@fuma-content/studio 1.0.3 → 1.0.4

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.
Files changed (109) hide show
  1. package/build/client/assets/{QueryClientProvider-Cys2v_1v.js → QueryClientProvider-BFSUF51X.js} +1 -1
  2. package/build/client/assets/actions-ByenKsIt.js +1 -0
  3. package/build/client/assets/actions-ClHPL1CP.js +1 -0
  4. package/build/client/assets/badge-BnhEE6iu.js +1 -0
  5. package/build/client/assets/{client-Cfd36Zz-.js → client-BEKU4RIg.js} +146 -146
  6. package/build/client/assets/client-DBU2dkUR.js +1 -0
  7. package/build/client/assets/client-DvwvjHta.js +1 -0
  8. package/build/client/assets/client-wd2sce2I.js +8 -0
  9. package/build/client/assets/dropdown-menu-By_XeFX4.js +1 -0
  10. package/build/client/assets/entry.rsc-J_U0YQEr.js +1 -0
  11. package/build/client/assets/{index-DL539Bhx.js → index-B5GacMxj.js} +1 -1
  12. package/build/client/assets/index-BTaHNKf7.js +1 -0
  13. package/build/client/assets/index-BgFxGtat.js +1 -0
  14. package/build/client/assets/index-CG_0cSZQ.js +1 -0
  15. package/build/client/assets/index-CfCSvolS.js +1 -0
  16. package/build/client/assets/{index-C37mbJ0i.js → index-D8KuzOxG.js} +1 -1
  17. package/build/client/assets/index-DrT4Adhh.js +41 -0
  18. package/build/client/assets/{index-DXHuzvfN.js → index-El_a1Yhs.js} +1 -1
  19. package/build/client/assets/index-QYLIz8qa.js +1 -0
  20. package/build/client/assets/layout-BPVd8vtW.js +1 -0
  21. package/build/client/assets/{mdx-CehodSrM.js → mdx-DBJIR6uw.js} +1 -1
  22. package/build/client/assets/page-BJL5nvn-.js +1 -0
  23. package/build/client/assets/page-eyuUZvVn.js +1 -0
  24. package/build/client/assets/popover-BowiFsDm.js +1 -0
  25. package/build/client/assets/{react-D58ornpH.js → react-CzFdRS7Y.js} +7 -7
  26. package/build/client/assets/root-7fvd-0uP.js +1 -0
  27. package/build/client/assets/root-B0B6-NU5.css +1 -0
  28. package/build/client/assets/{root-CNcQf1GA.js → root-jg-0qm8s.js} +1 -1
  29. package/build/client/assets/route-BLLsZ_zO.js +1 -0
  30. package/build/client/assets/{router-XCTsiXqQ.js → router-QEl8O8lm.js} +1 -1
  31. package/build/client/assets/select-BI356bZ1.js +1 -0
  32. package/build/client/assets/separator-0kwG7IIM.js +1 -0
  33. package/build/client/assets/sidebar-ByyQE2QS.js +12 -0
  34. package/build/client/assets/{site-header-1Aor7-g4.js → site-header-iBpA4Sim.js} +1 -1
  35. package/build/client/assets/spinner-D35u7i0p.js +1 -0
  36. package/build/client/assets/tooltip-v-_I4rCw.js +16 -0
  37. package/build/client/assets/use-sync-yCWvjE_m.js +2 -0
  38. package/build/client/assets/{yaml-DUnUkeX8.js → yaml-BnQf_2Zt.js} +1 -1
  39. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +213 -133
  40. package/build/server/__ssr_build/assets/{actions-DLZnfFzU.js → actions-C5Kv8XYU.js} +2 -2
  41. package/build/server/__ssr_build/assets/{actions-D6dLhck1.js → actions-DQIBBM15.js} +4 -4
  42. package/build/server/__ssr_build/assets/{badge-CH6ntch2.js → badge-B48L9yYO.js} +1 -1
  43. package/build/server/__ssr_build/assets/{client-C-WcMcGh.js → client-AuWNsacU.js} +3 -3
  44. package/build/server/__ssr_build/assets/client-BHaLyky8.js +1162 -0
  45. package/build/server/__ssr_build/assets/{client-DX-wDNer.js → client-BogEWrwz.js} +9 -5
  46. package/build/server/__ssr_build/assets/{client-JNaR8Jey.js → client-DXOHI3cC.js} +2808 -4397
  47. package/build/server/__ssr_build/assets/{dropdown-menu-gcIcDMHP.js → dropdown-menu-CnDgV_JY.js} +7 -9
  48. package/build/server/__ssr_build/assets/{entry.rsc-Cg_DxYkh.js → entry.rsc-aOU-YPkj.js} +1 -1
  49. package/build/server/__ssr_build/assets/{index-PpqpVA51.js → index-B6ajh-UP.js} +1 -1
  50. package/build/server/__ssr_build/assets/index-BPd5y8T-.js +76 -0
  51. package/build/server/__ssr_build/assets/{button-U-KvP9zg.js → index-By9m5mBe.js} +3272 -3175
  52. package/build/server/__ssr_build/assets/index-Ch7b9Ofo.js +37 -0
  53. package/build/server/__ssr_build/assets/{index-BJ-AF-IL.js → index-Cw6b1mnl.js} +8 -7
  54. package/build/server/__ssr_build/assets/{index-BloUStie.js → index-kCa2P0Xn.js} +4 -75
  55. package/build/server/__ssr_build/assets/{index-CWwW5yWZ.js → index-tFzyztyE.js} +2 -2
  56. package/build/server/__ssr_build/assets/{layout-B79fq6F-.js → layout-CC-HJHWR.js} +13 -11
  57. package/build/server/__ssr_build/assets/{mdx-bmeV1kyx.js → mdx-D9VFmsYC.js} +1 -1
  58. package/build/server/__ssr_build/assets/{page-CxhOzrct.js → page-BVUd9aDy.js} +10 -8
  59. package/build/server/__ssr_build/assets/{page-DxtKhA1K.js → page-C_wQzy3_.js} +13 -11
  60. package/build/server/__ssr_build/assets/popover-CzQgoguQ.js +321 -0
  61. package/build/server/__ssr_build/assets/{root-TWeSpY2W.js → root-BmMc6_zA.js} +1 -1
  62. package/build/server/__ssr_build/assets/route-CNYc37pV.js +860 -0
  63. package/build/server/__ssr_build/assets/{spinner-w3Q_wkh3.js → select-B8QQSB6X.js} +10 -25
  64. package/build/server/__ssr_build/assets/{separator-CKrKBtv4.js → separator-C601eKPH.js} +2 -2
  65. package/build/server/__ssr_build/assets/{sidebar-DoXmiwf0.js → sidebar-C6fHDjcx.js} +237 -65
  66. package/build/server/__ssr_build/assets/{site-header-pFjDV73T.js → site-header-Bmsr3a30.js} +2 -2
  67. package/build/server/__ssr_build/assets/spinner-D5zAJQcS.js +19 -0
  68. package/build/server/__ssr_build/assets/{tooltip-B2NV0tpS.js → tooltip-B3A57zPO.js} +1211 -1211
  69. package/build/server/__ssr_build/assets/{use-sync-p_-o0jkt.js → use-sync-DTZgOM1O.js} +29 -1185
  70. package/build/server/__ssr_build/assets/{yaml-BEdFfhvc.js → yaml-xJU1Ur4O.js} +1 -1
  71. package/build/server/__ssr_build/index.js +31 -15
  72. package/build/server/__vite_rsc_assets_manifest.js +213 -133
  73. package/build/server/assets/{actions-C92yn6jE.js → actions-BbMzIy5J.js} +2 -2
  74. package/build/server/assets/{actions-CWWFIcb1.js → actions-CjWBMAed.js} +2 -2
  75. package/build/server/assets/{actions-DZdN0IBq.js → actions-cRzXiMyR.js} +2 -2
  76. package/build/server/assets/{config-Cb909uq6.js → config-Dka4Bvz4.js} +10 -10
  77. package/build/server/assets/{layout-CRw_6FCt.js → layout-CIIfFN0v.js} +2 -2
  78. package/build/server/assets/{page-BfKoQQmw.js → page-pyqagPXb.js} +2 -2
  79. package/build/server/assets/root-B0B6-NU5.css +1 -0
  80. package/build/server/assets/{root-BqMNAwvK.js → root-D1ebFoST.js} +1 -1
  81. package/build/server/assets/{route-DiqCR5uw.js → route-C7QEArEP.js} +13911 -5699
  82. package/build/server/index.js +40 -15
  83. package/dist/bin.mjs +4 -4
  84. package/dist/package.mjs +1 -1
  85. package/package.json +32 -15
  86. package/build/client/assets/actions-BIaFztcg.js +0 -1
  87. package/build/client/assets/actions-Bws1O3FH.js +0 -1
  88. package/build/client/assets/badge-C70RdDmr.js +0 -1
  89. package/build/client/assets/button-B0G-joJA.js +0 -41
  90. package/build/client/assets/client-C814jsdE.js +0 -1
  91. package/build/client/assets/client-wwp8K9Xz.js +0 -1
  92. package/build/client/assets/dropdown-menu-Re3QusA0.js +0 -1
  93. package/build/client/assets/entry.rsc-CdTwhQ3_.js +0 -1
  94. package/build/client/assets/index-DZ8LIlZu.js +0 -1
  95. package/build/client/assets/index-DprkZK2S.js +0 -1
  96. package/build/client/assets/index-UnlOgAz7.js +0 -1
  97. package/build/client/assets/layout-C5TjiFIx.js +0 -1
  98. package/build/client/assets/page-CiRIEJz9.js +0 -1
  99. package/build/client/assets/page-DBIuN_hk.js +0 -1
  100. package/build/client/assets/root-CbriXo_i.css +0 -1
  101. package/build/client/assets/root-DJ8qMHCd.js +0 -1
  102. package/build/client/assets/separator-BDe8wWVP.js +0 -1
  103. package/build/client/assets/sidebar-DNKkYLTA.js +0 -12
  104. package/build/client/assets/spinner-O3ZbB6fn.js +0 -1
  105. package/build/client/assets/tooltip-B4fI3WTO.js +0 -16
  106. package/build/client/assets/use-sync-CfDyibsS.js +0 -9
  107. package/build/server/assets/root-CbriXo_i.css +0 -1
  108. /package/build/server/__ssr_build/assets/{root-BYlluTc0.js → root-S8l7oX7x.js} +0 -0
  109. /package/build/server/assets/{root-ByROcfN4.js → root-DRYtk85G.js} +0 -0
