@glasshome/widget-sdk 1.9.2 → 1.9.3

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.
Files changed (2) hide show
  1. package/dist/index.js +199 -195
  2. package/package.json +7 -3
package/dist/index.js CHANGED
@@ -3,13 +3,13 @@ import { WidgetManifestSchema as r, formatSchemaError as i } from "./schemas.js"
3
3
  import { z as a, z as o } from "zod";
4
4
  import { getForecasts as s, getStream as c, getWebRtcClientConfig as l, hassMediaUrl as u, sendWebRtcCandidate as d, startWebRtcSession as f, state as p, trackEntityHistory as m, untrackEntityHistory as h } from "@glasshome/sync-layer";
5
5
  import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as ne, useEntityStatistics as re, useForecast as x, useHassConfig as ie, useLocale as ae, useService as oe, useStore as se, useTemperatureUnit as S, useToggle as ce, useTurnOff as le, useTurnOn as ue, useUnitSystem as de } from "@glasshome/sync-layer/solid";
6
- import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as pe, onCleanup as D, onMount as me, splitProps as he, untrack as ge, useContext as O } from "solid-js";
7
- import { addEventListener as k, className as A, createComponent as j, delegateEvents as _e, effect as M, insert as N, memo as P, setStyleProperty as F, style as ve, template as I, use as ye } from "solid-js/web";
8
- import { clsx as be } from "clsx";
9
- import { twMerge as xe } from "tailwind-merge";
10
- import { Badge as Se, Button as Ce, ColorSlider as we, ColorWheel as Te, Input as Ee, Label as De, ResponsiveDialog as Oe, ResponsiveDialogContent as ke, ResponsiveDialogDescription as Ae, ResponsiveDialogHeader as je, ResponsiveDialogTitle as Me, SchemaForm as Ne, Select as Pe, SelectContent as Fe, SelectItem as Ie, SelectTrigger as Le, SelectValue as Re, Slider as ze, Switch as Be, parseColor as Ve } from "@glasshome/ui/solid";
6
+ import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as pe, onCleanup as D, onMount as me, splitProps as he, useContext as O } from "solid-js";
7
+ import { addEventListener as k, className as A, createComponent as j, delegateEvents as ge, effect as M, insert as N, memo as P, setStyleProperty as F, style as _e, template as I, use as ve } from "solid-js/web";
8
+ import { clsx as ye } from "clsx";
9
+ import { twMerge as be } from "tailwind-merge";
10
+ import { Badge as xe, Button as Se, ColorSlider as Ce, ColorWheel as we, Input as Te, Label as Ee, ResponsiveDialog as De, ResponsiveDialogContent as Oe, ResponsiveDialogDescription as ke, ResponsiveDialogHeader as Ae, ResponsiveDialogTitle as je, SchemaForm as Me, Select as Ne, SelectContent as Pe, SelectItem as Fe, SelectTrigger as Ie, SelectValue as Le, Slider as Re, Switch as ze, parseColor as Be } from "@glasshome/ui/solid";
11
11
  //#region src/framework/to-form-schema.ts
