@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.
- package/README.md +1 -0
- package/dist/components/argument.d.ts +21 -0
- package/dist/components/argument.js +96 -0
- package/dist/components/argument.js.map +1 -0
- package/dist/components/default-value.d.ts +9 -0
- package/dist/components/default-value.js +78 -0
- package/dist/components/default-value.js.map +1 -0
- package/dist/components/deprecation-reason.d.ts +9 -0
- package/dist/components/deprecation-reason.js +24 -0
- package/dist/components/deprecation-reason.js.map +1 -0
- package/dist/components/directive.d.ts +9 -0
- package/dist/components/directive.js +25 -0
- package/dist/components/directive.js.map +1 -0
- package/dist/components/doc-explorer.d.ts +1 -0
- package/dist/components/doc-explorer.js +234 -0
- package/dist/components/doc-explorer.js.map +1 -0
- package/dist/components/field-documentation.d.ts +9 -0
- package/dist/components/field-documentation.js +182 -0
- package/dist/components/field-documentation.js.map +1 -0
- package/dist/components/field-link.d.ts +9 -0
- package/dist/components/field-link.js +48 -0
- package/dist/components/field-link.js.map +1 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/schema-documentation.d.ts +9 -0
- package/dist/components/schema-documentation.js +168 -0
- package/dist/components/schema-documentation.js.map +1 -0
- package/dist/components/search.d.ts +17 -0
- package/dist/components/search.js +379 -0
- package/dist/components/search.js.map +1 -0
- package/dist/components/section.d.ts +11 -0
- package/dist/components/section.js +68 -0
- package/dist/components/section.js.map +1 -0
- package/dist/components/type-documentation.d.ts +9 -0
- package/dist/components/type-documentation.js +394 -0
- package/dist/components/type-documentation.js.map +1 -0
- package/dist/components/type-link.d.ts +9 -0
- package/dist/components/type-link.js +52 -0
- package/dist/components/type-link.js.map +1 -0
- package/dist/components/utils.d.ts +3 -0
- package/dist/components/utils.js +22 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/context.d.ts +56 -0
- package/dist/context.js +234 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +285 -0
- package/package.json +60 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { isNamedType, isObjectType, isInterfaceType, isInputObjectType, isEnumType, isAbstractType } from "graphql";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { MarkdownContent, Button, useSchemaContext } from "@graphiql/react";
|
|
6
|
+
import { Argument } from "./argument.js";
|
|
7
|
+
import { DefaultValue } from "./default-value.js";
|
|
8
|
+
import { DeprecationReason } from "./deprecation-reason.js";
|
|
9
|
+
import { FieldLink } from "./field-link.js";
|
|
10
|
+
import { ExplorerSection } from "./section.js";
|
|
11
|
+
import { TypeLink } from "./type-link.js";
|
|
12
|
+
/* empty css */
|
|
13
|
+
function TypeDocumentation(props) {
|
|
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 })
|
|
23
|
+
] }) : null;
|
|
24
|
+
$[0] = props.type;
|
|
25
|
+
$[1] = t0;
|
|
26
|
+
} else {
|
|
27
|
+
t0 = $[1];
|
|
28
|
+
}
|
|
29
|
+
return t0;
|
|
30
|
+
}
|
|
31
|
+
function ImplementsInterfaces(t0) {
|
|
32
|
+
const $ = c(5);
|
|
33
|
+
const {
|
|
34
|
+
type
|
|
35
|
+
} = t0;
|
|
36
|
+
if (!isObjectType(type)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
let t1;
|
|
40
|
+
if ($[0] !== type) {
|
|
41
|
+
t1 = type.getInterfaces();
|
|
42
|
+
$[0] = type;
|
|
43
|
+
$[1] = t1;
|
|
44
|
+
} else {
|
|
45
|
+
t1 = $[1];
|
|
46
|
+
}
|
|
47
|
+
const interfaces = t1;
|
|
48
|
+
let t2;
|
|
49
|
+
if ($[2] !== interfaces.length || $[3] !== type) {
|
|
50
|
+
t2 = interfaces.length > 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Implements", children: type.getInterfaces().map(_temp) }) : null;
|
|
51
|
+
$[2] = interfaces.length;
|
|
52
|
+
$[3] = type;
|
|
53
|
+
$[4] = t2;
|
|
54
|
+
} else {
|
|
55
|
+
t2 = $[4];
|
|
56
|
+
}
|
|
57
|
+
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) {
|
|
63
|
+
const $ = c(12);
|
|
64
|
+
const {
|
|
65
|
+
type
|
|
66
|
+
} = t0;
|
|
67
|
+
const [showDeprecated, setShowDeprecated] = useState(false);
|
|
68
|
+
let t1;
|
|
69
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t1 = () => {
|
|
71
|
+
setShowDeprecated(true);
|
|
72
|
+
};
|
|
73
|
+
$[0] = t1;
|
|
74
|
+
} else {
|
|
75
|
+
t1 = $[0];
|
|
76
|
+
}
|
|
77
|
+
const handleShowDeprecated = t1;
|
|
78
|
+
if (!isObjectType(type) && !isInterfaceType(type) && !isInputObjectType(type)) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
let deprecatedFields;
|
|
82
|
+
let fields;
|
|
83
|
+
let t2;
|
|
84
|
+
if ($[1] !== type) {
|
|
85
|
+
const fieldMap = type.getFields();
|
|
86
|
+
fields = [];
|
|
87
|
+
deprecatedFields = [];
|
|
88
|
+
for (const field of Object.keys(fieldMap).map((name) => fieldMap[name])) {
|
|
89
|
+
if (field.deprecationReason) {
|
|
90
|
+
deprecatedFields.push(field);
|
|
91
|
+
} else {
|
|
92
|
+
fields.push(field);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
t2 = fields.length > 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Fields", children: fields.map(_temp2) }) : null;
|
|
96
|
+
$[1] = type;
|
|
97
|
+
$[2] = deprecatedFields;
|
|
98
|
+
$[3] = fields;
|
|
99
|
+
$[4] = t2;
|
|
100
|
+
} else {
|
|
101
|
+
deprecatedFields = $[2];
|
|
102
|
+
fields = $[3];
|
|
103
|
+
t2 = $[4];
|
|
104
|
+
}
|
|
105
|
+
let t3;
|
|
106
|
+
if ($[5] !== deprecatedFields || $[6] !== fields.length || $[7] !== showDeprecated) {
|
|
107
|
+
t3 = deprecatedFields.length > 0 ? showDeprecated || fields.length === 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Deprecated Fields", children: deprecatedFields.map(_temp3) }) : /* @__PURE__ */ jsx(Button, { type: "button", onClick: handleShowDeprecated, children: "Show Deprecated Fields" }) : null;
|
|
108
|
+
$[5] = deprecatedFields;
|
|
109
|
+
$[6] = fields.length;
|
|
110
|
+
$[7] = showDeprecated;
|
|
111
|
+
$[8] = t3;
|
|
112
|
+
} else {
|
|
113
|
+
t3 = $[8];
|
|
114
|
+
}
|
|
115
|
+
let t4;
|
|
116
|
+
if ($[9] !== t2 || $[10] !== t3) {
|
|
117
|
+
t4 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
t2,
|
|
119
|
+
t3
|
|
120
|
+
] });
|
|
121
|
+
$[9] = t2;
|
|
122
|
+
$[10] = t3;
|
|
123
|
+
$[11] = t4;
|
|
124
|
+
} else {
|
|
125
|
+
t4 = $[11];
|
|
126
|
+
}
|
|
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) {
|
|
136
|
+
const $ = c(22);
|
|
137
|
+
const {
|
|
138
|
+
field
|
|
139
|
+
} = t0;
|
|
140
|
+
let t1;
|
|
141
|
+
let t2;
|
|
142
|
+
let t3;
|
|
143
|
+
if ($[0] !== field) {
|
|
144
|
+
const args = "args" in field ? field.args.filter(_temp4) : [];
|
|
145
|
+
t3 = "graphiql-doc-explorer-item";
|
|
146
|
+
t1 = /* @__PURE__ */ jsx(FieldLink, { field });
|
|
147
|
+
t2 = args.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
+
"(",
|
|
149
|
+
/* @__PURE__ */ jsx("span", { children: args.map((arg_0) => args.length === 1 ? /* @__PURE__ */ jsx(Argument, { arg: arg_0, inline: true }, arg_0.name) : /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-argument-multiple", children: /* @__PURE__ */ jsx(Argument, { arg: arg_0, inline: true }) }, arg_0.name)) }),
|
|
150
|
+
")"
|
|
151
|
+
] }) : null;
|
|
152
|
+
$[0] = field;
|
|
153
|
+
$[1] = t1;
|
|
154
|
+
$[2] = t2;
|
|
155
|
+
$[3] = t3;
|
|
156
|
+
} else {
|
|
157
|
+
t1 = $[1];
|
|
158
|
+
t2 = $[2];
|
|
159
|
+
t3 = $[3];
|
|
160
|
+
}
|
|
161
|
+
let t4;
|
|
162
|
+
if ($[4] !== field.type) {
|
|
163
|
+
t4 = /* @__PURE__ */ jsx(TypeLink, { type: field.type });
|
|
164
|
+
$[4] = field.type;
|
|
165
|
+
$[5] = t4;
|
|
166
|
+
} else {
|
|
167
|
+
t4 = $[5];
|
|
168
|
+
}
|
|
169
|
+
let t5;
|
|
170
|
+
if ($[6] !== field) {
|
|
171
|
+
t5 = /* @__PURE__ */ jsx(DefaultValue, { field });
|
|
172
|
+
$[6] = field;
|
|
173
|
+
$[7] = t5;
|
|
174
|
+
} else {
|
|
175
|
+
t5 = $[7];
|
|
176
|
+
}
|
|
177
|
+
let t6;
|
|
178
|
+
if ($[8] !== t1 || $[9] !== t2 || $[10] !== t4 || $[11] !== t5) {
|
|
179
|
+
t6 = /* @__PURE__ */ jsxs("div", { children: [
|
|
180
|
+
t1,
|
|
181
|
+
t2,
|
|
182
|
+
": ",
|
|
183
|
+
t4,
|
|
184
|
+
t5
|
|
185
|
+
] });
|
|
186
|
+
$[8] = t1;
|
|
187
|
+
$[9] = t2;
|
|
188
|
+
$[10] = t4;
|
|
189
|
+
$[11] = t5;
|
|
190
|
+
$[12] = t6;
|
|
191
|
+
} else {
|
|
192
|
+
t6 = $[12];
|
|
193
|
+
}
|
|
194
|
+
let t7;
|
|
195
|
+
if ($[13] !== field.description) {
|
|
196
|
+
t7 = field.description ? /* @__PURE__ */ jsx(MarkdownContent, { type: "description", onlyShowFirstChild: true, children: field.description }) : null;
|
|
197
|
+
$[13] = field.description;
|
|
198
|
+
$[14] = t7;
|
|
199
|
+
} else {
|
|
200
|
+
t7 = $[14];
|
|
201
|
+
}
|
|
202
|
+
let t8;
|
|
203
|
+
if ($[15] !== field.deprecationReason) {
|
|
204
|
+
t8 = /* @__PURE__ */ jsx(DeprecationReason, { children: field.deprecationReason });
|
|
205
|
+
$[15] = field.deprecationReason;
|
|
206
|
+
$[16] = t8;
|
|
207
|
+
} else {
|
|
208
|
+
t8 = $[16];
|
|
209
|
+
}
|
|
210
|
+
let t9;
|
|
211
|
+
if ($[17] !== t3 || $[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
|
|
212
|
+
t9 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
|
|
213
|
+
t6,
|
|
214
|
+
t7,
|
|
215
|
+
t8
|
|
216
|
+
] });
|
|
217
|
+
$[17] = t3;
|
|
218
|
+
$[18] = t6;
|
|
219
|
+
$[19] = t7;
|
|
220
|
+
$[20] = t8;
|
|
221
|
+
$[21] = t9;
|
|
222
|
+
} else {
|
|
223
|
+
t9 = $[21];
|
|
224
|
+
}
|
|
225
|
+
return t9;
|
|
226
|
+
}
|
|
227
|
+
function _temp4(arg) {
|
|
228
|
+
return !arg.deprecationReason;
|
|
229
|
+
}
|
|
230
|
+
function EnumValues(t0) {
|
|
231
|
+
const $ = c(12);
|
|
232
|
+
const {
|
|
233
|
+
type
|
|
234
|
+
} = t0;
|
|
235
|
+
const [showDeprecated, setShowDeprecated] = useState(false);
|
|
236
|
+
let t1;
|
|
237
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
238
|
+
t1 = () => {
|
|
239
|
+
setShowDeprecated(true);
|
|
240
|
+
};
|
|
241
|
+
$[0] = t1;
|
|
242
|
+
} else {
|
|
243
|
+
t1 = $[0];
|
|
244
|
+
}
|
|
245
|
+
const handleShowDeprecated = t1;
|
|
246
|
+
if (!isEnumType(type)) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
let deprecatedValues;
|
|
250
|
+
let t2;
|
|
251
|
+
let values;
|
|
252
|
+
if ($[1] !== type) {
|
|
253
|
+
values = [];
|
|
254
|
+
deprecatedValues = [];
|
|
255
|
+
for (const value of type.getValues()) {
|
|
256
|
+
if (value.deprecationReason) {
|
|
257
|
+
deprecatedValues.push(value);
|
|
258
|
+
} else {
|
|
259
|
+
values.push(value);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
t2 = values.length > 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Enum Values", children: values.map(_temp5) }) : null;
|
|
263
|
+
$[1] = type;
|
|
264
|
+
$[2] = deprecatedValues;
|
|
265
|
+
$[3] = t2;
|
|
266
|
+
$[4] = values;
|
|
267
|
+
} else {
|
|
268
|
+
deprecatedValues = $[2];
|
|
269
|
+
t2 = $[3];
|
|
270
|
+
values = $[4];
|
|
271
|
+
}
|
|
272
|
+
let t3;
|
|
273
|
+
if ($[5] !== deprecatedValues || $[6] !== showDeprecated || $[7] !== values.length) {
|
|
274
|
+
t3 = deprecatedValues.length > 0 ? showDeprecated || values.length === 0 ? /* @__PURE__ */ jsx(ExplorerSection, { title: "Deprecated Enum Values", children: deprecatedValues.map(_temp6) }) : /* @__PURE__ */ jsx(Button, { type: "button", onClick: handleShowDeprecated, children: "Show Deprecated Values" }) : null;
|
|
275
|
+
$[5] = deprecatedValues;
|
|
276
|
+
$[6] = showDeprecated;
|
|
277
|
+
$[7] = values.length;
|
|
278
|
+
$[8] = t3;
|
|
279
|
+
} else {
|
|
280
|
+
t3 = $[8];
|
|
281
|
+
}
|
|
282
|
+
let t4;
|
|
283
|
+
if ($[9] !== t2 || $[10] !== t3) {
|
|
284
|
+
t4 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
|
+
t2,
|
|
286
|
+
t3
|
|
287
|
+
] });
|
|
288
|
+
$[9] = t2;
|
|
289
|
+
$[10] = t3;
|
|
290
|
+
$[11] = t4;
|
|
291
|
+
} else {
|
|
292
|
+
t4 = $[11];
|
|
293
|
+
}
|
|
294
|
+
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) {
|
|
303
|
+
const $ = c(10);
|
|
304
|
+
const {
|
|
305
|
+
value
|
|
306
|
+
} = t0;
|
|
307
|
+
let t1;
|
|
308
|
+
if ($[0] !== value.name) {
|
|
309
|
+
t1 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-enum-value", children: value.name });
|
|
310
|
+
$[0] = value.name;
|
|
311
|
+
$[1] = t1;
|
|
312
|
+
} else {
|
|
313
|
+
t1 = $[1];
|
|
314
|
+
}
|
|
315
|
+
let t2;
|
|
316
|
+
if ($[2] !== value.description) {
|
|
317
|
+
t2 = value.description ? /* @__PURE__ */ jsx(MarkdownContent, { type: "description", children: value.description }) : null;
|
|
318
|
+
$[2] = value.description;
|
|
319
|
+
$[3] = t2;
|
|
320
|
+
} else {
|
|
321
|
+
t2 = $[3];
|
|
322
|
+
}
|
|
323
|
+
let t3;
|
|
324
|
+
if ($[4] !== value.deprecationReason) {
|
|
325
|
+
t3 = value.deprecationReason ? /* @__PURE__ */ jsx(MarkdownContent, { type: "deprecation", children: value.deprecationReason }) : null;
|
|
326
|
+
$[4] = value.deprecationReason;
|
|
327
|
+
$[5] = t3;
|
|
328
|
+
} else {
|
|
329
|
+
t3 = $[5];
|
|
330
|
+
}
|
|
331
|
+
let t4;
|
|
332
|
+
if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
|
|
333
|
+
t4 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-item", children: [
|
|
334
|
+
t1,
|
|
335
|
+
t2,
|
|
336
|
+
t3
|
|
337
|
+
] });
|
|
338
|
+
$[6] = t1;
|
|
339
|
+
$[7] = t2;
|
|
340
|
+
$[8] = t3;
|
|
341
|
+
$[9] = t4;
|
|
342
|
+
} else {
|
|
343
|
+
t4 = $[9];
|
|
344
|
+
}
|
|
345
|
+
return t4;
|
|
346
|
+
}
|
|
347
|
+
function PossibleTypes(t0) {
|
|
348
|
+
const $ = c(7);
|
|
349
|
+
const {
|
|
350
|
+
type
|
|
351
|
+
} = t0;
|
|
352
|
+
let t1;
|
|
353
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
354
|
+
t1 = {
|
|
355
|
+
nonNull: true
|
|
356
|
+
};
|
|
357
|
+
$[0] = t1;
|
|
358
|
+
} else {
|
|
359
|
+
t1 = $[0];
|
|
360
|
+
}
|
|
361
|
+
const {
|
|
362
|
+
schema
|
|
363
|
+
} = useSchemaContext(t1);
|
|
364
|
+
if (!schema || !isAbstractType(type)) {
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
const t2 = isInterfaceType(type) ? "Implementations" : "Possible Types";
|
|
368
|
+
let t3;
|
|
369
|
+
if ($[1] !== schema || $[2] !== type) {
|
|
370
|
+
t3 = schema.getPossibleTypes(type).map(_temp7);
|
|
371
|
+
$[1] = schema;
|
|
372
|
+
$[2] = type;
|
|
373
|
+
$[3] = t3;
|
|
374
|
+
} else {
|
|
375
|
+
t3 = $[3];
|
|
376
|
+
}
|
|
377
|
+
let t4;
|
|
378
|
+
if ($[4] !== t2 || $[5] !== t3) {
|
|
379
|
+
t4 = /* @__PURE__ */ jsx(ExplorerSection, { title: t2, children: t3 });
|
|
380
|
+
$[4] = t2;
|
|
381
|
+
$[5] = t3;
|
|
382
|
+
$[6] = t4;
|
|
383
|
+
} else {
|
|
384
|
+
t4 = $[6];
|
|
385
|
+
}
|
|
386
|
+
return t4;
|
|
387
|
+
}
|
|
388
|
+
function _temp7(possibleType) {
|
|
389
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TypeLink, { type: possibleType }) }, possibleType.name);
|
|
390
|
+
}
|
|
391
|
+
export {
|
|
392
|
+
TypeDocumentation
|
|
393
|
+
};
|
|
394
|
+
//# sourceMappingURL=type-documentation.js.map
|
|
@@ -0,0 +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,KAAA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AElEiC,SAAA6B,OAAMG,iBAAkBjE,IAAI,EAACU,IAAAwD,MAI7B;AAACrE,WAAAiE;AAAAjE,WAAAG;AAAAH,WAAAoC;AAAAA,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;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { useExplorerContext } from "../context.js";
|
|
4
|
+
import { renderType } from "./utils.js";
|
|
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
|
+
}
|
|
18
|
+
const {
|
|
19
|
+
push
|
|
20
|
+
} = useExplorerContext(t0);
|
|
21
|
+
if (!props.type) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[1] !== push) {
|
|
26
|
+
t1 = (namedType) => /* @__PURE__ */ jsx("a", { className: "graphiql-doc-explorer-type-name", onClick: (event) => {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
push({
|
|
29
|
+
name: namedType.name,
|
|
30
|
+
def: namedType
|
|
31
|
+
});
|
|
32
|
+
}, href: "#", children: namedType.name });
|
|
33
|
+
$[1] = push;
|
|
34
|
+
$[2] = t1;
|
|
35
|
+
} else {
|
|
36
|
+
t1 = $[2];
|
|
37
|
+
}
|
|
38
|
+
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;
|
|
44
|
+
} else {
|
|
45
|
+
t2 = $[5];
|
|
46
|
+
}
|
|
47
|
+
return t2;
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
TypeLink
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=type-link.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { isNonNullType, isListType } from "graphql";
|
|
3
|
+
function renderType(type, renderNamedType) {
|
|
4
|
+
if (isNonNullType(type)) {
|
|
5
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6
|
+
renderType(type.ofType, renderNamedType),
|
|
7
|
+
"!"
|
|
8
|
+
] });
|
|
9
|
+
}
|
|
10
|
+
if (isListType(type)) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
"[",
|
|
13
|
+
renderType(type.ofType, renderNamedType),
|
|
14
|
+
"]"
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
return renderNamedType(type);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
renderType
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/components/utils.tsx"],"sourcesContent":["'use no memo';\n\nimport {\n GraphQLNamedType,\n GraphQLType,\n isListType,\n isNonNullType,\n} from 'graphql';\nimport { JSX } from 'react';\n\nexport function renderType(\n type: GraphQLType,\n renderNamedType: (namedType: GraphQLNamedType) => JSX.Element,\n): JSX.Element {\n if (isNonNullType(type)) {\n return <>{renderType(type.ofType, renderNamedType)}!</>;\n }\n if (isListType(type)) {\n return <>[{renderType(type.ofType, renderNamedType)}]</>;\n }\n return renderNamedType(type);\n}\n"],"names":["renderType","type","renderNamedType","isNonNullType","ofType","isListType"],"mappings":";;AAUgBA,SAAAA,WACdC,MACAC,iBACa;AACTC,MAAAA,cAAcF,IAAI,GAAG;AACvB,WAAUD,qBAAAA,UAAAA,EAAAA,UAAAA;AAAAA,MAAWC,WAAAA,KAAKG,QAAQF,eAAe;AAAA,MAAE;AAAA,IAAA,GAAC;AAAA,EAAA;AAElDG,MAAAA,WAAWJ,IAAI,GAAG;AACpB,WAAS,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA;AAAA,MAAED,WAAWC,KAAKG,QAAQF,eAAe;AAAA,MAAE;AAAA,IAAA,GAAC;AAAA,EAAA;AAEvD,SAAOA,gBAAgBD,IAAI;AAC7B;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 = {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the item.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The definition object of the item, this can be a named type, a field, an
|
|
11
|
+
* input field or an argument.
|
|
12
|
+
*/
|
|
13
|
+
def?: GraphQLNamedType | ExplorerFieldDef;
|
|
14
|
+
};
|
|
15
|
+
export declare type ExplorerNavStack = [
|
|
16
|
+
ExplorerNavStackItem,
|
|
17
|
+
...ExplorerNavStackItem[]
|
|
18
|
+
];
|
|
19
|
+
export declare type ExplorerContextType = {
|
|
20
|
+
/**
|
|
21
|
+
* A stack of navigation items. The last item in the list is the current one.
|
|
22
|
+
* This list always contains at least one item.
|
|
23
|
+
*/
|
|
24
|
+
explorerNavStack: ExplorerNavStack;
|
|
25
|
+
/**
|
|
26
|
+
* Push an item to the navigation stack.
|
|
27
|
+
* @param item The item that should be pushed to the stack.
|
|
28
|
+
*/
|
|
29
|
+
push(item: ExplorerNavStackItem): void;
|
|
30
|
+
/**
|
|
31
|
+
* Pop the last item from the navigation stack.
|
|
32
|
+
*/
|
|
33
|
+
pop(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Reset the navigation stack to its initial state, this will remove all but
|
|
36
|
+
* the initial stack item.
|
|
37
|
+
*/
|
|
38
|
+
reset(): void;
|
|
39
|
+
};
|
|
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 {};
|