@tempots/beatui 0.80.0 → 0.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-DwHLVgKj.cjs → ar-D7CXDmVZ.cjs} +1 -1
- package/dist/{ar-Bo_FZZi7.js → ar-nOSKXpIW.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +101 -99
- package/dist/beatui.css +393 -0
- package/dist/beatui.tailwind.css +393 -0
- package/dist/{de-zI5mdV4M.cjs → de-WzsOu9Gn.cjs} +1 -1
- package/dist/{de-CCqwOkqN.js → de-f2xcEb34.js} +1 -1
- package/dist/{deep-merge-1uN6CG6K.js → deep-merge-CiOwVWn8.js} +269 -284
- package/dist/deep-merge-DxZqCkE5.cjs +1 -0
- package/dist/{duration-input-C9kpsw-t.js → duration-input-B3vnnwBZ.js} +30 -29
- package/dist/duration-input-Dg5SX3lM.cjs +1 -0
- package/dist/{es-BF02UrPL.js → es-CDqqzpCw.js} +1 -1
- package/dist/{es-Cw90CAbu.cjs → es-Ds2Xf3wV.cjs} +1 -1
- package/dist/{fa-DPQV4YB8.js → fa-C7tE_hR3.js} +1 -1
- package/dist/{fa-B4lssnzR.cjs → fa-Ct1UtDB7.cjs} +1 -1
- package/dist/{fr-1Kd6z1F-.cjs → fr-CzAkRFed.cjs} +1 -1
- package/dist/{fr-dmxPhwkD.js → fr-yOW_68YY.js} +1 -1
- package/dist/{he-BtQbrVt3.js → he-D2oUloCJ.js} +1 -1
- package/dist/{he-CJ3XnuPm.cjs → he-DlXALrK7.cjs} +1 -1
- package/dist/{hi-BpfnFKHp.cjs → hi-3dBhLwDs.cjs} +1 -1
- package/dist/{hi-D_Le4Yka.js → hi-D5ZlZoQq.js} +1 -1
- package/dist/{index-CfaWytS2.cjs → index-C5YCCgnn.cjs} +1 -1
- package/dist/{index-K6u33-GC.cjs → index-ChsRjiIp.cjs} +17 -17
- package/dist/{index-CGEzILlC.js → index-CiAVfKIZ.js} +1 -1
- package/dist/{index-YtW7SCWB.js → index-DT6-HMMz.js} +8 -7
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +296 -291
- package/dist/{it-DyHjSuHN.js → it-6e6X-4BB.js} +1 -1
- package/dist/{it-COCZ9NyB.cjs → it-DohtcWi9.cjs} +1 -1
- package/dist/{ja-X43lABza.js → ja-BxNuNo2H.js} +1 -1
- package/dist/{ja--NdggLU9.cjs → ja-eyTArrgS.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -8
- package/dist/json-schema/index.es.js +1391 -7471
- package/dist/json-schema-display/index.cjs.js +1 -0
- package/dist/json-schema-display/index.es.js +846 -0
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +89 -87
- package/dist/{ko-BUvb0ggK.cjs → ko-BFLCDMMs.cjs} +1 -1
- package/dist/{ko-B9g9iw99.js → ko-Ch0jFsBV.js} +1 -1
- package/dist/modal-D2xE47kr.cjs +1 -0
- package/dist/{modal-CSHIhHvI.js → modal-hkQD1bqZ.js} +22 -21
- package/dist/{nl-0S25Gsld.cjs → nl-Bx2ACvr4.cjs} +1 -1
- package/dist/{nl-Ew5jnSsT.js → nl-NuTdZO1s.js} +1 -1
- package/dist/notice-C0SmlheE.cjs +1 -0
- package/dist/{notice-C-964yaY.js → notice-CZHWWwOQ.js} +52 -51
- package/dist/oneof-branch-detection-BVNoKU9d.js +6281 -0
- package/dist/oneof-branch-detection-C8g3eWnx.cjs +8 -0
- package/dist/{pl-C9f6UBSe.js → pl-Bs4nLJ__.js} +1 -1
- package/dist/{pl-B3k-K3S4.cjs → pl-QHl6sl8f.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-DYtAvbrw.js → pt-BETjHZrL.js} +1 -1
- package/dist/{pt-CKoikRO5.cjs → pt-DZGw2Z-1.cjs} +1 -1
- package/dist/{ru-ZexN-b8V.js → ru-Bi1_DEKM.js} +1 -1
- package/dist/{ru-COb7RSDt.cjs → ru-D03IuLqh.cjs} +1 -1
- package/dist/stack-BJgsPJ9A.js +873 -0
- package/dist/stack-DcZ_u50f.cjs +1 -0
- package/dist/string-B9vVyfq3.cjs +1 -0
- package/dist/string-DYyMxBl-.js +19 -0
- package/dist/text-input-CByq5OIo.cjs +1 -0
- package/dist/text-input-CFJntP7G.js +287 -0
- package/dist/{toolbar-DNpBIoJo.js → toolbar-DR2Zd4Oo.js} +1 -1
- package/dist/toolbar-TPWYzoiF.cjs +1 -0
- package/dist/{tr-tO_EH-Y2.cjs → tr-B_-_1wua.cjs} +1 -1
- package/dist/{tr-BDvn05-H.js → tr-DiYB-FwX.js} +1 -1
- package/dist/translations-B4-Zd2LM.cjs +1 -0
- package/dist/translations-Cq8bUKJP.js +584 -0
- package/dist/{translations-DwGC_94w.cjs → translations-D62qqNV9.cjs} +1 -1
- package/dist/{translations-CfWR4loD.js → translations-DPr6c05Z.js} +1 -1
- package/dist/types/components/json-schema/schema-conditionals.d.ts +11 -0
- package/dist/types/components/json-schema/schema-context.d.ts +1 -1
- package/dist/types/components/json-schema-display/display-widget-customization.d.ts +61 -0
- package/dist/types/components/json-schema-display/display-wrapper.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/any-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/array-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/boolean-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/composition-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/enum-const-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/generic-display.d.ts +18 -0
- package/dist/types/components/json-schema-display/displays/null-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/number-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/object-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/string-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/index.d.ts +14 -0
- package/dist/types/components/json-schema-display/json-schema-display.d.ts +25 -0
- package/dist/types/components/json-schema-display/mismatch.d.ts +14 -0
- package/dist/types/json-schema-display/index.d.ts +1 -0
- package/dist/{ur-DbEqQgS6.js → ur-B69X-xNs.js} +1 -1
- package/dist/{ur-BbnYJ3HS.cjs → ur-DyUSmIbo.cjs} +1 -1
- package/dist/use-form-CgZyrACX.js +864 -0
- package/dist/use-form-JjeKCINk.cjs +2 -0
- package/dist/utils-DEbsp9Q9.js +129 -0
- package/dist/utils-DIUEhA-Z.cjs +1 -0
- package/dist/{vi-CpZUeuSj.js → vi-BdzxA60L.js} +1 -1
- package/dist/{vi-ByBwvGQY.cjs → vi-CBmPaHxg.cjs} +1 -1
- package/dist/widget-customization-DRA7E9Zf.js +1072 -0
- package/dist/widget-customization-G-QLB1rw.cjs +1 -0
- package/dist/{zh-DnxK0ieB.cjs → zh-Cb1b8uik.cjs} +1 -1
- package/dist/{zh-DJyhKO0I.js → zh-Dn1UJiZa.js} +1 -1
- package/package.json +13 -7
- package/dist/deep-merge-CBIkQM4E.cjs +0 -1
- package/dist/duration-input-DHWhQJnn.cjs +0 -1
- package/dist/modal-cc8Ehngz.cjs +0 -1
- package/dist/notice-C_BWqu2K.cjs +0 -1
- package/dist/toolbar-D5FcnRju.cjs +0 -1
- package/dist/translations-0tLX4x7M.js +0 -866
- package/dist/translations-WPN3ibDg.cjs +0 -1
- package/dist/use-form-D4JFOcjo.cjs +0 -2
- package/dist/use-form-D4rqJkvG.js +0 -1731
- package/dist/widget-customization-BSjJz3_Y.js +0 -1195
- package/dist/widget-customization-CrFVrt4V.cjs +0 -1
|
@@ -0,0 +1,846 @@
|
|
|
1
|
+
import { g as F, a as G, r as q, m as V, d as U, b as B, S as X } from "../oneof-branch-detection-BVNoKU9d.js";
|
|
2
|
+
import { Fragment as z, html as l, attr as r, Empty as E, Value as d, MapSignal as _ } from "@tempots/dom";
|
|
3
|
+
import { r as R } from "../utils-DEbsp9Q9.js";
|
|
4
|
+
function H(e) {
|
|
5
|
+
return e === null ? "null" : Array.isArray(e) ? "array" : typeof e == "object" ? "object" : typeof e == "string" ? "string" : typeof e == "number" ? Number.isInteger(e) ? "integer" : "number" : typeof e == "boolean" ? "boolean" : "unknown";
|
|
6
|
+
}
|
|
7
|
+
function Q(e, t) {
|
|
8
|
+
return e === t || t === "number" && e === "integer";
|
|
9
|
+
}
|
|
10
|
+
function S(e, t, i = []) {
|
|
11
|
+
if (typeof t == "boolean")
|
|
12
|
+
return t === !1 ? [
|
|
13
|
+
{
|
|
14
|
+
kind: "type-mismatch",
|
|
15
|
+
path: i,
|
|
16
|
+
message: "Schema disallows any value",
|
|
17
|
+
actual: String(e)
|
|
18
|
+
}
|
|
19
|
+
] : [];
|
|
20
|
+
const a = [], n = t;
|
|
21
|
+
if (n.type != null && e !== void 0) {
|
|
22
|
+
const s = Array.isArray(n.type) ? n.type : [n.type], o = H(e);
|
|
23
|
+
if (o !== "unknown" && !s.some((p) => Q(o, p)))
|
|
24
|
+
return a.push({
|
|
25
|
+
kind: "type-mismatch",
|
|
26
|
+
path: i,
|
|
27
|
+
message: `Expected ${s.join(" | ")}, got ${o}`,
|
|
28
|
+
expected: s.join(" | "),
|
|
29
|
+
actual: o
|
|
30
|
+
}), a;
|
|
31
|
+
}
|
|
32
|
+
if (n.enum != null && e !== void 0 && (n.enum.some(
|
|
33
|
+
(o) => JSON.stringify(o) === JSON.stringify(e)
|
|
34
|
+
) || a.push({
|
|
35
|
+
kind: "enum-mismatch",
|
|
36
|
+
path: i,
|
|
37
|
+
message: `Value not in enum: ${JSON.stringify(n.enum)}`,
|
|
38
|
+
expected: n.enum.map(String).join(", "),
|
|
39
|
+
actual: String(e)
|
|
40
|
+
})), n.const !== void 0 && e !== void 0 && JSON.stringify(n.const) !== JSON.stringify(e) && a.push({
|
|
41
|
+
kind: "const-mismatch",
|
|
42
|
+
path: i,
|
|
43
|
+
message: `Expected const ${JSON.stringify(n.const)}, got ${JSON.stringify(e)}`,
|
|
44
|
+
expected: JSON.stringify(n.const),
|
|
45
|
+
actual: JSON.stringify(e)
|
|
46
|
+
}), typeof e == "string" && (n.minLength != null && e.length < n.minLength && a.push({
|
|
47
|
+
kind: "constraint-violation",
|
|
48
|
+
path: i,
|
|
49
|
+
message: `String length ${e.length} < minLength ${n.minLength}`,
|
|
50
|
+
expected: `>= ${n.minLength} chars`,
|
|
51
|
+
actual: `${e.length} chars`
|
|
52
|
+
}), n.maxLength != null && e.length > n.maxLength && a.push({
|
|
53
|
+
kind: "constraint-violation",
|
|
54
|
+
path: i,
|
|
55
|
+
message: `String length ${e.length} > maxLength ${n.maxLength}`,
|
|
56
|
+
expected: `<= ${n.maxLength} chars`,
|
|
57
|
+
actual: `${e.length} chars`
|
|
58
|
+
}), n.pattern != null))
|
|
59
|
+
try {
|
|
60
|
+
new RegExp(n.pattern).test(e) || a.push({
|
|
61
|
+
kind: "constraint-violation",
|
|
62
|
+
path: i,
|
|
63
|
+
message: `String does not match pattern /${n.pattern}/`,
|
|
64
|
+
expected: `/${n.pattern}/`,
|
|
65
|
+
actual: e
|
|
66
|
+
});
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
if (typeof e == "number" && (n.minimum != null && e < n.minimum && a.push({
|
|
70
|
+
kind: "constraint-violation",
|
|
71
|
+
path: i,
|
|
72
|
+
message: `Value ${e} < minimum ${n.minimum}`,
|
|
73
|
+
expected: `>= ${n.minimum}`,
|
|
74
|
+
actual: String(e)
|
|
75
|
+
}), n.maximum != null && e > n.maximum && a.push({
|
|
76
|
+
kind: "constraint-violation",
|
|
77
|
+
path: i,
|
|
78
|
+
message: `Value ${e} > maximum ${n.maximum}`,
|
|
79
|
+
expected: `<= ${n.maximum}`,
|
|
80
|
+
actual: String(e)
|
|
81
|
+
}), n.exclusiveMinimum != null && e <= n.exclusiveMinimum && a.push({
|
|
82
|
+
kind: "constraint-violation",
|
|
83
|
+
path: i,
|
|
84
|
+
message: `Value ${e} <= exclusiveMinimum ${n.exclusiveMinimum}`,
|
|
85
|
+
expected: `> ${n.exclusiveMinimum}`,
|
|
86
|
+
actual: String(e)
|
|
87
|
+
}), n.exclusiveMaximum != null && e >= n.exclusiveMaximum && a.push({
|
|
88
|
+
kind: "constraint-violation",
|
|
89
|
+
path: i,
|
|
90
|
+
message: `Value ${e} >= exclusiveMaximum ${n.exclusiveMaximum}`,
|
|
91
|
+
expected: `< ${n.exclusiveMaximum}`,
|
|
92
|
+
actual: String(e)
|
|
93
|
+
}), n.multipleOf != null && e % n.multipleOf !== 0 && a.push({
|
|
94
|
+
kind: "constraint-violation",
|
|
95
|
+
path: i,
|
|
96
|
+
message: `Value ${e} is not a multiple of ${n.multipleOf}`,
|
|
97
|
+
expected: `multiple of ${n.multipleOf}`,
|
|
98
|
+
actual: String(e)
|
|
99
|
+
})), typeof e == "object" && e !== null && !Array.isArray(e)) {
|
|
100
|
+
const s = e, o = Object.keys(s);
|
|
101
|
+
if (n.required != null)
|
|
102
|
+
for (const p of n.required)
|
|
103
|
+
p in s || a.push({
|
|
104
|
+
kind: "missing-required",
|
|
105
|
+
path: [...i, p],
|
|
106
|
+
message: `Missing required property "${p}"`,
|
|
107
|
+
expected: p
|
|
108
|
+
});
|
|
109
|
+
if (n.additionalProperties === !1 && n.properties != null) {
|
|
110
|
+
const p = new Set(Object.keys(n.properties));
|
|
111
|
+
if (n.patternProperties != null) {
|
|
112
|
+
const c = Object.keys(n.patternProperties).map(
|
|
113
|
+
(m) => new RegExp(m)
|
|
114
|
+
);
|
|
115
|
+
for (const m of o)
|
|
116
|
+
!p.has(m) && !c.some((u) => u.test(m)) && a.push({
|
|
117
|
+
kind: "extra-property",
|
|
118
|
+
path: [...i, m],
|
|
119
|
+
message: `Extra property "${m}" not allowed`,
|
|
120
|
+
actual: m
|
|
121
|
+
});
|
|
122
|
+
} else
|
|
123
|
+
for (const c of o)
|
|
124
|
+
p.has(c) || a.push({
|
|
125
|
+
kind: "extra-property",
|
|
126
|
+
path: [...i, c],
|
|
127
|
+
message: `Extra property "${c}" not allowed`,
|
|
128
|
+
actual: c
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (n.properties != null)
|
|
132
|
+
for (const [p, c] of Object.entries(n.properties))
|
|
133
|
+
p in s && a.push(
|
|
134
|
+
...S(s[p], c, [...i, p])
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
if (Array.isArray(e)) {
|
|
138
|
+
if (n.minItems != null && e.length < n.minItems && a.push({
|
|
139
|
+
kind: "constraint-violation",
|
|
140
|
+
path: i,
|
|
141
|
+
message: `Array length ${e.length} < minItems ${n.minItems}`,
|
|
142
|
+
expected: `>= ${n.minItems} items`,
|
|
143
|
+
actual: `${e.length} items`
|
|
144
|
+
}), n.maxItems != null && e.length > n.maxItems && a.push({
|
|
145
|
+
kind: "constraint-violation",
|
|
146
|
+
path: i,
|
|
147
|
+
message: `Array length ${e.length} > maxItems ${n.maxItems}`,
|
|
148
|
+
expected: `<= ${n.maxItems} items`,
|
|
149
|
+
actual: `${e.length} items`
|
|
150
|
+
}), n.prefixItems != null) {
|
|
151
|
+
for (let s = 0; s < e.length && s < n.prefixItems.length; s++)
|
|
152
|
+
a.push(
|
|
153
|
+
...S(e[s], n.prefixItems[s], [...i, s])
|
|
154
|
+
);
|
|
155
|
+
if (n.items != null && !Array.isArray(n.items))
|
|
156
|
+
for (let s = n.prefixItems.length; s < e.length; s++)
|
|
157
|
+
a.push(
|
|
158
|
+
...S(e[s], n.items, [...i, s])
|
|
159
|
+
);
|
|
160
|
+
} else if (Array.isArray(n.items)) {
|
|
161
|
+
for (let s = 0; s < e.length && s < n.items.length; s++)
|
|
162
|
+
a.push(
|
|
163
|
+
...S(e[s], n.items[s], [...i, s])
|
|
164
|
+
);
|
|
165
|
+
if (n.additionalItems != null)
|
|
166
|
+
for (let s = n.items.length; s < e.length; s++)
|
|
167
|
+
a.push(
|
|
168
|
+
...S(e[s], n.additionalItems, [...i, s])
|
|
169
|
+
);
|
|
170
|
+
} else if (n.items != null)
|
|
171
|
+
for (let s = 0; s < e.length; s++)
|
|
172
|
+
a.push(
|
|
173
|
+
...S(e[s], n.items, [...i, s])
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return a;
|
|
177
|
+
}
|
|
178
|
+
class Y {
|
|
179
|
+
widgets = [];
|
|
180
|
+
register(t) {
|
|
181
|
+
this.widgets.push(t), this.widgets.sort((i, a) => (a.priority ?? 50) - (i.priority ?? 50));
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Find the best display widget for a schema context.
|
|
185
|
+
* Returns the factory if found, undefined otherwise.
|
|
186
|
+
*/
|
|
187
|
+
findBestWidget(t) {
|
|
188
|
+
const i = R(t.definition, t.name);
|
|
189
|
+
if (i?.widget) {
|
|
190
|
+
const a = this.widgets.find(
|
|
191
|
+
(n) => n.displayName === i.widget && n.matcher(t)
|
|
192
|
+
);
|
|
193
|
+
if (a)
|
|
194
|
+
return { factory: a.factory, resolved: i };
|
|
195
|
+
}
|
|
196
|
+
for (const a of this.widgets)
|
|
197
|
+
try {
|
|
198
|
+
if (a.matcher(t))
|
|
199
|
+
return { factory: a.factory, resolved: i };
|
|
200
|
+
} catch (n) {
|
|
201
|
+
console.warn(
|
|
202
|
+
`Error in display widget matcher "${a.displayName ?? "unknown"}":`,
|
|
203
|
+
n
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function de(e, t, i) {
|
|
209
|
+
return {
|
|
210
|
+
factory: t,
|
|
211
|
+
matcher: (a) => {
|
|
212
|
+
const s = a.definition["x:ui"];
|
|
213
|
+
return s === e || typeof s == "object" && s !== null && s.widget === e;
|
|
214
|
+
},
|
|
215
|
+
displayName: i?.displayName ?? e,
|
|
216
|
+
priority: i?.priority ?? 100,
|
|
217
|
+
...i
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function he(e, t, i) {
|
|
221
|
+
return {
|
|
222
|
+
factory: t,
|
|
223
|
+
matcher: (a) => a.definition.format === e,
|
|
224
|
+
displayName: i?.displayName ?? `${e} display`,
|
|
225
|
+
priority: i?.priority ?? 75,
|
|
226
|
+
...i
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function ye(e, t, i, a) {
|
|
230
|
+
return {
|
|
231
|
+
factory: i,
|
|
232
|
+
matcher: (n) => {
|
|
233
|
+
const s = n.definition;
|
|
234
|
+
return s.type === e && s.format === t;
|
|
235
|
+
},
|
|
236
|
+
displayName: a?.displayName ?? `${e}:${t} display`,
|
|
237
|
+
priority: a?.priority ?? 80,
|
|
238
|
+
...a
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function Z(e) {
|
|
242
|
+
return e.length === 0 ? E : l.div(
|
|
243
|
+
r.class("bc-json-schema-display__mismatches"),
|
|
244
|
+
...e.map(
|
|
245
|
+
(t) => l.span(
|
|
246
|
+
r.class(
|
|
247
|
+
`bc-json-schema-display__mismatch bc-json-schema-display__mismatch--${t.kind}`
|
|
248
|
+
),
|
|
249
|
+
r.title(
|
|
250
|
+
t.expected ? `Expected: ${t.expected}${t.actual ? `, got: ${t.actual}` : ""}` : t.message
|
|
251
|
+
),
|
|
252
|
+
t.message
|
|
253
|
+
)
|
|
254
|
+
)
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
function g({
|
|
258
|
+
ctx: e,
|
|
259
|
+
mismatches: t,
|
|
260
|
+
children: i
|
|
261
|
+
}) {
|
|
262
|
+
const a = e.widgetLabel, n = e.isPropertyRequired, s = e.isDeprecated, o = e.description;
|
|
263
|
+
if (e.isRoot && !t?.length)
|
|
264
|
+
return z(i);
|
|
265
|
+
const p = t ? t.filter((c) => {
|
|
266
|
+
const m = c.path.map(String).join("."), u = e.path.map(String).join(".");
|
|
267
|
+
return m === u;
|
|
268
|
+
}) : [];
|
|
269
|
+
return l.div(
|
|
270
|
+
r.class("bc-json-schema-display__field"),
|
|
271
|
+
// Label row
|
|
272
|
+
a || n || s ? l.div(
|
|
273
|
+
r.class("bc-json-schema-display__label-row"),
|
|
274
|
+
a ? l.span(r.class("bc-json-schema-display__label"), a) : null,
|
|
275
|
+
n ? l.span(r.class("bc-json-schema-display__required"), "*") : null,
|
|
276
|
+
s ? l.span(
|
|
277
|
+
r.class("bc-json-schema-display__deprecated"),
|
|
278
|
+
"deprecated"
|
|
279
|
+
) : null
|
|
280
|
+
) : null,
|
|
281
|
+
// Value content
|
|
282
|
+
i,
|
|
283
|
+
// Description
|
|
284
|
+
o ? l.div(r.class("bc-json-schema-display__description"), o) : null,
|
|
285
|
+
// Mismatch indicators
|
|
286
|
+
Z(p)
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
function W(e, t) {
|
|
290
|
+
switch (t) {
|
|
291
|
+
case "email":
|
|
292
|
+
return e ? l.a(
|
|
293
|
+
r.class("bc-json-schema-display__link"),
|
|
294
|
+
r.href(`mailto:${e}`),
|
|
295
|
+
e
|
|
296
|
+
) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
297
|
+
case "uri":
|
|
298
|
+
case "uri-reference":
|
|
299
|
+
case "url":
|
|
300
|
+
return e ? l.a(
|
|
301
|
+
r.class("bc-json-schema-display__link"),
|
|
302
|
+
r.href(e),
|
|
303
|
+
r.target("_blank"),
|
|
304
|
+
r.rel("noopener noreferrer"),
|
|
305
|
+
e
|
|
306
|
+
) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
307
|
+
case "color":
|
|
308
|
+
return e ? l.span(
|
|
309
|
+
r.class("bc-json-schema-display__color-display"),
|
|
310
|
+
l.span(
|
|
311
|
+
r.class("bc-json-schema-display__color-swatch"),
|
|
312
|
+
r.style(`background-color: ${e}`)
|
|
313
|
+
),
|
|
314
|
+
l.span(r.class("bc-json-schema-display__monospace"), e)
|
|
315
|
+
) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
316
|
+
case "date-time":
|
|
317
|
+
case "date":
|
|
318
|
+
case "time":
|
|
319
|
+
if (!e)
|
|
320
|
+
return l.span(
|
|
321
|
+
r.class("bc-json-schema-display__value--null"),
|
|
322
|
+
"—"
|
|
323
|
+
);
|
|
324
|
+
try {
|
|
325
|
+
if (t === "time") return l.span(e);
|
|
326
|
+
const i = new Date(e);
|
|
327
|
+
return isNaN(i.getTime()) ? l.span(e) : l.span(
|
|
328
|
+
t === "date" ? i.toLocaleDateString() : i.toLocaleString()
|
|
329
|
+
);
|
|
330
|
+
} catch {
|
|
331
|
+
return l.span(e);
|
|
332
|
+
}
|
|
333
|
+
case "password":
|
|
334
|
+
return e ? l.span(
|
|
335
|
+
r.class("bc-json-schema-display__value"),
|
|
336
|
+
"•".repeat(Math.min(e.length, 12))
|
|
337
|
+
) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
338
|
+
case "uuid":
|
|
339
|
+
return e ? l.span(r.class("bc-json-schema-display__monospace"), e) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
340
|
+
case "textarea":
|
|
341
|
+
case "markdown":
|
|
342
|
+
return e ? l.pre(r.class("bc-json-schema-display__pre"), e) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
343
|
+
default:
|
|
344
|
+
return e !== "" ? l.span(r.class("bc-json-schema-display__value"), e) : l.span(r.class("bc-json-schema-display__value--null"), "—");
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function v({
|
|
348
|
+
ctx: e,
|
|
349
|
+
value: t,
|
|
350
|
+
mismatches: i
|
|
351
|
+
}) {
|
|
352
|
+
const a = e.definition, s = R(a, e.name)?.widget, o = d.map(t, (c) => c != null ? String(c) : ""), p = _(o, (c) => W(c, s));
|
|
353
|
+
return g({
|
|
354
|
+
ctx: e,
|
|
355
|
+
mismatches: i,
|
|
356
|
+
children: p
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function ee(e) {
|
|
360
|
+
if (e == null) return "—";
|
|
361
|
+
const t = Number(e);
|
|
362
|
+
return isNaN(t) ? String(e) : t.toLocaleString();
|
|
363
|
+
}
|
|
364
|
+
function ne(e) {
|
|
365
|
+
return e == null ? "bc-json-schema-display__value--null" : "bc-json-schema-display__value";
|
|
366
|
+
}
|
|
367
|
+
function se({
|
|
368
|
+
ctx: e,
|
|
369
|
+
value: t,
|
|
370
|
+
mismatches: i
|
|
371
|
+
}) {
|
|
372
|
+
return g({
|
|
373
|
+
ctx: e,
|
|
374
|
+
mismatches: i,
|
|
375
|
+
children: l.span(
|
|
376
|
+
r.class(d.map(t, ne)),
|
|
377
|
+
d.map(t, ee)
|
|
378
|
+
)
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function te(e) {
|
|
382
|
+
return e == null ? "bc-json-schema-display__value--null" : `bc-json-schema-display__boolean bc-json-schema-display__boolean--${!!e ? "true" : "false"}`;
|
|
383
|
+
}
|
|
384
|
+
function ie(e) {
|
|
385
|
+
return e == null ? "—" : e ? "true" : "false";
|
|
386
|
+
}
|
|
387
|
+
function ae({
|
|
388
|
+
ctx: e,
|
|
389
|
+
value: t,
|
|
390
|
+
mismatches: i
|
|
391
|
+
}) {
|
|
392
|
+
return g({
|
|
393
|
+
ctx: e,
|
|
394
|
+
mismatches: i,
|
|
395
|
+
children: l.span(
|
|
396
|
+
r.class(d.map(t, te)),
|
|
397
|
+
d.map(t, ie)
|
|
398
|
+
)
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function re({
|
|
402
|
+
ctx: e,
|
|
403
|
+
mismatches: t
|
|
404
|
+
}) {
|
|
405
|
+
return g({
|
|
406
|
+
ctx: e,
|
|
407
|
+
mismatches: t,
|
|
408
|
+
children: l.span(
|
|
409
|
+
r.class("bc-json-schema-display__value--null"),
|
|
410
|
+
"null"
|
|
411
|
+
)
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function le(e, t) {
|
|
415
|
+
if (e.prefixItems != null && t < e.prefixItems.length)
|
|
416
|
+
return e.prefixItems[t];
|
|
417
|
+
if (Array.isArray(e.items) && t < e.items.length)
|
|
418
|
+
return e.items[t];
|
|
419
|
+
if (e.prefixItems != null && t >= e.prefixItems.length)
|
|
420
|
+
return e.items != null && !Array.isArray(e.items) ? e.items : void 0;
|
|
421
|
+
if (e.items != null && !Array.isArray(e.items))
|
|
422
|
+
return e.items;
|
|
423
|
+
}
|
|
424
|
+
function ce({
|
|
425
|
+
ctx: e,
|
|
426
|
+
value: t,
|
|
427
|
+
mismatches: i,
|
|
428
|
+
displayWidgetRegistry: a
|
|
429
|
+
}) {
|
|
430
|
+
const n = e.definition, s = d.toSignal(t), o = _(s, (p) => Array.isArray(p) ? p.length === 0 ? l.span(
|
|
431
|
+
r.class("bc-json-schema-display__empty"),
|
|
432
|
+
"(empty array)"
|
|
433
|
+
) : l.div(
|
|
434
|
+
r.class("bc-json-schema-display__array"),
|
|
435
|
+
...p.map((c, m) => {
|
|
436
|
+
const u = le(n, m), h = e.with({
|
|
437
|
+
definition: u ?? !0
|
|
438
|
+
}).append(m), b = i?.filter((j) => {
|
|
439
|
+
const y = j.path.map(String), $ = [...e.path.map(String), String(m)];
|
|
440
|
+
return y.length >= $.length && $.every((x, N) => y[N] === x);
|
|
441
|
+
});
|
|
442
|
+
return l.div(
|
|
443
|
+
r.class("bc-json-schema-display__array-item"),
|
|
444
|
+
l.span(
|
|
445
|
+
r.class("bc-json-schema-display__array-index"),
|
|
446
|
+
`[${m}]`
|
|
447
|
+
),
|
|
448
|
+
O({
|
|
449
|
+
ctx: h,
|
|
450
|
+
value: c,
|
|
451
|
+
mismatches: b,
|
|
452
|
+
displayWidgetRegistry: a
|
|
453
|
+
})
|
|
454
|
+
);
|
|
455
|
+
})
|
|
456
|
+
) : p == null ? l.span(
|
|
457
|
+
r.class("bc-json-schema-display__value--null"),
|
|
458
|
+
"—"
|
|
459
|
+
) : l.span(r.class("bc-json-schema-display__value"), String(p)));
|
|
460
|
+
return g({ ctx: e, mismatches: i, children: o });
|
|
461
|
+
}
|
|
462
|
+
function oe({
|
|
463
|
+
ctx: e,
|
|
464
|
+
value: t,
|
|
465
|
+
mismatches: i,
|
|
466
|
+
displayWidgetRegistry: a
|
|
467
|
+
}) {
|
|
468
|
+
const n = e.definition, s = d.toSignal(t), o = _(s, (p) => {
|
|
469
|
+
if (p == null)
|
|
470
|
+
return l.span(
|
|
471
|
+
r.class("bc-json-schema-display__value--null"),
|
|
472
|
+
"—"
|
|
473
|
+
);
|
|
474
|
+
if (typeof p != "object" || Array.isArray(p))
|
|
475
|
+
return l.span(
|
|
476
|
+
r.class("bc-json-schema-display__value"),
|
|
477
|
+
JSON.stringify(p)
|
|
478
|
+
);
|
|
479
|
+
const c = p, m = n.properties ?? {}, u = Object.keys(m), h = Object.keys(c), b = u.map((f) => {
|
|
480
|
+
const P = m[f], w = e.with({
|
|
481
|
+
definition: P,
|
|
482
|
+
isPropertyRequired: e.hasRequiredProperty(f)
|
|
483
|
+
}).append(f), L = i?.filter((D) => {
|
|
484
|
+
const I = D.path.map(String), k = [...e.path.map(String), f];
|
|
485
|
+
return I.length >= k.length && k.every((T, K) => I[K] === T);
|
|
486
|
+
}), A = f in c ? c[f] : void 0;
|
|
487
|
+
return !(f in c) && e.hasRequiredProperty(f) ? l.div(
|
|
488
|
+
r.class("bc-json-schema-display__field"),
|
|
489
|
+
l.div(
|
|
490
|
+
r.class("bc-json-schema-display__label-row"),
|
|
491
|
+
l.span(
|
|
492
|
+
r.class("bc-json-schema-display__label"),
|
|
493
|
+
w.widgetLabel ?? f
|
|
494
|
+
),
|
|
495
|
+
l.span(r.class("bc-json-schema-display__required"), "*")
|
|
496
|
+
),
|
|
497
|
+
l.span(
|
|
498
|
+
r.class("bc-json-schema-display__value--missing"),
|
|
499
|
+
"(missing)"
|
|
500
|
+
)
|
|
501
|
+
) : f in c ? O({
|
|
502
|
+
ctx: w,
|
|
503
|
+
value: A,
|
|
504
|
+
mismatches: L,
|
|
505
|
+
displayWidgetRegistry: a
|
|
506
|
+
}) : E;
|
|
507
|
+
}), j = new Set(u), y = h.filter((f) => !j.has(f)), $ = y.map((f) => {
|
|
508
|
+
const P = e.with({ definition: !0 }).append(f), w = i?.filter((L) => {
|
|
509
|
+
const A = L.path.map(String), D = [...e.path.map(String), f];
|
|
510
|
+
return A.length >= D.length && D.every((I, k) => A[k] === I);
|
|
511
|
+
});
|
|
512
|
+
return l.div(
|
|
513
|
+
r.class("bc-json-schema-display__extra-property"),
|
|
514
|
+
O({
|
|
515
|
+
ctx: P,
|
|
516
|
+
value: c[f],
|
|
517
|
+
mismatches: w,
|
|
518
|
+
displayWidgetRegistry: a
|
|
519
|
+
})
|
|
520
|
+
);
|
|
521
|
+
}), x = [...b, ...$], N = F(e);
|
|
522
|
+
return N ? G(N, e, x, [
|
|
523
|
+
...u,
|
|
524
|
+
...y
|
|
525
|
+
]) : e.isRoot ? l.div(
|
|
526
|
+
r.class("bc-json-schema-display__fields"),
|
|
527
|
+
...x
|
|
528
|
+
) : l.div(
|
|
529
|
+
r.class("bc-json-schema-display__object"),
|
|
530
|
+
...x
|
|
531
|
+
);
|
|
532
|
+
});
|
|
533
|
+
return e.isRoot ? o : l.div(
|
|
534
|
+
r.class("bc-json-schema-display__field"),
|
|
535
|
+
e.widgetLabel ? l.div(
|
|
536
|
+
r.class("bc-json-schema-display__label-row"),
|
|
537
|
+
l.span(
|
|
538
|
+
r.class("bc-json-schema-display__label"),
|
|
539
|
+
e.widgetLabel
|
|
540
|
+
),
|
|
541
|
+
e.isPropertyRequired ? l.span(r.class("bc-json-schema-display__required"), "*") : null,
|
|
542
|
+
e.isDeprecated ? l.span(
|
|
543
|
+
r.class("bc-json-schema-display__deprecated"),
|
|
544
|
+
"deprecated"
|
|
545
|
+
) : null
|
|
546
|
+
) : null,
|
|
547
|
+
o,
|
|
548
|
+
e.description ? l.div(
|
|
549
|
+
r.class("bc-json-schema-display__description"),
|
|
550
|
+
e.description
|
|
551
|
+
) : null
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
function M({
|
|
555
|
+
ctx: e,
|
|
556
|
+
value: t,
|
|
557
|
+
mismatches: i
|
|
558
|
+
}) {
|
|
559
|
+
const a = e.definition, n = d.toSignal(t), s = _(n, (o) => {
|
|
560
|
+
if (o == null)
|
|
561
|
+
return l.span(
|
|
562
|
+
r.class("bc-json-schema-display__value--null"),
|
|
563
|
+
"—"
|
|
564
|
+
);
|
|
565
|
+
const p = typeof o == "string" ? o : JSON.stringify(o);
|
|
566
|
+
let c = !0;
|
|
567
|
+
return a.enum != null ? c = a.enum.some((m) => JSON.stringify(m) === JSON.stringify(o)) : a.const !== void 0 && (c = JSON.stringify(a.const) === JSON.stringify(o)), l.span(
|
|
568
|
+
r.class(
|
|
569
|
+
`bc-json-schema-display__value${c ? "" : " bc-json-schema-display__mismatch--enum-mismatch"}`
|
|
570
|
+
),
|
|
571
|
+
p,
|
|
572
|
+
c ? null : l.span(
|
|
573
|
+
r.class("bc-json-schema-display__mismatch-indicator"),
|
|
574
|
+
a.enum != null ? ` (not in enum: ${a.enum.map((m) => JSON.stringify(m)).join(", ")})` : ` (expected: ${JSON.stringify(a.const)})`
|
|
575
|
+
)
|
|
576
|
+
);
|
|
577
|
+
});
|
|
578
|
+
return g({ ctx: e, mismatches: i, children: s });
|
|
579
|
+
}
|
|
580
|
+
function pe({
|
|
581
|
+
ctx: e,
|
|
582
|
+
value: t,
|
|
583
|
+
mismatches: i,
|
|
584
|
+
displayWidgetRegistry: a
|
|
585
|
+
}) {
|
|
586
|
+
const n = e.definition;
|
|
587
|
+
if (n.allOf != null) {
|
|
588
|
+
const c = n.allOf.filter(
|
|
589
|
+
(m) => typeof m == "object" && m !== null
|
|
590
|
+
);
|
|
591
|
+
if (c.length > 0) {
|
|
592
|
+
const m = c.map(
|
|
593
|
+
($) => q($, e.schema, e.ajv)
|
|
594
|
+
), { mergedSchema: u } = V(m, e.path), { allOf: h, ...b } = n, j = { ...b, ...u }, y = e.with({ definition: j });
|
|
595
|
+
return O({
|
|
596
|
+
ctx: y,
|
|
597
|
+
value: t,
|
|
598
|
+
mismatches: i,
|
|
599
|
+
displayWidgetRegistry: a
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const s = n.oneOf ?? n.anyOf;
|
|
604
|
+
if (!Array.isArray(s) || s.length === 0) {
|
|
605
|
+
const c = d.toSignal(t);
|
|
606
|
+
return g({
|
|
607
|
+
ctx: e,
|
|
608
|
+
mismatches: i,
|
|
609
|
+
children: _(
|
|
610
|
+
c,
|
|
611
|
+
(m) => l.span(
|
|
612
|
+
r.class("bc-json-schema-display__value"),
|
|
613
|
+
JSON.stringify(m)
|
|
614
|
+
)
|
|
615
|
+
)
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
const o = d.toSignal(t), p = _(o, (c) => {
|
|
619
|
+
const m = U(e, c, e.ajv);
|
|
620
|
+
if (m.matchingBranch >= 0) {
|
|
621
|
+
const u = s[m.matchingBranch], h = typeof u == "object" && u !== null && u.$ref ? B(u, e.schema) : u;
|
|
622
|
+
if ((typeof h == "object" ? h?.type : void 0) === "object") {
|
|
623
|
+
const y = e.with({ definition: h });
|
|
624
|
+
return O({
|
|
625
|
+
ctx: y,
|
|
626
|
+
value: c,
|
|
627
|
+
mismatches: i,
|
|
628
|
+
displayWidgetRegistry: a
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
const j = typeof c == "string" ? c : JSON.stringify(c);
|
|
632
|
+
return l.span(
|
|
633
|
+
r.class("bc-json-schema-display__value"),
|
|
634
|
+
j
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
return m.isAmbiguous ? l.div(
|
|
638
|
+
l.span(
|
|
639
|
+
r.class(
|
|
640
|
+
"bc-json-schema-display__branch-label bc-json-schema-display__branch-label--ambiguous"
|
|
641
|
+
),
|
|
642
|
+
`Ambiguous (${m.validBranches.length} branches match)`
|
|
643
|
+
),
|
|
644
|
+
l.pre(
|
|
645
|
+
r.class("bc-json-schema-display__pre"),
|
|
646
|
+
JSON.stringify(c, null, 2)
|
|
647
|
+
)
|
|
648
|
+
) : l.div(
|
|
649
|
+
l.span(
|
|
650
|
+
r.class(
|
|
651
|
+
"bc-json-schema-display__branch-label bc-json-schema-display__branch-label--no-match"
|
|
652
|
+
),
|
|
653
|
+
"No matching branch"
|
|
654
|
+
),
|
|
655
|
+
l.pre(
|
|
656
|
+
r.class("bc-json-schema-display__pre"),
|
|
657
|
+
JSON.stringify(c, null, 2)
|
|
658
|
+
)
|
|
659
|
+
);
|
|
660
|
+
});
|
|
661
|
+
return g({ ctx: e, mismatches: i, children: p });
|
|
662
|
+
}
|
|
663
|
+
function J({
|
|
664
|
+
ctx: e,
|
|
665
|
+
value: t,
|
|
666
|
+
mismatches: i
|
|
667
|
+
}) {
|
|
668
|
+
const a = d.toSignal(t), n = _(a, (s) => {
|
|
669
|
+
if (s == null)
|
|
670
|
+
return l.span(
|
|
671
|
+
r.class("bc-json-schema-display__value--null"),
|
|
672
|
+
s === null ? "null" : "—"
|
|
673
|
+
);
|
|
674
|
+
if (typeof s == "boolean")
|
|
675
|
+
return l.span(
|
|
676
|
+
r.class(
|
|
677
|
+
`bc-json-schema-display__boolean bc-json-schema-display__boolean--${s ? "true" : "false"}`
|
|
678
|
+
),
|
|
679
|
+
String(s)
|
|
680
|
+
);
|
|
681
|
+
if (typeof s == "number")
|
|
682
|
+
return l.span(
|
|
683
|
+
r.class("bc-json-schema-display__value"),
|
|
684
|
+
s.toLocaleString()
|
|
685
|
+
);
|
|
686
|
+
if (typeof s == "string")
|
|
687
|
+
return l.span(r.class("bc-json-schema-display__value"), s);
|
|
688
|
+
try {
|
|
689
|
+
return l.pre(
|
|
690
|
+
r.class("bc-json-schema-display__pre"),
|
|
691
|
+
JSON.stringify(s, null, 2)
|
|
692
|
+
);
|
|
693
|
+
} catch {
|
|
694
|
+
return l.span(r.class("bc-json-schema-display__value"), String(s));
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
return g({ ctx: e, mismatches: i, children: n });
|
|
698
|
+
}
|
|
699
|
+
function O({
|
|
700
|
+
ctx: e,
|
|
701
|
+
value: t,
|
|
702
|
+
mismatches: i,
|
|
703
|
+
displayWidgetRegistry: a
|
|
704
|
+
}) {
|
|
705
|
+
const n = typeof e.definition == "boolean" ? {} : e.definition;
|
|
706
|
+
let s = n?.$ref ? B(n, e.schema) : n, o = e.with({ definition: s });
|
|
707
|
+
if (s?.allOf != null) {
|
|
708
|
+
const p = s.allOf.filter(
|
|
709
|
+
(c) => typeof c == "object" && c !== null
|
|
710
|
+
);
|
|
711
|
+
if (p.length > 0) {
|
|
712
|
+
const c = p.map(
|
|
713
|
+
(b) => q(b, e.schema, e.ajv)
|
|
714
|
+
), { mergedSchema: m } = V(c, e.path), { allOf: u, ...h } = s;
|
|
715
|
+
s = { ...h, ...m }, o = e.with({ definition: s });
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
if (a) {
|
|
719
|
+
const p = a.findBestWidget(o);
|
|
720
|
+
if (p)
|
|
721
|
+
return p.factory({
|
|
722
|
+
value: t,
|
|
723
|
+
ctx: o,
|
|
724
|
+
mismatches: i
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
if (s == null)
|
|
728
|
+
return J({
|
|
729
|
+
ctx: o,
|
|
730
|
+
value: t,
|
|
731
|
+
mismatches: i
|
|
732
|
+
});
|
|
733
|
+
if (s.enum != null)
|
|
734
|
+
return M({
|
|
735
|
+
ctx: o,
|
|
736
|
+
value: t,
|
|
737
|
+
mismatches: i
|
|
738
|
+
});
|
|
739
|
+
if (s.const !== void 0)
|
|
740
|
+
return M({
|
|
741
|
+
ctx: o,
|
|
742
|
+
value: t,
|
|
743
|
+
mismatches: i
|
|
744
|
+
});
|
|
745
|
+
if (s.anyOf != null || s.oneOf != null)
|
|
746
|
+
return pe({
|
|
747
|
+
ctx: o,
|
|
748
|
+
value: t,
|
|
749
|
+
mismatches: i,
|
|
750
|
+
displayWidgetRegistry: a
|
|
751
|
+
});
|
|
752
|
+
if (s.type == null)
|
|
753
|
+
return J({
|
|
754
|
+
ctx: o,
|
|
755
|
+
value: t,
|
|
756
|
+
mismatches: i
|
|
757
|
+
});
|
|
758
|
+
if (Array.isArray(s.type)) {
|
|
759
|
+
const c = s.type.filter((m) => m !== "null");
|
|
760
|
+
return c.length === 1 && ["string", "number", "integer", "boolean"].includes(c[0]) ? C(c[0], {
|
|
761
|
+
ctx: o,
|
|
762
|
+
value: t,
|
|
763
|
+
mismatches: i,
|
|
764
|
+
displayWidgetRegistry: a
|
|
765
|
+
}) : J({
|
|
766
|
+
ctx: o,
|
|
767
|
+
value: t,
|
|
768
|
+
mismatches: i
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
return C(s.type, {
|
|
772
|
+
ctx: o,
|
|
773
|
+
value: t,
|
|
774
|
+
mismatches: i,
|
|
775
|
+
displayWidgetRegistry: a
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
function C(e, t) {
|
|
779
|
+
switch (e) {
|
|
780
|
+
case "string":
|
|
781
|
+
return v(t);
|
|
782
|
+
case "number":
|
|
783
|
+
case "integer":
|
|
784
|
+
return se(t);
|
|
785
|
+
case "boolean":
|
|
786
|
+
return ae(t);
|
|
787
|
+
case "array":
|
|
788
|
+
return ce(t);
|
|
789
|
+
case "object":
|
|
790
|
+
return oe(t);
|
|
791
|
+
case "null":
|
|
792
|
+
return re(t);
|
|
793
|
+
default:
|
|
794
|
+
return J(t);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
function ge({
|
|
798
|
+
schema: e,
|
|
799
|
+
value: t,
|
|
800
|
+
showMismatches: i = !0,
|
|
801
|
+
customWidgets: a,
|
|
802
|
+
horizontal: n = !1
|
|
803
|
+
}) {
|
|
804
|
+
const s = new X({
|
|
805
|
+
schema: e,
|
|
806
|
+
definition: e,
|
|
807
|
+
horizontal: n,
|
|
808
|
+
isPropertyRequired: !1,
|
|
809
|
+
path: []
|
|
810
|
+
});
|
|
811
|
+
let o;
|
|
812
|
+
if (a && a.length > 0) {
|
|
813
|
+
o = new Y();
|
|
814
|
+
for (const c of a)
|
|
815
|
+
o.register(c);
|
|
816
|
+
}
|
|
817
|
+
const p = d.toSignal(t);
|
|
818
|
+
return _(p, (c) => {
|
|
819
|
+
const m = i ? S(c, e) : void 0;
|
|
820
|
+
return O({
|
|
821
|
+
ctx: s,
|
|
822
|
+
value: c,
|
|
823
|
+
mismatches: m,
|
|
824
|
+
displayWidgetRegistry: o
|
|
825
|
+
});
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
export {
|
|
829
|
+
J as AnyDisplay,
|
|
830
|
+
ce as ArrayDisplay,
|
|
831
|
+
ae as BooleanDisplay,
|
|
832
|
+
pe as CompositionDisplay,
|
|
833
|
+
Y as DisplayWidgetRegistry,
|
|
834
|
+
g as DisplayWrapper,
|
|
835
|
+
M as EnumConstDisplay,
|
|
836
|
+
O as GenericDisplay,
|
|
837
|
+
ge as JSONSchemaDisplay,
|
|
838
|
+
re as NullDisplay,
|
|
839
|
+
se as NumberDisplay,
|
|
840
|
+
oe as ObjectDisplay,
|
|
841
|
+
v as StringDisplay,
|
|
842
|
+
S as detectMismatches,
|
|
843
|
+
he as forDisplayFormat,
|
|
844
|
+
ye as forDisplayTypeAndFormat,
|
|
845
|
+
de as forDisplayXUI
|
|
846
|
+
};
|