@graphiql/plugin-doc-explorer 0.1.0-canary-65327511.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/components/argument.d.ts +2 -1
  2. package/dist/components/argument.js +3 -3
  3. package/dist/components/argument.js.map +1 -1
  4. package/dist/components/default-value.d.ts +4 -3
  5. package/dist/components/default-value.js +2 -2
  6. package/dist/components/default-value.js.map +1 -1
  7. package/dist/components/deprecation-reason.d.ts +3 -2
  8. package/dist/components/deprecation-reason.js +2 -2
  9. package/dist/components/deprecation-reason.js.map +1 -1
  10. package/dist/components/directive.d.ts +2 -1
  11. package/dist/components/directive.js +2 -2
  12. package/dist/components/directive.js.map +1 -1
  13. package/dist/components/doc-explorer.d.ts +2 -1
  14. package/dist/components/doc-explorer.js +116 -126
  15. package/dist/components/doc-explorer.js.map +1 -1
  16. package/dist/components/field-documentation.d.ts +4 -3
  17. package/dist/components/field-documentation.js +66 -71
  18. package/dist/components/field-documentation.js.map +1 -1
  19. package/dist/components/field-link.d.ts +4 -3
  20. package/dist/components/field-link.js +21 -27
  21. package/dist/components/field-link.js.map +1 -1
  22. package/dist/components/schema-documentation.d.ts +2 -1
  23. package/dist/components/schema-documentation.js +98 -95
  24. package/dist/components/schema-documentation.js.map +1 -1
  25. package/dist/components/search.js +130 -151
  26. package/dist/components/search.js.map +1 -1
  27. package/dist/components/section.d.ts +2 -2
  28. package/dist/components/section.js +37 -33
  29. package/dist/components/section.js.map +1 -1
  30. package/dist/components/type-documentation.d.ts +2 -1
  31. package/dist/components/type-documentation.js +47 -44
  32. package/dist/components/type-documentation.js.map +1 -1
  33. package/dist/components/type-link.d.ts +2 -1
  34. package/dist/components/type-link.js +19 -26
  35. package/dist/components/type-link.js.map +1 -1
  36. package/dist/context.d.ts +47 -28
  37. package/dist/context.js +214 -142
  38. package/dist/context.js.map +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.js +5 -4
  41. package/dist/index.js.map +1 -1
  42. package/package.json +4 -3
@@ -1,7 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { isNamedType, isObjectType, isInterfaceType, isInputObjectType, isEnumType, isAbstractType } from "graphql";
4
3
  import { useState } from "react";
4
+ import { isNamedType, isObjectType, isInterfaceType, isInputObjectType, isEnumType, isAbstractType } from "graphql";
5
5
  import { MarkdownContent, Button, useSchemaContext } from "@graphiql/react";
6
6
  import { Argument } from "./argument.js";
7
7
  import { DefaultValue } from "./default-value.js";
@@ -10,25 +10,28 @@ import { FieldLink } from "./field-link.js";
10
10
  import { ExplorerSection } from "./section.js";
11
11
  import { TypeLink } from "./type-link.js";
12
12
  /* empty css */
