json-schema-builder-react 0.0.7 → 0.0.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/README.md +9 -5
- package/dist-lib/components/PropertyEditDialog.d.ts +14 -13
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.d.ts +0 -1
- package/dist-lib/index.js +592 -533
- package/dist-lib/index.js.map +1 -1
- package/package.json +12 -13
package/dist-lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as e, jsxs as s, Fragment as
|
|
2
|
-
import * as
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Slot as
|
|
5
|
-
import { cva as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import { ChevronDown as ee, Check as
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
|
+
import { useContext as Ie, createContext as Se, useState as P, useEffect as Z, useMemo as Te, useCallback as E } from "react";
|
|
4
|
+
import { Slot as De } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva as oe } from "class-variance-authority";
|
|
6
|
+
import { clsx as je } from "clsx";
|
|
7
|
+
import { twMerge as qe } from "tailwind-merge";
|
|
8
|
+
import { ChevronDown as ee, Check as ce, ChevronUp as Le, X as Pe, Asterisk as se, Type as Oe, Hash as re, CheckSquare as Re, Braces as Ee, List as Fe, FileText as ze, Plus as B, Pencil as Ae, Trash2 as me, CheckCircle2 as Be, Copy as Me, Download as $e, ChevronRight as Ke, Moon as Je, Sun as Ve, Upload as He } from "lucide-react";
|
|
9
9
|
import * as F from "@radix-ui/react-tooltip";
|
|
10
10
|
import * as w from "@radix-ui/react-select";
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
11
|
+
import * as L from "@radix-ui/react-dialog";
|
|
12
|
+
import * as ue from "@radix-ui/react-label";
|
|
13
13
|
import * as V from "@radix-ui/react-checkbox";
|
|
14
|
-
function
|
|
15
|
-
return je(
|
|
14
|
+
function h(...t) {
|
|
15
|
+
return qe(je(t));
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const _e = oe(
|
|
18
18
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
19
19
|
{
|
|
20
20
|
variants: {
|
|
@@ -38,50 +38,50 @@ const He = de(
|
|
|
38
38
|
size: "default"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
),
|
|
42
|
-
({ className: t, variant: i, size: a, asChild:
|
|
43
|
-
|
|
41
|
+
), I = b.forwardRef(
|
|
42
|
+
({ className: t, variant: i, size: a, asChild: l = !1, ...n }, d) => /* @__PURE__ */ e(
|
|
43
|
+
l ? De : "button",
|
|
44
44
|
{
|
|
45
|
-
className:
|
|
46
|
-
ref:
|
|
45
|
+
className: h(_e({ variant: i, size: a, className: t })),
|
|
46
|
+
ref: d,
|
|
47
47
|
...n
|
|
48
48
|
}
|
|
49
49
|
)
|
|
50
50
|
);
|
|
51
|
-
|
|
52
|
-
const D =
|
|
53
|
-
({ className: t, type: i, ...a },
|
|
51
|
+
I.displayName = "Button";
|
|
52
|
+
const D = b.forwardRef(
|
|
53
|
+
({ className: t, type: i, ...a }, l) => /* @__PURE__ */ e(
|
|
54
54
|
"input",
|
|
55
55
|
{
|
|
56
56
|
type: i,
|
|
57
|
-
className:
|
|
57
|
+
className: h(
|
|
58
58
|
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
59
59
|
t
|
|
60
60
|
),
|
|
61
|
-
ref:
|
|
61
|
+
ref: l,
|
|
62
62
|
...a
|
|
63
63
|
}
|
|
64
64
|
)
|
|
65
65
|
);
|
|
66
66
|
D.displayName = "Input";
|
|
67
|
-
const
|
|
67
|
+
const Ue = F.Provider, Xe = F.Root, Ge = F.Trigger, he = b.forwardRef(({ className: t, sideOffset: i = 4, ...a }, l) => /* @__PURE__ */ e(F.Portal, { children: /* @__PURE__ */ e(
|
|
68
68
|
F.Content,
|
|
69
69
|
{
|
|
70
|
-
ref:
|
|
70
|
+
ref: l,
|
|
71
71
|
sideOffset: i,
|
|
72
|
-
className:
|
|
72
|
+
className: h(
|
|
73
73
|
"z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
74
74
|
t
|
|
75
75
|
),
|
|
76
76
|
...a
|
|
77
77
|
}
|
|
78
78
|
) }));
|
|
79
|
-
|
|
80
|
-
const H = w.Root, _ = w.Value, $ =
|
|
79
|
+
he.displayName = F.Content.displayName;
|
|
80
|
+
const H = w.Root, _ = w.Value, $ = b.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
|
|
81
81
|
w.Trigger,
|
|
82
82
|
{
|
|
83
|
-
ref:
|
|
84
|
-
className:
|
|
83
|
+
ref: l,
|
|
84
|
+
className: h(
|
|
85
85
|
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
86
86
|
t
|
|
87
87
|
),
|
|
@@ -93,24 +93,24 @@ const H = w.Root, _ = w.Value, $ = y.forwardRef(({ className: t, children: i, ..
|
|
|
93
93
|
}
|
|
94
94
|
));
|
|
95
95
|
$.displayName = w.Trigger.displayName;
|
|
96
|
-
const
|
|
96
|
+
const fe = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
97
97
|
w.ScrollUpButton,
|
|
98
98
|
{
|
|
99
99
|
ref: a,
|
|
100
|
-
className:
|
|
100
|
+
className: h(
|
|
101
101
|
"flex cursor-default items-center justify-center py-1",
|
|
102
102
|
t
|
|
103
103
|
),
|
|
104
104
|
...i,
|
|
105
|
-
children: /* @__PURE__ */ e(
|
|
105
|
+
children: /* @__PURE__ */ e(Le, { className: "h-4 w-4" })
|
|
106
106
|
}
|
|
107
107
|
));
|
|
108
|
-
|
|
109
|
-
const
|
|
108
|
+
fe.displayName = w.ScrollUpButton.displayName;
|
|
109
|
+
const pe = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
110
110
|
w.ScrollDownButton,
|
|
111
111
|
{
|
|
112
112
|
ref: a,
|
|
113
|
-
className:
|
|
113
|
+
className: h(
|
|
114
114
|
"flex cursor-default items-center justify-center py-1",
|
|
115
115
|
t
|
|
116
116
|
),
|
|
@@ -118,168 +118,168 @@ const fe = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
|
118
118
|
children: /* @__PURE__ */ e(ee, { className: "h-4 w-4" })
|
|
119
119
|
}
|
|
120
120
|
));
|
|
121
|
-
|
|
122
|
-
const K =
|
|
121
|
+
pe.displayName = w.ScrollDownButton.displayName;
|
|
122
|
+
const K = b.forwardRef(({ className: t, children: i, position: a = "popper", ...l }, n) => /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ s(
|
|
123
123
|
w.Content,
|
|
124
124
|
{
|
|
125
125
|
ref: n,
|
|
126
|
-
className:
|
|
126
|
+
className: h(
|
|
127
127
|
"relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
|
|
128
128
|
a === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
129
129
|
t
|
|
130
130
|
),
|
|
131
131
|
position: a,
|
|
132
|
-
...
|
|
132
|
+
...l,
|
|
133
133
|
children: [
|
|
134
|
-
/* @__PURE__ */ e(
|
|
134
|
+
/* @__PURE__ */ e(fe, {}),
|
|
135
135
|
/* @__PURE__ */ e(
|
|
136
136
|
w.Viewport,
|
|
137
137
|
{
|
|
138
|
-
className:
|
|
138
|
+
className: h(
|
|
139
139
|
"p-1",
|
|
140
140
|
a === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
141
141
|
),
|
|
142
142
|
children: i
|
|
143
143
|
}
|
|
144
144
|
),
|
|
145
|
-
/* @__PURE__ */ e(
|
|
145
|
+
/* @__PURE__ */ e(pe, {})
|
|
146
146
|
]
|
|
147
147
|
}
|
|
148
148
|
) }));
|
|
149
149
|
K.displayName = w.Content.displayName;
|
|
150
|
-
const
|
|
150
|
+
const Qe = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
151
151
|
w.Label,
|
|
152
152
|
{
|
|
153
153
|
ref: a,
|
|
154
|
-
className:
|
|
154
|
+
className: h("px-2 py-1.5 text-sm font-semibold", t),
|
|
155
155
|
...i
|
|
156
156
|
}
|
|
157
157
|
));
|
|
158
|
-
|
|
159
|
-
const
|
|
158
|
+
Qe.displayName = w.Label.displayName;
|
|
159
|
+
const C = b.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
|
|
160
160
|
w.Item,
|
|
161
161
|
{
|
|
162
|
-
ref:
|
|
163
|
-
className:
|
|
162
|
+
ref: l,
|
|
163
|
+
className: h(
|
|
164
164
|
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
165
165
|
t
|
|
166
166
|
),
|
|
167
167
|
...a,
|
|
168
168
|
children: [
|
|
169
|
-
/* @__PURE__ */ e("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(w.ItemIndicator, { children: /* @__PURE__ */ e(
|
|
169
|
+
/* @__PURE__ */ e("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(w.ItemIndicator, { children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" }) }) }),
|
|
170
170
|
/* @__PURE__ */ e(w.ItemText, { children: i })
|
|
171
171
|
]
|
|
172
172
|
}
|
|
173
173
|
));
|
|
174
|
-
|
|
175
|
-
const
|
|
174
|
+
C.displayName = w.Item.displayName;
|
|
175
|
+
const We = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
176
176
|
w.Separator,
|
|
177
177
|
{
|
|
178
178
|
ref: a,
|
|
179
|
-
className:
|
|
179
|
+
className: h("-mx-1 my-1 h-px bg-muted", t),
|
|
180
180
|
...i
|
|
181
181
|
}
|
|
182
182
|
));
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
|
|
183
|
+
We.displayName = w.Separator.displayName;
|
|
184
|
+
const Ye = L.Root, Ze = L.Portal, ge = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
185
|
+
L.Overlay,
|
|
186
186
|
{
|
|
187
187
|
ref: a,
|
|
188
|
-
className:
|
|
188
|
+
className: h(
|
|
189
189
|
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
190
190
|
t
|
|
191
191
|
),
|
|
192
192
|
...i
|
|
193
193
|
}
|
|
194
194
|
));
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
/* @__PURE__ */ e(
|
|
195
|
+
ge.displayName = L.Overlay.displayName;
|
|
196
|
+
const ve = b.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(Ze, { children: [
|
|
197
|
+
/* @__PURE__ */ e(ge, {}),
|
|
198
198
|
/* @__PURE__ */ s(
|
|
199
|
-
|
|
199
|
+
L.Content,
|
|
200
200
|
{
|
|
201
|
-
ref:
|
|
202
|
-
className:
|
|
201
|
+
ref: l,
|
|
202
|
+
className: h(
|
|
203
203
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
204
204
|
t
|
|
205
205
|
),
|
|
206
206
|
...a,
|
|
207
207
|
children: [
|
|
208
208
|
i,
|
|
209
|
-
/* @__PURE__ */ s(
|
|
210
|
-
/* @__PURE__ */ e(
|
|
209
|
+
/* @__PURE__ */ s(L.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
210
|
+
/* @__PURE__ */ e(Pe, { className: "h-4 w-4" }),
|
|
211
211
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
|
|
212
212
|
] })
|
|
213
213
|
]
|
|
214
214
|
}
|
|
215
215
|
)
|
|
216
216
|
] }));
|
|
217
|
-
|
|
218
|
-
const
|
|
217
|
+
ve.displayName = L.Content.displayName;
|
|
218
|
+
const ye = ({
|
|
219
219
|
className: t,
|
|
220
220
|
...i
|
|
221
221
|
}) => /* @__PURE__ */ e(
|
|
222
222
|
"div",
|
|
223
223
|
{
|
|
224
|
-
className:
|
|
224
|
+
className: h(
|
|
225
225
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
226
226
|
t
|
|
227
227
|
),
|
|
228
228
|
...i
|
|
229
229
|
}
|
|
230
230
|
);
|
|
231
|
-
|
|
232
|
-
const
|
|
231
|
+
ye.displayName = "DialogHeader";
|
|
232
|
+
const xe = ({
|
|
233
233
|
className: t,
|
|
234
234
|
...i
|
|
235
235
|
}) => /* @__PURE__ */ e(
|
|
236
236
|
"div",
|
|
237
237
|
{
|
|
238
|
-
className:
|
|
238
|
+
className: h(
|
|
239
239
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
240
240
|
t
|
|
241
241
|
),
|
|
242
242
|
...i
|
|
243
243
|
}
|
|
244
244
|
);
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
245
|
+
xe.displayName = "DialogFooter";
|
|
246
|
+
const be = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
247
|
+
L.Title,
|
|
248
248
|
{
|
|
249
249
|
ref: a,
|
|
250
|
-
className:
|
|
250
|
+
className: h(
|
|
251
251
|
"text-lg font-semibold leading-none tracking-tight",
|
|
252
252
|
t
|
|
253
253
|
),
|
|
254
254
|
...i
|
|
255
255
|
}
|
|
256
256
|
));
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
|
|
257
|
+
be.displayName = L.Title.displayName;
|
|
258
|
+
const et = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
259
|
+
L.Description,
|
|
260
260
|
{
|
|
261
261
|
ref: a,
|
|
262
|
-
className:
|
|
262
|
+
className: h("text-sm text-muted-foreground", t),
|
|
263
263
|
...i
|
|
264
264
|
}
|
|
265
265
|
));
|
|
266
|
-
|
|
267
|
-
const
|
|
266
|
+
et.displayName = L.Description.displayName;
|
|
267
|
+
const tt = oe(
|
|
268
268
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
269
|
-
), N =
|
|
270
|
-
|
|
269
|
+
), N = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
270
|
+
ue.Root,
|
|
271
271
|
{
|
|
272
272
|
ref: a,
|
|
273
|
-
className:
|
|
273
|
+
className: h(tt(), t),
|
|
274
274
|
...i
|
|
275
275
|
}
|
|
276
276
|
));
|
|
277
|
-
N.displayName =
|
|
278
|
-
const U =
|
|
277
|
+
N.displayName = ue.Root.displayName;
|
|
278
|
+
const U = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
279
279
|
V.Root,
|
|
280
280
|
{
|
|
281
281
|
ref: a,
|
|
282
|
-
className:
|
|
282
|
+
className: h(
|
|
283
283
|
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
284
284
|
t
|
|
285
285
|
),
|
|
@@ -287,17 +287,17 @@ const U = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
|
287
287
|
children: /* @__PURE__ */ e(
|
|
288
288
|
V.Indicator,
|
|
289
289
|
{
|
|
290
|
-
className:
|
|
291
|
-
children: /* @__PURE__ */ e(
|
|
290
|
+
className: h("grid place-content-center text-current"),
|
|
291
|
+
children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" })
|
|
292
292
|
}
|
|
293
293
|
)
|
|
294
294
|
}
|
|
295
295
|
));
|
|
296
296
|
U.displayName = V.Root.displayName;
|
|
297
|
-
const te =
|
|
297
|
+
const te = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
298
298
|
"textarea",
|
|
299
299
|
{
|
|
300
|
-
className:
|
|
300
|
+
className: h(
|
|
301
301
|
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
302
302
|
t
|
|
303
303
|
),
|
|
@@ -306,28 +306,28 @@ const te = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
|
306
306
|
}
|
|
307
307
|
));
|
|
308
308
|
te.displayName = "Textarea";
|
|
309
|
-
const
|
|
310
|
-
const n = (
|
|
311
|
-
i({ ...t, [
|
|
309
|
+
const at = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_"), it = (t, i, a = !1, l = !1) => {
|
|
310
|
+
const n = (g, y) => {
|
|
311
|
+
i({ ...t, [g]: y });
|
|
312
312
|
};
|
|
313
313
|
return {
|
|
314
|
-
handleTitleChange: (
|
|
315
|
-
n("title",
|
|
314
|
+
handleTitleChange: (g) => {
|
|
315
|
+
n("title", g);
|
|
316
316
|
},
|
|
317
317
|
handleTitleBlur: () => {
|
|
318
318
|
if (a && t.title) {
|
|
319
|
-
const
|
|
320
|
-
n("key",
|
|
319
|
+
const g = at(t.title);
|
|
320
|
+
n("key", g);
|
|
321
321
|
}
|
|
322
322
|
},
|
|
323
|
-
handleKeyChange: (
|
|
324
|
-
(a ||
|
|
323
|
+
handleKeyChange: (g) => {
|
|
324
|
+
(a || l) && n("key", g);
|
|
325
325
|
},
|
|
326
326
|
handleFieldChange: n,
|
|
327
|
-
handleConstraintChange: (
|
|
327
|
+
handleConstraintChange: (g, y) => {
|
|
328
328
|
i({
|
|
329
329
|
...t,
|
|
330
|
-
[
|
|
330
|
+
[g]: y
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
};
|
|
@@ -340,60 +340,59 @@ const tt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g,
|
|
|
340
340
|
array: "Array",
|
|
341
341
|
null: "Null",
|
|
342
342
|
file: "File"
|
|
343
|
-
},
|
|
343
|
+
}, Ne = Se({
|
|
344
344
|
getTypeLabel: (t) => X[t],
|
|
345
345
|
typeLabels: X
|
|
346
346
|
});
|
|
347
|
-
function
|
|
347
|
+
function nt({
|
|
348
348
|
children: t,
|
|
349
349
|
customLabels: i = {}
|
|
350
350
|
}) {
|
|
351
|
-
const a = { ...X, ...i },
|
|
352
|
-
return /* @__PURE__ */ e(
|
|
351
|
+
const a = { ...X, ...i }, l = (n) => a[n] || n;
|
|
352
|
+
return /* @__PURE__ */ e(Ne.Provider, { value: { getTypeLabel: l, typeLabels: a }, children: t });
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
return
|
|
354
|
+
function we() {
|
|
355
|
+
return Ie(Ne);
|
|
356
356
|
}
|
|
357
357
|
function G({
|
|
358
358
|
property: t,
|
|
359
359
|
open: i,
|
|
360
360
|
onOpenChange: a,
|
|
361
|
-
onSave:
|
|
361
|
+
onSave: l,
|
|
362
362
|
isArrayItem: n = !1,
|
|
363
|
-
isNewProperty:
|
|
363
|
+
isNewProperty: d = !1,
|
|
364
364
|
propertyLabel: r = { singular: "Property", plural: "Properties" },
|
|
365
|
-
showRegex:
|
|
366
|
-
keyEditable:
|
|
365
|
+
showRegex: m = !1,
|
|
366
|
+
keyEditable: k = !1,
|
|
367
|
+
typeLabels: g
|
|
367
368
|
}) {
|
|
368
|
-
|
|
369
|
-
const { typeLabels: c } = Ne(), [o, v] = O(t);
|
|
369
|
+
const { typeLabels: y } = we(), u = g || y, [o, f] = P(t);
|
|
370
370
|
Z(() => {
|
|
371
|
-
i &&
|
|
371
|
+
i && f(t);
|
|
372
372
|
}, [t, i]);
|
|
373
373
|
const {
|
|
374
|
-
handleTitleChange:
|
|
375
|
-
handleTitleBlur:
|
|
376
|
-
handleKeyChange:
|
|
377
|
-
handleFieldChange:
|
|
378
|
-
handleConstraintChange:
|
|
379
|
-
} =
|
|
374
|
+
handleTitleChange: v,
|
|
375
|
+
handleTitleBlur: j,
|
|
376
|
+
handleKeyChange: q,
|
|
377
|
+
handleFieldChange: S,
|
|
378
|
+
handleConstraintChange: x
|
|
379
|
+
} = it(
|
|
380
380
|
o,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
),
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
v(t), a(!1);
|
|
381
|
+
f,
|
|
382
|
+
d,
|
|
383
|
+
k
|
|
384
|
+
), p = () => {
|
|
385
|
+
o.title?.trim() && (l(o), a(!1));
|
|
386
|
+
}, z = () => {
|
|
387
|
+
f(t), a(!1);
|
|
389
388
|
};
|
|
390
|
-
return /* @__PURE__ */ e(
|
|
391
|
-
|
|
389
|
+
return /* @__PURE__ */ e(Ye, { open: i, onOpenChange: a, children: /* @__PURE__ */ s(
|
|
390
|
+
ve,
|
|
392
391
|
{
|
|
393
392
|
className: "max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0",
|
|
394
393
|
"data-testid": "dialog-edit-property",
|
|
395
394
|
children: [
|
|
396
|
-
/* @__PURE__ */ e(
|
|
395
|
+
/* @__PURE__ */ e(ye, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(be, { children: d ? `Add ${r.singular}` : `Edit ${r.singular}` }) }),
|
|
397
396
|
/* @__PURE__ */ s("div", { className: "space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0", children: [
|
|
398
397
|
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
399
398
|
/* @__PURE__ */ s(N, { className: "flex items-center gap-1.5", children: [
|
|
@@ -404,19 +403,19 @@ function G({
|
|
|
404
403
|
H,
|
|
405
404
|
{
|
|
406
405
|
value: o.type,
|
|
407
|
-
onValueChange: (
|
|
406
|
+
onValueChange: (c) => S("type", c),
|
|
408
407
|
"data-testid": "select-type-dialog",
|
|
409
408
|
children: [
|
|
410
409
|
/* @__PURE__ */ e($, { children: /* @__PURE__ */ e(_, {}) }),
|
|
411
410
|
/* @__PURE__ */ s(K, { children: [
|
|
412
|
-
/* @__PURE__ */ e(
|
|
413
|
-
/* @__PURE__ */ e(
|
|
414
|
-
/* @__PURE__ */ e(
|
|
415
|
-
/* @__PURE__ */ e(
|
|
416
|
-
/* @__PURE__ */ e(
|
|
417
|
-
/* @__PURE__ */ e(
|
|
418
|
-
/* @__PURE__ */ e(
|
|
419
|
-
/* @__PURE__ */ e(
|
|
411
|
+
/* @__PURE__ */ e(C, { value: "string", children: u.string }),
|
|
412
|
+
/* @__PURE__ */ e(C, { value: "number", children: u.number }),
|
|
413
|
+
/* @__PURE__ */ e(C, { value: "integer", children: u.integer }),
|
|
414
|
+
/* @__PURE__ */ e(C, { value: "boolean", children: u.boolean }),
|
|
415
|
+
/* @__PURE__ */ e(C, { value: "object", children: u.object }),
|
|
416
|
+
/* @__PURE__ */ e(C, { value: "array", children: u.array }),
|
|
417
|
+
/* @__PURE__ */ e(C, { value: "file", children: u.file }),
|
|
418
|
+
/* @__PURE__ */ e(C, { value: "null", children: u.null })
|
|
420
419
|
] })
|
|
421
420
|
]
|
|
422
421
|
}
|
|
@@ -431,30 +430,30 @@ function G({
|
|
|
431
430
|
D,
|
|
432
431
|
{
|
|
433
432
|
value: o.title || "",
|
|
434
|
-
onChange: (
|
|
435
|
-
onBlur:
|
|
433
|
+
onChange: (c) => v(c.target.value),
|
|
434
|
+
onBlur: j,
|
|
436
435
|
placeholder: "Property Title",
|
|
437
436
|
"data-testid": "input-title-dialog",
|
|
438
437
|
required: !0
|
|
439
438
|
}
|
|
440
439
|
),
|
|
441
|
-
!
|
|
440
|
+
!d && o.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
|
|
442
441
|
"Key: ",
|
|
443
442
|
o.key
|
|
444
443
|
] })
|
|
445
444
|
] }),
|
|
446
|
-
(
|
|
445
|
+
(d || k) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
447
446
|
/* @__PURE__ */ e(N, { children: "Key" }),
|
|
448
447
|
/* @__PURE__ */ e(
|
|
449
448
|
D,
|
|
450
449
|
{
|
|
451
450
|
value: o.key,
|
|
452
|
-
onChange: (
|
|
451
|
+
onChange: (c) => q(c.target.value),
|
|
453
452
|
placeholder: "property_key",
|
|
454
453
|
"data-testid": "input-key-dialog"
|
|
455
454
|
}
|
|
456
455
|
),
|
|
457
|
-
!
|
|
456
|
+
!d && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
|
|
458
457
|
] }),
|
|
459
458
|
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
460
459
|
/* @__PURE__ */ e(N, { children: "Description" }),
|
|
@@ -463,7 +462,7 @@ function G({
|
|
|
463
462
|
{
|
|
464
463
|
placeholder: "Optional description",
|
|
465
464
|
value: o.description || "",
|
|
466
|
-
onChange: (
|
|
465
|
+
onChange: (c) => S("description", c.target.value),
|
|
467
466
|
rows: 2,
|
|
468
467
|
"data-testid": "input-edit-description"
|
|
469
468
|
}
|
|
@@ -471,7 +470,7 @@ function G({
|
|
|
471
470
|
] }),
|
|
472
471
|
o.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
|
|
473
472
|
/* @__PURE__ */ s(N, { className: "font-semibold text-xs text-muted-foreground", children: [
|
|
474
|
-
|
|
473
|
+
u.array,
|
|
475
474
|
" Items"
|
|
476
475
|
] }),
|
|
477
476
|
o.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
|
|
@@ -481,24 +480,24 @@ function G({
|
|
|
481
480
|
H,
|
|
482
481
|
{
|
|
483
482
|
value: o.items.type,
|
|
484
|
-
onValueChange: (
|
|
483
|
+
onValueChange: (c) => f({
|
|
485
484
|
...o,
|
|
486
485
|
items: {
|
|
487
486
|
...o.items,
|
|
488
|
-
type:
|
|
487
|
+
type: c
|
|
489
488
|
}
|
|
490
489
|
}),
|
|
491
490
|
children: [
|
|
492
491
|
/* @__PURE__ */ e($, { children: /* @__PURE__ */ e(_, {}) }),
|
|
493
492
|
/* @__PURE__ */ s(K, { children: [
|
|
494
|
-
/* @__PURE__ */ e(
|
|
495
|
-
/* @__PURE__ */ e(
|
|
496
|
-
/* @__PURE__ */ e(
|
|
497
|
-
/* @__PURE__ */ e(
|
|
498
|
-
/* @__PURE__ */ e(
|
|
499
|
-
/* @__PURE__ */ e(
|
|
500
|
-
/* @__PURE__ */ e(
|
|
501
|
-
/* @__PURE__ */ e(
|
|
493
|
+
/* @__PURE__ */ e(C, { value: "string", children: u.string }),
|
|
494
|
+
/* @__PURE__ */ e(C, { value: "number", children: u.number }),
|
|
495
|
+
/* @__PURE__ */ e(C, { value: "integer", children: u.integer }),
|
|
496
|
+
/* @__PURE__ */ e(C, { value: "boolean", children: u.boolean }),
|
|
497
|
+
/* @__PURE__ */ e(C, { value: "object", children: u.object }),
|
|
498
|
+
/* @__PURE__ */ e(C, { value: "array", children: u.array }),
|
|
499
|
+
/* @__PURE__ */ e(C, { value: "file", children: u.file }),
|
|
500
|
+
/* @__PURE__ */ e(C, { value: "null", children: u.null })
|
|
502
501
|
] })
|
|
503
502
|
]
|
|
504
503
|
}
|
|
@@ -510,11 +509,11 @@ function G({
|
|
|
510
509
|
D,
|
|
511
510
|
{
|
|
512
511
|
value: o.items.title || "",
|
|
513
|
-
onChange: (
|
|
512
|
+
onChange: (c) => f({
|
|
514
513
|
...o,
|
|
515
514
|
items: {
|
|
516
515
|
...o.items,
|
|
517
|
-
title:
|
|
516
|
+
title: c.target.value
|
|
518
517
|
}
|
|
519
518
|
}),
|
|
520
519
|
placeholder: "Item Title"
|
|
@@ -522,26 +521,26 @@ function G({
|
|
|
522
521
|
)
|
|
523
522
|
] }),
|
|
524
523
|
/* @__PURE__ */ s(
|
|
525
|
-
|
|
524
|
+
I,
|
|
526
525
|
{
|
|
527
526
|
variant: "ghost",
|
|
528
527
|
size: "sm",
|
|
529
528
|
className: "mt-2",
|
|
530
|
-
onClick: () =>
|
|
529
|
+
onClick: () => f({ ...o, items: void 0 }),
|
|
531
530
|
children: [
|
|
532
531
|
"Remove ",
|
|
533
|
-
|
|
532
|
+
u.array,
|
|
534
533
|
" Item Schema"
|
|
535
534
|
]
|
|
536
535
|
}
|
|
537
536
|
)
|
|
538
537
|
] }) : /* @__PURE__ */ s(
|
|
539
|
-
|
|
538
|
+
I,
|
|
540
539
|
{
|
|
541
540
|
variant: "outline",
|
|
542
541
|
size: "sm",
|
|
543
542
|
onClick: () => {
|
|
544
|
-
|
|
543
|
+
f({
|
|
545
544
|
...o,
|
|
546
545
|
items: {
|
|
547
546
|
id: Date.now().toString() + Math.random(),
|
|
@@ -553,7 +552,7 @@ function G({
|
|
|
553
552
|
},
|
|
554
553
|
children: [
|
|
555
554
|
"Add ",
|
|
556
|
-
|
|
555
|
+
u.array,
|
|
557
556
|
" Item Schema"
|
|
558
557
|
]
|
|
559
558
|
}
|
|
@@ -565,7 +564,7 @@ function G({
|
|
|
565
564
|
{
|
|
566
565
|
id: "prop-required",
|
|
567
566
|
checked: o.required,
|
|
568
|
-
onCheckedChange: (
|
|
567
|
+
onCheckedChange: (c) => S("required", c),
|
|
569
568
|
"data-testid": "checkbox-edit-required"
|
|
570
569
|
}
|
|
571
570
|
),
|
|
@@ -573,7 +572,7 @@ function G({
|
|
|
573
572
|
] }),
|
|
574
573
|
o.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
|
|
575
574
|
/* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
|
|
576
|
-
|
|
575
|
+
u.string,
|
|
577
576
|
" Constraints"
|
|
578
577
|
] }) }),
|
|
579
578
|
/* @__PURE__ */ s("div", { className: "space-y-4 p-4 pt-0", children: [
|
|
@@ -587,9 +586,9 @@ function G({
|
|
|
587
586
|
type: "number",
|
|
588
587
|
placeholder: "0",
|
|
589
588
|
value: o.minLength || "",
|
|
590
|
-
onChange: (
|
|
589
|
+
onChange: (c) => x(
|
|
591
590
|
"minLength",
|
|
592
|
-
|
|
591
|
+
c.target.value ? parseInt(c.target.value) : void 0
|
|
593
592
|
),
|
|
594
593
|
"data-testid": "input-edit-minlength"
|
|
595
594
|
}
|
|
@@ -604,16 +603,16 @@ function G({
|
|
|
604
603
|
type: "number",
|
|
605
604
|
placeholder: "∞",
|
|
606
605
|
value: o.maxLength || "",
|
|
607
|
-
onChange: (
|
|
606
|
+
onChange: (c) => x(
|
|
608
607
|
"maxLength",
|
|
609
|
-
|
|
608
|
+
c.target.value ? parseInt(c.target.value) : void 0
|
|
610
609
|
),
|
|
611
610
|
"data-testid": "input-edit-maxlength"
|
|
612
611
|
}
|
|
613
612
|
)
|
|
614
613
|
] })
|
|
615
614
|
] }),
|
|
616
|
-
|
|
615
|
+
m && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
617
616
|
/* @__PURE__ */ e(N, { htmlFor: "pattern", children: "Pattern (regex)" }),
|
|
618
617
|
/* @__PURE__ */ e(
|
|
619
618
|
D,
|
|
@@ -621,7 +620,7 @@ function G({
|
|
|
621
620
|
id: "pattern",
|
|
622
621
|
placeholder: "^[a-z]+$",
|
|
623
622
|
value: o.pattern || "",
|
|
624
|
-
onChange: (
|
|
623
|
+
onChange: (c) => x("pattern", c.target.value),
|
|
625
624
|
className: "font-mono text-sm",
|
|
626
625
|
"data-testid": "input-edit-pattern"
|
|
627
626
|
}
|
|
@@ -629,38 +628,35 @@ function G({
|
|
|
629
628
|
] }),
|
|
630
629
|
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
631
630
|
/* @__PURE__ */ e(N, { children: "Enum Values" }),
|
|
632
|
-
/* @__PURE__ */ e("div", { className: "space-y-2", children: [...o.enum || [], ""].map((
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
value
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
T.trim()
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
);
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
"data-testid": `input-edit-enum-${j}`
|
|
631
|
+
/* @__PURE__ */ e("div", { className: "space-y-2", children: [...o.enum || [], ""].map((c, O) => /* @__PURE__ */ e(
|
|
632
|
+
D,
|
|
633
|
+
{
|
|
634
|
+
placeholder: O === (o.enum?.length || 0) ? "Add new value..." : "Enum value",
|
|
635
|
+
value: c,
|
|
636
|
+
onChange: (J) => {
|
|
637
|
+
const T = J.target.value, R = o.enum || [];
|
|
638
|
+
if (O === R.length)
|
|
639
|
+
T.trim() && x("enum", [
|
|
640
|
+
...R,
|
|
641
|
+
T.trim()
|
|
642
|
+
]);
|
|
643
|
+
else if (T.trim()) {
|
|
644
|
+
const A = [...R];
|
|
645
|
+
A[O] = T.trim(), x("enum", A);
|
|
646
|
+
} else {
|
|
647
|
+
const A = R.filter(
|
|
648
|
+
(yt, ke) => ke !== O
|
|
649
|
+
);
|
|
650
|
+
x(
|
|
651
|
+
"enum",
|
|
652
|
+
A.length > 0 ? A : void 0
|
|
653
|
+
);
|
|
654
|
+
}
|
|
660
655
|
},
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
656
|
+
"data-testid": `input-edit-enum-${O}`
|
|
657
|
+
},
|
|
658
|
+
O
|
|
659
|
+
)) }),
|
|
664
660
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Enter allowed values (empty fields will be removed)" })
|
|
665
661
|
] })
|
|
666
662
|
] })
|
|
@@ -677,9 +673,9 @@ function G({
|
|
|
677
673
|
type: "number",
|
|
678
674
|
placeholder: "-∞",
|
|
679
675
|
value: o.minimum ?? "",
|
|
680
|
-
onChange: (
|
|
676
|
+
onChange: (c) => x(
|
|
681
677
|
"minimum",
|
|
682
|
-
|
|
678
|
+
c.target.value ? parseFloat(c.target.value) : void 0
|
|
683
679
|
),
|
|
684
680
|
"data-testid": "input-edit-minimum"
|
|
685
681
|
}
|
|
@@ -694,9 +690,9 @@ function G({
|
|
|
694
690
|
type: "number",
|
|
695
691
|
placeholder: "∞",
|
|
696
692
|
value: o.maximum ?? "",
|
|
697
|
-
onChange: (
|
|
693
|
+
onChange: (c) => x(
|
|
698
694
|
"maximum",
|
|
699
|
-
|
|
695
|
+
c.target.value ? parseFloat(c.target.value) : void 0
|
|
700
696
|
),
|
|
701
697
|
"data-testid": "input-edit-maximum"
|
|
702
698
|
}
|
|
@@ -706,7 +702,7 @@ function G({
|
|
|
706
702
|
] }),
|
|
707
703
|
o.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
|
|
708
704
|
/* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
|
|
709
|
-
|
|
705
|
+
u.array,
|
|
710
706
|
" Constraints"
|
|
711
707
|
] }) }),
|
|
712
708
|
/* @__PURE__ */ s("div", { className: "space-y-4 p-4 pt-0", children: [
|
|
@@ -720,9 +716,9 @@ function G({
|
|
|
720
716
|
type: "number",
|
|
721
717
|
placeholder: "0",
|
|
722
718
|
value: o.minItems || "",
|
|
723
|
-
onChange: (
|
|
719
|
+
onChange: (c) => x(
|
|
724
720
|
"minItems",
|
|
725
|
-
|
|
721
|
+
c.target.value ? parseInt(c.target.value) : void 0
|
|
726
722
|
),
|
|
727
723
|
"data-testid": "input-edit-minitems"
|
|
728
724
|
}
|
|
@@ -737,9 +733,9 @@ function G({
|
|
|
737
733
|
type: "number",
|
|
738
734
|
placeholder: "∞",
|
|
739
735
|
value: o.maxItems || "",
|
|
740
|
-
onChange: (
|
|
736
|
+
onChange: (c) => x(
|
|
741
737
|
"maxItems",
|
|
742
|
-
|
|
738
|
+
c.target.value ? parseInt(c.target.value) : void 0
|
|
743
739
|
),
|
|
744
740
|
"data-testid": "input-edit-maxitems"
|
|
745
741
|
}
|
|
@@ -752,7 +748,7 @@ function G({
|
|
|
752
748
|
{
|
|
753
749
|
id: "unique-items",
|
|
754
750
|
checked: o.uniqueItems || !1,
|
|
755
|
-
onCheckedChange: (
|
|
751
|
+
onCheckedChange: (c) => x("uniqueItems", c),
|
|
756
752
|
"data-testid": "checkbox-edit-unique"
|
|
757
753
|
}
|
|
758
754
|
),
|
|
@@ -761,22 +757,22 @@ function G({
|
|
|
761
757
|
] })
|
|
762
758
|
] })
|
|
763
759
|
] }),
|
|
764
|
-
/* @__PURE__ */ s(
|
|
760
|
+
/* @__PURE__ */ s(xe, { className: "px-6 py-4 border-t bg-background shrink-0", children: [
|
|
765
761
|
/* @__PURE__ */ e(
|
|
766
|
-
|
|
762
|
+
I,
|
|
767
763
|
{
|
|
768
764
|
variant: "outline",
|
|
769
|
-
onClick:
|
|
765
|
+
onClick: z,
|
|
770
766
|
"data-testid": "button-cancel",
|
|
771
767
|
children: "Cancel"
|
|
772
768
|
}
|
|
773
769
|
),
|
|
774
770
|
/* @__PURE__ */ e(
|
|
775
|
-
|
|
771
|
+
I,
|
|
776
772
|
{
|
|
777
|
-
onClick:
|
|
773
|
+
onClick: p,
|
|
778
774
|
"data-testid": "button-save",
|
|
779
|
-
disabled: !
|
|
775
|
+
disabled: !o.title?.trim(),
|
|
780
776
|
children: "Save Changes"
|
|
781
777
|
}
|
|
782
778
|
)
|
|
@@ -785,42 +781,42 @@ function G({
|
|
|
785
781
|
}
|
|
786
782
|
) });
|
|
787
783
|
}
|
|
788
|
-
function
|
|
789
|
-
const { allowEmpty:
|
|
784
|
+
function le(t, i, a = {}) {
|
|
785
|
+
const { allowEmpty: l = !1, onEditStart: n, onEditCancel: d } = a, [r, m] = P(!1), [k, g] = P(t);
|
|
790
786
|
Z(() => {
|
|
791
|
-
r ||
|
|
787
|
+
r || g(t);
|
|
792
788
|
}, [t, r]);
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
},
|
|
796
|
-
|
|
797
|
-
},
|
|
798
|
-
const
|
|
799
|
-
if (!
|
|
800
|
-
|
|
789
|
+
const y = () => {
|
|
790
|
+
g(t), m(!0), n?.();
|
|
791
|
+
}, u = (v) => {
|
|
792
|
+
g(v);
|
|
793
|
+
}, o = () => {
|
|
794
|
+
const v = k.trim();
|
|
795
|
+
if (!l && !v) {
|
|
796
|
+
g(t), m(!1);
|
|
801
797
|
return;
|
|
802
798
|
}
|
|
803
|
-
|
|
799
|
+
v !== t && i(v), m(!1);
|
|
804
800
|
};
|
|
805
801
|
return {
|
|
806
802
|
isEditing: r,
|
|
807
|
-
value:
|
|
808
|
-
startEdit:
|
|
809
|
-
handleChange:
|
|
810
|
-
handleBlur:
|
|
811
|
-
handleKeyDown: (
|
|
812
|
-
|
|
803
|
+
value: k,
|
|
804
|
+
startEdit: y,
|
|
805
|
+
handleChange: u,
|
|
806
|
+
handleBlur: o,
|
|
807
|
+
handleKeyDown: (v) => {
|
|
808
|
+
v.key === "Enter" ? o() : v.key === "Escape" && (g(t), m(!1), d?.());
|
|
813
809
|
}
|
|
814
810
|
};
|
|
815
811
|
}
|
|
816
|
-
function
|
|
817
|
-
const [a,
|
|
812
|
+
function st(t, i) {
|
|
813
|
+
const [a, l] = P(!1);
|
|
818
814
|
return {
|
|
819
815
|
isChangingType: a,
|
|
820
|
-
setIsChangingType:
|
|
816
|
+
setIsChangingType: l,
|
|
821
817
|
handleTypeChange: (r) => {
|
|
822
|
-
const
|
|
823
|
-
r !== "string" && (delete
|
|
818
|
+
const m = { ...t, type: r };
|
|
819
|
+
r !== "string" && (delete m.minLength, delete m.maxLength, delete m.pattern, delete m.enum), r !== "number" && r !== "integer" && (delete m.minimum, delete m.maximum), r !== "array" && (delete m.minItems, delete m.maxItems, delete m.uniqueItems, delete m.items), r !== "object" && delete m.children, i(m), l(!1);
|
|
824
820
|
},
|
|
825
821
|
availableTypes: [
|
|
826
822
|
"string",
|
|
@@ -835,26 +831,26 @@ function nt(t, i) {
|
|
|
835
831
|
}
|
|
836
832
|
const ae = () => `${Date.now()}-${Math.random()}`;
|
|
837
833
|
function ie(t = {}) {
|
|
838
|
-
const { onConfirm: i, onCancel: a, createInitialData:
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
},
|
|
842
|
-
|
|
834
|
+
const { onConfirm: i, onCancel: a, createInitialData: l } = t, [n, d] = P(!1), [r, m] = P(null), k = (o) => {
|
|
835
|
+
const f = o ?? (l ? l() : null);
|
|
836
|
+
m(f), d(!0);
|
|
837
|
+
}, g = () => {
|
|
838
|
+
d(!1), m(null), a?.();
|
|
843
839
|
};
|
|
844
840
|
return {
|
|
845
841
|
isOpen: n,
|
|
846
842
|
data: r,
|
|
847
|
-
open:
|
|
848
|
-
close:
|
|
849
|
-
confirm: (
|
|
850
|
-
i
|
|
843
|
+
open: k,
|
|
844
|
+
close: g,
|
|
845
|
+
confirm: (o) => {
|
|
846
|
+
i?.(o), d(!1), m(null);
|
|
851
847
|
},
|
|
852
|
-
setIsOpen: (
|
|
853
|
-
|
|
848
|
+
setIsOpen: (o) => {
|
|
849
|
+
o ? d(!0) : g();
|
|
854
850
|
}
|
|
855
851
|
};
|
|
856
852
|
}
|
|
857
|
-
function
|
|
853
|
+
function rt(t, i) {
|
|
858
854
|
const a = ie({
|
|
859
855
|
createInitialData: () => ({
|
|
860
856
|
id: ae(),
|
|
@@ -862,23 +858,23 @@ function st(t, i) {
|
|
|
862
858
|
type: "string",
|
|
863
859
|
required: !1
|
|
864
860
|
}),
|
|
865
|
-
onConfirm: (
|
|
861
|
+
onConfirm: (d) => {
|
|
866
862
|
i({
|
|
867
863
|
...t,
|
|
868
|
-
children: [...t.children || [],
|
|
864
|
+
children: [...t.children || [], d]
|
|
869
865
|
});
|
|
870
866
|
}
|
|
871
867
|
});
|
|
872
868
|
return {
|
|
873
869
|
addChild: () => a.open(),
|
|
874
|
-
updateChild: (
|
|
875
|
-
const
|
|
876
|
-
(
|
|
870
|
+
updateChild: (d, r) => {
|
|
871
|
+
const m = t.children.map(
|
|
872
|
+
(k) => k.id === d ? r : k
|
|
877
873
|
);
|
|
878
|
-
i({ ...t, children:
|
|
874
|
+
i({ ...t, children: m });
|
|
879
875
|
},
|
|
880
|
-
deleteChild: (
|
|
881
|
-
const r = t.children.filter((
|
|
876
|
+
deleteChild: (d) => {
|
|
877
|
+
const r = t.children.filter((m) => m.id !== d);
|
|
882
878
|
i({ ...t, children: r });
|
|
883
879
|
},
|
|
884
880
|
addChildDialog: {
|
|
@@ -893,27 +889,34 @@ function Q({
|
|
|
893
889
|
property: t,
|
|
894
890
|
onUpdate: i,
|
|
895
891
|
onDelete: a,
|
|
896
|
-
level:
|
|
892
|
+
level: l = 1,
|
|
897
893
|
isArrayItem: n = !1,
|
|
898
|
-
showRegex:
|
|
894
|
+
showRegex: d = !1,
|
|
899
895
|
keyEditable: r = !1
|
|
900
896
|
}) {
|
|
901
|
-
const { getTypeLabel:
|
|
897
|
+
const { getTypeLabel: m, typeLabels: k } = we(), g = ie(), y = le(
|
|
902
898
|
t.title || t.key || "",
|
|
903
|
-
(
|
|
899
|
+
(p) => i({ ...t, title: p }),
|
|
904
900
|
{ allowEmpty: !1 }
|
|
905
|
-
),
|
|
901
|
+
), u = le(
|
|
906
902
|
t.description || "",
|
|
907
|
-
(
|
|
903
|
+
(p) => i({ ...t, description: p || void 0 }),
|
|
908
904
|
{ allowEmpty: !0 }
|
|
909
|
-
),
|
|
905
|
+
), o = st(t, i), f = rt(t, i), v = `h${Math.min(l, 6)}`, j = t.type === "object", q = j && t.children && t.children.length > 0, S = {
|
|
910
906
|
1: "text-lg font-semibold",
|
|
911
907
|
2: "text-base",
|
|
912
908
|
3: "text-base",
|
|
913
909
|
4: "text-base",
|
|
914
910
|
5: "text-sm",
|
|
915
911
|
6: "text-sm"
|
|
916
|
-
}[
|
|
912
|
+
}[l] || "text-sm", x = {
|
|
913
|
+
1: "h-5 w-5",
|
|
914
|
+
2: "h-4 w-4",
|
|
915
|
+
3: "h-4 w-4",
|
|
916
|
+
4: "h-4 w-4",
|
|
917
|
+
5: "h-4 w-4",
|
|
918
|
+
6: "h-4 w-4"
|
|
919
|
+
}[l] || "h-5 w-5";
|
|
917
920
|
return /* @__PURE__ */ s("div", { className: "group", children: [
|
|
918
921
|
/* @__PURE__ */ s("div", { className: "flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50", children: [
|
|
919
922
|
/* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
|
|
@@ -921,103 +924,165 @@ function Q({
|
|
|
921
924
|
"button",
|
|
922
925
|
{
|
|
923
926
|
onClick: () => i({ ...t, required: !t.required }),
|
|
924
|
-
className: "shrink-0 transition-all hover:scale-110 mt-
|
|
927
|
+
className: "shrink-0 transition-all hover:scale-110 -mt-[3px]",
|
|
925
928
|
title: t.required ? "Required field - click to make optional" : "Optional field - click to make required",
|
|
926
|
-
children: t.required ?
|
|
929
|
+
children: t.required ? (
|
|
930
|
+
// <span className="block w-4 h-4 rounded-full bg-primary"></span>
|
|
931
|
+
/* @__PURE__ */ e(se, { className: "w-6 h-6 text-primary" })
|
|
932
|
+
) : (
|
|
933
|
+
// <span className="block w-4 h-4 rounded-full border border-dashed border-gray-400"></span>
|
|
934
|
+
/* @__PURE__ */ e(se, { className: "w-6 h-6 text-border" })
|
|
935
|
+
)
|
|
927
936
|
}
|
|
928
937
|
),
|
|
929
|
-
|
|
938
|
+
y.isEditing ? /* @__PURE__ */ e(
|
|
930
939
|
D,
|
|
931
940
|
{
|
|
932
|
-
value:
|
|
933
|
-
onChange: (
|
|
934
|
-
onBlur:
|
|
935
|
-
onKeyDown:
|
|
941
|
+
value: y.value,
|
|
942
|
+
onChange: (p) => y.handleChange(p.target.value),
|
|
943
|
+
onBlur: y.handleBlur,
|
|
944
|
+
onKeyDown: y.handleKeyDown,
|
|
936
945
|
autoFocus: !0,
|
|
937
|
-
className:
|
|
946
|
+
className: S,
|
|
938
947
|
placeholder: "Enter title"
|
|
939
948
|
}
|
|
940
949
|
) : /* @__PURE__ */ s("div", { className: "flex gap-2 flex-wrap flex-1", children: [
|
|
941
950
|
/* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
|
|
942
951
|
/* @__PURE__ */ e(
|
|
943
|
-
|
|
952
|
+
v,
|
|
944
953
|
{
|
|
945
|
-
className: `${
|
|
946
|
-
onClick:
|
|
954
|
+
className: `${S} cursor-pointer hover:text-primary transition-colors leading-none`,
|
|
955
|
+
onClick: y.startEdit,
|
|
947
956
|
children: t.title || t.key || /* @__PURE__ */ e("span", { className: "text-muted-foreground italic", children: "unnamed" })
|
|
948
957
|
}
|
|
949
958
|
),
|
|
950
|
-
|
|
959
|
+
o.isChangingType ? /* @__PURE__ */ s(
|
|
951
960
|
H,
|
|
952
961
|
{
|
|
953
962
|
value: t.type,
|
|
954
|
-
onValueChange: (
|
|
955
|
-
open:
|
|
956
|
-
onOpenChange:
|
|
963
|
+
onValueChange: (p) => o.handleTypeChange(p),
|
|
964
|
+
open: o.isChangingType,
|
|
965
|
+
onOpenChange: o.setIsChangingType,
|
|
957
966
|
children: [
|
|
958
967
|
/* @__PURE__ */ e($, { className: "w-[140px] h-7", children: /* @__PURE__ */ e(_, {}) }),
|
|
959
|
-
/* @__PURE__ */ e(K, { children:
|
|
968
|
+
/* @__PURE__ */ e(K, { children: o.availableTypes.map((p) => /* @__PURE__ */ e(C, { value: p, children: k[p] }, p)) })
|
|
960
969
|
]
|
|
961
970
|
}
|
|
962
|
-
) : /* @__PURE__ */ e(
|
|
963
|
-
/* @__PURE__ */ e(
|
|
971
|
+
) : /* @__PURE__ */ e(Ue, { children: /* @__PURE__ */ s(Xe, { children: [
|
|
972
|
+
/* @__PURE__ */ e(Ge, { asChild: !0, children: /* @__PURE__ */ s(
|
|
964
973
|
"button",
|
|
965
974
|
{
|
|
966
|
-
onClick: () =>
|
|
967
|
-
className: "cursor-pointer hover:bg-accent rounded p-0.5 transition-colors",
|
|
975
|
+
onClick: () => o.setIsChangingType(!0),
|
|
976
|
+
className: "cursor-pointer hover:bg-accent rounded p-0.5 -mt-0.5 transition-colors",
|
|
968
977
|
children: [
|
|
969
|
-
t.type === "string" && /* @__PURE__ */ e(
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
978
|
+
t.type === "string" && /* @__PURE__ */ e(
|
|
979
|
+
Oe,
|
|
980
|
+
{
|
|
981
|
+
className: h(
|
|
982
|
+
x,
|
|
983
|
+
"text-muted-foreground"
|
|
984
|
+
)
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
t.type === "number" && /* @__PURE__ */ e(
|
|
988
|
+
re,
|
|
989
|
+
{
|
|
990
|
+
className: h(
|
|
991
|
+
x,
|
|
992
|
+
"text-muted-foreground"
|
|
993
|
+
)
|
|
994
|
+
}
|
|
995
|
+
),
|
|
996
|
+
t.type === "integer" && /* @__PURE__ */ e(
|
|
997
|
+
re,
|
|
998
|
+
{
|
|
999
|
+
className: h(
|
|
1000
|
+
x,
|
|
1001
|
+
"text-muted-foreground"
|
|
1002
|
+
)
|
|
1003
|
+
}
|
|
1004
|
+
),
|
|
1005
|
+
t.type === "boolean" && /* @__PURE__ */ e(
|
|
1006
|
+
Re,
|
|
1007
|
+
{
|
|
1008
|
+
className: h(
|
|
1009
|
+
x,
|
|
1010
|
+
"text-muted-foreground"
|
|
1011
|
+
)
|
|
1012
|
+
}
|
|
1013
|
+
),
|
|
1014
|
+
t.type === "object" && /* @__PURE__ */ e(
|
|
1015
|
+
Ee,
|
|
1016
|
+
{
|
|
1017
|
+
className: h(
|
|
1018
|
+
x,
|
|
1019
|
+
"text-muted-foreground"
|
|
1020
|
+
)
|
|
1021
|
+
}
|
|
1022
|
+
),
|
|
1023
|
+
t.type === "array" && /* @__PURE__ */ e(
|
|
1024
|
+
Fe,
|
|
1025
|
+
{
|
|
1026
|
+
className: h(
|
|
1027
|
+
x,
|
|
1028
|
+
"text-muted-foreground"
|
|
1029
|
+
)
|
|
1030
|
+
}
|
|
1031
|
+
),
|
|
1032
|
+
t.type === "file" && /* @__PURE__ */ e(
|
|
1033
|
+
ze,
|
|
1034
|
+
{
|
|
1035
|
+
className: h(
|
|
1036
|
+
x,
|
|
1037
|
+
"text-muted-foreground"
|
|
1038
|
+
)
|
|
1039
|
+
}
|
|
1040
|
+
)
|
|
976
1041
|
]
|
|
977
1042
|
}
|
|
978
1043
|
) }),
|
|
979
|
-
/* @__PURE__ */ s(
|
|
980
|
-
|
|
981
|
-
t.type === "array" && t.items ? ` of ${
|
|
1044
|
+
/* @__PURE__ */ s(he, { children: [
|
|
1045
|
+
m(t.type),
|
|
1046
|
+
t.type === "array" && t.items ? ` of ${m(t.items.type)}` : "",
|
|
982
1047
|
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground mt-1", children: "Click to change type" })
|
|
983
1048
|
] })
|
|
984
1049
|
] }) }),
|
|
985
1050
|
t.type === "object" && /* @__PURE__ */ e(
|
|
986
|
-
|
|
1051
|
+
I,
|
|
987
1052
|
{
|
|
988
1053
|
variant: "ghost",
|
|
989
1054
|
size: "icon",
|
|
990
|
-
className: "
|
|
991
|
-
onClick:
|
|
1055
|
+
className: "h-4 w-4",
|
|
1056
|
+
onClick: f.addChild,
|
|
992
1057
|
"data-testid": `button-add-child-${t.id}`,
|
|
993
|
-
children: /* @__PURE__ */ e(B, {
|
|
1058
|
+
children: /* @__PURE__ */ e(B, {})
|
|
994
1059
|
}
|
|
995
1060
|
)
|
|
996
1061
|
] }),
|
|
997
|
-
/* @__PURE__ */ e("div", { className: "flex-1", children:
|
|
1062
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: u.isEditing ? /* @__PURE__ */ e(
|
|
998
1063
|
D,
|
|
999
1064
|
{
|
|
1000
|
-
value:
|
|
1001
|
-
onChange: (
|
|
1002
|
-
onBlur:
|
|
1003
|
-
onKeyDown:
|
|
1065
|
+
value: u.value,
|
|
1066
|
+
onChange: (p) => u.handleChange(p.target.value),
|
|
1067
|
+
onBlur: u.handleBlur,
|
|
1068
|
+
onKeyDown: u.handleKeyDown,
|
|
1004
1069
|
autoFocus: !0,
|
|
1005
1070
|
className: "text-sm flex-1",
|
|
1006
1071
|
placeholder: "Enter description"
|
|
1007
1072
|
}
|
|
1008
|
-
) : /* @__PURE__ */ e(
|
|
1073
|
+
) : /* @__PURE__ */ e(de, { children: t.description ? /* @__PURE__ */ e(
|
|
1009
1074
|
"p",
|
|
1010
1075
|
{
|
|
1011
1076
|
className: "text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors",
|
|
1012
1077
|
"data-testid": `text-description-${t.id}`,
|
|
1013
|
-
onClick:
|
|
1078
|
+
onClick: u.startEdit,
|
|
1014
1079
|
children: t.description
|
|
1015
1080
|
}
|
|
1016
1081
|
) : /* @__PURE__ */ e(
|
|
1017
1082
|
"p",
|
|
1018
1083
|
{
|
|
1019
1084
|
className: "text-sm text-muted-foreground/50 flex-1 min-w-[200px] cursor-pointer hover:text-muted-foreground italic transition-colors",
|
|
1020
|
-
onClick:
|
|
1085
|
+
onClick: u.startEdit,
|
|
1021
1086
|
children: "Add description..."
|
|
1022
1087
|
}
|
|
1023
1088
|
) }) })
|
|
@@ -1025,76 +1090,76 @@ function Q({
|
|
|
1025
1090
|
] }) }),
|
|
1026
1091
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
1027
1092
|
/* @__PURE__ */ e(
|
|
1028
|
-
|
|
1093
|
+
I,
|
|
1029
1094
|
{
|
|
1030
1095
|
variant: "ghost",
|
|
1031
1096
|
size: "icon",
|
|
1032
1097
|
className: "h-7 w-7",
|
|
1033
|
-
onClick: () =>
|
|
1098
|
+
onClick: () => g.open(t),
|
|
1034
1099
|
"data-testid": `button-edit-${t.id}`,
|
|
1035
|
-
children: /* @__PURE__ */ e(
|
|
1100
|
+
children: /* @__PURE__ */ e(Ae, { className: "w-3 h-3" })
|
|
1036
1101
|
}
|
|
1037
1102
|
),
|
|
1038
|
-
|
|
1039
|
-
|
|
1103
|
+
j && t.type !== "object" && /* @__PURE__ */ e(
|
|
1104
|
+
I,
|
|
1040
1105
|
{
|
|
1041
1106
|
variant: "ghost",
|
|
1042
1107
|
size: "icon",
|
|
1043
1108
|
className: "h-7 w-7",
|
|
1044
|
-
onClick:
|
|
1109
|
+
onClick: f.addChild,
|
|
1045
1110
|
"data-testid": `button-add-child-${t.id}`,
|
|
1046
1111
|
children: /* @__PURE__ */ e(B, { className: "w-3 h-3" })
|
|
1047
1112
|
}
|
|
1048
1113
|
),
|
|
1049
1114
|
/* @__PURE__ */ e(
|
|
1050
|
-
|
|
1115
|
+
I,
|
|
1051
1116
|
{
|
|
1052
1117
|
variant: "ghost",
|
|
1053
1118
|
size: "icon",
|
|
1054
1119
|
className: "h-7 w-7 text-muted-foreground hover:text-destructive",
|
|
1055
1120
|
onClick: a,
|
|
1056
1121
|
"data-testid": `button-delete-${t.id}`,
|
|
1057
|
-
children: /* @__PURE__ */ e(
|
|
1122
|
+
children: /* @__PURE__ */ e(me, { className: "w-3 h-3" })
|
|
1058
1123
|
}
|
|
1059
1124
|
)
|
|
1060
1125
|
] })
|
|
1061
1126
|
] }),
|
|
1062
|
-
|
|
1127
|
+
q && /* @__PURE__ */ e(
|
|
1063
1128
|
"div",
|
|
1064
1129
|
{
|
|
1065
|
-
className:
|
|
1066
|
-
children: t.children.map((
|
|
1130
|
+
className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
|
|
1131
|
+
children: t.children.map((p) => /* @__PURE__ */ e(
|
|
1067
1132
|
Q,
|
|
1068
1133
|
{
|
|
1069
|
-
property:
|
|
1070
|
-
onUpdate: (
|
|
1071
|
-
onDelete: () =>
|
|
1072
|
-
level:
|
|
1073
|
-
showRegex:
|
|
1134
|
+
property: p,
|
|
1135
|
+
onUpdate: (z) => f.updateChild(p.id, z),
|
|
1136
|
+
onDelete: () => f.deleteChild(p.id),
|
|
1137
|
+
level: l + 1,
|
|
1138
|
+
showRegex: d,
|
|
1074
1139
|
keyEditable: r
|
|
1075
1140
|
},
|
|
1076
|
-
|
|
1141
|
+
p.id
|
|
1077
1142
|
))
|
|
1078
1143
|
}
|
|
1079
1144
|
),
|
|
1080
1145
|
t.type === "array" && t.items && /* @__PURE__ */ s(
|
|
1081
1146
|
"div",
|
|
1082
1147
|
{
|
|
1083
|
-
className:
|
|
1148
|
+
className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
|
|
1084
1149
|
children: [
|
|
1085
1150
|
/* @__PURE__ */ s("div", { className: "mb-2 text-xs text-muted-foreground font-semibold uppercase", children: [
|
|
1086
|
-
|
|
1151
|
+
m("array"),
|
|
1087
1152
|
" Items"
|
|
1088
1153
|
] }),
|
|
1089
1154
|
/* @__PURE__ */ e(
|
|
1090
1155
|
Q,
|
|
1091
1156
|
{
|
|
1092
1157
|
property: t.items,
|
|
1093
|
-
onUpdate: (
|
|
1158
|
+
onUpdate: (p) => i({ ...t, items: p }),
|
|
1094
1159
|
onDelete: () => i({ ...t, items: void 0 }),
|
|
1095
|
-
level:
|
|
1160
|
+
level: l + 1,
|
|
1096
1161
|
isArrayItem: !0,
|
|
1097
|
-
showRegex:
|
|
1162
|
+
showRegex: d,
|
|
1098
1163
|
keyEditable: r
|
|
1099
1164
|
}
|
|
1100
1165
|
)
|
|
@@ -1104,134 +1169,129 @@ function Q({
|
|
|
1104
1169
|
/* @__PURE__ */ e(
|
|
1105
1170
|
G,
|
|
1106
1171
|
{
|
|
1107
|
-
property:
|
|
1108
|
-
open:
|
|
1109
|
-
onOpenChange:
|
|
1110
|
-
onSave: (
|
|
1111
|
-
i(
|
|
1172
|
+
property: g.data || t,
|
|
1173
|
+
open: g.isOpen,
|
|
1174
|
+
onOpenChange: g.setIsOpen,
|
|
1175
|
+
onSave: (p) => {
|
|
1176
|
+
i(p), g.close();
|
|
1112
1177
|
},
|
|
1113
1178
|
isArrayItem: n,
|
|
1114
1179
|
isNewProperty: !1,
|
|
1115
|
-
showRegex:
|
|
1180
|
+
showRegex: d,
|
|
1116
1181
|
keyEditable: r
|
|
1117
1182
|
}
|
|
1118
1183
|
),
|
|
1119
|
-
|
|
1184
|
+
f.addChildDialog.isOpen && f.addChildDialog.data && /* @__PURE__ */ e(
|
|
1120
1185
|
G,
|
|
1121
1186
|
{
|
|
1122
|
-
property:
|
|
1123
|
-
open:
|
|
1187
|
+
property: f.addChildDialog.data,
|
|
1188
|
+
open: f.addChildDialog.isOpen,
|
|
1124
1189
|
isNewProperty: !0,
|
|
1125
|
-
onOpenChange:
|
|
1126
|
-
onSave:
|
|
1127
|
-
showRegex:
|
|
1190
|
+
onOpenChange: f.addChildDialog.setIsOpen,
|
|
1191
|
+
onSave: f.addChildDialog.confirm,
|
|
1192
|
+
showRegex: d,
|
|
1128
1193
|
keyEditable: r
|
|
1129
1194
|
}
|
|
1130
1195
|
)
|
|
1131
1196
|
] });
|
|
1132
1197
|
}
|
|
1133
|
-
const ne =
|
|
1198
|
+
const ne = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
1134
1199
|
"div",
|
|
1135
1200
|
{
|
|
1136
1201
|
ref: a,
|
|
1137
|
-
className:
|
|
1138
|
-
"rounded-xl border bg-card text-card-foreground shadow",
|
|
1139
|
-
t
|
|
1140
|
-
),
|
|
1202
|
+
className: h("rounded-xl border bg-card text-card-foreground", t),
|
|
1141
1203
|
...i
|
|
1142
1204
|
}
|
|
1143
1205
|
));
|
|
1144
1206
|
ne.displayName = "Card";
|
|
1145
|
-
const
|
|
1207
|
+
const lt = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
1146
1208
|
"div",
|
|
1147
1209
|
{
|
|
1148
1210
|
ref: a,
|
|
1149
|
-
className:
|
|
1211
|
+
className: h("flex flex-col space-y-1.5 p-6", t),
|
|
1150
1212
|
...i
|
|
1151
1213
|
}
|
|
1152
1214
|
));
|
|
1153
|
-
|
|
1154
|
-
const
|
|
1215
|
+
lt.displayName = "CardHeader";
|
|
1216
|
+
const dt = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
1155
1217
|
"div",
|
|
1156
1218
|
{
|
|
1157
1219
|
ref: a,
|
|
1158
|
-
className:
|
|
1220
|
+
className: h("font-semibold leading-none tracking-tight", t),
|
|
1159
1221
|
...i
|
|
1160
1222
|
}
|
|
1161
1223
|
));
|
|
1162
|
-
|
|
1163
|
-
const
|
|
1224
|
+
dt.displayName = "CardTitle";
|
|
1225
|
+
const ot = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
1164
1226
|
"div",
|
|
1165
1227
|
{
|
|
1166
1228
|
ref: a,
|
|
1167
|
-
className:
|
|
1229
|
+
className: h("text-sm text-muted-foreground", t),
|
|
1168
1230
|
...i
|
|
1169
1231
|
}
|
|
1170
1232
|
));
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
const
|
|
1233
|
+
ot.displayName = "CardDescription";
|
|
1234
|
+
const ct = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e("div", { ref: a, className: h("p-6 pt-0", t), ...i }));
|
|
1235
|
+
ct.displayName = "CardContent";
|
|
1236
|
+
const mt = b.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
|
|
1175
1237
|
"div",
|
|
1176
1238
|
{
|
|
1177
1239
|
ref: a,
|
|
1178
|
-
className:
|
|
1240
|
+
className: h("flex items-center p-6 pt-0", t),
|
|
1179
1241
|
...i
|
|
1180
1242
|
}
|
|
1181
1243
|
));
|
|
1182
|
-
|
|
1183
|
-
const
|
|
1244
|
+
mt.displayName = "CardFooter";
|
|
1245
|
+
const ut = () => new Promise((t, i) => {
|
|
1184
1246
|
const a = document.createElement("input");
|
|
1185
|
-
a.type = "file", a.accept = ".json", a.onchange = (
|
|
1186
|
-
|
|
1187
|
-
const n = (r = d.target.files) == null ? void 0 : r[0];
|
|
1247
|
+
a.type = "file", a.accept = ".json", a.onchange = (l) => {
|
|
1248
|
+
const n = l.target.files?.[0];
|
|
1188
1249
|
if (!n) {
|
|
1189
1250
|
i(new Error("No file selected"));
|
|
1190
1251
|
return;
|
|
1191
1252
|
}
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1194
|
-
var C;
|
|
1253
|
+
const d = new FileReader();
|
|
1254
|
+
d.onload = (r) => {
|
|
1195
1255
|
try {
|
|
1196
|
-
const
|
|
1197
|
-
t(
|
|
1256
|
+
const m = JSON.parse(r.target?.result);
|
|
1257
|
+
t(m);
|
|
1198
1258
|
} catch {
|
|
1199
1259
|
i(new Error("Invalid JSON file"));
|
|
1200
1260
|
}
|
|
1201
|
-
},
|
|
1261
|
+
}, d.onerror = () => i(new Error("Failed to read file")), d.readAsText(n);
|
|
1202
1262
|
}, a.click();
|
|
1203
|
-
}),
|
|
1204
|
-
const a = JSON.stringify(t, null, 2),
|
|
1205
|
-
|
|
1263
|
+
}), Ce = (t, i = "schema.json") => {
|
|
1264
|
+
const a = JSON.stringify(t, null, 2), l = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(l), d = document.createElement("a");
|
|
1265
|
+
d.href = n, d.download = i, document.body.appendChild(d), d.click(), document.body.removeChild(d), URL.revokeObjectURL(n);
|
|
1206
1266
|
};
|
|
1207
|
-
function
|
|
1208
|
-
const [i, a] =
|
|
1267
|
+
function ht({ schema: t }) {
|
|
1268
|
+
const [i, a] = P(!1), l = JSON.stringify(t, null, 2);
|
|
1209
1269
|
return /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
|
|
1210
1270
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between p-4 border-b", children: [
|
|
1211
1271
|
/* @__PURE__ */ e("h2", { className: "text-sm font-medium", children: "JSON Schema Output" }),
|
|
1212
1272
|
/* @__PURE__ */ s("div", { className: "flex gap-2", children: [
|
|
1213
1273
|
/* @__PURE__ */ e(
|
|
1214
|
-
|
|
1274
|
+
I,
|
|
1215
1275
|
{
|
|
1216
1276
|
variant: "outline",
|
|
1217
1277
|
size: "sm",
|
|
1218
1278
|
onClick: async () => {
|
|
1219
|
-
await navigator.clipboard.writeText(
|
|
1279
|
+
await navigator.clipboard.writeText(l), a(!0), setTimeout(() => a(!1), 2e3);
|
|
1220
1280
|
},
|
|
1221
1281
|
"data-testid": "button-copy",
|
|
1222
|
-
children: i ? /* @__PURE__ */ e(Be, { className: "w-4 h-4" }) : /* @__PURE__ */ e(
|
|
1282
|
+
children: i ? /* @__PURE__ */ e(Be, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Me, { className: "w-4 h-4" })
|
|
1223
1283
|
}
|
|
1224
1284
|
),
|
|
1225
1285
|
/* @__PURE__ */ e(
|
|
1226
|
-
|
|
1286
|
+
I,
|
|
1227
1287
|
{
|
|
1228
1288
|
variant: "outline",
|
|
1229
1289
|
size: "sm",
|
|
1230
1290
|
onClick: () => {
|
|
1231
|
-
|
|
1291
|
+
Ce(t, "schema.json");
|
|
1232
1292
|
},
|
|
1233
1293
|
"data-testid": "button-download",
|
|
1234
|
-
children: /* @__PURE__ */ e(
|
|
1294
|
+
children: /* @__PURE__ */ e($e, { className: "w-4 h-4" })
|
|
1235
1295
|
}
|
|
1236
1296
|
)
|
|
1237
1297
|
] })
|
|
@@ -1241,29 +1301,29 @@ function ut({ schema: t }) {
|
|
|
1241
1301
|
{
|
|
1242
1302
|
className: "p-6 text-xs font-mono overflow-auto",
|
|
1243
1303
|
"data-testid": "text-json-output",
|
|
1244
|
-
children: /* @__PURE__ */ e("code", { children:
|
|
1304
|
+
children: /* @__PURE__ */ e("code", { children: l })
|
|
1245
1305
|
}
|
|
1246
1306
|
) }) })
|
|
1247
1307
|
] });
|
|
1248
1308
|
}
|
|
1249
|
-
function
|
|
1309
|
+
function ft({
|
|
1250
1310
|
title: t,
|
|
1251
1311
|
description: i,
|
|
1252
1312
|
version: a,
|
|
1253
|
-
onUpdate:
|
|
1313
|
+
onUpdate: l
|
|
1254
1314
|
}) {
|
|
1255
|
-
const [n,
|
|
1315
|
+
const [n, d] = P(!1);
|
|
1256
1316
|
return /* @__PURE__ */ s(ne, { className: "p-4", children: [
|
|
1257
1317
|
/* @__PURE__ */ s(
|
|
1258
|
-
|
|
1318
|
+
I,
|
|
1259
1319
|
{
|
|
1260
1320
|
variant: "ghost",
|
|
1261
|
-
onClick: () =>
|
|
1321
|
+
onClick: () => d(!n),
|
|
1262
1322
|
className: "w-full justify-between px-2 h-auto hover:bg-transparent",
|
|
1263
1323
|
"data-testid": "button-toggle-metadata",
|
|
1264
1324
|
children: [
|
|
1265
1325
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium", children: "Schema Metadata" }),
|
|
1266
|
-
n ? /* @__PURE__ */ e(ee, { className: "w-4 h-4" }) : /* @__PURE__ */ e(
|
|
1326
|
+
n ? /* @__PURE__ */ e(ee, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Ke, { className: "w-4 h-4" })
|
|
1267
1327
|
]
|
|
1268
1328
|
}
|
|
1269
1329
|
),
|
|
@@ -1283,7 +1343,7 @@ function ht({
|
|
|
1283
1343
|
id: "schema-title",
|
|
1284
1344
|
placeholder: "My Schema",
|
|
1285
1345
|
value: t,
|
|
1286
|
-
onChange: (r) =>
|
|
1346
|
+
onChange: (r) => l("title", r.target.value),
|
|
1287
1347
|
"data-testid": "input-title"
|
|
1288
1348
|
}
|
|
1289
1349
|
)
|
|
@@ -1303,7 +1363,7 @@ function ht({
|
|
|
1303
1363
|
id: "schema-description",
|
|
1304
1364
|
placeholder: "Describe your schema...",
|
|
1305
1365
|
value: i,
|
|
1306
|
-
onChange: (r) =>
|
|
1366
|
+
onChange: (r) => l("description", r.target.value),
|
|
1307
1367
|
className: "resize-none",
|
|
1308
1368
|
rows: 3,
|
|
1309
1369
|
"data-testid": "input-schema-description"
|
|
@@ -1325,7 +1385,7 @@ function ht({
|
|
|
1325
1385
|
id: "schema-version",
|
|
1326
1386
|
placeholder: "1.0.0",
|
|
1327
1387
|
value: a,
|
|
1328
|
-
onChange: (r) =>
|
|
1388
|
+
onChange: (r) => l("version", r.target.value),
|
|
1329
1389
|
"data-testid": "input-version"
|
|
1330
1390
|
}
|
|
1331
1391
|
)
|
|
@@ -1334,14 +1394,14 @@ function ht({
|
|
|
1334
1394
|
] });
|
|
1335
1395
|
}
|
|
1336
1396
|
const M = (t, i, a = !0) => {
|
|
1337
|
-
const
|
|
1397
|
+
const l = {
|
|
1338
1398
|
type: "object"
|
|
1339
1399
|
};
|
|
1340
|
-
a && i && (i.title && (
|
|
1400
|
+
a && i && (i.title && (l.title = i.title), i.description && (l.description = i.description));
|
|
1341
1401
|
const n = W(t);
|
|
1342
|
-
Object.keys(n).length > 0 && (
|
|
1343
|
-
const
|
|
1344
|
-
return
|
|
1402
|
+
Object.keys(n).length > 0 && (l.properties = n);
|
|
1403
|
+
const d = t.filter((r) => r.required && r.key).map((r) => r.key);
|
|
1404
|
+
return d.length > 0 && (l.required = d), l;
|
|
1345
1405
|
}, W = (t) => {
|
|
1346
1406
|
const i = {};
|
|
1347
1407
|
return t.forEach((a) => {
|
|
@@ -1351,12 +1411,12 @@ const M = (t, i, a = !0) => {
|
|
|
1351
1411
|
type: a.items.type
|
|
1352
1412
|
})), a.type === "object" && a.children && a.children.length > 0) {
|
|
1353
1413
|
n.properties = W(a.children);
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1414
|
+
const d = a.children.filter((r) => r.required && r.key).map((r) => r.key);
|
|
1415
|
+
d.length > 0 && (n.required = d);
|
|
1356
1416
|
}
|
|
1357
1417
|
i[a.key] = n;
|
|
1358
1418
|
}), i;
|
|
1359
|
-
},
|
|
1419
|
+
}, pt = (t) => {
|
|
1360
1420
|
const i = {
|
|
1361
1421
|
properties: []
|
|
1362
1422
|
};
|
|
@@ -1369,274 +1429,273 @@ const M = (t, i, a = !0) => {
|
|
|
1369
1429
|
t.properties,
|
|
1370
1430
|
Array.isArray(t.required) ? t.required : []
|
|
1371
1431
|
)), i;
|
|
1372
|
-
}, Y = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a,
|
|
1373
|
-
const n =
|
|
1374
|
-
let
|
|
1375
|
-
|
|
1432
|
+
}, Y = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, l]) => {
|
|
1433
|
+
const n = l;
|
|
1434
|
+
let d = typeof n.type == "string" ? n.type : "string";
|
|
1435
|
+
d === "string" && n.format === "filename" && (d = "file");
|
|
1376
1436
|
const r = {
|
|
1377
1437
|
id: ae(),
|
|
1378
1438
|
key: a,
|
|
1379
1439
|
title: typeof n.title == "string" ? n.title : void 0,
|
|
1380
|
-
type:
|
|
1440
|
+
type: d,
|
|
1381
1441
|
description: typeof n.description == "string" ? n.description : void 0,
|
|
1382
1442
|
required: i.includes(a)
|
|
1383
1443
|
};
|
|
1384
1444
|
return n.minLength !== void 0 && (r.minLength = n.minLength), n.maxLength !== void 0 && (r.maxLength = n.maxLength), n.pattern && (r.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (r.enum = n.enum), n.minimum !== void 0 && (r.minimum = n.minimum), n.maximum !== void 0 && (r.maximum = n.maximum), n.minItems !== void 0 && (r.minItems = n.minItems), n.maxItems !== void 0 && (r.maxItems = n.maxItems), n.uniqueItems && (r.uniqueItems = n.uniqueItems), r.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (r.items = Y(
|
|
1385
1445
|
{ item: n.items },
|
|
1386
1446
|
[]
|
|
1387
|
-
).find((
|
|
1447
|
+
).find((m) => m.key === "item")), n.properties && typeof n.properties == "object" && (r.children = Y(
|
|
1388
1448
|
n.properties,
|
|
1389
1449
|
Array.isArray(n.required) ? n.required : []
|
|
1390
1450
|
)), r;
|
|
1391
|
-
}) : [],
|
|
1451
|
+
}) : [], gt = ({
|
|
1392
1452
|
schema: t,
|
|
1393
1453
|
onChange: i,
|
|
1394
1454
|
includeMetadata: a = !0
|
|
1395
1455
|
}) => {
|
|
1396
|
-
const { properties:
|
|
1397
|
-
() =>
|
|
1456
|
+
const { properties: l, metadata: n } = Te(
|
|
1457
|
+
() => pt(t),
|
|
1398
1458
|
[t]
|
|
1399
|
-
),
|
|
1459
|
+
), d = l, r = n || {
|
|
1400
1460
|
title: "",
|
|
1401
1461
|
description: "",
|
|
1402
1462
|
version: ""
|
|
1403
|
-
},
|
|
1463
|
+
}, m = E(() => ({
|
|
1404
1464
|
id: ae(),
|
|
1405
1465
|
key: "",
|
|
1406
1466
|
type: "string",
|
|
1407
1467
|
required: !1
|
|
1408
|
-
}), []),
|
|
1409
|
-
(
|
|
1410
|
-
const
|
|
1411
|
-
let
|
|
1412
|
-
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1468
|
+
}), []), k = E(
|
|
1469
|
+
(v, j) => {
|
|
1470
|
+
const q = d.some((p) => p.id === v);
|
|
1471
|
+
let S;
|
|
1472
|
+
q ? S = d.map((p) => p.id === v ? j : p) : S = [...d, j];
|
|
1473
|
+
const x = M(
|
|
1474
|
+
S,
|
|
1415
1475
|
r,
|
|
1416
1476
|
a
|
|
1417
1477
|
);
|
|
1418
|
-
i(
|
|
1478
|
+
i(x);
|
|
1419
1479
|
},
|
|
1420
|
-
[
|
|
1421
|
-
),
|
|
1422
|
-
(
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1480
|
+
[d, r, a, i]
|
|
1481
|
+
), g = E(
|
|
1482
|
+
(v) => {
|
|
1483
|
+
const j = d.filter((S) => S.id !== v), q = M(
|
|
1484
|
+
j,
|
|
1425
1485
|
r,
|
|
1426
1486
|
a
|
|
1427
1487
|
);
|
|
1428
|
-
i(
|
|
1488
|
+
i(q);
|
|
1429
1489
|
},
|
|
1430
|
-
[
|
|
1431
|
-
),
|
|
1432
|
-
const
|
|
1433
|
-
i(
|
|
1434
|
-
}, [a, i]),
|
|
1435
|
-
(
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
|
|
1490
|
+
[d, r, a, i]
|
|
1491
|
+
), y = E(() => {
|
|
1492
|
+
const j = M([], { title: "", description: "" }, a);
|
|
1493
|
+
i(j);
|
|
1494
|
+
}, [a, i]), u = E(
|
|
1495
|
+
(v, j) => {
|
|
1496
|
+
const q = { ...r, [v]: j }, S = M(
|
|
1497
|
+
d,
|
|
1498
|
+
q,
|
|
1439
1499
|
a
|
|
1440
1500
|
);
|
|
1441
|
-
i(
|
|
1501
|
+
i(S);
|
|
1442
1502
|
},
|
|
1443
|
-
[
|
|
1444
|
-
),
|
|
1445
|
-
const
|
|
1446
|
-
i(
|
|
1447
|
-
}, [i]),
|
|
1448
|
-
|
|
1503
|
+
[d, r, a, i]
|
|
1504
|
+
), o = E(async () => {
|
|
1505
|
+
const v = await ut();
|
|
1506
|
+
i(v);
|
|
1507
|
+
}, [i]), f = E(() => {
|
|
1508
|
+
Ce(t, "schema.json");
|
|
1449
1509
|
}, [t]);
|
|
1450
1510
|
return {
|
|
1451
|
-
properties:
|
|
1511
|
+
properties: d,
|
|
1452
1512
|
metadata: r,
|
|
1453
|
-
addProperty:
|
|
1454
|
-
updateProperty:
|
|
1455
|
-
deleteProperty:
|
|
1456
|
-
clearAll:
|
|
1457
|
-
updateMetadata:
|
|
1458
|
-
importSchema:
|
|
1459
|
-
downloadSchema:
|
|
1513
|
+
addProperty: m,
|
|
1514
|
+
updateProperty: k,
|
|
1515
|
+
deleteProperty: g,
|
|
1516
|
+
clearAll: y,
|
|
1517
|
+
updateMetadata: u,
|
|
1518
|
+
importSchema: o,
|
|
1519
|
+
downloadSchema: f
|
|
1460
1520
|
};
|
|
1461
1521
|
};
|
|
1462
|
-
function
|
|
1463
|
-
const [t, i] =
|
|
1522
|
+
function vt() {
|
|
1523
|
+
const [t, i] = P("light");
|
|
1464
1524
|
return Z(() => {
|
|
1465
1525
|
const n = localStorage.getItem("theme") || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
1466
1526
|
i(n), document.documentElement.classList.toggle("dark", n === "dark");
|
|
1467
1527
|
}, []), /* @__PURE__ */ e(
|
|
1468
|
-
|
|
1528
|
+
I,
|
|
1469
1529
|
{
|
|
1470
1530
|
variant: "ghost",
|
|
1471
1531
|
size: "icon",
|
|
1472
1532
|
onClick: () => {
|
|
1473
|
-
const
|
|
1474
|
-
i(
|
|
1533
|
+
const l = t === "light" ? "dark" : "light";
|
|
1534
|
+
i(l), localStorage.setItem("theme", l), document.documentElement.classList.toggle("dark", l === "dark");
|
|
1475
1535
|
},
|
|
1476
1536
|
"data-testid": "button-theme-toggle",
|
|
1477
|
-
children: t === "light" ? /* @__PURE__ */ e(
|
|
1537
|
+
children: t === "light" ? /* @__PURE__ */ e(Je, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Ve, { className: "w-4 h-4" })
|
|
1478
1538
|
}
|
|
1479
1539
|
);
|
|
1480
1540
|
}
|
|
1481
|
-
function
|
|
1541
|
+
function St({
|
|
1482
1542
|
schema: t,
|
|
1483
1543
|
onChange: i,
|
|
1484
1544
|
showMetadata: a = !1,
|
|
1485
|
-
showImport:
|
|
1545
|
+
showImport: l = !0,
|
|
1486
1546
|
showClear: n = !0,
|
|
1487
|
-
showOutput:
|
|
1547
|
+
showOutput: d = !0,
|
|
1488
1548
|
showHeader: r = !0,
|
|
1489
|
-
className:
|
|
1490
|
-
showSummary:
|
|
1491
|
-
typeLabels:
|
|
1492
|
-
propertyLabel:
|
|
1493
|
-
showRegex:
|
|
1494
|
-
keyEditable:
|
|
1549
|
+
className: m = "",
|
|
1550
|
+
showSummary: k = !1,
|
|
1551
|
+
typeLabels: g,
|
|
1552
|
+
propertyLabel: y = { singular: "property", plural: "properties" },
|
|
1553
|
+
showRegex: u = !1,
|
|
1554
|
+
keyEditable: o = !1
|
|
1495
1555
|
}) {
|
|
1496
1556
|
const {
|
|
1497
|
-
properties:
|
|
1498
|
-
metadata:
|
|
1499
|
-
addProperty:
|
|
1500
|
-
updateProperty:
|
|
1501
|
-
deleteProperty:
|
|
1502
|
-
clearAll:
|
|
1503
|
-
updateMetadata:
|
|
1504
|
-
importSchema:
|
|
1505
|
-
} =
|
|
1557
|
+
properties: f,
|
|
1558
|
+
metadata: v,
|
|
1559
|
+
addProperty: j,
|
|
1560
|
+
updateProperty: q,
|
|
1561
|
+
deleteProperty: S,
|
|
1562
|
+
clearAll: x,
|
|
1563
|
+
updateMetadata: p,
|
|
1564
|
+
importSchema: z
|
|
1565
|
+
} = gt({
|
|
1506
1566
|
schema: t,
|
|
1507
1567
|
onChange: i,
|
|
1508
1568
|
includeMetadata: a
|
|
1509
|
-
}),
|
|
1510
|
-
createInitialData: () =>
|
|
1569
|
+
}), c = ie({
|
|
1570
|
+
createInitialData: () => j(),
|
|
1511
1571
|
onConfirm: (T) => {
|
|
1512
|
-
|
|
1572
|
+
q(T.id, T);
|
|
1513
1573
|
}
|
|
1514
|
-
}),
|
|
1515
|
-
|
|
1574
|
+
}), O = () => {
|
|
1575
|
+
x();
|
|
1516
1576
|
}, J = async () => {
|
|
1517
|
-
await
|
|
1577
|
+
await z();
|
|
1518
1578
|
};
|
|
1519
|
-
return /* @__PURE__ */ e(
|
|
1579
|
+
return /* @__PURE__ */ e(nt, { customLabels: g, children: /* @__PURE__ */ s("div", { className: `${m} flex flex-col json-schema-builder-react`, children: [
|
|
1520
1580
|
r && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
1521
|
-
|
|
1522
|
-
|
|
1581
|
+
l && /* @__PURE__ */ e(
|
|
1582
|
+
I,
|
|
1523
1583
|
{
|
|
1524
1584
|
variant: "outline",
|
|
1525
1585
|
size: "sm",
|
|
1526
1586
|
onClick: J,
|
|
1527
1587
|
"data-testid": "button-import",
|
|
1528
|
-
children: /* @__PURE__ */ e(
|
|
1588
|
+
children: /* @__PURE__ */ e(He, { className: "w-4 h-4" })
|
|
1529
1589
|
}
|
|
1530
1590
|
),
|
|
1531
1591
|
n && /* @__PURE__ */ e(
|
|
1532
|
-
|
|
1592
|
+
I,
|
|
1533
1593
|
{
|
|
1534
1594
|
variant: "outline",
|
|
1535
1595
|
size: "sm",
|
|
1536
|
-
onClick:
|
|
1537
|
-
disabled:
|
|
1596
|
+
onClick: O,
|
|
1597
|
+
disabled: f.length === 0,
|
|
1538
1598
|
"data-testid": "button-clear",
|
|
1539
|
-
children: /* @__PURE__ */ e(
|
|
1599
|
+
children: /* @__PURE__ */ e(me, { className: "w-4 h-4" })
|
|
1540
1600
|
}
|
|
1541
1601
|
),
|
|
1542
|
-
/* @__PURE__ */ e(
|
|
1602
|
+
/* @__PURE__ */ e(vt, {})
|
|
1543
1603
|
] }) }),
|
|
1544
1604
|
/* @__PURE__ */ s("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
1545
|
-
/* @__PURE__ */ e("div", { className:
|
|
1605
|
+
/* @__PURE__ */ e("div", { className: d ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
|
|
1546
1606
|
/* @__PURE__ */ s("div", { className: "flex-1 overflow-auto p-2 space-y-4", children: [
|
|
1547
1607
|
a && /* @__PURE__ */ e(
|
|
1548
|
-
|
|
1608
|
+
ft,
|
|
1549
1609
|
{
|
|
1550
|
-
title:
|
|
1551
|
-
description:
|
|
1552
|
-
version:
|
|
1553
|
-
onUpdate: (T, R) =>
|
|
1610
|
+
title: v.title,
|
|
1611
|
+
description: v.description,
|
|
1612
|
+
version: v.version,
|
|
1613
|
+
onUpdate: (T, R) => p(T, R)
|
|
1554
1614
|
}
|
|
1555
1615
|
),
|
|
1556
|
-
|
|
1616
|
+
f.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
1557
1617
|
/* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4", children: /* @__PURE__ */ e(B, { className: "w-8 h-8 text-muted-foreground" }) }),
|
|
1558
1618
|
/* @__PURE__ */ s("h2", { className: "text-lg font-medium mb-2", children: [
|
|
1559
1619
|
"No ",
|
|
1560
|
-
|
|
1620
|
+
y.plural,
|
|
1561
1621
|
" yet"
|
|
1562
1622
|
] }),
|
|
1563
1623
|
/* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground mb-6 max-w-sm", children: [
|
|
1564
1624
|
"Start building your JSON schema by adding your first",
|
|
1565
1625
|
" ",
|
|
1566
|
-
|
|
1626
|
+
y.singular
|
|
1567
1627
|
] }),
|
|
1568
1628
|
/* @__PURE__ */ s(
|
|
1569
|
-
|
|
1629
|
+
I,
|
|
1570
1630
|
{
|
|
1571
|
-
onClick: () =>
|
|
1631
|
+
onClick: () => c.open(),
|
|
1572
1632
|
"data-testid": "button-add-first",
|
|
1573
1633
|
children: [
|
|
1574
1634
|
/* @__PURE__ */ e(B, { className: "w-4 h-4 mr-2" }),
|
|
1575
1635
|
"Add ",
|
|
1576
|
-
|
|
1636
|
+
y.singular
|
|
1577
1637
|
]
|
|
1578
1638
|
}
|
|
1579
1639
|
)
|
|
1580
|
-
] }) : /* @__PURE__ */ s(
|
|
1581
|
-
/* @__PURE__ */ e("div", { className: "space-y-1", children:
|
|
1640
|
+
] }) : /* @__PURE__ */ s(de, { children: [
|
|
1641
|
+
/* @__PURE__ */ e("div", { className: "space-y-1", children: f.map((T) => /* @__PURE__ */ e(
|
|
1582
1642
|
Q,
|
|
1583
1643
|
{
|
|
1584
1644
|
property: T,
|
|
1585
|
-
onUpdate: (R) =>
|
|
1586
|
-
onDelete: () =>
|
|
1587
|
-
showRegex:
|
|
1588
|
-
keyEditable:
|
|
1645
|
+
onUpdate: (R) => q(T.id, R),
|
|
1646
|
+
onDelete: () => S(T.id),
|
|
1647
|
+
showRegex: u,
|
|
1648
|
+
keyEditable: o
|
|
1589
1649
|
},
|
|
1590
1650
|
T.id
|
|
1591
1651
|
)) }),
|
|
1592
|
-
|
|
1652
|
+
k && /* @__PURE__ */ s("div", { className: "pt-4 border-t flex items-center justify-between text-sm text-muted-foreground", children: [
|
|
1593
1653
|
/* @__PURE__ */ s("span", { children: [
|
|
1594
|
-
|
|
1654
|
+
f.length,
|
|
1595
1655
|
" ",
|
|
1596
|
-
|
|
1656
|
+
f.length === 1 ? y.singular : y.plural
|
|
1597
1657
|
] }),
|
|
1598
1658
|
/* @__PURE__ */ s("span", { children: [
|
|
1599
|
-
|
|
1659
|
+
f.filter((T) => T.required).length,
|
|
1600
1660
|
" required"
|
|
1601
1661
|
] })
|
|
1602
1662
|
] })
|
|
1603
1663
|
] })
|
|
1604
1664
|
] }),
|
|
1605
|
-
|
|
1606
|
-
|
|
1665
|
+
f.length > 0 && /* @__PURE__ */ e("div", { className: "border-t p-2 pt-4 bg-background", children: /* @__PURE__ */ s(
|
|
1666
|
+
I,
|
|
1607
1667
|
{
|
|
1608
|
-
onClick: () =>
|
|
1668
|
+
onClick: () => c.open(),
|
|
1609
1669
|
className: "w-full",
|
|
1610
1670
|
variant: "outline",
|
|
1611
1671
|
"data-testid": "button-add-property",
|
|
1612
1672
|
children: [
|
|
1613
1673
|
/* @__PURE__ */ e(B, { className: "w-4 h-4" }),
|
|
1614
1674
|
"Add ",
|
|
1615
|
-
|
|
1675
|
+
y.singular
|
|
1616
1676
|
]
|
|
1617
1677
|
}
|
|
1618
1678
|
) })
|
|
1619
1679
|
] }) }),
|
|
1620
|
-
|
|
1680
|
+
d && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(ht, { schema: t }) })
|
|
1621
1681
|
] }),
|
|
1622
|
-
|
|
1682
|
+
c.isOpen && c.data && /* @__PURE__ */ e(
|
|
1623
1683
|
G,
|
|
1624
1684
|
{
|
|
1625
|
-
property:
|
|
1626
|
-
open:
|
|
1685
|
+
property: c.data,
|
|
1686
|
+
open: c.isOpen,
|
|
1627
1687
|
isNewProperty: !0,
|
|
1628
|
-
onOpenChange:
|
|
1629
|
-
propertyLabel:
|
|
1630
|
-
onSave:
|
|
1631
|
-
showRegex:
|
|
1632
|
-
keyEditable:
|
|
1688
|
+
onOpenChange: c.setIsOpen,
|
|
1689
|
+
propertyLabel: y,
|
|
1690
|
+
onSave: c.confirm,
|
|
1691
|
+
showRegex: u,
|
|
1692
|
+
keyEditable: o
|
|
1633
1693
|
}
|
|
1634
1694
|
)
|
|
1635
1695
|
] }) });
|
|
1636
1696
|
}
|
|
1637
1697
|
export {
|
|
1638
|
-
|
|
1639
|
-
G as PropertyEditDialog
|
|
1640
|
-
it as TypeLabelsProvider
|
|
1698
|
+
St as JsonSchemaBuilder,
|
|
1699
|
+
G as PropertyEditDialog
|
|
1641
1700
|
};
|
|
1642
1701
|
//# sourceMappingURL=index.js.map
|