@graphiql/plugin-doc-explorer 1.0.0-beta.1 → 1.0.0-beta.2
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/LICENSE +21 -0
- package/dist/components/argument.js +88 -92
- package/dist/components/argument.js.map +1 -1
- package/dist/components/arguments-list.js +226 -237
- package/dist/components/arguments-list.js.map +1 -1
- package/dist/components/breadcrumb.js +59 -52
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/default-value.js +63 -74
- package/dist/components/default-value.js.map +1 -1
- package/dist/components/deprecation-reason.js +27 -21
- package/dist/components/deprecation-reason.js.map +1 -1
- package/dist/components/directive.js +20 -23
- package/dist/components/directive.js.map +1 -1
- package/dist/components/doc-explorer.js +219 -259
- package/dist/components/doc-explorer.js.map +1 -1
- package/dist/components/field-card.js +103 -97
- package/dist/components/field-card.js.map +1 -1
- package/dist/components/field-documentation.js +118 -135
- package/dist/components/field-documentation.js.map +1 -1
- package/dist/components/field-link.js +37 -39
- package/dist/components/field-link.js.map +1 -1
- package/dist/components/fields-list.js +216 -226
- package/dist/components/fields-list.js.map +1 -1
- package/dist/components/schema-documentation.js +263 -224
- package/dist/components/schema-documentation.js.map +1 -1
- package/dist/components/search-row.js +287 -268
- package/dist/components/search-row.js.map +1 -1
- package/dist/components/search.js +342 -345
- package/dist/components/search.js.map +1 -1
- package/dist/components/section.js +59 -69
- package/dist/components/section.js.map +1 -1
- package/dist/components/type-card.js +104 -107
- package/dist/components/type-card.js.map +1 -1
- package/dist/components/type-documentation.js +340 -363
- package/dist/components/type-documentation.js.map +1 -1
- package/dist/components/type-link.js +38 -39
- package/dist/components/type-link.js.map +1 -1
- package/dist/components/utils.js +15 -20
- package/dist/components/utils.js.map +1 -1
- package/dist/context.js +205 -285
- package/dist/context.js.map +1 -1
- package/dist/index.js +7 -31
- package/dist/schema-reference.js +48 -54
- package/dist/schema-reference.js.map +1 -1
- package/dist/style.css +24 -28
- package/package.json +25 -19
- package/dist/index.js.map +0 -1
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { isType, isObjectType, isInterfaceType, isInputObjectType, isEnumType, isUnionType } from "graphql";
|
|
4
|
-
import { pick, useGraphiQL, Spinner, PanelHeader } from "@graphiql/react";
|
|
5
1
|
import { useDocExplorer, useDocExplorerActions } from "../context.js";
|
|
6
2
|
import { Breadcrumb } from "./breadcrumb.js";
|
|
7
3
|
import { FieldDocumentation } from "./field-documentation.js";
|
|
@@ -11,260 +7,224 @@ import { SearchRow } from "./search-row.js";
|
|
|
11
7
|
import { TypeCard } from "./type-card.js";
|
|
12
8
|
import { TypeDocumentation } from "./type-documentation.js";
|
|
13
9
|
/* empty css */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
$[30] = t3;
|
|
174
|
-
} else {
|
|
175
|
-
t3 = $[30];
|
|
176
|
-
}
|
|
177
|
-
let t4;
|
|
178
|
-
if ($[31] !== content) {
|
|
179
|
-
t4 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-content", children: content });
|
|
180
|
-
$[31] = content;
|
|
181
|
-
$[32] = t4;
|
|
182
|
-
} else {
|
|
183
|
-
t4 = $[32];
|
|
184
|
-
}
|
|
185
|
-
let t5;
|
|
186
|
-
if ($[33] !== t2 || $[34] !== t3 || $[35] !== t4) {
|
|
187
|
-
t5 = /* @__PURE__ */ jsxs("section", { className: "graphiql-doc-explorer", "aria-label": "Documentation Explorer", children: [
|
|
188
|
-
t1,
|
|
189
|
-
t2,
|
|
190
|
-
t3,
|
|
191
|
-
t4
|
|
192
|
-
] });
|
|
193
|
-
$[33] = t2;
|
|
194
|
-
$[34] = t3;
|
|
195
|
-
$[35] = t4;
|
|
196
|
-
$[36] = t5;
|
|
197
|
-
} else {
|
|
198
|
-
t5 = $[36];
|
|
199
|
-
}
|
|
200
|
-
return t5;
|
|
201
|
-
};
|
|
202
|
-
const TypeView = (t0) => {
|
|
203
|
-
const $ = c(16);
|
|
204
|
-
const {
|
|
205
|
-
type
|
|
206
|
-
} = t0;
|
|
207
|
-
let t1;
|
|
208
|
-
if ($[0] !== type) {
|
|
209
|
-
t1 = isObjectType(type) || isInterfaceType(type) || isInputObjectType(type);
|
|
210
|
-
$[0] = type;
|
|
211
|
-
$[1] = t1;
|
|
212
|
-
} else {
|
|
213
|
-
t1 = $[1];
|
|
214
|
-
}
|
|
215
|
-
const hasNewFieldsList = t1;
|
|
216
|
-
let t2;
|
|
217
|
-
if ($[2] !== type) {
|
|
218
|
-
t2 = isEnumType(type) || isUnionType(type) || isInterfaceType(type);
|
|
219
|
-
$[2] = type;
|
|
220
|
-
$[3] = t2;
|
|
221
|
-
} else {
|
|
222
|
-
t2 = $[3];
|
|
223
|
-
}
|
|
224
|
-
const needsTypeDocs = t2;
|
|
225
|
-
let t3;
|
|
226
|
-
if ($[4] !== type) {
|
|
227
|
-
t3 = /* @__PURE__ */ jsx(TypeCard, { type });
|
|
228
|
-
$[4] = type;
|
|
229
|
-
$[5] = t3;
|
|
230
|
-
} else {
|
|
231
|
-
t3 = $[5];
|
|
232
|
-
}
|
|
233
|
-
let t4;
|
|
234
|
-
if ($[6] !== hasNewFieldsList || $[7] !== type) {
|
|
235
|
-
t4 = hasNewFieldsList && /* @__PURE__ */ jsx(FieldsList, { type });
|
|
236
|
-
$[6] = hasNewFieldsList;
|
|
237
|
-
$[7] = type;
|
|
238
|
-
$[8] = t4;
|
|
239
|
-
} else {
|
|
240
|
-
t4 = $[8];
|
|
241
|
-
}
|
|
242
|
-
let t5;
|
|
243
|
-
if ($[9] !== needsTypeDocs || $[10] !== type) {
|
|
244
|
-
t5 = needsTypeDocs && /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-type-extra", children: /* @__PURE__ */ jsx(TypeDocumentation, { type, hideHeader: true }) });
|
|
245
|
-
$[9] = needsTypeDocs;
|
|
246
|
-
$[10] = type;
|
|
247
|
-
$[11] = t5;
|
|
248
|
-
} else {
|
|
249
|
-
t5 = $[11];
|
|
250
|
-
}
|
|
251
|
-
let t6;
|
|
252
|
-
if ($[12] !== t3 || $[13] !== t4 || $[14] !== t5) {
|
|
253
|
-
t6 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
254
|
-
t3,
|
|
255
|
-
t4,
|
|
256
|
-
t5
|
|
257
|
-
] });
|
|
258
|
-
$[12] = t3;
|
|
259
|
-
$[13] = t4;
|
|
260
|
-
$[14] = t5;
|
|
261
|
-
$[15] = t6;
|
|
262
|
-
} else {
|
|
263
|
-
t6 = $[15];
|
|
264
|
-
}
|
|
265
|
-
return t6;
|
|
10
|
+
import { c } from "react-compiler-runtime";
|
|
11
|
+
import { PanelHeader, Spinner, pick, useGraphiQL } from "@graphiql/react";
|
|
12
|
+
import { isEnumType, isInputObjectType, isInterfaceType, isObjectType, isType, isUnionType } from "graphql";
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
//#region src/components/doc-explorer.tsx
|
|
15
|
+
var DocExplorer = () => {
|
|
16
|
+
const $ = c(37);
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19
|
+
t0 = pick("fetchError", "isIntrospecting", "schema", "validationErrors");
|
|
20
|
+
$[0] = t0;
|
|
21
|
+
} else t0 = $[0];
|
|
22
|
+
const { fetchError, isIntrospecting, schema, validationErrors } = useGraphiQL(t0);
|
|
23
|
+
const explorerNavStack = useDocExplorer();
|
|
24
|
+
const { pop } = useDocExplorerActions();
|
|
25
|
+
let content;
|
|
26
|
+
let navItem;
|
|
27
|
+
let navigateToIndex;
|
|
28
|
+
if ($[1] !== explorerNavStack || $[2] !== fetchError || $[3] !== isIntrospecting || $[4] !== pop || $[5] !== schema || $[6] !== validationErrors) {
|
|
29
|
+
navItem = explorerNavStack.at(-1);
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[10] !== explorerNavStack.length || $[11] !== pop) {
|
|
32
|
+
t1 = (index) => {
|
|
33
|
+
const stepsBack = explorerNavStack.length - 1 - index;
|
|
34
|
+
for (let i = 0; i < stepsBack; i++) pop();
|
|
35
|
+
};
|
|
36
|
+
$[10] = explorerNavStack.length;
|
|
37
|
+
$[11] = pop;
|
|
38
|
+
$[12] = t1;
|
|
39
|
+
} else t1 = $[12];
|
|
40
|
+
navigateToIndex = t1;
|
|
41
|
+
content = null;
|
|
42
|
+
if (fetchError) {
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: "graphiql-doc-explorer-error",
|
|
47
|
+
children: "Error fetching schema"
|
|
48
|
+
});
|
|
49
|
+
$[13] = t2;
|
|
50
|
+
} else t2 = $[13];
|
|
51
|
+
content = t2;
|
|
52
|
+
} else if (validationErrors[0]) {
|
|
53
|
+
let t2;
|
|
54
|
+
if ($[14] !== validationErrors[0].message) {
|
|
55
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
56
|
+
className: "graphiql-doc-explorer-error",
|
|
57
|
+
children: ["Schema is invalid: ", validationErrors[0].message]
|
|
58
|
+
});
|
|
59
|
+
$[14] = validationErrors[0].message;
|
|
60
|
+
$[15] = t2;
|
|
61
|
+
} else t2 = $[15];
|
|
62
|
+
content = t2;
|
|
63
|
+
} else if (isIntrospecting) {
|
|
64
|
+
let t2;
|
|
65
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
66
|
+
t2 = /* @__PURE__ */ jsx(Spinner, {});
|
|
67
|
+
$[16] = t2;
|
|
68
|
+
} else t2 = $[16];
|
|
69
|
+
content = t2;
|
|
70
|
+
} else if (!schema) {
|
|
71
|
+
let t2;
|
|
72
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
74
|
+
className: "graphiql-doc-explorer-error",
|
|
75
|
+
children: "No GraphQL schema available"
|
|
76
|
+
});
|
|
77
|
+
$[17] = t2;
|
|
78
|
+
} else t2 = $[17];
|
|
79
|
+
content = t2;
|
|
80
|
+
} else if (explorerNavStack.length === 1) {
|
|
81
|
+
let t2;
|
|
82
|
+
if ($[18] !== schema) {
|
|
83
|
+
t2 = /* @__PURE__ */ jsx(SchemaDocumentation, { schema });
|
|
84
|
+
$[18] = schema;
|
|
85
|
+
$[19] = t2;
|
|
86
|
+
} else t2 = $[19];
|
|
87
|
+
content = t2;
|
|
88
|
+
} else if (isType(navItem.def)) {
|
|
89
|
+
let t2;
|
|
90
|
+
if ($[20] !== navItem.def) {
|
|
91
|
+
t2 = /* @__PURE__ */ jsx(TypeView, { type: navItem.def });
|
|
92
|
+
$[20] = navItem.def;
|
|
93
|
+
$[21] = t2;
|
|
94
|
+
} else t2 = $[21];
|
|
95
|
+
content = t2;
|
|
96
|
+
} else if (navItem.def) {
|
|
97
|
+
let t2;
|
|
98
|
+
if ($[22] !== navItem.def) {
|
|
99
|
+
t2 = /* @__PURE__ */ jsx(FieldDocumentation, { field: navItem.def });
|
|
100
|
+
$[22] = navItem.def;
|
|
101
|
+
$[23] = t2;
|
|
102
|
+
} else t2 = $[23];
|
|
103
|
+
content = t2;
|
|
104
|
+
}
|
|
105
|
+
$[1] = explorerNavStack;
|
|
106
|
+
$[2] = fetchError;
|
|
107
|
+
$[3] = isIntrospecting;
|
|
108
|
+
$[4] = pop;
|
|
109
|
+
$[5] = schema;
|
|
110
|
+
$[6] = validationErrors;
|
|
111
|
+
$[7] = content;
|
|
112
|
+
$[8] = navItem;
|
|
113
|
+
$[9] = navigateToIndex;
|
|
114
|
+
} else {
|
|
115
|
+
content = $[7];
|
|
116
|
+
navItem = $[8];
|
|
117
|
+
navigateToIndex = $[9];
|
|
118
|
+
}
|
|
119
|
+
const isTypeOrFieldView = explorerNavStack.length > 1;
|
|
120
|
+
let t1;
|
|
121
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
122
|
+
t1 = /* @__PURE__ */ jsx(PanelHeader, { title: "Schema Explorer" });
|
|
123
|
+
$[24] = t1;
|
|
124
|
+
} else t1 = $[24];
|
|
125
|
+
let t2;
|
|
126
|
+
if ($[25] !== explorerNavStack || $[26] !== isTypeOrFieldView || $[27] !== navigateToIndex) {
|
|
127
|
+
t2 = isTypeOrFieldView && /* @__PURE__ */ jsx(Breadcrumb, {
|
|
128
|
+
navStack: explorerNavStack,
|
|
129
|
+
onNavigateTo: navigateToIndex
|
|
130
|
+
});
|
|
131
|
+
$[25] = explorerNavStack;
|
|
132
|
+
$[26] = isTypeOrFieldView;
|
|
133
|
+
$[27] = navigateToIndex;
|
|
134
|
+
$[28] = t2;
|
|
135
|
+
} else t2 = $[28];
|
|
136
|
+
let t3;
|
|
137
|
+
if ($[29] !== navItem.name) {
|
|
138
|
+
t3 = /* @__PURE__ */ jsx(SearchRow, {}, navItem.name);
|
|
139
|
+
$[29] = navItem.name;
|
|
140
|
+
$[30] = t3;
|
|
141
|
+
} else t3 = $[30];
|
|
142
|
+
let t4;
|
|
143
|
+
if ($[31] !== content) {
|
|
144
|
+
t4 = /* @__PURE__ */ jsx("div", {
|
|
145
|
+
className: "graphiql-doc-explorer-content",
|
|
146
|
+
children: content
|
|
147
|
+
});
|
|
148
|
+
$[31] = content;
|
|
149
|
+
$[32] = t4;
|
|
150
|
+
} else t4 = $[32];
|
|
151
|
+
let t5;
|
|
152
|
+
if ($[33] !== t2 || $[34] !== t3 || $[35] !== t4) {
|
|
153
|
+
t5 = /* @__PURE__ */ jsxs("section", {
|
|
154
|
+
className: "graphiql-doc-explorer",
|
|
155
|
+
"aria-label": "Documentation Explorer",
|
|
156
|
+
children: [
|
|
157
|
+
t1,
|
|
158
|
+
t2,
|
|
159
|
+
t3,
|
|
160
|
+
t4
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
$[33] = t2;
|
|
164
|
+
$[34] = t3;
|
|
165
|
+
$[35] = t4;
|
|
166
|
+
$[36] = t5;
|
|
167
|
+
} else t5 = $[36];
|
|
168
|
+
return t5;
|
|
266
169
|
};
|
|
267
|
-
|
|
268
|
-
|
|
170
|
+
var TypeView = (t0) => {
|
|
171
|
+
const $ = c(16);
|
|
172
|
+
const { type } = t0;
|
|
173
|
+
let t1;
|
|
174
|
+
if ($[0] !== type) {
|
|
175
|
+
t1 = isObjectType(type) || isInterfaceType(type) || isInputObjectType(type);
|
|
176
|
+
$[0] = type;
|
|
177
|
+
$[1] = t1;
|
|
178
|
+
} else t1 = $[1];
|
|
179
|
+
const hasNewFieldsList = t1;
|
|
180
|
+
let t2;
|
|
181
|
+
if ($[2] !== type) {
|
|
182
|
+
t2 = isEnumType(type) || isUnionType(type) || isInterfaceType(type);
|
|
183
|
+
$[2] = type;
|
|
184
|
+
$[3] = t2;
|
|
185
|
+
} else t2 = $[3];
|
|
186
|
+
const needsTypeDocs = t2;
|
|
187
|
+
let t3;
|
|
188
|
+
if ($[4] !== type) {
|
|
189
|
+
t3 = /* @__PURE__ */ jsx(TypeCard, { type });
|
|
190
|
+
$[4] = type;
|
|
191
|
+
$[5] = t3;
|
|
192
|
+
} else t3 = $[5];
|
|
193
|
+
let t4;
|
|
194
|
+
if ($[6] !== hasNewFieldsList || $[7] !== type) {
|
|
195
|
+
t4 = hasNewFieldsList && /* @__PURE__ */ jsx(FieldsList, { type });
|
|
196
|
+
$[6] = hasNewFieldsList;
|
|
197
|
+
$[7] = type;
|
|
198
|
+
$[8] = t4;
|
|
199
|
+
} else t4 = $[8];
|
|
200
|
+
let t5;
|
|
201
|
+
if ($[9] !== needsTypeDocs || $[10] !== type) {
|
|
202
|
+
t5 = needsTypeDocs && /* @__PURE__ */ jsx("div", {
|
|
203
|
+
className: "graphiql-doc-explorer-type-extra",
|
|
204
|
+
children: /* @__PURE__ */ jsx(TypeDocumentation, {
|
|
205
|
+
type,
|
|
206
|
+
hideHeader: true
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
$[9] = needsTypeDocs;
|
|
210
|
+
$[10] = type;
|
|
211
|
+
$[11] = t5;
|
|
212
|
+
} else t5 = $[11];
|
|
213
|
+
let t6;
|
|
214
|
+
if ($[12] !== t3 || $[13] !== t4 || $[14] !== t5) {
|
|
215
|
+
t6 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
216
|
+
t3,
|
|
217
|
+
t4,
|
|
218
|
+
t5
|
|
219
|
+
] });
|
|
220
|
+
$[12] = t3;
|
|
221
|
+
$[13] = t4;
|
|
222
|
+
$[14] = t5;
|
|
223
|
+
$[15] = t6;
|
|
224
|
+
} else t6 = $[15];
|
|
225
|
+
return t6;
|
|
269
226
|
};
|
|
270
|
-
//#
|
|
227
|
+
//#endregion
|
|
228
|
+
export { DocExplorer };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=doc-explorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-explorer.js","sources":["../../src/components/doc-explorer.tsx"],"sourcesContent":["import {\n GraphQLNamedType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n isType,\n isUnionType,\n} from 'graphql';\nimport type { FC, ReactNode } from 'react';\nimport { PanelHeader, Spinner, useGraphiQL, pick } from '@graphiql/react';\nimport { useDocExplorer, useDocExplorerActions } from '../context';\nimport { Breadcrumb } from './breadcrumb';\nimport { FieldDocumentation } from './field-documentation';\nimport { FieldsList } from './fields-list';\nimport { SchemaDocumentation } from './schema-documentation';\nimport { SearchRow } from './search-row';\nimport { TypeCard } from './type-card';\nimport { TypeDocumentation } from './type-documentation';\nimport './doc-explorer.css';\n\nexport const DocExplorer: FC = () => {\n const { fetchError, isIntrospecting, schema, validationErrors } = useGraphiQL(\n pick('fetchError', 'isIntrospecting', 'schema', 'validationErrors'),\n );\n const explorerNavStack = useDocExplorer();\n const { pop } = useDocExplorerActions();\n const navItem = explorerNavStack.at(-1)!;\n\n const navigateToIndex = (index: number) => {\n const stepsBack = explorerNavStack.length - 1 - index;\n for (let i = 0; i < stepsBack; i++) {\n pop();\n }\n };\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[0]) {\n content = (\n <div className=\"graphiql-doc-explorer-error\">\n Schema is invalid: {validationErrors[0].message}\n </div>\n );\n } else if (isIntrospecting) {\n content = <Spinner />;\n } else if (!schema) {\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 = <TypeView type={navItem.def} />;\n } else if (navItem.def) {\n content = <FieldDocumentation field={navItem.def} />;\n }\n\n const isTypeOrFieldView = explorerNavStack.length > 1;\n\n return (\n <section\n className=\"graphiql-doc-explorer\"\n aria-label=\"Documentation Explorer\"\n >\n <PanelHeader title=\"Schema Explorer\" />\n {isTypeOrFieldView && (\n <Breadcrumb\n navStack={explorerNavStack}\n onNavigateTo={navigateToIndex}\n />\n )}\n <SearchRow key={navItem.name} />\n <div className=\"graphiql-doc-explorer-content\">{content}</div>\n </section>\n );\n};\n\nconst TypeView: FC<{ type: GraphQLNamedType }> = ({ type }) => {\n const hasNewFieldsList =\n isObjectType(type) || isInterfaceType(type) || isInputObjectType(type);\n // Enum/union/scalar still need the TypeDocumentation for enum values and\n // possible-type sections; interface needs it for Implementations.\n const needsTypeDocs =\n isEnumType(type) || isUnionType(type) || isInterfaceType(type);\n\n return (\n <>\n <TypeCard type={type} />\n {hasNewFieldsList && <FieldsList type={type} />}\n {needsTypeDocs && (\n <div className=\"graphiql-doc-explorer-type-extra\">\n <TypeDocumentation type={type} hideHeader />\n </div>\n )}\n </>\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"doc-explorer.js","names":["GraphQLNamedType","isEnumType","isInputObjectType","isInterfaceType","isObjectType","isType","isUnionType","FC","ReactNode","PanelHeader","Spinner","useGraphiQL","pick","useDocExplorer","useDocExplorerActions","Breadcrumb","FieldDocumentation","FieldsList","SchemaDocumentation","SearchRow","TypeCard","TypeDocumentation","DocExplorer","$","_c","t0","Symbol","for","fetchError","isIntrospecting","schema","validationErrors","explorerNavStack","pop","content","navItem","navigateToIndex","at","t1","length","index","stepsBack","i","t2","message","def","isTypeOrFieldView","t3","name","t4","t5","TypeView","type","hasNewFieldsList","needsTypeDocs","t6"],"sources":["../../src/components/doc-explorer.tsx"],"sourcesContent":["import {\n GraphQLNamedType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n isType,\n isUnionType,\n} from 'graphql';\nimport type { FC, ReactNode } from 'react';\nimport { PanelHeader, Spinner, useGraphiQL, pick } from '@graphiql/react';\nimport { useDocExplorer, useDocExplorerActions } from '../context';\nimport { Breadcrumb } from './breadcrumb';\nimport { FieldDocumentation } from './field-documentation';\nimport { FieldsList } from './fields-list';\nimport { SchemaDocumentation } from './schema-documentation';\nimport { SearchRow } from './search-row';\nimport { TypeCard } from './type-card';\nimport { TypeDocumentation } from './type-documentation';\nimport './doc-explorer.css';\n\nexport const DocExplorer: FC = () => {\n const { fetchError, isIntrospecting, schema, validationErrors } = useGraphiQL(\n pick('fetchError', 'isIntrospecting', 'schema', 'validationErrors'),\n );\n const explorerNavStack = useDocExplorer();\n const { pop } = useDocExplorerActions();\n const navItem = explorerNavStack.at(-1)!;\n\n const navigateToIndex = (index: number) => {\n const stepsBack = explorerNavStack.length - 1 - index;\n for (let i = 0; i < stepsBack; i++) {\n pop();\n }\n };\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[0]) {\n content = (\n <div className=\"graphiql-doc-explorer-error\">\n Schema is invalid: {validationErrors[0].message}\n </div>\n );\n } else if (isIntrospecting) {\n content = <Spinner />;\n } else if (!schema) {\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 = <TypeView type={navItem.def} />;\n } else if (navItem.def) {\n content = <FieldDocumentation field={navItem.def} />;\n }\n\n const isTypeOrFieldView = explorerNavStack.length > 1;\n\n return (\n <section\n className=\"graphiql-doc-explorer\"\n aria-label=\"Documentation Explorer\"\n >\n <PanelHeader title=\"Schema Explorer\" />\n {isTypeOrFieldView && (\n <Breadcrumb\n navStack={explorerNavStack}\n onNavigateTo={navigateToIndex}\n />\n )}\n <SearchRow key={navItem.name} />\n <div className=\"graphiql-doc-explorer-content\">{content}</div>\n </section>\n );\n};\n\nconst TypeView: FC<{ type: GraphQLNamedType }> = ({ type }) => {\n const hasNewFieldsList =\n isObjectType(type) || isInterfaceType(type) || isInputObjectType(type);\n // Enum/union/scalar still need the TypeDocumentation for enum values and\n // possible-type sections; interface needs it for Implementations.\n const needsTypeDocs =\n isEnumType(type) || isUnionType(type) || isInterfaceType(type);\n\n return (\n <>\n <TypeCard type={type} />\n {hasNewFieldsList && <FieldsList type={type} />}\n {needsTypeDocs && (\n <div className=\"graphiql-doc-explorer-type-extra\">\n <TypeDocumentation type={type} hideHeader />\n </div>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAasB,oBAAkB;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAE3BF,KAAAb,KAAK,cAAc,mBAAmB,UAAU,kBAAkB;EAACW,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CADrE,MAAA,EAAAK,YAAAC,iBAAAC,QAAAC,qBAAkEpB,YAChEc,EACF;CACA,MAAAO,mBAAyBnB,eAAe;CACxC,MAAA,EAAAoB,QAAgBnB,sBAAsB;CAAE,IAAAoB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAb,EAAA,OAAAS,oBAAAT,EAAA,OAAAK,cAAAL,EAAA,OAAAM,mBAAAN,EAAA,OAAAU,OAAAV,EAAA,OAAAO,UAAAP,EAAA,OAAAQ,kBAAA;EACxCI,UAAgBH,iBAAgBK,GAAA,EAAM;EAAG,IAAAC;EAAA,IAAAf,EAAA,QAAAS,iBAAAO,UAAAhB,EAAA,QAAAU,KAAA;GAEjBK,MAAAE,UAAA;IACtB,MAAAC,YAAkBT,iBAAgBO,SAAA,IAAcC;IAAM,KAAA,IAAAE,IAAA,GACtCA,IAAID,WAAWC,KAC7BT,IAAI;GAAC;GAERV,EAAA,MAAAS,iBAAAO;GAAAhB,EAAA,MAAAU;GAAAV,EAAA,MAAAe;EAAA,OAAAA,KAAAf,EAAA;EALDa,kBAAwBE;EAOxBJ,UAAA;EAA8B,IAC1BN,YAAU;GAAA,IAAAe;GAAA,IAAApB,EAAA,QAAAG,OAAAC,IAAA,2BAAA,GAAA;IAEVgB,KAAA,o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