13
- function TypeDocumentation(props) {
13
+ const TypeDocumentation = (t0) => {
14
14
  const $ = c(2);
15
- let t0;
16
- if ($[0] !== props.type) {
17
- t0 = isNamedType(props.type) ? /* @__PURE__ */ jsxs(Fragment, { children: [
18
- props.type.description ? /* @__PURE__ */ jsx(MarkdownContent, { type: "description", children: props.type.description }) : null,
19
- /* @__PURE__ */ jsx(ImplementsInterfaces, { type: props.type }),
20
- /* @__PURE__ */ jsx(Fields, { type: props.type }),
21
- /* @__PURE__ */ jsx(EnumValues, { type: props.type }),
22
- /* @__PURE__ */ jsx(PossibleTypes, { type: props.type })
15
+ const {
16
+ type
17
+ } = t0;
18
+ let t1;
19
+ if ($[0] !== type) {
20
+ t1 = isNamedType(type) ? /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ type.description ? /* @__PURE__ */ jsx(MarkdownContent, { type: "description", children: type.description }) : null,
22
+ /* @__PURE__ */ jsx(ImplementsInterfaces, { type }),
23
+ /* @__PURE__ */ jsx(Fields, { type }),
24
+ /* @__PURE__ */ jsx(EnumValues, { type }),
25
+ /* @__PURE__ */ jsx(PossibleTypes, { type })
23
26
  ] }) : null;
24
- $[0] = props.type;
25
- $[1] = t0;
27
+ $[0] = type;
28
+ $[1] = t1;
26
29
  } else {
27
- t0 = $[1];
30
+ t1 = $[1];
28
31
  }
29
- return t0;
30
- }
31
- function ImplementsInterfaces(t0) {
32
+ return t1;
33
+ };
34
+ const ImplementsInterfaces = (t0) => {
32
35
  const $ = c(5);
33
36
  const {
34
37
  type
@@ -55,11 +58,8 @@ function ImplementsInterfaces(t0) {
55
58
  t2 = $[4];
56
59
  }
57
60
  return t2;
58
- }
59
- function _temp(implementedInterface) {
60
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TypeLink, { type: implementedInterface }) }, implementedInterface.name);
61
- }
62
- function Fields(t0) {
61
+ };
62
+ const Fields = (t0) => {
63
63
  const $ = c(12);
64
64
  const {
65
65
  type
@@ -125,14 +125,8 @@ function Fields(t0) {
125
125
  t4 = $[11];
126
126
  }
127
127
  return t4;
128
- }
129
- function _temp3(field_1) {
130
- return /* @__PURE__ */ jsx(Field, { field: field_1 }, field_1.name);
131
- }
132
- function _temp2(field_0) {
133
- return /* @__PURE__ */ jsx(Field, { field: field_0 }, field_0.name);
134
- }
135
- function Field(t0) {
128
+ };
129
+ const Field = (t0) => {
136
130
  const $ = c(22);
137
131
  const {
138
132
  field
@@ -223,11 +217,8 @@ function Field(t0) {
223
217
  t9 = $[21];
224
218
  }
225
219
  return t9;
226
- }
227
- function _temp4(arg) {
228
- return !arg.deprecationReason;
229
- }
230
- function EnumValues(t0) {
220
+ };
221
+ const EnumValues = (t0) => {
231
222
  const $ = c(12);
232
223
  const {
233
224
  type
@@ -292,14 +283,8 @@ function EnumValues(t0) {
292
283
  t4 = $[11];
293
284
  }
294
285
  return t4;
295
- }
296
- function _temp6(value_1) {
297
- return /* @__PURE__ */ jsx(EnumValue, { value: value_1 }, value_1.name);
298
- }
299
- function _temp5(value_0) {
300
- return /* @__PURE__ */ jsx(EnumValue, { value: value_0 }, value_0.name);
301
- }
302
- function EnumValue(t0) {
286
+ };
287
+ const EnumValue = (t0) => {
303
288
  const $ = c(10);
304
289
  const {
305
290
  value
@@ -343,8 +328,8 @@ function EnumValue(t0) {
343
328
  t4 = $[9];
344
329
  }
345
330
  return t4;
346
- }
347
- function PossibleTypes(t0) {
331
+ };
332
+ const PossibleTypes = (t0) => {
348
333
  const $ = c(7);
349
334
  const {
350
335
  type
@@ -384,6 +369,24 @@ function PossibleTypes(t0) {
384
369
  t4 = $[6];
385
370
  }
386
371
  return t4;
372
+ };
373
+ function _temp(implementedInterface) {
374
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TypeLink, { type: implementedInterface }) }, implementedInterface.name);
375
+ }
376
+ function _temp2(field_0) {
377
+ return /* @__PURE__ */ jsx(Field, { field: field_0 }, field_0.name);
378
+ }
379
+ function _temp3(field_1) {
380
+ return /* @__PURE__ */ jsx(Field, { field: field_1 }, field_1.name);
381
+ }
382
+ function _temp4(arg) {
383
+ return !arg.deprecationReason;
384
+ }
385
+ function _temp5(value_0) {
386
+ return /* @__PURE__ */ jsx(EnumValue, { value: value_0 }, value_0.name);
387
+ }
388
+ function _temp6(value_1) {
389
+ return /* @__PURE__ */ jsx(EnumValue, { value: value_1 }, value_1.name);
387
390
  }
388
391
  function _temp7(possibleType) {
389
392
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TypeLink, { type: possibleType }) }, possibleType.name);
@@ -1 +1 @@
1
- {"version":3,"file":"type-documentation.js","sources":["../../src/components/type-documentation.tsx"],"sourcesContent":["import {\n GraphQLEnumValue,\n GraphQLNamedType,\n isAbstractType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isNamedType,\n isObjectType,\n} from 'graphql';\nimport { useState } from 'react';\n\nimport { useSchemaContext, Button, MarkdownContent } from '@graphiql/react';\nimport { ExplorerFieldDef } from '../context';\nimport { Argument } from './argument';\nimport { DefaultValue } from './default-value';\nimport { DeprecationReason } from './deprecation-reason';\nimport { FieldLink } from './field-link';\nimport { ExplorerSection } from './section';\nimport { TypeLink } from './type-link';\n\nimport './type-documentation.css';\n\ntype TypeDocumentationProps = {\n /**\n * The type that should be rendered.\n */\n type: GraphQLNamedType;\n};\n\nexport function TypeDocumentation(props: TypeDocumentationProps) {\n return isNamedType(props.type) ? (\n <>\n {props.type.description ? (\n <MarkdownContent type=\"description\">\n {props.type.description}\n </MarkdownContent>\n ) : null}\n <ImplementsInterfaces type={props.type} />\n <Fields type={props.type} />\n <EnumValues type={props.type} />\n <PossibleTypes type={props.type} />\n </>\n ) : null;\n}\n\nfunction ImplementsInterfaces({ type }: { type: GraphQLNamedType }) {\n if (!isObjectType(type)) {\n return null;\n }\n const interfaces = type.getInterfaces();\n return interfaces.length > 0 ? (\n <ExplorerSection title=\"Implements\">\n {type.getInterfaces().map(implementedInterface => (\n <div key={implementedInterface.name}>\n <TypeLink type={implementedInterface} />\n </div>\n ))}\n </ExplorerSection>\n ) : null;\n}\n\nfunction Fields({ type }: { type: GraphQLNamedType }) {\n const [showDeprecated, setShowDeprecated] = useState(false);\n const handleShowDeprecated = () => {\n setShowDeprecated(true);\n };\n\n if (\n !isObjectType(type) &&\n !isInterfaceType(type) &&\n !isInputObjectType(type)\n ) {\n return null;\n }\n\n const fieldMap = type.getFields();\n\n const fields: ExplorerFieldDef[] = [];\n const deprecatedFields: ExplorerFieldDef[] = [];\n\n for (const field of Object.keys(fieldMap).map(name => fieldMap[name])) {\n if (field.deprecationReason) {\n deprecatedFields.push(field);\n } else {\n fields.push(field);\n }\n }\n\n return (\n <>\n {fields.length > 0 ? (\n <ExplorerSection title=\"Fields\">\n {fields.map(field => (\n <Field key={field.name} field={field} />\n ))}\n </ExplorerSection>\n ) : null}\n {deprecatedFields.length > 0 ? (\n showDeprecated || fields.length === 0 ? (\n <ExplorerSection title=\"Deprecated Fields\">\n {deprecatedFields.map(field => (\n <Field key={field.name} field={field} />\n ))}\n </ExplorerSection>\n ) : (\n <Button type=\"button\" onClick={handleShowDeprecated}>\n Show Deprecated Fields\n </Button>\n )\n ) : null}\n </>\n );\n}\n\nfunction Field({ field }: { field: ExplorerFieldDef }) {\n const args =\n 'args' in field ? field.args.filter(arg => !arg.deprecationReason) : [];\n return (\n <div className=\"graphiql-doc-explorer-item\">\n <div>\n <FieldLink field={field} />\n {args.length > 0 ? (\n <>\n (\n <span>\n {args.map(arg =>\n args.length === 1 ? (\n <Argument key={arg.name} arg={arg} inline />\n ) : (\n <div\n key={arg.name}\n className=\"graphiql-doc-explorer-argument-multiple\"\n >\n <Argument arg={arg} inline />\n </div>\n ),\n )}\n </span>\n )\n </>\n ) : null}\n {': '}\n <TypeLink type={field.type} />\n <DefaultValue field={field} />\n </div>\n {field.description ? (\n <MarkdownContent type=\"description\" onlyShowFirstChild>\n {field.description}\n </MarkdownContent>\n ) : null}\n <DeprecationReason>{field.deprecationReason}</DeprecationReason>\n </div>\n );\n}\n\nfunction EnumValues({ type }: { type: GraphQLNamedType }) {\n const [showDeprecated, setShowDeprecated] = useState(false);\n const handleShowDeprecated = () => {\n setShowDeprecated(true);\n };\n\n if (!isEnumType(type)) {\n return null;\n }\n\n const values: GraphQLEnumValue[] = [];\n const deprecatedValues: GraphQLEnumValue[] = [];\n for (const value of type.getValues()) {\n if (value.deprecationReason) {\n deprecatedValues.push(value);\n } else {\n values.push(value);\n }\n }\n\n return (\n <>\n {values.length > 0 ? (\n <ExplorerSection title=\"Enum Values\">\n {values.map(value => (\n <EnumValue key={value.name} value={value} />\n ))}\n </ExplorerSection>\n ) : null}\n {deprecatedValues.length > 0 ? (\n showDeprecated || values.length === 0 ? (\n <ExplorerSection title=\"Deprecated Enum Values\">\n {deprecatedValues.map(value => (\n <EnumValue key={value.name} value={value} />\n ))}\n </ExplorerSection>\n ) : (\n <Button type=\"button\" onClick={handleShowDeprecated}>\n Show Deprecated Values\n </Button>\n )\n ) : null}\n </>\n );\n}\n\nfunction EnumValue({ value }: { value: GraphQLEnumValue }) {\n return (\n <div className=\"graphiql-doc-explorer-item\">\n <div className=\"graphiql-doc-explorer-enum-value\">{value.name}</div>\n {value.description ? (\n <MarkdownContent type=\"description\">\n {value.description}\n </MarkdownContent>\n ) : null}\n {value.deprecationReason ? (\n <MarkdownContent type=\"deprecation\">\n {value.deprecationReason}\n </MarkdownContent>\n ) : null}\n </div>\n );\n}\n\nfunction PossibleTypes({ type }: { type: GraphQLNamedType }) {\n const { schema } = useSchemaContext({ nonNull: true });\n if (!schema || !isAbstractType(type)) {\n return null;\n }\n return (\n <ExplorerSection\n title={isInterfaceType(type) ? 'Implementations' : 'Possible Types'}\n >\n {schema.getPossibleTypes(type).map(possibleType => (\n <div key={possibleType.name}>\n <TypeLink type={possibleType} />\n </div>\n ))}\n </ExplorerSection>\n );\n}\n"],"names":["TypeDocumentation","props","$","_c","t0","type","isNamedType","description","ImplementsInterfaces","isObjectType","t1","getInterfaces","interfaces","t2","length","map","_temp","implementedInterface","name","Fields","showDeprecated","setShowDeprecated","useState","Symbol","for","handleShowDeprecated","isInterfaceType","isInputObjectType","deprecatedFields","fields","fieldMap","getFields","field","Object","keys","deprecationReason","push","_temp2","t3","_temp3","t4","field_1","field_0","Field","args","filter","_temp4","arg_0","arg","t5","t6","t7","t8","t9","EnumValues","isEnumType","deprecatedValues","values","value","getValues","_temp5","_temp6","value_1","value_0","EnumValue","PossibleTypes","nonNull","schema","useSchemaContext","isAbstractType","getPossibleTypes","_temp7","possibleType"],"mappings":";;;;;;;;;;;;AA8BO,SAAAA,kBAAAC,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAAC,MAAAA;AAAA,MAAAF,EAAA,CAAA,MAAAD,MAAAI,MAAA;AACED,SAAAE,YAAYL,MAAKI,IAAK,IAExBJ,qBAAAA,UAAAA,EAAAA,UAAAA;AAAAA,MAAKI,MAAAA,KAAAE,cACH,oBAAA,iBAAA,EAAqB,MAAA,eACnBN,UAAAA,MAAKI,KAAAE,YAAAA,CACR,IAAkB;AAAA,MAEnB,oBAAA,sBAAA,EAA2B,MAAAN,MAAKI,KACjC,CAAA;AAAA,MAAC,oBAAA,QAAA,EA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AAA,EAAAA,OAAA;AAAAA,SAAApC,EAAA,CAAA;AAAA,EAAA;AAAAsC,MAAAA;AAAA,MAAAtC,EAAAW,CAAAA,MAAAA,MAAAX,SAAAoC,IAAA;AAPJE,SAAC,oBAAA,iBAAA,EACQ,OAAA3B,IAENyB,UAKH,IAAA;AAAkBpC,WAAAW;AAAAX,WAAAoC;AAAApC,WAAAsC;AAAAA,EAAAA,OAAA;AAAAA,SAAAtC,EAAA,CAAA;AAAA,EAAA;AARlBsC,SAAAA;AAQkB;AAdtB,SAAA+B,OAAAC,cAAA;AAUQ,SAAA,6BACE,UAAC,oBAAA,UAAA,EAAeA,mBAAY,CAAA,KADpBA,aAAYtD,IAEtB;AAAM;"}
1
+ {"version":3,"file":"type-documentation.js","sources":["../../src/components/type-documentation.tsx"],"sourcesContent":["import { FC, useState } from 'react';\nimport {\n GraphQLEnumValue,\n GraphQLNamedType,\n isAbstractType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isNamedType,\n isObjectType,\n} from 'graphql';\nimport { useSchemaContext, Button, MarkdownContent } from '@graphiql/react';\nimport { DocExplorerFieldDef } from '../context';\nimport { Argument } from './argument';\nimport { DefaultValue } from './default-value';\nimport { DeprecationReason } from './deprecation-reason';\nimport { FieldLink } from './field-link';\nimport { ExplorerSection } from './section';\nimport { TypeLink } from './type-link';\nimport './type-documentation.css';\n\ntype TypeDocumentationProps = {\n /**\n * The type that should be rendered.\n */\n type: GraphQLNamedType;\n};\n\nexport const TypeDocumentation: FC<TypeDocumentationProps> = ({ type }) => {\n return isNamedType(type) ? (\n <>\n {type.description ? (\n <MarkdownContent type=\"description\">{type.description}</MarkdownContent>\n ) : null}\n <ImplementsInterfaces type={type} />\n <Fields type={type} />\n <EnumValues type={type} />\n <PossibleTypes type={type} />\n </>\n ) : null;\n};\n\nconst ImplementsInterfaces: FC<{ type: GraphQLNamedType }> = ({ type }) => {\n if (!isObjectType(type)) {\n return null;\n }\n const interfaces = type.getInterfaces();\n return interfaces.length > 0 ? (\n <ExplorerSection title=\"Implements\">\n {type.getInterfaces().map(implementedInterface => (\n <div key={implementedInterface.name}>\n <TypeLink type={implementedInterface} />\n </div>\n ))}\n </ExplorerSection>\n ) : null;\n};\n\nconst Fields: FC<{ type: GraphQLNamedType }> = ({ type }) => {\n const [showDeprecated, setShowDeprecated] = useState(false);\n const handleShowDeprecated = () => {\n setShowDeprecated(true);\n };\n\n if (\n !isObjectType(type) &&\n !isInterfaceType(type) &&\n !isInputObjectType(type)\n ) {\n return null;\n }\n\n const fieldMap = type.getFields();\n\n const fields: DocExplorerFieldDef[] = [];\n const deprecatedFields: DocExplorerFieldDef[] = [];\n\n for (const field of Object.keys(fieldMap).map(name => fieldMap[name])) {\n if (field.deprecationReason) {\n deprecatedFields.push(field);\n } else {\n fields.push(field);\n }\n }\n\n return (\n <>\n {fields.length > 0 ? (\n <ExplorerSection title=\"Fields\">\n {fields.map(field => (\n <Field key={field.name} field={field} />\n ))}\n </ExplorerSection>\n ) : null}\n {deprecatedFields.length > 0 ? (\n showDeprecated || fields.length === 0 ? (\n <ExplorerSection title=\"Deprecated Fields\">\n {deprecatedFields.map(field => (\n <Field key={field.name} field={field} />\n ))}\n </ExplorerSection>\n ) : (\n <Button type=\"button\" onClick={handleShowDeprecated}>\n Show Deprecated Fields\n </Button>\n )\n ) : null}\n </>\n );\n};\n\nconst Field: FC<{ field: DocExplorerFieldDef }> = ({ field }) => {\n const args =\n 'args' in field ? field.args.filter(arg => !arg.deprecationReason) : [];\n return (\n <div className=\"graphiql-doc-explorer-item\">\n <div>\n <FieldLink field={field} />\n {args.length > 0 ? (\n <>\n (\n <span>\n {args.map(arg =>\n args.length === 1 ? (\n <Argument key={arg.name} arg={arg} inline />\n ) : (\n <div\n key={arg.name}\n className=\"graphiql-doc-explorer-argument-multiple\"\n >\n <Argument arg={arg} inline />\n </div>\n ),\n )}\n </span>\n )\n </>\n ) : null}\n {': '}\n <TypeLink type={field.type} />\n <DefaultValue field={field} />\n </div>\n {field.description ? (\n <MarkdownContent type=\"description\" onlyShowFirstChild>\n {field.description}\n </MarkdownContent>\n ) : null}\n <DeprecationReason>{field.deprecationReason}</DeprecationReason>\n </div>\n );\n};\n\nconst EnumValues: FC<{ type: GraphQLNamedType }> = ({ type }) => {\n const [showDeprecated, setShowDeprecated] = useState(false);\n const handleShowDeprecated = () => {\n setShowDeprecated(true);\n };\n\n if (!isEnumType(type)) {\n return null;\n }\n\n const values: GraphQLEnumValue[] = [];\n const deprecatedValues: GraphQLEnumValue[] = [];\n for (const value of type.getValues()) {\n if (value.deprecationReason) {\n deprecatedValues.push(value);\n } else {\n values.push(value);\n }\n }\n\n return (\n <>\n {values.length > 0 ? (\n <ExplorerSection title=\"Enum Values\">\n {values.map(value => (\n <EnumValue key={value.name} value={value} />\n ))}\n </ExplorerSection>\n ) : null}\n {deprecatedValues.length > 0 ? (\n showDeprecated || values.length === 0 ? (\n <ExplorerSection title=\"Deprecated Enum Values\">\n {deprecatedValues.map(value => (\n <EnumValue key={value.name} value={value} />\n ))}\n </ExplorerSection>\n ) : (\n <Button type=\"button\" onClick={handleShowDeprecated}>\n Show Deprecated Values\n </Button>\n )\n ) : null}\n </>\n );\n};\n\nconst EnumValue: FC<{ value: GraphQLEnumValue }> = ({ value }) => {\n return (\n <div className=\"graphiql-doc-explorer-item\">\n <div className=\"graphiql-doc-explorer-enum-value\">{value.name}</div>\n {value.description ? (\n <MarkdownContent type=\"description\">\n {value.description}\n </MarkdownContent>\n ) : null}\n {value.deprecationReason ? (\n <MarkdownContent type=\"deprecation\">\n {value.deprecationReason}\n </MarkdownContent>\n ) : null}\n </div>\n );\n};\n\nconst PossibleTypes: FC<{ type: GraphQLNamedType }> = ({ type }) => {\n const { schema } = useSchemaContext({ nonNull: true });\n if (!schema || !isAbstractType(type)) {\n return null;\n }\n return (\n <ExplorerSection\n title={isInterfaceType(type) ? 'Implementations' : 'Possible Types'}\n >\n {schema.getPossibleTypes(type).map(possibleType => (\n <div key={possibleType.name}>\n <TypeLink type={possibleType} />\n </div>\n ))}\n </ExplorerSection>\n );\n};\n"],"names":["TypeDocumentation","t0","$","_c","type","t1","isNamedType","description","ImplementsInterfaces","isObjectType","getInterfaces","interfaces","t2","length","map","_temp","Fields","showDeprecated","setShowDeprecated","useState","Symbol","for","handleShowDeprecated","isInterfaceType","isInputObjectType","deprecatedFields","fields","fieldMap","getFields","field","Object","keys","name","deprecationReason","push","_temp2","t3","_temp3","t4","Field","args","filter","_temp4","arg_0","arg","t5","t6","t7","t8","t9","EnumValues","isEnumType","deprecatedValues","values","value","getValues","_temp5","_temp6","EnumValue","PossibleTypes","nonNull","schema","useSchemaContext","isAbstractType","getPossibleTypes","_temp7","implementedInterface","field_0","field_1","value_0","value_1","possibleType"],"mappings":";;;;;;;;;;;;AA4BO,MAAMA,oBAAgDC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAAQI,MAAAA;AAAAH,MAAAA,SAAAE,MAAA;AAC7DE,SAAAA,YAAYF,IAAI,IAElBA,qBAAAA,UAAAA,EAAAA,UAAAA;AAAAA,MAAAA,KAAIG,cACF,oBAAA,iBAAA,EAAqB,MAAA,eAAeH,UAAAA,KAAIG,aAAa,IACjD;AAAA,MACP,oBAAC,wBAA2BH,MAAI;AAAA,MAChC,oBAAC,UAAaA,MAAI;AAAA,MAClB,oBAAC,cAAiBA,MAAI;AAAA,MACtB,oBAAC,iBAAoBA,KAAI,CAAA;AAAA,IAAA,EAAA,CAAI,IAEzB;AAAAF,WAAAE;AAAAF,WAAAG;AAAAA,EAAAA,OAAA;AAAAA,SAAAH,EAAA,CAAA;AAAA,EAAA;AAVDG,SAAAA;AAUC;AAGV,MAAMG,uBAAuDP,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AACvDQ,MAAAA,CAAAA,aAAaL,IAAI,GAAC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ADpBA,aAAYvC,IAEtB;AAAM;"}
@@ -1,3 +1,4 @@
1
+ import { FC } from 'react';
1
2
  import { GraphQLType } from 'graphql';
