@graphiql/plugin-doc-explorer 0.0.2 → 0.0.3-canary-5d447953.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.
- package/dist/components/default-value.d.ts +2 -2
- package/dist/components/default-value.js.map +1 -1
- package/dist/components/doc-explorer.js +118 -138
- package/dist/components/doc-explorer.js.map +1 -1
- package/dist/components/field-documentation.d.ts +2 -2
- package/dist/components/field-documentation.js.map +1 -1
- package/dist/components/field-link.d.ts +2 -2
- package/dist/components/field-link.js +17 -26
- package/dist/components/field-link.js.map +1 -1
- package/dist/components/search.d.ts +1 -1
- package/dist/components/search.js +115 -152
- package/dist/components/search.js.map +1 -1
- package/dist/components/type-documentation.js +17 -26
- package/dist/components/type-documentation.js.map +1 -1
- package/dist/components/type-link.js +17 -27
- package/dist/components/type-link.js.map +1 -1
- package/dist/context.d.ts +47 -26
- package/dist/context.js +194 -183
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DocExplorerFieldDef } from '../context';
|
|
3
3
|
declare type DefaultValueProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The field or argument for which to render the default value.
|
|
6
6
|
*/
|
|
7
|
-
field:
|
|
7
|
+
field: DocExplorerFieldDef;
|
|
8
8
|
};
|
|
9
9
|
export declare const DefaultValue: FC<DefaultValueProps>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-value.js","sources":["../../src/components/default-value.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { astFromValue, print, ValueNode } from 'graphql';\nimport {
|
|
1
|
+
{"version":3,"file":"default-value.js","sources":["../../src/components/default-value.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { astFromValue, print, ValueNode } from 'graphql';\nimport { DocExplorerFieldDef } from '../context';\nimport './default-value.css';\n\nconst printDefault = (ast?: ValueNode | null): string => {\n if (!ast) {\n return '';\n }\n return print(ast);\n};\n\ntype DefaultValueProps = {\n /**\n * The field or argument for which to render the default value.\n */\n field: DocExplorerFieldDef;\n};\n\nexport const DefaultValue: FC<DefaultValueProps> = ({ field }) => {\n if (!('defaultValue' in field) || field.defaultValue === undefined) {\n return null;\n }\n const ast = astFromValue(field.defaultValue, field.type);\n if (!ast) {\n return null;\n }\n return (\n <>\n {' = '}\n <span className=\"graphiql-doc-explorer-default-value\">\n {printDefault(ast)}\n </span>\n </>\n );\n};\n"],"names":["printDefault","ast","print","DefaultValue","t0","$","_c","field","defaultValue","undefined","t1","t2","type","t3","t4","t5","t6","Symbol","for","astFromValue","bb0","t7","t8"],"mappings":";;;;AAKA,MAAMA,eAAeA,CAACC,QAAmC;AACvD,MAAI,CAACA,KAAK;AACD,WAAA;AAAA,EAAA;AAET,SAAOC,MAAMD,GAAG;AAClB;AASO,MAAME,eAAsCC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAAS,MACvD,EAAE,kBAAkBG,UAAUA,MAAKC,iBAAAC,QAA2B;AAAA,WAAA;AAAA,EAAA;AAGzC,QAAAC,KAAAH,MAAKC;AAAe,QAAAG,KAAAJ,MAAKK;AAAKC,MAAAA;AAAAC,MAAAA;AAAAC,MAAAA;AAAAC,MAAAA;AAAAX,MAAAA,EAAAE,CAAAA,MAAAA,MAAAC,gBAAAH,EAAA,CAAA,MAAAE,MAAAK,MAAA;AAE9CK,SAAAA,OAAAC,iCAAG;AAAC,SAAA;AAFbjB,YAAAA,MAAYkB,aAAaT,IAAoBC,EAAU;AAAE,UAAA,CACpDV,KAAG;AACC,aAAA;AAAImB,cAAAA;AAAAA,MAAAA;AAIH,WAAA;AAC+C,WAAA;AAClDN,WAAAd,aAAaC,GAAG;AAAA,IAAA;AAAC,MAAA,CAAA,IAAAM,MAAAC;AAAA,MAAA,CAAA,IAAAD,MAAAK;AAAAP,WAAAQ;AAAAR,WAAAS;AAAAT,WAAAU;AAAAV,WAAAW;AAAAA,EAAAA,OAAA;AAAAH,SAAAR,EAAA,CAAA;AAAAS,SAAAT,EAAA,CAAA;AAAAU,SAAAV,EAAA,CAAA;AAAAW,SAAAX,EAAA,CAAA;AAAA,EAAA;AAAA,MAAAW,OAAAC,OAAAC,IAAA,6BAAA,GAAA;AAAAF,WAAAA;AAAAA,EAAAA;AAAAK,MAAAA;AAAA,MAAAhB,EAAAQ,CAAAA,MAAAA,MAAAR,SAAAS,IAAA;AADpBO,SAEO,oBAAA,QAAA,EAFS,WAAAR,IACbC,UACH,IAAA;AAAOT,WAAAQ;AAAAR,WAAAS;AAAAT,WAAAgB;AAAAA,EAAAA,OAAA;AAAAA,SAAAhB,EAAA,CAAA;AAAA,EAAA;AAAAiB,MAAAA;AAAA,MAAAjB,EAAAU,CAAAA,MAAAA,MAAAV,UAAAgB,IAAA;AAJTC,SACGP,qBAAAA,UAAAA,EAAAA,UAAAA;AAAAA,MAAAA;AAAAA,MACDM;AAAAA,IAAAA,GAEO;AACNhB,WAAAU;AAAAV,YAAAgB;AAAAhB,YAAAiB;AAAAA,EAAAA,OAAA;AAAAA,SAAAjB,EAAA,EAAA;AAAA,EAAA;AALHiB,SAAAA;AAKG;"}
|
|
@@ -1,126 +1,106 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { isType } from "graphql";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useSchemaStore, Spinner, ChevronLeftIcon } from "@graphiql/react";
|
|
5
|
+
import { useDocExplorer, useDocExplorerActions } from "../context.js";
|
|
6
6
|
import { FieldDocumentation } from "./field-documentation.js";
|
|
7
7
|
import { SchemaDocumentation } from "./schema-documentation.js";
|
|
8
8
|
import { Search } from "./search.js";
|
|
9
9
|
import { TypeDocumentation } from "./type-documentation.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
const DocExplorer = () => {
|
|
12
|
-
const $ = c(
|
|
13
|
-
let t0;
|
|
14
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15
|
-
t0 = {
|
|
16
|
-
nonNull: true,
|
|
17
|
-
caller: DocExplorer
|
|
18
|
-
};
|
|
19
|
-
$[0] = t0;
|
|
20
|
-
} else {
|
|
21
|
-
t0 = $[0];
|
|
22
|
-
}
|
|
12
|
+
const $ = c(38);
|
|
23
13
|
const {
|
|
24
14
|
fetchError,
|
|
25
15
|
isFetching,
|
|
26
16
|
schema,
|
|
27
17
|
validationErrors
|
|
28
|
-
} =
|
|
29
|
-
|
|
30
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
-
t1 = {
|
|
32
|
-
nonNull: true,
|
|
33
|
-
caller: DocExplorer
|
|
34
|
-
};
|
|
35
|
-
$[1] = t1;
|
|
36
|
-
} else {
|
|
37
|
-
t1 = $[1];
|
|
38
|
-
}
|
|
18
|
+
} = useSchemaStore();
|
|
19
|
+
const explorerNavStack = useDocExplorer();
|
|
39
20
|
const {
|
|
40
|
-
explorerNavStack,
|
|
41
21
|
pop
|
|
42
|
-
} =
|
|
22
|
+
} = useDocExplorerActions();
|
|
43
23
|
let content;
|
|
44
24
|
let navItem;
|
|
45
|
-
if ($[
|
|
25
|
+
if ($[0] !== explorerNavStack || $[1] !== fetchError || $[2] !== isFetching || $[3] !== schema || $[4] !== validationErrors) {
|
|
46
26
|
navItem = explorerNavStack.at(-1);
|
|
47
27
|
content = null;
|
|
48
28
|
if (fetchError) {
|
|
49
|
-
let
|
|
50
|
-
if ($[
|
|
51
|
-
|
|
52
|
-
$[
|
|
29
|
+
let t02;
|
|
30
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
+
t02 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-error", children: "Error fetching schema" });
|
|
32
|
+
$[7] = t02;
|
|
53
33
|
} else {
|
|
54
|
-
|
|
34
|
+
t02 = $[7];
|
|
55
35
|
}
|
|
56
|
-
content =
|
|
36
|
+
content = t02;
|
|
57
37
|
} else {
|
|
58
38
|
if (validationErrors.length > 0) {
|
|
59
|
-
let
|
|
60
|
-
if ($[
|
|
61
|
-
|
|
39
|
+
let t02;
|
|
40
|
+
if ($[8] !== validationErrors[0].message) {
|
|
41
|
+
t02 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-error", children: [
|
|
62
42
|
"Schema is invalid: ",
|
|
63
43
|
validationErrors[0].message
|
|
64
44
|
] });
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
45
|
+
$[8] = validationErrors[0].message;
|
|
46
|
+
$[9] = t02;
|
|
67
47
|
} else {
|
|
68
|
-
|
|
48
|
+
t02 = $[9];
|
|
69
49
|
}
|
|
70
|
-
content =
|
|
50
|
+
content = t02;
|
|
71
51
|
} else {
|
|
72
52
|
if (isFetching) {
|
|
73
|
-
let
|
|
74
|
-
if ($[
|
|
75
|
-
|
|
76
|
-
$[
|
|
53
|
+
let t02;
|
|
54
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
55
|
+
t02 = /* @__PURE__ */ jsx(Spinner, {});
|
|
56
|
+
$[10] = t02;
|
|
77
57
|
} else {
|
|
78
|
-
|
|
58
|
+
t02 = $[10];
|
|
79
59
|
}
|
|
80
|
-
content =
|
|
60
|
+
content = t02;
|
|
81
61
|
} else {
|
|
82
62
|
if (!schema) {
|
|
83
|
-
let
|
|
84
|
-
if ($[
|
|
85
|
-
|
|
86
|
-
$[
|
|
63
|
+
let t02;
|
|
64
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
65
|
+
t02 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-error", children: "No GraphQL schema available" });
|
|
66
|
+
$[11] = t02;
|
|
87
67
|
} else {
|
|
88
|
-
|
|
68
|
+
t02 = $[11];
|
|
89
69
|
}
|
|
90
|
-
content =
|
|
70
|
+
content = t02;
|
|
91
71
|
} else {
|
|
92
72
|
if (explorerNavStack.length === 1) {
|
|
93
|
-
let
|
|
94
|
-
if ($[
|
|
95
|
-
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
73
|
+
let t02;
|
|
74
|
+
if ($[12] !== schema) {
|
|
75
|
+
t02 = /* @__PURE__ */ jsx(SchemaDocumentation, { schema });
|
|
76
|
+
$[12] = schema;
|
|
77
|
+
$[13] = t02;
|
|
98
78
|
} else {
|
|
99
|
-
|
|
79
|
+
t02 = $[13];
|
|
100
80
|
}
|
|
101
|
-
content =
|
|
81
|
+
content = t02;
|
|
102
82
|
} else {
|
|
103
83
|
if (isType(navItem.def)) {
|
|
104
|
-
let
|
|
105
|
-
if ($[
|
|
106
|
-
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
84
|
+
let t02;
|
|
85
|
+
if ($[14] !== navItem.def) {
|
|
86
|
+
t02 = /* @__PURE__ */ jsx(TypeDocumentation, { type: navItem.def });
|
|
87
|
+
$[14] = navItem.def;
|
|
88
|
+
$[15] = t02;
|
|
109
89
|
} else {
|
|
110
|
-
|
|
90
|
+
t02 = $[15];
|
|
111
91
|
}
|
|
112
|
-
content =
|
|
92
|
+
content = t02;
|
|
113
93
|
} else {
|
|
114
94
|
if (navItem.def) {
|
|
115
|
-
let
|
|
116
|
-
if ($[
|
|
117
|
-
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
95
|
+
let t02;
|
|
96
|
+
if ($[16] !== navItem.def) {
|
|
97
|
+
t02 = /* @__PURE__ */ jsx(FieldDocumentation, { field: navItem.def });
|
|
98
|
+
$[16] = navItem.def;
|
|
99
|
+
$[17] = t02;
|
|
120
100
|
} else {
|
|
121
|
-
|
|
101
|
+
t02 = $[17];
|
|
122
102
|
}
|
|
123
|
-
content =
|
|
103
|
+
content = t02;
|
|
124
104
|
}
|
|
125
105
|
}
|
|
126
106
|
}
|
|
@@ -128,105 +108,105 @@ const DocExplorer = () => {
|
|
|
128
108
|
}
|
|
129
109
|
}
|
|
130
110
|
}
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
111
|
+
$[0] = explorerNavStack;
|
|
112
|
+
$[1] = fetchError;
|
|
113
|
+
$[2] = isFetching;
|
|
114
|
+
$[3] = schema;
|
|
115
|
+
$[4] = validationErrors;
|
|
116
|
+
$[5] = content;
|
|
117
|
+
$[6] = navItem;
|
|
138
118
|
} else {
|
|
139
|
-
content = $[
|
|
140
|
-
navItem = $[
|
|
119
|
+
content = $[5];
|
|
120
|
+
navItem = $[6];
|
|
141
121
|
}
|
|
142
122
|
let prevName;
|
|
143
123
|
if (explorerNavStack.length > 1) {
|
|
144
|
-
let
|
|
145
|
-
if ($[
|
|
146
|
-
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
124
|
+
let t02;
|
|
125
|
+
if ($[18] !== explorerNavStack) {
|
|
126
|
+
t02 = explorerNavStack.at(-2);
|
|
127
|
+
$[18] = explorerNavStack;
|
|
128
|
+
$[19] = t02;
|
|
149
129
|
} else {
|
|
150
|
-
|
|
130
|
+
t02 = $[19];
|
|
151
131
|
}
|
|
152
|
-
prevName =
|
|
132
|
+
prevName = t02.name;
|
|
153
133
|
}
|
|
154
|
-
let
|
|
155
|
-
if ($[
|
|
156
|
-
|
|
134
|
+
let t0;
|
|
135
|
+
if ($[20] !== pop || $[21] !== prevName) {
|
|
136
|
+
t0 = prevName && /* @__PURE__ */ jsxs("a", { href: "#", className: "graphiql-doc-explorer-back", onClick: (event) => {
|
|
157
137
|
event.preventDefault();
|
|
158
138
|
pop();
|
|
159
139
|
}, "aria-label": `Go back to ${prevName}`, children: [
|
|
160
140
|
/* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
161
141
|
prevName
|
|
162
142
|
] });
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
143
|
+
$[20] = pop;
|
|
144
|
+
$[21] = prevName;
|
|
145
|
+
$[22] = t0;
|
|
146
|
+
} else {
|
|
147
|
+
t0 = $[22];
|
|
148
|
+
}
|
|
149
|
+
let t1;
|
|
150
|
+
if ($[23] !== navItem.name) {
|
|
151
|
+
t1 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-title", children: navItem.name });
|
|
152
|
+
$[23] = navItem.name;
|
|
153
|
+
$[24] = t1;
|
|
154
|
+
} else {
|
|
155
|
+
t1 = $[24];
|
|
156
|
+
}
|
|
157
|
+
let t2;
|
|
158
|
+
if ($[25] !== t0 || $[26] !== t1) {
|
|
159
|
+
t2 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-header-content", children: [
|
|
160
|
+
t0,
|
|
161
|
+
t1
|
|
162
|
+
] });
|
|
163
|
+
$[25] = t0;
|
|
164
|
+
$[26] = t1;
|
|
165
|
+
$[27] = t2;
|
|
166
166
|
} else {
|
|
167
|
-
t2 = $[
|
|
167
|
+
t2 = $[27];
|
|
168
168
|
}
|
|
169
169
|
let t3;
|
|
170
|
-
if ($[
|
|
171
|
-
t3 = /* @__PURE__ */ jsx(
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
170
|
+
if ($[28] !== navItem.name) {
|
|
171
|
+
t3 = /* @__PURE__ */ jsx(Search, {}, navItem.name);
|
|
172
|
+
$[28] = navItem.name;
|
|
173
|
+
$[29] = t3;
|
|
174
174
|
} else {
|
|
175
|
-
t3 = $[
|
|
175
|
+
t3 = $[29];
|
|
176
176
|
}
|
|
177
177
|
let t4;
|
|
178
|
-
if ($[
|
|
179
|
-
t4 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-header
|
|
178
|
+
if ($[30] !== t2 || $[31] !== t3) {
|
|
179
|
+
t4 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-header", children: [
|
|
180
180
|
t2,
|
|
181
181
|
t3
|
|
182
182
|
] });
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
183
|
+
$[30] = t2;
|
|
184
|
+
$[31] = t3;
|
|
185
|
+
$[32] = t4;
|
|
186
186
|
} else {
|
|
187
|
-
t4 = $[
|
|
187
|
+
t4 = $[32];
|
|
188
188
|
}
|
|
189
189
|
let t5;
|
|
190
|
-
if ($[
|
|
191
|
-
t5 = /* @__PURE__ */ jsx(
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
190
|
+
if ($[33] !== content) {
|
|
191
|
+
t5 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-content", children: content });
|
|
192
|
+
$[33] = content;
|
|
193
|
+
$[34] = t5;
|
|
194
194
|
} else {
|
|
195
|
-
t5 = $[
|
|
195
|
+
t5 = $[34];
|
|
196
196
|
}
|
|
197
197
|
let t6;
|
|
198
|
-
if ($[
|
|
199
|
-
t6 = /* @__PURE__ */ jsxs("
|
|
198
|
+
if ($[35] !== t4 || $[36] !== t5) {
|
|
199
|
+
t6 = /* @__PURE__ */ jsxs("section", { className: "graphiql-doc-explorer", "aria-label": "Documentation Explorer", children: [
|
|
200
200
|
t4,
|
|
201
201
|
t5
|
|
202
202
|
] });
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[34] = t6;
|
|
206
|
-
} else {
|
|
207
|
-
t6 = $[34];
|
|
208
|
-
}
|
|
209
|
-
let t7;
|
|
210
|
-
if ($[35] !== content) {
|
|
211
|
-
t7 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-content", children: content });
|
|
212
|
-
$[35] = content;
|
|
213
|
-
$[36] = t7;
|
|
214
|
-
} else {
|
|
215
|
-
t7 = $[36];
|
|
216
|
-
}
|
|
217
|
-
let t8;
|
|
218
|
-
if ($[37] !== t6 || $[38] !== t7) {
|
|
219
|
-
t8 = /* @__PURE__ */ jsxs("section", { className: "graphiql-doc-explorer", "aria-label": "Documentation Explorer", children: [
|
|
220
|
-
t6,
|
|
221
|
-
t7
|
|
222
|
-
] });
|
|
203
|
+
$[35] = t4;
|
|
204
|
+
$[36] = t5;
|
|
223
205
|
$[37] = t6;
|
|
224
|
-
$[38] = t7;
|
|
225
|
-
$[39] = t8;
|
|
226
206
|
} else {
|
|
227
|
-
|
|
207
|
+
t6 = $[37];
|
|
228
208
|
}
|
|
229
|
-
return
|
|
209
|
+
return t6;
|
|
230
210
|
};
|
|
231
211
|
export {
|
|
232
212
|
DocExplorer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-explorer.js","sources":["../../src/components/doc-explorer.tsx"],"sourcesContent":["import { isType } from 'graphql';\nimport { FC, ReactNode } from 'react';\nimport { ChevronLeftIcon, Spinner,
|
|
1
|
+
{"version":3,"file":"doc-explorer.js","sources":["../../src/components/doc-explorer.tsx"],"sourcesContent":["import { isType } from 'graphql';\nimport { FC, ReactNode } from 'react';\nimport { ChevronLeftIcon, Spinner, useSchemaStore } from '@graphiql/react';\nimport { useDocExplorer, useDocExplorerActions } from '../context';\nimport { FieldDocumentation } from './field-documentation';\nimport { SchemaDocumentation } from './schema-documentation';\nimport { Search } from './search';\nimport { TypeDocumentation } from './type-documentation';\nimport './doc-explorer.css';\n\nexport const DocExplorer: FC = () => {\n const { fetchError, isFetching, schema, validationErrors } = useSchemaStore();\n const explorerNavStack = useDocExplorer();\n const { pop } = useDocExplorerActions();\n const navItem = explorerNavStack.at(-1)!;\n\n let content: ReactNode = null;\n if (fetchError) {\n content = (\n <div className=\"graphiql-doc-explorer-error\">Error fetching schema</div>\n );\n } else if (validationErrors.length > 0) {\n content = (\n <div className=\"graphiql-doc-explorer-error\">\n Schema is invalid: {validationErrors[0].message}\n </div>\n );\n } else if (isFetching) {\n // Schema is undefined when it is being loaded via introspection.\n content = <Spinner />;\n } else if (!schema) {\n // Schema is null when it explicitly does not exist, typically due to\n // an error during introspection.\n content = (\n <div className=\"graphiql-doc-explorer-error\">\n No GraphQL schema available\n </div>\n );\n } else if (explorerNavStack.length === 1) {\n content = <SchemaDocumentation schema={schema} />;\n } else if (isType(navItem.def)) {\n content = <TypeDocumentation type={navItem.def} />;\n } else if (navItem.def) {\n content = <FieldDocumentation field={navItem.def} />;\n }\n\n let prevName;\n if (explorerNavStack.length > 1) {\n prevName = explorerNavStack.at(-2)!.name;\n }\n\n return (\n <section\n className=\"graphiql-doc-explorer\"\n aria-label=\"Documentation Explorer\"\n >\n <div className=\"graphiql-doc-explorer-header\">\n <div className=\"graphiql-doc-explorer-header-content\">\n {prevName && (\n <a\n href=\"#\"\n className=\"graphiql-doc-explorer-back\"\n onClick={event => {\n event.preventDefault();\n pop();\n }}\n aria-label={`Go back to ${prevName}`}\n >\n <ChevronLeftIcon />\n {prevName}\n </a>\n )}\n <div className=\"graphiql-doc-explorer-title\">{navItem.name}</div>\n </div>\n <Search key={navItem.name} />\n </div>\n <div className=\"graphiql-doc-explorer-content\">{content}</div>\n </section>\n );\n};\n"],"names":["DocExplorer","$","_c","fetchError","isFetching","schema","validationErrors","useSchemaStore","explorerNavStack","useDocExplorer","pop","useDocExplorerActions","content","navItem","at","t0","Symbol","for","length","message","isType","def","prevName","event","preventDefault","t1","name","t2","t3","t4","t5","t6"],"mappings":";;;;;;;;;;AAUO,MAAMA,cAAkBA,MAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAC7B,QAAA;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,MAA6DC,eAAe;AAC5E,QAAAC,mBAAyBC,eAAe;AACxC,QAAA;AAAA,IAAAC;AAAAA,MAAgBC,sBAAsB;AAAEC,MAAAA;AAAAC,MAAAA;AAAA,MAAAZ,EAAAO,CAAAA,MAAAA,oBAAAP,EAAA,CAAA,MAAAE,cAAAF,EAAAG,CAAAA,MAAAA,cAAAH,EAAA,CAAA,MAAAI,UAAAJ,SAAAK,kBAAA;AACxBE,cAAAA,iBAAgBM,KAAM;AAEtC,cAAA;AA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B,MAAAA;AAAA,MAAA5B,EAAA0B,EAAAA,MAAAA,MAAA1B,UAAA2B,IAAA;AACzB,SAAA,qBAAA,OAnBS,EAAA,WAAA,gCACbD,UAAAA;AAAAA,MAAAA;AAAAA,MAiBAC;AAAAA,IAAAA,GACF;AAAM3B,YAAA0B;AAAA1B,YAAA2B;AAAA3B,YAAA4B;AAAAA,EAAAA,OAAA;AAAAA,SAAA5B,EAAA,EAAA;AAAA,EAAA;AAAA6B,MAAAA;AAAA7B,MAAAA,UAAAW,SAAA;AACNkB,SAAA,oBAAA,OAAA,EAAe,WAAA,iCAAiClB,UAAQ,SAAA;AAAMX,YAAAW;AAAAX,YAAA6B;AAAAA,EAAAA,OAAA;AAAAA,SAAA7B,EAAA,EAAA;AAAA,EAAA;AAAA8B,MAAAA;AAAA,MAAA9B,EAAA4B,EAAAA,MAAAA,MAAA5B,UAAA6B,IAAA;AAxBhEC,2CACY,WAAA,yBACC,cAAA,0BAEXF,UAAAA;AAAAA,MAAAA;AAAAA,MAoBAC;AAAAA,IAAAA,GACF;AAAU7B,YAAA4B;AAAA5B,YAAA6B;AAAA7B,YAAA8B;AAAAA,EAAAA,OAAA;AAAAA,SAAA9B,EAAA,EAAA;AAAA,EAAA;AAzBV8B,SAAAA;AAyBU;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DocExplorerFieldDef } from '../context';
|
|
3
3
|
declare type FieldDocumentationProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The field or argument that should be rendered.
|
|
6
6
|
*/
|
|
7
|
-
field:
|
|
7
|
+
field: DocExplorerFieldDef;
|
|
8
8
|
};
|
|
9
9
|
export declare const FieldDocumentation: FC<FieldDocumentationProps>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-documentation.js","sources":["../../src/components/field-documentation.tsx"],"sourcesContent":["import { GraphQLArgument } from 'graphql';\nimport { FC, useState } from 'react';\nimport { Button, MarkdownContent } from '@graphiql/react';\nimport {
|
|
1
|
+
{"version":3,"file":"field-documentation.js","sources":["../../src/components/field-documentation.tsx"],"sourcesContent":["import { GraphQLArgument } from 'graphql';\nimport { FC, useState } from 'react';\nimport { Button, MarkdownContent } from '@graphiql/react';\nimport { DocExplorerFieldDef } 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: DocExplorerFieldDef;\n};\n\nexport const FieldDocumentation: FC<FieldDocumentationProps> = ({ field }) => {\n return (\n <>\n {field.description ? (\n <MarkdownContent type=\"description\">\n {field.description}\n </MarkdownContent>\n ) : null}\n <DeprecationReason preview={false}>\n {field.deprecationReason}\n </DeprecationReason>\n <ExplorerSection title=\"Type\">\n <TypeLink type={field.type} />\n </ExplorerSection>\n <Arguments field={field} />\n <Directives field={field} />\n </>\n );\n};\n\nconst Arguments: FC<{ field: DocExplorerFieldDef }> = ({ field }) => {\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\nconst Directives: FC<{ field: DocExplorerFieldDef }> = ({ field }) => {\n const directives = field.astNode?.directives;\n if (!directives?.length) {\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","t0","$","_c","field","t1","description","t2","deprecationReason","t3","type","t4","t5","t6","Arguments","showDeprecated","setShowDeprecated","useState","Symbol","for","handleShowDeprecated","args","deprecatedArgs","argument","push","length","map","_temp","_temp2","Directives","directives","astNode","_temp3","arg","name","arg_0","directive","value"],"mappings":";;;;;;;;;AAiBO,MAAMA,qBAAkDC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAASI,MAAAA;AAAA,MAAAH,EAAA,CAAA,MAAAE,MAAAE,aAAA;AAGlEF,SAAAA,MAAKE,cACH,oBAAA,iBAAA,EAAqB,MAAA,eACnBF,UAAAA,MAAKE,aACR,IACM;AAAA,MAAA,CAAA,IAAAF,MAAAE;AAAAJ,WAAAG;AAAAA,EAAAA,OAAA;AAAAA,SAAAH,EAAA,CAAA;AAAA,EAAA;AAAAK,MAAAA;AAAA,MAAAL,EAAA,CAAA,MAAAE,MAAAI,mBAAA;AACRD,SAAC,oBAAA,mBAAA,EAA2B,SAAI,OAC7BH,gBAAKI,mBACR;AAAoB,MAAA,CAAA,IAAAJ,MAAAI;AAAAN,WAAAK;AAAAA,EAAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AAAAO,MAAAA;AAAA,MAAAP,EAAA,CAAA,MAAAE,MAAAM,MAAA;AACpB,SAAA,oBAAC,mBAAsB,OAAA,QACrB,8BAAC,UAAe,EAAA,MAAAN,MAAKM,KAAAA,CACvB,EAAA,CAAA;AAAkB,MAAA,CAAA,IAAAN,MA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AL,YAAAO;AAAAP,YAAAS;AAAAA,EAAAA,OAAA;AAAAA,SAAAT,EAAA,EAAA;AAAA,EAAA;AArBHS,SAAAA;AAqBG;AAIP,MAAMkB,aAAiD5B,CAAA,OAAA;;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AACtD6B,QAAAA,cAAmB1B,WAAK2B,YAAL3B,mBAAK0B;AACnBA,MAAAA,EAAAA,yCAAUL,SAAA;AAAA,WAAA;AAAA,EAAA;AAAApB,MAAAA;AAAAH,MAAAA,SAAA4B,YAAA;AAKVA,SAAAA,WAAUJ,IAAAM,MAIV;AAAC9B,WAAA4B;AAAA5B,WAAAG;AAAAA,EAAAA,OAAA;AAAAA,SAAAH,EAAA,CAAA;AAAA,EAAA;AAAAK,MAAAA;AAAAL,MAAAA,SAAAG,IAAA;AALJE,SAAC,oBAAA,iBAAA,EAAsB,OAAA,cACpBF,UAKH,IAAA;AAAkBH,WAAAG;AAAAH,WAAAK;AAAAA,EAAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AANlBK,SAAAA;AAMkB;AA1DgC,SAAAoB,MAAAM,KAAA;AAAA,SAyBzC,oBAAA,UAAA,EAA6BA,IAAfA,GAAAA,IAAGC,IAAmB;AAAA;AAzBK,SAAAN,OAAAO,OAAA;AAAA,SAiCvC,oBAAA,UAAA,EAA6BF,KAAAA,MAAAA,GAAfA,MAAGC,IAAmB;AAAA;AAaI,SAAAF,OAAAI,WAAA;AAQ/C,SAAA,oBAAA,SACE,UAAC,oBAAA,WAAA,EAAqBA,UACxB,CAAA,EAFUA,GAAAA,UAASF,KAAAG,KAEnB;AAAM;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DocExplorerFieldDef } from '../context';
|
|
3
3
|
declare type FieldLinkProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The field or argument that should be linked to.
|
|
6
6
|
*/
|
|
7
|
-
field:
|
|
7
|
+
field: DocExplorerFieldDef;
|
|
8
8
|
};
|
|
9
9
|
export declare const FieldLink: FC<FieldLinkProps>;
|
|
10
10
|
export {};
|
|
@@ -1,49 +1,40 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useDocExplorerActions } from "../context.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
const FieldLink = (t0) => {
|
|
6
|
-
const $ = c(
|
|
6
|
+
const $ = c(6);
|
|
7
7
|
const {
|
|
8
8
|
field
|
|
9
9
|
} = t0;
|
|
10
|
-
let t1;
|
|
11
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
12
|
-
t1 = {
|
|
13
|
-
nonNull: true
|
|
14
|
-
};
|
|
15
|
-
$[0] = t1;
|
|
16
|
-
} else {
|
|
17
|
-
t1 = $[0];
|
|
18
|
-
}
|
|
19
10
|
const {
|
|
20
11
|
push
|
|
21
|
-
} =
|
|
22
|
-
let
|
|
23
|
-
if ($[
|
|
24
|
-
|
|
12
|
+
} = useDocExplorerActions();
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[0] !== field || $[1] !== push) {
|
|
15
|
+
t1 = (event) => {
|
|
25
16
|
event.preventDefault();
|
|
26
17
|
push({
|
|
27
18
|
name: field.name,
|
|
28
19
|
def: field
|
|
29
20
|
});
|
|
30
21
|
};
|
|
31
|
-
$[
|
|
32
|
-
$[
|
|
33
|
-
$[
|
|
22
|
+
$[0] = field;
|
|
23
|
+
$[1] = push;
|
|
24
|
+
$[2] = t1;
|
|
34
25
|
} else {
|
|
35
|
-
|
|
26
|
+
t1 = $[2];
|
|
36
27
|
}
|
|
37
|
-
let
|
|
38
|
-
if ($[
|
|
39
|
-
|
|
40
|
-
$[
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[3] !== field.name || $[4] !== t1) {
|
|
30
|
+
t2 = /* @__PURE__ */ jsx("a", { className: "graphiql-doc-explorer-field-name", onClick: t1, href: "#", children: field.name });
|
|
31
|
+
$[3] = field.name;
|
|
32
|
+
$[4] = t1;
|
|
41
33
|
$[5] = t2;
|
|
42
|
-
$[6] = t3;
|
|
43
34
|
} else {
|
|
44
|
-
|
|
35
|
+
t2 = $[5];
|
|
45
36
|
}
|
|
46
|
-
return
|
|
37
|
+
return t2;
|
|
47
38
|
};
|
|
48
39
|
export {
|
|
49
40
|
FieldLink
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-link.js","sources":["../../src/components/field-link.tsx"],"sourcesContent":["import { FC } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"field-link.js","sources":["../../src/components/field-link.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { DocExplorerFieldDef, useDocExplorerActions } from '../context';\nimport './field-link.css';\n\ntype FieldLinkProps = {\n /**\n * The field or argument that should be linked to.\n */\n field: DocExplorerFieldDef;\n};\n\nexport const FieldLink: FC<FieldLinkProps> = ({ field }) => {\n const { push } = useDocExplorerActions();\n\n return (\n <a\n className=\"graphiql-doc-explorer-field-name\"\n onClick={event => {\n event.preventDefault();\n push({ name: field.name, def: field });\n }}\n href=\"#\"\n >\n {field.name}\n </a>\n );\n};\n"],"names":["FieldLink","t0","$","_c","field","push","useDocExplorerActions","t1","event","preventDefault","name","def","t2"],"mappings":";;;;AAWO,MAAMA,YAAgCC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAC5C,QAAA;AAAA,IAAAI;AAAAA,MAAiBC,sBAAsB;AAAEC,MAAAA;AAAA,MAAAL,EAAAE,CAAAA,MAAAA,SAAAF,SAAAG,MAAA;AAK5BE,SAAAC,CAAA,UAAA;AACPA,YAAKC,eAAgB;AACjB,WAAA;AAAA,QAAAC,MAASN,MAAKM;AAAAA,QAAAC,KAAYP;AAAAA,MAAAA,CAAO;AAAA,IAAC;AACvCF,WAAAE;AAAAF,WAAAG;AAAAH,WAAAK;AAAAA,EAAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AAAAU,MAAAA;AAAAV,MAAAA,SAAAE,MAAAM,QAAAR,SAAAK,IAAA;AALH,SAAA,oBAAA,OACY,WAAA,oCACD,SAAAA,IAIJ,MAAA,KAEJH,UAAAA,MAAKM,KACR,CAAA;AAAI,MAAA,CAAA,IAAAN,MAAAM;AAAAR,WAAAK;AAAAL,WAAAU;AAAAA,EAAAA,OAAA;AAAAA,SAAAV,EAAA,CAAA;AAAA,EAAA;AATJU,SAAAA;AASI;"}
|
|
@@ -9,7 +9,7 @@ declare type FieldMatch = {
|
|
|
9
9
|
field: GraphQLField<unknown, unknown> | GraphQLInputField;
|
|
10
10
|
argument?: GraphQLArgument;
|
|
11
11
|
};
|
|
12
|
-
export declare function useSearchResults(
|
|
12
|
+
export declare function useSearchResults(): (searchValue: string) => {
|
|
13
13
|
within: FieldMatch[];
|
|
14
14
|
types: TypeMatch[];
|
|
15
15
|
fields: FieldMatch[];
|