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