@glasshome/widget-sdk 1.4.1 → 1.5.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/README.md +1 -1
- package/dist/index.js +252 -247
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SDK for building GlassHome dashboard widgets with SolidJS.
|
|
4
4
|
|
|
5
|
-
Provides `defineWidget`, reactive entity bindings, framework components/hooks, a Vite plugin for widget development, and Tailwind v4 source paths — everything you need to build, preview, and ship dashboard
|
|
5
|
+
Provides `defineWidget`, reactive entity bindings, framework components/hooks, a Vite plugin for widget development, and Tailwind v4 source paths — everything you need to build, preview, and ship widgets for [GlassHome](https://glasshome.app), the local-first dashboard for Home Assistant. Start with the [widget development guide](https://glasshome.app/docs/widget-development).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import { deprecate as e, deprecations as t, formatDeprecation as n } from "./dep
|
|
|
2
2
|
import { WidgetManifestSchema as r, formatSchemaError as i } from "./schemas.js";
|
|
3
3
|
import { z as a, z as o } from "zod";
|
|
4
4
|
import { getForecasts as s, getStream as c, getWebRtcClientConfig as l, hassMediaUrl as u, sendWebRtcCandidate as d, startWebRtcSession as f, state as p, trackEntityHistory as m, untrackEntityHistory as h } from "@glasshome/sync-layer";
|
|
5
|
-
import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as x, useEntityStatistics as ne, useForecast as re, useHassConfig as ie, useLocale as
|
|
6
|
-
import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as pe, onCleanup as D, onMount as me, splitProps as he, useContext as O } from "solid-js";
|
|
7
|
-
import { addEventListener as k, className as A, createComponent as j, delegateEvents as
|
|
8
|
-
import { clsx as
|
|
9
|
-
import { twMerge as
|
|
5
|
+
import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as x, useEntityStatistics as ne, useForecast as re, useHassConfig as ie, useLocale as ae, useService as S, useStore as oe, useTemperatureUnit as se, useToggle as ce, useTurnOff as le, useTurnOn as ue, useUnitSystem as de } from "@glasshome/sync-layer/solid";
|
|
6
|
+
import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as pe, onCleanup as D, onMount as me, splitProps as he, untrack as ge, useContext as O } from "solid-js";
|
|
7
|
+
import { addEventListener as k, className as A, createComponent as j, delegateEvents as _e, effect as M, insert as N, memo as P, setStyleProperty as F, style as ve, template as I, use as ye } from "solid-js/web";
|
|
8
|
+
import { clsx as be } from "clsx";
|
|
9
|
+
import { twMerge as xe } from "tailwind-merge";
|
|
10
10
|
//#region src/framework/to-form-schema.ts
|
|
11
|
-
function
|
|
11
|
+
function Se(e) {
|
|
12
12
|
return o.toJSONSchema(e, { override: (e) => {
|
|
13
13
|
let t = o.globalRegistry.get(e.zodSchema);
|
|
14
14
|
return t && typeof t == "object" && Object.keys(t).length > 0 ? {
|
|
@@ -17,7 +17,7 @@ function be(e) {
|
|
|
17
17
|
} : e.jsonSchema;
|
|
18
18
|
} });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Ce(e) {
|
|
21
21
|
try {
|
|
22
22
|
return e.parse({});
|
|
23
23
|
} catch {
|
|
@@ -26,82 +26,82 @@ function xe(e) {
|
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/define-widget.ts
|
|
29
|
-
function
|
|
30
|
-
return e.configSchema && (e.manifest.schema || (e.manifest.schema =
|
|
29
|
+
function we(e) {
|
|
30
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = Se(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ce(e.configSchema))), e;
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/framework/hooks/use-widget-context.ts
|
|
34
|
-
var
|
|
35
|
-
function
|
|
36
|
-
let e = O(
|
|
34
|
+
var L = fe();
|
|
35
|
+
function Te() {
|
|
36
|
+
let e = O(L);
|
|
37
37
|
if (!e) throw Error("useWidgetContext must be used within a Widget component");
|
|
38
38
|
return e;
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/framework/hooks/use-service.ts
|
|
42
|
-
function
|
|
42
|
+
function Ee(e) {
|
|
43
43
|
let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
|
|
44
44
|
if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
|
|
45
45
|
return n;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return (n, r = {}) => e(
|
|
47
|
+
function R(e, t) {
|
|
48
|
+
return (n, r = {}) => e(Ee(n), t, r, { entity_id: n });
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
let e = O(
|
|
50
|
+
function De() {
|
|
51
|
+
let e = O(L)?.callService;
|
|
52
52
|
return e ? {
|
|
53
53
|
callService: e,
|
|
54
|
-
turnOn:
|
|
55
|
-
turnOff:
|
|
56
|
-
toggle:
|
|
57
|
-
} :
|
|
54
|
+
turnOn: R(e, "turn_on"),
|
|
55
|
+
turnOff: R(e, "turn_off"),
|
|
56
|
+
toggle: R(e, "toggle")
|
|
57
|
+
} : S();
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
let e = O(
|
|
61
|
-
return e ?
|
|
59
|
+
function Oe() {
|
|
60
|
+
let e = O(L)?.callService;
|
|
61
|
+
return e ? R(e, "turn_on") : ue();
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
let e = O(
|
|
65
|
-
return e ?
|
|
63
|
+
function ke() {
|
|
64
|
+
let e = O(L)?.callService;
|
|
65
|
+
return e ? R(e, "turn_off") : le();
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
let e = O(
|
|
69
|
-
return e ?
|
|
67
|
+
function Ae() {
|
|
68
|
+
let e = O(L)?.callService;
|
|
69
|
+
return e ? R(e, "toggle") : ce();
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/framework/design-system/z-index.ts
|
|
73
|
-
var
|
|
73
|
+
var z = {
|
|
74
74
|
BACKGROUND: 0,
|
|
75
75
|
CONTENT: 10,
|
|
76
76
|
OVERLAY: 20,
|
|
77
77
|
ACTIONS: 30
|
|
78
|
-
},
|
|
79
|
-
function
|
|
80
|
-
return
|
|
78
|
+
}, 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 (cqb=height, cqi=width).\n * Icon/pad/gap track HEIGHT (cqb) not the shortest side: two widgets of equal\n * height match regardless of width (a 2×2 and a 4×2 get the same icon). cqmin\n * starved portrait tiles by pinning the icon to the narrow width. Tune\n * 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(44px, 25cqb, 58px);\n --widget-icon-glyph: clamp(24px, 14cqb, 33px);\n --widget-pad: clamp(8px, 3.5cqb, 22px);\n --widget-gap: clamp(6px, 2cqb, 14px);\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\n/* === Compact 1×1 ===\n * Small in BOTH axes → stack the tile: icon on top, label + status centered\n * under it. Icon stays moderate (not a hero) so the text keeps room. Wide\n * tiles (2×1) fail the width test and keep the row layout above. Placed after\n * the row-flip so it wins. */\n@container widget (max-width: 189px) and (max-height: 189px) {\n .glasshome-widget-content {\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: clamp(4px, 2.5cqmin, 8px);\n }\n .glasshome-widget-content > * { align-items: center; text-align: center; }\n .glasshome-widget-icon {\n --widget-icon-box: clamp(36px, 30cqmin, 56px);\n --widget-icon-glyph: clamp(20px, 17cqmin, 32px);\n }\n .glasshome-widget-title { font-size: clamp(11px, 6cqmin, 14px); max-width: 100%; }\n .glasshome-widget-status,\n .glasshome-widget-value { font-size: clamp(13px, 7cqmin, 17px); }\n .glasshome-widget-content [class*=\"ml-auto\"] { margin-left: 0 !important; }\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();
|
|
79
|
+
function Pe() {
|
|
80
|
+
return B || (B = new CSSStyleSheet(), B.replaceSync(je.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), B;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function Fe(e) {
|
|
83
83
|
if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
|
|
84
|
-
if (
|
|
85
|
-
let t =
|
|
86
|
-
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]),
|
|
84
|
+
if (Ne.has(e)) return;
|
|
85
|
+
let t = Pe();
|
|
86
|
+
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), Ne.add(e);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
if (
|
|
89
|
+
if (Me) return;
|
|
90
90
|
let t = e ?? (typeof document > "u" ? void 0 : document);
|
|
91
91
|
if (!t) return;
|
|
92
92
|
if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
|
|
93
|
-
|
|
93
|
+
Me = !0;
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
let n = t.createElement("style");
|
|
97
|
-
n.setAttribute("data-glasshome-tokens", ""), n.textContent =
|
|
97
|
+
n.setAttribute("data-glasshome-tokens", ""), n.textContent = je, t.head.appendChild(n), Me = !0;
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/framework/utils/cn.ts
|
|
101
|
-
function
|
|
102
|
-
return
|
|
101
|
+
function V(...e) {
|
|
102
|
+
return xe(be(e));
|
|
103
103
|
}
|
|
104
|
-
var
|
|
104
|
+
var Ie = {
|
|
105
105
|
"classic-glass": {
|
|
106
106
|
id: "classic-glass",
|
|
107
107
|
name: "Classic Glass",
|
|
@@ -187,22 +187,22 @@ var Pe = {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function Le(e) {
|
|
191
|
+
return Ie[e];
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/framework/backgrounds/WidgetSliderFill.tsx
|
|
195
|
-
var
|
|
196
|
-
function
|
|
195
|
+
var Re = /*#__PURE__*/ I("<div>");
|
|
196
|
+
function ze(e) {
|
|
197
197
|
return (() => {
|
|
198
|
-
var t =
|
|
198
|
+
var t = Re();
|
|
199
199
|
return M((n) => {
|
|
200
|
-
var r =
|
|
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
201
|
"--widget-fill-value": e.value,
|
|
202
|
-
"z-index":
|
|
202
|
+
"z-index": z.BACKGROUND,
|
|
203
203
|
...e.color ? { "--widget-icon-color": e.color } : {}
|
|
204
204
|
};
|
|
205
|
-
return r !== n.e && A(t, n.e = r), n.t =
|
|
205
|
+
return r !== n.e && A(t, n.e = r), n.t = ve(t, i, n.t), n;
|
|
206
206
|
}, {
|
|
207
207
|
e: void 0,
|
|
208
208
|
t: void 0
|
|
@@ -211,37 +211,37 @@ function Le(e) {
|
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/framework/components/WidgetContent.tsx
|
|
214
|
-
var
|
|
215
|
-
function
|
|
214
|
+
var Be = /*#__PURE__*/ I("<div>");
|
|
215
|
+
function Ve(e) {
|
|
216
216
|
return (() => {
|
|
217
|
-
var t =
|
|
218
|
-
return N(t, () => e.children), M(() => A(t,
|
|
217
|
+
var t = Be();
|
|
218
|
+
return N(t, () => e.children), M(() => A(t, V("glasshome-widget-content", e.class))), t;
|
|
219
219
|
})();
|
|
220
220
|
}
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region src/framework/components/WidgetIcon.tsx
|
|
223
|
-
var
|
|
224
|
-
function
|
|
223
|
+
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\">");
|
|
224
|
+
function Ge(e) {
|
|
225
225
|
let t = () => e.entityCount ?? 1;
|
|
226
226
|
return (() => {
|
|
227
|
-
var n =
|
|
227
|
+
var n = We(), r = n.firstChild;
|
|
228
228
|
return N(n, j(C, {
|
|
229
229
|
get when() {
|
|
230
230
|
return t() >= 2;
|
|
231
231
|
},
|
|
232
232
|
get children() {
|
|
233
|
-
return
|
|
233
|
+
return He();
|
|
234
234
|
}
|
|
235
235
|
}), r), N(n, j(C, {
|
|
236
236
|
get when() {
|
|
237
237
|
return t() >= 3;
|
|
238
238
|
},
|
|
239
239
|
get children() {
|
|
240
|
-
return
|
|
240
|
+
return Ue();
|
|
241
241
|
}
|
|
242
242
|
}), r), N(r, () => e.icon), M((t) => {
|
|
243
|
-
var r =
|
|
244
|
-
return r !== t.e && A(n, t.e = r), t.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 && A(n, t.e = r), t.t = ve(n, i, t.t), t;
|
|
245
245
|
}, {
|
|
246
246
|
e: void 0,
|
|
247
247
|
t: void 0
|
|
@@ -250,15 +250,15 @@ function Ue(e) {
|
|
|
250
250
|
}
|
|
251
251
|
//#endregion
|
|
252
252
|
//#region src/framework/components/WidgetStatus.tsx
|
|
253
|
-
var
|
|
254
|
-
function
|
|
253
|
+
var Ke = /*#__PURE__*/ I("<p>");
|
|
254
|
+
function qe(e) {
|
|
255
255
|
return (() => {
|
|
256
|
-
var t =
|
|
256
|
+
var t = Ke();
|
|
257
257
|
return N(t, (() => {
|
|
258
258
|
var t = P(() => !!e.isUnavailable);
|
|
259
259
|
return () => t() ? "Unavailable" : e.children;
|
|
260
260
|
})()), M((n) => {
|
|
261
|
-
var r =
|
|
261
|
+
var r = V("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = z.ACTIONS;
|
|
262
262
|
return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
|
|
263
263
|
}, {
|
|
264
264
|
e: void 0,
|
|
@@ -268,20 +268,20 @@ function Ge(e) {
|
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/framework/components/WidgetTitle.tsx
|
|
271
|
-
var
|
|
272
|
-
function
|
|
271
|
+
var Je = /*#__PURE__*/ I("<span class=\"glasshome-widget-badge shrink-0\">"), Ye = /*#__PURE__*/ I("<div><h3 class=glasshome-widget-title>");
|
|
272
|
+
function Xe(e) {
|
|
273
273
|
return (() => {
|
|
274
|
-
var t =
|
|
274
|
+
var t = Ye(), n = t.firstChild;
|
|
275
275
|
return N(n, () => e.children), N(t, j(C, {
|
|
276
276
|
get when() {
|
|
277
277
|
return P(() => e.badge !== void 0)() && e.badge > 0;
|
|
278
278
|
},
|
|
279
279
|
get children() {
|
|
280
|
-
var t =
|
|
280
|
+
var t = Je();
|
|
281
281
|
return N(t, () => e.badge), t;
|
|
282
282
|
}
|
|
283
283
|
}), null), M((n) => {
|
|
284
|
-
var r =
|
|
284
|
+
var r = V("relative flex items-center gap-2", e.class), i = z.ACTIONS;
|
|
285
285
|
return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
|
|
286
286
|
}, {
|
|
287
287
|
e: void 0,
|
|
@@ -291,7 +291,7 @@ function Je(e) {
|
|
|
291
291
|
}
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/framework/utils/entity-aggregation.ts
|
|
294
|
-
function
|
|
294
|
+
function Ze(e, t = !1) {
|
|
295
295
|
if (e.length === 0) return {
|
|
296
296
|
isGroup: !1,
|
|
297
297
|
state: "unknown",
|
|
@@ -314,7 +314,7 @@ function Ye(e, t = !1) {
|
|
|
314
314
|
isUnavailable: t.state === "unavailable",
|
|
315
315
|
brightness: r,
|
|
316
316
|
brightnessPercent: i,
|
|
317
|
-
color:
|
|
317
|
+
color: $e(t),
|
|
318
318
|
onCount: +!!n,
|
|
319
319
|
totalCount: 1,
|
|
320
320
|
description: n ? "On" : "Off"
|
|
@@ -341,7 +341,7 @@ function Ye(e, t = !1) {
|
|
|
341
341
|
if (l.length > 0) {
|
|
342
342
|
let e = Math.round(l.reduce((e, t) => e + t[0], 0) / l.length), t = Math.round(l.reduce((e, t) => e + t[1], 0) / l.length), n = Math.round(l.reduce((e, t) => e + t[2], 0) / l.length), r = v / 255;
|
|
343
343
|
y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
|
|
344
|
-
} else y =
|
|
344
|
+
} else y = $e(e[0]);
|
|
345
345
|
let b;
|
|
346
346
|
return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
|
|
347
347
|
isGroup: n,
|
|
@@ -356,7 +356,7 @@ function Ye(e, t = !1) {
|
|
|
356
356
|
description: b
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Qe(e, t = "mean", n = !0) {
|
|
360
360
|
if (e.length === 0) return {
|
|
361
361
|
isGroup: !1,
|
|
362
362
|
state: "unknown",
|
|
@@ -452,7 +452,7 @@ function Xe(e, t = "mean", n = !0) {
|
|
|
452
452
|
memberValues: a
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function $e(e) {
|
|
456
456
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
457
457
|
let t = (e.attributes?.brightness ?? 255) / 255;
|
|
458
458
|
if (e.attributes?.rgb_color) {
|
|
@@ -467,7 +467,7 @@ function Ze(e) {
|
|
|
467
467
|
}
|
|
468
468
|
//#endregion
|
|
469
469
|
//#region src/framework/utils/entity-state.ts
|
|
470
|
-
function
|
|
470
|
+
function et(e) {
|
|
471
471
|
if (!e) return !1;
|
|
472
472
|
if ([
|
|
473
473
|
"on",
|
|
@@ -483,15 +483,15 @@ function Qe(e) {
|
|
|
483
483
|
}
|
|
484
484
|
return !1;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function tt(e, t, n) {
|
|
487
487
|
return e?.attributes ? e.attributes[t] ?? n : n;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
return e.filter(
|
|
489
|
+
function nt(e) {
|
|
490
|
+
return e.filter(et).length;
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/framework/utils/format-value.ts
|
|
494
|
-
function
|
|
494
|
+
function rt(e, t, n) {
|
|
495
495
|
let { decimals: r, scale: i = !0 } = n || {};
|
|
496
496
|
if (typeof e == "string") return t ? `${e}${t}` : e;
|
|
497
497
|
if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
|
|
@@ -502,31 +502,31 @@ function tt(e, t, n) {
|
|
|
502
502
|
}
|
|
503
503
|
//#endregion
|
|
504
504
|
//#region src/framework/utils/interpret-value.ts
|
|
505
|
-
function
|
|
505
|
+
function it(e, t) {
|
|
506
506
|
return e == null || isNaN(e) ? null : t === "°C" ? e < 10 ? "Cold" : e < 18 ? "Cool" : e < 24 ? "Comfortable" : e < 28 ? "Warm" : "Hot" : t === "°F" ? e < 50 ? "Cold" : e < 64 ? "Cool" : e < 75 ? "Comfortable" : e < 82 ? "Warm" : "Hot" : t === "%" ? e < 20 ? "Very Low" : e < 40 ? "Low" : e < 60 ? "Medium" : e < 80 ? "High" : "Very High" : t === "ppm" ? e < 400 ? "Excellent" : e < 600 ? "Good" : e < 1e3 ? "Acceptable" : e < 1500 ? "Mediocre" : "Poor" : t === "lx" ? e < 50 ? "Dark" : e < 200 ? "Dim" : e < 500 ? "Moderate" : e < 1e3 ? "Bright" : "Very Bright" : t === "AQI" ? e <= 50 ? "Good" : e <= 100 ? "Moderate" : e <= 150 ? "Unhealthy for Sensitive" : e <= 200 ? "Unhealthy" : e <= 300 ? "Very Unhealthy" : "Hazardous" : t === "dB" ? e < 30 ? "Very Quiet" : e < 50 ? "Quiet" : e < 70 ? "Moderate" : e < 85 ? "Loud" : "Very Loud" : null;
|
|
507
507
|
}
|
|
508
508
|
//#endregion
|
|
509
509
|
//#region src/framework/components/WidgetValue.tsx
|
|
510
|
-
var
|
|
511
|
-
function
|
|
510
|
+
var at = /*#__PURE__*/ I("<div class=glasshome-widget-subtitle>"), ot = /*#__PURE__*/ I("<div><div class=glasshome-widget-value>");
|
|
511
|
+
function st(e) {
|
|
512
512
|
return (() => {
|
|
513
|
-
var t =
|
|
514
|
-
return N(n, () =>
|
|
513
|
+
var t = ot(), n = t.firstChild;
|
|
514
|
+
return N(n, () => rt(e.value, e.unit)), N(t, j(C, {
|
|
515
515
|
get when() {
|
|
516
516
|
return P(() => !!e.interpret)() && typeof e.value == "number";
|
|
517
517
|
},
|
|
518
518
|
get children() {
|
|
519
|
-
var t =
|
|
520
|
-
return N(t, () =>
|
|
519
|
+
var t = at();
|
|
520
|
+
return N(t, () => it(e.value, e.unit)), t;
|
|
521
521
|
}
|
|
522
|
-
}), null), M(() => A(t,
|
|
522
|
+
}), null), M(() => A(t, V("flex flex-col", e.class))), t;
|
|
523
523
|
})();
|
|
524
524
|
}
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/framework/core/Widget.tsx
|
|
527
|
-
var
|
|
528
|
-
function
|
|
529
|
-
let t = O(
|
|
527
|
+
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\">");
|
|
528
|
+
function mt(e) {
|
|
529
|
+
let t = O(L), [n, r] = E(), [i, a] = E({
|
|
530
530
|
width: 0,
|
|
531
531
|
height: 0
|
|
532
532
|
});
|
|
@@ -547,7 +547,7 @@ function ft(e) {
|
|
|
547
547
|
t.observe(e), D(() => t.disconnect());
|
|
548
548
|
}), me(() => {
|
|
549
549
|
let e = n()?.getRootNode();
|
|
550
|
-
|
|
550
|
+
Fe(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
|
|
551
551
|
});
|
|
552
552
|
let o = {
|
|
553
553
|
isEditMode: () => e.isEditMode ?? !1,
|
|
@@ -556,7 +556,7 @@ function ft(e) {
|
|
|
556
556
|
callService: t?.callService,
|
|
557
557
|
dimensions: () => i()
|
|
558
558
|
}, s = T(() => {
|
|
559
|
-
if (e.variant) return typeof e.variant == "string" ?
|
|
559
|
+
if (e.variant) return typeof e.variant == "string" ? Le(e.variant) : e.variant;
|
|
560
560
|
}), c = T(() => ({
|
|
561
561
|
"container-type": "size",
|
|
562
562
|
"container-name": "widget",
|
|
@@ -578,15 +578,15 @@ function ft(e) {
|
|
|
578
578
|
}, m = (t) => {
|
|
579
579
|
l() && e.gestures?.onPointerCancel(t);
|
|
580
580
|
};
|
|
581
|
-
return j(
|
|
581
|
+
return j(L.Provider, {
|
|
582
582
|
value: o,
|
|
583
583
|
get children() {
|
|
584
|
-
var t =
|
|
585
|
-
return k(t, "pointercancel", m), k(t, "pointerup", p), k(t, "pointermove", f), k(t, "pointerdown", d), k(t, "pointerenter", u),
|
|
584
|
+
var t = ct(), n = t.firstChild;
|
|
585
|
+
return k(t, "pointercancel", m), k(t, "pointerup", p), k(t, "pointermove", f), k(t, "pointerdown", d), k(t, "pointerenter", u), ye((t) => {
|
|
586
586
|
r(t), e.gestures?.bindElement(t);
|
|
587
587
|
}, t), N(n, (() => {
|
|
588
588
|
var t = P(() => !!e.emptyState);
|
|
589
|
-
return () => t() ? j(
|
|
589
|
+
return () => t() ? j(ht, {
|
|
590
590
|
get icon() {
|
|
591
591
|
return e.emptyState.icon;
|
|
592
592
|
},
|
|
@@ -600,12 +600,12 @@ function ft(e) {
|
|
|
600
600
|
})()), N(t, (() => {
|
|
601
601
|
var t = P(() => !!e.loading);
|
|
602
602
|
return () => t() && (() => {
|
|
603
|
-
var e =
|
|
604
|
-
return M((t) => F(e, "z-index",
|
|
603
|
+
var e = lt();
|
|
604
|
+
return M((t) => F(e, "z-index", z.OVERLAY)), e;
|
|
605
605
|
})();
|
|
606
606
|
})(), null), M((r) => {
|
|
607
|
-
var i =
|
|
608
|
-
return i !== r.e && A(t, r.e = i), r.t =
|
|
607
|
+
var i = V("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", s()?.styles?.class, e.class), a = c(), o = z.CONTENT;
|
|
608
|
+
return i !== r.e && A(t, r.e = i), r.t = ve(t, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
|
|
609
609
|
}, {
|
|
610
610
|
e: void 0,
|
|
611
611
|
t: void 0,
|
|
@@ -614,55 +614,55 @@ function ft(e) {
|
|
|
614
614
|
}
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function ht(e) {
|
|
618
618
|
return (() => {
|
|
619
|
-
var t =
|
|
619
|
+
var t = ut();
|
|
620
620
|
return N(t, (() => {
|
|
621
621
|
var t = P(() => !!e.icon);
|
|
622
622
|
return () => t() && (() => {
|
|
623
|
-
var t =
|
|
623
|
+
var t = dt();
|
|
624
624
|
return N(t, () => e.icon), t;
|
|
625
625
|
})();
|
|
626
626
|
})(), null), N(t, (() => {
|
|
627
627
|
var t = P(() => !!e.title);
|
|
628
628
|
return () => t() && (() => {
|
|
629
|
-
var t =
|
|
629
|
+
var t = ft();
|
|
630
630
|
return N(t, () => e.title), t;
|
|
631
631
|
})();
|
|
632
632
|
})(), null), N(t, (() => {
|
|
633
633
|
var t = P(() => !!e.message);
|
|
634
634
|
return () => t() && (() => {
|
|
635
|
-
var t =
|
|
635
|
+
var t = pt();
|
|
636
636
|
return N(t, () => e.message), t;
|
|
637
637
|
})();
|
|
638
638
|
})(), null), t;
|
|
639
639
|
})();
|
|
640
640
|
}
|
|
641
|
-
var
|
|
642
|
-
|
|
641
|
+
var H = mt;
|
|
642
|
+
H.Content = Ve, H.Icon = Ge, H.Title = Xe, H.Status = qe, H.Value = st, H.SliderFill = ze;
|
|
643
643
|
//#endregion
|
|
644
644
|
//#region src/framework/dialogs/WidgetDialog.tsx
|
|
645
|
-
var
|
|
646
|
-
function
|
|
645
|
+
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\">");
|
|
646
|
+
function Ot(e) {
|
|
647
647
|
return (() => {
|
|
648
|
-
var t =
|
|
648
|
+
var t = _t();
|
|
649
649
|
return t.$$click = () => e.onClick(), N(t, j(C, {
|
|
650
650
|
get when() {
|
|
651
651
|
return e.isActive;
|
|
652
652
|
},
|
|
653
653
|
get children() {
|
|
654
|
-
var t =
|
|
654
|
+
var t = gt();
|
|
655
655
|
return N(t, () => e.icon), t;
|
|
656
656
|
}
|
|
657
|
-
}), null), N(t, () => e.label, null), M(() => A(t,
|
|
657
|
+
}), null), N(t, () => e.label, null), M(() => A(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;
|
|
658
658
|
})();
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function kt(e) {
|
|
661
661
|
let [t] = he(e, /* @__PURE__ */ "open.onOpenChange.title.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.Button.SchemaForm".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = E({}), [a, o] = E(null);
|
|
662
662
|
w(pe(() => t.config, (e) => {
|
|
663
663
|
e && i({ ...e });
|
|
664
664
|
})), w(pe(() => t.configSchema, (e) => {
|
|
665
|
-
e && o(
|
|
665
|
+
e && o(Se(e));
|
|
666
666
|
}));
|
|
667
667
|
let s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), c = (e) => {
|
|
668
668
|
!e && t.config && i({ ...t.config }), t.onOpenChange(e);
|
|
@@ -684,26 +684,26 @@ function Dt(e) {
|
|
|
684
684
|
return e.push({
|
|
685
685
|
id: "edit",
|
|
686
686
|
label: "Edit",
|
|
687
|
-
icon:
|
|
687
|
+
icon: vt(),
|
|
688
688
|
content: t.editContent ?? (n() && a() ? j(ne, {
|
|
689
689
|
get schema() {
|
|
690
690
|
return a();
|
|
691
691
|
},
|
|
692
692
|
get data() {
|
|
693
|
-
return r
|
|
693
|
+
return ge(r);
|
|
694
694
|
},
|
|
695
695
|
onChange: i
|
|
696
|
-
}) :
|
|
696
|
+
}) : yt())
|
|
697
697
|
}), e.push({
|
|
698
698
|
id: "controls",
|
|
699
699
|
label: "Controls",
|
|
700
|
-
icon:
|
|
701
|
-
content: t.controlsContent ??
|
|
700
|
+
icon: bt(),
|
|
701
|
+
content: t.controlsContent ?? xt()
|
|
702
702
|
}), e.push({
|
|
703
703
|
id: "debug",
|
|
704
704
|
label: "Debug",
|
|
705
|
-
icon:
|
|
706
|
-
content: t.debugContent ??
|
|
705
|
+
icon: St(),
|
|
706
|
+
content: t.debugContent ?? Ct()
|
|
707
707
|
}), e;
|
|
708
708
|
}, g = async () => {
|
|
709
709
|
if (t.debugData !== void 0) try {
|
|
@@ -711,18 +711,23 @@ function Dt(e) {
|
|
|
711
711
|
await navigator.clipboard.writeText(e);
|
|
712
712
|
} catch {}
|
|
713
713
|
}, _ = () => {
|
|
714
|
-
let e =
|
|
714
|
+
let e = re();
|
|
715
715
|
return e.find((e) => e.id === f())?.content ?? e[0]?.content;
|
|
716
|
-
}, v = t.ResponsiveDialog, ee = t.ResponsiveDialogContent, y = t.ResponsiveDialogHeader, b = t.ResponsiveDialogTitle, te = t.ResponsiveDialogDescription, x = t.Button, ne = t.SchemaForm, re = (
|
|
716
|
+
}, v = t.ResponsiveDialog, ee = t.ResponsiveDialogContent, y = t.ResponsiveDialogHeader, b = t.ResponsiveDialogTitle, te = t.ResponsiveDialogDescription, x = t.Button, ne = t.SchemaForm, re = T(pe([
|
|
717
|
+
() => t.open,
|
|
718
|
+
a,
|
|
719
|
+
() => t.config,
|
|
720
|
+
() => t.tabs
|
|
721
|
+
], () => h())), ie = (e) => n() ? c(e) : t.onOpenChange(e), ae = () => n() ? s() : t.hasUnsavedChanges, S = () => n() ? l : t.onSave;
|
|
717
722
|
return j(v, {
|
|
718
723
|
get open() {
|
|
719
724
|
return t.open;
|
|
720
725
|
},
|
|
721
|
-
onOpenChange: (e) =>
|
|
726
|
+
onOpenChange: (e) => ie(e),
|
|
722
727
|
get children() {
|
|
723
728
|
return j(ee, {
|
|
724
729
|
get class() {
|
|
725
|
-
return
|
|
730
|
+
return V(m(), t.class);
|
|
726
731
|
},
|
|
727
732
|
get children() {
|
|
728
733
|
return [
|
|
@@ -730,7 +735,7 @@ function Dt(e) {
|
|
|
730
735
|
class: "flex flex-row items-center justify-between gap-3",
|
|
731
736
|
get children() {
|
|
732
737
|
return [(() => {
|
|
733
|
-
var e =
|
|
738
|
+
var e = wt();
|
|
734
739
|
return N(e, j(b, {
|
|
735
740
|
class: "truncate leading-tight",
|
|
736
741
|
get children() {
|
|
@@ -741,8 +746,8 @@ function Dt(e) {
|
|
|
741
746
|
children: "Widget configuration dialog"
|
|
742
747
|
}), null), e;
|
|
743
748
|
})(), (() => {
|
|
744
|
-
var e =
|
|
745
|
-
return N(n, () =>
|
|
749
|
+
var e = Tt(), n = e.firstChild;
|
|
750
|
+
return N(n, () => re().map((e) => j(Ot, {
|
|
746
751
|
get icon() {
|
|
747
752
|
return e.icon;
|
|
748
753
|
},
|
|
@@ -765,7 +770,7 @@ function Dt(e) {
|
|
|
765
770
|
}
|
|
766
771
|
}),
|
|
767
772
|
(() => {
|
|
768
|
-
var e =
|
|
773
|
+
var e = Et();
|
|
769
774
|
return N(e, _), e;
|
|
770
775
|
})(),
|
|
771
776
|
j(C, {
|
|
@@ -773,7 +778,7 @@ function Dt(e) {
|
|
|
773
778
|
return P(() => f() === "edit")() && (S() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
|
|
774
779
|
},
|
|
775
780
|
get children() {
|
|
776
|
-
var e =
|
|
781
|
+
var e = Dt();
|
|
777
782
|
return N(e, j(C, {
|
|
778
783
|
get when() {
|
|
779
784
|
return P(() => f() === "edit")() && t.onDelete;
|
|
@@ -794,7 +799,7 @@ function Dt(e) {
|
|
|
794
799
|
return j(x, {
|
|
795
800
|
size: "sm",
|
|
796
801
|
get disabled() {
|
|
797
|
-
return !
|
|
802
|
+
return !ae();
|
|
798
803
|
},
|
|
799
804
|
onClick: () => S()?.(),
|
|
800
805
|
children: "Save"
|
|
@@ -821,10 +826,10 @@ function Dt(e) {
|
|
|
821
826
|
}
|
|
822
827
|
});
|
|
823
828
|
}
|
|
824
|
-
|
|
829
|
+
_e(["click"]);
|
|
825
830
|
//#endregion
|
|
826
831
|
//#region src/framework/hooks/use-intersection-pause.ts
|
|
827
|
-
function
|
|
832
|
+
function At(e) {
|
|
828
833
|
if (typeof IntersectionObserver > "u") return () => !1;
|
|
829
834
|
let [t, n] = E(!1), r = new IntersectionObserver((e) => {
|
|
830
835
|
let t = e[0];
|
|
@@ -837,17 +842,17 @@ function Ot(e) {
|
|
|
837
842
|
}
|
|
838
843
|
//#endregion
|
|
839
844
|
//#region src/framework/hooks/use-reduced-motion.ts
|
|
840
|
-
function
|
|
845
|
+
function jt() {
|
|
841
846
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
|
|
842
847
|
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
|
|
843
848
|
return e.addEventListener("change", r), D(() => e.removeEventListener("change", r)), t;
|
|
844
849
|
}
|
|
845
850
|
//#endregion
|
|
846
851
|
//#region src/framework/hooks/use-widget-dialog.ts
|
|
847
|
-
function
|
|
852
|
+
function Mt(e = "controls") {
|
|
848
853
|
let [t, n] = E(!1), [r, i] = E(e), a = (t) => {
|
|
849
854
|
i(t ?? e), n(!0);
|
|
850
|
-
}, o = O(
|
|
855
|
+
}, o = O(L);
|
|
851
856
|
return o?.registerDialogOpener?.(a), D(() => o?.registerDialogOpener?.(null)), {
|
|
852
857
|
showDialog: t,
|
|
853
858
|
setShowDialog: n,
|
|
@@ -869,14 +874,14 @@ function At(e = "controls") {
|
|
|
869
874
|
}
|
|
870
875
|
//#endregion
|
|
871
876
|
//#region src/framework/hooks/use-widget-entity-group.ts
|
|
872
|
-
function
|
|
877
|
+
function Nt(e) {
|
|
873
878
|
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(() => {
|
|
874
879
|
if (!r()) return;
|
|
875
880
|
let t = e.aggregationMode?.();
|
|
876
881
|
if (!t || t === "none") return;
|
|
877
882
|
let n = e.entities();
|
|
878
|
-
if (t === "light" || t === "binary-sensor" || t === "switch") return
|
|
879
|
-
if (t === "sensor") return
|
|
883
|
+
if (t === "light" || t === "binary-sensor" || t === "switch") return Ze(n, e.allEntitiesMode);
|
|
884
|
+
if (t === "sensor") return Qe(n, e.sensorGroupType?.() ?? "mean", !0);
|
|
880
885
|
}), o = T(() => r() ? void 0 : e.emptyStateConfig);
|
|
881
886
|
return {
|
|
882
887
|
entities: e.entities,
|
|
@@ -889,142 +894,142 @@ function jt(e) {
|
|
|
889
894
|
}
|
|
890
895
|
//#endregion
|
|
891
896
|
//#region src/framework/gestures/cursors.ts
|
|
892
|
-
var
|
|
893
|
-
function
|
|
897
|
+
var U = 32, W = U / 2, G = "white", K = "rgba(0,0,0,0.4)", q = 2, J = 3;
|
|
898
|
+
function Pt(e) {
|
|
894
899
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
895
900
|
}
|
|
896
|
-
function
|
|
897
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
901
|
+
function Y(e) {
|
|
902
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${U}" viewBox="0 0 ${U} ${U}">${e}</svg>`;
|
|
898
903
|
}
|
|
899
|
-
var
|
|
904
|
+
var Ft = Y(`
|
|
900
905
|
<g transform="translate(6, 2)">
|
|
901
906
|
<!-- shadow -->
|
|
902
|
-
<g stroke="${
|
|
907
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
903
908
|
<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"/>
|
|
904
909
|
</g>
|
|
905
910
|
<!-- main -->
|
|
906
|
-
<g stroke="${
|
|
911
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
907
912
|
<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"/>
|
|
908
913
|
</g>
|
|
909
914
|
</g>
|
|
910
|
-
`),
|
|
915
|
+
`), It = Y(`
|
|
911
916
|
<g>
|
|
912
|
-
<circle cx="${
|
|
913
|
-
<circle cx="${
|
|
914
|
-
<circle cx="${
|
|
917
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${K}" stroke-width="${J}" fill="none"/>
|
|
918
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${G}" stroke-width="1.5" fill="none"/>
|
|
919
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
915
920
|
</g>
|
|
916
|
-
`),
|
|
921
|
+
`), Lt = Y(`
|
|
917
922
|
<g>
|
|
918
923
|
<!-- shadow -->
|
|
919
|
-
<g stroke="${
|
|
920
|
-
<line x1="6" y1="${
|
|
921
|
-
<polyline points="10,${
|
|
922
|
-
<polyline points="22,${
|
|
924
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
925
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
926
|
+
<polyline points="10,${W - 4} 6,${W} 10,20"/>
|
|
927
|
+
<polyline points="22,${W - 4} 26,${W} 22,20"/>
|
|
923
928
|
</g>
|
|
924
929
|
<!-- main -->
|
|
925
|
-
<g stroke="${
|
|
926
|
-
<line x1="6" y1="${
|
|
927
|
-
<polyline points="10,${
|
|
928
|
-
<polyline points="22,${
|
|
930
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
931
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
932
|
+
<polyline points="10,${W - 4} 6,${W} 10,20"/>
|
|
933
|
+
<polyline points="22,${W - 4} 26,${W} 22,20"/>
|
|
929
934
|
</g>
|
|
930
935
|
<!-- center grip dots -->
|
|
931
|
-
<circle cx="${
|
|
932
|
-
<circle cx="${
|
|
933
|
-
<circle cx="21" cy="${
|
|
936
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
937
|
+
<circle cx="${W - 5}" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
938
|
+
<circle cx="21" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
934
939
|
</g>
|
|
935
|
-
`),
|
|
940
|
+
`), Rt = Y(`
|
|
936
941
|
<g>
|
|
937
942
|
<!-- shadow -->
|
|
938
|
-
<g stroke="${
|
|
939
|
-
<line x1="${
|
|
940
|
-
<polyline points="${
|
|
941
|
-
<polyline points="${
|
|
943
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
944
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
945
|
+
<polyline points="${W - 4},10 ${W},6 20,10"/>
|
|
946
|
+
<polyline points="${W - 4},22 ${W},26 20,22"/>
|
|
942
947
|
</g>
|
|
943
948
|
<!-- main -->
|
|
944
|
-
<g stroke="${
|
|
945
|
-
<line x1="${
|
|
946
|
-
<polyline points="${
|
|
947
|
-
<polyline points="${
|
|
949
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
950
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
951
|
+
<polyline points="${W - 4},10 ${W},6 20,10"/>
|
|
952
|
+
<polyline points="${W - 4},22 ${W},26 20,22"/>
|
|
948
953
|
</g>
|
|
949
954
|
<!-- center grip dots -->
|
|
950
|
-
<circle cx="${
|
|
951
|
-
<circle cx="${
|
|
952
|
-
<circle cx="${
|
|
955
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
956
|
+
<circle cx="${W}" cy="${W - 5}" r="1" fill="${G}" opacity="0.6"/>
|
|
957
|
+
<circle cx="${W}" cy="21" r="1" fill="${G}" opacity="0.6"/>
|
|
953
958
|
</g>
|
|
954
|
-
`),
|
|
959
|
+
`), zt = Y(`
|
|
955
960
|
<g>
|
|
956
961
|
<!-- shadow -->
|
|
957
|
-
<g stroke="${
|
|
958
|
-
<line x1="7" y1="${
|
|
959
|
-
<line x1="${
|
|
960
|
-
<polyline points="11,${
|
|
961
|
-
<polyline points="21,${
|
|
962
|
-
<polyline points="${
|
|
963
|
-
<polyline points="${
|
|
962
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
963
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
964
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
965
|
+
<polyline points="11,${W - 3} 7,${W} 11,19"/>
|
|
966
|
+
<polyline points="21,${W - 3} 25,${W} 21,19"/>
|
|
967
|
+
<polyline points="${W - 3},11 ${W},7 19,11"/>
|
|
968
|
+
<polyline points="${W - 3},21 ${W},25 19,21"/>
|
|
964
969
|
</g>
|
|
965
970
|
<!-- main -->
|
|
966
|
-
<g stroke="${
|
|
967
|
-
<line x1="7" y1="${
|
|
968
|
-
<line x1="${
|
|
969
|
-
<polyline points="11,${
|
|
970
|
-
<polyline points="21,${
|
|
971
|
-
<polyline points="${
|
|
972
|
-
<polyline points="${
|
|
971
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
972
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
973
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
974
|
+
<polyline points="11,${W - 3} 7,${W} 11,19"/>
|
|
975
|
+
<polyline points="21,${W - 3} 25,${W} 21,19"/>
|
|
976
|
+
<polyline points="${W - 3},11 ${W},7 19,11"/>
|
|
977
|
+
<polyline points="${W - 3},21 ${W},25 19,21"/>
|
|
973
978
|
</g>
|
|
974
979
|
<!-- center dot -->
|
|
975
|
-
<circle cx="${
|
|
980
|
+
<circle cx="${W}" cy="${W}" r="2" fill="${G}"/>
|
|
976
981
|
</g>
|
|
977
982
|
`);
|
|
978
|
-
function
|
|
983
|
+
function X(e, t, n) {
|
|
979
984
|
return {
|
|
980
|
-
css: `${
|
|
985
|
+
css: `${Pt(e)} ${t} ${n}, auto`,
|
|
981
986
|
hotspotX: t,
|
|
982
987
|
hotspotY: n
|
|
983
988
|
};
|
|
984
989
|
}
|
|
985
|
-
var
|
|
986
|
-
tap:
|
|
987
|
-
hold:
|
|
988
|
-
slideHorizontal:
|
|
989
|
-
slideVertical:
|
|
990
|
-
slideAuto:
|
|
990
|
+
var Z = {
|
|
991
|
+
tap: X(Ft, 12, 4),
|
|
992
|
+
hold: X(It, 16, 16),
|
|
993
|
+
slideHorizontal: X(Lt, W, W),
|
|
994
|
+
slideVertical: X(Rt, W, W),
|
|
995
|
+
slideAuto: X(zt, W, W)
|
|
991
996
|
};
|
|
992
997
|
//#endregion
|
|
993
998
|
//#region src/framework/gestures/haptics.ts
|
|
994
|
-
function
|
|
999
|
+
function Bt() {
|
|
995
1000
|
if (typeof window > "u") return null;
|
|
996
1001
|
let e = window;
|
|
997
1002
|
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
998
1003
|
}
|
|
999
|
-
function
|
|
1004
|
+
function Q(e) {
|
|
1000
1005
|
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
|
|
1001
1006
|
navigator.vibrate(e);
|
|
1002
1007
|
} catch {}
|
|
1003
1008
|
}
|
|
1004
|
-
var
|
|
1009
|
+
var Vt = {
|
|
1005
1010
|
tick() {
|
|
1006
|
-
let e =
|
|
1011
|
+
let e = Bt();
|
|
1007
1012
|
if (e) {
|
|
1008
1013
|
e.impact({ style: "Light" }).catch(() => {});
|
|
1009
1014
|
return;
|
|
1010
1015
|
}
|
|
1011
|
-
|
|
1016
|
+
Q(8);
|
|
1012
1017
|
},
|
|
1013
1018
|
bump() {
|
|
1014
|
-
let e =
|
|
1019
|
+
let e = Bt();
|
|
1015
1020
|
if (e) {
|
|
1016
1021
|
e.impact({ style: "Medium" }).catch(() => {});
|
|
1017
1022
|
return;
|
|
1018
1023
|
}
|
|
1019
|
-
|
|
1024
|
+
Q(20);
|
|
1020
1025
|
},
|
|
1021
1026
|
pulse() {
|
|
1022
|
-
let e =
|
|
1027
|
+
let e = Bt();
|
|
1023
1028
|
if (e) {
|
|
1024
1029
|
e.impact({ style: "Heavy" }).catch(() => {});
|
|
1025
1030
|
return;
|
|
1026
1031
|
}
|
|
1027
|
-
|
|
1032
|
+
Q([
|
|
1028
1033
|
0,
|
|
1029
1034
|
15,
|
|
1030
1035
|
40,
|
|
@@ -1034,7 +1039,7 @@ var Bt = {
|
|
|
1034
1039
|
};
|
|
1035
1040
|
//#endregion
|
|
1036
1041
|
//#region src/framework/gestures/use-widget-gestures.ts
|
|
1037
|
-
function
|
|
1042
|
+
function Ht(e, t) {
|
|
1038
1043
|
let n = {
|
|
1039
1044
|
isDown: !1,
|
|
1040
1045
|
isTouch: !1,
|
|
@@ -1077,7 +1082,7 @@ function Vt(e, t) {
|
|
|
1077
1082
|
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) {
|
|
1078
1083
|
let e = r.hold.delay ?? 300;
|
|
1079
1084
|
n.holdTimer = setTimeout(() => {
|
|
1080
|
-
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (
|
|
1085
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Vt.bump(), r.hold?.action(), n.isDown = !1);
|
|
1081
1086
|
}, e);
|
|
1082
1087
|
}
|
|
1083
1088
|
if (!n.isTouch && r.slide) try {
|
|
@@ -1114,9 +1119,9 @@ function Vt(e, t) {
|
|
|
1114
1119
|
let n = e();
|
|
1115
1120
|
if (n.slide) {
|
|
1116
1121
|
let e = n.slide.orientation;
|
|
1117
|
-
return e === "horizontal" ?
|
|
1122
|
+
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);
|
|
1118
1123
|
}
|
|
1119
|
-
return n.tap ?
|
|
1124
|
+
return n.tap ? Z.tap.css : n.hold ? Z.hold.css : "";
|
|
1120
1125
|
};
|
|
1121
1126
|
return {
|
|
1122
1127
|
onPointerDown: f,
|
|
@@ -1145,7 +1150,7 @@ function Vt(e, t) {
|
|
|
1145
1150
|
}
|
|
1146
1151
|
//#endregion
|
|
1147
1152
|
//#region src/framework/theming/svg-colors.ts
|
|
1148
|
-
var
|
|
1153
|
+
var Ut = {
|
|
1149
1154
|
solar: "oklch(0.74 0.18 60)",
|
|
1150
1155
|
grid: "oklch(0.62 0.12 245)",
|
|
1151
1156
|
battery: "oklch(0.70 0.18 145)",
|
|
@@ -1154,21 +1159,21 @@ var Ht = {
|
|
|
1154
1159
|
positive: "oklch(0.70 0.14 160)",
|
|
1155
1160
|
negative: "oklch(0.64 0.22 27)"
|
|
1156
1161
|
};
|
|
1157
|
-
function
|
|
1162
|
+
function Wt(e) {
|
|
1158
1163
|
return {
|
|
1159
1164
|
fill: `color-mix(in oklch, ${e} 20%, transparent)`,
|
|
1160
1165
|
stroke: e,
|
|
1161
1166
|
solid: e
|
|
1162
1167
|
};
|
|
1163
1168
|
}
|
|
1164
|
-
var
|
|
1169
|
+
var Gt = Object.fromEntries(Object.entries(Ut).map(([e, t]) => [e, Wt(t)])), Kt = o.enum([
|
|
1165
1170
|
"success",
|
|
1166
1171
|
"warning",
|
|
1167
1172
|
"danger",
|
|
1168
1173
|
"info",
|
|
1169
1174
|
"neutral",
|
|
1170
1175
|
"accent"
|
|
1171
|
-
]),
|
|
1176
|
+
]), qt = {
|
|
1172
1177
|
title: e(() => o.string().optional().meta({
|
|
1173
1178
|
title: "Title",
|
|
1174
1179
|
description: "Optional display name override"
|
|
@@ -1196,39 +1201,39 @@ function $(e) {
|
|
|
1196
1201
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
1197
1202
|
return t;
|
|
1198
1203
|
}
|
|
1199
|
-
function
|
|
1204
|
+
function Jt() {
|
|
1200
1205
|
return o.string().optional().meta({
|
|
1201
1206
|
title: "Title",
|
|
1202
1207
|
description: "Optional display name override"
|
|
1203
1208
|
});
|
|
1204
1209
|
}
|
|
1205
|
-
function
|
|
1210
|
+
function Yt(e) {
|
|
1206
1211
|
return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta($({
|
|
1207
1212
|
title: e.title,
|
|
1208
1213
|
description: e.description
|
|
1209
1214
|
}));
|
|
1210
1215
|
}
|
|
1211
|
-
function
|
|
1216
|
+
function Xt(e) {
|
|
1212
1217
|
let t = o.number();
|
|
1213
1218
|
return e.min !== void 0 && (t = t.min(e.min)), e.max !== void 0 && (t = t.max(e.max)), (e.default === void 0 ? t.optional() : t.default(e.default)).meta($({
|
|
1214
1219
|
title: e.title,
|
|
1215
1220
|
description: e.description
|
|
1216
1221
|
}));
|
|
1217
1222
|
}
|
|
1218
|
-
function
|
|
1223
|
+
function Zt(e) {
|
|
1219
1224
|
return o.boolean().default(e.default ?? !1).meta($({
|
|
1220
1225
|
title: e.title,
|
|
1221
1226
|
description: e.description
|
|
1222
1227
|
}));
|
|
1223
1228
|
}
|
|
1224
|
-
function
|
|
1229
|
+
function Qt(e, t) {
|
|
1225
1230
|
let n = o.enum(e);
|
|
1226
1231
|
return (t.default === void 0 ? n.optional() : n.default(t.default)).meta($({
|
|
1227
1232
|
title: t.title,
|
|
1228
1233
|
description: t.description
|
|
1229
1234
|
}));
|
|
1230
1235
|
}
|
|
1231
|
-
function
|
|
1236
|
+
function $t(e, t) {
|
|
1232
1237
|
return o.array(o.string()).default([]).meta($({
|
|
1233
1238
|
domain: e,
|
|
1234
1239
|
title: t?.title ?? "Entities",
|
|
@@ -1236,7 +1241,7 @@ function Qt(e, t) {
|
|
|
1236
1241
|
deviceClass: t?.deviceClass
|
|
1237
1242
|
}));
|
|
1238
1243
|
}
|
|
1239
|
-
function
|
|
1244
|
+
function en(e, t) {
|
|
1240
1245
|
return o.array(o.string()).default([]).meta($({
|
|
1241
1246
|
domain: e,
|
|
1242
1247
|
title: t?.title ?? "Entity",
|
|
@@ -1245,40 +1250,40 @@ function $t(e, t) {
|
|
|
1245
1250
|
singleSelect: !0
|
|
1246
1251
|
}));
|
|
1247
1252
|
}
|
|
1248
|
-
function
|
|
1253
|
+
function tn(e) {
|
|
1249
1254
|
return o.string().optional().meta({
|
|
1250
1255
|
formType: "area-picker",
|
|
1251
1256
|
title: e?.title ?? "Area"
|
|
1252
1257
|
});
|
|
1253
1258
|
}
|
|
1254
|
-
function
|
|
1259
|
+
function nn(e) {
|
|
1255
1260
|
return o.array(o.string()).default([]).meta($({
|
|
1256
1261
|
title: e.title,
|
|
1257
1262
|
description: e.description
|
|
1258
1263
|
}));
|
|
1259
1264
|
}
|
|
1260
|
-
function
|
|
1265
|
+
function rn(e, t) {
|
|
1261
1266
|
let n = o.object(e);
|
|
1262
|
-
return n.default(
|
|
1267
|
+
return n.default(Ce(n)).meta({ title: t.title });
|
|
1263
1268
|
}
|
|
1264
|
-
var
|
|
1265
|
-
title:
|
|
1266
|
-
text:
|
|
1267
|
-
number:
|
|
1268
|
-
toggle:
|
|
1269
|
-
choice:
|
|
1270
|
-
entities:
|
|
1271
|
-
entity:
|
|
1272
|
-
area:
|
|
1273
|
-
stringList:
|
|
1274
|
-
group:
|
|
1269
|
+
var an = {
|
|
1270
|
+
title: Jt,
|
|
1271
|
+
text: Yt,
|
|
1272
|
+
number: Xt,
|
|
1273
|
+
toggle: Zt,
|
|
1274
|
+
choice: Qt,
|
|
1275
|
+
entities: $t,
|
|
1276
|
+
entity: en,
|
|
1277
|
+
area: tn,
|
|
1278
|
+
stringList: nn,
|
|
1279
|
+
group: rn
|
|
1275
1280
|
};
|
|
1276
|
-
function
|
|
1281
|
+
function on(e) {
|
|
1277
1282
|
return o.object(e);
|
|
1278
1283
|
}
|
|
1279
1284
|
//#endregion
|
|
1280
1285
|
//#region src/shared/spline.ts
|
|
1281
|
-
function
|
|
1286
|
+
function sn(e) {
|
|
1282
1287
|
if (e.length < 2) return "";
|
|
1283
1288
|
let t = e[0], n = e[1];
|
|
1284
1289
|
if (!t || !n) return "";
|
|
@@ -1305,14 +1310,14 @@ function on(e) {
|
|
|
1305
1310
|
}
|
|
1306
1311
|
//#endregion
|
|
1307
1312
|
//#region src/theme.ts
|
|
1308
|
-
function
|
|
1313
|
+
function cn() {
|
|
1309
1314
|
return document.documentElement.classList.contains("dark");
|
|
1310
1315
|
}
|
|
1311
1316
|
//#endregion
|
|
1312
1317
|
//#region src/version.ts
|
|
1313
|
-
var
|
|
1318
|
+
var ln = {
|
|
1314
1319
|
name: "@glasshome/widget-sdk",
|
|
1315
|
-
version: "1.
|
|
1320
|
+
version: "1.5.0",
|
|
1316
1321
|
description: "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
1317
1322
|
keywords: [
|
|
1318
1323
|
"glasshome",
|
|
@@ -1364,7 +1369,7 @@ var cn = {
|
|
|
1364
1369
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json"
|
|
1365
1370
|
},
|
|
1366
1371
|
peerDependencies: {
|
|
1367
|
-
"@glasshome/sync-layer": "0.3.
|
|
1372
|
+
"@glasshome/sync-layer": "0.3.2",
|
|
1368
1373
|
"solid-js": "^1.9.11"
|
|
1369
1374
|
},
|
|
1370
1375
|
dependencies: {
|
|
@@ -1395,4 +1400,4 @@ var cn = {
|
|
|
1395
1400
|
engines: { node: ">=18" }
|
|
1396
1401
|
}.version;
|
|
1397
1402
|
//#endregion
|
|
1398
|
-
export {
|
|
1403
|
+
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, ee as useConnection, y as useCurrency, b as useEntities, te as useEntity, x as useEntityHistory, ne as useEntityStatistics, re as useForecast, ie as useHassConfig, At as useIntersectionPause, ae as useLocale, jt as useReducedMotion, De as useService, oe as useStore, se as useTemperatureUnit, Ae as useToggle, ke as useTurnOff, Oe as useTurnOn, de as useUnitSystem, Te as useWidgetContext, Mt as useWidgetDialog, Nt as useWidgetEntityGroup, Ht as useWidgetGestures, qt as widgetFields, a as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/widget-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"glasshome",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@glasshome/sync-layer": "0.3.
|
|
55
|
+
"@glasshome/sync-layer": "0.3.2",
|
|
56
56
|
"solid-js": "^1.9.11"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|