@tempots/beatui 1.7.4 → 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/beatui.css +1 -0
- package/dist/beatui.tailwind.css +1 -0
- 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
|
@@ -0,0 +1,1198 @@
|
|
|
1
|
+
import { Value as p, prop as gt, computedOf as V, html as A, attr as d, svg as it, svgAttr as Y, Empty as W, on as y, When as U, Fragment as z, aria as ct, emitValue as tt, Use as Kt, input as bt, emitValueAsNullableDate as ut, emitValueAsNullableDateTime as ht } from "@tempots/dom";
|
|
2
|
+
import { F as te, U as ee, a as re } from "./deep-merge-8fwp1z4X.js";
|
|
3
|
+
import { decodeBase64 as ae } from "@tempots/std";
|
|
4
|
+
import { a as et } from "./input-container-DCS5oJ4S.js";
|
|
5
|
+
import { C as rt, m as mt, T as ne } from "./text-input-ByuxdX8w.js";
|
|
6
|
+
import { B as se, I as oe } from "./translations-DU9wTV1y.js";
|
|
7
|
+
import { AutoSelect as le } from "@tempots/ui";
|
|
8
|
+
import { N as L, T as ie } from "./text-area-Br83-_PQ.js";
|
|
9
|
+
import { E as ce, P as ue } from "./password-input-mkRmrEPq.js";
|
|
10
|
+
import { R as he } from "./slider-input-VYAMm7pE.js";
|
|
11
|
+
import { r as pe } from "./utils-Nbh7yQ73.js";
|
|
12
|
+
async function de(t) {
|
|
13
|
+
return new Promise((e, r) => {
|
|
14
|
+
const a = new FileReader();
|
|
15
|
+
a.readAsDataURL(t), a.onload = () => {
|
|
16
|
+
const n = a.result;
|
|
17
|
+
e(n.split(",")[1]);
|
|
18
|
+
}, a.onerror = (n) => r(n);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function ge(t) {
|
|
22
|
+
return Promise.all(t.map(de));
|
|
23
|
+
}
|
|
24
|
+
function be(t) {
|
|
25
|
+
if (t.length >= 4) {
|
|
26
|
+
if (t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71)
|
|
27
|
+
return "image/png";
|
|
28
|
+
if (t[0] === 255 && t[1] === 216) return "image/jpeg";
|
|
29
|
+
if (t[0] === 71 && t[1] === 73 && t[2] === 70)
|
|
30
|
+
return "image/gif";
|
|
31
|
+
if (t[0] === 82 && t[1] === 73 && t[2] === 70 && t[3] === 70 && t.length >= 12 && t[8] === 87 && t[9] === 69 && t[10] === 66 && t[11] === 80)
|
|
32
|
+
return "image/webp";
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
if (new TextDecoder("utf-8").decode(t.slice(0, 256)).includes("<svg")) return "image/svg+xml";
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
return "application/octet-stream";
|
|
39
|
+
}
|
|
40
|
+
function me(t) {
|
|
41
|
+
const e = ae(t ?? ""), r = e.length, a = new Uint8Array(r);
|
|
42
|
+
for (let n = 0; n < r; n++) a[n] = e.charCodeAt(n);
|
|
43
|
+
return a;
|
|
44
|
+
}
|
|
45
|
+
function fe(t) {
|
|
46
|
+
const {
|
|
47
|
+
value: e,
|
|
48
|
+
onChange: r,
|
|
49
|
+
onInput: a,
|
|
50
|
+
...n
|
|
51
|
+
} = t, s = /* @__PURE__ */ new Map(), o = p.toSignal(e).map(($) => $.map((m, k) => {
|
|
52
|
+
const g = s.get(m), b = me(m ?? ""), T = g?.type || be(b), B = g?.name ?? `file-${k}`, _ = b.buffer.slice(
|
|
53
|
+
b.byteOffset,
|
|
54
|
+
b.byteOffset + b.byteLength
|
|
55
|
+
), j = new Blob([_], { type: T });
|
|
56
|
+
return new File([j], B, { type: T });
|
|
57
|
+
})), l = ($) => (m) => {
|
|
58
|
+
$ && ge(m).then((k) => {
|
|
59
|
+
for (const [g, b] of k.entries())
|
|
60
|
+
s.set(b, { name: m[g].name, type: m[g].type });
|
|
61
|
+
$(k);
|
|
62
|
+
});
|
|
63
|
+
}, i = l(r), c = l(a);
|
|
64
|
+
return te({
|
|
65
|
+
...n,
|
|
66
|
+
value: o,
|
|
67
|
+
onChange: i,
|
|
68
|
+
onInput: c
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function zr(t) {
|
|
72
|
+
const {
|
|
73
|
+
value: e,
|
|
74
|
+
onInput: r,
|
|
75
|
+
onChange: a,
|
|
76
|
+
...n
|
|
77
|
+
} = t;
|
|
78
|
+
return fe({
|
|
79
|
+
...n,
|
|
80
|
+
maxFiles: 1,
|
|
81
|
+
value: p.map(e, (s) => s == null ? [] : [s]),
|
|
82
|
+
onChange: (s) => {
|
|
83
|
+
a?.(s[0]);
|
|
84
|
+
},
|
|
85
|
+
onInput: (s) => {
|
|
86
|
+
r?.(s[0]);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
let F = class extends Error {
|
|
91
|
+
constructor(e) {
|
|
92
|
+
super(e), this.name = "ParsingError";
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const h = (t, e, r) => Math.min(Math.max(t, e), r), E = (t, e, r) => Math.trunc(h(t, e, r)), x = (t, e) => {
|
|
96
|
+
const r = Math.pow(10, e);
|
|
97
|
+
return Math.round(t * r) / r;
|
|
98
|
+
}, N = (t, e) => (t = t % e, t < 0 && (t += e), t), at = {
|
|
99
|
+
aliceblue: [240, 248, 255],
|
|
100
|
+
antiquewhite: [250, 235, 215],
|
|
101
|
+
aqua: [0, 255, 255],
|
|
102
|
+
aquamarine: [127, 255, 212],
|
|
103
|
+
azure: [240, 255, 255],
|
|
104
|
+
beige: [245, 245, 220],
|
|
105
|
+
bisque: [255, 228, 196],
|
|
106
|
+
black: [0, 0, 0],
|
|
107
|
+
blanchedalmond: [255, 235, 205],
|
|
108
|
+
blue: [0, 0, 255],
|
|
109
|
+
blueviolet: [138, 43, 226],
|
|
110
|
+
brown: [165, 42, 42],
|
|
111
|
+
burlywood: [222, 184, 135],
|
|
112
|
+
cadetblue: [95, 158, 160],
|
|
113
|
+
chartreuse: [127, 255, 0],
|
|
114
|
+
chocolate: [210, 105, 30],
|
|
115
|
+
coral: [255, 127, 80],
|
|
116
|
+
cornflowerblue: [100, 149, 237],
|
|
117
|
+
cornsilk: [255, 248, 220],
|
|
118
|
+
crimson: [220, 20, 60],
|
|
119
|
+
cyan: [0, 255, 255],
|
|
120
|
+
darkblue: [0, 0, 139],
|
|
121
|
+
darkcyan: [0, 139, 139],
|
|
122
|
+
darkgoldenrod: [184, 134, 11],
|
|
123
|
+
darkgray: [169, 169, 169],
|
|
124
|
+
darkgreen: [0, 100, 0],
|
|
125
|
+
darkgrey: [169, 169, 169],
|
|
126
|
+
darkkhaki: [189, 183, 107],
|
|
127
|
+
darkmagenta: [139, 0, 139],
|
|
128
|
+
darkolivegreen: [85, 107, 47],
|
|
129
|
+
darkorange: [255, 140, 0],
|
|
130
|
+
darkorchid: [153, 50, 204],
|
|
131
|
+
darkred: [139, 0, 0],
|
|
132
|
+
darksalmon: [233, 150, 122],
|
|
133
|
+
darkseagreen: [143, 188, 143],
|
|
134
|
+
darkslateblue: [72, 61, 139],
|
|
135
|
+
darkslategray: [47, 79, 79],
|
|
136
|
+
darkslategrey: [47, 79, 79],
|
|
137
|
+
darkturquoise: [0, 206, 209],
|
|
138
|
+
darkviolet: [148, 0, 211],
|
|
139
|
+
deeppink: [255, 20, 147],
|
|
140
|
+
deepskyblue: [0, 191, 255],
|
|
141
|
+
dimgray: [105, 105, 105],
|
|
142
|
+
dimgrey: [105, 105, 105],
|
|
143
|
+
dodgerblue: [30, 144, 255],
|
|
144
|
+
firebrick: [178, 34, 34],
|
|
145
|
+
floralwhite: [255, 250, 240],
|
|
146
|
+
forestgreen: [34, 139, 34],
|
|
147
|
+
fuchsia: [255, 0, 255],
|
|
148
|
+
gainsboro: [220, 220, 220],
|
|
149
|
+
ghostwhite: [248, 248, 255],
|
|
150
|
+
gold: [255, 215, 0],
|
|
151
|
+
goldenrod: [218, 165, 32],
|
|
152
|
+
gray: [128, 128, 128],
|
|
153
|
+
green: [0, 128, 0],
|
|
154
|
+
greenyellow: [173, 255, 47],
|
|
155
|
+
grey: [128, 128, 128],
|
|
156
|
+
honeydew: [240, 255, 240],
|
|
157
|
+
hotpink: [255, 105, 180],
|
|
158
|
+
indianred: [205, 92, 92],
|
|
159
|
+
indigo: [75, 0, 130],
|
|
160
|
+
ivory: [255, 255, 240],
|
|
161
|
+
khaki: [240, 230, 140],
|
|
162
|
+
lavender: [230, 230, 250],
|
|
163
|
+
lavenderblush: [255, 240, 245],
|
|
164
|
+
lawngreen: [124, 252, 0],
|
|
165
|
+
lemonchiffon: [255, 250, 205],
|
|
166
|
+
lightblue: [173, 216, 230],
|
|
167
|
+
lightcoral: [240, 128, 128],
|
|
168
|
+
lightcyan: [224, 255, 255],
|
|
169
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
170
|
+
lightgray: [211, 211, 211],
|
|
171
|
+
lightgreen: [144, 238, 144],
|
|
172
|
+
lightgrey: [211, 211, 211],
|
|
173
|
+
lightpink: [255, 182, 193],
|
|
174
|
+
lightsalmon: [255, 160, 122],
|
|
175
|
+
lightseagreen: [32, 178, 170],
|
|
176
|
+
lightskyblue: [135, 206, 250],
|
|
177
|
+
lightslategray: [119, 136, 153],
|
|
178
|
+
lightslategrey: [119, 136, 153],
|
|
179
|
+
lightsteelblue: [176, 196, 222],
|
|
180
|
+
lightyellow: [255, 255, 224],
|
|
181
|
+
lime: [0, 255, 0],
|
|
182
|
+
limegreen: [50, 205, 50],
|
|
183
|
+
linen: [250, 240, 230],
|
|
184
|
+
magenta: [255, 0, 255],
|
|
185
|
+
maroon: [128, 0, 0],
|
|
186
|
+
mediumaquamarine: [102, 205, 170],
|
|
187
|
+
mediumblue: [0, 0, 205],
|
|
188
|
+
mediumorchid: [186, 85, 211],
|
|
189
|
+
mediumpurple: [147, 112, 219],
|
|
190
|
+
mediumseagreen: [60, 179, 113],
|
|
191
|
+
mediumslateblue: [123, 104, 238],
|
|
192
|
+
mediumspringgreen: [0, 250, 154],
|
|
193
|
+
mediumturquoise: [72, 209, 204],
|
|
194
|
+
mediumvioletred: [199, 21, 133],
|
|
195
|
+
midnightblue: [25, 25, 112],
|
|
196
|
+
mintcream: [245, 255, 250],
|
|
197
|
+
mistyrose: [255, 228, 225],
|
|
198
|
+
moccasin: [255, 228, 181],
|
|
199
|
+
navajowhite: [255, 222, 173],
|
|
200
|
+
navy: [0, 0, 128],
|
|
201
|
+
oldlace: [253, 245, 230],
|
|
202
|
+
olive: [128, 128, 0],
|
|
203
|
+
olivedrab: [107, 142, 35],
|
|
204
|
+
orange: [255, 165, 0],
|
|
205
|
+
orangered: [255, 69, 0],
|
|
206
|
+
orchid: [218, 112, 214],
|
|
207
|
+
palegoldenrod: [238, 232, 170],
|
|
208
|
+
palegreen: [152, 251, 152],
|
|
209
|
+
paleturquoise: [175, 238, 238],
|
|
210
|
+
palevioletred: [219, 112, 147],
|
|
211
|
+
papayawhip: [255, 239, 213],
|
|
212
|
+
peachpuff: [255, 218, 185],
|
|
213
|
+
peru: [205, 133, 63],
|
|
214
|
+
pink: [255, 192, 203],
|
|
215
|
+
plum: [221, 160, 221],
|
|
216
|
+
powderblue: [176, 224, 230],
|
|
217
|
+
purple: [128, 0, 128],
|
|
218
|
+
rebeccapurple: [102, 51, 153],
|
|
219
|
+
red: [255, 0, 0],
|
|
220
|
+
rosybrown: [188, 143, 143],
|
|
221
|
+
royalblue: [65, 105, 225],
|
|
222
|
+
saddlebrown: [139, 69, 19],
|
|
223
|
+
salmon: [250, 128, 114],
|
|
224
|
+
sandybrown: [244, 164, 96],
|
|
225
|
+
seagreen: [46, 139, 87],
|
|
226
|
+
seashell: [255, 245, 238],
|
|
227
|
+
sienna: [160, 82, 45],
|
|
228
|
+
silver: [192, 192, 192],
|
|
229
|
+
skyblue: [135, 206, 235],
|
|
230
|
+
slateblue: [106, 90, 205],
|
|
231
|
+
slategray: [112, 128, 144],
|
|
232
|
+
slategrey: [112, 128, 144],
|
|
233
|
+
snow: [255, 250, 250],
|
|
234
|
+
springgreen: [0, 255, 127],
|
|
235
|
+
steelblue: [70, 130, 180],
|
|
236
|
+
tan: [210, 180, 140],
|
|
237
|
+
teal: [0, 128, 128],
|
|
238
|
+
thistle: [216, 191, 216],
|
|
239
|
+
tomato: [255, 99, 71],
|
|
240
|
+
turquoise: [64, 224, 208],
|
|
241
|
+
violet: [238, 130, 238],
|
|
242
|
+
wheat: [245, 222, 179],
|
|
243
|
+
white: [255, 255, 255],
|
|
244
|
+
whitesmoke: [245, 245, 245],
|
|
245
|
+
yellow: [255, 255, 0],
|
|
246
|
+
yellowgreen: [154, 205, 50]
|
|
247
|
+
}, ft = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, wt = /^rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*(?:,\s*([\d.]+%?)\s*)?\)$/i, $t = /^rgba?\(\s*(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, yt = /^rgba?\(\s*(\d+(?:\.\d+)?)%\s*,\s*(\d+(?:\.\d+)?)%\s*,\s*(\d+(?:\.\d+)?)%\s*(?:,\s*([\d.]+%?)\s*)?\)$/i, Mt = /^rgba?\(\s*(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, we = (t) => ft.test(t.trim()), $e = (t) => {
|
|
248
|
+
const e = t.trim(), r = ft.exec(e);
|
|
249
|
+
if (!r) throw new F(`Invalid hex color: '${t}'`);
|
|
250
|
+
const a = r[1];
|
|
251
|
+
return a.length === 3 ? M(
|
|
252
|
+
parseInt(a[0] + a[0], 16),
|
|
253
|
+
parseInt(a[1] + a[1], 16),
|
|
254
|
+
parseInt(a[2] + a[2], 16)
|
|
255
|
+
) : a.length === 4 ? M(
|
|
256
|
+
parseInt(a[0] + a[0], 16),
|
|
257
|
+
parseInt(a[1] + a[1], 16),
|
|
258
|
+
parseInt(a[2] + a[2], 16),
|
|
259
|
+
parseInt(a[3] + a[3], 16) / 255
|
|
260
|
+
) : a.length === 6 ? M(
|
|
261
|
+
parseInt(a.slice(0, 2), 16),
|
|
262
|
+
parseInt(a.slice(2, 4), 16),
|
|
263
|
+
parseInt(a.slice(4, 6), 16)
|
|
264
|
+
) : M(
|
|
265
|
+
parseInt(a.slice(0, 2), 16),
|
|
266
|
+
parseInt(a.slice(2, 4), 16),
|
|
267
|
+
parseInt(a.slice(4, 6), 16),
|
|
268
|
+
parseInt(a.slice(6, 8), 16) / 255
|
|
269
|
+
);
|
|
270
|
+
}, ye = (t) => {
|
|
271
|
+
const e = t.trim();
|
|
272
|
+
return wt.test(e) || $t.test(e) || yt.test(e) || Mt.test(e);
|
|
273
|
+
}, Me = (t) => {
|
|
274
|
+
const e = t.trim(), r = wt.exec(e) ?? $t.exec(e);
|
|
275
|
+
if (r)
|
|
276
|
+
return M(
|
|
277
|
+
E(parseFloat(r[1]), 0, 255),
|
|
278
|
+
E(parseFloat(r[2]), 0, 255),
|
|
279
|
+
E(parseFloat(r[3]), 0, 255),
|
|
280
|
+
C(r[4])
|
|
281
|
+
);
|
|
282
|
+
const a = yt.exec(e) ?? Mt.exec(e);
|
|
283
|
+
if (a)
|
|
284
|
+
return M(
|
|
285
|
+
Math.round(parseFloat(a[1]) / 100 * 255),
|
|
286
|
+
Math.round(parseFloat(a[2]) / 100 * 255),
|
|
287
|
+
Math.round(parseFloat(a[3]) / 100 * 255),
|
|
288
|
+
C(a[4])
|
|
289
|
+
);
|
|
290
|
+
throw new F(`Invalid rgb color: '${t}'`);
|
|
291
|
+
}, ke = (t) => t.trim().toLowerCase() in at, ve = (t) => {
|
|
292
|
+
const e = t.trim().toLowerCase(), r = at[e];
|
|
293
|
+
if (!r) throw new F(`Unknown named color: '${t}'`);
|
|
294
|
+
return M(r[0], r[1], r[2]);
|
|
295
|
+
}, xe = (t) => t.alpha >= 1 ? `rgb(${t.r} ${t.g} ${t.b})` : `rgb(${t.r} ${t.g} ${t.b} / ${t.alpha})`, Ie = (t) => {
|
|
296
|
+
const e = G(t.r * 100), r = G(t.g * 100), a = G(t.b * 100);
|
|
297
|
+
return t.alpha >= 1 ? `rgb(${e}% ${r}% ${a}%)` : `rgb(${e}% ${r}% ${a}% / ${t.alpha})`;
|
|
298
|
+
}, G = (t) => Math.round(t * 100) / 100, kt = /^hsla?\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)%\s*,\s*(\d+(?:\.\d+)?)%\s*(?:,\s*([\d.]+%?)\s*)?\)$/i, vt = /^hsla?\(\s*(-?\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, Fe = (t) => {
|
|
299
|
+
const e = t.trim();
|
|
300
|
+
return kt.test(e) || vt.test(e);
|
|
301
|
+
}, Te = (t) => {
|
|
302
|
+
const e = t.trim(), r = kt.exec(e) ?? vt.exec(e);
|
|
303
|
+
if (!r) throw new F(`Invalid hsl color: '${t}'`);
|
|
304
|
+
return K(
|
|
305
|
+
parseFloat(r[1]),
|
|
306
|
+
h(parseFloat(r[2]) / 100, 0, 1),
|
|
307
|
+
h(parseFloat(r[3]) / 100, 0, 1),
|
|
308
|
+
C(r[4])
|
|
309
|
+
);
|
|
310
|
+
}, _e = (t) => {
|
|
311
|
+
const e = t.r / 255, r = t.g / 255, a = t.b / 255, n = Math.max(e, r, a), s = Math.min(e, r, a), o = n - s, l = (n + s) / 2;
|
|
312
|
+
if (o === 0)
|
|
313
|
+
return K(0, 0, l, t.alpha);
|
|
314
|
+
const i = o / (1 - Math.abs(2 * l - 1));
|
|
315
|
+
let c;
|
|
316
|
+
return n === e ? c = (r - a) / o % 6 : n === r ? c = (a - e) / o + 2 : c = (e - r) / o + 4, c *= 60, c < 0 && (c += 360), K(c, i, l, t.alpha);
|
|
317
|
+
}, Ae = (t) => {
|
|
318
|
+
const e = t.s, r = t.l, a = N(t.h, 360), n = (1 - Math.abs(2 * r - 1)) * e, s = n * (1 - Math.abs(a / 60 % 2 - 1)), o = r - n / 2;
|
|
319
|
+
let l, i, c;
|
|
320
|
+
return a < 60 ? (l = n, i = s, c = 0) : a < 120 ? (l = s, i = n, c = 0) : a < 180 ? (l = 0, i = n, c = s) : a < 240 ? (l = 0, i = s, c = n) : a < 300 ? (l = s, i = 0, c = n) : (l = n, i = 0, c = s), M(
|
|
321
|
+
Math.round((l + o) * 255),
|
|
322
|
+
Math.round((i + o) * 255),
|
|
323
|
+
Math.round((c + o) * 255),
|
|
324
|
+
t.alpha
|
|
325
|
+
);
|
|
326
|
+
}, Se = (t) => {
|
|
327
|
+
const e = H(t.h), r = H(t.s * 100), a = H(t.l * 100);
|
|
328
|
+
return t.alpha >= 1 ? `hsl(${e} ${r}% ${a}%)` : `hsl(${e} ${r}% ${a}% / ${t.alpha})`;
|
|
329
|
+
}, H = (t) => Math.round(t * 100) / 100, xt = /^hsva?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*([\d.]+%?)\s*)?\)$/i, It = /^hsva?\(\s*([\d.]+)\s+([\d.]+)%\s+([\d.]+)%\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, We = (t) => {
|
|
330
|
+
const e = t.trim();
|
|
331
|
+
return xt.test(e) || It.test(e);
|
|
332
|
+
}, Ce = (t) => {
|
|
333
|
+
const e = t.trim(), r = xt.exec(e) ?? It.exec(e);
|
|
334
|
+
if (!r) throw new F(`Invalid hsv color: '${t}'`);
|
|
335
|
+
return Ut(
|
|
336
|
+
N(parseFloat(r[1]), 360),
|
|
337
|
+
h(parseFloat(r[2]) / 100, 0, 1),
|
|
338
|
+
h(parseFloat(r[3]) / 100, 0, 1),
|
|
339
|
+
C(r[4])
|
|
340
|
+
);
|
|
341
|
+
}, Ne = (t) => {
|
|
342
|
+
const e = t.r / 255, r = t.g / 255, a = t.b / 255, n = Math.max(e, r, a), s = Math.min(e, r, a), o = n - s, l = n, i = n === 0 ? 0 : o / n;
|
|
343
|
+
let c = 0;
|
|
344
|
+
return o !== 0 && (n === e ? c = (r - a) / o % 6 : n === r ? c = (a - e) / o + 2 : c = (e - r) / o + 4, c *= 60, c < 0 && (c += 360)), Ut(c, i, l, t.alpha);
|
|
345
|
+
}, Be = (t) => {
|
|
346
|
+
const e = t.s, r = t.v, a = r * e, n = a * (1 - Math.abs(t.h / 60 % 2 - 1)), s = r - a;
|
|
347
|
+
let o = 0, l = 0, i = 0;
|
|
348
|
+
const c = t.h;
|
|
349
|
+
return c < 60 ? (o = a, l = n) : c < 120 ? (o = n, l = a) : c < 180 ? (l = a, i = n) : c < 240 ? (l = n, i = a) : c < 300 ? (o = n, i = a) : (o = a, i = n), M(
|
|
350
|
+
Math.round((o + s) * 255),
|
|
351
|
+
Math.round((l + s) * 255),
|
|
352
|
+
Math.round((i + s) * 255),
|
|
353
|
+
t.alpha
|
|
354
|
+
);
|
|
355
|
+
}, Pe = (t) => {
|
|
356
|
+
const e = t.h, r = Math.round(t.s * 1e4) / 100, a = Math.round(t.v * 1e4) / 100;
|
|
357
|
+
return t.alpha >= 1 ? `hsv(${e} ${r}% ${a}%)` : `hsv(${e} ${r}% ${a}% / ${t.alpha})`;
|
|
358
|
+
}, Ft = /^hwb\(\s*(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, Ee = (t) => Ft.test(t.trim()), Re = (t) => {
|
|
359
|
+
const e = t.trim(), r = Ft.exec(e);
|
|
360
|
+
if (!r) throw new F(`Invalid hwb color: '${t}'`);
|
|
361
|
+
return zt(
|
|
362
|
+
parseFloat(r[1]),
|
|
363
|
+
h(parseFloat(r[2]) / 100, 0, 1),
|
|
364
|
+
h(parseFloat(r[3]) / 100, 0, 1),
|
|
365
|
+
C(r[4])
|
|
366
|
+
);
|
|
367
|
+
}, De = (t) => {
|
|
368
|
+
const e = t.r / 255, r = t.g / 255, a = t.b / 255, n = Math.max(e, r, a), s = Math.min(e, r, a), o = n - s;
|
|
369
|
+
let l;
|
|
370
|
+
o === 0 ? l = 0 : n === e ? l = (r - a) / o * 60 : n === r ? l = ((a - e) / o + 2) * 60 : l = ((e - r) / o + 4) * 60, l < 0 && (l += 360);
|
|
371
|
+
const i = s, c = 1 - n;
|
|
372
|
+
return zt(l, i, c, t.alpha);
|
|
373
|
+
}, qe = (t) => {
|
|
374
|
+
let e = t.w, r = t.b;
|
|
375
|
+
if (e + r >= 1) {
|
|
376
|
+
const g = 1 / (e + r);
|
|
377
|
+
e *= g, r *= g;
|
|
378
|
+
}
|
|
379
|
+
const a = N(t.h, 360) / 60, n = Math.floor(a) % 6, s = a - Math.floor(a);
|
|
380
|
+
let o, l, i;
|
|
381
|
+
switch (n) {
|
|
382
|
+
case 0:
|
|
383
|
+
o = 1, l = s, i = 0;
|
|
384
|
+
break;
|
|
385
|
+
case 1:
|
|
386
|
+
o = 1 - s, l = 1, i = 0;
|
|
387
|
+
break;
|
|
388
|
+
case 2:
|
|
389
|
+
o = 0, l = 1, i = s;
|
|
390
|
+
break;
|
|
391
|
+
case 3:
|
|
392
|
+
o = 0, l = 1 - s, i = 1;
|
|
393
|
+
break;
|
|
394
|
+
case 4:
|
|
395
|
+
o = s, l = 0, i = 1;
|
|
396
|
+
break;
|
|
397
|
+
default:
|
|
398
|
+
o = 1, l = 0, i = 1 - s;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
const c = 1 - e - r, $ = h(Math.round((o * c + e) * 255), 0, 255), m = h(Math.round((l * c + e) * 255), 0, 255), k = h(Math.round((i * c + e) * 255), 0, 255);
|
|
402
|
+
return M($, m, k, t.alpha);
|
|
403
|
+
}, Oe = (t) => t.alpha >= 1 ? `hwb(${t.h} ${t.w * 100}% ${t.b * 100}%)` : `hwb(${t.h} ${t.w * 100}% ${t.b * 100}% / ${t.alpha})`, Tt = /^lab\(\s*([\d.]+%?)\s+([-\d.]+)\s+([-\d.]+)\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, _t = /^lch\(\s*([\d.]+%?)\s+([\d.]+)\s+([\d.]+)\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, Q = (t) => t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4), Z = (t) => t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055, Ue = (t, e, r) => [
|
|
404
|
+
0.4124564 * t + 0.3575761 * e + 0.1804375 * r,
|
|
405
|
+
0.2126729 * t + 0.7151522 * e + 0.072175 * r,
|
|
406
|
+
0.0193339 * t + 0.119192 * e + 0.9503041 * r
|
|
407
|
+
], ze = (t, e, r) => [
|
|
408
|
+
3.2404542 * t - 1.5371385 * e - 0.4985314 * r,
|
|
409
|
+
-0.969266 * t + 1.8760108 * e + 0.041556 * r,
|
|
410
|
+
0.0556434 * t - 0.2040259 * e + 1.0572252 * r
|
|
411
|
+
], At = 0.95047, St = 1, Wt = 1.08883, nt = 6 / 29, Ve = nt ** 3, Ct = 3 * nt ** 2, Le = (t, e, r) => {
|
|
412
|
+
const a = (l) => l > Ve ? Math.cbrt(l) : l / Ct + 0.13793103448275862, n = a(t / At), s = a(e / St), o = a(r / Wt);
|
|
413
|
+
return [116 * s - 16, 500 * (n - s), 200 * (s - o)];
|
|
414
|
+
}, je = (t, e, r) => {
|
|
415
|
+
const a = (l) => l > nt ? l ** 3 : Ct * (l - 0.13793103448275862), n = (t + 16) / 116, s = e / 500 + n, o = n - r / 200;
|
|
416
|
+
return [At * a(s), St * a(n), Wt * a(o)];
|
|
417
|
+
}, Xe = (t, e, r) => {
|
|
418
|
+
const a = Math.sqrt(e * e + r * r);
|
|
419
|
+
let n = Math.atan2(r, e) * 180 / Math.PI;
|
|
420
|
+
return n < 0 && (n += 360), [t, a, n];
|
|
421
|
+
}, Ye = (t, e, r) => {
|
|
422
|
+
const a = r * Math.PI / 180;
|
|
423
|
+
return [t, e * Math.cos(a), e * Math.sin(a)];
|
|
424
|
+
}, Nt = (t) => (t.endsWith("%"), h(parseFloat(t), 0, 100) / 100), Ge = (t) => Tt.test(t.trim()), He = (t) => {
|
|
425
|
+
const e = Tt.exec(t.trim());
|
|
426
|
+
if (!e) throw new F(`Invalid lab color: '${t}'`);
|
|
427
|
+
return st(
|
|
428
|
+
Nt(e[1]),
|
|
429
|
+
parseFloat(e[2]),
|
|
430
|
+
parseFloat(e[3]),
|
|
431
|
+
C(e[4])
|
|
432
|
+
);
|
|
433
|
+
}, Qe = (t) => _t.test(t.trim()), Ze = (t) => {
|
|
434
|
+
const e = _t.exec(t.trim());
|
|
435
|
+
if (!e) throw new F(`Invalid lch color: '${t}'`);
|
|
436
|
+
return Vt(
|
|
437
|
+
Nt(e[1]),
|
|
438
|
+
Math.max(0, parseFloat(e[2])),
|
|
439
|
+
N(parseFloat(e[3]), 360),
|
|
440
|
+
C(e[4])
|
|
441
|
+
);
|
|
442
|
+
}, Bt = (t) => {
|
|
443
|
+
const e = Q(t.r / 255), r = Q(t.g / 255), a = Q(t.b / 255), [n, s, o] = Ue(e, r, a), [l, i, c] = Le(n, s, o);
|
|
444
|
+
return st(l / 100, i, c, t.alpha);
|
|
445
|
+
}, Pt = (t) => {
|
|
446
|
+
const [e, r, a] = je(t.l * 100, t.a, t.b), [n, s, o] = ze(e, r, a);
|
|
447
|
+
return M(
|
|
448
|
+
Math.round(h(Z(n), 0, 1) * 255),
|
|
449
|
+
Math.round(h(Z(s), 0, 1) * 255),
|
|
450
|
+
Math.round(h(Z(o), 0, 1) * 255),
|
|
451
|
+
t.alpha
|
|
452
|
+
);
|
|
453
|
+
}, Je = (t) => {
|
|
454
|
+
const e = Bt(t), [r, a, n] = Xe(e.l * 100, e.a, e.b);
|
|
455
|
+
return Vt(r / 100, a, n, t.alpha);
|
|
456
|
+
}, Ke = (t) => {
|
|
457
|
+
const [e, r, a] = Ye(t.l * 100, t.c, t.h);
|
|
458
|
+
return Pt(st(e / 100, r, a, t.alpha));
|
|
459
|
+
}, tr = (t) => {
|
|
460
|
+
const e = x(t.l * 100, 2), r = x(t.a, 4), a = x(t.b, 4);
|
|
461
|
+
return t.alpha >= 1 ? `lab(${e} ${r} ${a})` : `lab(${e} ${r} ${a} / ${t.alpha})`;
|
|
462
|
+
}, er = (t) => {
|
|
463
|
+
const e = x(t.l * 100, 2), r = x(t.c, 4), a = x(t.h, 4);
|
|
464
|
+
return t.alpha >= 1 ? `lch(${e} ${r} ${a})` : `lch(${e} ${r} ${a} / ${t.alpha})`;
|
|
465
|
+
}, Et = /^oklab\(\s*([\d.]+%?)\s+([-\d.]+)\s+([-\d.]+)\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, Rt = /^oklch\(\s*([\d.]+%?)\s+([\d.]+)\s+([\d.]+)\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i, R = (t) => t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4), J = (t) => t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055, Dt = (t, e, r) => {
|
|
466
|
+
const a = 0.4122214708 * t + 0.5363325363 * e + 0.0514459929 * r, n = 0.2119034982 * t + 0.6806995451 * e + 0.1073969566 * r, s = 0.0883024619 * t + 0.2817188376 * e + 0.6299787005 * r, o = Math.cbrt(a), l = Math.cbrt(n), i = Math.cbrt(s), c = 0.2104542553 * o + 0.793617785 * l - 0.0040720468 * i, $ = 1.9779984951 * o - 2.428592205 * l + 0.4505937099 * i, m = 0.0259040371 * o + 0.7827717662 * l - 0.808675766 * i;
|
|
467
|
+
return [c, $, m];
|
|
468
|
+
}, rr = (t, e, r) => {
|
|
469
|
+
const a = t + 0.3963377774 * e + 0.2158037573 * r, n = t - 0.1055613458 * e - 0.0638541728 * r, s = t - 0.0894841775 * e - 1.291485548 * r, o = a * a * a, l = n * n * n, i = s * s * s, c = 4.0767416621 * o - 3.3077115913 * l + 0.2309699292 * i, $ = -1.2684380046 * o + 2.6097574011 * l - 0.3413193965 * i, m = -0.0041960863 * o - 0.7034186147 * l + 1.707614701 * i;
|
|
470
|
+
return [c, $, m];
|
|
471
|
+
}, ar = (t, e, r) => {
|
|
472
|
+
const a = Math.sqrt(e * e + r * r);
|
|
473
|
+
let n = Math.atan2(r, e) * 180 / Math.PI;
|
|
474
|
+
return n < 0 && (n += 360), [t, a, n];
|
|
475
|
+
}, nr = (t, e, r) => {
|
|
476
|
+
const a = r * Math.PI / 180, n = e * Math.cos(a), s = e * Math.sin(a);
|
|
477
|
+
return [t, n, s];
|
|
478
|
+
}, qt = (t) => t.endsWith("%") ? parseFloat(t) / 100 : parseFloat(t), sr = (t) => Et.test(t.trim()), or = (t) => {
|
|
479
|
+
const e = Et.exec(t.trim());
|
|
480
|
+
if (!e) throw new F(`Invalid oklab color: '${t}'`);
|
|
481
|
+
return ot(
|
|
482
|
+
qt(e[1]),
|
|
483
|
+
parseFloat(e[2]),
|
|
484
|
+
parseFloat(e[3]),
|
|
485
|
+
C(e[4])
|
|
486
|
+
);
|
|
487
|
+
}, lr = (t) => Rt.test(t.trim()), ir = (t) => {
|
|
488
|
+
const e = Rt.exec(t.trim());
|
|
489
|
+
if (!e) throw new F(`Invalid oklch color: '${t}'`);
|
|
490
|
+
return Lt(
|
|
491
|
+
qt(e[1]),
|
|
492
|
+
parseFloat(e[2]),
|
|
493
|
+
parseFloat(e[3]),
|
|
494
|
+
C(e[4])
|
|
495
|
+
);
|
|
496
|
+
}, cr = (t) => {
|
|
497
|
+
const e = R(t.r / 255), r = R(t.g / 255), a = R(t.b / 255), [n, s, o] = Dt(e, r, a);
|
|
498
|
+
return ot(n, s, o, t.alpha);
|
|
499
|
+
}, Ot = (t) => {
|
|
500
|
+
const [e, r, a] = rr(t.l, t.a, t.b);
|
|
501
|
+
return M(
|
|
502
|
+
Math.round(h(J(e), 0, 1) * 255),
|
|
503
|
+
Math.round(h(J(r), 0, 1) * 255),
|
|
504
|
+
Math.round(h(J(a), 0, 1) * 255),
|
|
505
|
+
t.alpha
|
|
506
|
+
);
|
|
507
|
+
}, ur = (t) => {
|
|
508
|
+
const e = R(t.r / 255), r = R(t.g / 255), a = R(t.b / 255), [n, s, o] = Dt(e, r, a), [l, i, c] = ar(n, s, o);
|
|
509
|
+
return Lt(l, i, c, t.alpha);
|
|
510
|
+
}, hr = (t) => {
|
|
511
|
+
const [e, r, a] = nr(t.l, t.c, t.h);
|
|
512
|
+
return Ot(ot(e, r, a, t.alpha));
|
|
513
|
+
}, pr = (t) => {
|
|
514
|
+
const e = x(t.l, 5), r = x(t.a, 5), a = x(t.b, 5);
|
|
515
|
+
return t.alpha >= 1 ? `oklab(${e} ${r} ${a})` : `oklab(${e} ${r} ${a} / ${t.alpha})`;
|
|
516
|
+
}, dr = (t) => {
|
|
517
|
+
const e = x(t.l, 5), r = x(t.c, 5), a = x(t.h, 2);
|
|
518
|
+
return t.alpha >= 1 ? `oklch(${e} ${r} ${a})` : `oklch(${e} ${r} ${a} / ${t.alpha})`;
|
|
519
|
+
}, gr = (t, e, r, a = 1) => ({
|
|
520
|
+
space: "rgb",
|
|
521
|
+
r: h(t, 0, 1),
|
|
522
|
+
g: h(e, 0, 1),
|
|
523
|
+
b: h(r, 0, 1),
|
|
524
|
+
alpha: h(a, 0, 1)
|
|
525
|
+
}), M = (t, e, r, a = 1) => ({
|
|
526
|
+
space: "rgb8",
|
|
527
|
+
r: E(t, 0, 255),
|
|
528
|
+
g: E(e, 0, 255),
|
|
529
|
+
b: E(r, 0, 255),
|
|
530
|
+
alpha: h(a, 0, 1)
|
|
531
|
+
}), K = (t, e, r, a = 1) => ({
|
|
532
|
+
space: "hsl",
|
|
533
|
+
h: N(t, 360),
|
|
534
|
+
s: h(e, 0, 1),
|
|
535
|
+
l: h(r, 0, 1),
|
|
536
|
+
alpha: h(a, 0, 1)
|
|
537
|
+
}), Ut = (t, e, r, a = 1) => ({
|
|
538
|
+
space: "hsv",
|
|
539
|
+
h: N(t, 360),
|
|
540
|
+
s: h(e, 0, 1),
|
|
541
|
+
v: h(r, 0, 1),
|
|
542
|
+
alpha: h(a, 0, 1)
|
|
543
|
+
}), zt = (t, e, r, a = 1) => ({
|
|
544
|
+
space: "hwb",
|
|
545
|
+
h: N(t, 360),
|
|
546
|
+
w: h(e, 0, 1),
|
|
547
|
+
b: h(r, 0, 1),
|
|
548
|
+
alpha: h(a, 0, 1)
|
|
549
|
+
}), st = (t, e, r, a = 1) => ({
|
|
550
|
+
space: "lab",
|
|
551
|
+
l: h(t, 0, 1),
|
|
552
|
+
a: e,
|
|
553
|
+
b: r,
|
|
554
|
+
alpha: h(a, 0, 1)
|
|
555
|
+
}), Vt = (t, e, r, a = 1) => ({
|
|
556
|
+
space: "lch",
|
|
557
|
+
l: h(t, 0, 1),
|
|
558
|
+
c: Math.max(0, e),
|
|
559
|
+
h: N(r, 360),
|
|
560
|
+
alpha: h(a, 0, 1)
|
|
561
|
+
}), ot = (t, e, r, a = 1) => ({
|
|
562
|
+
space: "oklab",
|
|
563
|
+
l: h(t, 0, 1),
|
|
564
|
+
a: e,
|
|
565
|
+
b: r,
|
|
566
|
+
alpha: h(a, 0, 1)
|
|
567
|
+
}), Lt = (t, e, r, a = 1) => ({
|
|
568
|
+
space: "oklch",
|
|
569
|
+
l: h(t, 0, 1),
|
|
570
|
+
c: Math.max(0, e),
|
|
571
|
+
h: N(r, 360),
|
|
572
|
+
alpha: h(a, 0, 1)
|
|
573
|
+
}), C = (t) => t == null ? 1 : t.endsWith("%") ? h(parseFloat(t) / 100, 0, 1) : h(parseFloat(t), 0, 1), br = (t) => M(
|
|
574
|
+
Math.round(t.r * 255),
|
|
575
|
+
Math.round(t.g * 255),
|
|
576
|
+
Math.round(t.b * 255),
|
|
577
|
+
t.alpha
|
|
578
|
+
), mr = (t) => gr(t.r / 255, t.g / 255, t.b / 255, t.alpha), jt = (t) => {
|
|
579
|
+
const e = t.trim().toLowerCase();
|
|
580
|
+
if (e.startsWith("#") || e.startsWith("rgba") || e.startsWith("rgb(")) return "rgb8";
|
|
581
|
+
if (e.startsWith("hsla") || e.startsWith("hsl(")) return "hsl";
|
|
582
|
+
if (e.startsWith("hsva") || e.startsWith("hsv(")) return "hsv";
|
|
583
|
+
if (e.startsWith("hwb(")) return "hwb";
|
|
584
|
+
if (e.startsWith("oklab(")) return "oklab";
|
|
585
|
+
if (e.startsWith("oklch(")) return "oklch";
|
|
586
|
+
if (e.startsWith("lab(")) return "lab";
|
|
587
|
+
if (e.startsWith("lch(")) return "lch";
|
|
588
|
+
if (e in at) return "rgb8";
|
|
589
|
+
}, Lr = (t) => {
|
|
590
|
+
const e = jt(t);
|
|
591
|
+
if (e == null) return !1;
|
|
592
|
+
switch (e) {
|
|
593
|
+
case "rgb8":
|
|
594
|
+
return we(t) || ye(t) || ke(t);
|
|
595
|
+
case "hsl":
|
|
596
|
+
return Fe(t);
|
|
597
|
+
case "hsv":
|
|
598
|
+
return We(t);
|
|
599
|
+
case "hwb":
|
|
600
|
+
return Ee(t);
|
|
601
|
+
case "lab":
|
|
602
|
+
return Ge(t);
|
|
603
|
+
case "lch":
|
|
604
|
+
return Qe(t);
|
|
605
|
+
case "oklab":
|
|
606
|
+
return sr(t);
|
|
607
|
+
case "oklch":
|
|
608
|
+
return lr(t);
|
|
609
|
+
default:
|
|
610
|
+
return !1;
|
|
611
|
+
}
|
|
612
|
+
}, Xt = (t) => {
|
|
613
|
+
switch (jt(t)) {
|
|
614
|
+
case "rgb8": {
|
|
615
|
+
const e = t.trim();
|
|
616
|
+
return e.startsWith("#") ? $e(t) : /^rgba?\(/i.test(e) ? Me(t) : ve(t);
|
|
617
|
+
}
|
|
618
|
+
case "hsl":
|
|
619
|
+
return Te(t);
|
|
620
|
+
case "hsv":
|
|
621
|
+
return Ce(t);
|
|
622
|
+
case "hwb":
|
|
623
|
+
return Re(t);
|
|
624
|
+
case "lab":
|
|
625
|
+
return He(t);
|
|
626
|
+
case "lch":
|
|
627
|
+
return Ze(t);
|
|
628
|
+
case "oklab":
|
|
629
|
+
return or(t);
|
|
630
|
+
case "oklch":
|
|
631
|
+
return ir(t);
|
|
632
|
+
default:
|
|
633
|
+
throw new F(`Unrecognized color format: '${t}'`);
|
|
634
|
+
}
|
|
635
|
+
}, fr = (t) => {
|
|
636
|
+
switch (t.space) {
|
|
637
|
+
case "rgb":
|
|
638
|
+
return br(t);
|
|
639
|
+
case "rgb8":
|
|
640
|
+
return t;
|
|
641
|
+
case "hsl":
|
|
642
|
+
return Ae(t);
|
|
643
|
+
case "hsv":
|
|
644
|
+
return Be(t);
|
|
645
|
+
case "hwb":
|
|
646
|
+
return qe(t);
|
|
647
|
+
case "lab":
|
|
648
|
+
return Pt(t);
|
|
649
|
+
case "lch":
|
|
650
|
+
return Ke(t);
|
|
651
|
+
case "oklab":
|
|
652
|
+
return Ot(t);
|
|
653
|
+
case "oklch":
|
|
654
|
+
return hr(t);
|
|
655
|
+
}
|
|
656
|
+
}, wr = (t, e) => {
|
|
657
|
+
switch (e) {
|
|
658
|
+
case "rgb":
|
|
659
|
+
return mr(t);
|
|
660
|
+
case "rgb8":
|
|
661
|
+
return t;
|
|
662
|
+
case "hsl":
|
|
663
|
+
return _e(t);
|
|
664
|
+
case "hsv":
|
|
665
|
+
return Ne(t);
|
|
666
|
+
case "hwb":
|
|
667
|
+
return De(t);
|
|
668
|
+
case "lab":
|
|
669
|
+
return Bt(t);
|
|
670
|
+
case "lch":
|
|
671
|
+
return Je(t);
|
|
672
|
+
case "oklab":
|
|
673
|
+
return cr(t);
|
|
674
|
+
case "oklch":
|
|
675
|
+
return ur(t);
|
|
676
|
+
}
|
|
677
|
+
}, lt = (t, e) => t.space === e ? t : wr(fr(t), e), Yt = (t) => {
|
|
678
|
+
switch (t.space) {
|
|
679
|
+
case "rgb":
|
|
680
|
+
return Ie(t);
|
|
681
|
+
case "rgb8":
|
|
682
|
+
return xe(t);
|
|
683
|
+
case "hsl":
|
|
684
|
+
return Se(t);
|
|
685
|
+
case "hsv":
|
|
686
|
+
return Pe(t);
|
|
687
|
+
case "hwb":
|
|
688
|
+
return Oe(t);
|
|
689
|
+
case "lab":
|
|
690
|
+
return tr(t);
|
|
691
|
+
case "lch":
|
|
692
|
+
return er(t);
|
|
693
|
+
case "oklab":
|
|
694
|
+
return pr(t);
|
|
695
|
+
case "oklch":
|
|
696
|
+
return dr(t);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
function $r(t) {
|
|
700
|
+
let e = t + 1831565813;
|
|
701
|
+
return function() {
|
|
702
|
+
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function yr(t) {
|
|
706
|
+
try {
|
|
707
|
+
const e = lt(Xt(t), "rgb8");
|
|
708
|
+
return [e.r, e.g, e.b, e.alpha];
|
|
709
|
+
} catch {
|
|
710
|
+
return [0, 0, 0, 1];
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
function pt(t, e, r) {
|
|
714
|
+
return Yt(M(t, e, r));
|
|
715
|
+
}
|
|
716
|
+
function dt(t) {
|
|
717
|
+
try {
|
|
718
|
+
const e = lt(Xt(t), "rgb8");
|
|
719
|
+
return { r: e.r, g: e.g, b: e.b };
|
|
720
|
+
} catch {
|
|
721
|
+
return null;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function Mr(t, e, r, a) {
|
|
725
|
+
return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(r)}, ${Math.max(0, Math.min(1, Math.round(a * 100) / 100))})`;
|
|
726
|
+
}
|
|
727
|
+
function q(t, e, r, a, n) {
|
|
728
|
+
const s = M(Math.round(t), Math.round(e), Math.round(r), a), l = lt(s, n === "hex" ? "rgb8" : n === "rgba" ? "rgb" : n === "hsla" ? "hsl" : n === "rgb" ? "rgb" : n);
|
|
729
|
+
return Yt(l);
|
|
730
|
+
}
|
|
731
|
+
function O(t, e) {
|
|
732
|
+
return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
|
|
733
|
+
}
|
|
734
|
+
function kr(t, e) {
|
|
735
|
+
const [r, a, n] = t, s = r << 16 ^ a << 8 ^ n, o = $r(s), l = 6 + Math.floor(o() * 5), i = 0.18 + o() * 0.06, c = [];
|
|
736
|
+
for (let g = 0; g < l; g++) {
|
|
737
|
+
const b = g / l * Math.PI * 2, T = e * (1 + (o() * 2 - 1) * i), B = Math.cos(b) * T, _ = Math.sin(b) * T;
|
|
738
|
+
c.push({ x: B, y: _ });
|
|
739
|
+
}
|
|
740
|
+
const $ = (c[0].x + c[l - 1].x) / 2, m = (c[0].y + c[l - 1].y) / 2;
|
|
741
|
+
let k = `M ${$.toFixed(3)} ${m.toFixed(3)}`;
|
|
742
|
+
for (let g = 0; g < l; g++) {
|
|
743
|
+
const b = c[g], T = c[(g + 1) % l], B = (b.x + T.x) / 2, _ = (b.y + T.y) / 2;
|
|
744
|
+
k += ` Q ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${B.toFixed(3)} ${_.toFixed(3)}`;
|
|
745
|
+
}
|
|
746
|
+
return k += " Z", k;
|
|
747
|
+
}
|
|
748
|
+
const jr = (t) => {
|
|
749
|
+
const {
|
|
750
|
+
value: e,
|
|
751
|
+
onBlur: r,
|
|
752
|
+
onChange: a,
|
|
753
|
+
onInput: n,
|
|
754
|
+
displayValue: s,
|
|
755
|
+
swatchSize: o,
|
|
756
|
+
withAlpha: l
|
|
757
|
+
} = t, i = {
|
|
758
|
+
xs: 20,
|
|
759
|
+
sm: 26,
|
|
760
|
+
md: 32,
|
|
761
|
+
lg: 40,
|
|
762
|
+
xl: 52
|
|
763
|
+
}, c = o != null ? p.map(o, (u) => Number(u)) : p.map(
|
|
764
|
+
t.size ?? "md",
|
|
765
|
+
(u) => i[u] ?? 32
|
|
766
|
+
), $ = p.map(e, (u) => yr(u ?? "#000000")), m = p.map(
|
|
767
|
+
$,
|
|
768
|
+
([u, f, w]) => [u, f, w]
|
|
769
|
+
), k = p.map($, ([, , , u]) => u), g = gt(p.get(k) ?? 1), b = p.map(l ?? !1, (u) => u), T = p.map(
|
|
770
|
+
t.colorTextFormat ?? "rgb",
|
|
771
|
+
(u) => u
|
|
772
|
+
), B = V(
|
|
773
|
+
m,
|
|
774
|
+
g,
|
|
775
|
+
T,
|
|
776
|
+
b
|
|
777
|
+
)(
|
|
778
|
+
([u, f, w], v, I, S) => q(u, f, w, v ?? 1, O(I, S))
|
|
779
|
+
), _ = p.map(
|
|
780
|
+
t.colorTextFormat ?? "hex",
|
|
781
|
+
(u) => u
|
|
782
|
+
), j = p.map(c, (u) => `${-u / 2} ${-u / 2} ${u} ${u}`), Gt = V(
|
|
783
|
+
m,
|
|
784
|
+
c
|
|
785
|
+
)((u, f) => kr(u, f / 2)), Ht = V(
|
|
786
|
+
m,
|
|
787
|
+
g,
|
|
788
|
+
b
|
|
789
|
+
)(
|
|
790
|
+
([u, f, w], v, I) => I || v < 1 ? Mr(u, f, w, v) : pt(u, f, w)
|
|
791
|
+
), Qt = A.div(
|
|
792
|
+
d.class("bc-color-swatch-input__control"),
|
|
793
|
+
d.class(
|
|
794
|
+
p.map(
|
|
795
|
+
b,
|
|
796
|
+
(u) => u ? "bc-color-swatch-input__control--alpha" : ""
|
|
797
|
+
)
|
|
798
|
+
),
|
|
799
|
+
d.style(V(c)((u) => `width:${u + 2}px;height:${u + 2}px`)),
|
|
800
|
+
// The SVG blob preview
|
|
801
|
+
it.svg(
|
|
802
|
+
d.class("bc-color-swatch-input__svg"),
|
|
803
|
+
Y.viewBox(j),
|
|
804
|
+
it.path(Y.d(Gt), Y.fill(Ht))
|
|
805
|
+
),
|
|
806
|
+
// Invisible native input overlays the blob for picker and accessibility
|
|
807
|
+
A.input(
|
|
808
|
+
d.type("color"),
|
|
809
|
+
rt(t),
|
|
810
|
+
// Native color input needs hex without alpha
|
|
811
|
+
d.value(p.map(m, ([u, f, w]) => pt(u, f, w))),
|
|
812
|
+
d.class(
|
|
813
|
+
"bc-input bc-color-swatch-input bc-color-swatch-input__native"
|
|
814
|
+
),
|
|
815
|
+
r != null ? y.blur(r) : W,
|
|
816
|
+
a != null ? y.change((u) => {
|
|
817
|
+
const f = u.target.value;
|
|
818
|
+
if (!a) return;
|
|
819
|
+
const { r: w, g: v, b: I } = dt(f) ?? { r: 0, g: 0, b: 0 }, S = p.get(g) ?? 1, P = O(
|
|
820
|
+
p.get(_),
|
|
821
|
+
p.get(b)
|
|
822
|
+
), X = q(w, v, I, S, P);
|
|
823
|
+
a(X);
|
|
824
|
+
}) : W,
|
|
825
|
+
n != null ? y.input((u) => {
|
|
826
|
+
const f = u.target.value;
|
|
827
|
+
if (!n) return;
|
|
828
|
+
const { r: w, g: v, b: I } = dt(f) ?? { r: 0, g: 0, b: 0 }, S = p.get(g) ?? 1, P = O(
|
|
829
|
+
p.get(_),
|
|
830
|
+
p.get(b)
|
|
831
|
+
), X = q(w, v, I, S, P);
|
|
832
|
+
n(X);
|
|
833
|
+
}) : W
|
|
834
|
+
)
|
|
835
|
+
), Zt = U(
|
|
836
|
+
b,
|
|
837
|
+
() => A.input(
|
|
838
|
+
d.type("range"),
|
|
839
|
+
d.class("bc-color-swatch-input__alpha"),
|
|
840
|
+
d.min(0),
|
|
841
|
+
d.max(1),
|
|
842
|
+
d.step(0.01),
|
|
843
|
+
d.value(p.map(g, (u) => String(u ?? 1))),
|
|
844
|
+
d.disabled(t.disabled),
|
|
845
|
+
y.input((u) => {
|
|
846
|
+
const f = parseFloat(u.target.value);
|
|
847
|
+
g.set(f);
|
|
848
|
+
const [w, v, I] = p.get(m), S = O(
|
|
849
|
+
p.get(_),
|
|
850
|
+
p.get(b)
|
|
851
|
+
), P = q(w, v, I, f, S);
|
|
852
|
+
n?.(P);
|
|
853
|
+
}),
|
|
854
|
+
y.change((u) => {
|
|
855
|
+
const f = parseFloat(u.target.value);
|
|
856
|
+
g.set(f);
|
|
857
|
+
const [w, v, I] = p.get(m), S = O(
|
|
858
|
+
p.get(_),
|
|
859
|
+
p.get(b)
|
|
860
|
+
), P = q(w, v, I, f, S);
|
|
861
|
+
a?.(P);
|
|
862
|
+
})
|
|
863
|
+
)
|
|
864
|
+
), {
|
|
865
|
+
swatchSize: Tr,
|
|
866
|
+
displayValue: _r,
|
|
867
|
+
withAlpha: Ar,
|
|
868
|
+
colorTextFormat: Sr,
|
|
869
|
+
...Jt
|
|
870
|
+
} = t;
|
|
871
|
+
return et({
|
|
872
|
+
baseContainer: !0,
|
|
873
|
+
...Jt,
|
|
874
|
+
// ensure our control does not try to grow
|
|
875
|
+
growInput: !1,
|
|
876
|
+
input: Qt,
|
|
877
|
+
// If caller provided an `after`, append RGB before it
|
|
878
|
+
after: z(
|
|
879
|
+
U(
|
|
880
|
+
s ?? !1,
|
|
881
|
+
() => A.span(d.class("bc-color-swatch-input__rgb"), B)
|
|
882
|
+
),
|
|
883
|
+
Zt,
|
|
884
|
+
t.after
|
|
885
|
+
)
|
|
886
|
+
});
|
|
887
|
+
}, vr = (t) => typeof t == "string" && t.trim() === "" ? null : t, xr = (t) => t ?? "";
|
|
888
|
+
function D(t) {
|
|
889
|
+
return (e) => {
|
|
890
|
+
const { after: r, disabled: a } = e, n = mt(e, xr, vr), s = L(
|
|
891
|
+
e.value,
|
|
892
|
+
a,
|
|
893
|
+
e.onChange ?? e.onInput
|
|
894
|
+
);
|
|
895
|
+
return t({
|
|
896
|
+
...n,
|
|
897
|
+
after: r != null ? z(s, r) : s
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
const Xr = ({
|
|
902
|
+
startEditing: t,
|
|
903
|
+
value: e,
|
|
904
|
+
onChange: r,
|
|
905
|
+
placeholder: a,
|
|
906
|
+
disabled: n
|
|
907
|
+
}) => {
|
|
908
|
+
const s = p.deriveProp(t ?? !1), o = gt(!1), l = p.map(n ?? !1, (i) => i);
|
|
909
|
+
return A.div(
|
|
910
|
+
d.class("bc-editable-text"),
|
|
911
|
+
d.class(
|
|
912
|
+
p.map(
|
|
913
|
+
l,
|
|
914
|
+
(i) => i ? "bc-editable-text--disabled" : ""
|
|
915
|
+
)
|
|
916
|
+
),
|
|
917
|
+
ct.disabled(l),
|
|
918
|
+
U(
|
|
919
|
+
s,
|
|
920
|
+
() => A.input(
|
|
921
|
+
d.placeholder(a),
|
|
922
|
+
d.value(e),
|
|
923
|
+
d.class("bc-editable-text__input"),
|
|
924
|
+
le(),
|
|
925
|
+
y.keydown((i) => {
|
|
926
|
+
i.key === "Enter" ? s.set(!1) : i.key === "Escape" && (o.set(!0), s.set(!1));
|
|
927
|
+
}),
|
|
928
|
+
y.blur(
|
|
929
|
+
tt((i) => {
|
|
930
|
+
if (s.set(!1), o.value) {
|
|
931
|
+
o.set(!1);
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
r(i);
|
|
935
|
+
})
|
|
936
|
+
)
|
|
937
|
+
),
|
|
938
|
+
() => A.span(
|
|
939
|
+
y.click(() => {
|
|
940
|
+
p.get(l) || s.set(!0);
|
|
941
|
+
}),
|
|
942
|
+
d.class("bc-editable-text__display"),
|
|
943
|
+
U(
|
|
944
|
+
p.map(e, (i) => i != null && i.trim() !== ""),
|
|
945
|
+
() => A.span(d.class("bc-editable-text__text"), e),
|
|
946
|
+
() => A.span(
|
|
947
|
+
d.class("bc-editable-text__placeholder"),
|
|
948
|
+
a
|
|
949
|
+
)
|
|
950
|
+
),
|
|
951
|
+
U(
|
|
952
|
+
p.map(l, (i) => !i),
|
|
953
|
+
() => A.button(
|
|
954
|
+
d.type("button"),
|
|
955
|
+
d.class("bc-editable-text__edit-button"),
|
|
956
|
+
Kt(se, (i) => ct.label(i.$.editLabel)),
|
|
957
|
+
y.click(() => s.set(!0)),
|
|
958
|
+
oe({ icon: "line-md/pencil", color: "neutral" })
|
|
959
|
+
)
|
|
960
|
+
)
|
|
961
|
+
)
|
|
962
|
+
)
|
|
963
|
+
);
|
|
964
|
+
}, Yr = (t) => {
|
|
965
|
+
const { value: e, onBlur: r, onChange: a, onInput: n, after: s, disabled: o } = t, l = L(e, o, a ?? n);
|
|
966
|
+
return et({
|
|
967
|
+
...t,
|
|
968
|
+
input: bt.date(
|
|
969
|
+
rt(t),
|
|
970
|
+
d.valueAsDate(e),
|
|
971
|
+
d.class("bc-input"),
|
|
972
|
+
r != null ? y.blur(tt(r)) : W,
|
|
973
|
+
a != null ? y.change(ut(a)) : W,
|
|
974
|
+
n != null ? y.input(ut(n)) : W
|
|
975
|
+
),
|
|
976
|
+
after: s != null ? z(l, s) : l
|
|
977
|
+
});
|
|
978
|
+
}, Ir = (t) => {
|
|
979
|
+
const e = t.getFullYear(), r = t.getMonth() + 1, a = t.getDate(), n = t.getHours(), s = t.getMinutes(), o = t.getSeconds();
|
|
980
|
+
return `${e}-${r.toString().padStart(2, "0")}-${a.toString().padStart(2, "0")}T${n.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
|
|
981
|
+
}, Gr = (t) => {
|
|
982
|
+
const { value: e, onBlur: r, onChange: a, onInput: n, after: s, disabled: o } = t, l = p.map(e, (c) => c != null ? Ir(c) : null), i = L(e, o, a ?? n);
|
|
983
|
+
return et({
|
|
984
|
+
...t,
|
|
985
|
+
input: bt["datetime-local"](
|
|
986
|
+
rt(t),
|
|
987
|
+
d.value(p.map(l, (c) => c ?? null)),
|
|
988
|
+
d.class("bc-input"),
|
|
989
|
+
r != null ? y.blur(tt(r)) : W,
|
|
990
|
+
a != null ? y.change(ht(a)) : W,
|
|
991
|
+
n != null ? y.input(ht(n)) : W
|
|
992
|
+
),
|
|
993
|
+
after: s != null ? z(i, s) : i
|
|
994
|
+
});
|
|
995
|
+
}, Hr = D(ce), Qr = D(ne), Zr = D(ue), Jr = D(
|
|
996
|
+
ie
|
|
997
|
+
), Kr = D(ee), ta = (t) => {
|
|
998
|
+
const { after: e, disabled: r } = t, a = mt(
|
|
999
|
+
t,
|
|
1000
|
+
(s) => s ?? 0,
|
|
1001
|
+
(s) => s
|
|
1002
|
+
), n = L(
|
|
1003
|
+
t.value,
|
|
1004
|
+
r,
|
|
1005
|
+
t.onChange ?? t.onInput
|
|
1006
|
+
);
|
|
1007
|
+
return he({
|
|
1008
|
+
...a,
|
|
1009
|
+
after: e != null ? z(n, e) : n
|
|
1010
|
+
});
|
|
1011
|
+
}, ea = D(re);
|
|
1012
|
+
class Fr {
|
|
1013
|
+
widgets = /* @__PURE__ */ new Map();
|
|
1014
|
+
typeMapping = /* @__PURE__ */ new Map();
|
|
1015
|
+
// JSON Schema type -> widget names
|
|
1016
|
+
/**
|
|
1017
|
+
* Register a custom widget
|
|
1018
|
+
*/
|
|
1019
|
+
register(e, r) {
|
|
1020
|
+
if (this.widgets.set(e, r), r.supportedTypes)
|
|
1021
|
+
for (const a of r.supportedTypes)
|
|
1022
|
+
this.typeMapping.has(a) || this.typeMapping.set(a, []), this.typeMapping.get(a).push(e), this.typeMapping.get(a).sort((n, s) => {
|
|
1023
|
+
const o = this.widgets.get(n)?.priority || 0;
|
|
1024
|
+
return (this.widgets.get(s)?.priority || 0) - o;
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Unregister a widget
|
|
1029
|
+
*/
|
|
1030
|
+
unregister(e) {
|
|
1031
|
+
const r = this.widgets.get(e);
|
|
1032
|
+
if (r && (this.widgets.delete(e), r.supportedTypes))
|
|
1033
|
+
for (const a of r.supportedTypes) {
|
|
1034
|
+
const n = this.typeMapping.get(a);
|
|
1035
|
+
if (n) {
|
|
1036
|
+
const s = n.indexOf(e);
|
|
1037
|
+
s >= 0 && n.splice(s, 1), n.length === 0 && this.typeMapping.delete(a);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Get a registered widget
|
|
1043
|
+
*/
|
|
1044
|
+
get(e) {
|
|
1045
|
+
return this.widgets.get(e);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Get all registered widgets
|
|
1049
|
+
*/
|
|
1050
|
+
getAll() {
|
|
1051
|
+
return new Map(this.widgets);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Get widgets that support a specific JSON Schema type
|
|
1055
|
+
*/
|
|
1056
|
+
getForType(e) {
|
|
1057
|
+
return (this.typeMapping.get(e) || []).map((a) => this.widgets.get(a)).filter(Boolean);
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Find the best widget for a schema context
|
|
1061
|
+
*/
|
|
1062
|
+
findBestWidget(e) {
|
|
1063
|
+
const r = pe(e.definition, e.name);
|
|
1064
|
+
if (r?.widget) {
|
|
1065
|
+
const n = this.widgets.get(r.widget);
|
|
1066
|
+
if (n)
|
|
1067
|
+
return { name: r.widget, registration: n, resolved: r };
|
|
1068
|
+
}
|
|
1069
|
+
const a = [];
|
|
1070
|
+
for (const [n, s] of this.widgets.entries())
|
|
1071
|
+
if (s.matcher)
|
|
1072
|
+
try {
|
|
1073
|
+
s.matcher(e) && a.push({
|
|
1074
|
+
name: n,
|
|
1075
|
+
registration: s,
|
|
1076
|
+
priority: s.priority ?? 0
|
|
1077
|
+
});
|
|
1078
|
+
} catch (o) {
|
|
1079
|
+
console.warn(`Error in matcher for widget "${n}":`, o);
|
|
1080
|
+
}
|
|
1081
|
+
if (a.length > 0) {
|
|
1082
|
+
a.sort((s, o) => o.priority - s.priority);
|
|
1083
|
+
const n = a[0];
|
|
1084
|
+
return {
|
|
1085
|
+
name: n.name,
|
|
1086
|
+
registration: n.registration,
|
|
1087
|
+
resolved: { widget: n.name, source: "heuristics" }
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
if (typeof e.definition == "object" && e.definition.type) {
|
|
1091
|
+
const n = Array.isArray(e.definition.type) ? e.definition.type[0] : e.definition.type, s = this.getForType(n);
|
|
1092
|
+
if (s.length > 0) {
|
|
1093
|
+
const o = this.typeMapping.get(n)[0];
|
|
1094
|
+
return {
|
|
1095
|
+
name: o,
|
|
1096
|
+
registration: s[0],
|
|
1097
|
+
resolved: { widget: o, source: "type-fallback" }
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
return null;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
const ra = new Fr();
|
|
1105
|
+
function aa(t, e, r) {
|
|
1106
|
+
return {
|
|
1107
|
+
factory: e,
|
|
1108
|
+
matcher: (a) => {
|
|
1109
|
+
const s = a.definition["x:ui"];
|
|
1110
|
+
return s === t || typeof s == "object" && s !== null && s.widget === t;
|
|
1111
|
+
},
|
|
1112
|
+
displayName: r?.displayName ?? t,
|
|
1113
|
+
priority: r?.priority ?? 100,
|
|
1114
|
+
// High priority for explicit matches
|
|
1115
|
+
...r
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function na(t, e, r) {
|
|
1119
|
+
return {
|
|
1120
|
+
factory: e,
|
|
1121
|
+
matcher: (a) => a.definition.format === t,
|
|
1122
|
+
displayName: r?.displayName ?? `${t} widget`,
|
|
1123
|
+
priority: r?.priority ?? 75,
|
|
1124
|
+
...r
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
function sa(t, e, r, a) {
|
|
1128
|
+
return {
|
|
1129
|
+
factory: r,
|
|
1130
|
+
matcher: (n) => {
|
|
1131
|
+
const s = n.definition;
|
|
1132
|
+
return s.type === t && s.format === e;
|
|
1133
|
+
},
|
|
1134
|
+
displayName: a?.displayName ?? `${t}:${e} widget`,
|
|
1135
|
+
priority: a?.priority ?? 80,
|
|
1136
|
+
...a
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function oa(t) {
|
|
1140
|
+
const e = t?.logPrefix ?? "WIDGET_DIAG", r = t?.filterFn ?? (() => !0);
|
|
1141
|
+
return {
|
|
1142
|
+
factory: () => null,
|
|
1143
|
+
displayName: "Diagnostic Widget (never matches)",
|
|
1144
|
+
priority: -1e3,
|
|
1145
|
+
// Very low priority, should never actually match
|
|
1146
|
+
matcher: (a) => {
|
|
1147
|
+
if (!r(a)) return !1;
|
|
1148
|
+
const n = a.definition, s = {
|
|
1149
|
+
name: a.name,
|
|
1150
|
+
path: a.path.map(String),
|
|
1151
|
+
type: n?.type,
|
|
1152
|
+
hasRegistry: a.widgetRegistry !== void 0,
|
|
1153
|
+
definition: n
|
|
1154
|
+
};
|
|
1155
|
+
return console.log(
|
|
1156
|
+
`[${e}] name="${s.name ?? "ROOT"}" path=[${s.path.join(", ")}] type="${s.type ?? "unknown"}" hasRegistry=${s.hasRegistry}`
|
|
1157
|
+
), t?.onProcess?.(s), !1;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
export {
|
|
1162
|
+
zr as B,
|
|
1163
|
+
jr as C,
|
|
1164
|
+
Xr as E,
|
|
1165
|
+
Ut as F,
|
|
1166
|
+
st as H,
|
|
1167
|
+
ot as I,
|
|
1168
|
+
Yt as L,
|
|
1169
|
+
Qr as N,
|
|
1170
|
+
Fr as W,
|
|
1171
|
+
Xt as _,
|
|
1172
|
+
Jr as a,
|
|
1173
|
+
Kr as b,
|
|
1174
|
+
ea as c,
|
|
1175
|
+
Zr as d,
|
|
1176
|
+
Gr as e,
|
|
1177
|
+
Yr as f,
|
|
1178
|
+
ra as g,
|
|
1179
|
+
Hr as h,
|
|
1180
|
+
ta as i,
|
|
1181
|
+
oa as j,
|
|
1182
|
+
na as k,
|
|
1183
|
+
sa as l,
|
|
1184
|
+
aa as m,
|
|
1185
|
+
K as n,
|
|
1186
|
+
Lt as o,
|
|
1187
|
+
Vt as p,
|
|
1188
|
+
M as q,
|
|
1189
|
+
zt as r,
|
|
1190
|
+
gr as s,
|
|
1191
|
+
vr as t,
|
|
1192
|
+
xr as u,
|
|
1193
|
+
Lr as v,
|
|
1194
|
+
jt as w,
|
|
1195
|
+
lt as x,
|
|
1196
|
+
fe as y,
|
|
1197
|
+
de as z
|
|
1198
|
+
};
|