@@ -1,365 +1,18 @@
1
- import { r as reactExports, j as jsxRuntimeExports, d as We } from "../index.js";
2
- import { S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem, e as Spinner } from "./spinner-w3Q_wkh3.js";
3
- import { c as createLucideIcon, P as Primitive, h as useControllableState, a as createContextScope, k as useId, b as composeEventHandlers, g as Presence, s as cn, v as ChevronRight, w as buttonVariants, X } from "./button-U-KvP9zg.js";
4
- import { Ajv2020 } from "ajv/dist/2020.js";
1
+ import { r as reactExports, j as jsxRuntimeExports, W as We } from "../index.js";
2
+ import { c as createLucideIcon, f as useControllableState, P as Primitive, u as useId, g as composeEventHandlers, q as Presence, h as createContextScope, b as cn } from "./index-By9m5mBe.js";
3
+ import { R as Root$1, I as Item, c as createRovingFocusGroupScope } from "./index-kCa2P0Xn.js";
4
+ import { u as useDirection, C as Check } from "./index-BPd5y8T-.js";
5
+ import { P as Primitive$1 } from "./index-Ch7b9Ofo.js";
5
6
  import { cva } from "class-variance-authority";
6
- import { u as useDirection, c as createRovingFocusGroupScope, R as Root$1, I as Item, C as Check } from "./index-BloUStie.js";
7
- const __iconNode$3 = [
7
+ import { S as Spinner } from "./spinner-D5zAJQcS.js";
8
+ const __iconNode$1 = [
8
9
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
9
10
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
10
11
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
11
12
  ];
12
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$3);
13
- const __iconNode$2 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
14
- const Circle = createLucideIcon("circle", __iconNode$2);
15
- const __iconNode$1 = [
16
- ["path", { d: "M5 12h14", key: "1ays0h" }],
17
- ["path", { d: "M12 5v14", key: "s699le" }]
18
- ];
19
- const Plus = createLucideIcon("plus", __iconNode$1);
20
- const __iconNode = [
21
- ["path", { d: "M10 11v6", key: "nco0om" }],
22
- ["path", { d: "M14 11v6", key: "outv1u" }],
23
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
24
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
25
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
26
- ];
27
- const Trash2 = createLucideIcon("trash-2", __iconNode);
28
- function objectGet(obj, key) {
29
- let cur = obj;
30
- for (const prop of key) {
31
- if (typeof cur !== "object" || cur === null || !(prop in cur)) return;
32
- cur = cur[prop];
33
- }
34
- return cur;
35
- }
36
- function objectSet(obj, key, value) {
37
- if (key.length === 0) return value;
38
- const parent = objectGet(obj, key.slice(0, -1));
39
- if (typeof parent !== "object" || parent === null) throw new Error("missing parent object");
40
- parent[key[key.length - 1]] = value;
41
- return obj;
42
- }
43
- function deepEqual$2(a, b) {
44
- if (a === b) return true;
45
- if (a == null || b == null) return false;
46
- if (typeof a !== "object" || typeof b !== "object") return false;
47
- if (Array.isArray(a) && Array.isArray(b)) {
48
- if (a.length !== b.length) return false;
49
- return a.every((item, index) => deepEqual$2(item, b[index]));
50
- }
51
- if (Array.isArray(a) || Array.isArray(b)) return false;
52
- const keysA = Object.keys(a);
53
- const keysB = Object.keys(b);
54
- if (keysA.length !== keysB.length) return false;
55
- return keysA.every((key) => Object.prototype.hasOwnProperty.call(b, key) && deepEqual$2(a[key], b[key]));
56
- }
57
- function stringifyFieldKey(fieldKey) {
58
- return fieldKey.map((v) => `${typeof v}:${v}`).join(".");
59
- }
60
- const Context = reactExports.createContext(null);
61
- function StfProvider({ value, children }) {
62
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Context, {
63
- value,
64
- children
65
- });
66
- }
67
- function useStf(options) {
68
- const { defaultValues } = options;
69
- const dataEngine = reactExports.useMemo(() => new DataEngine(defaultValues), []);
70
- return reactExports.useMemo(() => ({ dataEngine }), [dataEngine]);
71
- }
72
- function useDataEngine(stf) {
73
- if (stf) return stf.dataEngine;
74
- return reactExports.use(Context).dataEngine;
75
- }
76
- function useArray(field, options = {}) {
77
- const engine = useDataEngine();
78
- const [items] = useFieldValue(field, {
79
- defaultValue: options.defaultValue,
80
- compute(value) {
81
- const items$1 = [];
82
- if (Array.isArray(value)) for (let i = 0; i < value.length; i++) items$1.push({
83
- field: [...field, i],
84
- index: i
85
- });
86
- return items$1;
87
- },
88
- isChanged(prev, next) {
89
- return prev.length !== next.length;
90
- }
91
- });
92
- return {
93
- items,
94
- insertItem(itemValue) {
95
- const value = engine.get(field);
96
- engine.update(field, Array.isArray(value) ? [...value, itemValue] : [itemValue]);
97
- },
98
- removeItem(index) {
99
- engine.delete([...field, index]);
100
- }
101
- };
102
- }
103
- function useObject(field, options) {
104
- const engine = useDataEngine();
105
- const [objectKeys] = useFieldValue(field, {
106
- defaultValue: options.defaultValue,
107
- compute(currentValue) {
108
- return currentValue ? Object.keys(currentValue) : [];
109
- },
110
- isChanged(prev, next) {
111
- return !deepEqual$2(prev, next);
112
- }
113
- });
114
- return {
115
- properties: reactExports.useMemo(() => {
116
- const properties = [];
117
- const unknownKeys = new Set(objectKeys);
118
- for (const [key, prop] of Object.entries(options.properties)) {
119
- unknownKeys.delete(key);
120
- properties.push({
121
- kind: "fixed",
122
- field: [...field, key],
123
- key,
124
- info: prop
125
- });
126
- }
127
- for (const [pattern, prop] of Object.entries(options.patternProperties ?? {})) {
128
- const regex = RegExp(pattern);
129
- for (const key of unknownKeys) {
130
- if (!key.match(regex)) continue;
131
- unknownKeys.delete(key);
132
- properties.push({
133
- kind: "pattern",
134
- info: prop,
135
- key,
136
- pattern,
137
- field: [...field, key]
138
- });
139
- }
140
- }
141
- if (options.fallback) for (const key of unknownKeys) properties.push({
142
- kind: "fallback",
143
- field: [...field, key],
144
- key,
145
- info: options.fallback
146
- });
147
- return properties;
148
- }, [
149
- field,
150
- objectKeys,
151
- options.fallback,
152
- options.patternProperties,
153
- options.properties
154
- ]),
155
- onAppend(name, value) {
156
- name = name.trim();
157
- if (name.length === 0) return;
158
- engine.init([...field, name], value);
159
- },
160
- onDelete(name) {
161
- return engine.delete([...field, name]);
162
- }
163
- };
164
- }
165
- function getDefaultValue$1(defaultValue) {
166
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
167
- }
168
- var ListenerManager = class {
169
- constructor() {
170
- this.listeners = /* @__PURE__ */ new Set();
171
- this.indexed = /* @__PURE__ */ new Map();
172
- }
173
- add(listener) {
174
- if (!listener.field) {
175
- this.listeners.add(listener);
176
- return;
177
- }
178
- const key = stringifyFieldKey(listener.field);
179
- const set2 = this.indexed.get(key) ?? /* @__PURE__ */ new Set();
180
- set2.add(listener);
181
- this.indexed.set(key, set2);
182
- }
183
- remove(listener) {
184
- if (!listener.field) this.listeners.delete(listener);
185
- else this.indexed.get(stringifyFieldKey(listener.field))?.delete(listener);
186
- }
187
- onUpdate(field, ctx) {
188
- for (const v of this.listeners) v.onUpdate?.(field, ctx);
189
- const updatedKey = stringifyFieldKey(field);
190
- if (ctx.swallow) {
191
- const set2 = this.indexed.get(updatedKey);
192
- if (set2) for (const v of set2) v.onUpdate?.(field, ctx);
193
- } else for (const [k, listeners] of this.indexed.entries()) {
194
- if (k !== updatedKey && !k.startsWith(updatedKey + ".")) continue;
195
- for (const v of listeners) v.onUpdate?.(field, ctx);
196
- }
197
- }
198
- onInit(field) {
199
- for (const v of this.listeners) v.onInit?.(field);
200
- const set2 = this.indexed.get(stringifyFieldKey(field));
201
- if (set2) for (const v of set2) v.onInit?.(field);
202
- }
203
- onDelete(field) {
204
- for (const v of this.listeners) v.onDelete?.(field);
205
- const set2 = this.indexed.get(stringifyFieldKey(field));
206
- if (set2) for (const v of set2) v.onDelete?.(field);
207
- }
208
- };
209
- var DataEngine = class {
210
- constructor(defaultValues = {}) {
211
- this.attachedDataMap = /* @__PURE__ */ new Map();
212
- this.listeners = new ListenerManager();
213
- this.data = getDefaultValue$1(defaultValues);
214
- }
215
- listen(listener) {
216
- this.listeners.add(listener);
217
- }
218
- unlisten(listener) {
219
- this.listeners.remove(listener);
220
- }
221
- getData() {
222
- return this.data;
223
- }
224
- /**
225
- * init a field
226
- * @param key the key of field
227
- * @param defaultValue the initial value, the field is also created for `undefined`
228
- * @returns the value of initialized field, or the current value of field if already initialized
229
- */
230
- init(key, defaultValue) {
231
- if (key.length === 0) return this.data;
232
- let cur = this.data;
233
- const currentKey = [];
234
- for (let i = 0; i < key.length; i++) {
235
- const propKey = key[i];
236
- const propValue = cur[propKey];
237
- if (i === key.length - 1) {
238
- if (propValue !== void 0) return propValue;
239
- cur[propKey] = getDefaultValue$1(defaultValue);
240
- this.listeners.onUpdate(currentKey, { swallow: true });
241
- this.listeners.onInit(key);
242
- return cur[propKey];
243
- } else if (typeof propValue === "object" && propValue !== null) cur = propValue;
244
- else {
245
- if (propValue !== void 0) console.warn(`the original value of field ${currentKey.join(".")} is overidden, this might be unexpected.`);
246
- cur = cur[propKey] = {};
247
- this.listeners.onUpdate(currentKey, { swallow: true });
248
- }
249
- currentKey.push(propKey);
250
- }
251
- }
252
- delete(key) {
253
- if (key.length === 0) return;
254
- const parentKey = key.slice(0, -1);
255
- const prop = key[key.length - 1];
256
- const parent = this.get(parentKey);
257
- if (Array.isArray(parent) && typeof prop === "number") {
258
- const [deleted] = parent.splice(prop, 1);
259
- this.listeners.onUpdate(parentKey, { swallow: false });
260
- this.listeners.onDelete(key);
261
- return deleted;
262
- } else if (typeof parent === "object" && parent !== null) {
263
- const temp = parent[prop];
264
- delete parent[prop];
265
- this.listeners.onUpdate(parentKey, { swallow: true });
266
- this.listeners.onDelete(key);
267
- return temp;
268
- }
269
- }
270
- get(key) {
271
- return objectGet(this.data, key);
272
- }
273
- /**
274
- * update the value of field if it exists
275
- * @returns if the field is updated
276
- */
277
- update(key, value) {
278
- try {
279
- this.data = objectSet(this.data, key, value);
280
- this.listeners.onUpdate(key, { swallow: false });
281
- return true;
282
- } catch {
283
- return false;
284
- }
285
- }
286
- attachedData(namespace) {
287
- return {
288
- get: (field) => {
289
- return this.attachedDataMap.get(`${namespace}:${stringifyFieldKey(field)}`);
290
- },
291
- set: (field, value) => {
292
- this.attachedDataMap.set(`${namespace}:${stringifyFieldKey(field)}`, value);
293
- },
294
- delete: (field) => {
295
- if (field) this.attachedDataMap.delete(`${namespace}:${stringifyFieldKey(field)}`);
296
- else for (const key of this.attachedDataMap.keys()) if (key.startsWith(`${namespace}:`)) this.attachedDataMap.delete(key);
297
- }
298
- };
299
- }
300
- reset(data) {
301
- this.update([], data);
302
- this.attachedDataMap.clear();
303
- }
304
- };
305
- function useFieldValue(key, options = {}) {
306
- const engine = useDataEngine(options.stf);
307
- const { compute = (v) => v, defaultValue, isChanged = (a, b) => a !== b } = options;
308
- const [value, setValue] = reactExports.useState(() => compute(engine.init(key, defaultValue)));
309
- useListener({
310
- field: key,
311
- onUpdate() {
312
- const computed = compute(engine.get(key));
313
- if (isChanged(value, computed)) setValue(computed);
314
- },
315
- onDelete() {
316
- const computed = compute(void 0);
317
- if (isChanged(value, computed)) setValue(computed);
318
- }
319
- });
320
- return [value, (newValue) => engine.update(key, newValue)];
321
- }
322
- function useListener(listener) {
323
- const engine = useDataEngine(listener.stf);
324
- const listenerRef = reactExports.useRef(listener);
325
- listenerRef.current = listener;
326
- reactExports.useEffect(() => {
327
- const internal = {
328
- field: listener.field,
329
- onDelete(...args) {
330
- return listenerRef.current.onDelete?.(...args);
331
- },
332
- onInit(...args) {
333
- return listenerRef.current.onInit?.(...args);
334
- },
335
- onUpdate(...args) {
336
- return listenerRef.current.onUpdate?.(...args);
337
- }
338
- };
339
- engine.listen(internal);
340
- return () => {
341
- engine.unlisten(internal);
342
- };
343
- }, [engine, listener.field]);
344
- }
345
- var NAME = "Label";
346
- var Label$1 = reactExports.forwardRef((props, forwardedRef) => {
347
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
348
- Primitive.label,
349
- {
350
- ...props,
351
- ref: forwardedRef,
352
- onMouseDown: (event) => {
353
- const target = event.target;
354
- if (target.closest("button, input, select, textarea")) return;
355
- props.onMouseDown?.(event);
356
- if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
357
- }
358
- }
359
- );
360
- });
361
- Label$1.displayName = NAME;
362
- var Root = Label$1;
13
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$1);
14
+ const __iconNode = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
15
+ const Circle = createLucideIcon("circle", __iconNode);
363
16
  var TABS_NAME = "Tabs";
