@tempots/beatui 1.7.5 → 1.9.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-Wr6gMs-M.cjs → ar-CEzAem0F.cjs} +1 -1
- package/dist/{ar-fdUqbCvM.js → ar-CQieaqsq.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/auth-divider-B8yr-E_b.cjs +1 -0
- package/dist/{auth-divider-D9KnNeyF.js → auth-divider-Byh5BWLc.js} +91 -88
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +27 -26
- package/dist/card-BkA7Wvbh.cjs +1 -0
- package/dist/card-DX1DwGbL.js +62 -0
- package/dist/{colors-C2sgnzFH.js → colors-CyMhfbJi.js} +64 -58
- package/dist/{colors-DPCHjRMj.cjs → colors-IXZF9U-s.cjs} +1 -1
- package/dist/control-hqEuMzyI.js +343 -0
- package/dist/control-muup9GF1.cjs +1 -0
- package/dist/custom-validation-BA9iJWl_.cjs +1 -0
- package/dist/custom-validation-BOBoUwHY.js +181 -0
- package/dist/{de-C5-k5Eov.js → de-CBIwvkAH.js} +1 -1
- package/dist/{de-DZqdSEta.cjs → de-DdfxrlT3.cjs} +1 -1
- package/dist/deep-merge-8fwp1z4X.js +1346 -0
- package/dist/deep-merge-VDGE_HQD.cjs +1 -0
- package/dist/duration-input-DmsljXl3.cjs +1 -0
- package/dist/{duration-input-D4V_PHIg.js → duration-input-ZQlcqdXU.js} +32 -31
- package/dist/{editor-toolbar-group-FpOHrmtx.js → editor-toolbar-group-BNTBMJCe.js} +2 -2
- package/dist/{editor-toolbar-group-C_ft_T8D.cjs → editor-toolbar-group-DiMzqYgz.cjs} +1 -1
- package/dist/{es-h6jmoF4X.js → es--9HaEj2D.js} +1 -1
- package/dist/{es-CJgYfRap.cjs → es-DSdljxFJ.cjs} +1 -1
- package/dist/{fa-BuxK837l.js → fa-1Z-akcW7.js} +1 -1
- package/dist/{fa-BQ5PzwNY.cjs → fa-BolmeWRT.cjs} +1 -1
- package/dist/flyout-CuKFh_T7.js +151 -0
- package/dist/flyout-DC_tKaTG.cjs +1 -0
- package/dist/{fr-Bv3TG44U.cjs → fr-CODgUuoZ.cjs} +1 -1
- package/dist/{fr-BwILQ9G2.js → fr-DhHM9rou.js} +1 -1
- package/dist/{he-yC9Sc7JD.js → he-CBamXbGJ.js} +1 -1
- package/dist/{he-5LbvgMCC.cjs → he-Juw-dr28.cjs} +1 -1
- package/dist/{hi-Da7rcCpP.js → hi-DvvcX-Ra.js} +1 -1
- package/dist/{hi-YWhWcG_L.cjs → hi-R749jeg-.cjs} +1 -1
- package/dist/{index-CvU9E9wd.js → index-BfQaT5Jy.js} +104 -104
- package/dist/{index-XogEKwdt.cjs → index-Dv7nPuwA.cjs} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +6713 -9831
- package/dist/{input-container-CyOgiiQD.cjs → input-container-BaWQLWB6.cjs} +1 -1
- package/dist/{input-container-8JFB11xN.js → input-container-DCS5oJ4S.js} +4 -4
- package/dist/{it-BxOIJE45.cjs → it-DT5oRZDH.cjs} +1 -1
- package/dist/{it-Yeklau78.js → it-aV6i8Qxz.js} +1 -1
- package/dist/{ja-Dxj9Q5Yd.js → ja-CuLhGnJX.js} +1 -1
- package/dist/{ja-CNhjK06P.cjs → ja-CwKaCYLB.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +83 -79
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +2 -2
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +74 -72
- package/dist/{ko-DgkqcXTs.cjs → ko-Bucro9ID.cjs} +1 -1
- package/dist/{ko-gn_MsegK.js → ko-D-66BsEX.js} +1 -1
- package/dist/lexical/index.cjs.js +1 -1
- package/dist/lexical/index.es.js +5 -5
- package/dist/menu-BFLFKceF.cjs +1 -0
- package/dist/menu-BO6zqyfq.js +220 -0
- package/dist/modal-6Mq3vS5r.js +309 -0
- package/dist/modal-d77-TMc4.cjs +1 -0
- package/dist/{nl-vHNFtXXb.js → nl-CAny6wvm.js} +1 -1
- package/dist/{nl-Dy9lmbBO.cjs → nl-D7vHpehb.cjs} +1 -1
- package/dist/notice-BNGx86Yg.js +110 -0
- package/dist/notice-iF6zBMq9.cjs +1 -0
- package/dist/{oneof-branch-detection-Q_jxvJIA.js → oneof-branch-detection-Bm17RhC2.js} +27 -26
- package/dist/oneof-branch-detection-DZ4MrfBp.cjs +1 -0
- package/dist/openui/index.cjs.js +9 -0
- package/dist/openui/index.es.js +2174 -0
- package/dist/password-input-Bipt7Wsu.cjs +1 -0
- package/dist/password-input-mkRmrEPq.js +105 -0
- package/dist/{pl-BtYbtsmG.cjs → pl-CSiXoOKT.cjs} +1 -1
- package/dist/{pl-C0UdHla0.js → pl-rmZLgQ_V.js} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +4 -4
- package/dist/{pt-CtNmqQ1X.cjs → pt-CJT-iq4y.cjs} +1 -1
- package/dist/{pt-DGKtfN0d.js → pt-DHnajqAi.js} +1 -1
- package/dist/{ru-CpXYLt-v.js → ru-C_E8OZNE.js} +1 -1
- package/dist/{ru-BaL_NPRU.cjs → ru-G3sr_ctV.cjs} +1 -1
- package/dist/slider-input-SLguFA0d.cjs +1 -0
- package/dist/slider-input-VYAMm7pE.js +285 -0
- package/dist/stepper-24p16Zsv.cjs +1 -0
- package/dist/stepper-TlzbfYWa.js +3222 -0
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +38 -40
- package/dist/tailwind/vite-plugin.cjs.js +14 -12
- package/dist/tailwind/vite-plugin.es.js +317 -246
- package/dist/text-area-BdemKQ_w.cjs +1 -0
- package/dist/text-area-Br83-_PQ.js +431 -0
- package/dist/{text-input-NJypZSnE.js → text-input-ByuxdX8w.js} +5 -5
- package/dist/{text-input-DS5zlXb2.cjs → text-input-MjlUC_9u.cjs} +1 -1
- package/dist/{toolbar-BF2L6WKC.js → toolbar-CEBTTjHh.js} +1 -1
- package/dist/{toolbar-BBwfe8U9.cjs → toolbar-DWawYFFX.cjs} +1 -1
- package/dist/{tr-DwOd87oB.cjs → tr-DcxLHHTC.cjs} +1 -1
- package/dist/{tr-DIFZDFW_.js → tr-bVXwloKC.js} +1 -1
- package/dist/{translations-EwEmHe3v.cjs → translations-D3xqZUTA.cjs} +1 -1
- package/dist/{translations-BCMP-h52.js → translations-DU9wTV1y.js} +20 -19
- package/dist/{translations-5cXBrENb.js → translations-RT_UN8ny.js} +1 -1
- package/dist/{translations-BqWc0ZHz.cjs → translations-qljG2Chq.cjs} +1 -1
- package/dist/types/components/navigation/stepper.d.ts +4 -4
- package/dist/types/openui/index.d.ts +28 -0
- package/dist/types/openui/library/define-component.d.ts +15 -0
- package/dist/types/openui/library/library.d.ts +7 -0
- package/dist/types/openui/library/prompt-generator.d.ts +5 -0
- package/dist/types/openui/library/types.d.ts +33 -0
- package/dist/types/openui/parser/parser.d.ts +8 -0
- package/dist/types/openui/parser/streaming-parser.d.ts +14 -0
- package/dist/types/openui/parser/tokenizer.d.ts +9 -0
- package/dist/types/openui/parser/types.d.ts +46 -0
- package/dist/types/openui/registry/button.d.ts +148 -0
- package/dist/types/openui/registry/data.d.ts +177 -0
- package/dist/types/openui/registry/form.d.ts +65 -0
- package/dist/types/openui/registry/format.d.ts +67 -0
- package/dist/types/openui/registry/index.d.ts +9 -0
- package/dist/types/openui/registry/layout.d.ts +45 -0
- package/dist/types/openui/registry/navigation.d.ts +149 -0
- package/dist/types/openui/registry/overlay.d.ts +56 -0
- package/dist/types/openui/registry/typography.d.ts +17 -0
- package/dist/types/openui/renderer/action-context.d.ts +24 -0
- package/dist/types/openui/renderer/node-resolver.d.ts +9 -0
- package/dist/types/openui/renderer/openui-renderer.d.ts +32 -0
- package/dist/types/openui/renderer/skeleton.d.ts +2 -0
- package/dist/types/openui/streaming/from-fetch.d.ts +7 -0
- package/dist/types/openui/streaming/from-sse.d.ts +7 -0
- package/dist/types/openui/streaming/from-websocket.d.ts +10 -0
- package/dist/types/openui/streaming/types.d.ts +5 -0
- package/dist/types/tailwind/preset.d.ts +25 -4
- package/dist/types/tailwind/vite-plugin.d.ts +17 -5
- package/dist/types/tokens/colors.d.ts +87 -9
- package/dist/types/tokens/index.d.ts +7 -6
- package/dist/{ur-DBst-TXc.js → ur-Dls2qb4V.js} +1 -1
- package/dist/{ur-D9nLchps.cjs → ur-IRQoHh1E.cjs} +1 -1
- package/dist/use-form-BZ8vDYOv.cjs +2 -0
- package/dist/use-form-DsCzINfm.js +750 -0
- package/dist/utils-D3-NApSw.cjs +1 -0
- package/dist/utils-Nbh7yQ73.js +105 -0
- package/dist/{vi-Dg1aiMr5.cjs → vi-Bi9SvVCP.cjs} +1 -1
- package/dist/{vi-DQOJp32U.js → vi-C3mTzj50.js} +1 -1
- package/dist/widget-customization-BV6XB2v_.cjs +1 -0
- package/dist/widget-customization-Bso45ONQ.js +1198 -0
- package/dist/{zh-DPK4HXl2.js → zh-B4JRJBt2.js} +1 -1
- package/dist/{zh-tbwSTbmn.cjs → zh-BMU5rYu1.cjs} +1 -1
- package/package.json +31 -20
- package/dist/auth-divider-CjcrgXmq.cjs +0 -1
- package/dist/custom-validation-7por5nJN.js +0 -488
- package/dist/custom-validation-CLscGHY4.cjs +0 -1
- package/dist/deep-merge-D90SW1Ci.cjs +0 -1
- package/dist/deep-merge-DT2H9AGq.js +0 -1765
- package/dist/duration-input-4AQnQpyo.cjs +0 -1
- package/dist/menu-B60Q9j3-.cjs +0 -1
- package/dist/menu-BkqFGcXg.js +0 -366
- package/dist/notice-CQGJyZ8o.js +0 -211
- package/dist/notice-p2IqXS5-.cjs +0 -1
- package/dist/oneof-branch-detection-xDDDdYRk.cjs +0 -1
- package/dist/use-form-8NnZ-KHk.js +0 -1090
- package/dist/use-form-Dcra7GeE.cjs +0 -2
- package/dist/utils-DmEuG3Np.cjs +0 -1
- package/dist/utils-vUtP6iPG.js +0 -165
- package/dist/widget-customization-BIBva3f-.js +0 -1458
- package/dist/widget-customization-pqmtsraC.cjs +0 -1
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { attr as O, Value as j, Fragment as ce, Empty as U, WithElement as Te, Use as K, html as I, When as oe, computedOf as M, prop as X, style as Me, Ensure as $e, MapSignal as re, Async as mt, OnDispose as yt } from "@tempots/dom";
|
|
2
|
-
import { m as ve, c as Le, g as We, a as Be, r as De, e as gt, f as Oe, S as ht, b as bt, h as we, i as vt } from "../oneof-branch-detection-
|
|
3
|
-
import { j as
|
|
4
|
-
import { B as q } from "../translations-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
2
|
+
import { m as ve, c as Le, g as We, a as Be, r as De, e as gt, f as Oe, S as ht, b as bt, h as we, i as vt } from "../oneof-branch-detection-Bm17RhC2.js";
|
|
3
|
+
import { j as Er, k as Tr, l as Mr, n as $r, o as Lr, p as Wr, q as Br } from "../oneof-branch-detection-Bm17RhC2.js";
|
|
4
|
+
import { B as q } from "../translations-DU9wTV1y.js";
|
|
5
|
+
import { N as xe } from "../notice-BNGx86Yg.js";
|
|
6
|
+
import { N as wt, a as St, R as At, S as Ot } from "../slider-input-VYAMm7pE.js";
|
|
7
|
+
import { S as _, L as ee, M as jt } from "../stack-BLMteGTn.js";
|
|
8
|
+
import { F as ie, c as A, M as fe, b as je, C as _e } from "../control-hqEuMzyI.js";
|
|
9
|
+
import { objectEntries as Ue, upperCaseFirst as Ke, Validation as L } from "@tempots/std";
|
|
10
|
+
import { S as kt, b as Ct, N as qe, T as Pt, a as It, G as Nt, c as Rt } from "../text-area-Br83-_PQ.js";
|
|
11
|
+
import { g as ke, B as Ft, N as H, a as de, b as Vt, C as Et, c as Tt, d as Mt, e as $t, f as Lt, h as Wt, i as Bt, E as Je, W as Dt } from "../widget-customization-Bso45ONQ.js";
|
|
12
|
+
import { j as xr, k as _r, l as Ur, m as Kr } from "../widget-customization-Bso45ONQ.js";
|
|
13
|
+
import { r as F } from "../utils-Nbh7yQ73.js";
|
|
14
|
+
import { m as xt, T as _t } from "../text-input-ByuxdX8w.js";
|
|
15
|
+
import { W as Ut, N as Kt, t as te, b as Q, U as qt, c as pe, M as ae, L as Jt, e as zt, f as Ht } from "../deep-merge-8fwp1z4X.js";
|
|
16
|
+
import { P as Gt, E as Xt } from "../password-input-mkRmrEPq.js";
|
|
17
|
+
import { B as ze } from "../input-container-DCS5oJ4S.js";
|
|
18
|
+
import { O as Yt, A as Zt, b as Qt } from "../use-form-DsCzINfm.js";
|
|
15
19
|
import en from "ajv";
|
|
16
20
|
function tn(e) {
|
|
17
21
|
if (!e || typeof e != "object") return !1;
|
|
@@ -190,7 +194,7 @@ function V({
|
|
|
190
194
|
return a.factory(i);
|
|
191
195
|
}
|
|
192
196
|
if (r != null) {
|
|
193
|
-
const a =
|
|
197
|
+
const a = ke.get(r);
|
|
194
198
|
if (a)
|
|
195
199
|
return a.factory(i);
|
|
196
200
|
}
|
|
@@ -199,7 +203,7 @@ function V({
|
|
|
199
203
|
if (a)
|
|
200
204
|
return a.registration.factory(i);
|
|
201
205
|
}
|
|
202
|
-
const s =
|
|
206
|
+
const s = ke.findBestWidget(e);
|
|
203
207
|
return s ? s.registration.factory(i) : null;
|
|
204
208
|
}
|
|
205
209
|
function Xe(e) {
|
|
@@ -216,14 +220,14 @@ function Xe(e) {
|
|
|
216
220
|
const m = Object.fromEntries(
|
|
217
221
|
t.map((p) => [a(p.value), p.label])
|
|
218
222
|
);
|
|
219
|
-
return
|
|
223
|
+
return kt({
|
|
220
224
|
options: m,
|
|
221
225
|
value: j.map(n, (p) => a(p)),
|
|
222
226
|
onChange: (p) => r(o(p)),
|
|
223
227
|
size: s
|
|
224
228
|
});
|
|
225
229
|
}
|
|
226
|
-
return
|
|
230
|
+
return Ct({
|
|
227
231
|
options: t.map((m) => ({
|
|
228
232
|
type: "value",
|
|
229
233
|
value: m.value,
|
|
@@ -371,16 +375,16 @@ function un(e) {
|
|
|
371
375
|
}
|
|
372
376
|
}
|
|
373
377
|
const cn = (e) => {
|
|
374
|
-
const { after: t, disabled: n } = e, r =
|
|
378
|
+
const { after: t, disabled: n } = e, r = xt(
|
|
375
379
|
e,
|
|
376
380
|
(s) => s ?? void 0,
|
|
377
381
|
(s) => s ?? null
|
|
378
|
-
), i =
|
|
382
|
+
), i = qe(
|
|
379
383
|
e.value,
|
|
380
384
|
n,
|
|
381
385
|
e.onChange ?? e.onInput
|
|
382
386
|
);
|
|
383
|
-
return
|
|
387
|
+
return Ft({
|
|
384
388
|
...r,
|
|
385
389
|
after: t != null ? ce(i, t) : i
|
|
386
390
|
});
|
|
@@ -393,19 +397,19 @@ function Ce({
|
|
|
393
397
|
const r = un(e), i = !e.isNullable, s = () => i ? te(n) : n;
|
|
394
398
|
switch (r?.format) {
|
|
395
399
|
case "email":
|
|
396
|
-
return A(
|
|
400
|
+
return A(Wt, {
|
|
397
401
|
...t,
|
|
398
402
|
controller: s()
|
|
399
403
|
});
|
|
400
404
|
case "date":
|
|
401
|
-
return
|
|
405
|
+
return fe(Lt, {
|
|
402
406
|
...t,
|
|
403
407
|
controller: s(),
|
|
404
408
|
toInput: (a) => a == null ? null : new Date(a),
|
|
405
409
|
fromInput: (a) => a?.toISOString().split("T")[0] ?? null
|
|
406
410
|
});
|
|
407
411
|
case "date-time":
|
|
408
|
-
return
|
|
412
|
+
return fe($t, {
|
|
409
413
|
...t,
|
|
410
414
|
controller: s(),
|
|
411
415
|
toInput: (a) => a == null ? null : new Date(a),
|
|
@@ -418,7 +422,7 @@ function Ce({
|
|
|
418
422
|
placeholder: "HH:MM:SS"
|
|
419
423
|
});
|
|
420
424
|
case "password":
|
|
421
|
-
return A(
|
|
425
|
+
return A(Mt, {
|
|
422
426
|
...t,
|
|
423
427
|
controller: s()
|
|
424
428
|
});
|
|
@@ -431,7 +435,7 @@ function Ce({
|
|
|
431
435
|
accept: r.mediaType || "*/*",
|
|
432
436
|
maxFileSize: (typeof o?.maxBytes == "number" ? o.maxBytes : void 0) || (typeof o?.maxFileSize == "number" ? o.maxFileSize : void 0),
|
|
433
437
|
showFileList: !0
|
|
434
|
-
}) : A(
|
|
438
|
+
}) : A(de, {
|
|
435
439
|
...t,
|
|
436
440
|
controller: s(),
|
|
437
441
|
placeholder: "Paste base64-encoded data",
|
|
@@ -440,7 +444,7 @@ function Ce({
|
|
|
440
444
|
}
|
|
441
445
|
case "uri":
|
|
442
446
|
case "url":
|
|
443
|
-
return A(
|
|
447
|
+
return A(Tt, {
|
|
444
448
|
...t,
|
|
445
449
|
controller: s(),
|
|
446
450
|
placeholder: "https://example.com"
|
|
@@ -470,15 +474,15 @@ function Ce({
|
|
|
470
474
|
placeholder: "2001:db8::1"
|
|
471
475
|
});
|
|
472
476
|
case "regex":
|
|
473
|
-
return A(
|
|
477
|
+
return A(de, {
|
|
474
478
|
...t,
|
|
475
479
|
controller: s(),
|
|
476
480
|
placeholder: "^[a-zA-Z0-9]+$",
|
|
477
481
|
rows: 3
|
|
478
482
|
});
|
|
479
483
|
case "duration":
|
|
480
|
-
return
|
|
481
|
-
({ Duration: a }) =>
|
|
484
|
+
return Ut(
|
|
485
|
+
({ Duration: a }) => fe(Kt, {
|
|
482
486
|
...t,
|
|
483
487
|
controller: s(),
|
|
484
488
|
toInput: (o) => o == null ? null : a.from(o),
|
|
@@ -486,18 +490,18 @@ function Ce({
|
|
|
486
490
|
})
|
|
487
491
|
);
|
|
488
492
|
case "color":
|
|
489
|
-
return A(
|
|
493
|
+
return A(Et, {
|
|
490
494
|
...t,
|
|
491
495
|
controller: n,
|
|
492
496
|
displayValue: !0
|
|
493
497
|
});
|
|
494
498
|
case "uuid":
|
|
495
|
-
return A(
|
|
499
|
+
return A(Vt, {
|
|
496
500
|
...t,
|
|
497
501
|
controller: s()
|
|
498
502
|
});
|
|
499
503
|
case "textarea":
|
|
500
|
-
return A(
|
|
504
|
+
return A(de, {
|
|
501
505
|
...t,
|
|
502
506
|
controller: s()
|
|
503
507
|
});
|
|
@@ -545,12 +549,12 @@ function me({
|
|
|
545
549
|
return Ce({ ctx: e, options: s, controller: t });
|
|
546
550
|
switch (r) {
|
|
547
551
|
case "email":
|
|
548
|
-
return A(
|
|
552
|
+
return A(Xt, {
|
|
549
553
|
...s,
|
|
550
554
|
controller: Q(t)
|
|
551
555
|
});
|
|
552
556
|
case "password":
|
|
553
|
-
return A(
|
|
557
|
+
return A(Gt, {
|
|
554
558
|
...s,
|
|
555
559
|
controller: Q(t)
|
|
556
560
|
});
|
|
@@ -560,12 +564,12 @@ function me({
|
|
|
560
564
|
controller: Q(t)
|
|
561
565
|
});
|
|
562
566
|
case "textarea":
|
|
563
|
-
return A(
|
|
567
|
+
return A(Pt, {
|
|
564
568
|
...s,
|
|
565
569
|
controller: Q(t)
|
|
566
570
|
});
|
|
567
571
|
default:
|
|
568
|
-
return A(
|
|
572
|
+
return A(_t, {
|
|
569
573
|
...s,
|
|
570
574
|
controller: Q(t)
|
|
571
575
|
});
|
|
@@ -609,24 +613,24 @@ function le({
|
|
|
609
613
|
switch (r.widget) {
|
|
610
614
|
case "rating":
|
|
611
615
|
const u = (typeof r.options?.max == "number" ? r.options.max : n.maximum) || 5;
|
|
612
|
-
return o ? A(
|
|
616
|
+
return o ? A(Bt, {
|
|
613
617
|
...a,
|
|
614
618
|
max: u,
|
|
615
619
|
controller: l ? te(
|
|
616
620
|
t
|
|
617
621
|
) : t
|
|
618
|
-
}) : A(
|
|
622
|
+
}) : A(At, {
|
|
619
623
|
...a,
|
|
620
624
|
max: u,
|
|
621
625
|
controller: t
|
|
622
626
|
});
|
|
623
627
|
case "slider":
|
|
624
|
-
return o ? A(
|
|
628
|
+
return o ? A(wt, {
|
|
625
629
|
...a,
|
|
626
630
|
controller: l ? te(
|
|
627
631
|
t
|
|
628
632
|
) : t
|
|
629
|
-
}) : A(
|
|
633
|
+
}) : A(St, {
|
|
630
634
|
...a,
|
|
631
635
|
controller: t
|
|
632
636
|
});
|
|
@@ -657,7 +661,7 @@ function le({
|
|
|
657
661
|
controller: l ? te(
|
|
658
662
|
t
|
|
659
663
|
) : t
|
|
660
|
-
}) : A(
|
|
664
|
+
}) : A(It, {
|
|
661
665
|
...a,
|
|
662
666
|
controller: t
|
|
663
667
|
});
|
|
@@ -711,17 +715,17 @@ function ge({
|
|
|
711
715
|
const i = {
|
|
712
716
|
...W({ ctx: e }),
|
|
713
717
|
disabled: Ae(e)
|
|
714
|
-
}, s = A(
|
|
718
|
+
}, s = A(je, {
|
|
715
719
|
...i,
|
|
716
720
|
controller: t
|
|
717
721
|
});
|
|
718
722
|
if (!e.isNullable && (!e.isOptional || e.shouldShowPresenceToggle))
|
|
719
723
|
return s;
|
|
720
724
|
const a = !e.isNullable;
|
|
721
|
-
return A(
|
|
725
|
+
return A(je, {
|
|
722
726
|
...i,
|
|
723
727
|
controller: t,
|
|
724
|
-
after:
|
|
728
|
+
after: qe(
|
|
725
729
|
t.signal,
|
|
726
730
|
t.disabled,
|
|
727
731
|
() => t.change(a ? void 0 : null)
|
|
@@ -824,7 +828,7 @@ function yn({
|
|
|
824
828
|
ie({
|
|
825
829
|
layout: "horizontal",
|
|
826
830
|
label: `Include ${i}`,
|
|
827
|
-
content:
|
|
831
|
+
content: Ot({
|
|
828
832
|
value: r,
|
|
829
833
|
onChange: s,
|
|
830
834
|
size: "xs"
|
|
@@ -1015,7 +1019,7 @@ function An({
|
|
|
1015
1019
|
const m = a && o ? te(
|
|
1016
1020
|
t
|
|
1017
1021
|
) : t;
|
|
1018
|
-
return
|
|
1022
|
+
return Rt({
|
|
1019
1023
|
...W({ ctx: e }),
|
|
1020
1024
|
options: u,
|
|
1021
1025
|
controller: m,
|
|
@@ -1040,7 +1044,7 @@ function On({
|
|
|
1040
1044
|
Te(() => {
|
|
1041
1045
|
j.get(t.signal) !== i.const && t.change(i.const);
|
|
1042
1046
|
}),
|
|
1043
|
-
|
|
1047
|
+
Nt(jt(e.widgetLabel, ": "), ee(String(i.const)))
|
|
1044
1048
|
);
|
|
1045
1049
|
}
|
|
1046
1050
|
function tt(e, t, n) {
|
|
@@ -1084,7 +1088,7 @@ function tt(e, t, n) {
|
|
|
1084
1088
|
delete w[e], w[g] = S, r.change(w);
|
|
1085
1089
|
}, f = K(
|
|
1086
1090
|
q,
|
|
1087
|
-
(v) =>
|
|
1091
|
+
(v) => _e({
|
|
1088
1092
|
size: "xs",
|
|
1089
1093
|
label: v.$.removeItem,
|
|
1090
1094
|
disabled: !o(
|
|
@@ -1105,7 +1109,7 @@ function tt(e, t, n) {
|
|
|
1105
1109
|
O.class("bc-object-helpers__row"),
|
|
1106
1110
|
Me.gridTemplateColumns("2fr 3fr min-content"),
|
|
1107
1111
|
ie({
|
|
1108
|
-
content:
|
|
1112
|
+
content: Je({
|
|
1109
1113
|
value: p,
|
|
1110
1114
|
onChange: b,
|
|
1111
1115
|
disabled: M(
|
|
@@ -1178,7 +1182,7 @@ function nt(e, t, n) {
|
|
|
1178
1182
|
delete S[e], S[y] = C, r.change(S);
|
|
1179
1183
|
}, d = K(
|
|
1180
1184
|
q,
|
|
1181
|
-
(g) =>
|
|
1185
|
+
(g) => _e({
|
|
1182
1186
|
size: "xs",
|
|
1183
1187
|
label: g.$.removeItem,
|
|
1184
1188
|
disabled: !l(
|
|
@@ -1199,7 +1203,7 @@ function nt(e, t, n) {
|
|
|
1199
1203
|
O.class("bc-object-helpers__row"),
|
|
1200
1204
|
Me.gridTemplateColumns("2fr 3fr min-content"),
|
|
1201
1205
|
ie({
|
|
1202
|
-
content:
|
|
1206
|
+
content: Je({
|
|
1203
1207
|
value: c,
|
|
1204
1208
|
onChange: f,
|
|
1205
1209
|
disabled: M(
|
|
@@ -1302,7 +1306,7 @@ function jn({
|
|
|
1302
1306
|
config: n,
|
|
1303
1307
|
effective: r
|
|
1304
1308
|
}) {
|
|
1305
|
-
const i =
|
|
1309
|
+
const i = Ue(n.knownProps).filter(
|
|
1306
1310
|
([, o]) => o !== !1
|
|
1307
1311
|
), s = i.map(([o]) => o);
|
|
1308
1312
|
return { children: i.map(([o, l]) => {
|
|
@@ -1476,7 +1480,7 @@ function Pn({
|
|
|
1476
1480
|
O.title(o.unevaluatedTooltip),
|
|
1477
1481
|
k.$.addLabel
|
|
1478
1482
|
)
|
|
1479
|
-
), g = We(a), y =
|
|
1483
|
+
), g = We(a), y = Ue(o.knownProps).filter(
|
|
1480
1484
|
([, k]) => k !== !1
|
|
1481
1485
|
), S = [
|
|
1482
1486
|
...y.map(([k]) => k),
|
|
@@ -1655,7 +1659,7 @@ function Vn({
|
|
|
1655
1659
|
const i = e.definition.oneOf;
|
|
1656
1660
|
return lt({ ctx: e, controller: t, kind: "oneOf", variants: i });
|
|
1657
1661
|
}
|
|
1658
|
-
function
|
|
1662
|
+
function Ir({
|
|
1659
1663
|
ctx: e,
|
|
1660
1664
|
controller: t
|
|
1661
1665
|
}) {
|
|
@@ -1949,7 +1953,7 @@ function D({
|
|
|
1949
1953
|
i,
|
|
1950
1954
|
ut({
|
|
1951
1955
|
ctx: i,
|
|
1952
|
-
controller: t instanceof
|
|
1956
|
+
controller: t instanceof Zt ? t : t.array()
|
|
1953
1957
|
}),
|
|
1954
1958
|
t
|
|
1955
1959
|
)
|
|
@@ -1957,7 +1961,7 @@ function D({
|
|
|
1957
1961
|
case "object": {
|
|
1958
1962
|
const a = ot({
|
|
1959
1963
|
ctx: i,
|
|
1960
|
-
controller: t instanceof
|
|
1964
|
+
controller: t instanceof Yt ? t : t.object()
|
|
1961
1965
|
});
|
|
1962
1966
|
return i.isRoot ? R(
|
|
1963
1967
|
i,
|
|
@@ -2128,7 +2132,7 @@ function ut({
|
|
|
2128
2132
|
return `Must contain at most ${c.maxContains} item(s) matching ${h} (currently ${c.count})`;
|
|
2129
2133
|
}
|
|
2130
2134
|
return `Contains ${c.count} item(s) matching ${h}`;
|
|
2131
|
-
}) : null, p =
|
|
2135
|
+
}) : null, p = Jt({
|
|
2132
2136
|
...W({ ctx: e }),
|
|
2133
2137
|
createItem: () => {
|
|
2134
2138
|
const c = t.signal.value?.length ?? 0;
|
|
@@ -2212,7 +2216,7 @@ function ut({
|
|
|
2212
2216
|
function Mn(e) {
|
|
2213
2217
|
return e.map((t) => ({
|
|
2214
2218
|
key: t,
|
|
2215
|
-
label:
|
|
2219
|
+
label: Ke(t),
|
|
2216
2220
|
detect: (n) => sn(n, [t]) === t,
|
|
2217
2221
|
convert: (n) => an(n, t),
|
|
2218
2222
|
defaultValue: () => on(t)
|
|
@@ -2235,7 +2239,7 @@ function ct({
|
|
|
2235
2239
|
(f) => f !== "null" && (f === "string" || f === "number" || f === "integer" || f === "boolean")
|
|
2236
2240
|
), u = o && l.length === s.length - 1;
|
|
2237
2241
|
u && (s = l);
|
|
2238
|
-
const m = Mn(s), p = new
|
|
2242
|
+
const m = Mn(s), p = new zt(
|
|
2239
2243
|
t.path,
|
|
2240
2244
|
t.change,
|
|
2241
2245
|
t.signal,
|
|
@@ -2245,7 +2249,7 @@ function ct({
|
|
|
2245
2249
|
);
|
|
2246
2250
|
t.onDispose(() => p.dispose());
|
|
2247
2251
|
const c = (f) => Xe({
|
|
2248
|
-
options: s.map((d) => ({ value: d, label:
|
|
2252
|
+
options: s.map((d) => ({ value: d, label: Ke(d) })),
|
|
2249
2253
|
selected: p.activeBranch,
|
|
2250
2254
|
onChange: f,
|
|
2251
2255
|
mode: a.selector ?? "auto"
|
|
@@ -2828,7 +2832,7 @@ function ir(e, t) {
|
|
|
2828
2832
|
}
|
|
2829
2833
|
}
|
|
2830
2834
|
function sr(e) {
|
|
2831
|
-
const t = new
|
|
2835
|
+
const t = new Dt();
|
|
2832
2836
|
for (let n = 0; n < e.length; n++) {
|
|
2833
2837
|
const r = e[n], i = r.displayName ?? `custom-widget-${n}`;
|
|
2834
2838
|
t.register(i, {
|
|
@@ -2843,7 +2847,7 @@ function sr(e) {
|
|
|
2843
2847
|
}
|
|
2844
2848
|
return t;
|
|
2845
2849
|
}
|
|
2846
|
-
function
|
|
2850
|
+
function Nr({
|
|
2847
2851
|
schema: e,
|
|
2848
2852
|
initialValue: t,
|
|
2849
2853
|
externalSchemas: n,
|
|
@@ -2857,7 +2861,7 @@ function kr({
|
|
|
2857
2861
|
}, m) {
|
|
2858
2862
|
const p = t !== void 0 ? j.get(t) : void 0, c = Y(e);
|
|
2859
2863
|
let h;
|
|
2860
|
-
return t === void 0 ? h = c ?? {} : l ? h =
|
|
2864
|
+
return t === void 0 ? h = c ?? {} : l ? h = Ht(
|
|
2861
2865
|
c,
|
|
2862
2866
|
p
|
|
2863
2867
|
) : h = p, mt(
|
|
@@ -2880,7 +2884,7 @@ function kr({
|
|
|
2880
2884
|
v,
|
|
2881
2885
|
d
|
|
2882
2886
|
) : Z;
|
|
2883
|
-
}, { controller: C, setStatus: J } =
|
|
2887
|
+
}, { controller: C, setStatus: J } = Qt({
|
|
2884
2888
|
initialValue: h,
|
|
2885
2889
|
validationMode: w,
|
|
2886
2890
|
validateDebounceMs: a,
|
|
@@ -2923,7 +2927,7 @@ function kr({
|
|
|
2923
2927
|
}
|
|
2924
2928
|
);
|
|
2925
2929
|
}
|
|
2926
|
-
function
|
|
2930
|
+
function Rr(e, t) {
|
|
2927
2931
|
const r = (t?.ajv ?? new en({ allErrors: !0 })).compile(e);
|
|
2928
2932
|
return {
|
|
2929
2933
|
"~standard": {
|
|
@@ -2966,7 +2970,7 @@ function cr(e) {
|
|
|
2966
2970
|
return /^\d+$/.test(e);
|
|
2967
2971
|
}
|
|
2968
2972
|
export {
|
|
2969
|
-
|
|
2973
|
+
Ir as JSONSchemaAllOf,
|
|
2970
2974
|
ue as JSONSchemaAny,
|
|
2971
2975
|
Fn as JSONSchemaAnyOf,
|
|
2972
2976
|
ut as JSONSchemaArray,
|
|
@@ -2974,7 +2978,7 @@ export {
|
|
|
2974
2978
|
On as JSONSchemaConst,
|
|
2975
2979
|
En as JSONSchemaControl,
|
|
2976
2980
|
An as JSONSchemaEnum,
|
|
2977
|
-
|
|
2981
|
+
Nr as JSONSchemaForm,
|
|
2978
2982
|
D as JSONSchemaGenericControl,
|
|
2979
2983
|
ye as JSONSchemaInteger,
|
|
2980
2984
|
Ze as JSONSchemaNull,
|
|
@@ -2985,25 +2989,25 @@ export {
|
|
|
2985
2989
|
ct as JSONSchemaUnion,
|
|
2986
2990
|
ht as SchemaContext,
|
|
2987
2991
|
we as ajvErrorsToControllerValidation,
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2992
|
+
Er as ajvErrorsToDependencies,
|
|
2993
|
+
Tr as buildMessage,
|
|
2994
|
+
Mr as buildPath,
|
|
2995
|
+
$r as clearCaches,
|
|
2996
|
+
Lr as clearCachesForAjv,
|
|
2993
2997
|
Le as compileWithCache,
|
|
2994
2998
|
rn as composeEffectiveObjectSchema,
|
|
2995
|
-
|
|
2996
|
-
|
|
2999
|
+
Rr as createAJVStandardSchema,
|
|
3000
|
+
xr as createDiagnosticWidget,
|
|
2997
3001
|
He as evaluateIfThenElseOverlay,
|
|
2998
3002
|
nn as evaluateNotViolation,
|
|
2999
3003
|
Y as extractSchemaDefaults,
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3004
|
+
_r as forFormat,
|
|
3005
|
+
Ur as forTypeAndFormat,
|
|
3006
|
+
Kr as forXUI,
|
|
3003
3007
|
vt as getAjvForSchema,
|
|
3004
|
-
|
|
3008
|
+
Wr as getCacheStats,
|
|
3005
3009
|
G as getEvaluatedProperties,
|
|
3006
3010
|
tn as hasConditionalFeatures,
|
|
3007
|
-
|
|
3011
|
+
Br as jsonPointerToSegments,
|
|
3008
3012
|
ve as mergeAllOf
|
|
3009
3013
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),f=require("../oneof-branch-detection-xDDDdYRk.cjs"),P=require("../utils-DmEuG3Np.cjs");function U(t){return t===null?"null":Array.isArray(t)?"array":typeof t=="object"?"object":typeof t=="string"?"string":typeof t=="number"?Number.isInteger(t)?"integer":"number":typeof t=="boolean"?"boolean":"unknown"}function X(t,a){return t===a||a==="number"&&t==="integer"}function b(t,a,i=[]){if(typeof a=="boolean")return a===!1?[{kind:"type-mismatch",path:i,message:"Schema disallows any value",actual:String(t)}]:[];const r=[],n=a;if(n.type!=null&&t!==void 0){const s=Array.isArray(n.type)?n.type:[n.type],c=U(t);if(c!=="unknown"&&!s.some(o=>X(c,o)))return r.push({kind:"type-mismatch",path:i,message:`Expected ${s.join(" | ")}, got ${c}`,expected:s.join(" | "),actual:c}),r}if(n.enum!=null&&t!==void 0&&(n.enum.some(c=>JSON.stringify(c)===JSON.stringify(t))||r.push({kind:"enum-mismatch",path:i,message:`Value not in enum: ${JSON.stringify(n.enum)}`,expected:n.enum.map(String).join(", "),actual:String(t)})),n.const!==void 0&&t!==void 0&&JSON.stringify(n.const)!==JSON.stringify(t)&&r.push({kind:"const-mismatch",path:i,message:`Expected const ${JSON.stringify(n.const)}, got ${JSON.stringify(t)}`,expected:JSON.stringify(n.const),actual:JSON.stringify(t)}),typeof t=="string"&&(n.minLength!=null&&t.length<n.minLength&&r.push({kind:"constraint-violation",path:i,message:`String length ${t.length} < minLength ${n.minLength}`,expected:`>= ${n.minLength} chars`,actual:`${t.length} chars`}),n.maxLength!=null&&t.length>n.maxLength&&r.push({kind:"constraint-violation",path:i,message:`String length ${t.length} > maxLength ${n.maxLength}`,expected:`<= ${n.maxLength} chars`,actual:`${t.length} chars`}),n.pattern!=null))try{new RegExp(n.pattern).test(t)||r.push({kind:"constraint-violation",path:i,message:`String does not match pattern /${n.pattern}/`,expected:`/${n.pattern}/`,actual:t})}catch{}if(typeof t=="number"&&(n.minimum!=null&&t<n.minimum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} < minimum ${n.minimum}`,expected:`>= ${n.minimum}`,actual:String(t)}),n.maximum!=null&&t>n.maximum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} > maximum ${n.maximum}`,expected:`<= ${n.maximum}`,actual:String(t)}),n.exclusiveMinimum!=null&&t<=n.exclusiveMinimum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} <= exclusiveMinimum ${n.exclusiveMinimum}`,expected:`> ${n.exclusiveMinimum}`,actual:String(t)}),n.exclusiveMaximum!=null&&t>=n.exclusiveMaximum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} >= exclusiveMaximum ${n.exclusiveMaximum}`,expected:`< ${n.exclusiveMaximum}`,actual:String(t)}),n.multipleOf!=null&&t%n.multipleOf!==0&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} is not a multiple of ${n.multipleOf}`,expected:`multiple of ${n.multipleOf}`,actual:String(t)})),typeof t=="object"&&t!==null&&!Array.isArray(t)){const s=t,c=Object.keys(s);if(n.required!=null)for(const o of n.required)o in s||r.push({kind:"missing-required",path:[...i,o],message:`Missing required property "${o}"`,expected:o});if(n.additionalProperties===!1&&n.properties!=null){const o=new Set(Object.keys(n.properties));if(n.patternProperties!=null){const l=Object.keys(n.patternProperties).map(m=>new RegExp(m));for(const m of c)!o.has(m)&&!l.some(p=>p.test(m))&&r.push({kind:"extra-property",path:[...i,m],message:`Extra property "${m}" not allowed`,actual:m})}else for(const l of c)o.has(l)||r.push({kind:"extra-property",path:[...i,l],message:`Extra property "${l}" not allowed`,actual:l})}if(n.properties!=null)for(const[o,l]of Object.entries(n.properties))o in s&&r.push(...b(s[o],l,[...i,o]))}if(Array.isArray(t)){if(n.minItems!=null&&t.length<n.minItems&&r.push({kind:"constraint-violation",path:i,message:`Array length ${t.length} < minItems ${n.minItems}`,expected:`>= ${n.minItems} items`,actual:`${t.length} items`}),n.maxItems!=null&&t.length>n.maxItems&&r.push({kind:"constraint-violation",path:i,message:`Array length ${t.length} > maxItems ${n.maxItems}`,expected:`<= ${n.maxItems} items`,actual:`${t.length} items`}),n.prefixItems!=null){for(let s=0;s<t.length&&s<n.prefixItems.length;s++)r.push(...b(t[s],n.prefixItems[s],[...i,s]));if(n.items!=null&&!Array.isArray(n.items))for(let s=n.prefixItems.length;s<t.length;s++)r.push(...b(t[s],n.items,[...i,s]))}else if(Array.isArray(n.items)){for(let s=0;s<t.length&&s<n.items.length;s++)r.push(...b(t[s],n.items[s],[...i,s]));if(n.additionalItems!=null)for(let s=n.items.length;s<t.length;s++)r.push(...b(t[s],n.additionalItems,[...i,s]))}else if(n.items!=null)for(let s=0;s<t.length;s++)r.push(...b(t[s],n.items,[...i,s]))}return r}class L{widgets=[];register(a){this.widgets.push(a),this.widgets.sort((i,r)=>(r.priority??50)-(i.priority??50))}findBestWidget(a){const i=P.resolveWidget(a.definition,a.name);if(i?.widget){const r=this.widgets.find(n=>n.displayName===i.widget&&n.matcher(a));if(r)return{factory:r.factory,resolved:i}}for(const r of this.widgets)try{if(r.matcher(a))return{factory:r.factory,resolved:i}}catch(n){console.warn(`Error in display widget matcher "${r.displayName??"unknown"}":`,n)}}}function W(t,a,i){return{factory:a,matcher:r=>{const s=r.definition["x:ui"];return s===t||typeof s=="object"&&s!==null&&s.widget===t},displayName:i?.displayName??t,priority:i?.priority??100,...i}}function z(t,a,i){return{factory:a,matcher:r=>r.definition.format===t,displayName:i?.displayName??`${t} display`,priority:i?.priority??75,...i}}function H(t,a,i,r){return{factory:i,matcher:n=>{const s=n.definition;return s.type===t&&s.format===a},displayName:r?.displayName??`${t}:${a} display`,priority:r?.priority??80,...r}}function Q(t){return t.length===0?e.Empty:e.html.div(e.attr.class("bc-json-schema-display__mismatches"),...t.map(a=>e.html.span(e.attr.class(`bc-json-schema-display__mismatch bc-json-schema-display__mismatch--${a.kind}`),e.attr.title(a.expected?`Expected: ${a.expected}${a.actual?`, got: ${a.actual}`:""}`:a.message),a.message)))}function d({ctx:t,mismatches:a,children:i}){const r=t.widgetLabel,n=t.isPropertyRequired,s=t.isDeprecated,c=t.description;if(t.isRoot&&!a?.length)return e.Fragment(i);const o=a?a.filter(l=>{const m=l.path.map(String).join("."),p=t.path.map(String).join(".");return m===p}):[];return e.html.div(e.attr.class("bc-json-schema-display__field"),r||n||s?e.html.div(e.attr.class("bc-json-schema-display__label-row"),r?e.html.span(e.attr.class("bc-json-schema-display__label"),r):null,n?e.html.span(e.attr.class("bc-json-schema-display__required"),"*"):null,s?e.html.span(e.attr.class("bc-json-schema-display__deprecated"),"deprecated"):null):null,i,c?e.html.div(e.attr.class("bc-json-schema-display__description"),c):null,Q(o))}function Y(t,a){switch(a){case"email":return t?e.html.a(e.attr.class("bc-json-schema-display__link"),e.attr.href(`mailto:${t}`),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"uri":case"uri-reference":case"url":return t?e.html.a(e.attr.class("bc-json-schema-display__link"),e.attr.href(t),e.attr.target("_blank"),e.attr.rel("noopener noreferrer"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"color":return t?e.html.span(e.attr.class("bc-json-schema-display__color-display"),e.html.span(e.attr.class("bc-json-schema-display__color-swatch"),e.attr.style(`background-color: ${t}`)),e.html.span(e.attr.class("bc-json-schema-display__monospace"),t)):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"date-time":case"date":case"time":if(!t)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");try{if(a==="time")return e.html.span(t);const i=new Date(t);return isNaN(i.getTime())?e.html.span(t):e.html.span(a==="date"?i.toLocaleDateString():i.toLocaleString())}catch{return e.html.span(t)}case"password":return t?e.html.span(e.attr.class("bc-json-schema-display__value"),"•".repeat(Math.min(t.length,12))):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"uuid":return t?e.html.span(e.attr.class("bc-json-schema-display__monospace"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"textarea":case"markdown":return t?e.html.pre(e.attr.class("bc-json-schema-display__pre"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");default:return t!==""?e.html.span(e.attr.class("bc-json-schema-display__value"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—")}}function C({ctx:t,value:a,mismatches:i}){const r=t.definition,s=P.resolveWidget(r,t.name)?.widget,c=e.Value.map(a,l=>l!=null?String(l):""),o=e.MapSignal(c,l=>Y(l,s));return d({ctx:t,mismatches:i,children:o})}function Z(t){if(t==null)return"—";const a=Number(t);return isNaN(a)?String(t):a.toLocaleString()}function v(t){return t==null?"bc-json-schema-display__value--null":"bc-json-schema-display__value"}function q({ctx:t,value:a,mismatches:i}){return d({ctx:t,mismatches:i,children:e.html.span(e.attr.class(e.Value.map(a,v)),e.Value.map(a,Z))})}function tt(t){return t==null?"bc-json-schema-display__value--null":`bc-json-schema-display__boolean bc-json-schema-display__boolean--${!!t?"true":"false"}`}function et(t){return t==null?"—":t?"true":"false"}function R({ctx:t,value:a,mismatches:i}){return d({ctx:t,mismatches:i,children:e.html.span(e.attr.class(e.Value.map(a,tt)),e.Value.map(a,et))})}function B({ctx:t,mismatches:a}){return d({ctx:t,mismatches:a,children:e.html.span(e.attr.class("bc-json-schema-display__value--null"),"null")})}function nt(t,a){if(t.prefixItems!=null&&a<t.prefixItems.length)return t.prefixItems[a];if(Array.isArray(t.items)&&a<t.items.length)return t.items[a];if(t.prefixItems!=null&&a>=t.prefixItems.length)return t.items!=null&&!Array.isArray(t.items)?t.items:void 0;if(t.items!=null&&!Array.isArray(t.items))return t.items}function E({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=t.definition,s=e.Value.toSignal(a),c=e.MapSignal(s,o=>Array.isArray(o)?o.length===0?e.html.span(e.attr.class("bc-json-schema-display__empty"),"(empty array)"):e.html.div(e.attr.class("bc-json-schema-display__array"),...o.map((l,m)=>{const p=nt(n,m),h=t.with({definition:p??!0}).append(m),g=i?.filter(_=>{const y=_.path.map(String),S=[...t.path.map(String),String(m)];return y.length>=S.length&&S.every(($,x)=>y[x]===$)});return e.html.div(e.attr.class("bc-json-schema-display__array-item"),e.html.span(e.attr.class("bc-json-schema-display__array-index"),`[${m}]`),j({ctx:h,value:l,mismatches:g,displayWidgetRegistry:r}))})):o==null?e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—"):e.html.span(e.attr.class("bc-json-schema-display__value"),String(o)));return d({ctx:t,mismatches:i,children:c})}function T({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=t.definition,s=e.Value.toSignal(a),c=e.MapSignal(s,o=>{if(o==null)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");if(typeof o!="object"||Array.isArray(o))return e.html.span(e.attr.class("bc-json-schema-display__value"),JSON.stringify(o));const l=o,m=n.properties??{},p=Object.keys(m),h=Object.keys(l),g=p.map(u=>{const I=m[u],D=t.with({definition:I,isPropertyRequired:t.hasRequiredProperty(u)}).append(u),V=i?.filter(A=>{const w=A.path.map(String),M=[...t.path.map(String),u];return w.length>=M.length&&M.every((K,G)=>w[G]===K)}),N=u in l?l[u]:void 0;return!(u in l)&&t.hasRequiredProperty(u)?e.html.div(e.attr.class("bc-json-schema-display__field"),e.html.div(e.attr.class("bc-json-schema-display__label-row"),e.html.span(e.attr.class("bc-json-schema-display__label"),D.widgetLabel??u),e.html.span(e.attr.class("bc-json-schema-display__required"),"*")),e.html.span(e.attr.class("bc-json-schema-display__value--missing"),"(missing)")):u in l?j({ctx:D,value:N,mismatches:V,displayWidgetRegistry:r}):e.Empty}),_=new Set(p),y=h.filter(u=>!_.has(u)),S=y.map(u=>{const I=t.with({definition:!0}).append(u),D=i?.filter(V=>{const N=V.path.map(String),A=[...t.path.map(String),u];return N.length>=A.length&&A.every((w,M)=>N[M]===w)});return e.html.div(e.attr.class("bc-json-schema-display__extra-property"),j({ctx:I,value:l[u],mismatches:D,displayWidgetRegistry:r}))}),$=[...g,...S],x=f.getContainerLayout(t);return x?f.applyContainerLayout(x,t,$,[...p,...y]):t.isRoot?e.html.div(e.attr.class("bc-json-schema-display__fields"),...$):e.html.div(e.attr.class("bc-json-schema-display__object"),...$)});return t.isRoot?c:e.html.div(e.attr.class("bc-json-schema-display__field"),t.widgetLabel?e.html.div(e.attr.class("bc-json-schema-display__label-row"),e.html.span(e.attr.class("bc-json-schema-display__label"),t.widgetLabel),t.isPropertyRequired?e.html.span(e.attr.class("bc-json-schema-display__required"),"*"):null,t.isDeprecated?e.html.span(e.attr.class("bc-json-schema-display__deprecated"),"deprecated"):null):null,c,t.description?e.html.div(e.attr.class("bc-json-schema-display__description"),t.description):null)}function k({ctx:t,value:a,mismatches:i}){const r=t.definition,n=e.Value.toSignal(a),s=e.MapSignal(n,c=>{if(c==null)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");const o=typeof c=="string"?c:JSON.stringify(c);let l=!0;return r.enum!=null?l=r.enum.some(m=>JSON.stringify(m)===JSON.stringify(c)):r.const!==void 0&&(l=JSON.stringify(r.const)===JSON.stringify(c)),e.html.span(e.attr.class(`bc-json-schema-display__value${l?"":" bc-json-schema-display__mismatch--enum-mismatch"}`),o,l?null:e.html.span(e.attr.class("bc-json-schema-display__mismatch-indicator"),r.enum!=null?` (not in enum: ${r.enum.map(m=>JSON.stringify(m)).join(", ")})`:` (expected: ${JSON.stringify(r.const)})`))});return d({ctx:t,mismatches:i,children:s})}function F({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=t.definition;if(n.allOf!=null){const l=n.allOf.filter(m=>typeof m=="object"&&m!==null);if(l.length>0){const m=l.map(S=>f.resolveAnyRef(S,t.schema,t.ajv)),{mergedSchema:p}=f.mergeAllOf(m,t.path),{allOf:h,...g}=n,_={...g,...p},y=t.with({definition:_});return j({ctx:y,value:a,mismatches:i,displayWidgetRegistry:r})}}const s=n.oneOf??n.anyOf;if(!Array.isArray(s)||s.length===0){const l=e.Value.toSignal(a);return d({ctx:t,mismatches:i,children:e.MapSignal(l,m=>e.html.span(e.attr.class("bc-json-schema-display__value"),JSON.stringify(m)))})}const c=e.Value.toSignal(a),o=e.MapSignal(c,l=>{const m=f.detectOneOfBranch(t,l,t.ajv);if(m.matchingBranch>=0){const p=s[m.matchingBranch],h=typeof p=="object"&&p!==null&&p.$ref?f.resolveRef(p,t.schema):p;if((typeof h=="object"?h?.type:void 0)==="object"){const y=t.with({definition:h});return j({ctx:y,value:l,mismatches:i,displayWidgetRegistry:r})}const _=typeof l=="string"?l:JSON.stringify(l);return e.html.span(e.attr.class("bc-json-schema-display__value"),_)}return m.isAmbiguous?e.html.div(e.html.span(e.attr.class("bc-json-schema-display__branch-label bc-json-schema-display__branch-label--ambiguous"),`Ambiguous (${m.validBranches.length} branches match)`),e.html.pre(e.attr.class("bc-json-schema-display__pre"),JSON.stringify(l,null,2))):e.html.div(e.html.span(e.attr.class("bc-json-schema-display__branch-label bc-json-schema-display__branch-label--no-match"),"No matching branch"),e.html.pre(e.attr.class("bc-json-schema-display__pre"),JSON.stringify(l,null,2)))});return d({ctx:t,mismatches:i,children:o})}function O({ctx:t,value:a,mismatches:i}){const r=e.Value.toSignal(a),n=e.MapSignal(r,s=>{if(s==null)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),s===null?"null":"—");if(typeof s=="boolean")return e.html.span(e.attr.class(`bc-json-schema-display__boolean bc-json-schema-display__boolean--${s?"true":"false"}`),String(s));if(typeof s=="number")return e.html.span(e.attr.class("bc-json-schema-display__value"),s.toLocaleString());if(typeof s=="string")return e.html.span(e.attr.class("bc-json-schema-display__value"),s);try{return e.html.pre(e.attr.class("bc-json-schema-display__pre"),JSON.stringify(s,null,2))}catch{return e.html.span(e.attr.class("bc-json-schema-display__value"),String(s))}});return d({ctx:t,mismatches:i,children:n})}function j({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=typeof t.definition=="boolean"?{}:t.definition;let s=n?.$ref?f.resolveRef(n,t.schema):n,c=t.with({definition:s});if(s?.allOf!=null){const o=s.allOf.filter(l=>typeof l=="object"&&l!==null);if(o.length>0){const l=o.map(g=>f.resolveAnyRef(g,t.schema,t.ajv)),{mergedSchema:m}=f.mergeAllOf(l,t.path),{allOf:p,...h}=s;s={...h,...m},c=t.with({definition:s})}}if(r){const o=r.findBestWidget(c);if(o)return o.factory({value:a,ctx:c,mismatches:i})}if(s==null)return O({ctx:c,value:a,mismatches:i});if(s.enum!=null)return k({ctx:c,value:a,mismatches:i});if(s.const!==void 0)return k({ctx:c,value:a,mismatches:i});if(s.anyOf!=null||s.oneOf!=null)return F({ctx:c,value:a,mismatches:i,displayWidgetRegistry:r});if(s.type==null)return O({ctx:c,value:a,mismatches:i});if(Array.isArray(s.type)){const l=s.type.filter(m=>m!=="null");return l.length===1&&["string","number","integer","boolean"].includes(l[0])?J(l[0],{ctx:c,value:a,mismatches:i,displayWidgetRegistry:r}):O({ctx:c,value:a,mismatches:i})}return J(s.type,{ctx:c,value:a,mismatches:i,displayWidgetRegistry:r})}function J(t,a){switch(t){case"string":return C(a);case"number":case"integer":return q(a);case"boolean":return R(a);case"array":return E(a);case"object":return T(a);case"null":return B(a);default:return O(a)}}function st({schema:t,value:a,showMismatches:i=!0,customWidgets:r,horizontal:n=!1}){const s=new f.SchemaContext({schema:t,definition:t,horizontal:n,isPropertyRequired:!1,path:[]});let c;if(r&&r.length>0){c=new L;for(const l of r)c.register(l)}const o=e.Value.toSignal(a);return e.MapSignal(o,l=>{const m=i?b(l,t):void 0;return j({ctx:s,value:l,mismatches:m,displayWidgetRegistry:c})})}exports.AnyDisplay=O;exports.ArrayDisplay=E;exports.BooleanDisplay=R;exports.CompositionDisplay=F;exports.DisplayWidgetRegistry=L;exports.DisplayWrapper=d;exports.EnumConstDisplay=k;exports.GenericDisplay=j;exports.JSONSchemaDisplay=st;exports.NullDisplay=B;exports.NumberDisplay=q;exports.ObjectDisplay=T;exports.StringDisplay=C;exports.detectMismatches=b;exports.forDisplayFormat=z;exports.forDisplayTypeAndFormat=H;exports.forDisplayXUI=W;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tempots/dom"),f=require("../oneof-branch-detection-DZ4MrfBp.cjs"),P=require("../utils-D3-NApSw.cjs");function U(t){return t===null?"null":Array.isArray(t)?"array":typeof t=="object"?"object":typeof t=="string"?"string":typeof t=="number"?Number.isInteger(t)?"integer":"number":typeof t=="boolean"?"boolean":"unknown"}function X(t,a){return t===a||a==="number"&&t==="integer"}function b(t,a,i=[]){if(typeof a=="boolean")return a===!1?[{kind:"type-mismatch",path:i,message:"Schema disallows any value",actual:String(t)}]:[];const r=[],n=a;if(n.type!=null&&t!==void 0){const s=Array.isArray(n.type)?n.type:[n.type],c=U(t);if(c!=="unknown"&&!s.some(o=>X(c,o)))return r.push({kind:"type-mismatch",path:i,message:`Expected ${s.join(" | ")}, got ${c}`,expected:s.join(" | "),actual:c}),r}if(n.enum!=null&&t!==void 0&&(n.enum.some(c=>JSON.stringify(c)===JSON.stringify(t))||r.push({kind:"enum-mismatch",path:i,message:`Value not in enum: ${JSON.stringify(n.enum)}`,expected:n.enum.map(String).join(", "),actual:String(t)})),n.const!==void 0&&t!==void 0&&JSON.stringify(n.const)!==JSON.stringify(t)&&r.push({kind:"const-mismatch",path:i,message:`Expected const ${JSON.stringify(n.const)}, got ${JSON.stringify(t)}`,expected:JSON.stringify(n.const),actual:JSON.stringify(t)}),typeof t=="string"&&(n.minLength!=null&&t.length<n.minLength&&r.push({kind:"constraint-violation",path:i,message:`String length ${t.length} < minLength ${n.minLength}`,expected:`>= ${n.minLength} chars`,actual:`${t.length} chars`}),n.maxLength!=null&&t.length>n.maxLength&&r.push({kind:"constraint-violation",path:i,message:`String length ${t.length} > maxLength ${n.maxLength}`,expected:`<= ${n.maxLength} chars`,actual:`${t.length} chars`}),n.pattern!=null))try{new RegExp(n.pattern).test(t)||r.push({kind:"constraint-violation",path:i,message:`String does not match pattern /${n.pattern}/`,expected:`/${n.pattern}/`,actual:t})}catch{}if(typeof t=="number"&&(n.minimum!=null&&t<n.minimum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} < minimum ${n.minimum}`,expected:`>= ${n.minimum}`,actual:String(t)}),n.maximum!=null&&t>n.maximum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} > maximum ${n.maximum}`,expected:`<= ${n.maximum}`,actual:String(t)}),n.exclusiveMinimum!=null&&t<=n.exclusiveMinimum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} <= exclusiveMinimum ${n.exclusiveMinimum}`,expected:`> ${n.exclusiveMinimum}`,actual:String(t)}),n.exclusiveMaximum!=null&&t>=n.exclusiveMaximum&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} >= exclusiveMaximum ${n.exclusiveMaximum}`,expected:`< ${n.exclusiveMaximum}`,actual:String(t)}),n.multipleOf!=null&&t%n.multipleOf!==0&&r.push({kind:"constraint-violation",path:i,message:`Value ${t} is not a multiple of ${n.multipleOf}`,expected:`multiple of ${n.multipleOf}`,actual:String(t)})),typeof t=="object"&&t!==null&&!Array.isArray(t)){const s=t,c=Object.keys(s);if(n.required!=null)for(const o of n.required)o in s||r.push({kind:"missing-required",path:[...i,o],message:`Missing required property "${o}"`,expected:o});if(n.additionalProperties===!1&&n.properties!=null){const o=new Set(Object.keys(n.properties));if(n.patternProperties!=null){const l=Object.keys(n.patternProperties).map(m=>new RegExp(m));for(const m of c)!o.has(m)&&!l.some(p=>p.test(m))&&r.push({kind:"extra-property",path:[...i,m],message:`Extra property "${m}" not allowed`,actual:m})}else for(const l of c)o.has(l)||r.push({kind:"extra-property",path:[...i,l],message:`Extra property "${l}" not allowed`,actual:l})}if(n.properties!=null)for(const[o,l]of Object.entries(n.properties))o in s&&r.push(...b(s[o],l,[...i,o]))}if(Array.isArray(t)){if(n.minItems!=null&&t.length<n.minItems&&r.push({kind:"constraint-violation",path:i,message:`Array length ${t.length} < minItems ${n.minItems}`,expected:`>= ${n.minItems} items`,actual:`${t.length} items`}),n.maxItems!=null&&t.length>n.maxItems&&r.push({kind:"constraint-violation",path:i,message:`Array length ${t.length} > maxItems ${n.maxItems}`,expected:`<= ${n.maxItems} items`,actual:`${t.length} items`}),n.prefixItems!=null){for(let s=0;s<t.length&&s<n.prefixItems.length;s++)r.push(...b(t[s],n.prefixItems[s],[...i,s]));if(n.items!=null&&!Array.isArray(n.items))for(let s=n.prefixItems.length;s<t.length;s++)r.push(...b(t[s],n.items,[...i,s]))}else if(Array.isArray(n.items)){for(let s=0;s<t.length&&s<n.items.length;s++)r.push(...b(t[s],n.items[s],[...i,s]));if(n.additionalItems!=null)for(let s=n.items.length;s<t.length;s++)r.push(...b(t[s],n.additionalItems,[...i,s]))}else if(n.items!=null)for(let s=0;s<t.length;s++)r.push(...b(t[s],n.items,[...i,s]))}return r}class L{widgets=[];register(a){this.widgets.push(a),this.widgets.sort((i,r)=>(r.priority??50)-(i.priority??50))}findBestWidget(a){const i=P.resolveWidget(a.definition,a.name);if(i?.widget){const r=this.widgets.find(n=>n.displayName===i.widget&&n.matcher(a));if(r)return{factory:r.factory,resolved:i}}for(const r of this.widgets)try{if(r.matcher(a))return{factory:r.factory,resolved:i}}catch(n){console.warn(`Error in display widget matcher "${r.displayName??"unknown"}":`,n)}}}function W(t,a,i){return{factory:a,matcher:r=>{const s=r.definition["x:ui"];return s===t||typeof s=="object"&&s!==null&&s.widget===t},displayName:i?.displayName??t,priority:i?.priority??100,...i}}function z(t,a,i){return{factory:a,matcher:r=>r.definition.format===t,displayName:i?.displayName??`${t} display`,priority:i?.priority??75,...i}}function H(t,a,i,r){return{factory:i,matcher:n=>{const s=n.definition;return s.type===t&&s.format===a},displayName:r?.displayName??`${t}:${a} display`,priority:r?.priority??80,...r}}function Q(t){return t.length===0?e.Empty:e.html.div(e.attr.class("bc-json-schema-display__mismatches"),...t.map(a=>e.html.span(e.attr.class(`bc-json-schema-display__mismatch bc-json-schema-display__mismatch--${a.kind}`),e.attr.title(a.expected?`Expected: ${a.expected}${a.actual?`, got: ${a.actual}`:""}`:a.message),a.message)))}function d({ctx:t,mismatches:a,children:i}){const r=t.widgetLabel,n=t.isPropertyRequired,s=t.isDeprecated,c=t.description;if(t.isRoot&&!a?.length)return e.Fragment(i);const o=a?a.filter(l=>{const m=l.path.map(String).join("."),p=t.path.map(String).join(".");return m===p}):[];return e.html.div(e.attr.class("bc-json-schema-display__field"),r||n||s?e.html.div(e.attr.class("bc-json-schema-display__label-row"),r?e.html.span(e.attr.class("bc-json-schema-display__label"),r):null,n?e.html.span(e.attr.class("bc-json-schema-display__required"),"*"):null,s?e.html.span(e.attr.class("bc-json-schema-display__deprecated"),"deprecated"):null):null,i,c?e.html.div(e.attr.class("bc-json-schema-display__description"),c):null,Q(o))}function Y(t,a){switch(a){case"email":return t?e.html.a(e.attr.class("bc-json-schema-display__link"),e.attr.href(`mailto:${t}`),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"uri":case"uri-reference":case"url":return t?e.html.a(e.attr.class("bc-json-schema-display__link"),e.attr.href(t),e.attr.target("_blank"),e.attr.rel("noopener noreferrer"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"color":return t?e.html.span(e.attr.class("bc-json-schema-display__color-display"),e.html.span(e.attr.class("bc-json-schema-display__color-swatch"),e.attr.style(`background-color: ${t}`)),e.html.span(e.attr.class("bc-json-schema-display__monospace"),t)):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"date-time":case"date":case"time":if(!t)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");try{if(a==="time")return e.html.span(t);const i=new Date(t);return isNaN(i.getTime())?e.html.span(t):e.html.span(a==="date"?i.toLocaleDateString():i.toLocaleString())}catch{return e.html.span(t)}case"password":return t?e.html.span(e.attr.class("bc-json-schema-display__value"),"•".repeat(Math.min(t.length,12))):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"uuid":return t?e.html.span(e.attr.class("bc-json-schema-display__monospace"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");case"textarea":case"markdown":return t?e.html.pre(e.attr.class("bc-json-schema-display__pre"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");default:return t!==""?e.html.span(e.attr.class("bc-json-schema-display__value"),t):e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—")}}function C({ctx:t,value:a,mismatches:i}){const r=t.definition,s=P.resolveWidget(r,t.name)?.widget,c=e.Value.map(a,l=>l!=null?String(l):""),o=e.MapSignal(c,l=>Y(l,s));return d({ctx:t,mismatches:i,children:o})}function Z(t){if(t==null)return"—";const a=Number(t);return isNaN(a)?String(t):a.toLocaleString()}function v(t){return t==null?"bc-json-schema-display__value--null":"bc-json-schema-display__value"}function q({ctx:t,value:a,mismatches:i}){return d({ctx:t,mismatches:i,children:e.html.span(e.attr.class(e.Value.map(a,v)),e.Value.map(a,Z))})}function tt(t){return t==null?"bc-json-schema-display__value--null":`bc-json-schema-display__boolean bc-json-schema-display__boolean--${!!t?"true":"false"}`}function et(t){return t==null?"—":t?"true":"false"}function R({ctx:t,value:a,mismatches:i}){return d({ctx:t,mismatches:i,children:e.html.span(e.attr.class(e.Value.map(a,tt)),e.Value.map(a,et))})}function B({ctx:t,mismatches:a}){return d({ctx:t,mismatches:a,children:e.html.span(e.attr.class("bc-json-schema-display__value--null"),"null")})}function nt(t,a){if(t.prefixItems!=null&&a<t.prefixItems.length)return t.prefixItems[a];if(Array.isArray(t.items)&&a<t.items.length)return t.items[a];if(t.prefixItems!=null&&a>=t.prefixItems.length)return t.items!=null&&!Array.isArray(t.items)?t.items:void 0;if(t.items!=null&&!Array.isArray(t.items))return t.items}function E({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=t.definition,s=e.Value.toSignal(a),c=e.MapSignal(s,o=>Array.isArray(o)?o.length===0?e.html.span(e.attr.class("bc-json-schema-display__empty"),"(empty array)"):e.html.div(e.attr.class("bc-json-schema-display__array"),...o.map((l,m)=>{const p=nt(n,m),h=t.with({definition:p??!0}).append(m),g=i?.filter(_=>{const y=_.path.map(String),S=[...t.path.map(String),String(m)];return y.length>=S.length&&S.every(($,x)=>y[x]===$)});return e.html.div(e.attr.class("bc-json-schema-display__array-item"),e.html.span(e.attr.class("bc-json-schema-display__array-index"),`[${m}]`),j({ctx:h,value:l,mismatches:g,displayWidgetRegistry:r}))})):o==null?e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—"):e.html.span(e.attr.class("bc-json-schema-display__value"),String(o)));return d({ctx:t,mismatches:i,children:c})}function T({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=t.definition,s=e.Value.toSignal(a),c=e.MapSignal(s,o=>{if(o==null)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");if(typeof o!="object"||Array.isArray(o))return e.html.span(e.attr.class("bc-json-schema-display__value"),JSON.stringify(o));const l=o,m=n.properties??{},p=Object.keys(m),h=Object.keys(l),g=p.map(u=>{const I=m[u],D=t.with({definition:I,isPropertyRequired:t.hasRequiredProperty(u)}).append(u),V=i?.filter(A=>{const w=A.path.map(String),M=[...t.path.map(String),u];return w.length>=M.length&&M.every((K,G)=>w[G]===K)}),N=u in l?l[u]:void 0;return!(u in l)&&t.hasRequiredProperty(u)?e.html.div(e.attr.class("bc-json-schema-display__field"),e.html.div(e.attr.class("bc-json-schema-display__label-row"),e.html.span(e.attr.class("bc-json-schema-display__label"),D.widgetLabel??u),e.html.span(e.attr.class("bc-json-schema-display__required"),"*")),e.html.span(e.attr.class("bc-json-schema-display__value--missing"),"(missing)")):u in l?j({ctx:D,value:N,mismatches:V,displayWidgetRegistry:r}):e.Empty}),_=new Set(p),y=h.filter(u=>!_.has(u)),S=y.map(u=>{const I=t.with({definition:!0}).append(u),D=i?.filter(V=>{const N=V.path.map(String),A=[...t.path.map(String),u];return N.length>=A.length&&A.every((w,M)=>N[M]===w)});return e.html.div(e.attr.class("bc-json-schema-display__extra-property"),j({ctx:I,value:l[u],mismatches:D,displayWidgetRegistry:r}))}),$=[...g,...S],x=f.getContainerLayout(t);return x?f.applyContainerLayout(x,t,$,[...p,...y]):t.isRoot?e.html.div(e.attr.class("bc-json-schema-display__fields"),...$):e.html.div(e.attr.class("bc-json-schema-display__object"),...$)});return t.isRoot?c:e.html.div(e.attr.class("bc-json-schema-display__field"),t.widgetLabel?e.html.div(e.attr.class("bc-json-schema-display__label-row"),e.html.span(e.attr.class("bc-json-schema-display__label"),t.widgetLabel),t.isPropertyRequired?e.html.span(e.attr.class("bc-json-schema-display__required"),"*"):null,t.isDeprecated?e.html.span(e.attr.class("bc-json-schema-display__deprecated"),"deprecated"):null):null,c,t.description?e.html.div(e.attr.class("bc-json-schema-display__description"),t.description):null)}function k({ctx:t,value:a,mismatches:i}){const r=t.definition,n=e.Value.toSignal(a),s=e.MapSignal(n,c=>{if(c==null)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),"—");const o=typeof c=="string"?c:JSON.stringify(c);let l=!0;return r.enum!=null?l=r.enum.some(m=>JSON.stringify(m)===JSON.stringify(c)):r.const!==void 0&&(l=JSON.stringify(r.const)===JSON.stringify(c)),e.html.span(e.attr.class(`bc-json-schema-display__value${l?"":" bc-json-schema-display__mismatch--enum-mismatch"}`),o,l?null:e.html.span(e.attr.class("bc-json-schema-display__mismatch-indicator"),r.enum!=null?` (not in enum: ${r.enum.map(m=>JSON.stringify(m)).join(", ")})`:` (expected: ${JSON.stringify(r.const)})`))});return d({ctx:t,mismatches:i,children:s})}function F({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=t.definition;if(n.allOf!=null){const l=n.allOf.filter(m=>typeof m=="object"&&m!==null);if(l.length>0){const m=l.map(S=>f.resolveAnyRef(S,t.schema,t.ajv)),{mergedSchema:p}=f.mergeAllOf(m,t.path),{allOf:h,...g}=n,_={...g,...p},y=t.with({definition:_});return j({ctx:y,value:a,mismatches:i,displayWidgetRegistry:r})}}const s=n.oneOf??n.anyOf;if(!Array.isArray(s)||s.length===0){const l=e.Value.toSignal(a);return d({ctx:t,mismatches:i,children:e.MapSignal(l,m=>e.html.span(e.attr.class("bc-json-schema-display__value"),JSON.stringify(m)))})}const c=e.Value.toSignal(a),o=e.MapSignal(c,l=>{const m=f.detectOneOfBranch(t,l,t.ajv);if(m.matchingBranch>=0){const p=s[m.matchingBranch],h=typeof p=="object"&&p!==null&&p.$ref?f.resolveRef(p,t.schema):p;if((typeof h=="object"?h?.type:void 0)==="object"){const y=t.with({definition:h});return j({ctx:y,value:l,mismatches:i,displayWidgetRegistry:r})}const _=typeof l=="string"?l:JSON.stringify(l);return e.html.span(e.attr.class("bc-json-schema-display__value"),_)}return m.isAmbiguous?e.html.div(e.html.span(e.attr.class("bc-json-schema-display__branch-label bc-json-schema-display__branch-label--ambiguous"),`Ambiguous (${m.validBranches.length} branches match)`),e.html.pre(e.attr.class("bc-json-schema-display__pre"),JSON.stringify(l,null,2))):e.html.div(e.html.span(e.attr.class("bc-json-schema-display__branch-label bc-json-schema-display__branch-label--no-match"),"No matching branch"),e.html.pre(e.attr.class("bc-json-schema-display__pre"),JSON.stringify(l,null,2)))});return d({ctx:t,mismatches:i,children:o})}function O({ctx:t,value:a,mismatches:i}){const r=e.Value.toSignal(a),n=e.MapSignal(r,s=>{if(s==null)return e.html.span(e.attr.class("bc-json-schema-display__value--null"),s===null?"null":"—");if(typeof s=="boolean")return e.html.span(e.attr.class(`bc-json-schema-display__boolean bc-json-schema-display__boolean--${s?"true":"false"}`),String(s));if(typeof s=="number")return e.html.span(e.attr.class("bc-json-schema-display__value"),s.toLocaleString());if(typeof s=="string")return e.html.span(e.attr.class("bc-json-schema-display__value"),s);try{return e.html.pre(e.attr.class("bc-json-schema-display__pre"),JSON.stringify(s,null,2))}catch{return e.html.span(e.attr.class("bc-json-schema-display__value"),String(s))}});return d({ctx:t,mismatches:i,children:n})}function j({ctx:t,value:a,mismatches:i,displayWidgetRegistry:r}){const n=typeof t.definition=="boolean"?{}:t.definition;let s=n?.$ref?f.resolveRef(n,t.schema):n,c=t.with({definition:s});if(s?.allOf!=null){const o=s.allOf.filter(l=>typeof l=="object"&&l!==null);if(o.length>0){const l=o.map(g=>f.resolveAnyRef(g,t.schema,t.ajv)),{mergedSchema:m}=f.mergeAllOf(l,t.path),{allOf:p,...h}=s;s={...h,...m},c=t.with({definition:s})}}if(r){const o=r.findBestWidget(c);if(o)return o.factory({value:a,ctx:c,mismatches:i})}if(s==null)return O({ctx:c,value:a,mismatches:i});if(s.enum!=null)return k({ctx:c,value:a,mismatches:i});if(s.const!==void 0)return k({ctx:c,value:a,mismatches:i});if(s.anyOf!=null||s.oneOf!=null)return F({ctx:c,value:a,mismatches:i,displayWidgetRegistry:r});if(s.type==null)return O({ctx:c,value:a,mismatches:i});if(Array.isArray(s.type)){const l=s.type.filter(m=>m!=="null");return l.length===1&&["string","number","integer","boolean"].includes(l[0])?J(l[0],{ctx:c,value:a,mismatches:i,displayWidgetRegistry:r}):O({ctx:c,value:a,mismatches:i})}return J(s.type,{ctx:c,value:a,mismatches:i,displayWidgetRegistry:r})}function J(t,a){switch(t){case"string":return C(a);case"number":case"integer":return q(a);case"boolean":return R(a);case"array":return E(a);case"object":return T(a);case"null":return B(a);default:return O(a)}}function st({schema:t,value:a,showMismatches:i=!0,customWidgets:r,horizontal:n=!1}){const s=new f.SchemaContext({schema:t,definition:t,horizontal:n,isPropertyRequired:!1,path:[]});let c;if(r&&r.length>0){c=new L;for(const l of r)c.register(l)}const o=e.Value.toSignal(a);return e.MapSignal(o,l=>{const m=i?b(l,t):void 0;return j({ctx:s,value:l,mismatches:m,displayWidgetRegistry:c})})}exports.AnyDisplay=O;exports.ArrayDisplay=E;exports.BooleanDisplay=R;exports.CompositionDisplay=F;exports.DisplayWidgetRegistry=L;exports.DisplayWrapper=d;exports.EnumConstDisplay=k;exports.GenericDisplay=j;exports.JSONSchemaDisplay=st;exports.NullDisplay=B;exports.NumberDisplay=q;exports.ObjectDisplay=T;exports.StringDisplay=C;exports.detectMismatches=b;exports.forDisplayFormat=z;exports.forDisplayTypeAndFormat=H;exports.forDisplayXUI=W;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as F, html as l, attr as r, Empty as q, Value as d, MapSignal as _ } from "@tempots/dom";
|
|
2
|
-
import { g as G, a as U, r as V, m as B, d as X, b as E, S as z } from "../oneof-branch-detection-
|
|
3
|
-
import { r as R } from "../utils-
|
|
2
|
+
import { g as G, a as U, r as V, m as B, d as X, b as E, S as z } from "../oneof-branch-detection-Bm17RhC2.js";
|
|
3
|
+
import { r as R } from "../utils-Nbh7yQ73.js";
|
|
4
4
|
function H(e) {
|
|
5
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
6
|
}
|