@glasshome/widget-sdk 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { WidgetManifestSchema as e, formatSchemaError as t } from "./schemas.js";
2
- import { z as n } from "zod";
3
- import { getForecasts as r, getStream as i, getWebRtcClientConfig as a, hassMediaUrl as o, sendWebRtcCandidate as s, startWebRtcSession as c, state as l, trackEntityHistory as u, untrackEntityHistory as d } from "@glasshome/sync-layer";
4
- import { byDomain as f, useArea as p, useCamera as m, useConnection as h, useCurrency as g, useEntities as _, useEntity as v, useEntityHistory as y, useEntityStatistics as b, useForecast as x, useHassConfig as ee, useLocale as S, useService as te, useStore as ne, useTemperatureUnit as re, useToggle as C, useTurnOff as ie, useTurnOn as ae, useUnitSystem as oe } from "@glasshome/sync-layer/solid";
5
- import { Show as w, createContext as se, createEffect as T, createMemo as E, createSignal as D, on as ce, onCleanup as O, onMount as le, splitProps as ue, useContext as k } from "solid-js";
6
- import { addEventListener as A, className as j, createComponent as M, delegateEvents as de, effect as N, insert as P, memo as F, setStyleProperty as I, style as L, template as R, use as fe } from "solid-js/web";
7
- import { createElementSize as pe } from "@solid-primitives/resize-observer";
8
- import { clsx as me } from "clsx";
9
- import { twMerge as he } from "tailwind-merge";
1
+ import { deprecate as e, deprecations as t, formatDeprecation as n } from "./deprecations.js";
2
+ import { WidgetManifestSchema as r, formatSchemaError as i } from "./schemas.js";
3
+ import { z as a, z as o } from "zod";
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
+ import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as x, useEntityStatistics as ne, useForecast as re, useHassConfig as ie, useLocale as S, useService as ae, useStore as oe, useTemperatureUnit as se, 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, 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 I, template as L, use as _e } from "solid-js/web";
8
+ import { clsx as ve } from "clsx";
9
+ import { twMerge as ye } from "tailwind-merge";
10
10
  //#region src/framework/to-form-schema.ts