364
17
  var [createTabsContext] = createContextScope(TABS_NAME, [
365
18
  createRovingFocusGroupScope
@@ -534,828 +187,6 @@ var Root2 = Tabs$1;
534
187
  var List = TabsList$1;
535
188
  var Trigger = TabsTrigger$1;
536
189
  var Content = TabsContent$1;
537
- function Input({ className, type, ...props }) {
538
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
539
- "input",
540
- {
541
- type,
542
- "data-slot": "input",
543
- className: cn(
544
- "h-9 w-full min-w-0 rounded-4xl border border-input bg-input/30 px-3 py-1 text-base outline-none transition-colors file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
545
- className
546
- ),
547
- ...props
548
- }
549
- );
550
- }
551
- function getDefaultValue(schema) {
552
- if (typeof schema === "boolean") return null;
553
- const type = schema.type;
554
- if (Array.isArray(type))
555
- return getDefaultValue({
556
- ...schema,
557
- type: type[0]
558
- });
559
- if (type === "object" && typeof schema === "object")
560
- return Object.fromEntries(
561
- Object.entries(schema.properties ?? {}).map(([key, prop]) => {
562
- return [key, getDefaultValue(prop)];
563
- })
564
- );
565
- if (type === "array") return [];
566
- if (type === "null") return null;
567
- if (type === "string") {
568
- if (typeof schema === "object" && schema.format === "binary") return void 0;
569
- return "";
570
- }
571
- if (type === "number" || type === "integer") return 0;
572
- if (type === "boolean") return false;
573
- }
574
- var FormatFlags = /* @__PURE__ */ ((FormatFlags2) => {
575
- FormatFlags2[FormatFlags2["None"] = 0] = "None";
576
- FormatFlags2[FormatFlags2["UseAlias"] = 1] = "UseAlias";
577
- return FormatFlags2;
578
- })(FormatFlags || {});
579
- function schemaToString(value, flags = 0) {
580
- function union(union2, sep, flags2) {
581
- const members = /* @__PURE__ */ new Set();
582
- let nullable = false;
583
- for (const item of union2) {
584
- const result2 = run(
585
- item,
586
- flags2 | 1
587
- /* UseAlias */
588
- );
589
- if (result2 === "null") {
590
- nullable = true;
591
- } else if (result2 !== "unknown") {
592
- members.add(result2);
593
- }
594
- }
595
- const result = Array.from(members).join(sep);
596
- return nullable ? `${result} | null` : result;
597
- }
598
- function run(schema, flags2) {
599
- if (schema === true) return "any";
600
- else if (schema === false) return "never";
601
- if ((flags2 & 1) === 1) {
602
- if (schema.title) return schema.title;
603
- }
604
- if (Array.isArray(schema.type)) {
605
- return union(
606
- schema.type.map((type) => ({
607
- ...schema,
608
- type
609
- })),
610
- " | ",
611
- flags2
612
- );
613
- }
614
- if (schema.type === "array")
615
- return `array<${schema.items ? run(
616
- schema.items,
617
- flags2 | 1
618
- /* UseAlias */
619
- ) : "unknown"}>`;
620
- const or = schema.oneOf ?? schema.anyOf;
621
- if (schema.oneOf && schema.anyOf) {
622
- return `(${union(schema.oneOf, " | ", flags2)}) & (${union(schema.anyOf, " | ", flags2)})`;
623
- } else if (or) {
624
- return union(or, " | ", flags2);
625
- }
626
- if (schema.allOf) {
627
- return union(schema.allOf, " & ", flags2);
628
- }
629
- if (schema.not) return `not ${run(schema.not, flags2)}`;
630
- if (schema.type === "string" && schema.format === "binary") return "file";
631
- if (schema.type && Array.isArray(schema.type)) {
632
- return schema.type.filter((v) => v !== "null").join(" | ");
633
- }
634
- if (schema.type) {
635
- return schema.type;
636
- }
637
- return "unknown";
638
- }
639
- return run(value, flags);
640
- }
641
- function deepEqual$1(a, b) {
642
- if (a === b) {
643
- return true;
644
- }
645
- if (a == null || b == null) {
646
- return false;
647
- }
648
- if (typeof a !== "object" || typeof b !== "object") {
649
- return false;
650
- }
651
- if (Array.isArray(a) && Array.isArray(b)) {
652
- if (a.length !== b.length) {
653
- return false;
654
- }
655
- return a.every((item, index) => deepEqual$1(item, b[index]));
656
- }
657
- if (Array.isArray(a) || Array.isArray(b)) {
658
- return false;
659
- }
660
- const keysA = Object.keys(a);
661
- const keysB = Object.keys(b);
662
- if (keysA.length !== keysB.length) {
663
- return false;
664
- }
665
- return keysA.every(
666
- (key) => Object.prototype.hasOwnProperty.call(b, key) && deepEqual$1(a[key], b[key])
667
- );
668
- }
669
- function mergeAllOf(schema) {
670
- if (typeof schema === "boolean" || !schema.allOf) return schema;
671
- const { allOf, ...rest } = schema;
672
- let result = rest;
673
- for (const item of allOf) {
674
- result = intersection(result, item);
675
- }
676
- return result;
677
- }
678
- function intersection(a, b) {
679
- a = mergeAllOf(a);
680
- b = mergeAllOf(b);
681
- if (typeof a === "boolean" && typeof b === "boolean") return a && b;
682
- if (typeof a === "boolean") return a;
683
- if (typeof b === "boolean") return b;
684
- const result = { ...a };
685
- for (const _k in b) {
686
- const key = _k;
687
- switch (key) {
688
- case "$id":
689
- case "$comment":
690
- case "description":
691
- case "additionalItems":
692
- case "examples":
693
- case "allOf":
694
- case "writeOnly":
695
- case "readOnly":
696
- break;
697
- case "title": {
698
- const value = b[key];
699
- if (value === void 0) break;
700
- if (result[key]) {
701
- result[key] = `${result[key]} & ${value}`;
702
- } else {
703
- result[key] = value;
704
- }
705
- break;
706
- }
707
- case "minItems":
708
- case "minimum":
709
- case "exclusiveMinimum":
710
- case "minProperties":
711
- case "minContains":
712
- case "minLength": {
713
- const value = b[key];
714
- if (value === void 0) break;
715
- result[key] = result[key] === void 0 ? value : Math.max(result[key], value);
716
- break;
717
- }
718
- case "maxContains":
719
- case "maxItems":
720
- case "maxLength":
721
- case "maxProperties":
722
- case "maximum":
723
- case "exclusiveMaximum": {
724
- const value = b[key];
725
- if (value === void 0) break;
726
- result[key] = result[key] === void 0 ? value : Math.min(result[key], value);
727
- break;
728
- }
729
- // intersection
730
- case "enum":
731
- case "anyOf":
732
- case "oneOf": {
733
- const value = b[key];
734
- if (value === void 0) break;
735
- result[key] = result[key] === void 0 ? value : intersectArray(result[key], value);
736
- break;
737
- }
738
- // require same
739
- case "format":
740
- case "const":
741
- case "type": {
742
- const value = b[key];
743
- if (value === void 0) break;
744
- result[key] ??= value;
745
- if (!deepEqual$1(result[key], value)) return false;
746
- break;
747
- }
748
- // add
749
- case "required": {
750
- const value = b[key];
751
- if (value === void 0) break;
752
- result[key] = [...result[key] ?? [], ...value];
753
- break;
754
- }
755
- case "properties":
756
- case "patternProperties": {
757
- const value = b[key];
758
- if (value === void 0) break;
759
- if (result[key] === void 0) {
760
- result[key] = value;
761
- break;
762
- }
763
- const out = {};
764
- const allProps = /* @__PURE__ */ new Set();
765
- for (const k in result[key]) allProps.add(k);
766
- for (const k in value) allProps.add(k);
767
- for (const prop of allProps) {
768
- const aProp = result[key][prop];
769
- const bProp = value[prop];
770
- if (aProp === void 0) {
771
- out[prop] = bProp;
772
- } else if (bProp === void 0) {
773
- out[prop] = aProp;
774
- } else {
775
- out[prop] = intersection(aProp, bProp);
776
- }
777
- }
778
- result[key] = out;
779
- break;
780
- }
781
- case "additionalProperties":
782
- case "contains":
783
- case "items": {
784
- const value = b[key];
785
- if (value === void 0) break;
786
- result[key] = result[key] === void 0 ? value : intersection(result[key], value);
787
- break;
788
- }
789
- case "not": {
790
- const value = b[key];
791
- if (value === void 0) break;
792
- if (result[key] && value) {
793
- result.not = { anyOf: [result[key], value] };
794
- } else if (value) {
795
- result.not = value;
796
- }
797
- break;
798
- }
799
- default:
800
- result[key] = b[key];
801
- }
802
- }
803
- return result;
804
- }
805
- function intersectArray(a, b) {
806
- const out = /* @__PURE__ */ new Set();
807
- for (const item of a) {
808
- if (b.includes(item)) out.add(item);
809
- }
810
- for (const item of b) {
811
- if (a.includes(item)) out.add(item);
812
- }
813
- return Array.from(out);
814
- }
815
- const SchemaContext = reactExports.createContext(void 0);
816
- const anyFields = {
817
- type: ["string", "number", "boolean", "array", "object"],
818
- items: true,
819
- additionalProperties: true
820
- };
821
- function SchemaProvider({
822
- schema,
823
- children
824
- }) {
825
- const ajv = reactExports.useMemo(
826
- () => new Ajv2020({
827
- strict: false,
828
- validateSchema: false,
829
- validateFormats: false,
830
- schemas: [schema]
831
- }),
832
- [schema]
833
- );
834
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SchemaContext.Provider, { value: reactExports.useMemo(() => ({ schema, ajv }), [schema, ajv]), children });
835
- }
836
- function useFieldInfo(fieldName, schema) {
837
- const { ajv } = reactExports.use(SchemaContext);
838
- const engine = useDataEngine();
839
- const attachedData = engine.attachedData("field-info");
840
- const [info, setInfo] = reactExports.useState(() => {
841
- const value = engine.get(fieldName);
842
- const initialInfo = attachedData.get(fieldName);
843
- if (initialInfo) return initialInfo;
844
- const out = {
845
- oneOf: -1
846
- };
847
- const union = getUnion(schema);
848
- if (union) {
849
- const [members, field] = union;
850
- out.oneOf = members.findIndex((item) => ajv.validate(item, value));
851
- if (out.oneOf === -1) out.oneOf = 0;
852
- out.unionField = field;
853
- }
854
- if (Array.isArray(schema.type)) {
855
- const types = schema.type;
856
- out.selectedType = types.find((type) => {
857
- schema.type = type;
858
- const match = ajv.validate(schema, value);
859
- schema.type = types;
860
- return match;
861
- }) ?? types.at(0);
862
- }
863
- if (schema.allOf) {
864
- const merged = mergeAllOf(schema);
865
- if (typeof merged !== "boolean")
866
- out.intersection = {
867
- merged
868
- };
869
- }
870
- return out;
871
- });
872
- attachedData.set(fieldName, info);
873
- return {
874
- info,
875
- updateInfo(value) {
876
- const updated = {
877
- ...info,
878
- ...value
879
- };
880
- if (updated.oneOf === info.oneOf && updated.selectedType === info.selectedType) return;
881
- setInfo(updated);
882
- let valueSchema = schema;
883
- if (updated.unionField) {
884
- valueSchema = schema[updated.unionField][updated.oneOf];
885
- } else if (updated.selectedType) {
886
- valueSchema = { ...schema, type: updated.selectedType };
887
- }
888
- engine.update(fieldName, getDefaultValue(valueSchema));
889
- }
890
- };
891
- }
892
- function useSchemaContext() {
893
- return reactExports.use(SchemaContext);
894
- }
895
- function useResolvedSchema(schema) {
896
- const { ajv } = reactExports.use(SchemaContext);
897
- return reactExports.useMemo(() => fallbackAny(dereference(schema, { ajv })), [ajv, schema]);
898
- }
899
- function fallbackAny(schema) {
900
- return typeof schema === "boolean" ? anyFields : schema;
901
- }
902
- function getUnion(schema) {
903
- if (schema.anyOf) {
904
- return [schema.anyOf, "anyOf"];
905
- }
906
- if (schema.oneOf) return [schema.oneOf, "oneOf"];
907
- }
908
- function dereference(schema, { ajv }) {
909
- if (typeof schema === "boolean") return schema;
910
- if (schema.$ref) return ajv.getSchema(schema.$ref)?.schema ?? false;
911
- return schema;
912
- }
913
- const labelVariants$1 = cva(
914
- "text-xs font-medium text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
915
- );
916
- function FieldLabel(props) {
917
- return /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...props, className: cn("w-full inline-flex items-center gap-0.5", props.className), children: props.children });
918
- }
919
- function FieldLabelType(props) {
920
- return /* @__PURE__ */ jsxRuntimeExports.jsx("code", { ...props, className: cn("text-xs text-muted-foreground", props.className), children: props.children });
921
- }
922
- function ObjectInput({
923
- field: _field,
924
- fieldName,
925
- ...props
926
- }) {
927
- const field = useResolvedSchema(_field);
928
- const [nextName, setNextName] = reactExports.useState("");
929
- const { properties, onAppend, onDelete } = useObject(fieldName, {
930
- defaultValue: () => getDefaultValue(field),
931
- properties: field.properties ?? {},
932
- fallback: field.additionalProperties,
933
- patternProperties: field.patternProperties
934
- });
935
- const isDynamic = field.patternProperties ?? field.additionalProperties;
936
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("grid grid-cols-1 gap-4 @md:grid-cols-2", props.className), children: [
937
- properties.map((child) => {
938
- let toolbar = null;
939
- if (child.kind === "pattern" || child.kind === "fallback") {
940
- toolbar = /* @__PURE__ */ jsxRuntimeExports.jsx(
941
- "button",
942
- {
943
- type: "button",
944
- "aria-label": "Remove Item",
945
- className: cn(
946
- buttonVariants({
947
- variant: "outline",
948
- size: "icon-xs"
949
- })
950
- ),
951
- onClick: () => {
952
- onDelete(child.key);
953
- },
954
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, {})
955
- }
956
- );
957
- }
958
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
959
- FieldSet,
960
- {
961
- name: child.key,
962
- field: child.info,
963
- fieldName: child.field,
964
- isRequired: field.required?.includes(child.key),
965
- toolbar
966
- },
967
- child.key
968
- );
969
- }),
970
- isDynamic && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 col-span-full", children: [
971
- /* @__PURE__ */ jsxRuntimeExports.jsx(
972
- Input,
973
- {
974
- value: nextName,
975
- placeholder: "Enter Property Name",
976
- onChange: (e) => setNextName(e.target.value),
977
- onKeyDown: (e) => {
978
- if (e.key === "Enter") {
979
- setNextName("");
980
- onAppend(nextName);
981
- e.preventDefault();
982
- }
983
- }
984
- }
985
- ),
986
- /* @__PURE__ */ jsxRuntimeExports.jsx(
987
- "button",
988
- {
989
- type: "button",
990
- className: cn(buttonVariants({ variant: "secondary", size: "sm" }), "px-4"),
991
- onClick: () => {
992
- onAppend(nextName);
993
- setNextName("");
994
- },
995
- children: "New"
996
- }
997
- )
998
- ] })
999
- ] });
1000
- }
1001
- function FieldInput({
1002
- field,
1003
- fieldName,
1004
- isRequired,
1005
- ...props
1006
- }) {
1007
- const engine = useDataEngine();
1008
- const [value, setValue] = useFieldValue(fieldName);
1009
- const id = stringifyFieldKey(fieldName);
1010
- if (field.type === "null") return;
1011
- function renderUnset(children) {
1012
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-row gap-2", props.className), children: [
1013
- children,
1014
- value !== void 0 && !isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(
1015
- "button",
1016
- {
1017
- type: "button",
1018
- onClick: () => engine.delete(fieldName),
1019
- className: "text-muted-foreground",
1020
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "size-4" })
1021
- }
1022
- )
1023
- ] });
1024
- }
1025
- if (field.enum && field.enum.length > 0) {
1026
- const idx = field.enum.indexOf(value);
1027
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: String(idx), onValueChange: (v) => setValue(field.enum[Number(v)]), children: [
1028
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id, ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
1029
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
1030
- field.enum.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: String(i), children: typeof item === "string" ? item : JSON.stringify(item, null, 2) }, i)),
1031
- !isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "-1", children: "Unset" })
1032
- ] })
1033
- ] });
1034
- }
1035
- if (field.type === "boolean") {
1036
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1037
- Select,
1038
- {
1039
- value: String(value),
1040
- onValueChange: (value2) => setValue(value2 === "undefined" ? void 0 : value2 === "true"),
1041
- children: [
1042
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { id, ...props, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
1043
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
1044
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "true", children: "True" }),
1045
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "false", children: "False" }),
1046
- !isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "undefined", children: "Unset" })
1047
- ] })
1048
- ]
1049
- }
1050
- );
1051
- }
1052
- if (field.type === "integer" || field.type === "number") {
1053
- return renderUnset(
1054
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1055
- Input,
1056
- {
1057
- id,
1058
- placeholder: "Enter value",
1059
- type: "number",
1060
- step: field.type === "integer" ? 1 : void 0,
1061
- value: String(value ?? ""),
1062
- onChange: (e) => setValue(Number.isNaN(e.target.valueAsNumber) ? void 0 : e.target.valueAsNumber)
1063
- }
1064
- )
1065
- );
1066
- }
1067
- if (field.type === "string" && field.format === "binary") {
1068
- return renderUnset(
1069
- /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1070
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1071
- "label",
1072
- {
1073
- htmlFor: id,
1074
- className: cn(
1075
- buttonVariants({
1076
- variant: "secondary",
1077
- className: "w-full h-9 gap-2 truncate"
1078
- })
1079
- ),
1080
- children: value instanceof File ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1081
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs", children: "Selected" }),
1082
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate w-0 flex-1 text-end", children: value.name })
1083
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: "Upload" })
1084
- }
1085
- ),
1086
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1087
- "input",
1088
- {
1089
- id,
1090
- type: "file",
1091
- multiple: false,
1092
- onChange: (e) => {
1093
- if (!e.target.files || e.target.files.length === 0) return;
1094
- setValue(e.target.files.item(0));
1095
- },
1096
- hidden: true
1097
- }
1098
- )
1099
- ] })
1100
- );
1101
- }
1102
- return renderUnset(
1103
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1104
- Input,
1105
- {
1106
- id,
1107
- placeholder: "Enter value",
1108
- type: field.format === "date" ? "date" : "text",
1109
- value: String(value ?? ""),
1110
- onChange: (e) => setValue(e.target.value)
1111
- }
1112
- )
1113
- );
1114
- }
1115
- function FieldSet({
1116
- field: _field,
1117
- fieldName,
1118
- toolbar,
1119
- name,
1120
- isRequired,
1121
- depth = 0,
1122
- slotType,
1123
- collapsible = true,
1124
- ...props
1125
- }) {
1126
- const field = useResolvedSchema(_field);
1127
- const [show, setShow] = reactExports.useState(!collapsible);
1128
- const { info, updateInfo } = useFieldInfo(fieldName, field);
1129
- const id = stringifyFieldKey(fieldName);
1130
- const dataEngine = useDataEngine();
1131
- if (_field === false) return;
1132
- function renderLabelTrigger(schema = field) {
1133
- if (!collapsible) return renderLabelName();
1134
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1135
- "button",
1136
- {
1137
- type: "button",
1138
- className: cn(labelVariants$1(), "inline-flex items-center gap-1 font-mono me-auto"),
1139
- onClick: () => {
1140
- dataEngine.init(fieldName, getDefaultValue(schema));
1141
- setShow((prev) => !prev);
1142
- },
1143
- children: [
1144
- /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: cn("size-3.5 text-muted-foreground", show && "rotate-90") }),
1145
- name,
1146
- isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-400/80", children: "*" })
1147
- ]
1148
- }
1149
- );
1150
- }
1151
- function renderLabelName() {
1152
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: cn(labelVariants$1(), "font-mono me-auto"), children: [
1153
- name,
1154
- isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-400/80 mx-1", children: "*" })
1155
- ] });
1156
- }
1157
- if (info.unionField && field[info.unionField]) {
1158
- const union = field[info.unionField];
1159
- const showSelect = union.length > 1;
1160
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
1161
- FieldSet,
1162
- {
1163
- ...props,
1164
- name,
1165
- fieldName,
1166
- isRequired,
1167
- field: union[info.oneOf],
1168
- depth: depth + 1,
1169
- slotType: showSelect ? false : slotType,
1170
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1171
- showSelect && /* @__PURE__ */ jsxRuntimeExports.jsx(
1172
- "select",
1173
- {
1174
- className: "text-xs font-mono",
1175
- value: info.oneOf,
1176
- onChange: (e) => {
1177
- updateInfo({
1178
- oneOf: Number(e.target.value)
1179
- });
1180
- },
1181
- children: union.map((item, i) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: i, className: "bg-popover text-popover-foreground", children: schemaToString(item, FormatFlags.UseAlias) }, i))
1182
- }
1183
- ),
1184
- toolbar
1185
- ] })
1186
- }
1187
- );
1188
- }
1189
- if (Array.isArray(field.type)) {
1190
- const showSelect = field.type.length > 1;
1191
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
1192
- FieldSet,
1193
- {
1194
- ...props,
1195
- name,
1196
- fieldName,
1197
- isRequired,
1198
- field: {
1199
- ...field,
1200
- type: info.selectedType
1201
- },
1202
- depth: depth + 1,
1203
- slotType: showSelect ? false : slotType,
1204
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1205
- showSelect && /* @__PURE__ */ jsxRuntimeExports.jsx(
1206
- "select",
1207
- {
1208
- className: "text-xs font-mono",
1209
- value: info.selectedType,
1210
- onChange: (e) => {
1211
- updateInfo({
1212
- selectedType: e.target.value
1213
- });
1214
- },
1215
- children: field.type.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item, className: "bg-popover text-popover-foreground", children: item }, item))
1216
- }
1217
- ),
1218
- toolbar
1219
- ] })
1220
- }
1221
- );
1222
- }
1223
- if (field.type === "object" || info.intersection) {
1224
- const schema = info.intersection?.merged ?? field;
1225
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1226
- "fieldset",
1227
- {
1228
- ...props,
1229
- className: cn("flex flex-col gap-1.5 col-span-full @container", props.className),
1230
- children: [
1231
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel, { htmlFor: id, children: [
1232
- renderLabelTrigger(schema),
1233
- slotType ?? /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelType, { children: schemaToString(field) }),
1234
- toolbar
1235
- ] }),
1236
- show && /* @__PURE__ */ jsxRuntimeExports.jsx(
1237
- ObjectInput,
1238
- {
1239
- field: schema,
1240
- fieldName,
1241
- className: "rounded-lg border bg-card text-card-foreground p-2 shadow-sm"
1242
- }
1243
- )
1244
- ]
1245
- }
1246
- );
1247
- }
1248
- if (field.type === "array") {
1249
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("fieldset", { ...props, className: cn("flex flex-col gap-1.5 col-span-full", props.className), children: [
1250
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel, { htmlFor: id, children: [
1251
- renderLabelTrigger(),
1252
- slotType ?? /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelType, { children: schemaToString(field) }),
1253
- toolbar
1254
- ] }),
1255
- show && /* @__PURE__ */ jsxRuntimeExports.jsx(
1256
- ArrayInput,
1257
- {
1258
- fieldName,
1259
- items: field.items ?? anyFields,
1260
- className: "rounded-lg border bg-card text-card-foreground p-2 shadow-sm"
1261
- }
1262
- )
1263
- ] });
1264
- }
1265
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("fieldset", { ...props, className: cn("flex flex-col gap-1.5", props.className), children: [
1266
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel, { htmlFor: id, children: [
1267
- renderLabelName(),
1268
- slotType ?? /* @__PURE__ */ jsxRuntimeExports.jsx(FieldLabelType, { children: schemaToString(field) }),
1269
- toolbar
1270
- ] }),
1271
- /* @__PURE__ */ jsxRuntimeExports.jsx(FieldInput, { field, fieldName, isRequired })
1272
- ] });
1273
- }
1274
- function ArrayInput({
1275
- fieldName,
1276
- items: itemSchema,
1277
- ...props
1278
- }) {
1279
- const name = fieldName.at(-1) ?? "";
1280
- const { items, insertItem, removeItem } = useArray(fieldName, {
1281
- defaultValue: []
1282
- });
1283
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...props, className: cn("flex flex-col gap-2", props.className), children: [
1284
- items.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1285
- FieldSet,
1286
- {
1287
- name: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-muted-foreground", children: [
1288
- name,
1289
- "[",
1290
- item.index,
1291
- "]"
1292
- ] }),
1293
- field: itemSchema,
1294
- isRequired: true,
1295
- fieldName: item.field,
1296
- toolbar: /* @__PURE__ */ jsxRuntimeExports.jsx(
1297
- "button",
1298
- {
1299
- type: "button",
1300
- "aria-label": "Remove Item",
1301
- className: cn(
1302
- buttonVariants({
1303
- variant: "outline",
1304
- size: "icon-xs"
1305
- })
1306
- ),
1307
- onClick: () => removeItem(item.index),
1308
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trash2, {})
1309
- }
1310
- )
1311
- },
1312
- item.index
1313
- )),
1314
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1315
- "button",
1316
- {
1317
- type: "button",
1318
- className: cn(
1319
- buttonVariants({
1320
- variant: "secondary",
1321
- className: "gap-1.5 py-2",
1322
- size: "sm"
1323
- })
1324
- ),
1325
- onClick: () => {
1326
- insertItem(getDefaultValue(itemSchema));
1327
- },
1328
- children: [
1329
- /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
1330
- "New Item"
1331
- ]
1332
- }
1333
- )
1334
- ] });
1335
- }
1336
- function JSONSchemaEditorProvider({
1337
- children,
1338
- defaultValue,
1339
- onValueChange,
1340
- ...props
1341
- }) {
1342
- const stf = useStf({
1343
- defaultValues: defaultValue
1344
- });
1345
- useListener({
1346
- stf,
1347
- onUpdate() {
1348
- onValueChange(stf.dataEngine.getData());
1349
- }
1350
- });
1351
- return /* @__PURE__ */ jsxRuntimeExports.jsx(StfProvider, { value: stf, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SchemaProvider, { ...props, children }) });
1352
- }
1353
- function JSONSchemaEditorContent() {
1354
- const { schema } = useSchemaContext();
1355
- const field = useResolvedSchema(schema);
1356
- if (field.format === "binary") return /* @__PURE__ */ jsxRuntimeExports.jsx(FieldSet, { field, fieldName: [] });
1357
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FieldSet, { field, fieldName: [], collapsible: false });
1358
- }
1359
190
  function Tabs({
1360
191
  className,
1361
192
  orientation = "horizontal",
@@ -1408,7 +239,7 @@ function TabsContent({ className, ...props }) {
1408
239
  }
1409
240
  );
1410
241
  }