12
- function He(e) {
12
+ function Ve(e) {
13
13
  return o.toJSONSchema(e, { override: (e) => {
14
14
  let t = o.globalRegistry.get(e.zodSchema);
15
15
  return t && typeof t == "object" && Object.keys(t).length > 0 ? {
@@ -18,7 +18,7 @@ function He(e) {
18
18
  } : e.jsonSchema;
19
19
  } });
20
20
  }
21
- function Ue(e) {
21
+ function He(e) {
22
22
  try {
23
23
  return e.parse({});
24
24
  } catch {
@@ -27,28 +27,28 @@ function Ue(e) {
27
27
  }
28
28
  //#endregion
29
29
  //#region src/define-widget.ts
30
- function We(e) {
31
- return e.configSchema && (e.manifest.schema || (e.manifest.schema = He(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ue(e.configSchema))), e;
30
+ function Ue(e) {
31
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = Ve(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = He(e.configSchema))), e;
32
32
  }
33
33
  //#endregion
34
34
  //#region src/framework/hooks/use-widget-context.ts
35
35
  var L = fe();
36
- function Ge() {
36
+ function We() {
37
37
  let e = O(L);
38
38
  if (!e) throw Error("useWidgetContext must be used within a Widget component");
39
39
  return e;
40
40
  }
41
41
  //#endregion
42
42
  //#region src/framework/hooks/use-service.ts
43
- function Ke(e) {
43
+ function Ge(e) {
44
44
  let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
45
45
  if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
46
46
  return n;
47
47
  }
48
48
  function R(e, t) {
49
- return (n, r = {}) => e(Ke(n), t, r, { entity_id: n });
49
+ return (n, r = {}) => e(Ge(n), t, r, { entity_id: n });
50
50
  }
51
- function qe() {
51
+ function Ke() {
52
52
  let e = O(L)?.callService;
53
53
  return e ? {
54
54
  callService: e,
@@ -57,15 +57,15 @@ function qe() {
57
57
  toggle: R(e, "toggle")
58
58
  } : oe();
59
59
  }
60
- function Je() {
60
+ function qe() {
61
61
  let e = O(L)?.callService;
62
62
  return e ? R(e, "turn_on") : ue();
63
63
  }
64
- function Ye() {
64
+ function Je() {
65
65
  let e = O(L)?.callService;
66
66
  return e ? R(e, "turn_off") : le();
67
67
  }
68
- function Xe() {
68
+ function Ye() {
69
69
  let e = O(L)?.callService;
70
70
  return e ? R(e, "toggle") : ce();
71
71
  }
@@ -76,41 +76,41 @@ var z = {
76
76
  CONTENT: 10,
77
77
  OVERLAY: 20,
78
78
  ACTIONS: 30
79
- }, Ze = fe();
80
- function Qe() {
81
- let e = O(Ze);
79
+ }, Xe = fe();
80
+ function Ze() {
81
+ let e = O(Xe);
82
82
  if (!e) throw Error("useWidgetDimensions must be called inside <Widget>: move the call into a component rendered within <Widget> (the top-level widget scope only sees the host stub).");
83
83
  return e;
84
84
  }
85
85
  //#endregion
86
86
  //#region src/framework/theming/tokens.css?raw
87
- var $e = "/* Authoritative SDK CSS contract. Injected once on first Widget mount\n * via framework/theming/tokens.ts.\n *\n * All widget-internal visual scale is driven from CSS custom properties +\n * container queries on the `.glasshome-widget` shell (`container-type: size`).\n * No JS classifier, no size tier enum.\n */\n\n:root {\n --tone-success: oklch(0.70 0.18 145);\n --tone-warning: oklch(0.80 0.17 75);\n --tone-danger: oklch(0.64 0.22 27);\n --tone-info: oklch(0.66 0.20 245);\n --tone-neutral: oklch(0.65 0.02 250);\n --tone-accent: oklch(0.74 0.18 60);\n\n --widget-grad-strength: 1;\n --widget-glow-default: 0.4;\n --widget-border-highlight: oklch(0.98 0 0 / 0.4);\n}\n\n.dark {\n --tone-success: oklch(0.74 0.18 145);\n --tone-warning: oklch(0.82 0.17 75);\n --tone-danger: oklch(0.68 0.22 27);\n --tone-info: oklch(0.70 0.20 245);\n --tone-neutral: oklch(0.69 0.02 250);\n --tone-accent: oklch(0.78 0.18 60);\n\n --widget-grad-strength: 1.1;\n --widget-glow-default: 0.5;\n --widget-border-highlight: oklch(1 0 0 / 0.08);\n}\n\n@property --widget-color {\n syntax: \"<color>\";\n inherits: true;\n initial-value: oklch(0.65 0.02 250);\n}\n\n/* === Widget shell ===\n * Fluid scale tokens — tied to the shell's own container box (cqb=height, cqi=width).\n * Icon/pad/gap track HEIGHT (cqb) not the shortest side: two widgets of equal\n * height match regardless of width (a 2×2 and a 4×2 get the same icon). cqmin\n * starved portrait tiles by pinning the icon to the narrow width. Tune\n * multipliers / clamps to adjust density. */\n.glasshome-widget {\n --widget-color: var(--tone-neutral);\n --widget-glow-strength: var(--widget-glow-default);\n\n --widget-icon-box: clamp(44px, 25cqb, 58px);\n --widget-icon-glyph: clamp(24px, 14cqb, 33px);\n --widget-pad: clamp(8px, 3.5cqb, 22px);\n --widget-gap: clamp(6px, 2cqb, 14px);\n --widget-title-size: clamp(12px, 2cqi, 18px);\n --widget-subtitle: clamp(12px, 2.5cqi, 20px);\n --widget-status-size: clamp(14px, 5cqi, 36px);\n --widget-value-size: clamp(18px, 7cqi, 48px);\n --widget-badge-size: clamp(11px, 1.6cqi, 14px);\n}\n\n/* Shell material. Two channels, both host/variant-driven:\n * - `--widget-backdrop`: the live backdrop filter (the shared glass recipe is\n * blur + saturate, matching ui's CARD_BLUR). Default none — a variant opts\n * in (classic-glass), and a performant-blur host disables it via override\n * sheet when it paints a precomputed frost instead.\n * - `--glass-frost`: one full background layer (image + position / size +\n * repeat) composited at the BOTTOM, under the accent gradient — the same\n * frost slot ui's `.glass` formula ends its background list with. Unset →\n * none. A performant-blur host sets it per shell with the viewport-aligned\n * slice of its pre-blurred bitmap. */\n.glasshome-widget {\n background:\n var(--widget-gradient,\n linear-gradient(135deg,\n color-mix(in oklch, var(--widget-color) calc(22% * var(--widget-grad-strength)), transparent),\n color-mix(in oklch, var(--widget-color-to, var(--widget-color)) calc(11% * var(--widget-grad-strength)), transparent)\n )\n ),\n var(--glass-frost, none);\n backdrop-filter: var(--widget-backdrop, none);\n -webkit-backdrop-filter: var(--widget-backdrop, none);\n box-shadow: inset 0 1px 0 var(--widget-border-highlight);\n}\n\n/* === Slot: content layout === */\n/* Default: column. Flip to row only on wide-and-short widgets (matches the\n * old contentLayout heuristic: aspect > 1 AND height < 150px). */\n.glasshome-widget-content {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n padding: var(--widget-pad);\n gap: var(--widget-gap);\n overflow: hidden;\n}\n@container widget (min-aspect-ratio: 1) and (max-height: 149px) {\n .glasshome-widget-content {\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n }\n}\n\n/* === Compact 1×1 ===\n * Small in BOTH axes → stack the tile: icon on top, label + status centered\n * under it. Icon stays moderate (not a hero) so the text keeps room. Wide\n * tiles (2×1) fail the width test and keep the row layout above. Placed after\n * the row-flip so it wins. */\n@container widget (max-width: 189px) and (max-height: 189px) {\n .glasshome-widget-content {\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: clamp(4px, 2.5cqmin, 8px);\n }\n .glasshome-widget-content > * { align-items: center; text-align: center; }\n .glasshome-widget-icon {\n --widget-icon-box: clamp(36px, 30cqmin, 56px);\n --widget-icon-glyph: clamp(20px, 17cqmin, 32px);\n }\n .glasshome-widget-title { font-size: clamp(11px, 6cqmin, 14px); max-width: 100%; }\n .glasshome-widget-status,\n .glasshome-widget-value { font-size: clamp(13px, 7cqmin, 17px); }\n .glasshome-widget-content [class*=\"ml-auto\"] { margin-left: 0 !important; }\n}\n.glasshome-widget-content [class*=\"ml-auto\"] {\n position: relative;\n z-index: 30;\n}\n\n/* === Slot: icon === */\n.glasshome-widget-icon {\n width: var(--widget-icon-box);\n height: var(--widget-icon-box);\n border-radius: var(--radius-sm, 12px);\n background: var(--widget-icon-color, var(--widget-color));\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);\n color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);\n}\n.glasshome-widget-icon-glyph {\n font-size: var(--widget-icon-glyph);\n line-height: 1;\n}\n.glasshome-widget-icon-stack {\n position: absolute;\n width: 102%;\n height: 102%;\n border-radius: var(--radius-sm, 12px);\n}\n.glasshome-widget-icon-stack-2 { bottom: -14%; right: -10%; opacity: 0.45; z-index: -2; }\n.glasshome-widget-icon-stack-3 { bottom: -28%; right: -20%; opacity: 0.20; z-index: -3; }\n\n/* === Slot: text === */\n.glasshome-widget-title {\n font-size: var(--widget-title-size);\n line-height: 1.2;\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.glasshome-widget-subtitle {\n font-size: var(--widget-subtitle);\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n}\n.glasshome-widget-status {\n font-size: var(--widget-status-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.1;\n}\n.glasshome-widget-value {\n font-size: var(--widget-value-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.05;\n}\n.glasshome-widget-badge {\n font-size: var(--widget-badge-size);\n font-weight: 500;\n padding: 0.125rem 0.5rem;\n border-radius: 9999px;\n background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);\n color: var(--color-foreground, currentColor);\n}\n\n.glasshome-widget-loading {\n background: color-mix(in oklch, var(--widget-color) 20%, transparent);\n}\n\n/* === Slider fill ===\n * Value flows in via --widget-fill-value (0-100). Vertical orientation auto-\n * detected via container query. */\n.glasshome-widget-slider-fill {\n --widget-fill-value: 0;\n background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);\n clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);\n}\n@container widget (max-aspect-ratio: 1) {\n .glasshome-widget-slider-fill {\n clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);\n }\n}\n", et = !1, B, tt = /* @__PURE__ */ new WeakSet();
88
- function nt() {
89
- return B || (B = new CSSStyleSheet(), B.replaceSync($e.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), B;
87
+ var Qe = "/* Authoritative SDK CSS contract. Injected once on first Widget mount\n * via framework/theming/tokens.ts.\n *\n * All widget-internal visual scale is driven from CSS custom properties +\n * container queries on the `.glasshome-widget` shell (`container-type: size`).\n * No JS classifier, no size tier enum.\n */\n\n:root {\n --tone-success: oklch(0.70 0.18 145);\n --tone-warning: oklch(0.80 0.17 75);\n --tone-danger: oklch(0.64 0.22 27);\n --tone-info: oklch(0.66 0.20 245);\n --tone-neutral: oklch(0.65 0.02 250);\n --tone-accent: oklch(0.74 0.18 60);\n\n --widget-grad-strength: 1;\n --widget-glow-default: 0.4;\n --widget-border-highlight: oklch(0.98 0 0 / 0.4);\n}\n\n.dark {\n --tone-success: oklch(0.74 0.18 145);\n --tone-warning: oklch(0.82 0.17 75);\n --tone-danger: oklch(0.68 0.22 27);\n --tone-info: oklch(0.70 0.20 245);\n --tone-neutral: oklch(0.69 0.02 250);\n --tone-accent: oklch(0.78 0.18 60);\n\n --widget-grad-strength: 1.1;\n --widget-glow-default: 0.5;\n --widget-border-highlight: oklch(1 0 0 / 0.08);\n}\n\n@property --widget-color {\n syntax: \"<color>\";\n inherits: true;\n initial-value: oklch(0.65 0.02 250);\n}\n\n/* === Widget shell ===\n * Fluid scale tokens — tied to the shell's own container box (cqb=height, cqi=width).\n * Icon/pad/gap track HEIGHT (cqb) not the shortest side: two widgets of equal\n * height match regardless of width (a 2×2 and a 4×2 get the same icon). cqmin\n * starved portrait tiles by pinning the icon to the narrow width. Tune\n * multipliers / clamps to adjust density. */\n.glasshome-widget {\n --widget-color: var(--tone-neutral);\n --widget-glow-strength: var(--widget-glow-default);\n\n --widget-icon-box: clamp(44px, 25cqb, 58px);\n --widget-icon-glyph: clamp(24px, 14cqb, 33px);\n --widget-pad: clamp(8px, 3.5cqb, 22px);\n --widget-gap: clamp(6px, 2cqb, 14px);\n --widget-title-size: clamp(12px, 2cqi, 18px);\n --widget-subtitle: clamp(12px, 2.5cqi, 20px);\n --widget-status-size: clamp(14px, 5cqi, 36px);\n --widget-value-size: clamp(18px, 7cqi, 48px);\n --widget-badge-size: clamp(11px, 1.6cqi, 14px);\n}\n\n/* Shell material. Two channels, both host/variant-driven:\n * - `--widget-backdrop`: the live backdrop filter (the shared glass recipe is\n * blur + saturate, matching ui's CARD_BLUR). Default none — a variant opts\n * in (classic-glass), and a performant-blur host disables it via override\n * sheet when it paints a precomputed frost instead.\n * - `--glass-frost`: one full background layer (image + position / size +\n * repeat) composited at the BOTTOM, under the accent gradient — the same\n * frost slot ui's `.glass` formula ends its background list with. Unset →\n * none. A performant-blur host sets it per shell with the viewport-aligned\n * slice of its pre-blurred bitmap. */\n.glasshome-widget {\n background:\n var(--widget-gradient,\n linear-gradient(135deg,\n color-mix(in oklch, var(--widget-color) calc(22% * var(--widget-grad-strength)), transparent),\n color-mix(in oklch, var(--widget-color-to, var(--widget-color)) calc(11% * var(--widget-grad-strength)), transparent)\n )\n ),\n var(--glass-frost, none);\n backdrop-filter: var(--widget-backdrop, none);\n -webkit-backdrop-filter: var(--widget-backdrop, none);\n box-shadow: inset 0 1px 0 var(--widget-border-highlight);\n}\n\n/* === Slot: content layout === */\n/* Default: column. Flip to row only on wide-and-short widgets (matches the\n * old contentLayout heuristic: aspect > 1 AND height < 150px). */\n.glasshome-widget-content {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n padding: var(--widget-pad);\n gap: var(--widget-gap);\n overflow: hidden;\n}\n@container widget (min-aspect-ratio: 1) and (max-height: 149px) {\n .glasshome-widget-content {\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n }\n}\n\n/* === Compact 1×1 ===\n * Small in BOTH axes → stack the tile: icon on top, label + status centered\n * under it. Icon stays moderate (not a hero) so the text keeps room. Wide\n * tiles (2×1) fail the width test and keep the row layout above. Placed after\n * the row-flip so it wins. */\n@container widget (max-width: 189px) and (max-height: 189px) {\n .glasshome-widget-content {\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: clamp(4px, 2.5cqmin, 8px);\n }\n .glasshome-widget-content > * { align-items: center; text-align: center; }\n .glasshome-widget-icon {\n --widget-icon-box: clamp(36px, 30cqmin, 56px);\n --widget-icon-glyph: clamp(20px, 17cqmin, 32px);\n }\n .glasshome-widget-title { font-size: clamp(11px, 6cqmin, 14px); max-width: 100%; }\n .glasshome-widget-status,\n .glasshome-widget-value { font-size: clamp(13px, 7cqmin, 17px); }\n .glasshome-widget-content [class*=\"ml-auto\"] { margin-left: 0 !important; }\n}\n.glasshome-widget-content [class*=\"ml-auto\"] {\n position: relative;\n z-index: 30;\n}\n\n/* === Slot: icon === */\n.glasshome-widget-icon {\n width: var(--widget-icon-box);\n height: var(--widget-icon-box);\n border-radius: var(--radius-sm, 12px);\n background: var(--widget-icon-color, var(--widget-color));\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);\n color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);\n}\n.glasshome-widget-icon-glyph {\n font-size: var(--widget-icon-glyph);\n line-height: 1;\n}\n.glasshome-widget-icon-stack {\n position: absolute;\n width: 102%;\n height: 102%;\n border-radius: var(--radius-sm, 12px);\n}\n.glasshome-widget-icon-stack-2 { bottom: -14%; right: -10%; opacity: 0.45; z-index: -2; }\n.glasshome-widget-icon-stack-3 { bottom: -28%; right: -20%; opacity: 0.20; z-index: -3; }\n\n/* === Slot: text === */\n.glasshome-widget-title {\n font-size: var(--widget-title-size);\n line-height: 1.2;\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.glasshome-widget-subtitle {\n font-size: var(--widget-subtitle);\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n}\n.glasshome-widget-status {\n font-size: var(--widget-status-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.1;\n}\n.glasshome-widget-value {\n font-size: var(--widget-value-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.05;\n}\n.glasshome-widget-badge {\n font-size: var(--widget-badge-size);\n font-weight: 500;\n padding: 0.125rem 0.5rem;\n border-radius: 9999px;\n background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);\n color: var(--color-foreground, currentColor);\n}\n\n.glasshome-widget-loading {\n background: color-mix(in oklch, var(--widget-color) 20%, transparent);\n}\n\n/* === Slider fill ===\n * Value flows in via --widget-fill-value (0-100). Vertical orientation auto-\n * detected via container query. */\n.glasshome-widget-slider-fill {\n --widget-fill-value: 0;\n background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);\n clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);\n}\n@container widget (max-aspect-ratio: 1) {\n .glasshome-widget-slider-fill {\n clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);\n }\n}\n", $e = !1, B, et = /* @__PURE__ */ new WeakSet();
88
+ function tt() {
89
+ return B || (B = new CSSStyleSheet(), B.replaceSync(Qe.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), B;
90
90
  }
91
- function rt(e) {
91
+ function nt(e) {
92
92
  if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
93
- if (tt.has(e)) return;
94
- let t = nt();
95
- e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), tt.add(e);
93
+ if (et.has(e)) return;
94
+ let t = tt();
95
+ e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), et.add(e);
96
96
  return;
97
97
  }
98
- if (et) return;
98
+ if ($e) return;
99
99
  let t = e ?? (typeof document > "u" ? void 0 : document);
100
100
  if (!t) return;
101
101
  if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
102
- et = !0;
102
+ $e = !0;
103
103
  return;
104
104
  }
105
105
  let n = t.createElement("style");
106
- n.setAttribute("data-glasshome-tokens", ""), n.textContent = $e, t.head.appendChild(n), et = !0;
106
+ n.setAttribute("data-glasshome-tokens", ""), n.textContent = Qe, t.head.appendChild(n), $e = !0;
107
107
  }
108
108
  //#endregion
109
109
  //#region src/framework/utils/cn.ts
110
110
  function V(...e) {
111
- return xe(be(e));
111
+ return be(ye(e));
112
112
  }
113
- var it = {
113
+ var rt = {
114
114
  "classic-glass": {
115
115
  id: "classic-glass",
116
116
  name: "Classic Glass",
@@ -192,22 +192,22 @@ var it = {
192
192
  }
193
193
  }
194
194
  };
195
- function at(e) {
196
- return it[e];
195
+ function it(e) {
196
+ return rt[e];
197
197
  }
198
198
  //#endregion
199
199
  //#region src/framework/backgrounds/WidgetSliderFill.tsx
200
- var ot = /*#__PURE__*/ I("<div>");
201
- function st(e) {
200
+ var at = /*#__PURE__*/ I("<div>");
201
+ function ot(e) {
202
202
  return (() => {
203
- var t = ot();
203
+ var t = at();
204
204
  return M((n) => {
205
205
  var r = V("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
206
206
  "--widget-fill-value": e.value,
207
207
  "z-index": z.BACKGROUND,
208
208
  ...e.color ? { "--widget-icon-color": e.color } : {}
209
209
  };
210
- return r !== n.e && A(t, n.e = r), n.t = ve(t, i, n.t), n;
210
+ return r !== n.e && A(t, n.e = r), n.t = _e(t, i, n.t), n;
211
211
  }, {
212
212
  e: void 0,
213
213
  t: void 0
@@ -216,37 +216,37 @@ function st(e) {
216
216
  }
217
217
  //#endregion
218
218
  //#region src/framework/components/WidgetContent.tsx
219
- var ct = /*#__PURE__*/ I("<div>");
220
- function lt(e) {
219
+ var st = /*#__PURE__*/ I("<div>");
220
+ function ct(e) {
221
221
  return (() => {
222
- var t = ct();
222
+ var t = st();
223
223
  return N(t, () => e.children), M(() => A(t, V("glasshome-widget-content", e.class))), t;
224
224
  })();
225
225
  }
226
226
  //#endregion
227
227
  //#region src/framework/components/WidgetIcon.tsx
228
- var ut = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), dt = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), ft = /*#__PURE__*/ I("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
229
- function pt(e) {
228
+ var lt = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), ut = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), dt = /*#__PURE__*/ I("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
229
+ function ft(e) {
230
230
  let t = () => e.entityCount ?? 1;
231
231
  return (() => {
232
- var n = ft(), r = n.firstChild;
232
+ var n = dt(), r = n.firstChild;
233
233
  return N(n, j(C, {
234
234
  get when() {
235
235
  return t() >= 2;
236
236
  },
237
237
  get children() {
238
- return ut();
238
+ return lt();
239
239
  }
240
240
  }), r), N(n, j(C, {
241
241
  get when() {
242
242
  return t() >= 3;
243
243
  },
244
244
  get children() {
245
- return dt();
245
+ return ut();
246
246
  }
247
247
  }), r), N(r, () => e.icon), M((t) => {
248
248
  var r = V("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), i = e.color ? { "--widget-icon-color": e.color } : void 0;
249
- return r !== t.e && A(n, t.e = r), t.t = ve(n, i, t.t), t;
249
+ return r !== t.e && A(n, t.e = r), t.t = _e(n, i, t.t), t;
250
250
  }, {
251
251
  e: void 0,
252
252
  t: void 0
@@ -255,10 +255,10 @@ function pt(e) {
255
255
  }
256
256
  //#endregion
257
257
  //#region src/framework/components/WidgetStatus.tsx
258
- var mt = /*#__PURE__*/ I("<p>");
259
- function ht(e) {
258
+ var pt = /*#__PURE__*/ I("<p>");
259
+ function mt(e) {
260
260
  return (() => {
261
- var t = mt();
261
+ var t = pt();
262
262
  return N(t, (() => {
263
263
  var t = P(() => !!e.isUnavailable);
264
264
  return () => t() ? "Unavailable" : e.children;
@@ -273,16 +273,16 @@ function ht(e) {
273
273
  }
274
274
  //#endregion
275
275
  //#region src/framework/components/WidgetTitle.tsx
276
- var gt = /*#__PURE__*/ I("<span class=\"glasshome-widget-badge shrink-0\">"), _t = /*#__PURE__*/ I("<div><h3 class=glasshome-widget-title>");
277
- function vt(e) {
276
+ var ht = /*#__PURE__*/ I("<span class=\"glasshome-widget-badge shrink-0\">"), gt = /*#__PURE__*/ I("<div><h3 class=glasshome-widget-title>");
277
+ function _t(e) {
278
278
  return (() => {
279
- var t = _t(), n = t.firstChild;
279
+ var t = gt(), n = t.firstChild;
280
280
  return N(n, () => e.children), N(t, j(C, {
281
281
  get when() {
282
282
  return P(() => e.badge !== void 0)() && e.badge > 0;
283
283
  },
284
284
  get children() {
285
- var t = gt();
285
+ var t = ht();
286
286
  return N(t, () => e.badge), t;
287
287
  }
288
288
  }), null), M((n) => {
@@ -296,7 +296,7 @@ function vt(e) {
296
296
  }
297
297
  //#endregion
298
298
  //#region src/framework/utils/entity-aggregation.ts
299
- function yt(e, t = !1) {
299
+ function vt(e, t = !1) {
300
300
  if (e.length === 0) return {
301
301
  isGroup: !1,
302
302
  state: "unknown",
@@ -319,7 +319,7 @@ function yt(e, t = !1) {
319
319
  isUnavailable: t.state === "unavailable",
320
320
  brightness: r,
321
321
  brightnessPercent: i,
322
- color: St(t),
322
+ color: xt(t),
323
323
  onCount: +!!n,
324
324
  totalCount: 1,
325
325
  description: n ? "On" : "Off"
@@ -331,7 +331,7 @@ function yt(e, t = !1) {
331
331
  if (r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color) l.push(t.attributes.rgb_color);
332
332
  else if (t.attributes?.hs_color) {
333
333
  let [e, n] = t.attributes.hs_color;
334
- l.push(xt(e, n));
334
+ l.push(bt(e, n));
335
335
  }
336
336
  break;
337
337
  case "off":
@@ -348,7 +348,7 @@ function yt(e, t = !1) {
348
348
  if (l.length > 0) {
349
349
  let e = Math.round(l.reduce((e, t) => e + t[0], 0) / l.length), t = Math.round(l.reduce((e, t) => e + t[1], 0) / l.length), n = Math.round(l.reduce((e, t) => e + t[2], 0) / l.length), r = v / 255;
350
350
  y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
351
- } else y = St(e[0]);
351
+ } else y = xt(e[0]);
352
352
  let b;
353
353
  return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
354
354
  isGroup: n,
@@ -363,7 +363,7 @@ function yt(e, t = !1) {
363
363
  description: b
364
364
  };
365
365
  }
366
- function bt(e, t = "mean", n = !0) {
366
+ function yt(e, t = "mean", n = !0) {
367
367
  if (e.length === 0) return {
368
368
  isGroup: !1,
369
369
  state: "unknown",
@@ -459,7 +459,7 @@ function bt(e, t = "mean", n = !0) {
459
459
  memberValues: a
460
460
  };
461
461
  }
462
- function xt(e, t) {
462
+ function bt(e, t) {
463
463
  let n = t / 100, r = n * (1 - Math.abs(e / 60 % 2 - 1)), i = 1 - n, a = 0, o = 0, s = 0;
464
464
  return e < 60 ? [a, o] = [n, r] : e < 120 ? [a, o] = [r, n] : e < 180 ? [o, s] = [n, r] : e < 240 ? [o, s] = [r, n] : e < 300 ? [a, s] = [r, n] : [a, s] = [n, r], [
465
465
  (a + i) * 255,
@@ -467,7 +467,7 @@ function xt(e, t) {
467
467
  (s + i) * 255
468
468
  ];
469
469
  }
470
- function St(e) {
470
+ function xt(e) {
471
471
  if (e.state !== "on") return "rgb(100, 100, 100)";
472
472
  let t = (e.attributes?.brightness ?? 255) / 255;
473
473
  if (e.attributes?.rgb_color) {
@@ -475,7 +475,7 @@ function St(e) {
475
475
  return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
476
476
  }
477
477
  if (e.attributes?.hs_color) {
478
- let [n, r] = e.attributes.hs_color, [i, a, o] = xt(n, r);
478
+ let [n, r] = e.attributes.hs_color, [i, a, o] = bt(n, r);
479
479
  return `rgb(${Math.round(i * t)}, ${Math.round(a * t)}, ${Math.round(o * t)})`;
480
480
  }
481
481
  if (e.attributes?.color_temp) {
@@ -486,7 +486,7 @@ function St(e) {
486
486
  }
487
487
  //#endregion
488
488
  //#region src/framework/utils/entity-state.ts
489
- function Ct(e) {
489
+ function St(e) {
490
490
  if (!e) return !1;
491
491
  if ([
492
492
  "on",
@@ -502,15 +502,15 @@ function Ct(e) {
502
502
  }
503
503
  return !1;
504
504
  }
505
- function wt(e, t, n) {
505
+ function Ct(e, t, n) {
506
506
  return e?.attributes ? e.attributes[t] ?? n : n;
507
507
  }
508
- function Tt(e) {
509
- return e.filter(Ct).length;
508
+ function wt(e) {
509
+ return e.filter(St).length;
510
510
  }
511
511
  //#endregion
512
512
  //#region src/framework/utils/format-value.ts
513
- function Et(e, t, n) {
513
+ function Tt(e, t, n) {
514
514
  let { decimals: r, scale: i = !0 } = n || {};
515
515
  if (typeof e == "string") return t ? `${e}${t}` : e;
516
516
  if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
@@ -521,30 +521,30 @@ function Et(e, t, n) {
521
521
  }
522
522
  //#endregion
523
523
  //#region src/framework/utils/interpret-value.ts
524
- function Dt(e, t) {
524
+ function Et(e, t) {
525
525
  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;
526
526
  }
527
527
  //#endregion
528
528
  //#region src/framework/components/WidgetValue.tsx
529
- var Ot = /*#__PURE__*/ I("<div class=glasshome-widget-subtitle>"), kt = /*#__PURE__*/ I("<div><div class=glasshome-widget-value>");
530
- function At(e) {
529
+ var Dt = /*#__PURE__*/ I("<div class=glasshome-widget-subtitle>"), Ot = /*#__PURE__*/ I("<div><div class=glasshome-widget-value>");
530
+ function kt(e) {
531
531
  return (() => {
532
- var t = kt(), n = t.firstChild;
533
- return N(n, () => Et(e.value, e.unit)), N(t, j(C, {
532
+ var t = Ot(), n = t.firstChild;
533
+ return N(n, () => Tt(e.value, e.unit)), N(t, j(C, {
534
534
  get when() {
535
535
  return P(() => !!e.interpret)() && typeof e.value == "number";
536
536
  },
537
537
  get children() {
538
- var t = Ot();
539
- return N(t, () => Dt(e.value, e.unit)), t;
538
+ var t = Dt();
539
+ return N(t, () => Et(e.value, e.unit)), t;
540
540
  }
541
541
  }), null), M(() => A(t, V("flex flex-col", e.class))), t;
542
542
  })();
543
543
  }
544
544
  //#endregion
545
545
  //#region src/framework/core/Widget.tsx
546
- var jt = /*#__PURE__*/ I("<div><div class=\"relative h-full w-full\">"), Mt = /*#__PURE__*/ I("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), Nt = /*#__PURE__*/ I("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), Pt = /*#__PURE__*/ I("<div class=\"flex items-center justify-center text-white/30\">"), Ft = /*#__PURE__*/ I("<h3 class=\"font-semibold text-sm text-white/60\">"), It = /*#__PURE__*/ I("<p class=\"text-white/50 text-xs\">");
547
- function Lt(t) {
546
+ var At = /*#__PURE__*/ I("<div><div class=\"relative h-full w-full\">"), jt = /*#__PURE__*/ I("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), Mt = /*#__PURE__*/ I("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), Nt = /*#__PURE__*/ I("<div class=\"flex items-center justify-center text-white/30\">"), Pt = /*#__PURE__*/ I("<h3 class=\"font-semibold text-sm text-white/60\">"), Ft = /*#__PURE__*/ I("<p class=\"text-white/50 text-xs\">");
547
+ function It(t) {
548
548
  let n = O(L), [r, i] = E(), [a, o] = E({
549
549
  width: 0,
550
550
  height: 0
@@ -566,7 +566,7 @@ function Lt(t) {
566
566
  t.observe(e), D(() => t.disconnect());
567
567
  }), me(() => {
568
568
  let e = r()?.getRootNode();
569
- rt(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
569
+ nt(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
570
570
  });
571
571
  let s = {
572
572
  updateConfig: n?.updateConfig ?? (() => {}),
@@ -574,7 +574,7 @@ function Lt(t) {
574
574
  callService: n?.callService,
575
575
  dimensions: e(() => a(), "ctx.dimensions")
576
576
  }, c = T(() => {
577
- if (t.variant) return typeof t.variant == "string" ? at(t.variant) : t.variant;
577
+ if (t.variant) return typeof t.variant == "string" ? it(t.variant) : t.variant;
578
578
  }), l = T(() => ({
579
579
  "container-type": "size",
580
580
  "container-name": "widget",
@@ -599,15 +599,15 @@ function Lt(t) {
599
599
  return j(L.Provider, {
600
600
  value: s,
601
601
  get children() {
602
- return j(Ze.Provider, {
602
+ return j(Xe.Provider, {
603
603
  value: a,
604
604
  get children() {
605
- var e = jt(), n = e.firstChild;
606
- return k(e, "pointercancel", h), k(e, "pointerup", m), k(e, "pointermove", p), k(e, "pointerdown", f), k(e, "pointerenter", d), ye((e) => {
605
+ var e = At(), n = e.firstChild;
606
+ return k(e, "pointercancel", h), k(e, "pointerup", m), k(e, "pointermove", p), k(e, "pointerdown", f), k(e, "pointerenter", d), ve((e) => {
607
607
  i(e), t.gestures?.bindElement(e);
608
608
  }, e), N(n, (() => {
609
609
  var e = P(() => !!t.emptyState);
610
- return () => e() ? j(Rt, {
610
+ return () => e() ? j(Lt, {
611
611
  get icon() {
612
612
  return t.emptyState.icon;
613
613
  },
@@ -621,12 +621,12 @@ function Lt(t) {
621
621
  })()), N(e, (() => {
622
622
  var e = P(() => !!t.loading);
623
623
  return () => e() && (() => {
624
- var e = Mt();
624
+ var e = jt();
625
625
  return M((t) => F(e, "z-index", z.OVERLAY)), e;
626
626
  })();
627
627
  })(), null), M((r) => {
628
628
  var i = V("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", c()?.styles?.class, t.class), a = l(), o = z.CONTENT;
629
- return i !== r.e && A(e, r.e = i), r.t = ve(e, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
629
+ return i !== r.e && A(e, r.e = i), r.t = _e(e, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
630
630
  }, {
631
631
  e: void 0,
632
632
  t: void 0,
@@ -637,76 +637,76 @@ function Lt(t) {
637
637
  }
638
638
  });
639
639
  }
640
- function Rt(e) {
640
+ function Lt(e) {
641
641
  return (() => {
642
- var t = Nt();
642
+ var t = Mt();
643
643
  return N(t, (() => {
644
644
  var t = P(() => !!e.icon);
645
645
  return () => t() && (() => {
646
- var t = Pt();
646
+ var t = Nt();
647
647
  return N(t, () => e.icon), t;
648
648
  })();
649
649
  })(), null), N(t, (() => {
650
650
  var t = P(() => !!e.title);
651
651
  return () => t() && (() => {
652
- var t = Ft();
652
+ var t = Pt();
653
653
  return N(t, () => e.title), t;
654
654
  })();
655
655
  })(), null), N(t, (() => {
656
656
  var t = P(() => !!e.message);
657
657
  return () => t() && (() => {
658
- var t = It();
658
+ var t = Ft();
659
659
  return N(t, () => e.message), t;
660
660
  })();
661
661
  })(), null), t;
662
662
  })();
663
663
  }
664
- var H = Lt;
665
- H.Content = lt, H.Icon = pt, H.Title = vt, H.Status = ht, H.Value = At, H.SliderFill = st;
664
+ var H = It;
665
+ H.Content = ct, H.Icon = ft, H.Title = _t, H.Status = mt, H.Value = kt, H.SliderFill = ot;
666
666
  //#endregion
667
667
  //#region src/framework/dialogs/validate-config.ts
668
- function zt(e) {
668
+ function Rt(e) {
669
669
  let t = "";
670
670
  for (let n of e) t += typeof n == "number" ? `[${n}]` : t ? `.${String(n)}` : String(n);
671
671
  return t;
672
672
  }
673
- function Bt(e, t) {
673
+ function zt(e, t) {
674
674
  let n = e.safeParse(t);
675
675
  return n.success ? null : n.error.issues.map((e) => {
676
- let t = zt(e.path);
676
+ let t = Rt(e.path);
677
677
  return t ? `${t}: ${e.message}` : e.message;
678
678
  });
679
679
  }
680
680
  //#endregion
681
681
  //#region src/framework/dialogs/WidgetDialog.tsx
682
- var Vt = /*#__PURE__*/ I("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), Ht = /*#__PURE__*/ I("<button type=button>"), Ut = /*#__PURE__*/ I("<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__*/ I("<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"), Gt = /*#__PURE__*/ I("<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>"), Kt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), qt = /*#__PURE__*/ I("<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\">"), Jt = /*#__PURE__*/ I("<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"), Yt = /*#__PURE__*/ I("<div class=\"min-w-0 shrink-0\">"), Xt = /*#__PURE__*/ I("<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\">"), Zt = /*#__PURE__*/ I("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Qt = /*#__PURE__*/ I("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
683
- function $t(e) {
682
+ var Bt = /*#__PURE__*/ I("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), Vt = /*#__PURE__*/ I("<button type=button>"), Ht = /*#__PURE__*/ I("<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\">"), Ut = /*#__PURE__*/ I("<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"), Wt = /*#__PURE__*/ I("<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__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), Kt = /*#__PURE__*/ I("<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\">"), qt = /*#__PURE__*/ I("<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"), Jt = /*#__PURE__*/ I("<div class=\"min-w-0 shrink-0\">"), Yt = /*#__PURE__*/ I("<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\">"), Xt = /*#__PURE__*/ I("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Zt = /*#__PURE__*/ I("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
683
+ function Qt(e) {
684
684
  return (() => {
685
- var t = Ht();
685
+ var t = Vt();
686
686
  return t.$$click = () => e.onClick(), N(t, j(C, {
687
687
  get when() {
688
688
  return e.isActive;
689
689
  },
690
690
  get children() {
691
- var t = Vt();
691
+ var t = Bt();
692
692
  return N(t, () => e.icon), t;
693
693
  }
694
694
  }), null), N(t, () => e.label, null), M(() => A(t, V("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;
695
695
  })();
696
696
  }
697
- function en(e) {
697
+ function $t(e) {
698
698
  let [t] = he(e, /* @__PURE__ */ "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".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = E({}), [a, o] = E(null), [s, c] = E([]);
699
699
  w(pe(() => t.config, (e) => {
700
700
  e && i({ ...e });
701
701
  })), w(pe(() => t.configSchema, (e) => {
702
- e && o(He(e));
702
+ e && o(Ve(e));
703
703
  }));
704
704
  let l = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), u = (e) => {
705
705
  !e && t.config && (i({ ...t.config }), c([])), t.onOpenChange(e);
706
706
  }, d = () => {
707
707
  let e = t.configSchema;
708
708
  if (e) {
709
- let t = Bt(e, r());
709
+ let t = zt(e, r());
710
710
  if (t) {
711
711
  c(t);
712
712
  return;
@@ -729,30 +729,30 @@ function en(e) {
729
729
  return e.push({
730
730
  id: "edit",
731
731
  label: "Edit",
732
- icon: Ut(),
732
+ icon: Ht(),
733
733
  content: t.editContent ?? (() => {
734
734
  let e = n() ? a() : void 0;
735
735
  return e ? j(ie, {
736
736
  schema: e,
737
737
  get data() {
738
- return ge(r);
738
+ return r();
739
739
  },
740
740
  onChange: i,
741
741
  get errors() {
742
742
  return s();
743
743
  }
744
- }) : Wt();
744
+ }) : Ut();
745
745
  })()
746
746
  }), e.push({
747
747
  id: "controls",
748
748
  label: "Controls",
749
- icon: Gt(),
750
- content: t.controlsContent ?? Kt()
749
+ icon: Wt(),
750
+ content: t.controlsContent ?? Gt()
751
751
  }), e.push({
752
752
  id: "debug",
753
753
  label: "Debug",
754
- icon: qt(),
755
- content: t.debugContent ?? Jt()
754
+ icon: Kt(),
755
+ content: t.debugContent ?? qt()
756
756
  }), e;
757
757
  }, v = async () => {
758
758
  if (t.debugData !== void 0) try {
@@ -784,7 +784,7 @@ function en(e) {
784
784
  class: "flex flex-row items-center justify-between gap-3 px-6",
785
785
  get children() {
786
786
  return [(() => {
787
- var e = Yt();
787
+ var e = Jt();
788
788
  return N(e, j(ne, {
789
789
  class: "truncate leading-tight",
790
790
  get children() {
@@ -795,8 +795,8 @@ function en(e) {
795
795
  children: "Widget configuration dialog"
796
796
  }), null), e;
797
797
  })(), (() => {
798
- var e = Xt(), n = e.firstChild;
799
- return N(n, () => ae().map((e) => j($t, {
798
+ var e = Yt(), n = e.firstChild;
799
+ return N(n, () => ae().map((e) => j(Qt, {
800
800
  get icon() {
801
801
  return e.icon;
802
802
  },
@@ -819,7 +819,7 @@ function en(e) {
819
819
  }
820
820
  }),
821
821
  (() => {
822
- var e = Zt();
822
+ var e = Xt();
823
823
  return N(e, ee), e;
824
824
  })(),
825
825
  j(C, {
@@ -827,7 +827,7 @@ function en(e) {
827
827
  return P(() => m() === "edit")() && (S() || t.onDelete) || m() === "debug" && t.debugData !== void 0;
828
828
  },
829
829
  get children() {
830
- var e = Qt();
830
+ var e = Zt();
831
831
  return N(e, j(C, {
832
832
  get when() {
833
833
  return P(() => m() === "edit")() && t.onDelete;
@@ -875,10 +875,10 @@ function en(e) {
875
875
  }
876
876
  });
877
877
  }
878
- _e(["click"]);
878
+ ge(["click"]);
879
879
  //#endregion
880
880
  //#region src/framework/hooks/use-intersection-pause.ts
881
- function tn(e) {
881
+ function en(e) {
882
882
  if (typeof IntersectionObserver > "u") return () => !1;
883
883
  let [t, n] = E(!1), r = new IntersectionObserver((e) => {
884
884
  let t = e[0];
@@ -891,14 +891,14 @@ function tn(e) {
891
891
  }
892
892
  //#endregion
893
893
  //#region src/framework/hooks/use-reduced-motion.ts
894
- function nn() {
894
+ function tn() {
895
895
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
896
896
  let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
897
897
  return e.addEventListener("change", r), D(() => e.removeEventListener("change", r)), t;
898
898
  }
899
899
  //#endregion
900
900
  //#region src/framework/hooks/use-widget-dialog.ts
901
- function rn(e = "controls") {
901
+ function nn(e = "controls") {
902
902
  let [t, n] = E(!1), [r, i] = E(e), a = (t) => {
903
903
  i(t ?? e), n(!0);
904
904
  }, o = O(L);
@@ -923,14 +923,14 @@ function rn(e = "controls") {
923
923
  }
924
924
  //#endregion
925
925
  //#region src/framework/hooks/use-widget-entity-group.ts
926
- function an(e) {
926
+ function rn(e) {
927
927
  let t = e.minEntities ?? 1, n = T(() => e.entities().length), r = T(() => n() >= t), i = T(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = T(() => {
928
928
  if (!r()) return;
929
929
  let t = e.aggregationMode?.();
930
930
  if (!t || t === "none") return;
931
931
  let n = e.entities();
932
- if (t === "light" || t === "binary-sensor" || t === "switch") return yt(n, e.allEntitiesMode);
933
- if (t === "sensor") return bt(n, e.sensorGroupType?.() ?? "mean", !0);
932
+ if (t === "light" || t === "binary-sensor" || t === "switch") return vt(n, e.allEntitiesMode);
933
+ if (t === "sensor") return yt(n, e.sensorGroupType?.() ?? "mean", !0);
934
934
  }), o = T(() => r() ? void 0 : e.emptyStateConfig);
935
935
  return {
936
936
  entities: e.entities,
@@ -944,13 +944,13 @@ function an(e) {
944
944
  //#endregion
945
945
  //#region src/framework/gestures/cursors.ts
946
946
  var U = 32, W = U / 2, G = "white", K = "rgba(0,0,0,0.4)", q = 2, J = 3;
947
- function on(e) {
947
+ function an(e) {
948
948
  return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
949
949
  }
950
950
  function Y(e) {
951
951
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${U}" viewBox="0 0 ${U} ${U}">${e}</svg>`;
952
952
  }
953
- var sn = Y(`
953
+ var on = Y(`
954
954
  <g transform="translate(6, 2)">
955
955
  <!-- shadow -->
956
956
  <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -961,13 +961,13 @@ var sn = Y(`
961
961
  <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"/>
962
962
  </g>
963
963
  </g>
964
- `), cn = Y(`
964
+ `), sn = Y(`
965
965
  <g>
966
966
  <circle cx="${W}" cy="${W}" r="8" stroke="${K}" stroke-width="${J}" fill="none"/>
967
967
  <circle cx="${W}" cy="${W}" r="8" stroke="${G}" stroke-width="1.5" fill="none"/>
968
968
  <circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
969
969
  </g>
970
- `), ln = Y(`
970
+ `), cn = Y(`
971
971
  <g>
972
972
  <!-- shadow -->
973
973
  <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -986,7 +986,7 @@ var sn = Y(`
986
986
  <circle cx="11" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
987
987
  <circle cx="21" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
988
988
  </g>
989
- `), un = Y(`
989
+ `), ln = Y(`
990
990
  <g>
991
991
  <!-- shadow -->
992
992
  <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -1005,7 +1005,7 @@ var sn = Y(`
1005
1005
  <circle cx="${W}" cy="11" r="1" fill="${G}" opacity="0.6"/>
1006
1006
  <circle cx="${W}" cy="21" r="1" fill="${G}" opacity="0.6"/>
1007
1007
  </g>
1008
- `), dn = Y(`
1008
+ `), un = Y(`
1009
1009
  <g>
1010
1010
  <!-- shadow -->
1011
1011
  <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
@@ -1031,54 +1031,54 @@ var sn = Y(`
1031
1031
  `);
1032
1032
  function X(e, t, n) {
1033
1033
  return {
1034
- css: `${on(e)} ${t} ${n}, auto`,
1034
+ css: `${an(e)} ${t} ${n}, auto`,
1035
1035
  hotspotX: t,
1036
1036
  hotspotY: n
1037
1037
  };
1038
1038
  }
1039
1039
  var Z = {
1040
- tap: X(sn, 12, 4),
1041
- hold: X(cn, 16, 16),
1042
- slideHorizontal: X(ln, W, W),
1043
- slideVertical: X(un, W, W),
1044
- slideAuto: X(dn, W, W)
1040
+ tap: X(on, 12, 4),
1041
+ hold: X(sn, 16, 16),
1042
+ slideHorizontal: X(cn, W, W),
1043
+ slideVertical: X(ln, W, W),
1044
+ slideAuto: X(un, W, W)
1045
1045
  };
1046
1046
  //#endregion
1047
1047
  //#region src/framework/gestures/haptics.ts
1048
- function fn() {
1048
+ function dn() {
1049
1049
  if (typeof window > "u") return null;
1050
1050
  let e = window;
1051
1051
  return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
1052
1052
  }
1053
- function pn(e) {
1053
+ function fn(e) {
1054
1054
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
1055
1055
  navigator.vibrate(e);
1056
1056
  } catch {}
1057
1057
  }
1058
- var mn = {
1058
+ var pn = {
1059
1059
  tick() {
1060
- let e = fn();
1060
+ let e = dn();
1061
1061
  if (e) {
1062
1062
  e.impact({ style: "Light" }).catch(() => {});
1063
1063
  return;
1064
1064
  }
1065
- pn(8);
1065
+ fn(8);
1066
1066
  },
1067
1067
  bump() {
1068
- let e = fn();
1068
+ let e = dn();
1069
1069
  if (e) {
1070
1070
  e.impact({ style: "Medium" }).catch(() => {});
1071
1071
  return;
1072
1072
  }
1073
- pn(20);
1073
+ fn(20);
1074
1074
  },
1075
1075
  pulse() {
1076
- let e = fn();
1076
+ let e = dn();
1077
1077
  if (e) {
1078
1078
  e.impact({ style: "Heavy" }).catch(() => {});
1079
1079
  return;
1080
1080
  }
1081
- pn([
1081
+ fn([
1082
1082
  0,
1083
1083
  15,
1084
1084
  40,
@@ -1088,7 +1088,7 @@ var mn = {
1088
1088
  };
1089
1089
  //#endregion
1090
1090
  //#region src/framework/gestures/use-widget-gestures.ts
1091
- function hn(e, t) {
1091
+ function mn(e, t) {
1092
1092
  let n = {
1093
1093
  isDown: !1,
1094
1094
  isTouch: !1,
@@ -1131,7 +1131,7 @@ function hn(e, t) {
1131
1131
  if (n.isDown = !0, n.isTouch = t.pointerType === "touch", n.element = t.currentTarget, c(n.element), n.startX = t.clientX, n.startY = t.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, r.hold) {
1132
1132
  let e = r.hold.delay ?? 300;
1133
1133
  n.holdTimer = setTimeout(() => {
1134
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (mn.bump(), r.hold?.action(), n.isDown = !1);
1134
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (pn.bump(), r.hold?.action(), n.isDown = !1);
1135
1135
  }, e);
1136
1136
  }
1137
1137
  if (!n.isTouch && r.slide) try {
@@ -1199,7 +1199,7 @@ function hn(e, t) {
1199
1199
  }
1200
1200
  //#endregion
1201
1201
  //#region src/framework/theming/svg-colors.ts
1202
- var gn = {
1202
+ var hn = {
1203
1203
  solar: "oklch(0.74 0.18 60)",
1204
1204
  grid: "oklch(0.62 0.12 245)",
1205
1205
  battery: "oklch(0.70 0.18 145)",
@@ -1208,21 +1208,21 @@ var gn = {
1208
1208
  positive: "oklch(0.70 0.14 160)",
1209
1209
  negative: "oklch(0.64 0.22 27)"
1210
1210
  };
1211
- function _n(e) {
1211
+ function gn(e) {
1212
1212
  return {
1213
1213
  fill: `color-mix(in oklch, ${e} 20%, transparent)`,
1214
1214
  stroke: e,
1215
1215
  solid: e
1216
1216
  };
1217
1217
  }
1218
- var vn = Object.fromEntries(Object.entries(gn).map(([e, t]) => [e, _n(t)])), yn = o.enum([
1218
+ var _n = Object.fromEntries(Object.entries(hn).map(([e, t]) => [e, gn(t)])), vn = o.enum([
1219
1219
  "success",
1220
1220
  "warning",
1221
1221
  "danger",
1222
1222
  "info",
1223
1223
  "neutral",
1224
1224
  "accent"
1225
- ]), bn = {
1225
+ ]), yn = {
1226
1226
  title: e(() => o.string().optional().meta({
1227
1227
  title: "Title",
1228
1228
  description: "Optional display name override"
@@ -1242,45 +1242,45 @@ var vn = Object.fromEntries(Object.entries(gn).map(([e, t]) => [e, _n(t)])), yn
1242
1242
  formType: "area-picker",
1243
1243
  title: "Area"
1244
1244
  }), "widgetFields.areaId")
1245
- }, xn = 24;
1245
+ }, bn = 24;
1246
1246
  function Q(e) {
1247
1247
  let t = {};
1248
1248
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
1249
1249
  return t;
1250
1250
  }
1251
- function Sn() {
1251
+ function xn() {
1252
1252
  return o.string().optional().meta({
1253
1253
  title: "Title",
1254
1254
  description: "Optional display name override"
1255
1255
  });
1256
1256
  }
1257
- function Cn(e) {
1257
+ function Sn(e) {
1258
1258
  return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta(Q({
1259
1259
  title: e.title,
1260
1260
  description: e.description
1261
1261
  }));
1262
1262
  }
1263
- function wn(e) {
1263
+ function Cn(e) {
1264
1264
  let t = o.number();
1265
1265
  return e.min !== void 0 && (t = t.min(e.min)), e.max !== void 0 && (t = t.max(e.max)), (e.default === void 0 ? t.optional() : t.default(e.default)).meta(Q({
1266
1266
  title: e.title,
1267
1267
  description: e.description
1268
1268
  }));
1269
1269
  }
1270
- function Tn(e) {
1270
+ function wn(e) {
1271
1271
  return o.boolean().default(e.default ?? !1).meta(Q({
1272
1272
  title: e.title,
1273
1273
  description: e.description
1274
1274
  }));
1275
1275
  }
1276
- function En(e, t) {
1276
+ function Tn(e, t) {
1277
1277
  let n = o.enum(e);
1278
1278
  return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(Q({
1279
1279
  title: t.title,
1280
1280
  description: t.description
1281
1281
  }));
1282
1282
  }
1283
- function Dn(e, t) {
1283
+ function En(e, t) {
1284
1284
  return o.array(o.string()).default([]).meta(Q({
1285
1285
  domain: e,
1286
1286
  title: t?.title ?? "Entities",
@@ -1288,7 +1288,7 @@ function Dn(e, t) {
1288
1288
  deviceClass: t?.deviceClass
1289
1289
  }));
1290
1290
  }
1291
- function On(e, t) {
1291
+ function Dn(e, t) {
1292
1292
  return o.array(o.string()).default([]).meta(Q({
1293
1293
  domain: e,
1294
1294
  title: t?.title ?? "Entity",
@@ -1297,49 +1297,49 @@ function On(e, t) {
1297
1297
  singleSelect: !0
1298
1298
  }));
1299
1299
  }
1300
- function kn(e) {
1300
+ function On(e) {
1301
1301
  return o.string().optional().meta({
1302
1302
  formType: "area-picker",
1303
1303
  title: e?.title ?? "Area"
1304
1304
  });
1305
1305
  }
1306
- function An(e) {
1306
+ function kn(e) {
1307
1307
  let t = o.string().meta({
1308
1308
  formType: "icon-picker",
1309
1309
  title: e?.title ?? "Icon"
1310
1310
  });
1311
1311
  return e?.default === void 0 ? t.optional() : t.default(e.default);
1312
1312
  }
1313
- function jn(e) {
1313
+ function An(e) {
1314
1314
  return o.array(o.string()).default([]).meta(Q({
1315
1315
  title: e.title,
1316
1316
  description: e.description
1317
1317
  }));
1318
1318
  }
1319
- function Mn(e, t) {
1319
+ function jn(e, t) {
1320
1320
  let n = o.object(e);
1321
- return n.default(Ue(n)).meta({ title: t.title });
1321
+ return n.default(He(n)).meta({ title: t.title });
1322
1322
  }
1323
- function Nn(e) {
1323
+ function Mn(e) {
1324
1324
  return e.def;
1325
1325
  }
1326
1326
  function $(e) {
1327
1327
  if (o.globalRegistry.get(e)?.formType === "list") return !0;
1328
- let t = Nn(e);
1328
+ let t = Mn(e);
1329
1329
  return t.shape ? Object.values(t.shape).some($) : t.options ? t.options.some($) : t.element ? $(t.element) : t.innerType ? $(t.innerType) : !1;
1330
1330
  }
1331
- function Pn(e) {
1332
- let t = e, n = Nn(t).innerType;
1333
- for (; n;) t = n, n = Nn(t).innerType;
1331
+ function Nn(e) {
1332
+ let t = e, n = Mn(t).innerType;
1333
+ for (; n;) t = n, n = Mn(t).innerType;
1334
1334
  return t;
1335
1335
  }
1336
- function Fn(e) {
1337
- let t = Nn(Pn(e));
1336
+ function Pn(e) {
1337
+ let t = Mn(Nn(e));
1338
1338
  if (t.shape) return new Set(Object.keys(t.shape));
1339
1339
  if (t.options) {
1340
1340
  let e = [];
1341
1341
  for (let n of t.options) {
1342
- let t = Fn(n);
1342
+ let t = Pn(n);
1343
1343
  if (!t) return null;
1344
1344
  e.push(t);
1345
1345
  }
@@ -1351,7 +1351,7 @@ function Fn(e) {
1351
1351
  }
1352
1352
  return null;
1353
1353
  }
1354
- function In(e, t, n) {
1354
+ function Fn(e, t, n) {
1355
1355
  let r = { [t]: n };
1356
1356
  try {
1357
1357
  return e.parse(r);
@@ -1359,12 +1359,12 @@ function In(e, t, n) {
1359
1359
  return r;
1360
1360
  }
1361
1361
  }
1362
- function Ln(e, t) {
1362
+ function In(e, t) {
1363
1363
  if (!Number.isInteger(t.max) || t.max < 1) throw Error(`field.list: max must be a positive integer, got ${t.max}`);
1364
- if (t.max > xn) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${xn}`);
1364
+ if (t.max > bn) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${bn}`);
1365
1365
  if (t.min !== void 0 && (!Number.isInteger(t.min) || t.min < 0 || t.min > t.max)) throw Error(`field.list: min must be an integer between 0 and max, got ${t.min}`);
1366
1366
  if ($(e)) throw Error("field.list: a list item cannot contain another field.list (depth 1 only)");
1367
- if (t.labelField !== void 0 && !Fn(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
1367
+ if (t.labelField !== void 0 && !Pn(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
1368
1368
  let n = o.array(e);
1369
1369
  return t.min !== void 0 && (n = n.min(t.min)), n = n.max(t.max), n.default([]).meta(Q({
1370
1370
  formType: "list",
@@ -1374,7 +1374,7 @@ function Ln(e, t) {
1374
1374
  labelField: t.labelField
1375
1375
  }));
1376
1376
  }
1377
- function Rn(e, t, n) {
1377
+ function Ln(e, t, n) {
1378
1378
  let r = Object.keys(t)[0];
1379
1379
  if (r === void 0) throw Error("field.variants: at least one variant is required");
1380
1380
  if (n.shared && e in n.shared) throw Error(`field.variants: shared fields cannot redefine the discriminator "${e}"`);
@@ -1387,7 +1387,7 @@ function Rn(e, t, n) {
1387
1387
  ...r,
1388
1388
  [e]: o.literal(t)
1389
1389
  })), a = o.discriminatedUnion(e, i), s = i[0];
1390
- return a.default(s ? In(s, e, r) : {}).meta(Q({
1390
+ return a.default(s ? Fn(s, e, r) : {}).meta(Q({
1391
1391
  formType: "variants",
1392
1392
  discriminator: e,
1393
1393
  title: n.title,
@@ -1395,27 +1395,27 @@ function Rn(e, t, n) {
1395
1395
  labels: n.labels
1396
1396
  }));
1397
1397
  }
1398
- var zn = {
1399
- title: Sn,
1400
- text: Cn,
1401
- number: wn,
1402
- toggle: Tn,
1403
- choice: En,
1404
- entities: Dn,
1405
- entity: On,
1406
- area: kn,
1407
- icon: An,
1408
- stringList: jn,
1409
- group: Mn,
1410
- list: Ln,
1411
- variants: Rn
1398
+ var Rn = {
1399
+ title: xn,
1400
+ text: Sn,
1401
+ number: Cn,
1402
+ toggle: wn,
1403
+ choice: Tn,
1404
+ entities: En,
1405
+ entity: Dn,
1406
+ area: On,
1407
+ icon: kn,
1408
+ stringList: An,
1409
+ group: jn,
1410
+ list: In,
1411
+ variants: Ln
1412
1412
  };
1413
- function Bn(e) {
1413
+ function zn(e) {
1414
1414
  return o.object(e);
1415
1415
  }
1416
1416
  //#endregion
1417
1417
  //#region src/shared/spline.ts
1418
- function Vn(e) {
1418
+ function Bn(e) {
1419
1419
  if (e.length < 2) return "";
1420
1420
  let t = e[0], n = e[1];
1421
1421
  if (!t || !n) return "";
@@ -1442,14 +1442,14 @@ function Vn(e) {
1442
1442
  }
1443
1443
  //#endregion
1444
1444
  //#region src/theme.ts
1445
- function Hn() {
1445
+ function Vn() {
1446
1446
  return document.documentElement.classList.contains("dark");
1447
1447
  }
1448
1448
  //#endregion
1449
1449
  //#region src/version.ts
1450
- var Un = {
1450
+ var Hn = {
1451
1451
  name: "@glasshome/widget-sdk",
1452
- version: "1.9.2",
1452
+ version: "1.9.3",
1453
1453
  description: "SDK for building GlassHome dashboard widgets with SolidJS",
1454
1454
  keywords: [
1455
1455
  "glasshome",
@@ -1502,7 +1502,9 @@ var Un = {
1502
1502
  scripts: {
1503
1503
  build: "vite build && tsc && bun scripts/check-host-singleton.ts",
1504
1504
  dev: "vite build --watch",
1505
- test: "bun test",
1505
+ test: "bun test src && vitest run",
1506
+ "test:dom": "vitest run",
1507
+ "test:dom:watch": "vitest",
1506
1508
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json"
1507
1509
  },
1508
1510
  peerDependencies: {
@@ -1523,11 +1525,13 @@ var Un = {
1523
1525
  },
1524
1526
  devDependencies: {
1525
1527
  "@glasshome/ui": "1.3.0",
1528
+ "@solidjs/testing-library": "^0.8.10",
1526
1529
  "@types/bun": "latest",
1527
1530
  "@types/node": "^25.2.2",
1528
1531
  typescript: "^5",
1529
1532
  vite: "^8.1.0",
1530
- "vite-plugin-solid": "^2.11.12"
1533
+ "vite-plugin-solid": "^2.11.12",
1534
+ vitest: "^4.1.10"
1531
1535
  },
1532
1536
  repository: {
1533
1537
  type: "git",
@@ -1541,4 +1545,4 @@ var Un = {
1541
1545
  engines: { node: ">=18" }
1542
1546
  }.version;
1543
1547
  //#endregion
1544
- export { Se as Badge, Ce as Button, we as ColorSlider, Te as ColorWheel, Ee as Input, De as Label, Oe as ResponsiveDialog, ke as ResponsiveDialogContent, Ae as ResponsiveDialogDescription, je as ResponsiveDialogHeader, Me as ResponsiveDialogTitle, Un as SDK_VERSION, Ne as SchemaForm, Pe as Select, Fe as SelectContent, Ie as SelectItem, Le as SelectTrigger, Re as SelectValue, ze as Slider, Be as Switch, yn as ToneSchema, H as Widget, lt as WidgetContent, L as WidgetCtx, en as WidgetDialog, pt as WidgetIcon, r as WidgetManifestSchema, Ze as WidgetSizeCtx, st as WidgetSliderFill, ht as WidgetStatus, vt as WidgetTitle, At as WidgetValue, g as byDomain, yt as calculateLightGroup, bt as calculateSensorGroup, Tt as countActiveEntities, Bn as defineConfig, We as defineWidget, t as deprecations, zn as field, n as formatDeprecation, i as formatSchemaError, wt as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, rt as injectTokens, Hn as isDark, Ct as isEntityActive, Vn as monotoneCubicPath, Ve as parseColor, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, vn as svgColors, m as trackEntityHistory, h as untrackEntityHistory, _ as useArea, v as useCamera, ee as useConnection, y as useCurrency, b as useEntities, te as useEntity, ne as useEntityHistory, re as useEntityStatistics, x as useForecast, ie as useHassConfig, tn as useIntersectionPause, ae as useLocale, nn as useReducedMotion, qe as useService, se as useStore, S as useTemperatureUnit, Xe as useToggle, Ye as useTurnOff, Je as useTurnOn, de as useUnitSystem, Ge as useWidgetContext, rn as useWidgetDialog, Qe as useWidgetDimensions, an as useWidgetEntityGroup, hn as useWidgetGestures, bn as widgetFields, a as z };
1548
+ export { xe as Badge, Se as Button, Ce as ColorSlider, we as ColorWheel, Te as Input, Ee as Label, De as ResponsiveDialog, Oe as ResponsiveDialogContent, ke as ResponsiveDialogDescription, Ae as ResponsiveDialogHeader, je as ResponsiveDialogTitle, Hn as SDK_VERSION, Me as SchemaForm, Ne as Select, Pe as SelectContent, Fe as SelectItem, Ie as SelectTrigger, Le as SelectValue, Re as Slider, ze as Switch, vn as ToneSchema, H as Widget, ct as WidgetContent, L as WidgetCtx, $t as WidgetDialog, ft as WidgetIcon, r as WidgetManifestSchema, Xe as WidgetSizeCtx, ot as WidgetSliderFill, mt as WidgetStatus, _t as WidgetTitle, kt as WidgetValue, g as byDomain, vt as calculateLightGroup, yt as calculateSensorGroup, wt as countActiveEntities, zn as defineConfig, Ue as defineWidget, t as deprecations, Rn as field, n as formatDeprecation, i as formatSchemaError, Ct as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, nt as injectTokens, Vn as isDark, St as isEntityActive, Bn as monotoneCubicPath, Be as parseColor, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, _n as svgColors, m as trackEntityHistory, h as untrackEntityHistory, _ as useArea, v as useCamera, ee as useConnection, y as useCurrency, b as useEntities, te as useEntity, ne as useEntityHistory, re as useEntityStatistics, x as useForecast, ie as useHassConfig, en as useIntersectionPause, ae as useLocale, tn as useReducedMotion, Ke as useService, se as useStore, S as useTemperatureUnit, Ye as useToggle, Je as useTurnOff, qe as useTurnOn, de as useUnitSystem, We as useWidgetContext, nn as useWidgetDialog, Ze as useWidgetDimensions, rn as useWidgetEntityGroup, mn as useWidgetGestures, yn as widgetFields, a as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/widget-sdk",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "SDK for building GlassHome dashboard widgets with SolidJS",
5
5
  "keywords": [
6
6
  "glasshome",
@@ -53,7 +53,9 @@
53
53
  "scripts": {
54
54
  "build": "vite build && tsc && bun scripts/check-host-singleton.ts",
55
55
  "dev": "vite build --watch",
56
- "test": "bun test",
56
+ "test": "bun test src && vitest run",
57
+ "test:dom": "vitest run",
58
+ "test:dom:watch": "vitest",
57
59
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json"
58
60
  },
59
61
  "peerDependencies": {
@@ -78,11 +80,13 @@
78
80
  },
79
81
  "devDependencies": {
80
82
  "@glasshome/ui": "1.3.0",
83
+ "@solidjs/testing-library": "^0.8.10",
81
84
  "@types/bun": "latest",
82
85
  "@types/node": "^25.2.2",
83
86
  "typescript": "^5",
84
87
  "vite": "^8.1.0",
85
- "vite-plugin-solid": "^2.11.12"
88
+ "vite-plugin-solid": "^2.11.12",
89
+ "vitest": "^4.1.10"
86
90
  },
87
91
  "repository": {
88
92
  "type": "git",