@graphiql/plugin-doc-explorer 0.4.3 → 1.0.0-beta.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/arguments-list.d.ts +12 -0
- package/dist/components/arguments-list.js +248 -0
- package/dist/components/arguments-list.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb.js +54 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/doc-explorer.js +172 -123
- package/dist/components/doc-explorer.js.map +1 -1
- package/dist/components/field-card.d.ts +7 -0
- package/dist/components/field-card.js +102 -0
- package/dist/components/field-card.js.map +1 -0
- package/dist/components/field-documentation.js +76 -110
- package/dist/components/field-documentation.js.map +1 -1
- package/dist/components/fields-list.d.ts +8 -0
- package/dist/components/fields-list.js +235 -0
- package/dist/components/fields-list.js.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/schema-documentation.js +170 -98
- package/dist/components/schema-documentation.js.map +1 -1
- package/dist/components/search-row.d.ts +2 -0
- package/dist/components/search-row.js +282 -0
- package/dist/components/search-row.js.map +1 -0
- package/dist/components/search.js +76 -52
- package/dist/components/search.js.map +1 -1
- package/dist/components/section.js +1 -1
- package/dist/components/section.js.map +1 -1
- package/dist/components/type-card.d.ts +7 -0
- package/dist/components/type-card.js +112 -0
- package/dist/components/type-card.js.map +1 -0
- package/dist/components/type-documentation.d.ts +6 -0
- package/dist/components/type-documentation.js +11 -9
- package/dist/components/type-documentation.js.map +1 -1
- package/dist/components/type-link.js +2 -1
- package/dist/components/type-link.js.map +1 -1
- package/dist/context.js +60 -40
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/stories/doc-explorer.stories.d.ts +12 -0
- package/dist/style.css +691 -131
- package/package.json +9 -3
- package/dist/deprecated.d.ts +0 -11
- package/dist/deprecated.js +0 -24
- package/dist/deprecated.js.map +0 -1
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { isObjectType, isInterfaceType, isInputObjectType, isEnumType, isScalarType, isUnionType } from "graphql";
|
|
4
|
+
import { MethodPill } from "@graphiql/react";
|
|
5
|
+
import { useDocExplorerActions } from "../context.js";
|
|
6
6
|
/* empty css */
|
|
7
|
+
function getTypeKindLabel(type) {
|
|
8
|
+
if (isObjectType(type)) {
|
|
9
|
+
return "TYPE";
|
|
10
|
+
}
|
|
11
|
+
if (isInterfaceType(type)) {
|
|
12
|
+
return "INTERFACE";
|
|
13
|
+
}
|
|
14
|
+
if (isInputObjectType(type)) {
|
|
15
|
+
return "INPUT";
|
|
16
|
+
}
|
|
17
|
+
if (isEnumType(type)) {
|
|
18
|
+
return "ENUM";
|
|
19
|
+
}
|
|
20
|
+
if (isScalarType(type)) {
|
|
21
|
+
return "SCALAR";
|
|
22
|
+
}
|
|
23
|
+
if (isUnionType(type)) {
|
|
24
|
+
return "UNION";
|
|
25
|
+
}
|
|
26
|
+
return "TYPE";
|
|
27
|
+
}
|
|
7
28
|
const SchemaDocumentation = (t0) => {
|
|
8
|
-
const $ = c(
|
|
29
|
+
const $ = c(47);
|
|
9
30
|
const {
|
|
10
31
|
schema
|
|
11
32
|
} = t0;
|
|
33
|
+
const {
|
|
34
|
+
push
|
|
35
|
+
} = useDocExplorerActions();
|
|
12
36
|
let t1;
|
|
13
37
|
if ($[0] !== schema) {
|
|
14
38
|
t1 = schema.getQueryType();
|
|
@@ -36,120 +60,168 @@ const SchemaDocumentation = (t0) => {
|
|
|
36
60
|
t3 = $[5];
|
|
37
61
|
}
|
|
38
62
|
const subscriptionType = t3;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
let t6;
|
|
63
|
+
const t4 = queryType == null ? void 0 : queryType.name;
|
|
64
|
+
const t5 = mutationType == null ? void 0 : mutationType.name;
|
|
65
|
+
const t6 = subscriptionType == null ? void 0 : subscriptionType.name;
|
|
43
66
|
let t7;
|
|
44
|
-
if ($[6] !==
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
if ($[6] !== t4 || $[7] !== t5 || $[8] !== t6) {
|
|
68
|
+
t7 = new Set([t4, t5, t6].filter(Boolean));
|
|
69
|
+
$[6] = t4;
|
|
70
|
+
$[7] = t5;
|
|
71
|
+
$[8] = t6;
|
|
72
|
+
$[9] = t7;
|
|
73
|
+
} else {
|
|
74
|
+
t7 = $[9];
|
|
75
|
+
}
|
|
76
|
+
const rootTypeNames = t7;
|
|
77
|
+
let t10;
|
|
78
|
+
let t11;
|
|
79
|
+
let t12;
|
|
80
|
+
let t13;
|
|
81
|
+
let t8;
|
|
82
|
+
let t9;
|
|
83
|
+
if ($[10] !== mutationType || $[11] !== push || $[12] !== queryType || $[13] !== rootTypeNames || $[14] !== schema || $[15] !== subscriptionType) {
|
|
84
|
+
const allTypes = Object.values(schema.getTypeMap()).filter((type) => !type.name.startsWith("__") && !rootTypeNames.has(type.name));
|
|
85
|
+
t10 = "graphiql-doc-explorer-schema-overview";
|
|
86
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
87
|
+
t11 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-schema-section-header", children: "ROOT TYPES" });
|
|
88
|
+
$[22] = t11;
|
|
52
89
|
} else {
|
|
53
|
-
|
|
90
|
+
t11 = $[22];
|
|
54
91
|
}
|
|
55
|
-
let
|
|
56
|
-
if ($[
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
92
|
+
let t142;
|
|
93
|
+
if ($[23] !== push || $[24] !== queryType) {
|
|
94
|
+
t142 = queryType && /* @__PURE__ */ jsxs("button", { type: "button", className: "graphiql-doc-explorer-schema-root-row", onClick: () => push({
|
|
95
|
+
name: queryType.name,
|
|
96
|
+
def: queryType
|
|
97
|
+
}), children: [
|
|
98
|
+
/* @__PURE__ */ jsx(MethodPill, { operation: "query", "aria-hidden": true }),
|
|
99
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-root-label", children: "Query" }),
|
|
100
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-root-colon", children: ":" }),
|
|
101
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-type-name", children: queryType.name })
|
|
102
|
+
] });
|
|
103
|
+
$[23] = push;
|
|
104
|
+
$[24] = queryType;
|
|
105
|
+
$[25] = t142;
|
|
64
106
|
} else {
|
|
65
|
-
|
|
107
|
+
t142 = $[25];
|
|
66
108
|
}
|
|
67
|
-
let
|
|
68
|
-
if ($[
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
109
|
+
let t152;
|
|
110
|
+
if ($[26] !== mutationType || $[27] !== push) {
|
|
111
|
+
t152 = mutationType && /* @__PURE__ */ jsxs("button", { type: "button", className: "graphiql-doc-explorer-schema-root-row", onClick: () => push({
|
|
112
|
+
name: mutationType.name,
|
|
113
|
+
def: mutationType
|
|
114
|
+
}), children: [
|
|
115
|
+
/* @__PURE__ */ jsx(MethodPill, { operation: "mutation", "aria-hidden": true }),
|
|
116
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-root-label", children: "Mutation" }),
|
|
117
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-root-colon", children: ":" }),
|
|
118
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-type-name", children: mutationType.name })
|
|
73
119
|
] });
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
120
|
+
$[26] = mutationType;
|
|
121
|
+
$[27] = push;
|
|
122
|
+
$[28] = t152;
|
|
76
123
|
} else {
|
|
77
|
-
|
|
124
|
+
t152 = $[28];
|
|
78
125
|
}
|
|
79
|
-
let
|
|
80
|
-
if ($[
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
126
|
+
let t16;
|
|
127
|
+
if ($[29] !== push || $[30] !== subscriptionType) {
|
|
128
|
+
t16 = subscriptionType && /* @__PURE__ */ jsxs("button", { type: "button", className: "graphiql-doc-explorer-schema-root-row", onClick: () => push({
|
|
129
|
+
name: subscriptionType.name,
|
|
130
|
+
def: subscriptionType
|
|
131
|
+
}), children: [
|
|
132
|
+
/* @__PURE__ */ jsx(MethodPill, { operation: "subscription", "aria-hidden": true }),
|
|
133
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-root-label", children: "Subscription" }),
|
|
134
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-root-colon", children: ":" }),
|
|
135
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-type-name", children: subscriptionType.name })
|
|
85
136
|
] });
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
137
|
+
$[29] = push;
|
|
138
|
+
$[30] = subscriptionType;
|
|
139
|
+
$[31] = t16;
|
|
88
140
|
} else {
|
|
89
|
-
|
|
141
|
+
t16 = $[31];
|
|
90
142
|
}
|
|
91
|
-
if ($[
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
143
|
+
if ($[32] !== t142 || $[33] !== t152 || $[34] !== t16) {
|
|
144
|
+
t12 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-schema-root-types", children: [
|
|
145
|
+
t142,
|
|
146
|
+
t152,
|
|
147
|
+
t16
|
|
96
148
|
] });
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
149
|
+
$[32] = t142;
|
|
150
|
+
$[33] = t152;
|
|
151
|
+
$[34] = t16;
|
|
152
|
+
$[35] = t12;
|
|
101
153
|
} else {
|
|
102
|
-
|
|
154
|
+
t12 = $[35];
|
|
103
155
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
156
|
+
if ($[36] !== allTypes) {
|
|
157
|
+
t13 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-schema-section-header graphiql-doc-explorer-schema-section-header--types", children: [
|
|
158
|
+
"ALL SCHEMA TYPES",
|
|
159
|
+
/* @__PURE__ */ jsxs("span", { className: "graphiql-doc-explorer-schema-type-count", children: [
|
|
160
|
+
" ",
|
|
161
|
+
"· ",
|
|
162
|
+
allTypes.length
|
|
163
|
+
] })
|
|
164
|
+
] });
|
|
165
|
+
$[36] = allTypes;
|
|
166
|
+
$[37] = t13;
|
|
167
|
+
} else {
|
|
168
|
+
t13 = $[37];
|
|
169
|
+
}
|
|
170
|
+
t8 = "graphiql-doc-explorer-schema-all-types";
|
|
171
|
+
t9 = allTypes.map((type_0) => /* @__PURE__ */ jsxs("button", { type: "button", className: "graphiql-doc-explorer-schema-type-row", onClick: () => push({
|
|
172
|
+
name: type_0.name,
|
|
173
|
+
def: type_0
|
|
174
|
+
}), children: [
|
|
175
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-type-badge", children: getTypeKindLabel(type_0) }),
|
|
176
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-schema-type-name", children: type_0.name })
|
|
177
|
+
] }, type_0.name));
|
|
178
|
+
$[10] = mutationType;
|
|
179
|
+
$[11] = push;
|
|
180
|
+
$[12] = queryType;
|
|
181
|
+
$[13] = rootTypeNames;
|
|
182
|
+
$[14] = schema;
|
|
183
|
+
$[15] = subscriptionType;
|
|
184
|
+
$[16] = t10;
|
|
185
|
+
$[17] = t11;
|
|
186
|
+
$[18] = t12;
|
|
187
|
+
$[19] = t13;
|
|
188
|
+
$[20] = t8;
|
|
189
|
+
$[21] = t9;
|
|
121
190
|
} else {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
191
|
+
t10 = $[16];
|
|
192
|
+
t11 = $[17];
|
|
193
|
+
t12 = $[18];
|
|
194
|
+
t13 = $[19];
|
|
195
|
+
t8 = $[20];
|
|
196
|
+
t9 = $[21];
|
|
127
197
|
}
|
|
128
|
-
let
|
|
129
|
-
if ($[
|
|
130
|
-
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[30] = t8;
|
|
198
|
+
let t14;
|
|
199
|
+
if ($[38] !== t8 || $[39] !== t9) {
|
|
200
|
+
t14 = /* @__PURE__ */ jsx("div", { className: t8, children: t9 });
|
|
201
|
+
$[38] = t8;
|
|
202
|
+
$[39] = t9;
|
|
203
|
+
$[40] = t14;
|
|
135
204
|
} else {
|
|
136
|
-
|
|
205
|
+
t14 = $[40];
|
|
137
206
|
}
|
|
138
|
-
let
|
|
139
|
-
if ($[
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
207
|
+
let t15;
|
|
208
|
+
if ($[41] !== t10 || $[42] !== t11 || $[43] !== t12 || $[44] !== t13 || $[45] !== t14) {
|
|
209
|
+
t15 = /* @__PURE__ */ jsxs("div", { className: t10, children: [
|
|
210
|
+
t11,
|
|
211
|
+
t12,
|
|
212
|
+
t13,
|
|
213
|
+
t14
|
|
144
214
|
] });
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
215
|
+
$[41] = t10;
|
|
216
|
+
$[42] = t11;
|
|
217
|
+
$[43] = t12;
|
|
218
|
+
$[44] = t13;
|
|
219
|
+
$[45] = t14;
|
|
220
|
+
$[46] = t15;
|
|
149
221
|
} else {
|
|
150
|
-
|
|
222
|
+
t15 = $[46];
|
|
151
223
|
}
|
|
152
|
-
return
|
|
224
|
+
return t15;
|
|
153
225
|
};
|
|
154
226
|
export {
|
|
155
227
|
SchemaDocumentation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-documentation.js","sources":["../../src/components/schema-documentation.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { GraphQLSchema } from 'graphql';\nimport { MarkdownContent } from '@graphiql/react';\nimport { ExplorerSection } from './section';\nimport { TypeLink } from './type-link';\nimport './schema-documentation.css';\n\ntype SchemaDocumentationProps = {\n /**\n * The schema that should be rendered.\n */\n schema: GraphQLSchema;\n};\n\nexport const SchemaDocumentation: FC<SchemaDocumentationProps> = ({\n schema,\n}) => {\n const queryType = schema.getQueryType();\n const mutationType = schema.getMutationType();\n const subscriptionType = schema.getSubscriptionType();\n const typeMap = schema.getTypeMap();\n const ignoreTypesInAllSchema = [\n queryType?.name,\n mutationType?.name,\n subscriptionType?.name,\n ];\n\n return (\n <>\n <MarkdownContent type=\"description\">\n {schema.description ||\n 'A GraphQL schema provides a root type for each kind of operation.'}\n </MarkdownContent>\n <ExplorerSection title=\"Root Types\">\n {queryType ? (\n <div>\n <span className=\"graphiql-doc-explorer-root-type\">query</span>\n {': '}\n <TypeLink type={queryType} />\n </div>\n ) : null}\n {mutationType && (\n <div>\n <span className=\"graphiql-doc-explorer-root-type\">mutation</span>\n {': '}\n <TypeLink type={mutationType} />\n </div>\n )}\n {subscriptionType && (\n <div>\n <span className=\"graphiql-doc-explorer-root-type\">\n subscription\n </span>\n {': '}\n <TypeLink type={subscriptionType} />\n </div>\n )}\n </ExplorerSection>\n <ExplorerSection title=\"All Schema Types\">\n <div>\n {Object.values(typeMap).map(type => {\n if (\n ignoreTypesInAllSchema.includes(type.name) ||\n type.name.startsWith('__')\n ) {\n return null;\n }\n\n return (\n <div key={type.name}>\n <TypeLink type={type} />\n </div>\n );\n })}\n </div>\n </ExplorerSection>\n </>\n );\n};\n"],"names":["SchemaDocumentation","t0","$","_c","schema","t1","getQueryType","queryType","t2","getMutationType","mutationType","t3","getSubscriptionType","subscriptionType","T0","t4","t5","t6","t7","typeMap","getTypeMap","ignoreTypesInAllSchema","name","t8","description","t9","t10","t11","ExplorerSection","Object","values","map","type","includes","startsWith"],"mappings":";;;;;;AAcO,MAAMA,sBAAoDC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAEjEI,MAAAA;AAAAH,MAAAA,SAAAE,QAAA;AACmBC,SAAAD,OAAME,aAAc;AAACJ,WAAAE;AAAAF,WAAAG;AAAAA,EAAAA,OAAA;AAAAA,SAAAH,EAAA,CAAA;AAAA,EAAA;AAAvC,QAAAK,YAAkBF;AAAsBG,MAAAA;AAAAN,MAAAA,SAAAE,QAAA;AACnBI,SAAAJ,OAAMK,gBAAiB;AAACP,WAAAE;AAAAF,WAAAM;AAAAA,EAAAA,OAAA;AAAAA,SAAAN,EAAA,CAAA;AAAA,EAAA;AAA7C,QAAAQ,eAAqBF;AAAyBG,MAAAA;AAAAT,MAAAA,SAAAE,QAAA;AACrBO,SAAAP,OAAMQ,oBAAqB;AAACV,WAAAE;AAAAF,WAAAS;AAAAA,EAAAA,OAAA;AAAAA,SAAAT,EAAA,CAAA;AAAA,EAAA;AAArD,QAAAW,mBAAyBF;AAA6BG,MAAAA;AAAAC,MAAAA;AAAAC,MAAAA;AAAAC,MAAAA;AAAAC,MAAAA;AAAA,MAAAhB,EAAA,CAAA,MAAAQ,gBAAAR,EAAAK,CAAAA,MAAAA,aAAAL,EAAAE,CAAAA,MAAAA,UAAAF,SAAAW,kBAAA;AACtDM,UAAAA,UAAgBf,OAAMgB,WAAY;AAClC,UAAAC,yBAAA,CACEd,uCAASe,MACTZ,6CAAYY,MACZT,qDAAgBS,IAAA;AAMXC,UAAAA,MAAAnB,OAAMoB,eACL;AAAmEtB,QA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,MAAAqB,IAAA;AA/CpBE,SACET,qBAAAA,UAAAA,EAAAA,UAAAA;AAAAA,MAAAA;AAAAA,MAIAC;AAAAA,MAyBAM;AAAAA,IAAAA,GAiBkB;AACjBrB,YAAAc;AAAAd,YAAAe;AAAAf,YAAAqB;AAAArB,YAAAuB;AAAAA,EAAAA,OAAA;AAAAA,SAAAvB,EAAA,EAAA;AAAA,EAAA;AAhDHuB,SAAAA;AAgDG;"}
|
|
1
|
+
{"version":3,"file":"schema-documentation.js","sources":["../../src/components/schema-documentation.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { GraphQLNamedType, GraphQLSchema } from 'graphql';\nimport {\n isObjectType,\n isInterfaceType,\n isInputObjectType,\n isEnumType,\n isScalarType,\n isUnionType,\n} from 'graphql';\nimport { MethodPill } from '@graphiql/react';\nimport { useDocExplorerActions } from '../context';\nimport './schema-documentation.css';\n\ntype SchemaDocumentationProps = {\n /**\n * The schema that should be rendered.\n */\n schema: GraphQLSchema;\n};\n\nfunction getTypeKindLabel(type: GraphQLNamedType): string {\n if (isObjectType(type)) {\n return 'TYPE';\n }\n if (isInterfaceType(type)) {\n return 'INTERFACE';\n }\n if (isInputObjectType(type)) {\n return 'INPUT';\n }\n if (isEnumType(type)) {\n return 'ENUM';\n }\n if (isScalarType(type)) {\n return 'SCALAR';\n }\n if (isUnionType(type)) {\n return 'UNION';\n }\n return 'TYPE';\n}\n\nexport const SchemaDocumentation: FC<SchemaDocumentationProps> = ({\n schema,\n}) => {\n const { push } = useDocExplorerActions();\n const queryType = schema.getQueryType();\n const mutationType = schema.getMutationType();\n const subscriptionType = schema.getSubscriptionType();\n const rootTypeNames = new Set(\n [queryType?.name, mutationType?.name, subscriptionType?.name].filter(\n Boolean,\n ),\n );\n\n const allTypes = Object.values(schema.getTypeMap()).filter(\n type => !type.name.startsWith('__') && !rootTypeNames.has(type.name),\n );\n\n return (\n <div className=\"graphiql-doc-explorer-schema-overview\">\n {/* Root types section */}\n <div className=\"graphiql-doc-explorer-schema-section-header\">\n ROOT TYPES\n </div>\n <div className=\"graphiql-doc-explorer-schema-root-types\">\n {queryType && (\n <button\n type=\"button\"\n className=\"graphiql-doc-explorer-schema-root-row\"\n onClick={() => push({ name: queryType.name, def: queryType })}\n >\n <MethodPill operation=\"query\" aria-hidden />\n <span className=\"graphiql-doc-explorer-schema-root-label\">\n Query\n </span>\n <span className=\"graphiql-doc-explorer-schema-root-colon\">:</span>\n <span className=\"graphiql-doc-explorer-type-name\">\n {queryType.name}\n </span>\n </button>\n )}\n {mutationType && (\n <button\n type=\"button\"\n className=\"graphiql-doc-explorer-schema-root-row\"\n onClick={() => push({ name: mutationType.name, def: mutationType })}\n >\n <MethodPill operation=\"mutation\" aria-hidden />\n <span className=\"graphiql-doc-explorer-schema-root-label\">\n Mutation\n </span>\n <span className=\"graphiql-doc-explorer-schema-root-colon\">:</span>\n <span className=\"graphiql-doc-explorer-type-name\">\n {mutationType.name}\n </span>\n </button>\n )}\n {subscriptionType && (\n <button\n type=\"button\"\n className=\"graphiql-doc-explorer-schema-root-row\"\n onClick={() =>\n push({ name: subscriptionType.name, def: subscriptionType })\n }\n >\n <MethodPill operation=\"subscription\" aria-hidden />\n <span className=\"graphiql-doc-explorer-schema-root-label\">\n Subscription\n </span>\n <span className=\"graphiql-doc-explorer-schema-root-colon\">:</span>\n <span className=\"graphiql-doc-explorer-type-name\">\n {subscriptionType.name}\n </span>\n </button>\n )}\n </div>\n\n {/* All schema types section */}\n <div className=\"graphiql-doc-explorer-schema-section-header graphiql-doc-explorer-schema-section-header--types\">\n ALL SCHEMA TYPES\n <span className=\"graphiql-doc-explorer-schema-type-count\">\n {' '}\n · {allTypes.length}\n </span>\n </div>\n <div className=\"graphiql-doc-explorer-schema-all-types\">\n {allTypes.map(type => (\n <button\n key={type.name}\n type=\"button\"\n className=\"graphiql-doc-explorer-schema-type-row\"\n onClick={() => push({ name: type.name, def: type })}\n >\n <span className=\"graphiql-doc-explorer-type-badge\">\n {getTypeKindLabel(type)}\n </span>\n <span className=\"graphiql-doc-explorer-schema-type-name\">\n {type.name}\n </span>\n </button>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["getTypeKindLabel","type","isObjectType","isInterfaceType","isInputObjectType","isEnumType","isScalarType","isUnionType","SchemaDocumentation","t0","$","_c","schema","push","useDocExplorerActions","t1","getQueryType","queryType","t2","getMutationType","mutationType","t3","getSubscriptionType","subscriptionType","t4","name","t5","t6","t7","Set","filter","Boolean","rootTypeNames","t10","t11","t12","t13","t8","t9","allTypes","Object","values","getTypeMap","startsWith","has","Symbol","for","t14","def","t15","t16","length","map","type_0"],"mappings":";;;;;;AAqBA,SAASA,iBAAiBC,MAAgC;AACpDC,MAAAA,aAAaD,IAAI,GAAG;AACf,WAAA;AAAA,EAAA;AAELE,MAAAA,gBAAgBF,IAAI,GAAG;AAClB,WAAA;AAAA,EAAA;AAELG,MAAAA,kBAAkBH,IAAI,GAAG;AACpB,WAAA;AAAA,EAAA;AAELI,MAAAA,WAAWJ,IAAI,GAAG;AACb,WAAA;AAAA,EAAA;AAELK,MAAAA,aAAaL,IAAI,GAAG;AACf,WAAA;AAAA,EAAA;AAELM,MAAAA,YAAYN,IAAI,GAAG;AACd,WAAA;AAAA,EAAA;AAEF,SAAA;AACT;AAEO,MAAMO,sBAAoDC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,EAAAA,IAAAH;AAGhE,QAAA;AAAA,IAAAI;AAAAA,MAAiBC,sBAAsB;AAAEC,MAAAA;AAAAL,MAAAA,SAAAE,QAAA;AACvBG,SAAAH,OAAMI,aAAc;AAACN,WAAAE;AAAAF,WAAAK;AAAAA,EAAAA,OAAA;AAAAA,SAAAL,EAAA,CAAA;AAAA,EAAA;AAAvC,QAAAO,YAAkBF;AAAsBG,MAAAA;AAAAR,MAAAA,SAAAE,QAAA;AACnBM,SAAAN,OAAMO,gBAAiB;AAACT,WAAAE;AAAAF,WAAAQ;AA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Ae,EAAA,WAAAd,KAEbC,UAAAA;AAAAA,MAAAA;AAAAA,MAGAC;AAAAA,MAsDAC;AAAAA,MAOAW;AAAAA,IAAAA,GAiBF;AAAMrC,YAAAuB;AAAAvB,YAAAwB;AAAAxB,YAAAyB;AAAAzB,YAAA0B;AAAA1B,YAAAqC;AAAArC,YAAAuC;AAAAA,EAAAA,OAAA;AAAAA,UAAAvC,EAAA,EAAA;AAAA,EAAA;AAnFNuC,SAAAA;AAmFM;"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { useRef, useState, useEffect } from "react";
|
|
4
|
+
import { isObjectType, isInterfaceType, isInputObjectType } from "graphql";
|
|
5
|
+
import { ComboboxOptions, ComboboxOption, ComboboxInput, Combobox } from "@headlessui/react";
|
|
6
|
+
import { debounce, formatShortcutForOS, KEY_MAP, typeCategory, MagnifyingGlassIcon, KeycapHint } from "@graphiql/react";
|
|
7
|
+
import { useDocExplorer, useDocExplorerActions } from "../context.js";
|
|
8
|
+
import { useSearchResults } from "./search.js";
|
|
9
|
+
import { renderType } from "./utils.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
const SearchRow = () => {
|
|
12
|
+
const $ = c(39);
|
|
13
|
+
const explorerNavStack = useDocExplorer();
|
|
14
|
+
const {
|
|
15
|
+
push
|
|
16
|
+
} = useDocExplorerActions();
|
|
17
|
+
const inputRef = useRef(null);
|
|
18
|
+
const getSearchResults = useSearchResults();
|
|
19
|
+
const [searchValue, setSearchValue] = useState("");
|
|
20
|
+
let t0;
|
|
21
|
+
if ($[0] !== getSearchResults || $[1] !== searchValue) {
|
|
22
|
+
t0 = () => getSearchResults(searchValue);
|
|
23
|
+
$[0] = getSearchResults;
|
|
24
|
+
$[1] = searchValue;
|
|
25
|
+
$[2] = t0;
|
|
26
|
+
} else {
|
|
27
|
+
t0 = $[2];
|
|
28
|
+
}
|
|
29
|
+
const [results, setResults] = useState(t0);
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[3] !== getSearchResults) {
|
|
32
|
+
t1 = debounce(200, (search) => {
|
|
33
|
+
setResults(getSearchResults(search));
|
|
34
|
+
});
|
|
35
|
+
$[3] = getSearchResults;
|
|
36
|
+
$[4] = t1;
|
|
37
|
+
} else {
|
|
38
|
+
t1 = $[4];
|
|
39
|
+
}
|
|
40
|
+
const debouncedGetSearchResults = t1;
|
|
41
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
42
|
+
let t2;
|
|
43
|
+
let t3;
|
|
44
|
+
if ($[5] !== debouncedGetSearchResults || $[6] !== searchValue) {
|
|
45
|
+
t2 = () => {
|
|
46
|
+
debouncedGetSearchResults(searchValue);
|
|
47
|
+
};
|
|
48
|
+
t3 = [debouncedGetSearchResults, searchValue];
|
|
49
|
+
$[5] = debouncedGetSearchResults;
|
|
50
|
+
$[6] = searchValue;
|
|
51
|
+
$[7] = t2;
|
|
52
|
+
$[8] = t3;
|
|
53
|
+
} else {
|
|
54
|
+
t2 = $[7];
|
|
55
|
+
t3 = $[8];
|
|
56
|
+
}
|
|
57
|
+
useEffect(t2, t3);
|
|
58
|
+
let navItem;
|
|
59
|
+
let onSelect;
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[9] !== explorerNavStack || $[10] !== push) {
|
|
62
|
+
navItem = explorerNavStack.at(-1);
|
|
63
|
+
let t52;
|
|
64
|
+
if ($[14] !== push) {
|
|
65
|
+
t52 = (def) => {
|
|
66
|
+
if (!def) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
push("field" in def ? {
|
|
70
|
+
name: def.field.name,
|
|
71
|
+
def: def.field
|
|
72
|
+
} : {
|
|
73
|
+
name: def.type.name,
|
|
74
|
+
def: def.type
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
$[14] = push;
|
|
78
|
+
$[15] = t52;
|
|
79
|
+
} else {
|
|
80
|
+
t52 = $[15];
|
|
81
|
+
}
|
|
82
|
+
onSelect = t52;
|
|
83
|
+
t4 = explorerNavStack.length === 1 || isObjectType(navItem.def) || isInterfaceType(navItem.def) || isInputObjectType(navItem.def);
|
|
84
|
+
$[9] = explorerNavStack;
|
|
85
|
+
$[10] = push;
|
|
86
|
+
$[11] = navItem;
|
|
87
|
+
$[12] = onSelect;
|
|
88
|
+
$[13] = t4;
|
|
89
|
+
} else {
|
|
90
|
+
navItem = $[11];
|
|
91
|
+
onSelect = $[12];
|
|
92
|
+
t4 = $[13];
|
|
93
|
+
}
|
|
94
|
+
const shouldShow = t4;
|
|
95
|
+
if (!shouldShow) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
let t5;
|
|
99
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
100
|
+
t5 = formatShortcutForOS(KEY_MAP.searchInDocs.key).split("-");
|
|
101
|
+
$[16] = t5;
|
|
102
|
+
} else {
|
|
103
|
+
t5 = $[16];
|
|
104
|
+
}
|
|
105
|
+
const shortcutKeys = t5;
|
|
106
|
+
const t6 = `Search ${navItem.name}...`;
|
|
107
|
+
let t7;
|
|
108
|
+
let t8;
|
|
109
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
110
|
+
t7 = () => {
|
|
111
|
+
inputRef.current.focus();
|
|
112
|
+
};
|
|
113
|
+
t8 = /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "aria-hidden": "true" });
|
|
114
|
+
$[17] = t7;
|
|
115
|
+
$[18] = t8;
|
|
116
|
+
} else {
|
|
117
|
+
t7 = $[17];
|
|
118
|
+
t8 = $[18];
|
|
119
|
+
}
|
|
120
|
+
let t10;
|
|
121
|
+
let t11;
|
|
122
|
+
let t9;
|
|
123
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
124
|
+
t9 = (event) => setSearchValue(event.target.value);
|
|
125
|
+
t10 = () => setIsFocused(true);
|
|
126
|
+
t11 = () => setIsFocused(false);
|
|
127
|
+
$[19] = t10;
|
|
128
|
+
$[20] = t11;
|
|
129
|
+
$[21] = t9;
|
|
130
|
+
} else {
|
|
131
|
+
t10 = $[19];
|
|
132
|
+
t11 = $[20];
|
|
133
|
+
t9 = $[21];
|
|
134
|
+
}
|
|
135
|
+
let t12;
|
|
136
|
+
if ($[22] !== searchValue) {
|
|
137
|
+
t12 = /* @__PURE__ */ jsx(ComboboxInput, { autoComplete: "off", onChange: t9, onFocus: t10, onBlur: t11, placeholder: "Search schema", ref: inputRef, value: searchValue, "data-cy": "doc-explorer-input" });
|
|
138
|
+
$[22] = searchValue;
|
|
139
|
+
$[23] = t12;
|
|
140
|
+
} else {
|
|
141
|
+
t12 = $[23];
|
|
142
|
+
}
|
|
143
|
+
let t13;
|
|
144
|
+
if ($[24] !== isFocused || $[25] !== searchValue || $[26] !== shortcutKeys) {
|
|
145
|
+
t13 = !isFocused && !searchValue && /* @__PURE__ */ jsx(KeycapHint, { keys: shortcutKeys, ariaLabel: "Search docs shortcut" });
|
|
146
|
+
$[24] = isFocused;
|
|
147
|
+
$[25] = searchValue;
|
|
148
|
+
$[26] = shortcutKeys;
|
|
149
|
+
$[27] = t13;
|
|
150
|
+
} else {
|
|
151
|
+
t13 = $[27];
|
|
152
|
+
}
|
|
153
|
+
let t14;
|
|
154
|
+
if ($[28] !== t12 || $[29] !== t13) {
|
|
155
|
+
t14 = /* @__PURE__ */ jsxs("div", { className: "graphiql-doc-explorer-search-row-input", onClick: t7, children: [
|
|
156
|
+
t8,
|
|
157
|
+
t12,
|
|
158
|
+
t13
|
|
159
|
+
] });
|
|
160
|
+
$[28] = t12;
|
|
161
|
+
$[29] = t13;
|
|
162
|
+
$[30] = t14;
|
|
163
|
+
} else {
|
|
164
|
+
t14 = $[30];
|
|
165
|
+
}
|
|
166
|
+
let t15;
|
|
167
|
+
if ($[31] !== isFocused || $[32] !== results) {
|
|
168
|
+
t15 = isFocused && /* @__PURE__ */ jsxs(ComboboxOptions, { className: "graphiql-doc-explorer-search-row-listbox", "data-cy": "doc-explorer-list", children: [
|
|
169
|
+
results.within.length + results.types.length + results.fields.length === 0 ? /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-search-empty", children: "No results found" }) : results.within.map(_temp),
|
|
170
|
+
results.within.length > 0 && results.types.length + results.fields.length > 0 ? /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-search-divider", children: "Other results" }) : null,
|
|
171
|
+
results.types.map(_temp2),
|
|
172
|
+
results.fields.map(_temp3)
|
|
173
|
+
] });
|
|
174
|
+
$[31] = isFocused;
|
|
175
|
+
$[32] = results;
|
|
176
|
+
$[33] = t15;
|
|
177
|
+
} else {
|
|
178
|
+
t15 = $[33];
|
|
179
|
+
}
|
|
180
|
+
let t16;
|
|
181
|
+
if ($[34] !== onSelect || $[35] !== t14 || $[36] !== t15 || $[37] !== t6) {
|
|
182
|
+
t16 = /* @__PURE__ */ jsx("div", { className: "graphiql-doc-explorer-search-row-wrapper", children: /* @__PURE__ */ jsxs(Combobox, { as: "div", className: "graphiql-doc-explorer-search-row", onChange: onSelect, "aria-label": t6, children: [
|
|
183
|
+
t14,
|
|
184
|
+
t15
|
|
185
|
+
] }) });
|
|
186
|
+
$[34] = onSelect;
|
|
187
|
+
$[35] = t14;
|
|
188
|
+
$[36] = t15;
|
|
189
|
+
$[37] = t6;
|
|
190
|
+
$[38] = t16;
|
|
191
|
+
} else {
|
|
192
|
+
t16 = $[38];
|
|
193
|
+
}
|
|
194
|
+
return t16;
|
|
195
|
+
};
|
|
196
|
+
const SearchType = (t0) => {
|
|
197
|
+
const $ = c(5);
|
|
198
|
+
const {
|
|
199
|
+
type
|
|
200
|
+
} = t0;
|
|
201
|
+
let t1;
|
|
202
|
+
if ($[0] !== type) {
|
|
203
|
+
t1 = typeCategory(type);
|
|
204
|
+
$[0] = type;
|
|
205
|
+
$[1] = t1;
|
|
206
|
+
} else {
|
|
207
|
+
t1 = $[1];
|
|
208
|
+
}
|
|
209
|
+
let t2;
|
|
210
|
+
if ($[2] !== t1 || $[3] !== type.name) {
|
|
211
|
+
t2 = /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-search-type", "data-type-kind": t1, children: type.name });
|
|
212
|
+
$[2] = t1;
|
|
213
|
+
$[3] = type.name;
|
|
214
|
+
$[4] = t2;
|
|
215
|
+
} else {
|
|
216
|
+
t2 = $[4];
|
|
217
|
+
}
|
|
218
|
+
return t2;
|
|
219
|
+
};
|
|
220
|
+
const SearchField = (t0) => {
|
|
221
|
+
const $ = c(7);
|
|
222
|
+
const {
|
|
223
|
+
field,
|
|
224
|
+
argument
|
|
225
|
+
} = t0;
|
|
226
|
+
let t1;
|
|
227
|
+
if ($[0] !== field.name) {
|
|
228
|
+
t1 = /* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-search-field", children: field.name });
|
|
229
|
+
$[0] = field.name;
|
|
230
|
+
$[1] = t1;
|
|
231
|
+
} else {
|
|
232
|
+
t1 = $[1];
|
|
233
|
+
}
|
|
234
|
+
let t2;
|
|
235
|
+
if ($[2] !== argument) {
|
|
236
|
+
t2 = argument ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
237
|
+
"(",
|
|
238
|
+
/* @__PURE__ */ jsx("span", { className: "graphiql-doc-explorer-search-argument", children: argument.name }),
|
|
239
|
+
":",
|
|
240
|
+
" ",
|
|
241
|
+
renderType(argument.type, _temp4),
|
|
242
|
+
")"
|
|
243
|
+
] }) : null;
|
|
244
|
+
$[2] = argument;
|
|
245
|
+
$[3] = t2;
|
|
246
|
+
} else {
|
|
247
|
+
t2 = $[3];
|
|
248
|
+
}
|
|
249
|
+
let t3;
|
|
250
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
251
|
+
t3 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
252
|
+
t1,
|
|
253
|
+
t2
|
|
254
|
+
] });
|
|
255
|
+
$[4] = t1;
|
|
256
|
+
$[5] = t2;
|
|
257
|
+
$[6] = t3;
|
|
258
|
+
} else {
|
|
259
|
+
t3 = $[6];
|
|
260
|
+
}
|
|
261
|
+
return t3;
|
|
262
|
+
};
|
|
263
|
+
function _temp(result, i) {
|
|
264
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: result, "data-cy": "doc-explorer-option", children: /* @__PURE__ */ jsx(SearchField, { field: result.field, argument: result.argument }) }, `within-${i}`);
|
|
265
|
+
}
|
|
266
|
+
function _temp2(result_0, i_0) {
|
|
267
|
+
return /* @__PURE__ */ jsx(ComboboxOption, { value: result_0, "data-cy": "doc-explorer-option", children: /* @__PURE__ */ jsx(SearchType, { type: result_0.type }) }, `type-${i_0}`);
|
|
268
|
+
}
|
|
269
|
+
function _temp3(result_1, i_1) {
|
|
270
|
+
return /* @__PURE__ */ jsxs(ComboboxOption, { value: result_1, "data-cy": "doc-explorer-option", children: [
|
|
271
|
+
/* @__PURE__ */ jsx(SearchType, { type: result_1.type }),
|
|
272
|
+
".",
|
|
273
|
+
/* @__PURE__ */ jsx(SearchField, { field: result_1.field, argument: result_1.argument })
|
|
274
|
+
] }, `field-${i_1}`);
|
|
275
|
+
}
|
|
276
|
+
function _temp4(namedType) {
|
|
277
|
+
return /* @__PURE__ */ jsx(SearchType, { type: namedType });
|
|
278
|
+
}
|
|
279
|
+
export {
|
|
280
|
+
SearchRow
|
|
281
|
+
};
|
|
282
|
+
//# sourceMappingURL=search-row.js.map
|