@glasshome/widget-sdk 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,16 @@
1
- import { n as e, r as t, t as n } from "./tokens-Bdfb1xYe.js";
1
+ import { n as e, r as t, t as n } from "./tokens-CFl0mCx4.js";
2
2
  import { deprecate as r, deprecations as i, formatDeprecation as a } from "./deprecations.js";
3
3
  import { WidgetManifestSchema as o, formatSchemaError as s } from "./schemas.js";
4
4
  import { z as c, z as l } from "zod";
5
5
  import { getForecasts as u, getStream as d, getWebRtcClientConfig as f, hassMediaUrl as p, sendWebRtcCandidate as m, startWebRtcSession as h, state as g, trackEntityHistory as _, untrackEntityHistory as v } from "@glasshome/sync-layer";
6
- import { byDomain as ee, useArea as y, useCamera as b, useConnection as te, useCurrency as x, useEntities as ne, useEntity as S, useEntityHistory as re, useEntityStatistics as ie, useForecast as C, useHassConfig as ae, useLocale as oe, useService as se, useStore as ce, useTemperatureUnit as le, useToggle as ue, useTurnOff as de, useTurnOn as fe, useUnitSystem as pe } from "@glasshome/sync-layer/solid";
7
- import { Show as w, createEffect as T, createMemo as E, createSignal as D, on as O, onCleanup as k, onMount as me, splitProps as he, untrack as ge, useContext as A } from "solid-js";
8
- import { addEventListener as j, className as M, createComponent as N, delegateEvents as _e, effect as P, insert as F, memo as I, setStyleProperty as L, style as R, template as z, use as ve } from "solid-js/web";
9
- import { clsx as ye } from "clsx";
10
- import { twMerge as be } from "tailwind-merge";
6
+ import { byDomain as ee, useArea as y, useCamera as b, useConnection as te, useCurrency as ne, useEntities as re, useEntity as x, useEntityHistory as ie, useEntityStatistics as ae, useForecast as oe, useHassConfig as se, useLocale as S, useService as ce, useStore as le, useTemperatureUnit as ue, useToggle as de, useTurnOff as fe, useTurnOn as pe, useUnitSystem as me } from "@glasshome/sync-layer/solid";
7
+ import { Show as C, createContext as he, createEffect as w, createMemo as T, createSignal as E, on as ge, onCleanup as D, onMount as _e, splitProps as ve, untrack as ye, useContext as O } from "solid-js";
8
+ import { addEventListener as k, className as A, createComponent as j, delegateEvents as be, effect as M, insert as N, memo as P, setStyleProperty as F, style as I, template as L, use as xe } from "solid-js/web";
9
+ import { clsx as Se } from "clsx";
10
+ import { twMerge as Ce } from "tailwind-merge";
11
+ import { Badge as we, Button as Te, ColorSlider as Ee, ColorWheel as De, Input as Oe, Label as ke, ResponsiveDialog as Ae, ResponsiveDialogContent as je, ResponsiveDialogDescription as Me, ResponsiveDialogHeader as Ne, ResponsiveDialogTitle as Pe, SchemaForm as Fe, Select as Ie, SelectContent as Le, SelectItem as Re, SelectTrigger as ze, SelectValue as Be, Slider as Ve, Switch as He, parseColor as Ue } from "@glasshome/ui/solid";
11
12
  //#region src/framework/to-form-schema.ts
