@flowgram.ai/json-schema 0.4.6 → 0.4.8
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/esm/index.js +124 -57
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +128 -61
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -109,7 +109,7 @@ BaseTypeManager = __decorateClass([
|
|
|
109
109
|
], BaseTypeManager);
|
|
110
110
|
|
|
111
111
|
// src/json-schema/json-schema-type-manager.tsx
|
|
112
|
-
var
|
|
112
|
+
var import_react11 = __toESM(require("react"));
|
|
113
113
|
var import_inversify2 = require("inversify");
|
|
114
114
|
|
|
115
115
|
// src/json-schema/type-definition/default.tsx
|
|
@@ -155,12 +155,74 @@ var defaultTypeDefinitionRegistry = ({ typeManager }) => ({
|
|
|
155
155
|
getDisplayText: (type) => typeManager.getComplexText(type)
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
// src/json-schema/type-definition/
|
|
158
|
+
// src/json-schema/type-definition/date-time.tsx
|
|
159
159
|
var import_react2 = __toESM(require("react"));
|
|
160
|
+
var dateTimeRegistryCreator = () => ({
|
|
161
|
+
type: "date-time",
|
|
162
|
+
label: "DateTime",
|
|
163
|
+
icon: /* @__PURE__ */ import_react2.default.createElement(
|
|
164
|
+
"svg",
|
|
165
|
+
{
|
|
166
|
+
viewBox: "0 0 24 24",
|
|
167
|
+
fill: "none",
|
|
168
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
169
|
+
width: "1em",
|
|
170
|
+
height: "1em",
|
|
171
|
+
focusable: "false",
|
|
172
|
+
"aria-hidden": "true"
|
|
173
|
+
},
|
|
174
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
175
|
+
"path",
|
|
176
|
+
{
|
|
177
|
+
d: "M2 5v14a3 3 0 0 0 3 3h7.1a7.02 7.02 0 0 1-1.43-2H6a2 2 0 0 1-2-2V8a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2.67c.75.36 1.43.85 2 1.43V5a3 3 0 0 0-3-3H5a3 3 0 0 0-3 3Z",
|
|
178
|
+
fill: "currentColor"
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
/* @__PURE__ */ import_react2.default.createElement("path", { d: "M16 10h1c-.54 0-1.06.06-1.57.18A1 1 0 0 1 16 10Z", fill: "currentColor" }),
|
|
182
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
183
|
+
"path",
|
|
184
|
+
{
|
|
185
|
+
d: "M13.5 10.94a1 1 0 0 0-1-.94h-1a1 1 0 0 0-1 1v1a1 1 0 0 0 .77.97 7.03 7.03 0 0 1 2.23-2.03Z",
|
|
186
|
+
fill: "currentColor"
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
190
|
+
"path",
|
|
191
|
+
{
|
|
192
|
+
d: "M7 10a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1a1 1 0 0 0-1-1H7Z",
|
|
193
|
+
fill: "currentColor"
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
197
|
+
"path",
|
|
198
|
+
{
|
|
199
|
+
d: "M6 16a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-1Z",
|
|
200
|
+
fill: "currentColor"
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ import_react2.default.createElement(
|
|
204
|
+
"path",
|
|
205
|
+
{
|
|
206
|
+
fillRule: "evenodd",
|
|
207
|
+
clipRule: "evenodd",
|
|
208
|
+
d: "M22 17a5 5 0 1 1-10 0 5 5 0 0 1 10 0Zm-4-2a1 1 0 1 0-2 0v2c0 .27.1.52.3.7l1.5 1.5a1 1 0 0 0 1.4-1.4L18 16.58V15Z",
|
|
209
|
+
fill: "currentColor"
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
),
|
|
213
|
+
getDefaultSchema: () => ({
|
|
214
|
+
type: "date-time"
|
|
215
|
+
}),
|
|
216
|
+
getValueText: (value) => value ? `${value}` : "",
|
|
217
|
+
getDefaultValue: () => ""
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// src/json-schema/type-definition/string.tsx
|
|
221
|
+
var import_react3 = __toESM(require("react"));
|
|
160
222
|
var stringRegistryCreator = () => ({
|
|
161
223
|
type: "string",
|
|
162
224
|
label: "String",
|
|
163
|
-
icon: /* @__PURE__ */
|
|
225
|
+
icon: /* @__PURE__ */ import_react3.default.createElement(
|
|
164
226
|
"svg",
|
|
165
227
|
{
|
|
166
228
|
width: "1em",
|
|
@@ -169,28 +231,28 @@ var stringRegistryCreator = () => ({
|
|
|
169
231
|
fill: "none",
|
|
170
232
|
xmlns: "http://www.w3.org/2000/svg"
|
|
171
233
|
},
|
|
172
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
173
235
|
"path",
|
|
174
236
|
{
|
|
175
237
|
d: "M9.3342 3.33321C8.96601 3.33321 8.66753 3.63169 8.66753 3.99988C8.66753 4.36807 8.96601 4.66655 9.3342 4.66655H14.6675C15.0357 4.66655 15.3342 4.36807 15.3342 3.99988C15.3342 3.63169 15.0357 3.33321 14.6675 3.33321H9.3342Z",
|
|
176
238
|
fill: "currentColor"
|
|
177
239
|
}
|
|
178
240
|
),
|
|
179
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
180
242
|
"path",
|
|
181
243
|
{
|
|
182
244
|
d: "M10.0009 7.99988C10.0009 7.63169 10.2993 7.33321 10.6675 7.33321H14.6675C15.0357 7.33321 15.3342 7.63169 15.3342 7.99988C15.3342 8.36807 15.0357 8.66655 14.6675 8.66655H10.6675C10.2993 8.66655 10.0009 8.36807 10.0009 7.99988Z",
|
|
183
245
|
fill: "currentColor"
|
|
184
246
|
}
|
|
185
247
|
),
|
|
186
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
187
249
|
"path",
|
|
188
250
|
{
|
|
189
251
|
d: "M12.0009 11.3332C11.6327 11.3332 11.3342 11.6317 11.3342 11.9999C11.3342 12.3681 11.6327 12.6665 12.0009 12.6665H14.6675C15.0357 12.6665 15.3342 12.3681 15.3342 11.9999C15.3342 11.6317 15.0357 11.3332 14.6675 11.3332H12.0009Z",
|
|
190
252
|
fill: "currentColor"
|
|
191
253
|
}
|
|
192
254
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
194
256
|
"path",
|
|
195
257
|
{
|
|
196
258
|
d: "M9.86659 14.1482L8.23444 10.1844H3.18136C3.13868 10.1844 3.09685 10.1808 3.05616 10.1738L1.66589 14.1129C1.53049 14.4965 1.10971 14.6978 0.726058 14.5624C0.342408 14.427 0.141166 14.0062 0.276572 13.6225L4.37566 2.00848C4.71323 1.05202 6.05321 1.01763 6.4394 1.95552L11.2289 13.5872C11.3838 13.9634 11.2044 14.394 10.8282 14.5489C10.452 14.7038 10.0215 14.5244 9.86659 14.1482ZM5.44412 3.40791L3.57241 8.71109H7.62778L5.44412 3.40791Z",
|
|
@@ -206,17 +268,17 @@ var stringRegistryCreator = () => ({
|
|
|
206
268
|
});
|
|
207
269
|
|
|
208
270
|
// src/json-schema/type-definition/object.tsx
|
|
209
|
-
var
|
|
271
|
+
var import_react4 = __toESM(require("react"));
|
|
210
272
|
var objectRegistryCreator = () => ({
|
|
211
273
|
type: "object",
|
|
212
274
|
label: "Object",
|
|
213
|
-
icon: /* @__PURE__ */
|
|
275
|
+
icon: /* @__PURE__ */ import_react4.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react4.default.createElement(
|
|
214
276
|
"path",
|
|
215
277
|
{
|
|
216
278
|
d: "M5.33893 1.5835C5.66613 1.5835 5.93137 1.88142 5.93137 2.20862C5.93137 2.53582 5.66613 2.76838 5.33893 2.76838H4.9099C4.34717 2.76838 4.08062 3.07557 4.08062 3.71921V6.58633C4.08062 7.30996 3.80723 7.84734 3.26798 8.19105C3.11426 8.28902 3.10884 8.55273 3.26068 8.65359C3.80476 9.01503 4.08062 9.53994 4.08062 10.2434V13.1251C4.08062 13.7395 4.34717 14.0613 4.9099 14.0613H5.33893C5.66613 14.0613 5.93137 14.3435 5.93137 14.6707C5.93137 14.9979 5.66613 15.2462 5.33893 15.2462H4.64335C3.99177 15.2462 3.48828 15.0268 3.13287 14.6172C2.80708 14.2369 2.64419 13.7103 2.64419 13.0666V10.3165C2.64419 9.8923 2.55534 9.58511 2.37764 9.39494C2.26816 9.27135 1.80618 9.17938 1.38154 9.11602C1.02726 9.06315 0.759057 8.76744 0.765747 8.4093C0.772379 8.0543 1.03439 7.7566 1.38545 7.70346C1.80778 7.63952 2.26906 7.54968 2.37764 7.43477C2.55534 7.22997 2.64419 6.92278 2.64419 6.51319V3.77772C2.64419 3.11945 2.80708 2.59284 3.13287 2.21251C3.48828 1.78829 3.99177 1.5835 4.64335 1.5835H5.33893Z",
|
|
217
279
|
fill: "currentColor"
|
|
218
280
|
}
|
|
219
|
-
), /* @__PURE__ */
|
|
281
|
+
), /* @__PURE__ */ import_react4.default.createElement(
|
|
220
282
|
"path",
|
|
221
283
|
{
|
|
222
284
|
d: "M10.962 15.2463C10.6348 15.2463 10.3696 14.9483 10.3696 14.6211C10.3696 14.2939 10.6348 14.0614 10.962 14.0614H11.391C11.9538 14.0614 12.2203 13.7542 12.2203 13.1105V10.2434C12.2203 9.51979 12.4937 8.98241 13.033 8.6387C13.1867 8.54073 13.1921 8.27703 13.0403 8.17616C12.4962 7.81472 12.2203 7.28982 12.2203 6.58638V3.70463C12.2203 3.09024 11.9538 2.76842 11.391 2.76842L10.962 2.76842C10.6348 2.76842 10.3696 2.48627 10.3696 2.15907C10.3696 1.83188 10.6348 1.58354 10.962 1.58354L11.6576 1.58354C12.3092 1.58354 12.8127 1.80296 13.1681 2.21255C13.4939 2.59289 13.6568 3.1195 13.6568 3.76314V6.51324C13.6568 6.93745 13.7456 7.24464 13.9233 7.43481C14.03 7.5553 14.4328 7.64858 14.8186 7.71393C15.1718 7.77376 15.4401 8.06977 15.4334 8.42791C15.4268 8.78291 15.1646 9.08018 14.814 9.13633C14.4306 9.19774 14.0291 9.28303 13.9233 9.39499C13.7456 9.59978 13.6568 9.90697 13.6568 10.3166V13.052C13.6568 13.7103 13.4939 14.2369 13.1681 14.6172C12.8127 15.0415 12.3092 15.2463 11.6576 15.2463H10.962Z",
|
|
@@ -238,24 +300,24 @@ var objectRegistryCreator = () => ({
|
|
|
238
300
|
});
|
|
239
301
|
|
|
240
302
|
// src/json-schema/type-definition/number.tsx
|
|
241
|
-
var
|
|
303
|
+
var import_react5 = __toESM(require("react"));
|
|
242
304
|
var numberRegistryCreator = () => ({
|
|
243
305
|
type: "number",
|
|
244
306
|
label: "Number",
|
|
245
307
|
extend: "integer",
|
|
246
|
-
icon: /* @__PURE__ */
|
|
308
|
+
icon: /* @__PURE__ */ import_react5.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react5.default.createElement(
|
|
247
309
|
"path",
|
|
248
310
|
{
|
|
249
311
|
d: "M3.44151 5.3068C3.44151 3.83404 4.71542 2.64014 6.18818 2.64014C7.66094 2.64014 8.93484 3.83404 8.93484 5.3068V10.6135C8.93484 12.0862 7.66094 13.2801 6.18818 13.2801C4.71542 13.2801 3.44151 12.0862 3.44151 10.6135V5.3068ZM7.60151 5.3068C7.60151 4.57042 6.92456 3.97347 6.18818 3.97347C5.4518 3.97347 4.77484 4.57042 4.77484 5.3068V10.6135C4.77484 11.3498 5.4518 11.9468 6.18818 11.9468C6.92456 11.9468 7.60151 11.3498 7.60151 10.6135V5.3068Z",
|
|
250
312
|
fill: "currentColor"
|
|
251
313
|
}
|
|
252
|
-
), /* @__PURE__ */
|
|
314
|
+
), /* @__PURE__ */ import_react5.default.createElement(
|
|
253
315
|
"path",
|
|
254
316
|
{
|
|
255
317
|
d: "M12.9882 2.64014C11.5154 2.64014 10.2415 3.83404 10.2415 5.3068V10.6135C10.2415 12.0862 11.5154 13.2801 12.9882 13.2801C14.4609 13.2801 15.7348 12.0862 15.7348 10.6135V5.3068C15.7348 3.83404 14.4609 2.64014 12.9882 2.64014ZM14.4015 10.6135C14.4015 11.3498 13.7246 11.9468 12.9882 11.9468C12.2518 11.9468 11.5748 11.3498 11.5748 10.6135V5.3068C11.5748 4.57042 12.2518 3.97347 12.9882 3.97347C13.7246 3.97347 14.4015 4.57042 14.4015 5.3068V10.6135Z",
|
|
256
318
|
fill: "currentColor"
|
|
257
319
|
}
|
|
258
|
-
), /* @__PURE__ */
|
|
320
|
+
), /* @__PURE__ */ import_react5.default.createElement(
|
|
259
321
|
"path",
|
|
260
322
|
{
|
|
261
323
|
d: "M1.21484 13.2001C1.76713 13.2001 2.21484 12.7524 2.21484 12.2001C2.21484 11.6479 1.76713 11.2001 1.21484 11.2001C0.662559 11.2001 0.214844 11.6479 0.214844 12.2001C0.214844 12.7524 0.662559 13.2001 1.21484 13.2001Z",
|
|
@@ -267,11 +329,11 @@ var numberRegistryCreator = () => ({
|
|
|
267
329
|
});
|
|
268
330
|
|
|
269
331
|
// src/json-schema/type-definition/boolean.tsx
|
|
270
|
-
var
|
|
332
|
+
var import_react6 = __toESM(require("react"));
|
|
271
333
|
var booleanRegistryCreator = () => ({
|
|
272
334
|
type: "boolean",
|
|
273
335
|
label: "Boolean",
|
|
274
|
-
icon: /* @__PURE__ */
|
|
336
|
+
icon: /* @__PURE__ */ import_react6.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react6.default.createElement(
|
|
275
337
|
"path",
|
|
276
338
|
{
|
|
277
339
|
fillRule: "evenodd",
|
|
@@ -279,7 +341,7 @@ var booleanRegistryCreator = () => ({
|
|
|
279
341
|
d: "M10.668 4.66683H5.33463C3.49369 4.66683 2.0013 6.15921 2.0013 8.00016C2.0013 9.84111 3.49369 11.3335 5.33463 11.3335H10.668C12.5089 11.3335 14.0013 9.84111 14.0013 8.00016C14.0013 6.15921 12.5089 4.66683 10.668 4.66683ZM5.33463 3.3335C2.75731 3.3335 0.667969 5.42283 0.667969 8.00016C0.667969 10.5775 2.75731 12.6668 5.33463 12.6668H10.668C13.2453 12.6668 15.3346 10.5775 15.3346 8.00016C15.3346 5.42283 13.2453 3.3335 10.668 3.3335H5.33463Z",
|
|
280
342
|
fill: "currentColor"
|
|
281
343
|
}
|
|
282
|
-
), /* @__PURE__ */
|
|
344
|
+
), /* @__PURE__ */ import_react6.default.createElement(
|
|
283
345
|
"path",
|
|
284
346
|
{
|
|
285
347
|
fillRule: "evenodd",
|
|
@@ -294,15 +356,15 @@ var booleanRegistryCreator = () => ({
|
|
|
294
356
|
});
|
|
295
357
|
|
|
296
358
|
// src/json-schema/type-definition/array.tsx
|
|
297
|
-
var
|
|
359
|
+
var import_react7 = __toESM(require("react"));
|
|
298
360
|
var arrayRegistryCreator = ({ typeManager }) => {
|
|
299
|
-
const icon = /* @__PURE__ */
|
|
361
|
+
const icon = /* @__PURE__ */ import_react7.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
300
362
|
"path",
|
|
301
363
|
{
|
|
302
364
|
d: "M5.23759 1.00342H2.00391V14.997H5.23759V13.6251H3.35127V2.37534H5.23759V1.00342Z",
|
|
303
365
|
fill: "currentColor"
|
|
304
366
|
}
|
|
305
|
-
), /* @__PURE__ */
|
|
367
|
+
), /* @__PURE__ */ import_react7.default.createElement(
|
|
306
368
|
"path",
|
|
307
369
|
{
|
|
308
370
|
d: "M10.7624 1.00342H13.9961V14.997H10.7624V13.6251H12.6487V2.37534H10.7624V1.00342Z",
|
|
@@ -314,7 +376,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
314
376
|
const config = typeManager.getTypeBySchema(item);
|
|
315
377
|
switch (config?.type) {
|
|
316
378
|
case "object":
|
|
317
|
-
return /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
318
380
|
"svg",
|
|
319
381
|
{
|
|
320
382
|
width: "16",
|
|
@@ -323,7 +385,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
323
385
|
fill: "none",
|
|
324
386
|
xmlns: "http://www.w3.org/2000/svg"
|
|
325
387
|
},
|
|
326
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
327
389
|
"path",
|
|
328
390
|
{
|
|
329
391
|
fillRule: "evenodd",
|
|
@@ -334,7 +396,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
334
396
|
)
|
|
335
397
|
);
|
|
336
398
|
case "string": {
|
|
337
|
-
return /* @__PURE__ */
|
|
399
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
338
400
|
"svg",
|
|
339
401
|
{
|
|
340
402
|
width: "16",
|
|
@@ -343,7 +405,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
343
405
|
fill: "none",
|
|
344
406
|
xmlns: "http://www.w3.org/2000/svg"
|
|
345
407
|
},
|
|
346
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
347
409
|
"path",
|
|
348
410
|
{
|
|
349
411
|
fillRule: "evenodd",
|
|
@@ -355,7 +417,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
355
417
|
);
|
|
356
418
|
}
|
|
357
419
|
case "enum": {
|
|
358
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
359
421
|
"svg",
|
|
360
422
|
{
|
|
361
423
|
width: "16",
|
|
@@ -364,7 +426,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
364
426
|
fill: "none",
|
|
365
427
|
xmlns: "http://www.w3.org/2000/svg"
|
|
366
428
|
},
|
|
367
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
368
430
|
"path",
|
|
369
431
|
{
|
|
370
432
|
fillRule: "evenodd",
|
|
@@ -373,7 +435,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
373
435
|
fill: "currentColor"
|
|
374
436
|
}
|
|
375
437
|
),
|
|
376
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
377
439
|
"path",
|
|
378
440
|
{
|
|
379
441
|
d: "M6.01442 7.34421C5.89401 7.46462 5.89401 7.65985 6.01442 7.78026L7.78218 9.54802C7.9026 9.66844 8.09782 9.66844 8.21823 9.54802L9.986 7.78026C10.1064 7.65985 10.1064 7.46462 9.986 7.34421L9.69137 7.04958C9.57096 6.92917 9.37573 6.92917 9.25532 7.04958L8.00021 8.3047L6.74509 7.04958C6.62468 6.92917 6.42946 6.92917 6.30904 7.04958L6.01442 7.34421ZM3.31699 7.99984C3.31699 10.5864 5.41379 12.6832 8.00033 12.6832C10.5869 12.6832 12.6837 10.5864 12.6837 7.99984C12.6837 5.4133 10.5869 3.3165 8.00033 3.3165C5.41379 3.3165 3.31699 5.4133 3.31699 7.99984ZM11.6503 7.99984C11.6503 10.0157 10.0162 11.6498 8.00033 11.6498C5.98449 11.6498 4.35033 10.0157 4.35033 7.99984C4.35033 5.984 5.98449 4.34984 8.00033 4.34984C10.0162 4.34984 11.6503 5.984 11.6503 7.99984Z",
|
|
@@ -385,7 +447,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
385
447
|
);
|
|
386
448
|
}
|
|
387
449
|
case "integer": {
|
|
388
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
389
451
|
"svg",
|
|
390
452
|
{
|
|
391
453
|
width: "16",
|
|
@@ -394,7 +456,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
394
456
|
fill: "none",
|
|
395
457
|
xmlns: "http://www.w3.org/2000/svg"
|
|
396
458
|
},
|
|
397
|
-
/* @__PURE__ */
|
|
459
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
398
460
|
"path",
|
|
399
461
|
{
|
|
400
462
|
fillRule: "evenodd",
|
|
@@ -406,7 +468,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
406
468
|
);
|
|
407
469
|
}
|
|
408
470
|
case "number": {
|
|
409
|
-
return /* @__PURE__ */
|
|
471
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
410
472
|
"svg",
|
|
411
473
|
{
|
|
412
474
|
width: "16",
|
|
@@ -415,7 +477,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
415
477
|
fill: "none",
|
|
416
478
|
xmlns: "http://www.w3.org/2000/svg"
|
|
417
479
|
},
|
|
418
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
419
481
|
"path",
|
|
420
482
|
{
|
|
421
483
|
fillRule: "evenodd",
|
|
@@ -427,7 +489,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
427
489
|
);
|
|
428
490
|
}
|
|
429
491
|
case "boolean":
|
|
430
|
-
return /* @__PURE__ */
|
|
492
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
431
493
|
"svg",
|
|
432
494
|
{
|
|
433
495
|
width: "16",
|
|
@@ -436,7 +498,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
436
498
|
fill: "none",
|
|
437
499
|
xmlns: "http://www.w3.org/2000/svg"
|
|
438
500
|
},
|
|
439
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
440
502
|
"path",
|
|
441
503
|
{
|
|
442
504
|
fillRule: "evenodd",
|
|
@@ -448,7 +510,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
448
510
|
);
|
|
449
511
|
case "stream":
|
|
450
512
|
case "map": {
|
|
451
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
452
514
|
"svg",
|
|
453
515
|
{
|
|
454
516
|
width: "16",
|
|
@@ -457,7 +519,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
457
519
|
fill: "none",
|
|
458
520
|
xmlns: "http://www.w3.org/2000/svg"
|
|
459
521
|
},
|
|
460
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
461
523
|
"path",
|
|
462
524
|
{
|
|
463
525
|
fillRule: "evenodd",
|
|
@@ -466,7 +528,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
466
528
|
fill: "currentColor"
|
|
467
529
|
}
|
|
468
530
|
),
|
|
469
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
470
532
|
"path",
|
|
471
533
|
{
|
|
472
534
|
fillRule: "evenodd",
|
|
@@ -475,7 +537,7 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
475
537
|
fill: "currentColor"
|
|
476
538
|
}
|
|
477
539
|
),
|
|
478
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
479
541
|
"path",
|
|
480
542
|
{
|
|
481
543
|
fillRule: "evenodd",
|
|
@@ -557,23 +619,23 @@ var arrayRegistryCreator = ({ typeManager }) => {
|
|
|
557
619
|
};
|
|
558
620
|
|
|
559
621
|
// src/json-schema/type-definition/integer.tsx
|
|
560
|
-
var
|
|
622
|
+
var import_react8 = __toESM(require("react"));
|
|
561
623
|
var integerRegistryCreator = () => ({
|
|
562
624
|
type: "integer",
|
|
563
625
|
label: "Integer",
|
|
564
|
-
icon: /* @__PURE__ */
|
|
626
|
+
icon: /* @__PURE__ */ import_react8.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
565
627
|
"path",
|
|
566
628
|
{
|
|
567
629
|
d: "M15.132 11.4601C15.644 11.0121 15.9 10.3921 15.9 9.60007C15.9 8.60807 15.5 7.93607 14.7 7.58407C15.412 7.23207 15.768 6.62407 15.768 5.76007C15.768 5.05607 15.536 4.48007 15.072 4.03207C14.608 3.59207 14.012 3.37207 13.284 3.37207C12.588 3.37207 12.008 3.58007 11.544 3.99607C11.064 4.42007 10.808 4.98807 10.776 5.70007H12C12.064 4.88407 12.492 4.47607 13.284 4.47607C14.124 4.47607 14.544 4.91607 14.544 5.79607C14.544 6.66007 14.112 7.09207 13.248 7.09207H13.044V8.16007H13.248C14.2 8.16007 14.676 8.62807 14.676 9.56407C14.676 10.5081 14.212 10.9801 13.284 10.9801C12.9 10.9801 12.584 10.8761 12.336 10.6681C12.064 10.4441 11.916 10.1161 11.892 9.68407H10.668C10.692 10.4761 10.964 11.0841 11.484 11.5081C11.948 11.8921 12.548 12.0841 13.284 12.0841C14.036 12.0841 14.652 11.8761 15.132 11.4601Z",
|
|
568
630
|
fill: "currentColor"
|
|
569
631
|
}
|
|
570
|
-
), /* @__PURE__ */
|
|
632
|
+
), /* @__PURE__ */ import_react8.default.createElement(
|
|
571
633
|
"path",
|
|
572
634
|
{
|
|
573
635
|
d: "M4.46875 12.0003V10.9083L7.75675 6.91228C8.06075 6.54428 8.21275 6.16428 8.21275 5.77228C8.21275 4.90828 7.79675 4.47628 6.96475 4.47628C6.60475 4.47628 6.31275 4.57628 6.08875 4.77628C5.83275 5.00828 5.70475 5.34828 5.70475 5.79628H4.48075C4.48075 5.07628 4.71275 4.49228 5.17675 4.04428C5.64075 3.60428 6.23675 3.38428 6.96475 3.38428C7.70075 3.38428 8.29675 3.60028 8.75275 4.03228C9.20875 4.47228 9.43675 5.05628 9.43675 5.78428C9.43675 6.13628 9.36875 6.45628 9.23275 6.74428C9.12075 6.97628 8.92075 7.27228 8.63275 7.63228L5.95675 10.9083H9.43675V12.0003H4.46875Z",
|
|
574
636
|
fill: "currentColor"
|
|
575
637
|
}
|
|
576
|
-
), /* @__PURE__ */
|
|
638
|
+
), /* @__PURE__ */ import_react8.default.createElement(
|
|
577
639
|
"path",
|
|
578
640
|
{
|
|
579
641
|
d: "M1.668 12.0001V4.78805L0 6.25205V4.89605L1.668 3.45605H2.892V12.0001H1.668Z",
|
|
@@ -586,12 +648,12 @@ var integerRegistryCreator = () => ({
|
|
|
586
648
|
});
|
|
587
649
|
|
|
588
650
|
// src/json-schema/type-definition/unknown.tsx
|
|
589
|
-
var
|
|
651
|
+
var import_react9 = __toESM(require("react"));
|
|
590
652
|
var unknownRegistryCreator = () => ({
|
|
591
653
|
type: "unknown",
|
|
592
654
|
label: "Unknown",
|
|
593
655
|
parentType: [],
|
|
594
|
-
icon: /* @__PURE__ */
|
|
656
|
+
icon: /* @__PURE__ */ import_react9.default.createElement(
|
|
595
657
|
"svg",
|
|
596
658
|
{
|
|
597
659
|
viewBox: "0 0 24 24",
|
|
@@ -602,7 +664,7 @@ var unknownRegistryCreator = () => ({
|
|
|
602
664
|
focusable: "false",
|
|
603
665
|
"aria-hidden": "true"
|
|
604
666
|
},
|
|
605
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ import_react9.default.createElement(
|
|
606
668
|
"path",
|
|
607
669
|
{
|
|
608
670
|
fillRule: "evenodd",
|
|
@@ -611,7 +673,7 @@ var unknownRegistryCreator = () => ({
|
|
|
611
673
|
fill: "currentColor"
|
|
612
674
|
}
|
|
613
675
|
),
|
|
614
|
-
/* @__PURE__ */
|
|
676
|
+
/* @__PURE__ */ import_react9.default.createElement(
|
|
615
677
|
"path",
|
|
616
678
|
{
|
|
617
679
|
fillRule: "evenodd",
|
|
@@ -620,7 +682,7 @@ var unknownRegistryCreator = () => ({
|
|
|
620
682
|
fill: "currentColor"
|
|
621
683
|
}
|
|
622
684
|
),
|
|
623
|
-
/* @__PURE__ */
|
|
685
|
+
/* @__PURE__ */ import_react9.default.createElement(
|
|
624
686
|
"path",
|
|
625
687
|
{
|
|
626
688
|
fillRule: "evenodd",
|
|
@@ -635,9 +697,9 @@ var unknownRegistryCreator = () => ({
|
|
|
635
697
|
});
|
|
636
698
|
|
|
637
699
|
// src/json-schema/type-definition/map.tsx
|
|
638
|
-
var
|
|
700
|
+
var import_react10 = __toESM(require("react"));
|
|
639
701
|
var mapRegistryCreator = ({ typeManager }) => {
|
|
640
|
-
const icon = /* @__PURE__ */
|
|
702
|
+
const icon = /* @__PURE__ */ import_react10.default.createElement(
|
|
641
703
|
"svg",
|
|
642
704
|
{
|
|
643
705
|
viewBox: "0 0 1024 1024",
|
|
@@ -646,14 +708,14 @@ var mapRegistryCreator = ({ typeManager }) => {
|
|
|
646
708
|
width: "16",
|
|
647
709
|
height: "16"
|
|
648
710
|
},
|
|
649
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ import_react10.default.createElement(
|
|
650
712
|
"path",
|
|
651
713
|
{
|
|
652
714
|
d: "M877.860571 938.642286h-645.851428c-27.574857 0-54.052571-11.337143-73.508572-31.744a110.957714 110.957714 0 0 1-30.500571-76.8V193.828571c0-28.745143 10.971429-56.32 30.500571-76.726857a101.888 101.888 0 0 1 73.508572-31.817143h574.171428c27.501714 0 53.979429 11.337143 73.508572 31.744 19.529143 20.333714 30.500571 48.054857 30.500571 76.8v522.020572a34.157714 34.157714 0 0 1-6.948571 22.820571c-37.156571 19.382857-57.636571 39.350857-57.636572 72.630857 0 39.716571 19.894857 50.029714 57.636572 72.777143a34.816 34.816 0 0 1-8.045714 49.298286 32.256 32.256 0 0 1-17.334858 5.193143z m-32.256-254.537143V193.828571a40.228571 40.228571 0 0 0-39.497142-41.179428H232.009143a40.301714 40.301714 0 0 0-39.497143 41.252571V699.245714c17.773714-9.874286 37.449143-14.994286 57.417143-14.921143h595.675428v-0.073142z m-595.675428 187.245714h566.198857c-22.893714-11.190857-27.940571-39.497143-28.013714-59.977143 0-20.260571 3.218286-43.885714 28.013714-59.904h-566.125714c-31.670857 0-57.417143 26.843429-57.417143 59.977143 0 33.060571 25.746286 59.904 57.344 59.904z",
|
|
653
715
|
fill: "currentColor"
|
|
654
716
|
}
|
|
655
717
|
),
|
|
656
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ import_react10.default.createElement(
|
|
657
719
|
"path",
|
|
658
720
|
{
|
|
659
721
|
d: "M320 128m32.036571 0l-0.073142 0q32.036571 0 32.036571 32.036571l0 511.926858q0 32.036571-32.036571 32.036571l0.073142 0q-32.036571 0-32.036571-32.036571l0-511.926858q0-32.036571 32.036571-32.036571Z",
|
|
@@ -767,7 +829,7 @@ var JsonSchemaTypeManager = class extends BaseTypeManager {
|
|
|
767
829
|
};
|
|
768
830
|
this.getDisplayIcon = (type) => {
|
|
769
831
|
const registry = this.getTypeBySchema(type);
|
|
770
|
-
return registry?.getDisplayIcon(type) || registry?.icon || /* @__PURE__ */
|
|
832
|
+
return registry?.getDisplayIcon(type) || registry?.icon || /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null);
|
|
771
833
|
};
|
|
772
834
|
this.getTypeSchemaProperties = (type) => {
|
|
773
835
|
const registry = this.getTypeBySchema(type);
|
|
@@ -798,7 +860,8 @@ var JsonSchemaTypeManager = class extends BaseTypeManager {
|
|
|
798
860
|
objectRegistryCreator,
|
|
799
861
|
arrayRegistryCreator,
|
|
800
862
|
unknownRegistryCreator,
|
|
801
|
-
mapRegistryCreator
|
|
863
|
+
mapRegistryCreator,
|
|
864
|
+
dateTimeRegistryCreator
|
|
802
865
|
];
|
|
803
866
|
registries.forEach((registry) => {
|
|
804
867
|
this.register(
|
|
@@ -818,6 +881,9 @@ var JsonSchemaTypeManager = class extends BaseTypeManager {
|
|
|
818
881
|
if (typeSchema.enum) {
|
|
819
882
|
return "enum";
|
|
820
883
|
}
|
|
884
|
+
if (typeSchema.format && typeSchema.type === "string") {
|
|
885
|
+
return typeSchema.format;
|
|
886
|
+
}
|
|
821
887
|
return typeSchema.type || typeSchema.$ref || "unknown";
|
|
822
888
|
}
|
|
823
889
|
};
|
|
@@ -826,7 +892,7 @@ JsonSchemaTypeManager = __decorateClass([
|
|
|
826
892
|
], JsonSchemaTypeManager);
|
|
827
893
|
|
|
828
894
|
// src/json-schema/utils.ts
|
|
829
|
-
var
|
|
895
|
+
var import_lodash_es = require("lodash-es");
|
|
830
896
|
var import_variable_core = require("@flowgram.ai/variable-core");
|
|
831
897
|
var JsonSchemaUtils;
|
|
832
898
|
((JsonSchemaUtils2) => {
|
|
@@ -842,7 +908,7 @@ var JsonSchemaUtils;
|
|
|
842
908
|
return { kind: import_variable_core.ASTKind.Object, weak: true };
|
|
843
909
|
}
|
|
844
910
|
return import_variable_core.ASTFactory.createObject({
|
|
845
|
-
properties: Object.entries(jsonSchema.properties || {}).sort((a, b) => ((0,
|
|
911
|
+
properties: Object.entries(jsonSchema.properties || {}).sort((a, b) => ((0, import_lodash_es.get)(a?.[1], "extra.index") || 0) - ((0, import_lodash_es.get)(b?.[1], "extra.index") || 0)).map(([key, _property]) => ({
|
|
846
912
|
key,
|
|
847
913
|
type: schemaToAST(_property),
|
|
848
914
|
meta: {
|
|
@@ -868,7 +934,7 @@ var JsonSchemaUtils;
|
|
|
868
934
|
valueType: schemaToAST(jsonSchema.additionalProperties)
|
|
869
935
|
});
|
|
870
936
|
case "string":
|
|
871
|
-
return import_variable_core.ASTFactory.createString();
|
|
937
|
+
return import_variable_core.ASTFactory.createString({ format: jsonSchema.format });
|
|
872
938
|
case "number":
|
|
873
939
|
return import_variable_core.ASTFactory.createNumber();
|
|
874
940
|
case "boolean":
|
|
@@ -892,7 +958,8 @@ var JsonSchemaUtils;
|
|
|
892
958
|
}
|
|
893
959
|
if (import_variable_core.ASTMatch.isString(typeAST)) {
|
|
894
960
|
return {
|
|
895
|
-
type: "string"
|
|
961
|
+
type: "string",
|
|
962
|
+
format: typeAST.format
|
|
896
963
|
};
|
|
897
964
|
}
|
|
898
965
|
if (import_variable_core.ASTMatch.isBoolean(typeAST)) {
|
|
@@ -968,11 +1035,11 @@ var JsonSchemaUtils;
|
|
|
968
1035
|
var jsonSchemaTypeManager = new JsonSchemaTypeManager();
|
|
969
1036
|
|
|
970
1037
|
// src/context.tsx
|
|
971
|
-
var
|
|
1038
|
+
var import_react12 = __toESM(require("react"));
|
|
972
1039
|
var import_core = require("@flowgram.ai/core");
|
|
973
|
-
var TypePresetContext = (0,
|
|
1040
|
+
var TypePresetContext = (0, import_react12.createContext)(null);
|
|
974
1041
|
var useTypeManager = () => {
|
|
975
|
-
const typeManagerFromContext = (0,
|
|
1042
|
+
const typeManagerFromContext = (0, import_react12.useContext)(TypePresetContext);
|
|
976
1043
|
const container = (0, import_core.usePlaygroundContainer)();
|
|
977
1044
|
if (typeManagerFromContext) {
|
|
978
1045
|
return typeManagerFromContext;
|
|
@@ -986,12 +1053,12 @@ var TypePresetProvider = ({
|
|
|
986
1053
|
children,
|
|
987
1054
|
types
|
|
988
1055
|
}) => {
|
|
989
|
-
const schemaManager = (0,
|
|
1056
|
+
const schemaManager = (0, import_react12.useMemo)(() => {
|
|
990
1057
|
const typeManager = new JsonSchemaTypeManager();
|
|
991
1058
|
types.forEach((_type) => typeManager.register(_type));
|
|
992
1059
|
return typeManager;
|
|
993
1060
|
}, [...types]);
|
|
994
|
-
return /* @__PURE__ */
|
|
1061
|
+
return /* @__PURE__ */ import_react12.default.createElement(TypePresetContext.Provider, { value: schemaManager }, children);
|
|
995
1062
|
};
|
|
996
1063
|
|
|
997
1064
|
// src/container-module.tsx
|