@tempots/beatui 0.91.0 → 0.93.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/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/{auth-divider-VzrKnv2d.cjs → auth-divider-C3E16pml.cjs} +1 -1
- package/dist/{auth-divider-B4n8lGx5.js → auth-divider-Rt0WDKAe.js} +3 -3
- package/dist/beatui.css +271 -262
- package/dist/beatui.tailwind.css +271 -262
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +2 -2
- package/dist/deep-merge-Blrucd-E.cjs +1 -0
- package/dist/{deep-merge-BdRgguFO.js → deep-merge-CoLO4id0.js} +593 -587
- package/dist/duration-input-47x7nbGh.cjs +1 -0
- package/dist/{duration-input-BZhzeELL.js → duration-input-DrVonjKK.js} +42 -42
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +692 -691
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +5 -5
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +3 -3
- package/dist/lexical/index.cjs.js +25 -25
- package/dist/lexical/index.es.js +1820 -1812
- package/dist/lexical.css +51 -49
- package/dist/{modal-C-d5Btti.cjs → modal-DUlqGUW7.cjs} +1 -1
- package/dist/{modal-DTz98Dk7.js → modal-ZitwUeXx.js} +1 -1
- package/dist/{notice-BDTfBGtx.cjs → notice-DAVOTnfA.cjs} +1 -1
- package/dist/{notice-CZuh-h6a.js → notice-E_p2hg1G.js} +1 -1
- package/dist/styles-url-BIeImEjl.js +4 -0
- package/dist/styles-url-CkPTI32j.cjs +1 -0
- package/dist/types/lexical/types.d.ts +5 -0
- package/dist/{use-form-Cd8YFWaN.js → use-form-BQRVnIp9.js} +167 -166
- package/dist/use-form-DTyNw0kM.cjs +2 -0
- package/dist/{widget-customization-BY4Ox_4e.js → widget-customization-C-fSx3RB.js} +307 -306
- package/dist/widget-customization-xEBfEPhQ.cjs +1 -0
- package/package.json +1 -1
- package/dist/deep-merge-CI1g9sjh.cjs +0 -1
- package/dist/duration-input-a1fCTfKl.cjs +0 -1
- package/dist/styles-url-4g2WnNJ8.js +0 -4
- package/dist/styles-url-mlDYoWbF.cjs +0 -1
- package/dist/use-form-DQVN_Zjb.cjs +0 -2
- package/dist/widget-customization-eyQ2pxvu.cjs +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Value as p, prop as rt, computedOf as D, html as
|
|
2
|
-
import { F as ht, N as z, T as gt, U as ft, a as mt } from "./deep-merge-
|
|
1
|
+
import { Value as p, prop as rt, computedOf as D, html as _, attr as u, svg as tt, svgAttr as Y, Empty as A, on as M, When as W, Fragment as j, aria as N, emitValue as Z, Use as lt, input as ot, emitValueAsNullableDate as et, emitValueAsNullableDateTime as nt, Repeat as ut, style as pt, emit as dt, emitValueAsNumber as V } from "@tempots/dom";
|
|
2
|
+
import { F as ht, N as z, T as gt, U as ft, a as mt } from "./deep-merge-CoLO4id0.js";
|
|
3
3
|
import { $ as bt } from "./string-DYyMxBl-.js";
|
|
4
4
|
import { I as E } from "./input-container-9r1F3KuX.js";
|
|
5
5
|
import { C as U, T as wt } from "./text-input-BgPx8BbG.js";
|
|
6
6
|
import { B as yt, I as q, b as st, a as It } from "./translations-CiBhB2FV.js";
|
|
7
7
|
import { AutoSelect as Mt } from "@tempots/ui";
|
|
8
|
-
import { E as $t, P as xt } from "./notice-
|
|
8
|
+
import { E as $t, P as xt } from "./notice-E_p2hg1G.js";
|
|
9
9
|
import { s as _t } from "./session-id-3KiilioY.js";
|
|
10
10
|
import { r as kt } from "./utils-DEbsp9Q9.js";
|
|
11
11
|
function it(t) {
|
|
@@ -15,23 +15,23 @@ function it(t) {
|
|
|
15
15
|
}
|
|
16
16
|
function Ft(t) {
|
|
17
17
|
if (typeof t != "string") return !1;
|
|
18
|
-
const e = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,
|
|
19
|
-
if (!
|
|
20
|
-
const [, n, r,
|
|
18
|
+
const e = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, a = t.match(e);
|
|
19
|
+
if (!a) return !1;
|
|
20
|
+
const [, n, r, s] = a, o = parseInt(n, 10), i = parseInt(r, 10), c = parseInt(s, 10);
|
|
21
21
|
return o >= 0 && o <= 255 && i >= 0 && i <= 255 && c >= 0 && c <= 255;
|
|
22
22
|
}
|
|
23
23
|
function Ct(t) {
|
|
24
24
|
if (typeof t != "string") return !1;
|
|
25
|
-
const e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,
|
|
26
|
-
if (!
|
|
27
|
-
const [, n, r,
|
|
25
|
+
const e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, a = t.match(e);
|
|
26
|
+
if (!a) return !1;
|
|
27
|
+
const [, n, r, s, o] = a, i = parseInt(n, 10), c = parseInt(r, 10), l = parseInt(s, 10), d = parseFloat(o);
|
|
28
28
|
return i >= 0 && i <= 255 && c >= 0 && c <= 255 && l >= 0 && l <= 255 && d >= 0 && d <= 1;
|
|
29
29
|
}
|
|
30
30
|
function Tt(t) {
|
|
31
31
|
if (typeof t != "string") return !1;
|
|
32
|
-
const e = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,
|
|
33
|
-
if (!
|
|
34
|
-
const [, n, r,
|
|
32
|
+
const e = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i, a = t.match(e);
|
|
33
|
+
if (!a) return !1;
|
|
34
|
+
const [, n, r, s] = a, o = parseInt(n, 10), i = parseInt(r, 10), c = parseInt(s, 10);
|
|
35
35
|
return o >= 0 && o <= 360 && i >= 0 && i <= 100 && c >= 0 && c <= 100;
|
|
36
36
|
}
|
|
37
37
|
function re(t) {
|
|
@@ -40,44 +40,44 @@ function re(t) {
|
|
|
40
40
|
function At(t) {
|
|
41
41
|
if (!it(t)) return null;
|
|
42
42
|
let e = t.startsWith("#") ? t.slice(1) : t;
|
|
43
|
-
return e.length === 3 && (e = e.split("").map((
|
|
43
|
+
return e.length === 3 && (e = e.split("").map((a) => a + a).join("")), `#${e.toLowerCase()}`;
|
|
44
44
|
}
|
|
45
|
-
function Q(t, e,
|
|
45
|
+
function Q(t, e, a) {
|
|
46
46
|
const n = (r) => {
|
|
47
|
-
const
|
|
48
|
-
return
|
|
47
|
+
const s = Math.round(Math.max(0, Math.min(255, r))).toString(16);
|
|
48
|
+
return s.length === 1 ? "0" + s : s;
|
|
49
49
|
};
|
|
50
|
-
return `#${n(t)}${n(e)}${n(
|
|
50
|
+
return `#${n(t)}${n(e)}${n(a)}`;
|
|
51
51
|
}
|
|
52
52
|
function H(t) {
|
|
53
53
|
const e = At(t);
|
|
54
54
|
if (!e) return null;
|
|
55
|
-
const
|
|
56
|
-
return
|
|
57
|
-
r: parseInt(
|
|
58
|
-
g: parseInt(
|
|
59
|
-
b: parseInt(
|
|
55
|
+
const a = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
56
|
+
return a ? {
|
|
57
|
+
r: parseInt(a[1], 16),
|
|
58
|
+
g: parseInt(a[2], 16),
|
|
59
|
+
b: parseInt(a[3], 16)
|
|
60
60
|
} : null;
|
|
61
61
|
}
|
|
62
62
|
function oe(t, e) {
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
63
|
+
const a = H(t), n = H(e);
|
|
64
|
+
if (!a || !n) return null;
|
|
65
65
|
const r = (l, d, f) => {
|
|
66
|
-
const [m,
|
|
67
|
-
return 0.2126 * m + 0.7152 *
|
|
68
|
-
},
|
|
66
|
+
const [m, g, b] = [l, d, f].map((I) => (I = I / 255, I <= 0.03928 ? I / 12.92 : Math.pow((I + 0.055) / 1.055, 2.4)));
|
|
67
|
+
return 0.2126 * m + 0.7152 * g + 0.0722 * b;
|
|
68
|
+
}, s = r(a.r, a.g, a.b), o = r(n.r, n.g, n.b), i = Math.max(s, o), c = Math.min(s, o);
|
|
69
69
|
return (i + 0.05) / (c + 0.05);
|
|
70
70
|
}
|
|
71
71
|
function St(t) {
|
|
72
72
|
if (!t) return [0, 0, 0, 1];
|
|
73
|
-
const
|
|
73
|
+
const a = t.trim().match(
|
|
74
74
|
/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
|
|
75
75
|
);
|
|
76
|
-
if (
|
|
77
|
-
const l =
|
|
76
|
+
if (a) {
|
|
77
|
+
const l = a[1];
|
|
78
78
|
if (l.length === 8) {
|
|
79
|
-
const d = parseInt(l.slice(0, 2), 16), f = parseInt(l.slice(2, 4), 16), m = parseInt(l.slice(4, 6), 16),
|
|
80
|
-
return [d, f, m,
|
|
79
|
+
const d = parseInt(l.slice(0, 2), 16), f = parseInt(l.slice(2, 4), 16), m = parseInt(l.slice(4, 6), 16), g = parseInt(l.slice(6, 8), 16) / 255;
|
|
80
|
+
return [d, f, m, g];
|
|
81
81
|
}
|
|
82
82
|
if (l.length === 6)
|
|
83
83
|
return [
|
|
@@ -87,8 +87,8 @@ function St(t) {
|
|
|
87
87
|
1
|
|
88
88
|
];
|
|
89
89
|
if (l.length === 4) {
|
|
90
|
-
const d = parseInt(l[0] + l[0], 16), f = parseInt(l[1] + l[1], 16), m = parseInt(l[2] + l[2], 16),
|
|
91
|
-
return [d, f, m,
|
|
90
|
+
const d = parseInt(l[0] + l[0], 16), f = parseInt(l[1] + l[1], 16), m = parseInt(l[2] + l[2], 16), g = parseInt(l[3] + l[3], 16) / 255;
|
|
91
|
+
return [d, f, m, g];
|
|
92
92
|
}
|
|
93
93
|
if (l.length === 3) {
|
|
94
94
|
const d = parseInt(l[0] + l[0], 16), f = parseInt(l[1] + l[1], 16), m = parseInt(l[2] + l[2], 16);
|
|
@@ -110,32 +110,32 @@ function St(t) {
|
|
|
110
110
|
);
|
|
111
111
|
if (r)
|
|
112
112
|
return [parseInt(r[1], 10), parseInt(r[2], 10), parseInt(r[3], 10), 1];
|
|
113
|
-
const
|
|
113
|
+
const s = t.match(
|
|
114
114
|
/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
115
115
|
);
|
|
116
|
-
if (
|
|
117
|
-
const l = parseFloat(
|
|
118
|
-
return [
|
|
116
|
+
if (s) {
|
|
117
|
+
const l = parseFloat(s[1]), d = parseFloat(s[2]), f = parseFloat(s[3]), m = s[4] != null ? parseFloat(s[4]) : 1, [g, b, I] = ct(l, d / 100, f / 100);
|
|
118
|
+
return [g, b, I, m];
|
|
119
119
|
}
|
|
120
120
|
const o = t.match(
|
|
121
121
|
/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
122
122
|
);
|
|
123
123
|
if (o) {
|
|
124
|
-
const l = parseFloat(o[1]), d = parseFloat(o[2]) / 100, f = parseFloat(o[3]) / 100, m = o[4] != null ? parseFloat(o[4]) : 1, [
|
|
125
|
-
return [
|
|
124
|
+
const l = parseFloat(o[1]), d = parseFloat(o[2]) / 100, f = parseFloat(o[3]) / 100, m = o[4] != null ? parseFloat(o[4]) : 1, [g, b, I] = Nt(l, d, f);
|
|
125
|
+
return [g, b, I, m];
|
|
126
126
|
}
|
|
127
127
|
const i = t.match(
|
|
128
128
|
/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
129
129
|
);
|
|
130
130
|
if (i) {
|
|
131
|
-
const l = i[1], d = parseFloat(i[2]), f = parseFloat(i[3]), m = i[4] != null ? parseFloat(i[4]) : 1,
|
|
132
|
-
return [
|
|
131
|
+
const l = i[1], d = parseFloat(i[2]), f = parseFloat(i[3]), m = i[4] != null ? parseFloat(i[4]) : 1, g = l.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(l) / 100)) : Math.max(0, Math.min(1, parseFloat(l))), [b, I, x] = Bt(g, d, f);
|
|
132
|
+
return [b, I, x, m];
|
|
133
133
|
}
|
|
134
134
|
const c = H(t);
|
|
135
135
|
return c ? [c.r, c.g, c.b, 1] : [0, 0, 0, 1];
|
|
136
136
|
}
|
|
137
|
-
function vt(t, e,
|
|
138
|
-
return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(
|
|
137
|
+
function vt(t, e, a, n) {
|
|
138
|
+
return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(a)}, ${Math.max(
|
|
139
139
|
0,
|
|
140
140
|
Math.min(1, Math.round(n * 100) / 100)
|
|
141
141
|
)})`;
|
|
@@ -146,45 +146,45 @@ function Rt(t) {
|
|
|
146
146
|
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
function ct(t, e,
|
|
149
|
+
function ct(t, e, a) {
|
|
150
150
|
t = (t % 360 + 360) % 360;
|
|
151
|
-
const n = (1 - Math.abs(2 *
|
|
151
|
+
const n = (1 - Math.abs(2 * a - 1)) * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), s = a - n / 2;
|
|
152
152
|
let o, i, c;
|
|
153
153
|
return 0 <= t && t < 60 ? [o, i, c] = [n, r, 0] : 60 <= t && t < 120 ? [o, i, c] = [r, n, 0] : 120 <= t && t < 180 ? [o, i, c] = [0, n, r] : 180 <= t && t < 240 ? [o, i, c] = [0, r, n] : 240 <= t && t < 300 ? [o, i, c] = [r, 0, n] : [o, i, c] = [n, 0, r], [
|
|
154
|
-
Math.round((o +
|
|
155
|
-
Math.round((i +
|
|
156
|
-
Math.round((c +
|
|
154
|
+
Math.round((o + s) * 255),
|
|
155
|
+
Math.round((i + s) * 255),
|
|
156
|
+
Math.round((c + s) * 255)
|
|
157
157
|
];
|
|
158
158
|
}
|
|
159
|
-
function Nt(t, e,
|
|
159
|
+
function Nt(t, e, a) {
|
|
160
160
|
t = (t % 360 + 360) % 360;
|
|
161
|
-
const n = e +
|
|
162
|
-
n > 1 && (e /= n,
|
|
163
|
-
const [r,
|
|
161
|
+
const n = e + a;
|
|
162
|
+
n > 1 && (e /= n, a /= n);
|
|
163
|
+
const [r, s, o] = ct(t, 1, 0.5).map((f) => f / 255), i = 1 - e - a, c = r * i + e, l = s * i + e, d = o * i + e;
|
|
164
164
|
return [Math.round(c * 255), Math.round(l * 255), Math.round(d * 255)];
|
|
165
165
|
}
|
|
166
|
-
function J(t, e,
|
|
167
|
-
t /= 255, e /= 255,
|
|
168
|
-
const n = Math.max(t, e,
|
|
169
|
-
let
|
|
166
|
+
function J(t, e, a) {
|
|
167
|
+
t /= 255, e /= 255, a /= 255;
|
|
168
|
+
const n = Math.max(t, e, a), r = Math.min(t, e, a);
|
|
169
|
+
let s = 0, o = 0;
|
|
170
170
|
const i = (n + r) / 2, c = n - r;
|
|
171
171
|
if (c !== 0) {
|
|
172
172
|
switch (o = i > 0.5 ? c / (2 - n - r) : c / (n + r), n) {
|
|
173
173
|
case t:
|
|
174
|
-
|
|
174
|
+
s = (e - a) / c + (e < a ? 6 : 0);
|
|
175
175
|
break;
|
|
176
176
|
case e:
|
|
177
|
-
|
|
177
|
+
s = (a - t) / c + 2;
|
|
178
178
|
break;
|
|
179
179
|
default:
|
|
180
|
-
|
|
180
|
+
s = (t - e) / c + 4;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
s *= 60;
|
|
183
183
|
}
|
|
184
|
-
return [Math.round(
|
|
184
|
+
return [Math.round(s), Math.round(o * 100), Math.round(i * 100)];
|
|
185
185
|
}
|
|
186
|
-
function Dt(t, e,
|
|
187
|
-
const [n] = J(t, e,
|
|
186
|
+
function Dt(t, e, a) {
|
|
187
|
+
const [n] = J(t, e, a), r = t / 255, s = e / 255, o = a / 255, i = Math.min(r, s, o), c = 1 - Math.max(r, s, o);
|
|
188
188
|
return [n, Math.round(i * 100), Math.round(c * 100)];
|
|
189
189
|
}
|
|
190
190
|
function G(t) {
|
|
@@ -195,42 +195,42 @@ function K(t) {
|
|
|
195
195
|
const e = t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 0.4166666666666667) - 0.055;
|
|
196
196
|
return Math.round(Math.max(0, Math.min(1, e)) * 255);
|
|
197
197
|
}
|
|
198
|
-
function Bt(t, e,
|
|
199
|
-
const n =
|
|
200
|
-
return [K(m), K(
|
|
198
|
+
function Bt(t, e, a) {
|
|
199
|
+
const n = a * Math.PI / 180, r = Math.cos(n) * e, s = Math.sin(n) * e, o = t + 0.3963377774 * r + 0.2158037573 * s, i = t - 0.1055613458 * r - 0.0638541728 * s, c = t - 0.0894841775 * r - 1.291485548 * s, l = o * o * o, d = i * i * i, f = c * c * c, m = 4.0767416621 * l - 3.3077115913 * d + 0.2309699292 * f, g = -1.2684380046 * l + 2.6097574011 * d - 0.3413193965 * f, b = -0.0041960863 * l - 0.7034186147 * d + 1.707614701 * f;
|
|
200
|
+
return [K(m), K(g), K(b)];
|
|
201
201
|
}
|
|
202
|
-
function Vt(t, e,
|
|
203
|
-
const n = G(t), r = G(e),
|
|
204
|
-
let x = Math.atan2(
|
|
202
|
+
function Vt(t, e, a) {
|
|
203
|
+
const n = G(t), r = G(e), s = G(a), o = 0.4122214708 * n + 0.5363325363 * r + 0.0514459929 * s, i = 0.2119034982 * n + 0.6806995451 * r + 0.1073969566 * s, c = 0.0883024619 * n + 0.2817188376 * r + 0.6299787005 * s, l = Math.cbrt(o), d = Math.cbrt(i), f = Math.cbrt(c), m = 0.2104542553 * l + 0.793617785 * d - 0.0040720468 * f, g = 1.9779984951 * l - 2.428592205 * d + 0.4505937099 * f, b = 0.0259040371 * l + 0.7827717662 * d - 0.808675766 * f, I = Math.sqrt(g * g + b * b);
|
|
204
|
+
let x = Math.atan2(b, g) * 180 / Math.PI;
|
|
205
205
|
return x < 0 && (x += 360), [m, I, x];
|
|
206
206
|
}
|
|
207
|
-
function P(t, e,
|
|
207
|
+
function P(t, e, a, n, r, s) {
|
|
208
208
|
switch (r) {
|
|
209
209
|
case "hex":
|
|
210
|
-
if (
|
|
210
|
+
if (s) {
|
|
211
211
|
const o = (c) => c.toString(16).padStart(2, "0"), i = Math.max(0, Math.min(255, Math.round(n * 255)));
|
|
212
|
-
return `#${o(t)}${o(e)}${o(
|
|
212
|
+
return `#${o(t)}${o(e)}${o(a)}${o(i)}`;
|
|
213
213
|
}
|
|
214
|
-
return Q(t, e,
|
|
214
|
+
return Q(t, e, a);
|
|
215
215
|
case "rgb":
|
|
216
|
-
return `rgb(${t}, ${e}, ${
|
|
216
|
+
return `rgb(${t}, ${e}, ${a})`;
|
|
217
217
|
case "rgba":
|
|
218
|
-
return `rgba(${t}, ${e}, ${
|
|
218
|
+
return `rgba(${t}, ${e}, ${a}, ${Math.round(n * 100) / 100})`;
|
|
219
219
|
case "hsl": {
|
|
220
|
-
const [o, i, c] = J(t, e,
|
|
220
|
+
const [o, i, c] = J(t, e, a);
|
|
221
221
|
return `hsl(${o}, ${i}%, ${c}%)`;
|
|
222
222
|
}
|
|
223
223
|
case "hsla": {
|
|
224
|
-
const [o, i, c] = J(t, e,
|
|
224
|
+
const [o, i, c] = J(t, e, a);
|
|
225
225
|
return `hsla(${o}, ${i}%, ${c}%, ${Math.round(n * 100) / 100})`;
|
|
226
226
|
}
|
|
227
227
|
case "hwb": {
|
|
228
|
-
const [o, i, c] = Dt(t, e,
|
|
228
|
+
const [o, i, c] = Dt(t, e, a);
|
|
229
229
|
return n < 1 ? `hwb(${o} ${i}% ${c}% / ${Math.round(n * 100) / 100})` : `hwb(${o} ${i}% ${c}%)`;
|
|
230
230
|
}
|
|
231
231
|
case "oklch": {
|
|
232
|
-
const [o, i, c] = Vt(t, e,
|
|
233
|
-
return
|
|
232
|
+
const [o, i, c] = Vt(t, e, a), l = (Math.round(o * 1e3) / 1e3).toFixed(3), d = (Math.round(i * 1e3) / 1e3).toFixed(3), f = (Math.round(c * 10) / 10).toFixed(1), m = Math.round(n * 100) / 100;
|
|
233
|
+
return s || n < 1 ? `oklch(${l} ${d} ${f} / ${m})` : `oklch(${l} ${d} ${f})`;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -238,12 +238,12 @@ function O(t, e) {
|
|
|
238
238
|
return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
|
|
239
239
|
}
|
|
240
240
|
async function Et(t) {
|
|
241
|
-
return new Promise((e,
|
|
241
|
+
return new Promise((e, a) => {
|
|
242
242
|
const n = new FileReader();
|
|
243
243
|
n.readAsDataURL(t), n.onload = () => {
|
|
244
244
|
const r = n.result;
|
|
245
245
|
e(r.split(",")[1]);
|
|
246
|
-
}, n.onerror = (r) =>
|
|
246
|
+
}, n.onerror = (r) => a(r);
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
function Ut(t) {
|
|
@@ -266,29 +266,29 @@ function Lt(t) {
|
|
|
266
266
|
return "application/octet-stream";
|
|
267
267
|
}
|
|
268
268
|
function Pt(t) {
|
|
269
|
-
const e = bt(t ?? ""),
|
|
270
|
-
for (let r = 0; r <
|
|
269
|
+
const e = bt(t ?? ""), a = e.length, n = new Uint8Array(a);
|
|
270
|
+
for (let r = 0; r < a; r++) n[r] = e.charCodeAt(r);
|
|
271
271
|
return n;
|
|
272
272
|
}
|
|
273
273
|
function Ot(t) {
|
|
274
274
|
const {
|
|
275
275
|
value: e,
|
|
276
|
-
onChange:
|
|
276
|
+
onChange: a,
|
|
277
277
|
onInput: n,
|
|
278
278
|
...r
|
|
279
|
-
} = t,
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
),
|
|
284
|
-
return new File([
|
|
279
|
+
} = t, s = /* @__PURE__ */ new Map(), o = p.toSignal(e).map((d) => d.map((f, m) => {
|
|
280
|
+
const g = s.get(f), b = Pt(f ?? ""), I = g?.type || Lt(b), x = g?.name ?? `file-${m}`, y = b.buffer.slice(
|
|
281
|
+
b.byteOffset,
|
|
282
|
+
b.byteOffset + b.byteLength
|
|
283
|
+
), F = new Blob([y], { type: I });
|
|
284
|
+
return new File([F], x, { type: I });
|
|
285
285
|
})), i = (d) => (f) => {
|
|
286
286
|
d && Ut(f).then((m) => {
|
|
287
|
-
for (const [
|
|
288
|
-
|
|
287
|
+
for (const [g, b] of m.entries())
|
|
288
|
+
s.set(b, { name: f[g].name, type: f[g].type });
|
|
289
289
|
d(m);
|
|
290
290
|
});
|
|
291
|
-
}, c = i(
|
|
291
|
+
}, c = i(a), l = i(n);
|
|
292
292
|
return ht({
|
|
293
293
|
...r,
|
|
294
294
|
value: o,
|
|
@@ -299,134 +299,134 @@ function Ot(t) {
|
|
|
299
299
|
function ie(t) {
|
|
300
300
|
const {
|
|
301
301
|
value: e,
|
|
302
|
-
onInput:
|
|
302
|
+
onInput: a,
|
|
303
303
|
onChange: n,
|
|
304
304
|
...r
|
|
305
305
|
} = t;
|
|
306
306
|
return Ot({
|
|
307
307
|
...r,
|
|
308
308
|
maxFiles: 1,
|
|
309
|
-
value: p.map(e, (
|
|
310
|
-
onChange: (
|
|
311
|
-
n?.(
|
|
309
|
+
value: p.map(e, (s) => s == null ? [] : [s]),
|
|
310
|
+
onChange: (s) => {
|
|
311
|
+
n?.(s[0]);
|
|
312
312
|
},
|
|
313
|
-
onInput: (
|
|
314
|
-
|
|
313
|
+
onInput: (s) => {
|
|
314
|
+
a?.(s[0]);
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
function Wt(t, e) {
|
|
319
|
-
const [
|
|
320
|
-
for (let
|
|
321
|
-
const
|
|
319
|
+
const [a, n, r] = t, s = a << 16 ^ n << 8 ^ r, o = Rt(s), i = 6 + Math.floor(o() * 5), c = 0.18 + o() * 0.06, l = [];
|
|
320
|
+
for (let g = 0; g < i; g++) {
|
|
321
|
+
const b = g / i * Math.PI * 2, I = e * (1 + (o() * 2 - 1) * c), x = Math.cos(b) * I, y = Math.sin(b) * I;
|
|
322
322
|
l.push({ x, y });
|
|
323
323
|
}
|
|
324
324
|
const d = (l[0].x + l[i - 1].x) / 2, f = (l[0].y + l[i - 1].y) / 2;
|
|
325
325
|
let m = `M ${d.toFixed(3)} ${f.toFixed(3)}`;
|
|
326
|
-
for (let
|
|
327
|
-
const
|
|
328
|
-
m += ` Q ${
|
|
326
|
+
for (let g = 0; g < i; g++) {
|
|
327
|
+
const b = l[g], I = l[(g + 1) % i], x = (b.x + I.x) / 2, y = (b.y + I.y) / 2;
|
|
328
|
+
m += ` Q ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${x.toFixed(3)} ${y.toFixed(3)}`;
|
|
329
329
|
}
|
|
330
330
|
return m += " Z", m;
|
|
331
331
|
}
|
|
332
332
|
const ce = (t) => {
|
|
333
|
-
const { value: e, onBlur:
|
|
333
|
+
const { value: e, onBlur: a, onChange: n, onInput: r, displayValue: s, size: o, withAlpha: i } = t, c = p.map(o ?? 32, (h) => h), l = p.map(e, (h) => St(h ?? "#000000")), d = p.map(
|
|
334
334
|
l,
|
|
335
|
-
([
|
|
336
|
-
), f = p.map(l, ([, , ,
|
|
335
|
+
([h, $, k]) => [h, $, k]
|
|
336
|
+
), f = p.map(l, ([, , , h]) => h), m = rt(p.get(f) ?? 1), g = p.map(i ?? !1, (h) => h), b = p.map(
|
|
337
337
|
t.colorTextFormat ?? "rgb",
|
|
338
|
-
(
|
|
338
|
+
(h) => h
|
|
339
339
|
), I = D(
|
|
340
340
|
d,
|
|
341
341
|
m,
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
b,
|
|
343
|
+
g
|
|
344
344
|
)(
|
|
345
|
-
([
|
|
345
|
+
([h, $, k], T, v, R) => P(h, $, k, T ?? 1, O(v, R), R)
|
|
346
346
|
), x = p.map(
|
|
347
347
|
t.colorTextFormat ?? "hex",
|
|
348
|
-
(
|
|
349
|
-
), y = p.map(c, (
|
|
348
|
+
(h) => h
|
|
349
|
+
), y = p.map(c, (h) => `${-h / 2} ${-h / 2} ${h} ${h}`), F = D(
|
|
350
350
|
d,
|
|
351
351
|
c
|
|
352
|
-
)((
|
|
352
|
+
)((h, $) => Wt(h, $ / 2)), w = D(
|
|
353
353
|
d,
|
|
354
354
|
m,
|
|
355
|
-
|
|
355
|
+
g
|
|
356
356
|
)(
|
|
357
|
-
([
|
|
358
|
-
),
|
|
357
|
+
([h, $, k], T, v) => v || T < 1 ? vt(h, $, k, T) : Q(h, $, k)
|
|
358
|
+
), S = _.div(
|
|
359
359
|
u.class("bc-color-swatch-input__control"),
|
|
360
360
|
u.class(
|
|
361
361
|
p.map(
|
|
362
|
-
|
|
363
|
-
(
|
|
362
|
+
g,
|
|
363
|
+
(h) => h ? "bc-color-swatch-input__control--alpha" : ""
|
|
364
364
|
)
|
|
365
365
|
),
|
|
366
366
|
u.style(
|
|
367
|
-
D(c)((
|
|
367
|
+
D(c)((h) => `min-width:${h + 2}px;height:${h + 2}px`)
|
|
368
368
|
),
|
|
369
369
|
// The SVG blob preview
|
|
370
370
|
tt.svg(
|
|
371
371
|
u.class("bc-color-swatch-input__svg"),
|
|
372
372
|
Y.viewBox(y),
|
|
373
|
-
tt.path(Y.d(
|
|
373
|
+
tt.path(Y.d(F), Y.fill(w))
|
|
374
374
|
),
|
|
375
375
|
// Invisible native input overlays the blob for picker and accessibility
|
|
376
|
-
|
|
376
|
+
_.input(
|
|
377
377
|
u.type("color"),
|
|
378
378
|
U(t),
|
|
379
379
|
// Native color input needs hex without alpha
|
|
380
|
-
u.value(p.map(d, ([
|
|
380
|
+
u.value(p.map(d, ([h, $, k]) => Q(h, $, k))),
|
|
381
381
|
u.class(
|
|
382
382
|
"bc-input bc-color-swatch-input bc-color-swatch-input__native"
|
|
383
383
|
),
|
|
384
|
-
|
|
385
|
-
n != null ? M.change((
|
|
386
|
-
const $ =
|
|
384
|
+
a != null ? M.blur(a) : A,
|
|
385
|
+
n != null ? M.change((h) => {
|
|
386
|
+
const $ = h.target.value;
|
|
387
387
|
if (!n) return;
|
|
388
|
-
const { r:
|
|
388
|
+
const { r: k, g: T, b: v } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = O(
|
|
389
389
|
p.get(x),
|
|
390
|
-
p.get(
|
|
391
|
-
), X = P(
|
|
390
|
+
p.get(g)
|
|
391
|
+
), X = P(k, T, v, R, B, p.get(g));
|
|
392
392
|
n(X);
|
|
393
393
|
}) : A,
|
|
394
|
-
r != null ? M.input((
|
|
395
|
-
const $ =
|
|
394
|
+
r != null ? M.input((h) => {
|
|
395
|
+
const $ = h.target.value;
|
|
396
396
|
if (!r) return;
|
|
397
|
-
const { r:
|
|
397
|
+
const { r: k, g: T, b: v } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(m) ?? 1, B = O(
|
|
398
398
|
p.get(x),
|
|
399
|
-
p.get(
|
|
400
|
-
), X = P(
|
|
399
|
+
p.get(g)
|
|
400
|
+
), X = P(k, T, v, R, B, p.get(g));
|
|
401
401
|
r(X);
|
|
402
402
|
}) : A
|
|
403
403
|
)
|
|
404
404
|
), C = W(
|
|
405
|
-
|
|
406
|
-
() =>
|
|
405
|
+
g,
|
|
406
|
+
() => _.input(
|
|
407
407
|
u.type("range"),
|
|
408
408
|
u.class("bc-color-swatch-input__alpha"),
|
|
409
409
|
u.min(0),
|
|
410
410
|
u.max(1),
|
|
411
411
|
u.step(0.01),
|
|
412
|
-
u.value(p.map(m, (
|
|
412
|
+
u.value(p.map(m, (h) => String(h ?? 1))),
|
|
413
413
|
u.disabled(t.disabled),
|
|
414
|
-
M.input((
|
|
415
|
-
const $ = parseFloat(
|
|
414
|
+
M.input((h) => {
|
|
415
|
+
const $ = parseFloat(h.target.value);
|
|
416
416
|
m.set($);
|
|
417
|
-
const [
|
|
417
|
+
const [k, T, v] = p.get(d), R = O(
|
|
418
418
|
p.get(x),
|
|
419
|
-
p.get(
|
|
420
|
-
), B = P(
|
|
419
|
+
p.get(g)
|
|
420
|
+
), B = P(k, T, v, $, R, p.get(g));
|
|
421
421
|
r?.(B);
|
|
422
422
|
}),
|
|
423
|
-
M.change((
|
|
424
|
-
const $ = parseFloat(
|
|
423
|
+
M.change((h) => {
|
|
424
|
+
const $ = parseFloat(h.target.value);
|
|
425
425
|
m.set($);
|
|
426
|
-
const [
|
|
426
|
+
const [k, T, v] = p.get(d), R = O(
|
|
427
427
|
p.get(x),
|
|
428
|
-
p.get(
|
|
429
|
-
), B = P(
|
|
428
|
+
p.get(g)
|
|
429
|
+
), B = P(k, T, v, $, R, p.get(g));
|
|
430
430
|
n?.(B);
|
|
431
431
|
})
|
|
432
432
|
)
|
|
@@ -436,12 +436,12 @@ const ce = (t) => {
|
|
|
436
436
|
...t,
|
|
437
437
|
// ensure our control does not try to grow
|
|
438
438
|
growInput: !1,
|
|
439
|
-
input:
|
|
439
|
+
input: S,
|
|
440
440
|
// If caller provided an `after`, append RGB before it
|
|
441
441
|
after: j(
|
|
442
442
|
W(
|
|
443
|
-
|
|
444
|
-
() =>
|
|
443
|
+
s ?? !1,
|
|
444
|
+
() => _.span(u.class("bc-color-swatch-input__rgb"), I)
|
|
445
445
|
),
|
|
446
446
|
C,
|
|
447
447
|
t.after
|
|
@@ -450,13 +450,13 @@ const ce = (t) => {
|
|
|
450
450
|
}, at = (t) => typeof t == "string" && t.trim() === "" ? null : t, Ht = (t) => t ?? "";
|
|
451
451
|
function L(t) {
|
|
452
452
|
return (e) => {
|
|
453
|
-
const { value:
|
|
453
|
+
const { value: a, onBlur: n, onChange: r, onInput: s, after: o, disabled: i, ...c } = e, l = z(a, i, r ?? s);
|
|
454
454
|
return t({
|
|
455
455
|
...c,
|
|
456
456
|
disabled: i,
|
|
457
|
-
value: p.map(
|
|
457
|
+
value: p.map(a, Ht),
|
|
458
458
|
onChange: r != null ? (d) => r(at(d)) : void 0,
|
|
459
|
-
onInput:
|
|
459
|
+
onInput: s != null ? (d) => s(at(d)) : void 0,
|
|
460
460
|
onBlur: n,
|
|
461
461
|
after: o != null ? j(l, o) : l
|
|
462
462
|
});
|
|
@@ -465,12 +465,12 @@ function L(t) {
|
|
|
465
465
|
const le = ({
|
|
466
466
|
startEditing: t,
|
|
467
467
|
value: e,
|
|
468
|
-
onChange:
|
|
468
|
+
onChange: a,
|
|
469
469
|
placeholder: n,
|
|
470
470
|
disabled: r
|
|
471
471
|
}) => {
|
|
472
|
-
const
|
|
473
|
-
return
|
|
472
|
+
const s = p.deriveProp(t ?? !1), o = rt(!1), i = p.map(r ?? !1, (c) => c);
|
|
473
|
+
return _.div(
|
|
474
474
|
u.class("bc-editable-text"),
|
|
475
475
|
u.class(
|
|
476
476
|
p.map(
|
|
@@ -480,45 +480,45 @@ const le = ({
|
|
|
480
480
|
),
|
|
481
481
|
N.disabled(i),
|
|
482
482
|
W(
|
|
483
|
-
|
|
484
|
-
() =>
|
|
483
|
+
s,
|
|
484
|
+
() => _.input(
|
|
485
485
|
u.placeholder(n),
|
|
486
486
|
u.value(e),
|
|
487
487
|
u.class("bc-editable-text__input"),
|
|
488
488
|
Mt(),
|
|
489
489
|
M.keydown((c) => {
|
|
490
|
-
c.key === "Enter" ?
|
|
490
|
+
c.key === "Enter" ? s.set(!1) : c.key === "Escape" && (o.set(!0), s.set(!1));
|
|
491
491
|
}),
|
|
492
492
|
M.blur(
|
|
493
493
|
Z((c) => {
|
|
494
|
-
if (
|
|
494
|
+
if (s.set(!1), o.value) {
|
|
495
495
|
o.set(!1);
|
|
496
496
|
return;
|
|
497
497
|
}
|
|
498
|
-
|
|
498
|
+
a(c);
|
|
499
499
|
})
|
|
500
500
|
)
|
|
501
501
|
),
|
|
502
|
-
() =>
|
|
502
|
+
() => _.span(
|
|
503
503
|
M.click(() => {
|
|
504
|
-
p.get(i) ||
|
|
504
|
+
p.get(i) || s.set(!0);
|
|
505
505
|
}),
|
|
506
506
|
u.class("bc-editable-text__display"),
|
|
507
507
|
W(
|
|
508
508
|
p.map(e, (c) => c != null && c.trim() !== ""),
|
|
509
|
-
() =>
|
|
510
|
-
() =>
|
|
509
|
+
() => _.span(u.class("bc-editable-text__text"), e),
|
|
510
|
+
() => _.span(
|
|
511
511
|
u.class("bc-editable-text__placeholder"),
|
|
512
512
|
n
|
|
513
513
|
)
|
|
514
514
|
),
|
|
515
515
|
W(
|
|
516
516
|
p.map(i, (c) => !c),
|
|
517
|
-
() =>
|
|
517
|
+
() => _.button(
|
|
518
518
|
u.type("button"),
|
|
519
519
|
u.class("bc-editable-text__edit-button"),
|
|
520
520
|
lt(yt, (c) => N.label(c.$.editLabel)),
|
|
521
|
-
M.click(() =>
|
|
521
|
+
M.click(() => s.set(!0)),
|
|
522
522
|
q({ icon: "line-md/pencil", color: "neutral" })
|
|
523
523
|
)
|
|
524
524
|
)
|
|
@@ -526,45 +526,45 @@ const le = ({
|
|
|
526
526
|
)
|
|
527
527
|
);
|
|
528
528
|
}, ue = (t) => {
|
|
529
|
-
const { value: e, onBlur:
|
|
529
|
+
const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, i = z(e, o, n ?? r);
|
|
530
530
|
return E({
|
|
531
531
|
...t,
|
|
532
532
|
input: ot.date(
|
|
533
533
|
U(t),
|
|
534
534
|
u.valueAsDate(e),
|
|
535
535
|
u.class("bc-input"),
|
|
536
|
-
|
|
536
|
+
a != null ? M.blur(Z(a)) : A,
|
|
537
537
|
n != null ? M.change(et(n)) : A,
|
|
538
538
|
r != null ? M.input(et(r)) : A
|
|
539
539
|
),
|
|
540
|
-
after:
|
|
540
|
+
after: s != null ? j(i, s) : i
|
|
541
541
|
});
|
|
542
542
|
}, jt = (t) => {
|
|
543
|
-
const e = t.getFullYear(),
|
|
544
|
-
return `${e}-${
|
|
543
|
+
const e = t.getFullYear(), a = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), s = t.getMinutes(), o = t.getSeconds();
|
|
544
|
+
return `${e}-${a.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
|
|
545
545
|
}, pe = (t) => {
|
|
546
|
-
const { value: e, onBlur:
|
|
546
|
+
const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, i = p.map(e, (l) => l != null ? jt(l) : null), c = z(e, o, n ?? r);
|
|
547
547
|
return E({
|
|
548
548
|
...t,
|
|
549
549
|
input: ot["datetime-local"](
|
|
550
550
|
U(t),
|
|
551
551
|
u.value(p.map(i, (l) => l ?? null)),
|
|
552
552
|
u.class("bc-input"),
|
|
553
|
-
|
|
553
|
+
a != null ? M.blur(Z(a)) : A,
|
|
554
554
|
n != null ? M.change(nt(n)) : A,
|
|
555
555
|
r != null ? M.input(nt(r)) : A
|
|
556
556
|
),
|
|
557
|
-
after:
|
|
557
|
+
after: s != null ? j(c, s) : c
|
|
558
558
|
});
|
|
559
559
|
}, de = L($t), he = L(wt), ge = L(xt), fe = L(
|
|
560
560
|
gt
|
|
561
561
|
), me = ({
|
|
562
562
|
value: t,
|
|
563
563
|
onChange: e,
|
|
564
|
-
onInput:
|
|
564
|
+
onInput: a,
|
|
565
565
|
onBlur: n,
|
|
566
566
|
offLabel: r,
|
|
567
|
-
onLabel:
|
|
567
|
+
onLabel: s,
|
|
568
568
|
disabled: o = !1,
|
|
569
569
|
size: i = "md",
|
|
570
570
|
id: c,
|
|
@@ -573,38 +573,38 @@ const le = ({
|
|
|
573
573
|
matchInputHeight: f = !0
|
|
574
574
|
}) => {
|
|
575
575
|
const m = c ?? _t("switch");
|
|
576
|
-
function
|
|
577
|
-
const
|
|
576
|
+
function g(y, F) {
|
|
577
|
+
const w = [
|
|
578
578
|
"bc-switch",
|
|
579
|
-
`bc-switch--size-${
|
|
580
|
-
`bc-switch--${
|
|
579
|
+
`bc-switch--size-${F}`,
|
|
580
|
+
`bc-switch--${F}`
|
|
581
581
|
];
|
|
582
|
-
return f &&
|
|
582
|
+
return f && w.push("bc-switch--match-input"), y && w.push("bc-switch--disabled"), w.join(" ");
|
|
583
583
|
}
|
|
584
|
-
function
|
|
585
|
-
const
|
|
586
|
-
return
|
|
584
|
+
function b(y) {
|
|
585
|
+
const F = y ?? "primary", w = /* @__PURE__ */ new Map(), S = st(F, "solid", "light"), C = st(F, "solid", "dark");
|
|
586
|
+
return w.set("--switch-track-on-bg", S.backgroundColor), w.set("--switch-track-on-label", S.textColor), w.set("--switch-track-on-bg-dark", C.backgroundColor), w.set("--switch-track-on-label-dark", C.textColor), w.set(
|
|
587
587
|
"--switch-track-on-border-dark",
|
|
588
|
-
It(
|
|
589
|
-
), Array.from(
|
|
588
|
+
It(F, "dark")
|
|
589
|
+
), Array.from(w.entries()).map(([h, $]) => `${h}: ${$}`).join("; ");
|
|
590
590
|
}
|
|
591
591
|
const I = () => {
|
|
592
|
-
p.get(o) || (e?.(!p.get(t)),
|
|
592
|
+
p.get(o) || (e?.(!p.get(t)), a?.(!p.get(t)));
|
|
593
593
|
}, x = (y) => {
|
|
594
594
|
p.get(o) || (y.key === " " || y.key === "Enter") && (y.preventDefault(), I());
|
|
595
595
|
};
|
|
596
|
-
return
|
|
596
|
+
return _.div(
|
|
597
597
|
u.class(
|
|
598
598
|
D(
|
|
599
599
|
o ?? !1,
|
|
600
600
|
i
|
|
601
601
|
)(
|
|
602
|
-
(y,
|
|
602
|
+
(y, F) => g(y ?? !1, F ?? "md")
|
|
603
603
|
)
|
|
604
604
|
),
|
|
605
605
|
u.style(
|
|
606
606
|
D(l)(
|
|
607
|
-
(y) =>
|
|
607
|
+
(y) => b(y)
|
|
608
608
|
)
|
|
609
609
|
),
|
|
610
610
|
u.id(m),
|
|
@@ -613,14 +613,14 @@ const le = ({
|
|
|
613
613
|
D(
|
|
614
614
|
o ?? !1,
|
|
615
615
|
d
|
|
616
|
-
)((y,
|
|
616
|
+
)((y, F) => y ? -1 : F ?? 0)
|
|
617
617
|
),
|
|
618
618
|
N.checked(t),
|
|
619
619
|
N.disabled(o),
|
|
620
620
|
M.click(I),
|
|
621
621
|
M.keydown(x),
|
|
622
622
|
n != null ? M.blur(n) : null,
|
|
623
|
-
|
|
623
|
+
_.div(
|
|
624
624
|
u.class("bc-switch__track"),
|
|
625
625
|
u.class(
|
|
626
626
|
p.map(
|
|
@@ -628,7 +628,7 @@ const le = ({
|
|
|
628
628
|
(y) => y ? "bc-switch__track--on" : "bc-switch__track--off"
|
|
629
629
|
)
|
|
630
630
|
),
|
|
631
|
-
r != null ?
|
|
631
|
+
r != null ? _.div(
|
|
632
632
|
N.hidden(!0),
|
|
633
633
|
u.class("bc-switch__track-label bc-switch__track-label--off"),
|
|
634
634
|
u.class(
|
|
@@ -639,7 +639,7 @@ const le = ({
|
|
|
639
639
|
),
|
|
640
640
|
r
|
|
641
641
|
) : null,
|
|
642
|
-
|
|
642
|
+
s != null ? _.div(
|
|
643
643
|
u.class("bc-switch__track-label bc-switch__track-label--on"),
|
|
644
644
|
u.class(
|
|
645
645
|
p.map(
|
|
@@ -647,9 +647,9 @@ const le = ({
|
|
|
647
647
|
(y) => y ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
|
|
648
648
|
)
|
|
649
649
|
),
|
|
650
|
-
|
|
650
|
+
s
|
|
651
651
|
) : null,
|
|
652
|
-
|
|
652
|
+
_.div(
|
|
653
653
|
u.class("bc-switch__thumb"),
|
|
654
654
|
u.class(
|
|
655
655
|
p.map(
|
|
@@ -663,79 +663,80 @@ const le = ({
|
|
|
663
663
|
}, be = L(ft), zt = "line-md:star-alt-filled", Xt = "line-md:star-alt", Yt = (t) => {
|
|
664
664
|
const {
|
|
665
665
|
value: e,
|
|
666
|
-
onChange:
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
666
|
+
onChange: a,
|
|
667
|
+
onInput: n,
|
|
668
|
+
disabled: r,
|
|
669
|
+
max: s = 5,
|
|
670
|
+
fullColor: o = "yellow",
|
|
671
|
+
emptyColor: i = "neutral",
|
|
672
|
+
fullIcon: c = zt,
|
|
673
|
+
emptyIcon: l = Xt,
|
|
674
|
+
size: d = "md",
|
|
675
|
+
onBlur: f,
|
|
676
|
+
rounding: m = 1
|
|
677
|
+
} = t, g = () => {
|
|
678
|
+
const w = p.get(m);
|
|
679
|
+
return w > 0 ? w : 1;
|
|
680
|
+
}, b = (w) => Math.min(Math.max(w, 0), p.get(s)), I = (w, S) => {
|
|
681
|
+
if (p.get(r ?? !1)) return;
|
|
682
|
+
const h = w.currentTarget.getBoundingClientRect(), $ = (w.clientX - h.left) / h.width, k = S - 1 + $, T = g(), v = Math.ceil(k / T) * T, R = b(v);
|
|
683
|
+
a?.(R), n?.(R);
|
|
684
|
+
}, x = (w) => {
|
|
685
|
+
if (p.get(r ?? !1)) return;
|
|
686
|
+
const S = g(), C = p.get(e) ?? 0;
|
|
687
|
+
let h;
|
|
688
|
+
switch (w.key) {
|
|
688
689
|
case "ArrowRight":
|
|
689
690
|
case "ArrowUp":
|
|
690
|
-
|
|
691
|
+
h = b(C + S);
|
|
691
692
|
break;
|
|
692
693
|
case "ArrowLeft":
|
|
693
694
|
case "ArrowDown":
|
|
694
|
-
|
|
695
|
+
h = b(C - S);
|
|
695
696
|
break;
|
|
696
697
|
case "Home":
|
|
697
|
-
|
|
698
|
+
h = 0;
|
|
698
699
|
break;
|
|
699
700
|
case "End":
|
|
700
|
-
|
|
701
|
+
h = p.get(s);
|
|
701
702
|
break;
|
|
702
703
|
default:
|
|
703
704
|
return;
|
|
704
705
|
}
|
|
705
|
-
|
|
706
|
-
},
|
|
706
|
+
w.preventDefault(), a?.(h), n?.(h);
|
|
707
|
+
}, y = p.map(d, (w) => `bc-icon--${w}`), F = ({ index: w, counter: S }) => _.span(
|
|
707
708
|
u.class("bc-rating-input__icon-container"),
|
|
708
|
-
u.class(
|
|
709
|
+
u.class(y),
|
|
709
710
|
q(
|
|
710
711
|
{
|
|
711
|
-
icon:
|
|
712
|
-
size:
|
|
713
|
-
color:
|
|
712
|
+
icon: l,
|
|
713
|
+
size: d,
|
|
714
|
+
color: i,
|
|
714
715
|
tone: "soft"
|
|
715
716
|
},
|
|
716
717
|
u.class("bc-rating-input__icon-empty")
|
|
717
718
|
),
|
|
718
|
-
|
|
719
|
+
_.span(
|
|
719
720
|
u.class("bc-rating-input__icon-clipper"),
|
|
720
|
-
u.class(
|
|
721
|
+
u.class(y),
|
|
721
722
|
pt.width(
|
|
722
|
-
p.map(e, (
|
|
723
|
-
const
|
|
724
|
-
return
|
|
723
|
+
p.map(e, (C) => {
|
|
724
|
+
const h = Math.floor(C);
|
|
725
|
+
return h > w ? "100%" : h < w ? "0%" : `${(C - w) * 100}%`;
|
|
725
726
|
})
|
|
726
727
|
),
|
|
727
728
|
q(
|
|
728
729
|
{
|
|
729
|
-
icon:
|
|
730
|
-
size:
|
|
731
|
-
color:
|
|
730
|
+
icon: c,
|
|
731
|
+
size: d,
|
|
732
|
+
color: o,
|
|
732
733
|
tone: "soft"
|
|
733
734
|
},
|
|
734
735
|
u.class("bc-rating-input__icon-full")
|
|
735
736
|
)
|
|
736
737
|
),
|
|
737
738
|
M.click(
|
|
738
|
-
dt((
|
|
739
|
+
dt((C) => I(C, S), {
|
|
739
740
|
preventDefault: !0,
|
|
740
741
|
stopPropagation: !0
|
|
741
742
|
})
|
|
@@ -746,66 +747,66 @@ const le = ({
|
|
|
746
747
|
growInput: !1,
|
|
747
748
|
focusableSelector: '[role="slider"]',
|
|
748
749
|
...t,
|
|
749
|
-
input:
|
|
750
|
+
input: _.div(
|
|
750
751
|
// Common input attributes (id, required, invalid, custom classes, etc.)
|
|
751
752
|
U(t),
|
|
752
753
|
u.class("bc-rating-input"),
|
|
753
754
|
// ARIA slider semantics
|
|
754
755
|
u.role("slider"),
|
|
755
|
-
u.tabindex(p.map(
|
|
756
|
-
N.disabled(
|
|
756
|
+
u.tabindex(p.map(r ?? !1, (w) => w ? -1 : 0)),
|
|
757
|
+
N.disabled(r ?? !1),
|
|
757
758
|
N.valuemin(0),
|
|
758
|
-
N.valuemax(p.map(
|
|
759
|
-
N.valuenow(p.map(e, (
|
|
759
|
+
N.valuemax(p.map(s, (w) => w ?? 0)),
|
|
760
|
+
N.valuenow(p.map(e, (w) => w ?? 0)),
|
|
760
761
|
N.valuetext(
|
|
761
762
|
D(
|
|
762
763
|
e,
|
|
763
|
-
|
|
764
|
-
)((
|
|
765
|
-
const
|
|
766
|
-
return `${String(
|
|
764
|
+
s
|
|
765
|
+
)((w, S) => {
|
|
766
|
+
const C = w ?? 0, h = S ?? 0;
|
|
767
|
+
return `${String(C)} / ${String(h)}`;
|
|
767
768
|
})
|
|
768
769
|
),
|
|
769
770
|
// Keyboard & focus handlers
|
|
770
|
-
M.keydown(
|
|
771
|
-
|
|
772
|
-
ut(
|
|
771
|
+
M.keydown(x),
|
|
772
|
+
f != null ? M.blur(f) : null,
|
|
773
|
+
ut(s, F)
|
|
773
774
|
)
|
|
774
775
|
});
|
|
775
776
|
}, we = (t) => {
|
|
776
|
-
const { value: e, onChange:
|
|
777
|
+
const { value: e, onChange: a, onInput: n, onBlur: r, after: s, disabled: o, ...i } = t, c = z(e, o, a ?? n);
|
|
777
778
|
return Yt({
|
|
778
779
|
...i,
|
|
779
780
|
// Map null -> 0 for display so the control shows as empty when null
|
|
780
781
|
value: p.map(e, (l) => l ?? 0),
|
|
781
782
|
// Pass through numeric changes; clear button will call onChange(null)
|
|
782
|
-
onChange:
|
|
783
|
+
onChange: a,
|
|
783
784
|
onInput: n,
|
|
784
785
|
onBlur: r,
|
|
785
|
-
after:
|
|
786
|
+
after: s != null ? j(c, s) : c
|
|
786
787
|
});
|
|
787
788
|
}, ye = (t) => {
|
|
788
|
-
const { value: e, step:
|
|
789
|
+
const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: i } = t;
|
|
789
790
|
return E({
|
|
790
791
|
...t,
|
|
791
792
|
// Make sure clicks anywhere focus the range input
|
|
792
793
|
focusableSelector: 'input[type="range"]',
|
|
793
|
-
input:
|
|
794
|
+
input: _.input(
|
|
794
795
|
u.type("range"),
|
|
795
796
|
U(t),
|
|
796
797
|
u.min(n),
|
|
797
798
|
u.max(r),
|
|
798
|
-
u.step(
|
|
799
|
+
u.step(a),
|
|
799
800
|
// Using value as number to keep it in sync
|
|
800
801
|
u.valueAsNumber(e),
|
|
801
802
|
u.class("bc-input bc-slider-input"),
|
|
802
|
-
|
|
803
|
+
s != null ? M.blur(V(s)) : A,
|
|
803
804
|
o != null ? M.change(V(o)) : A,
|
|
804
805
|
i != null ? M.input(V(i)) : A
|
|
805
806
|
)
|
|
806
807
|
});
|
|
807
808
|
}, Ie = (t) => {
|
|
808
|
-
const { value: e, step:
|
|
809
|
+
const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: i } = t, c = p.map(e, (d) => {
|
|
809
810
|
if (d != null) return d;
|
|
810
811
|
const f = n != null ? p.get(n) : void 0;
|
|
811
812
|
return typeof f == "number" ? f : 0;
|
|
@@ -818,15 +819,15 @@ const le = ({
|
|
|
818
819
|
...t,
|
|
819
820
|
focusableSelector: 'input[type="range"]',
|
|
820
821
|
after: l,
|
|
821
|
-
input:
|
|
822
|
+
input: _.input(
|
|
822
823
|
u.type("range"),
|
|
823
824
|
U(t),
|
|
824
825
|
u.min(n),
|
|
825
826
|
u.max(r),
|
|
826
|
-
u.step(
|
|
827
|
+
u.step(a),
|
|
827
828
|
u.valueAsNumber(c),
|
|
828
829
|
u.class("bc-input bc-slider-input"),
|
|
829
|
-
|
|
830
|
+
s != null ? M.blur(V(s)) : A,
|
|
830
831
|
o != null ? M.change(
|
|
831
832
|
V((d) => {
|
|
832
833
|
o(d);
|
|
@@ -847,25 +848,25 @@ class Gt {
|
|
|
847
848
|
/**
|
|
848
849
|
* Register a custom widget
|
|
849
850
|
*/
|
|
850
|
-
register(e,
|
|
851
|
-
if (this.widgets.set(e,
|
|
852
|
-
for (const n of
|
|
853
|
-
this.typeMapping.has(n) || this.typeMapping.set(n, []), this.typeMapping.get(n).push(e), this.typeMapping.get(n).sort((r,
|
|
851
|
+
register(e, a) {
|
|
852
|
+
if (this.widgets.set(e, a), a.supportedTypes)
|
|
853
|
+
for (const n of a.supportedTypes)
|
|
854
|
+
this.typeMapping.has(n) || this.typeMapping.set(n, []), this.typeMapping.get(n).push(e), this.typeMapping.get(n).sort((r, s) => {
|
|
854
855
|
const o = this.widgets.get(r)?.priority || 0;
|
|
855
|
-
return (this.widgets.get(
|
|
856
|
+
return (this.widgets.get(s)?.priority || 0) - o;
|
|
856
857
|
});
|
|
857
858
|
}
|
|
858
859
|
/**
|
|
859
860
|
* Unregister a widget
|
|
860
861
|
*/
|
|
861
862
|
unregister(e) {
|
|
862
|
-
const
|
|
863
|
-
if (
|
|
864
|
-
for (const n of
|
|
863
|
+
const a = this.widgets.get(e);
|
|
864
|
+
if (a && (this.widgets.delete(e), a.supportedTypes))
|
|
865
|
+
for (const n of a.supportedTypes) {
|
|
865
866
|
const r = this.typeMapping.get(n);
|
|
866
867
|
if (r) {
|
|
867
|
-
const
|
|
868
|
-
|
|
868
|
+
const s = r.indexOf(e);
|
|
869
|
+
s >= 0 && r.splice(s, 1), r.length === 0 && this.typeMapping.delete(n);
|
|
869
870
|
}
|
|
870
871
|
}
|
|
871
872
|
}
|
|
@@ -891,26 +892,26 @@ class Gt {
|
|
|
891
892
|
* Find the best widget for a schema context
|
|
892
893
|
*/
|
|
893
894
|
findBestWidget(e) {
|
|
894
|
-
const
|
|
895
|
-
if (
|
|
896
|
-
const r = this.widgets.get(
|
|
895
|
+
const a = kt(e.definition, e.name);
|
|
896
|
+
if (a?.widget) {
|
|
897
|
+
const r = this.widgets.get(a.widget);
|
|
897
898
|
if (r)
|
|
898
|
-
return { name:
|
|
899
|
+
return { name: a.widget, registration: r, resolved: a };
|
|
899
900
|
}
|
|
900
901
|
const n = [];
|
|
901
|
-
for (const [r,
|
|
902
|
-
if (
|
|
902
|
+
for (const [r, s] of this.widgets.entries())
|
|
903
|
+
if (s.matcher)
|
|
903
904
|
try {
|
|
904
|
-
|
|
905
|
+
s.matcher(e) && n.push({
|
|
905
906
|
name: r,
|
|
906
|
-
registration:
|
|
907
|
-
priority:
|
|
907
|
+
registration: s,
|
|
908
|
+
priority: s.priority ?? 0
|
|
908
909
|
});
|
|
909
910
|
} catch (o) {
|
|
910
911
|
console.warn(`Error in matcher for widget "${r}":`, o);
|
|
911
912
|
}
|
|
912
913
|
if (n.length > 0) {
|
|
913
|
-
n.sort((
|
|
914
|
+
n.sort((s, o) => o.priority - s.priority);
|
|
914
915
|
const r = n[0];
|
|
915
916
|
return {
|
|
916
917
|
name: r.name,
|
|
@@ -919,12 +920,12 @@ class Gt {
|
|
|
919
920
|
};
|
|
920
921
|
}
|
|
921
922
|
if (typeof e.definition == "object" && e.definition.type) {
|
|
922
|
-
const r = Array.isArray(e.definition.type) ? e.definition.type[0] : e.definition.type,
|
|
923
|
-
if (
|
|
923
|
+
const r = Array.isArray(e.definition.type) ? e.definition.type[0] : e.definition.type, s = this.getForType(r);
|
|
924
|
+
if (s.length > 0) {
|
|
924
925
|
const o = this.typeMapping.get(r)[0];
|
|
925
926
|
return {
|
|
926
927
|
name: o,
|
|
927
|
-
registration:
|
|
928
|
+
registration: s[0],
|
|
928
929
|
resolved: { widget: o, source: "type-fallback" }
|
|
929
930
|
};
|
|
930
931
|
}
|
|
@@ -933,34 +934,34 @@ class Gt {
|
|
|
933
934
|
}
|
|
934
935
|
}
|
|
935
936
|
const $e = new Gt();
|
|
936
|
-
function xe(t, e,
|
|
937
|
+
function xe(t, e, a) {
|
|
937
938
|
return {
|
|
938
939
|
factory: e,
|
|
939
940
|
matcher: (n) => {
|
|
940
|
-
const
|
|
941
|
-
return
|
|
941
|
+
const s = n.definition["x:ui"];
|
|
942
|
+
return s === t || typeof s == "object" && s !== null && s.widget === t;
|
|
942
943
|
},
|
|
943
|
-
displayName:
|
|
944
|
-
priority:
|
|
944
|
+
displayName: a?.displayName ?? t,
|
|
945
|
+
priority: a?.priority ?? 100,
|
|
945
946
|
// High priority for explicit matches
|
|
946
|
-
...
|
|
947
|
+
...a
|
|
947
948
|
};
|
|
948
949
|
}
|
|
949
|
-
function _e(t, e,
|
|
950
|
+
function _e(t, e, a) {
|
|
950
951
|
return {
|
|
951
952
|
factory: e,
|
|
952
953
|
matcher: (n) => n.definition.format === t,
|
|
953
|
-
displayName:
|
|
954
|
-
priority:
|
|
955
|
-
...
|
|
954
|
+
displayName: a?.displayName ?? `${t} widget`,
|
|
955
|
+
priority: a?.priority ?? 75,
|
|
956
|
+
...a
|
|
956
957
|
};
|
|
957
958
|
}
|
|
958
|
-
function ke(t, e,
|
|
959
|
+
function ke(t, e, a, n) {
|
|
959
960
|
return {
|
|
960
|
-
factory:
|
|
961
|
+
factory: a,
|
|
961
962
|
matcher: (r) => {
|
|
962
|
-
const
|
|
963
|
-
return
|
|
963
|
+
const s = r.definition;
|
|
964
|
+
return s.type === t && s.format === e;
|
|
964
965
|
},
|
|
965
966
|
displayName: n?.displayName ?? `${t}:${e} widget`,
|
|
966
967
|
priority: n?.priority ?? 80,
|
|
@@ -968,15 +969,15 @@ function ke(t, e, s, n) {
|
|
|
968
969
|
};
|
|
969
970
|
}
|
|
970
971
|
function Fe(t) {
|
|
971
|
-
const e = t?.logPrefix ?? "WIDGET_DIAG",
|
|
972
|
+
const e = t?.logPrefix ?? "WIDGET_DIAG", a = t?.filterFn ?? (() => !0);
|
|
972
973
|
return {
|
|
973
974
|
factory: () => null,
|
|
974
975
|
displayName: "Diagnostic Widget (never matches)",
|
|
975
976
|
priority: -1e3,
|
|
976
977
|
// Very low priority, should never actually match
|
|
977
978
|
matcher: (n) => {
|
|
978
|
-
if (!
|
|
979
|
-
const r = n.definition,
|
|
979
|
+
if (!a(n)) return !1;
|
|
980
|
+
const r = n.definition, s = {
|
|
980
981
|
name: n.name,
|
|
981
982
|
path: n.path.map(String),
|
|
982
983
|
type: r?.type,
|
|
@@ -984,8 +985,8 @@ function Fe(t) {
|
|
|
984
985
|
definition: r
|
|
985
986
|
};
|
|
986
987
|
return console.log(
|
|
987
|
-
`[${e}] name="${
|
|
988
|
-
), t?.onProcess?.(
|
|
988
|
+
`[${e}] name="${s.name ?? "ROOT"}" path=[${s.path.join(", ")}] type="${s.type ?? "unknown"}" hasRegistry=${s.hasRegistry}`
|
|
989
|
+
), t?.onProcess?.(s), !1;
|
|
989
990
|
}
|
|
990
991
|
};
|
|
991
992
|
}
|