11
- function ge(e) {
12
- return n.toJSONSchema(e, { override: (e) => {
13
- let t = n.globalRegistry.get(e.zodSchema);
11
+ function be(e) {
12
+ return o.toJSONSchema(e, { override: (e) => {
13
+ let t = o.globalRegistry.get(e.zodSchema);
14
14
  return t && typeof t == "object" && Object.keys(t).length > 0 ? {
15
15
  ...e.jsonSchema,
16
16
  ...t
17
17
  } : e.jsonSchema;
18
18
  } });
19
19
  }
20
- function _e(e) {
20
+ function xe(e) {
21
21
  try {
22
22
  return e.parse({});
23
23
  } catch {
@@ -26,82 +26,82 @@ function _e(e) {
26
26
  }
27
27
  //#endregion
28
28
  //#region src/define-widget.ts
29
- function ve(e) {
30
- return e.configSchema && (e.manifest.schema || (e.manifest.schema = ge(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = _e(e.configSchema))), e;
29
+ function Se(e) {
30
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = be(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = xe(e.configSchema))), e;
31
31
  }
32
32
  //#endregion
33
33
  //#region src/framework/hooks/use-widget-context.ts
34
- var z = se();
35
- function ye() {
36
- let e = k(z);
34
+ var R = fe();
35
+ function Ce() {
36
+ let e = O(R);
37
37
  if (!e) throw Error("useWidgetContext must be used within a Widget component");
38
38
  return e;
39
39
  }
40
40
  //#endregion
41
41
  //#region src/framework/hooks/use-service.ts
42
- function be(e) {
42
+ function we(e) {
43
43
  let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
44
44
  if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
45
45
  return n;
46
46
  }
47
- function B(e, t) {
48
- return (n, r = {}) => e(be(n), t, r, { entity_id: n });
47
+ function z(e, t) {
48
+ return (n, r = {}) => e(we(n), t, r, { entity_id: n });
49
49
  }
50
- function xe() {
51
- let e = k(z)?.callService;
50
+ function Te() {
51
+ let e = O(R)?.callService;
52
52
  return e ? {
53
53
  callService: e,
54
- turnOn: B(e, "turn_on"),
55
- turnOff: B(e, "turn_off"),
56
- toggle: B(e, "toggle")
57
- } : te();
54
+ turnOn: z(e, "turn_on"),
55
+ turnOff: z(e, "turn_off"),
56
+ toggle: z(e, "toggle")
57
+ } : ae();
58
58
  }
59
- function Se() {
60
- let e = k(z)?.callService;
61
- return e ? B(e, "turn_on") : ae();
59
+ function Ee() {
60
+ let e = O(R)?.callService;
61
+ return e ? z(e, "turn_on") : ue();
62
62
  }
63
- function Ce() {
64
- let e = k(z)?.callService;
65
- return e ? B(e, "turn_off") : ie();
63
+ function De() {
64
+ let e = O(R)?.callService;
65
+ return e ? z(e, "turn_off") : le();
66
66
  }
67
- function we() {
68
- let e = k(z)?.callService;
69
- return e ? B(e, "toggle") : C();
67
+ function Oe() {
68
+ let e = O(R)?.callService;
69
+ return e ? z(e, "toggle") : ce();
70
70
  }
71
71
  //#endregion
72
72
  //#region src/framework/design-system/z-index.ts
73
- var V = {
73
+ var B = {
74
74
  BACKGROUND: 0,
75
75
  CONTENT: 10,
76
76
  OVERLAY: 20,
77
77
  ACTIONS: 30
78
- }, Te = "/* 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 (cqmin/cqi/cqb).\n * Same input box → same output, so two widgets at the same grid cell match\n * exactly. Tune 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(28px, 22cqmin, 64px);\n --widget-icon-glyph: clamp(16px, 13cqmin, 36px);\n --widget-pad: clamp(8px, 4cqmin, 24px);\n --widget-gap: clamp(6px, 2cqmin, 16px);\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.glasshome-widget {\n background: 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 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.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", Ee = !1, H, De = /* @__PURE__ */ new WeakSet();
79
- function Oe() {
80
- return H || (H = new CSSStyleSheet(), H.replaceSync(Te.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), H;
78
+ }, ke = "/* 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 (cqmin/cqi/cqb).\n * Same input box → same output, so two widgets at the same grid cell match\n * exactly. Tune 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(28px, 22cqmin, 64px);\n --widget-icon-glyph: clamp(16px, 13cqmin, 36px);\n --widget-pad: clamp(8px, 4cqmin, 24px);\n --widget-gap: clamp(6px, 2cqmin, 16px);\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.glasshome-widget {\n background: 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 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.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", Ae = !1, V, je = /* @__PURE__ */ new WeakSet();
79
+ function Me() {
80
+ return V || (V = new CSSStyleSheet(), V.replaceSync(ke.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), V;
81
81
  }
82
- function ke(e) {
82
+ function Ne(e) {
83
83
  if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
84
- if (De.has(e)) return;
85
- let t = Oe();
86
- e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), De.add(e);
84
+ if (je.has(e)) return;
85
+ let t = Me();
86
+ e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), je.add(e);
87
87
  return;
88
88
  }
89
- if (Ee) return;
89
+ if (Ae) return;
90
90
  let t = e ?? (typeof document > "u" ? void 0 : document);
91
91
  if (!t) return;
92
92
  if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
93
- Ee = !0;
93
+ Ae = !0;
94
94
  return;
95
95
  }
96
96
  let n = t.createElement("style");
97
- n.setAttribute("data-glasshome-tokens", ""), n.textContent = Te, t.head.appendChild(n), Ee = !0;
97
+ n.setAttribute("data-glasshome-tokens", ""), n.textContent = ke, t.head.appendChild(n), Ae = !0;
98
98
  }
99
99
  //#endregion
100
100
  //#region src/framework/utils/cn.ts
101
- function U(...e) {
102
- return he(me(e));
101
+ function H(...e) {
102
+ return ye(ve(e));
103
103
  }
104
- var Ae = {
104
+ var Pe = {
105
105
  "classic-glass": {
106
106
  id: "classic-glass",
107
107
  name: "Classic Glass",
@@ -187,22 +187,22 @@ var Ae = {
187
187
  }
188
188
  }
189
189
  };
190
- function je(e) {
191
- return Ae[e];
190
+ function Fe(e) {
191
+ return Pe[e];
192
192
  }
193
193
  //#endregion
194
194
  //#region src/framework/backgrounds/WidgetSliderFill.tsx
195
- var Me = /*#__PURE__*/ R("<div>");
196
- function Ne(e) {
195
+ var Ie = /*#__PURE__*/ L("<div>");
196
+ function Le(e) {
197
197
  return (() => {
198
- var t = Me();
199
- return N((n) => {
200
- var r = U("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
198
+ var t = Ie();
199
+ return M((n) => {
200
+ var r = H("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
201
201
  "--widget-fill-value": e.value,
202
- "z-index": V.BACKGROUND,
202
+ "z-index": B.BACKGROUND,
203
203
  ...e.color ? { "--widget-icon-color": e.color } : {}
204
204
  };
205
- return r !== n.e && j(t, n.e = r), n.t = L(t, i, n.t), n;
205
+ return r !== n.e && A(t, n.e = r), n.t = I(t, i, n.t), n;
206
206
  }, {
207
207
  e: void 0,
208
208
  t: void 0
@@ -211,37 +211,37 @@ function Ne(e) {
211
211
  }
212
212
  //#endregion
213
213
  //#region src/framework/components/WidgetContent.tsx
214
- var Pe = /*#__PURE__*/ R("<div>");
215
- function Fe(e) {
214
+ var Re = /*#__PURE__*/ L("<div>");
215
+ function ze(e) {
216
216
  return (() => {
217
- var t = Pe();
218
- return P(t, () => e.children), N(() => j(t, U("glasshome-widget-content", e.class))), t;
217
+ var t = Re();
218
+ return N(t, () => e.children), M(() => A(t, H("glasshome-widget-content", e.class))), t;
219
219
  })();
220
220
  }
221
221
  //#endregion
222
222
  //#region src/framework/components/WidgetIcon.tsx
223
- var Ie = /*#__PURE__*/ R("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), Le = /*#__PURE__*/ R("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), Re = /*#__PURE__*/ R("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
224
- function ze(e) {
223
+ var Be = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), Ve = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), He = /*#__PURE__*/ L("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
224
+ function Ue(e) {
225
225
  let t = () => e.entityCount ?? 1;
226
226
  return (() => {
227
- var n = Re(), r = n.firstChild;
228
- return P(n, M(w, {
227
+ var n = He(), r = n.firstChild;
228
+ return N(n, j(C, {
229
229
  get when() {
230
230
  return t() >= 2;
231
231
  },
232
232
  get children() {
233
- return Ie();
233
+ return Be();
234
234
  }
235
- }), r), P(n, M(w, {
235
+ }), r), N(n, j(C, {
236
236
  get when() {
237
237
  return t() >= 3;
238
238
  },
239
239
  get children() {
240
- return Le();
240
+ return Ve();
241
241
  }
242
- }), r), P(r, () => e.icon), N((t) => {
243
- var r = U("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;
244
- return r !== t.e && j(n, t.e = r), t.t = L(n, i, t.t), t;
242
+ }), r), N(r, () => e.icon), M((t) => {
243
+ var r = H("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;
244
+ return r !== t.e && A(n, t.e = r), t.t = I(n, i, t.t), t;
245
245
  }, {
246
246
  e: void 0,
247
247
  t: void 0
@@ -250,16 +250,16 @@ function ze(e) {
250
250
  }
251
251
  //#endregion
252
252
  //#region src/framework/components/WidgetStatus.tsx
253
- var Be = /*#__PURE__*/ R("<p>");
254
- function Ve(e) {
253
+ var We = /*#__PURE__*/ L("<p>");
254
+ function Ge(e) {
255
255
  return (() => {
256
- var t = Be();
257
- return P(t, (() => {
258
- var t = F(() => !!e.isUnavailable);
256
+ var t = We();
257
+ return N(t, (() => {
258
+ var t = P(() => !!e.isUnavailable);
259
259
  return () => t() ? "Unavailable" : e.children;
260
- })()), N((n) => {
261
- var r = U("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = V.ACTIONS;
262
- return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
260
+ })()), M((n) => {
261
+ var r = H("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = B.ACTIONS;
262
+ return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
263
263
  }, {
264
264
  e: void 0,
265
265
  t: void 0
@@ -268,21 +268,21 @@ function Ve(e) {
268
268
  }
269
269
  //#endregion
270
270
  //#region src/framework/components/WidgetTitle.tsx
271
- var He = /*#__PURE__*/ R("<span class=\"glasshome-widget-badge shrink-0\">"), Ue = /*#__PURE__*/ R("<div><h3 class=glasshome-widget-title>");
272
- function We(e) {
271
+ var Ke = /*#__PURE__*/ L("<span class=\"glasshome-widget-badge shrink-0\">"), qe = /*#__PURE__*/ L("<div><h3 class=glasshome-widget-title>");
272
+ function Je(e) {
273
273
  return (() => {
274
- var t = Ue(), n = t.firstChild;
275
- return P(n, () => e.children), P(t, M(w, {
274
+ var t = qe(), n = t.firstChild;
275
+ return N(n, () => e.children), N(t, j(C, {
276
276
  get when() {
277
- return F(() => e.badge !== void 0)() && e.badge > 0;
277
+ return P(() => e.badge !== void 0)() && e.badge > 0;
278
278
  },
279
279
  get children() {
280
- var t = He();
281
- return P(t, () => e.badge), t;
280
+ var t = Ke();
281
+ return N(t, () => e.badge), t;
282
282
  }
283
- }), null), N((n) => {
284
- var r = U("relative flex items-center gap-2", e.class), i = V.ACTIONS;
285
- return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
283
+ }), null), M((n) => {
284
+ var r = H("relative flex items-center gap-2", e.class), i = B.ACTIONS;
285
+ return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
286
286
  }, {
287
287
  e: void 0,
288
288
  t: void 0
@@ -291,7 +291,7 @@ function We(e) {
291
291
  }
292
292
  //#endregion
293
293
  //#region src/framework/utils/entity-aggregation.ts
294
- function Ge(e, t = !1) {
294
+ function Ye(e, t = !1) {
295
295
  if (e.length === 0) return {
296
296
  isGroup: !1,
297
297
  state: "unknown",
@@ -314,7 +314,7 @@ function Ge(e, t = !1) {
314
314
  isUnavailable: t.state === "unavailable",
315
315
  brightness: r,
316
316
  brightnessPercent: i,
317
- color: qe(t),
317
+ color: Ze(t),
318
318
  onCount: +!!n,
319
319
  totalCount: 1,
320
320
  description: n ? "On" : "Off"
@@ -337,26 +337,26 @@ function Ge(e, t = !1) {
337
337
  }
338
338
  let u = e.length, d = o === u, f = a + o === u, p = r > 0, m = r === u, h = i === u, g, _;
339
339
  t ? d ? (g = "unavailable", _ = !1) : a > 0 || o > 0 ? (g = "unknown", _ = !1) : i > 0 ? (g = "off", _ = !1) : (g = "on", _ = !0) : d ? (g = "unavailable", _ = !1) : f ? (g = "unknown", _ = !1) : p ? (g = "on", _ = !0) : (g = "off", _ = !1);
340
- let v = c > 0 ? Math.round(s / c) : 0, y = Math.round(v / 255 * 100), b;
340
+ let v = c > 0 ? Math.round(s / c) : 0, ee = Math.round(v / 255 * 100), y;
341
341
  if (l.length > 0) {
342
342
  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;
343
- b = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
344
- } else b = qe(e[0]);
345
- let x;
346
- return x = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
343
+ y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
344
+ } else y = Ze(e[0]);
345
+ let b;
346
+ return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
347
347
  isGroup: n,
348
348
  state: g,
349
349
  isOn: _,
350
350
  isUnavailable: g === "unavailable",
351
351
  brightness: v,
352
- brightnessPercent: y,
353
- color: b,
352
+ brightnessPercent: ee,
353
+ color: y,
354
354
  onCount: r,
355
355
  totalCount: u,
356
- description: x
356
+ description: b
357
357
  };
358
358
  }
359
- function Ke(e, t = "mean", n = !0) {
359
+ function Xe(e, t = "mean", n = !0) {
360
360
  if (e.length === 0) return {
361
361
  isGroup: !1,
362
362
  state: "unknown",
@@ -452,7 +452,7 @@ function Ke(e, t = "mean", n = !0) {
452
452
  memberValues: a
453
453
  };
454
454
  }
455
- function qe(e) {
455
+ function Ze(e) {
456
456
  if (e.state !== "on") return "rgb(100, 100, 100)";
457
457
  let t = (e.attributes?.brightness ?? 255) / 255;
458
458
  if (e.attributes?.rgb_color) {
@@ -467,7 +467,7 @@ function qe(e) {
467
467
  }
468
468
  //#endregion
469
469
  //#region src/framework/utils/entity-state.ts
470
- function Je(e) {
470
+ function Qe(e) {
471
471
  if (!e) return !1;
472
472
  if ([
473
473
  "on",
@@ -483,15 +483,15 @@ function Je(e) {
483
483
  }
484
484
  return !1;
485
485
  }
486
- function Ye(e, t, n) {
486
+ function $e(e, t, n) {
487
487
  return e?.attributes ? e.attributes[t] ?? n : n;
488
488
  }
489
- function Xe(e) {
490
- return e.filter(Je).length;
489
+ function et(e) {
490
+ return e.filter(Qe).length;
491
491
  }
492
492
  //#endregion
493
493
  //#region src/framework/utils/format-value.ts
494
- function Ze(e, t, n) {
494
+ function tt(e, t, n) {
495
495
  let { decimals: r, scale: i = !0 } = n || {};
496
496
  if (typeof e == "string") return t ? `${e}${t}` : e;
497
497
  if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
@@ -502,76 +502,91 @@ function Ze(e, t, n) {
502
502
  }
503
503
  //#endregion
504
504
  //#region src/framework/utils/interpret-value.ts
505
- function Qe(e, t) {
505
+ function nt(e, t) {
506
506
  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;
507
507
  }
508
508
  //#endregion
509
509
  //#region src/framework/components/WidgetValue.tsx
510
- var $e = /*#__PURE__*/ R("<div class=glasshome-widget-subtitle>"), et = /*#__PURE__*/ R("<div><div class=glasshome-widget-value>");
511
- function tt(e) {
510
+ var rt = /*#__PURE__*/ L("<div class=glasshome-widget-subtitle>"), it = /*#__PURE__*/ L("<div><div class=glasshome-widget-value>");
511
+ function at(e) {
512
512
  return (() => {
513
- var t = et(), n = t.firstChild;
514
- return P(n, () => Ze(e.value, e.unit)), P(t, M(w, {
513
+ var t = it(), n = t.firstChild;
514
+ return N(n, () => tt(e.value, e.unit)), N(t, j(C, {
515
515
  get when() {
516
- return F(() => !!e.interpret)() && typeof e.value == "number";
516
+ return P(() => !!e.interpret)() && typeof e.value == "number";
517
517
  },
518
518
  get children() {
519
- var t = $e();
520
- return P(t, () => Qe(e.value, e.unit)), t;
519
+ var t = rt();
520
+ return N(t, () => nt(e.value, e.unit)), t;
521
521
  }
522
- }), null), N(() => j(t, U("flex flex-col", e.class))), t;
522
+ }), null), M(() => A(t, H("flex flex-col", e.class))), t;
523
523
  })();
524
524
  }
525
525
  //#endregion
526
526
  //#region src/framework/core/Widget.tsx
527
- var nt = /*#__PURE__*/ R("<div><div class=\"relative h-full w-full\">"), rt = /*#__PURE__*/ R("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), it = /*#__PURE__*/ R("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), at = /*#__PURE__*/ R("<div class=\"flex items-center justify-center text-white/30\">"), ot = /*#__PURE__*/ R("<h3 class=\"font-semibold text-sm text-white/60\">"), st = /*#__PURE__*/ R("<p class=\"text-white/50 text-xs\">");
528
- function ct(e) {
529
- let t = k(z), [n, r] = D(), i = pe(n);
530
- le(() => {
527
+ var ot = /*#__PURE__*/ L("<div><div class=\"relative h-full w-full\">"), st = /*#__PURE__*/ L("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), ct = /*#__PURE__*/ L("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), lt = /*#__PURE__*/ L("<div class=\"flex items-center justify-center text-white/30\">"), ut = /*#__PURE__*/ L("<h3 class=\"font-semibold text-sm text-white/60\">"), dt = /*#__PURE__*/ L("<p class=\"text-white/50 text-xs\">");
528
+ function ft(e) {
529
+ let t = O(R), [n, r] = E(), [i, a] = E({
530
+ width: 0,
531
+ height: 0
532
+ });
533
+ w(() => {
534
+ let e = n();
535
+ if (!e) return;
536
+ let t = new ResizeObserver(([e]) => {
537
+ if (!e) return;
538
+ let t = e.borderBoxSize?.[0];
539
+ a(t ? {
540
+ width: t.inlineSize,
541
+ height: t.blockSize
542
+ } : {
543
+ width: e.contentRect.width,
544
+ height: e.contentRect.height
545
+ });
546
+ });
547
+ t.observe(e), D(() => t.disconnect());
548
+ }), me(() => {
531
549
  let e = n()?.getRootNode();
532
- ke(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
550
+ Ne(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
533
551
  });
534
- let a = {
552
+ let o = {
535
553
  isEditMode: () => e.isEditMode ?? !1,
536
554
  updateConfig: t?.updateConfig ?? (() => {}),
537
555
  registerDialogOpener: t?.registerDialogOpener,
538
556
  callService: t?.callService,
539
- dimensions: () => ({
540
- width: i.width ?? 0,
541
- height: i.height ?? 0
542
- })
543
- }, o = E(() => {
544
- if (e.variant) return typeof e.variant == "string" ? je(e.variant) : e.variant;
545
- }), s = E(() => ({
557
+ dimensions: () => i()
558
+ }, s = T(() => {
559
+ if (e.variant) return typeof e.variant == "string" ? Fe(e.variant) : e.variant;
560
+ }), c = T(() => ({
546
561
  "container-type": "size",
547
562
  "container-name": "widget",
548
563
  "touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
549
- ...o()?.styles?.container,
550
- ...o()?.styles?.cssVars || {},
564
+ ...s()?.styles?.container,
565
+ ...s()?.styles?.cssVars || {},
551
566
  ...e.tone ? { "--widget-color": `var(--tone-${e.tone})` } : {},
552
567
  ...e.color ? { "--widget-color": e.color } : {},
553
568
  ...e.colorTo ? { "--widget-color-to": e.colorTo } : {},
554
569
  ...e.gradient ? { "--widget-gradient": e.gradient } : {}
555
- })), c = () => !!e.gestures && !e.isEditMode, l = (t) => {
556
- c() && e.gestures?.onPointerEnter(t);
557
- }, u = (t) => {
558
- c() && e.gestures?.onPointerDown(t);
570
+ })), l = () => !!e.gestures && !e.isEditMode, u = (t) => {
571
+ l() && e.gestures?.onPointerEnter(t);
559
572
  }, d = (t) => {
560
- c() && e.gestures?.onPointerMove(t);
573
+ l() && e.gestures?.onPointerDown(t);
561
574
  }, f = (t) => {
562
- c() && e.gestures?.onPointerUp(t);
575
+ l() && e.gestures?.onPointerMove(t);
563
576
  }, p = (t) => {
564
- c() && e.gestures?.onPointerCancel(t);
577
+ l() && e.gestures?.onPointerUp(t);
578
+ }, m = (t) => {
579
+ l() && e.gestures?.onPointerCancel(t);
565
580
  };
566
- return M(z.Provider, {
567
- value: a,
581
+ return j(R.Provider, {
582
+ value: o,
568
583
  get children() {
569
- var t = nt(), n = t.firstChild;
570
- return A(t, "pointercancel", p), A(t, "pointerup", f), A(t, "pointermove", d), A(t, "pointerdown", u), A(t, "pointerenter", l), fe((t) => {
584
+ var t = ot(), n = t.firstChild;
585
+ return k(t, "pointercancel", m), k(t, "pointerup", p), k(t, "pointermove", f), k(t, "pointerdown", d), k(t, "pointerenter", u), _e((t) => {
571
586
  r(t), e.gestures?.bindElement(t);
572
- }, t), P(n, (() => {
573
- var t = F(() => !!e.emptyState);
574
- return () => t() ? M(lt, {
587
+ }, t), N(n, (() => {
588
+ var t = P(() => !!e.emptyState);
589
+ return () => t() ? j(pt, {
575
590
  get icon() {
576
591
  return e.emptyState.icon;
577
592
  },
@@ -582,15 +597,15 @@ function ct(e) {
582
597
  return e.emptyState.message;
583
598
  }
584
599
  }) : e.children;
585
- })()), P(t, (() => {
586
- var t = F(() => !!e.loading);
600
+ })()), N(t, (() => {
601
+ var t = P(() => !!e.loading);
587
602
  return () => t() && (() => {
588
- var e = rt();
589
- return N((t) => I(e, "z-index", V.OVERLAY)), e;
603
+ var e = st();
604
+ return M((t) => F(e, "z-index", B.OVERLAY)), e;
590
605
  })();
591
- })(), null), N((r) => {
592
- var i = U("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", o()?.styles?.class, e.class), a = s(), c = V.CONTENT;
593
- return i !== r.e && j(t, r.e = i), r.t = L(t, a, r.t), c !== r.a && I(n, "z-index", r.a = c), r;
606
+ })(), null), M((r) => {
607
+ var i = H("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", s()?.styles?.class, e.class), a = c(), o = B.CONTENT;
608
+ return i !== r.e && A(t, r.e = i), r.t = I(t, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
594
609
  }, {
595
610
  e: void 0,
596
611
  t: void 0,
@@ -599,61 +614,61 @@ function ct(e) {
599
614
  }
600
615
  });
601
616
  }
602
- function lt(e) {
617
+ function pt(e) {
603
618
  return (() => {
604
- var t = it();
605
- return P(t, (() => {
606
- var t = F(() => !!e.icon);
619
+ var t = ct();
620
+ return N(t, (() => {
621
+ var t = P(() => !!e.icon);
607
622
  return () => t() && (() => {
608
- var t = at();
609
- return P(t, () => e.icon), t;
623
+ var t = lt();
624
+ return N(t, () => e.icon), t;
610
625
  })();
611
- })(), null), P(t, (() => {
612
- var t = F(() => !!e.title);
626
+ })(), null), N(t, (() => {
627
+ var t = P(() => !!e.title);
613
628
  return () => t() && (() => {
614
- var t = ot();
615
- return P(t, () => e.title), t;
629
+ var t = ut();
630
+ return N(t, () => e.title), t;
616
631
  })();
617
- })(), null), P(t, (() => {
618
- var t = F(() => !!e.message);
632
+ })(), null), N(t, (() => {
633
+ var t = P(() => !!e.message);
619
634
  return () => t() && (() => {
620
- var t = st();
621
- return P(t, () => e.message), t;
635
+ var t = dt();
636
+ return N(t, () => e.message), t;
622
637
  })();
623
638
  })(), null), t;
624
639
  })();
625
640
  }
626
- var W = ct;
627
- W.Content = Fe, W.Icon = ze, W.Title = We, W.Status = Ve, W.Value = tt, W.SliderFill = Ne;
641
+ var U = ft;
642
+ U.Content = ze, U.Icon = Ue, U.Title = Je, U.Status = Ge, U.Value = at, U.SliderFill = Le;
628
643
  //#endregion
629
644
  //#region src/framework/dialogs/WidgetDialog.tsx
630
- var ut = /*#__PURE__*/ R("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), dt = /*#__PURE__*/ R("<button type=button>"), ft = /*#__PURE__*/ R("<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\">"), pt = /*#__PURE__*/ R("<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"), mt = /*#__PURE__*/ R("<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>"), ht = /*#__PURE__*/ R("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), gt = /*#__PURE__*/ R("<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\">"), _t = /*#__PURE__*/ R("<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"), vt = /*#__PURE__*/ R("<div class=\"min-w-0 shrink-0\">"), yt = /*#__PURE__*/ R("<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\">"), bt = /*#__PURE__*/ R("<div class=\"min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]\">"), xt = /*#__PURE__*/ R("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3\">");
631
- function St(e) {
645
+ var mt = /*#__PURE__*/ L("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), ht = /*#__PURE__*/ L("<button type=button>"), gt = /*#__PURE__*/ L("<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\">"), _t = /*#__PURE__*/ L("<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"), vt = /*#__PURE__*/ L("<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>"), yt = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), bt = /*#__PURE__*/ L("<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\">"), xt = /*#__PURE__*/ L("<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"), St = /*#__PURE__*/ L("<div class=\"min-w-0 shrink-0\">"), Ct = /*#__PURE__*/ L("<div class=\"flex items-center gap-2\"><div class=\"flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5\">"), wt = /*#__PURE__*/ L("<div class=\"min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]\">"), Tt = /*#__PURE__*/ L("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3\">");
646
+ function Et(e) {
632
647
  return (() => {
633
- var t = dt();
634
- return t.$$click = () => e.onClick(), P(t, M(w, {
648
+ var t = ht();
649
+ return t.$$click = () => e.onClick(), N(t, j(C, {
635
650
  get when() {
636
651
  return e.isActive;
637
652
  },
638
653
  get children() {
639
- var t = ut();
640
- return P(t, () => e.icon), t;
654
+ var t = mt();
655
+ return N(t, () => e.icon), t;
641
656
  }
642
- }), null), P(t, () => e.label, null), N(() => j(t, U("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;
657
+ }), null), N(t, () => e.label, null), M(() => A(t, H("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;
643
658
  })();
644
659
  }
645
- function Ct(e) {
646
- let [t] = ue(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] = D({}), [a, o] = D(null);
647
- T(ce(() => t.config, (e) => {
660
+ function Dt(e) {
661
+ 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);
662
+ w(pe(() => t.config, (e) => {
648
663
  e && i({ ...e });
649
- })), T(ce(() => t.configSchema, (e) => {
650
- e && o(ge(e));
664
+ })), w(pe(() => t.configSchema, (e) => {
665
+ e && o(be(e));
651
666
  }));
652
667
  let s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), c = (e) => {
653
668
  !e && t.config && i({ ...t.config }), t.onOpenChange(e);
654
669
  }, l = () => {
655
670
  t.onConfigSave?.(r());
656
- }, [u, d] = D(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
671
+ }, [u, d] = E(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
657
672
  t.onActiveTabChange ? t.onActiveTabChange(e) : d(e);
658
673
  }, m = () => ({
659
674
  sm: "max-w-sm",
@@ -669,8 +684,8 @@ function Ct(e) {
669
684
  return e.push({
670
685
  id: "edit",
671
686
  label: "Edit",
672
- icon: ft(),
673
- content: t.editContent ?? (n() && a() ? M(te, {
687
+ icon: gt(),
688
+ content: t.editContent ?? (n() && a() ? j(ne, {
674
689
  get schema() {
675
690
  return a();
676
691
  },
@@ -678,17 +693,17 @@ function Ct(e) {
678
693
  return r();
679
694
  },
680
695
  onChange: i
681
- }) : pt())
696
+ }) : _t())
682
697
  }), e.push({
683
698
  id: "controls",
684
699
  label: "Controls",
685
- icon: mt(),
686
- content: t.controlsContent ?? ht()
700
+ icon: vt(),
701
+ content: t.controlsContent ?? yt()
687
702
  }), e.push({
688
703
  id: "debug",
689
704
  label: "Debug",
690
- icon: gt(),
691
- content: t.debugContent ?? _t()
705
+ icon: bt(),
706
+ content: t.debugContent ?? xt()
692
707
  }), e;
693
708
  }, g = async () => {
694
709
  if (t.debugData !== void 0) try {
@@ -698,36 +713,36 @@ function Ct(e) {
698
713
  }, _ = () => {
699
714
  let e = h();
700
715
  return e.find((e) => e.id === f())?.content ?? e[0]?.content;
701
- }, v = t.ResponsiveDialog, y = t.ResponsiveDialogContent, b = t.ResponsiveDialogHeader, x = t.ResponsiveDialogTitle, ee = t.ResponsiveDialogDescription, S = t.Button, te = t.SchemaForm, ne = (e) => n() ? c(e) : t.onOpenChange(e), re = () => n() ? s() : t.hasUnsavedChanges, C = () => n() ? l : t.onSave;
702
- return M(v, {
716
+ }, v = t.ResponsiveDialog, ee = t.ResponsiveDialogContent, y = t.ResponsiveDialogHeader, b = t.ResponsiveDialogTitle, te = t.ResponsiveDialogDescription, x = t.Button, ne = t.SchemaForm, re = (e) => n() ? c(e) : t.onOpenChange(e), ie = () => n() ? s() : t.hasUnsavedChanges, S = () => n() ? l : t.onSave;
717
+ return j(v, {
703
718
  get open() {
704
719
  return t.open;
705
720
  },
706
- onOpenChange: (e) => ne(e),
721
+ onOpenChange: (e) => re(e),
707
722
  get children() {
708
- return M(y, {
723
+ return j(ee, {
709
724
  get class() {
710
- return U(m(), t.class);
725
+ return H(m(), t.class);
711
726
  },
712
727
  get children() {
713
728
  return [
714
- M(b, {
729
+ j(y, {
715
730
  class: "flex flex-row items-center justify-between gap-3",
716
731
  get children() {
717
732
  return [(() => {
718
- var e = vt();
719
- return P(e, M(x, {
733
+ var e = St();
734
+ return N(e, j(b, {
720
735
  class: "truncate leading-tight",
721
736
  get children() {
722
737
  return t.title;
723
738
  }
724
- }), null), P(e, M(ee, {
739
+ }), null), N(e, j(te, {
725
740
  class: "sr-only",
726
741
  children: "Widget configuration dialog"
727
742
  }), null), e;
728
743
  })(), (() => {
729
- var e = yt(), n = e.firstChild;
730
- return P(n, () => h().map((e) => M(St, {
744
+ var e = Ct(), n = e.firstChild;
745
+ return N(n, () => h().map((e) => j(Et, {
731
746
  get icon() {
732
747
  return e.icon;
733
748
  },
@@ -738,7 +753,7 @@ function Ct(e) {
738
753
  return f() === e.id;
739
754
  },
740
755
  onClick: () => p(e.id)
741
- }))), P(e, M(w, {
756
+ }))), N(e, j(C, {
742
757
  get when() {
743
758
  return t.headerActions;
744
759
  },
@@ -750,47 +765,47 @@ function Ct(e) {
750
765
  }
751
766
  }),
752
767
  (() => {
753
- var e = bt();
754
- return P(e, _), e;
768
+ var e = wt();
769
+ return N(e, _), e;
755
770
  })(),
756
- M(w, {
771
+ j(C, {
757
772
  get when() {
758
- return F(() => f() === "edit")() && (C() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
773
+ return P(() => f() === "edit")() && (S() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
759
774
  },
760
775
  get children() {
761
- var e = xt();
762
- return P(e, M(w, {
776
+ var e = Tt();
777
+ return N(e, j(C, {
763
778
  get when() {
764
- return F(() => f() === "edit")() && t.onDelete;
779
+ return P(() => f() === "edit")() && t.onDelete;
765
780
  },
766
781
  get children() {
767
- return M(S, {
782
+ return j(x, {
768
783
  size: "sm",
769
784
  variant: "destructive",
770
785
  onClick: () => t.onDelete?.(),
771
786
  children: "Delete"
772
787
  });
773
788
  }
774
- }), null), P(e, M(w, {
789
+ }), null), N(e, j(C, {
775
790
  get when() {
776
- return F(() => f() === "edit")() && C();
791
+ return P(() => f() === "edit")() && S();
777
792
  },
778
793
  get children() {
779
- return M(S, {
794
+ return j(x, {
780
795
  size: "sm",
781
796
  get disabled() {
782
- return !re();
797
+ return !ie();
783
798
  },
784
- onClick: () => C()?.(),
799
+ onClick: () => S()?.(),
785
800
  children: "Save"
786
801
  });
787
802
  }
788
- }), null), P(e, M(w, {
803
+ }), null), N(e, j(C, {
789
804
  get when() {
790
- return F(() => f() === "debug")() && t.debugData !== void 0;
805
+ return P(() => f() === "debug")() && t.debugData !== void 0;
791
806
  },
792
807
  get children() {
793
- return M(S, {
808
+ return j(x, {
794
809
  size: "sm",
795
810
  variant: "outline",
796
811
  onClick: g,
@@ -806,34 +821,34 @@ function Ct(e) {
806
821
  }
807
822
  });
808
823
  }
809
- de(["click"]);
824
+ ge(["click"]);
810
825
  //#endregion
811
826
  //#region src/framework/hooks/use-intersection-pause.ts
812
- function wt(e) {
827
+ function Ot(e) {
813
828
  if (typeof IntersectionObserver > "u") return () => !1;
814
- let [t, n] = D(!1), r = new IntersectionObserver((e) => {
829
+ let [t, n] = E(!1), r = new IntersectionObserver((e) => {
815
830
  let t = e[0];
816
831
  t && n(!t.isIntersecting);
817
832
  });
818
- return T(() => {
833
+ return w(() => {
819
834
  let t = e();
820
835
  r.disconnect(), t && r.observe(t);
821
- }), O(() => r.disconnect()), t;
836
+ }), D(() => r.disconnect()), t;
822
837
  }
823
838
  //#endregion
824
839
  //#region src/framework/hooks/use-reduced-motion.ts
825
- function Tt() {
840
+ function kt() {
826
841
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
827
- let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = D(e.matches), r = (e) => n(e.matches);
828
- return e.addEventListener("change", r), O(() => e.removeEventListener("change", r)), t;
842
+ let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
843
+ return e.addEventListener("change", r), D(() => e.removeEventListener("change", r)), t;
829
844
  }
830
845
  //#endregion
831
846
  //#region src/framework/hooks/use-widget-dialog.ts
832
- function Et(e = "controls") {
833
- let [t, n] = D(!1), [r, i] = D(e), a = (t) => {
847
+ function At(e = "controls") {
848
+ let [t, n] = E(!1), [r, i] = E(e), a = (t) => {
834
849
  i(t ?? e), n(!0);
835
- }, o = k(z);
836
- return o?.registerDialogOpener?.(a), O(() => o?.registerDialogOpener?.(null)), {
850
+ }, o = O(R);
851
+ return o?.registerDialogOpener?.(a), D(() => o?.registerDialogOpener?.(null)), {
837
852
  showDialog: t,
838
853
  setShowDialog: n,
839
854
  openDialog: a,
@@ -854,15 +869,15 @@ function Et(e = "controls") {
854
869
  }
855
870
  //#endregion
856
871
  //#region src/framework/hooks/use-widget-entity-group.ts
857
- function Dt(e) {
858
- let t = e.minEntities ?? 1, n = E(() => e.entities().length), r = E(() => n() >= t), i = E(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = E(() => {
872
+ function jt(e) {
873
+ 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(() => {
859
874
  if (!r()) return;
860
875
  let t = e.aggregationMode?.();
861
876
  if (!t || t === "none") return;
862
877
  let n = e.entities();
863
- if (t === "light" || t === "binary-sensor" || t === "switch") return Ge(n, e.allEntitiesMode);
864
- if (t === "sensor") return Ke(n, e.sensorGroupType?.() ?? "mean", !0);
865
- }), o = E(() => r() ? void 0 : e.emptyStateConfig);
878
+ if (t === "light" || t === "binary-sensor" || t === "switch") return Ye(n, e.allEntitiesMode);
879
+ if (t === "sensor") return Xe(n, e.sensorGroupType?.() ?? "mean", !0);
880
+ }), o = T(() => r() ? void 0 : e.emptyStateConfig);
866
881
  return {
867
882
  entities: e.entities,
868
883
  groupData: i,
@@ -874,142 +889,142 @@ function Dt(e) {
874
889
  }
875
890
  //#endregion
876
891
  //#region src/framework/gestures/cursors.ts
877
- var G = 32, K = G / 2, q = "white", J = "rgba(0,0,0,0.4)", Y = 2, X = 3;
878
- function Ot(e) {
892
+ var W = 32, G = W / 2, K = "white", q = "rgba(0,0,0,0.4)", J = 2, Y = 3;
893
+ function Mt(e) {
879
894
  return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
880
895
  }
881
- function Z(e) {
882
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="0 0 ${G} ${G}">${e}</svg>`;
896
+ function X(e) {
897
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${W}" viewBox="0 0 ${W} ${W}">${e}</svg>`;
883
898
  }
884
- var kt = Z(`
899
+ var Nt = X(`
885
900
  <g transform="translate(6, 2)">
886
901
  <!-- shadow -->
887
- <g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
902
+ <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
888
903
  <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"/>
889
904
  </g>
890
905
  <!-- main -->
891
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
906
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
892
907
  <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"/>
893
908
  </g>
894
909
  </g>
895
- `), At = Z(`
910
+ `), Pt = X(`
896
911
  <g>
897
- <circle cx="${K}" cy="${K}" r="8" stroke="${J}" stroke-width="${X}" fill="none"/>
898
- <circle cx="${K}" cy="${K}" r="8" stroke="${q}" stroke-width="1.5" fill="none"/>
899
- <circle cx="${K}" cy="${K}" r="1.5" fill="${q}"/>
912
+ <circle cx="${G}" cy="${G}" r="8" stroke="${q}" stroke-width="${Y}" fill="none"/>
913
+ <circle cx="${G}" cy="${G}" r="8" stroke="${K}" stroke-width="1.5" fill="none"/>
914
+ <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
900
915
  </g>
901
- `), jt = Z(`
916
+ `), Ft = X(`
902
917
  <g>
903
918
  <!-- shadow -->
904
- <g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
905
- <line x1="6" y1="${K}" x2="26" y2="${K}"/>
906
- <polyline points="10,${K - 4} 6,${K} 10,20"/>
907
- <polyline points="22,${K - 4} 26,${K} 22,20"/>
919
+ <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
920
+ <line x1="6" y1="${G}" x2="26" y2="${G}"/>
921
+ <polyline points="10,${G - 4} 6,${G} 10,20"/>
922
+ <polyline points="22,${G - 4} 26,${G} 22,20"/>
908
923
  </g>
909
924
  <!-- main -->
910
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
911
- <line x1="6" y1="${K}" x2="26" y2="${K}"/>
912
- <polyline points="10,${K - 4} 6,${K} 10,20"/>
913
- <polyline points="22,${K - 4} 26,${K} 22,20"/>
925
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
926
+ <line x1="6" y1="${G}" x2="26" y2="${G}"/>
927
+ <polyline points="10,${G - 4} 6,${G} 10,20"/>
928
+ <polyline points="22,${G - 4} 26,${G} 22,20"/>
914
929
  </g>
915
930
  <!-- center grip dots -->
916
- <circle cx="${K}" cy="${K}" r="1.5" fill="${q}"/>
917
- <circle cx="${K - 5}" cy="${K}" r="1" fill="${q}" opacity="0.6"/>
918
- <circle cx="21" cy="${K}" r="1" fill="${q}" opacity="0.6"/>
931
+ <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
932
+ <circle cx="${G - 5}" cy="${G}" r="1" fill="${K}" opacity="0.6"/>
933
+ <circle cx="21" cy="${G}" r="1" fill="${K}" opacity="0.6"/>
919
934
  </g>
920
- `), Mt = Z(`
935
+ `), It = X(`
921
936
  <g>
922
937
  <!-- shadow -->
923
- <g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
924
- <line x1="${K}" y1="6" x2="${K}" y2="26"/>
925
- <polyline points="${K - 4},10 ${K},6 20,10"/>
926
- <polyline points="${K - 4},22 ${K},26 20,22"/>
938
+ <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
939
+ <line x1="${G}" y1="6" x2="${G}" y2="26"/>
940
+ <polyline points="${G - 4},10 ${G},6 20,10"/>
941
+ <polyline points="${G - 4},22 ${G},26 20,22"/>
927
942
  </g>
928
943
  <!-- main -->
929
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
930
- <line x1="${K}" y1="6" x2="${K}" y2="26"/>
931
- <polyline points="${K - 4},10 ${K},6 20,10"/>
932
- <polyline points="${K - 4},22 ${K},26 20,22"/>
944
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
945
+ <line x1="${G}" y1="6" x2="${G}" y2="26"/>
946
+ <polyline points="${G - 4},10 ${G},6 20,10"/>
947
+ <polyline points="${G - 4},22 ${G},26 20,22"/>
933
948
  </g>
934
949
  <!-- center grip dots -->
935
- <circle cx="${K}" cy="${K}" r="1.5" fill="${q}"/>
936
- <circle cx="${K}" cy="${K - 5}" r="1" fill="${q}" opacity="0.6"/>
937
- <circle cx="${K}" cy="21" r="1" fill="${q}" opacity="0.6"/>
950
+ <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
951
+ <circle cx="${G}" cy="${G - 5}" r="1" fill="${K}" opacity="0.6"/>
952
+ <circle cx="${G}" cy="21" r="1" fill="${K}" opacity="0.6"/>
938
953
  </g>
939
- `), Nt = Z(`
954
+ `), Lt = X(`
940
955
  <g>
941
956
  <!-- shadow -->
942
- <g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
943
- <line x1="7" y1="${K}" x2="25" y2="${K}"/>
944
- <line x1="${K}" y1="7" x2="${K}" y2="25"/>
945
- <polyline points="11,${K - 3} 7,${K} 11,19"/>
946
- <polyline points="21,${K - 3} 25,${K} 21,19"/>
947
- <polyline points="${K - 3},11 ${K},7 19,11"/>
948
- <polyline points="${K - 3},21 ${K},25 19,21"/>
957
+ <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
958
+ <line x1="7" y1="${G}" x2="25" y2="${G}"/>
959
+ <line x1="${G}" y1="7" x2="${G}" y2="25"/>
960
+ <polyline points="11,${G - 3} 7,${G} 11,19"/>
961
+ <polyline points="21,${G - 3} 25,${G} 21,19"/>
962
+ <polyline points="${G - 3},11 ${G},7 19,11"/>
963
+ <polyline points="${G - 3},21 ${G},25 19,21"/>
949
964
  </g>
950
965
  <!-- main -->
951
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
952
- <line x1="7" y1="${K}" x2="25" y2="${K}"/>
953
- <line x1="${K}" y1="7" x2="${K}" y2="25"/>
954
- <polyline points="11,${K - 3} 7,${K} 11,19"/>
955
- <polyline points="21,${K - 3} 25,${K} 21,19"/>
956
- <polyline points="${K - 3},11 ${K},7 19,11"/>
957
- <polyline points="${K - 3},21 ${K},25 19,21"/>
966
+ <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
967
+ <line x1="7" y1="${G}" x2="25" y2="${G}"/>
968
+ <line x1="${G}" y1="7" x2="${G}" y2="25"/>
969
+ <polyline points="11,${G - 3} 7,${G} 11,19"/>
970
+ <polyline points="21,${G - 3} 25,${G} 21,19"/>
971
+ <polyline points="${G - 3},11 ${G},7 19,11"/>
972
+ <polyline points="${G - 3},21 ${G},25 19,21"/>
958
973
  </g>
959
974
  <!-- center dot -->
960
- <circle cx="${K}" cy="${K}" r="2" fill="${q}"/>
975
+ <circle cx="${G}" cy="${G}" r="2" fill="${K}"/>
961
976
  </g>
962
977
  `);
963
- function Q(e, t, n) {
978
+ function Z(e, t, n) {
964
979
  return {
965
- css: `${Ot(e)} ${t} ${n}, auto`,
980
+ css: `${Mt(e)} ${t} ${n}, auto`,
966
981
  hotspotX: t,
967
982
  hotspotY: n
968
983
  };
969
984
  }
970
- var $ = {
971
- tap: Q(kt, 12, 4),
972
- hold: Q(At, 16, 16),
973
- slideHorizontal: Q(jt, K, K),
974
- slideVertical: Q(Mt, K, K),
975
- slideAuto: Q(Nt, K, K)
985
+ var Q = {
986
+ tap: Z(Nt, 12, 4),
987
+ hold: Z(Pt, 16, 16),
988
+ slideHorizontal: Z(Ft, G, G),
989
+ slideVertical: Z(It, G, G),
990
+ slideAuto: Z(Lt, G, G)
976
991
  };
977
992
  //#endregion
978
993
  //#region src/framework/gestures/haptics.ts
979
- function Pt() {
994
+ function Rt() {
980
995
  if (typeof window > "u") return null;
981
996
  let e = window;
982
997
  return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
983
998
  }
984
- function Ft(e) {
999
+ function zt(e) {
985
1000
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
986
1001
  navigator.vibrate(e);
987
1002
  } catch {}
988
1003
  }
989
- var It = {
1004
+ var Bt = {
990
1005
  tick() {
991
- let e = Pt();
1006
+ let e = Rt();
992
1007
  if (e) {
993
1008
  e.impact({ style: "Light" }).catch(() => {});
994
1009
  return;
995
1010
  }
996
- Ft(8);
1011
+ zt(8);
997
1012
  },
998
1013
  bump() {
999
- let e = Pt();
1014
+ let e = Rt();
1000
1015
  if (e) {
1001
1016
  e.impact({ style: "Medium" }).catch(() => {});
1002
1017
  return;
1003
1018
  }
1004
- Ft(20);
1019
+ zt(20);
1005
1020
  },
1006
1021
  pulse() {
1007
- let e = Pt();
1022
+ let e = Rt();
1008
1023
  if (e) {
1009
1024
  e.impact({ style: "Heavy" }).catch(() => {});
1010
1025
  return;
1011
1026
  }
1012
- Ft([
1027
+ zt([
1013
1028
  0,
1014
1029
  15,
1015
1030
  40,
@@ -1019,7 +1034,7 @@ var It = {
1019
1034
  };
1020
1035
  //#endregion
1021
1036
  //#region src/framework/gestures/use-widget-gestures.ts
1022
- function Lt(e, t) {
1037
+ function Vt(e, t) {
1023
1038
  let n = {
1024
1039
  isDown: !1,
1025
1040
  isTouch: !1,
@@ -1030,7 +1045,7 @@ function Lt(e, t) {
1030
1045
  sliding: !1,
1031
1046
  holdTimer: null,
1032
1047
  element: null
1033
- }, r = null, i = null, a = null, [o, s] = D(null);
1048
+ }, r = null, i = null, a = null, [o, s] = E(null);
1034
1049
  function c(e) {
1035
1050
  e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
1036
1051
  let t = e[0];
@@ -1062,7 +1077,7 @@ function Lt(e, t) {
1062
1077
  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) {
1063
1078
  let e = r.hold.delay ?? 300;
1064
1079
  n.holdTimer = setTimeout(() => {
1065
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (It.bump(), r.hold?.action(), n.isDown = !1);
1080
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Bt.bump(), r.hold?.action(), n.isDown = !1);
1066
1081
  }, e);
1067
1082
  }
1068
1083
  if (!n.isTouch && r.slide) try {
@@ -1099,9 +1114,9 @@ function Lt(e, t) {
1099
1114
  let n = e();
1100
1115
  if (n.slide) {
1101
1116
  let e = n.slide.orientation;
1102
- return e === "horizontal" ? $.slideHorizontal.css : e === "vertical" ? $.slideVertical.css : (r || c(t), r && r.height > r.width ? $.slideVertical.css : $.slideHorizontal.css);
1117
+ return e === "horizontal" ? Q.slideHorizontal.css : e === "vertical" ? Q.slideVertical.css : (r || c(t), r && r.height > r.width ? Q.slideVertical.css : Q.slideHorizontal.css);
1103
1118
  }
1104
- return n.tap ? $.tap.css : n.hold ? $.hold.css : "";
1119
+ return n.tap ? Q.tap.css : n.hold ? Q.hold.css : "";
1105
1120
  };
1106
1121
  return {
1107
1122
  onPointerDown: f,
@@ -1130,7 +1145,7 @@ function Lt(e, t) {
1130
1145
  }
1131
1146
  //#endregion
1132
1147
  //#region src/framework/theming/svg-colors.ts
1133
- var Rt = {
1148
+ var Ht = {
1134
1149
  solar: "oklch(0.74 0.18 60)",
1135
1150
  grid: "oklch(0.62 0.12 245)",
1136
1151
  battery: "oklch(0.70 0.18 145)",
@@ -1139,44 +1154,131 @@ var Rt = {
1139
1154
  positive: "oklch(0.70 0.14 160)",
1140
1155
  negative: "oklch(0.64 0.22 27)"
1141
1156
  };
1142
- function zt(e) {
1157
+ function Ut(e) {
1143
1158
  return {
1144
1159
  fill: `color-mix(in oklch, ${e} 20%, transparent)`,
1145
1160
  stroke: e,
1146
1161
  solid: e
1147
1162
  };
1148
1163
  }
1149
- var Bt = Object.fromEntries(Object.entries(Rt).map(([e, t]) => [e, zt(t)])), Vt = n.enum([
1164
+ var Wt = Object.fromEntries(Object.entries(Ht).map(([e, t]) => [e, Ut(t)])), Gt = o.enum([
1150
1165
  "success",
1151
1166
  "warning",
1152
1167
  "danger",
1153
1168
  "info",
1154
1169
  "neutral",
1155
1170
  "accent"
1156
- ]), Ht = {
1157
- title: () => n.string().optional().meta({
1171
+ ]), Kt = {
1172
+ title: e(() => o.string().optional().meta({
1158
1173
  title: "Title",
1159
1174
  description: "Optional display name override"
1160
- }),
1161
- entityIds: (e, t) => n.array(n.string()).default([]).meta({
1175
+ }), "widgetFields.title"),
1176
+ entityIds: e((e, t) => o.array(o.string()).default([]).meta({
1162
1177
  domain: e,
1163
1178
  title: "Entities",
1164
1179
  ...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
1165
- }),
1166
- singleEntity: (e, t) => n.array(n.string()).default([]).meta({
1180
+ }), "widgetFields.entityIds"),
1181
+ singleEntity: e((e, t) => o.array(o.string()).default([]).meta({
1167
1182
  domain: e,
1168
1183
  title: "Entity",
1169
1184
  singleSelect: !0,
1170
1185
  ...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
1171
- }),
1172
- areaId: () => n.string().optional().meta({
1186
+ }), "widgetFields.singleEntity"),
1187
+ areaId: e(() => o.string().optional().meta({
1173
1188
  formType: "area-picker",
1174
1189
  title: "Area"
1175
- })
1190
+ }), "widgetFields.areaId")
1176
1191
  };
1177
1192
  //#endregion
1193
+ //#region src/framework/config/index.ts
1194
+ function $(e) {
1195
+ let t = {};
1196
+ for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
1197
+ return t;
1198
+ }
1199
+ function qt() {
1200
+ return o.string().optional().meta({
1201
+ title: "Title",
1202
+ description: "Optional display name override"
1203
+ });
1204
+ }
1205
+ function Jt(e) {
1206
+ return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta($({
1207
+ title: e.title,
1208
+ description: e.description
1209
+ }));
1210
+ }
1211
+ function Yt(e) {
1212
+ let t = o.number();
1213
+ 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($({
1214
+ title: e.title,
1215
+ description: e.description
1216
+ }));
1217
+ }
1218
+ function Xt(e) {
1219
+ return o.boolean().default(e.default ?? !1).meta($({
1220
+ title: e.title,
1221
+ description: e.description
1222
+ }));
1223
+ }
1224
+ function Zt(e, t) {
1225
+ let n = o.enum(e);
1226
+ return (t.default === void 0 ? n.optional() : n.default(t.default)).meta($({
1227
+ title: t.title,
1228
+ description: t.description
1229
+ }));
1230
+ }
1231
+ function Qt(e, t) {
1232
+ return o.array(o.string()).default([]).meta($({
1233
+ domain: e,
1234
+ title: t?.title ?? "Entities",
1235
+ description: t?.description,
1236
+ deviceClass: t?.deviceClass
1237
+ }));
1238
+ }
1239
+ function $t(e, t) {
1240
+ return o.array(o.string()).default([]).meta($({
1241
+ domain: e,
1242
+ title: t?.title ?? "Entity",
1243
+ description: t?.description,
1244
+ deviceClass: t?.deviceClass,
1245
+ singleSelect: !0
1246
+ }));
1247
+ }
1248
+ function en(e) {
1249
+ return o.string().optional().meta({
1250
+ formType: "area-picker",
1251
+ title: e?.title ?? "Area"
1252
+ });
1253
+ }
1254
+ function tn(e) {
1255
+ return o.array(o.string()).default([]).meta($({
1256
+ title: e.title,
1257
+ description: e.description
1258
+ }));
1259
+ }
1260
+ function nn(e, t) {
1261
+ let n = o.object(e);
1262
+ return n.default(xe(n)).meta({ title: t.title });
1263
+ }
1264
+ var rn = {
1265
+ title: qt,
1266
+ text: Jt,
1267
+ number: Yt,
1268
+ toggle: Xt,
1269
+ choice: Zt,
1270
+ entities: Qt,
1271
+ entity: $t,
1272
+ area: en,
1273
+ stringList: tn,
1274
+ group: nn
1275
+ };
1276
+ function an(e) {
1277
+ return o.object(e);
1278
+ }
1279
+ //#endregion
1178
1280
  //#region src/shared/spline.ts
1179
- function Ut(e) {
1281
+ function on(e) {
1180
1282
  if (e.length < 2) return "";
1181
1283
  let t = e[0], n = e[1];
1182
1284
  if (!t || !n) return "";
@@ -1203,14 +1305,14 @@ function Ut(e) {
1203
1305
  }
1204
1306
  //#endregion
1205
1307
  //#region src/theme.ts
1206
- function Wt() {
1308
+ function sn() {
1207
1309
  return document.documentElement.classList.contains("dark");
1208
1310
  }
1209
1311
  //#endregion
1210
1312
  //#region src/version.ts
1211
- var Gt = {
1313
+ var cn = {
1212
1314
  name: "@glasshome/widget-sdk",
1213
- version: "1.3.0",
1315
+ version: "1.4.1",
1214
1316
  description: "SDK for building GlassHome dashboard widgets with SolidJS",
1215
1317
  keywords: [
1216
1318
  "glasshome",
@@ -1237,6 +1339,11 @@ var Gt = {
1237
1339
  types: "./dist/schemas.d.ts",
1238
1340
  import: "./dist/schemas.js"
1239
1341
  },
1342
+ "./deprecations": {
1343
+ "@glasshome/source": "./src/deprecations.ts",
1344
+ types: "./dist/deprecations.d.ts",
1345
+ import: "./dist/deprecations.js"
1346
+ },
1240
1347
  "./vite": {
1241
1348
  "@glasshome/source": "./src/vite/index.ts",
1242
1349
  types: "./dist/vite/index.d.ts",
@@ -1252,7 +1359,9 @@ var Gt = {
1252
1359
  ],
1253
1360
  scripts: {
1254
1361
  build: "vite build && tsc",
1255
- dev: "vite build --watch"
1362
+ dev: "vite build --watch",
1363
+ test: "bun test",
1364
+ "typecheck:test": "tsc --noEmit -p tsconfig.test.json"
1256
1365
  },
1257
1366
  peerDependencies: {
1258
1367
  "@glasshome/sync-layer": "0.3.0",
@@ -1261,7 +1370,6 @@ var Gt = {
1261
1370
  dependencies: {
1262
1371
  "@glasshome/widget-contract": "0.1.0",
1263
1372
  "@modular-forms/solid": "^0.25.1",
1264
- "@solid-primitives/resize-observer": "^2.1.5",
1265
1373
  clsx: "^2.1.1",
1266
1374
  "tailwind-merge": "^3.5.0",
1267
1375
  zod: "^4.1.13",
@@ -1287,4 +1395,4 @@ var Gt = {
1287
1395
  engines: { node: ">=18" }
1288
1396
  }.version;
1289
1397
  //#endregion
1290
- export { Gt as SDK_VERSION, Vt as ToneSchema, W as Widget, Fe as WidgetContent, z as WidgetCtx, Ct as WidgetDialog, ze as WidgetIcon, e as WidgetManifestSchema, Ne as WidgetSliderFill, Ve as WidgetStatus, We as WidgetTitle, tt as WidgetValue, f as byDomain, Ge as calculateLightGroup, Ke as calculateSensorGroup, Xe as countActiveEntities, ve as defineWidget, t as formatSchemaError, Ye as getEntityAttribute, r as getForecasts, i as getStream, a as getWebRtcClientConfig, o as hassMediaUrl, ke as injectTokens, Wt as isDark, Je as isEntityActive, Ut as monotoneCubicPath, s as sendWebRtcCandidate, c as startWebRtcSession, l as state, Bt as svgColors, u as trackEntityHistory, d as untrackEntityHistory, p as useArea, m as useCamera, h as useConnection, g as useCurrency, _ as useEntities, v as useEntity, y as useEntityHistory, b as useEntityStatistics, x as useForecast, ee as useHassConfig, wt as useIntersectionPause, S as useLocale, Tt as useReducedMotion, xe as useService, ne as useStore, re as useTemperatureUnit, we as useToggle, Ce as useTurnOff, Se as useTurnOn, oe as useUnitSystem, ye as useWidgetContext, Et as useWidgetDialog, Dt as useWidgetEntityGroup, Lt as useWidgetGestures, Ht as widgetFields };
1398
+ export { cn as SDK_VERSION, Gt as ToneSchema, U as Widget, ze as WidgetContent, R as WidgetCtx, Dt as WidgetDialog, Ue as WidgetIcon, r as WidgetManifestSchema, Le as WidgetSliderFill, Ge as WidgetStatus, Je as WidgetTitle, at as WidgetValue, g as byDomain, Ye as calculateLightGroup, Xe as calculateSensorGroup, et as countActiveEntities, an as defineConfig, Se as defineWidget, t as deprecations, rn as field, n as formatDeprecation, i as formatSchemaError, $e as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, Ne as injectTokens, sn as isDark, Qe as isEntityActive, on as monotoneCubicPath, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, Wt 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, x as useEntityHistory, ne as useEntityStatistics, re as useForecast, ie as useHassConfig, Ot as useIntersectionPause, S as useLocale, kt as useReducedMotion, Te as useService, oe as useStore, se as useTemperatureUnit, Oe as useToggle, De as useTurnOff, Ee as useTurnOn, de as useUnitSystem, Ce as useWidgetContext, At as useWidgetDialog, jt as useWidgetEntityGroup, Vt as useWidgetGestures, Kt as widgetFields, a as z };