mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
73 lines
30 KiB
Diff
73 lines
30 KiB
Diff
|
|
diff --git a/dist/index.cjs.js b/dist/index.cjs.js
|
||
|
|
index 83792f244cbe04b8ca3ca0057e8d57b30231672f..00ec78a6e7fc1a218aae794fdb01d7d94da20428 100644
|
||
|
|
--- a/dist/index.cjs.js
|
||
|
|
+++ b/dist/index.cjs.js
|
||
|
|
@@ -156,5 +156,5 @@ In some cases, you need to provide options to alter GraphQL's execution behavior
|
||
|
|
# Auto Complete: Ctrl-Space (or just start typing)
|
||
|
|
#
|
||
|
|
|
||
|
|
-`;var Pue=Object.defineProperty,Oue=c((e,t)=>Pue(e,"name",{value:t,configurable:!0}),"__name$a");function Di(n){var r=n,{isHidden:e}=r,t=B(r,["isHidden"]);const{headerEditor:o}=je({nonNull:!0,caller:Di}),i=an(t,Di);return m.useEffect(()=>{e||o==null||o.refresh()},[o,e]),w.jsx("div",{className:Ie("graphiql-editor",e&&"hidden"),ref:i})}c(Di,"HeaderEditor");Oue(Di,"HeaderEditor");var Lue=Object.defineProperty,_a=c((e,t)=>Lue(e,"name",{value:t,configurable:!0}),"__name$9");function zr(e){var l;const[t,n]=m.useState({width:null,height:null}),[r,o]=m.useState(null),i=m.useRef(null),a=(l=Wl(e.token))==null?void 0:l.href;m.useEffect(()=>{if(!!i.current){if(!a){n({width:null,height:null}),o(null);return}fetch(a,{method:"HEAD"}).then(u=>{o(u.headers.get("Content-Type"))}).catch(()=>{o(null)})}},[a]);const s=t.width!==null&&t.height!==null?w.jsxs("div",{children:[t.width,"x",t.height,r===null?null:" "+r]}):null;return w.jsxs("div",{children:[w.jsx("img",{onLoad:()=>{var u,d,f,p;n({width:(d=(u=i.current)==null?void 0:u.naturalWidth)!=null?d:null,height:(p=(f=i.current)==null?void 0:f.naturalHeight)!=null?p:null})},ref:i,src:a}),s]})}c(zr,"ImagePreview");_a(zr,"ImagePreview");zr.shouldRender=_a(c(function(t){const n=Wl(t);return n?C0(n):!1},"shouldRender"),"shouldRender");function Wl(e){if(e.type!=="string")return;const t=e.string.slice(1).slice(0,-1).trim();try{const{location:n}=window;return new URL(t,n.protocol+"//"+n.host)}catch{return}}c(Wl,"tokenToURL");_a(Wl,"tokenToURL");function C0(e){return/(bmp|gif|jpeg|jpg|png|svg)$/.test(e.pathname)}c(C0,"isImageURL");_a(C0,"isImageURL");var $ue=Object.defineProperty,Fue=c((e,t)=>$ue(e,"name",{value:t,configurable:!0}),"__name$8");function Yl(e){const t=Ct(e,Yl);return w.jsx("div",{className:"graphiql-editor",ref:t})}c(Yl,"QueryEditor");Fue(Yl,"QueryEditor");var jue=Object.defineProperty,que=c((e,t)=>jue(e,"name",{value:t,configurable:!0}),"__name$7");function Hr({responseTooltip:e,editorTheme:t=fa,keyMap:n=pa}={},r){const{fetchError:o,validationErrors:i}=xt({nonNull:!0,caller:r||Hr}),{initialResponse:a,responseEditor:s,setResponseEditor:l}=je({nonNull:!0,caller:r||Hr}),u=m.useRef(null),d=m.useRef(e);return m.useEffect(()=>{d.current=e},[e]),m.useEffect(()=>{let f=!0;return Zn([Promise.resolve().then(function(){return require("./foldgutter.cjs.js")}).then(function(p){return p.foldgutter}),Promise.resolve().then(function(){return require("./brace-fold.cjs.js")}).then(function(p){return p.braceFold}),Promise.resolve().then(function(){return require("./dialog.cjs.js")}).then(function(p){return p.dialog}),Promise.resolve().then(function(){return require("./search.cjs.js")}).then(function(p){return p.search}),Promise.resolve().then(function(){return require("./searchcursor.cjs.js")}).then(function(p){return p.searchcursor}),Promise.resolve().then(function(){return require("./jump-to-line.cjs.js")}).then(function(p){return p.jumpToLine}),Promise.resolve().then(function(){return require("./sublime.cjs.js")}).then(function(p){return p.sublime}),Promise.resolve().then(function(){return require("./mode.cjs2.js")}),Promise.resolve().then(function(){return require("./info-addon.cjs.js")})],{useCommonAddons:!1}).then(p=>{if(!f)return;const h=document.createElement("div");p.registerHelper("info","graphql-results",(b,y,x,E)=>{const C=[],_=d.current;return _&&C.push(w.jsx(_,{pos:E,token:b})),zr.shouldRender(b)&&C.push(w.jsx(zr,{token:b},"image-preview")),C.length?(ss.default.render(C,h),h):(ss.default.unmountComponentAtNode(h),null)});const v=u.current;if(!v)return;const g=p(v,{value:a,lineWrapping:!0,readOnly:!0,theme:t,mode:"graphql-results",foldGutter:!0,gutters:["CodeMirror-foldgutter"],info:!0,extraKeys:ha});l(g)}),()=>{f=!1}},[t,a,l]),fo(s,"keyMap",n),m.useEffect(()=>{o&&(s==null||s.setValue(o)),i.length>0&&(s==null||s.setValue(yr(i)))},[s,o,i]),u}c(Hr,"useResponseEditor");que(Hr,"useResponseEditor");var Vue=Object.defineProperty,Bue=c((e,t)=>Vue(e,"name",{value:t,configurable:!0}),"__name$6");function Ql(e){const t=Hr(e,Ql);return w.jsx("section",{className:"result-window","aria-label":"Result
|
||
|
|
+`;var Pue=Object.defineProperty,Oue=c((e,t)=>Pue(e,"name",{value:t,configurable:!0}),"__name$a");function Di(n){var r=n,{isHidden:e}=r,t=B(r,["isHidden"]);const{headerEditor:o}=je({nonNull:!0,caller:Di}),i=an(t,Di);return m.useEffect(()=>{e||o==null||o.refresh()},[o,e]),w.jsx("div",{className:Ie("graphiql-editor",e&&"hidden"),ref:i})}c(Di,"HeaderEditor");Oue(Di,"HeaderEditor");var Lue=Object.defineProperty,_a=c((e,t)=>Lue(e,"name",{value:t,configurable:!0}),"__name$9");function zr(e){var l;const[t,n]=m.useState({width:null,height:null}),[r,o]=m.useState(null),i=m.useRef(null),a=(l=Wl(e.token))==null?void 0:l.href;m.useEffect(()=>{if(!!i.current){if(!a){n({width:null,height:null}),o(null);return}fetch(a,{method:"HEAD"}).then(u=>{o(u.headers.get("Content-Type"))}).catch(()=>{o(null)})}},[a]);const s=t.width!==null&&t.height!==null?w.jsxs("div",{children:[t.width,"x",t.height,r===null?null:" "+r]}):null;return w.jsxs("div",{children:[w.jsx("img",{onLoad:()=>{var u,d,f,p;n({width:(d=(u=i.current)==null?void 0:u.naturalWidth)!=null?d:null,height:(p=(f=i.current)==null?void 0:f.naturalHeight)!=null?p:null})},ref:i,src:a}),s]})}c(zr,"ImagePreview");_a(zr,"ImagePreview");zr.shouldRender=_a(c(function(t){const n=Wl(t);return n?C0(n):!1},"shouldRender"),"shouldRender");function Wl(e){if(e.type!=="string")return;const t=e.string.slice(1).slice(0,-1).trim();try{const{location:n}=window;return new URL(t,n.protocol+"//"+n.host)}catch{return}}c(Wl,"tokenToURL");_a(Wl,"tokenToURL");function C0(e){return/(bmp|gif|jpeg|jpg|png|svg)$/.test(e.pathname)}c(C0,"isImageURL");_a(C0,"isImageURL");var $ue=Object.defineProperty,Fue=c((e,t)=>$ue(e,"name",{value:t,configurable:!0}),"__name$8");function Yl(e){const t=Ct(e,Yl);return w.jsx("div",{className:"graphiql-editor",ref:t})}c(Yl,"QueryEditor");Fue(Yl,"QueryEditor");var jue=Object.defineProperty,que=c((e,t)=>jue(e,"name",{value:t,configurable:!0}),"__name$7");function Hr({responseTooltip:e,editorTheme:t=fa,keyMap:n=pa}={},r){const{fetchError:o,validationErrors:i}=xt({nonNull:!0,caller:r||Hr}),{initialResponse:a,responseEditor:s,setResponseEditor:l}=je({nonNull:!0,caller:r||Hr}),u=m.useRef(null),d=m.useRef(e);return m.useEffect(()=>{d.current=e},[e]),m.useEffect(()=>{let f=!0;return Zn([Promise.resolve().then(function(){return require("./foldgutter.cjs.js")}).then(function(p){return p.foldgutter}),Promise.resolve().then(function(){return require("./brace-fold.cjs.js")}).then(function(p){return p.braceFold}),Promise.resolve().then(function(){return require("./dialog.cjs.js")}).then(function(p){return p.dialog}),Promise.resolve().then(function(){return require("./search.cjs.js")}).then(function(p){return p.search}),Promise.resolve().then(function(){return require("./searchcursor.cjs.js")}).then(function(p){return p.searchcursor}),Promise.resolve().then(function(){return require("./jump-to-line.cjs.js")}).then(function(p){return p.jumpToLine}),Promise.resolve().then(function(){return require("./sublime.cjs.js")}).then(function(p){return p.sublime}),Promise.resolve().then(function(){return require("./mode.cjs2.js")}),Promise.resolve().then(function(){return require("./info-addon.cjs.js")})],{useCommonAddons:!1}).then(p=>{if(!f)return;const h=document.createElement("div");p.registerHelper("info","graphql-results",(b,y,x,E)=>{const C=[],_=d.current;return _&&C.push(w.jsx(_,{pos:E,token:b})),zr.shouldRender(b)&&C.push(w.jsx(zr,{token:b},"image-preview")),C.length?(ss.default.render(C,h),h):(ss.default.unmountComponentAtNode(h),null)});const v=u.current;if(!v)return;const g=p(v,{value:a,lineWrapping:!0,readOnly:!0,theme:t,mode:"graphql-results",foldGutter:!0,gutters:["CodeMirror-foldgutter"],info:!0,extraKeys:ha});l(g)}),()=>{f=!1}},[t,a,l]),fo(s,"keyMap",n),m.useEffect(()=>{o&&(s==null||s.setValue(o)),i.length>0&&(s==null||s.setValue(yr(i)))},[s,o,i]),u}c(Hr,"useResponseEditor");que(Hr,"useResponseEditor");var Vue=Object.defineProperty,Bue=c((e,t)=>Vue(e,"name",{value:t,configurable:!0}),"__name$6");function Ql(e){const t=Hr(e,Ql);return w.jsx("section",{className:"result-window","aria-label":"Result
|
||
|
|
//# sourceMappingURL=index.cjs.js.map
|
||
|
|
diff --git a/dist/index.es.js b/dist/index.es.js
|
||
|
|
index 71e21cb576dc761bf0dd0d3d2ad1014dba653f35..652d56f110456f3d9a00745abc57f4163cc8e778 100644
|
||
|
|
--- a/dist/index.es.js
|
||
|
|
+++ b/dist/index.es.js
|
||
|
|
@@ -32456,7 +32456,7 @@ function useTheme() {
|
||
|
|
const stored = storageContext.get(STORAGE_KEY);
|
||
|
|
switch (stored) {
|
||
|
|
case "light":
|
||
|
|
- return "light";
|
||
|
|
+ return "dark";
|
||
|
|
case "dark":
|
||
|
|
return "dark";
|
||
|
|
default:
|
||
|
|
@@ -32472,12 +32472,12 @@ function useTheme() {
|
||
|
|
}
|
||
|
|
document.body.classList.remove("graphiql-light", "graphiql-dark");
|
||
|
|
if (theme) {
|
||
|
|
- document.body.classList.add(`graphiql-${theme}`);
|
||
|
|
+ document.body.classList.add(`graphiql-dark`);
|
||
|
|
}
|
||
|
|
}, [theme]);
|
||
|
|
- const setTheme = useCallback((newTheme) => {
|
||
|
|
- storageContext == null ? void 0 : storageContext.set(STORAGE_KEY, newTheme || "");
|
||
|
|
- setThemeInternal(newTheme);
|
||
|
|
+ const setTheme = useCallback((_) => {
|
||
|
|
+ storageContext == null ? void 0 : storageContext.set(STORAGE_KEY, 'dark');
|
||
|
|
+ setThemeInternal('dark');
|
||
|
|
}, [storageContext]);
|
||
|
|
return useMemo(() => ({ theme, setTheme }), [theme, setTheme]);
|
||
|
|
}
|
||
|
|
diff --git a/src/theme.ts b/src/theme.ts
|
||
|
|
index 5dc3b8ea6696cb49f6f881c8876c02c47066967d..0bda8c8defb225950347d8350e3f781fad3214a4 100644
|
||
|
|
--- a/src/theme.ts
|
||
|
|
+++ b/src/theme.ts
|
||
|
|
@@ -18,7 +18,7 @@ export function useTheme() {
|
||
|
|
const stored = storageContext.get(STORAGE_KEY);
|
||
|
|
switch (stored) {
|
||
|
|
case 'light':
|
||
|
|
- return 'light';
|
||
|
|
+ return 'dark';
|
||
|
|
case 'dark':
|
||
|
|
return 'dark';
|
||
|
|
default:
|
||
|
|
@@ -37,14 +37,14 @@ export function useTheme() {
|
||
|
|
|
||
|
|
document.body.classList.remove('graphiql-light', 'graphiql-dark');
|
||
|
|
if (theme) {
|
||
|
|
- document.body.classList.add(`graphiql-${theme}`);
|
||
|
|
+ document.body.classList.add(`graphiql-dark`);
|
||
|
|
}
|
||
|
|
}, [theme]);
|
||
|
|
|
||
|
|
const setTheme = useCallback(
|
||
|
|
- (newTheme: Theme) => {
|
||
|
|
- storageContext?.set(STORAGE_KEY, newTheme || '');
|
||
|
|
- setThemeInternal(newTheme);
|
||
|
|
+ (_: Theme) => {
|
||
|
|
+ storageContext?.set(STORAGE_KEY, 'dark');
|
||
|
|
+ setThemeInternal('dark');
|
||
|
|
},
|
||
|
|
[storageContext],
|
||
|
|
);
|