@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,459 +1,456 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { CloseIcon, PlusIcon, ChevronDownIcon } from "@graphiql/react";
|
|
4
|
-
import { isNonNullType, isListType, isInputObjectType, getNamedType, isEnumType, isScalarType } from "graphql";
|
|
5
|
-
import { useState } from "react";
|
|
6
1
|
import { BooleanArgControl, ScalarArgControl } from "./scalar-arg-control.js";
|
|
7
2
|
import { EnumArgControl } from "./enum-arg-control.js";
|
|
3
|
+
import { ChevronDownIcon, CloseIcon, PlusIcon } from "@graphiql/react";
|
|
4
|
+
import { c } from "react-compiler-runtime";
|
|
5
|
+
import { getNamedType, isEnumType, isInputObjectType, isListType, isNonNullType, isScalarType } from "graphql";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/arg-input/arg-input-by-type.tsx
|
|
9
|
+
/**
|
|
10
|
+
* True when an arg/field of this type renders as an input-object disclosure
|
|
11
|
+
* (which labels itself via its header). A list of input objects does not — it
|
|
12
|
+
* renders as a list and needs its own `name:` label — so we only unwrap
|
|
13
|
+
* NonNull here, not List. Re-exported as the public predicate from index.
|
|
14
|
+
*/
|
|
8
15
|
function rendersAsInputObject(type) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
return isInputObjectType(getNamedType(unwrapped));
|
|
16
|
+
const unwrapped = isNonNullType(type) ? type.ofType : type;
|
|
17
|
+
if (isListType(unwrapped)) return false;
|
|
18
|
+
return isInputObjectType(getNamedType(unwrapped));
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
20
|
+
var ArgInputByType = (t0) => {
|
|
21
|
+
const $ = c(58);
|
|
22
|
+
const { type, name, value, onChange, isVariable: t1, variableName, onPromote, onDemote } = t0;
|
|
23
|
+
const isVariable = t1 === void 0 ? false : t1;
|
|
24
|
+
if (isNonNullType(type)) {
|
|
25
|
+
let t2;
|
|
26
|
+
if ($[0] !== isVariable || $[1] !== name || $[2] !== onChange || $[3] !== onDemote || $[4] !== onPromote || $[5] !== type.ofType || $[6] !== value || $[7] !== variableName) {
|
|
27
|
+
t2 = /* @__PURE__ */ jsx(ArgInputByType, {
|
|
28
|
+
type: type.ofType,
|
|
29
|
+
name,
|
|
30
|
+
value,
|
|
31
|
+
onChange,
|
|
32
|
+
isVariable,
|
|
33
|
+
variableName,
|
|
34
|
+
onPromote,
|
|
35
|
+
onDemote
|
|
36
|
+
});
|
|
37
|
+
$[0] = isVariable;
|
|
38
|
+
$[1] = name;
|
|
39
|
+
$[2] = onChange;
|
|
40
|
+
$[3] = onDemote;
|
|
41
|
+
$[4] = onPromote;
|
|
42
|
+
$[5] = type.ofType;
|
|
43
|
+
$[6] = value;
|
|
44
|
+
$[7] = variableName;
|
|
45
|
+
$[8] = t2;
|
|
46
|
+
} else t2 = $[8];
|
|
47
|
+
return t2;
|
|
48
|
+
}
|
|
49
|
+
if (isListType(type)) {
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[9] !== value) {
|
|
52
|
+
t2 = Array.isArray(value) ? value : [];
|
|
53
|
+
$[9] = value;
|
|
54
|
+
$[10] = t2;
|
|
55
|
+
} else t2 = $[10];
|
|
56
|
+
let t3;
|
|
57
|
+
if ($[11] !== name || $[12] !== onChange || $[13] !== t2 || $[14] !== type.ofType) {
|
|
58
|
+
t3 = /* @__PURE__ */ jsx(ListArgInput, {
|
|
59
|
+
itemType: type.ofType,
|
|
60
|
+
name,
|
|
61
|
+
value: t2,
|
|
62
|
+
onChange
|
|
63
|
+
});
|
|
64
|
+
$[11] = name;
|
|
65
|
+
$[12] = onChange;
|
|
66
|
+
$[13] = t2;
|
|
67
|
+
$[14] = type.ofType;
|
|
68
|
+
$[15] = t3;
|
|
69
|
+
} else t3 = $[15];
|
|
70
|
+
return t3;
|
|
71
|
+
}
|
|
72
|
+
let named;
|
|
73
|
+
let t2;
|
|
74
|
+
let t3;
|
|
75
|
+
let toggleBtn;
|
|
76
|
+
if ($[16] !== isVariable || $[17] !== name || $[18] !== onChange || $[19] !== onDemote || $[20] !== onPromote || $[21] !== type || $[22] !== value || $[23] !== variableName) {
|
|
77
|
+
t3 = Symbol.for("react.early_return_sentinel");
|
|
78
|
+
bb0: {
|
|
79
|
+
named = getNamedType(type);
|
|
80
|
+
if (isInputObjectType(named)) {
|
|
81
|
+
let t4;
|
|
82
|
+
if ($[28] !== value) {
|
|
83
|
+
t4 = !Array.isArray(value) && typeof value === "object" && value !== null ? value : {};
|
|
84
|
+
$[28] = value;
|
|
85
|
+
$[29] = t4;
|
|
86
|
+
} else t4 = $[29];
|
|
87
|
+
t3 = /* @__PURE__ */ jsx(InputObjectArgInput, {
|
|
88
|
+
inputType: named,
|
|
89
|
+
name,
|
|
90
|
+
value: t4,
|
|
91
|
+
onChange
|
|
92
|
+
});
|
|
93
|
+
break bb0;
|
|
94
|
+
}
|
|
95
|
+
let t4;
|
|
96
|
+
if ($[30] !== isVariable || $[31] !== name || $[32] !== onDemote || $[33] !== onPromote || $[34] !== variableName) {
|
|
97
|
+
t4 = onPromote ? /* @__PURE__ */ jsx("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
className: "graphiql-qb-var-toggle",
|
|
100
|
+
"aria-pressed": isVariable,
|
|
101
|
+
onClick: () => {
|
|
102
|
+
if (isVariable) {
|
|
103
|
+
if (onDemote && variableName) onDemote(name, variableName);
|
|
104
|
+
} else onPromote(name, name);
|
|
105
|
+
},
|
|
106
|
+
children: isVariable ? "Inline argument" : "Use as variable"
|
|
107
|
+
}) : null;
|
|
108
|
+
$[30] = isVariable;
|
|
109
|
+
$[31] = name;
|
|
110
|
+
$[32] = onDemote;
|
|
111
|
+
$[33] = onPromote;
|
|
112
|
+
$[34] = variableName;
|
|
113
|
+
$[35] = t4;
|
|
114
|
+
} else t4 = $[35];
|
|
115
|
+
toggleBtn = t4;
|
|
116
|
+
if (isEnumType(named)) {
|
|
117
|
+
t3 = /* @__PURE__ */ jsx(WithVariableToggle, {
|
|
118
|
+
isVariable,
|
|
119
|
+
name,
|
|
120
|
+
variableName,
|
|
121
|
+
toggle: toggleBtn,
|
|
122
|
+
children: /* @__PURE__ */ jsx(EnumArgControl, {
|
|
123
|
+
name,
|
|
124
|
+
value: typeof value === "string" ? value : "",
|
|
125
|
+
onChange,
|
|
126
|
+
enumValues: named.getValues().map(_temp)
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
break bb0;
|
|
130
|
+
}
|
|
131
|
+
t2 = isScalarType(named);
|
|
132
|
+
}
|
|
133
|
+
$[16] = isVariable;
|
|
134
|
+
$[17] = name;
|
|
135
|
+
$[18] = onChange;
|
|
136
|
+
$[19] = onDemote;
|
|
137
|
+
$[20] = onPromote;
|
|
138
|
+
$[21] = type;
|
|
139
|
+
$[22] = value;
|
|
140
|
+
$[23] = variableName;
|
|
141
|
+
$[24] = named;
|
|
142
|
+
$[25] = t2;
|
|
143
|
+
$[26] = t3;
|
|
144
|
+
$[27] = toggleBtn;
|
|
145
|
+
} else {
|
|
146
|
+
named = $[24];
|
|
147
|
+
t2 = $[25];
|
|
148
|
+
t3 = $[26];
|
|
149
|
+
toggleBtn = $[27];
|
|
150
|
+
}
|
|
151
|
+
if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
|
|
152
|
+
if (t2) {
|
|
153
|
+
if (named.name === "Boolean") {
|
|
154
|
+
const t4 = typeof value === "string" ? value : "";
|
|
155
|
+
let t5;
|
|
156
|
+
if ($[36] !== name || $[37] !== onChange || $[38] !== t4) {
|
|
157
|
+
t5 = /* @__PURE__ */ jsx(BooleanArgControl, {
|
|
158
|
+
name,
|
|
159
|
+
value: t4,
|
|
160
|
+
onChange
|
|
161
|
+
});
|
|
162
|
+
$[36] = name;
|
|
163
|
+
$[37] = onChange;
|
|
164
|
+
$[38] = t4;
|
|
165
|
+
$[39] = t5;
|
|
166
|
+
} else t5 = $[39];
|
|
167
|
+
let t6;
|
|
168
|
+
if ($[40] !== isVariable || $[41] !== name || $[42] !== t5 || $[43] !== toggleBtn || $[44] !== variableName) {
|
|
169
|
+
t6 = /* @__PURE__ */ jsx(WithVariableToggle, {
|
|
170
|
+
isVariable,
|
|
171
|
+
name,
|
|
172
|
+
variableName,
|
|
173
|
+
toggle: toggleBtn,
|
|
174
|
+
children: t5
|
|
175
|
+
});
|
|
176
|
+
$[40] = isVariable;
|
|
177
|
+
$[41] = name;
|
|
178
|
+
$[42] = t5;
|
|
179
|
+
$[43] = toggleBtn;
|
|
180
|
+
$[44] = variableName;
|
|
181
|
+
$[45] = t6;
|
|
182
|
+
} else t6 = $[45];
|
|
183
|
+
return t6;
|
|
184
|
+
}
|
|
185
|
+
const inputType = named.name === "Int" || named.name === "Float" ? "number" : "text";
|
|
186
|
+
const t4 = named.name === "Int" ? "1" : void 0;
|
|
187
|
+
const t5 = typeof value === "string" ? value : "";
|
|
188
|
+
let t6;
|
|
189
|
+
if ($[46] !== inputType || $[47] !== name || $[48] !== onChange || $[49] !== t4 || $[50] !== t5) {
|
|
190
|
+
t6 = /* @__PURE__ */ jsx(ScalarArgControl, {
|
|
191
|
+
name,
|
|
192
|
+
inputType,
|
|
193
|
+
step: t4,
|
|
194
|
+
value: t5,
|
|
195
|
+
onChange
|
|
196
|
+
});
|
|
197
|
+
$[46] = inputType;
|
|
198
|
+
$[47] = name;
|
|
199
|
+
$[48] = onChange;
|
|
200
|
+
$[49] = t4;
|
|
201
|
+
$[50] = t5;
|
|
202
|
+
$[51] = t6;
|
|
203
|
+
} else t6 = $[51];
|
|
204
|
+
let t7;
|
|
205
|
+
if ($[52] !== isVariable || $[53] !== name || $[54] !== t6 || $[55] !== toggleBtn || $[56] !== variableName) {
|
|
206
|
+
t7 = /* @__PURE__ */ jsx(WithVariableToggle, {
|
|
207
|
+
isVariable,
|
|
208
|
+
name,
|
|
209
|
+
variableName,
|
|
210
|
+
toggle: toggleBtn,
|
|
211
|
+
children: t6
|
|
212
|
+
});
|
|
213
|
+
$[52] = isVariable;
|
|
214
|
+
$[53] = name;
|
|
215
|
+
$[54] = t6;
|
|
216
|
+
$[55] = toggleBtn;
|
|
217
|
+
$[56] = variableName;
|
|
218
|
+
$[57] = t7;
|
|
219
|
+
} else t7 = $[57];
|
|
220
|
+
return t7;
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
194
223
|
};
|
|
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
|
-
toggle
|
|
223
|
-
] });
|
|
224
|
-
$[5] = t1;
|
|
225
|
-
$[6] = toggle;
|
|
226
|
-
$[7] = t2;
|
|
227
|
-
} else {
|
|
228
|
-
t2 = $[7];
|
|
229
|
-
}
|
|
230
|
-
return t2;
|
|
224
|
+
var WithVariableToggle = (t0) => {
|
|
225
|
+
const $ = c(8);
|
|
226
|
+
const { isVariable, name, variableName, toggle, children } = t0;
|
|
227
|
+
let t1;
|
|
228
|
+
if ($[0] !== children || $[1] !== isVariable || $[2] !== name || $[3] !== variableName) {
|
|
229
|
+
t1 = isVariable ? /* @__PURE__ */ jsxs("span", {
|
|
230
|
+
className: "graphiql-qb-var-badge",
|
|
231
|
+
"aria-label": `${name} bound to $${variableName ?? name}`,
|
|
232
|
+
children: ["$", variableName ?? name]
|
|
233
|
+
}) : children;
|
|
234
|
+
$[0] = children;
|
|
235
|
+
$[1] = isVariable;
|
|
236
|
+
$[2] = name;
|
|
237
|
+
$[3] = variableName;
|
|
238
|
+
$[4] = t1;
|
|
239
|
+
} else t1 = $[4];
|
|
240
|
+
let t2;
|
|
241
|
+
if ($[5] !== t1 || $[6] !== toggle) {
|
|
242
|
+
t2 = /* @__PURE__ */ jsxs("span", {
|
|
243
|
+
className: "graphiql-qb-arg-with-toggle",
|
|
244
|
+
children: [t1, toggle]
|
|
245
|
+
});
|
|
246
|
+
$[5] = t1;
|
|
247
|
+
$[6] = toggle;
|
|
248
|
+
$[7] = t2;
|
|
249
|
+
} else t2 = $[7];
|
|
250
|
+
return t2;
|
|
231
251
|
};
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
252
|
+
var withIds = (values) => values.map((value) => ({
|
|
253
|
+
id: crypto.randomUUID(),
|
|
254
|
+
value
|
|
235
255
|
}));
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
-
t7
|
|
335
|
-
] });
|
|
336
|
-
$[18] = t4;
|
|
337
|
-
$[19] = t7;
|
|
338
|
-
$[20] = t8;
|
|
339
|
-
} else {
|
|
340
|
-
t8 = $[20];
|
|
341
|
-
}
|
|
342
|
-
return t8;
|
|
256
|
+
var projectItems = (items) => items.map((i) => i.value).filter((v) => v !== "");
|
|
257
|
+
var ListArgInput = (t0) => {
|
|
258
|
+
const $ = c(21);
|
|
259
|
+
const { itemType, name, value, onChange } = t0;
|
|
260
|
+
let t1;
|
|
261
|
+
if ($[0] !== value) {
|
|
262
|
+
t1 = () => withIds(value);
|
|
263
|
+
$[0] = value;
|
|
264
|
+
$[1] = t1;
|
|
265
|
+
} else t1 = $[1];
|
|
266
|
+
const [items, setItems] = useState(t1);
|
|
267
|
+
let t2;
|
|
268
|
+
if ($[2] !== value) {
|
|
269
|
+
t2 = JSON.stringify(value);
|
|
270
|
+
$[2] = value;
|
|
271
|
+
$[3] = t2;
|
|
272
|
+
} else t2 = $[3];
|
|
273
|
+
const valueJSON = t2;
|
|
274
|
+
const [syncedJSON, setSyncedJSON] = useState(valueJSON);
|
|
275
|
+
if (valueJSON !== syncedJSON) {
|
|
276
|
+
setSyncedJSON(valueJSON);
|
|
277
|
+
if (valueJSON !== JSON.stringify(projectItems(items))) setItems(withIds(value));
|
|
278
|
+
}
|
|
279
|
+
let t3;
|
|
280
|
+
if ($[4] !== onChange) {
|
|
281
|
+
t3 = (next) => {
|
|
282
|
+
setItems(next);
|
|
283
|
+
onChange(next.map(_temp2));
|
|
284
|
+
};
|
|
285
|
+
$[4] = onChange;
|
|
286
|
+
$[5] = t3;
|
|
287
|
+
} else t3 = $[5];
|
|
288
|
+
const emit = t3;
|
|
289
|
+
let t4;
|
|
290
|
+
if ($[6] !== emit || $[7] !== itemType || $[8] !== items || $[9] !== name) {
|
|
291
|
+
t4 = items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
292
|
+
className: "graphiql-qb-list-item",
|
|
293
|
+
children: [/* @__PURE__ */ jsx(ArgInputByType, {
|
|
294
|
+
type: itemType,
|
|
295
|
+
name,
|
|
296
|
+
value: item.value,
|
|
297
|
+
onChange: (v) => emit(items.map((i_0) => i_0.id === item.id ? {
|
|
298
|
+
...i_0,
|
|
299
|
+
value: v
|
|
300
|
+
} : i_0))
|
|
301
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
302
|
+
type: "button",
|
|
303
|
+
onClick: () => emit(items.filter((i_1) => i_1.id !== item.id)),
|
|
304
|
+
"aria-label": "Remove item",
|
|
305
|
+
className: "graphiql-qb-list-remove",
|
|
306
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
307
|
+
})]
|
|
308
|
+
}, item.id));
|
|
309
|
+
$[6] = emit;
|
|
310
|
+
$[7] = itemType;
|
|
311
|
+
$[8] = items;
|
|
312
|
+
$[9] = name;
|
|
313
|
+
$[10] = t4;
|
|
314
|
+
} else t4 = $[10];
|
|
315
|
+
let t5;
|
|
316
|
+
if ($[11] !== emit || $[12] !== itemType || $[13] !== items) {
|
|
317
|
+
t5 = () => emit([...items, {
|
|
318
|
+
id: crypto.randomUUID(),
|
|
319
|
+
value: defaultValueForType(itemType)
|
|
320
|
+
}]);
|
|
321
|
+
$[11] = emit;
|
|
322
|
+
$[12] = itemType;
|
|
323
|
+
$[13] = items;
|
|
324
|
+
$[14] = t5;
|
|
325
|
+
} else t5 = $[14];
|
|
326
|
+
let t6;
|
|
327
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
328
|
+
t6 = /* @__PURE__ */ jsx(PlusIcon, {});
|
|
329
|
+
$[15] = t6;
|
|
330
|
+
} else t6 = $[15];
|
|
331
|
+
let t7;
|
|
332
|
+
if ($[16] !== t5) {
|
|
333
|
+
t7 = /* @__PURE__ */ jsxs("button", {
|
|
334
|
+
type: "button",
|
|
335
|
+
onClick: t5,
|
|
336
|
+
"aria-label": "Add item",
|
|
337
|
+
className: "graphiql-qb-list-add",
|
|
338
|
+
children: [t6, "Add"]
|
|
339
|
+
});
|
|
340
|
+
$[16] = t5;
|
|
341
|
+
$[17] = t7;
|
|
342
|
+
} else t7 = $[17];
|
|
343
|
+
let t8;
|
|
344
|
+
if ($[18] !== t4 || $[19] !== t7) {
|
|
345
|
+
t8 = /* @__PURE__ */ jsxs("div", {
|
|
346
|
+
className: "graphiql-qb-list-arg",
|
|
347
|
+
children: [t4, t7]
|
|
348
|
+
});
|
|
349
|
+
$[18] = t4;
|
|
350
|
+
$[19] = t7;
|
|
351
|
+
$[20] = t8;
|
|
352
|
+
} else t8 = $[20];
|
|
353
|
+
return t8;
|
|
343
354
|
};
|
|
344
355
|
function defaultValueForType(type) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
const named = getNamedType(type);
|
|
352
|
-
if (isInputObjectType(named)) {
|
|
353
|
-
return {};
|
|
354
|
-
}
|
|
355
|
-
return "";
|
|
356
|
+
if (isNonNullType(type)) return defaultValueForType(type.ofType);
|
|
357
|
+
if (isListType(type)) return [];
|
|
358
|
+
const named = getNamedType(type);
|
|
359
|
+
if (isInputObjectType(named)) return {};
|
|
360
|
+
return "";
|
|
356
361
|
}
|
|
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
|
-
|
|
441
|
-
$[3] = open;
|
|
442
|
-
$[4] = value;
|
|
443
|
-
$[5] = t1;
|
|
444
|
-
} else {
|
|
445
|
-
t1 = $[5];
|
|
446
|
-
}
|
|
447
|
-
return t1;
|
|
362
|
+
var InputObjectArgInput = (t0) => {
|
|
363
|
+
const $ = c(15);
|
|
364
|
+
const { inputType, name, value, onChange } = t0;
|
|
365
|
+
const [open, setOpen] = useState(false);
|
|
366
|
+
let t1;
|
|
367
|
+
if ($[0] !== inputType || $[1] !== name || $[2] !== onChange || $[3] !== open || $[4] !== value) {
|
|
368
|
+
const fields = inputType.getFields();
|
|
369
|
+
const onChangeField = (fieldName, fieldValue) => {
|
|
370
|
+
const next = { ...value };
|
|
371
|
+
if (fieldValue === "" || fieldValue === void 0) delete next[fieldName];
|
|
372
|
+
else next[fieldName] = fieldValue;
|
|
373
|
+
onChange(next);
|
|
374
|
+
};
|
|
375
|
+
let t2;
|
|
376
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
377
|
+
t2 = (e) => setOpen(e.currentTarget.open);
|
|
378
|
+
$[6] = t2;
|
|
379
|
+
} else t2 = $[6];
|
|
380
|
+
const t3 = open ? "graphiql-qb-chevron-expanded" : "graphiql-qb-chevron-collapsed";
|
|
381
|
+
let t4;
|
|
382
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
383
|
+
t4 = /* @__PURE__ */ jsx(ChevronDownIcon, {});
|
|
384
|
+
$[7] = t4;
|
|
385
|
+
} else t4 = $[7];
|
|
386
|
+
let t5;
|
|
387
|
+
if ($[8] !== t3) {
|
|
388
|
+
t5 = /* @__PURE__ */ jsx("span", {
|
|
389
|
+
className: t3,
|
|
390
|
+
children: t4
|
|
391
|
+
});
|
|
392
|
+
$[8] = t3;
|
|
393
|
+
$[9] = t5;
|
|
394
|
+
} else t5 = $[9];
|
|
395
|
+
let t6;
|
|
396
|
+
if ($[10] !== name) {
|
|
397
|
+
t6 = /* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: "graphiql-qb-arg-name",
|
|
399
|
+
children: name
|
|
400
|
+
});
|
|
401
|
+
$[10] = name;
|
|
402
|
+
$[11] = t6;
|
|
403
|
+
} else t6 = $[11];
|
|
404
|
+
let t7;
|
|
405
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
406
|
+
t7 = /* @__PURE__ */ jsxs("summary", {
|
|
407
|
+
className: "graphiql-qb-input-object-summary",
|
|
408
|
+
children: [t5, t6]
|
|
409
|
+
});
|
|
410
|
+
$[12] = t5;
|
|
411
|
+
$[13] = t6;
|
|
412
|
+
$[14] = t7;
|
|
413
|
+
} else t7 = $[14];
|
|
414
|
+
t1 = /* @__PURE__ */ jsxs("details", {
|
|
415
|
+
className: "graphiql-qb-input-object",
|
|
416
|
+
onToggle: t2,
|
|
417
|
+
children: [t7, open && /* @__PURE__ */ jsx("div", {
|
|
418
|
+
className: "graphiql-qb-input-object-fields",
|
|
419
|
+
children: Object.entries(fields).map((t8) => {
|
|
420
|
+
const [fieldName_0, field] = t8;
|
|
421
|
+
const fieldVal = value[fieldName_0] ?? "";
|
|
422
|
+
const isObjectField = rendersAsInputObject(field.type);
|
|
423
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
424
|
+
className: "graphiql-qb-arg-row",
|
|
425
|
+
children: [!isObjectField && /* @__PURE__ */ jsxs("span", {
|
|
426
|
+
className: "graphiql-qb-arg-name",
|
|
427
|
+
children: [fieldName_0, ":"]
|
|
428
|
+
}), /* @__PURE__ */ jsx(ArgInputByType, {
|
|
429
|
+
type: field.type,
|
|
430
|
+
name: fieldName_0,
|
|
431
|
+
value: fieldVal,
|
|
432
|
+
onChange: (v) => onChangeField(fieldName_0, v)
|
|
433
|
+
})]
|
|
434
|
+
}, fieldName_0);
|
|
435
|
+
})
|
|
436
|
+
})]
|
|
437
|
+
});
|
|
438
|
+
$[0] = inputType;
|
|
439
|
+
$[1] = name;
|
|
440
|
+
$[2] = onChange;
|
|
441
|
+
$[3] = open;
|
|
442
|
+
$[4] = value;
|
|
443
|
+
$[5] = t1;
|
|
444
|
+
} else t1 = $[5];
|
|
445
|
+
return t1;
|
|
448
446
|
};
|
|
449
447
|
function _temp(v) {
|
|
450
|
-
|
|
448
|
+
return v.name;
|
|
451
449
|
}
|
|
452
450
|
function _temp2(i) {
|
|
453
|
-
|
|
451
|
+
return i.value;
|
|
454
452
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
//# sourceMappingURL=arg-input-by-type.js.map
|
|
453
|
+
//#endregion
|
|
454
|
+
export { ArgInputByType, rendersAsInputObject };
|
|
455
|
+
|
|
456
|
+
//# sourceMappingURL=arg-input-by-type.js.map
|