2
3
  declare type TypeLinkProps = {
3
4
  /**
@@ -5,5 +6,5 @@ declare type TypeLinkProps = {
5
6
  */
6
7
  type: GraphQLType;
7
8
  };
8
- export declare function TypeLink(props: TypeLinkProps): import("react").JSX.Element | null;
9
+ export declare const TypeLink: FC<TypeLinkProps>;
9
10
  export {};
@@ -1,28 +1,21 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { useExplorerContext } from "../context.js";
3
+ import { useDocExplorerActions } from "../context.js";
4
4
  import { renderType } from "./utils.js";
5
5
  /* empty css */
6
- function TypeLink(props) {
7
- const $ = c(6);
8
- let t0;
9
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
10
- t0 = {
11
- nonNull: true,
12
- caller: TypeLink
13
- };
14
- $[0] = t0;
15
- } else {
16
- t0 = $[0];
17
- }
6
+ const TypeLink = (t0) => {
7
+ const $ = c(5);
8
+ const {
9
+ type
10
+ } = t0;
18
11
  const {
19
12
  push
20
- } = useExplorerContext(t0);
21
- if (!props.type) {
13
+ } = useDocExplorerActions();
14
+ if (!type) {
22
15
  return null;
23
16
  }
24
17
  let t1;
25
- if ($[1] !== push) {
18
+ if ($[0] !== push) {
26
19
  t1 = (namedType) => /* @__PURE__ */ jsx("a", { className: "graphiql-doc-explorer-type-name", onClick: (event) => {
27
20
  event.preventDefault();
28
21
  push({
@@ -30,22 +23,22 @@ function TypeLink(props) {
30
23
  def: namedType
31
24
  });
32
25
  }, href: "#", children: namedType.name });
33
- $[1] = push;
34
- $[2] = t1;
26
+ $[0] = push;
27
+ $[1] = t1;
35
28
  } else {
36
- t1 = $[2];
29
+ t1 = $[1];
37
30
  }
38
31
  let t2;
39
- if ($[3] !== props.type || $[4] !== t1) {
40
- t2 = renderType(props.type, t1);
41
- $[3] = props.type;
42
- $[4] = t1;
43
- $[5] = t2;
32
+ if ($[2] !== t1 || $[3] !== type) {
33
+ t2 = renderType(type, t1);
34
+ $[2] = t1;
35
+ $[3] = type;
36
+ $[4] = t2;
44
37
  } else {
45
- t2 = $[5];
38
+ t2 = $[4];
46
39
  }
47
40
  return t2;
48
- }
41
+ };
49
42
  export {
50
43
  TypeLink
51
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"type-link.js","sources":["../../src/components/type-link.tsx"],"sourcesContent":["import { GraphQLType } from 'graphql';\n\nimport { useExplorerContext } from '../context';\nimport { renderType } from './utils';\n\nimport './type-link.css';\n\ntype TypeLinkProps = {\n /**\n * The type that should be linked to.\n */\n type: GraphQLType;\n};\n\nexport function TypeLink(props: TypeLinkProps) {\n const { push } = useExplorerContext({ nonNull: true, caller: TypeLink });\n\n if (!props.type) {\n return null;\n }\n\n return renderType(props.type, namedType => (\n <a\n className=\"graphiql-doc-explorer-type-name\"\n onClick={event => {\n event.preventDefault();\n push({ name: namedType.name, def: namedType });\n }}\n href=\"#\"\n >\n {namedType.name}\n </a>\n ));\n}\n"],"names":["TypeLink","props","$","_c","t0","Symbol","for","nonNull","caller","push","useExplorerContext","type","t1","namedType","event","preventDefault","name","def","t2","renderType"],"mappings":";;;;;AAcO,SAAAA,SAAAC,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAAC,MAAAA;AAAA,MAAAF,EAAA,CAAA,MAAAG,OAAAC,IAAA,2BAAA,GAAA;AAC+B,SAAA;AAAA,MAAAC,SAAA;AAAA,MAAAC,QAAAR;AAAAA,IAAA;AAAmCE,WAAAE;AAAAA,EAAAA,OAAA;AAAAA,SAAAF,EAAA,CAAA;AAAA,EAAA;AAAvE,QAAA;AAAA,IAAAO;AAAAA,EAAAA,IAAiBC,mBAAmBN,EAAmC;AAElEH,MAAAA,CAAAA,MAAKU,MAAA;AAAA,WAAA;AAAA,EAAA;AAAAC,MAAAA;AAAAV,MAAAA,SAAAO,MAAA;AAIoBG,SAAAC,eAC5B,oBAAA,KAAA,EACY,WAAA,mCACD,SAAAC,CAAA,UAAA;AACPA,YAAKC,eAAgB;AACjB,WAAA;AAAA,QAAAC,MAASH,UAASG;AAAAA,QAAAC,KAAYJ;AAAAA,MAAAA,CAAW;AAAA,IAE1C,GAAA,MAAA,KAEJA,UAAAA,UAASG,KACZ,CAAA;AACDd,WAAAO;AAAAP,WAAAU;AAAAA,EAAAA,OAAA;AAAAA,SAAAV,EAAA,CAAA;AAAA,EAAA;AAAAgB,MAAAA;AAAAhB,MAAAA,SAAAD,MAAAU,QAAAT,SAAAU,IAAA;AAXMO,SAAAA,WAAWlB,MAAKU,MAAOC,EAW7B;AAAC,MAAA,CAAA,IAAAX,MAAAU;AAAAT,WAAAU;AAAAV,WAAAgB;AAAAA,EAAAA,OAAA;AAAAA,SAAAhB,EAAA,CAAA;AAAA,EAAA;AAXKgB,SAAAA;AAWL;"}
1
+ {"version":3,"file":"type-link.js","sources":["../../src/components/type-link.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { GraphQLType } from 'graphql';\nimport { useDocExplorerActions } from '../context';\nimport { renderType } from './utils';\nimport './type-link.css';\n\ntype TypeLinkProps = {\n /**\n * The type that should be linked to.\n */\n type: GraphQLType;\n};\n\nexport const TypeLink: FC<TypeLinkProps> = ({ type }) => {\n const { push } = useDocExplorerActions();\n\n if (!type) {\n return null;\n }\n\n return renderType(type, namedType => (\n <a\n className=\"graphiql-doc-explorer-type-name\"\n onClick={event => {\n event.preventDefault();\n push({ name: namedType.name, def: namedType });\n }}\n href=\"#\"\n >\n {namedType.name}\n </a>\n ));\n};\n"],"names":["TypeLink","t0","$","_c","type","push","useDocExplorerActions","t1","namedType","event","preventDefault","name","def","t2","renderType"],"mappings":";;;;;AAaO,MAAMA,WAA8BC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAC1C,QAAA;AAAA,IAAAI;AAAAA,MAAiBC,sBAAsB;AAAE,MAAA,CAEpCF,MAAI;AAAA,WAAA;AAAA,EAAA;AAAAG,MAAAA;AAAAL,MAAAA,SAAAG,MAAA;AAIeE,SAAAC,eACtB,oBAAA,KAAA,EACY,WAAA,mCACD,SAAAC,CAAA,UAAA;AACPA,YAAKC,eAAgB;AACjB,WAAA;AAAA,QAAAC,MAASH,UAASG;AAAAA,QAAAC,KAAYJ;AAAAA,MAAAA,CAAW;AAAA,IAE1C,GAAA,MAAA,KAEJA,UAAAA,UAASG,KACZ,CAAA;AACDT,WAAAG;AAAAH,WAAAK;AAAAA,EAAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AAAAW,MAAAA;AAAA,MAAAX,EAAAK,CAAAA,MAAAA,MAAAL,SAAAE,MAAA;AAXMU,SAAAA,WAAWV,MAAMG,EAWvB;AAACL,WAAAK;AAAAL,WAAAE;AAAAF,WAAAW;AAAAA,EAAAA,OAAA;AAAAA,SAAAX,EAAA,CAAA;AAAA,EAAA;AAXKW,SAAAA;AAWL;"}
package/dist/context.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { GraphQLArgument, GraphQLField, GraphQLInputField, GraphQLNamedType } from 'graphql';
2
- import { ReactNode } from 'react';
3
- export declare type ExplorerFieldDef = GraphQLField<unknown, unknown> | GraphQLInputField | GraphQLArgument;
4
- export declare type ExplorerNavStackItem = {
1
+ import { GraphQLArgument, GraphQLField, GraphQLInputField, GraphQLNamedType, GraphQLSchema } from 'graphql';
2
+ import { FC, ReactNode, RefObject } from 'react';
3
+ import { SchemaContextType } from '@graphiql/react';
4
+ import { StoreApi } from 'zustand';
5
+ export declare type DocExplorerFieldDef = GraphQLField<unknown, unknown> | GraphQLInputField | GraphQLArgument;
6
+ export declare type DocExplorerNavStackItem = {
5
7
  /**
6
8
  * The name of the item.
7
9
  */
@@ -10,23 +12,52 @@ export declare type ExplorerNavStackItem = {
10
12
  * The definition object of the item, this can be a named type, a field, an
11
13
  * input field or an argument.
12
14
  */
13
- def?: GraphQLNamedType | ExplorerFieldDef;
15
+ def?: GraphQLNamedType | DocExplorerFieldDef;
14
16
  };
15
- export declare type ExplorerNavStack = [
16
- ExplorerNavStackItem,
17
- ...ExplorerNavStackItem[]
17
+ export declare type DocExplorerNavStack = [
18
+ DocExplorerNavStackItem,
19
+ ...DocExplorerNavStackItem[]
18
20
  ];
19
- export declare type ExplorerContextType = {
21
+ export declare type DocExplorerContextType = {
20
22
  /**
21
23
  * A stack of navigation items. The last item in the list is the current one.
22
24
  * This list always contains at least one item.
23
25
  */
24
- explorerNavStack: ExplorerNavStack;
26
+ explorerNavStack: DocExplorerNavStack;
27
+ actions: {
28
+ /**
29
+ * Push an item to the navigation stack.
30
+ * @param item The item that should be pushed to the stack.
31
+ */
32
+ push(item: DocExplorerNavStackItem): void;
33
+ /**
34
+ * Pop the last item from the navigation stack.
35
+ */
36
+ pop(): void;
37
+ /**
38
+ * Reset the navigation stack to its initial state, this will remove all but
39
+ * the initial stack item.
40
+ */
41
+ reset(): void;
42
+ resolveSchemaReferenceToNavItem(schemaReference: SchemaContextType['schemaReference']): void;
43
+ /**
44
+ * Replace the nav stack with an updated version using the new schema.
45
+ */
46
+ rebuildNavStackWithSchema(schema: GraphQLSchema): void;
47
+ };
48
+ };
49
+ export declare function createDocExplorerStore(initialNavStackItem?: DocExplorerNavStackItem): StoreApi<DocExplorerContextType>;
50
+ export declare const DocExplorerContext: import('react').Context<RefObject<StoreApi<DocExplorerContextType>> | null>;
51
+ export declare const DocExplorerContextProvider: FC<{
52
+ children: ReactNode;
53
+ }>;
54
+ export declare const useDocExplorer: () => DocExplorerNavStack;
55
+ export declare const useDocExplorerActions: () => {
25
56
  /**
26
57
  * Push an item to the navigation stack.
27
58
  * @param item The item that should be pushed to the stack.
28
59
  */
29
- push(item: ExplorerNavStackItem): void;
60
+ push(item: DocExplorerNavStackItem): void;
30
61
  /**
31
62
  * Pop the last item from the navigation stack.
32
63
  */
@@ -36,21 +67,9 @@ export declare type ExplorerContextType = {
36
67
  * the initial stack item.
37
68
  */
38
69
  reset(): void;
70
+ resolveSchemaReferenceToNavItem(schemaReference: SchemaContextType['schemaReference']): void;
71
+ /**
72
+ * Replace the nav stack with an updated version using the new schema.
73
+ */
74
+ rebuildNavStackWithSchema(schema: GraphQLSchema): void;
39
75
  };
40
- export declare const ExplorerContext: import('react').Context<ExplorerContextType | null>;
41
- declare type ExplorerContextProviderProps = {
42
- children: ReactNode;
43
- };
44
- export declare function ExplorerContextProvider(props: ExplorerContextProviderProps): import("react/jsx-runtime").JSX.Element;
45
- export declare const useExplorerContext: {
46
- (options: {
47
- nonNull: true;
48
- caller?: Function | undefined;
49
- }): ExplorerContextType;
50
- (options: {
51
- nonNull?: boolean | undefined;
52
- caller?: Function | undefined;
53
- }): ExplorerContextType | null;
54
- (): ExplorerContextType | null;
55
- };
56
- export {};