@graphiql/plugin-doc-explorer 0.0.1-canary-aa7ad225.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 (49) hide show
  1. package/README.md +1 -0
  2. package/dist/components/argument.d.ts +21 -0
  3. package/dist/components/argument.js +96 -0
  4. package/dist/components/argument.js.map +1 -0
  5. package/dist/components/default-value.d.ts +9 -0
  6. package/dist/components/default-value.js +78 -0
  7. package/dist/components/default-value.js.map +1 -0
  8. package/dist/components/deprecation-reason.d.ts +9 -0
  9. package/dist/components/deprecation-reason.js +24 -0
  10. package/dist/components/deprecation-reason.js.map +1 -0
  11. package/dist/components/directive.d.ts +9 -0
  12. package/dist/components/directive.js +25 -0
  13. package/dist/components/directive.js.map +1 -0
  14. package/dist/components/doc-explorer.d.ts +1 -0
  15. package/dist/components/doc-explorer.js +234 -0
  16. package/dist/components/doc-explorer.js.map +1 -0
  17. package/dist/components/field-documentation.d.ts +9 -0
  18. package/dist/components/field-documentation.js +182 -0
  19. package/dist/components/field-documentation.js.map +1 -0
  20. package/dist/components/field-link.d.ts +9 -0
  21. package/dist/components/field-link.js +48 -0
  22. package/dist/components/field-link.js.map +1 -0
  23. package/dist/components/index.d.ts +12 -0
  24. package/dist/components/schema-documentation.d.ts +9 -0
  25. package/dist/components/schema-documentation.js +168 -0
  26. package/dist/components/schema-documentation.js.map +1 -0
  27. package/dist/components/search.d.ts +17 -0
  28. package/dist/components/search.js +379 -0
  29. package/dist/components/search.js.map +1 -0
  30. package/dist/components/section.d.ts +11 -0
  31. package/dist/components/section.js +68 -0
  32. package/dist/components/section.js.map +1 -0
  33. package/dist/components/type-documentation.d.ts +9 -0
  34. package/dist/components/type-documentation.js +394 -0
  35. package/dist/components/type-documentation.js.map +1 -0
  36. package/dist/components/type-link.d.ts +9 -0
  37. package/dist/components/type-link.js +52 -0
  38. package/dist/components/type-link.js.map +1 -0
  39. package/dist/components/utils.d.ts +3 -0
  40. package/dist/components/utils.js +22 -0
  41. package/dist/components/utils.js.map +1 -0
  42. package/dist/context.d.ts +56 -0
  43. package/dist/context.js +234 -0
  44. package/dist/context.js.map +1 -0
  45. package/dist/index.d.ts +5 -0
  46. package/dist/index.js +42 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/style.css +285 -0
  49. package/package.json +60 -0
