@glasshome/widget-sdk 0.3.5 → 0.3.6
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/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { z as
|
|
3
|
-
import { GridSizeSchema as
|
|
4
|
-
import { memo as E, effect as
|
|
1
|
+
import { createSignal as j, createContext as Ee, useContext as Se, createEffect as q, untrack as ve, createMemo as A, splitProps as Ae, on as be, Show as te } from "solid-js";
|
|
2
|
+
import { z as J } from "zod";
|
|
3
|
+
import { GridSizeSchema as xr, PublishBodySchema as vr, PublishConfirmSchema as br, PublishRequestSchema as yr, WidgetManifestSchema as wr, formatSchemaError as $r, parseGridSize as kr, serializeGridSize as Sr } from "./schemas.js";
|
|
4
|
+
import { memo as E, effect as D, setStyleProperty as z, className as C, template as w, insert as x, style as se, createComponent as T, addEventListener as ne, use as Ne, delegateEvents as Oe } from "solid-js/web";
|
|
5
5
|
import { clsx as Te } from "clsx";
|
|
6
6
|
import { twMerge as Ve } from "tailwind-merge";
|
|
7
7
|
import { createElementSize as We } from "@solid-primitives/resize-observer";
|
|
8
8
|
import { createForm as Ie, zodForm as Re, reset as Ge, setValue as Pe, getValue as He } from "@modular-forms/solid";
|
|
9
|
-
function
|
|
10
|
-
const [t] =
|
|
9
|
+
function An(e) {
|
|
10
|
+
const [t] = j(e);
|
|
11
11
|
return t;
|
|
12
12
|
}
|
|
13
13
|
function pe(e) {
|
|
14
|
-
return
|
|
14
|
+
return J.toJSONSchema(e, {
|
|
15
15
|
override: (t) => {
|
|
16
|
-
const n =
|
|
16
|
+
const n = J.globalRegistry.get(t.zodSchema);
|
|
17
17
|
return n && typeof n == "object" && Object.keys(n).length > 0 ? { ...t.jsonSchema, ...n } : t.jsonSchema;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -25,10 +25,10 @@ function Be(e) {
|
|
|
25
25
|
return {};
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Nn(e) {
|
|
29
29
|
return e.configSchema && (e.manifest.schema || (e.manifest.schema = pe(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Be(e.configSchema))), e;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const U = {
|
|
32
32
|
/** Background layer (gradients, images, glows) */
|
|
33
33
|
BACKGROUND: 0,
|
|
34
34
|
/** Main content layer (icon, title, text) */
|
|
@@ -38,7 +38,7 @@ const Y = {
|
|
|
38
38
|
/** Action layer (buttons, edit controls) */
|
|
39
39
|
ACTIONS: 30
|
|
40
40
|
};
|
|
41
|
-
function
|
|
41
|
+
function On(e) {
|
|
42
42
|
}
|
|
43
43
|
const me = Ee();
|
|
44
44
|
function G() {
|
|
@@ -143,28 +143,28 @@ const Le = {
|
|
|
143
143
|
function Ue(e) {
|
|
144
144
|
return fe[e];
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Tn(e) {
|
|
147
147
|
return e in fe;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Vn() {
|
|
150
150
|
return Object.keys(fe);
|
|
151
151
|
}
|
|
152
152
|
function Ce(e, t) {
|
|
153
153
|
if (typeof e != "object" || e === null)
|
|
154
154
|
return t;
|
|
155
155
|
const n = { ...e };
|
|
156
|
-
for (const
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
if (Array.isArray(
|
|
160
|
-
n[
|
|
156
|
+
for (const r in t) {
|
|
157
|
+
const i = t[r], a = e[r];
|
|
158
|
+
if (i !== void 0) {
|
|
159
|
+
if (Array.isArray(i)) {
|
|
160
|
+
n[r] = i;
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
if (typeof
|
|
164
|
-
typeof a == "object" && a !== null ? n[
|
|
163
|
+
if (typeof i == "object" && i !== null && !Array.isArray(i)) {
|
|
164
|
+
typeof a == "object" && a !== null ? n[r] = Ce(a, i) : n[r] = i;
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
167
|
-
n[
|
|
167
|
+
n[r] = i;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
return n;
|
|
@@ -219,58 +219,58 @@ function he(e, t) {
|
|
|
219
219
|
extends: t.extends ?? e.extends
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Wn(e, t) {
|
|
223
223
|
return {
|
|
224
224
|
...t,
|
|
225
225
|
extends: e
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function In(...e) {
|
|
229
229
|
if (e.length === 0)
|
|
230
230
|
throw new Error("composeVariants requires at least one variant");
|
|
231
231
|
return e.length === 1 ? e[0] : e.reduce((t, n) => he(t, n));
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function Rn(e, t) {
|
|
234
234
|
return he(e, { layout: t });
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function Gn(e, t) {
|
|
237
237
|
return he(e, {
|
|
238
238
|
styles: { cssVars: t }
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Pn(e = "column", t = "start", n = "start", r) {
|
|
242
242
|
return {
|
|
243
243
|
type: "flex",
|
|
244
244
|
direction: e,
|
|
245
245
|
align: t,
|
|
246
246
|
justify: n,
|
|
247
|
-
...
|
|
247
|
+
...r
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
var Ze = /* @__PURE__ */ w("<div>"), Qe = /* @__PURE__ */ w('<div class="pointer-events-none absolute inset-0 opacity-40 blur-2xl">');
|
|
251
251
|
function et(e) {
|
|
252
|
-
const t = G(), n = () => t.orientation() === "vertical" ? `inset(${100 - e.value}% 0 0 0)` : `inset(0 ${100 - e.value}% 0 0)`,
|
|
252
|
+
const t = G(), n = () => t.orientation() === "vertical" ? `inset(${100 - e.value}% 0 0 0)` : `inset(0 ${100 - e.value}% 0 0)`, r = () => e.color ?? "rgb(59, 130, 246)";
|
|
253
253
|
return [E(() => E(() => !!((e.glow ?? !1) && e.value > 0))() && (() => {
|
|
254
|
-
var
|
|
255
|
-
return
|
|
256
|
-
var o =
|
|
257
|
-
return o !== a.e &&
|
|
254
|
+
var i = Qe();
|
|
255
|
+
return D((a) => {
|
|
256
|
+
var o = r(), s = U.BACKGROUND;
|
|
257
|
+
return o !== a.e && z(i, "background", a.e = o), s !== a.t && z(i, "z-index", a.t = s), a;
|
|
258
258
|
}, {
|
|
259
259
|
e: void 0,
|
|
260
260
|
t: void 0
|
|
261
|
-
}),
|
|
261
|
+
}), i;
|
|
262
262
|
})()), (() => {
|
|
263
|
-
var
|
|
264
|
-
return
|
|
265
|
-
var o = S("pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), s =
|
|
266
|
-
return o !== a.e &&
|
|
263
|
+
var i = Ze();
|
|
264
|
+
return D((a) => {
|
|
265
|
+
var o = S("pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), s = r(), l = n(), d = e.opacity ?? 0.3, c = U.BACKGROUND;
|
|
266
|
+
return o !== a.e && C(i, a.e = o), s !== a.t && z(i, "background", a.t = s), l !== a.a && z(i, "clip-path", a.a = l), d !== a.o && z(i, "opacity", a.o = d), c !== a.i && z(i, "z-index", a.i = c), a;
|
|
267
267
|
}, {
|
|
268
268
|
e: void 0,
|
|
269
269
|
t: void 0,
|
|
270
270
|
a: void 0,
|
|
271
271
|
o: void 0,
|
|
272
272
|
i: void 0
|
|
273
|
-
}),
|
|
273
|
+
}), i;
|
|
274
274
|
})()];
|
|
275
275
|
}
|
|
276
276
|
const re = {
|
|
@@ -278,7 +278,7 @@ const re = {
|
|
|
278
278
|
S2: { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 },
|
|
279
279
|
S3: { xs: 8, sm: 10, md: 12, lg: 14, xl: 16 },
|
|
280
280
|
S4: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20 }
|
|
281
|
-
},
|
|
281
|
+
}, W = {
|
|
282
282
|
/** Extra small spacing (4-8px) */
|
|
283
283
|
S1: (e) => `${re.S1[e]}px`,
|
|
284
284
|
/** Small spacing (6-14px) - default for most layouts */
|
|
@@ -357,16 +357,16 @@ function it(e) {
|
|
|
357
357
|
const t = G();
|
|
358
358
|
return (() => {
|
|
359
359
|
var n = rt();
|
|
360
|
-
return
|
|
361
|
-
var
|
|
360
|
+
return x(n, () => e.children), D((r) => {
|
|
361
|
+
var i = S(
|
|
362
362
|
"relative flex h-full w-full overflow-hidden",
|
|
363
363
|
// Ensure controls (ml-auto divs) are above other content
|
|
364
364
|
"[&_div.ml-auto]:relative [&_div.ml-auto]:z-30",
|
|
365
365
|
t.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
|
|
366
366
|
nt("S3", t.size()),
|
|
367
367
|
e.class
|
|
368
|
-
), a =
|
|
369
|
-
return
|
|
368
|
+
), a = W.container(t.size()), o = U.CONTENT;
|
|
369
|
+
return i !== r.e && C(n, r.e = i), a !== r.t && z(n, "padding", r.t = a), o !== r.a && z(n, "z-index", r.a = o), r;
|
|
370
370
|
}, {
|
|
371
371
|
e: void 0,
|
|
372
372
|
t: void 0,
|
|
@@ -374,7 +374,7 @@ function it(e) {
|
|
|
374
374
|
}), n;
|
|
375
375
|
})();
|
|
376
376
|
}
|
|
377
|
-
const
|
|
377
|
+
const F = {
|
|
378
378
|
/** Container base text sizing */
|
|
379
379
|
container: (e) => ({
|
|
380
380
|
xs: "text-xs",
|
|
@@ -492,60 +492,60 @@ var at = /* @__PURE__ */ w("<div><div>"), ot = /* @__PURE__ */ w("<div>"), st =
|
|
|
492
492
|
function ut(e) {
|
|
493
493
|
const t = G(), n = () => t.contentLayout() === "horizontal";
|
|
494
494
|
return (() => {
|
|
495
|
-
var
|
|
496
|
-
return
|
|
495
|
+
var r = at(), i = r.firstChild;
|
|
496
|
+
return x(r, (() => {
|
|
497
497
|
var a = E(() => !!e.icon);
|
|
498
498
|
return () => a() && (() => {
|
|
499
499
|
var o = ot();
|
|
500
|
-
return
|
|
501
|
-
var l = S("flex items-center justify-center text-foreground/30", n() ? "shrink-0" : ""), d = `${
|
|
502
|
-
return l !== s.e &&
|
|
500
|
+
return x(o, () => e.icon), D((s) => {
|
|
501
|
+
var l = S("flex items-center justify-center text-foreground/30", n() ? "shrink-0" : ""), d = `${W.icon(t.size())}px`, c = `${W.icon(t.size())}px`;
|
|
502
|
+
return l !== s.e && C(o, s.e = l), d !== s.t && z(o, "width", s.t = d), c !== s.a && z(o, "height", s.a = c), s;
|
|
503
503
|
}, {
|
|
504
504
|
e: void 0,
|
|
505
505
|
t: void 0,
|
|
506
506
|
a: void 0
|
|
507
507
|
}), o;
|
|
508
508
|
})();
|
|
509
|
-
})(),
|
|
509
|
+
})(), i), x(i, (() => {
|
|
510
510
|
var a = E(() => !!(e.title ?? "No data"));
|
|
511
511
|
return () => a() && (() => {
|
|
512
512
|
var o = st();
|
|
513
|
-
return
|
|
514
|
-
var l = S("font-semibold text-foreground/60",
|
|
515
|
-
return l !== s.e &&
|
|
513
|
+
return x(o, () => e.title ?? "No data"), D((s) => {
|
|
514
|
+
var l = S("font-semibold text-foreground/60", F.subtitle(t.size())), d = n() ? "100%" : "80%";
|
|
515
|
+
return l !== s.e && C(o, s.e = l), d !== s.t && z(o, "max-width", s.t = d), s;
|
|
516
516
|
}, {
|
|
517
517
|
e: void 0,
|
|
518
518
|
t: void 0
|
|
519
519
|
}), o;
|
|
520
520
|
})();
|
|
521
|
-
})(), null),
|
|
521
|
+
})(), null), x(i, (() => {
|
|
522
522
|
var a = E(() => !!e.message);
|
|
523
523
|
return () => a() && (() => {
|
|
524
524
|
var o = lt();
|
|
525
|
-
return
|
|
526
|
-
var l = S("text-foreground/50",
|
|
527
|
-
return l !== s.e &&
|
|
525
|
+
return x(o, () => e.message), D((s) => {
|
|
526
|
+
var l = S("text-foreground/50", F.emptyState(t.size())), d = n() ? "100%" : "85%";
|
|
527
|
+
return l !== s.e && C(o, s.e = l), d !== s.t && z(o, "max-width", s.t = d), s;
|
|
528
528
|
}, {
|
|
529
529
|
e: void 0,
|
|
530
530
|
t: void 0
|
|
531
531
|
}), o;
|
|
532
532
|
})();
|
|
533
|
-
})(), null),
|
|
533
|
+
})(), null), x(i, (() => {
|
|
534
534
|
var a = E(() => !!e.action);
|
|
535
535
|
return () => a() && (() => {
|
|
536
536
|
var o = ct();
|
|
537
|
-
return
|
|
537
|
+
return x(o, () => e.action), o;
|
|
538
538
|
})();
|
|
539
|
-
})(), null),
|
|
540
|
-
var o = S("flex h-full w-full", n() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", e.class), s =
|
|
541
|
-
return o !== a.e &&
|
|
539
|
+
})(), null), D((a) => {
|
|
540
|
+
var o = S("flex h-full w-full", n() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", e.class), s = W.S2(t.size()), l = W.container(t.size()), d = S("flex flex-col", n() ? "items-start text-left" : "items-center text-center"), c = W.S1(t.size());
|
|
541
|
+
return o !== a.e && C(r, a.e = o), s !== a.t && z(r, "gap", a.t = s), l !== a.a && z(r, "padding", a.a = l), d !== a.o && C(i, a.o = d), c !== a.i && z(i, "gap", a.i = c), a;
|
|
542
542
|
}, {
|
|
543
543
|
e: void 0,
|
|
544
544
|
t: void 0,
|
|
545
545
|
a: void 0,
|
|
546
546
|
o: void 0,
|
|
547
547
|
i: void 0
|
|
548
|
-
}),
|
|
548
|
+
}), r;
|
|
549
549
|
})();
|
|
550
550
|
}
|
|
551
551
|
function dt(e) {
|
|
@@ -561,36 +561,36 @@ function mt(e) {
|
|
|
561
561
|
if (!t) return null;
|
|
562
562
|
let n = t[1];
|
|
563
563
|
n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]);
|
|
564
|
-
const
|
|
565
|
-
return Me(
|
|
564
|
+
const r = Number.parseInt(n.slice(0, 2), 16), i = Number.parseInt(n.slice(2, 4), 16), a = Number.parseInt(n.slice(4, 6), 16);
|
|
565
|
+
return Me(r, i, a);
|
|
566
566
|
}
|
|
567
567
|
function Me(e, t, n) {
|
|
568
568
|
e /= 255, t /= 255, n /= 255;
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
const o =
|
|
569
|
+
const r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
570
|
+
if (r === i) return { h: 0, s: 0, l: a * 100 };
|
|
571
|
+
const o = r - i, s = a > 0.5 ? o / (2 - r - i) : o / (r + i);
|
|
572
572
|
let l = 0;
|
|
573
|
-
return
|
|
573
|
+
return r === e ? l = ((t - n) / o + (t < n ? 6 : 0)) / 6 : r === t ? l = ((n - e) / o + 2) / 6 : l = ((e - t) / o + 4) / 6, { h: l * 360, s: s * 100, l: a * 100 };
|
|
574
574
|
}
|
|
575
575
|
function ft(e) {
|
|
576
576
|
return dt(e) ?? gt(e) ?? mt(e);
|
|
577
577
|
}
|
|
578
|
-
function ye(e, t, n,
|
|
579
|
-
const
|
|
580
|
-
return
|
|
578
|
+
function ye(e, t, n, r) {
|
|
579
|
+
const i = Math.round(e), a = Math.round(Math.min(100, Math.max(0, t))), o = Math.round(Math.min(100, Math.max(0, n)));
|
|
580
|
+
return r !== void 0 && r < 1 ? `hsla(${i}, ${a}%, ${o}%, ${r})` : `hsl(${i}, ${a}%, ${o}%)`;
|
|
581
581
|
}
|
|
582
582
|
function ht(e) {
|
|
583
583
|
const t = ft(e);
|
|
584
584
|
if (!t) return null;
|
|
585
|
-
const { h: n, s:
|
|
586
|
-
let a, o = Math.min(
|
|
587
|
-
|
|
588
|
-
const s = ye(n, o, a, 0.85), l = ye(n, Math.min(
|
|
585
|
+
const { h: n, s: r, l: i } = t;
|
|
586
|
+
let a, o = Math.min(r + 10, 100);
|
|
587
|
+
i < 25 ? (a = i + 12, o = Math.min(r + 15, 100)) : i < 40 ? a = Math.max(i - 8, 15) : a = Math.max(18, i * 0.3), r < 15 && (o = 10, a = Math.max(a, 20));
|
|
588
|
+
const s = ye(n, o, a, 0.85), l = ye(n, Math.min(r, 90), Math.min(i, 55), 0.5);
|
|
589
589
|
return { background: s, glow: l };
|
|
590
590
|
}
|
|
591
591
|
var xt = /* @__PURE__ */ w('<div><div class="flex items-center justify-center text-foreground">'), we = /* @__PURE__ */ w("<div>");
|
|
592
592
|
function vt(e) {
|
|
593
|
-
const t = G(), n = () => e.dynamicColor ? ht(e.dynamicColor) : null,
|
|
593
|
+
const t = G(), n = () => e.dynamicColor ? ht(e.dynamicColor) : null, r = () => !!n(), i = () => {
|
|
594
594
|
const l = n();
|
|
595
595
|
if (l)
|
|
596
596
|
return {
|
|
@@ -604,61 +604,61 @@ function vt(e) {
|
|
|
604
604
|
};
|
|
605
605
|
}, o = () => {
|
|
606
606
|
const l = {
|
|
607
|
-
width: `${
|
|
608
|
-
height: `${
|
|
607
|
+
width: `${W.icon(t.size())}px`,
|
|
608
|
+
height: `${W.icon(t.size())}px`,
|
|
609
609
|
"border-radius": "var(--radius-sm, 12px)"
|
|
610
|
-
}, d =
|
|
610
|
+
}, d = i(), c = a();
|
|
611
611
|
return d && Object.assign(l, d), c && Object.assign(l, c), l;
|
|
612
612
|
}, s = (l, d, c) => {
|
|
613
|
-
const
|
|
614
|
-
width: `${
|
|
615
|
-
height: `${
|
|
613
|
+
const y = {
|
|
614
|
+
width: `${W.icon(t.size()) * 1.02}px`,
|
|
615
|
+
height: `${W.icon(t.size()) * 1.02}px`,
|
|
616
616
|
"border-radius": "var(--radius-sm, 12px)",
|
|
617
|
-
bottom: `${-
|
|
618
|
-
right: `${-
|
|
617
|
+
bottom: `${-W.icon(t.size()) * l}px`,
|
|
618
|
+
right: `${-W.icon(t.size()) * (l * 0.71)}px`,
|
|
619
619
|
"z-index": d,
|
|
620
620
|
opacity: c
|
|
621
|
-
},
|
|
622
|
-
return
|
|
621
|
+
}, M = i();
|
|
622
|
+
return M && Object.assign(y, M), y;
|
|
623
623
|
};
|
|
624
624
|
return (() => {
|
|
625
625
|
var l = xt(), d = l.firstChild;
|
|
626
|
-
return
|
|
626
|
+
return x(l, (() => {
|
|
627
627
|
var c = E(() => (e.entityCount ?? 1) >= 2);
|
|
628
628
|
return () => c() && (() => {
|
|
629
|
-
var
|
|
630
|
-
return
|
|
631
|
-
var f = S("absolute", !
|
|
632
|
-
return f !==
|
|
629
|
+
var y = we();
|
|
630
|
+
return D((M) => {
|
|
631
|
+
var f = S("absolute", !r() && (e.color ?? "bg-foreground/10")), v = s(0.14, -2, 0.45);
|
|
632
|
+
return f !== M.e && C(y, M.e = f), M.t = se(y, v, M.t), M;
|
|
633
633
|
}, {
|
|
634
634
|
e: void 0,
|
|
635
635
|
t: void 0
|
|
636
|
-
}),
|
|
636
|
+
}), y;
|
|
637
637
|
})();
|
|
638
|
-
})(), d),
|
|
638
|
+
})(), d), x(l, (() => {
|
|
639
639
|
var c = E(() => (e.entityCount ?? 1) >= 3);
|
|
640
640
|
return () => c() && (() => {
|
|
641
|
-
var
|
|
642
|
-
return
|
|
643
|
-
var f = S("absolute", !
|
|
644
|
-
return f !==
|
|
641
|
+
var y = we();
|
|
642
|
+
return D((M) => {
|
|
643
|
+
var f = S("absolute", !r() && (e.color ?? "bg-foreground/10")), v = s(0.28, -3, 0.2);
|
|
644
|
+
return f !== M.e && C(y, M.e = f), M.t = se(y, v, M.t), M;
|
|
645
645
|
}, {
|
|
646
646
|
e: void 0,
|
|
647
647
|
t: void 0
|
|
648
|
-
}),
|
|
648
|
+
}), y;
|
|
649
649
|
})();
|
|
650
|
-
})(), d),
|
|
651
|
-
var
|
|
650
|
+
})(), d), x(d, () => e.icon), D((c) => {
|
|
651
|
+
var y = S(
|
|
652
652
|
"relative flex shrink-0 items-center justify-center transition-all",
|
|
653
653
|
"pointer-events-none",
|
|
654
654
|
e.dimmed && "opacity-50",
|
|
655
655
|
// Only apply Tailwind classes when not using dynamic colors
|
|
656
|
-
!
|
|
657
|
-
!
|
|
658
|
-
!
|
|
656
|
+
!r() && e.glow && "shadow-[0_0_25px_var(--tw-shadow-color,transparent)]",
|
|
657
|
+
!r() && (e.color ?? "bg-foreground/10"),
|
|
658
|
+
!r() && e.glow,
|
|
659
659
|
e.class
|
|
660
|
-
),
|
|
661
|
-
return
|
|
660
|
+
), M = o(), f = `${W.iconSize(t.size())}px`;
|
|
661
|
+
return y !== c.e && C(l, c.e = y), c.t = se(l, M, c.t), f !== c.a && z(d, "font-size", c.a = f), c;
|
|
662
662
|
}, {
|
|
663
663
|
e: void 0,
|
|
664
664
|
t: void 0,
|
|
@@ -669,33 +669,33 @@ function vt(e) {
|
|
|
669
669
|
var bt = /* @__PURE__ */ w("<div>"), yt = /* @__PURE__ */ w("<div><div><span></span></div><div>"), wt = /* @__PURE__ */ w("<span class=shrink-0>"), $t = /* @__PURE__ */ w('<span class="ml-1 text-foreground/70">');
|
|
670
670
|
function kt(e) {
|
|
671
671
|
const t = G(), n = () => {
|
|
672
|
-
const
|
|
673
|
-
return
|
|
672
|
+
const r = e.direction ?? "auto";
|
|
673
|
+
return r === "auto" ? t.orientation() === "horizontal" ? "horizontal" : "vertical" : r;
|
|
674
674
|
};
|
|
675
675
|
return (() => {
|
|
676
|
-
var
|
|
677
|
-
return
|
|
676
|
+
var r = bt();
|
|
677
|
+
return x(r, () => e.children), D(() => C(r, S("flex", n() === "horizontal" ? "flex-row gap-4" : "flex-col gap-2", e.class))), r;
|
|
678
678
|
})();
|
|
679
679
|
}
|
|
680
680
|
function St(e) {
|
|
681
681
|
const t = G();
|
|
682
682
|
return (() => {
|
|
683
|
-
var n = yt(),
|
|
684
|
-
return
|
|
683
|
+
var n = yt(), r = n.firstChild, i = r.firstChild, a = r.nextSibling;
|
|
684
|
+
return x(r, (() => {
|
|
685
685
|
var o = E(() => !!e.icon);
|
|
686
686
|
return () => o() && (() => {
|
|
687
687
|
var s = wt();
|
|
688
|
-
return
|
|
688
|
+
return x(s, () => e.icon), s;
|
|
689
689
|
})();
|
|
690
|
-
})(),
|
|
690
|
+
})(), i), x(i, () => e.label), x(a, () => e.value, null), x(a, (() => {
|
|
691
691
|
var o = E(() => !!e.unit);
|
|
692
692
|
return () => o() && (() => {
|
|
693
693
|
var s = $t();
|
|
694
|
-
return
|
|
694
|
+
return x(s, () => e.unit), s;
|
|
695
695
|
})();
|
|
696
|
-
})(), null),
|
|
697
|
-
var s = S("flex flex-col", e.dimmed && "opacity-50", e.class), l =
|
|
698
|
-
return s !== o.e &&
|
|
696
|
+
})(), null), D((o) => {
|
|
697
|
+
var s = S("flex flex-col", e.dimmed && "opacity-50", e.class), l = W.S1(t.size()), d = S("flex items-center gap-1 text-foreground/60", F.metricLabel(t.size())), c = S("font-semibold text-foreground", F.metricValue(t.size()));
|
|
698
|
+
return s !== o.e && C(n, o.e = s), l !== o.t && z(n, "gap", o.t = l), d !== o.a && C(r, o.a = d), c !== o.o && C(a, o.o = c), o;
|
|
699
699
|
}, {
|
|
700
700
|
e: void 0,
|
|
701
701
|
t: void 0,
|
|
@@ -711,12 +711,12 @@ function Ct(e) {
|
|
|
711
711
|
const t = G();
|
|
712
712
|
return (() => {
|
|
713
713
|
var n = pt();
|
|
714
|
-
return
|
|
715
|
-
var
|
|
716
|
-
return () =>
|
|
717
|
-
})()),
|
|
718
|
-
var
|
|
719
|
-
return
|
|
714
|
+
return x(n, (() => {
|
|
715
|
+
var r = E(() => !!e.isUnavailable);
|
|
716
|
+
return () => r() ? "Unavailable" : e.children;
|
|
717
|
+
})()), D((r) => {
|
|
718
|
+
var i = S("relative font-bold text-foreground", e.dimmed && "opacity-40", F.status(t.size()), e.class), a = U.ACTIONS;
|
|
719
|
+
return i !== r.e && C(n, r.e = i), a !== r.t && z(n, "z-index", r.t = a), r;
|
|
720
720
|
}, {
|
|
721
721
|
e: void 0,
|
|
722
722
|
t: void 0
|
|
@@ -728,23 +728,23 @@ function zt(e) {
|
|
|
728
728
|
const t = G();
|
|
729
729
|
return (() => {
|
|
730
730
|
var n = Mt();
|
|
731
|
-
return
|
|
731
|
+
return x(n, () => e.children), D(() => C(n, S("truncate font-medium text-foreground/80", e.dimmed && "text-foreground/50", F.subtitle(t.size()), e.class))), n;
|
|
732
732
|
})();
|
|
733
733
|
}
|
|
734
734
|
var Dt = /* @__PURE__ */ w("<div><h3>"), _t = /* @__PURE__ */ w("<span>");
|
|
735
735
|
function Et(e) {
|
|
736
736
|
const t = G();
|
|
737
737
|
return (() => {
|
|
738
|
-
var n = Dt(),
|
|
739
|
-
return
|
|
740
|
-
var
|
|
741
|
-
return () =>
|
|
738
|
+
var n = Dt(), r = n.firstChild;
|
|
739
|
+
return x(r, () => e.children), x(n, (() => {
|
|
740
|
+
var i = E(() => e.badge !== void 0 && e.badge > 0);
|
|
741
|
+
return () => i() && (() => {
|
|
742
742
|
var a = _t();
|
|
743
|
-
return
|
|
743
|
+
return x(a, () => e.badge), D(() => C(a, S("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", F.badge(t.size())))), a;
|
|
744
744
|
})();
|
|
745
|
-
})(), null),
|
|
746
|
-
var a = S("relative flex items-center", e.class), o =
|
|
747
|
-
return a !==
|
|
745
|
+
})(), null), D((i) => {
|
|
746
|
+
var a = S("relative flex items-center", e.class), o = W.S1(t.size()), s = U.ACTIONS, l = S("truncate text-foreground/60", F.title(t.size()));
|
|
747
|
+
return a !== i.e && C(n, i.e = a), o !== i.t && z(n, "gap", i.t = o), s !== i.a && z(n, "z-index", i.a = s), l !== i.o && C(r, i.o = l), i;
|
|
748
748
|
}, {
|
|
749
749
|
e: void 0,
|
|
750
750
|
t: void 0,
|
|
@@ -753,7 +753,7 @@ function Et(e) {
|
|
|
753
753
|
}), n;
|
|
754
754
|
})();
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function Hn(e) {
|
|
757
757
|
return {
|
|
758
758
|
icon: e.icon,
|
|
759
759
|
title: e.title,
|
|
@@ -776,29 +776,29 @@ function At(e, t = !1) {
|
|
|
776
776
|
};
|
|
777
777
|
const n = e.length > 1;
|
|
778
778
|
if (!n) {
|
|
779
|
-
const
|
|
779
|
+
const p = e[0], P = p.state === "on", B = p.attributes?.brightness || 0, h = Math.round(B / 255 * 100);
|
|
780
780
|
return {
|
|
781
781
|
isGroup: !1,
|
|
782
|
-
state:
|
|
782
|
+
state: p.state,
|
|
783
783
|
isOn: P,
|
|
784
|
-
isUnavailable:
|
|
785
|
-
brightness:
|
|
786
|
-
brightnessPercent:
|
|
787
|
-
color: $e(
|
|
784
|
+
isUnavailable: p.state === "unavailable",
|
|
785
|
+
brightness: B,
|
|
786
|
+
brightnessPercent: h,
|
|
787
|
+
color: $e(p),
|
|
788
788
|
onCount: P ? 1 : 0,
|
|
789
789
|
totalCount: 1,
|
|
790
790
|
description: P ? "On" : "Off"
|
|
791
791
|
};
|
|
792
792
|
}
|
|
793
|
-
let
|
|
793
|
+
let r = 0, i = 0, a = 0, o = 0, s = 0, l = 0;
|
|
794
794
|
const d = [];
|
|
795
|
-
for (const
|
|
796
|
-
switch (
|
|
795
|
+
for (const p of e)
|
|
796
|
+
switch (p.state) {
|
|
797
797
|
case "on":
|
|
798
|
-
|
|
798
|
+
r++, p.attributes?.brightness !== void 0 && (s += p.attributes.brightness, l++), p.attributes?.rgb_color && d.push(p.attributes.rgb_color);
|
|
799
799
|
break;
|
|
800
800
|
case "off":
|
|
801
|
-
|
|
801
|
+
i++;
|
|
802
802
|
break;
|
|
803
803
|
case "unknown":
|
|
804
804
|
a++;
|
|
@@ -807,28 +807,28 @@ function At(e, t = !1) {
|
|
|
807
807
|
o++;
|
|
808
808
|
break;
|
|
809
809
|
}
|
|
810
|
-
const c = e.length,
|
|
811
|
-
let N,
|
|
812
|
-
t ?
|
|
813
|
-
const
|
|
814
|
-
let
|
|
810
|
+
const c = e.length, y = o === c, M = a + o === c, f = r > 0, v = r === c, V = i === c;
|
|
811
|
+
let N, I;
|
|
812
|
+
t ? y ? (N = "unavailable", I = !1) : a > 0 || o > 0 ? (N = "unknown", I = !1) : i > 0 ? (N = "off", I = !1) : (N = "on", I = !0) : y ? (N = "unavailable", I = !1) : M ? (N = "unknown", I = !1) : f ? (N = "on", I = !0) : (N = "off", I = !1);
|
|
813
|
+
const X = l > 0 ? Math.round(s / l) : 0, m = Math.round(X / 255 * 100);
|
|
814
|
+
let b;
|
|
815
815
|
if (d.length > 0) {
|
|
816
|
-
const
|
|
817
|
-
|
|
816
|
+
const p = Math.round(d.reduce((u, O) => u + O[0], 0) / d.length), P = Math.round(d.reduce((u, O) => u + O[1], 0) / d.length), B = Math.round(d.reduce((u, O) => u + O[2], 0) / d.length), h = X / 255;
|
|
817
|
+
b = `rgb(${Math.round(p * h)}, ${Math.round(P * h)}, ${Math.round(B * h)})`;
|
|
818
818
|
} else
|
|
819
|
-
|
|
820
|
-
let
|
|
821
|
-
return v ?
|
|
819
|
+
b = $e(e[0]);
|
|
820
|
+
let $;
|
|
821
|
+
return v ? $ = "All on" : V ? $ = "All off" : r > 0 ? $ = `${r} of ${c} on` : $ = "Off", {
|
|
822
822
|
isGroup: n,
|
|
823
823
|
state: N,
|
|
824
|
-
isOn:
|
|
824
|
+
isOn: I,
|
|
825
825
|
isUnavailable: N === "unavailable",
|
|
826
|
-
brightness:
|
|
827
|
-
brightnessPercent:
|
|
828
|
-
color:
|
|
829
|
-
onCount:
|
|
826
|
+
brightness: X,
|
|
827
|
+
brightnessPercent: m,
|
|
828
|
+
color: b,
|
|
829
|
+
onCount: r,
|
|
830
830
|
totalCount: c,
|
|
831
|
-
description:
|
|
831
|
+
description: $
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
834
|
function Nt(e, t = "mean", n = !0) {
|
|
@@ -840,8 +840,8 @@ function Nt(e, t = "mean", n = !0) {
|
|
|
840
840
|
isUnavailable: !0,
|
|
841
841
|
description: "No entities"
|
|
842
842
|
};
|
|
843
|
-
const
|
|
844
|
-
if (!
|
|
843
|
+
const r = e.length > 1;
|
|
844
|
+
if (!r) {
|
|
845
845
|
const f = e[0], v = Number.parseFloat(f.state);
|
|
846
846
|
let V = f.state;
|
|
847
847
|
return Number.isNaN(v) || (V = Number.isInteger(v) ? v.toString() : v.toFixed(1)), {
|
|
@@ -853,7 +853,7 @@ function Nt(e, t = "mean", n = !0) {
|
|
|
853
853
|
description: V
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
|
-
const
|
|
856
|
+
const i = [], a = [];
|
|
857
857
|
let o = 0, s;
|
|
858
858
|
for (const f of e) {
|
|
859
859
|
if (!s && f.unitOfMeasurement && (s = f.unitOfMeasurement), f.state === "unavailable") {
|
|
@@ -869,16 +869,16 @@ function Nt(e, t = "mean", n = !0) {
|
|
|
869
869
|
entityId: f.id,
|
|
870
870
|
value: f.state,
|
|
871
871
|
friendly_name: f.friendlyName
|
|
872
|
-
}) : (
|
|
872
|
+
}) : (i.push(v), a.push({
|
|
873
873
|
entityId: f.id,
|
|
874
874
|
value: v,
|
|
875
875
|
friendly_name: f.friendlyName
|
|
876
876
|
}));
|
|
877
877
|
}
|
|
878
|
-
const l = o === e.length, d =
|
|
878
|
+
const l = o === e.length, d = i.length === 0;
|
|
879
879
|
if (l || d)
|
|
880
880
|
return {
|
|
881
|
-
isGroup:
|
|
881
|
+
isGroup: r,
|
|
882
882
|
state: l ? "unavailable" : "unknown",
|
|
883
883
|
numericValue: null,
|
|
884
884
|
isUnavailable: l,
|
|
@@ -886,50 +886,50 @@ function Nt(e, t = "mean", n = !0) {
|
|
|
886
886
|
description: l ? "Unavailable" : "No numeric values",
|
|
887
887
|
memberValues: a
|
|
888
888
|
};
|
|
889
|
-
let c,
|
|
889
|
+
let c, y;
|
|
890
890
|
switch (t) {
|
|
891
891
|
case "min":
|
|
892
|
-
c = Math.min(...
|
|
892
|
+
c = Math.min(...i), y = "Minimum";
|
|
893
893
|
break;
|
|
894
894
|
case "max":
|
|
895
|
-
c = Math.max(...
|
|
895
|
+
c = Math.max(...i), y = "Maximum";
|
|
896
896
|
break;
|
|
897
897
|
case "mean":
|
|
898
|
-
c =
|
|
898
|
+
c = i.reduce((f, v) => f + v, 0) / i.length, y = "Average";
|
|
899
899
|
break;
|
|
900
900
|
case "median": {
|
|
901
|
-
const f = [...
|
|
902
|
-
c = f.length % 2 === 0 ? (f[v - 1] + f[v]) / 2 : f[v],
|
|
901
|
+
const f = [...i].sort((V, N) => V - N), v = Math.floor(f.length / 2);
|
|
902
|
+
c = f.length % 2 === 0 ? (f[v - 1] + f[v]) / 2 : f[v], y = "Median";
|
|
903
903
|
break;
|
|
904
904
|
}
|
|
905
905
|
case "sum":
|
|
906
|
-
c =
|
|
906
|
+
c = i.reduce((f, v) => f + v, 0), y = "Sum";
|
|
907
907
|
break;
|
|
908
908
|
case "last":
|
|
909
|
-
c =
|
|
909
|
+
c = i[i.length - 1], y = "Latest";
|
|
910
910
|
break;
|
|
911
911
|
case "range":
|
|
912
|
-
c = Math.max(...
|
|
912
|
+
c = Math.max(...i) - Math.min(...i), y = "Range";
|
|
913
913
|
break;
|
|
914
914
|
case "product":
|
|
915
|
-
c =
|
|
915
|
+
c = i.reduce((f, v) => f * v, 1), y = "Product";
|
|
916
916
|
break;
|
|
917
917
|
case "std_dev": {
|
|
918
|
-
const f =
|
|
919
|
-
c = Math.sqrt(v),
|
|
918
|
+
const f = i.reduce((V, N) => V + N, 0) / i.length, v = i.reduce((V, N) => V + (N - f) ** 2, 0) / i.length;
|
|
919
|
+
c = Math.sqrt(v), y = "Std Dev";
|
|
920
920
|
break;
|
|
921
921
|
}
|
|
922
922
|
default:
|
|
923
|
-
c =
|
|
923
|
+
c = i.reduce((f, v) => f + v, 0) / i.length, y = "Average";
|
|
924
924
|
}
|
|
925
|
-
const
|
|
925
|
+
const M = Number.isInteger(c) ? c.toString() : c.toFixed(1);
|
|
926
926
|
return {
|
|
927
|
-
isGroup:
|
|
928
|
-
state:
|
|
927
|
+
isGroup: r,
|
|
928
|
+
state: M,
|
|
929
929
|
numericValue: c,
|
|
930
930
|
isUnavailable: !1,
|
|
931
931
|
unit: s,
|
|
932
|
-
description: `${
|
|
932
|
+
description: `${y} of ${i.length}`,
|
|
933
933
|
memberValues: a
|
|
934
934
|
};
|
|
935
935
|
}
|
|
@@ -937,13 +937,13 @@ function $e(e) {
|
|
|
937
937
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
938
938
|
const n = (e.attributes?.brightness ?? 255) / 255;
|
|
939
939
|
if (e.attributes?.rgb_color) {
|
|
940
|
-
const [
|
|
941
|
-
return `rgb(${Math.round(
|
|
940
|
+
const [r, i, a] = e.attributes.rgb_color;
|
|
941
|
+
return `rgb(${Math.round(r * n)}, ${Math.round(i * n)}, ${Math.round(a * n)})`;
|
|
942
942
|
}
|
|
943
943
|
if (e.attributes?.color_temp) {
|
|
944
|
-
const
|
|
944
|
+
const i = 1e6 / e.attributes.color_temp / 100;
|
|
945
945
|
let a, o, s;
|
|
946
|
-
return
|
|
946
|
+
return i <= 66 ? (a = 255, o = i <= 19 ? 0 : 99.4708025861 * Math.log(i - 10) - 161.1195681661, s = i <= 19 ? 0 : i <= 66 ? 138.5177312231 * Math.log(i - 10) - 305.0447927307 : 255) : (a = 329.698727446 * (i - 60) ** -0.1332047592, o = 288.1221695283 * (i - 60) ** -0.0755148492, s = 255), a = Math.max(0, Math.min(255, a)) * n, o = Math.max(0, Math.min(255, o)) * n, s = Math.max(0, Math.min(255, s)) * n, `rgb(${Math.round(a)}, ${Math.round(o)}, ${Math.round(s)})`;
|
|
947
947
|
}
|
|
948
948
|
return `rgb(${Math.round(255 * n)}, ${Math.round(220 * n)}, ${Math.round(180 * n)})`;
|
|
949
949
|
}
|
|
@@ -960,37 +960,37 @@ function Tt(e) {
|
|
|
960
960
|
}
|
|
961
961
|
return !1;
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function Bn(e, t = "unknown") {
|
|
964
964
|
return e?.state ?? t;
|
|
965
965
|
}
|
|
966
|
-
function
|
|
966
|
+
function Ln(e, t, n) {
|
|
967
967
|
return e?.attributes ? e.attributes[t] ?? n : n;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function jn(e, t) {
|
|
970
970
|
return e.filter((n) => n.state === t).length;
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function Fn(e) {
|
|
973
973
|
return e.filter(Ot).length;
|
|
974
974
|
}
|
|
975
|
-
function
|
|
975
|
+
function Un(e) {
|
|
976
976
|
return e.filter(Tt).length;
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Yn(e, t) {
|
|
979
979
|
return e.length > 0 && e.every((n) => n.state === t);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function Xn(e, t) {
|
|
982
982
|
return e.some((n) => n.state === t);
|
|
983
983
|
}
|
|
984
984
|
function Vt(e, t, n) {
|
|
985
|
-
const { decimals:
|
|
985
|
+
const { decimals: r, scale: i = !0 } = n || {};
|
|
986
986
|
if (typeof e == "string")
|
|
987
987
|
return t ? `${e}${t}` : e;
|
|
988
988
|
if (e == null || Number.isNaN(e))
|
|
989
989
|
return t ? `--${t}` : "--";
|
|
990
990
|
let a = e, o = t || "";
|
|
991
|
-
|
|
991
|
+
i && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (a = e / 1e6, o = "MW") : e >= 1e3 ? (a = e / 1e3, o = "kW") : o = "W"), i && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (a = e / 1073741824, o = "GB") : e >= 1048576 ? (a = e / 1048576, o = "MB") : e >= 1024 ? (a = e / 1024, o = "KB") : o = "B");
|
|
992
992
|
let s;
|
|
993
|
-
return
|
|
993
|
+
return r !== void 0 ? s = a.toFixed(r) : a !== e ? s = a.toFixed(1) : Number.isInteger(e) ? s = e.toString() : s = Number.parseFloat(e.toFixed(2)).toString(), o ? `${s}${o}` : s;
|
|
994
994
|
}
|
|
995
995
|
function Wt(e, t) {
|
|
996
996
|
return e == null || isNaN(e) ? null : t === "°C" ? e < 10 ? "Cold" : e < 18 ? "Cool" : e < 24 ? "Comfortable" : e < 28 ? "Warm" : "Hot" : t === "°F" ? e < 50 ? "Cold" : e < 64 ? "Cool" : e < 75 ? "Comfortable" : e < 82 ? "Warm" : "Hot" : t === "%" ? e < 20 ? "Very Low" : e < 40 ? "Low" : e < 60 ? "Medium" : e < 80 ? "High" : "Very High" : t === "ppm" ? e < 400 ? "Excellent" : e < 600 ? "Good" : e < 1e3 ? "Acceptable" : e < 1500 ? "Mediocre" : "Poor" : t === "lx" ? e < 50 ? "Dark" : e < 200 ? "Dim" : e < 500 ? "Moderate" : e < 1e3 ? "Bright" : "Very Bright" : t === "AQI" ? e <= 50 ? "Good" : e <= 100 ? "Moderate" : e <= 150 ? "Unhealthy for Sensitive" : e <= 200 ? "Unhealthy" : e <= 300 ? "Very Unhealthy" : "Hazardous" : t === "dB" ? e < 30 ? "Very Quiet" : e < 50 ? "Quiet" : e < 70 ? "Moderate" : e < 85 ? "Loud" : "Very Loud" : null;
|
|
@@ -999,22 +999,22 @@ var It = /* @__PURE__ */ w("<div><div>"), Rt = /* @__PURE__ */ w("<div>");
|
|
|
999
999
|
function Gt(e) {
|
|
1000
1000
|
const t = G();
|
|
1001
1001
|
return (() => {
|
|
1002
|
-
var n = It(),
|
|
1003
|
-
return
|
|
1004
|
-
var
|
|
1005
|
-
return () =>
|
|
1002
|
+
var n = It(), r = n.firstChild;
|
|
1003
|
+
return x(r, () => Vt(e.value, e.unit)), x(n, (() => {
|
|
1004
|
+
var i = E(() => !!(e.interpret && typeof e.value == "number"));
|
|
1005
|
+
return () => i() && (() => {
|
|
1006
1006
|
var a = Rt();
|
|
1007
|
-
return
|
|
1008
|
-
var s = S("text-foreground/60",
|
|
1009
|
-
return s !== o.e &&
|
|
1007
|
+
return x(a, () => Wt(e.value, e.unit)), D((o) => {
|
|
1008
|
+
var s = S("text-foreground/60", F.subtitle(t.size())), l = W.S1(t.size());
|
|
1009
|
+
return s !== o.e && C(a, o.e = s), l !== o.t && z(a, "margin-top", o.t = l), o;
|
|
1010
1010
|
}, {
|
|
1011
1011
|
e: void 0,
|
|
1012
1012
|
t: void 0
|
|
1013
1013
|
}), a;
|
|
1014
1014
|
})();
|
|
1015
|
-
})(), null),
|
|
1016
|
-
var a = S("flex flex-col", e.class), o = S("font-bold text-foreground",
|
|
1017
|
-
return a !==
|
|
1015
|
+
})(), null), D((i) => {
|
|
1016
|
+
var a = S("flex flex-col", e.class), o = S("font-bold text-foreground", F.value(t.size()));
|
|
1017
|
+
return a !== i.e && C(n, i.e = a), o !== i.t && C(r, i.t = o), i;
|
|
1018
1018
|
}, {
|
|
1019
1019
|
e: void 0,
|
|
1020
1020
|
t: void 0
|
|
@@ -1034,85 +1034,86 @@ function Kt(e, t) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
function qt(e) {
|
|
1036
1036
|
let t;
|
|
1037
|
-
const n = We(() => t),
|
|
1038
|
-
|
|
1039
|
-
const
|
|
1040
|
-
(Math.abs(
|
|
1037
|
+
const n = We(() => t), r = 2, [i, a] = j(0), [o, s] = j(0);
|
|
1038
|
+
q(() => {
|
|
1039
|
+
const h = Math.round(n.width ?? 0), u = Math.round(n.height ?? 0), O = ve(i), k = ve(o);
|
|
1040
|
+
(Math.abs(h - O) > r || Math.abs(u - k) > r) && (a(h), s(u));
|
|
1041
1041
|
});
|
|
1042
1042
|
const l = A(() => {
|
|
1043
1043
|
if (e.variant)
|
|
1044
1044
|
return typeof e.variant == "string" ? Ue(e.variant) : e.variant;
|
|
1045
1045
|
}), d = A(() => ({
|
|
1046
|
-
width:
|
|
1046
|
+
width: i(),
|
|
1047
1047
|
height: o(),
|
|
1048
|
-
gridWidth: Math.max(1, Math.round(
|
|
1048
|
+
gridWidth: Math.max(1, Math.round(i() / 150)),
|
|
1049
1049
|
gridHeight: Math.max(1, Math.round(o() / 75))
|
|
1050
1050
|
}), void 0, {
|
|
1051
|
-
equals: (
|
|
1051
|
+
equals: (h, u) => h.width === u.width && h.height === u.height && h.gridWidth === u.gridWidth && h.gridHeight === u.gridHeight
|
|
1052
1052
|
}), c = A(() => {
|
|
1053
|
-
const
|
|
1054
|
-
return Yt(
|
|
1055
|
-
}),
|
|
1056
|
-
const
|
|
1057
|
-
return Xt(
|
|
1058
|
-
}),
|
|
1059
|
-
const
|
|
1060
|
-
return Kt(
|
|
1053
|
+
const h = d();
|
|
1054
|
+
return Yt(h.gridWidth, h.gridHeight);
|
|
1055
|
+
}), y = A(() => {
|
|
1056
|
+
const h = d();
|
|
1057
|
+
return Xt(h.width, h.height);
|
|
1058
|
+
}), M = A(() => {
|
|
1059
|
+
const h = d();
|
|
1060
|
+
return Kt(h.width, h.height);
|
|
1061
1061
|
}), f = Se(me), v = f;
|
|
1062
|
-
v?._isStub?.() && v._bridge && (
|
|
1062
|
+
v?._isStub?.() && v._bridge && (q(() => {
|
|
1063
1063
|
v._bridge.setSize(c());
|
|
1064
|
-
}),
|
|
1065
|
-
v._bridge.setOrientation(
|
|
1066
|
-
}),
|
|
1067
|
-
v._bridge.setContentLayout(
|
|
1068
|
-
}),
|
|
1064
|
+
}), q(() => {
|
|
1065
|
+
v._bridge.setOrientation(y());
|
|
1066
|
+
}), q(() => {
|
|
1067
|
+
v._bridge.setContentLayout(M());
|
|
1068
|
+
}), q(() => {
|
|
1069
1069
|
v._bridge.setDimensions(d());
|
|
1070
|
-
}),
|
|
1070
|
+
}), q(() => {
|
|
1071
1071
|
v._bridge.setIsStub(!1);
|
|
1072
1072
|
}));
|
|
1073
1073
|
const V = {
|
|
1074
1074
|
size: c,
|
|
1075
|
-
orientation:
|
|
1076
|
-
contentLayout:
|
|
1075
|
+
orientation: y,
|
|
1076
|
+
contentLayout: M,
|
|
1077
1077
|
dimensions: d,
|
|
1078
1078
|
isEditMode: () => e.isEditMode ?? !1,
|
|
1079
1079
|
updateConfig: f?.updateConfig ?? (() => {
|
|
1080
1080
|
})
|
|
1081
|
-
}, N = "bg-gradient-to-br from-gray-500/20 to-gray-600/20",
|
|
1081
|
+
}, N = "bg-gradient-to-br from-gray-500/20 to-gray-600/20", I = A(() => e.emptyState && !e.gradient ? N : e.gradient), X = A(() => ({
|
|
1082
1082
|
"container-type": "size",
|
|
1083
1083
|
"container-name": "widget",
|
|
1084
|
+
"touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
|
|
1084
1085
|
...l()?.styles?.container,
|
|
1085
1086
|
...l()?.styles?.cssVars || {}
|
|
1086
|
-
})),
|
|
1087
|
-
|
|
1088
|
-
},
|
|
1089
|
-
|
|
1090
|
-
},
|
|
1091
|
-
|
|
1092
|
-
}, P = (
|
|
1093
|
-
|
|
1094
|
-
},
|
|
1095
|
-
|
|
1087
|
+
})), m = () => !!e.gestures && !e.isEditMode, b = (h) => {
|
|
1088
|
+
m() && e.gestures?.onPointerEnter(h);
|
|
1089
|
+
}, $ = (h) => {
|
|
1090
|
+
m() && e.gestures?.onPointerDown(h);
|
|
1091
|
+
}, p = (h) => {
|
|
1092
|
+
m() && e.gestures?.onPointerMove(h);
|
|
1093
|
+
}, P = (h) => {
|
|
1094
|
+
m() && e.gestures?.onPointerUp(h);
|
|
1095
|
+
}, B = (h) => {
|
|
1096
|
+
m() && e.gestures?.onPointerCancel(h);
|
|
1096
1097
|
};
|
|
1097
1098
|
return T(me.Provider, {
|
|
1098
1099
|
value: V,
|
|
1099
1100
|
get children() {
|
|
1100
|
-
var
|
|
1101
|
-
return ne(
|
|
1101
|
+
var h = Pt(), u = h.firstChild, O = u.firstChild;
|
|
1102
|
+
return ne(h, "pointercancel", B), ne(h, "pointerup", P), ne(h, "pointermove", p), ne(h, "pointerdown", $), ne(h, "pointerenter", b), Ne((k) => {
|
|
1102
1103
|
t = k, e.gestures?.bindElement(k);
|
|
1103
|
-
},
|
|
1104
|
+
}, h), x(u, (() => {
|
|
1104
1105
|
var k = E(() => !!e.backgroundGlow);
|
|
1105
1106
|
return () => k() && (() => {
|
|
1106
|
-
var
|
|
1107
|
-
return
|
|
1108
|
-
var
|
|
1109
|
-
return
|
|
1107
|
+
var R = Ht(), Q = R.firstChild;
|
|
1108
|
+
return D((L) => {
|
|
1109
|
+
var K = U.BACKGROUND, ae = S("absolute inset-0 opacity-20 blur-2xl", e.backgroundGlow);
|
|
1110
|
+
return K !== L.e && z(R, "z-index", L.e = K), ae !== L.t && C(Q, L.t = ae), L;
|
|
1110
1111
|
}, {
|
|
1111
1112
|
e: void 0,
|
|
1112
1113
|
t: void 0
|
|
1113
|
-
}),
|
|
1114
|
+
}), R;
|
|
1114
1115
|
})();
|
|
1115
|
-
})(),
|
|
1116
|
+
})(), O), x(O, (() => {
|
|
1116
1117
|
var k = E(() => !!e.emptyState);
|
|
1117
1118
|
return () => k() ? T(Jt, {
|
|
1118
1119
|
get icon() {
|
|
@@ -1125,68 +1126,68 @@ function qt(e) {
|
|
|
1125
1126
|
return e.emptyState.message;
|
|
1126
1127
|
}
|
|
1127
1128
|
}) : e.children;
|
|
1128
|
-
})()),
|
|
1129
|
+
})()), x(u, (() => {
|
|
1129
1130
|
var k = E(() => !!e.loading);
|
|
1130
1131
|
return () => k() && (() => {
|
|
1131
|
-
var
|
|
1132
|
-
return
|
|
1132
|
+
var R = Bt();
|
|
1133
|
+
return D((Q) => z(R, "z-index", U.OVERLAY)), R;
|
|
1133
1134
|
})();
|
|
1134
|
-
})(), null),
|
|
1135
|
-
var
|
|
1135
|
+
})(), null), D((k) => {
|
|
1136
|
+
var R = S(
|
|
1136
1137
|
"relative h-full w-full select-none rounded-xl border border-border/50",
|
|
1137
1138
|
// Variant styles (lowest priority)
|
|
1138
1139
|
l()?.styles?.class,
|
|
1139
1140
|
// Custom class (highest priority)
|
|
1140
1141
|
e.class
|
|
1141
|
-
), Q =
|
|
1142
|
+
), Q = X(), L = S(
|
|
1142
1143
|
"relative h-full w-full overflow-hidden rounded-xl",
|
|
1143
1144
|
// Gradient prop (overrides variant, auto-applied for empty state)
|
|
1144
|
-
|
|
1145
|
-
),
|
|
1146
|
-
return
|
|
1145
|
+
I()
|
|
1146
|
+
), K = U.CONTENT;
|
|
1147
|
+
return R !== k.e && C(h, k.e = R), k.t = se(h, Q, k.t), L !== k.a && C(u, k.a = L), K !== k.o && z(O, "z-index", k.o = K), k;
|
|
1147
1148
|
}, {
|
|
1148
1149
|
e: void 0,
|
|
1149
1150
|
t: void 0,
|
|
1150
1151
|
a: void 0,
|
|
1151
1152
|
o: void 0
|
|
1152
|
-
}),
|
|
1153
|
+
}), h;
|
|
1153
1154
|
}
|
|
1154
1155
|
});
|
|
1155
1156
|
}
|
|
1156
1157
|
function Jt(e) {
|
|
1157
1158
|
return (() => {
|
|
1158
1159
|
var t = Lt();
|
|
1159
|
-
return
|
|
1160
|
+
return x(t, (() => {
|
|
1160
1161
|
var n = E(() => !!e.icon);
|
|
1161
1162
|
return () => n() && (() => {
|
|
1162
|
-
var
|
|
1163
|
-
return
|
|
1163
|
+
var r = jt();
|
|
1164
|
+
return x(r, () => e.icon), r;
|
|
1164
1165
|
})();
|
|
1165
|
-
})(), null),
|
|
1166
|
+
})(), null), x(t, (() => {
|
|
1166
1167
|
var n = E(() => !!e.title);
|
|
1167
1168
|
return () => n() && (() => {
|
|
1168
|
-
var
|
|
1169
|
-
return
|
|
1169
|
+
var r = Ft();
|
|
1170
|
+
return x(r, () => e.title), r;
|
|
1170
1171
|
})();
|
|
1171
|
-
})(), null),
|
|
1172
|
+
})(), null), x(t, (() => {
|
|
1172
1173
|
var n = E(() => !!e.message);
|
|
1173
1174
|
return () => n() && (() => {
|
|
1174
|
-
var
|
|
1175
|
-
return
|
|
1175
|
+
var r = Ut();
|
|
1176
|
+
return x(r, () => e.message), r;
|
|
1176
1177
|
})();
|
|
1177
1178
|
})(), null), t;
|
|
1178
1179
|
})();
|
|
1179
1180
|
}
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1181
|
+
const Y = qt;
|
|
1182
|
+
Y.Content = it;
|
|
1183
|
+
Y.Icon = vt;
|
|
1184
|
+
Y.Title = Et;
|
|
1185
|
+
Y.Subtitle = zt;
|
|
1186
|
+
Y.Status = Ct;
|
|
1187
|
+
Y.Value = Gt;
|
|
1188
|
+
Y.Metrics = ze;
|
|
1189
|
+
Y.EmptyState = ut;
|
|
1190
|
+
Y.SliderFill = et;
|
|
1190
1191
|
var Zt = /* @__PURE__ */ w("<div><div>");
|
|
1191
1192
|
const Qt = {
|
|
1192
1193
|
blue: "bg-blue-500/30",
|
|
@@ -1196,13 +1197,13 @@ const Qt = {
|
|
|
1196
1197
|
purple: "bg-purple-500/30",
|
|
1197
1198
|
gray: "bg-gray-500/30"
|
|
1198
1199
|
};
|
|
1199
|
-
function
|
|
1200
|
+
function Kn(e) {
|
|
1200
1201
|
const t = () => Qt[e.color] ?? e.color;
|
|
1201
1202
|
return (() => {
|
|
1202
|
-
var n = Zt(),
|
|
1203
|
-
return
|
|
1204
|
-
var a = S("pointer-events-none absolute inset-0", e.class), o =
|
|
1205
|
-
return a !==
|
|
1203
|
+
var n = Zt(), r = n.firstChild;
|
|
1204
|
+
return D((i) => {
|
|
1205
|
+
var a = S("pointer-events-none absolute inset-0", e.class), o = U.BACKGROUND, s = S("absolute inset-0 opacity-40 blur-3xl", t());
|
|
1206
|
+
return a !== i.e && C(n, i.e = a), o !== i.t && z(n, "z-index", i.t = o), s !== i.a && C(r, i.a = s), i;
|
|
1206
1207
|
}, {
|
|
1207
1208
|
e: void 0,
|
|
1208
1209
|
t: void 0,
|
|
@@ -1211,53 +1212,53 @@ function Xn(e) {
|
|
|
1211
1212
|
})();
|
|
1212
1213
|
}
|
|
1213
1214
|
var en = /* @__PURE__ */ w("<div>");
|
|
1214
|
-
function
|
|
1215
|
+
function qn(e) {
|
|
1215
1216
|
const t = G(), n = () => {
|
|
1216
|
-
const
|
|
1217
|
-
return
|
|
1217
|
+
const r = e.spacing ?? "S2";
|
|
1218
|
+
return W[r](t.size());
|
|
1218
1219
|
};
|
|
1219
1220
|
return (() => {
|
|
1220
|
-
var
|
|
1221
|
-
return
|
|
1221
|
+
var r = en();
|
|
1222
|
+
return x(r, () => e.children), D((i) => {
|
|
1222
1223
|
var a = S("flex flex-col", e.class), o = n();
|
|
1223
|
-
return a !==
|
|
1224
|
+
return a !== i.e && C(r, i.e = a), o !== i.t && z(r, "gap", i.t = o), i;
|
|
1224
1225
|
}, {
|
|
1225
1226
|
e: void 0,
|
|
1226
1227
|
t: void 0
|
|
1227
|
-
}),
|
|
1228
|
+
}), r;
|
|
1228
1229
|
})();
|
|
1229
1230
|
}
|
|
1230
1231
|
var tn = /* @__PURE__ */ w('<span class="inline-flex size-3.5 shrink-0 items-center">'), nn = /* @__PURE__ */ w("<button type=button>"), rn = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z">'), an = /* @__PURE__ */ w('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No edit options available'), on = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>'), sn = /* @__PURE__ */ w('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), ln = /* @__PURE__ */ w('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4">'), cn = /* @__PURE__ */ w('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No debug information available'), un = /* @__PURE__ */ w('<div class="min-w-0 shrink-0">'), dn = /* @__PURE__ */ w('<div class="flex items-center gap-2"><div class="flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5">'), gn = /* @__PURE__ */ w('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), mn = /* @__PURE__ */ w('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
|
|
1231
1232
|
function fn(e) {
|
|
1232
1233
|
return (() => {
|
|
1233
1234
|
var t = nn();
|
|
1234
|
-
return t.$$click = () => e.onClick(),
|
|
1235
|
+
return t.$$click = () => e.onClick(), x(t, T(te, {
|
|
1235
1236
|
get when() {
|
|
1236
1237
|
return e.isActive;
|
|
1237
1238
|
},
|
|
1238
1239
|
get children() {
|
|
1239
1240
|
var n = tn();
|
|
1240
|
-
return
|
|
1241
|
+
return x(n, () => e.icon), n;
|
|
1241
1242
|
}
|
|
1242
|
-
}), null),
|
|
1243
|
+
}), null), x(t, () => e.label, null), D(() => C(t, S("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
|
|
1243
1244
|
})();
|
|
1244
1245
|
}
|
|
1245
|
-
function
|
|
1246
|
-
const [t] = Ae(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [
|
|
1247
|
-
|
|
1248
|
-
u &&
|
|
1246
|
+
function Jn(e) {
|
|
1247
|
+
const [t] = Ae(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = j({}), [a, o] = j(null);
|
|
1248
|
+
q(be(() => t.config, (u) => {
|
|
1249
|
+
u && i({
|
|
1249
1250
|
...u
|
|
1250
1251
|
});
|
|
1251
|
-
})),
|
|
1252
|
+
})), q(be(() => t.configSchema, (u) => {
|
|
1252
1253
|
u && o(pe(u));
|
|
1253
1254
|
}));
|
|
1254
|
-
const s = () => n() && JSON.stringify(
|
|
1255
|
-
!u && t.config &&
|
|
1255
|
+
const s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), l = (u) => {
|
|
1256
|
+
!u && t.config && i({
|
|
1256
1257
|
...t.config
|
|
1257
1258
|
}), t.onOpenChange(u);
|
|
1258
1259
|
}, d = () => {
|
|
1259
|
-
t.onConfigSave?.(
|
|
1260
|
-
}, [c,
|
|
1260
|
+
t.onConfigSave?.(r());
|
|
1261
|
+
}, [c, y] = j(t.defaultTab ?? "controls"), M = () => {
|
|
1261
1262
|
const u = t.maxWidth ?? "3xl";
|
|
1262
1263
|
return {
|
|
1263
1264
|
sm: "max-w-sm",
|
|
@@ -1275,14 +1276,14 @@ function qn(e) {
|
|
|
1275
1276
|
id: "edit",
|
|
1276
1277
|
label: "Edit",
|
|
1277
1278
|
icon: rn(),
|
|
1278
|
-
content: t.editContent ?? (n() && a() ? T(
|
|
1279
|
+
content: t.editContent ?? (n() && a() ? T(p, {
|
|
1279
1280
|
get schema() {
|
|
1280
1281
|
return a();
|
|
1281
1282
|
},
|
|
1282
1283
|
get data() {
|
|
1283
|
-
return
|
|
1284
|
+
return r();
|
|
1284
1285
|
},
|
|
1285
|
-
onChange:
|
|
1286
|
+
onChange: i
|
|
1286
1287
|
}) : an())
|
|
1287
1288
|
}), u.push({
|
|
1288
1289
|
id: "controls",
|
|
@@ -1305,35 +1306,35 @@ function qn(e) {
|
|
|
1305
1306
|
}, V = () => {
|
|
1306
1307
|
const u = f();
|
|
1307
1308
|
return u.find((k) => k.id === c())?.content ?? u[0]?.content;
|
|
1308
|
-
}, N = t.ResponsiveDialog,
|
|
1309
|
+
}, N = t.ResponsiveDialog, I = t.ResponsiveDialogContent, X = t.ResponsiveDialogHeader, m = t.ResponsiveDialogTitle, b = t.ResponsiveDialogDescription, $ = t.Button, p = t.SchemaForm, P = (u) => n() ? l(u) : t.onOpenChange(u), B = () => n() ? s() : t.hasUnsavedChanges, h = () => n() ? d : t.onSave;
|
|
1309
1310
|
return T(N, {
|
|
1310
1311
|
get open() {
|
|
1311
1312
|
return t.open;
|
|
1312
1313
|
},
|
|
1313
1314
|
onOpenChange: (u) => P(u),
|
|
1314
1315
|
get children() {
|
|
1315
|
-
return T(
|
|
1316
|
+
return T(I, {
|
|
1316
1317
|
get class() {
|
|
1317
|
-
return S(
|
|
1318
|
+
return S(M(), t.class);
|
|
1318
1319
|
},
|
|
1319
1320
|
get children() {
|
|
1320
|
-
return [T(
|
|
1321
|
+
return [T(X, {
|
|
1321
1322
|
class: "flex flex-row items-center justify-between gap-3",
|
|
1322
1323
|
get children() {
|
|
1323
1324
|
return [(() => {
|
|
1324
1325
|
var u = un();
|
|
1325
|
-
return
|
|
1326
|
+
return x(u, T(m, {
|
|
1326
1327
|
class: "truncate leading-tight",
|
|
1327
1328
|
get children() {
|
|
1328
1329
|
return t.title;
|
|
1329
1330
|
}
|
|
1330
|
-
}), null),
|
|
1331
|
+
}), null), x(u, T(b, {
|
|
1331
1332
|
class: "sr-only",
|
|
1332
1333
|
children: "Widget configuration dialog"
|
|
1333
1334
|
}), null), u;
|
|
1334
1335
|
})(), (() => {
|
|
1335
|
-
var u = dn(),
|
|
1336
|
-
return
|
|
1336
|
+
var u = dn(), O = u.firstChild;
|
|
1337
|
+
return x(O, () => f().map((k) => T(fn, {
|
|
1337
1338
|
get icon() {
|
|
1338
1339
|
return k.icon;
|
|
1339
1340
|
},
|
|
@@ -1343,8 +1344,8 @@ function qn(e) {
|
|
|
1343
1344
|
get isActive() {
|
|
1344
1345
|
return c() === k.id;
|
|
1345
1346
|
},
|
|
1346
|
-
onClick: () =>
|
|
1347
|
-
}))),
|
|
1347
|
+
onClick: () => y(k.id)
|
|
1348
|
+
}))), x(u, T(te, {
|
|
1348
1349
|
get when() {
|
|
1349
1350
|
return t.headerActions;
|
|
1350
1351
|
},
|
|
@@ -1356,45 +1357,45 @@ function qn(e) {
|
|
|
1356
1357
|
}
|
|
1357
1358
|
}), (() => {
|
|
1358
1359
|
var u = gn();
|
|
1359
|
-
return
|
|
1360
|
+
return x(u, V), u;
|
|
1360
1361
|
})(), T(te, {
|
|
1361
1362
|
get when() {
|
|
1362
|
-
return E(() => c() === "edit")() && (
|
|
1363
|
+
return E(() => c() === "edit")() && (h() || t.onDelete) || c() === "debug" && t.debugData !== void 0;
|
|
1363
1364
|
},
|
|
1364
1365
|
get children() {
|
|
1365
1366
|
var u = mn();
|
|
1366
|
-
return
|
|
1367
|
+
return x(u, T(te, {
|
|
1367
1368
|
get when() {
|
|
1368
1369
|
return E(() => c() === "edit")() && t.onDelete;
|
|
1369
1370
|
},
|
|
1370
1371
|
get children() {
|
|
1371
|
-
return T(
|
|
1372
|
+
return T($, {
|
|
1372
1373
|
size: "sm",
|
|
1373
1374
|
variant: "destructive",
|
|
1374
1375
|
onClick: () => t.onDelete?.(),
|
|
1375
1376
|
children: "Delete"
|
|
1376
1377
|
});
|
|
1377
1378
|
}
|
|
1378
|
-
}), null),
|
|
1379
|
+
}), null), x(u, T(te, {
|
|
1379
1380
|
get when() {
|
|
1380
|
-
return E(() => c() === "edit")() &&
|
|
1381
|
+
return E(() => c() === "edit")() && h();
|
|
1381
1382
|
},
|
|
1382
1383
|
get children() {
|
|
1383
|
-
return T(
|
|
1384
|
+
return T($, {
|
|
1384
1385
|
size: "sm",
|
|
1385
1386
|
get disabled() {
|
|
1386
|
-
return !
|
|
1387
|
+
return !B();
|
|
1387
1388
|
},
|
|
1388
|
-
onClick: () =>
|
|
1389
|
+
onClick: () => h()?.(),
|
|
1389
1390
|
children: "Save"
|
|
1390
1391
|
});
|
|
1391
1392
|
}
|
|
1392
|
-
}), null),
|
|
1393
|
+
}), null), x(u, T(te, {
|
|
1393
1394
|
get when() {
|
|
1394
1395
|
return E(() => c() === "debug")() && t.debugData !== void 0;
|
|
1395
1396
|
},
|
|
1396
1397
|
get children() {
|
|
1397
|
-
return T(
|
|
1398
|
+
return T($, {
|
|
1398
1399
|
size: "sm",
|
|
1399
1400
|
variant: "outline",
|
|
1400
1401
|
onClick: v,
|
|
@@ -1410,79 +1411,79 @@ function qn(e) {
|
|
|
1410
1411
|
});
|
|
1411
1412
|
}
|
|
1412
1413
|
Oe(["click"]);
|
|
1413
|
-
const ie = 32, g = ie / 2,
|
|
1414
|
+
const ie = 32, g = ie / 2, H = "white", le = "rgba(0,0,0,0.4)", xe = 2, ce = 3;
|
|
1414
1415
|
function hn(e) {
|
|
1415
1416
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
1416
1417
|
}
|
|
1417
|
-
function
|
|
1418
|
+
function ue(e) {
|
|
1418
1419
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${ie}" height="${ie}" viewBox="0 0 ${ie} ${ie}">${e}</svg>`;
|
|
1419
1420
|
}
|
|
1420
|
-
const xn =
|
|
1421
|
+
const xn = ue(`
|
|
1421
1422
|
<g transform="translate(6, 2)">
|
|
1422
1423
|
<!-- shadow -->
|
|
1423
|
-
<g stroke="${
|
|
1424
|
+
<g stroke="${le}" stroke-width="${ce}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1424
1425
|
<path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
|
|
1425
1426
|
</g>
|
|
1426
1427
|
<!-- main -->
|
|
1427
|
-
<g stroke="${
|
|
1428
|
+
<g stroke="${H}" stroke-width="${xe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1428
1429
|
<path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
|
|
1429
1430
|
</g>
|
|
1430
1431
|
</g>
|
|
1431
|
-
`), vn =
|
|
1432
|
+
`), vn = ue(`
|
|
1432
1433
|
<g>
|
|
1433
|
-
<circle cx="${g}" cy="${g}" r="8" stroke="${
|
|
1434
|
-
<circle cx="${g}" cy="${g}" r="8" stroke="${
|
|
1435
|
-
<circle cx="${g}" cy="${g}" r="1.5" fill="${
|
|
1434
|
+
<circle cx="${g}" cy="${g}" r="8" stroke="${le}" stroke-width="${ce}" fill="none"/>
|
|
1435
|
+
<circle cx="${g}" cy="${g}" r="8" stroke="${H}" stroke-width="1.5" fill="none"/>
|
|
1436
|
+
<circle cx="${g}" cy="${g}" r="1.5" fill="${H}"/>
|
|
1436
1437
|
</g>
|
|
1437
|
-
`), bn =
|
|
1438
|
+
`), bn = ue(`
|
|
1438
1439
|
<g>
|
|
1439
1440
|
<!-- shadow -->
|
|
1440
|
-
<g stroke="${
|
|
1441
|
+
<g stroke="${le}" stroke-width="${ce}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1441
1442
|
<line x1="6" y1="${g}" x2="26" y2="${g}"/>
|
|
1442
1443
|
<polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
|
|
1443
1444
|
<polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
|
|
1444
1445
|
</g>
|
|
1445
1446
|
<!-- main -->
|
|
1446
|
-
<g stroke="${
|
|
1447
|
+
<g stroke="${H}" stroke-width="${xe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1447
1448
|
<line x1="6" y1="${g}" x2="26" y2="${g}"/>
|
|
1448
1449
|
<polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
|
|
1449
1450
|
<polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
|
|
1450
1451
|
</g>
|
|
1451
1452
|
<!-- center grip dots -->
|
|
1452
|
-
<circle cx="${g}" cy="${g}" r="1.5" fill="${
|
|
1453
|
-
<circle cx="${g - 5}" cy="${g}" r="1" fill="${
|
|
1454
|
-
<circle cx="${g + 5}" cy="${g}" r="1" fill="${
|
|
1453
|
+
<circle cx="${g}" cy="${g}" r="1.5" fill="${H}"/>
|
|
1454
|
+
<circle cx="${g - 5}" cy="${g}" r="1" fill="${H}" opacity="0.6"/>
|
|
1455
|
+
<circle cx="${g + 5}" cy="${g}" r="1" fill="${H}" opacity="0.6"/>
|
|
1455
1456
|
</g>
|
|
1456
|
-
`), yn =
|
|
1457
|
+
`), yn = ue(`
|
|
1457
1458
|
<g>
|
|
1458
1459
|
<!-- shadow -->
|
|
1459
|
-
<g stroke="${
|
|
1460
|
+
<g stroke="${le}" stroke-width="${ce}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1460
1461
|
<line x1="${g}" y1="6" x2="${g}" y2="26"/>
|
|
1461
1462
|
<polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
|
|
1462
1463
|
<polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
|
|
1463
1464
|
</g>
|
|
1464
1465
|
<!-- main -->
|
|
1465
|
-
<g stroke="${
|
|
1466
|
+
<g stroke="${H}" stroke-width="${xe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1466
1467
|
<line x1="${g}" y1="6" x2="${g}" y2="26"/>
|
|
1467
1468
|
<polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
|
|
1468
1469
|
<polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
|
|
1469
1470
|
</g>
|
|
1470
1471
|
<!-- center grip dots -->
|
|
1471
|
-
<circle cx="${g}" cy="${g}" r="1.5" fill="${
|
|
1472
|
-
<circle cx="${g}" cy="${g - 5}" r="1" fill="${
|
|
1473
|
-
<circle cx="${g}" cy="${g + 5}" r="1" fill="${
|
|
1472
|
+
<circle cx="${g}" cy="${g}" r="1.5" fill="${H}"/>
|
|
1473
|
+
<circle cx="${g}" cy="${g - 5}" r="1" fill="${H}" opacity="0.6"/>
|
|
1474
|
+
<circle cx="${g}" cy="${g + 5}" r="1" fill="${H}" opacity="0.6"/>
|
|
1474
1475
|
</g>
|
|
1475
1476
|
`);
|
|
1476
|
-
function
|
|
1477
|
+
function oe(e, t, n) {
|
|
1477
1478
|
return { css: `${hn(e)} ${t} ${n}, auto`, hotspotX: t, hotspotY: n };
|
|
1478
1479
|
}
|
|
1479
1480
|
const Z = {
|
|
1480
|
-
tap:
|
|
1481
|
-
hold:
|
|
1482
|
-
slideHorizontal:
|
|
1483
|
-
slideVertical:
|
|
1481
|
+
tap: oe(xn, 12, 4),
|
|
1482
|
+
hold: oe(vn, 16, 16),
|
|
1483
|
+
slideHorizontal: oe(bn, g, g),
|
|
1484
|
+
slideVertical: oe(yn, g, g)
|
|
1484
1485
|
};
|
|
1485
|
-
function
|
|
1486
|
+
function Zn(e, t) {
|
|
1486
1487
|
const n = {
|
|
1487
1488
|
isDown: !1,
|
|
1488
1489
|
startX: 0,
|
|
@@ -1497,109 +1498,117 @@ function Jn(e, t) {
|
|
|
1497
1498
|
lockedAxis: null,
|
|
1498
1499
|
element: null
|
|
1499
1500
|
};
|
|
1500
|
-
let
|
|
1501
|
-
function o(
|
|
1502
|
-
|
|
1503
|
-
const $ =
|
|
1501
|
+
let r = null, i = null, a = null;
|
|
1502
|
+
function o(m) {
|
|
1503
|
+
m !== i && (a && a.disconnect(), a = new ResizeObserver((b) => {
|
|
1504
|
+
const $ = b[0];
|
|
1504
1505
|
if ($) {
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1506
|
+
const p = $.borderBoxSize?.[0];
|
|
1507
|
+
p ? r = { width: p.inlineSize, height: p.blockSize } : r = { width: $.contentRect.width, height: $.contentRect.height };
|
|
1507
1508
|
}
|
|
1508
|
-
}),
|
|
1509
|
+
}), i = m, a.observe(m), r = { width: m.clientWidth, height: m.clientHeight });
|
|
1509
1510
|
}
|
|
1510
1511
|
const s = 10, l = 5, d = () => {
|
|
1511
1512
|
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null), n.slideActivationTimer && (clearTimeout(n.slideActivationTimer), n.slideActivationTimer = null);
|
|
1512
|
-
}, c = (
|
|
1513
|
+
}, c = (m) => {
|
|
1513
1514
|
const $ = e().slide;
|
|
1514
|
-
return $?.orientation === "horizontal" ? "horizontal" : $?.orientation === "vertical" ? "vertical" :
|
|
1515
|
-
},
|
|
1516
|
-
const
|
|
1517
|
-
if (!(!
|
|
1518
|
-
if (
|
|
1519
|
-
const $ =
|
|
1515
|
+
return $?.orientation === "horizontal" ? "horizontal" : $?.orientation === "vertical" ? "vertical" : m && (r || o(m), r) ? r.height > r.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1516
|
+
}, y = (m) => {
|
|
1517
|
+
const b = e();
|
|
1518
|
+
if (!(!b.tap && !b.hold && !b.slide)) {
|
|
1519
|
+
if (m.preventDefault(), n.isDown = !0, n.element = m.currentTarget, o(n.element), n.startX = m.clientX, n.startY = m.clientY, n.currentX = m.clientX, n.currentY = m.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, m.currentTarget.setPointerCapture(m.pointerId), b.hold) {
|
|
1520
|
+
const $ = b.hold.delay ?? 300;
|
|
1520
1521
|
n.holdTimer = setTimeout(() => {
|
|
1521
|
-
n.isDown && !n.hasMoved && (
|
|
1522
|
+
n.isDown && !n.hasMoved && (b.hold.action(), n.isDown = !1);
|
|
1522
1523
|
}, $);
|
|
1523
1524
|
}
|
|
1524
|
-
if (
|
|
1525
|
-
const $ =
|
|
1525
|
+
if (b.slide) {
|
|
1526
|
+
const $ = b.slide.activationDelay ?? 0;
|
|
1526
1527
|
$ > 0 ? n.slideActivationTimer = setTimeout(() => {
|
|
1527
1528
|
n.slideActive = !0;
|
|
1528
1529
|
}, $) : n.slideActive = !0;
|
|
1529
1530
|
}
|
|
1530
1531
|
}
|
|
1531
|
-
},
|
|
1532
|
+
}, M = (m) => {
|
|
1532
1533
|
if (!n.isDown) return;
|
|
1533
|
-
const
|
|
1534
|
-
n.currentX =
|
|
1535
|
-
const $ = n.currentX - n.startX,
|
|
1536
|
-
if (!n.lockedAxis &&
|
|
1537
|
-
|
|
1534
|
+
const b = e();
|
|
1535
|
+
n.currentX = m.clientX, n.currentY = m.clientY;
|
|
1536
|
+
const $ = n.currentX - n.startX, p = n.currentY - n.startY, P = Math.abs($), B = Math.abs(p), h = Math.sqrt($ * $ + p * p), u = m.currentTarget, O = c(u);
|
|
1537
|
+
if (!n.lockedAxis && h > l && (P > B ? n.lockedAxis = "horizontal" : n.lockedAxis = "vertical", b.slide && n.lockedAxis !== O)) {
|
|
1538
|
+
u.releasePointerCapture(m.pointerId), n.isDown = !1, n.slideActive = !1, d();
|
|
1538
1539
|
return;
|
|
1539
1540
|
}
|
|
1540
|
-
if (
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1541
|
+
if (h > s && (n.hasMoved = !0, d()), b.slide && n.slideActive && n.hasMoved && n.lockedAxis === O) {
|
|
1542
|
+
const k = b.slide.min ?? 0, R = b.slide.max ?? 100, Q = R - k, L = O === "vertical" ? -p : $, K = r ?? { width: u.clientWidth, height: u.clientHeight }, ae = O === "vertical" ? K.height : K.width, De = L / ae * Q, _e = Math.max(k, Math.min(R, b.slide.value + De));
|
|
1543
|
+
b.slide.onChange(Math.round(_e)), n.startX = n.currentX, n.startY = n.currentY, m.preventDefault();
|
|
1543
1544
|
}
|
|
1544
|
-
}, f = (
|
|
1545
|
+
}, f = (m) => {
|
|
1545
1546
|
if (!n.isDown) return;
|
|
1546
|
-
const
|
|
1547
|
-
if (d(),
|
|
1548
|
-
const
|
|
1549
|
-
n.isDown &&
|
|
1547
|
+
const b = e(), $ = b.hold?.delay ?? 300;
|
|
1548
|
+
if (d(), b.tap && !n.hasMoved) {
|
|
1549
|
+
const p = Date.now() - n.startTime;
|
|
1550
|
+
n.isDown && p < $ && b.tap();
|
|
1550
1551
|
}
|
|
1551
|
-
n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null,
|
|
1552
|
-
}, v = (
|
|
1553
|
-
d(), n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null,
|
|
1554
|
-
}, V = (
|
|
1555
|
-
const
|
|
1556
|
-
if (
|
|
1557
|
-
const $ =
|
|
1558
|
-
return $ === "horizontal" ? Z.slideHorizontal.css : $ === "vertical" ? Z.slideVertical.css : (
|
|
1552
|
+
n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, m.currentTarget.releasePointerCapture(m.pointerId);
|
|
1553
|
+
}, v = (m) => {
|
|
1554
|
+
d(), n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, m.currentTarget.releasePointerCapture(m.pointerId);
|
|
1555
|
+
}, V = (m) => {
|
|
1556
|
+
const b = e();
|
|
1557
|
+
if (b.slide) {
|
|
1558
|
+
const $ = b.slide.orientation;
|
|
1559
|
+
return $ === "horizontal" ? Z.slideHorizontal.css : $ === "vertical" ? Z.slideVertical.css : (r || o(m), r && r.height > r.width ? Z.slideVertical.css : Z.slideHorizontal.css);
|
|
1559
1560
|
}
|
|
1560
|
-
return
|
|
1561
|
+
return b.tap ? Z.tap.css : b.hold ? Z.hold.css : "";
|
|
1561
1562
|
};
|
|
1562
1563
|
return {
|
|
1563
|
-
onPointerDown:
|
|
1564
|
-
onPointerMove:
|
|
1564
|
+
onPointerDown: y,
|
|
1565
|
+
onPointerMove: M,
|
|
1565
1566
|
onPointerUp: f,
|
|
1566
1567
|
onPointerCancel: v,
|
|
1567
|
-
onPointerEnter: (
|
|
1568
|
-
const
|
|
1569
|
-
n.element =
|
|
1568
|
+
onPointerEnter: (m) => {
|
|
1569
|
+
const b = m.currentTarget;
|
|
1570
|
+
n.element = b, b.style.cursor = V(b);
|
|
1571
|
+
},
|
|
1572
|
+
bindElement: (m) => {
|
|
1573
|
+
m && (n.element = m, o(m));
|
|
1570
1574
|
},
|
|
1571
|
-
|
|
1572
|
-
|
|
1575
|
+
touchAction: () => {
|
|
1576
|
+
const m = e();
|
|
1577
|
+
if (m.slide) {
|
|
1578
|
+
const b = m.slide.orientation;
|
|
1579
|
+
return b === "horizontal" ? "pan-y" : b === "vertical" || r && r.height > r.width ? "pan-x" : "pan-y";
|
|
1580
|
+
}
|
|
1581
|
+
return m.tap || m.hold ? "manipulation" : "auto";
|
|
1573
1582
|
},
|
|
1574
1583
|
dispose: () => {
|
|
1575
|
-
d(), a && (a.disconnect(), a = null),
|
|
1584
|
+
d(), a && (a.disconnect(), a = null), i = null, r = null;
|
|
1576
1585
|
}
|
|
1577
1586
|
};
|
|
1578
1587
|
}
|
|
1579
|
-
function
|
|
1588
|
+
function Qn(e) {
|
|
1580
1589
|
return A(() => {
|
|
1581
1590
|
const t = e.entities();
|
|
1582
1591
|
if (t.length === 0) return;
|
|
1583
1592
|
const n = {
|
|
1584
1593
|
widgetConfig: e.widgetConfig,
|
|
1585
|
-
entities: t.map((
|
|
1586
|
-
const
|
|
1587
|
-
entity_id:
|
|
1588
|
-
state:
|
|
1589
|
-
domain:
|
|
1590
|
-
friendly_name:
|
|
1594
|
+
entities: t.map((r) => {
|
|
1595
|
+
const i = {
|
|
1596
|
+
entity_id: r.id,
|
|
1597
|
+
state: r.state,
|
|
1598
|
+
domain: r.domain,
|
|
1599
|
+
friendly_name: r.friendlyName
|
|
1591
1600
|
};
|
|
1592
1601
|
return e.customEntityFields ? {
|
|
1593
|
-
...
|
|
1594
|
-
...e.customEntityFields(
|
|
1595
|
-
} :
|
|
1602
|
+
...i,
|
|
1603
|
+
...e.customEntityFields(r)
|
|
1604
|
+
} : i;
|
|
1596
1605
|
})
|
|
1597
1606
|
};
|
|
1598
1607
|
return e.additionalData && Object.assign(n, e.additionalData), n;
|
|
1599
1608
|
});
|
|
1600
1609
|
}
|
|
1601
|
-
function
|
|
1602
|
-
const [t, n] =
|
|
1610
|
+
function er(e = {}) {
|
|
1611
|
+
const [t, n] = j(!1), [r, i] = j(!1);
|
|
1603
1612
|
return {
|
|
1604
1613
|
save: async (s) => {
|
|
1605
1614
|
if (e.onSave) {
|
|
@@ -1613,44 +1622,44 @@ function Qn(e = {}) {
|
|
|
1613
1622
|
},
|
|
1614
1623
|
remove: async () => {
|
|
1615
1624
|
if (e.onDelete) {
|
|
1616
|
-
|
|
1625
|
+
i(!0);
|
|
1617
1626
|
try {
|
|
1618
1627
|
await e.onDelete(), e.onDeleteSuccess?.();
|
|
1619
1628
|
} finally {
|
|
1620
|
-
|
|
1629
|
+
i(!1);
|
|
1621
1630
|
}
|
|
1622
1631
|
}
|
|
1623
1632
|
},
|
|
1624
1633
|
isSaving: t,
|
|
1625
|
-
isDeleting:
|
|
1634
|
+
isDeleting: r
|
|
1626
1635
|
};
|
|
1627
1636
|
}
|
|
1628
|
-
function
|
|
1629
|
-
const [t, n] =
|
|
1637
|
+
function tr(e = "edit") {
|
|
1638
|
+
const [t, n] = j(!1), [r, i] = j(e);
|
|
1630
1639
|
return {
|
|
1631
1640
|
showDialog: t,
|
|
1632
1641
|
setShowDialog: n,
|
|
1633
1642
|
openDialog: () => n(!0),
|
|
1634
1643
|
closeDialog: () => n(!1),
|
|
1635
|
-
activeTab:
|
|
1636
|
-
setActiveTab:
|
|
1644
|
+
activeTab: r,
|
|
1645
|
+
setActiveTab: i
|
|
1637
1646
|
};
|
|
1638
1647
|
}
|
|
1639
|
-
function
|
|
1648
|
+
function nr(e) {
|
|
1640
1649
|
const t = A(() => e.entity() !== null), n = A(() => {
|
|
1641
|
-
const
|
|
1642
|
-
return
|
|
1643
|
-
}),
|
|
1650
|
+
const i = e.entity();
|
|
1651
|
+
return i ? e.calculateData(i) : null;
|
|
1652
|
+
}), r = A(() => t() ? void 0 : e.emptyStateConfig);
|
|
1644
1653
|
return {
|
|
1645
1654
|
entity: e.entity,
|
|
1646
1655
|
data: n,
|
|
1647
|
-
emptyState:
|
|
1656
|
+
emptyState: r,
|
|
1648
1657
|
hasEntity: t
|
|
1649
1658
|
};
|
|
1650
1659
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const t = e.minEntities ?? 1, n = A(() => e.entities().length),
|
|
1653
|
-
if (!
|
|
1660
|
+
function rr(e) {
|
|
1661
|
+
const t = e.minEntities ?? 1, n = A(() => e.entities().length), r = A(() => n() >= t), i = A(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = A(() => {
|
|
1662
|
+
if (!r()) return;
|
|
1654
1663
|
const s = e.aggregationMode?.();
|
|
1655
1664
|
if (!s || s === "none") return;
|
|
1656
1665
|
const l = e.entities();
|
|
@@ -1660,25 +1669,25 @@ function nr(e) {
|
|
|
1660
1669
|
const d = e.sensorGroupType?.() ?? "mean";
|
|
1661
1670
|
return Nt(l, d, !0);
|
|
1662
1671
|
}
|
|
1663
|
-
}), o = A(() =>
|
|
1672
|
+
}), o = A(() => r() ? void 0 : e.emptyStateConfig);
|
|
1664
1673
|
return {
|
|
1665
1674
|
entities: e.entities,
|
|
1666
|
-
groupData:
|
|
1675
|
+
groupData: i,
|
|
1667
1676
|
aggregatedData: a,
|
|
1668
1677
|
emptyState: o,
|
|
1669
|
-
hasEntities:
|
|
1678
|
+
hasEntities: r,
|
|
1670
1679
|
count: n
|
|
1671
1680
|
};
|
|
1672
1681
|
}
|
|
1673
|
-
function
|
|
1682
|
+
function ir(e) {
|
|
1674
1683
|
const [t] = Ie({
|
|
1675
1684
|
validate: Re(e.schema),
|
|
1676
1685
|
initialValues: e.initialValues
|
|
1677
|
-
}), n = A(() => t.dirty),
|
|
1686
|
+
}), n = A(() => t.dirty), r = A(() => t.submitting);
|
|
1678
1687
|
return {
|
|
1679
1688
|
form: t,
|
|
1680
1689
|
isDirty: n,
|
|
1681
|
-
isSubmitting:
|
|
1690
|
+
isSubmitting: r,
|
|
1682
1691
|
handleSubmit: (a) => {
|
|
1683
1692
|
e.onSubmit?.(a);
|
|
1684
1693
|
},
|
|
@@ -1688,29 +1697,29 @@ function rr(e) {
|
|
|
1688
1697
|
};
|
|
1689
1698
|
}
|
|
1690
1699
|
const de = ["xs", "sm", "md", "lg", "xl"];
|
|
1691
|
-
function
|
|
1700
|
+
function ar() {
|
|
1692
1701
|
const e = G(), t = A(() => de.indexOf(e.size())), n = A(() => {
|
|
1693
1702
|
const l = e.size();
|
|
1694
1703
|
return l === "xs" || l === "sm";
|
|
1695
|
-
}),
|
|
1704
|
+
}), r = A(() => {
|
|
1696
1705
|
const l = e.size();
|
|
1697
1706
|
return l === "lg" || l === "xl";
|
|
1698
|
-
}),
|
|
1707
|
+
}), i = A(() => t() >= 2);
|
|
1699
1708
|
return {
|
|
1700
1709
|
isCompact: n,
|
|
1701
|
-
isLarge:
|
|
1702
|
-
showDetail:
|
|
1710
|
+
isLarge: r,
|
|
1711
|
+
showDetail: i,
|
|
1703
1712
|
showOn: (l) => l.includes(e.size()),
|
|
1704
1713
|
hideOn: (l) => !l.includes(e.size()),
|
|
1705
1714
|
matches: (l) => {
|
|
1706
1715
|
const d = l.trim();
|
|
1707
1716
|
if (d.endsWith("+")) {
|
|
1708
|
-
const c = d.slice(0, -1),
|
|
1709
|
-
return
|
|
1717
|
+
const c = d.slice(0, -1), y = de.indexOf(c);
|
|
1718
|
+
return y >= 0 && t() >= y;
|
|
1710
1719
|
}
|
|
1711
1720
|
if (d.endsWith("-")) {
|
|
1712
|
-
const c = d.slice(0, -1),
|
|
1713
|
-
return
|
|
1721
|
+
const c = d.slice(0, -1), y = de.indexOf(c);
|
|
1722
|
+
return y >= 0 && t() <= y;
|
|
1714
1723
|
}
|
|
1715
1724
|
return e.size() === d;
|
|
1716
1725
|
}
|
|
@@ -1734,7 +1743,7 @@ const _ = {
|
|
|
1734
1743
|
sage: "bg-gradient-to-br from-lime-600/20 to-green-600/20",
|
|
1735
1744
|
copper: "bg-gradient-to-br from-amber-600/20 to-amber-800/20",
|
|
1736
1745
|
dusk: "bg-gradient-to-br from-blue-500/20 to-purple-600/20"
|
|
1737
|
-
},
|
|
1746
|
+
}, or = {
|
|
1738
1747
|
ocean: "Ocean Breeze",
|
|
1739
1748
|
sunset: "Sunset Glow",
|
|
1740
1749
|
forest: "Forest Dawn",
|
|
@@ -1752,19 +1761,19 @@ const _ = {
|
|
|
1752
1761
|
sage: "Sage",
|
|
1753
1762
|
copper: "Copper",
|
|
1754
1763
|
dusk: "Dusk"
|
|
1755
|
-
},
|
|
1764
|
+
}, sr = Object.keys(_);
|
|
1756
1765
|
function ke(e) {
|
|
1757
1766
|
const t = Object.keys(_);
|
|
1758
1767
|
let n = 0;
|
|
1759
|
-
for (const
|
|
1760
|
-
n = (n << 5) - n +
|
|
1761
|
-
const
|
|
1762
|
-
return t[
|
|
1768
|
+
for (const i of e)
|
|
1769
|
+
n = (n << 5) - n + i.charCodeAt(0), n = n & n;
|
|
1770
|
+
const r = Math.abs(n) % t.length;
|
|
1771
|
+
return t[r];
|
|
1763
1772
|
}
|
|
1764
|
-
function
|
|
1773
|
+
function lr(e, t) {
|
|
1765
1774
|
if (!e) {
|
|
1766
|
-
const
|
|
1767
|
-
return _[
|
|
1775
|
+
const r = ke(t);
|
|
1776
|
+
return _[r];
|
|
1768
1777
|
}
|
|
1769
1778
|
if (typeof e == "string" && e in _)
|
|
1770
1779
|
return _[e];
|
|
@@ -1944,116 +1953,116 @@ const ee = {
|
|
|
1944
1953
|
muted: "text-blue-400/60 dark:text-blue-300/60"
|
|
1945
1954
|
}
|
|
1946
1955
|
}
|
|
1947
|
-
},
|
|
1956
|
+
}, cr = {
|
|
1948
1957
|
unavailable: ee.steel,
|
|
1949
1958
|
active: ee.ocean,
|
|
1950
1959
|
inactive: ee.steel,
|
|
1951
1960
|
success: ee.forest,
|
|
1952
1961
|
warning: ee.ember,
|
|
1953
1962
|
error: ee.rose
|
|
1954
|
-
},
|
|
1963
|
+
}, ur = {
|
|
1955
1964
|
/** Optional display name override (renders as text input) */
|
|
1956
|
-
title: () =>
|
|
1965
|
+
title: () => J.string().optional().meta({ title: "Title", description: "Optional display name override" }),
|
|
1957
1966
|
/** Multi-select entity picker for a HA domain */
|
|
1958
|
-
entityIds: (e) =>
|
|
1967
|
+
entityIds: (e) => J.array(J.string()).default([]).meta({ domain: e, title: "Entities" }),
|
|
1959
1968
|
/** Single-select entity picker for a HA domain */
|
|
1960
|
-
singleEntity: (e) =>
|
|
1969
|
+
singleEntity: (e) => J.array(J.string()).default([]).meta({ domain: e, title: "Entity", singleSelect: !0 }),
|
|
1961
1970
|
/** Area picker dropdown */
|
|
1962
|
-
areaId: () =>
|
|
1971
|
+
areaId: () => J.string().optional().meta({ formType: "area-picker", title: "Area" })
|
|
1963
1972
|
};
|
|
1964
1973
|
let ge = null;
|
|
1965
1974
|
function wn() {
|
|
1966
1975
|
return ge || (ge = getComputedStyle(document.documentElement)), ge;
|
|
1967
1976
|
}
|
|
1968
|
-
function
|
|
1977
|
+
function dr(e) {
|
|
1969
1978
|
const t = e.startsWith("--") ? e : `--${e}`;
|
|
1970
1979
|
return wn().getPropertyValue(t).trim();
|
|
1971
1980
|
}
|
|
1972
|
-
function
|
|
1981
|
+
function gr() {
|
|
1973
1982
|
return document.documentElement.classList.contains("dark");
|
|
1974
1983
|
}
|
|
1975
|
-
const $n = "0.3.
|
|
1984
|
+
const $n = "0.3.6", kn = {
|
|
1976
1985
|
version: $n
|
|
1977
|
-
},
|
|
1986
|
+
}, mr = kn.version;
|
|
1978
1987
|
export {
|
|
1979
|
-
|
|
1988
|
+
or as GRADIENT_NAMES,
|
|
1980
1989
|
_ as GRADIENT_PRESETS,
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
+
sr as GRADIENT_PRESET_KEYS,
|
|
1991
|
+
Kn as Glow,
|
|
1992
|
+
xr as GridSizeSchema,
|
|
1993
|
+
vr as PublishBodySchema,
|
|
1994
|
+
br as PublishConfirmSchema,
|
|
1995
|
+
yr as PublishRequestSchema,
|
|
1996
|
+
mr as SDK_VERSION,
|
|
1997
|
+
U as WIDGET_Z,
|
|
1998
|
+
Y as Widget,
|
|
1990
1999
|
it as WidgetContent,
|
|
1991
2000
|
me as WidgetCtx,
|
|
1992
|
-
|
|
2001
|
+
Jn as WidgetDialog,
|
|
1993
2002
|
ut as WidgetEmptyState,
|
|
1994
2003
|
vt as WidgetIcon,
|
|
1995
|
-
|
|
2004
|
+
wr as WidgetManifestSchema,
|
|
1996
2005
|
ze as WidgetMetrics,
|
|
1997
2006
|
et as WidgetSliderFill,
|
|
1998
|
-
|
|
2007
|
+
qn as WidgetStack,
|
|
1999
2008
|
Ct as WidgetStatus,
|
|
2000
2009
|
zt as WidgetSubtitle,
|
|
2001
2010
|
Et as WidgetTitle,
|
|
2002
2011
|
Gt as WidgetValue,
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2012
|
+
Yn as allEntitiesInState,
|
|
2013
|
+
Xn as anyEntityInState,
|
|
2014
|
+
Gn as applyCssVars,
|
|
2015
|
+
Rn as applyLayout,
|
|
2007
2016
|
fe as builtInVariants,
|
|
2008
2017
|
At as calculateLightGroup,
|
|
2009
2018
|
Nt as calculateSensorGroup,
|
|
2010
2019
|
Le as classicGlass,
|
|
2011
2020
|
S as cn,
|
|
2012
2021
|
Fe as compactHorizontal,
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2022
|
+
In as composeVariants,
|
|
2023
|
+
Un as countActiveEntities,
|
|
2024
|
+
Fn as countAvailableEntities,
|
|
2025
|
+
jn as countEntitiesByState,
|
|
2026
|
+
Hn as createEmptyStateConfig,
|
|
2027
|
+
An as createEntity,
|
|
2028
|
+
Pn as createFlexLayout,
|
|
2029
|
+
Nn as defineWidget,
|
|
2021
2030
|
ht as deriveAdaptiveIconColors,
|
|
2022
|
-
|
|
2031
|
+
Wn as extendVariant,
|
|
2023
2032
|
Be as extractDefaults,
|
|
2024
|
-
|
|
2033
|
+
$r as formatSchemaError,
|
|
2025
2034
|
Vt as formatValue,
|
|
2026
2035
|
Ue as getBuiltInVariant,
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2036
|
+
Vn as getBuiltInVariantIds,
|
|
2037
|
+
Ln as getEntityAttribute,
|
|
2038
|
+
Bn as getEntityState,
|
|
2039
|
+
lr as getGradient,
|
|
2031
2040
|
ke as getGradientFromString,
|
|
2032
2041
|
nt as getSpacingClass,
|
|
2033
|
-
|
|
2042
|
+
dr as getThemeToken,
|
|
2034
2043
|
ee as gradientColorPresets,
|
|
2035
2044
|
Wt as interpretValue,
|
|
2036
|
-
|
|
2037
|
-
|
|
2045
|
+
Tn as isBuiltInVariant,
|
|
2046
|
+
gr as isDark,
|
|
2038
2047
|
Tt as isEntityActive,
|
|
2039
2048
|
Ot as isEntityAvailable,
|
|
2040
2049
|
he as mergeVariants,
|
|
2041
2050
|
je as minimal,
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2051
|
+
kr as parseGridSize,
|
|
2052
|
+
Sr as serializeGridSize,
|
|
2053
|
+
W as spacing,
|
|
2054
|
+
cr as stateColors,
|
|
2046
2055
|
pe as toFormSchema,
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2056
|
+
F as typography,
|
|
2057
|
+
Qn as useDebugData,
|
|
2058
|
+
er as useWidgetConfig,
|
|
2050
2059
|
G as useWidgetContext,
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2060
|
+
tr as useWidgetDialog,
|
|
2061
|
+
nr as useWidgetEntity,
|
|
2062
|
+
rr as useWidgetEntityGroup,
|
|
2063
|
+
ir as useWidgetForm,
|
|
2064
|
+
Zn as useWidgetGestures,
|
|
2065
|
+
ar as useWidgetResponsive,
|
|
2066
|
+
On as warnIfStub,
|
|
2067
|
+
ur as widgetFields
|
|
2059
2068
|
};
|