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