12
- function xe(e) {
13
+ function We(e) {
13
14
  return l.toJSONSchema(e, { override: (e) => {
14
15
  let t = l.globalRegistry.get(e.zodSchema);
15
16
  return t && typeof t == "object" && Object.keys(t).length > 0 ? {
@@ -18,7 +19,7 @@ function xe(e) {
18
19
  } : e.jsonSchema;
19
20
  } });
20
21
  }
21
- function Se(e) {
22
+ function Ge(e) {
22
23
  try {
23
24
  return e.parse({});
24
25
  } catch {
@@ -27,68 +28,71 @@ function Se(e) {
27
28
  }
28
29
  //#endregion
29
30
  //#region src/define-widget.ts
30
- function Ce(e) {
31
- return e.configSchema && (e.manifest.schema || (e.manifest.schema = xe(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Se(e.configSchema))), e;
31
+ function Ke(e) {
32
+ return e.configSchema && (e.manifest.schema || (e.manifest.schema = We(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ge(e.configSchema))), e;
32
33
  }
33
34
  //#endregion
34
35
  //#region src/framework/hooks/use-service.ts
35
- function we(e) {
36
+ function qe(e) {
36
37
  let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
37
38
  if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
38
39
  return n;
39
40
  }
40
- function B(e, t) {
41
- return (n, r = {}) => e(we(n), t, r, { entity_id: n });
41
+ function R(e, t) {
42
+ return (n, r = {}) => e(qe(n), t, r, { entity_id: n });
42
43
  }
43
- function Te() {
44
- let t = A(e)?.callService;
44
+ function Je() {
45
+ let t = O(e)?.callService;
45
46
  return t ? {
46
47
  callService: t,
47
- turnOn: B(t, "turn_on"),
48
- turnOff: B(t, "turn_off"),
49
- toggle: B(t, "toggle")
50
- } : se();
48
+ turnOn: R(t, "turn_on"),
49
+ turnOff: R(t, "turn_off"),
50
+ toggle: R(t, "toggle")
51
+ } : ce();
51
52
  }
52
- function Ee() {
53
- let t = A(e)?.callService;
54
- return t ? B(t, "turn_on") : fe();
53
+ function Ye() {
54
+ let t = O(e)?.callService;
55
+ return t ? R(t, "turn_on") : pe();
55
56
  }
56
- function De() {
57
- let t = A(e)?.callService;
58
- return t ? B(t, "turn_off") : de();
57
+ function Xe() {
58
+ let t = O(e)?.callService;
59
+ return t ? R(t, "turn_off") : fe();
59
60
  }
60
- function Oe() {
61
- let t = A(e)?.callService;
62
- return t ? B(t, "toggle") : ue();
61
+ function Ze() {
62
+ let t = O(e)?.callService;
63
+ return t ? R(t, "toggle") : de();
63
64
  }
64
65
  //#endregion
65
66
  //#region src/framework/design-system/z-index.ts
66
- var V = {
67
+ var z = {
67
68
  BACKGROUND: 0,
68
69
  CONTENT: 10,
69
70
  OVERLAY: 20,
70
71
  ACTIONS: 30
71
- };
72
+ }, Qe = he();
73
+ function $e() {
74
+ let e = O(Qe);
75
+ 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).");
76
+ return e;
77
+ }
72
78
  //#endregion
73
79
  //#region src/framework/utils/cn.ts
74
- function H(...e) {
75
- return be(ye(e));
80
+ function B(...e) {
81
+ return Ce(Se(e));
76
82
  }
77
- var ke = {
83
+ var et = {
78
84
  "classic-glass": {
79
85
  id: "classic-glass",
80
86
  name: "Classic Glass",
81
87
  description: "Default glassmorphism design with blur background and gradient",
82
- styles: {
83
- cssVars: {
84
- "--widget-bg": "rgba(255, 255, 255, 0.1)",
85
- "--widget-border": "rgba(255, 255, 255, 0.2)",
86
- "--widget-blur": "12px",
87
- "--widget-shadow": "0 8px 32px rgba(0, 0, 0, 0.2)",
88
- "--widget-padding": "1.5rem"
89
- },
90
- class: "backdrop-blur-xl"
91
- },
88
+ styles: { cssVars: {
89
+ "--widget-bg": "rgba(255, 255, 255, 0.1)",
90
+ "--widget-border": "rgba(255, 255, 255, 0.2)",
91
+ "--widget-blur": "12px",
92
+ "--widget-shadow": "0 8px 32px rgba(0, 0, 0, 0.2)",
93
+ "--widget-padding": "1.5rem",
94
+ "--widget-backdrop": "blur(var(--glass-blur, 24px)) saturate(1.8)"
95
+ } },
92
96
  layout: {
93
97
  type: "flex",
94
98
  direction: "column",
@@ -134,16 +138,14 @@ var ke = {
134
138
  id: "compact-horizontal",
135
139
  name: "Compact Horizontal",
136
140
  description: "Horizontal layout for compact widgets",
137
- styles: {
138
- cssVars: {
139
- "--widget-bg": "rgba(255, 255, 255, 0.08)",
140
- "--widget-border": "rgba(255, 255, 255, 0.15)",
141
- "--widget-blur": "10px",
142
- "--widget-padding": "1rem",
143
- "--widget-icon-size": "2.5rem"
144
- },
145
- class: "backdrop-blur-lg"
146
- },
141
+ styles: { cssVars: {
142
+ "--widget-bg": "rgba(255, 255, 255, 0.08)",
143
+ "--widget-border": "rgba(255, 255, 255, 0.15)",
144
+ "--widget-blur": "10px",
145
+ "--widget-padding": "1rem",
146
+ "--widget-icon-size": "2.5rem",
147
+ "--widget-backdrop": "blur(16px) saturate(1.8)"
148
+ } },
147
149
  layout: {
148
150
  type: "flex",
149
151
  direction: "row",
@@ -160,22 +162,22 @@ var ke = {
160
162
  }
161
163
  }
162
164
  };
163
- function Ae(e) {
164
- return ke[e];
165
+ function tt(e) {
166
+ return et[e];
165
167
  }
166
168
  //#endregion
167
169
  //#region src/framework/backgrounds/WidgetSliderFill.tsx
168
- var je = /*#__PURE__*/ z("<div>");
169
- function Me(e) {
170
+ var nt = /*#__PURE__*/ L("<div>");
171
+ function rt(e) {
170
172
  return (() => {
171
- var t = je();
172
- return P((n) => {
173
- 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 = {
173
+ var t = nt();
174
+ return M((n) => {
175
+ var r = B("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
174
176
  "--widget-fill-value": e.value,
175
- "z-index": V.BACKGROUND,
177
+ "z-index": z.BACKGROUND,
176
178
  ...e.color ? { "--widget-icon-color": e.color } : {}
177
179
  };
178
- return r !== n.e && M(t, n.e = r), n.t = R(t, i, n.t), n;
180
+ return r !== n.e && A(t, n.e = r), n.t = I(t, i, n.t), n;
179
181
  }, {
180
182
  e: void 0,
181
183
  t: void 0
@@ -184,37 +186,37 @@ function Me(e) {
184
186
  }
185
187
  //#endregion
186
188
  //#region src/framework/components/WidgetContent.tsx
187
- var Ne = /*#__PURE__*/ z("<div>");
188
- function Pe(e) {
189
+ var it = /*#__PURE__*/ L("<div>");
190
+ function at(e) {
189
191
  return (() => {
190
- var t = Ne();
191
- return F(t, () => e.children), P(() => M(t, H("glasshome-widget-content", e.class))), t;
192
+ var t = it();
193
+ return N(t, () => e.children), M(() => A(t, B("glasshome-widget-content", e.class))), t;
192
194
  })();
193
195
  }
194
196
  //#endregion
195
197
  //#region src/framework/components/WidgetIcon.tsx
196
- var Fe = /*#__PURE__*/ z("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), Ie = /*#__PURE__*/ z("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), Le = /*#__PURE__*/ z("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
197
- function Re(e) {
198
+ var ot = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), st = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), ct = /*#__PURE__*/ L("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
199
+ function lt(e) {
198
200
  let t = () => e.entityCount ?? 1;
199
201
  return (() => {
200
- var n = Le(), r = n.firstChild;
201
- return F(n, N(w, {
202
+ var n = ct(), r = n.firstChild;
203
+ return N(n, j(C, {
202
204
  get when() {
203
205
  return t() >= 2;
204
206
  },
205
207
  get children() {
206
- return Fe();
208
+ return ot();
207
209
  }
208
- }), r), F(n, N(w, {
210
+ }), r), N(n, j(C, {
209
211
  get when() {
210
212
  return t() >= 3;
211
213
  },
212
214
  get children() {
213
- return Ie();
215
+ return st();
214
216
  }
215
- }), r), F(r, () => e.icon), P((t) => {
216
- 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;
217
- return r !== t.e && M(n, t.e = r), t.t = R(n, i, t.t), t;
217
+ }), r), N(r, () => e.icon), M((t) => {
218
+ var r = B("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;
219
+ return r !== t.e && A(n, t.e = r), t.t = I(n, i, t.t), t;
218
220
  }, {
219
221
  e: void 0,
220
222
  t: void 0
@@ -223,16 +225,16 @@ function Re(e) {
223
225
  }
224
226
  //#endregion
225
227
  //#region src/framework/components/WidgetStatus.tsx
226
- var ze = /*#__PURE__*/ z("<p>");
227
- function Be(e) {
228
+ var ut = /*#__PURE__*/ L("<p>");
229
+ function dt(e) {
228
230
  return (() => {
229
- var t = ze();
230
- return F(t, (() => {
231
- var t = I(() => !!e.isUnavailable);
231
+ var t = ut();
232
+ return N(t, (() => {
233
+ var t = P(() => !!e.isUnavailable);
232
234
  return () => t() ? "Unavailable" : e.children;
233
- })()), P((n) => {
234
- var r = H("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = V.ACTIONS;
235
- return r !== n.e && M(t, n.e = r), i !== n.t && L(t, "z-index", n.t = i), n;
235
+ })()), M((n) => {
236
+ var r = B("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = z.ACTIONS;
237
+ return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
236
238
  }, {
237
239
  e: void 0,
238
240
  t: void 0
@@ -241,21 +243,21 @@ function Be(e) {
241
243
  }
242
244
  //#endregion
243
245
  //#region src/framework/components/WidgetTitle.tsx
244
- var Ve = /*#__PURE__*/ z("<span class=\"glasshome-widget-badge shrink-0\">"), He = /*#__PURE__*/ z("<div><h3 class=glasshome-widget-title>");
245
- function Ue(e) {
246
+ var ft = /*#__PURE__*/ L("<span class=\"glasshome-widget-badge shrink-0\">"), pt = /*#__PURE__*/ L("<div><h3 class=glasshome-widget-title>");
247
+ function mt(e) {
246
248
  return (() => {
247
- var t = He(), n = t.firstChild;
248
- return F(n, () => e.children), F(t, N(w, {
249
+ var t = pt(), n = t.firstChild;
250
+ return N(n, () => e.children), N(t, j(C, {
249
251
  get when() {
250
- return I(() => e.badge !== void 0)() && e.badge > 0;
252
+ return P(() => e.badge !== void 0)() && e.badge > 0;
251
253
  },
252
254
  get children() {
253
- var t = Ve();
254
- return F(t, () => e.badge), t;
255
+ var t = ft();
256
+ return N(t, () => e.badge), t;
255
257
  }
256
- }), null), P((n) => {
257
- var r = H("relative flex items-center gap-2", e.class), i = V.ACTIONS;
258
- return r !== n.e && M(t, n.e = r), i !== n.t && L(t, "z-index", n.t = i), n;
258
+ }), null), M((n) => {
259
+ var r = B("relative flex items-center gap-2", e.class), i = z.ACTIONS;
260
+ return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
259
261
  }, {
260
262
  e: void 0,
261
263
  t: void 0
@@ -264,7 +266,7 @@ function Ue(e) {
264
266
  }
265
267
  //#endregion
266
268
  //#region src/framework/utils/entity-aggregation.ts
267
- function We(e, t = !1) {
269
+ function ht(e, t = !1) {
268
270
  if (e.length === 0) return {
269
271
  isGroup: !1,
270
272
  state: "unknown",
@@ -287,7 +289,7 @@ function We(e, t = !1) {
287
289
  isUnavailable: t.state === "unavailable",
288
290
  brightness: r,
289
291
  brightnessPercent: i,
290
- color: qe(t),
292
+ color: vt(t),
291
293
  onCount: +!!n,
292
294
  totalCount: 1,
293
295
  description: n ? "On" : "Off"
@@ -299,7 +301,7 @@ function We(e, t = !1) {
299
301
  if (r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color) l.push(t.attributes.rgb_color);
300
302
  else if (t.attributes?.hs_color) {
301
303
  let [e, n] = t.attributes.hs_color;
302
- l.push(Ke(e, n));
304
+ l.push(_t(e, n));
303
305
  }
304
306
  break;
305
307
  case "off":
@@ -308,9 +310,7 @@ function We(e, t = !1) {
308
310
  case "unknown":
309
311
  a++;
310
312
  break;
311
- case "unavailable":
312
- o++;
313
- break;
313
+ case "unavailable": o++;
314
314
  }
315
315
  let u = e.length, d = o === u, f = a + o === u, p = r > 0, m = r === u, h = i === u, g, _;
316
316
  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);
@@ -318,7 +318,7 @@ function We(e, t = !1) {
318
318
  if (l.length > 0) {
319
319
  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;
320
320
  y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
321
- } else y = qe(e[0]);
321
+ } else y = vt(e[0]);
322
322
  let b;
323
323
  return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
324
324
  isGroup: n,
@@ -333,7 +333,7 @@ function We(e, t = !1) {
333
333
  description: b
334
334
  };
335
335
  }
336
- function Ge(e, t = "mean", n = !0) {
336
+ function gt(e, t = "mean", n = !0) {
337
337
  if (e.length === 0) return {
338
338
  isGroup: !1,
339
339
  state: "unknown",
@@ -429,7 +429,7 @@ function Ge(e, t = "mean", n = !0) {
429
429
  memberValues: a
430
430
  };
431
431
  }
432
- function Ke(e, t) {
432
+ function _t(e, t) {
433
433
  let n = t / 100, r = n * (1 - Math.abs(e / 60 % 2 - 1)), i = 1 - n, a = 0, o = 0, s = 0;
434
434
  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], [
435
435
  (a + i) * 255,
@@ -437,7 +437,7 @@ function Ke(e, t) {
437
437
  (s + i) * 255
438
438
  ];
439
439
  }
440
- function qe(e) {
440
+ function vt(e) {
441
441
  if (e.state !== "on") return "rgb(100, 100, 100)";
442
442
  let t = (e.attributes?.brightness ?? 255) / 255;
443
443
  if (e.attributes?.rgb_color) {
@@ -445,7 +445,7 @@ function qe(e) {
445
445
  return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
446
446
  }
447
447
  if (e.attributes?.hs_color) {
448
- let [n, r] = e.attributes.hs_color, [i, a, o] = Ke(n, r);
448
+ let [n, r] = e.attributes.hs_color, [i, a, o] = _t(n, r);
449
449
  return `rgb(${Math.round(i * t)}, ${Math.round(a * t)}, ${Math.round(o * t)})`;
450
450
  }
451
451
  if (e.attributes?.color_temp) {
@@ -456,7 +456,7 @@ function qe(e) {
456
456
  }
457
457
  //#endregion
458
458
  //#region src/framework/utils/entity-state.ts
459
- function Je(e) {
459
+ function yt(e) {
460
460
  if (!e) return !1;
461
461
  if ([
462
462
  "on",
@@ -472,15 +472,15 @@ function Je(e) {
472
472
  }
473
473
  return !1;
474
474
  }
475
- function Ye(e, t, n) {
475
+ function bt(e, t, n) {
476
476
  return e?.attributes ? e.attributes[t] ?? n : n;
477
477
  }
478
- function Xe(e) {
479
- return e.filter(Je).length;
478
+ function xt(e) {
479
+ return e.filter(yt).length;
480
480
  }
481
481
  //#endregion
482
482
  //#region src/framework/utils/format-value.ts
483
- function Ze(e, t, n) {
483
+ function St(e, t, n) {
484
484
  let { decimals: r, scale: i = !0 } = n || {};
485
485
  if (typeof e == "string") return t ? `${e}${t}` : e;
486
486
  if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
@@ -491,41 +491,41 @@ function Ze(e, t, n) {
491
491
  }
492
492
  //#endregion
493
493
  //#region src/framework/utils/interpret-value.ts
494
- function Qe(e, t) {
494
+ function Ct(e, t) {
495
495
  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;
496
496
  }
497
497
  //#endregion
498
498
  //#region src/framework/components/WidgetValue.tsx
499
- var $e = /*#__PURE__*/ z("<div class=glasshome-widget-subtitle>"), et = /*#__PURE__*/ z("<div><div class=glasshome-widget-value>");
500
- function tt(e) {
499
+ var wt = /*#__PURE__*/ L("<div class=glasshome-widget-subtitle>"), Tt = /*#__PURE__*/ L("<div><div class=glasshome-widget-value>");
500
+ function Et(e) {
501
501
  return (() => {
502
- var t = et(), n = t.firstChild;
503
- return F(n, () => Ze(e.value, e.unit)), F(t, N(w, {
502
+ var t = Tt(), n = t.firstChild;
503
+ return N(n, () => St(e.value, e.unit)), N(t, j(C, {
504
504
  get when() {
505
- return I(() => !!e.interpret)() && typeof e.value == "number";
505
+ return P(() => !!e.interpret)() && typeof e.value == "number";
506
506
  },
507
507
  get children() {
508
- var t = $e();
509
- return F(t, () => Qe(e.value, e.unit)), t;
508
+ var t = wt();
509
+ return N(t, () => Ct(e.value, e.unit)), t;
510
510
  }
511
- }), null), P(() => M(t, H("flex flex-col", e.class))), t;
511
+ }), null), M(() => A(t, B("flex flex-col", e.class))), t;
512
512
  })();
513
513
  }
514
514
  //#endregion
515
515
  //#region src/framework/core/Widget.tsx
516
- var nt = /*#__PURE__*/ z("<div><div class=\"relative h-full w-full\">"), rt = /*#__PURE__*/ z("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), it = /*#__PURE__*/ z("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), at = /*#__PURE__*/ z("<div class=\"flex items-center justify-center text-white/30\">"), ot = /*#__PURE__*/ z("<h3 class=\"font-semibold text-sm text-white/60\">"), st = /*#__PURE__*/ z("<p class=\"text-white/50 text-xs\">");
517
- function ct(t) {
518
- let r = A(e), [i, a] = D(), [o, s] = D({
516
+ var Dt = /*#__PURE__*/ L("<div><div class=\"relative h-full w-full\">"), Ot = /*#__PURE__*/ L("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), kt = /*#__PURE__*/ L("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), At = /*#__PURE__*/ L("<div class=\"flex items-center justify-center text-white/30\">"), jt = /*#__PURE__*/ L("<h3 class=\"font-semibold text-sm text-white/60\">"), Mt = /*#__PURE__*/ L("<p class=\"text-white/50 text-xs\">");
517
+ function Nt(t) {
518
+ let i = O(e), [a, o] = E(), [s, c] = E({
519
519
  width: 0,
520
520
  height: 0
521
521
  });
522
- T(() => {
523
- let e = i();
522
+ w(() => {
523
+ let e = a();
524
524
  if (!e) return;
525
525
  let t = new ResizeObserver(([e]) => {
526
526
  if (!e) return;
527
527
  let t = e.borderBoxSize?.[0];
528
- s(t ? {
528
+ c(t ? {
529
529
  width: t.inlineSize,
530
530
  height: t.blockSize
531
531
  } : {
@@ -533,133 +533,159 @@ function ct(t) {
533
533
  height: e.contentRect.height
534
534
  });
535
535
  });
536
- t.observe(e), k(() => t.disconnect());
537
- }), me(() => {
538
- let e = i()?.getRootNode();
536
+ t.observe(e), D(() => t.disconnect());
537
+ }), _e(() => {
538
+ let e = a()?.getRootNode();
539
539
  n(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
540
540
  });
541
- let c = {
542
- isEditMode: () => t.isEditMode ?? !1,
543
- updateConfig: r?.updateConfig ?? (() => {}),
544
- registerDialogOpener: r?.registerDialogOpener,
545
- callService: r?.callService,
546
- dimensions: () => o()
547
- }, l = E(() => {
548
- if (t.variant) return typeof t.variant == "string" ? Ae(t.variant) : t.variant;
549
- }), u = E(() => ({
541
+ let l = {
542
+ updateConfig: i?.updateConfig ?? (() => {}),
543
+ registerDialogOpener: i?.registerDialogOpener,
544
+ callService: i?.callService,
545
+ dimensions: r(() => s(), "ctx.dimensions")
546
+ }, u = T(() => {
547
+ if (t.variant) return typeof t.variant == "string" ? tt(t.variant) : t.variant;
548
+ }), d = T(() => ({
550
549
  "container-type": "size",
551
550
  "container-name": "widget",
552
551
  "touch-action": t.gestures && !t.isEditMode ? t.gestures.touchAction() : void 0,
553
- ...l()?.styles?.container,
554
- ...l()?.styles?.cssVars || {},
552
+ ...u()?.styles?.container,
553
+ ...u()?.styles?.cssVars || {},
555
554
  ...t.tone ? { "--widget-color": `var(--tone-${t.tone})` } : {},
556
555
  ...t.color ? { "--widget-color": t.color } : {},
557
556
  ...t.colorTo ? { "--widget-color-to": t.colorTo } : {},
558
557
  ...t.gradient ? { "--widget-gradient": t.gradient } : {}
559
- })), d = () => !!t.gestures && !t.isEditMode, f = (e) => {
560
- d() && t.gestures?.onPointerEnter(e);
561
- }, p = (e) => {
562
- d() && t.gestures?.onPointerDown(e);
558
+ })), f = () => !!t.gestures && !t.isEditMode, p = (e) => {
559
+ f() && t.gestures?.onPointerEnter(e);
563
560
  }, m = (e) => {
564
- d() && t.gestures?.onPointerMove(e);
561
+ f() && t.gestures?.onPointerDown(e);
565
562
  }, h = (e) => {
566
- d() && t.gestures?.onPointerUp(e);
563
+ f() && t.gestures?.onPointerMove(e);
567
564
  }, g = (e) => {
568
- d() && t.gestures?.onPointerCancel(e);
565
+ f() && t.gestures?.onPointerUp(e);
566
+ }, _ = (e) => {
567
+ f() && t.gestures?.onPointerCancel(e);
569
568
  };
570
- return N(e.Provider, {
571
- value: c,
569
+ return j(e.Provider, {
570
+ value: l,
572
571
  get children() {
573
- var e = nt(), n = e.firstChild;
574
- return j(e, "pointercancel", g), j(e, "pointerup", h), j(e, "pointermove", m), j(e, "pointerdown", p), j(e, "pointerenter", f), ve((e) => {
575
- a(e), t.gestures?.bindElement(e);
576
- }, e), F(n, (() => {
577
- var e = I(() => !!t.emptyState);
578
- return () => e() ? N(lt, {
579
- get icon() {
580
- return t.emptyState.icon;
581
- },
582
- get title() {
583
- return t.emptyState.title;
584
- },
585
- get message() {
586
- return t.emptyState.message;
587
- }
588
- }) : t.children;
589
- })()), F(e, (() => {
590
- var e = I(() => !!t.loading);
591
- return () => e() && (() => {
592
- var e = rt();
593
- return P((t) => L(e, "z-index", V.OVERLAY)), e;
594
- })();
595
- })(), null), P((r) => {
596
- var i = H("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", l()?.styles?.class, t.class), a = u(), o = V.CONTENT;
597
- return i !== r.e && M(e, r.e = i), r.t = R(e, a, r.t), o !== r.a && L(n, "z-index", r.a = o), r;
598
- }, {
599
- e: void 0,
600
- t: void 0,
601
- a: void 0
602
- }), e;
572
+ return j(Qe.Provider, {
573
+ value: s,
574
+ get children() {
575
+ var e = Dt(), n = e.firstChild;
576
+ return k(e, "pointercancel", _), k(e, "pointerup", g), k(e, "pointermove", h), k(e, "pointerdown", m), k(e, "pointerenter", p), xe((e) => {
577
+ o(e), t.gestures?.bindElement(e);
578
+ }, e), N(n, (() => {
579
+ var e = P(() => !!t.emptyState);
580
+ return () => e() ? j(Pt, {
581
+ get icon() {
582
+ return t.emptyState.icon;
583
+ },
584
+ get title() {
585
+ return t.emptyState.title;
586
+ },
587
+ get message() {
588
+ return t.emptyState.message;
589
+ }
590
+ }) : t.children;
591
+ })()), N(e, (() => {
592
+ var e = P(() => !!t.loading);
593
+ return () => e() && (() => {
594
+ var e = Ot();
595
+ return M((t) => F(e, "z-index", z.OVERLAY)), e;
596
+ })();
597
+ })(), null), M((r) => {
598
+ var i = B("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", u()?.styles?.class, t.class), a = d(), o = z.CONTENT;
599
+ return i !== r.e && A(e, r.e = i), r.t = I(e, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
600
+ }, {
601
+ e: void 0,
602
+ t: void 0,
603
+ a: void 0
604
+ }), e;
605
+ }
606
+ });
603
607
  }
604
608
  });
605
609
  }
606
- function lt(e) {
610
+ function Pt(e) {
607
611
  return (() => {
608
- var t = it();
609
- return F(t, (() => {
610
- var t = I(() => !!e.icon);
612
+ var t = kt();
613
+ return N(t, (() => {
614
+ var t = P(() => !!e.icon);
611
615
  return () => t() && (() => {
612
- var t = at();
613
- return F(t, () => e.icon), t;
616
+ var t = At();
617
+ return N(t, () => e.icon), t;
614
618
  })();
615
- })(), null), F(t, (() => {
616
- var t = I(() => !!e.title);
619
+ })(), null), N(t, (() => {
620
+ var t = P(() => !!e.title);
617
621
  return () => t() && (() => {
618
- var t = ot();
619
- return F(t, () => e.title), t;
622
+ var t = jt();
623
+ return N(t, () => e.title), t;
620
624
  })();
621
- })(), null), F(t, (() => {
622
- var t = I(() => !!e.message);
625
+ })(), null), N(t, (() => {
626
+ var t = P(() => !!e.message);
623
627
  return () => t() && (() => {
624
- var t = st();
625
- return F(t, () => e.message), t;
628
+ var t = Mt();
629
+ return N(t, () => e.message), t;
626
630
  })();
627
631
  })(), null), t;
628
632
  })();
629
633
  }
630
- var U = ct;
631
- U.Content = Pe, U.Icon = Re, U.Title = Ue, U.Status = Be, U.Value = tt, U.SliderFill = Me;
634
+ var V = Nt;
635
+ V.Content = at, V.Icon = lt, V.Title = mt, V.Status = dt, V.Value = Et, V.SliderFill = rt;
636
+ //#endregion
637
+ //#region src/framework/dialogs/validate-config.ts
638
+ function Ft(e) {
639
+ let t = "";
640
+ for (let n of e) t += typeof n == "number" ? `[${n}]` : t ? `.${String(n)}` : String(n);
641
+ return t;
642
+ }
643
+ function It(e, t) {
644
+ let n = e.safeParse(t);
645
+ return n.success ? null : n.error.issues.map((e) => {
646
+ let t = Ft(e.path);
647
+ return t ? `${t}: ${e.message}` : e.message;
648
+ });
649
+ }
632
650
  //#endregion
633
651
  //#region src/framework/dialogs/WidgetDialog.tsx
634
- var ut = /*#__PURE__*/ z("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), dt = /*#__PURE__*/ z("<button type=button>"), ft = /*#__PURE__*/ z("<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__*/ z("<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__*/ z("<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__*/ z("<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__*/ z("<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__*/ z("<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__*/ z("<div class=\"min-w-0 shrink-0\">"), yt = /*#__PURE__*/ z("<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__*/ z("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), xt = /*#__PURE__*/ z("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
635
- function St(e) {
652
+ var Lt = /*#__PURE__*/ L("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), Rt = /*#__PURE__*/ L("<button type=button>"), zt = /*#__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\">"), Bt = /*#__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>"), Ht = /*#__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"), Ut = /*#__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\">"), Wt = /*#__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"), Gt = /*#__PURE__*/ L("<div class=\"min-w-0 shrink-0\">"), Kt = /*#__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\">"), qt = /*#__PURE__*/ L("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Jt = /*#__PURE__*/ L("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
653
+ function Yt(e) {
636
654
  return (() => {
637
- var t = dt();
638
- return t.$$click = () => e.onClick(), F(t, N(w, {
655
+ var t = Rt();
656
+ return t.$$click = () => e.onClick(), N(t, j(C, {
639
657
  get when() {
640
658
  return e.isActive;
641
659
  },
642
660
  get children() {
643
- var t = ut();
644
- return F(t, () => e.icon), t;
661
+ var t = Lt();
662
+ return N(t, () => e.icon), t;
645
663
  }
646
- }), null), F(t, () => e.label, null), P(() => M(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;
664
+ }), null), N(t, () => e.label, null), M(() => A(t, B("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;
647
665
  })();
648
666
  }
649
- function Ct(e) {
650
- 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] = D({}), [a, o] = D(null);
651
- T(O(() => t.config, (e) => {
667
+ function Xt(e) {
668
+ let [t] = ve(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([]);
669
+ w(ge(() => t.config, (e) => {
652
670
  e && i({ ...e });
653
- })), T(O(() => t.configSchema, (e) => {
654
- e && o(xe(e));
671
+ })), w(ge(() => t.configSchema, (e) => {
672
+ e && o(We(e));
655
673
  }));
656
- let s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), c = (e) => {
657
- !e && t.config && i({ ...t.config }), t.onOpenChange(e);
658
- }, l = () => {
659
- t.onConfigSave?.(r());
660
- }, [u, d] = D(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
661
- t.onActiveTabChange ? t.onActiveTabChange(e) : d(e);
662
- }, m = () => ({
674
+ let l = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), u = (e) => {
675
+ !e && t.config && (i({ ...t.config }), c([])), t.onOpenChange(e);
676
+ }, d = () => {
677
+ let e = t.configSchema;
678
+ if (e) {
679
+ let t = It(e, r());
680
+ if (t) {
681
+ c(t);
682
+ return;
683
+ }
684
+ }
685
+ c([]), t.onConfigSave?.(r());
686
+ }, [f, p] = E(t.defaultTab ?? "controls"), m = () => t.activeTab ?? f(), h = (e) => {
687
+ t.onActiveTabChange ? t.onActiveTabChange(e) : p(e);
688
+ }, g = () => ({
663
689
  sm: "max-w-sm",
664
690
  md: "max-w-md",
665
691
  lg: "max-w-lg",
@@ -667,76 +693,80 @@ function Ct(e) {
667
693
  "2xl": "max-w-2xl",
668
694
  "3xl": "max-w-3xl",
669
695
  "4xl": "max-w-4xl"
670
- })[t.maxWidth ?? "3xl"], h = () => {
696
+ })[t.maxWidth ?? "3xl"], _ = () => {
671
697
  if (t.tabs) return t.tabs;
672
698
  let e = [];
673
699
  return e.push({
674
700
  id: "edit",
675
701
  label: "Edit",
676
- icon: ft(),
677
- content: t.editContent ?? (n() && a() ? N(ne, {
678
- get schema() {
679
- return a();
680
- },
681
- get data() {
682
- return ge(r);
683
- },
684
- onChange: i
685
- }) : pt())
702
+ icon: zt(),
703
+ content: t.editContent ?? (() => {
704
+ let e = n() ? a() : void 0;
705
+ return e ? j(ie, {
706
+ schema: e,
707
+ get data() {
708
+ return ye(r);
709
+ },
710
+ onChange: i,
711
+ get errors() {
712
+ return s();
713
+ }
714
+ }) : Bt();
715
+ })()
686
716
  }), e.push({
687
717
  id: "controls",
688
718
  label: "Controls",
689
- icon: mt(),
690
- content: t.controlsContent ?? ht()
719
+ icon: Vt(),
720
+ content: t.controlsContent ?? Ht()
691
721
  }), e.push({
692
722
  id: "debug",
693
723
  label: "Debug",
694
- icon: gt(),
695
- content: t.debugContent ?? _t()
724
+ icon: Ut(),
725
+ content: t.debugContent ?? Wt()
696
726
  }), e;
697
- }, g = async () => {
727
+ }, v = async () => {
698
728
  if (t.debugData !== void 0) try {
699
729
  let e = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
700
730
  await navigator.clipboard.writeText(e);
701
731
  } catch {}
702
- }, _ = () => {
703
- let e = S();
704
- return e.find((e) => e.id === f())?.content ?? e[0]?.content;
705
- }, v = t.ResponsiveDialog, ee = t.ResponsiveDialogContent, y = t.ResponsiveDialogHeader, b = t.ResponsiveDialogTitle, te = t.ResponsiveDialogDescription, x = t.Button, ne = t.SchemaForm, S = E(O([
732
+ }, ee = () => {
733
+ let e = ae();
734
+ return e.find((e) => e.id === m())?.content ?? e[0]?.content;
735
+ }, y = t.ResponsiveDialog, b = t.ResponsiveDialogContent, te = t.ResponsiveDialogHeader, ne = t.ResponsiveDialogTitle, re = t.ResponsiveDialogDescription, x = t.Button, ie = t.SchemaForm, ae = T(ge([
706
736
  () => t.open,
707
737
  a,
708
738
  () => t.config,
709
739
  () => t.tabs
710
- ], () => h())), re = (e) => n() ? c(e) : t.onOpenChange(e), ie = () => n() ? s() : t.hasUnsavedChanges, C = () => n() ? l : t.onSave;
711
- return N(v, {
740
+ ], () => _())), oe = (e) => n() ? u(e) : t.onOpenChange(e), se = () => n() ? l() : t.hasUnsavedChanges, S = () => n() ? d : t.onSave;
741
+ return j(y, {
712
742
  get open() {
713
743
  return t.open;
714
744
  },
715
- onOpenChange: (e) => re(e),
745
+ onOpenChange: (e) => oe(e),
716
746
  get children() {
717
- return N(ee, {
747
+ return j(b, {
718
748
  get class() {
719
- return H(m(), "px-0", t.class);
749
+ return B(g(), "px-0", t.class);
720
750
  },
721
751
  get children() {
722
752
  return [
723
- N(y, {
753
+ j(te, {
724
754
  class: "flex flex-row items-center justify-between gap-3 px-6",
725
755
  get children() {
726
756
  return [(() => {
727
- var e = vt();
728
- return F(e, N(b, {
757
+ var e = Gt();
758
+ return N(e, j(ne, {
729
759
  class: "truncate leading-tight",
730
760
  get children() {
731
761
  return t.title;
732
762
  }
733
- }), null), F(e, N(te, {
763
+ }), null), N(e, j(re, {
734
764
  class: "sr-only",
735
765
  children: "Widget configuration dialog"
736
766
  }), null), e;
737
767
  })(), (() => {
738
- var e = yt(), n = e.firstChild;
739
- return F(n, () => S().map((e) => N(St, {
768
+ var e = Kt(), n = e.firstChild;
769
+ return N(n, () => ae().map((e) => j(Yt, {
740
770
  get icon() {
741
771
  return e.icon;
742
772
  },
@@ -744,10 +774,10 @@ function Ct(e) {
744
774
  return e.label;
745
775
  },
746
776
  get isActive() {
747
- return f() === e.id;
777
+ return m() === e.id;
748
778
  },
749
- onClick: () => p(e.id)
750
- }))), F(e, N(w, {
779
+ onClick: () => h(e.id)
780
+ }))), N(e, j(C, {
751
781
  get when() {
752
782
  return t.headerActions;
753
783
  },
@@ -759,50 +789,50 @@ function Ct(e) {
759
789
  }
760
790
  }),
761
791
  (() => {
762
- var e = bt();
763
- return F(e, _), e;
792
+ var e = qt();
793
+ return N(e, ee), e;
764
794
  })(),
765
- N(w, {
795
+ j(C, {
766
796
  get when() {
767
- return I(() => f() === "edit")() && (C() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
797
+ return P(() => m() === "edit")() && (S() || t.onDelete) || m() === "debug" && t.debugData !== void 0;
768
798
  },
769
799
  get children() {
770
- var e = xt();
771
- return F(e, N(w, {
800
+ var e = Jt();
801
+ return N(e, j(C, {
772
802
  get when() {
773
- return I(() => f() === "edit")() && t.onDelete;
803
+ return P(() => m() === "edit")() && t.onDelete;
774
804
  },
775
805
  get children() {
776
- return N(x, {
806
+ return j(x, {
777
807
  size: "sm",
778
808
  variant: "destructive",
779
809
  onClick: () => t.onDelete?.(),
780
810
  children: "Delete"
781
811
  });
782
812
  }
783
- }), null), F(e, N(w, {
813
+ }), null), N(e, j(C, {
784
814
  get when() {
785
- return I(() => f() === "edit")() && C();
815
+ return P(() => m() === "edit")() && S();
786
816
  },
787
817
  get children() {
788
- return N(x, {
818
+ return j(x, {
789
819
  size: "sm",
790
820
  get disabled() {
791
- return !ie();
821
+ return !se();
792
822
  },
793
- onClick: () => C()?.(),
823
+ onClick: () => S()?.(),
794
824
  children: "Save"
795
825
  });
796
826
  }
797
- }), null), F(e, N(w, {
827
+ }), null), N(e, j(C, {
798
828
  get when() {
799
- return I(() => f() === "debug")() && t.debugData !== void 0;
829
+ return P(() => m() === "debug")() && t.debugData !== void 0;
800
830
  },
801
831
  get children() {
802
- return N(x, {
832
+ return j(x, {
803
833
  size: "sm",
804
834
  variant: "outline",
805
- onClick: g,
835
+ onClick: v,
806
836
  children: "Copy"
807
837
  });
808
838
  }
@@ -815,34 +845,34 @@ function Ct(e) {
815
845
  }
816
846
  });
817
847
  }
818
- _e(["click"]);
848
+ be(["click"]);
819
849
  //#endregion
820
850
  //#region src/framework/hooks/use-intersection-pause.ts
821
- function wt(e) {
851
+ function Zt(e) {
822
852
  if (typeof IntersectionObserver > "u") return () => !1;
823
- let [t, n] = D(!1), r = new IntersectionObserver((e) => {
853
+ let [t, n] = E(!1), r = new IntersectionObserver((e) => {
824
854
  let t = e[0];
825
855
  t && n(!t.isIntersecting);
826
856
  });
827
- return T(() => {
857
+ return w(() => {
828
858
  let t = e();
829
859
  r.disconnect(), t && r.observe(t);
830
- }), k(() => r.disconnect()), t;
860
+ }), D(() => r.disconnect()), t;
831
861
  }
832
862
  //#endregion
833
863
  //#region src/framework/hooks/use-reduced-motion.ts
834
- function Tt() {
864
+ function Qt() {
835
865
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
836
- let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = D(e.matches), r = (e) => n(e.matches);
837
- return e.addEventListener("change", r), k(() => e.removeEventListener("change", r)), t;
866
+ let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
867
+ return e.addEventListener("change", r), D(() => e.removeEventListener("change", r)), t;
838
868
  }
839
869
  //#endregion
840
870
  //#region src/framework/hooks/use-widget-dialog.ts
841
- function Et(t = "controls") {
842
- let [n, r] = D(!1), [i, a] = D(t), o = (e) => {
871
+ function $t(t = "controls") {
872
+ let [n, r] = E(!1), [i, a] = E(t), o = (e) => {
843
873
  a(e ?? t), r(!0);
844
- }, s = A(e);
845
- return s?.registerDialogOpener?.(o), k(() => s?.registerDialogOpener?.(null)), {
874
+ }, s = O(e);
875
+ return s?.registerDialogOpener?.(o), D(() => s?.registerDialogOpener?.(null)), {
846
876
  showDialog: n,
847
877
  setShowDialog: r,
848
878
  openDialog: o,
@@ -863,15 +893,15 @@ function Et(t = "controls") {
863
893
  }
864
894
  //#endregion
865
895
  //#region src/framework/hooks/use-widget-entity-group.ts
866
- function Dt(e) {
867
- 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(() => {
896
+ function en(e) {
897
+ 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(() => {
868
898
  if (!r()) return;
869
899
  let t = e.aggregationMode?.();
870
900
  if (!t || t === "none") return;
871
901
  let n = e.entities();
872
- if (t === "light" || t === "binary-sensor" || t === "switch") return We(n, e.allEntitiesMode);
873
- if (t === "sensor") return Ge(n, e.sensorGroupType?.() ?? "mean", !0);
874
- }), o = E(() => r() ? void 0 : e.emptyStateConfig);
902
+ if (t === "light" || t === "binary-sensor" || t === "switch") return ht(n, e.allEntitiesMode);
903
+ if (t === "sensor") return gt(n, e.sensorGroupType?.() ?? "mean", !0);
904
+ }), o = T(() => r() ? void 0 : e.emptyStateConfig);
875
905
  return {
876
906
  entities: e.entities,
877
907
  groupData: i,
@@ -883,142 +913,142 @@ function Dt(e) {
883
913
  }
884
914
  //#endregion
885
915
  //#region src/framework/gestures/cursors.ts
886
- var W = 32, G = W / 2, K = "white", q = "rgba(0,0,0,0.4)", J = 2, Y = 3;
887
- function Ot(e) {
916
+ var H = 32, U = H / 2, W = "white", G = "rgba(0,0,0,0.4)", K = 2, q = 3;
917
+ function tn(e) {
888
918
  return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
889
919
  }
890
- function X(e) {
891
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${W}" viewBox="0 0 ${W} ${W}">${e}</svg>`;
920
+ function J(e) {
921
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${H}" height="${H}" viewBox="0 0 ${H} ${H}">${e}</svg>`;
892
922
  }
893
- var kt = X(`
923
+ var nn = J(`
894
924
  <g transform="translate(6, 2)">
895
925
  <!-- shadow -->
896
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
926
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
897
927
  <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"/>
898
928
  </g>
899
929
  <!-- main -->
900
- <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
930
+ <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
901
931
  <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"/>
902
932
  </g>
903
933
  </g>
904
- `), At = X(`
934
+ `), rn = J(`
905
935
  <g>
906
- <circle cx="${G}" cy="${G}" r="8" stroke="${q}" stroke-width="${Y}" fill="none"/>
907
- <circle cx="${G}" cy="${G}" r="8" stroke="${K}" stroke-width="1.5" fill="none"/>
908
- <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
936
+ <circle cx="${U}" cy="${U}" r="8" stroke="${G}" stroke-width="${q}" fill="none"/>
937
+ <circle cx="${U}" cy="${U}" r="8" stroke="${W}" stroke-width="1.5" fill="none"/>
938
+ <circle cx="${U}" cy="${U}" r="1.5" fill="${W}"/>
909
939
  </g>
910
- `), jt = X(`
940
+ `), an = J(`
911
941
  <g>
912
942
  <!-- shadow -->
913
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
914
- <line x1="6" y1="${G}" x2="26" y2="${G}"/>
915
- <polyline points="10,${G - 4} 6,${G} 10,20"/>
916
- <polyline points="22,${G - 4} 26,${G} 22,20"/>
943
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
944
+ <line x1="6" y1="${U}" x2="26" y2="${U}"/>
945
+ <polyline points="10,12 6,${U} 10,20"/>
946
+ <polyline points="22,12 26,${U} 22,20"/>
917
947
  </g>
918
948
  <!-- main -->
919
- <g stroke="${K}" stroke-width="${J}" 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"/>
949
+ <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
950
+ <line x1="6" y1="${U}" x2="26" y2="${U}"/>
951
+ <polyline points="10,12 6,${U} 10,20"/>
952
+ <polyline points="22,12 26,${U} 22,20"/>
923
953
  </g>
924
954
  <!-- center grip dots -->
925
- <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
926
- <circle cx="${G - 5}" cy="${G}" r="1" fill="${K}" opacity="0.6"/>
927
- <circle cx="21" cy="${G}" r="1" fill="${K}" opacity="0.6"/>
955
+ <circle cx="${U}" cy="${U}" r="1.5" fill="${W}"/>
956
+ <circle cx="11" cy="${U}" r="1" fill="${W}" opacity="0.6"/>
957
+ <circle cx="21" cy="${U}" r="1" fill="${W}" opacity="0.6"/>
928
958
  </g>
929
- `), Mt = X(`
959
+ `), on = J(`
930
960
  <g>
931
961
  <!-- shadow -->
932
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
933
- <line x1="${G}" y1="6" x2="${G}" y2="26"/>
934
- <polyline points="${G - 4},10 ${G},6 20,10"/>
935
- <polyline points="${G - 4},22 ${G},26 20,22"/>
962
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
963
+ <line x1="${U}" y1="6" x2="${U}" y2="26"/>
964
+ <polyline points="12,10 ${U},6 20,10"/>
965
+ <polyline points="12,22 ${U},26 20,22"/>
936
966
  </g>
937
967
  <!-- main -->
938
- <g stroke="${K}" stroke-width="${J}" 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"/>
968
+ <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
969
+ <line x1="${U}" y1="6" x2="${U}" y2="26"/>
970
+ <polyline points="12,10 ${U},6 20,10"/>
971
+ <polyline points="12,22 ${U},26 20,22"/>
942
972
  </g>
943
973
  <!-- center grip dots -->
944
- <circle cx="${G}" cy="${G}" r="1.5" fill="${K}"/>
945
- <circle cx="${G}" cy="${G - 5}" r="1" fill="${K}" opacity="0.6"/>
946
- <circle cx="${G}" cy="21" r="1" fill="${K}" opacity="0.6"/>
974
+ <circle cx="${U}" cy="${U}" r="1.5" fill="${W}"/>
975
+ <circle cx="${U}" cy="11" r="1" fill="${W}" opacity="0.6"/>
976
+ <circle cx="${U}" cy="21" r="1" fill="${W}" opacity="0.6"/>
947
977
  </g>
948
- `), Nt = X(`
978
+ `), sn = J(`
949
979
  <g>
950
980
  <!-- shadow -->
951
- <g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
952
- <line x1="7" y1="${G}" x2="25" y2="${G}"/>
953
- <line x1="${G}" y1="7" x2="${G}" y2="25"/>
954
- <polyline points="11,${G - 3} 7,${G} 11,19"/>
955
- <polyline points="21,${G - 3} 25,${G} 21,19"/>
956
- <polyline points="${G - 3},11 ${G},7 19,11"/>
957
- <polyline points="${G - 3},21 ${G},25 19,21"/>
981
+ <g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
982
+ <line x1="7" y1="${U}" x2="25" y2="${U}"/>
983
+ <line x1="${U}" y1="7" x2="${U}" y2="25"/>
984
+ <polyline points="11,13 7,${U} 11,19"/>
985
+ <polyline points="21,13 25,${U} 21,19"/>
986
+ <polyline points="13,11 ${U},7 19,11"/>
987
+ <polyline points="13,21 ${U},25 19,21"/>
958
988
  </g>
959
989
  <!-- main -->
960
- <g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
961
- <line x1="7" y1="${G}" x2="25" y2="${G}"/>
962
- <line x1="${G}" y1="7" x2="${G}" y2="25"/>
963
- <polyline points="11,${G - 3} 7,${G} 11,19"/>
964
- <polyline points="21,${G - 3} 25,${G} 21,19"/>
965
- <polyline points="${G - 3},11 ${G},7 19,11"/>
966
- <polyline points="${G - 3},21 ${G},25 19,21"/>
990
+ <g stroke="${W}" stroke-width="${K}" fill="none" stroke-linecap="round" stroke-linejoin="round">
991
+ <line x1="7" y1="${U}" x2="25" y2="${U}"/>
992
+ <line x1="${U}" y1="7" x2="${U}" y2="25"/>
993
+ <polyline points="11,13 7,${U} 11,19"/>
994
+ <polyline points="21,13 25,${U} 21,19"/>
995
+ <polyline points="13,11 ${U},7 19,11"/>
996
+ <polyline points="13,21 ${U},25 19,21"/>
967
997
  </g>
968
998
  <!-- center dot -->
969
- <circle cx="${G}" cy="${G}" r="2" fill="${K}"/>
999
+ <circle cx="${U}" cy="${U}" r="2" fill="${W}"/>
970
1000
  </g>
971
1001
  `);
972
- function Z(e, t, n) {
1002
+ function Y(e, t, n) {
973
1003
  return {
974
- css: `${Ot(e)} ${t} ${n}, auto`,
1004
+ css: `${tn(e)} ${t} ${n}, auto`,
975
1005
  hotspotX: t,
976
1006
  hotspotY: n
977
1007
  };
978
1008
  }
979
- var Q = {
980
- tap: Z(kt, 12, 4),
981
- hold: Z(At, 16, 16),
982
- slideHorizontal: Z(jt, G, G),
983
- slideVertical: Z(Mt, G, G),
984
- slideAuto: Z(Nt, G, G)
1009
+ var X = {
1010
+ tap: Y(nn, 12, 4),
1011
+ hold: Y(rn, 16, 16),
1012
+ slideHorizontal: Y(an, U, U),
1013
+ slideVertical: Y(on, U, U),
1014
+ slideAuto: Y(sn, U, U)
985
1015
  };
986
1016
  //#endregion
987
1017
  //#region src/framework/gestures/haptics.ts
988
- function Pt() {
1018
+ function cn() {
989
1019
  if (typeof window > "u") return null;
990
1020
  let e = window;
991
1021
  return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
992
1022
  }
993
- function Ft(e) {
1023
+ function ln(e) {
994
1024
  if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
995
1025
  navigator.vibrate(e);
996
1026
  } catch {}
997
1027
  }
998
- var It = {
1028
+ var un = {
999
1029
  tick() {
1000
- let e = Pt();
1030
+ let e = cn();
1001
1031
  if (e) {
1002
1032
  e.impact({ style: "Light" }).catch(() => {});
1003
1033
  return;
1004
1034
  }
1005
- Ft(8);
1035
+ ln(8);
1006
1036
  },
1007
1037
  bump() {
1008
- let e = Pt();
1038
+ let e = cn();
1009
1039
  if (e) {
1010
1040
  e.impact({ style: "Medium" }).catch(() => {});
1011
1041
  return;
1012
1042
  }
1013
- Ft(20);
1043
+ ln(20);
1014
1044
  },
1015
1045
  pulse() {
1016
- let e = Pt();
1046
+ let e = cn();
1017
1047
  if (e) {
1018
1048
  e.impact({ style: "Heavy" }).catch(() => {});
1019
1049
  return;
1020
1050
  }
1021
- Ft([
1051
+ ln([
1022
1052
  0,
1023
1053
  15,
1024
1054
  40,
@@ -1028,7 +1058,7 @@ var It = {
1028
1058
  };
1029
1059
  //#endregion
1030
1060
  //#region src/framework/gestures/use-widget-gestures.ts
1031
- function Lt(e, t) {
1061
+ function dn(e, t) {
1032
1062
  let n = {
1033
1063
  isDown: !1,
1034
1064
  isTouch: !1,
@@ -1039,7 +1069,7 @@ function Lt(e, t) {
1039
1069
  sliding: !1,
1040
1070
  holdTimer: null,
1041
1071
  element: null
1042
- }, r = null, i = null, a = null, [o, s] = D(null);
1072
+ }, r = null, i = null, a = null, [o, s] = E(null);
1043
1073
  function c(e) {
1044
1074
  e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
1045
1075
  let t = e[0];
@@ -1071,7 +1101,7 @@ function Lt(e, t) {
1071
1101
  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) {
1072
1102
  let e = r.hold.delay ?? 300;
1073
1103
  n.holdTimer = setTimeout(() => {
1074
- n.holdTimer = null, !(!n.isDown || n.hasMoved) && (It.bump(), r.hold?.action(), n.isDown = !1);
1104
+ n.holdTimer = null, !(!n.isDown || n.hasMoved) && (un.bump(), r.hold?.action(), n.isDown = !1);
1075
1105
  }, e);
1076
1106
  }
1077
1107
  if (!n.isTouch && r.slide) try {
@@ -1108,9 +1138,9 @@ function Lt(e, t) {
1108
1138
  let n = e();
1109
1139
  if (n.slide) {
1110
1140
  let e = n.slide.orientation;
1111
- 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);
1141
+ return e === "horizontal" ? X.slideHorizontal.css : e === "vertical" ? X.slideVertical.css : (r || c(t), r && r.height > r.width ? X.slideVertical.css : X.slideHorizontal.css);
1112
1142
  }
1113
- return n.tap ? Q.tap.css : n.hold ? Q.hold.css : "";
1143
+ return n.tap ? X.tap.css : n.hold ? X.hold.css : "";
1114
1144
  };
1115
1145
  return {
1116
1146
  onPointerDown: f,
@@ -1139,7 +1169,7 @@ function Lt(e, t) {
1139
1169
  }
1140
1170
  //#endregion
1141
1171
  //#region src/framework/theming/svg-colors.ts
1142
- var Rt = {
1172
+ var fn = {
1143
1173
  solar: "oklch(0.74 0.18 60)",
1144
1174
  grid: "oklch(0.62 0.12 245)",
1145
1175
  battery: "oklch(0.70 0.18 145)",
@@ -1148,21 +1178,21 @@ var Rt = {
1148
1178
  positive: "oklch(0.70 0.14 160)",
1149
1179
  negative: "oklch(0.64 0.22 27)"
1150
1180
  };
1151
- function zt(e) {
1181
+ function pn(e) {
1152
1182
  return {
1153
1183
  fill: `color-mix(in oklch, ${e} 20%, transparent)`,
1154
1184
  stroke: e,
1155
1185
  solid: e
1156
1186
  };
1157
1187
  }
1158
- var Bt = Object.fromEntries(Object.entries(Rt).map(([e, t]) => [e, zt(t)])), Vt = l.enum([
1188
+ var mn = Object.fromEntries(Object.entries(fn).map(([e, t]) => [e, pn(t)])), hn = l.enum([
1159
1189
  "success",
1160
1190
  "warning",
1161
1191
  "danger",
1162
1192
  "info",
1163
1193
  "neutral",
1164
1194
  "accent"
1165
- ]), Ht = {
1195
+ ]), gn = {
1166
1196
  title: r(() => l.string().optional().meta({
1167
1197
  title: "Title",
1168
1198
  description: "Optional display name override"
@@ -1182,56 +1212,54 @@ var Bt = Object.fromEntries(Object.entries(Rt).map(([e, t]) => [e, zt(t)])), Vt
1182
1212
  formType: "area-picker",
1183
1213
  title: "Area"
1184
1214
  }), "widgetFields.areaId")
1185
- };
1186
- //#endregion
1187
- //#region src/framework/config/index.ts
1188
- function $(e) {
1215
+ }, _n = 24;
1216
+ function Z(e) {
1189
1217
  let t = {};
1190
1218
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
1191
1219
  return t;
1192
1220
  }
1193
- function Ut() {
1221
+ function vn() {
1194
1222
  return l.string().optional().meta({
1195
1223
  title: "Title",
1196
1224
  description: "Optional display name override"
1197
1225
  });
1198
1226
  }
1199
- function Wt(e) {
1200
- return (e.default === void 0 ? l.string().optional() : l.string().default(e.default)).meta($({
1227
+ function yn(e) {
1228
+ return (e.default === void 0 ? l.string().optional() : l.string().default(e.default)).meta(Z({
1201
1229
  title: e.title,
1202
1230
  description: e.description
1203
1231
  }));
1204
1232
  }
1205
- function Gt(e) {
1233
+ function bn(e) {
1206
1234
  let t = l.number();
1207
- 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($({
1235
+ 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(Z({
1208
1236
  title: e.title,
1209
1237
  description: e.description
1210
1238
  }));
1211
1239
  }
1212
- function Kt(e) {
1213
- return l.boolean().default(e.default ?? !1).meta($({
1240
+ function xn(e) {
1241
+ return l.boolean().default(e.default ?? !1).meta(Z({
1214
1242
  title: e.title,
1215
1243
  description: e.description
1216
1244
  }));
1217
1245
  }
1218
- function qt(e, t) {
1246
+ function Sn(e, t) {
1219
1247
  let n = l.enum(e);
1220
- return (t.default === void 0 ? n.optional() : n.default(t.default)).meta($({
1248
+ return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(Z({
1221
1249
  title: t.title,
1222
1250
  description: t.description
1223
1251
  }));
1224
1252
  }
1225
- function Jt(e, t) {
1226
- return l.array(l.string()).default([]).meta($({
1253
+ function Cn(e, t) {
1254
+ return l.array(l.string()).default([]).meta(Z({
1227
1255
  domain: e,
1228
1256
  title: t?.title ?? "Entities",
1229
1257
  description: t?.description,
1230
1258
  deviceClass: t?.deviceClass
1231
1259
  }));
1232
1260
  }
1233
- function Yt(e, t) {
1234
- return l.array(l.string()).default([]).meta($({
1261
+ function wn(e, t) {
1262
+ return l.array(l.string()).default([]).meta(Z({
1235
1263
  domain: e,
1236
1264
  title: t?.title ?? "Entity",
1237
1265
  description: t?.description,
@@ -1239,48 +1267,125 @@ function Yt(e, t) {
1239
1267
  singleSelect: !0
1240
1268
  }));
1241
1269
  }
1242
- function Xt(e) {
1270
+ function Tn(e) {
1243
1271
  return l.string().optional().meta({
1244
1272
  formType: "area-picker",
1245
1273
  title: e?.title ?? "Area"
1246
1274
  });
1247
1275
  }
1248
- function Zt(e) {
1276
+ function En(e) {
1249
1277
  let t = l.string().meta({
1250
1278
  formType: "icon-picker",
1251
1279
  title: e?.title ?? "Icon"
1252
1280
  });
1253
1281
  return e?.default === void 0 ? t.optional() : t.default(e.default);
1254
1282
  }
1255
- function Qt(e) {
1256
- return l.array(l.string()).default([]).meta($({
1283
+ function Dn(e) {
1284
+ return l.array(l.string()).default([]).meta(Z({
1257
1285
  title: e.title,
1258
1286
  description: e.description
1259
1287
  }));
1260
1288
  }
1261
- function $t(e, t) {
1289
+ function On(e, t) {
1262
1290
  let n = l.object(e);
1263
- return n.default(Se(n)).meta({ title: t.title });
1264
- }
1265
- var en = {
1266
- title: Ut,
1267
- text: Wt,
1268
- number: Gt,
1269
- toggle: Kt,
1270
- choice: qt,
1271
- entities: Jt,
1272
- entity: Yt,
1273
- area: Xt,
1274
- icon: Zt,
1275
- stringList: Qt,
1276
- group: $t
1291
+ return n.default(Ge(n)).meta({ title: t.title });
1292
+ }
1293
+ function Q(e) {
1294
+ return e.def;
1295
+ }
1296
+ function $(e) {
1297
+ if (l.globalRegistry.get(e)?.formType === "list") return !0;
1298
+ let t = Q(e);
1299
+ return t.shape ? Object.values(t.shape).some($) : t.options ? t.options.some($) : t.element ? $(t.element) : t.innerType ? $(t.innerType) : !1;
1300
+ }
1301
+ function kn(e) {
1302
+ let t = e, n = Q(t).innerType;
1303
+ for (; n;) t = n, n = Q(t).innerType;
1304
+ return t;
1305
+ }
1306
+ function An(e) {
1307
+ let t = Q(kn(e));
1308
+ if (t.shape) return new Set(Object.keys(t.shape));
1309
+ if (t.options) {
1310
+ let e = [];
1311
+ for (let n of t.options) {
1312
+ let t = An(n);
1313
+ if (!t) return null;
1314
+ e.push(t);
1315
+ }
1316
+ let [n, ...r] = e;
1317
+ if (!n) return null;
1318
+ let i = /* @__PURE__ */ new Set();
1319
+ for (let e of n) r.every((t) => t.has(e)) && i.add(e);
1320
+ return i;
1321
+ }
1322
+ return null;
1323
+ }
1324
+ function jn(e, t, n) {
1325
+ let r = { [t]: n };
1326
+ try {
1327
+ return e.parse(r);
1328
+ } catch {
1329
+ return r;
1330
+ }
1331
+ }
1332
+ function Mn(e, t) {
1333
+ if (!Number.isInteger(t.max) || t.max < 1) throw Error(`field.list: max must be a positive integer, got ${t.max}`);
1334
+ if (t.max > _n) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${_n}`);
1335
+ 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}`);
1336
+ if ($(e)) throw Error("field.list: a list item cannot contain another field.list (depth 1 only)");
1337
+ if (t.labelField !== void 0 && !An(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
1338
+ let n = l.array(e);
1339
+ return t.min !== void 0 && (n = n.min(t.min)), n = n.max(t.max), n.default([]).meta(Z({
1340
+ formType: "list",
1341
+ title: t.title,
1342
+ description: t.description,
1343
+ addLabel: t.addLabel,
1344
+ labelField: t.labelField
1345
+ }));
1346
+ }
1347
+ function Nn(e, t, n) {
1348
+ let r = Object.keys(t)[0];
1349
+ if (r === void 0) throw Error("field.variants: at least one variant is required");
1350
+ if (n.shared && e in n.shared) throw Error(`field.variants: shared fields cannot redefine the discriminator "${e}"`);
1351
+ for (let [n, r] of Object.entries(t)) if (e in r) throw Error(`field.variants: variant "${n}" cannot redefine the discriminator "${e}"`);
1352
+ if (n.labels) {
1353
+ for (let e of Object.keys(n.labels)) if (!(e in t)) throw Error(`field.variants: labels names unknown variant "${e}"`);
1354
+ }
1355
+ let i = Object.entries(t).map(([t, r]) => l.object({
1356
+ ...n.shared ?? {},
1357
+ ...r,
1358
+ [e]: l.literal(t)
1359
+ })), a = l.discriminatedUnion(e, i), o = i[0];
1360
+ return a.default(o ? jn(o, e, r) : {}).meta(Z({
1361
+ formType: "variants",
1362
+ discriminator: e,
1363
+ title: n.title,
1364
+ description: n.description,
1365
+ labels: n.labels
1366
+ }));
1367
+ }
1368
+ var Pn = {
1369
+ title: vn,
1370
+ text: yn,
1371
+ number: bn,
1372
+ toggle: xn,
1373
+ choice: Sn,
1374
+ entities: Cn,
1375
+ entity: wn,
1376
+ area: Tn,
1377
+ icon: En,
1378
+ stringList: Dn,
1379
+ group: On,
1380
+ list: Mn,
1381
+ variants: Nn
1277
1382
  };
1278
- function tn(e) {
1383
+ function Fn(e) {
1279
1384
  return l.object(e);
1280
1385
  }
1281
1386
  //#endregion
1282
1387
  //#region src/shared/spline.ts
1283
- function nn(e) {
1388
+ function In(e) {
1284
1389
  if (e.length < 2) return "";
1285
1390
  let t = e[0], n = e[1];
1286
1391
  if (!t || !n) return "";
@@ -1307,14 +1412,14 @@ function nn(e) {
1307
1412
  }
1308
1413
  //#endregion
1309
1414
  //#region src/theme.ts
1310
- function rn() {
1415
+ function Ln() {
1311
1416
  return document.documentElement.classList.contains("dark");
1312
1417
  }
1313
1418
  //#endregion
1314
1419
  //#region src/version.ts
1315
- var an = {
1420
+ var Rn = {
1316
1421
  name: "@glasshome/widget-sdk",
1317
- version: "1.8.1",
1422
+ version: "1.9.0",
1318
1423
  description: "SDK for building GlassHome dashboard widgets with SolidJS",
1319
1424
  keywords: [
1320
1425
  "glasshome",
@@ -1371,7 +1476,8 @@ var an = {
1371
1476
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json"
1372
1477
  },
1373
1478
  peerDependencies: {
1374
- "@glasshome/sync-layer": "0.4.0",
1479
+ "@glasshome/sync-layer": "0.5.0",
1480
+ "@glasshome/ui": "1.3.0",
1375
1481
  "solid-js": "^1.9.11"
1376
1482
  },
1377
1483
  dependencies: {
@@ -1403,4 +1509,4 @@ var an = {
1403
1509
  engines: { node: ">=18" }
1404
1510
  }.version;
1405
1511
  //#endregion
1406
- export { an as SDK_VERSION, Vt as ToneSchema, U as Widget, Pe as WidgetContent, e as WidgetCtx, Ct as WidgetDialog, Re as WidgetIcon, o as WidgetManifestSchema, Me as WidgetSliderFill, Be as WidgetStatus, Ue as WidgetTitle, tt as WidgetValue, ee as byDomain, We as calculateLightGroup, Ge as calculateSensorGroup, Xe as countActiveEntities, tn as defineConfig, Ce as defineWidget, i as deprecations, en as field, a as formatDeprecation, s as formatSchemaError, Ye as getEntityAttribute, u as getForecasts, d as getStream, f as getWebRtcClientConfig, p as hassMediaUrl, n as injectTokens, rn as isDark, Je as isEntityActive, nn as monotoneCubicPath, m as sendWebRtcCandidate, h as startWebRtcSession, g as state, Bt as svgColors, _ as trackEntityHistory, v as untrackEntityHistory, y as useArea, b as useCamera, te as useConnection, x as useCurrency, ne as useEntities, S as useEntity, re as useEntityHistory, ie as useEntityStatistics, C as useForecast, ae as useHassConfig, wt as useIntersectionPause, oe as useLocale, Tt as useReducedMotion, Te as useService, ce as useStore, le as useTemperatureUnit, Oe as useToggle, De as useTurnOff, Ee as useTurnOn, pe as useUnitSystem, t as useWidgetContext, Et as useWidgetDialog, Dt as useWidgetEntityGroup, Lt as useWidgetGestures, Ht as widgetFields, c as z };
1512
+ export { we as Badge, Te as Button, Ee as ColorSlider, De as ColorWheel, Oe as Input, ke as Label, Ae as ResponsiveDialog, je as ResponsiveDialogContent, Me as ResponsiveDialogDescription, Ne as ResponsiveDialogHeader, Pe as ResponsiveDialogTitle, Rn as SDK_VERSION, Fe as SchemaForm, Ie as Select, Le as SelectContent, Re as SelectItem, ze as SelectTrigger, Be as SelectValue, Ve as Slider, He as Switch, hn as ToneSchema, V as Widget, at as WidgetContent, e as WidgetCtx, Xt as WidgetDialog, lt as WidgetIcon, o as WidgetManifestSchema, Qe as WidgetSizeCtx, rt as WidgetSliderFill, dt as WidgetStatus, mt as WidgetTitle, Et as WidgetValue, ee as byDomain, ht as calculateLightGroup, gt as calculateSensorGroup, xt as countActiveEntities, Fn as defineConfig, Ke as defineWidget, i as deprecations, Pn as field, a as formatDeprecation, s as formatSchemaError, bt as getEntityAttribute, u as getForecasts, d as getStream, f as getWebRtcClientConfig, p as hassMediaUrl, n as injectTokens, Ln as isDark, yt as isEntityActive, In as monotoneCubicPath, Ue as parseColor, m as sendWebRtcCandidate, h as startWebRtcSession, g as state, mn as svgColors, _ as trackEntityHistory, v as untrackEntityHistory, y as useArea, b as useCamera, te as useConnection, ne as useCurrency, re as useEntities, x as useEntity, ie as useEntityHistory, ae as useEntityStatistics, oe as useForecast, se as useHassConfig, Zt as useIntersectionPause, S as useLocale, Qt as useReducedMotion, Je as useService, le as useStore, ue as useTemperatureUnit, Ze as useToggle, Xe as useTurnOff, Ye as useTurnOn, me as useUnitSystem, t as useWidgetContext, $t as useWidgetDialog, $e as useWidgetDimensions, en as useWidgetEntityGroup, dn as useWidgetGestures, gn as widgetFields, c as z };