mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
chore: Update to graphql 5.2.0 (#3410)
chore: Update to graphql 5.2.0, previous version was not loading dependencies anymore https://github.com/graphql/graphiql/tree/graphiql%405.2.0/examples/graphiql-cdn Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
@@ -1,67 +1,92 @@
|
||||
<!--
|
||||
* Copyright (c) 2021 GraphQL Contributors
|
||||
* Copyright (c) 2025 GraphQL Contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>zot GraphQL playground</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GraphiQL 5 with React 19 and GraphiQL Explorer</title>
|
||||
<style>
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#graphiql {
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
}
|
||||
|
||||
.loading {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 4rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="https://esm.sh/graphiql/dist/style.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://esm.sh/@graphiql/plugin-explorer/dist/style.css"
|
||||
/>
|
||||
<!--
|
||||
This GraphiQL example depends on Promise and fetch, which are available in
|
||||
modern browsers, but can be "polyfilled" for older browsers.
|
||||
GraphiQL itself depends on React DOM.
|
||||
If you do not want to rely on a CDN, you can host these files locally or
|
||||
include them directly in your favored resource bundler.
|
||||
* Note:
|
||||
* The ?standalone flag bundles the module along with all of its `dependencies`, excluding `peerDependencies`, into a single JavaScript file.
|
||||
* `@emotion/is-prop-valid` is a shim to remove the console error ` module "@emotion /is-prop-valid" not found`. Upstream issue: https://github.com/motiondivision/motion/issues/3126
|
||||
-->
|
||||
<script
|
||||
crossorigin
|
||||
src="https://unpkg.com/react@17/umd/react.development.js"
|
||||
></script>
|
||||
<script
|
||||
crossorigin
|
||||
src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"
|
||||
></script>
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"react": "https://esm.sh/react@19.1.0",
|
||||
"react/": "https://esm.sh/react@19.1.0/",
|
||||
|
||||
<!--
|
||||
These two files can be found in the npm module, however you may wish to
|
||||
copy them directly into your environment, or perhaps include them in your
|
||||
favored resource bundler.
|
||||
-->
|
||||
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
|
||||
</head>
|
||||
"react-dom": "https://esm.sh/react-dom@19.1.0",
|
||||
"react-dom/": "https://esm.sh/react-dom@19.1.0/",
|
||||
|
||||
<body>
|
||||
<div id="graphiql">Loading...</div>
|
||||
<script
|
||||
src="https://unpkg.com/graphiql/graphiql.min.js"
|
||||
type="application/javascript"
|
||||
></script>
|
||||
<script>
|
||||
ReactDOM.render(
|
||||
React.createElement(GraphiQL, {
|
||||
fetcher: GraphiQL.createFetcher({
|
||||
url: {{.Target}},
|
||||
}),
|
||||
defaultEditorToolsVisibility: true,
|
||||
}),
|
||||
document.getElementById('graphiql'),
|
||||
);
|
||||
"graphiql": "https://esm.sh/graphiql?standalone&external=react,react-dom,@graphiql/react,graphql",
|
||||
"graphiql/": "https://esm.sh/graphiql/",
|
||||
"@graphiql/plugin-explorer": "https://esm.sh/@graphiql/plugin-explorer?standalone&external=react,@graphiql/react,graphql",
|
||||
"@graphiql/react": "https://esm.sh/@graphiql/react?standalone&external=react,react-dom,graphql,@graphiql/toolkit,@emotion/is-prop-valid",
|
||||
|
||||
"@graphiql/toolkit": "https://esm.sh/@graphiql/toolkit?standalone&external=graphql",
|
||||
"graphql": "https://esm.sh/graphql@16.11.0",
|
||||
"@emotion/is-prop-valid": "data:text/javascript,"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="module">
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { GraphiQL, HISTORY_PLUGIN } from 'graphiql';
|
||||
import { createGraphiQLFetcher } from '@graphiql/toolkit';
|
||||
import { explorerPlugin } from '@graphiql/plugin-explorer';
|
||||
import 'graphiql/setup-workers/esm.sh';
|
||||
|
||||
const fetcher = createGraphiQLFetcher({
|
||||
url: 'https://countries.trevorblades.com',
|
||||
});
|
||||
const plugins = [HISTORY_PLUGIN, explorerPlugin()];
|
||||
|
||||
function App() {
|
||||
return React.createElement(GraphiQL, {
|
||||
fetcher,
|
||||
plugins,
|
||||
defaultEditorToolsVisibility: true,
|
||||
});
|
||||
}
|
||||
|
||||
const container = document.getElementById('graphiql');
|
||||
const root = ReactDOM.createRoot(container);
|
||||
root.render(React.createElement(App));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="graphiql">
|
||||
<div class="loading">Loading…</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user