@graphiql/react
Advanced tools
Comparing version 0.23.0-canary-49f80902.0 to 0.23.0-canary-5b09c3aa.0
@@ -1,2 +0,2 @@ | ||
"use strict";const s=require("./codemirror.cjs.js");require("./show-hint.cjs.js");const c=require("graphql-language-service");require("./codemirror.cjs2.js");s.CodeMirror.registerHelper("hint","graphql",(r,a)=>{const{schema:i,externalFragments:u}=a;if(!i)return;const n=r.getCursor(),t=r.getTokenAt(n),l=t.type!==null&&/"|\w/.test(t.string[0])?t.start:t.end,g=new c.Position(n.line,l),e={list:c.getAutocompleteSuggestions(i,r.getValue(),g,t,u).map(o=>({text:o.label,type:o.type,description:o.documentation,isDeprecated:o.isDeprecated,deprecationReason:o.deprecationReason})),from:{line:n.line,ch:l},to:{line:n.line,ch:t.end}};return e!=null&&e.list&&e.list.length>0&&(e.from=s.CodeMirror.Pos(e.from.line,e.from.ch),e.to=s.CodeMirror.Pos(e.to.line,e.to.ch),s.CodeMirror.signal(r,"hasCompletion",r,e,t)),e}); | ||
"use strict";const s=require("./codemirror.cjs.js");require("./show-hint.cjs.js");const c=require("graphql-language-service");require("./codemirror.cjs2.js");s.CodeMirror.registerHelper("hint","graphql",(o,u)=>{const{schema:l,externalFragments:p,autocompleteOptions:g}=u;if(!l)return;const n=o.getCursor(),t=o.getTokenAt(n),a=t.type!==null&&/"|\w/.test(t.string[0])?t.start:t.end,d=new c.Position(n.line,a),e={list:c.getAutocompleteSuggestions(l,o.getValue(),d,t,p,g).map(r=>{var i;return{text:(i=r==null?void 0:r.rawInsert)!==null&&i!==void 0?i:r.label,type:r.type,description:r.documentation,isDeprecated:r.isDeprecated,deprecationReason:r.deprecationReason}}),from:{line:n.line,ch:a},to:{line:n.line,ch:t.end}};return e!=null&&e.list&&e.list.length>0&&(e.from=s.CodeMirror.Pos(e.from.line,e.from.ch),e.to=s.CodeMirror.Pos(e.to.line,e.to.ch),s.CodeMirror.signal(o,"hasCompletion",o,e,t)),e}); | ||
//# sourceMappingURL=hint.cjs.js.map |
import { C as r } from "./codemirror.es.js"; | ||
import "./show-hint.es.js"; | ||
import { Position as u, getAutocompleteSuggestions as g } from "graphql-language-service"; | ||
import { Position as d, getAutocompleteSuggestions as m } from "graphql-language-service"; | ||
import "./codemirror.es2.js"; | ||
r.registerHelper("hint", "graphql", (o, a) => { | ||
const { schema: i, externalFragments: c } = a; | ||
r.registerHelper("hint", "graphql", (n, c) => { | ||
const { schema: i, externalFragments: p, autocompleteOptions: u } = c; | ||
if (!i) | ||
return; | ||
const s = o.getCursor(), e = o.getTokenAt(s), l = e.type !== null && /"|\w/.test(e.string[0]) ? e.start : e.end, p = new u(s.line, l), t = { | ||
list: g(i, o.getValue(), p, e, c).map((n) => ({ | ||
text: n.label, | ||
type: n.type, | ||
description: n.documentation, | ||
isDeprecated: n.isDeprecated, | ||
deprecationReason: n.deprecationReason | ||
})), | ||
from: { line: s.line, ch: l }, | ||
to: { line: s.line, ch: e.end } | ||
const s = n.getCursor(), o = n.getTokenAt(s), a = o.type !== null && /"|\w/.test(o.string[0]) ? o.start : o.end, g = new d(s.line, a), t = { | ||
list: m(i, n.getValue(), g, o, p, u).map((e) => { | ||
var l; | ||
return { | ||
text: (l = e == null ? void 0 : e.rawInsert) !== null && l !== void 0 ? l : e.label, | ||
type: e.type, | ||
description: e.documentation, | ||
isDeprecated: e.isDeprecated, | ||
deprecationReason: e.deprecationReason | ||
}; | ||
}), | ||
from: { line: s.line, ch: a }, | ||
to: { line: s.line, ch: o.end } | ||
}; | ||
return t != null && t.list && t.list.length > 0 && (t.from = r.Pos(t.from.line, t.from.ch), t.to = r.Pos(t.to.line, t.to.ch), r.signal(o, "hasCompletion", o, t, e)), t; | ||
return t != null && t.list && t.list.length > 0 && (t.from = r.Pos(t.from.line, t.from.ch), t.to = r.Pos(t.to.line, t.to.ch), r.signal(n, "hasCompletion", n, t, o)), t; | ||
}); | ||
//# sourceMappingURL=hint.es.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var v=Object.defineProperty;var l=(a,e)=>v(a,"name",{value:e,configurable:!0});const s=require("graphql"),D=require("./codemirror.cjs.js"),m=require("./SchemaReference.cjs.js");require("./info-addon.cjs.js");require("./codemirror.cjs2.js");require("./forEachState.cjs.js");D.CodeMirror.registerHelper("info","graphql",(a,e)=>{if(!e.schema||!a.state)return;const{kind:c,step:n}=a.state,r=m.getTypeInfo(e.schema,a.state);if(c==="Field"&&n===0&&r.fieldDef||c==="AliasedField"&&n===2&&r.fieldDef){const i=document.createElement("div");i.className="CodeMirror-info-header",E(i,r,e);const d=document.createElement("div");return d.append(i),o(d,e,r.fieldDef),d}if(c==="Directive"&&n===1&&r.directiveDef){const i=document.createElement("div");i.className="CodeMirror-info-header",h(i,r,e);const d=document.createElement("div");return d.append(i),o(d,e,r.directiveDef),d}if(c==="Argument"&&n===0&&r.argDef){const i=document.createElement("div");i.className="CodeMirror-info-header",T(i,r,e);const d=document.createElement("div");return d.append(i),o(d,e,r.argDef),d}if(c==="EnumValue"&&r.enumValue&&r.enumValue.description){const i=document.createElement("div");i.className="CodeMirror-info-header",g(i,r,e);const d=document.createElement("div");return d.append(i),o(d,e,r.enumValue),d}if(c==="NamedType"&&r.type&&r.type.description){const i=document.createElement("div");i.className="CodeMirror-info-header",u(i,r,e,r.type);const d=document.createElement("div");return d.append(i),o(d,e,r.type),d}});function E(a,e,c){N(a,e,c),p(a,e,c,e.type)}l(E,"renderField");function N(a,e,c){var n;const r=((n=e.fieldDef)===null||n===void 0?void 0:n.name)||"";t(a,r,"field-name",c,m.getFieldReference(e))}l(N,"renderQualifiedField");function h(a,e,c){var n;const r="@"+(((n=e.directiveDef)===null||n===void 0?void 0:n.name)||"");t(a,r,"directive-name",c,m.getDirectiveReference(e))}l(h,"renderDirective");function T(a,e,c){var n;const r=((n=e.argDef)===null||n===void 0?void 0:n.name)||"";t(a,r,"arg-name",c,m.getArgumentReference(e)),p(a,e,c,e.inputType)}l(T,"renderArg");function g(a,e,c){var n;const r=((n=e.enumValue)===null||n===void 0?void 0:n.name)||"";u(a,e,c,e.inputType),t(a,"."),t(a,r,"enum-value",c,m.getEnumValueReference(e))}l(g,"renderEnumValue");function p(a,e,c,n){const r=document.createElement("span");r.className="type-name-pill",n instanceof s.GraphQLNonNull?(u(r,e,c,n.ofType),t(r,"!")):n instanceof s.GraphQLList?(t(r,"["),u(r,e,c,n.ofType),t(r,"]")):t(r,(n==null?void 0:n.name)||"","type-name",c,m.getTypeReference(e,n)),a.append(r)}l(p,"renderTypeAnnotation");function u(a,e,c,n){n instanceof s.GraphQLNonNull?(u(a,e,c,n.ofType),t(a,"!")):n instanceof s.GraphQLList?(t(a,"["),u(a,e,c,n.ofType),t(a,"]")):t(a,(n==null?void 0:n.name)||"","type-name",c,m.getTypeReference(e,n))}l(u,"renderType");function o(a,e,c){const{description:n}=c;if(n){const r=document.createElement("div");r.className="info-description",e.renderDescription?r.innerHTML=e.renderDescription(n):r.append(document.createTextNode(n)),a.append(r)}L(a,e,c)}l(o,"renderDescription");function L(a,e,c){const n=c.deprecationReason;if(n){const r=document.createElement("div");r.className="info-deprecation",a.append(r);const i=document.createElement("span");i.className="info-deprecation-label",i.append(document.createTextNode("Deprecated")),r.append(i);const d=document.createElement("div");d.className="info-deprecation-reason",e.renderDescription?d.innerHTML=e.renderDescription(n):d.append(document.createTextNode(n)),r.append(d)}}l(L,"renderDeprecation");function t(a,e,c="",n={onClick:null},r=null){if(c){const{onClick:i}=n;let d;i?(d=document.createElement("a"),d.href="javascript:void 0",d.addEventListener("click",f=>{f.preventDefault(),i(r,f)})):d=document.createElement("span"),d.className=c,d.append(document.createTextNode(e)),a.append(d)}else a.append(document.createTextNode(e))}l(t,"text"); | ||
"use strict";var v=Object.defineProperty;var m=(r,e)=>v(r,"name",{value:e,configurable:!0});const f=require("graphql"),D=require("./codemirror.cjs.js"),u=require("./SchemaReference.cjs.js");require("./info-addon.cjs.js");require("./codemirror.cjs2.js");require("./forEachState.cjs.js");D.CodeMirror.registerHelper("info","graphql",(r,e)=>{var c;if(!e.schema||!r.state)return;const{kind:n,step:a}=r.state,i=u.getTypeInfo(e.schema,r.state);if(n==="Field"&&a===0&&i.fieldDef||n==="AliasedField"&&a===2&&i.fieldDef||n==="ObjectField"&&a===0&&i.fieldDef){const d=document.createElement("div");d.className="CodeMirror-info-header",E(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.fieldDef),t}if(n==="Directive"&&a===1&&i.directiveDef){const d=document.createElement("div");d.className="CodeMirror-info-header",h(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.directiveDef),t}if(n==="Argument"&&a===0&&i.argDef){const d=document.createElement("div");d.className="CodeMirror-info-header",T(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.argDef),t}if(n==="EnumValue"&&(!((c=i.enumValue)===null||c===void 0)&&c.description)){const d=document.createElement("div");d.className="CodeMirror-info-header",g(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.enumValue),t}if(n==="NamedType"&&i.type&&i.type.description){const d=document.createElement("div");d.className="CodeMirror-info-header",o(d,i,e,i.type);const t=document.createElement("div");return t.append(d),s(t,e,i.type),t}});function E(r,e,c){N(r,e,c),p(r,e,c,e.type)}m(E,"renderField");function N(r,e,c){var n;const a=((n=e.fieldDef)===null||n===void 0?void 0:n.name)||"";l(r,a,"field-name",c,u.getFieldReference(e))}m(N,"renderQualifiedField");function h(r,e,c){var n;const a="@"+(((n=e.directiveDef)===null||n===void 0?void 0:n.name)||"");l(r,a,"directive-name",c,u.getDirectiveReference(e))}m(h,"renderDirective");function T(r,e,c){var n;const a=((n=e.argDef)===null||n===void 0?void 0:n.name)||"";l(r,a,"arg-name",c,u.getArgumentReference(e)),p(r,e,c,e.inputType)}m(T,"renderArg");function g(r,e,c){var n;const a=((n=e.enumValue)===null||n===void 0?void 0:n.name)||"";o(r,e,c,e.inputType),l(r,"."),l(r,a,"enum-value",c,u.getEnumValueReference(e))}m(g,"renderEnumValue");function p(r,e,c,n){const a=document.createElement("span");a.className="type-name-pill",n instanceof f.GraphQLNonNull?(o(a,e,c,n.ofType),l(a,"!")):n instanceof f.GraphQLList?(l(a,"["),o(a,e,c,n.ofType),l(a,"]")):l(a,(n==null?void 0:n.name)||"","type-name",c,u.getTypeReference(e,n)),r.append(a)}m(p,"renderTypeAnnotation");function o(r,e,c,n){n instanceof f.GraphQLNonNull?(o(r,e,c,n.ofType),l(r,"!")):n instanceof f.GraphQLList?(l(r,"["),o(r,e,c,n.ofType),l(r,"]")):l(r,(n==null?void 0:n.name)||"","type-name",c,u.getTypeReference(e,n))}m(o,"renderType");function s(r,e,c){const{description:n}=c;if(n){const a=document.createElement("div");a.className="info-description",e.renderDescription?a.innerHTML=e.renderDescription(n):a.append(document.createTextNode(n)),r.append(a)}L(r,e,c)}m(s,"renderDescription");function L(r,e,c){const n=c.deprecationReason;if(n){const a=document.createElement("div");a.className="info-deprecation",r.append(a);const i=document.createElement("span");i.className="info-deprecation-label",i.append(document.createTextNode("Deprecated")),a.append(i);const d=document.createElement("div");d.className="info-deprecation-reason",e.renderDescription?d.innerHTML=e.renderDescription(n):d.append(document.createTextNode(n)),a.append(d)}}m(L,"renderDeprecation");function l(r,e,c="",n={onClick:null},a=null){if(c){const{onClick:i}=n;let d;i?(d=document.createElement("a"),d.href="javascript:void 0",d.addEventListener("click",t=>{t.preventDefault(),i(a,t)})):d=document.createElement("span"),d.className=c,d.append(document.createTextNode(e)),r.append(d)}else r.append(document.createTextNode(e))}m(l,"text"); | ||
//# sourceMappingURL=info.cjs.js.map |
var D = Object.defineProperty; | ||
var l = (a, e) => D(a, "name", { value: e, configurable: !0 }); | ||
var m = (r, e) => D(r, "name", { value: e, configurable: !0 }); | ||
import { GraphQLNonNull as u, GraphQLList as f } from "graphql"; | ||
@@ -9,106 +9,107 @@ import { C as E } from "./codemirror.es.js"; | ||
import "./forEachState.es.js"; | ||
E.registerHelper("info", "graphql", (a, e) => { | ||
if (!e.schema || !a.state) | ||
E.registerHelper("info", "graphql", (r, e) => { | ||
var d; | ||
if (!e.schema || !r.state) | ||
return; | ||
const { kind: d, step: n } = a.state, r = N(e.schema, a.state); | ||
if (d === "Field" && n === 0 && r.fieldDef || d === "AliasedField" && n === 2 && r.fieldDef) { | ||
const i = document.createElement("div"); | ||
i.className = "CodeMirror-info-header", M(i, r, e); | ||
const { kind: n, step: a } = r.state, i = N(e.schema, r.state); | ||
if (n === "Field" && a === 0 && i.fieldDef || n === "AliasedField" && a === 2 && i.fieldDef || n === "ObjectField" && a === 0 && i.fieldDef) { | ||
const c = document.createElement("div"); | ||
return c.append(i), o(c, e, r.fieldDef), c; | ||
c.className = "CodeMirror-info-header", M(c, i, e); | ||
const t = document.createElement("div"); | ||
return t.append(c), s(t, e, i.fieldDef), t; | ||
} | ||
if (d === "Directive" && n === 1 && r.directiveDef) { | ||
const i = document.createElement("div"); | ||
i.className = "CodeMirror-info-header", V(i, r, e); | ||
if (n === "Directive" && a === 1 && i.directiveDef) { | ||
const c = document.createElement("div"); | ||
return c.append(i), o(c, e, r.directiveDef), c; | ||
c.className = "CodeMirror-info-header", x(c, i, e); | ||
const t = document.createElement("div"); | ||
return t.append(c), s(t, e, i.directiveDef), t; | ||
} | ||
if (d === "Argument" && n === 0 && r.argDef) { | ||
const i = document.createElement("div"); | ||
i.className = "CodeMirror-info-header", x(i, r, e); | ||
if (n === "Argument" && a === 0 && i.argDef) { | ||
const c = document.createElement("div"); | ||
return c.append(i), o(c, e, r.argDef), c; | ||
c.className = "CodeMirror-info-header", F(c, i, e); | ||
const t = document.createElement("div"); | ||
return t.append(c), s(t, e, i.argDef), t; | ||
} | ||
if (d === "EnumValue" && r.enumValue && r.enumValue.description) { | ||
const i = document.createElement("div"); | ||
i.className = "CodeMirror-info-header", L(i, r, e); | ||
if (n === "EnumValue" && (!((d = i.enumValue) === null || d === void 0) && d.description)) { | ||
const c = document.createElement("div"); | ||
return c.append(i), o(c, e, r.enumValue), c; | ||
c.className = "CodeMirror-info-header", L(c, i, e); | ||
const t = document.createElement("div"); | ||
return t.append(c), s(t, e, i.enumValue), t; | ||
} | ||
if (d === "NamedType" && r.type && r.type.description) { | ||
const i = document.createElement("div"); | ||
i.className = "CodeMirror-info-header", m(i, r, e, r.type); | ||
if (n === "NamedType" && i.type && i.type.description) { | ||
const c = document.createElement("div"); | ||
return c.append(i), o(c, e, r.type), c; | ||
c.className = "CodeMirror-info-header", o(c, i, e, i.type); | ||
const t = document.createElement("div"); | ||
return t.append(c), s(t, e, i.type), t; | ||
} | ||
}); | ||
function M(a, e, d) { | ||
y(a, e, d), v(a, e, d, e.type); | ||
function M(r, e, d) { | ||
y(r, e, d), v(r, e, d, e.type); | ||
} | ||
l(M, "renderField"); | ||
function y(a, e, d) { | ||
m(M, "renderField"); | ||
function y(r, e, d) { | ||
var n; | ||
const r = ((n = e.fieldDef) === null || n === void 0 ? void 0 : n.name) || ""; | ||
t(a, r, "field-name", d, T(e)); | ||
const a = ((n = e.fieldDef) === null || n === void 0 ? void 0 : n.name) || ""; | ||
l(r, a, "field-name", d, T(e)); | ||
} | ||
l(y, "renderQualifiedField"); | ||
function V(a, e, d) { | ||
m(y, "renderQualifiedField"); | ||
function x(r, e, d) { | ||
var n; | ||
const r = "@" + (((n = e.directiveDef) === null || n === void 0 ? void 0 : n.name) || ""); | ||
t(a, r, "directive-name", d, g(e)); | ||
const a = "@" + (((n = e.directiveDef) === null || n === void 0 ? void 0 : n.name) || ""); | ||
l(r, a, "directive-name", d, g(e)); | ||
} | ||
l(V, "renderDirective"); | ||
function x(a, e, d) { | ||
m(x, "renderDirective"); | ||
function F(r, e, d) { | ||
var n; | ||
const r = ((n = e.argDef) === null || n === void 0 ? void 0 : n.name) || ""; | ||
t(a, r, "arg-name", d, h(e)), v(a, e, d, e.inputType); | ||
const a = ((n = e.argDef) === null || n === void 0 ? void 0 : n.name) || ""; | ||
l(r, a, "arg-name", d, h(e)), v(r, e, d, e.inputType); | ||
} | ||
l(x, "renderArg"); | ||
function L(a, e, d) { | ||
m(F, "renderArg"); | ||
function L(r, e, d) { | ||
var n; | ||
const r = ((n = e.enumValue) === null || n === void 0 ? void 0 : n.name) || ""; | ||
m(a, e, d, e.inputType), t(a, "."), t(a, r, "enum-value", d, C(e)); | ||
const a = ((n = e.enumValue) === null || n === void 0 ? void 0 : n.name) || ""; | ||
o(r, e, d, e.inputType), l(r, "."), l(r, a, "enum-value", d, C(e)); | ||
} | ||
l(L, "renderEnumValue"); | ||
function v(a, e, d, n) { | ||
const r = document.createElement("span"); | ||
r.className = "type-name-pill", n instanceof u ? (m(r, e, d, n.ofType), t(r, "!")) : n instanceof f ? (t(r, "["), m(r, e, d, n.ofType), t(r, "]")) : t(r, (n == null ? void 0 : n.name) || "", "type-name", d, p(e, n)), a.append(r); | ||
m(L, "renderEnumValue"); | ||
function v(r, e, d, n) { | ||
const a = document.createElement("span"); | ||
a.className = "type-name-pill", n instanceof u ? (o(a, e, d, n.ofType), l(a, "!")) : n instanceof f ? (l(a, "["), o(a, e, d, n.ofType), l(a, "]")) : l(a, (n == null ? void 0 : n.name) || "", "type-name", d, p(e, n)), r.append(a); | ||
} | ||
l(v, "renderTypeAnnotation"); | ||
function m(a, e, d, n) { | ||
n instanceof u ? (m(a, e, d, n.ofType), t(a, "!")) : n instanceof f ? (t(a, "["), m(a, e, d, n.ofType), t(a, "]")) : t(a, (n == null ? void 0 : n.name) || "", "type-name", d, p(e, n)); | ||
m(v, "renderTypeAnnotation"); | ||
function o(r, e, d, n) { | ||
n instanceof u ? (o(r, e, d, n.ofType), l(r, "!")) : n instanceof f ? (l(r, "["), o(r, e, d, n.ofType), l(r, "]")) : l(r, (n == null ? void 0 : n.name) || "", "type-name", d, p(e, n)); | ||
} | ||
l(m, "renderType"); | ||
function o(a, e, d) { | ||
m(o, "renderType"); | ||
function s(r, e, d) { | ||
const { description: n } = d; | ||
if (n) { | ||
const r = document.createElement("div"); | ||
r.className = "info-description", e.renderDescription ? r.innerHTML = e.renderDescription(n) : r.append(document.createTextNode(n)), a.append(r); | ||
const a = document.createElement("div"); | ||
a.className = "info-description", e.renderDescription ? a.innerHTML = e.renderDescription(n) : a.append(document.createTextNode(n)), r.append(a); | ||
} | ||
R(a, e, d); | ||
R(r, e, d); | ||
} | ||
l(o, "renderDescription"); | ||
function R(a, e, d) { | ||
m(s, "renderDescription"); | ||
function R(r, e, d) { | ||
const n = d.deprecationReason; | ||
if (n) { | ||
const r = document.createElement("div"); | ||
r.className = "info-deprecation", a.append(r); | ||
const a = document.createElement("div"); | ||
a.className = "info-deprecation", r.append(a); | ||
const i = document.createElement("span"); | ||
i.className = "info-deprecation-label", i.append(document.createTextNode("Deprecated")), r.append(i); | ||
i.className = "info-deprecation-label", i.append(document.createTextNode("Deprecated")), a.append(i); | ||
const c = document.createElement("div"); | ||
c.className = "info-deprecation-reason", e.renderDescription ? c.innerHTML = e.renderDescription(n) : c.append(document.createTextNode(n)), r.append(c); | ||
c.className = "info-deprecation-reason", e.renderDescription ? c.innerHTML = e.renderDescription(n) : c.append(document.createTextNode(n)), a.append(c); | ||
} | ||
} | ||
l(R, "renderDeprecation"); | ||
function t(a, e, d = "", n = { onClick: null }, r = null) { | ||
m(R, "renderDeprecation"); | ||
function l(r, e, d = "", n = { onClick: null }, a = null) { | ||
if (d) { | ||
const { onClick: i } = n; | ||
let c; | ||
i ? (c = document.createElement("a"), c.href = "javascript:void 0", c.addEventListener("click", (s) => { | ||
s.preventDefault(), i(r, s); | ||
})) : c = document.createElement("span"), c.className = d, c.append(document.createTextNode(e)), a.append(c); | ||
i ? (c = document.createElement("a"), c.href = "javascript:void 0", c.addEventListener("click", (t) => { | ||
t.preventDefault(), i(a, t); | ||
})) : c = document.createElement("span"), c.className = d, c.append(document.createTextNode(e)), r.append(c); | ||
} else | ||
a.append(document.createTextNode(e)); | ||
r.append(document.createTextNode(e)); | ||
} | ||
l(t, "text"); | ||
m(l, "text"); | ||
//# sourceMappingURL=info.es.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var c=Object.defineProperty;var s=(e,r)=>c(e,"name",{value:r,configurable:!0});const u=require("./codemirror.cjs.js"),d=require("./SchemaReference.cjs.js");require("./codemirror.cjs2.js");require("graphql");require("./forEachState.cjs.js");u.CodeMirror.defineOption("jump",!1,(e,r,n)=>{if(n&&n!==u.CodeMirror.Init){const t=e.state.jump.onMouseOver;u.CodeMirror.off(e.getWrapperElement(),"mouseover",t);const i=e.state.jump.onMouseOut;u.CodeMirror.off(e.getWrapperElement(),"mouseout",i),u.CodeMirror.off(document,"keydown",e.state.jump.onKeyDown),delete e.state.jump}if(r){const t=e.state.jump={options:r,onMouseOver:M.bind(null,e),onMouseOut:m.bind(null,e),onKeyDown:g.bind(null,e)};u.CodeMirror.on(e.getWrapperElement(),"mouseover",t.onMouseOver),u.CodeMirror.on(e.getWrapperElement(),"mouseout",t.onMouseOut),u.CodeMirror.on(document,"keydown",t.onKeyDown)}});function M(e,r){const n=r.target||r.srcElement;if(!(n instanceof HTMLElement)||(n==null?void 0:n.nodeName)!=="SPAN")return;const t=n.getBoundingClientRect(),i={left:(t.left+t.right)/2,top:(t.top+t.bottom)/2};e.state.jump.cursor=i,e.state.jump.isHoldingModifier&&l(e)}s(M,"onMouseOver");function m(e){if(!e.state.jump.isHoldingModifier&&e.state.jump.cursor){e.state.jump.cursor=null;return}e.state.jump.isHoldingModifier&&e.state.jump.marker&&p(e)}s(m,"onMouseOut");function g(e,r){if(e.state.jump.isHoldingModifier||!k(r.key))return;e.state.jump.isHoldingModifier=!0,e.state.jump.cursor&&l(e);const n=s(o=>{o.code===r.code&&(e.state.jump.isHoldingModifier=!1,e.state.jump.marker&&p(e),u.CodeMirror.off(document,"keyup",n),u.CodeMirror.off(document,"click",t),e.off("mousedown",i))},"onKeyUp"),t=s(o=>{const{destination:a,options:f}=e.state.jump;a&&f.onClick(a,o)},"onClick"),i=s((o,a)=>{e.state.jump.destination&&(a.codemirrorIgnore=!0)},"onMouseDown");u.CodeMirror.on(document,"keyup",n),u.CodeMirror.on(document,"click",t),e.on("mousedown",i)}s(g,"onKeyDown");const j=typeof navigator<"u"&&navigator&&navigator.appVersion.includes("Mac");function k(e){return e===(j?"Meta":"Control")}s(k,"isJumpModifier");function l(e){if(e.state.jump.marker)return;const{cursor:r,options:n}=e.state.jump,t=e.coordsChar(r),i=e.getTokenAt(t,!0),o=n.getDestination||e.getHelper(t,"jump");if(o){const a=o(i,n,e);if(a){const f=e.markText({line:t.line,ch:i.start},{line:t.line,ch:i.end},{className:"CodeMirror-jump-token"});e.state.jump.marker=f,e.state.jump.destination=a}}}s(l,"enableJumpMode");function p(e){const{marker:r}=e.state.jump;e.state.jump.marker=null,e.state.jump.destination=null,r.clear()}s(p,"disableJumpMode");u.CodeMirror.registerHelper("jump","graphql",(e,r)=>{if(!r.schema||!r.onClick||!e.state)return;const{state:n}=e,{kind:t,step:i}=n,o=d.getTypeInfo(r.schema,n);if(t==="Field"&&i===0&&o.fieldDef||t==="AliasedField"&&i===2&&o.fieldDef)return d.getFieldReference(o);if(t==="Directive"&&i===1&&o.directiveDef)return d.getDirectiveReference(o);if(t==="Argument"&&i===0&&o.argDef)return d.getArgumentReference(o);if(t==="EnumValue"&&o.enumValue)return d.getEnumValueReference(o);if(t==="NamedType"&&o.type)return d.getTypeReference(o)}); | ||
"use strict";var c=Object.defineProperty;var s=(e,r)=>c(e,"name",{value:r,configurable:!0});const u=require("./codemirror.cjs.js"),d=require("./SchemaReference.cjs.js");require("./codemirror.cjs2.js");require("graphql");require("./forEachState.cjs.js");u.CodeMirror.defineOption("jump",!1,(e,r,n)=>{if(n&&n!==u.CodeMirror.Init){const t=e.state.jump.onMouseOver;u.CodeMirror.off(e.getWrapperElement(),"mouseover",t);const i=e.state.jump.onMouseOut;u.CodeMirror.off(e.getWrapperElement(),"mouseout",i),u.CodeMirror.off(document,"keydown",e.state.jump.onKeyDown),delete e.state.jump}if(r){const t=e.state.jump={options:r,onMouseOver:M.bind(null,e),onMouseOut:g.bind(null,e),onKeyDown:m.bind(null,e)};u.CodeMirror.on(e.getWrapperElement(),"mouseover",t.onMouseOver),u.CodeMirror.on(e.getWrapperElement(),"mouseout",t.onMouseOut),u.CodeMirror.on(document,"keydown",t.onKeyDown)}});function M(e,r){const n=r.target||r.srcElement;if(!(n instanceof HTMLElement)||(n==null?void 0:n.nodeName)!=="SPAN")return;const t=n.getBoundingClientRect(),i={left:(t.left+t.right)/2,top:(t.top+t.bottom)/2};e.state.jump.cursor=i,e.state.jump.isHoldingModifier&&l(e)}s(M,"onMouseOver");function g(e){if(!e.state.jump.isHoldingModifier&&e.state.jump.cursor){e.state.jump.cursor=null;return}e.state.jump.isHoldingModifier&&e.state.jump.marker&&p(e)}s(g,"onMouseOut");function m(e,r){if(e.state.jump.isHoldingModifier||!k(r.key))return;e.state.jump.isHoldingModifier=!0,e.state.jump.cursor&&l(e);const n=s(o=>{o.code===r.code&&(e.state.jump.isHoldingModifier=!1,e.state.jump.marker&&p(e),u.CodeMirror.off(document,"keyup",n),u.CodeMirror.off(document,"click",t),e.off("mousedown",i))},"onKeyUp"),t=s(o=>{const{destination:a,options:f}=e.state.jump;a&&f.onClick(a,o)},"onClick"),i=s((o,a)=>{e.state.jump.destination&&(a.codemirrorIgnore=!0)},"onMouseDown");u.CodeMirror.on(document,"keyup",n),u.CodeMirror.on(document,"click",t),e.on("mousedown",i)}s(m,"onKeyDown");const j=typeof navigator<"u"&&(navigator==null?void 0:navigator.appVersion.includes("Mac"));function k(e){return e===(j?"Meta":"Control")}s(k,"isJumpModifier");function l(e){if(e.state.jump.marker)return;const{cursor:r,options:n}=e.state.jump,t=e.coordsChar(r),i=e.getTokenAt(t,!0),o=n.getDestination||e.getHelper(t,"jump");if(o){const a=o(i,n,e);if(a){const f=e.markText({line:t.line,ch:i.start},{line:t.line,ch:i.end},{className:"CodeMirror-jump-token"});e.state.jump.marker=f,e.state.jump.destination=a}}}s(l,"enableJumpMode");function p(e){const{marker:r}=e.state.jump;e.state.jump.marker=null,e.state.jump.destination=null,r.clear()}s(p,"disableJumpMode");u.CodeMirror.registerHelper("jump","graphql",(e,r)=>{if(!r.schema||!r.onClick||!e.state)return;const{state:n}=e,{kind:t,step:i}=n,o=d.getTypeInfo(r.schema,n);if(t==="Field"&&i===0&&o.fieldDef||t==="AliasedField"&&i===2&&o.fieldDef)return d.getFieldReference(o);if(t==="Directive"&&i===1&&o.directiveDef)return d.getDirectiveReference(o);if(t==="Argument"&&i===0&&o.argDef)return d.getArgumentReference(o);if(t==="EnumValue"&&o.enumValue)return d.getEnumValueReference(o);if(t==="NamedType"&&o.type)return d.getTypeReference(o)}); | ||
//# sourceMappingURL=jump.cjs.js.map |
var l = Object.defineProperty; | ||
var u = (e, n) => l(e, "name", { value: n, configurable: !0 }); | ||
import { C as s } from "./codemirror.es.js"; | ||
var s = (e, n) => l(e, "name", { value: n, configurable: !0 }); | ||
import { C as u } from "./codemirror.es.js"; | ||
import { g as m, a as g, b as c, c as j, d as M, e as k } from "./SchemaReference.es.js"; | ||
@@ -8,8 +8,8 @@ import "./codemirror.es2.js"; | ||
import "./forEachState.es.js"; | ||
s.defineOption("jump", !1, (e, n, r) => { | ||
if (r && r !== s.Init) { | ||
u.defineOption("jump", !1, (e, n, r) => { | ||
if (r && r !== u.Init) { | ||
const t = e.state.jump.onMouseOver; | ||
s.off(e.getWrapperElement(), "mouseover", t); | ||
u.off(e.getWrapperElement(), "mouseover", t); | ||
const i = e.state.jump.onMouseOut; | ||
s.off(e.getWrapperElement(), "mouseout", i), s.off(document, "keydown", e.state.jump.onKeyDown), delete e.state.jump; | ||
u.off(e.getWrapperElement(), "mouseout", i), u.off(document, "keydown", e.state.jump.onKeyDown), delete e.state.jump; | ||
} | ||
@@ -19,10 +19,10 @@ if (n) { | ||
options: n, | ||
onMouseOver: y.bind(null, e), | ||
onMouseOut: v.bind(null, e), | ||
onMouseOver: v.bind(null, e), | ||
onMouseOut: y.bind(null, e), | ||
onKeyDown: D.bind(null, e) | ||
}; | ||
s.on(e.getWrapperElement(), "mouseover", t.onMouseOver), s.on(e.getWrapperElement(), "mouseout", t.onMouseOut), s.on(document, "keydown", t.onKeyDown); | ||
u.on(e.getWrapperElement(), "mouseover", t.onMouseOver), u.on(e.getWrapperElement(), "mouseout", t.onMouseOut), u.on(document, "keydown", t.onKeyDown); | ||
} | ||
}); | ||
function y(e, n) { | ||
function v(e, n) { | ||
const r = n.target || n.srcElement; | ||
@@ -37,4 +37,4 @@ if (!(r instanceof HTMLElement) || (r == null ? void 0 : r.nodeName) !== "SPAN") | ||
} | ||
u(y, "onMouseOver"); | ||
function v(e) { | ||
s(v, "onMouseOver"); | ||
function y(e) { | ||
if (!e.state.jump.isHoldingModifier && e.state.jump.cursor) { | ||
@@ -46,3 +46,3 @@ e.state.jump.cursor = null; | ||
} | ||
u(v, "onMouseOut"); | ||
s(y, "onMouseOut"); | ||
function D(e, n) { | ||
@@ -52,18 +52,18 @@ if (e.state.jump.isHoldingModifier || !w(n.key)) | ||
e.state.jump.isHoldingModifier = !0, e.state.jump.cursor && p(e); | ||
const r = /* @__PURE__ */ u((o) => { | ||
o.code === n.code && (e.state.jump.isHoldingModifier = !1, e.state.jump.marker && d(e), s.off(document, "keyup", r), s.off(document, "click", t), e.off("mousedown", i)); | ||
}, "onKeyUp"), t = /* @__PURE__ */ u((o) => { | ||
const r = /* @__PURE__ */ s((o) => { | ||
o.code === n.code && (e.state.jump.isHoldingModifier = !1, e.state.jump.marker && d(e), u.off(document, "keyup", r), u.off(document, "click", t), e.off("mousedown", i)); | ||
}, "onKeyUp"), t = /* @__PURE__ */ s((o) => { | ||
const { destination: a, options: f } = e.state.jump; | ||
a && f.onClick(a, o); | ||
}, "onClick"), i = /* @__PURE__ */ u((o, a) => { | ||
}, "onClick"), i = /* @__PURE__ */ s((o, a) => { | ||
e.state.jump.destination && (a.codemirrorIgnore = !0); | ||
}, "onMouseDown"); | ||
s.on(document, "keyup", r), s.on(document, "click", t), e.on("mousedown", i); | ||
u.on(document, "keyup", r), u.on(document, "click", t), e.on("mousedown", i); | ||
} | ||
u(D, "onKeyDown"); | ||
const O = typeof navigator < "u" && navigator && navigator.appVersion.includes("Mac"); | ||
s(D, "onKeyDown"); | ||
const O = typeof navigator < "u" && (navigator == null ? void 0 : navigator.appVersion.includes("Mac")); | ||
function w(e) { | ||
return e === (O ? "Meta" : "Control"); | ||
} | ||
u(w, "isJumpModifier"); | ||
s(w, "isJumpModifier"); | ||
function p(e) { | ||
@@ -81,3 +81,3 @@ if (e.state.jump.marker) | ||
} | ||
u(p, "enableJumpMode"); | ||
s(p, "enableJumpMode"); | ||
function d(e) { | ||
@@ -87,4 +87,4 @@ const { marker: n } = e.state.jump; | ||
} | ||
u(d, "disableJumpMode"); | ||
s.registerHelper("jump", "graphql", (e, n) => { | ||
s(d, "disableJumpMode"); | ||
u.registerHelper("jump", "graphql", (e, n) => { | ||
if (!n.schema || !n.onClick || !e.state) | ||
@@ -91,0 +91,0 @@ return; |
@@ -1,2 +0,2 @@ | ||
"use strict";var m=Object.defineProperty;var l=(n,r)=>m(n,"name",{value:r,configurable:!0});const t=require("graphql"),s=require("./forEachState.cjs.js");function o(n,r){const e={schema:n,type:null,parentType:null,inputType:null,directiveDef:null,fieldDef:null,argDef:null,argDefs:null,objectFieldDefs:null};return s.forEachState(r,i=>{var a,c;switch(i.kind){case"Query":case"ShortQuery":e.type=n.getQueryType();break;case"Mutation":e.type=n.getMutationType();break;case"Subscription":e.type=n.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":i.type&&(e.type=n.getType(i.type));break;case"Field":case"AliasedField":e.fieldDef=e.type&&i.name?T(n,e.parentType,i.name):null,e.type=(a=e.fieldDef)===null||a===void 0?void 0:a.type;break;case"SelectionSet":e.parentType=e.type?t.getNamedType(e.type):null;break;case"Directive":e.directiveDef=i.name?n.getDirective(i.name):null;break;case"Arguments":const f=i.prevState?i.prevState.kind==="Field"?e.fieldDef:i.prevState.kind==="Directive"?e.directiveDef:i.prevState.kind==="AliasedField"?i.prevState.name&&T(n,e.parentType,i.prevState.name):null:null;e.argDefs=f?f.args:null;break;case"Argument":if(e.argDef=null,e.argDefs){for(let u=0;u<e.argDefs.length;u++)if(e.argDefs[u].name===i.name){e.argDef=e.argDefs[u];break}}e.inputType=(c=e.argDef)===null||c===void 0?void 0:c.type;break;case"EnumValue":const d=e.inputType?t.getNamedType(e.inputType):null;e.enumValue=d instanceof t.GraphQLEnumType?b(d.getValues(),u=>u.value===i.name):null;break;case"ListValue":const g=e.inputType?t.getNullableType(e.inputType):null;e.inputType=g instanceof t.GraphQLList?g.ofType:null;break;case"ObjectValue":const y=e.inputType?t.getNamedType(e.inputType):null;e.objectFieldDefs=y instanceof t.GraphQLInputObjectType?y.getFields():null;break;case"ObjectField":const p=i.name&&e.objectFieldDefs?e.objectFieldDefs[i.name]:null;e.inputType=p==null?void 0:p.type;break;case"NamedType":e.type=i.name?n.getType(i.name):null;break}}),e}l(o,"getTypeInfo");function T(n,r,e){if(e===t.SchemaMetaFieldDef.name&&n.getQueryType()===r)return t.SchemaMetaFieldDef;if(e===t.TypeMetaFieldDef.name&&n.getQueryType()===r)return t.TypeMetaFieldDef;if(e===t.TypeNameMetaFieldDef.name&&t.isCompositeType(r))return t.TypeNameMetaFieldDef;if(r&&r.getFields)return r.getFields()[e]}l(T,"getFieldDef");function b(n,r){for(let e=0;e<n.length;e++)if(r(n[e]))return n[e]}l(b,"find");function v(n){return{kind:"Field",schema:n.schema,field:n.fieldDef,type:D(n.fieldDef)?null:n.parentType}}l(v,"getFieldReference");function F(n){return{kind:"Directive",schema:n.schema,directive:n.directiveDef}}l(F,"getDirectiveReference");function k(n){return n.directiveDef?{kind:"Argument",schema:n.schema,argument:n.argDef,directive:n.directiveDef}:{kind:"Argument",schema:n.schema,argument:n.argDef,field:n.fieldDef,type:D(n.fieldDef)?null:n.parentType}}l(k,"getArgumentReference");function S(n){return{kind:"EnumValue",value:n.enumValue||void 0,type:n.inputType?t.getNamedType(n.inputType):void 0}}l(S,"getEnumValueReference");function h(n,r){return{kind:"Type",schema:n.schema,type:r||n.type}}l(h,"getTypeReference");function D(n){return n.name.slice(0,2)==="__"}l(D,"isMetaField");exports.getArgumentReference=k;exports.getDirectiveReference=F;exports.getEnumValueReference=S;exports.getFieldReference=v;exports.getTypeInfo=o;exports.getTypeReference=h; | ||
"use strict";var m=Object.defineProperty;var l=(n,r)=>m(n,"name",{value:r,configurable:!0});const t=require("graphql"),s=require("./forEachState.cjs.js");function o(n,r){const e={schema:n,type:null,parentType:null,inputType:null,directiveDef:null,fieldDef:null,argDef:null,argDefs:null,objectFieldDefs:null};return s.forEachState(r,i=>{var c,p;switch(i.kind){case"Query":case"ShortQuery":e.type=n.getQueryType();break;case"Mutation":e.type=n.getMutationType();break;case"Subscription":e.type=n.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":i.type&&(e.type=n.getType(i.type));break;case"Field":case"AliasedField":e.fieldDef=e.type&&i.name?T(n,e.parentType,i.name):null,e.type=(c=e.fieldDef)===null||c===void 0?void 0:c.type;break;case"SelectionSet":e.parentType=e.type?t.getNamedType(e.type):null;break;case"Directive":e.directiveDef=i.name?n.getDirective(i.name):null;break;case"Arguments":const f=i.prevState?i.prevState.kind==="Field"?e.fieldDef:i.prevState.kind==="Directive"?e.directiveDef:i.prevState.kind==="AliasedField"?i.prevState.name&&T(n,e.parentType,i.prevState.name):null:null;e.argDefs=f?f.args:null;break;case"Argument":if(e.argDef=null,e.argDefs){for(let u=0;u<e.argDefs.length;u++)if(e.argDefs[u].name===i.name){e.argDef=e.argDefs[u];break}}e.inputType=(p=e.argDef)===null||p===void 0?void 0:p.type;break;case"EnumValue":const d=e.inputType?t.getNamedType(e.inputType):null;e.enumValue=d instanceof t.GraphQLEnumType?b(d.getValues(),u=>u.value===i.name):null;break;case"ListValue":const g=e.inputType?t.getNullableType(e.inputType):null;e.inputType=g instanceof t.GraphQLList?g.ofType:null;break;case"ObjectValue":const y=e.inputType?t.getNamedType(e.inputType):null;e.objectFieldDefs=y instanceof t.GraphQLInputObjectType?y.getFields():null;break;case"ObjectField":const a=i.name&&e.objectFieldDefs?e.objectFieldDefs[i.name]:null;e.inputType=a==null?void 0:a.type,e.fieldDef=a;break;case"NamedType":e.type=i.name?n.getType(i.name):null;break}}),e}l(o,"getTypeInfo");function T(n,r,e){if(e===t.SchemaMetaFieldDef.name&&n.getQueryType()===r)return t.SchemaMetaFieldDef;if(e===t.TypeMetaFieldDef.name&&n.getQueryType()===r)return t.TypeMetaFieldDef;if(e===t.TypeNameMetaFieldDef.name&&t.isCompositeType(r))return t.TypeNameMetaFieldDef;if(r&&r.getFields)return r.getFields()[e]}l(T,"getFieldDef");function b(n,r){for(let e=0;e<n.length;e++)if(r(n[e]))return n[e]}l(b,"find");function v(n){return{kind:"Field",schema:n.schema,field:n.fieldDef,type:D(n.fieldDef)?null:n.parentType}}l(v,"getFieldReference");function F(n){return{kind:"Directive",schema:n.schema,directive:n.directiveDef}}l(F,"getDirectiveReference");function k(n){return n.directiveDef?{kind:"Argument",schema:n.schema,argument:n.argDef,directive:n.directiveDef}:{kind:"Argument",schema:n.schema,argument:n.argDef,field:n.fieldDef,type:D(n.fieldDef)?null:n.parentType}}l(k,"getArgumentReference");function S(n){return{kind:"EnumValue",value:n.enumValue||void 0,type:n.inputType?t.getNamedType(n.inputType):void 0}}l(S,"getEnumValueReference");function h(n,r){return{kind:"Type",schema:n.schema,type:r||n.type}}l(h,"getTypeReference");function D(n){return n.name.slice(0,2)==="__"}l(D,"isMetaField");exports.getArgumentReference=k;exports.getDirectiveReference=F;exports.getEnumValueReference=S;exports.getFieldReference=v;exports.getTypeInfo=o;exports.getTypeReference=h; | ||
//# sourceMappingURL=SchemaReference.cjs.js.map |
var b = Object.defineProperty; | ||
var r = (n, l) => b(n, "name", { value: l, configurable: !0 }); | ||
import { getNamedType as u, GraphQLInputObjectType as v, getNullableType as k, GraphQLList as F, GraphQLEnumType as S, SchemaMetaFieldDef as y, TypeMetaFieldDef as D, TypeNameMetaFieldDef as m, isCompositeType as h } from "graphql"; | ||
import { getNamedType as a, GraphQLInputObjectType as v, getNullableType as k, GraphQLList as F, GraphQLEnumType as S, SchemaMetaFieldDef as y, TypeMetaFieldDef as D, TypeNameMetaFieldDef as m, isCompositeType as h } from "graphql"; | ||
import { f as j } from "./forEachState.es.js"; | ||
@@ -18,3 +18,3 @@ function E(n, l) { | ||
return j(l, (i) => { | ||
var a, p; | ||
var p, c; | ||
switch (i.kind) { | ||
@@ -37,6 +37,6 @@ case "Query": | ||
case "AliasedField": | ||
e.fieldDef = e.type && i.name ? T(n, e.parentType, i.name) : null, e.type = (a = e.fieldDef) === null || a === void 0 ? void 0 : a.type; | ||
e.fieldDef = e.type && i.name ? T(n, e.parentType, i.name) : null, e.type = (p = e.fieldDef) === null || p === void 0 ? void 0 : p.type; | ||
break; | ||
case "SelectionSet": | ||
e.parentType = e.type ? u(e.type) : null; | ||
e.parentType = e.type ? a(e.type) : null; | ||
break; | ||
@@ -58,6 +58,6 @@ case "Directive": | ||
} | ||
e.inputType = (p = e.argDef) === null || p === void 0 ? void 0 : p.type; | ||
e.inputType = (c = e.argDef) === null || c === void 0 ? void 0 : c.type; | ||
break; | ||
case "EnumValue": | ||
const d = e.inputType ? u(e.inputType) : null; | ||
const d = e.inputType ? a(e.inputType) : null; | ||
e.enumValue = d instanceof S ? Q(d.getValues(), (t) => t.value === i.name) : null; | ||
@@ -70,8 +70,8 @@ break; | ||
case "ObjectValue": | ||
const s = e.inputType ? u(e.inputType) : null; | ||
const s = e.inputType ? a(e.inputType) : null; | ||
e.objectFieldDefs = s instanceof v ? s.getFields() : null; | ||
break; | ||
case "ObjectField": | ||
const c = i.name && e.objectFieldDefs ? e.objectFieldDefs[i.name] : null; | ||
e.inputType = c == null ? void 0 : c.type; | ||
const u = i.name && e.objectFieldDefs ? e.objectFieldDefs[i.name] : null; | ||
e.inputType = u == null ? void 0 : u.type, e.fieldDef = u; | ||
break; | ||
@@ -138,3 +138,3 @@ case "NamedType": | ||
value: n.enumValue || void 0, | ||
type: n.inputType ? u(n.inputType) : void 0 | ||
type: n.inputType ? a(n.inputType) : void 0 | ||
}; | ||
@@ -141,0 +141,0 @@ } |
{ | ||
"name": "@graphiql/react", | ||
"version": "0.23.0-canary-49f80902.0", | ||
"version": "0.23.0-canary-5b09c3aa.0", | ||
"repository": { | ||
@@ -60,6 +60,6 @@ "type": "git", | ||
"codemirror": "^5.65.3", | ||
"codemirror-graphql": "^2.0.11", | ||
"codemirror-graphql": "^2.0.12", | ||
"copy-to-clipboard": "^3.2.0", | ||
"framer-motion": "^6.5.1", | ||
"graphql-language-service": "^5.2.0", | ||
"graphql-language-service": "^5.2.1", | ||
"markdown-it": "^14.1.0", | ||
@@ -66,0 +66,0 @@ "set-value": "^4.1.0" |
export { HeaderEditor } from './header-editor'; | ||
export { ImagePreview } from './image-preview'; | ||
export { IncrementsEditors } from './increments-editors'; | ||
export { QueryEditor } from './query-editor'; | ||
export { ResponseEditor } from './response-editor'; | ||
export { VariableEditor } from './variable-editor'; | ||
export type { IncrementsEditorsProps } from './increments-editors'; |
export { | ||
HeaderEditor, | ||
ImagePreview, | ||
IncrementsEditors, | ||
QueryEditor, | ||
@@ -30,3 +29,2 @@ ResponseEditor, | ||
export type { IncrementsEditorsProps } from './components'; | ||
export type { EditorContextType, EditorContextProviderProps } from './context'; | ||
@@ -39,5 +37,5 @@ export type { UseHeaderEditorArgs } from './header-editor'; | ||
} from './response-editor'; | ||
export type { IncrementalPayload, TabsState } from './tabs'; | ||
export type { TabsState } from './tabs'; | ||
export type { UseVariableEditorArgs } from './variable-editor'; | ||
export type { CommonEditorProps, KeyMap, WriteableEditorProps } from './types'; |
@@ -9,4 +9,7 @@ import { getSelectedOperationName } from '@graphiql/toolkit'; | ||
} from 'graphql'; | ||
import { getOperationFacts } from 'graphql-language-service'; | ||
import { | ||
getOperationFacts, | ||
GraphQLDocumentMode, | ||
} from 'graphql-language-service'; | ||
import { | ||
MutableRefObject, | ||
@@ -190,2 +193,6 @@ useCallback, | ||
externalFragments: undefined, | ||
autocompleteOptions: { | ||
// for the query editor, restrict to executable type definitions | ||
mode: GraphQLDocumentMode.EXECUTABLE, | ||
}, | ||
}, | ||
@@ -192,0 +199,0 @@ info: { |
import { StorageAPI } from '@graphiql/toolkit'; | ||
import { ExecutionResult } from 'graphql'; | ||
import { useCallback, useMemo } from 'react'; | ||
import debounce from '../utility/debounce'; | ||
import { IncrementalResult } from '../utility/incremental'; | ||
import { CodeMirrorEditorWithOperationFacts } from './context'; | ||
@@ -52,25 +50,4 @@ import { CodeMirrorEditor } from './types'; | ||
response: string | null; | ||
/** | ||
* While being subscribed to a multi-part request (subscription, defer, | ||
* stream, etc.) this list will accumulate all incremental results received | ||
* from the server, including a client-generated timestamp for when the | ||
* increment was received. Each time a new request starts to run, this list | ||
* will be cleared. | ||
*/ | ||
incrementalPayloads?: IncrementalPayload[] | null; | ||
}; | ||
export type IncrementalPayload = { | ||
/** | ||
* The number of milliseconds that went by between sending the request and | ||
* receiving this increment. | ||
*/ | ||
timing: number; | ||
/** | ||
* The execution result (for subscriptions), or the list of incremental | ||
* results (for @defer/@stream). | ||
*/ | ||
payload: ExecutionResult | IncrementalResult[]; | ||
}; | ||
/** | ||
@@ -152,3 +129,2 @@ * This object describes the state of all tabs. | ||
response: null, | ||
incrementalPayloads: [], | ||
}); | ||
@@ -201,4 +177,3 @@ parsed.activeTabIndex = parsed.tabs.length - 1; | ||
hasStringOrNullKey(obj, 'operationName') && | ||
hasStringOrNullKey(obj, 'response') && | ||
hasIncrementalPayloads(obj) | ||
hasStringOrNullKey(obj, 'response') | ||
); | ||
@@ -219,27 +194,2 @@ } | ||
function hasIncrementalPayloads(obj: Record<string, any>) { | ||
const { incrementalPayloads } = obj; | ||
// Not having any values is fine | ||
if (incrementalPayloads === undefined || incrementalPayloads === null) { | ||
return true; | ||
} | ||
// Anything other than an array is bad | ||
if (!Array.isArray(incrementalPayloads)) { | ||
return false; | ||
} | ||
return incrementalPayloads.every( | ||
item => | ||
item && | ||
typeof item === 'object' && | ||
'timing' in item && | ||
typeof item.timing === 'number' && | ||
'payload' in item && | ||
item.payload && | ||
typeof item.payload === 'object', | ||
); | ||
} | ||
export function useSynchronizeActiveTabValues({ | ||
@@ -282,3 +232,2 @@ queryEditor, | ||
key === 'response' || | ||
key === 'incrementalPayloads' || | ||
(!shouldPersistHeaders && key === 'headers') | ||
@@ -358,3 +307,2 @@ ? null | ||
response: null, | ||
incrementalPayloads: [], | ||
}; | ||
@@ -361,0 +309,0 @@ } |
@@ -8,3 +8,2 @@ import './style/root.css'; | ||
ImagePreview, | ||
IncrementsEditors, | ||
QueryEditor, | ||
@@ -85,4 +84,2 @@ ResponseEditor, | ||
EditorContextType, | ||
IncrementalPayload, | ||
IncrementsEditorsProps, | ||
KeyMap, | ||
@@ -124,2 +121,1 @@ ResponseTooltipType, | ||
export type { Theme } from './theme'; | ||
export type { IncrementalResult } from './utility/incremental'; |
export { HeaderEditor } from './header-editor'; | ||
export { ImagePreview } from './image-preview'; | ||
export { IncrementsEditors } from './increments-editors'; | ||
export { QueryEditor } from './query-editor'; | ||
export { ResponseEditor } from './response-editor'; | ||
export { VariableEditor } from './variable-editor'; | ||
export type { IncrementsEditorsProps } from './increments-editors'; |
@@ -1,2 +0,2 @@ | ||
export { HeaderEditor, ImagePreview, IncrementsEditors, QueryEditor, ResponseEditor, VariableEditor, } from './components'; | ||
export { HeaderEditor, ImagePreview, QueryEditor, ResponseEditor, VariableEditor, } from './components'; | ||
export { EditorContext, EditorContextProvider, useEditorContext, } from './context'; | ||
@@ -8,3 +8,2 @@ export { useHeaderEditor } from './header-editor'; | ||
export { useVariableEditor } from './variable-editor'; | ||
export type { IncrementsEditorsProps } from './components'; | ||
export type { EditorContextType, EditorContextProviderProps } from './context'; | ||
@@ -14,4 +13,4 @@ export type { UseHeaderEditorArgs } from './header-editor'; | ||
export type { ResponseTooltipType, UseResponseEditorArgs, } from './response-editor'; | ||
export type { IncrementalPayload, TabsState } from './tabs'; | ||
export type { TabsState } from './tabs'; | ||
export type { UseVariableEditorArgs } from './variable-editor'; | ||
export type { CommonEditorProps, KeyMap, WriteableEditorProps } from './types'; |
import { StorageAPI } from '@graphiql/toolkit'; | ||
import { ExecutionResult } from 'graphql'; | ||
import { IncrementalResult } from '../utility/incremental'; | ||
import { CodeMirrorEditorWithOperationFacts } from './context'; | ||
@@ -47,23 +45,3 @@ import { CodeMirrorEditor } from './types'; | ||
response: string | null; | ||
/** | ||
* While being subscribed to a multi-part request (subscription, defer, | ||
* stream, etc.) this list will accumulate all incremental results received | ||
* from the server, including a client-generated timestamp for when the | ||
* increment was received. Each time a new request starts to run, this list | ||
* will be cleared. | ||
*/ | ||
incrementalPayloads?: IncrementalPayload[] | null; | ||
}; | ||
export declare type IncrementalPayload = { | ||
/** | ||
* The number of milliseconds that went by between sending the request and | ||
* receiving this increment. | ||
*/ | ||
timing: number; | ||
/** | ||
* The execution result (for subscriptions), or the list of incremental | ||
* results (for @defer/@stream). | ||
*/ | ||
payload: ExecutionResult | IncrementalResult[]; | ||
}; | ||
/** | ||
@@ -70,0 +48,0 @@ * This object describes the state of all tabs. |
@@ -13,5 +13,4 @@ import { Fetcher } from '@graphiql/toolkit'; | ||
* If there is currently a GraphQL request in-flight. For multi-part | ||
* requests (subscriptions, defer, stream, etc.), this will be `true` until | ||
* the last batch has been fetched or the connection is closed from the | ||
* client. | ||
* requests like subscriptions, this will be `true` until the last batch | ||
* has been fetched or the connection is closed from the client. | ||
*/ | ||
@@ -18,0 +17,0 @@ isSubscribed: boolean; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="react" /> | ||
import { GraphQLType } from 'graphql'; | ||
@@ -2,0 +3,0 @@ import './type-link.css'; |
@@ -0,2 +1,3 @@ | ||
/// <reference types="react" /> | ||
import { GraphQLNamedType, GraphQLType } from 'graphql'; | ||
export declare function renderType(type: GraphQLType, renderNamedType: (namedType: GraphQLNamedType) => JSX.Element): JSX.Element; |
import './style/root.css'; | ||
export { EditorContext, EditorContextProvider, HeaderEditor, ImagePreview, IncrementsEditors, QueryEditor, ResponseEditor, useAutoCompleteLeafs, useCopyQuery, useEditorContext, useHeaderEditor, useMergeQuery, usePrettifyEditors, useQueryEditor, useResponseEditor, useVariableEditor, useEditorState, useOperationsEditorState, useOptimisticState, useVariablesEditorState, useHeadersEditorState, VariableEditor, } from './editor'; | ||
export { EditorContext, EditorContextProvider, HeaderEditor, ImagePreview, QueryEditor, ResponseEditor, useAutoCompleteLeafs, useCopyQuery, useEditorContext, useHeaderEditor, useMergeQuery, usePrettifyEditors, useQueryEditor, useResponseEditor, useVariableEditor, useEditorState, useOperationsEditorState, useOptimisticState, useVariablesEditorState, useHeadersEditorState, VariableEditor, } from './editor'; | ||
export { ExecutionContext, ExecutionContextProvider, useExecutionContext, } from './execution'; | ||
@@ -15,3 +15,3 @@ export { Argument, DefaultValue, DeprecationReason, Directive, DocExplorer, ExplorerContext, ExplorerContextProvider, ExplorerSection, FieldDocumentation, FieldLink, SchemaDocumentation, Search, TypeDocumentation, TypeLink, useExplorerContext, } from './explorer'; | ||
export * from './toolbar'; | ||
export type { CommonEditorProps, EditorContextProviderProps, EditorContextType, IncrementalPayload, IncrementsEditorsProps, KeyMap, ResponseTooltipType, TabsState, UseHeaderEditorArgs, UseQueryEditorArgs, UseResponseEditorArgs, UseVariableEditorArgs, WriteableEditorProps, } from './editor'; | ||
export type { CommonEditorProps, EditorContextProviderProps, EditorContextType, KeyMap, ResponseTooltipType, TabsState, UseHeaderEditorArgs, UseQueryEditorArgs, UseResponseEditorArgs, UseVariableEditorArgs, WriteableEditorProps, } from './editor'; | ||
export type { ExecutionContextProviderProps, ExecutionContextType, } from './execution'; | ||
@@ -25,2 +25,1 @@ export type { ExplorerContextProviderProps, ExplorerContextType, ExplorerFieldDef, ExplorerNavStack, ExplorerNavStackItem, } from './explorer'; | ||
export type { Theme } from './theme'; | ||
export type { IncrementalResult } from './utility/incremental'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
4633614
336
28513