@graphiql/plugin-query-builder 1.0.0-beta.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/components/arg-input/arg-input-by-type.js +441 -444
- package/dist/components/arg-input/arg-input-by-type.js.map +1 -1
- package/dist/components/arg-input/enum-arg-control.js +49 -52
- package/dist/components/arg-input/enum-arg-control.js.map +1 -1
- package/dist/components/arg-input/index.js +44 -36
- package/dist/components/arg-input/index.js.map +1 -1
- package/dist/components/arg-input/scalar-arg-control.js +58 -63
- package/dist/components/arg-input/scalar-arg-control.js.map +1 -1
- package/dist/components/field-row.js +212 -197
- package/dist/components/field-row.js.map +1 -1
- package/dist/components/field-tree-context.js +23 -27
- package/dist/components/field-tree-context.js.map +1 -1
- package/dist/components/field-tree-node.js +128 -105
- package/dist/components/field-tree-node.js.map +1 -1
- package/dist/components/field-tree.js +178 -199
- package/dist/components/field-tree.js.map +1 -1
- package/dist/components/fragment-editor.js +157 -151
- package/dist/components/fragment-editor.js.map +1 -1
- package/dist/components/fragment-section.js +215 -203
- package/dist/components/fragment-section.js.map +1 -1
- package/dist/components/query-builder.js +205 -181
- package/dist/components/query-builder.js.map +1 -1
- package/dist/components/type-condition-selector.js +417 -462
- package/dist/components/type-condition-selector.js.map +1 -1
- package/dist/components/use-cursor-path.js +69 -70
- package/dist/components/use-cursor-path.js.map +1 -1
- package/dist/components/use-cursor-reveal.js +83 -89
- package/dist/components/use-cursor-reveal.js.map +1 -1
- package/dist/components/use-working-document.js +432 -527
- package/dist/components/use-working-document.js.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/arg-value.js +132 -139
- package/dist/lib/arg-value.js.map +1 -1
- package/dist/lib/arguments.js +54 -55
- package/dist/lib/arguments.js.map +1 -1
- package/dist/lib/ast-path.js +266 -291
- package/dist/lib/ast-path.js.map +1 -1
- package/dist/lib/field-list-view.js +33 -43
- package/dist/lib/field-list-view.js.map +1 -1
- package/dist/lib/field-selection.js +63 -67
- package/dist/lib/field-selection.js.map +1 -1
- package/dist/lib/fragments.js +166 -152
- package/dist/lib/fragments.js.map +1 -1
- package/dist/lib/inline-fragments.js +64 -62
- package/dist/lib/inline-fragments.js.map +1 -1
- package/dist/lib/schema-walk.js +141 -158
- package/dist/lib/schema-walk.js.map +1 -1
- package/dist/lib/variables.js +96 -90
- package/dist/lib/variables.js.map +1 -1
- package/dist/style.css +4 -22
- package/package.json +21 -18
|
@@ -1,472 +1,427 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ChevronDownIcon } from "@graphiql/react";
|
|
4
|
-
import { isUnionType, isInterfaceType } from "graphql";
|
|
5
|
-
import { useState, useEffect } from "react";
|
|
1
|
+
import { inlineFragmentSegment, segmentsEqual } from "../lib/ast-path.js";
|
|
2
|
+
import { isInlineFragmentPresent } from "../lib/inline-fragments.js";
|
|
6
3
|
import { useFieldTreeContext } from "./field-tree-context.js";
|
|
7
|
-
import { FieldTreeList } from "./field-tree.js";
|
|
8
4
|
import { useCursorReveal } from "./use-cursor-reveal.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { FieldTreeList } from "./field-tree.js";
|
|
6
|
+
import { ChevronDownIcon } from "@graphiql/react";
|
|
7
|
+
import { c } from "react-compiler-runtime";
|
|
8
|
+
import { isInterfaceType, isUnionType } from "graphql";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/type-condition-selector.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The type conditions worth offering for an abstract field: every concrete
|
|
14
|
+
* object type, plus (for interface fields) the other interfaces that share an
|
|
15
|
+
* implementor, so you can narrow to a sibling/sub-interface (`... on Node`).
|
|
16
|
+
* The field's own interface and the interfaces it already implements are
|
|
17
|
+
* skipped, since those fields are selectable directly. A union contributes just
|
|
18
|
+
* its member object types.
|
|
19
|
+
*/
|
|
11
20
|
function applicableTypeConditions(abstractType, schema) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const object of objects) {
|
|
19
|
-
for (const iface of object.getInterfaces()) {
|
|
20
|
-
if (!skip.has(iface.name)) {
|
|
21
|
-
interfaces.set(iface.name, iface);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return [...objects, ...interfaces.values()];
|
|
21
|
+
const objects = schema.getPossibleTypes(abstractType);
|
|
22
|
+
if (!isInterfaceType(abstractType)) return [...objects];
|
|
23
|
+
const skip = /* @__PURE__ */ new Set([abstractType.name, ...abstractType.getInterfaces().map((i) => i.name)]);
|
|
24
|
+
const interfaces = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const object of objects) for (const iface of object.getInterfaces()) if (!skip.has(iface.name)) interfaces.set(iface.name, iface);
|
|
26
|
+
return [...objects, ...interfaces.values()];
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
t20
|
|
240
|
-
] });
|
|
241
|
-
$[50] = expanded;
|
|
242
|
-
$[51] = t14;
|
|
243
|
-
$[52] = t18;
|
|
244
|
-
$[53] = t20;
|
|
245
|
-
$[54] = t21;
|
|
246
|
-
} else {
|
|
247
|
-
t21 = $[54];
|
|
248
|
-
}
|
|
249
|
-
const t22 = expanded && entries;
|
|
250
|
-
let t23;
|
|
251
|
-
if ($[55] !== t21 || $[56] !== t22) {
|
|
252
|
-
t23 = /* @__PURE__ */ jsxs("div", { className: "graphiql-qb-possible-types", children: [
|
|
253
|
-
t21,
|
|
254
|
-
t22
|
|
255
|
-
] });
|
|
256
|
-
$[55] = t21;
|
|
257
|
-
$[56] = t22;
|
|
258
|
-
$[57] = t23;
|
|
259
|
-
} else {
|
|
260
|
-
t23 = $[57];
|
|
261
|
-
}
|
|
262
|
-
return t23;
|
|
28
|
+
var TypeConditionSelector = (t0) => {
|
|
29
|
+
const $ = c(58);
|
|
30
|
+
const { fieldPath, abstractType } = t0;
|
|
31
|
+
const { doc, schema, target, cursorPath } = useFieldTreeContext();
|
|
32
|
+
let t1;
|
|
33
|
+
if ($[0] !== abstractType || $[1] !== doc || $[2] !== fieldPath || $[3] !== schema || $[4] !== target) {
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[6] !== doc || $[7] !== fieldPath || $[8] !== target) {
|
|
36
|
+
t2 = (t) => isInlineFragmentPresent(doc, fieldPath, t.name, target);
|
|
37
|
+
$[6] = doc;
|
|
38
|
+
$[7] = fieldPath;
|
|
39
|
+
$[8] = target;
|
|
40
|
+
$[9] = t2;
|
|
41
|
+
} else t2 = $[9];
|
|
42
|
+
t1 = (schema ? applicableTypeConditions(abstractType, schema) : []).some(t2);
|
|
43
|
+
$[0] = abstractType;
|
|
44
|
+
$[1] = doc;
|
|
45
|
+
$[2] = fieldPath;
|
|
46
|
+
$[3] = schema;
|
|
47
|
+
$[4] = target;
|
|
48
|
+
$[5] = t1;
|
|
49
|
+
} else t1 = $[5];
|
|
50
|
+
const hasSelectedCondition = t1;
|
|
51
|
+
const [expanded, setExpanded] = useState(hasSelectedCondition);
|
|
52
|
+
let t2;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[10] !== hasSelectedCondition) {
|
|
55
|
+
t2 = () => {
|
|
56
|
+
if (hasSelectedCondition) setExpanded(true);
|
|
57
|
+
};
|
|
58
|
+
t3 = [hasSelectedCondition];
|
|
59
|
+
$[10] = hasSelectedCondition;
|
|
60
|
+
$[11] = t2;
|
|
61
|
+
$[12] = t3;
|
|
62
|
+
} else {
|
|
63
|
+
t2 = $[11];
|
|
64
|
+
t3 = $[12];
|
|
65
|
+
}
|
|
66
|
+
useEffect(t2, t3);
|
|
67
|
+
let t4;
|
|
68
|
+
if ($[13] !== cursorPath || $[14] !== fieldPath) {
|
|
69
|
+
t4 = cursorPath !== void 0 && cursorPath.length > fieldPath.length && fieldPath.every((seg, i) => segmentsEqual(cursorPath[i], seg)) && cursorPath[fieldPath.length]?.kind === "inlineFragment";
|
|
70
|
+
$[13] = cursorPath;
|
|
71
|
+
$[14] = fieldPath;
|
|
72
|
+
$[15] = t4;
|
|
73
|
+
} else t4 = $[15];
|
|
74
|
+
const cursorInCondition = t4;
|
|
75
|
+
let t5;
|
|
76
|
+
if ($[16] !== cursorInCondition) {
|
|
77
|
+
t5 = () => {
|
|
78
|
+
if (cursorInCondition) setExpanded(true);
|
|
79
|
+
};
|
|
80
|
+
$[16] = cursorInCondition;
|
|
81
|
+
$[17] = t5;
|
|
82
|
+
} else t5 = $[17];
|
|
83
|
+
let t6;
|
|
84
|
+
if ($[18] !== cursorInCondition || $[19] !== cursorPath) {
|
|
85
|
+
t6 = [cursorPath, cursorInCondition];
|
|
86
|
+
$[18] = cursorInCondition;
|
|
87
|
+
$[19] = cursorPath;
|
|
88
|
+
$[20] = t6;
|
|
89
|
+
} else t6 = $[20];
|
|
90
|
+
useEffect(t5, t6);
|
|
91
|
+
if (!schema) return null;
|
|
92
|
+
let t10;
|
|
93
|
+
let t11;
|
|
94
|
+
let t7;
|
|
95
|
+
let t8;
|
|
96
|
+
let t9;
|
|
97
|
+
let typeConditions;
|
|
98
|
+
if ($[21] !== abstractType || $[22] !== doc || $[23] !== fieldPath || $[24] !== schema || $[25] !== target) {
|
|
99
|
+
t11 = Symbol.for("react.early_return_sentinel");
|
|
100
|
+
bb0: {
|
|
101
|
+
typeConditions = applicableTypeConditions(abstractType, schema);
|
|
102
|
+
if (typeConditions.length === 0) {
|
|
103
|
+
t11 = null;
|
|
104
|
+
break bb0;
|
|
105
|
+
}
|
|
106
|
+
t7 = "graphiql-qb-type-condition";
|
|
107
|
+
t8 = "group";
|
|
108
|
+
t9 = `Possible types for ${abstractType.name}`;
|
|
109
|
+
let t12;
|
|
110
|
+
if ($[32] !== doc || $[33] !== fieldPath || $[34] !== target) {
|
|
111
|
+
t12 = (conditionType) => {
|
|
112
|
+
const isSelected = isInlineFragmentPresent(doc, fieldPath, conditionType.name, target);
|
|
113
|
+
return /* @__PURE__ */ jsx(TypeConditionEntry, {
|
|
114
|
+
fieldPath,
|
|
115
|
+
typeName: conditionType.name,
|
|
116
|
+
concreteType: conditionType,
|
|
117
|
+
isInterface: isInterfaceType(conditionType),
|
|
118
|
+
isSelected
|
|
119
|
+
}, conditionType.name);
|
|
120
|
+
};
|
|
121
|
+
$[32] = doc;
|
|
122
|
+
$[33] = fieldPath;
|
|
123
|
+
$[34] = target;
|
|
124
|
+
$[35] = t12;
|
|
125
|
+
} else t12 = $[35];
|
|
126
|
+
t10 = typeConditions.map(t12);
|
|
127
|
+
}
|
|
128
|
+
$[21] = abstractType;
|
|
129
|
+
$[22] = doc;
|
|
130
|
+
$[23] = fieldPath;
|
|
131
|
+
$[24] = schema;
|
|
132
|
+
$[25] = target;
|
|
133
|
+
$[26] = t10;
|
|
134
|
+
$[27] = t11;
|
|
135
|
+
$[28] = t7;
|
|
136
|
+
$[29] = t8;
|
|
137
|
+
$[30] = t9;
|
|
138
|
+
$[31] = typeConditions;
|
|
139
|
+
} else {
|
|
140
|
+
t10 = $[26];
|
|
141
|
+
t11 = $[27];
|
|
142
|
+
t7 = $[28];
|
|
143
|
+
t8 = $[29];
|
|
144
|
+
t9 = $[30];
|
|
145
|
+
typeConditions = $[31];
|
|
146
|
+
}
|
|
147
|
+
if (t11 !== Symbol.for("react.early_return_sentinel")) return t11;
|
|
148
|
+
let t12;
|
|
149
|
+
if ($[36] !== t10 || $[37] !== t7 || $[38] !== t8 || $[39] !== t9) {
|
|
150
|
+
t12 = /* @__PURE__ */ jsx("div", {
|
|
151
|
+
className: t7,
|
|
152
|
+
role: t8,
|
|
153
|
+
"aria-label": t9,
|
|
154
|
+
children: t10
|
|
155
|
+
});
|
|
156
|
+
$[36] = t10;
|
|
157
|
+
$[37] = t7;
|
|
158
|
+
$[38] = t8;
|
|
159
|
+
$[39] = t9;
|
|
160
|
+
$[40] = t12;
|
|
161
|
+
} else t12 = $[40];
|
|
162
|
+
const entries = t12;
|
|
163
|
+
if (isUnionType(abstractType)) return entries;
|
|
164
|
+
const t13 = `calc(${fieldPath.length * 12}px + var(--px-8))`;
|
|
165
|
+
let t14;
|
|
166
|
+
if ($[41] !== t13) {
|
|
167
|
+
t14 = { paddingLeft: t13 };
|
|
168
|
+
$[41] = t13;
|
|
169
|
+
$[42] = t14;
|
|
170
|
+
} else t14 = $[42];
|
|
171
|
+
let t15;
|
|
172
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
173
|
+
t15 = () => setExpanded(_temp);
|
|
174
|
+
$[43] = t15;
|
|
175
|
+
} else t15 = $[43];
|
|
176
|
+
const t16 = expanded ? "graphiql-qb-chevron-expanded" : "graphiql-qb-chevron-collapsed";
|
|
177
|
+
let t17;
|
|
178
|
+
if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t17 = /* @__PURE__ */ jsx(ChevronDownIcon, {});
|
|
180
|
+
$[44] = t17;
|
|
181
|
+
} else t17 = $[44];
|
|
182
|
+
let t18;
|
|
183
|
+
if ($[45] !== t16) {
|
|
184
|
+
t18 = /* @__PURE__ */ jsx("span", {
|
|
185
|
+
className: t16,
|
|
186
|
+
children: t17
|
|
187
|
+
});
|
|
188
|
+
$[45] = t16;
|
|
189
|
+
$[46] = t18;
|
|
190
|
+
} else t18 = $[46];
|
|
191
|
+
let t19;
|
|
192
|
+
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
193
|
+
t19 = /* @__PURE__ */ jsx("span", {
|
|
194
|
+
className: "graphiql-qb-possible-types-label",
|
|
195
|
+
children: "Possible types"
|
|
196
|
+
});
|
|
197
|
+
$[47] = t19;
|
|
198
|
+
} else t19 = $[47];
|
|
199
|
+
let t20;
|
|
200
|
+
if ($[48] !== typeConditions.length) {
|
|
201
|
+
t20 = /* @__PURE__ */ jsx("span", {
|
|
202
|
+
className: "graphiql-qb-possible-types-count",
|
|
203
|
+
children: typeConditions.length
|
|
204
|
+
});
|
|
205
|
+
$[48] = typeConditions.length;
|
|
206
|
+
$[49] = t20;
|
|
207
|
+
} else t20 = $[49];
|
|
208
|
+
let t21;
|
|
209
|
+
if ($[50] !== expanded || $[51] !== t14 || $[52] !== t18 || $[53] !== t20) {
|
|
210
|
+
t21 = /* @__PURE__ */ jsxs("button", {
|
|
211
|
+
type: "button",
|
|
212
|
+
className: "graphiql-qb-field-toggle graphiql-qb-possible-types-header",
|
|
213
|
+
style: t14,
|
|
214
|
+
onClick: t15,
|
|
215
|
+
"aria-expanded": expanded,
|
|
216
|
+
children: [
|
|
217
|
+
t18,
|
|
218
|
+
t19,
|
|
219
|
+
t20
|
|
220
|
+
]
|
|
221
|
+
});
|
|
222
|
+
$[50] = expanded;
|
|
223
|
+
$[51] = t14;
|
|
224
|
+
$[52] = t18;
|
|
225
|
+
$[53] = t20;
|
|
226
|
+
$[54] = t21;
|
|
227
|
+
} else t21 = $[54];
|
|
228
|
+
const t22 = expanded && entries;
|
|
229
|
+
let t23;
|
|
230
|
+
if ($[55] !== t21 || $[56] !== t22) {
|
|
231
|
+
t23 = /* @__PURE__ */ jsxs("div", {
|
|
232
|
+
className: "graphiql-qb-possible-types",
|
|
233
|
+
children: [t21, t22]
|
|
234
|
+
});
|
|
235
|
+
$[55] = t21;
|
|
236
|
+
$[56] = t22;
|
|
237
|
+
$[57] = t23;
|
|
238
|
+
} else t23 = $[57];
|
|
239
|
+
return t23;
|
|
263
240
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
$[40] = fragmentPath;
|
|
441
|
-
$[41] = isInterface;
|
|
442
|
-
$[42] = t20;
|
|
443
|
-
} else {
|
|
444
|
-
t20 = $[42];
|
|
445
|
-
}
|
|
446
|
-
let t21;
|
|
447
|
-
if ($[43] !== nodeRef || $[44] !== t19 || $[45] !== t20 || $[46] !== t4) {
|
|
448
|
-
t21 = /* @__PURE__ */ jsxs("div", { className: t4, ref: nodeRef, children: [
|
|
449
|
-
t19,
|
|
450
|
-
t20
|
|
451
|
-
] });
|
|
452
|
-
$[43] = nodeRef;
|
|
453
|
-
$[44] = t19;
|
|
454
|
-
$[45] = t20;
|
|
455
|
-
$[46] = t4;
|
|
456
|
-
$[47] = t21;
|
|
457
|
-
} else {
|
|
458
|
-
t21 = $[47];
|
|
459
|
-
}
|
|
460
|
-
return t21;
|
|
241
|
+
var TypeConditionEntry = (t0) => {
|
|
242
|
+
const $ = c(48);
|
|
243
|
+
const { fieldPath, typeName, concreteType, isInterface, isSelected } = t0;
|
|
244
|
+
const { cursorPath, onAddInlineFragment, onRemoveInlineFragment } = useFieldTreeContext();
|
|
245
|
+
const [expanded, setExpanded] = useState(false);
|
|
246
|
+
let t1;
|
|
247
|
+
if ($[0] !== typeName) {
|
|
248
|
+
t1 = inlineFragmentSegment(typeName);
|
|
249
|
+
$[0] = typeName;
|
|
250
|
+
$[1] = t1;
|
|
251
|
+
} else t1 = $[1];
|
|
252
|
+
let t2;
|
|
253
|
+
if ($[2] !== fieldPath || $[3] !== t1) {
|
|
254
|
+
t2 = [...fieldPath, t1];
|
|
255
|
+
$[2] = fieldPath;
|
|
256
|
+
$[3] = t1;
|
|
257
|
+
$[4] = t2;
|
|
258
|
+
} else t2 = $[4];
|
|
259
|
+
const fragmentPath = t2;
|
|
260
|
+
const { flash, current, nodeRef } = useCursorReveal(fragmentPath, cursorPath, setExpanded);
|
|
261
|
+
let t3;
|
|
262
|
+
if ($[5] !== fieldPath || $[6] !== isSelected || $[7] !== onAddInlineFragment || $[8] !== onRemoveInlineFragment || $[9] !== typeName) {
|
|
263
|
+
t3 = function handleToggle() {
|
|
264
|
+
if (isSelected) onRemoveInlineFragment?.(fieldPath, typeName);
|
|
265
|
+
else onAddInlineFragment?.(fieldPath, typeName);
|
|
266
|
+
};
|
|
267
|
+
$[5] = fieldPath;
|
|
268
|
+
$[6] = isSelected;
|
|
269
|
+
$[7] = onAddInlineFragment;
|
|
270
|
+
$[8] = onRemoveInlineFragment;
|
|
271
|
+
$[9] = typeName;
|
|
272
|
+
$[10] = t3;
|
|
273
|
+
} else t3 = $[10];
|
|
274
|
+
const handleToggle = t3;
|
|
275
|
+
const t4 = `graphiql-qb-inline-fragment${flash ? " graphiql-qb-flash" : ""}${current ? " graphiql-qb-current" : ""}`;
|
|
276
|
+
const t5 = `calc(${fieldPath.length * 12}px + var(--px-8))`;
|
|
277
|
+
let t6;
|
|
278
|
+
if ($[11] !== t5) {
|
|
279
|
+
t6 = { paddingLeft: t5 };
|
|
280
|
+
$[11] = t5;
|
|
281
|
+
$[12] = t6;
|
|
282
|
+
} else t6 = $[12];
|
|
283
|
+
const t7 = `Toggle ... on ${typeName}`;
|
|
284
|
+
let t8;
|
|
285
|
+
if ($[13] !== handleToggle || $[14] !== isSelected || $[15] !== t7) {
|
|
286
|
+
t8 = /* @__PURE__ */ jsx("input", {
|
|
287
|
+
type: "checkbox",
|
|
288
|
+
checked: isSelected,
|
|
289
|
+
onChange: handleToggle,
|
|
290
|
+
"aria-label": t7,
|
|
291
|
+
className: "graphiql-qb-field-checkbox"
|
|
292
|
+
});
|
|
293
|
+
$[13] = handleToggle;
|
|
294
|
+
$[14] = isSelected;
|
|
295
|
+
$[15] = t7;
|
|
296
|
+
$[16] = t8;
|
|
297
|
+
} else t8 = $[16];
|
|
298
|
+
let t9;
|
|
299
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
300
|
+
t9 = () => setExpanded(_temp2);
|
|
301
|
+
$[17] = t9;
|
|
302
|
+
} else t9 = $[17];
|
|
303
|
+
const t10 = `${expanded ? "Collapse" : "Expand"} ... on ${typeName}`;
|
|
304
|
+
const t11 = expanded ? "graphiql-qb-chevron-expanded" : "graphiql-qb-chevron-collapsed";
|
|
305
|
+
let t12;
|
|
306
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
307
|
+
t12 = /* @__PURE__ */ jsx(ChevronDownIcon, {});
|
|
308
|
+
$[18] = t12;
|
|
309
|
+
} else t12 = $[18];
|
|
310
|
+
let t13;
|
|
311
|
+
if ($[19] !== t11) {
|
|
312
|
+
t13 = /* @__PURE__ */ jsx("span", {
|
|
313
|
+
className: t11,
|
|
314
|
+
children: t12
|
|
315
|
+
});
|
|
316
|
+
$[19] = t11;
|
|
317
|
+
$[20] = t13;
|
|
318
|
+
} else t13 = $[20];
|
|
319
|
+
let t14;
|
|
320
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
321
|
+
t14 = /* @__PURE__ */ jsx("span", {
|
|
322
|
+
className: "graphiql-qb-spread",
|
|
323
|
+
children: "..."
|
|
324
|
+
});
|
|
325
|
+
$[21] = t14;
|
|
326
|
+
} else t14 = $[21];
|
|
327
|
+
let t15;
|
|
328
|
+
if ($[22] !== typeName) {
|
|
329
|
+
t15 = /* @__PURE__ */ jsx("span", {
|
|
330
|
+
className: "graphiql-qb-type-name",
|
|
331
|
+
children: typeName
|
|
332
|
+
});
|
|
333
|
+
$[22] = typeName;
|
|
334
|
+
$[23] = t15;
|
|
335
|
+
} else t15 = $[23];
|
|
336
|
+
let t16;
|
|
337
|
+
if ($[24] !== isInterface) {
|
|
338
|
+
t16 = isInterface && /* @__PURE__ */ jsx("span", {
|
|
339
|
+
className: "graphiql-qb-type-kind-tag",
|
|
340
|
+
children: "interface"
|
|
341
|
+
});
|
|
342
|
+
$[24] = isInterface;
|
|
343
|
+
$[25] = t16;
|
|
344
|
+
} else t16 = $[25];
|
|
345
|
+
let t17;
|
|
346
|
+
if ($[26] !== t15 || $[27] !== t16) {
|
|
347
|
+
t17 = /* @__PURE__ */ jsxs("span", {
|
|
348
|
+
className: "graphiql-qb-inline-fragment-label",
|
|
349
|
+
children: [
|
|
350
|
+
t14,
|
|
351
|
+
" on ",
|
|
352
|
+
t15,
|
|
353
|
+
t16
|
|
354
|
+
]
|
|
355
|
+
});
|
|
356
|
+
$[26] = t15;
|
|
357
|
+
$[27] = t16;
|
|
358
|
+
$[28] = t17;
|
|
359
|
+
} else t17 = $[28];
|
|
360
|
+
let t18;
|
|
361
|
+
if ($[29] !== expanded || $[30] !== t10 || $[31] !== t13 || $[32] !== t17) {
|
|
362
|
+
t18 = /* @__PURE__ */ jsxs("button", {
|
|
363
|
+
type: "button",
|
|
364
|
+
className: "graphiql-qb-field-toggle",
|
|
365
|
+
onClick: t9,
|
|
366
|
+
"aria-expanded": expanded,
|
|
367
|
+
"aria-label": t10,
|
|
368
|
+
children: [t13, t17]
|
|
369
|
+
});
|
|
370
|
+
$[29] = expanded;
|
|
371
|
+
$[30] = t10;
|
|
372
|
+
$[31] = t13;
|
|
373
|
+
$[32] = t17;
|
|
374
|
+
$[33] = t18;
|
|
375
|
+
} else t18 = $[33];
|
|
376
|
+
let t19;
|
|
377
|
+
if ($[34] !== t18 || $[35] !== t6 || $[36] !== t8) {
|
|
378
|
+
t19 = /* @__PURE__ */ jsxs("div", {
|
|
379
|
+
className: "graphiql-qb-inline-fragment-header",
|
|
380
|
+
style: t6,
|
|
381
|
+
children: [t8, t18]
|
|
382
|
+
});
|
|
383
|
+
$[34] = t18;
|
|
384
|
+
$[35] = t6;
|
|
385
|
+
$[36] = t8;
|
|
386
|
+
$[37] = t19;
|
|
387
|
+
} else t19 = $[37];
|
|
388
|
+
let t20;
|
|
389
|
+
if ($[38] !== concreteType || $[39] !== expanded || $[40] !== fragmentPath || $[41] !== isInterface) {
|
|
390
|
+
t20 = expanded && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FieldTreeList, {
|
|
391
|
+
type: concreteType,
|
|
392
|
+
path: fragmentPath
|
|
393
|
+
}), isInterface && /* @__PURE__ */ jsx(TypeConditionSelector, {
|
|
394
|
+
fieldPath: fragmentPath,
|
|
395
|
+
abstractType: concreteType
|
|
396
|
+
})] });
|
|
397
|
+
$[38] = concreteType;
|
|
398
|
+
$[39] = expanded;
|
|
399
|
+
$[40] = fragmentPath;
|
|
400
|
+
$[41] = isInterface;
|
|
401
|
+
$[42] = t20;
|
|
402
|
+
} else t20 = $[42];
|
|
403
|
+
let t21;
|
|
404
|
+
if ($[43] !== nodeRef || $[44] !== t19 || $[45] !== t20 || $[46] !== t4) {
|
|
405
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
406
|
+
className: t4,
|
|
407
|
+
ref: nodeRef,
|
|
408
|
+
children: [t19, t20]
|
|
409
|
+
});
|
|
410
|
+
$[43] = nodeRef;
|
|
411
|
+
$[44] = t19;
|
|
412
|
+
$[45] = t20;
|
|
413
|
+
$[46] = t4;
|
|
414
|
+
$[47] = t21;
|
|
415
|
+
} else t21 = $[47];
|
|
416
|
+
return t21;
|
|
461
417
|
};
|
|
462
418
|
function _temp(prev) {
|
|
463
|
-
|
|
419
|
+
return !prev;
|
|
464
420
|
}
|
|
465
421
|
function _temp2(prev) {
|
|
466
|
-
|
|
422
|
+
return !prev;
|
|
467
423
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
//# sourceMappingURL=type-condition-selector.js.map
|
|
424
|
+
//#endregion
|
|
425
|
+
export { TypeConditionSelector, applicableTypeConditions };
|
|
426
|
+
|
|
427
|
+
//# sourceMappingURL=type-condition-selector.js.map
|