@tempots/beatui 1.0.0 → 1.0.1
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-BQIhr3-R.js → auth-divider-CbME_yVQ.js} +13 -13
- package/dist/auth-divider-MMhfmLBu.cjs +1 -0
- package/dist/beatui.css +4 -8
- package/dist/beatui.tailwind.css +4 -8
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +5 -5
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +11 -11
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +3 -3
- package/dist/notice-B5wTXoTq.cjs +1 -0
- package/dist/{notice-E19wu9lA.js → notice-BKcyJD5w.js} +44 -44
- package/dist/types/components/form/input/bigint-input.d.ts +3 -3
- package/dist/types/components/form/input/create-nullable-string-input.d.ts +2 -2
- package/dist/types/components/form/input/date-time-input.d.ts +4 -4
- package/dist/types/components/form/input/email-input.d.ts +4 -4
- package/dist/types/components/form/input/nullable-bigint-input.d.ts +3 -3
- package/dist/types/components/form/input/nullable-date-time-input.d.ts +2 -2
- package/dist/types/components/form/input/nullable-email-input.d.ts +3 -3
- package/dist/widget-customization-B49MeU4E.cjs +1 -0
- package/dist/{widget-customization-Dkx7kNSe.js → widget-customization-DEiQ_31d.js} +327 -321
- package/package.json +1 -1
- package/dist/auth-divider-DvnUModP.cjs +0 -1
- package/dist/notice-_9XhdrFw.cjs +0 -1
- package/dist/widget-customization-DgW1SXN6.cjs +0 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { Value as p, prop as
|
|
2
|
-
import { F as
|
|
3
|
-
import { decodeBase64 as
|
|
4
|
-
import { I as
|
|
5
|
-
import { C as
|
|
6
|
-
import { B as
|
|
7
|
-
import { AutoSelect as
|
|
8
|
-
import {
|
|
9
|
-
import { s as
|
|
10
|
-
import { r as
|
|
11
|
-
function
|
|
1
|
+
import { Value as p, prop as ut, computedOf as D, html as x, attr as u, svg as ot, svgAttr as Q, Empty as S, on as I, When as z, Fragment as j, aria as B, emitValue as st, Use as ft, input as pt, emitValueAsNullableDate as ct, emitValueAsNullableDateTime as it, Repeat as mt, emit as bt, style as wt, emitValueAsNumber as E } from "@tempots/dom";
|
|
2
|
+
import { F as yt, N as X, T as Mt, U as It, a as $t } from "./deep-merge-BzIheQtH.js";
|
|
3
|
+
import { decodeBase64 as xt } from "@tempots/std";
|
|
4
|
+
import { I as P } from "./input-container-BvEcp7FU.js";
|
|
5
|
+
import { C as L, m as dt, T as _t } from "./text-input-DfqXolVe.js";
|
|
6
|
+
import { B as kt, I as tt, b as lt, a as Ft } from "./translations-B1_yyDUK.js";
|
|
7
|
+
import { AutoSelect as Ct } from "@tempots/ui";
|
|
8
|
+
import { E as Tt, P as St } from "./notice-BKcyJD5w.js";
|
|
9
|
+
import { s as At } from "./session-id-3KiilioY.js";
|
|
10
|
+
import { r as vt } from "./utils-vUtP6iPG.js";
|
|
11
|
+
function ht(t) {
|
|
12
12
|
if (typeof t != "string") return !1;
|
|
13
13
|
const e = t.startsWith("#") ? t.slice(1) : t;
|
|
14
14
|
return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Nt(t) {
|
|
17
17
|
if (typeof t != "string") return !1;
|
|
18
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
19
|
if (!a) return !1;
|
|
20
20
|
const [, n, r, s] = a, o = parseInt(n, 10), c = parseInt(r, 10), i = parseInt(s, 10);
|
|
21
21
|
return o >= 0 && o <= 255 && c >= 0 && c <= 255 && i >= 0 && i <= 255;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Rt(t) {
|
|
24
24
|
if (typeof t != "string") return !1;
|
|
25
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
26
|
if (!a) return !1;
|
|
27
27
|
const [, n, r, s, o] = a, c = parseInt(n, 10), i = parseInt(r, 10), l = parseInt(s, 10), d = parseFloat(o);
|
|
28
28
|
return c >= 0 && c <= 255 && i >= 0 && i <= 255 && l >= 0 && l <= 255 && d >= 0 && d <= 1;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Bt(t) {
|
|
31
31
|
if (typeof t != "string") return !1;
|
|
32
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
33
|
if (!a) return !1;
|
|
34
34
|
const [, n, r, s] = a, o = parseInt(n, 10), c = parseInt(r, 10), i = parseInt(s, 10);
|
|
35
35
|
return o >= 0 && o <= 360 && c >= 0 && c <= 100 && i >= 0 && i <= 100;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function de(t) {
|
|
38
|
+
return ht(t) || Nt(t) || Rt(t) || Bt(t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
if (!
|
|
40
|
+
function Dt(t) {
|
|
41
|
+
if (!ht(t)) return null;
|
|
42
42
|
let e = t.startsWith("#") ? t.slice(1) : t;
|
|
43
43
|
return e.length === 3 && (e = e.split("").map((a) => a + a).join("")), `#${e.toLowerCase()}`;
|
|
44
44
|
}
|
|
@@ -49,8 +49,8 @@ function et(t, e, a) {
|
|
|
49
49
|
};
|
|
50
50
|
return `#${n(t)}${n(e)}${n(a)}`;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const e =
|
|
52
|
+
function H(t) {
|
|
53
|
+
const e = Dt(t);
|
|
54
54
|
if (!e) return null;
|
|
55
55
|
const a = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
56
56
|
return a ? {
|
|
@@ -59,16 +59,16 @@ function z(t) {
|
|
|
59
59
|
b: parseInt(a[3], 16)
|
|
60
60
|
} : null;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const a =
|
|
62
|
+
function he(t, e) {
|
|
63
|
+
const a = H(t), n = H(e);
|
|
64
64
|
if (!a || !n) return null;
|
|
65
|
-
const r = (l, d,
|
|
66
|
-
const [
|
|
67
|
-
return 0.2126 *
|
|
65
|
+
const r = (l, d, h) => {
|
|
66
|
+
const [y, f, g] = [l, d, h].map((M) => (M = M / 255, M <= 0.03928 ? M / 12.92 : Math.pow((M + 0.055) / 1.055, 2.4)));
|
|
67
|
+
return 0.2126 * y + 0.7152 * f + 0.0722 * g;
|
|
68
68
|
}, s = r(a.r, a.g, a.b), o = r(n.r, n.g, n.b), c = Math.max(s, o), i = Math.min(s, o);
|
|
69
69
|
return (c + 0.05) / (i + 0.05);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Vt(t) {
|
|
72
72
|
if (!t) return [0, 0, 0, 1];
|
|
73
73
|
const a = t.trim().match(
|
|
74
74
|
/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
|
|
@@ -76,8 +76,8 @@ function Dt(t) {
|
|
|
76
76
|
if (a) {
|
|
77
77
|
const l = a[1];
|
|
78
78
|
if (l.length === 8) {
|
|
79
|
-
const d = parseInt(l.slice(0, 2), 16),
|
|
80
|
-
return [d,
|
|
79
|
+
const d = parseInt(l.slice(0, 2), 16), h = parseInt(l.slice(2, 4), 16), y = parseInt(l.slice(4, 6), 16), f = parseInt(l.slice(6, 8), 16) / 255;
|
|
80
|
+
return [d, h, y, f];
|
|
81
81
|
}
|
|
82
82
|
if (l.length === 6)
|
|
83
83
|
return [
|
|
@@ -87,12 +87,12 @@ function Dt(t) {
|
|
|
87
87
|
1
|
|
88
88
|
];
|
|
89
89
|
if (l.length === 4) {
|
|
90
|
-
const d = parseInt(l[0] + l[0], 16),
|
|
91
|
-
return [d,
|
|
90
|
+
const d = parseInt(l[0] + l[0], 16), h = parseInt(l[1] + l[1], 16), y = parseInt(l[2] + l[2], 16), f = parseInt(l[3] + l[3], 16) / 255;
|
|
91
|
+
return [d, h, y, f];
|
|
92
92
|
}
|
|
93
93
|
if (l.length === 3) {
|
|
94
|
-
const d = parseInt(l[0] + l[0], 16),
|
|
95
|
-
return [d,
|
|
94
|
+
const d = parseInt(l[0] + l[0], 16), h = parseInt(l[1] + l[1], 16), y = parseInt(l[2] + l[2], 16);
|
|
95
|
+
return [d, h, y, 1];
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
const n = t.match(
|
|
@@ -114,39 +114,39 @@ function Dt(t) {
|
|
|
114
114
|
/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
115
115
|
);
|
|
116
116
|
if (s) {
|
|
117
|
-
const l = parseFloat(s[1]), d = parseFloat(s[2]),
|
|
118
|
-
return [
|
|
117
|
+
const l = parseFloat(s[1]), d = parseFloat(s[2]), h = parseFloat(s[3]), y = s[4] != null ? parseFloat(s[4]) : 1, [f, g, M] = gt(l, d / 100, h / 100);
|
|
118
|
+
return [f, g, M, y];
|
|
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,
|
|
125
|
-
return [
|
|
124
|
+
const l = parseFloat(o[1]), d = parseFloat(o[2]) / 100, h = parseFloat(o[3]) / 100, y = o[4] != null ? parseFloat(o[4]) : 1, [f, g, M] = Lt(l, d, h);
|
|
125
|
+
return [f, g, M, y];
|
|
126
126
|
}
|
|
127
127
|
const c = t.match(
|
|
128
128
|
/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
|
|
129
129
|
);
|
|
130
130
|
if (c) {
|
|
131
|
-
const l = c[1], d = parseFloat(c[2]),
|
|
132
|
-
return [
|
|
131
|
+
const l = c[1], d = parseFloat(c[2]), h = parseFloat(c[3]), y = c[4] != null ? parseFloat(c[4]) : 1, f = l.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(l) / 100)) : Math.max(0, Math.min(1, parseFloat(l))), [g, M, k] = Ut(f, d, h);
|
|
132
|
+
return [g, M, k, y];
|
|
133
133
|
}
|
|
134
|
-
const i =
|
|
134
|
+
const i = H(t);
|
|
135
135
|
return i ? [i.r, i.g, i.b, 1] : [0, 0, 0, 1];
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function Et(t, e, a, n) {
|
|
138
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
|
)})`;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Pt(t) {
|
|
144
144
|
let e = t + 1831565813;
|
|
145
145
|
return function() {
|
|
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
|
|
149
|
+
function gt(t, e, a) {
|
|
150
150
|
t = (t % 360 + 360) % 360;
|
|
151
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, c, i;
|
|
@@ -160,7 +160,7 @@ function Lt(t, e, a) {
|
|
|
160
160
|
t = (t % 360 + 360) % 360;
|
|
161
161
|
const n = e + a;
|
|
162
162
|
n > 1 && (e /= n, a /= n);
|
|
163
|
-
const [r, s, o] =
|
|
163
|
+
const [r, s, o] = gt(t, 1, 0.5).map((h) => h / 255), c = 1 - e - a, i = r * c + e, l = s * c + e, d = o * c + e;
|
|
164
164
|
return [Math.round(i * 255), Math.round(l * 255), Math.round(d * 255)];
|
|
165
165
|
}
|
|
166
166
|
function nt(t, e, a) {
|
|
@@ -195,14 +195,14 @@ function Z(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 Pt(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, c = t - 0.1055613458 * r - 0.0638541728 * s, i = t - 0.0894841775 * r - 1.291485548 * s, l = o * o * o, d = c * c * c, g = i * i * i, m = 4.0767416621 * l - 3.3077115913 * d + 0.2309699292 * g, h = -1.2684380046 * l + 2.6097574011 * d - 0.3413193965 * g, b = -0.0041960863 * l - 0.7034186147 * d + 1.707614701 * g;
|
|
200
|
-
return [Z(m), Z(h), Z(b)];
|
|
201
|
-
}
|
|
202
198
|
function Ut(t, e, a) {
|
|
203
|
-
const n =
|
|
204
|
-
|
|
205
|
-
|
|
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, c = t - 0.1055613458 * r - 0.0638541728 * s, i = t - 0.0894841775 * r - 1.291485548 * s, l = o * o * o, d = c * c * c, h = i * i * i, y = 4.0767416621 * l - 3.3077115913 * d + 0.2309699292 * h, f = -1.2684380046 * l + 2.6097574011 * d - 0.3413193965 * h, g = -0.0041960863 * l - 0.7034186147 * d + 1.707614701 * h;
|
|
200
|
+
return [Z(y), Z(f), Z(g)];
|
|
201
|
+
}
|
|
202
|
+
function Wt(t, e, a) {
|
|
203
|
+
const n = J(t), r = J(e), s = J(a), o = 0.4122214708 * n + 0.5363325363 * r + 0.0514459929 * s, c = 0.2119034982 * n + 0.6806995451 * r + 0.1073969566 * s, i = 0.0883024619 * n + 0.2817188376 * r + 0.6299787005 * s, l = Math.cbrt(o), d = Math.cbrt(c), h = Math.cbrt(i), y = 0.2104542553 * l + 0.793617785 * d - 0.0040720468 * h, f = 1.9779984951 * l - 2.428592205 * d + 0.4505937099 * h, g = 0.0259040371 * l + 0.7827717662 * d - 0.808675766 * h, M = Math.sqrt(f * f + g * g);
|
|
204
|
+
let k = Math.atan2(g, f) * 180 / Math.PI;
|
|
205
|
+
return k < 0 && (k += 360), [y, M, k];
|
|
206
206
|
}
|
|
207
207
|
function U(t, e, a, n, r, s) {
|
|
208
208
|
switch (r) {
|
|
@@ -229,15 +229,15 @@ function U(t, e, a, n, r, s) {
|
|
|
229
229
|
return n < 1 ? `hwb(${o} ${c}% ${i}% / ${Math.round(n * 100) / 100})` : `hwb(${o} ${c}% ${i}%)`;
|
|
230
230
|
}
|
|
231
231
|
case "oklch": {
|
|
232
|
-
const [o, c, i] =
|
|
233
|
-
return s || n < 1 ? `oklch(${l} ${d} ${
|
|
232
|
+
const [o, c, i] = Wt(t, e, a), l = (Math.round(o * 1e3) / 1e3).toFixed(3), d = (Math.round(c * 1e3) / 1e3).toFixed(3), h = (Math.round(i * 10) / 10).toFixed(1), y = Math.round(n * 100) / 100;
|
|
233
|
+
return s || n < 1 ? `oklch(${l} ${d} ${h} / ${y})` : `oklch(${l} ${d} ${h})`;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
function W(t, e) {
|
|
238
238
|
return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
|
|
239
239
|
}
|
|
240
|
-
async function
|
|
240
|
+
async function zt(t) {
|
|
241
241
|
return new Promise((e, a) => {
|
|
242
242
|
const n = new FileReader();
|
|
243
243
|
n.readAsDataURL(t), n.onload = () => {
|
|
@@ -247,9 +247,9 @@ async function Wt(t) {
|
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
function Ht(t) {
|
|
250
|
-
return Promise.all(t.map(
|
|
250
|
+
return Promise.all(t.map(zt));
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function jt(t) {
|
|
253
253
|
if (t.length >= 4) {
|
|
254
254
|
if (t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71)
|
|
255
255
|
return "image/png";
|
|
@@ -265,45 +265,45 @@ function zt(t) {
|
|
|
265
265
|
}
|
|
266
266
|
return "application/octet-stream";
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
const e =
|
|
268
|
+
function Xt(t) {
|
|
269
|
+
const e = xt(t ?? ""), a = e.length, n = new Uint8Array(a);
|
|
270
270
|
for (let r = 0; r < a; r++) n[r] = e.charCodeAt(r);
|
|
271
271
|
return n;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Yt(t) {
|
|
274
274
|
const {
|
|
275
275
|
value: e,
|
|
276
276
|
onChange: a,
|
|
277
277
|
onInput: n,
|
|
278
278
|
...r
|
|
279
|
-
} = t, s = /* @__PURE__ */ new Map(), o = p.toSignal(e).map((d) => d.map((
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
), F = new Blob([
|
|
284
|
-
return new File([F],
|
|
285
|
-
})), c = (d) => (
|
|
286
|
-
d && Ht(
|
|
287
|
-
for (const [
|
|
288
|
-
s.set(
|
|
289
|
-
d(
|
|
279
|
+
} = t, s = /* @__PURE__ */ new Map(), o = p.toSignal(e).map((d) => d.map((h, y) => {
|
|
280
|
+
const f = s.get(h), g = Xt(h ?? ""), M = f?.type || jt(g), k = f?.name ?? `file-${y}`, w = g.buffer.slice(
|
|
281
|
+
g.byteOffset,
|
|
282
|
+
g.byteOffset + g.byteLength
|
|
283
|
+
), F = new Blob([w], { type: M });
|
|
284
|
+
return new File([F], k, { type: M });
|
|
285
|
+
})), c = (d) => (h) => {
|
|
286
|
+
d && Ht(h).then((y) => {
|
|
287
|
+
for (const [f, g] of y.entries())
|
|
288
|
+
s.set(g, { name: h[f].name, type: h[f].type });
|
|
289
|
+
d(y);
|
|
290
290
|
});
|
|
291
291
|
}, i = c(a), l = c(n);
|
|
292
|
-
return
|
|
292
|
+
return yt({
|
|
293
293
|
...r,
|
|
294
294
|
value: o,
|
|
295
295
|
onChange: i,
|
|
296
296
|
onInput: l
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function ge(t) {
|
|
300
300
|
const {
|
|
301
301
|
value: e,
|
|
302
302
|
onInput: a,
|
|
303
303
|
onChange: n,
|
|
304
304
|
...r
|
|
305
305
|
} = t;
|
|
306
|
-
return
|
|
306
|
+
return Yt({
|
|
307
307
|
...r,
|
|
308
308
|
maxFiles: 1,
|
|
309
309
|
value: p.map(e, (s) => s == null ? [] : [s]),
|
|
@@ -315,21 +315,21 @@ function he(t) {
|
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
const [a, n, r] = t, s = a << 16 ^ n << 8 ^ r, o =
|
|
320
|
-
for (let
|
|
321
|
-
const
|
|
322
|
-
l.push({ x:
|
|
318
|
+
function Gt(t, e) {
|
|
319
|
+
const [a, n, r] = t, s = a << 16 ^ n << 8 ^ r, o = Pt(s), c = 6 + Math.floor(o() * 5), i = 0.18 + o() * 0.06, l = [];
|
|
320
|
+
for (let f = 0; f < c; f++) {
|
|
321
|
+
const g = f / c * Math.PI * 2, M = e * (1 + (o() * 2 - 1) * i), k = Math.cos(g) * M, w = Math.sin(g) * M;
|
|
322
|
+
l.push({ x: k, y: w });
|
|
323
323
|
}
|
|
324
|
-
const d = (l[0].x + l[c - 1].x) / 2,
|
|
325
|
-
let
|
|
326
|
-
for (let
|
|
327
|
-
const
|
|
328
|
-
|
|
324
|
+
const d = (l[0].x + l[c - 1].x) / 2, h = (l[0].y + l[c - 1].y) / 2;
|
|
325
|
+
let y = `M ${d.toFixed(3)} ${h.toFixed(3)}`;
|
|
326
|
+
for (let f = 0; f < c; f++) {
|
|
327
|
+
const g = l[f], M = l[(f + 1) % c], k = (g.x + M.x) / 2, w = (g.y + M.y) / 2;
|
|
328
|
+
y += ` Q ${g.x.toFixed(3)} ${g.y.toFixed(3)} ${k.toFixed(3)} ${w.toFixed(3)}`;
|
|
329
329
|
}
|
|
330
|
-
return
|
|
330
|
+
return y += " Z", y;
|
|
331
331
|
}
|
|
332
|
-
const
|
|
332
|
+
const fe = (t) => {
|
|
333
333
|
const {
|
|
334
334
|
value: e,
|
|
335
335
|
onBlur: a,
|
|
@@ -338,133 +338,139 @@ const ge = (t) => {
|
|
|
338
338
|
displayValue: s,
|
|
339
339
|
swatchSize: o,
|
|
340
340
|
withAlpha: c
|
|
341
|
-
} = t, i =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
),
|
|
341
|
+
} = t, i = {
|
|
342
|
+
xs: 20,
|
|
343
|
+
sm: 26,
|
|
344
|
+
md: 32,
|
|
345
|
+
lg: 40,
|
|
346
|
+
xl: 52
|
|
347
|
+
}, l = o != null ? p.map(o, (m) => Number(m)) : p.map(t.size ?? "md", (m) => i[m] ?? 32), d = p.map(e, (m) => Vt(m ?? "#000000")), h = p.map(
|
|
348
348
|
d,
|
|
349
|
-
m,
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
([m, $, C]) => [m, $, C]
|
|
350
|
+
), y = p.map(d, ([, , , m]) => m), f = ut(p.get(y) ?? 1), g = p.map(c ?? !1, (m) => m), M = p.map(
|
|
351
|
+
t.colorTextFormat ?? "rgb",
|
|
352
|
+
(m) => m
|
|
353
|
+
), k = D(
|
|
354
|
+
h,
|
|
355
|
+
f,
|
|
356
|
+
M,
|
|
357
|
+
g
|
|
352
358
|
)(
|
|
353
|
-
([
|
|
354
|
-
),
|
|
359
|
+
([m, $, C], v, N, R) => U(m, $, C, v ?? 1, W(N, R), R)
|
|
360
|
+
), w = p.map(
|
|
355
361
|
t.colorTextFormat ?? "hex",
|
|
356
|
-
(
|
|
357
|
-
),
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
)((
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
(m) => m
|
|
363
|
+
), F = p.map(l, (m) => `${-m / 2} ${-m / 2} ${m} ${m}`), b = D(
|
|
364
|
+
h,
|
|
365
|
+
l
|
|
366
|
+
)((m, $) => Gt(m, $ / 2)), A = D(
|
|
367
|
+
h,
|
|
368
|
+
f,
|
|
369
|
+
g
|
|
364
370
|
)(
|
|
365
|
-
([
|
|
366
|
-
),
|
|
371
|
+
([m, $, C], v, N) => N || v < 1 ? Et(m, $, C, v) : et(m, $, C)
|
|
372
|
+
), T = x.div(
|
|
367
373
|
u.class("bc-color-swatch-input__control"),
|
|
368
374
|
u.class(
|
|
369
375
|
p.map(
|
|
370
|
-
|
|
371
|
-
(
|
|
376
|
+
g,
|
|
377
|
+
(m) => m ? "bc-color-swatch-input__control--alpha" : ""
|
|
372
378
|
)
|
|
373
379
|
),
|
|
374
380
|
u.style(
|
|
375
|
-
D(
|
|
381
|
+
D(l)((m) => `width:${m + 2}px;height:${m + 2}px`)
|
|
376
382
|
),
|
|
377
383
|
// The SVG blob preview
|
|
378
|
-
|
|
384
|
+
ot.svg(
|
|
379
385
|
u.class("bc-color-swatch-input__svg"),
|
|
380
|
-
Q.viewBox(
|
|
381
|
-
|
|
386
|
+
Q.viewBox(F),
|
|
387
|
+
ot.path(Q.d(b), Q.fill(A))
|
|
382
388
|
),
|
|
383
389
|
// Invisible native input overlays the blob for picker and accessibility
|
|
384
|
-
|
|
390
|
+
x.input(
|
|
385
391
|
u.type("color"),
|
|
386
|
-
|
|
392
|
+
L(t),
|
|
387
393
|
// Native color input needs hex without alpha
|
|
388
|
-
u.value(p.map(
|
|
394
|
+
u.value(p.map(h, ([m, $, C]) => et(m, $, C))),
|
|
389
395
|
u.class(
|
|
390
396
|
"bc-input bc-color-swatch-input bc-color-swatch-input__native"
|
|
391
397
|
),
|
|
392
398
|
a != null ? I.blur(a) : S,
|
|
393
|
-
n != null ? I.change((
|
|
394
|
-
const
|
|
399
|
+
n != null ? I.change((m) => {
|
|
400
|
+
const $ = m.target.value;
|
|
395
401
|
if (!n) return;
|
|
396
|
-
const { r: C, g: v, b: N } =
|
|
397
|
-
p.get(
|
|
398
|
-
p.get(
|
|
399
|
-
), q = U(C, v, N, R, V, p.get(
|
|
402
|
+
const { r: C, g: v, b: N } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(f) ?? 1, V = W(
|
|
403
|
+
p.get(w),
|
|
404
|
+
p.get(g)
|
|
405
|
+
), q = U(C, v, N, R, V, p.get(g));
|
|
400
406
|
n(q);
|
|
401
407
|
}) : S,
|
|
402
|
-
r != null ? I.input((
|
|
403
|
-
const
|
|
408
|
+
r != null ? I.input((m) => {
|
|
409
|
+
const $ = m.target.value;
|
|
404
410
|
if (!r) return;
|
|
405
|
-
const { r: C, g: v, b: N } =
|
|
406
|
-
p.get(
|
|
407
|
-
p.get(
|
|
408
|
-
), q = U(C, v, N, R, V, p.get(
|
|
411
|
+
const { r: C, g: v, b: N } = H($) ?? { r: 0, g: 0, b: 0 }, R = p.get(f) ?? 1, V = W(
|
|
412
|
+
p.get(w),
|
|
413
|
+
p.get(g)
|
|
414
|
+
), q = U(C, v, N, R, V, p.get(g));
|
|
409
415
|
r(q);
|
|
410
416
|
}) : S
|
|
411
417
|
)
|
|
412
|
-
),
|
|
413
|
-
|
|
414
|
-
() =>
|
|
418
|
+
), _ = z(
|
|
419
|
+
g,
|
|
420
|
+
() => x.input(
|
|
415
421
|
u.type("range"),
|
|
416
422
|
u.class("bc-color-swatch-input__alpha"),
|
|
417
423
|
u.min(0),
|
|
418
424
|
u.max(1),
|
|
419
425
|
u.step(0.01),
|
|
420
|
-
u.value(p.map(
|
|
426
|
+
u.value(p.map(f, (m) => String(m ?? 1))),
|
|
421
427
|
u.disabled(t.disabled),
|
|
422
|
-
I.input((
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
const [C, v, N] = p.get(
|
|
426
|
-
p.get(
|
|
427
|
-
p.get(
|
|
428
|
-
), V = U(C, v, N,
|
|
428
|
+
I.input((m) => {
|
|
429
|
+
const $ = parseFloat(m.target.value);
|
|
430
|
+
f.set($);
|
|
431
|
+
const [C, v, N] = p.get(h), R = W(
|
|
432
|
+
p.get(w),
|
|
433
|
+
p.get(g)
|
|
434
|
+
), V = U(C, v, N, $, R, p.get(g));
|
|
429
435
|
r?.(V);
|
|
430
436
|
}),
|
|
431
|
-
I.change((
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
const [C, v, N] = p.get(
|
|
435
|
-
p.get(
|
|
436
|
-
p.get(
|
|
437
|
-
), V = U(C, v, N,
|
|
437
|
+
I.change((m) => {
|
|
438
|
+
const $ = parseFloat(m.target.value);
|
|
439
|
+
f.set($);
|
|
440
|
+
const [C, v, N] = p.get(h), R = W(
|
|
441
|
+
p.get(w),
|
|
442
|
+
p.get(g)
|
|
443
|
+
), V = U(C, v, N, $, R, p.get(g));
|
|
438
444
|
n?.(V);
|
|
439
445
|
})
|
|
440
446
|
)
|
|
441
447
|
), {
|
|
442
|
-
swatchSize:
|
|
443
|
-
displayValue:
|
|
444
|
-
withAlpha:
|
|
445
|
-
colorTextFormat:
|
|
446
|
-
...
|
|
448
|
+
swatchSize: Y,
|
|
449
|
+
displayValue: at,
|
|
450
|
+
withAlpha: K,
|
|
451
|
+
colorTextFormat: rt,
|
|
452
|
+
...G
|
|
447
453
|
} = t;
|
|
448
|
-
return
|
|
454
|
+
return P({
|
|
449
455
|
baseContainer: !0,
|
|
450
|
-
...
|
|
456
|
+
...G,
|
|
451
457
|
// ensure our control does not try to grow
|
|
452
458
|
growInput: !1,
|
|
453
|
-
input:
|
|
459
|
+
input: T,
|
|
454
460
|
// If caller provided an `after`, append RGB before it
|
|
455
461
|
after: j(
|
|
456
|
-
|
|
462
|
+
z(
|
|
457
463
|
s ?? !1,
|
|
458
|
-
() =>
|
|
464
|
+
() => x.span(u.class("bc-color-swatch-input__rgb"), k)
|
|
459
465
|
),
|
|
460
|
-
|
|
466
|
+
_,
|
|
461
467
|
t.after
|
|
462
468
|
)
|
|
463
469
|
});
|
|
464
|
-
},
|
|
465
|
-
function
|
|
470
|
+
}, Kt = (t) => typeof t == "string" && t.trim() === "" ? null : t, qt = (t) => t ?? "";
|
|
471
|
+
function O(t) {
|
|
466
472
|
return (e) => {
|
|
467
|
-
const { after: a, disabled: n } = e, r =
|
|
473
|
+
const { after: a, disabled: n } = e, r = dt(e, qt, Kt), s = X(
|
|
468
474
|
e.value,
|
|
469
475
|
n,
|
|
470
476
|
e.onChange ?? e.onInput
|
|
@@ -475,15 +481,15 @@ function P(t) {
|
|
|
475
481
|
});
|
|
476
482
|
};
|
|
477
483
|
}
|
|
478
|
-
const
|
|
484
|
+
const me = ({
|
|
479
485
|
startEditing: t,
|
|
480
486
|
value: e,
|
|
481
487
|
onChange: a,
|
|
482
488
|
placeholder: n,
|
|
483
489
|
disabled: r
|
|
484
490
|
}) => {
|
|
485
|
-
const s = p.deriveProp(t ?? !1), o =
|
|
486
|
-
return
|
|
491
|
+
const s = p.deriveProp(t ?? !1), o = ut(!1), c = p.map(r ?? !1, (i) => i);
|
|
492
|
+
return x.div(
|
|
487
493
|
u.class("bc-editable-text"),
|
|
488
494
|
u.class(
|
|
489
495
|
p.map(
|
|
@@ -492,13 +498,13 @@ const fe = ({
|
|
|
492
498
|
)
|
|
493
499
|
),
|
|
494
500
|
B.disabled(c),
|
|
495
|
-
|
|
501
|
+
z(
|
|
496
502
|
s,
|
|
497
|
-
() =>
|
|
503
|
+
() => x.input(
|
|
498
504
|
u.placeholder(n),
|
|
499
505
|
u.value(e),
|
|
500
506
|
u.class("bc-editable-text__input"),
|
|
501
|
-
|
|
507
|
+
Ct(),
|
|
502
508
|
I.keydown((i) => {
|
|
503
509
|
i.key === "Enter" ? s.set(!1) : i.key === "Escape" && (o.set(!0), s.set(!1));
|
|
504
510
|
}),
|
|
@@ -512,25 +518,25 @@ const fe = ({
|
|
|
512
518
|
})
|
|
513
519
|
)
|
|
514
520
|
),
|
|
515
|
-
() =>
|
|
521
|
+
() => x.span(
|
|
516
522
|
I.click(() => {
|
|
517
523
|
p.get(c) || s.set(!0);
|
|
518
524
|
}),
|
|
519
525
|
u.class("bc-editable-text__display"),
|
|
520
|
-
|
|
526
|
+
z(
|
|
521
527
|
p.map(e, (i) => i != null && i.trim() !== ""),
|
|
522
|
-
() =>
|
|
523
|
-
() =>
|
|
528
|
+
() => x.span(u.class("bc-editable-text__text"), e),
|
|
529
|
+
() => x.span(
|
|
524
530
|
u.class("bc-editable-text__placeholder"),
|
|
525
531
|
n
|
|
526
532
|
)
|
|
527
533
|
),
|
|
528
|
-
|
|
534
|
+
z(
|
|
529
535
|
p.map(c, (i) => !i),
|
|
530
|
-
() =>
|
|
536
|
+
() => x.button(
|
|
531
537
|
u.type("button"),
|
|
532
538
|
u.class("bc-editable-text__edit-button"),
|
|
533
|
-
|
|
539
|
+
ft(kt, (i) => B.label(i.$.editLabel)),
|
|
534
540
|
I.click(() => s.set(!0)),
|
|
535
541
|
tt({ icon: "line-md/pencil", color: "neutral" })
|
|
536
542
|
)
|
|
@@ -538,40 +544,40 @@ const fe = ({
|
|
|
538
544
|
)
|
|
539
545
|
)
|
|
540
546
|
);
|
|
541
|
-
},
|
|
547
|
+
}, be = (t) => {
|
|
542
548
|
const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, c = X(e, o, n ?? r);
|
|
543
|
-
return
|
|
549
|
+
return P({
|
|
544
550
|
...t,
|
|
545
|
-
input:
|
|
546
|
-
|
|
551
|
+
input: pt.date(
|
|
552
|
+
L(t),
|
|
547
553
|
u.valueAsDate(e),
|
|
548
554
|
u.class("bc-input"),
|
|
549
555
|
a != null ? I.blur(st(a)) : S,
|
|
550
|
-
n != null ? I.change(
|
|
551
|
-
r != null ? I.input(
|
|
556
|
+
n != null ? I.change(ct(n)) : S,
|
|
557
|
+
r != null ? I.input(ct(r)) : S
|
|
552
558
|
),
|
|
553
559
|
after: s != null ? j(c, s) : c
|
|
554
560
|
});
|
|
555
|
-
},
|
|
561
|
+
}, Qt = (t) => {
|
|
556
562
|
const e = t.getFullYear(), a = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), s = t.getMinutes(), o = t.getSeconds();
|
|
557
563
|
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")}`;
|
|
558
|
-
},
|
|
559
|
-
const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, c = p.map(e, (l) => l != null ?
|
|
560
|
-
return
|
|
564
|
+
}, we = (t) => {
|
|
565
|
+
const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, c = p.map(e, (l) => l != null ? Qt(l) : null), i = X(e, o, n ?? r);
|
|
566
|
+
return P({
|
|
561
567
|
...t,
|
|
562
|
-
input:
|
|
563
|
-
|
|
568
|
+
input: pt["datetime-local"](
|
|
569
|
+
L(t),
|
|
564
570
|
u.value(p.map(c, (l) => l ?? null)),
|
|
565
571
|
u.class("bc-input"),
|
|
566
572
|
a != null ? I.blur(st(a)) : S,
|
|
567
|
-
n != null ? I.change(
|
|
568
|
-
r != null ? I.input(
|
|
573
|
+
n != null ? I.change(it(n)) : S,
|
|
574
|
+
r != null ? I.input(it(r)) : S
|
|
569
575
|
),
|
|
570
576
|
after: s != null ? j(i, s) : i
|
|
571
577
|
});
|
|
572
|
-
},
|
|
573
|
-
|
|
574
|
-
),
|
|
578
|
+
}, ye = O(Tt), Me = O(_t), Ie = O(St), $e = O(
|
|
579
|
+
Mt
|
|
580
|
+
), xe = ({
|
|
575
581
|
value: t,
|
|
576
582
|
onChange: e,
|
|
577
583
|
onInput: a,
|
|
@@ -583,97 +589,97 @@ const fe = ({
|
|
|
583
589
|
id: i,
|
|
584
590
|
color: l = "primary",
|
|
585
591
|
tabIndex: d = 0,
|
|
586
|
-
matchInputHeight:
|
|
592
|
+
matchInputHeight: h = !0
|
|
587
593
|
}) => {
|
|
588
|
-
const
|
|
589
|
-
function
|
|
590
|
-
const
|
|
594
|
+
const y = i ?? At("switch");
|
|
595
|
+
function f(w, F) {
|
|
596
|
+
const b = [
|
|
591
597
|
"bc-switch",
|
|
592
598
|
`bc-switch--size-${F}`,
|
|
593
599
|
`bc-switch--${F}`
|
|
594
600
|
];
|
|
595
|
-
return
|
|
601
|
+
return h && b.push("bc-switch--match-input"), w && b.push("bc-switch--disabled"), b.join(" ");
|
|
596
602
|
}
|
|
597
|
-
function
|
|
598
|
-
const F =
|
|
599
|
-
return
|
|
603
|
+
function g(w) {
|
|
604
|
+
const F = w ?? "primary", b = /* @__PURE__ */ new Map(), A = lt(F, "solid", "light"), T = lt(F, "solid", "dark");
|
|
605
|
+
return b.set("--switch-track-on-bg", A.backgroundColor), b.set("--switch-track-on-label", A.textColor), b.set("--switch-track-on-bg-dark", T.backgroundColor), b.set("--switch-track-on-label-dark", T.textColor), b.set(
|
|
600
606
|
"--switch-track-on-border-dark",
|
|
601
|
-
|
|
602
|
-
), Array.from(
|
|
607
|
+
Ft(F, "dark")
|
|
608
|
+
), Array.from(b.entries()).map(([_, Y]) => `${_}: ${Y}`).join("; ");
|
|
603
609
|
}
|
|
604
610
|
const M = () => {
|
|
605
611
|
p.get(o) || (e?.(!p.get(t)), a?.(!p.get(t)));
|
|
606
|
-
},
|
|
607
|
-
p.get(o) || (
|
|
612
|
+
}, k = (w) => {
|
|
613
|
+
p.get(o) || (w.key === " " || w.key === "Enter") && (w.preventDefault(), M());
|
|
608
614
|
};
|
|
609
|
-
return
|
|
615
|
+
return x.div(
|
|
610
616
|
u.class(
|
|
611
617
|
D(
|
|
612
618
|
o ?? !1,
|
|
613
619
|
c
|
|
614
620
|
)(
|
|
615
|
-
(
|
|
621
|
+
(w, F) => f(w ?? !1, F ?? "md")
|
|
616
622
|
)
|
|
617
623
|
),
|
|
618
624
|
u.style(
|
|
619
625
|
D(l)(
|
|
620
|
-
(
|
|
626
|
+
(w) => g(w)
|
|
621
627
|
)
|
|
622
628
|
),
|
|
623
|
-
u.id(
|
|
629
|
+
u.id(y),
|
|
624
630
|
u.role("switch"),
|
|
625
631
|
u.tabindex(
|
|
626
632
|
D(
|
|
627
633
|
o ?? !1,
|
|
628
634
|
d
|
|
629
|
-
)((
|
|
635
|
+
)((w, F) => w ? -1 : F ?? 0)
|
|
630
636
|
),
|
|
631
637
|
B.checked(t),
|
|
632
638
|
B.disabled(o),
|
|
633
639
|
I.click(M),
|
|
634
|
-
I.keydown(
|
|
640
|
+
I.keydown(k),
|
|
635
641
|
n != null ? I.blur(n) : null,
|
|
636
|
-
|
|
642
|
+
x.div(
|
|
637
643
|
u.class("bc-switch__track"),
|
|
638
644
|
u.class(
|
|
639
645
|
p.map(
|
|
640
646
|
t,
|
|
641
|
-
(
|
|
647
|
+
(w) => w ? "bc-switch__track--on" : "bc-switch__track--off"
|
|
642
648
|
)
|
|
643
649
|
),
|
|
644
|
-
r != null ?
|
|
650
|
+
r != null ? x.div(
|
|
645
651
|
B.hidden(!0),
|
|
646
652
|
u.class("bc-switch__track-label bc-switch__track-label--off"),
|
|
647
653
|
u.class(
|
|
648
654
|
p.map(
|
|
649
655
|
t,
|
|
650
|
-
(
|
|
656
|
+
(w) => w ? "bc-switch__track-label--hidden" : "bc-switch__track-label--visible"
|
|
651
657
|
)
|
|
652
658
|
),
|
|
653
659
|
r
|
|
654
660
|
) : null,
|
|
655
|
-
s != null ?
|
|
661
|
+
s != null ? x.div(
|
|
656
662
|
u.class("bc-switch__track-label bc-switch__track-label--on"),
|
|
657
663
|
u.class(
|
|
658
664
|
p.map(
|
|
659
665
|
t,
|
|
660
|
-
(
|
|
666
|
+
(w) => w ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
|
|
661
667
|
)
|
|
662
668
|
),
|
|
663
669
|
s
|
|
664
670
|
) : null,
|
|
665
|
-
|
|
671
|
+
x.div(
|
|
666
672
|
u.class("bc-switch__thumb"),
|
|
667
673
|
u.class(
|
|
668
674
|
p.map(
|
|
669
675
|
t,
|
|
670
|
-
(
|
|
676
|
+
(w) => w ? "bc-switch__thumb--on" : "bc-switch__thumb--off"
|
|
671
677
|
)
|
|
672
678
|
)
|
|
673
679
|
)
|
|
674
680
|
)
|
|
675
681
|
);
|
|
676
|
-
},
|
|
682
|
+
}, _e = O(It), Jt = "line-md:star-alt-filled", Zt = "line-md:star-alt", te = (t) => {
|
|
677
683
|
const {
|
|
678
684
|
value: e,
|
|
679
685
|
onChange: a,
|
|
@@ -682,44 +688,50 @@ const fe = ({
|
|
|
682
688
|
max: s = 5,
|
|
683
689
|
fullColor: o = "yellow",
|
|
684
690
|
emptyColor: c = "neutral",
|
|
685
|
-
activeIcon: i =
|
|
686
|
-
inactiveIcon: l =
|
|
691
|
+
activeIcon: i = Jt,
|
|
692
|
+
inactiveIcon: l = Zt,
|
|
687
693
|
size: d = "md",
|
|
688
|
-
onBlur:
|
|
689
|
-
rounding:
|
|
690
|
-
} = t,
|
|
691
|
-
const
|
|
692
|
-
return
|
|
693
|
-
},
|
|
694
|
+
onBlur: h,
|
|
695
|
+
rounding: y = 1
|
|
696
|
+
} = t, f = () => {
|
|
697
|
+
const b = p.get(y);
|
|
698
|
+
return b > 0 ? b : 1;
|
|
699
|
+
}, g = (b) => Math.min(Math.max(b, 0), p.get(s)), M = (b, A) => {
|
|
694
700
|
if (p.get(r ?? !1)) return;
|
|
695
|
-
const
|
|
696
|
-
a?.(
|
|
697
|
-
},
|
|
701
|
+
const _ = b.currentTarget.getBoundingClientRect(), Y = (b.clientX - _.left) / _.width, at = A - 1 + Y, K = f(), rt = Math.ceil(at / K) * K, G = g(rt);
|
|
702
|
+
a?.(G), n?.(G);
|
|
703
|
+
}, k = (b) => {
|
|
698
704
|
if (p.get(r ?? !1)) return;
|
|
699
|
-
const A =
|
|
700
|
-
let
|
|
701
|
-
switch (
|
|
705
|
+
const A = f(), T = p.get(e) ?? 0;
|
|
706
|
+
let _;
|
|
707
|
+
switch (b.key) {
|
|
702
708
|
case "ArrowRight":
|
|
703
709
|
case "ArrowUp":
|
|
704
|
-
|
|
710
|
+
_ = g(T + A);
|
|
705
711
|
break;
|
|
706
712
|
case "ArrowLeft":
|
|
707
713
|
case "ArrowDown":
|
|
708
|
-
|
|
714
|
+
_ = g(T - A);
|
|
709
715
|
break;
|
|
710
716
|
case "Home":
|
|
711
|
-
|
|
717
|
+
_ = 0;
|
|
712
718
|
break;
|
|
713
719
|
case "End":
|
|
714
|
-
|
|
720
|
+
_ = p.get(s);
|
|
715
721
|
break;
|
|
716
722
|
default:
|
|
717
723
|
return;
|
|
718
724
|
}
|
|
719
|
-
|
|
720
|
-
},
|
|
725
|
+
b.preventDefault(), a?.(_), n?.(_);
|
|
726
|
+
}, w = p.map(d, (b) => `bc-icon--${b}`), F = ({ index: b, counter: A }) => x.span(
|
|
721
727
|
u.class("bc-rating-input__icon-container"),
|
|
722
|
-
u.class(
|
|
728
|
+
u.class(w),
|
|
729
|
+
I.click(
|
|
730
|
+
bt((T) => M(T, A), {
|
|
731
|
+
preventDefault: !0,
|
|
732
|
+
stopPropagation: !0
|
|
733
|
+
})
|
|
734
|
+
),
|
|
723
735
|
tt(
|
|
724
736
|
{
|
|
725
737
|
icon: l,
|
|
@@ -729,13 +741,13 @@ const fe = ({
|
|
|
729
741
|
},
|
|
730
742
|
u.class("bc-rating-input__icon-empty")
|
|
731
743
|
),
|
|
732
|
-
|
|
744
|
+
x.span(
|
|
733
745
|
u.class("bc-rating-input__icon-clipper"),
|
|
734
|
-
u.class(
|
|
735
|
-
|
|
746
|
+
u.class(w),
|
|
747
|
+
wt.width(
|
|
736
748
|
p.map(e, (T) => {
|
|
737
|
-
const
|
|
738
|
-
return
|
|
749
|
+
const _ = Math.floor(T);
|
|
750
|
+
return _ > b ? "100%" : _ < b ? "0%" : `${(T - b) * 100}%`;
|
|
739
751
|
})
|
|
740
752
|
),
|
|
741
753
|
tt(
|
|
@@ -747,47 +759,41 @@ const fe = ({
|
|
|
747
759
|
},
|
|
748
760
|
u.class("bc-rating-input__icon-full")
|
|
749
761
|
)
|
|
750
|
-
),
|
|
751
|
-
I.click(
|
|
752
|
-
bt((T) => M(T, A), {
|
|
753
|
-
preventDefault: !0,
|
|
754
|
-
stopPropagation: !0
|
|
755
|
-
})
|
|
756
762
|
)
|
|
757
763
|
);
|
|
758
|
-
return
|
|
764
|
+
return P({
|
|
759
765
|
baseContainer: !0,
|
|
760
766
|
growInput: !1,
|
|
761
767
|
focusableSelector: '[role="slider"]',
|
|
762
768
|
...t,
|
|
763
|
-
input:
|
|
769
|
+
input: x.div(
|
|
764
770
|
// Common input attributes (id, required, invalid, custom classes, etc.)
|
|
765
|
-
|
|
771
|
+
L(t),
|
|
766
772
|
u.class("bc-rating-input"),
|
|
767
773
|
// ARIA slider semantics
|
|
768
774
|
u.role("slider"),
|
|
769
|
-
u.tabindex(p.map(r ?? !1, (
|
|
775
|
+
u.tabindex(p.map(r ?? !1, (b) => b ? -1 : 0)),
|
|
770
776
|
B.disabled(r ?? !1),
|
|
771
777
|
B.valuemin(0),
|
|
772
|
-
B.valuemax(p.map(s, (
|
|
773
|
-
B.valuenow(p.map(e, (
|
|
778
|
+
B.valuemax(p.map(s, (b) => b ?? 0)),
|
|
779
|
+
B.valuenow(p.map(e, (b) => b ?? 0)),
|
|
774
780
|
B.valuetext(
|
|
775
781
|
D(
|
|
776
782
|
e,
|
|
777
783
|
s
|
|
778
|
-
)((
|
|
779
|
-
const T =
|
|
780
|
-
return `${String(T)} / ${String(
|
|
784
|
+
)((b, A) => {
|
|
785
|
+
const T = b ?? 0, _ = A ?? 0;
|
|
786
|
+
return `${String(T)} / ${String(_)}`;
|
|
781
787
|
})
|
|
782
788
|
),
|
|
783
789
|
// Keyboard & focus handlers
|
|
784
|
-
I.keydown(
|
|
785
|
-
|
|
786
|
-
|
|
790
|
+
I.keydown(k),
|
|
791
|
+
h != null ? I.blur(h) : null,
|
|
792
|
+
mt(s, F)
|
|
787
793
|
)
|
|
788
794
|
});
|
|
789
|
-
},
|
|
790
|
-
const { after: e, disabled: a } = t, n =
|
|
795
|
+
}, ke = (t) => {
|
|
796
|
+
const { after: e, disabled: a } = t, n = dt(
|
|
791
797
|
t,
|
|
792
798
|
(s) => s ?? 0,
|
|
793
799
|
(s) => s
|
|
@@ -796,19 +802,19 @@ const fe = ({
|
|
|
796
802
|
a,
|
|
797
803
|
t.onChange ?? t.onInput
|
|
798
804
|
);
|
|
799
|
-
return
|
|
805
|
+
return te({
|
|
800
806
|
...n,
|
|
801
807
|
after: e != null ? j(r, e) : r
|
|
802
808
|
});
|
|
803
|
-
},
|
|
809
|
+
}, Fe = (t) => {
|
|
804
810
|
const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: c } = t;
|
|
805
|
-
return
|
|
811
|
+
return P({
|
|
806
812
|
...t,
|
|
807
813
|
// Make sure clicks anywhere focus the range input
|
|
808
814
|
focusableSelector: 'input[type="range"]',
|
|
809
|
-
input:
|
|
815
|
+
input: x.input(
|
|
810
816
|
u.type("range"),
|
|
811
|
-
|
|
817
|
+
L(t),
|
|
812
818
|
u.min(n),
|
|
813
819
|
u.max(r),
|
|
814
820
|
u.step(a),
|
|
@@ -820,23 +826,23 @@ const fe = ({
|
|
|
820
826
|
c != null ? I.input(E(c)) : S
|
|
821
827
|
)
|
|
822
828
|
});
|
|
823
|
-
},
|
|
829
|
+
}, Ce = (t) => {
|
|
824
830
|
const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: c } = t, i = p.map(e, (d) => {
|
|
825
831
|
if (d != null) return d;
|
|
826
|
-
const
|
|
827
|
-
return typeof
|
|
832
|
+
const h = n != null ? p.get(n) : void 0;
|
|
833
|
+
return typeof h == "number" ? h : 0;
|
|
828
834
|
}), l = X(
|
|
829
835
|
e,
|
|
830
836
|
t.disabled,
|
|
831
837
|
o ?? c
|
|
832
838
|
);
|
|
833
|
-
return
|
|
839
|
+
return P({
|
|
834
840
|
...t,
|
|
835
841
|
focusableSelector: 'input[type="range"]',
|
|
836
842
|
after: l,
|
|
837
|
-
input:
|
|
843
|
+
input: x.input(
|
|
838
844
|
u.type("range"),
|
|
839
|
-
|
|
845
|
+
L(t),
|
|
840
846
|
u.min(n),
|
|
841
847
|
u.max(r),
|
|
842
848
|
u.step(a),
|
|
@@ -855,8 +861,8 @@ const fe = ({
|
|
|
855
861
|
) : S
|
|
856
862
|
)
|
|
857
863
|
});
|
|
858
|
-
},
|
|
859
|
-
class
|
|
864
|
+
}, Te = O($t);
|
|
865
|
+
class ee {
|
|
860
866
|
widgets = /* @__PURE__ */ new Map();
|
|
861
867
|
typeMapping = /* @__PURE__ */ new Map();
|
|
862
868
|
// JSON Schema type -> widget names
|
|
@@ -907,7 +913,7 @@ class te {
|
|
|
907
913
|
* Find the best widget for a schema context
|
|
908
914
|
*/
|
|
909
915
|
findBestWidget(e) {
|
|
910
|
-
const a =
|
|
916
|
+
const a = vt(e.definition, e.name);
|
|
911
917
|
if (a?.widget) {
|
|
912
918
|
const r = this.widgets.get(a.widget);
|
|
913
919
|
if (r)
|
|
@@ -948,8 +954,8 @@ class te {
|
|
|
948
954
|
return null;
|
|
949
955
|
}
|
|
950
956
|
}
|
|
951
|
-
const
|
|
952
|
-
function
|
|
957
|
+
const Se = new ee();
|
|
958
|
+
function Ae(t, e, a) {
|
|
953
959
|
return {
|
|
954
960
|
factory: e,
|
|
955
961
|
matcher: (n) => {
|
|
@@ -962,7 +968,7 @@ function Se(t, e, a) {
|
|
|
962
968
|
...a
|
|
963
969
|
};
|
|
964
970
|
}
|
|
965
|
-
function
|
|
971
|
+
function ve(t, e, a) {
|
|
966
972
|
return {
|
|
967
973
|
factory: e,
|
|
968
974
|
matcher: (n) => n.definition.format === t,
|
|
@@ -971,7 +977,7 @@ function Ae(t, e, a) {
|
|
|
971
977
|
...a
|
|
972
978
|
};
|
|
973
979
|
}
|
|
974
|
-
function
|
|
980
|
+
function Ne(t, e, a, n) {
|
|
975
981
|
return {
|
|
976
982
|
factory: a,
|
|
977
983
|
matcher: (r) => {
|
|
@@ -983,7 +989,7 @@ function ve(t, e, a, n) {
|
|
|
983
989
|
...n
|
|
984
990
|
};
|
|
985
991
|
}
|
|
986
|
-
function
|
|
992
|
+
function Re(t) {
|
|
987
993
|
const e = t?.logPrefix ?? "WIDGET_DIAG", a = t?.filterFn ?? (() => !0);
|
|
988
994
|
return {
|
|
989
995
|
factory: () => null,
|
|
@@ -1007,51 +1013,51 @@ function Ne(t) {
|
|
|
1007
1013
|
}
|
|
1008
1014
|
export {
|
|
1009
1015
|
Lt as A,
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
+
ge as B,
|
|
1017
|
+
fe as C,
|
|
1018
|
+
Bt as D,
|
|
1019
|
+
me as E,
|
|
1020
|
+
Nt as F,
|
|
1021
|
+
Rt as G,
|
|
1016
1022
|
Z as H,
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1023
|
+
Pt as I,
|
|
1024
|
+
Ut as J,
|
|
1025
|
+
Vt as K,
|
|
1020
1026
|
W as L,
|
|
1021
1027
|
et as M,
|
|
1022
|
-
|
|
1028
|
+
Me as N,
|
|
1023
1029
|
nt as O,
|
|
1024
1030
|
Ot as P,
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1031
|
+
Wt as Q,
|
|
1032
|
+
te as R,
|
|
1033
|
+
Fe as S,
|
|
1028
1034
|
J as T,
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1035
|
+
Et as U,
|
|
1036
|
+
ee as W,
|
|
1037
|
+
$e as a,
|
|
1038
|
+
_e as b,
|
|
1039
|
+
Te as c,
|
|
1040
|
+
Ie as d,
|
|
1041
|
+
we as e,
|
|
1042
|
+
be as f,
|
|
1043
|
+
Se as g,
|
|
1044
|
+
ye as h,
|
|
1045
|
+
Ce as i,
|
|
1046
|
+
ke as j,
|
|
1047
|
+
xe as k,
|
|
1048
|
+
Re as l,
|
|
1049
|
+
ve as m,
|
|
1050
|
+
Ne as n,
|
|
1051
|
+
Ae as o,
|
|
1052
|
+
Kt as p,
|
|
1053
|
+
qt as q,
|
|
1054
|
+
de as r,
|
|
1055
|
+
ht as s,
|
|
1056
|
+
Dt as t,
|
|
1057
|
+
Yt as u,
|
|
1058
|
+
zt as v,
|
|
1053
1059
|
U as w,
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1060
|
+
he as x,
|
|
1061
|
+
H as y,
|
|
1062
|
+
gt as z
|
|
1057
1063
|
};
|