@glasshome/widget-sdk 1.1.1 → 1.2.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/framework/fields.d.ts +6 -2
- package/dist/index.js +1254 -1368
- package/dist/schemas.js +2 -15
- package/dist/vite/index.js +258 -305
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,1404 +1,1290 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* container queries on the
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
/* === Slot: text === */
|
|
193
|
-
.glasshome-widget-title {
|
|
194
|
-
font-size: var(--widget-title-size);
|
|
195
|
-
line-height: 1.2;
|
|
196
|
-
color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);
|
|
197
|
-
overflow: hidden;
|
|
198
|
-
text-overflow: ellipsis;
|
|
199
|
-
white-space: nowrap;
|
|
200
|
-
}
|
|
201
|
-
.glasshome-widget-subtitle {
|
|
202
|
-
font-size: var(--widget-subtitle);
|
|
203
|
-
color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);
|
|
204
|
-
}
|
|
205
|
-
.glasshome-widget-status {
|
|
206
|
-
font-size: var(--widget-status-size);
|
|
207
|
-
font-weight: 700;
|
|
208
|
-
color: var(--color-foreground, currentColor);
|
|
209
|
-
line-height: 1.1;
|
|
210
|
-
}
|
|
211
|
-
.glasshome-widget-value {
|
|
212
|
-
font-size: var(--widget-value-size);
|
|
213
|
-
font-weight: 700;
|
|
214
|
-
color: var(--color-foreground, currentColor);
|
|
215
|
-
line-height: 1.05;
|
|
216
|
-
}
|
|
217
|
-
.glasshome-widget-badge {
|
|
218
|
-
font-size: var(--widget-badge-size);
|
|
219
|
-
font-weight: 500;
|
|
220
|
-
padding: 0.125rem 0.5rem;
|
|
221
|
-
border-radius: 9999px;
|
|
222
|
-
background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);
|
|
223
|
-
color: var(--color-foreground, currentColor);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.glasshome-widget-loading {
|
|
227
|
-
background: color-mix(in oklch, var(--widget-color) 20%, transparent);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/* === Slider fill ===
|
|
231
|
-
* Value flows in via --widget-fill-value (0-100). Vertical orientation auto-
|
|
232
|
-
* detected via container query. */
|
|
233
|
-
.glasshome-widget-slider-fill {
|
|
234
|
-
--widget-fill-value: 0;
|
|
235
|
-
background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);
|
|
236
|
-
box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)
|
|
237
|
-
color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);
|
|
238
|
-
clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);
|
|
239
|
-
}
|
|
240
|
-
@container widget (max-aspect-ratio: 1) {
|
|
241
|
-
.glasshome-widget-slider-fill {
|
|
242
|
-
clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
`;
|
|
246
|
-
let re = !1, Q;
|
|
247
|
-
const he = /* @__PURE__ */ new WeakSet();
|
|
248
|
-
function He() {
|
|
249
|
-
return Q || (Q = new CSSStyleSheet(), Q.replaceSync(
|
|
250
|
-
ve.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)")
|
|
251
|
-
)), Q;
|
|
1
|
+
import { WidgetManifestSchema as e, formatSchemaError as t } from "./schemas.js";
|
|
2
|
+
import { z as n } from "zod";
|
|
3
|
+
import { getForecasts as r, getStream as i, getWebRtcClientConfig as a, sendWebRtcCandidate as o, startWebRtcSession as s, state as c, trackEntityHistory as l, untrackEntityHistory as u } from "@glasshome/sync-layer";
|
|
4
|
+
import { byDomain as d, useArea as f, useCamera as p, useConnection as m, useCurrency as h, useEntities as g, useEntity as _, useEntityHistory as v, useEntityStatistics as ee, useForecast as y, useHassConfig as b, useLocale as te, useService as x, useStore as ne, useTemperatureUnit as re, useToggle as ie, useTurnOff as S, useTurnOn as ae, useUnitSystem as oe } from "@glasshome/sync-layer/solid";
|
|
5
|
+
import { Show as C, createContext as se, createEffect as ce, createMemo as w, createSignal as T, on as le, onCleanup as E, onMount as ue, splitProps as de, useContext as D } from "solid-js";
|
|
6
|
+
import { addEventListener as O, className as k, createComponent as A, delegateEvents as fe, effect as j, insert as M, memo as N, setStyleProperty as P, style as pe, template as F, use as me } from "solid-js/web";
|
|
7
|
+
import { createElementSize as he } from "@solid-primitives/resize-observer";
|
|
8
|
+
import { clsx as ge } from "clsx";
|
|
9
|
+
import { twMerge as _e } from "tailwind-merge";
|
|
10
|
+
//#region src/framework/to-form-schema.ts
|
|
11
|
+
function ve(e) {
|
|
12
|
+
return n.toJSONSchema(e, { override: (e) => {
|
|
13
|
+
let t = n.globalRegistry.get(e.zodSchema);
|
|
14
|
+
return t && typeof t == "object" && Object.keys(t).length > 0 ? {
|
|
15
|
+
...e.jsonSchema,
|
|
16
|
+
...t
|
|
17
|
+
} : e.jsonSchema;
|
|
18
|
+
} });
|
|
19
|
+
}
|
|
20
|
+
function ye(e) {
|
|
21
|
+
try {
|
|
22
|
+
return e.parse({});
|
|
23
|
+
} catch {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/define-widget.ts
|
|
29
|
+
function be(e) {
|
|
30
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = ve(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = ye(e.configSchema))), e;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/framework/hooks/use-widget-context.ts
|
|
34
|
+
var I = se();
|
|
35
|
+
function xe() {
|
|
36
|
+
let e = D(I);
|
|
37
|
+
if (!e) throw Error("useWidgetContext must be used within a Widget component");
|
|
38
|
+
return e;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/framework/hooks/use-service.ts
|
|
42
|
+
function Se(e) {
|
|
43
|
+
let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
|
|
44
|
+
if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
|
|
45
|
+
return n;
|
|
46
|
+
}
|
|
47
|
+
function L(e, t) {
|
|
48
|
+
return (n, r = {}) => e(Se(n), t, r, { entity_id: n });
|
|
49
|
+
}
|
|
50
|
+
function Ce() {
|
|
51
|
+
let e = D(I)?.callService;
|
|
52
|
+
return e ? {
|
|
53
|
+
callService: e,
|
|
54
|
+
turnOn: L(e, "turn_on"),
|
|
55
|
+
turnOff: L(e, "turn_off"),
|
|
56
|
+
toggle: L(e, "toggle")
|
|
57
|
+
} : x();
|
|
58
|
+
}
|
|
59
|
+
function we() {
|
|
60
|
+
let e = D(I)?.callService;
|
|
61
|
+
return e ? L(e, "turn_on") : ae();
|
|
62
|
+
}
|
|
63
|
+
function Te() {
|
|
64
|
+
let e = D(I)?.callService;
|
|
65
|
+
return e ? L(e, "turn_off") : S();
|
|
66
|
+
}
|
|
67
|
+
function Ee() {
|
|
68
|
+
let e = D(I)?.callService;
|
|
69
|
+
return e ? L(e, "toggle") : ie();
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/framework/design-system/z-index.ts
|
|
73
|
+
var R = {
|
|
74
|
+
BACKGROUND: 0,
|
|
75
|
+
CONTENT: 10,
|
|
76
|
+
OVERLAY: 20,
|
|
77
|
+
ACTIONS: 30
|
|
78
|
+
}, De = "/* 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", z = !1, B, Oe = /* @__PURE__ */ new WeakSet();
|
|
79
|
+
function ke() {
|
|
80
|
+
return B || (B = new CSSStyleSheet(), B.replaceSync(De.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), B;
|
|
81
|
+
}
|
|
82
|
+
function Ae(e) {
|
|
83
|
+
if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
|
|
84
|
+
if (Oe.has(e)) return;
|
|
85
|
+
let t = ke();
|
|
86
|
+
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), Oe.add(e);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (z) return;
|
|
90
|
+
let t = e ?? (typeof document > "u" ? void 0 : document);
|
|
91
|
+
if (!t) return;
|
|
92
|
+
if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
|
|
93
|
+
z = !0;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
let n = t.createElement("style");
|
|
97
|
+
n.setAttribute("data-glasshome-tokens", ""), n.textContent = De, t.head.appendChild(n), z = !0;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/framework/utils/cn.ts
|
|
101
|
+
function V(...e) {
|
|
102
|
+
return _e(ge(e));
|
|
103
|
+
}
|
|
104
|
+
var je = {
|
|
105
|
+
"classic-glass": {
|
|
106
|
+
id: "classic-glass",
|
|
107
|
+
name: "Classic Glass",
|
|
108
|
+
description: "Default glassmorphism design with blur background and gradient",
|
|
109
|
+
styles: {
|
|
110
|
+
cssVars: {
|
|
111
|
+
"--widget-bg": "rgba(255, 255, 255, 0.1)",
|
|
112
|
+
"--widget-border": "rgba(255, 255, 255, 0.2)",
|
|
113
|
+
"--widget-blur": "12px",
|
|
114
|
+
"--widget-shadow": "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
115
|
+
"--widget-padding": "1.5rem"
|
|
116
|
+
},
|
|
117
|
+
class: "backdrop-blur-xl"
|
|
118
|
+
},
|
|
119
|
+
layout: {
|
|
120
|
+
type: "flex",
|
|
121
|
+
direction: "column",
|
|
122
|
+
align: "start",
|
|
123
|
+
justify: "start",
|
|
124
|
+
gap: "0.75rem"
|
|
125
|
+
},
|
|
126
|
+
interactions: {
|
|
127
|
+
hover: !0,
|
|
128
|
+
active: !0,
|
|
129
|
+
focus: !0,
|
|
130
|
+
hoverScale: 1.02,
|
|
131
|
+
activeScale: .98
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
minimal: {
|
|
135
|
+
id: "minimal",
|
|
136
|
+
name: "Minimal",
|
|
137
|
+
description: "Clean, minimal design with no background effects",
|
|
138
|
+
styles: { cssVars: {
|
|
139
|
+
"--widget-bg": "transparent",
|
|
140
|
+
"--widget-border": "rgba(255, 255, 255, 0.1)",
|
|
141
|
+
"--widget-padding": "1rem"
|
|
142
|
+
} },
|
|
143
|
+
layout: {
|
|
144
|
+
type: "flex",
|
|
145
|
+
direction: "column",
|
|
146
|
+
align: "start",
|
|
147
|
+
justify: "start",
|
|
148
|
+
gap: "0.5rem"
|
|
149
|
+
},
|
|
150
|
+
elements: { visible: {
|
|
151
|
+
background: !1,
|
|
152
|
+
decorations: !1
|
|
153
|
+
} },
|
|
154
|
+
interactions: {
|
|
155
|
+
hover: !1,
|
|
156
|
+
active: !1,
|
|
157
|
+
focus: !0
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"compact-horizontal": {
|
|
161
|
+
id: "compact-horizontal",
|
|
162
|
+
name: "Compact Horizontal",
|
|
163
|
+
description: "Horizontal layout for compact widgets",
|
|
164
|
+
styles: {
|
|
165
|
+
cssVars: {
|
|
166
|
+
"--widget-bg": "rgba(255, 255, 255, 0.08)",
|
|
167
|
+
"--widget-border": "rgba(255, 255, 255, 0.15)",
|
|
168
|
+
"--widget-blur": "10px",
|
|
169
|
+
"--widget-padding": "1rem",
|
|
170
|
+
"--widget-icon-size": "2.5rem"
|
|
171
|
+
},
|
|
172
|
+
class: "backdrop-blur-lg"
|
|
173
|
+
},
|
|
174
|
+
layout: {
|
|
175
|
+
type: "flex",
|
|
176
|
+
direction: "row",
|
|
177
|
+
align: "center",
|
|
178
|
+
justify: "start",
|
|
179
|
+
gap: "1rem"
|
|
180
|
+
},
|
|
181
|
+
interactions: {
|
|
182
|
+
hover: !0,
|
|
183
|
+
active: !0,
|
|
184
|
+
focus: !0,
|
|
185
|
+
hoverScale: 1.02,
|
|
186
|
+
activeScale: .98
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
function Me(e) {
|
|
191
|
+
return je[e];
|
|
252
192
|
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/framework/backgrounds/WidgetSliderFill.tsx
|
|
195
|
+
var Ne = /*#__PURE__*/ F("<div>");
|
|
253
196
|
function Pe(e) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
"--widget-blur": "12px",
|
|
282
|
-
"--widget-shadow": "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
283
|
-
"--widget-padding": "1.5rem"
|
|
284
|
-
},
|
|
285
|
-
class: "backdrop-blur-xl"
|
|
286
|
-
},
|
|
287
|
-
layout: {
|
|
288
|
-
type: "flex",
|
|
289
|
-
direction: "column",
|
|
290
|
-
align: "start",
|
|
291
|
-
justify: "start",
|
|
292
|
-
gap: "0.75rem"
|
|
293
|
-
},
|
|
294
|
-
interactions: {
|
|
295
|
-
hover: !0,
|
|
296
|
-
active: !0,
|
|
297
|
-
focus: !0,
|
|
298
|
-
hoverScale: 1.02,
|
|
299
|
-
activeScale: 0.98
|
|
300
|
-
}
|
|
301
|
-
}, Le = {
|
|
302
|
-
id: "minimal",
|
|
303
|
-
name: "Minimal",
|
|
304
|
-
description: "Clean, minimal design with no background effects",
|
|
305
|
-
styles: {
|
|
306
|
-
cssVars: {
|
|
307
|
-
"--widget-bg": "transparent",
|
|
308
|
-
"--widget-border": "rgba(255, 255, 255, 0.1)",
|
|
309
|
-
"--widget-padding": "1rem"
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
layout: {
|
|
313
|
-
type: "flex",
|
|
314
|
-
direction: "column",
|
|
315
|
-
align: "start",
|
|
316
|
-
justify: "start",
|
|
317
|
-
gap: "0.5rem"
|
|
318
|
-
},
|
|
319
|
-
elements: {
|
|
320
|
-
visible: {
|
|
321
|
-
background: !1,
|
|
322
|
-
decorations: !1
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
interactions: {
|
|
326
|
-
hover: !1,
|
|
327
|
-
active: !1,
|
|
328
|
-
focus: !0
|
|
329
|
-
}
|
|
330
|
-
}, Ue = {
|
|
331
|
-
id: "compact-horizontal",
|
|
332
|
-
name: "Compact Horizontal",
|
|
333
|
-
description: "Horizontal layout for compact widgets",
|
|
334
|
-
styles: {
|
|
335
|
-
cssVars: {
|
|
336
|
-
"--widget-bg": "rgba(255, 255, 255, 0.08)",
|
|
337
|
-
"--widget-border": "rgba(255, 255, 255, 0.15)",
|
|
338
|
-
"--widget-blur": "10px",
|
|
339
|
-
"--widget-padding": "1rem",
|
|
340
|
-
"--widget-icon-size": "2.5rem"
|
|
341
|
-
},
|
|
342
|
-
class: "backdrop-blur-lg"
|
|
343
|
-
},
|
|
344
|
-
layout: {
|
|
345
|
-
type: "flex",
|
|
346
|
-
direction: "row",
|
|
347
|
-
align: "center",
|
|
348
|
-
justify: "start",
|
|
349
|
-
gap: "1rem"
|
|
350
|
-
},
|
|
351
|
-
interactions: {
|
|
352
|
-
hover: !0,
|
|
353
|
-
active: !0,
|
|
354
|
-
focus: !0,
|
|
355
|
-
hoverScale: 1.02,
|
|
356
|
-
activeScale: 0.98
|
|
357
|
-
}
|
|
358
|
-
}, je = {
|
|
359
|
-
"classic-glass": Ie,
|
|
360
|
-
minimal: Le,
|
|
361
|
-
"compact-horizontal": Ue
|
|
362
|
-
};
|
|
197
|
+
return (() => {
|
|
198
|
+
var t = Ne();
|
|
199
|
+
return j((n) => {
|
|
200
|
+
var r = V("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), i = {
|
|
201
|
+
"--widget-fill-value": e.value,
|
|
202
|
+
"z-index": R.BACKGROUND,
|
|
203
|
+
...e.color ? { "--widget-icon-color": e.color } : {}
|
|
204
|
+
};
|
|
205
|
+
return r !== n.e && k(t, n.e = r), n.t = pe(t, i, n.t), n;
|
|
206
|
+
}, {
|
|
207
|
+
e: void 0,
|
|
208
|
+
t: void 0
|
|
209
|
+
}), t;
|
|
210
|
+
})();
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/framework/components/WidgetContent.tsx
|
|
214
|
+
var Fe = /*#__PURE__*/ F("<div>");
|
|
215
|
+
function Ie(e) {
|
|
216
|
+
return (() => {
|
|
217
|
+
var t = Fe();
|
|
218
|
+
return M(t, () => e.children), j(() => k(t, V("glasshome-widget-content", e.class))), t;
|
|
219
|
+
})();
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/framework/components/WidgetIcon.tsx
|
|
223
|
+
var Le = /*#__PURE__*/ F("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), Re = /*#__PURE__*/ F("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), ze = /*#__PURE__*/ F("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
|
|
363
224
|
function Be(e) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
var
|
|
225
|
+
let t = () => e.entityCount ?? 1;
|
|
226
|
+
return (() => {
|
|
227
|
+
var n = ze(), r = n.firstChild;
|
|
228
|
+
return M(n, A(C, {
|
|
229
|
+
get when() {
|
|
230
|
+
return t() >= 2;
|
|
231
|
+
},
|
|
232
|
+
get children() {
|
|
233
|
+
return Le();
|
|
234
|
+
}
|
|
235
|
+
}), r), M(n, A(C, {
|
|
236
|
+
get when() {
|
|
237
|
+
return t() >= 3;
|
|
238
|
+
},
|
|
239
|
+
get children() {
|
|
240
|
+
return Re();
|
|
241
|
+
}
|
|
242
|
+
}), r), M(r, () => e.icon), j((t) => {
|
|
243
|
+
var r = V("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), i = e.color ? { "--widget-icon-color": e.color } : void 0;
|
|
244
|
+
return r !== t.e && k(n, t.e = r), t.t = pe(n, i, t.t), t;
|
|
245
|
+
}, {
|
|
246
|
+
e: void 0,
|
|
247
|
+
t: void 0
|
|
248
|
+
}), n;
|
|
249
|
+
})();
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/framework/components/WidgetStatus.tsx
|
|
253
|
+
var Ve = /*#__PURE__*/ F("<p>");
|
|
254
|
+
function He(e) {
|
|
255
|
+
return (() => {
|
|
256
|
+
var t = Ve();
|
|
257
|
+
return M(t, (() => {
|
|
258
|
+
var t = N(() => !!e.isUnavailable);
|
|
259
|
+
return () => t() ? "Unavailable" : e.children;
|
|
260
|
+
})()), j((n) => {
|
|
261
|
+
var r = V("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = R.ACTIONS;
|
|
262
|
+
return r !== n.e && k(t, n.e = r), i !== n.t && P(t, "z-index", n.t = i), n;
|
|
263
|
+
}, {
|
|
264
|
+
e: void 0,
|
|
265
|
+
t: void 0
|
|
266
|
+
}), t;
|
|
267
|
+
})();
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/framework/components/WidgetTitle.tsx
|
|
271
|
+
var Ue = /*#__PURE__*/ F("<span class=\"glasshome-widget-badge shrink-0\">"), We = /*#__PURE__*/ F("<div><h3 class=glasshome-widget-title>");
|
|
367
272
|
function Ge(e) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
|
|
273
|
+
return (() => {
|
|
274
|
+
var t = We(), n = t.firstChild;
|
|
275
|
+
return M(n, () => e.children), M(t, A(C, {
|
|
276
|
+
get when() {
|
|
277
|
+
return N(() => e.badge !== void 0)() && e.badge > 0;
|
|
278
|
+
},
|
|
279
|
+
get children() {
|
|
280
|
+
var t = Ue();
|
|
281
|
+
return M(t, () => e.badge), t;
|
|
282
|
+
}
|
|
283
|
+
}), null), j((n) => {
|
|
284
|
+
var r = V("relative flex items-center gap-2", e.class), i = R.ACTIONS;
|
|
285
|
+
return r !== n.e && k(t, n.e = r), i !== n.t && P(t, "z-index", n.t = i), n;
|
|
286
|
+
}, {
|
|
287
|
+
e: void 0,
|
|
288
|
+
t: void 0
|
|
289
|
+
}), t;
|
|
290
|
+
})();
|
|
291
|
+
}
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/framework/utils/entity-aggregation.ts
|
|
294
|
+
function Ke(e, t = !1) {
|
|
295
|
+
if (e.length === 0) return {
|
|
296
|
+
isGroup: !1,
|
|
297
|
+
state: "unknown",
|
|
298
|
+
isOn: !1,
|
|
299
|
+
isUnavailable: !0,
|
|
300
|
+
brightness: 0,
|
|
301
|
+
brightnessPercent: 0,
|
|
302
|
+
color: "rgb(100, 100, 100)",
|
|
303
|
+
onCount: 0,
|
|
304
|
+
totalCount: 0,
|
|
305
|
+
description: "No entities"
|
|
306
|
+
};
|
|
307
|
+
let n = e.length > 1;
|
|
308
|
+
if (!n) {
|
|
309
|
+
let t = e[0], n = t.state === "on", r = t.attributes?.brightness || 0, i = Math.round(r / 255 * 100);
|
|
310
|
+
return {
|
|
311
|
+
isGroup: !1,
|
|
312
|
+
state: t.state,
|
|
313
|
+
isOn: n,
|
|
314
|
+
isUnavailable: t.state === "unavailable",
|
|
315
|
+
brightness: r,
|
|
316
|
+
brightnessPercent: i,
|
|
317
|
+
color: Je(t),
|
|
318
|
+
onCount: +!!n,
|
|
319
|
+
totalCount: 1,
|
|
320
|
+
description: n ? "On" : "Off"
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
let r = 0, i = 0, a = 0, o = 0, s = 0, c = 0, l = [];
|
|
324
|
+
for (let t of e) switch (t.state) {
|
|
325
|
+
case "on":
|
|
326
|
+
r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color && l.push(t.attributes.rgb_color);
|
|
327
|
+
break;
|
|
328
|
+
case "off":
|
|
329
|
+
i++;
|
|
330
|
+
break;
|
|
331
|
+
case "unknown":
|
|
332
|
+
a++;
|
|
333
|
+
break;
|
|
334
|
+
case "unavailable":
|
|
335
|
+
o++;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
let u = e.length, d = o === u, f = a + o === u, p = r > 0, m = r === u, h = i === u, g, _;
|
|
339
|
+
t ? d ? (g = "unavailable", _ = !1) : a > 0 || o > 0 ? (g = "unknown", _ = !1) : i > 0 ? (g = "off", _ = !1) : (g = "on", _ = !0) : d ? (g = "unavailable", _ = !1) : f ? (g = "unknown", _ = !1) : p ? (g = "on", _ = !0) : (g = "off", _ = !1);
|
|
340
|
+
let v = c > 0 ? Math.round(s / c) : 0, ee = Math.round(v / 255 * 100), y;
|
|
341
|
+
if (l.length > 0) {
|
|
342
|
+
let e = Math.round(l.reduce((e, t) => e + t[0], 0) / l.length), t = Math.round(l.reduce((e, t) => e + t[1], 0) / l.length), n = Math.round(l.reduce((e, t) => e + t[2], 0) / l.length), r = v / 255;
|
|
343
|
+
y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
|
|
344
|
+
} else y = Je(e[0]);
|
|
345
|
+
let b;
|
|
346
|
+
return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
|
|
347
|
+
isGroup: n,
|
|
348
|
+
state: g,
|
|
349
|
+
isOn: _,
|
|
350
|
+
isUnavailable: g === "unavailable",
|
|
351
|
+
brightness: v,
|
|
352
|
+
brightnessPercent: ee,
|
|
353
|
+
color: y,
|
|
354
|
+
onCount: r,
|
|
355
|
+
totalCount: u,
|
|
356
|
+
description: b
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function qe(e, t = "mean", n = !0) {
|
|
360
|
+
if (e.length === 0) return {
|
|
361
|
+
isGroup: !1,
|
|
362
|
+
state: "unknown",
|
|
363
|
+
numericValue: null,
|
|
364
|
+
isUnavailable: !0,
|
|
365
|
+
description: "No entities"
|
|
366
|
+
};
|
|
367
|
+
let r = e.length > 1;
|
|
368
|
+
if (!r) {
|
|
369
|
+
let t = e[0], n = Number.parseFloat(t.state), r = t.state;
|
|
370
|
+
return Number.isNaN(n) || (r = Number.isInteger(n) ? n.toString() : n.toFixed(1)), {
|
|
371
|
+
isGroup: !1,
|
|
372
|
+
state: r,
|
|
373
|
+
numericValue: Number.isNaN(n) ? null : n,
|
|
374
|
+
isUnavailable: t.state === "unavailable",
|
|
375
|
+
unit: t.unitOfMeasurement ?? void 0,
|
|
376
|
+
description: r
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
let i = [], a = [], o = 0, s;
|
|
380
|
+
for (let t of e) {
|
|
381
|
+
if (!s && t.unitOfMeasurement && (s = t.unitOfMeasurement), t.state === "unavailable") {
|
|
382
|
+
o++, a.push({
|
|
383
|
+
entityId: t.id,
|
|
384
|
+
value: "unavailable",
|
|
385
|
+
friendly_name: t.friendlyName
|
|
386
|
+
});
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
let e = Number.parseFloat(t.state);
|
|
390
|
+
isNaN(e) ? n || a.push({
|
|
391
|
+
entityId: t.id,
|
|
392
|
+
value: t.state,
|
|
393
|
+
friendly_name: t.friendlyName
|
|
394
|
+
}) : (i.push(e), a.push({
|
|
395
|
+
entityId: t.id,
|
|
396
|
+
value: e,
|
|
397
|
+
friendly_name: t.friendlyName
|
|
398
|
+
}));
|
|
399
|
+
}
|
|
400
|
+
let c = o === e.length, l = i.length === 0;
|
|
401
|
+
if (c || l) return {
|
|
402
|
+
isGroup: r,
|
|
403
|
+
state: c ? "unavailable" : "unknown",
|
|
404
|
+
numericValue: null,
|
|
405
|
+
isUnavailable: c,
|
|
406
|
+
unit: s,
|
|
407
|
+
description: c ? "Unavailable" : "No numeric values",
|
|
408
|
+
memberValues: a
|
|
409
|
+
};
|
|
410
|
+
let u, d;
|
|
411
|
+
switch (t) {
|
|
412
|
+
case "min":
|
|
413
|
+
u = Math.min(...i), d = "Minimum";
|
|
414
|
+
break;
|
|
415
|
+
case "max":
|
|
416
|
+
u = Math.max(...i), d = "Maximum";
|
|
417
|
+
break;
|
|
418
|
+
case "mean":
|
|
419
|
+
u = i.reduce((e, t) => e + t, 0) / i.length, d = "Average";
|
|
420
|
+
break;
|
|
421
|
+
case "median": {
|
|
422
|
+
let e = [...i].sort((e, t) => e - t), t = Math.floor(e.length / 2);
|
|
423
|
+
u = e.length % 2 == 0 ? (e[t - 1] + e[t]) / 2 : e[t], d = "Median";
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
case "sum":
|
|
427
|
+
u = i.reduce((e, t) => e + t, 0), d = "Sum";
|
|
428
|
+
break;
|
|
429
|
+
case "last":
|
|
430
|
+
u = i[i.length - 1], d = "Latest";
|
|
431
|
+
break;
|
|
432
|
+
case "range":
|
|
433
|
+
u = Math.max(...i) - Math.min(...i), d = "Range";
|
|
434
|
+
break;
|
|
435
|
+
case "product":
|
|
436
|
+
u = i.reduce((e, t) => e * t, 1), d = "Product";
|
|
437
|
+
break;
|
|
438
|
+
case "std_dev": {
|
|
439
|
+
let e = i.reduce((e, t) => e + t, 0) / i.length, t = i.reduce((t, n) => t + (n - e) ** 2, 0) / i.length;
|
|
440
|
+
u = Math.sqrt(t), d = "Std Dev";
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
default: u = i.reduce((e, t) => e + t, 0) / i.length, d = "Average";
|
|
444
|
+
}
|
|
445
|
+
return {
|
|
446
|
+
isGroup: r,
|
|
447
|
+
state: Number.isInteger(u) ? u.toString() : u.toFixed(1),
|
|
448
|
+
numericValue: u,
|
|
449
|
+
isUnavailable: !1,
|
|
450
|
+
unit: s,
|
|
451
|
+
description: `${d} of ${i.length}`,
|
|
452
|
+
memberValues: a
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function Je(e) {
|
|
456
|
+
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
457
|
+
let t = (e.attributes?.brightness ?? 255) / 255;
|
|
458
|
+
if (e.attributes?.rgb_color) {
|
|
459
|
+
let [n, r, i] = e.attributes.rgb_color;
|
|
460
|
+
return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
|
|
461
|
+
}
|
|
462
|
+
if (e.attributes?.color_temp) {
|
|
463
|
+
let n = 1e6 / e.attributes.color_temp / 100, r, i, a;
|
|
464
|
+
return n <= 66 ? (r = 255, i = n <= 19 ? 0 : 99.4708025861 * Math.log(n - 10) - 161.1195681661, a = n <= 19 ? 0 : n <= 66 ? 138.5177312231 * Math.log(n - 10) - 305.0447927307 : 255) : (r = 329.698727446 * (n - 60) ** -.1332047592, i = 288.1221695283 * (n - 60) ** -.0755148492, a = 255), r = Math.max(0, Math.min(255, r)) * t, i = Math.max(0, Math.min(255, i)) * t, a = Math.max(0, Math.min(255, a)) * t, `rgb(${Math.round(r)}, ${Math.round(i)}, ${Math.round(a)})`;
|
|
465
|
+
}
|
|
466
|
+
return `rgb(${Math.round(255 * t)}, ${Math.round(220 * t)}, ${Math.round(180 * t)})`;
|
|
467
|
+
}
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/framework/utils/entity-state.ts
|
|
386
470
|
function Ye(e) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
471
|
+
if (!e) return !1;
|
|
472
|
+
if ([
|
|
473
|
+
"on",
|
|
474
|
+
"open",
|
|
475
|
+
"locked",
|
|
476
|
+
"home",
|
|
477
|
+
"playing",
|
|
478
|
+
"active"
|
|
479
|
+
].includes(e.state)) return !0;
|
|
480
|
+
if (e.domain === "sensor") {
|
|
481
|
+
let t = Number.parseFloat(e.state);
|
|
482
|
+
return !isNaN(t) && t > 0;
|
|
483
|
+
}
|
|
484
|
+
return !1;
|
|
485
|
+
}
|
|
486
|
+
function Xe(e, t, n) {
|
|
487
|
+
return e?.attributes ? e.attributes[t] ?? n : n;
|
|
488
|
+
}
|
|
489
|
+
function Ze(e) {
|
|
490
|
+
return e.filter(Ye).length;
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/framework/utils/format-value.ts
|
|
494
|
+
function Qe(e, t, n) {
|
|
495
|
+
let { decimals: r, scale: i = !0 } = n || {};
|
|
496
|
+
if (typeof e == "string") return t ? `${e}${t}` : e;
|
|
497
|
+
if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
|
|
498
|
+
let a = e, o = t || "";
|
|
499
|
+
i && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (a = e / 1e6, o = "MW") : e >= 1e3 ? (a = e / 1e3, o = "kW") : o = "W"), i && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (a = e / 1073741824, o = "GB") : e >= 1048576 ? (a = e / 1048576, o = "MB") : e >= 1024 ? (a = e / 1024, o = "KB") : o = "B");
|
|
500
|
+
let s;
|
|
501
|
+
return s = r === void 0 ? a === e ? Number.isInteger(e) ? e.toString() : Number.parseFloat(e.toFixed(2)).toString() : a.toFixed(1) : a.toFixed(r), o ? `${s}${o}` : s;
|
|
502
|
+
}
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region src/framework/utils/interpret-value.ts
|
|
505
|
+
function $e(e, t) {
|
|
506
|
+
return e == null || isNaN(e) ? null : t === "°C" ? e < 10 ? "Cold" : e < 18 ? "Cool" : e < 24 ? "Comfortable" : e < 28 ? "Warm" : "Hot" : t === "°F" ? e < 50 ? "Cold" : e < 64 ? "Cool" : e < 75 ? "Comfortable" : e < 82 ? "Warm" : "Hot" : t === "%" ? e < 20 ? "Very Low" : e < 40 ? "Low" : e < 60 ? "Medium" : e < 80 ? "High" : "Very High" : t === "ppm" ? e < 400 ? "Excellent" : e < 600 ? "Good" : e < 1e3 ? "Acceptable" : e < 1500 ? "Mediocre" : "Poor" : t === "lx" ? e < 50 ? "Dark" : e < 200 ? "Dim" : e < 500 ? "Moderate" : e < 1e3 ? "Bright" : "Very Bright" : t === "AQI" ? e <= 50 ? "Good" : e <= 100 ? "Moderate" : e <= 150 ? "Unhealthy for Sensitive" : e <= 200 ? "Unhealthy" : e <= 300 ? "Very Unhealthy" : "Hazardous" : t === "dB" ? e < 30 ? "Very Quiet" : e < 50 ? "Quiet" : e < 70 ? "Moderate" : e < 85 ? "Loud" : "Very Loud" : null;
|
|
507
|
+
}
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/framework/components/WidgetValue.tsx
|
|
510
|
+
var et = /*#__PURE__*/ F("<div class=glasshome-widget-subtitle>"), tt = /*#__PURE__*/ F("<div><div class=glasshome-widget-value>");
|
|
511
|
+
function nt(e) {
|
|
512
|
+
return (() => {
|
|
513
|
+
var t = tt(), n = t.firstChild;
|
|
514
|
+
return M(n, () => Qe(e.value, e.unit)), M(t, A(C, {
|
|
515
|
+
get when() {
|
|
516
|
+
return N(() => !!e.interpret)() && typeof e.value == "number";
|
|
517
|
+
},
|
|
518
|
+
get children() {
|
|
519
|
+
var t = et();
|
|
520
|
+
return M(t, () => $e(e.value, e.unit)), t;
|
|
521
|
+
}
|
|
522
|
+
}), null), j(() => k(t, V("flex flex-col", e.class))), t;
|
|
523
|
+
})();
|
|
524
|
+
}
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/framework/core/Widget.tsx
|
|
527
|
+
var rt = /*#__PURE__*/ F("<div><div class=\"relative h-full w-full\">"), it = /*#__PURE__*/ F("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), at = /*#__PURE__*/ F("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), ot = /*#__PURE__*/ F("<div class=\"flex items-center justify-center text-white/30\">"), st = /*#__PURE__*/ F("<h3 class=\"font-semibold text-sm text-white/60\">"), ct = /*#__PURE__*/ F("<p class=\"text-white/50 text-xs\">");
|
|
528
|
+
function lt(e) {
|
|
529
|
+
let t = D(I), [n, r] = T(), i = he(n);
|
|
530
|
+
ue(() => {
|
|
531
|
+
let e = n()?.getRootNode();
|
|
532
|
+
Ae(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
|
|
533
|
+
});
|
|
534
|
+
let a = {
|
|
535
|
+
isEditMode: () => e.isEditMode ?? !1,
|
|
536
|
+
updateConfig: t?.updateConfig ?? (() => {}),
|
|
537
|
+
registerDialogOpener: t?.registerDialogOpener,
|
|
538
|
+
callService: t?.callService,
|
|
539
|
+
dimensions: () => ({
|
|
540
|
+
width: i.width ?? 0,
|
|
541
|
+
height: i.height ?? 0
|
|
542
|
+
})
|
|
543
|
+
}, o = w(() => {
|
|
544
|
+
if (e.variant) return typeof e.variant == "string" ? Me(e.variant) : e.variant;
|
|
545
|
+
}), s = w(() => ({
|
|
546
|
+
"container-type": "size",
|
|
547
|
+
"container-name": "widget",
|
|
548
|
+
"touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
|
|
549
|
+
...o()?.styles?.container,
|
|
550
|
+
...o()?.styles?.cssVars || {},
|
|
551
|
+
...e.tone ? { "--widget-color": `var(--tone-${e.tone})` } : {},
|
|
552
|
+
...e.color ? { "--widget-color": e.color } : {},
|
|
553
|
+
...e.colorTo ? { "--widget-color-to": e.colorTo } : {},
|
|
554
|
+
...e.gradient ? { "--widget-gradient": e.gradient } : {}
|
|
555
|
+
})), c = () => !!e.gestures && !e.isEditMode, l = (t) => {
|
|
556
|
+
c() && e.gestures?.onPointerEnter(t);
|
|
557
|
+
}, u = (t) => {
|
|
558
|
+
c() && e.gestures?.onPointerDown(t);
|
|
559
|
+
}, d = (t) => {
|
|
560
|
+
c() && e.gestures?.onPointerMove(t);
|
|
561
|
+
}, f = (t) => {
|
|
562
|
+
c() && e.gestures?.onPointerUp(t);
|
|
563
|
+
}, p = (t) => {
|
|
564
|
+
c() && e.gestures?.onPointerCancel(t);
|
|
565
|
+
};
|
|
566
|
+
return A(I.Provider, {
|
|
567
|
+
value: a,
|
|
568
|
+
get children() {
|
|
569
|
+
var t = rt(), n = t.firstChild;
|
|
570
|
+
return O(t, "pointercancel", p), O(t, "pointerup", f), O(t, "pointermove", d), O(t, "pointerdown", u), O(t, "pointerenter", l), me((t) => {
|
|
571
|
+
r(t), e.gestures?.bindElement(t);
|
|
572
|
+
}, t), M(n, (() => {
|
|
573
|
+
var t = N(() => !!e.emptyState);
|
|
574
|
+
return () => t() ? A(ut, {
|
|
575
|
+
get icon() {
|
|
576
|
+
return e.emptyState.icon;
|
|
577
|
+
},
|
|
578
|
+
get title() {
|
|
579
|
+
return e.emptyState.title;
|
|
580
|
+
},
|
|
581
|
+
get message() {
|
|
582
|
+
return e.emptyState.message;
|
|
583
|
+
}
|
|
584
|
+
}) : e.children;
|
|
585
|
+
})()), M(t, (() => {
|
|
586
|
+
var t = N(() => !!e.loading);
|
|
587
|
+
return () => t() && (() => {
|
|
588
|
+
var e = it();
|
|
589
|
+
return j((t) => P(e, "z-index", R.OVERLAY)), e;
|
|
590
|
+
})();
|
|
591
|
+
})(), null), j((r) => {
|
|
592
|
+
var i = V("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", o()?.styles?.class, e.class), a = s(), c = R.CONTENT;
|
|
593
|
+
return i !== r.e && k(t, r.e = i), r.t = pe(t, a, r.t), c !== r.a && P(n, "z-index", r.a = c), r;
|
|
594
|
+
}, {
|
|
595
|
+
e: void 0,
|
|
596
|
+
t: void 0,
|
|
597
|
+
a: void 0
|
|
598
|
+
}), t;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
421
601
|
}
|
|
422
|
-
var Ze = /* @__PURE__ */ x("<p>");
|
|
423
|
-
function et(e) {
|
|
424
|
-
return (() => {
|
|
425
|
-
var t = Ze();
|
|
426
|
-
return p(t, (() => {
|
|
427
|
-
var i = T(() => !!e.isUnavailable);
|
|
428
|
-
return () => i() ? "Unavailable" : e.children;
|
|
429
|
-
})()), W((i) => {
|
|
430
|
-
var r = R("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), n = J.ACTIONS;
|
|
431
|
-
return r !== i.e && I(t, i.e = r), n !== i.t && ee(t, "z-index", i.t = n), i;
|
|
432
|
-
}, {
|
|
433
|
-
e: void 0,
|
|
434
|
-
t: void 0
|
|
435
|
-
}), t;
|
|
436
|
-
})();
|
|
437
|
-
}
|
|
438
|
-
var tt = /* @__PURE__ */ x('<span class="glasshome-widget-badge shrink-0">'), nt = /* @__PURE__ */ x("<div><h3 class=glasshome-widget-title>");
|
|
439
|
-
function it(e) {
|
|
440
|
-
return (() => {
|
|
441
|
-
var t = nt(), i = t.firstChild;
|
|
442
|
-
return p(i, () => e.children), p(t, k(E, {
|
|
443
|
-
get when() {
|
|
444
|
-
return T(() => e.badge !== void 0)() && e.badge > 0;
|
|
445
|
-
},
|
|
446
|
-
get children() {
|
|
447
|
-
var r = tt();
|
|
448
|
-
return p(r, () => e.badge), r;
|
|
449
|
-
}
|
|
450
|
-
}), null), W((r) => {
|
|
451
|
-
var n = R("relative flex items-center gap-2", e.class), o = J.ACTIONS;
|
|
452
|
-
return n !== r.e && I(t, r.e = n), o !== r.t && ee(t, "z-index", r.t = o), r;
|
|
453
|
-
}, {
|
|
454
|
-
e: void 0,
|
|
455
|
-
t: void 0
|
|
456
|
-
}), t;
|
|
457
|
-
})();
|
|
458
|
-
}
|
|
459
|
-
function rt(e, t = !1) {
|
|
460
|
-
if (e.length === 0)
|
|
461
|
-
return {
|
|
462
|
-
isGroup: !1,
|
|
463
|
-
state: "unknown",
|
|
464
|
-
isOn: !1,
|
|
465
|
-
isUnavailable: !0,
|
|
466
|
-
brightness: 0,
|
|
467
|
-
brightnessPercent: 0,
|
|
468
|
-
color: "rgb(100, 100, 100)",
|
|
469
|
-
onCount: 0,
|
|
470
|
-
totalCount: 0,
|
|
471
|
-
description: "No entities"
|
|
472
|
-
};
|
|
473
|
-
const i = e.length > 1;
|
|
474
|
-
if (!i) {
|
|
475
|
-
const s = e[0], f = s.state === "on", b = s.attributes?.brightness || 0, S = Math.round(b / 255 * 100);
|
|
476
|
-
return {
|
|
477
|
-
isGroup: !1,
|
|
478
|
-
state: s.state,
|
|
479
|
-
isOn: f,
|
|
480
|
-
isUnavailable: s.state === "unavailable",
|
|
481
|
-
brightness: b,
|
|
482
|
-
brightnessPercent: S,
|
|
483
|
-
color: fe(s),
|
|
484
|
-
onCount: f ? 1 : 0,
|
|
485
|
-
totalCount: 1,
|
|
486
|
-
description: f ? "On" : "Off"
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
let r = 0, n = 0, o = 0, u = 0, d = 0, $ = 0;
|
|
490
|
-
const m = [];
|
|
491
|
-
for (const s of e)
|
|
492
|
-
switch (s.state) {
|
|
493
|
-
case "on":
|
|
494
|
-
r++, s.attributes?.brightness !== void 0 && (d += s.attributes.brightness, $++), s.attributes?.rgb_color && m.push(s.attributes.rgb_color);
|
|
495
|
-
break;
|
|
496
|
-
case "off":
|
|
497
|
-
n++;
|
|
498
|
-
break;
|
|
499
|
-
case "unknown":
|
|
500
|
-
o++;
|
|
501
|
-
break;
|
|
502
|
-
case "unavailable":
|
|
503
|
-
u++;
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
const h = e.length, v = u === h, y = o + u === h, g = r > 0, a = r === h, C = n === h;
|
|
507
|
-
let w, M;
|
|
508
|
-
t ? v ? (w = "unavailable", M = !1) : o > 0 || u > 0 ? (w = "unknown", M = !1) : n > 0 ? (w = "off", M = !1) : (w = "on", M = !0) : v ? (w = "unavailable", M = !1) : y ? (w = "unknown", M = !1) : g ? (w = "on", M = !0) : (w = "off", M = !1);
|
|
509
|
-
const O = $ > 0 ? Math.round(d / $) : 0, L = Math.round(O / 255 * 100);
|
|
510
|
-
let F;
|
|
511
|
-
if (m.length > 0) {
|
|
512
|
-
const s = Math.round(m.reduce((z, D) => z + D[0], 0) / m.length), f = Math.round(m.reduce((z, D) => z + D[1], 0) / m.length), b = Math.round(m.reduce((z, D) => z + D[2], 0) / m.length), S = O / 255;
|
|
513
|
-
F = `rgb(${Math.round(s * S)}, ${Math.round(f * S)}, ${Math.round(b * S)})`;
|
|
514
|
-
} else
|
|
515
|
-
F = fe(e[0]);
|
|
516
|
-
let H;
|
|
517
|
-
return a ? H = "All on" : C ? H = "All off" : r > 0 ? H = `${r} of ${h} on` : H = "Off", {
|
|
518
|
-
isGroup: i,
|
|
519
|
-
state: w,
|
|
520
|
-
isOn: M,
|
|
521
|
-
isUnavailable: w === "unavailable",
|
|
522
|
-
brightness: O,
|
|
523
|
-
brightnessPercent: L,
|
|
524
|
-
color: F,
|
|
525
|
-
onCount: r,
|
|
526
|
-
totalCount: h,
|
|
527
|
-
description: H
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
function ot(e, t = "mean", i = !0) {
|
|
531
|
-
if (e.length === 0)
|
|
532
|
-
return {
|
|
533
|
-
isGroup: !1,
|
|
534
|
-
state: "unknown",
|
|
535
|
-
numericValue: null,
|
|
536
|
-
isUnavailable: !0,
|
|
537
|
-
description: "No entities"
|
|
538
|
-
};
|
|
539
|
-
const r = e.length > 1;
|
|
540
|
-
if (!r) {
|
|
541
|
-
const g = e[0], a = Number.parseFloat(g.state);
|
|
542
|
-
let C = g.state;
|
|
543
|
-
return Number.isNaN(a) || (C = Number.isInteger(a) ? a.toString() : a.toFixed(1)), {
|
|
544
|
-
isGroup: !1,
|
|
545
|
-
state: C,
|
|
546
|
-
numericValue: Number.isNaN(a) ? null : a,
|
|
547
|
-
isUnavailable: g.state === "unavailable",
|
|
548
|
-
unit: g.unitOfMeasurement ?? void 0,
|
|
549
|
-
description: C
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
const n = [], o = [];
|
|
553
|
-
let u = 0, d;
|
|
554
|
-
for (const g of e) {
|
|
555
|
-
if (!d && g.unitOfMeasurement && (d = g.unitOfMeasurement), g.state === "unavailable") {
|
|
556
|
-
u++, o.push({
|
|
557
|
-
entityId: g.id,
|
|
558
|
-
value: "unavailable",
|
|
559
|
-
friendly_name: g.friendlyName
|
|
560
|
-
});
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
const a = Number.parseFloat(g.state);
|
|
564
|
-
isNaN(a) ? i || o.push({
|
|
565
|
-
entityId: g.id,
|
|
566
|
-
value: g.state,
|
|
567
|
-
friendly_name: g.friendlyName
|
|
568
|
-
}) : (n.push(a), o.push({
|
|
569
|
-
entityId: g.id,
|
|
570
|
-
value: a,
|
|
571
|
-
friendly_name: g.friendlyName
|
|
572
|
-
}));
|
|
573
|
-
}
|
|
574
|
-
const $ = u === e.length, m = n.length === 0;
|
|
575
|
-
if ($ || m)
|
|
576
|
-
return {
|
|
577
|
-
isGroup: r,
|
|
578
|
-
state: $ ? "unavailable" : "unknown",
|
|
579
|
-
numericValue: null,
|
|
580
|
-
isUnavailable: $,
|
|
581
|
-
unit: d,
|
|
582
|
-
description: $ ? "Unavailable" : "No numeric values",
|
|
583
|
-
memberValues: o
|
|
584
|
-
};
|
|
585
|
-
let h, v;
|
|
586
|
-
switch (t) {
|
|
587
|
-
case "min":
|
|
588
|
-
h = Math.min(...n), v = "Minimum";
|
|
589
|
-
break;
|
|
590
|
-
case "max":
|
|
591
|
-
h = Math.max(...n), v = "Maximum";
|
|
592
|
-
break;
|
|
593
|
-
case "mean":
|
|
594
|
-
h = n.reduce((g, a) => g + a, 0) / n.length, v = "Average";
|
|
595
|
-
break;
|
|
596
|
-
case "median": {
|
|
597
|
-
const g = [...n].sort((C, w) => C - w), a = Math.floor(g.length / 2);
|
|
598
|
-
h = g.length % 2 === 0 ? (g[a - 1] + g[a]) / 2 : g[a], v = "Median";
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
case "sum":
|
|
602
|
-
h = n.reduce((g, a) => g + a, 0), v = "Sum";
|
|
603
|
-
break;
|
|
604
|
-
case "last":
|
|
605
|
-
h = n[n.length - 1], v = "Latest";
|
|
606
|
-
break;
|
|
607
|
-
case "range":
|
|
608
|
-
h = Math.max(...n) - Math.min(...n), v = "Range";
|
|
609
|
-
break;
|
|
610
|
-
case "product":
|
|
611
|
-
h = n.reduce((g, a) => g * a, 1), v = "Product";
|
|
612
|
-
break;
|
|
613
|
-
case "std_dev": {
|
|
614
|
-
const g = n.reduce((C, w) => C + w, 0) / n.length, a = n.reduce((C, w) => C + (w - g) ** 2, 0) / n.length;
|
|
615
|
-
h = Math.sqrt(a), v = "Std Dev";
|
|
616
|
-
break;
|
|
617
|
-
}
|
|
618
|
-
default:
|
|
619
|
-
h = n.reduce((g, a) => g + a, 0) / n.length, v = "Average";
|
|
620
|
-
}
|
|
621
|
-
const y = Number.isInteger(h) ? h.toString() : h.toFixed(1);
|
|
622
|
-
return {
|
|
623
|
-
isGroup: r,
|
|
624
|
-
state: y,
|
|
625
|
-
numericValue: h,
|
|
626
|
-
isUnavailable: !1,
|
|
627
|
-
unit: d,
|
|
628
|
-
description: `${v} of ${n.length}`,
|
|
629
|
-
memberValues: o
|
|
630
|
-
};
|
|
631
|
-
}
|
|
632
|
-
function fe(e) {
|
|
633
|
-
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
634
|
-
const i = (e.attributes?.brightness ?? 255) / 255;
|
|
635
|
-
if (e.attributes?.rgb_color) {
|
|
636
|
-
const [r, n, o] = e.attributes.rgb_color;
|
|
637
|
-
return `rgb(${Math.round(r * i)}, ${Math.round(n * i)}, ${Math.round(o * i)})`;
|
|
638
|
-
}
|
|
639
|
-
if (e.attributes?.color_temp) {
|
|
640
|
-
const n = 1e6 / e.attributes.color_temp / 100;
|
|
641
|
-
let o, u, d;
|
|
642
|
-
return n <= 66 ? (o = 255, u = n <= 19 ? 0 : 99.4708025861 * Math.log(n - 10) - 161.1195681661, d = n <= 19 ? 0 : n <= 66 ? 138.5177312231 * Math.log(n - 10) - 305.0447927307 : 255) : (o = 329.698727446 * (n - 60) ** -0.1332047592, u = 288.1221695283 * (n - 60) ** -0.0755148492, d = 255), o = Math.max(0, Math.min(255, o)) * i, u = Math.max(0, Math.min(255, u)) * i, d = Math.max(0, Math.min(255, d)) * i, `rgb(${Math.round(o)}, ${Math.round(u)}, ${Math.round(d)})`;
|
|
643
|
-
}
|
|
644
|
-
return `rgb(${Math.round(255 * i)}, ${Math.round(220 * i)}, ${Math.round(180 * i)})`;
|
|
645
|
-
}
|
|
646
|
-
function at(e) {
|
|
647
|
-
if (!e) return !1;
|
|
648
|
-
if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
|
|
649
|
-
return !0;
|
|
650
|
-
if (e.domain === "sensor") {
|
|
651
|
-
const t = Number.parseFloat(e.state);
|
|
652
|
-
return !isNaN(t) && t > 0;
|
|
653
|
-
}
|
|
654
|
-
return !1;
|
|
655
|
-
}
|
|
656
|
-
function rn(e, t, i) {
|
|
657
|
-
return e?.attributes ? e.attributes[t] ?? i : i;
|
|
658
|
-
}
|
|
659
|
-
function on(e) {
|
|
660
|
-
return e.filter(at).length;
|
|
661
|
-
}
|
|
662
|
-
function st(e, t, i) {
|
|
663
|
-
const { decimals: r, scale: n = !0 } = {};
|
|
664
|
-
if (typeof e == "string")
|
|
665
|
-
return t ? `${e}${t}` : e;
|
|
666
|
-
if (e == null || Number.isNaN(e))
|
|
667
|
-
return t ? `--${t}` : "--";
|
|
668
|
-
let o = e, u = t || "";
|
|
669
|
-
n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (o = e / 1e6, u = "MW") : e >= 1e3 ? (o = e / 1e3, u = "kW") : u = "W"), n && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (o = e / 1073741824, u = "GB") : e >= 1048576 ? (o = e / 1048576, u = "MB") : e >= 1024 ? (o = e / 1024, u = "KB") : u = "B");
|
|
670
|
-
let d;
|
|
671
|
-
return r !== void 0 ? d = o.toFixed(r) : o !== e ? d = o.toFixed(1) : Number.isInteger(e) ? d = e.toString() : d = Number.parseFloat(e.toFixed(2)).toString(), u ? `${d}${u}` : d;
|
|
672
|
-
}
|
|
673
|
-
function lt(e, t) {
|
|
674
|
-
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;
|
|
675
|
-
}
|
|
676
|
-
var ct = /* @__PURE__ */ x("<div class=glasshome-widget-subtitle>"), dt = /* @__PURE__ */ x("<div><div class=glasshome-widget-value>");
|
|
677
602
|
function ut(e) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
},
|
|
961
|
-
get children() {
|
|
962
|
-
return k(f, {
|
|
963
|
-
size: "sm",
|
|
964
|
-
get disabled() {
|
|
965
|
-
return !z();
|
|
966
|
-
},
|
|
967
|
-
onClick: () => D()?.(),
|
|
968
|
-
children: "Save"
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
}), null), p(c, k(E, {
|
|
972
|
-
get when() {
|
|
973
|
-
return T(() => y() === "debug")() && t.debugData !== void 0;
|
|
974
|
-
},
|
|
975
|
-
get children() {
|
|
976
|
-
return k(f, {
|
|
977
|
-
size: "sm",
|
|
978
|
-
variant: "outline",
|
|
979
|
-
onClick: w,
|
|
980
|
-
children: "Copy"
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
}), null), c;
|
|
984
|
-
}
|
|
985
|
-
})];
|
|
986
|
-
}
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
Ce(["click"]);
|
|
992
|
-
function sn(e) {
|
|
993
|
-
if (typeof IntersectionObserver > "u")
|
|
994
|
-
return () => !1;
|
|
995
|
-
const [t, i] = V(!1), r = new IntersectionObserver((n) => {
|
|
996
|
-
const o = n[0];
|
|
997
|
-
o && i(!o.isIntersecting);
|
|
998
|
-
});
|
|
999
|
-
return se(() => {
|
|
1000
|
-
const n = e();
|
|
1001
|
-
r.disconnect(), n && r.observe(n);
|
|
1002
|
-
}), ce(() => r.disconnect()), t;
|
|
1003
|
-
}
|
|
1004
|
-
function ln() {
|
|
1005
|
-
if (typeof window > "u" || typeof window.matchMedia != "function")
|
|
1006
|
-
return () => !1;
|
|
1007
|
-
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, i] = V(e.matches), r = (n) => i(n.matches);
|
|
1008
|
-
return e.addEventListener("change", r), ce(() => e.removeEventListener("change", r)), t;
|
|
1009
|
-
}
|
|
1010
|
-
function cn(e = "controls") {
|
|
1011
|
-
const [t, i] = V(!1), [r, n] = V(e), o = (d) => {
|
|
1012
|
-
n(d ?? e), i(!0);
|
|
1013
|
-
}, u = B(P);
|
|
1014
|
-
return u?.registerDialogOpener?.(o), ce(() => u?.registerDialogOpener?.(null)), {
|
|
1015
|
-
showDialog: t,
|
|
1016
|
-
setShowDialog: i,
|
|
1017
|
-
openDialog: o,
|
|
1018
|
-
closeDialog: () => i(!1),
|
|
1019
|
-
activeTab: r,
|
|
1020
|
-
setActiveTab: n,
|
|
1021
|
-
dialogProps: {
|
|
1022
|
-
get open() {
|
|
1023
|
-
return t();
|
|
1024
|
-
},
|
|
1025
|
-
onOpenChange: i,
|
|
1026
|
-
get activeTab() {
|
|
1027
|
-
return r();
|
|
1028
|
-
},
|
|
1029
|
-
onActiveTabChange: n
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
1033
|
-
function dn(e) {
|
|
1034
|
-
const t = e.minEntities ?? 1, i = j(() => e.entities().length), r = j(() => i() >= t), n = j(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), o = j(() => {
|
|
1035
|
-
if (!r()) return;
|
|
1036
|
-
const d = e.aggregationMode?.();
|
|
1037
|
-
if (!d || d === "none") return;
|
|
1038
|
-
const $ = e.entities();
|
|
1039
|
-
if (d === "light" || d === "binary-sensor" || d === "switch")
|
|
1040
|
-
return rt($, e.allEntitiesMode);
|
|
1041
|
-
if (d === "sensor") {
|
|
1042
|
-
const m = e.sensorGroupType?.() ?? "mean";
|
|
1043
|
-
return ot($, m, !0);
|
|
1044
|
-
}
|
|
1045
|
-
}), u = j(() => r() ? void 0 : e.emptyStateConfig);
|
|
1046
|
-
return {
|
|
1047
|
-
entities: e.entities,
|
|
1048
|
-
groupData: n,
|
|
1049
|
-
aggregatedData: o,
|
|
1050
|
-
emptyState: u,
|
|
1051
|
-
hasEntities: r,
|
|
1052
|
-
count: i
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
const X = 32, l = X / 2, _ = "white", te = "rgba(0,0,0,0.4)", de = 2, ne = 3;
|
|
1056
|
-
function Nt(e) {
|
|
1057
|
-
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
1058
|
-
}
|
|
1059
|
-
function ie(e) {
|
|
1060
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${X}" viewBox="0 0 ${X} ${X}">${e}</svg>`;
|
|
1061
|
-
}
|
|
1062
|
-
const At = ie(`
|
|
603
|
+
return (() => {
|
|
604
|
+
var t = at();
|
|
605
|
+
return M(t, (() => {
|
|
606
|
+
var t = N(() => !!e.icon);
|
|
607
|
+
return () => t() && (() => {
|
|
608
|
+
var t = ot();
|
|
609
|
+
return M(t, () => e.icon), t;
|
|
610
|
+
})();
|
|
611
|
+
})(), null), M(t, (() => {
|
|
612
|
+
var t = N(() => !!e.title);
|
|
613
|
+
return () => t() && (() => {
|
|
614
|
+
var t = st();
|
|
615
|
+
return M(t, () => e.title), t;
|
|
616
|
+
})();
|
|
617
|
+
})(), null), M(t, (() => {
|
|
618
|
+
var t = N(() => !!e.message);
|
|
619
|
+
return () => t() && (() => {
|
|
620
|
+
var t = ct();
|
|
621
|
+
return M(t, () => e.message), t;
|
|
622
|
+
})();
|
|
623
|
+
})(), null), t;
|
|
624
|
+
})();
|
|
625
|
+
}
|
|
626
|
+
var H = lt;
|
|
627
|
+
H.Content = Ie, H.Icon = Be, H.Title = Ge, H.Status = He, H.Value = nt, H.SliderFill = Pe;
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/framework/dialogs/WidgetDialog.tsx
|
|
630
|
+
var dt = /*#__PURE__*/ F("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), ft = /*#__PURE__*/ F("<button type=button>"), pt = /*#__PURE__*/ F("<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\">"), mt = /*#__PURE__*/ F("<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"), ht = /*#__PURE__*/ F("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>"), gt = /*#__PURE__*/ F("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), _t = /*#__PURE__*/ F("<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\">"), vt = /*#__PURE__*/ F("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No debug information available"), yt = /*#__PURE__*/ F("<div class=\"min-w-0 shrink-0\">"), bt = /*#__PURE__*/ F("<div class=\"flex items-center gap-2\"><div class=\"flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5\">"), xt = /*#__PURE__*/ F("<div class=\"min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]\">"), St = /*#__PURE__*/ F("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3\">");
|
|
631
|
+
function Ct(e) {
|
|
632
|
+
return (() => {
|
|
633
|
+
var t = ft();
|
|
634
|
+
return t.$$click = () => e.onClick(), M(t, A(C, {
|
|
635
|
+
get when() {
|
|
636
|
+
return e.isActive;
|
|
637
|
+
},
|
|
638
|
+
get children() {
|
|
639
|
+
var t = dt();
|
|
640
|
+
return M(t, () => e.icon), t;
|
|
641
|
+
}
|
|
642
|
+
}), null), M(t, () => e.label, null), j(() => k(t, V("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
|
|
643
|
+
})();
|
|
644
|
+
}
|
|
645
|
+
function wt(e) {
|
|
646
|
+
let [t] = de(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] = T({}), [a, o] = T(null);
|
|
647
|
+
ce(le(() => t.config, (e) => {
|
|
648
|
+
e && i({ ...e });
|
|
649
|
+
})), ce(le(() => t.configSchema, (e) => {
|
|
650
|
+
e && o(ve(e));
|
|
651
|
+
}));
|
|
652
|
+
let s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), c = (e) => {
|
|
653
|
+
!e && t.config && i({ ...t.config }), t.onOpenChange(e);
|
|
654
|
+
}, l = () => {
|
|
655
|
+
t.onConfigSave?.(r());
|
|
656
|
+
}, [u, d] = T(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
|
|
657
|
+
t.onActiveTabChange ? t.onActiveTabChange(e) : d(e);
|
|
658
|
+
}, m = () => ({
|
|
659
|
+
sm: "max-w-sm",
|
|
660
|
+
md: "max-w-md",
|
|
661
|
+
lg: "max-w-lg",
|
|
662
|
+
xl: "max-w-xl",
|
|
663
|
+
"2xl": "max-w-2xl",
|
|
664
|
+
"3xl": "max-w-3xl",
|
|
665
|
+
"4xl": "max-w-4xl"
|
|
666
|
+
})[t.maxWidth ?? "3xl"], h = () => {
|
|
667
|
+
if (t.tabs) return t.tabs;
|
|
668
|
+
let e = [];
|
|
669
|
+
return e.push({
|
|
670
|
+
id: "edit",
|
|
671
|
+
label: "Edit",
|
|
672
|
+
icon: pt(),
|
|
673
|
+
content: t.editContent ?? (n() && a() ? A(ne, {
|
|
674
|
+
get schema() {
|
|
675
|
+
return a();
|
|
676
|
+
},
|
|
677
|
+
get data() {
|
|
678
|
+
return r();
|
|
679
|
+
},
|
|
680
|
+
onChange: i
|
|
681
|
+
}) : mt())
|
|
682
|
+
}), e.push({
|
|
683
|
+
id: "controls",
|
|
684
|
+
label: "Controls",
|
|
685
|
+
icon: ht(),
|
|
686
|
+
content: t.controlsContent ?? gt()
|
|
687
|
+
}), e.push({
|
|
688
|
+
id: "debug",
|
|
689
|
+
label: "Debug",
|
|
690
|
+
icon: _t(),
|
|
691
|
+
content: t.debugContent ?? vt()
|
|
692
|
+
}), e;
|
|
693
|
+
}, g = async () => {
|
|
694
|
+
if (t.debugData !== void 0) try {
|
|
695
|
+
let e = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
|
|
696
|
+
await navigator.clipboard.writeText(e);
|
|
697
|
+
} catch {}
|
|
698
|
+
}, _ = () => {
|
|
699
|
+
let e = h();
|
|
700
|
+
return e.find((e) => e.id === f())?.content ?? e[0]?.content;
|
|
701
|
+
}, 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;
|
|
702
|
+
return A(v, {
|
|
703
|
+
get open() {
|
|
704
|
+
return t.open;
|
|
705
|
+
},
|
|
706
|
+
onOpenChange: (e) => re(e),
|
|
707
|
+
get children() {
|
|
708
|
+
return A(ee, {
|
|
709
|
+
get class() {
|
|
710
|
+
return V(m(), t.class);
|
|
711
|
+
},
|
|
712
|
+
get children() {
|
|
713
|
+
return [
|
|
714
|
+
A(y, {
|
|
715
|
+
class: "flex flex-row items-center justify-between gap-3",
|
|
716
|
+
get children() {
|
|
717
|
+
return [(() => {
|
|
718
|
+
var e = yt();
|
|
719
|
+
return M(e, A(b, {
|
|
720
|
+
class: "truncate leading-tight",
|
|
721
|
+
get children() {
|
|
722
|
+
return t.title;
|
|
723
|
+
}
|
|
724
|
+
}), null), M(e, A(te, {
|
|
725
|
+
class: "sr-only",
|
|
726
|
+
children: "Widget configuration dialog"
|
|
727
|
+
}), null), e;
|
|
728
|
+
})(), (() => {
|
|
729
|
+
var e = bt(), n = e.firstChild;
|
|
730
|
+
return M(n, () => h().map((e) => A(Ct, {
|
|
731
|
+
get icon() {
|
|
732
|
+
return e.icon;
|
|
733
|
+
},
|
|
734
|
+
get label() {
|
|
735
|
+
return e.label;
|
|
736
|
+
},
|
|
737
|
+
get isActive() {
|
|
738
|
+
return f() === e.id;
|
|
739
|
+
},
|
|
740
|
+
onClick: () => p(e.id)
|
|
741
|
+
}))), M(e, A(C, {
|
|
742
|
+
get when() {
|
|
743
|
+
return t.headerActions;
|
|
744
|
+
},
|
|
745
|
+
get children() {
|
|
746
|
+
return t.headerActions;
|
|
747
|
+
}
|
|
748
|
+
}), null), e;
|
|
749
|
+
})()];
|
|
750
|
+
}
|
|
751
|
+
}),
|
|
752
|
+
(() => {
|
|
753
|
+
var e = xt();
|
|
754
|
+
return M(e, _), e;
|
|
755
|
+
})(),
|
|
756
|
+
A(C, {
|
|
757
|
+
get when() {
|
|
758
|
+
return N(() => f() === "edit")() && (S() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
|
|
759
|
+
},
|
|
760
|
+
get children() {
|
|
761
|
+
var e = St();
|
|
762
|
+
return M(e, A(C, {
|
|
763
|
+
get when() {
|
|
764
|
+
return N(() => f() === "edit")() && t.onDelete;
|
|
765
|
+
},
|
|
766
|
+
get children() {
|
|
767
|
+
return A(x, {
|
|
768
|
+
size: "sm",
|
|
769
|
+
variant: "destructive",
|
|
770
|
+
onClick: () => t.onDelete?.(),
|
|
771
|
+
children: "Delete"
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
}), null), M(e, A(C, {
|
|
775
|
+
get when() {
|
|
776
|
+
return N(() => f() === "edit")() && S();
|
|
777
|
+
},
|
|
778
|
+
get children() {
|
|
779
|
+
return A(x, {
|
|
780
|
+
size: "sm",
|
|
781
|
+
get disabled() {
|
|
782
|
+
return !ie();
|
|
783
|
+
},
|
|
784
|
+
onClick: () => S()?.(),
|
|
785
|
+
children: "Save"
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}), null), M(e, A(C, {
|
|
789
|
+
get when() {
|
|
790
|
+
return N(() => f() === "debug")() && t.debugData !== void 0;
|
|
791
|
+
},
|
|
792
|
+
get children() {
|
|
793
|
+
return A(x, {
|
|
794
|
+
size: "sm",
|
|
795
|
+
variant: "outline",
|
|
796
|
+
onClick: g,
|
|
797
|
+
children: "Copy"
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
}), null), e;
|
|
801
|
+
}
|
|
802
|
+
})
|
|
803
|
+
];
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
fe(["click"]);
|
|
810
|
+
//#endregion
|
|
811
|
+
//#region src/framework/hooks/use-intersection-pause.ts
|
|
812
|
+
function Tt(e) {
|
|
813
|
+
if (typeof IntersectionObserver > "u") return () => !1;
|
|
814
|
+
let [t, n] = T(!1), r = new IntersectionObserver((e) => {
|
|
815
|
+
let t = e[0];
|
|
816
|
+
t && n(!t.isIntersecting);
|
|
817
|
+
});
|
|
818
|
+
return ce(() => {
|
|
819
|
+
let t = e();
|
|
820
|
+
r.disconnect(), t && r.observe(t);
|
|
821
|
+
}), E(() => r.disconnect()), t;
|
|
822
|
+
}
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/framework/hooks/use-reduced-motion.ts
|
|
825
|
+
function Et() {
|
|
826
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
|
|
827
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = T(e.matches), r = (e) => n(e.matches);
|
|
828
|
+
return e.addEventListener("change", r), E(() => e.removeEventListener("change", r)), t;
|
|
829
|
+
}
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/framework/hooks/use-widget-dialog.ts
|
|
832
|
+
function Dt(e = "controls") {
|
|
833
|
+
let [t, n] = T(!1), [r, i] = T(e), a = (t) => {
|
|
834
|
+
i(t ?? e), n(!0);
|
|
835
|
+
}, o = D(I);
|
|
836
|
+
return o?.registerDialogOpener?.(a), E(() => o?.registerDialogOpener?.(null)), {
|
|
837
|
+
showDialog: t,
|
|
838
|
+
setShowDialog: n,
|
|
839
|
+
openDialog: a,
|
|
840
|
+
closeDialog: () => n(!1),
|
|
841
|
+
activeTab: r,
|
|
842
|
+
setActiveTab: i,
|
|
843
|
+
dialogProps: {
|
|
844
|
+
get open() {
|
|
845
|
+
return t();
|
|
846
|
+
},
|
|
847
|
+
onOpenChange: n,
|
|
848
|
+
get activeTab() {
|
|
849
|
+
return r();
|
|
850
|
+
},
|
|
851
|
+
onActiveTabChange: i
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region src/framework/hooks/use-widget-entity-group.ts
|
|
857
|
+
function Ot(e) {
|
|
858
|
+
let t = e.minEntities ?? 1, n = w(() => e.entities().length), r = w(() => n() >= t), i = w(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = w(() => {
|
|
859
|
+
if (!r()) return;
|
|
860
|
+
let t = e.aggregationMode?.();
|
|
861
|
+
if (!t || t === "none") return;
|
|
862
|
+
let n = e.entities();
|
|
863
|
+
if (t === "light" || t === "binary-sensor" || t === "switch") return Ke(n, e.allEntitiesMode);
|
|
864
|
+
if (t === "sensor") return qe(n, e.sensorGroupType?.() ?? "mean", !0);
|
|
865
|
+
}), o = w(() => r() ? void 0 : e.emptyStateConfig);
|
|
866
|
+
return {
|
|
867
|
+
entities: e.entities,
|
|
868
|
+
groupData: i,
|
|
869
|
+
aggregatedData: a,
|
|
870
|
+
emptyState: o,
|
|
871
|
+
hasEntities: r,
|
|
872
|
+
count: n
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/framework/gestures/cursors.ts
|
|
877
|
+
var U = 32, W = U / 2, G = "white", K = "rgba(0,0,0,0.4)", q = 2, J = 3;
|
|
878
|
+
function kt(e) {
|
|
879
|
+
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
880
|
+
}
|
|
881
|
+
function Y(e) {
|
|
882
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${U}" viewBox="0 0 ${U} ${U}">${e}</svg>`;
|
|
883
|
+
}
|
|
884
|
+
var At = Y(`
|
|
1063
885
|
<g transform="translate(6, 2)">
|
|
1064
886
|
<!-- shadow -->
|
|
1065
|
-
<g stroke="${
|
|
887
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1066
888
|
<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"/>
|
|
1067
889
|
</g>
|
|
1068
890
|
<!-- main -->
|
|
1069
|
-
<g stroke="${
|
|
891
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1070
892
|
<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"/>
|
|
1071
893
|
</g>
|
|
1072
894
|
</g>
|
|
1073
|
-
`),
|
|
895
|
+
`), jt = Y(`
|
|
1074
896
|
<g>
|
|
1075
|
-
<circle cx="${
|
|
1076
|
-
<circle cx="${
|
|
1077
|
-
<circle cx="${
|
|
897
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${K}" stroke-width="${J}" fill="none"/>
|
|
898
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${G}" stroke-width="1.5" fill="none"/>
|
|
899
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
1078
900
|
</g>
|
|
1079
|
-
`),
|
|
901
|
+
`), Mt = Y(`
|
|
1080
902
|
<g>
|
|
1081
903
|
<!-- shadow -->
|
|
1082
|
-
<g stroke="${
|
|
1083
|
-
<line x1="6" y1="${
|
|
1084
|
-
<polyline points="10,${
|
|
1085
|
-
<polyline points="22,${
|
|
904
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
905
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
906
|
+
<polyline points="10,${W - 4} 6,${W} 10,20"/>
|
|
907
|
+
<polyline points="22,${W - 4} 26,${W} 22,20"/>
|
|
1086
908
|
</g>
|
|
1087
909
|
<!-- main -->
|
|
1088
|
-
<g stroke="${
|
|
1089
|
-
<line x1="6" y1="${
|
|
1090
|
-
<polyline points="10,${
|
|
1091
|
-
<polyline points="22,${
|
|
910
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
911
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
912
|
+
<polyline points="10,${W - 4} 6,${W} 10,20"/>
|
|
913
|
+
<polyline points="22,${W - 4} 26,${W} 22,20"/>
|
|
1092
914
|
</g>
|
|
1093
915
|
<!-- center grip dots -->
|
|
1094
|
-
<circle cx="${
|
|
1095
|
-
<circle cx="${
|
|
1096
|
-
<circle cx="
|
|
916
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
917
|
+
<circle cx="${W - 5}" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
918
|
+
<circle cx="21" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
1097
919
|
</g>
|
|
1098
|
-
`),
|
|
920
|
+
`), Nt = Y(`
|
|
1099
921
|
<g>
|
|
1100
922
|
<!-- shadow -->
|
|
1101
|
-
<g stroke="${
|
|
1102
|
-
<line x1="${
|
|
1103
|
-
<polyline points="${
|
|
1104
|
-
<polyline points="${
|
|
923
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
924
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
925
|
+
<polyline points="${W - 4},10 ${W},6 20,10"/>
|
|
926
|
+
<polyline points="${W - 4},22 ${W},26 20,22"/>
|
|
1105
927
|
</g>
|
|
1106
928
|
<!-- main -->
|
|
1107
|
-
<g stroke="${
|
|
1108
|
-
<line x1="${
|
|
1109
|
-
<polyline points="${
|
|
1110
|
-
<polyline points="${
|
|
929
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
930
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
931
|
+
<polyline points="${W - 4},10 ${W},6 20,10"/>
|
|
932
|
+
<polyline points="${W - 4},22 ${W},26 20,22"/>
|
|
1111
933
|
</g>
|
|
1112
934
|
<!-- center grip dots -->
|
|
1113
|
-
<circle cx="${
|
|
1114
|
-
<circle cx="${
|
|
1115
|
-
<circle cx="${
|
|
935
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
936
|
+
<circle cx="${W}" cy="${W - 5}" r="1" fill="${G}" opacity="0.6"/>
|
|
937
|
+
<circle cx="${W}" cy="21" r="1" fill="${G}" opacity="0.6"/>
|
|
938
|
+
</g>
|
|
939
|
+
`), Pt = Y(`
|
|
940
|
+
<g>
|
|
941
|
+
<!-- shadow -->
|
|
942
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
943
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
944
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
945
|
+
<polyline points="11,${W - 3} 7,${W} 11,19"/>
|
|
946
|
+
<polyline points="21,${W - 3} 25,${W} 21,19"/>
|
|
947
|
+
<polyline points="${W - 3},11 ${W},7 19,11"/>
|
|
948
|
+
<polyline points="${W - 3},21 ${W},25 19,21"/>
|
|
949
|
+
</g>
|
|
950
|
+
<!-- main -->
|
|
951
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
952
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
953
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
954
|
+
<polyline points="11,${W - 3} 7,${W} 11,19"/>
|
|
955
|
+
<polyline points="21,${W - 3} 25,${W} 21,19"/>
|
|
956
|
+
<polyline points="${W - 3},11 ${W},7 19,11"/>
|
|
957
|
+
<polyline points="${W - 3},21 ${W},25 19,21"/>
|
|
958
|
+
</g>
|
|
959
|
+
<!-- center dot -->
|
|
960
|
+
<circle cx="${W}" cy="${W}" r="2" fill="${G}"/>
|
|
1116
961
|
</g>
|
|
1117
962
|
`);
|
|
1118
|
-
function
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
}
|
|
1132
|
-
function ae(e) {
|
|
1133
|
-
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function"))
|
|
1134
|
-
try {
|
|
1135
|
-
navigator.vibrate(e);
|
|
1136
|
-
} catch {
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
const Ht = {
|
|
1140
|
-
/** Light confirmation — fires when slide gesture arms after user holds still. */
|
|
1141
|
-
tick() {
|
|
1142
|
-
const e = oe();
|
|
1143
|
-
if (e) {
|
|
1144
|
-
e.impact({ style: "Light" }).catch(() => {
|
|
1145
|
-
});
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
ae(8);
|
|
1149
|
-
},
|
|
1150
|
-
/** Medium bump — fires when hold gesture commits (detail opening). */
|
|
1151
|
-
bump() {
|
|
1152
|
-
const e = oe();
|
|
1153
|
-
if (e) {
|
|
1154
|
-
e.impact({ style: "Medium" }).catch(() => {
|
|
1155
|
-
});
|
|
1156
|
-
return;
|
|
1157
|
-
}
|
|
1158
|
-
ae(20);
|
|
1159
|
-
},
|
|
1160
|
-
/** Stronger pulse — reserved for edit-mode pickup (future use). */
|
|
1161
|
-
pulse() {
|
|
1162
|
-
const e = oe();
|
|
1163
|
-
if (e) {
|
|
1164
|
-
e.impact({ style: "Heavy" }).catch(() => {
|
|
1165
|
-
});
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
ae([0, 15, 40, 15]);
|
|
1169
|
-
}
|
|
963
|
+
function X(e, t, n) {
|
|
964
|
+
return {
|
|
965
|
+
css: `${kt(e)} ${t} ${n}, auto`,
|
|
966
|
+
hotspotX: t,
|
|
967
|
+
hotspotY: n
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
var Z = {
|
|
971
|
+
tap: X(At, 12, 4),
|
|
972
|
+
hold: X(jt, 16, 16),
|
|
973
|
+
slideHorizontal: X(Mt, W, W),
|
|
974
|
+
slideVertical: X(Nt, W, W),
|
|
975
|
+
slideAuto: X(Pt, W, W)
|
|
1170
976
|
};
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
} catch {
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
}, C = (s) => {
|
|
1217
|
-
if (!n.isDown) return;
|
|
1218
|
-
const f = e(), b = s.clientX - n.startX, S = s.clientY - n.startY;
|
|
1219
|
-
if (Math.sqrt(b * b + S * S) > 10 && (v(), n.hasMoved = !0), f.slide && n.hasMoved) {
|
|
1220
|
-
const D = s.currentTarget, c = g(D);
|
|
1221
|
-
if (n.isTouch && !n.sliding) {
|
|
1222
|
-
const $e = Math.abs(c === "vertical" ? S : b), ke = Math.abs(c === "vertical" ? b : S);
|
|
1223
|
-
if ($e < ke) return;
|
|
1224
|
-
}
|
|
1225
|
-
n.sliding = !0;
|
|
1226
|
-
const Y = f.slide.min ?? 0, N = f.slide.max ?? 100, we = N - Y, pe = c === "vertical" ? -S : b, ue = o ?? { width: D.clientWidth, height: D.clientHeight }, be = c === "vertical" ? ue.height : ue.width, xe = pe / be * we, ye = Math.max(Y, Math.min(N, f.slide.value + xe));
|
|
1227
|
-
f.slide.onChange(Math.round(ye)), n.startX = s.clientX, n.startY = s.clientY, s.preventDefault();
|
|
1228
|
-
}
|
|
1229
|
-
}, w = (s) => {
|
|
1230
|
-
const f = e(), b = n.isDown, S = Date.now() - n.startTime, z = f.hold?.delay ?? 300;
|
|
1231
|
-
v(), b && f.tap && !n.hasMoved && S < z && f.tap();
|
|
1232
|
-
try {
|
|
1233
|
-
s.currentTarget.releasePointerCapture(s.pointerId);
|
|
1234
|
-
} catch {
|
|
1235
|
-
}
|
|
1236
|
-
y();
|
|
1237
|
-
}, M = (s) => {
|
|
1238
|
-
v();
|
|
1239
|
-
try {
|
|
1240
|
-
s.currentTarget.releasePointerCapture(s.pointerId);
|
|
1241
|
-
} catch {
|
|
1242
|
-
}
|
|
1243
|
-
y();
|
|
1244
|
-
}, O = (s) => {
|
|
1245
|
-
const f = e();
|
|
1246
|
-
if (f.slide) {
|
|
1247
|
-
const b = f.slide.orientation;
|
|
1248
|
-
return b === "horizontal" ? U.slideHorizontal.css : b === "vertical" ? U.slideVertical.css : (o || h(s), o && o.height > o.width ? U.slideVertical.css : U.slideHorizontal.css);
|
|
1249
|
-
}
|
|
1250
|
-
return f.tap ? U.tap.css : f.hold ? U.hold.css : "";
|
|
1251
|
-
};
|
|
1252
|
-
return {
|
|
1253
|
-
onPointerDown: a,
|
|
1254
|
-
onPointerMove: C,
|
|
1255
|
-
onPointerUp: w,
|
|
1256
|
-
onPointerCancel: M,
|
|
1257
|
-
onPointerEnter: (s) => {
|
|
1258
|
-
const f = s.currentTarget;
|
|
1259
|
-
n.element = f, f.style.cursor = O(f);
|
|
1260
|
-
},
|
|
1261
|
-
bindElement: (s) => {
|
|
1262
|
-
s && (n.element = s, h(s));
|
|
1263
|
-
},
|
|
1264
|
-
touchAction: () => {
|
|
1265
|
-
const s = e();
|
|
1266
|
-
if (s.slide) {
|
|
1267
|
-
const f = s.slide.orientation;
|
|
1268
|
-
return f === "vertical" || f !== "horizontal" && ($() ?? (t?.() ?? "horizontal") !== "horizontal") ? "pan-x" : "pan-y";
|
|
1269
|
-
}
|
|
1270
|
-
return s.tap || s.hold ? "manipulation" : "auto";
|
|
1271
|
-
},
|
|
1272
|
-
dispose: () => {
|
|
1273
|
-
v(), d && (d.disconnect(), d = null), u = null, o = null;
|
|
1274
|
-
}
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
1277
|
-
const Pt = {
|
|
1278
|
-
solar: "oklch(0.74 0.18 60)",
|
|
1279
|
-
grid: "oklch(0.62 0.12 245)",
|
|
1280
|
-
battery: "oklch(0.70 0.18 145)",
|
|
1281
|
-
ev: "oklch(0.70 0.14 190)",
|
|
1282
|
-
home: "oklch(0.68 0.06 250)",
|
|
1283
|
-
positive: "oklch(0.70 0.14 160)",
|
|
1284
|
-
// Fault red-orange; used only for faults, never normal consumption.
|
|
1285
|
-
negative: "oklch(0.64 0.22 27)"
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/framework/gestures/haptics.ts
|
|
979
|
+
function Q() {
|
|
980
|
+
if (typeof window > "u") return null;
|
|
981
|
+
let e = window;
|
|
982
|
+
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
983
|
+
}
|
|
984
|
+
function $(e) {
|
|
985
|
+
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
|
|
986
|
+
navigator.vibrate(e);
|
|
987
|
+
} catch {}
|
|
988
|
+
}
|
|
989
|
+
var Ft = {
|
|
990
|
+
tick() {
|
|
991
|
+
let e = Q();
|
|
992
|
+
if (e) {
|
|
993
|
+
e.impact({ style: "Light" }).catch(() => {});
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
$(8);
|
|
997
|
+
},
|
|
998
|
+
bump() {
|
|
999
|
+
let e = Q();
|
|
1000
|
+
if (e) {
|
|
1001
|
+
e.impact({ style: "Medium" }).catch(() => {});
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
$(20);
|
|
1005
|
+
},
|
|
1006
|
+
pulse() {
|
|
1007
|
+
let e = Q();
|
|
1008
|
+
if (e) {
|
|
1009
|
+
e.impact({ style: "Heavy" }).catch(() => {});
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
$([
|
|
1013
|
+
0,
|
|
1014
|
+
15,
|
|
1015
|
+
40,
|
|
1016
|
+
15
|
|
1017
|
+
]);
|
|
1018
|
+
}
|
|
1286
1019
|
};
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region src/framework/gestures/use-widget-gestures.ts
|
|
1022
|
+
function It(e, t) {
|
|
1023
|
+
let n = {
|
|
1024
|
+
isDown: !1,
|
|
1025
|
+
isTouch: !1,
|
|
1026
|
+
startX: 0,
|
|
1027
|
+
startY: 0,
|
|
1028
|
+
startTime: 0,
|
|
1029
|
+
hasMoved: !1,
|
|
1030
|
+
sliding: !1,
|
|
1031
|
+
holdTimer: null,
|
|
1032
|
+
element: null
|
|
1033
|
+
}, r = null, i = null, a = null, [o, s] = T(null);
|
|
1034
|
+
function c(e) {
|
|
1035
|
+
e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
|
|
1036
|
+
let t = e[0];
|
|
1037
|
+
if (t) {
|
|
1038
|
+
let e = t.borderBoxSize?.[0];
|
|
1039
|
+
r = e ? {
|
|
1040
|
+
width: e.inlineSize,
|
|
1041
|
+
height: e.blockSize
|
|
1042
|
+
} : {
|
|
1043
|
+
width: t.contentRect.width,
|
|
1044
|
+
height: t.contentRect.height
|
|
1045
|
+
}, s(r.height > r.width);
|
|
1046
|
+
}
|
|
1047
|
+
}), i = e, a.observe(e), r = {
|
|
1048
|
+
width: e.clientWidth,
|
|
1049
|
+
height: e.clientHeight
|
|
1050
|
+
}, s(r.height > r.width));
|
|
1051
|
+
}
|
|
1052
|
+
let l = () => {
|
|
1053
|
+
n.holdTimer &&= (clearTimeout(n.holdTimer), null);
|
|
1054
|
+
}, u = () => {
|
|
1055
|
+
n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
|
|
1056
|
+
}, d = (n) => {
|
|
1057
|
+
let i = e().slide;
|
|
1058
|
+
return i?.orientation === "horizontal" ? "horizontal" : i?.orientation === "vertical" ? "vertical" : n && (r || c(n), r) ? r.height > r.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1059
|
+
}, f = (t) => {
|
|
1060
|
+
let r = e();
|
|
1061
|
+
if (!(!r.tap && !r.hold && !r.slide)) {
|
|
1062
|
+
if (n.isDown = !0, n.isTouch = t.pointerType === "touch", n.element = t.currentTarget, c(n.element), n.startX = t.clientX, n.startY = t.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, r.hold) {
|
|
1063
|
+
let e = r.hold.delay ?? 300;
|
|
1064
|
+
n.holdTimer = setTimeout(() => {
|
|
1065
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Ft.bump(), r.hold?.action(), n.isDown = !1);
|
|
1066
|
+
}, e);
|
|
1067
|
+
}
|
|
1068
|
+
if (!n.isTouch && r.slide) try {
|
|
1069
|
+
t.currentTarget.setPointerCapture(t.pointerId);
|
|
1070
|
+
} catch {}
|
|
1071
|
+
}
|
|
1072
|
+
}, p = (t) => {
|
|
1073
|
+
if (!n.isDown) return;
|
|
1074
|
+
let i = e(), a = t.clientX - n.startX, o = t.clientY - n.startY;
|
|
1075
|
+
if (Math.sqrt(a * a + o * o) > 10 && (l(), n.hasMoved = !0), i.slide && n.hasMoved) {
|
|
1076
|
+
let e = t.currentTarget, s = d(e);
|
|
1077
|
+
if (n.isTouch && !n.sliding && Math.abs(s === "vertical" ? o : a) < Math.abs(s === "vertical" ? a : o)) return;
|
|
1078
|
+
n.sliding = !0;
|
|
1079
|
+
let c = i.slide.min ?? 0, l = i.slide.max ?? 100, u = l - c, f = s === "vertical" ? -o : a, p = r ?? {
|
|
1080
|
+
width: e.clientWidth,
|
|
1081
|
+
height: e.clientHeight
|
|
1082
|
+
}, m = f / (s === "vertical" ? p.height : p.width) * u, h = Math.max(c, Math.min(l, i.slide.value + m));
|
|
1083
|
+
i.slide.onChange(Math.round(h)), n.startX = t.clientX, n.startY = t.clientY, t.preventDefault();
|
|
1084
|
+
}
|
|
1085
|
+
}, m = (t) => {
|
|
1086
|
+
let r = e(), i = n.isDown, a = Date.now() - n.startTime, o = r.hold?.delay ?? 300;
|
|
1087
|
+
l(), i && r.tap && !n.hasMoved && a < o && r.tap();
|
|
1088
|
+
try {
|
|
1089
|
+
t.currentTarget.releasePointerCapture(t.pointerId);
|
|
1090
|
+
} catch {}
|
|
1091
|
+
u();
|
|
1092
|
+
}, h = (e) => {
|
|
1093
|
+
l();
|
|
1094
|
+
try {
|
|
1095
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
1096
|
+
} catch {}
|
|
1097
|
+
u();
|
|
1098
|
+
}, g = (t) => {
|
|
1099
|
+
let n = e();
|
|
1100
|
+
if (n.slide) {
|
|
1101
|
+
let e = n.slide.orientation;
|
|
1102
|
+
return e === "horizontal" ? Z.slideHorizontal.css : e === "vertical" ? Z.slideVertical.css : (r || c(t), r && r.height > r.width ? Z.slideVertical.css : Z.slideHorizontal.css);
|
|
1103
|
+
}
|
|
1104
|
+
return n.tap ? Z.tap.css : n.hold ? Z.hold.css : "";
|
|
1105
|
+
};
|
|
1106
|
+
return {
|
|
1107
|
+
onPointerDown: f,
|
|
1108
|
+
onPointerMove: p,
|
|
1109
|
+
onPointerUp: m,
|
|
1110
|
+
onPointerCancel: h,
|
|
1111
|
+
onPointerEnter: (e) => {
|
|
1112
|
+
let t = e.currentTarget;
|
|
1113
|
+
n.element = t, t.style.cursor = g(t);
|
|
1114
|
+
},
|
|
1115
|
+
bindElement: (e) => {
|
|
1116
|
+
e && (n.element = e, c(e));
|
|
1117
|
+
},
|
|
1118
|
+
touchAction: () => {
|
|
1119
|
+
let n = e();
|
|
1120
|
+
if (n.slide) {
|
|
1121
|
+
let e = n.slide.orientation;
|
|
1122
|
+
return e === "vertical" || e !== "horizontal" && (o() ?? (t?.() ?? "horizontal") !== "horizontal") ? "pan-x" : "pan-y";
|
|
1123
|
+
}
|
|
1124
|
+
return n.tap || n.hold ? "manipulation" : "auto";
|
|
1125
|
+
},
|
|
1126
|
+
dispose: () => {
|
|
1127
|
+
l(), a &&= (a.disconnect(), null), i = null, r = null;
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region src/framework/theming/svg-colors.ts
|
|
1133
|
+
var Lt = {
|
|
1134
|
+
solar: "oklch(0.74 0.18 60)",
|
|
1135
|
+
grid: "oklch(0.62 0.12 245)",
|
|
1136
|
+
battery: "oklch(0.70 0.18 145)",
|
|
1137
|
+
ev: "oklch(0.70 0.14 190)",
|
|
1138
|
+
home: "oklch(0.68 0.06 250)",
|
|
1139
|
+
positive: "oklch(0.70 0.14 160)",
|
|
1140
|
+
negative: "oklch(0.64 0.22 27)"
|
|
1312
1141
|
};
|
|
1313
|
-
function
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
wn as SDK_VERSION,
|
|
1348
|
-
hn as ToneSchema,
|
|
1349
|
-
q as Widget,
|
|
1350
|
-
Ye as WidgetContent,
|
|
1351
|
-
P as WidgetCtx,
|
|
1352
|
-
an as WidgetDialog,
|
|
1353
|
-
Qe as WidgetIcon,
|
|
1354
|
-
xn as WidgetManifestSchema,
|
|
1355
|
-
Ge as WidgetSliderFill,
|
|
1356
|
-
et as WidgetStatus,
|
|
1357
|
-
it as WidgetTitle,
|
|
1358
|
-
ut as WidgetValue,
|
|
1359
|
-
kn as byDomain,
|
|
1360
|
-
rt as calculateLightGroup,
|
|
1361
|
-
ot as calculateSensorGroup,
|
|
1362
|
-
on as countActiveEntities,
|
|
1363
|
-
Jt as defineWidget,
|
|
1364
|
-
yn as formatSchemaError,
|
|
1365
|
-
rn as getEntityAttribute,
|
|
1366
|
-
Pn as getForecasts,
|
|
1367
|
-
In as getStream,
|
|
1368
|
-
Ln as getWebRtcClientConfig,
|
|
1369
|
-
Pe as injectTokens,
|
|
1370
|
-
vn as isDark,
|
|
1371
|
-
at as isEntityActive,
|
|
1372
|
-
mn as monotoneCubicPath,
|
|
1373
|
-
Un as sendWebRtcCandidate,
|
|
1374
|
-
jn as startWebRtcSession,
|
|
1375
|
-
Bn as state,
|
|
1376
|
-
gn as svgColors,
|
|
1377
|
-
Fn as trackEntityHistory,
|
|
1378
|
-
Gn as untrackEntityHistory,
|
|
1379
|
-
Sn as useArea,
|
|
1380
|
-
Cn as useCamera,
|
|
1381
|
-
Mn as useConnection,
|
|
1382
|
-
Dn as useCurrency,
|
|
1383
|
-
Tn as useEntities,
|
|
1384
|
-
_n as useEntity,
|
|
1385
|
-
On as useEntityHistory,
|
|
1386
|
-
zn as useEntityStatistics,
|
|
1387
|
-
En as useForecast,
|
|
1388
|
-
Nn as useHassConfig,
|
|
1389
|
-
sn as useIntersectionPause,
|
|
1390
|
-
An as useLocale,
|
|
1391
|
-
ln as useReducedMotion,
|
|
1392
|
-
Zt as useService,
|
|
1393
|
-
Vn as useStore,
|
|
1394
|
-
Wn as useTemperatureUnit,
|
|
1395
|
-
nn as useToggle,
|
|
1396
|
-
tn as useTurnOff,
|
|
1397
|
-
en as useTurnOn,
|
|
1398
|
-
Rn as useUnitSystem,
|
|
1399
|
-
Qt as useWidgetContext,
|
|
1400
|
-
cn as useWidgetDialog,
|
|
1401
|
-
dn as useWidgetEntityGroup,
|
|
1402
|
-
un as useWidgetGestures,
|
|
1403
|
-
fn as widgetFields
|
|
1142
|
+
function Rt(e) {
|
|
1143
|
+
return {
|
|
1144
|
+
fill: `color-mix(in oklch, ${e} 20%, transparent)`,
|
|
1145
|
+
stroke: e,
|
|
1146
|
+
solid: e
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
var zt = Object.fromEntries(Object.entries(Lt).map(([e, t]) => [e, Rt(t)])), Bt = n.enum([
|
|
1150
|
+
"success",
|
|
1151
|
+
"warning",
|
|
1152
|
+
"danger",
|
|
1153
|
+
"info",
|
|
1154
|
+
"neutral",
|
|
1155
|
+
"accent"
|
|
1156
|
+
]), Vt = {
|
|
1157
|
+
title: () => n.string().optional().meta({
|
|
1158
|
+
title: "Title",
|
|
1159
|
+
description: "Optional display name override"
|
|
1160
|
+
}),
|
|
1161
|
+
entityIds: (e, t) => n.array(n.string()).default([]).meta({
|
|
1162
|
+
domain: e,
|
|
1163
|
+
title: "Entities",
|
|
1164
|
+
...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
|
|
1165
|
+
}),
|
|
1166
|
+
singleEntity: (e, t) => n.array(n.string()).default([]).meta({
|
|
1167
|
+
domain: e,
|
|
1168
|
+
title: "Entity",
|
|
1169
|
+
singleSelect: !0,
|
|
1170
|
+
...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
|
|
1171
|
+
}),
|
|
1172
|
+
areaId: () => n.string().optional().meta({
|
|
1173
|
+
formType: "area-picker",
|
|
1174
|
+
title: "Area"
|
|
1175
|
+
})
|
|
1404
1176
|
};
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region src/shared/spline.ts
|
|
1179
|
+
function Ht(e) {
|
|
1180
|
+
if (e.length < 2) return "";
|
|
1181
|
+
let t = e[0], n = e[1];
|
|
1182
|
+
if (!t || !n) return "";
|
|
1183
|
+
if (e.length === 2) return `M ${t.x} ${t.y} L ${n.x} ${n.y}`;
|
|
1184
|
+
let r = e.length, i = [], a = [], o = [];
|
|
1185
|
+
for (let t = 0; t < r - 1; t++) {
|
|
1186
|
+
let n = e[t], r = e[t + 1];
|
|
1187
|
+
!n || !r || (i.push(r.x - n.x), a.push(r.y - n.y), o.push((r.y - n.y) / (r.x - n.x)));
|
|
1188
|
+
}
|
|
1189
|
+
let s = [o[0] ?? 0];
|
|
1190
|
+
for (let e = 1; e < r - 1; e++) {
|
|
1191
|
+
let t = o[e - 1] ?? 0, n = o[e] ?? 0, r = i[e - 1] ?? 0, a = i[e] ?? 0;
|
|
1192
|
+
t * n <= 0 ? s.push(0) : s.push(3 * (r + a) / ((2 * a + r) / t + (a + 2 * r) / n));
|
|
1193
|
+
}
|
|
1194
|
+
s.push(o[r - 2] ?? 0);
|
|
1195
|
+
let c = `M ${t.x} ${t.y}`;
|
|
1196
|
+
for (let t = 0; t < r - 1; t++) {
|
|
1197
|
+
let n = e[t], r = e[t + 1];
|
|
1198
|
+
if (!n || !r) continue;
|
|
1199
|
+
let a = (i[t] ?? 0) / 3, o = s[t] ?? 0, l = s[t + 1] ?? 0;
|
|
1200
|
+
c += ` C ${n.x + a} ${n.y + o * a}, ${r.x - a} ${r.y - l * a}, ${r.x} ${r.y}`;
|
|
1201
|
+
}
|
|
1202
|
+
return c;
|
|
1203
|
+
}
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region src/theme.ts
|
|
1206
|
+
function Ut() {
|
|
1207
|
+
return document.documentElement.classList.contains("dark");
|
|
1208
|
+
}
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/version.ts
|
|
1211
|
+
var Wt = {
|
|
1212
|
+
name: "@glasshome/widget-sdk",
|
|
1213
|
+
version: "1.2.1",
|
|
1214
|
+
description: "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
1215
|
+
keywords: [
|
|
1216
|
+
"glasshome",
|
|
1217
|
+
"widget",
|
|
1218
|
+
"sdk",
|
|
1219
|
+
"solidjs",
|
|
1220
|
+
"vite",
|
|
1221
|
+
"home-assistant",
|
|
1222
|
+
"dashboard",
|
|
1223
|
+
"smart-home"
|
|
1224
|
+
],
|
|
1225
|
+
type: "module",
|
|
1226
|
+
sideEffects: !1,
|
|
1227
|
+
main: "./dist/index.js",
|
|
1228
|
+
types: "./dist/index.d.ts",
|
|
1229
|
+
exports: {
|
|
1230
|
+
".": {
|
|
1231
|
+
"@glasshome/source": "./src/index.ts",
|
|
1232
|
+
types: "./dist/index.d.ts",
|
|
1233
|
+
import: "./dist/index.js"
|
|
1234
|
+
},
|
|
1235
|
+
"./schemas": {
|
|
1236
|
+
"@glasshome/source": "./src/schemas.ts",
|
|
1237
|
+
types: "./dist/schemas.d.ts",
|
|
1238
|
+
import: "./dist/schemas.js"
|
|
1239
|
+
},
|
|
1240
|
+
"./vite": {
|
|
1241
|
+
"@glasshome/source": "./src/vite/index.ts",
|
|
1242
|
+
types: "./dist/vite/index.d.ts",
|
|
1243
|
+
import: "./dist/vite/index.js"
|
|
1244
|
+
},
|
|
1245
|
+
"./tailwind-sources": "./tailwind-sources.css",
|
|
1246
|
+
"./package.json": "./package.json"
|
|
1247
|
+
},
|
|
1248
|
+
files: [
|
|
1249
|
+
"dist",
|
|
1250
|
+
"preview",
|
|
1251
|
+
"tailwind-sources.css"
|
|
1252
|
+
],
|
|
1253
|
+
scripts: {
|
|
1254
|
+
build: "vite build && tsc",
|
|
1255
|
+
dev: "vite build --watch"
|
|
1256
|
+
},
|
|
1257
|
+
peerDependencies: {
|
|
1258
|
+
"@glasshome/sync-layer": "0.2.0",
|
|
1259
|
+
"solid-js": "^1.9.11"
|
|
1260
|
+
},
|
|
1261
|
+
dependencies: {
|
|
1262
|
+
"@glasshome/widget-contract": "0.1.0",
|
|
1263
|
+
"@modular-forms/solid": "^0.25.1",
|
|
1264
|
+
"@solid-primitives/resize-observer": "^2.1.5",
|
|
1265
|
+
clsx: "^2.1.1",
|
|
1266
|
+
"tailwind-merge": "^3.5.0",
|
|
1267
|
+
zod: "^4.1.13",
|
|
1268
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
1269
|
+
tailwindcss: "^4.1.13"
|
|
1270
|
+
},
|
|
1271
|
+
devDependencies: {
|
|
1272
|
+
"@types/bun": "latest",
|
|
1273
|
+
"@types/node": "^25.2.2",
|
|
1274
|
+
typescript: "^5",
|
|
1275
|
+
vite: "^8.1.0",
|
|
1276
|
+
"vite-plugin-solid": "^2.11.12"
|
|
1277
|
+
},
|
|
1278
|
+
repository: {
|
|
1279
|
+
type: "git",
|
|
1280
|
+
url: "https://github.com/glasshome/widget-sdk.git"
|
|
1281
|
+
},
|
|
1282
|
+
homepage: "https://github.com/glasshome/widget-sdk#readme",
|
|
1283
|
+
bugs: { url: "https://github.com/glasshome/widget-sdk/issues" },
|
|
1284
|
+
author: "GlassHome Labs",
|
|
1285
|
+
license: "MIT",
|
|
1286
|
+
publishConfig: { access: "public" },
|
|
1287
|
+
engines: { node: ">=18" }
|
|
1288
|
+
}.version;
|
|
1289
|
+
//#endregion
|
|
1290
|
+
export { Wt as SDK_VERSION, Bt as ToneSchema, H as Widget, Ie as WidgetContent, I as WidgetCtx, wt as WidgetDialog, Be as WidgetIcon, e as WidgetManifestSchema, Pe as WidgetSliderFill, He as WidgetStatus, Ge as WidgetTitle, nt as WidgetValue, d as byDomain, Ke as calculateLightGroup, qe as calculateSensorGroup, Ze as countActiveEntities, be as defineWidget, t as formatSchemaError, Xe as getEntityAttribute, r as getForecasts, i as getStream, a as getWebRtcClientConfig, Ae as injectTokens, Ut as isDark, Ye as isEntityActive, Ht as monotoneCubicPath, o as sendWebRtcCandidate, s as startWebRtcSession, c as state, zt as svgColors, l as trackEntityHistory, u as untrackEntityHistory, f as useArea, p as useCamera, m as useConnection, h as useCurrency, g as useEntities, _ as useEntity, v as useEntityHistory, ee as useEntityStatistics, y as useForecast, b as useHassConfig, Tt as useIntersectionPause, te as useLocale, Et as useReducedMotion, Ce as useService, ne as useStore, re as useTemperatureUnit, Ee as useToggle, Te as useTurnOff, we as useTurnOn, oe as useUnitSystem, xe as useWidgetContext, Dt as useWidgetDialog, Ot as useWidgetEntityGroup, It as useWidgetGestures, Vt as widgetFields };
|