1411
- const Editor = reactExports.lazy(() => import("./yaml-BEdFfhvc.js").then((mod) => ({ default: mod.YamlEditor })));
242
+ const Editor = reactExports.lazy(() => import("./yaml-xJU1Ur4O.js").then((mod) => ({ default: mod.YamlEditor })));
1412
243
  function YamlEditorLazy(props) {
1413
244
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1414
245
  reactExports.Suspense,
@@ -3254,6 +2085,24 @@ function useForm(props = {}) {
3254
2085
  _formControl.current.formState = We.useMemo(() => getProxyFormState(formState, control), [control, formState]);
3255
2086
  return _formControl.current;
3256
2087
  }
2088
+ var NAME = "Label";
2089
+ var Label$1 = reactExports.forwardRef((props, forwardedRef) => {
2090
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
2091
+ Primitive$1.label,
2092
+ {
2093
+ ...props,
2094
+ ref: forwardedRef,
2095
+ onMouseDown: (event) => {
2096
+ const target = event.target;
2097
+ if (target.closest("button, input, select, textarea")) return;
2098
+ props.onMouseDown?.(event);
2099
+ if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
2100
+ }
2101
+ }
2102
+ );
2103
+ });
2104
+ Label$1.displayName = NAME;
2105
+ var Root = Label$1;
3257
2106
  const labelVariants = cva(
3258
2107
  "flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50"
3259
2108
  );
@@ -3304,10 +2153,7 @@ function useSync(onSyncCallback) {
3304
2153
  }
3305
2154
  export {
3306
2155
  Controller as C,
3307
- Input as I,
3308
- JSONSchemaEditorProvider as J,
3309
2156
  Label as L,
3310
- Plus as P,
3311
2157
  StatusBar as S,
3312
2158
  Tabs as T,
3313
2159
  YamlEditorLazy as Y,
@@ -3315,7 +2161,5 @@ export {
3315
2161
  TabsList as b,
3316
2162
  TabsTrigger as c,
3317
2163
  TabsContent as d,
3318
- JSONSchemaEditorContent as e,
3319
- Trash2 as f,
3320
2164
  useForm as u
3321
2165
  };