@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,379 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { isObjectType, isInterfaceType, isInputObjectType } from "graphql";
|
|
4
|
+
import { useRef, useState, useEffect } from "react";
|
|
5
|
+
import { ComboboxOptions, ComboboxOption, ComboboxInput, Combobox } from "@headlessui/react";
|
|
6
|
+
import { debounce, useSchemaContext, MagnifyingGlassIcon, isMacOs } from "@graphiql/react";
|
|
7
|
+
import { useExplorerContext } from "../context.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import { renderType } from "./utils.js";
|
|
10
|
+
const Search = () => {
|
|
11
|
+
const $ = c(33);
|
|
12
|
+
let t0;
|
|
13
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
14
|
+
t0 = {
|
|
15
|
+
nonNull: true,
|
|
16
|
+
caller: Search
|
|
17
|
+
};
|
|
18
|
+
$[0] = t0;
|
|
19
|
+
} else {
|
|
20
|
+
t0 = $[0];
|
|
21
|
+
}
|
|
22
|
+
const {
|
|
23
|
+
explorerNavStack,
|
|
24
|
+
push
|
|
25
|
+
} = useExplorerContext(t0);
|
|
26
|
+
const inputRef = useRef(null);
|
|
27
|
+
const getSearchResults = useSearchResults();
|
|
28
|
+
const [searchValue, setSearchValue] = useState("");
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[1] !== getSearchResults || $[2] !== searchValue) {
|
|
31
|
+
t1 = () => getSearchResults(searchValue);
|
|
32
|
+
$[1] = getSearchResults;
|
|
33
|
+
$[2] = searchValue;
|
|
34
|
+
$[3] = t1;
|
|
35
|
+
} else {
|
|
36
|
+
t1 = $[3];
|
|
37
|
+
}
|
|
38
|
+
const [results, setResults] = useState(t1);
|
|
39
|
+
let t2;
|
|
40
|
+
if ($[4] !== getSearchResults) {
|
|
41
|
+
t2 = debounce(200, (search) => {
|
|
42
|
+
setResults(getSearchResults(search));
|
|
43
|
+
});
|
|
44
|
+
$[4] = getSearchResults;
|
|
45
|
+
$[5] = t2;
|
|
46
|
+
} else {
|
|
47
|
+
t2 = $[5];
|
|
48
|
+
}
|
|
49
|
+
const debouncedGetSearchResults = t2;
|
|
50
|
+
const [ref] = useState(inputRef);
|
|
51
|
+
const isFocused = ref.current === document.activeElement;
|
|
52
|
+
let t3;
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[6] !== debouncedGetSearchResults || $[7] !== searchValue) {
|
|
55
|
+
t3 = () => {
|
|
56
|
+
debouncedGetSearchResults(searchValue);
|
|
57
|
+
};
|
|
58
|
+
t4 = [debouncedGetSearchResults, searchValue];
|
|
59
|
+
$[6] = debouncedGetSearchResults;
|
|
60
|
+
$[7] = searchValue;
|
|
61
|
+
$[8] = t3;
|
|
62
|
+
$[9] = t4;
|
|
63
|
+
} else {
|
|
64
|
+
t3 = $[8];
|
|
65
|
+
t4 = $[9];
|
|
66
|
+
}
|
|
67
|
+
useEffect(t3, t4);
|
|
68
|
+
let t5;
|
|
69
|
+
let t6;
|
|
70
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
71
|
+
t5 = () => {
|
|
72
|
+
const handleKeyDown = function handleKeyDown2(event) {
|
|
73
|
+
if (event.metaKey && event.key === "k") {
|
|
74
|
+
inputRef.current.focus();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
78
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
79
|
+
};
|
|
80
|
+
t6 = [];
|
|
81
|
+
$[10] = t5;
|
|
82
|
+
$[11] = t6;
|
|
83
|
+
} else {
|
|
84
|
+
t5 = $[10];
|
|
85
|
+
t6 = $[11];
|
|
86
|
+
}
|
|
87
|
+
useEffect(t5, t6);
|
|
88
|
+
let navItem;
|
|
89
|
+
let onSelect;
|
|
90
|
+
let t7;
|
|
91
|
+
if ($[12] !== explorerNavStack || $[13] !== push) {
|
|
92
|
+
navItem = explorerNavStack.at(-1);
|
|
93
|
+
let t82;
|
|
94
|
+
if ($[17] !== push) {
|
|
95
|
+
t82 = (def) => {
|
|
96
|
+
push("field" in def ? {
|
|
97
|
+
name: def.field.name,
|
|
98
|
+
def: def.field
|
|
99
|
+
} : {
|
|
100
|
+
name: def.type.name,
|
|
101
|
+
def: def.type
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
$[17] = push;
|
|
105
|
+
$[18] = t82;
|
|
106
|
+
} else {
|
|
107
|
+
t82 = $[18];
|
|
108
|
+
}
|
|
109
|
+
onSelect = t82;
|
|
110
|
+
t7 = explorerNavStack.length === 1 || isObjectType(navItem.def) || isInterfaceType(navItem.def) || isInputObjectType(navItem.def);
|
|
111
|
+
$[12] = explorerNavStack;
|
|
112
|
+
$[13] = push;
|
|
113
|
+
$[14] = navItem;
|
|
114
|
+
$[15] = onSelect;
|
|
115
|
+
$[16] = t7;
|
|
116
|
+
} else {
|
|
117
|
+
navItem = $[14];
|
|
118
|
+
onSelect = $[15];
|
|
119
|
+
t7 = $[16];
|
|
120
|
+
}
|
|
121
|
+
const shouldSearchBoxAppear = t7;
|
|
122
|
+
if (!shouldSearchBoxAppear) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const t8 = isFocused ? void 0 : "idle";
|
|
126
|
+
const t9 = `Search ${navItem.name}...`;
|
|
127
|
+
let t10;
|
|
128
|
+
let t11;
|
|
129
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
130
|
+
t10 = () => {
|
|
131
|
+
inputRef.current.focus();
|
|
132
|
+
};
|
|
133
|
+
t11 = /* @__PURE__ */ jsx(MagnifyingGlassIcon, {});
|
|
134
|
+
$[19] = t10;
|
|
135
|
+
$[20] = t11;
|
|
136
|
+
} else {
|
|
137
|
+
t10 = $[19];
|
|
138
|
+
t11 = $[20];
|
|
139
|
+
}
|
|
140
|
+
let t12;
|
|
141
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
142
|
+
t12 = (event_0) => setSearchValue(event_0.target.value);
|
|
143
|
+
$[21] = t12;
|
|
144
|
+
} else {
|
|
145
|
+
t12 = $[21];
|
|
146
|
+
}
|
|
147
|
+
let t13;
|
|
148
|
+
if ($[22] !== searchValue) {
|
|
149
|
+
t13 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-search-input", onClick: t10, children: [
|
|
150
|
+
t11,
|
|
151
|
+
/* @__PURE__ */ jsx(ComboboxInput, { autoComplete: "off", onChange: t12, placeholder: `${isMacOs ? "⌘" : "Ctrl"} K`, ref: inputRef, value: searchValue, "data-cy": "doc-explorer-input" })
|
|
152
|
+
] });
|
|
153
|
+
$[22] = searchValue;
|
|
154
|
+
$[23] = t13;
|
|
155
|
+
} else {
|
|
156
|
+
t13 = $[23];
|
|
157
|
+
}
|
|
158
|
+
let t14;
|
|
159
|
+
if ($[24] !== isFocused || $[25] !== results) {
|
|
160
|
+
t14 = isFocused && /* @__PURE__ */ jsxs(ComboboxOptions, { "data-cy": "doc-explorer-list", children: [
|
|
161
|
+
results.within.length + results.types.length + results.fields.length === 0 ? /* @__PURE__ */ jsx("li", { className: "graphiql-doc-explorer-search-empty", children: "No results found" }) : results.within.map(_temp),
|
|
162
|
+
results.within.length > 0 && results.types.length + results.fields.length > 0 ? /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-search-divider", children: "Other results" }) : null,
|
|
163
|
+
results.types.map(_temp2),
|
|
164
|
+
results.fields.map(_temp3)
|
|
165
|
+
] });
|
|
166
|
+
$[24] = isFocused;
|
|
167
|
+
$[25] = results;
|
|
168
|
+
$[26] = t14;
|
|
169
|
+
} else {
|
|
170
|
+
t14 = $[26];
|
|
171
|
+
}
|
|
172
|
+
let t15;
|
|
173
|
+
if ($[27] !== onSelect || $[28] !== t13 || $[29] !== t14 || $[30] !== t8 || $[31] !== t9) {
|
|
174
|
+
t15 = /* @__PURE__ */ jsxs(Combobox, { as: "div", className: "graphiql-doc-explorer-search", onChange: onSelect, "data-state": t8, "aria-label": t9, children: [
|
|
175
|
+
t13,
|
|
176
|
+
t14
|
|
177
|
+
] });
|
|
178
|
+
$[27] = onSelect;
|
|
179
|
+
$[28] = t13;
|
|
180
|
+
$[29] = t14;
|
|
181
|
+
$[30] = t8;
|
|
182
|
+
$[31] = t9;
|
|
183
|
+
$[32] = t15;
|
|
184
|
+
} else {
|
|
185
|
+
t15 = $[32];
|
|
186
|
+
}
|
|
187
|
+
return t15;
|
|
188
|
+
};
|
|
189
|
+
const _useSearchResults = useSearchResults;
|
|
190
|
+
function useSearchResults(caller) {
|
|
191
|
+
const $ = c(9);
|
|
192
|
+
const t0 = caller || _useSearchResults;
|
|
193
|
+
let t1;
|
|
194
|
+
if ($[0] !== t0) {
|
|
195
|
+
t1 = {
|
|
196
|
+
nonNull: true,
|
|
197
|
+
caller: t0
|
|
198
|
+
};
|
|
199
|
+
$[0] = t0;
|
|
200
|
+
$[1] = t1;
|
|
201
|
+
} else {
|
|
202
|
+
t1 = $[1];
|
|
203
|
+
}
|
|
204
|
+
const {
|
|
205
|
+
explorerNavStack
|
|
206
|
+
} = useExplorerContext(t1);
|
|
207
|
+
const t2 = caller || _useSearchResults;
|
|
208
|
+
let t3;
|
|
209
|
+
if ($[2] !== t2) {
|
|
210
|
+
t3 = {
|
|
211
|
+
nonNull: true,
|
|
212
|
+
caller: t2
|
|
213
|
+
};
|
|
214
|
+
$[2] = t2;
|
|
215
|
+
$[3] = t3;
|
|
216
|
+
} else {
|
|
217
|
+
t3 = $[3];
|
|
218
|
+
}
|
|
219
|
+
const {
|
|
220
|
+
schema
|
|
221
|
+
} = useSchemaContext(t3);
|
|
222
|
+
let t4;
|
|
223
|
+
if ($[4] !== explorerNavStack) {
|
|
224
|
+
t4 = explorerNavStack.at(-1);
|
|
225
|
+
$[4] = explorerNavStack;
|
|
226
|
+
$[5] = t4;
|
|
227
|
+
} else {
|
|
228
|
+
t4 = $[5];
|
|
229
|
+
}
|
|
230
|
+
const navItem = t4;
|
|
231
|
+
let t5;
|
|
232
|
+
if ($[6] !== navItem || $[7] !== schema) {
|
|
233
|
+
t5 = (searchValue) => {
|
|
234
|
+
const matches = {
|
|
235
|
+
within: [],
|
|
236
|
+
types: [],
|
|
237
|
+
fields: []
|
|
238
|
+
};
|
|
239
|
+
if (!schema) {
|
|
240
|
+
return matches;
|
|
241
|
+
}
|
|
242
|
+
const withinType = navItem.def;
|
|
243
|
+
const typeMap = schema.getTypeMap();
|
|
244
|
+
let typeNames = Object.keys(typeMap);
|
|
245
|
+
if (withinType) {
|
|
246
|
+
typeNames = typeNames.filter((n) => n !== withinType.name);
|
|
247
|
+
typeNames.unshift(withinType.name);
|
|
248
|
+
}
|
|
249
|
+
for (const typeName of typeNames) {
|
|
250
|
+
if (matches.within.length + matches.types.length + matches.fields.length >= 100) {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
const type = typeMap[typeName];
|
|
254
|
+
if (withinType !== type && isMatch(typeName, searchValue)) {
|
|
255
|
+
matches.types.push({
|
|
256
|
+
type
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (!isObjectType(type) && !isInterfaceType(type) && !isInputObjectType(type)) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const fields = type.getFields();
|
|
263
|
+
for (const fieldName in fields) {
|
|
264
|
+
const field = fields[fieldName];
|
|
265
|
+
let matchingArgs;
|
|
266
|
+
if (!isMatch(fieldName, searchValue)) {
|
|
267
|
+
if ("args" in field) {
|
|
268
|
+
matchingArgs = field.args.filter((arg) => isMatch(arg.name, searchValue));
|
|
269
|
+
if (matchingArgs.length === 0) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
matches[withinType === type ? "within" : "fields"].push(...matchingArgs ? matchingArgs.map((argument) => ({
|
|
277
|
+
type,
|
|
278
|
+
field,
|
|
279
|
+
argument
|
|
280
|
+
})) : [{
|
|
281
|
+
type,
|
|
282
|
+
field
|
|
283
|
+
}]);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return matches;
|
|
287
|
+
};
|
|
288
|
+
$[6] = navItem;
|
|
289
|
+
$[7] = schema;
|
|
290
|
+
$[8] = t5;
|
|
291
|
+
} else {
|
|
292
|
+
t5 = $[8];
|
|
293
|
+
}
|
|
294
|
+
return t5;
|
|
295
|
+
}
|
|
296
|
+
function isMatch(sourceText, searchValue) {
|
|
297
|
+
try {
|
|
298
|
+
const escaped = searchValue.replaceAll(/[^_0-9A-Za-z]/g, (ch) => "\\" + ch);
|
|
299
|
+
return new RegExp(escaped, "i").test(sourceText);
|
|
300
|
+
} catch {
|
|
301
|
+
return sourceText.toLowerCase().includes(searchValue.toLowerCase());
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function Type(props) {
|
|
305
|
+
const $ = c(2);
|
|
306
|
+
let t0;
|
|
307
|
+
if ($[0] !== props.type.name) {
|
|
308
|
+
t0 = /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-search-type", children: props.type.name });
|
|
309
|
+
$[0] = props.type.name;
|
|
310
|
+
$[1] = t0;
|
|
311
|
+
} else {
|
|
312
|
+
t0 = $[1];
|
|
313
|
+
}
|
|
314
|
+
return t0;
|
|
315
|
+
}
|
|
316
|
+
function Field(t0) {
|
|
317
|
+
const $ = c(7);
|
|
318
|
+
const {
|
|
319
|
+
field,
|
|
320
|
+
argument
|
|
321
|
+
} = t0;
|
|
322
|
+
let t1;
|
|
323
|
+
if ($[0] !== field.name) {
|
|
324
|
+
t1 = /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-search-field", children: field.name });
|
|
325
|
+
$[0] = field.name;
|
|
326
|
+
$[1] = t1;
|
|
327
|
+
} else {
|
|
328
|
+
t1 = $[1];
|
|
329
|
+
}
|
|
330
|
+
let t2;
|
|
331
|
+
if ($[2] !== argument) {
|
|
332
|
+
t2 = argument ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
333
|
+
"(",
|
|
334
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-search-argument", children: argument.name }),
|
|
335
|
+
":",
|
|
336
|
+
" ",
|
|
337
|
+
renderType(argument.type, _temp4),
|
|
338
|
+
")"
|
|
339
|
+
] }) : null;
|
|
340
|
+
$[2] = argument;
|
|
341
|
+
$[3] = t2;
|
|
342
|
+
} else {
|
|
343
|
+
t2 = $[3];
|
|
344
|
+
}
|
|
345
|
+
let t3;
|
|
346
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
347
|
+
t3 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
348
|
+
t1,
|
|
349
|
+
t2
|
|
350
|
+
] });
|
|
351
|
+
$[4] = t1;
|
|
352
|
+
$[5] = t2;
|
|
353
|
+
$[6] = t3;
|
|
354
|
+
} else {
|
|
355
|
+
t3 = $[6];
|
|
356
|
+
}
|
|
357
|
+
return t3;
|
|
358
|
+
}
|
|
359
|
+
function _temp4(namedType) {
|
|
360
|
+
return /* @__PURE__ */ jsx(Type, { type: namedType });
|
|
361
|
+
}
|
|
362
|
+
function _temp(result, i) {
|
|
363
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: result, "data-cy": "doc-explorer-option", children: /* @__PURE__ */ jsx(Field, { field: result.field, argument: result.argument }) }, `within-${i}`);
|
|
364
|
+
}
|
|
365
|
+
function _temp2(result_0, i_0) {
|
|
366
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: result_0, "data-cy": "doc-explorer-option", children: /* @__PURE__ */ jsx(Type, { type: result_0.type }) }, `type-${i_0}`);
|
|
367
|
+
}
|
|
368
|
+
function _temp3(result_1, i_1) {
|
|
369
|
+
return /* @__PURE__ */ jsxs(ComboboxOption, { value: result_1, "data-cy": "doc-explorer-option", children: [
|
|
370
|
+
/* @__PURE__ */ jsx(Type, { type: result_1.type }),
|
|
371
|
+
".",
|
|
372
|
+
/* @__PURE__ */ jsx(Field, { field: result_1.field, argument: result_1.argument })
|
|
373
|
+
] }, `field-${i_1}`);
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
Search,
|
|
377
|
+
useSearchResults
|
|
378
|
+
};
|
|
379
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sources":["../../src/components/search.tsx"],"sourcesContent":["import {\n GraphQLArgument,\n GraphQLField,\n GraphQLInputField,\n GraphQLNamedType,\n isInputObjectType,\n isInterfaceType,\n isObjectType,\n} from 'graphql';\nimport { FC, useEffect, useRef, useState } from 'react';\nimport {\n Combobox,\n ComboboxInput,\n ComboboxOptions,\n ComboboxOption,\n} from '@headlessui/react';\nimport {\n isMacOs,\n useSchemaContext,\n MagnifyingGlassIcon,\n debounce,\n} from '@graphiql/react';\n\nimport { useExplorerContext } from '../context';\n\nimport './search.css';\nimport { renderType } from './utils';\n\nexport const Search: FC = () => {\n const { explorerNavStack, push } = useExplorerContext({\n nonNull: true,\n caller: Search,\n });\n\n const inputRef = useRef<HTMLInputElement>(null!);\n const getSearchResults = useSearchResults();\n const [searchValue, setSearchValue] = useState('');\n const [results, setResults] = useState(() => getSearchResults(searchValue));\n const debouncedGetSearchResults = debounce(200, (search: string) => {\n setResults(getSearchResults(search));\n });\n // Workaround to fix React compiler error:\n // Ref values (the `current` property) may not be accessed during render.\n const [ref] = useState(inputRef);\n const isFocused = ref.current === document.activeElement;\n\n useEffect(() => {\n debouncedGetSearchResults(searchValue);\n }, [debouncedGetSearchResults, searchValue]);\n\n useEffect(() => {\n function handleKeyDown(event: KeyboardEvent) {\n if (event.metaKey && event.key === 'k') {\n inputRef.current.focus();\n }\n }\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, []);\n\n const navItem = explorerNavStack.at(-1)!;\n\n const onSelect = (def: TypeMatch | FieldMatch) => {\n push(\n 'field' in def\n ? { name: def.field.name, def: def.field }\n : { name: def.type.name, def: def.type },\n );\n };\n const shouldSearchBoxAppear =\n explorerNavStack.length === 1 ||\n isObjectType(navItem.def) ||\n isInterfaceType(navItem.def) ||\n isInputObjectType(navItem.def);\n if (!shouldSearchBoxAppear) {\n return null;\n }\n\n return (\n <Combobox\n as=\"div\"\n className=\"graphiql-doc-explorer-search\"\n onChange={onSelect}\n data-state={isFocused ? undefined : 'idle'}\n aria-label={`Search ${navItem.name}...`}\n >\n <div\n className=\"graphiql-doc-explorer-search-input\"\n onClick={() => {\n inputRef.current.focus();\n }}\n >\n <MagnifyingGlassIcon />\n <ComboboxInput\n autoComplete=\"off\"\n onChange={event => setSearchValue(event.target.value)}\n placeholder={`${isMacOs ? '⌘' : 'Ctrl'} K`}\n ref={inputRef}\n value={searchValue}\n data-cy=\"doc-explorer-input\"\n />\n </div>\n {isFocused && (\n <ComboboxOptions data-cy=\"doc-explorer-list\">\n {results.within.length +\n results.types.length +\n results.fields.length ===\n 0 ? (\n <li className=\"graphiql-doc-explorer-search-empty\">\n No results found\n </li>\n ) : (\n results.within.map((result, i) => (\n <ComboboxOption\n key={`within-${i}`}\n value={result}\n data-cy=\"doc-explorer-option\"\n >\n <Field field={result.field} argument={result.argument} />\n </ComboboxOption>\n ))\n )}\n {results.within.length > 0 &&\n results.types.length + results.fields.length > 0 ? (\n <div className=\"graphiql-doc-explorer-search-divider\">\n Other results\n </div>\n ) : null}\n {results.types.map((result, i) => (\n <ComboboxOption\n key={`type-${i}`}\n value={result}\n data-cy=\"doc-explorer-option\"\n >\n <Type type={result.type} />\n </ComboboxOption>\n ))}\n {results.fields.map((result, i) => (\n <ComboboxOption\n key={`field-${i}`}\n value={result}\n data-cy=\"doc-explorer-option\"\n >\n <Type type={result.type} />.\n <Field field={result.field} argument={result.argument} />\n </ComboboxOption>\n ))}\n </ComboboxOptions>\n )}\n </Combobox>\n );\n};\n\ntype TypeMatch = { type: GraphQLNamedType };\n\ntype FieldMatch = {\n type: GraphQLNamedType;\n field: GraphQLField<unknown, unknown> | GraphQLInputField;\n argument?: GraphQLArgument;\n};\n\n// To make react-compiler happy, otherwise complains about - Hooks may not be referenced as normal values\nconst _useSearchResults = useSearchResults;\n\nexport function useSearchResults(caller?: Function) {\n const { explorerNavStack } = useExplorerContext({\n nonNull: true,\n caller: caller || _useSearchResults,\n });\n const { schema } = useSchemaContext({\n nonNull: true,\n caller: caller || _useSearchResults,\n });\n\n const navItem = explorerNavStack.at(-1)!;\n\n return (searchValue: string) => {\n const matches: {\n within: FieldMatch[];\n types: TypeMatch[];\n fields: FieldMatch[];\n } = {\n within: [],\n types: [],\n fields: [],\n };\n\n if (!schema) {\n return matches;\n }\n\n const withinType = navItem.def;\n\n const typeMap = schema.getTypeMap();\n let typeNames = Object.keys(typeMap);\n\n // Move the within type name to be the first searched.\n if (withinType) {\n typeNames = typeNames.filter(n => n !== withinType.name);\n typeNames.unshift(withinType.name);\n }\n for (const typeName of typeNames) {\n if (\n matches.within.length + matches.types.length + matches.fields.length >=\n 100\n ) {\n break;\n }\n\n const type = typeMap[typeName];\n if (withinType !== type && isMatch(typeName, searchValue)) {\n matches.types.push({ type });\n }\n\n if (\n !isObjectType(type) &&\n !isInterfaceType(type) &&\n !isInputObjectType(type)\n ) {\n continue;\n }\n\n const fields = type.getFields();\n for (const fieldName in fields) {\n const field = fields[fieldName];\n let matchingArgs: GraphQLArgument[] | undefined;\n\n if (!isMatch(fieldName, searchValue)) {\n if ('args' in field) {\n matchingArgs = field.args.filter(arg =>\n isMatch(arg.name, searchValue),\n );\n if (matchingArgs.length === 0) {\n continue;\n }\n } else {\n continue;\n }\n }\n\n matches[withinType === type ? 'within' : 'fields'].push(\n ...(matchingArgs\n ? matchingArgs.map(argument => ({ type, field, argument }))\n : [{ type, field }]),\n );\n }\n }\n\n return matches;\n };\n}\n\nfunction isMatch(sourceText: string, searchValue: string): boolean {\n try {\n const escaped = searchValue.replaceAll(/[^_0-9A-Za-z]/g, ch => '\\\\' + ch);\n return new RegExp(escaped, 'i').test(sourceText);\n } catch {\n return sourceText.toLowerCase().includes(searchValue.toLowerCase());\n }\n}\n\ntype TypeProps = { type: GraphQLNamedType };\n\nfunction Type(props: TypeProps) {\n return (\n <span className=\"graphiql-doc-explorer-search-type\">{props.type.name}</span>\n );\n}\n\ntype FieldProps = {\n field: GraphQLField<unknown, unknown> | GraphQLInputField;\n argument?: GraphQLArgument;\n};\n\nfunction Field({ field, argument }: FieldProps) {\n return (\n <>\n <span className=\"graphiql-doc-explorer-search-field\">{field.name}</span>\n {argument ? (\n <>\n (\n <span className=\"graphiql-doc-explorer-search-argument\">\n {argument.name}\n </span>\n :{' '}\n {renderType(argument.type, namedType => (\n <Type type={namedType} />\n ))}\n )\n </>\n ) : null}\n </>\n );\n}\n"],"names":["Search","$","_c","t0","Symbol","for","nonNull","caller","explorerNavStack","push","useExplorerContext","inputRef","useRef","getSearchResults","useSearchResults","searchValue","setSearchValue","useState","t1","results","setResults","t2","debounce","search","debouncedGetSearchResults","ref","isFocused","current","document","activeElement","t3","t4","useEffect","t5","t6","handleKeyDown","event","metaKey","key","focus","addEventListener","window","removeEventListener","navItem","onSelect","t7","at","t8","def","name","field","type","length","isObjectType","isInterfaceType","isInputObjectType","shouldSearchBoxAppear","undefined","t9","t10","t11","t12","event_0","target","value","t13","isMacOs","t14","within","types","fields","map","_temp","_temp2","_temp3","t15","_useSearchResults","schema","useSchemaContext","matches","withinType","typeMap","getTypeMap","typeNames","Object","keys","filter","n","unshift","typeName","isMatch","getFields","fieldName","matchingArgs","args","arg","argument","sourceText","escaped","replaceAll","ch","RegExp","test","toLowerCase","includes","Type","props","Field","renderType","_temp4","namedType","result","i","result_0","i_0","result_1","i_1"],"mappings":";;;;;;;;;AA4BO,MAAMA,SAAaA,MAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAAC,MAAAA;AAAA,MAAAF,EAAA,CAAA,MAAAG,OAAAC,IAAA,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D,SAAM7D,OAAkB,UAAA6D,SAAMf,SAAS,CAAA;AAAA,gBALvCgB,GAAC,EAMjB;AAAiB;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type ExplorerSectionProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The title of the section, which will also determine the icon rendered next
|
|
6
|
+
* to the headline.
|
|
7
|
+
*/
|
|
8
|
+
title: 'Root Types' | 'Fields' | 'Deprecated Fields' | 'Type' | 'Arguments' | 'Deprecated Arguments' | 'Implements' | 'Implementations' | 'Possible Types' | 'Enum Values' | 'Deprecated Enum Values' | 'Directives' | 'All Schema Types';
|
|
9
|
+
};
|
|
10
|
+
export declare function ExplorerSection(props: ExplorerSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { TypeIcon, RootTypeIcon, ImplementsIcon, FieldIcon, EnumValueIcon, DirectiveIcon, DeprecatedFieldIcon, DeprecatedEnumValueIcon, DeprecatedArgumentIcon, ArgumentIcon } from "@graphiql/react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function ExplorerSection(props) {
|
|
6
|
+
const $ = c(10);
|
|
7
|
+
const Icon = TYPE_TO_ICON[props.title];
|
|
8
|
+
let t0;
|
|
9
|
+
if ($[0] !== Icon) {
|
|
10
|
+
t0 = /* @__PURE__ */ jsx(Icon, {});
|
|
11
|
+
$[0] = Icon;
|
|
12
|
+
$[1] = t0;
|
|
13
|
+
} else {
|
|
14
|
+
t0 = $[1];
|
|
15
|
+
}
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[2] !== props.title || $[3] !== t0) {
|
|
18
|
+
t1 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-section-title", children: [
|
|
19
|
+
t0,
|
|
20
|
+
props.title
|
|
21
|
+
] });
|
|
22
|
+
$[2] = props.title;
|
|
23
|
+
$[3] = t0;
|
|
24
|
+
$[4] = t1;
|
|
25
|
+
} else {
|
|
26
|
+
t1 = $[4];
|
|
27
|
+
}
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[5] !== props.children) {
|
|
30
|
+
t2 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-section-content", children: props.children });
|
|
31
|
+
$[5] = props.children;
|
|
32
|
+
$[6] = t2;
|
|
33
|
+
} else {
|
|
34
|
+
t2 = $[6];
|
|
35
|
+
}
|
|
36
|
+
let t3;
|
|
37
|
+
if ($[7] !== t1 || $[8] !== t2) {
|
|
38
|
+
t3 = /* @__PURE__ */ jsxs("div", { children: [
|
|
39
|
+
t1,
|
|
40
|
+
t2
|
|
41
|
+
] });
|
|
42
|
+
$[7] = t1;
|
|
43
|
+
$[8] = t2;
|
|
44
|
+
$[9] = t3;
|
|
45
|
+
} else {
|
|
46
|
+
t3 = $[9];
|
|
47
|
+
}
|
|
48
|
+
return t3;
|
|
49
|
+
}
|
|
50
|
+
const TYPE_TO_ICON = {
|
|
51
|
+
Arguments: ArgumentIcon,
|
|
52
|
+
"Deprecated Arguments": DeprecatedArgumentIcon,
|
|
53
|
+
"Deprecated Enum Values": DeprecatedEnumValueIcon,
|
|
54
|
+
"Deprecated Fields": DeprecatedFieldIcon,
|
|
55
|
+
Directives: DirectiveIcon,
|
|
56
|
+
"Enum Values": EnumValueIcon,
|
|
57
|
+
Fields: FieldIcon,
|
|
58
|
+
Implements: ImplementsIcon,
|
|
59
|
+
Implementations: TypeIcon,
|
|
60
|
+
"Possible Types": TypeIcon,
|
|
61
|
+
"Root Types": RootTypeIcon,
|
|
62
|
+
Type: TypeIcon,
|
|
63
|
+
"All Schema Types": TypeIcon
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
ExplorerSection
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section.js","sources":["../../src/components/section.tsx"],"sourcesContent":["import { ComponentType, ReactNode } from 'react';\n\nimport {\n ArgumentIcon,\n DeprecatedArgumentIcon,\n DeprecatedEnumValueIcon,\n DeprecatedFieldIcon,\n DirectiveIcon,\n EnumValueIcon,\n FieldIcon,\n ImplementsIcon,\n RootTypeIcon,\n TypeIcon,\n} from '@graphiql/react';\n\nimport './section.css';\n\ntype ExplorerSectionProps = {\n children: ReactNode;\n /**\n * The title of the section, which will also determine the icon rendered next\n * to the headline.\n */\n title:\n | 'Root Types'\n | 'Fields'\n | 'Deprecated Fields'\n | 'Type'\n | 'Arguments'\n | 'Deprecated Arguments'\n | 'Implements'\n | 'Implementations'\n | 'Possible Types'\n | 'Enum Values'\n | 'Deprecated Enum Values'\n | 'Directives'\n | 'All Schema Types';\n};\n\nexport function ExplorerSection(props: ExplorerSectionProps) {\n const Icon = TYPE_TO_ICON[props.title];\n return (\n <div>\n <div className=\"graphiql-doc-explorer-section-title\">\n <Icon />\n {props.title}\n </div>\n <div className=\"graphiql-doc-explorer-section-content\">\n {props.children}\n </div>\n </div>\n );\n}\n\nconst TYPE_TO_ICON: Record<ExplorerSectionProps['title'], ComponentType> = {\n Arguments: ArgumentIcon,\n 'Deprecated Arguments': DeprecatedArgumentIcon,\n 'Deprecated Enum Values': DeprecatedEnumValueIcon,\n 'Deprecated Fields': DeprecatedFieldIcon,\n Directives: DirectiveIcon,\n 'Enum Values': EnumValueIcon,\n Fields: FieldIcon,\n Implements: ImplementsIcon,\n Implementations: TypeIcon,\n 'Possible Types': TypeIcon,\n 'Root Types': RootTypeIcon,\n Type: TypeIcon,\n 'All Schema Types': TypeIcon,\n};\n"],"names":["ExplorerSection","props","$","_c","Icon","TYPE_TO_ICON","title","t0","t1","t2","children","t3","Arguments","ArgumentIcon","DeprecatedArgumentIcon","DeprecatedEnumValueIcon","DeprecatedFieldIcon","Directives","DirectiveIcon","EnumValueIcon","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C;AAAAA,EACrBC,YAAYC;AAAAA,EACZ,eAAeC;AAAAA,EACfC,QAAQC;AAAAA,EACRC,YAAYC;AAAAA,EACZC,iBAAiBC;AAAAA,EACjB,kBAAkBA;AAAAA,EAClB,cAAcC;AAAAA,EACdC,MAAMF;AAAAA,EACN,oBAAoBA;AACtB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphQLNamedType } from 'graphql';
|
|
2
|
+
declare type TypeDocumentationProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The type that should be rendered.
|
|
5
|
+
*/
|
|
6
|
+
type: GraphQLNamedType;
|
|
7
|
+
};
|
|
8
|
+
export declare function TypeDocumentation(props: TypeDocumentationProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|