@@ -0,0 +1,182 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { c } from "react-compiler-runtime";
3
+ import { useState } from "react";
4
+ import { MarkdownContent, Button } from "@graphiql/react";
5
+ import { Argument } from "./argument.js";
6
+ import { DeprecationReason } from "./deprecation-reason.js";
7
+ import { Directive } from "./directive.js";
8
+ import { ExplorerSection } from "./section.js";
9
+ import { TypeLink } from "./type-link.js";
10
+ function FieldDocumentation(props) {
11
+ const $ = c(15);
12
+ let t0;
13
+ if ($[0] !== props.field.description) {
14
+ t0 = props.field.description ? /* @__PURE__ */ jsx(MarkdownContent, { type: "description", children: props.field.description }) : null;
15
+ $[0] = props.field.description;
16
+ $[1] = t0;
17
+ } else {
18
+ t0 = $[1];
19
+ }
20
+ let t1;
21
+ if ($[2] !== props.field.deprecationReason) {
22
+ t1 = /* @__PURE__ */ jsx(DeprecationReason, { preview: false, children: props.field.deprecationReason });
23
+ $[2] = props.field.deprecationReason;
24
+ $[3] = t1;
25
+ } else {
26
+ t1 = $[3];
27
+ }
28
+ let t2;
29
+ if ($[4] !== props.field.type) {
30
+ t2 = /* @__PURE__ */ jsx(ExplorerSection, { title: "Type", children: /* @__PURE__ */ jsx(TypeLink, { type: props.field.type }) });
31
+ $[4] = props.field.type;
32
+ $[5] = t2;
33
+ } else {
34
+ t2 = $[5];
35
+ }
36
+ let t3;
37
+ let t4;
38
+ if ($[6] !== props.field) {
39
+ t3 = /* @__PURE__ */ jsx(Arguments, { field: props.field });
40
+ t4 = /* @__PURE__ */ jsx(Directives, { field: props.field });
41
+ $[6] = props.field;
42
+ $[7] = t3;
43
+ $[8] = t4;
44
+ } else {
45
+ t3 = $[7];
46
+ t4 = $[8];
47
+ }
48
+ let t5;
49
+ if ($[9] !== t0 || $[10] !== t1 || $[11] !== t2 || $[12] !== t3 || $[13] !== t4) {
50
+ t5 = /* @__PURE__ */ jsxs(Fragment, { children: [
51
+ t0,
52
+ t1,
53
+ t2,
54
+ t3,
55
+ t4
56
+ ] });
57
+ $[9] = t0;
58
+ $[10] = t1;
59
+ $[11] = t2;
60
+ $[12] = t3;
61
+ $[13] = t4;
62
+ $[14] = t5;
63
+ } else {
64
+ t5 = $[14];
65
+ }
66
+ return t5;
67
+ }
68
+ function Arguments(t0) {
69
+ const $ = c(12);
70
+ const {
71
+ field
72
+ } = t0;
73
+ const [showDeprecated, setShowDeprecated] = useState(false);
74
+ let t1;
75
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
76
+ t1 = () => {
77
+ setShowDeprecated(true);
78
+ };
79
+ $[0] = t1;
80
+ } else {
81
+ t1 = $[0];
82
+ }
83
+ const handleShowDeprecated = t1;
84
+ if (!("args" in field)) {
85
+ return null;
86
+ }
87
+ let args;
88
+ let deprecatedArgs;
89
+ let t2;
90
+ if ($[1] !== field.args) {
91
+ args = [];
92
+ deprecatedArgs = [];
93
+ for (const argument of field.args) {
94
+ if (argument.deprecationReason) {
95
+ deprecatedArgs.push(argument);
96
+ } else {
97
+ args.push(argument);
98
+ }
99
+ }
100
+ t2 = args.length > 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Arguments", children: args.map(_temp) }) : null;
101
+ $[1] = field.args;
102
+ $[2] = args;
103
+ $[3] = deprecatedArgs;
104
+ $[4] = t2;
105
+ } else {
106
+ args = $[2];
107
+ deprecatedArgs = $[3];
108
+ t2 = $[4];
109
+ }
110
+ let t3;
111
+ if ($[5] !== args.length || $[6] !== deprecatedArgs || $[7] !== showDeprecated) {
112
+ t3 = deprecatedArgs.length > 0 ? showDeprecated || args.length === 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Deprecated Arguments", children: deprecatedArgs.map(_temp2) }) : /* @__PURE__ */ jsx(Button, { type: "button", onClick: handleShowDeprecated, children: "Show Deprecated Arguments" }) : null;
113
+ $[5] = args.length;
114
+ $[6] = deprecatedArgs;
115
+ $[7] = showDeprecated;
116
+ $[8] = t3;
117
+ } else {
118
+ t3 = $[8];
119
+ }
120
+ let t4;
121
+ if ($[9] !== t2 || $[10] !== t3) {
122
+ t4 = /* @__PURE__ */ jsxs(Fragment, { children: [
123
+ t2,
124
+ t3
125
+ ] });
126
+ $[9] = t2;
127
+ $[10] = t3;
128
+ $[11] = t4;
129
+ } else {
130
+ t4 = $[11];
131
+ }
132
+ return t4;
133
+ }
134
+ function _temp2(arg_0) {
135
+ return /* @__PURE__ */ jsx(Argument, { arg: arg_0 }, arg_0.name);
136
+ }
137
+ function _temp(arg) {
138
+ return /* @__PURE__ */ jsx(Argument, { arg }, arg.name);
139
+ }
140
+ function Directives(t0) {
141
+ var _a, _b, _c;
142
+ const $ = c(6);
143
+ const {
144
+ field
145
+ } = t0;
146
+ let t1;
147
+ if ($[0] !== ((_a = field.astNode) == null ? void 0 : _a.directives)) {
148
+ t1 = ((_b = field.astNode) == null ? void 0 : _b.directives) || [];
149
+ $[0] = (_c = field.astNode) == null ? void 0 : _c.directives;
150
+ $[1] = t1;
151
+ } else {
152
+ t1 = $[1];
153
+ }
154
+ const directives = t1;
155
+ if (!directives || directives.length === 0) {
156
+ return null;
157
+ }
158
+ let t2;
159
+ if ($[2] !== directives) {
160
+ t2 = directives.map(_temp3);
161
+ $[2] = directives;
162
+ $[3] = t2;
163
+ } else {
164
+ t2 = $[3];
165
+ }
166
+ let t3;
167
+ if ($[4] !== t2) {
168
+ t3 = /* @__PURE__ */ jsx(ExplorerSection, { title: "Directives", children: t2 });
169
+ $[4] = t2;
170
+ $[5] = t3;
171
+ } else {
172
+ t3 = $[5];
173
+ }
174
+ return t3;
175
+ }
176
+ function _temp3(directive) {
177
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Directive, { directive }) }, directive.name.value);
178
+ }
179
+ export {
180
+ FieldDocumentation
181
+ };
182
+ //# sourceMappingURL=field-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-documentation.js","sources":["../../src/components/field-documentation.tsx"],"sourcesContent":["import { GraphQLArgument } from 'graphql';\nimport { useState } from 'react';\n\nimport { Button, MarkdownContent } from '@graphiql/react';\nimport { ExplorerFieldDef } from '../context';\nimport { Argument } from './argument';\nimport { DeprecationReason } from './deprecation-reason';\nimport { Directive } from './directive';\nimport { ExplorerSection } from './section';\nimport { TypeLink } from './type-link';\n\ntype FieldDocumentationProps = {\n /**\n * The field or argument that should be rendered.\n */\n field: ExplorerFieldDef;\n};\n\nexport function FieldDocumentation(props: FieldDocumentationProps) {\n return (\n <>\n {props.field.description ? (\n <MarkdownContent type=\"description\">\n {props.field.description}\n </MarkdownContent>\n ) : null}\n <DeprecationReason preview={false}>\n {props.field.deprecationReason}\n </DeprecationReason>\n <ExplorerSection title=\"Type\">\n <TypeLink type={props.field.type} />\n </ExplorerSection>\n <Arguments field={props.field} />\n <Directives field={props.field} />\n </>\n );\n}\n\nfunction Arguments({ field }: { field: ExplorerFieldDef }) {\n const [showDeprecated, setShowDeprecated] = useState(false);\n const handleShowDeprecated = () => {\n setShowDeprecated(true);\n };\n\n if (!('args' in field)) {\n return null;\n }\n\n const args: GraphQLArgument[] = [];\n const deprecatedArgs: GraphQLArgument[] = [];\n for (const argument of field.args) {\n if (argument.deprecationReason) {\n deprecatedArgs.push(argument);\n } else {\n args.push(argument);\n }\n }\n\n return (\n <>\n {args.length > 0 ? (\n <ExplorerSection title=\"Arguments\">\n {args.map(arg => (\n <Argument key={arg.name} arg={arg} />\n ))}\n </ExplorerSection>\n ) : null}\n {deprecatedArgs.length > 0 ? (\n showDeprecated || args.length === 0 ? (\n <ExplorerSection title=\"Deprecated Arguments\">\n {deprecatedArgs.map(arg => (\n <Argument key={arg.name} arg={arg} />\n ))}\n </ExplorerSection>\n ) : (\n <Button type=\"button\" onClick={handleShowDeprecated}>\n Show Deprecated Arguments\n </Button>\n )\n ) : null}\n </>\n );\n}\n\nfunction Directives({ field }: { field: ExplorerFieldDef }) {\n const directives = field.astNode?.directives || [];\n if (!directives || directives.length === 0) {\n return null;\n }\n return (\n <ExplorerSection title=\"Directives\">\n {directives.map(directive => (\n <div key={directive.name.value}>\n <Directive directive={directive} />\n </div>\n ))}\n </ExplorerSection>\n );\n}\n"],"names":["FieldDocumentation","props","$","_c","t0","field","description","t1","deprecationReason","t2","type","t3","t4","t5","Arguments","showDeprecated","setShowDeprecated","useState","Symbol","for","handleShowDeprecated","args","deprecatedArgs","argument","push","length","map","_temp","_temp2","arg_0","arg","name","Directives","astNode","directives","_temp3","directive","value"],"mappings":";;;;;;;;;AAkBO,SAAAA,mBAAAC,OAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAAC,MAAAA;AAAA,MAAAF,EAAAD,CAAAA,MAAAA,MAAAI,MAAAC,aAAA;AAGAL,SAAAA,MAAKI,MAAAC,cACH,oBAAA,iBAAA,EAAqB,MAAA,eACnBL,UAAAA,MAAKI,MAAAC,YAAAA,CACR,IACM;AAAAL,MAAAA,CAAAA,IAAAA,MAAAI,MAAAC;AAAAJ,WAAAE;AAAAA,EAAAA,OAAA;AAAAA,SAAAF,EAAA,CAAA;AAAA,EAAA;AAAAK,MAAAA;AAAA,MAAAL,EAAAD,CAAAA,MAAAA,MAAAI,MAAAG,mBAAA;AACRD,6BAAC,mBAA2B,EAAA,gBACzBN,UAAAA,MAAKI,MAAAG,mBACR;AAAoBP,MAAAA,CAAAA,IAAAA,MAAAI,MAAAG;AAAAN,WAAAK;AAAAA,EAAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AAAAO,MAAAA;AAAA,MAAAP,EAAAD,CAAAA,MAAAA,MAAAI,MAAAK,MAAA;AACpB,SAAA,oBAAC,iBAAsB,EAAA,OAAA,QACrB,UAAA,oBAAC,YAAe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AAAkBP,WAAAO;AAAAP,WAAAS;AAAAA,EAAAA,OAAA;AAAAA,SAAAT,EAAA,CAAA;AAAA,EAAA;AANlBS,SAAAA;AAMkB;AAZtB,SAAAwB,OAAAC,WAAA;AAQQ,SAAA,oBAAA,SACE,UAAC,oBAAA,WAAA,EAAqBA,UACxB,CAAA,EAFUA,GAAAA,UAASL,KAAAM,KAEnB;AAAM;"}
@@ -0,0 +1,9 @@
1
+ import { ExplorerFieldDef } from '../context';
2
+ declare type FieldLinkProps = {
3
+ /**
4
+ * The field or argument that should be linked to.
5
+ */
6
+ field: ExplorerFieldDef;
7
+ };
8
+ export declare function FieldLink(props: FieldLinkProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,48 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react-compiler-runtime";
3
+ import { useExplorerContext } from "../context.js";
4
+ /* empty css */
5
+ function FieldLink(props) {
6
+ const $ = c(7);
7
+ let t0;
8
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
9
+ t0 = {
10
+ nonNull: true
11
+ };
12
+ $[0] = t0;
13
+ } else {
14
+ t0 = $[0];
15
+ }
16
+ const {
17
+ push
18
+ } = useExplorerContext(t0);
19
+ let t1;
20
+ if ($[1] !== props.field || $[2] !== push) {
21
+ t1 = (event) => {
22
+ event.preventDefault();
23
+ push({
24
+ name: props.field.name,
25
+ def: props.field
26
+ });
27
+ };
28
+ $[1] = props.field;
29
+ $[2] = push;
30
+ $[3] = t1;
31
+ } else {
32
+ t1 = $[3];
33
+ }
34
+ let t2;
35
+ if ($[4] !== props.field.name || $[5] !== t1) {
36
+ t2 = /* @__PURE__ */ jsx("a", { className: "graphiql-doc-explorer-field-name", onClick: t1, href: "#", children: props.field.name });
37
+ $[4] = props.field.name;
38
+ $[5] = t1;
39
+ $[6] = t2;
40
+ } else {
41
+ t2 = $[6];
42
+ }
43
+ return t2;
44
+ }
45
+ export {
46
+ FieldLink
47
+ };
48
+ //# sourceMappingURL=field-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-link.js","sources":["../../src/components/field-link.tsx"],"sourcesContent":["import { ExplorerFieldDef, useExplorerContext } from '../context';\n\nimport './field-link.css';\n\ntype FieldLinkProps = {\n /**\n * The field or argument that should be linked to.\n */\n field: ExplorerFieldDef;\n};\n\nexport function FieldLink(props: FieldLinkProps) {\n const { push } = useExplorerContext({ nonNull: true });\n\n return (\n <a\n className=\"graphiql-doc-explorer-field-name\"\n onClick={event => {\n event.preventDefault();\n push({ name: props.field.name, def: props.field });\n }}\n href=\"#\"\n >\n {props.field.name}\n </a>\n );\n}\n"],"names":["FieldLink","props","$","_c","t0","Symbol","for","nonNull","push","useExplorerContext","t1","field","event","preventDefault","name","def","t2"],"mappings":";;;;AAWO,SAAAA,UAAAC,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAAC,MAAAA;AAAA,MAAAF,EAAA,CAAA,MAAAG,OAAAC,IAAA,2BAAA,GAAA;AAC+B,SAAA;AAAA,MAAAC,SAAA;AAAA,IAAA;AAAiBL,WAAAE;AAAAA,EAAAA,OAAA;AAAAA,SAAAF,EAAA,CAAA;AAAA,EAAA;AAArD,QAAA;AAAA,IAAAM;AAAAA,EAAAA,IAAiBC,mBAAmBL,EAAiB;AAAEM,MAAAA;AAAAR,MAAAA,SAAAD,MAAAU,SAAAT,SAAAM,MAAA;AAK1CE,SAAAE,CAAA,UAAA;AACPA,YAAKC,eAAgB;AACjB,WAAA;AAAA,QAAAC,MAASb,MAAKU,MAAAG;AAAAA,QAAAC,KAAkBd,MAAKU;AAAAA,MAAAA,CAAQ;AAAA,IAAC;AACnD,MAAA,CAAA,IAAAV,MAAAU;AAAAT,WAAAM;AAAAN,WAAAQ;AAAAA,EAAAA,OAAA;AAAAA,SAAAR,EAAA,CAAA;AAAA,EAAA;AAAAc,MAAAA;AAAAd,MAAAA,EAAAD,CAAAA,MAAAA,MAAAU,MAAAG,QAAAZ,EAAA,CAAA,MAAAQ,IAAA;AALH,SAAA,oBAAA,KACY,EAAA,WAAA,oCACD,SAAAA,IAIJ,MAAA,KAEJT,UAAKU,MAAAA,MAAAG,KACR,CAAA;AAAIb,MAAAA,CAAAA,IAAAA,MAAAU,MAAAG;AAAAZ,WAAAQ;AAAAR,WAAAc;AAAAA,EAAAA,OAAA;AAAAA,SAAAd,EAAA,CAAA;AAAA,EAAA;AATJc,SAAAA;AASI;"}
@@ -0,0 +1,12 @@
1
+ export { Argument } from './argument';
2
+ export { DefaultValue } from './default-value';
3
+ export { DeprecationReason } from './deprecation-reason';
4
+ export { Directive } from './directive';
5
+ export { DocExplorer } from './doc-explorer';
6
+ export { FieldDocumentation } from './field-documentation';
7
+ export { FieldLink } from './field-link';
8
+ export { SchemaDocumentation } from './schema-documentation';
9
+ export { Search } from './search';
10
+ export { ExplorerSection } from './section';
11
+ export { TypeDocumentation } from './type-documentation';
12
+ export { TypeLink } from './type-link';
@@ -0,0 +1,9 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ declare type SchemaDocumentationProps = {
3
+ /**
4
+ * The schema that should be rendered.
5
+ */
6
+ schema: GraphQLSchema;
7
+ };
8
+ export declare function SchemaDocumentation(props: SchemaDocumentationProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,168 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { c } from "react-compiler-runtime";
3
+ import { MarkdownContent } from "@graphiql/react";
4
+ import { ExplorerSection } from "./section.js";
5
+ import { TypeLink } from "./type-link.js";
6
+ /* empty css */
7
+ function SchemaDocumentation(props) {
8
+ var _a, _b, _c, _d;
9
+ const $ = c(39);
10
+ let t0;
11
+ if ($[0] !== props.schema) {
12
+ t0 = props.schema.getQueryType();
13
+ $[0] = props.schema;
14
+ $[1] = t0;
15
+ } else {
16
+ t0 = $[1];
17
+ }
18
+ const queryType = t0;
19
+ let t1;
20
+ if ($[2] !== props.schema) {
21
+ t1 = (_b = (_a = props.schema).getMutationType) == null ? void 0 : _b.call(_a);
22
+ $[2] = props.schema;
23
+ $[3] = t1;
24
+ } else {
25
+ t1 = $[3];
26
+ }
27
+ const mutationType = t1;
28
+ let t2;
29
+ if ($[4] !== props.schema) {
30
+ t2 = (_d = (_c = props.schema).getSubscriptionType) == null ? void 0 : _d.call(_c);
31
+ $[4] = props.schema;
32
+ $[5] = t2;
33
+ } else {
34
+ t2 = $[5];
35
+ }
36
+ const subscriptionType = t2;
37
+ let T0;
38
+ let t3;
39
+ let t4;
40
+ let t5;
41
+ let t6;
42
+ if ($[6] !== mutationType || $[7] !== props.schema || $[8] !== queryType || $[9] !== subscriptionType) {
43
+ const typeMap = props.schema.getTypeMap();
44
+ const t72 = queryType == null ? void 0 : queryType.name;
45
+ const t82 = mutationType == null ? void 0 : mutationType.name;
46
+ const t9 = subscriptionType == null ? void 0 : subscriptionType.name;
47
+ let t10;
48
+ if ($[15] !== t72 || $[16] !== t82 || $[17] !== t9) {
49
+ t10 = [t72, t82, t9];
50
+ $[15] = t72;
51
+ $[16] = t82;
52
+ $[17] = t9;
53
+ $[18] = t10;
54
+ } else {
55
+ t10 = $[18];
56
+ }
57
+ const ignoreTypesInAllSchema = t10;
58
+ const t11 = props.schema.description || "A GraphQL schema provides a root type for each kind of operation.";
59
+ if ($[19] !== t11) {
60
+ t5 = /* @__PURE__ */ jsx(MarkdownContent, { type: "description", children: t11 });
61
+ $[19] = t11;
62
+ $[20] = t5;
63
+ } else {
64
+ t5 = $[20];
65
+ }
66
+ let t12;
67
+ if ($[21] !== queryType) {
68
+ t12 = queryType ? /* @__PURE__ */ jsxs("div", { children: [
69
+ /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-root-type", children: "query" }),
70
+ ": ",
71
+ /* @__PURE__ */ jsx(TypeLink, { type: queryType })
72
+ ] }) : null;
73
+ $[21] = queryType;
74
+ $[22] = t12;
75
+ } else {
76
+ t12 = $[22];
77
+ }
78
+ let t13;
79
+ if ($[23] !== mutationType) {
80
+ t13 = mutationType && /* @__PURE__ */ jsxs("div", { children: [
81
+ /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-root-type", children: "mutation" }),
82
+ ": ",
83
+ /* @__PURE__ */ jsx(TypeLink, { type: mutationType })
84
+ ] });
85
+ $[23] = mutationType;
86
+ $[24] = t13;
87
+ } else {
88
+ t13 = $[24];
89
+ }
90
+ let t14;
91
+ if ($[25] !== subscriptionType) {
92
+ t14 = subscriptionType && /* @__PURE__ */ jsxs("div", { children: [
93
+ /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-root-type", children: "subscription" }),
94
+ ": ",
95
+ /* @__PURE__ */ jsx(TypeLink, { type: subscriptionType })
96
+ ] });
97
+ $[25] = subscriptionType;
98
+ $[26] = t14;
99
+ } else {
100
+ t14 = $[26];
101
+ }
102
+ if ($[27] !== t12 || $[28] !== t13 || $[29] !== t14) {
103
+ t6 = /* @__PURE__ */ jsxs(ExplorerSection, { title: "Root Types", children: [
104
+ t12,
105
+ t13,
106
+ t14
107
+ ] });
108
+ $[27] = t12;
109
+ $[28] = t13;
110
+ $[29] = t14;
111
+ $[30] = t6;
112
+ } else {
113
+ t6 = $[30];
114
+ }
115
+ T0 = ExplorerSection;
116
+ t3 = "All Schema Types";
117
+ t4 = typeMap && /* @__PURE__ */ jsx("div", { children: Object.values(typeMap).map((type) => {
118
+ if (ignoreTypesInAllSchema.includes(type.name) || type.name.startsWith("__")) {
119
+ return null;
120
+ }
121
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TypeLink, { type }) }, type.name);
122
+ }) });
123
+ $[6] = mutationType;
124
+ $[7] = props.schema;
125
+ $[8] = queryType;
126
+ $[9] = subscriptionType;
127
+ $[10] = T0;
128
+ $[11] = t3;
129
+ $[12] = t4;
130
+ $[13] = t5;
131
+ $[14] = t6;
132
+ } else {
133
+ T0 = $[10];
134
+ t3 = $[11];
135
+ t4 = $[12];
136
+ t5 = $[13];
137
+ t6 = $[14];
138
+ }
139
+ let t7;
140
+ if ($[31] !== T0 || $[32] !== t3 || $[33] !== t4) {
141
+ t7 = /* @__PURE__ */ jsx(T0, { title: t3, children: t4 });
142
+ $[31] = T0;
143
+ $[32] = t3;
144
+ $[33] = t4;
145
+ $[34] = t7;
146
+ } else {
147
+ t7 = $[34];
148
+ }
149
+ let t8;
150
+ if ($[35] !== t5 || $[36] !== t6 || $[37] !== t7) {
151
+ t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
152
+ t5,
153
+ t6,
154
+ t7
155
+ ] });
156
+ $[35] = t5;
157
+ $[36] = t6;
158
+ $[37] = t7;
159
+ $[38] = t8;
160
+ } else {
161
+ t8 = $[38];
162
+ }
163
+ return t8;
164
+ }
165
+ export {
166
+ SchemaDocumentation
167
+ };
168
+ //# sourceMappingURL=schema-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-documentation.js","sources":["../../src/components/schema-documentation.tsx"],"sourcesContent":["import type { GraphQLSchema } from 'graphql';\n\nimport { MarkdownContent } from '@graphiql/react';\nimport { ExplorerSection } from './section';\nimport { TypeLink } from './type-link';\n\nimport './schema-documentation.css';\n\ntype SchemaDocumentationProps = {\n /**\n * The schema that should be rendered.\n */\n schema: GraphQLSchema;\n};\n\nexport function SchemaDocumentation(props: SchemaDocumentationProps) {\n const queryType = props.schema.getQueryType();\n const mutationType = props.schema.getMutationType?.();\n const subscriptionType = props.schema.getSubscriptionType?.();\n const typeMap = props.schema.getTypeMap();\n const ignoreTypesInAllSchema = [\n queryType?.name,\n mutationType?.name,\n subscriptionType?.name,\n ];\n\n return (\n <>\n <MarkdownContent type=\"description\">\n {props.schema.description ||\n 'A GraphQL schema provides a root type for each kind of operation.'}\n </MarkdownContent>\n <ExplorerSection title=\"Root Types\">\n {queryType ? (\n <div>\n <span className=\"graphiql-doc-explorer-root-type\">query</span>\n {': '}\n <TypeLink type={queryType} />\n </div>\n ) : null}\n {mutationType && (\n <div>\n <span className=\"graphiql-doc-explorer-root-type\">mutation</span>\n {': '}\n <TypeLink type={mutationType} />\n </div>\n )}\n {subscriptionType && (\n <div>\n <span className=\"graphiql-doc-explorer-root-type\">\n subscription\n </span>\n {': '}\n <TypeLink type={subscriptionType} />\n </div>\n )}\n </ExplorerSection>\n <ExplorerSection title=\"All Schema Types\">\n {typeMap && (\n <div>\n {Object.values(typeMap).map(type => {\n if (\n ignoreTypesInAllSchema.includes(type.name) ||\n type.name.startsWith('__')\n ) {\n return null;\n }\n\n return (\n <div key={type.name}>\n <TypeLink type={type} />\n </div>\n );\n })}\n </div>\n )}\n </ExplorerSection>\n </>\n );\n}\n"],"names":["SchemaDocumentation","props","$","_c","t0","schema","getQueryType","queryType","t1","getMutationType","mutationType","t2","getSubscriptionType","subscriptionType","T0","t3","t4","t5","t6","typeMap","getTypeMap","t7","name","t8","t9","t10","ignoreTypesInAllSchema","t11","description","t12","t13","t14","ExplorerSection","Object","values","map","type","includes","startsWith"],"mappings":";;;;;;AAeO,SAAAA,oBAAAC,OAAA;;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAAC,MAAAA;AAAA,MAAAF,EAAA,CAAA,MAAAD,MAAAI,QAAA;AACaJ,SAAAA,MAAKI,OAAAC,aAAqB;AAAC,MAAA,CAAA,IAAAL,MAAAI;AAAAH,WAAAE;AAAAA,EAAAA,OAAA;AAAAA,SAAAF,EAAA,CAAA;AAAA,EAAA;AAA7C,QAAAK,YAAkBH;AAA4BI,MAAAA;AAAA,MAAAN,EAAA,CAAA,MAAAD,MAAAI,QAAA;AACzBJ,UAAAA,iBAAKI,QAAAI,oBAALR;AAAgC,MAAA,CAAA,IAAAA,MAAAI;AAAAH,WAAAM;AAAAA,EAAAA,OAAA;AAAAA,SAAAN,EAAA,CAAA;AAAA,EAAA;AAArD,QAAAQ,eAAqBF;AAAiCG,MAAAA;AAAA,MAAAT,EAAA,CAAA,MAAAD,MAAAI,QAAA;AAC7BJ,UAAAA,iBAAKI,QAAAO,wBAALX;AAAoC,MAAA,CAAA,IAAAA,MAA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AAA,wCAOxB,EAAA,UAAA,oBAAC,YAAeF,KAAI,CAAA,KADZA,KAAId,IAEd;AAAA,IAEH,CAAA,GACH;AACDpB,WAAAQ;AAAA,MAAA,CAAA,IAAAT,MAAAI;AAAAH,WAAAK;AAAAL,WAAAW;AAAAX,YAAAY;AAAAZ,YAAAa;AAAAb,YAAAc;AAAAd,YAAAe;AAAAf,YAAAgB;AAAAA,EAAAA,OAAA;AAAAJ,SAAAZ,EAAA,EAAA;AAAAa,SAAAb,EAAA,EAAA;AAAAc,SAAAd,EAAA,EAAA;AAAAe,SAAAf,EAAA,EAAA;AAAAgB,SAAAhB,EAAA,EAAA;AAAA,EAAA;AAAAmB,MAAAA;AAAAnB,MAAAA,EAAAY,EAAAA,MAAAA,MAAAZ,UAAAa,MAAAb,EAAA,EAAA,MAAAc,IAAA;AAlBHK,SAAC,oBAAA,IAAA,EAAsB,OAAAN,IACpBC,UAkBH,IAAA;AAAkBd,YAAAY;AAAAZ,YAAAa;AAAAb,YAAAc;AAAAd,YAAAmB;AAAAA,EAAAA,OAAA;AAAAA,SAAAnB,EAAA,EAAA;AAAA,EAAA;AAAAqB,MAAAA;AAAArB,MAAAA,EAAAe,EAAAA,MAAAA,MAAAf,UAAAgB,MAAAhB,EAAA,EAAA,MAAAmB,IAAA;AAjDpBE,SACEN,qBAAAA,UAAAA,EAAAA,UAAAA;AAAAA,MAAAA;AAAAA,MAIAC;AAAAA,MAyBAG;AAAAA,IAAAA,GAmBkB;AACjBnB,YAAAe;AAAAf,YAAAgB;AAAAhB,YAAAmB;AAAAnB,YAAAqB;AAAAA,EAAAA,OAAA;AAAAA,SAAArB,EAAA,EAAA;AAAA,EAAA;AAlDHqB,SAAAA;AAkDG;"}
@@ -0,0 +1,17 @@
1
+ import { GraphQLArgument, GraphQLField, GraphQLInputField, GraphQLNamedType } from 'graphql';
2
+ import { FC } from 'react';
3
+ export declare const Search: FC;
4
+ declare type TypeMatch = {
5
+ type: GraphQLNamedType;
6
+ };
7
+ declare type FieldMatch = {
8
+ type: GraphQLNamedType;
9
+ field: GraphQLField<unknown, unknown> | GraphQLInputField;
10
+ argument?: GraphQLArgument;
11
+ };
12
+ export declare function useSearchResults(caller?: Function): (searchValue: string) => {
13
+ within: FieldMatch[];
14
+ types: TypeMatch[];
15
+ fields: FieldMatch[];
16
+ };
17
+ export {};