@glasshome/widget-sdk 0.5.0 → 0.5.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/framework/hooks/index.d.ts +2 -0
- package/dist/framework/hooks/use-intersection-pause.d.ts +7 -0
- package/dist/framework/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/framework/index.d.ts +2 -2
- package/dist/framework/theming/index.d.ts +1 -0
- package/dist/framework/theming/svg-colors.d.ts +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +493 -425
- package/dist/shared/spline.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z as A } from "zod";
|
|
2
|
-
import { WidgetManifestSchema as
|
|
3
|
-
import { effect as W, className as
|
|
4
|
-
import { createElementSize as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import { twMerge as
|
|
8
|
-
function
|
|
2
|
+
import { WidgetManifestSchema as tn, formatSchemaError as nn } from "./schemas.js";
|
|
3
|
+
import { effect as W, className as R, style as ie, template as x, insert as p, createComponent as $, memo as _, setStyleProperty as Y, addEventListener as U, use as ve, delegateEvents as we } from "solid-js/web";
|
|
4
|
+
import { createElementSize as be } from "@solid-primitives/resize-observer";
|
|
5
|
+
import { createContext as pe, useContext as le, Show as E, onMount as xe, createSignal as H, createMemo as L, splitProps as ye, createEffect as te, on as ae, onCleanup as ce } from "solid-js";
|
|
6
|
+
import { clsx as $e } from "clsx";
|
|
7
|
+
import { twMerge as ke } from "tailwind-merge";
|
|
8
|
+
function de(e) {
|
|
9
9
|
return A.toJSONSchema(e, {
|
|
10
10
|
override: (t) => {
|
|
11
11
|
const i = A.globalRegistry.get(t.zodSchema);
|
|
@@ -13,15 +13,15 @@ function ce(e) {
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Ce(e) {
|
|
17
17
|
try {
|
|
18
18
|
return e.parse({});
|
|
19
19
|
} catch {
|
|
20
20
|
return {};
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return e.configSchema && (e.manifest.schema || (e.manifest.schema =
|
|
23
|
+
function Pt(e) {
|
|
24
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = de(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ce(e.configSchema))), e;
|
|
25
25
|
}
|
|
26
26
|
const G = {
|
|
27
27
|
/** Background layer (gradients, images, glows) */
|
|
@@ -32,14 +32,14 @@ const G = {
|
|
|
32
32
|
OVERLAY: 20,
|
|
33
33
|
/** Action layer (buttons, edit controls) */
|
|
34
34
|
ACTIONS: 30
|
|
35
|
-
},
|
|
36
|
-
function
|
|
37
|
-
const e =
|
|
35
|
+
}, ne = pe();
|
|
36
|
+
function Ht() {
|
|
37
|
+
const e = le(ne);
|
|
38
38
|
if (!e)
|
|
39
39
|
throw new Error("useWidgetContext must be used within a Widget component");
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const Se = `/* Authoritative SDK CSS contract. Injected once on first Widget mount
|
|
43
43
|
* via framework/theming/tokens.ts.
|
|
44
44
|
*
|
|
45
45
|
* All widget-internal visual scale is driven from CSS custom properties +
|
|
@@ -212,7 +212,7 @@ const Ce = `/* Authoritative SDK CSS contract. Injected once on first Widget mou
|
|
|
212
212
|
}
|
|
213
213
|
`;
|
|
214
214
|
let Q = !1;
|
|
215
|
-
function
|
|
215
|
+
function Me(e) {
|
|
216
216
|
if (Q) return;
|
|
217
217
|
const t = e ?? (typeof document > "u" ? void 0 : document);
|
|
218
218
|
if (!t) return;
|
|
@@ -221,12 +221,12 @@ function Se(e) {
|
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
223
|
const i = t.createElement("style");
|
|
224
|
-
i.setAttribute("data-glasshome-tokens", ""), i.textContent =
|
|
224
|
+
i.setAttribute("data-glasshome-tokens", ""), i.textContent = Se, t.head.appendChild(i), Q = !0;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
return $e(
|
|
226
|
+
function P(...e) {
|
|
227
|
+
return ke($e(e));
|
|
228
228
|
}
|
|
229
|
-
const
|
|
229
|
+
const De = {
|
|
230
230
|
id: "classic-glass",
|
|
231
231
|
name: "Classic Glass",
|
|
232
232
|
description: "Default glassmorphism design with blur background and gradient",
|
|
@@ -254,7 +254,7 @@ const Me = {
|
|
|
254
254
|
hoverScale: 1.02,
|
|
255
255
|
activeScale: 0.98
|
|
256
256
|
}
|
|
257
|
-
},
|
|
257
|
+
}, _e = {
|
|
258
258
|
id: "minimal",
|
|
259
259
|
name: "Minimal",
|
|
260
260
|
description: "Clean, minimal design with no background effects",
|
|
@@ -283,7 +283,7 @@ const Me = {
|
|
|
283
283
|
active: !1,
|
|
284
284
|
focus: !0
|
|
285
285
|
}
|
|
286
|
-
},
|
|
286
|
+
}, ze = {
|
|
287
287
|
id: "compact-horizontal",
|
|
288
288
|
name: "Compact Horizontal",
|
|
289
289
|
description: "Horizontal layout for compact widgets",
|
|
@@ -311,108 +311,108 @@ const Me = {
|
|
|
311
311
|
hoverScale: 1.02,
|
|
312
312
|
activeScale: 0.98
|
|
313
313
|
}
|
|
314
|
-
},
|
|
315
|
-
"classic-glass":
|
|
316
|
-
minimal:
|
|
317
|
-
"compact-horizontal":
|
|
314
|
+
}, Te = {
|
|
315
|
+
"classic-glass": De,
|
|
316
|
+
minimal: _e,
|
|
317
|
+
"compact-horizontal": ze
|
|
318
318
|
};
|
|
319
|
-
function
|
|
320
|
-
return
|
|
319
|
+
function Ee(e) {
|
|
320
|
+
return Te[e];
|
|
321
321
|
}
|
|
322
|
-
var
|
|
322
|
+
var Oe = /* @__PURE__ */ x("<div>");
|
|
323
323
|
function Ne(e) {
|
|
324
324
|
return (() => {
|
|
325
|
-
var t =
|
|
325
|
+
var t = Oe();
|
|
326
326
|
return W((i) => {
|
|
327
|
-
var r =
|
|
327
|
+
var r = P("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), n = {
|
|
328
328
|
"--widget-fill-value": e.value,
|
|
329
329
|
"z-index": G.BACKGROUND,
|
|
330
330
|
...e.color ? {
|
|
331
331
|
"--widget-icon-color": e.color
|
|
332
332
|
} : {}
|
|
333
333
|
};
|
|
334
|
-
return r !== i.e &&
|
|
334
|
+
return r !== i.e && R(t, i.e = r), i.t = ie(t, n, i.t), i;
|
|
335
335
|
}, {
|
|
336
336
|
e: void 0,
|
|
337
337
|
t: void 0
|
|
338
338
|
}), t;
|
|
339
339
|
})();
|
|
340
340
|
}
|
|
341
|
-
var
|
|
342
|
-
function
|
|
341
|
+
var Ve = /* @__PURE__ */ x("<div>");
|
|
342
|
+
function Ae(e) {
|
|
343
343
|
return (() => {
|
|
344
|
-
var t =
|
|
345
|
-
return
|
|
344
|
+
var t = Ve();
|
|
345
|
+
return p(t, () => e.children), W(() => R(t, P("glasshome-widget-content", e.class))), t;
|
|
346
346
|
})();
|
|
347
347
|
}
|
|
348
|
-
var
|
|
349
|
-
function
|
|
348
|
+
var We = /* @__PURE__ */ x('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2">'), Pe = /* @__PURE__ */ x('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3">'), He = /* @__PURE__ */ x('<div><div class="glasshome-widget-icon-glyph flex items-center justify-center">');
|
|
349
|
+
function Re(e) {
|
|
350
350
|
const t = () => e.entityCount ?? 1;
|
|
351
351
|
return (() => {
|
|
352
352
|
var i = He(), r = i.firstChild;
|
|
353
|
-
return
|
|
353
|
+
return p(i, $(E, {
|
|
354
354
|
get when() {
|
|
355
355
|
return t() >= 2;
|
|
356
356
|
},
|
|
357
357
|
get children() {
|
|
358
|
-
return
|
|
358
|
+
return We();
|
|
359
359
|
}
|
|
360
|
-
}), r),
|
|
360
|
+
}), r), p(i, $(E, {
|
|
361
361
|
get when() {
|
|
362
362
|
return t() >= 3;
|
|
363
363
|
},
|
|
364
364
|
get children() {
|
|
365
|
-
return
|
|
365
|
+
return Pe();
|
|
366
366
|
}
|
|
367
|
-
}), r),
|
|
368
|
-
var
|
|
367
|
+
}), r), p(r, () => e.icon), W((n) => {
|
|
368
|
+
var o = P("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), h = e.color ? {
|
|
369
369
|
"--widget-icon-color": e.color
|
|
370
370
|
} : void 0;
|
|
371
|
-
return
|
|
371
|
+
return o !== n.e && R(i, n.e = o), n.t = ie(i, h, n.t), n;
|
|
372
372
|
}, {
|
|
373
373
|
e: void 0,
|
|
374
374
|
t: void 0
|
|
375
375
|
}), i;
|
|
376
376
|
})();
|
|
377
377
|
}
|
|
378
|
-
var
|
|
379
|
-
function
|
|
378
|
+
var Ie = /* @__PURE__ */ x("<p>");
|
|
379
|
+
function je(e) {
|
|
380
380
|
return (() => {
|
|
381
|
-
var t =
|
|
382
|
-
return
|
|
383
|
-
var i =
|
|
381
|
+
var t = Ie();
|
|
382
|
+
return p(t, (() => {
|
|
383
|
+
var i = _(() => !!e.isUnavailable);
|
|
384
384
|
return () => i() ? "Unavailable" : e.children;
|
|
385
385
|
})()), W((i) => {
|
|
386
|
-
var r =
|
|
387
|
-
return r !== i.e &&
|
|
386
|
+
var r = P("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), n = G.ACTIONS;
|
|
387
|
+
return r !== i.e && R(t, i.e = r), n !== i.t && Y(t, "z-index", i.t = n), i;
|
|
388
388
|
}, {
|
|
389
389
|
e: void 0,
|
|
390
390
|
t: void 0
|
|
391
391
|
}), t;
|
|
392
392
|
})();
|
|
393
393
|
}
|
|
394
|
-
var
|
|
395
|
-
function
|
|
394
|
+
var Le = /* @__PURE__ */ x('<span class="glasshome-widget-badge shrink-0">'), Be = /* @__PURE__ */ x("<div><h3 class=glasshome-widget-title>");
|
|
395
|
+
function Ue(e) {
|
|
396
396
|
return (() => {
|
|
397
397
|
var t = Be(), i = t.firstChild;
|
|
398
|
-
return
|
|
398
|
+
return p(i, () => e.children), p(t, $(E, {
|
|
399
399
|
get when() {
|
|
400
|
-
return
|
|
400
|
+
return _(() => e.badge !== void 0)() && e.badge > 0;
|
|
401
401
|
},
|
|
402
402
|
get children() {
|
|
403
|
-
var r =
|
|
404
|
-
return
|
|
403
|
+
var r = Le();
|
|
404
|
+
return p(r, () => e.badge), r;
|
|
405
405
|
}
|
|
406
406
|
}), null), W((r) => {
|
|
407
|
-
var n =
|
|
408
|
-
return n !== r.e &&
|
|
407
|
+
var n = P("relative flex items-center gap-2", e.class), o = G.ACTIONS;
|
|
408
|
+
return n !== r.e && R(t, r.e = n), o !== r.t && Y(t, "z-index", r.t = o), r;
|
|
409
409
|
}, {
|
|
410
410
|
e: void 0,
|
|
411
411
|
t: void 0
|
|
412
412
|
}), t;
|
|
413
413
|
})();
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Fe(e, t = !1) {
|
|
416
416
|
if (e.length === 0)
|
|
417
417
|
return {
|
|
418
418
|
isGroup: !1,
|
|
@@ -428,62 +428,62 @@ function Le(e, t = !1) {
|
|
|
428
428
|
};
|
|
429
429
|
const i = e.length > 1;
|
|
430
430
|
if (!i) {
|
|
431
|
-
const
|
|
431
|
+
const b = e[0], M = b.state === "on", N = b.attributes?.brightness || 0, D = Math.round(N / 255 * 100);
|
|
432
432
|
return {
|
|
433
433
|
isGroup: !1,
|
|
434
|
-
state:
|
|
435
|
-
isOn:
|
|
436
|
-
isUnavailable:
|
|
437
|
-
brightness:
|
|
438
|
-
brightnessPercent:
|
|
439
|
-
color:
|
|
440
|
-
onCount:
|
|
434
|
+
state: b.state,
|
|
435
|
+
isOn: M,
|
|
436
|
+
isUnavailable: b.state === "unavailable",
|
|
437
|
+
brightness: N,
|
|
438
|
+
brightnessPercent: D,
|
|
439
|
+
color: se(b),
|
|
440
|
+
onCount: M ? 1 : 0,
|
|
441
441
|
totalCount: 1,
|
|
442
|
-
description:
|
|
442
|
+
description: M ? "On" : "Off"
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
let r = 0, n = 0,
|
|
446
|
-
const
|
|
447
|
-
for (const
|
|
448
|
-
switch (
|
|
445
|
+
let r = 0, n = 0, o = 0, h = 0, g = 0, y = 0;
|
|
446
|
+
const f = [];
|
|
447
|
+
for (const b of e)
|
|
448
|
+
switch (b.state) {
|
|
449
449
|
case "on":
|
|
450
|
-
r++,
|
|
450
|
+
r++, b.attributes?.brightness !== void 0 && (g += b.attributes.brightness, y++), b.attributes?.rgb_color && f.push(b.attributes.rgb_color);
|
|
451
451
|
break;
|
|
452
452
|
case "off":
|
|
453
453
|
n++;
|
|
454
454
|
break;
|
|
455
455
|
case "unknown":
|
|
456
|
-
|
|
456
|
+
o++;
|
|
457
457
|
break;
|
|
458
458
|
case "unavailable":
|
|
459
459
|
h++;
|
|
460
460
|
break;
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
let
|
|
464
|
-
t ?
|
|
465
|
-
const
|
|
466
|
-
let
|
|
467
|
-
if (
|
|
468
|
-
const
|
|
469
|
-
|
|
462
|
+
const c = e.length, v = h === c, k = o + h === c, d = r > 0, a = r === c, C = n === c;
|
|
463
|
+
let w, S;
|
|
464
|
+
t ? v ? (w = "unavailable", S = !1) : o > 0 || h > 0 ? (w = "unknown", S = !1) : n > 0 ? (w = "off", S = !1) : (w = "on", S = !0) : v ? (w = "unavailable", S = !1) : k ? (w = "unknown", S = !1) : d ? (w = "on", S = !0) : (w = "off", S = !1);
|
|
465
|
+
const O = y > 0 ? Math.round(g / y) : 0, I = Math.round(O / 255 * 100);
|
|
466
|
+
let u;
|
|
467
|
+
if (f.length > 0) {
|
|
468
|
+
const b = Math.round(f.reduce((l, z) => l + z[0], 0) / f.length), M = Math.round(f.reduce((l, z) => l + z[1], 0) / f.length), N = Math.round(f.reduce((l, z) => l + z[2], 0) / f.length), D = O / 255;
|
|
469
|
+
u = `rgb(${Math.round(b * D)}, ${Math.round(M * D)}, ${Math.round(N * D)})`;
|
|
470
470
|
} else
|
|
471
|
-
|
|
472
|
-
let
|
|
473
|
-
return
|
|
471
|
+
u = se(e[0]);
|
|
472
|
+
let m;
|
|
473
|
+
return a ? m = "All on" : C ? m = "All off" : r > 0 ? m = `${r} of ${c} on` : m = "Off", {
|
|
474
474
|
isGroup: i,
|
|
475
|
-
state:
|
|
476
|
-
isOn:
|
|
477
|
-
isUnavailable:
|
|
478
|
-
brightness:
|
|
479
|
-
brightnessPercent:
|
|
480
|
-
color:
|
|
475
|
+
state: w,
|
|
476
|
+
isOn: S,
|
|
477
|
+
isUnavailable: w === "unavailable",
|
|
478
|
+
brightness: O,
|
|
479
|
+
brightnessPercent: I,
|
|
480
|
+
color: u,
|
|
481
481
|
onCount: r,
|
|
482
|
-
totalCount:
|
|
483
|
-
description:
|
|
482
|
+
totalCount: c,
|
|
483
|
+
description: m
|
|
484
484
|
};
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Ge(e, t = "mean", i = !0) {
|
|
487
487
|
if (e.length === 0)
|
|
488
488
|
return {
|
|
489
489
|
isGroup: !1,
|
|
@@ -494,112 +494,112 @@ function Fe(e, t = "mean", i = !0) {
|
|
|
494
494
|
};
|
|
495
495
|
const r = e.length > 1;
|
|
496
496
|
if (!r) {
|
|
497
|
-
const d = e[0],
|
|
498
|
-
let
|
|
499
|
-
return Number.isNaN(
|
|
497
|
+
const d = e[0], a = Number.parseFloat(d.state);
|
|
498
|
+
let C = d.state;
|
|
499
|
+
return Number.isNaN(a) || (C = Number.isInteger(a) ? a.toString() : a.toFixed(1)), {
|
|
500
500
|
isGroup: !1,
|
|
501
|
-
state:
|
|
502
|
-
numericValue: Number.isNaN(
|
|
501
|
+
state: C,
|
|
502
|
+
numericValue: Number.isNaN(a) ? null : a,
|
|
503
503
|
isUnavailable: d.state === "unavailable",
|
|
504
504
|
unit: d.unitOfMeasurement ?? void 0,
|
|
505
|
-
description:
|
|
505
|
+
description: C
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
|
-
const n = [],
|
|
509
|
-
let h = 0,
|
|
508
|
+
const n = [], o = [];
|
|
509
|
+
let h = 0, g;
|
|
510
510
|
for (const d of e) {
|
|
511
|
-
if (!
|
|
512
|
-
h++,
|
|
511
|
+
if (!g && d.unitOfMeasurement && (g = d.unitOfMeasurement), d.state === "unavailable") {
|
|
512
|
+
h++, o.push({
|
|
513
513
|
entityId: d.id,
|
|
514
514
|
value: "unavailable",
|
|
515
515
|
friendly_name: d.friendlyName
|
|
516
516
|
});
|
|
517
517
|
continue;
|
|
518
518
|
}
|
|
519
|
-
const
|
|
520
|
-
isNaN(
|
|
519
|
+
const a = Number.parseFloat(d.state);
|
|
520
|
+
isNaN(a) ? i || o.push({
|
|
521
521
|
entityId: d.id,
|
|
522
522
|
value: d.state,
|
|
523
523
|
friendly_name: d.friendlyName
|
|
524
|
-
}) : (n.push(
|
|
524
|
+
}) : (n.push(a), o.push({
|
|
525
525
|
entityId: d.id,
|
|
526
|
-
value:
|
|
526
|
+
value: a,
|
|
527
527
|
friendly_name: d.friendlyName
|
|
528
528
|
}));
|
|
529
529
|
}
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
530
|
+
const y = h === e.length, f = n.length === 0;
|
|
531
|
+
if (y || f)
|
|
532
532
|
return {
|
|
533
533
|
isGroup: r,
|
|
534
|
-
state:
|
|
534
|
+
state: y ? "unavailable" : "unknown",
|
|
535
535
|
numericValue: null,
|
|
536
|
-
isUnavailable:
|
|
537
|
-
unit:
|
|
538
|
-
description:
|
|
539
|
-
memberValues:
|
|
536
|
+
isUnavailable: y,
|
|
537
|
+
unit: g,
|
|
538
|
+
description: y ? "Unavailable" : "No numeric values",
|
|
539
|
+
memberValues: o
|
|
540
540
|
};
|
|
541
|
-
let
|
|
541
|
+
let c, v;
|
|
542
542
|
switch (t) {
|
|
543
543
|
case "min":
|
|
544
|
-
|
|
544
|
+
c = Math.min(...n), v = "Minimum";
|
|
545
545
|
break;
|
|
546
546
|
case "max":
|
|
547
|
-
|
|
547
|
+
c = Math.max(...n), v = "Maximum";
|
|
548
548
|
break;
|
|
549
549
|
case "mean":
|
|
550
|
-
|
|
550
|
+
c = n.reduce((d, a) => d + a, 0) / n.length, v = "Average";
|
|
551
551
|
break;
|
|
552
552
|
case "median": {
|
|
553
|
-
const d = [...n].sort((
|
|
554
|
-
|
|
553
|
+
const d = [...n].sort((C, w) => C - w), a = Math.floor(d.length / 2);
|
|
554
|
+
c = d.length % 2 === 0 ? (d[a - 1] + d[a]) / 2 : d[a], v = "Median";
|
|
555
555
|
break;
|
|
556
556
|
}
|
|
557
557
|
case "sum":
|
|
558
|
-
|
|
558
|
+
c = n.reduce((d, a) => d + a, 0), v = "Sum";
|
|
559
559
|
break;
|
|
560
560
|
case "last":
|
|
561
|
-
|
|
561
|
+
c = n[n.length - 1], v = "Latest";
|
|
562
562
|
break;
|
|
563
563
|
case "range":
|
|
564
|
-
|
|
564
|
+
c = Math.max(...n) - Math.min(...n), v = "Range";
|
|
565
565
|
break;
|
|
566
566
|
case "product":
|
|
567
|
-
|
|
567
|
+
c = n.reduce((d, a) => d * a, 1), v = "Product";
|
|
568
568
|
break;
|
|
569
569
|
case "std_dev": {
|
|
570
|
-
const d = n.reduce((
|
|
571
|
-
|
|
570
|
+
const d = n.reduce((C, w) => C + w, 0) / n.length, a = n.reduce((C, w) => C + (w - d) ** 2, 0) / n.length;
|
|
571
|
+
c = Math.sqrt(a), v = "Std Dev";
|
|
572
572
|
break;
|
|
573
573
|
}
|
|
574
574
|
default:
|
|
575
|
-
|
|
575
|
+
c = n.reduce((d, a) => d + a, 0) / n.length, v = "Average";
|
|
576
576
|
}
|
|
577
|
-
const
|
|
577
|
+
const k = Number.isInteger(c) ? c.toString() : c.toFixed(1);
|
|
578
578
|
return {
|
|
579
579
|
isGroup: r,
|
|
580
|
-
state:
|
|
581
|
-
numericValue:
|
|
580
|
+
state: k,
|
|
581
|
+
numericValue: c,
|
|
582
582
|
isUnavailable: !1,
|
|
583
|
-
unit:
|
|
584
|
-
description: `${
|
|
585
|
-
memberValues:
|
|
583
|
+
unit: g,
|
|
584
|
+
description: `${v} of ${n.length}`,
|
|
585
|
+
memberValues: o
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function se(e) {
|
|
589
589
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
590
590
|
const i = (e.attributes?.brightness ?? 255) / 255;
|
|
591
591
|
if (e.attributes?.rgb_color) {
|
|
592
|
-
const [r, n,
|
|
593
|
-
return `rgb(${Math.round(r * i)}, ${Math.round(n * i)}, ${Math.round(
|
|
592
|
+
const [r, n, o] = e.attributes.rgb_color;
|
|
593
|
+
return `rgb(${Math.round(r * i)}, ${Math.round(n * i)}, ${Math.round(o * i)})`;
|
|
594
594
|
}
|
|
595
595
|
if (e.attributes?.color_temp) {
|
|
596
596
|
const n = 1e6 / e.attributes.color_temp / 100;
|
|
597
|
-
let
|
|
598
|
-
return n <= 66 ? (
|
|
597
|
+
let o, h, g;
|
|
598
|
+
return n <= 66 ? (o = 255, h = n <= 19 ? 0 : 99.4708025861 * Math.log(n - 10) - 161.1195681661, g = n <= 19 ? 0 : n <= 66 ? 138.5177312231 * Math.log(n - 10) - 305.0447927307 : 255) : (o = 329.698727446 * (n - 60) ** -0.1332047592, h = 288.1221695283 * (n - 60) ** -0.0755148492, g = 255), o = Math.max(0, Math.min(255, o)) * i, h = Math.max(0, Math.min(255, h)) * i, g = Math.max(0, Math.min(255, g)) * i, `rgb(${Math.round(o)}, ${Math.round(h)}, ${Math.round(g)})`;
|
|
599
599
|
}
|
|
600
600
|
return `rgb(${Math.round(255 * i)}, ${Math.round(220 * i)}, ${Math.round(180 * i)})`;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function qe(e) {
|
|
603
603
|
if (!e) return !1;
|
|
604
604
|
if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
|
|
605
605
|
return !0;
|
|
@@ -609,47 +609,47 @@ function Ge(e) {
|
|
|
609
609
|
}
|
|
610
610
|
return !1;
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function Rt(e, t, i) {
|
|
613
613
|
return e?.attributes ? e.attributes[t] ?? i : i;
|
|
614
614
|
}
|
|
615
|
-
function
|
|
616
|
-
return e.filter(
|
|
615
|
+
function It(e) {
|
|
616
|
+
return e.filter(qe).length;
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function Ye(e, t, i) {
|
|
619
619
|
const { decimals: r, scale: n = !0 } = {};
|
|
620
620
|
if (typeof e == "string")
|
|
621
621
|
return t ? `${e}${t}` : e;
|
|
622
622
|
if (e == null || Number.isNaN(e))
|
|
623
623
|
return t ? `--${t}` : "--";
|
|
624
|
-
let
|
|
625
|
-
n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (
|
|
626
|
-
let
|
|
627
|
-
return r !== void 0 ?
|
|
624
|
+
let o = e, h = t || "";
|
|
625
|
+
n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (o = e / 1e6, h = "MW") : e >= 1e3 ? (o = e / 1e3, h = "kW") : h = "W"), n && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (o = e / 1073741824, h = "GB") : e >= 1048576 ? (o = e / 1048576, h = "MB") : e >= 1024 ? (o = e / 1024, h = "KB") : h = "B");
|
|
626
|
+
let g;
|
|
627
|
+
return r !== void 0 ? g = o.toFixed(r) : o !== e ? g = o.toFixed(1) : Number.isInteger(e) ? g = e.toString() : g = Number.parseFloat(e.toFixed(2)).toString(), h ? `${g}${h}` : g;
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Ke(e, t) {
|
|
630
630
|
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;
|
|
631
631
|
}
|
|
632
|
-
var
|
|
633
|
-
function
|
|
632
|
+
var Xe = /* @__PURE__ */ x("<div class=glasshome-widget-subtitle>"), Je = /* @__PURE__ */ x("<div><div class=glasshome-widget-value>");
|
|
633
|
+
function Qe(e) {
|
|
634
634
|
return (() => {
|
|
635
|
-
var t =
|
|
636
|
-
return
|
|
635
|
+
var t = Je(), i = t.firstChild;
|
|
636
|
+
return p(i, () => Ye(e.value, e.unit)), p(t, $(E, {
|
|
637
637
|
get when() {
|
|
638
|
-
return
|
|
638
|
+
return _(() => !!e.interpret)() && typeof e.value == "number";
|
|
639
639
|
},
|
|
640
640
|
get children() {
|
|
641
|
-
var r =
|
|
642
|
-
return
|
|
641
|
+
var r = Xe();
|
|
642
|
+
return p(r, () => Ke(e.value, e.unit)), r;
|
|
643
643
|
}
|
|
644
|
-
}), null), W(() =>
|
|
644
|
+
}), null), W(() => R(t, P("flex flex-col", e.class))), t;
|
|
645
645
|
})();
|
|
646
646
|
}
|
|
647
|
-
var
|
|
648
|
-
function
|
|
649
|
-
|
|
650
|
-
|
|
647
|
+
var Ze = /* @__PURE__ */ x('<div><div class="relative h-full w-full">'), et = /* @__PURE__ */ x('<div class="glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse">'), tt = /* @__PURE__ */ x('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), nt = /* @__PURE__ */ x('<div class="flex items-center justify-center text-white/30">'), it = /* @__PURE__ */ x('<h3 class="font-semibold text-sm text-white/60">'), rt = /* @__PURE__ */ x('<p class="text-white/50 text-xs">');
|
|
648
|
+
function ot(e) {
|
|
649
|
+
xe(() => {
|
|
650
|
+
Me();
|
|
651
651
|
});
|
|
652
|
-
const t =
|
|
652
|
+
const t = le(ne), [i, r] = H(), n = be(i), o = {
|
|
653
653
|
isEditMode: () => e.isEditMode ?? !1,
|
|
654
654
|
updateConfig: t?.updateConfig ?? (() => {
|
|
655
655
|
}),
|
|
@@ -657,10 +657,10 @@ function rt(e) {
|
|
|
657
657
|
width: n.width ?? 0,
|
|
658
658
|
height: n.height ?? 0
|
|
659
659
|
})
|
|
660
|
-
}, h =
|
|
660
|
+
}, h = L(() => {
|
|
661
661
|
if (e.variant)
|
|
662
|
-
return typeof e.variant == "string" ?
|
|
663
|
-
}),
|
|
662
|
+
return typeof e.variant == "string" ? Ee(e.variant) : e.variant;
|
|
663
|
+
}), g = L(() => ({
|
|
664
664
|
"container-type": "size",
|
|
665
665
|
"container-name": "widget",
|
|
666
666
|
"touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
|
|
@@ -678,26 +678,26 @@ function rt(e) {
|
|
|
678
678
|
...e.gradient ? {
|
|
679
679
|
"--widget-gradient": e.gradient
|
|
680
680
|
} : {}
|
|
681
|
-
})),
|
|
682
|
-
|
|
683
|
-
},
|
|
684
|
-
|
|
685
|
-
},
|
|
686
|
-
|
|
687
|
-
},
|
|
688
|
-
|
|
689
|
-
}, d = (
|
|
690
|
-
|
|
681
|
+
})), y = () => !!e.gestures && !e.isEditMode, f = (a) => {
|
|
682
|
+
y() && e.gestures?.onPointerEnter(a);
|
|
683
|
+
}, c = (a) => {
|
|
684
|
+
y() && e.gestures?.onPointerDown(a);
|
|
685
|
+
}, v = (a) => {
|
|
686
|
+
y() && e.gestures?.onPointerMove(a);
|
|
687
|
+
}, k = (a) => {
|
|
688
|
+
y() && e.gestures?.onPointerUp(a);
|
|
689
|
+
}, d = (a) => {
|
|
690
|
+
y() && e.gestures?.onPointerCancel(a);
|
|
691
691
|
};
|
|
692
|
-
return
|
|
693
|
-
value:
|
|
692
|
+
return $(ne.Provider, {
|
|
693
|
+
value: o,
|
|
694
694
|
get children() {
|
|
695
|
-
var
|
|
696
|
-
return
|
|
697
|
-
r(
|
|
698
|
-
},
|
|
699
|
-
var
|
|
700
|
-
return () =>
|
|
695
|
+
var a = Ze(), C = a.firstChild;
|
|
696
|
+
return U(a, "pointercancel", d), U(a, "pointerup", k), U(a, "pointermove", v), U(a, "pointerdown", c), U(a, "pointerenter", f), ve((w) => {
|
|
697
|
+
r(w), e.gestures?.bindElement(w);
|
|
698
|
+
}, a), p(C, (() => {
|
|
699
|
+
var w = _(() => !!e.emptyState);
|
|
700
|
+
return () => w() ? $(at, {
|
|
701
701
|
get icon() {
|
|
702
702
|
return e.emptyState.icon;
|
|
703
703
|
},
|
|
@@ -708,86 +708,86 @@ function rt(e) {
|
|
|
708
708
|
return e.emptyState.message;
|
|
709
709
|
}
|
|
710
710
|
}) : e.children;
|
|
711
|
-
})()),
|
|
712
|
-
var
|
|
713
|
-
return () =>
|
|
714
|
-
var
|
|
715
|
-
return W((
|
|
711
|
+
})()), p(a, (() => {
|
|
712
|
+
var w = _(() => !!e.loading);
|
|
713
|
+
return () => w() && (() => {
|
|
714
|
+
var S = et();
|
|
715
|
+
return W((O) => Y(S, "z-index", G.OVERLAY)), S;
|
|
716
716
|
})();
|
|
717
|
-
})(), null), W((
|
|
718
|
-
var
|
|
719
|
-
return
|
|
717
|
+
})(), null), W((w) => {
|
|
718
|
+
var S = P("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", h()?.styles?.class, e.class), O = g(), I = G.CONTENT;
|
|
719
|
+
return S !== w.e && R(a, w.e = S), w.t = ie(a, O, w.t), I !== w.a && Y(C, "z-index", w.a = I), w;
|
|
720
720
|
}, {
|
|
721
721
|
e: void 0,
|
|
722
722
|
t: void 0,
|
|
723
723
|
a: void 0
|
|
724
|
-
}),
|
|
724
|
+
}), a;
|
|
725
725
|
}
|
|
726
726
|
});
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function at(e) {
|
|
729
729
|
return (() => {
|
|
730
|
-
var t =
|
|
731
|
-
return
|
|
732
|
-
var i =
|
|
733
|
-
return () => i() && (() => {
|
|
734
|
-
var r = tt();
|
|
735
|
-
return w(r, () => e.icon), r;
|
|
736
|
-
})();
|
|
737
|
-
})(), null), w(t, (() => {
|
|
738
|
-
var i = D(() => !!e.title);
|
|
730
|
+
var t = tt();
|
|
731
|
+
return p(t, (() => {
|
|
732
|
+
var i = _(() => !!e.icon);
|
|
739
733
|
return () => i() && (() => {
|
|
740
734
|
var r = nt();
|
|
741
|
-
return
|
|
735
|
+
return p(r, () => e.icon), r;
|
|
742
736
|
})();
|
|
743
|
-
})(), null),
|
|
744
|
-
var i =
|
|
737
|
+
})(), null), p(t, (() => {
|
|
738
|
+
var i = _(() => !!e.title);
|
|
745
739
|
return () => i() && (() => {
|
|
746
740
|
var r = it();
|
|
747
|
-
return
|
|
741
|
+
return p(r, () => e.title), r;
|
|
742
|
+
})();
|
|
743
|
+
})(), null), p(t, (() => {
|
|
744
|
+
var i = _(() => !!e.message);
|
|
745
|
+
return () => i() && (() => {
|
|
746
|
+
var r = rt();
|
|
747
|
+
return p(r, () => e.message), r;
|
|
748
748
|
})();
|
|
749
749
|
})(), null), t;
|
|
750
750
|
})();
|
|
751
751
|
}
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
var
|
|
760
|
-
function
|
|
752
|
+
const B = ot;
|
|
753
|
+
B.Content = Ae;
|
|
754
|
+
B.Icon = Re;
|
|
755
|
+
B.Title = Ue;
|
|
756
|
+
B.Status = je;
|
|
757
|
+
B.Value = Qe;
|
|
758
|
+
B.SliderFill = Ne;
|
|
759
|
+
var st = /* @__PURE__ */ x('<span class="inline-flex size-3.5 shrink-0 items-center">'), lt = /* @__PURE__ */ x("<button type=button>"), ct = /* @__PURE__ */ x('<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">'), dt = /* @__PURE__ */ x('<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'), ut = /* @__PURE__ */ x('<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>'), gt = /* @__PURE__ */ x('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), ht = /* @__PURE__ */ x('<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">'), ft = /* @__PURE__ */ x('<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'), mt = /* @__PURE__ */ x('<div class="min-w-0 shrink-0">'), vt = /* @__PURE__ */ x('<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">'), wt = /* @__PURE__ */ x('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), bt = /* @__PURE__ */ x('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
|
|
760
|
+
function pt(e) {
|
|
761
761
|
return (() => {
|
|
762
762
|
var t = lt();
|
|
763
|
-
return t.$$click = () => e.onClick(),
|
|
763
|
+
return t.$$click = () => e.onClick(), p(t, $(E, {
|
|
764
764
|
get when() {
|
|
765
765
|
return e.isActive;
|
|
766
766
|
},
|
|
767
767
|
get children() {
|
|
768
|
-
var i =
|
|
769
|
-
return
|
|
768
|
+
var i = st();
|
|
769
|
+
return p(i, () => e.icon), i;
|
|
770
770
|
}
|
|
771
|
-
}), null),
|
|
771
|
+
}), null), p(t, () => e.label, null), W(() => R(t, P("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;
|
|
772
772
|
})();
|
|
773
773
|
}
|
|
774
|
-
function
|
|
775
|
-
const [t] =
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
...
|
|
774
|
+
function jt(e) {
|
|
775
|
+
const [t] = ye(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"]), i = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, n] = H({}), [o, h] = H(null);
|
|
776
|
+
te(ae(() => t.config, (l) => {
|
|
777
|
+
l && n({
|
|
778
|
+
...l
|
|
779
779
|
});
|
|
780
|
-
})),
|
|
781
|
-
|
|
780
|
+
})), te(ae(() => t.configSchema, (l) => {
|
|
781
|
+
l && h(de(l));
|
|
782
782
|
}));
|
|
783
|
-
const
|
|
784
|
-
!
|
|
783
|
+
const g = () => i() && JSON.stringify(r()) !== JSON.stringify(t.config), y = (l) => {
|
|
784
|
+
!l && t.config && n({
|
|
785
785
|
...t.config
|
|
786
|
-
}), t.onOpenChange(
|
|
787
|
-
},
|
|
786
|
+
}), t.onOpenChange(l);
|
|
787
|
+
}, f = () => {
|
|
788
788
|
t.onConfigSave?.(r());
|
|
789
|
-
}, [
|
|
790
|
-
const
|
|
789
|
+
}, [c, v] = H(t.defaultTab ?? "controls"), k = () => {
|
|
790
|
+
const l = t.maxWidth ?? "3xl";
|
|
791
791
|
return {
|
|
792
792
|
sm: "max-w-sm",
|
|
793
793
|
md: "max-w-md",
|
|
@@ -796,73 +796,73 @@ function Pt(e) {
|
|
|
796
796
|
"2xl": "max-w-2xl",
|
|
797
797
|
"3xl": "max-w-3xl",
|
|
798
798
|
"4xl": "max-w-4xl"
|
|
799
|
-
}[
|
|
799
|
+
}[l];
|
|
800
800
|
}, d = () => {
|
|
801
801
|
if (t.tabs) return t.tabs;
|
|
802
|
-
const
|
|
803
|
-
return
|
|
802
|
+
const l = [];
|
|
803
|
+
return l.push({
|
|
804
804
|
id: "edit",
|
|
805
805
|
label: "Edit",
|
|
806
|
-
icon:
|
|
807
|
-
content: t.editContent ?? (i() &&
|
|
806
|
+
icon: ct(),
|
|
807
|
+
content: t.editContent ?? (i() && o() ? $(b, {
|
|
808
808
|
get schema() {
|
|
809
|
-
return
|
|
809
|
+
return o();
|
|
810
810
|
},
|
|
811
811
|
get data() {
|
|
812
812
|
return r();
|
|
813
813
|
},
|
|
814
814
|
onChange: n
|
|
815
|
-
}) :
|
|
816
|
-
}),
|
|
815
|
+
}) : dt())
|
|
816
|
+
}), l.push({
|
|
817
817
|
id: "controls",
|
|
818
818
|
label: "Controls",
|
|
819
|
-
icon:
|
|
820
|
-
content: t.controlsContent ??
|
|
821
|
-
}),
|
|
819
|
+
icon: ut(),
|
|
820
|
+
content: t.controlsContent ?? gt()
|
|
821
|
+
}), l.push({
|
|
822
822
|
id: "debug",
|
|
823
823
|
label: "Debug",
|
|
824
|
-
icon:
|
|
825
|
-
content: t.debugContent ??
|
|
826
|
-
}),
|
|
827
|
-
},
|
|
824
|
+
icon: ht(),
|
|
825
|
+
content: t.debugContent ?? ft()
|
|
826
|
+
}), l;
|
|
827
|
+
}, a = async () => {
|
|
828
828
|
if (t.debugData !== void 0)
|
|
829
829
|
try {
|
|
830
|
-
const
|
|
831
|
-
await navigator.clipboard.writeText(
|
|
830
|
+
const l = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
|
|
831
|
+
await navigator.clipboard.writeText(l);
|
|
832
832
|
} catch {
|
|
833
833
|
}
|
|
834
|
-
},
|
|
835
|
-
const
|
|
836
|
-
return
|
|
837
|
-
},
|
|
838
|
-
return
|
|
834
|
+
}, C = () => {
|
|
835
|
+
const l = d();
|
|
836
|
+
return l.find((V) => V.id === c())?.content ?? l[0]?.content;
|
|
837
|
+
}, w = t.ResponsiveDialog, S = t.ResponsiveDialogContent, O = t.ResponsiveDialogHeader, I = t.ResponsiveDialogTitle, u = t.ResponsiveDialogDescription, m = t.Button, b = t.SchemaForm, M = (l) => i() ? y(l) : t.onOpenChange(l), N = () => i() ? g() : t.hasUnsavedChanges, D = () => i() ? f : t.onSave;
|
|
838
|
+
return $(w, {
|
|
839
839
|
get open() {
|
|
840
840
|
return t.open;
|
|
841
841
|
},
|
|
842
|
-
onOpenChange: (
|
|
842
|
+
onOpenChange: (l) => M(l),
|
|
843
843
|
get children() {
|
|
844
|
-
return
|
|
844
|
+
return $(S, {
|
|
845
845
|
get class() {
|
|
846
|
-
return
|
|
846
|
+
return P(k(), t.class);
|
|
847
847
|
},
|
|
848
848
|
get children() {
|
|
849
|
-
return [
|
|
849
|
+
return [$(O, {
|
|
850
850
|
class: "flex flex-row items-center justify-between gap-3",
|
|
851
851
|
get children() {
|
|
852
852
|
return [(() => {
|
|
853
|
-
var
|
|
854
|
-
return
|
|
853
|
+
var l = mt();
|
|
854
|
+
return p(l, $(I, {
|
|
855
855
|
class: "truncate leading-tight",
|
|
856
856
|
get children() {
|
|
857
857
|
return t.title;
|
|
858
858
|
}
|
|
859
|
-
}), null),
|
|
859
|
+
}), null), p(l, $(u, {
|
|
860
860
|
class: "sr-only",
|
|
861
861
|
children: "Widget configuration dialog"
|
|
862
|
-
}), null),
|
|
862
|
+
}), null), l;
|
|
863
863
|
})(), (() => {
|
|
864
|
-
var
|
|
865
|
-
return
|
|
864
|
+
var l = vt(), z = l.firstChild;
|
|
865
|
+
return p(z, () => d().map((V) => $(pt, {
|
|
866
866
|
get icon() {
|
|
867
867
|
return V.icon;
|
|
868
868
|
},
|
|
@@ -870,67 +870,67 @@ function Pt(e) {
|
|
|
870
870
|
return V.label;
|
|
871
871
|
},
|
|
872
872
|
get isActive() {
|
|
873
|
-
return
|
|
873
|
+
return c() === V.id;
|
|
874
874
|
},
|
|
875
|
-
onClick: () =>
|
|
876
|
-
}))),
|
|
875
|
+
onClick: () => v(V.id)
|
|
876
|
+
}))), p(l, $(E, {
|
|
877
877
|
get when() {
|
|
878
878
|
return t.headerActions;
|
|
879
879
|
},
|
|
880
880
|
get children() {
|
|
881
881
|
return t.headerActions;
|
|
882
882
|
}
|
|
883
|
-
}), null),
|
|
883
|
+
}), null), l;
|
|
884
884
|
})()];
|
|
885
885
|
}
|
|
886
886
|
}), (() => {
|
|
887
|
-
var
|
|
888
|
-
return
|
|
889
|
-
})(),
|
|
887
|
+
var l = wt();
|
|
888
|
+
return p(l, C), l;
|
|
889
|
+
})(), $(E, {
|
|
890
890
|
get when() {
|
|
891
|
-
return
|
|
891
|
+
return _(() => c() === "edit")() && (D() || t.onDelete) || c() === "debug" && t.debugData !== void 0;
|
|
892
892
|
},
|
|
893
893
|
get children() {
|
|
894
|
-
var
|
|
895
|
-
return
|
|
894
|
+
var l = bt();
|
|
895
|
+
return p(l, $(E, {
|
|
896
896
|
get when() {
|
|
897
|
-
return
|
|
897
|
+
return _(() => c() === "edit")() && t.onDelete;
|
|
898
898
|
},
|
|
899
899
|
get children() {
|
|
900
|
-
return
|
|
900
|
+
return $(m, {
|
|
901
901
|
size: "sm",
|
|
902
902
|
variant: "destructive",
|
|
903
903
|
onClick: () => t.onDelete?.(),
|
|
904
904
|
children: "Delete"
|
|
905
905
|
});
|
|
906
906
|
}
|
|
907
|
-
}), null),
|
|
907
|
+
}), null), p(l, $(E, {
|
|
908
908
|
get when() {
|
|
909
|
-
return
|
|
909
|
+
return _(() => c() === "edit")() && D();
|
|
910
910
|
},
|
|
911
911
|
get children() {
|
|
912
|
-
return
|
|
912
|
+
return $(m, {
|
|
913
913
|
size: "sm",
|
|
914
914
|
get disabled() {
|
|
915
|
-
return !
|
|
915
|
+
return !N();
|
|
916
916
|
},
|
|
917
|
-
onClick: () =>
|
|
917
|
+
onClick: () => D()?.(),
|
|
918
918
|
children: "Save"
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
|
-
}), null),
|
|
921
|
+
}), null), p(l, $(E, {
|
|
922
922
|
get when() {
|
|
923
|
-
return
|
|
923
|
+
return _(() => c() === "debug")() && t.debugData !== void 0;
|
|
924
924
|
},
|
|
925
925
|
get children() {
|
|
926
|
-
return
|
|
926
|
+
return $(m, {
|
|
927
927
|
size: "sm",
|
|
928
928
|
variant: "outline",
|
|
929
|
-
onClick:
|
|
929
|
+
onClick: a,
|
|
930
930
|
children: "Copy"
|
|
931
931
|
});
|
|
932
932
|
}
|
|
933
|
-
}), null),
|
|
933
|
+
}), null), l;
|
|
934
934
|
}
|
|
935
935
|
})];
|
|
936
936
|
}
|
|
@@ -938,9 +938,27 @@ function Pt(e) {
|
|
|
938
938
|
}
|
|
939
939
|
});
|
|
940
940
|
}
|
|
941
|
-
|
|
942
|
-
function
|
|
943
|
-
|
|
941
|
+
we(["click"]);
|
|
942
|
+
function Lt(e) {
|
|
943
|
+
if (typeof IntersectionObserver > "u")
|
|
944
|
+
return () => !1;
|
|
945
|
+
const [t, i] = H(!1), r = new IntersectionObserver((n) => {
|
|
946
|
+
const o = n[0];
|
|
947
|
+
o && i(!o.isIntersecting);
|
|
948
|
+
});
|
|
949
|
+
return te(() => {
|
|
950
|
+
const n = e();
|
|
951
|
+
r.disconnect(), n && r.observe(n);
|
|
952
|
+
}), ce(() => r.disconnect()), t;
|
|
953
|
+
}
|
|
954
|
+
function Bt() {
|
|
955
|
+
if (typeof window > "u" || typeof window.matchMedia != "function")
|
|
956
|
+
return () => !1;
|
|
957
|
+
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, i] = H(e.matches), r = (n) => i(n.matches);
|
|
958
|
+
return e.addEventListener("change", r), ce(() => e.removeEventListener("change", r)), t;
|
|
959
|
+
}
|
|
960
|
+
function Ut(e = "edit") {
|
|
961
|
+
const [t, i] = H(!1), [r, n] = H(e);
|
|
944
962
|
return {
|
|
945
963
|
showDialog: t,
|
|
946
964
|
setShowDialog: i,
|
|
@@ -950,99 +968,99 @@ function Rt(e = "edit") {
|
|
|
950
968
|
setActiveTab: n
|
|
951
969
|
};
|
|
952
970
|
}
|
|
953
|
-
function
|
|
954
|
-
const t = e.minEntities ?? 1, i =
|
|
971
|
+
function Ft(e) {
|
|
972
|
+
const t = e.minEntities ?? 1, i = L(() => e.entities().length), r = L(() => i() >= t), n = L(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), o = L(() => {
|
|
955
973
|
if (!r()) return;
|
|
956
|
-
const
|
|
957
|
-
if (!
|
|
958
|
-
const
|
|
959
|
-
if (
|
|
960
|
-
return
|
|
961
|
-
if (
|
|
962
|
-
const
|
|
963
|
-
return
|
|
974
|
+
const g = e.aggregationMode?.();
|
|
975
|
+
if (!g || g === "none") return;
|
|
976
|
+
const y = e.entities();
|
|
977
|
+
if (g === "light" || g === "binary-sensor" || g === "switch")
|
|
978
|
+
return Fe(y, e.allEntitiesMode);
|
|
979
|
+
if (g === "sensor") {
|
|
980
|
+
const f = e.sensorGroupType?.() ?? "mean";
|
|
981
|
+
return Ge(y, f, !0);
|
|
964
982
|
}
|
|
965
|
-
}), h =
|
|
983
|
+
}), h = L(() => r() ? void 0 : e.emptyStateConfig);
|
|
966
984
|
return {
|
|
967
985
|
entities: e.entities,
|
|
968
986
|
groupData: n,
|
|
969
|
-
aggregatedData:
|
|
987
|
+
aggregatedData: o,
|
|
970
988
|
emptyState: h,
|
|
971
989
|
hasEntities: r,
|
|
972
990
|
count: i
|
|
973
991
|
};
|
|
974
992
|
}
|
|
975
|
-
const F = 32,
|
|
976
|
-
function
|
|
993
|
+
const F = 32, s = F / 2, T = "white", K = "rgba(0,0,0,0.4)", re = 2, X = 3;
|
|
994
|
+
function xt(e) {
|
|
977
995
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
978
996
|
}
|
|
979
997
|
function J(e) {
|
|
980
998
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${F}" height="${F}" viewBox="0 0 ${F} ${F}">${e}</svg>`;
|
|
981
999
|
}
|
|
982
|
-
const
|
|
1000
|
+
const yt = J(`
|
|
983
1001
|
<g transform="translate(6, 2)">
|
|
984
1002
|
<!-- shadow -->
|
|
985
1003
|
<g stroke="${K}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
986
1004
|
<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"/>
|
|
987
1005
|
</g>
|
|
988
1006
|
<!-- main -->
|
|
989
|
-
<g stroke="${
|
|
1007
|
+
<g stroke="${T}" stroke-width="${re}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
990
1008
|
<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"/>
|
|
991
1009
|
</g>
|
|
992
1010
|
</g>
|
|
993
|
-
`),
|
|
1011
|
+
`), $t = J(`
|
|
994
1012
|
<g>
|
|
995
|
-
<circle cx="${
|
|
996
|
-
<circle cx="${
|
|
997
|
-
<circle cx="${
|
|
1013
|
+
<circle cx="${s}" cy="${s}" r="8" stroke="${K}" stroke-width="${X}" fill="none"/>
|
|
1014
|
+
<circle cx="${s}" cy="${s}" r="8" stroke="${T}" stroke-width="1.5" fill="none"/>
|
|
1015
|
+
<circle cx="${s}" cy="${s}" r="1.5" fill="${T}"/>
|
|
998
1016
|
</g>
|
|
999
|
-
`),
|
|
1017
|
+
`), kt = J(`
|
|
1000
1018
|
<g>
|
|
1001
1019
|
<!-- shadow -->
|
|
1002
1020
|
<g stroke="${K}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1003
|
-
<line x1="6" y1="${
|
|
1004
|
-
<polyline points="10,${
|
|
1005
|
-
<polyline points="22,${
|
|
1021
|
+
<line x1="6" y1="${s}" x2="26" y2="${s}"/>
|
|
1022
|
+
<polyline points="10,${s - 4} 6,${s} 10,${s + 4}"/>
|
|
1023
|
+
<polyline points="22,${s - 4} 26,${s} 22,${s + 4}"/>
|
|
1006
1024
|
</g>
|
|
1007
1025
|
<!-- main -->
|
|
1008
|
-
<g stroke="${
|
|
1009
|
-
<line x1="6" y1="${
|
|
1010
|
-
<polyline points="10,${
|
|
1011
|
-
<polyline points="22,${
|
|
1026
|
+
<g stroke="${T}" stroke-width="${re}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1027
|
+
<line x1="6" y1="${s}" x2="26" y2="${s}"/>
|
|
1028
|
+
<polyline points="10,${s - 4} 6,${s} 10,${s + 4}"/>
|
|
1029
|
+
<polyline points="22,${s - 4} 26,${s} 22,${s + 4}"/>
|
|
1012
1030
|
</g>
|
|
1013
1031
|
<!-- center grip dots -->
|
|
1014
|
-
<circle cx="${
|
|
1015
|
-
<circle cx="${
|
|
1016
|
-
<circle cx="${
|
|
1032
|
+
<circle cx="${s}" cy="${s}" r="1.5" fill="${T}"/>
|
|
1033
|
+
<circle cx="${s - 5}" cy="${s}" r="1" fill="${T}" opacity="0.6"/>
|
|
1034
|
+
<circle cx="${s + 5}" cy="${s}" r="1" fill="${T}" opacity="0.6"/>
|
|
1017
1035
|
</g>
|
|
1018
|
-
`),
|
|
1036
|
+
`), Ct = J(`
|
|
1019
1037
|
<g>
|
|
1020
1038
|
<!-- shadow -->
|
|
1021
1039
|
<g stroke="${K}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1022
|
-
<line x1="${
|
|
1023
|
-
<polyline points="${
|
|
1024
|
-
<polyline points="${
|
|
1040
|
+
<line x1="${s}" y1="6" x2="${s}" y2="26"/>
|
|
1041
|
+
<polyline points="${s - 4},10 ${s},6 ${s + 4},10"/>
|
|
1042
|
+
<polyline points="${s - 4},22 ${s},26 ${s + 4},22"/>
|
|
1025
1043
|
</g>
|
|
1026
1044
|
<!-- main -->
|
|
1027
|
-
<g stroke="${
|
|
1028
|
-
<line x1="${
|
|
1029
|
-
<polyline points="${
|
|
1030
|
-
<polyline points="${
|
|
1045
|
+
<g stroke="${T}" stroke-width="${re}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1046
|
+
<line x1="${s}" y1="6" x2="${s}" y2="26"/>
|
|
1047
|
+
<polyline points="${s - 4},10 ${s},6 ${s + 4},10"/>
|
|
1048
|
+
<polyline points="${s - 4},22 ${s},26 ${s + 4},22"/>
|
|
1031
1049
|
</g>
|
|
1032
1050
|
<!-- center grip dots -->
|
|
1033
|
-
<circle cx="${
|
|
1034
|
-
<circle cx="${
|
|
1035
|
-
<circle cx="${
|
|
1051
|
+
<circle cx="${s}" cy="${s}" r="1.5" fill="${T}"/>
|
|
1052
|
+
<circle cx="${s}" cy="${s - 5}" r="1" fill="${T}" opacity="0.6"/>
|
|
1053
|
+
<circle cx="${s}" cy="${s + 5}" r="1" fill="${T}" opacity="0.6"/>
|
|
1036
1054
|
</g>
|
|
1037
1055
|
`);
|
|
1038
1056
|
function q(e, t, i) {
|
|
1039
|
-
return { css: `${
|
|
1057
|
+
return { css: `${xt(e)} ${t} ${i}, auto`, hotspotX: t, hotspotY: i };
|
|
1040
1058
|
}
|
|
1041
|
-
const
|
|
1042
|
-
tap: q(
|
|
1043
|
-
hold: q(
|
|
1044
|
-
slideHorizontal: q(
|
|
1045
|
-
slideVertical: q(
|
|
1059
|
+
const j = {
|
|
1060
|
+
tap: q(yt, 12, 4),
|
|
1061
|
+
hold: q($t, 16, 16),
|
|
1062
|
+
slideHorizontal: q(kt, s, s),
|
|
1063
|
+
slideVertical: q(Ct, s, s)
|
|
1046
1064
|
};
|
|
1047
1065
|
function Z() {
|
|
1048
1066
|
if (typeof window > "u") return null;
|
|
@@ -1056,7 +1074,7 @@ function ee(e) {
|
|
|
1056
1074
|
} catch {
|
|
1057
1075
|
}
|
|
1058
1076
|
}
|
|
1059
|
-
const
|
|
1077
|
+
const St = {
|
|
1060
1078
|
/** Light confirmation — fires when slide gesture arms after user holds still. */
|
|
1061
1079
|
tick() {
|
|
1062
1080
|
const e = Z();
|
|
@@ -1088,7 +1106,7 @@ const Ct = {
|
|
|
1088
1106
|
ee([0, 15, 40, 15]);
|
|
1089
1107
|
}
|
|
1090
1108
|
};
|
|
1091
|
-
function
|
|
1109
|
+
function Gt(e, t) {
|
|
1092
1110
|
const n = {
|
|
1093
1111
|
isDown: !1,
|
|
1094
1112
|
isTouch: !1,
|
|
@@ -1100,99 +1118,118 @@ function jt(e, t) {
|
|
|
1100
1118
|
holdTimer: null,
|
|
1101
1119
|
element: null
|
|
1102
1120
|
};
|
|
1103
|
-
let
|
|
1104
|
-
function
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1121
|
+
let o = null, h = null, g = null;
|
|
1122
|
+
function y(u) {
|
|
1123
|
+
u !== h && (g && g.disconnect(), g = new ResizeObserver((m) => {
|
|
1124
|
+
const b = m[0];
|
|
1125
|
+
if (b) {
|
|
1126
|
+
const M = b.borderBoxSize?.[0];
|
|
1127
|
+
M ? o = { width: M.inlineSize, height: M.blockSize } : o = { width: b.contentRect.width, height: b.contentRect.height };
|
|
1110
1128
|
}
|
|
1111
|
-
}), h =
|
|
1129
|
+
}), h = u, g.observe(u), o = { width: u.clientWidth, height: u.clientHeight });
|
|
1112
1130
|
}
|
|
1113
|
-
const
|
|
1131
|
+
const f = () => {
|
|
1114
1132
|
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null);
|
|
1115
|
-
},
|
|
1133
|
+
}, c = () => {
|
|
1116
1134
|
n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
|
|
1117
|
-
},
|
|
1118
|
-
const
|
|
1119
|
-
return
|
|
1120
|
-
},
|
|
1121
|
-
const
|
|
1122
|
-
if (!(!
|
|
1123
|
-
if (n.isDown = !0, n.isTouch =
|
|
1124
|
-
const
|
|
1135
|
+
}, v = (u) => {
|
|
1136
|
+
const b = e().slide;
|
|
1137
|
+
return b?.orientation === "horizontal" ? "horizontal" : b?.orientation === "vertical" ? "vertical" : u && (o || y(u), o) ? o.height > o.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1138
|
+
}, k = (u) => {
|
|
1139
|
+
const m = e();
|
|
1140
|
+
if (!(!m.tap && !m.hold && !m.slide)) {
|
|
1141
|
+
if (n.isDown = !0, n.isTouch = u.pointerType === "touch", n.element = u.currentTarget, y(n.element), n.startX = u.clientX, n.startY = u.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, m.hold) {
|
|
1142
|
+
const b = m.hold.delay ?? 500;
|
|
1125
1143
|
n.holdTimer = setTimeout(() => {
|
|
1126
|
-
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (
|
|
1127
|
-
},
|
|
1144
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (St.bump(), m.hold?.action(), n.isDown = !1);
|
|
1145
|
+
}, b);
|
|
1128
1146
|
}
|
|
1129
|
-
if (!n.isTouch &&
|
|
1147
|
+
if (!n.isTouch && m.slide)
|
|
1130
1148
|
try {
|
|
1131
|
-
|
|
1149
|
+
u.currentTarget.setPointerCapture(u.pointerId);
|
|
1132
1150
|
} catch {
|
|
1133
1151
|
}
|
|
1134
1152
|
}
|
|
1135
|
-
}, d = (
|
|
1153
|
+
}, d = (u) => {
|
|
1136
1154
|
if (!n.isDown) return;
|
|
1137
|
-
const
|
|
1138
|
-
if (Math.sqrt(
|
|
1139
|
-
const
|
|
1155
|
+
const m = e(), b = u.clientX - n.startX, M = u.clientY - n.startY;
|
|
1156
|
+
if (Math.sqrt(b * b + M * M) > 10 && (f(), n.hasMoved = !0), !n.isTouch && m.slide && n.hasMoved) {
|
|
1157
|
+
const D = u.currentTarget, l = v(D);
|
|
1140
1158
|
n.sliding = !0;
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1159
|
+
const z = m.slide.min ?? 0, V = m.slide.max ?? 100, ue = V - z, ge = l === "vertical" ? -M : b, oe = o ?? { width: D.clientWidth, height: D.clientHeight }, he = l === "vertical" ? oe.height : oe.width, fe = ge / he * ue, me = Math.max(z, Math.min(V, m.slide.value + fe));
|
|
1160
|
+
m.slide.onChange(Math.round(me)), n.startX = u.clientX, n.startY = u.clientY, u.preventDefault();
|
|
1143
1161
|
}
|
|
1144
|
-
},
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1162
|
+
}, a = (u) => {
|
|
1163
|
+
const m = e(), b = n.isDown, M = Date.now() - n.startTime, N = m.hold?.delay ?? 500;
|
|
1164
|
+
f(), b && m.tap && !n.hasMoved && M < N && m.tap();
|
|
1147
1165
|
try {
|
|
1148
|
-
|
|
1166
|
+
u.currentTarget.releasePointerCapture(u.pointerId);
|
|
1149
1167
|
} catch {
|
|
1150
1168
|
}
|
|
1151
|
-
|
|
1152
|
-
},
|
|
1153
|
-
|
|
1169
|
+
c();
|
|
1170
|
+
}, C = (u) => {
|
|
1171
|
+
f();
|
|
1154
1172
|
try {
|
|
1155
|
-
|
|
1173
|
+
u.currentTarget.releasePointerCapture(u.pointerId);
|
|
1156
1174
|
} catch {
|
|
1157
1175
|
}
|
|
1158
|
-
|
|
1159
|
-
},
|
|
1160
|
-
const
|
|
1161
|
-
if (
|
|
1162
|
-
const
|
|
1163
|
-
return
|
|
1176
|
+
c();
|
|
1177
|
+
}, w = (u) => {
|
|
1178
|
+
const m = e();
|
|
1179
|
+
if (m.slide) {
|
|
1180
|
+
const b = m.slide.orientation;
|
|
1181
|
+
return b === "horizontal" ? j.slideHorizontal.css : b === "vertical" ? j.slideVertical.css : (o || y(u), o && o.height > o.width ? j.slideVertical.css : j.slideHorizontal.css);
|
|
1164
1182
|
}
|
|
1165
|
-
return
|
|
1183
|
+
return m.tap ? j.tap.css : m.hold ? j.hold.css : "";
|
|
1166
1184
|
};
|
|
1167
1185
|
return {
|
|
1168
|
-
onPointerDown:
|
|
1186
|
+
onPointerDown: k,
|
|
1169
1187
|
onPointerMove: d,
|
|
1170
|
-
onPointerUp:
|
|
1171
|
-
onPointerCancel:
|
|
1172
|
-
onPointerEnter: (
|
|
1173
|
-
const
|
|
1174
|
-
n.element =
|
|
1188
|
+
onPointerUp: a,
|
|
1189
|
+
onPointerCancel: C,
|
|
1190
|
+
onPointerEnter: (u) => {
|
|
1191
|
+
const m = u.currentTarget;
|
|
1192
|
+
n.element = m, m.style.cursor = w(m);
|
|
1175
1193
|
},
|
|
1176
|
-
bindElement: (
|
|
1177
|
-
|
|
1194
|
+
bindElement: (u) => {
|
|
1195
|
+
u && (n.element = u, y(u));
|
|
1178
1196
|
},
|
|
1179
1197
|
touchAction: () => {
|
|
1180
|
-
const
|
|
1181
|
-
return
|
|
1198
|
+
const u = e();
|
|
1199
|
+
return u.tap || u.hold || u.slide ? "manipulation" : "auto";
|
|
1182
1200
|
},
|
|
1183
1201
|
dispose: () => {
|
|
1184
|
-
|
|
1202
|
+
f(), g && (g.disconnect(), g = null), h = null, o = null;
|
|
1185
1203
|
}
|
|
1186
1204
|
};
|
|
1187
1205
|
}
|
|
1188
|
-
const
|
|
1206
|
+
const Mt = {
|
|
1207
|
+
solar: "oklch(0.74 0.18 60)",
|
|
1208
|
+
grid: "oklch(0.62 0.12 245)",
|
|
1209
|
+
battery: "oklch(0.70 0.18 145)",
|
|
1210
|
+
ev: "oklch(0.70 0.14 190)",
|
|
1211
|
+
home: "oklch(0.68 0.06 250)",
|
|
1212
|
+
positive: "oklch(0.70 0.14 160)",
|
|
1213
|
+
// Fault red-orange; used only for faults, never normal consumption.
|
|
1214
|
+
negative: "oklch(0.64 0.22 27)"
|
|
1215
|
+
};
|
|
1216
|
+
function Dt(e) {
|
|
1217
|
+
return {
|
|
1218
|
+
fill: `color-mix(in oklch, ${e} 20%, transparent)`,
|
|
1219
|
+
stroke: e,
|
|
1220
|
+
solid: e
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
const qt = Object.fromEntries(
|
|
1224
|
+
Object.entries(Mt).map(([e, t]) => [e, Dt(t)])
|
|
1225
|
+
), Yt = A.enum([
|
|
1189
1226
|
"success",
|
|
1190
1227
|
"warning",
|
|
1191
1228
|
"danger",
|
|
1192
1229
|
"info",
|
|
1193
1230
|
"neutral",
|
|
1194
1231
|
"accent"
|
|
1195
|
-
]),
|
|
1232
|
+
]), Kt = {
|
|
1196
1233
|
/** Optional display name override (renders as text input) */
|
|
1197
1234
|
title: () => A.string().optional().meta({ title: "Title", description: "Optional display name override" }),
|
|
1198
1235
|
/** Multi-select entity picker for a HA domain */
|
|
@@ -1202,37 +1239,68 @@ const Bt = A.enum([
|
|
|
1202
1239
|
/** Area picker dropdown */
|
|
1203
1240
|
areaId: () => A.string().optional().meta({ formType: "area-picker", title: "Area" })
|
|
1204
1241
|
};
|
|
1205
|
-
function
|
|
1242
|
+
function Xt(e) {
|
|
1243
|
+
if (e.length < 2) return "";
|
|
1244
|
+
const t = e[0], i = e[1];
|
|
1245
|
+
if (!t || !i) return "";
|
|
1246
|
+
if (e.length === 2) return `M ${t.x} ${t.y} L ${i.x} ${i.y}`;
|
|
1247
|
+
const r = e.length, n = [], o = [], h = [];
|
|
1248
|
+
for (let f = 0; f < r - 1; f++) {
|
|
1249
|
+
const c = e[f], v = e[f + 1];
|
|
1250
|
+
!c || !v || (n.push(v.x - c.x), o.push(v.y - c.y), h.push((v.y - c.y) / (v.x - c.x)));
|
|
1251
|
+
}
|
|
1252
|
+
const g = [h[0] ?? 0];
|
|
1253
|
+
for (let f = 1; f < r - 1; f++) {
|
|
1254
|
+
const c = h[f - 1] ?? 0, v = h[f] ?? 0, k = n[f - 1] ?? 0, d = n[f] ?? 0;
|
|
1255
|
+
c * v <= 0 ? g.push(0) : g.push(
|
|
1256
|
+
3 * (k + d) / ((2 * d + k) / c + (d + 2 * k) / v)
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1259
|
+
g.push(h[r - 2] ?? 0);
|
|
1260
|
+
let y = `M ${t.x} ${t.y}`;
|
|
1261
|
+
for (let f = 0; f < r - 1; f++) {
|
|
1262
|
+
const c = e[f], v = e[f + 1];
|
|
1263
|
+
if (!c || !v) continue;
|
|
1264
|
+
const k = (n[f] ?? 0) / 3, d = g[f] ?? 0, a = g[f + 1] ?? 0;
|
|
1265
|
+
y += ` C ${c.x + k} ${c.y + d * k}, ${v.x - k} ${v.y - a * k}, ${v.x} ${v.y}`;
|
|
1266
|
+
}
|
|
1267
|
+
return y;
|
|
1268
|
+
}
|
|
1269
|
+
function Jt() {
|
|
1206
1270
|
return document.documentElement.classList.contains("dark");
|
|
1207
1271
|
}
|
|
1208
|
-
const
|
|
1209
|
-
version:
|
|
1210
|
-
},
|
|
1272
|
+
const _t = "0.5.1", zt = {
|
|
1273
|
+
version: _t
|
|
1274
|
+
}, Qt = zt.version;
|
|
1211
1275
|
export {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1276
|
+
Qt as SDK_VERSION,
|
|
1277
|
+
Yt as ToneSchema,
|
|
1278
|
+
B as Widget,
|
|
1279
|
+
Ae as WidgetContent,
|
|
1280
|
+
ne as WidgetCtx,
|
|
1281
|
+
jt as WidgetDialog,
|
|
1282
|
+
Re as WidgetIcon,
|
|
1283
|
+
tn as WidgetManifestSchema,
|
|
1220
1284
|
Ne as WidgetSliderFill,
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1285
|
+
je as WidgetStatus,
|
|
1286
|
+
Ue as WidgetTitle,
|
|
1287
|
+
Qe as WidgetValue,
|
|
1288
|
+
Fe as calculateLightGroup,
|
|
1289
|
+
Ge as calculateSensorGroup,
|
|
1290
|
+
It as countActiveEntities,
|
|
1291
|
+
Pt as defineWidget,
|
|
1292
|
+
nn as formatSchemaError,
|
|
1293
|
+
Rt as getEntityAttribute,
|
|
1294
|
+
Me as injectTokens,
|
|
1295
|
+
Jt as isDark,
|
|
1296
|
+
qe as isEntityActive,
|
|
1297
|
+
Xt as monotoneCubicPath,
|
|
1298
|
+
qt as svgColors,
|
|
1299
|
+
Lt as useIntersectionPause,
|
|
1300
|
+
Bt as useReducedMotion,
|
|
1301
|
+
Ht as useWidgetContext,
|
|
1302
|
+
Ut as useWidgetDialog,
|
|
1303
|
+
Ft as useWidgetEntityGroup,
|
|
1304
|
+
Gt as useWidgetGestures,
|
|
1305
|
+
Kt as widgetFields
|
|
1238
1306
|
};
|