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