@glasshome/widget-sdk 1.2.1 → 1.3.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/index.js +298 -298
- package/package.json +2 -2
package/dist/data.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* import map), and a direct import would bundle a second, disconnected
|
|
6
6
|
* store. Phase 4 routes these through capability checks.
|
|
7
7
|
*/
|
|
8
|
-
export { getForecasts, getStream, getWebRtcClientConfig, sendWebRtcCandidate, startWebRtcSession, state, trackEntityHistory, untrackEntityHistory, } from "@glasshome/sync-layer";
|
|
8
|
+
export { getForecasts, getStream, getWebRtcClientConfig, hassMediaUrl, sendWebRtcCandidate, startWebRtcSession, state, trackEntityHistory, untrackEntityHistory, } from "@glasshome/sync-layer";
|
|
9
9
|
export type { AreaView } from "@glasshome/sync-layer";
|
|
10
10
|
export { byDomain, useArea, useCamera, useConnection, useCurrency, useEntities, useEntity, useEntityHistory, useEntityStatistics, useForecast, useHassConfig, useLocale, useStore, useTemperatureUnit, useUnitSystem, } from "@glasshome/sync-layer/solid";
|
|
11
11
|
export { useService, useToggle, useTurnOff, useTurnOn } from "./framework/hooks/use-service";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { WidgetManifestSchema as e, formatSchemaError as t } from "./schemas.js";
|
|
2
2
|
import { z as n } from "zod";
|
|
3
|
-
import { getForecasts as r, getStream as i, getWebRtcClientConfig as a,
|
|
4
|
-
import { byDomain as
|
|
5
|
-
import { Show as
|
|
6
|
-
import { addEventListener as
|
|
7
|
-
import { createElementSize as
|
|
8
|
-
import { clsx as
|
|
9
|
-
import { twMerge as
|
|
3
|
+
import { getForecasts as r, getStream as i, getWebRtcClientConfig as a, hassMediaUrl as o, sendWebRtcCandidate as s, startWebRtcSession as c, state as l, trackEntityHistory as u, untrackEntityHistory as d } from "@glasshome/sync-layer";
|
|
4
|
+
import { byDomain as f, useArea as p, useCamera as m, useConnection as h, useCurrency as g, useEntities as _, useEntity as v, useEntityHistory as y, useEntityStatistics as b, useForecast as x, useHassConfig as ee, useLocale as S, useService as te, useStore as ne, useTemperatureUnit as re, useToggle as C, useTurnOff as ie, useTurnOn as ae, useUnitSystem as oe } from "@glasshome/sync-layer/solid";
|
|
5
|
+
import { Show as w, createContext as se, createEffect as T, createMemo as E, createSignal as D, on as ce, onCleanup as O, onMount as le, splitProps as ue, useContext as k } from "solid-js";
|
|
6
|
+
import { addEventListener as A, className as j, createComponent as M, delegateEvents as de, effect as N, insert as P, memo as F, setStyleProperty as I, style as L, template as R, use as fe } from "solid-js/web";
|
|
7
|
+
import { createElementSize as pe } from "@solid-primitives/resize-observer";
|
|
8
|
+
import { clsx as me } from "clsx";
|
|
9
|
+
import { twMerge as he } from "tailwind-merge";
|
|
10
10
|
//#region src/framework/to-form-schema.ts
|
|
11
|
-
function
|
|
11
|
+
function ge(e) {
|
|
12
12
|
return n.toJSONSchema(e, { override: (e) => {
|
|
13
13
|
let t = n.globalRegistry.get(e.zodSchema);
|
|
14
14
|
return t && typeof t == "object" && Object.keys(t).length > 0 ? {
|
|
@@ -17,7 +17,7 @@ function ve(e) {
|
|
|
17
17
|
} : e.jsonSchema;
|
|
18
18
|
} });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function _e(e) {
|
|
21
21
|
try {
|
|
22
22
|
return e.parse({});
|
|
23
23
|
} catch {
|
|
@@ -26,82 +26,82 @@ function ye(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 ve(e) {
|
|
30
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = ge(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = _e(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 =
|
|
34
|
+
var z = se();
|
|
35
|
+
function ye() {
|
|
36
|
+
let e = k(z);
|
|
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 be(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 B(e, t) {
|
|
48
|
+
return (n, r = {}) => e(be(n), t, r, { entity_id: n });
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
let e =
|
|
50
|
+
function xe() {
|
|
51
|
+
let e = k(z)?.callService;
|
|
52
52
|
return e ? {
|
|
53
53
|
callService: e,
|
|
54
|
-
turnOn:
|
|
55
|
-
turnOff:
|
|
56
|
-
toggle:
|
|
57
|
-
} :
|
|
54
|
+
turnOn: B(e, "turn_on"),
|
|
55
|
+
turnOff: B(e, "turn_off"),
|
|
56
|
+
toggle: B(e, "toggle")
|
|
57
|
+
} : te();
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
let e =
|
|
61
|
-
return e ?
|
|
59
|
+
function Se() {
|
|
60
|
+
let e = k(z)?.callService;
|
|
61
|
+
return e ? B(e, "turn_on") : ae();
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
let e =
|
|
65
|
-
return e ?
|
|
63
|
+
function Ce() {
|
|
64
|
+
let e = k(z)?.callService;
|
|
65
|
+
return e ? B(e, "turn_off") : ie();
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
let e =
|
|
69
|
-
return e ?
|
|
67
|
+
function we() {
|
|
68
|
+
let e = k(z)?.callService;
|
|
69
|
+
return e ? B(e, "toggle") : C();
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/framework/design-system/z-index.ts
|
|
73
|
-
var
|
|
73
|
+
var V = {
|
|
74
74
|
BACKGROUND: 0,
|
|
75
75
|
CONTENT: 10,
|
|
76
76
|
OVERLAY: 20,
|
|
77
77
|
ACTIONS: 30
|
|
78
|
-
},
|
|
79
|
-
function
|
|
80
|
-
return
|
|
78
|
+
}, Te = "/* 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", Ee = !1, H, De = /* @__PURE__ */ new WeakSet();
|
|
79
|
+
function Oe() {
|
|
80
|
+
return H || (H = new CSSStyleSheet(), H.replaceSync(Te.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), H;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function ke(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 (De.has(e)) return;
|
|
85
|
+
let t = Oe();
|
|
86
|
+
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), De.add(e);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
if (
|
|
89
|
+
if (Ee) 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
|
+
Ee = !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 = Te, t.head.appendChild(n), Ee = !0;
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/framework/utils/cn.ts
|
|
101
|
-
function
|
|
102
|
-
return
|
|
101
|
+
function U(...e) {
|
|
102
|
+
return he(me(e));
|
|
103
103
|
}
|
|
104
|
-
var
|
|
104
|
+
var Ae = {
|
|
105
105
|
"classic-glass": {
|
|
106
106
|
id: "classic-glass",
|
|
107
107
|
name: "Classic Glass",
|
|
@@ -187,22 +187,22 @@ var je = {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
|
-
function
|
|
191
|
-
return
|
|
190
|
+
function je(e) {
|
|
191
|
+
return Ae[e];
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/framework/backgrounds/WidgetSliderFill.tsx
|
|
195
|
-
var
|
|
196
|
-
function
|
|
195
|
+
var Me = /*#__PURE__*/ R("<div>");
|
|
196
|
+
function Ne(e) {
|
|
197
197
|
return (() => {
|
|
198
|
-
var t =
|
|
199
|
-
return
|
|
200
|
-
var r =
|
|
198
|
+
var t = Me();
|
|
199
|
+
return N((n) => {
|
|
200
|
+
var r = U("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": V.BACKGROUND,
|
|
203
203
|
...e.color ? { "--widget-icon-color": e.color } : {}
|
|
204
204
|
};
|
|
205
|
-
return r !== n.e &&
|
|
205
|
+
return r !== n.e && j(t, n.e = r), n.t = L(t, i, n.t), n;
|
|
206
206
|
}, {
|
|
207
207
|
e: void 0,
|
|
208
208
|
t: void 0
|
|
@@ -211,37 +211,37 @@ function Pe(e) {
|
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/framework/components/WidgetContent.tsx
|
|
214
|
-
var
|
|
215
|
-
function
|
|
214
|
+
var Pe = /*#__PURE__*/ R("<div>");
|
|
215
|
+
function Fe(e) {
|
|
216
216
|
return (() => {
|
|
217
|
-
var t =
|
|
218
|
-
return
|
|
217
|
+
var t = Pe();
|
|
218
|
+
return P(t, () => e.children), N(() => j(t, U("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 Ie = /*#__PURE__*/ R("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), Le = /*#__PURE__*/ R("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), Re = /*#__PURE__*/ R("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
|
|
224
|
+
function ze(e) {
|
|
225
225
|
let t = () => e.entityCount ?? 1;
|
|
226
226
|
return (() => {
|
|
227
|
-
var n =
|
|
228
|
-
return
|
|
227
|
+
var n = Re(), r = n.firstChild;
|
|
228
|
+
return P(n, M(w, {
|
|
229
229
|
get when() {
|
|
230
230
|
return t() >= 2;
|
|
231
231
|
},
|
|
232
232
|
get children() {
|
|
233
|
-
return
|
|
233
|
+
return Ie();
|
|
234
234
|
}
|
|
235
|
-
}), r),
|
|
235
|
+
}), r), P(n, M(w, {
|
|
236
236
|
get when() {
|
|
237
237
|
return t() >= 3;
|
|
238
238
|
},
|
|
239
239
|
get children() {
|
|
240
|
-
return
|
|
240
|
+
return Le();
|
|
241
241
|
}
|
|
242
|
-
}), r),
|
|
243
|
-
var r =
|
|
244
|
-
return r !== t.e &&
|
|
242
|
+
}), r), P(r, () => e.icon), N((t) => {
|
|
243
|
+
var r = U("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 && j(n, t.e = r), t.t = L(n, i, t.t), t;
|
|
245
245
|
}, {
|
|
246
246
|
e: void 0,
|
|
247
247
|
t: void 0
|
|
@@ -250,16 +250,16 @@ function Be(e) {
|
|
|
250
250
|
}
|
|
251
251
|
//#endregion
|
|
252
252
|
//#region src/framework/components/WidgetStatus.tsx
|
|
253
|
-
var
|
|
254
|
-
function
|
|
253
|
+
var Be = /*#__PURE__*/ R("<p>");
|
|
254
|
+
function Ve(e) {
|
|
255
255
|
return (() => {
|
|
256
|
-
var t =
|
|
257
|
-
return
|
|
258
|
-
var t =
|
|
256
|
+
var t = Be();
|
|
257
|
+
return P(t, (() => {
|
|
258
|
+
var t = F(() => !!e.isUnavailable);
|
|
259
259
|
return () => t() ? "Unavailable" : e.children;
|
|
260
|
-
})()),
|
|
261
|
-
var r =
|
|
262
|
-
return r !== n.e &&
|
|
260
|
+
})()), N((n) => {
|
|
261
|
+
var r = U("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = V.ACTIONS;
|
|
262
|
+
return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
|
|
263
263
|
}, {
|
|
264
264
|
e: void 0,
|
|
265
265
|
t: void 0
|
|
@@ -268,21 +268,21 @@ function He(e) {
|
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/framework/components/WidgetTitle.tsx
|
|
271
|
-
var
|
|
272
|
-
function
|
|
271
|
+
var He = /*#__PURE__*/ R("<span class=\"glasshome-widget-badge shrink-0\">"), Ue = /*#__PURE__*/ R("<div><h3 class=glasshome-widget-title>");
|
|
272
|
+
function We(e) {
|
|
273
273
|
return (() => {
|
|
274
|
-
var t =
|
|
275
|
-
return
|
|
274
|
+
var t = Ue(), n = t.firstChild;
|
|
275
|
+
return P(n, () => e.children), P(t, M(w, {
|
|
276
276
|
get when() {
|
|
277
|
-
return
|
|
277
|
+
return F(() => e.badge !== void 0)() && e.badge > 0;
|
|
278
278
|
},
|
|
279
279
|
get children() {
|
|
280
|
-
var t =
|
|
281
|
-
return
|
|
280
|
+
var t = He();
|
|
281
|
+
return P(t, () => e.badge), t;
|
|
282
282
|
}
|
|
283
|
-
}), null),
|
|
284
|
-
var r =
|
|
285
|
-
return r !== n.e &&
|
|
283
|
+
}), null), N((n) => {
|
|
284
|
+
var r = U("relative flex items-center gap-2", e.class), i = V.ACTIONS;
|
|
285
|
+
return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
|
|
286
286
|
}, {
|
|
287
287
|
e: void 0,
|
|
288
288
|
t: void 0
|
|
@@ -291,7 +291,7 @@ function Ge(e) {
|
|
|
291
291
|
}
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/framework/utils/entity-aggregation.ts
|
|
294
|
-
function
|
|
294
|
+
function Ge(e, t = !1) {
|
|
295
295
|
if (e.length === 0) return {
|
|
296
296
|
isGroup: !1,
|
|
297
297
|
state: "unknown",
|
|
@@ -314,7 +314,7 @@ function Ke(e, t = !1) {
|
|
|
314
314
|
isUnavailable: t.state === "unavailable",
|
|
315
315
|
brightness: r,
|
|
316
316
|
brightnessPercent: i,
|
|
317
|
-
color:
|
|
317
|
+
color: qe(t),
|
|
318
318
|
onCount: +!!n,
|
|
319
319
|
totalCount: 1,
|
|
320
320
|
description: n ? "On" : "Off"
|
|
@@ -337,26 +337,26 @@ function Ke(e, t = !1) {
|
|
|
337
337
|
}
|
|
338
338
|
let u = e.length, d = o === u, f = a + o === u, p = r > 0, m = r === u, h = i === u, g, _;
|
|
339
339
|
t ? d ? (g = "unavailable", _ = !1) : a > 0 || o > 0 ? (g = "unknown", _ = !1) : i > 0 ? (g = "off", _ = !1) : (g = "on", _ = !0) : d ? (g = "unavailable", _ = !1) : f ? (g = "unknown", _ = !1) : p ? (g = "on", _ = !0) : (g = "off", _ = !1);
|
|
340
|
-
let v = c > 0 ? Math.round(s / c) : 0,
|
|
340
|
+
let v = c > 0 ? Math.round(s / c) : 0, y = Math.round(v / 255 * 100), b;
|
|
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
|
-
|
|
344
|
-
} else
|
|
345
|
-
let
|
|
346
|
-
return
|
|
343
|
+
b = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
|
|
344
|
+
} else b = qe(e[0]);
|
|
345
|
+
let x;
|
|
346
|
+
return x = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
|
|
347
347
|
isGroup: n,
|
|
348
348
|
state: g,
|
|
349
349
|
isOn: _,
|
|
350
350
|
isUnavailable: g === "unavailable",
|
|
351
351
|
brightness: v,
|
|
352
|
-
brightnessPercent:
|
|
353
|
-
color:
|
|
352
|
+
brightnessPercent: y,
|
|
353
|
+
color: b,
|
|
354
354
|
onCount: r,
|
|
355
355
|
totalCount: u,
|
|
356
|
-
description:
|
|
356
|
+
description: x
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Ke(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 qe(e, t = "mean", n = !0) {
|
|
|
452
452
|
memberValues: a
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function qe(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 Je(e) {
|
|
|
467
467
|
}
|
|
468
468
|
//#endregion
|
|
469
469
|
//#region src/framework/utils/entity-state.ts
|
|
470
|
-
function
|
|
470
|
+
function Je(e) {
|
|
471
471
|
if (!e) return !1;
|
|
472
472
|
if ([
|
|
473
473
|
"on",
|
|
@@ -483,15 +483,15 @@ function Ye(e) {
|
|
|
483
483
|
}
|
|
484
484
|
return !1;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Ye(e, t, n) {
|
|
487
487
|
return e?.attributes ? e.attributes[t] ?? n : n;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
return e.filter(
|
|
489
|
+
function Xe(e) {
|
|
490
|
+
return e.filter(Je).length;
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/framework/utils/format-value.ts
|
|
494
|
-
function
|
|
494
|
+
function Ze(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,34 +502,34 @@ function Qe(e, t, n) {
|
|
|
502
502
|
}
|
|
503
503
|
//#endregion
|
|
504
504
|
//#region src/framework/utils/interpret-value.ts
|
|
505
|
-
function
|
|
505
|
+
function Qe(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 $e = /*#__PURE__*/ R("<div class=glasshome-widget-subtitle>"), et = /*#__PURE__*/ R("<div><div class=glasshome-widget-value>");
|
|
511
|
+
function tt(e) {
|
|
512
512
|
return (() => {
|
|
513
|
-
var t =
|
|
514
|
-
return
|
|
513
|
+
var t = et(), n = t.firstChild;
|
|
514
|
+
return P(n, () => Ze(e.value, e.unit)), P(t, M(w, {
|
|
515
515
|
get when() {
|
|
516
|
-
return
|
|
516
|
+
return F(() => !!e.interpret)() && typeof e.value == "number";
|
|
517
517
|
},
|
|
518
518
|
get children() {
|
|
519
|
-
var t =
|
|
520
|
-
return
|
|
519
|
+
var t = $e();
|
|
520
|
+
return P(t, () => Qe(e.value, e.unit)), t;
|
|
521
521
|
}
|
|
522
|
-
}), null),
|
|
522
|
+
}), null), N(() => j(t, U("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 =
|
|
530
|
-
|
|
527
|
+
var nt = /*#__PURE__*/ R("<div><div class=\"relative h-full w-full\">"), rt = /*#__PURE__*/ R("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), it = /*#__PURE__*/ R("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), at = /*#__PURE__*/ R("<div class=\"flex items-center justify-center text-white/30\">"), ot = /*#__PURE__*/ R("<h3 class=\"font-semibold text-sm text-white/60\">"), st = /*#__PURE__*/ R("<p class=\"text-white/50 text-xs\">");
|
|
528
|
+
function ct(e) {
|
|
529
|
+
let t = k(z), [n, r] = D(), i = pe(n);
|
|
530
|
+
le(() => {
|
|
531
531
|
let e = n()?.getRootNode();
|
|
532
|
-
|
|
532
|
+
ke(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
|
|
533
533
|
});
|
|
534
534
|
let a = {
|
|
535
535
|
isEditMode: () => e.isEditMode ?? !1,
|
|
@@ -540,9 +540,9 @@ function lt(e) {
|
|
|
540
540
|
width: i.width ?? 0,
|
|
541
541
|
height: i.height ?? 0
|
|
542
542
|
})
|
|
543
|
-
}, o =
|
|
544
|
-
if (e.variant) return typeof e.variant == "string" ?
|
|
545
|
-
}), s =
|
|
543
|
+
}, o = E(() => {
|
|
544
|
+
if (e.variant) return typeof e.variant == "string" ? je(e.variant) : e.variant;
|
|
545
|
+
}), s = E(() => ({
|
|
546
546
|
"container-type": "size",
|
|
547
547
|
"container-name": "widget",
|
|
548
548
|
"touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
|
|
@@ -563,15 +563,15 @@ function lt(e) {
|
|
|
563
563
|
}, p = (t) => {
|
|
564
564
|
c() && e.gestures?.onPointerCancel(t);
|
|
565
565
|
};
|
|
566
|
-
return
|
|
566
|
+
return M(z.Provider, {
|
|
567
567
|
value: a,
|
|
568
568
|
get children() {
|
|
569
|
-
var t =
|
|
570
|
-
return
|
|
569
|
+
var t = nt(), n = t.firstChild;
|
|
570
|
+
return A(t, "pointercancel", p), A(t, "pointerup", f), A(t, "pointermove", d), A(t, "pointerdown", u), A(t, "pointerenter", l), fe((t) => {
|
|
571
571
|
r(t), e.gestures?.bindElement(t);
|
|
572
|
-
}, t),
|
|
573
|
-
var t =
|
|
574
|
-
return () => t() ?
|
|
572
|
+
}, t), P(n, (() => {
|
|
573
|
+
var t = F(() => !!e.emptyState);
|
|
574
|
+
return () => t() ? M(lt, {
|
|
575
575
|
get icon() {
|
|
576
576
|
return e.emptyState.icon;
|
|
577
577
|
},
|
|
@@ -582,15 +582,15 @@ function lt(e) {
|
|
|
582
582
|
return e.emptyState.message;
|
|
583
583
|
}
|
|
584
584
|
}) : e.children;
|
|
585
|
-
})()),
|
|
586
|
-
var t =
|
|
585
|
+
})()), P(t, (() => {
|
|
586
|
+
var t = F(() => !!e.loading);
|
|
587
587
|
return () => t() && (() => {
|
|
588
|
-
var e =
|
|
589
|
-
return
|
|
588
|
+
var e = rt();
|
|
589
|
+
return N((t) => I(e, "z-index", V.OVERLAY)), e;
|
|
590
590
|
})();
|
|
591
|
-
})(), null),
|
|
592
|
-
var i =
|
|
593
|
-
return i !== r.e &&
|
|
591
|
+
})(), null), N((r) => {
|
|
592
|
+
var i = U("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 = V.CONTENT;
|
|
593
|
+
return i !== r.e && j(t, r.e = i), r.t = L(t, a, r.t), c !== r.a && I(n, "z-index", r.a = c), r;
|
|
594
594
|
}, {
|
|
595
595
|
e: void 0,
|
|
596
596
|
t: void 0,
|
|
@@ -599,61 +599,61 @@ function lt(e) {
|
|
|
599
599
|
}
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function lt(e) {
|
|
603
603
|
return (() => {
|
|
604
|
-
var t =
|
|
605
|
-
return
|
|
606
|
-
var t =
|
|
604
|
+
var t = it();
|
|
605
|
+
return P(t, (() => {
|
|
606
|
+
var t = F(() => !!e.icon);
|
|
607
607
|
return () => t() && (() => {
|
|
608
|
-
var t =
|
|
609
|
-
return
|
|
608
|
+
var t = at();
|
|
609
|
+
return P(t, () => e.icon), t;
|
|
610
610
|
})();
|
|
611
|
-
})(), null),
|
|
612
|
-
var t =
|
|
611
|
+
})(), null), P(t, (() => {
|
|
612
|
+
var t = F(() => !!e.title);
|
|
613
613
|
return () => t() && (() => {
|
|
614
|
-
var t =
|
|
615
|
-
return
|
|
614
|
+
var t = ot();
|
|
615
|
+
return P(t, () => e.title), t;
|
|
616
616
|
})();
|
|
617
|
-
})(), null),
|
|
618
|
-
var t =
|
|
617
|
+
})(), null), P(t, (() => {
|
|
618
|
+
var t = F(() => !!e.message);
|
|
619
619
|
return () => t() && (() => {
|
|
620
|
-
var t =
|
|
621
|
-
return
|
|
620
|
+
var t = st();
|
|
621
|
+
return P(t, () => e.message), t;
|
|
622
622
|
})();
|
|
623
623
|
})(), null), t;
|
|
624
624
|
})();
|
|
625
625
|
}
|
|
626
|
-
var
|
|
627
|
-
|
|
626
|
+
var W = ct;
|
|
627
|
+
W.Content = Fe, W.Icon = ze, W.Title = We, W.Status = Ve, W.Value = tt, W.SliderFill = Ne;
|
|
628
628
|
//#endregion
|
|
629
629
|
//#region src/framework/dialogs/WidgetDialog.tsx
|
|
630
|
-
var
|
|
631
|
-
function
|
|
630
|
+
var ut = /*#__PURE__*/ R("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), dt = /*#__PURE__*/ R("<button type=button>"), ft = /*#__PURE__*/ R("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"></path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\">"), pt = /*#__PURE__*/ R("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No edit options available"), mt = /*#__PURE__*/ R("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>"), ht = /*#__PURE__*/ R("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), gt = /*#__PURE__*/ R("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"m8 2 1.88 1.88\"></path><path d=\"M14.12 3.88 16 2\"></path><path d=\"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1\"></path><path d=\"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6\"></path><path d=\"M12 20v-9\"></path><path d=\"M6.53 9C4.6 8.8 3 7.1 3 5\"></path><path d=\"M6 13H2\"></path><path d=\"M3 21c0-2.1 1.7-3.9 3.8-4\"></path><path d=\"M20.97 5c0 2.1-1.6 3.8-3.5 4\"></path><path d=\"M22 13h-4\"></path><path d=\"M17.2 17c2.1.1 3.8 1.9 3.8 4\">"), _t = /*#__PURE__*/ R("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No debug information available"), vt = /*#__PURE__*/ R("<div class=\"min-w-0 shrink-0\">"), yt = /*#__PURE__*/ R("<div class=\"flex items-center gap-2\"><div class=\"flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5\">"), bt = /*#__PURE__*/ R("<div class=\"min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]\">"), xt = /*#__PURE__*/ R("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3\">");
|
|
631
|
+
function St(e) {
|
|
632
632
|
return (() => {
|
|
633
|
-
var t =
|
|
634
|
-
return t.$$click = () => e.onClick(),
|
|
633
|
+
var t = dt();
|
|
634
|
+
return t.$$click = () => e.onClick(), P(t, M(w, {
|
|
635
635
|
get when() {
|
|
636
636
|
return e.isActive;
|
|
637
637
|
},
|
|
638
638
|
get children() {
|
|
639
|
-
var t =
|
|
640
|
-
return
|
|
639
|
+
var t = ut();
|
|
640
|
+
return P(t, () => e.icon), t;
|
|
641
641
|
}
|
|
642
|
-
}), null),
|
|
642
|
+
}), null), P(t, () => e.label, null), N(() => j(t, U("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
643
|
})();
|
|
644
644
|
}
|
|
645
|
-
function
|
|
646
|
-
let [t] =
|
|
647
|
-
ce(
|
|
645
|
+
function Ct(e) {
|
|
646
|
+
let [t] = ue(e, /* @__PURE__ */ "open.onOpenChange.title.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.Button.SchemaForm".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = D({}), [a, o] = D(null);
|
|
647
|
+
T(ce(() => t.config, (e) => {
|
|
648
648
|
e && i({ ...e });
|
|
649
|
-
})), ce(
|
|
650
|
-
e && o(
|
|
649
|
+
})), T(ce(() => t.configSchema, (e) => {
|
|
650
|
+
e && o(ge(e));
|
|
651
651
|
}));
|
|
652
652
|
let s = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), c = (e) => {
|
|
653
653
|
!e && t.config && i({ ...t.config }), t.onOpenChange(e);
|
|
654
654
|
}, l = () => {
|
|
655
655
|
t.onConfigSave?.(r());
|
|
656
|
-
}, [u, d] =
|
|
656
|
+
}, [u, d] = D(t.defaultTab ?? "controls"), f = () => t.activeTab ?? u(), p = (e) => {
|
|
657
657
|
t.onActiveTabChange ? t.onActiveTabChange(e) : d(e);
|
|
658
658
|
}, m = () => ({
|
|
659
659
|
sm: "max-w-sm",
|
|
@@ -669,8 +669,8 @@ function wt(e) {
|
|
|
669
669
|
return e.push({
|
|
670
670
|
id: "edit",
|
|
671
671
|
label: "Edit",
|
|
672
|
-
icon:
|
|
673
|
-
content: t.editContent ?? (n() && a() ?
|
|
672
|
+
icon: ft(),
|
|
673
|
+
content: t.editContent ?? (n() && a() ? M(te, {
|
|
674
674
|
get schema() {
|
|
675
675
|
return a();
|
|
676
676
|
},
|
|
@@ -678,17 +678,17 @@ function wt(e) {
|
|
|
678
678
|
return r();
|
|
679
679
|
},
|
|
680
680
|
onChange: i
|
|
681
|
-
}) :
|
|
681
|
+
}) : pt())
|
|
682
682
|
}), e.push({
|
|
683
683
|
id: "controls",
|
|
684
684
|
label: "Controls",
|
|
685
|
-
icon:
|
|
686
|
-
content: t.controlsContent ??
|
|
685
|
+
icon: mt(),
|
|
686
|
+
content: t.controlsContent ?? ht()
|
|
687
687
|
}), e.push({
|
|
688
688
|
id: "debug",
|
|
689
689
|
label: "Debug",
|
|
690
|
-
icon:
|
|
691
|
-
content: t.debugContent ??
|
|
690
|
+
icon: gt(),
|
|
691
|
+
content: t.debugContent ?? _t()
|
|
692
692
|
}), e;
|
|
693
693
|
}, g = async () => {
|
|
694
694
|
if (t.debugData !== void 0) try {
|
|
@@ -698,36 +698,36 @@ function wt(e) {
|
|
|
698
698
|
}, _ = () => {
|
|
699
699
|
let e = h();
|
|
700
700
|
return e.find((e) => e.id === f())?.content ?? e[0]?.content;
|
|
701
|
-
}, v = t.ResponsiveDialog,
|
|
702
|
-
return
|
|
701
|
+
}, 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
|
+
return M(v, {
|
|
703
703
|
get open() {
|
|
704
704
|
return t.open;
|
|
705
705
|
},
|
|
706
|
-
onOpenChange: (e) =>
|
|
706
|
+
onOpenChange: (e) => ne(e),
|
|
707
707
|
get children() {
|
|
708
|
-
return
|
|
708
|
+
return M(y, {
|
|
709
709
|
get class() {
|
|
710
|
-
return
|
|
710
|
+
return U(m(), t.class);
|
|
711
711
|
},
|
|
712
712
|
get children() {
|
|
713
713
|
return [
|
|
714
|
-
|
|
714
|
+
M(b, {
|
|
715
715
|
class: "flex flex-row items-center justify-between gap-3",
|
|
716
716
|
get children() {
|
|
717
717
|
return [(() => {
|
|
718
|
-
var e =
|
|
719
|
-
return
|
|
718
|
+
var e = vt();
|
|
719
|
+
return P(e, M(x, {
|
|
720
720
|
class: "truncate leading-tight",
|
|
721
721
|
get children() {
|
|
722
722
|
return t.title;
|
|
723
723
|
}
|
|
724
|
-
}), null),
|
|
724
|
+
}), null), P(e, M(ee, {
|
|
725
725
|
class: "sr-only",
|
|
726
726
|
children: "Widget configuration dialog"
|
|
727
727
|
}), null), e;
|
|
728
728
|
})(), (() => {
|
|
729
|
-
var e =
|
|
730
|
-
return
|
|
729
|
+
var e = yt(), n = e.firstChild;
|
|
730
|
+
return P(n, () => h().map((e) => M(St, {
|
|
731
731
|
get icon() {
|
|
732
732
|
return e.icon;
|
|
733
733
|
},
|
|
@@ -738,7 +738,7 @@ function wt(e) {
|
|
|
738
738
|
return f() === e.id;
|
|
739
739
|
},
|
|
740
740
|
onClick: () => p(e.id)
|
|
741
|
-
}))),
|
|
741
|
+
}))), P(e, M(w, {
|
|
742
742
|
get when() {
|
|
743
743
|
return t.headerActions;
|
|
744
744
|
},
|
|
@@ -750,47 +750,47 @@ function wt(e) {
|
|
|
750
750
|
}
|
|
751
751
|
}),
|
|
752
752
|
(() => {
|
|
753
|
-
var e =
|
|
754
|
-
return
|
|
753
|
+
var e = bt();
|
|
754
|
+
return P(e, _), e;
|
|
755
755
|
})(),
|
|
756
|
-
|
|
756
|
+
M(w, {
|
|
757
757
|
get when() {
|
|
758
|
-
return
|
|
758
|
+
return F(() => f() === "edit")() && (C() || t.onDelete) || f() === "debug" && t.debugData !== void 0;
|
|
759
759
|
},
|
|
760
760
|
get children() {
|
|
761
|
-
var e =
|
|
762
|
-
return
|
|
761
|
+
var e = xt();
|
|
762
|
+
return P(e, M(w, {
|
|
763
763
|
get when() {
|
|
764
|
-
return
|
|
764
|
+
return F(() => f() === "edit")() && t.onDelete;
|
|
765
765
|
},
|
|
766
766
|
get children() {
|
|
767
|
-
return
|
|
767
|
+
return M(S, {
|
|
768
768
|
size: "sm",
|
|
769
769
|
variant: "destructive",
|
|
770
770
|
onClick: () => t.onDelete?.(),
|
|
771
771
|
children: "Delete"
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
|
-
}), null),
|
|
774
|
+
}), null), P(e, M(w, {
|
|
775
775
|
get when() {
|
|
776
|
-
return
|
|
776
|
+
return F(() => f() === "edit")() && C();
|
|
777
777
|
},
|
|
778
778
|
get children() {
|
|
779
|
-
return
|
|
779
|
+
return M(S, {
|
|
780
780
|
size: "sm",
|
|
781
781
|
get disabled() {
|
|
782
|
-
return !
|
|
782
|
+
return !re();
|
|
783
783
|
},
|
|
784
|
-
onClick: () =>
|
|
784
|
+
onClick: () => C()?.(),
|
|
785
785
|
children: "Save"
|
|
786
786
|
});
|
|
787
787
|
}
|
|
788
|
-
}), null),
|
|
788
|
+
}), null), P(e, M(w, {
|
|
789
789
|
get when() {
|
|
790
|
-
return
|
|
790
|
+
return F(() => f() === "debug")() && t.debugData !== void 0;
|
|
791
791
|
},
|
|
792
792
|
get children() {
|
|
793
|
-
return
|
|
793
|
+
return M(S, {
|
|
794
794
|
size: "sm",
|
|
795
795
|
variant: "outline",
|
|
796
796
|
onClick: g,
|
|
@@ -806,34 +806,34 @@ function wt(e) {
|
|
|
806
806
|
}
|
|
807
807
|
});
|
|
808
808
|
}
|
|
809
|
-
|
|
809
|
+
de(["click"]);
|
|
810
810
|
//#endregion
|
|
811
811
|
//#region src/framework/hooks/use-intersection-pause.ts
|
|
812
|
-
function
|
|
812
|
+
function wt(e) {
|
|
813
813
|
if (typeof IntersectionObserver > "u") return () => !1;
|
|
814
|
-
let [t, n] =
|
|
814
|
+
let [t, n] = D(!1), r = new IntersectionObserver((e) => {
|
|
815
815
|
let t = e[0];
|
|
816
816
|
t && n(!t.isIntersecting);
|
|
817
817
|
});
|
|
818
|
-
return
|
|
818
|
+
return T(() => {
|
|
819
819
|
let t = e();
|
|
820
820
|
r.disconnect(), t && r.observe(t);
|
|
821
|
-
}),
|
|
821
|
+
}), O(() => r.disconnect()), t;
|
|
822
822
|
}
|
|
823
823
|
//#endregion
|
|
824
824
|
//#region src/framework/hooks/use-reduced-motion.ts
|
|
825
|
-
function
|
|
825
|
+
function Tt() {
|
|
826
826
|
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),
|
|
827
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = D(e.matches), r = (e) => n(e.matches);
|
|
828
|
+
return e.addEventListener("change", r), O(() => e.removeEventListener("change", r)), t;
|
|
829
829
|
}
|
|
830
830
|
//#endregion
|
|
831
831
|
//#region src/framework/hooks/use-widget-dialog.ts
|
|
832
|
-
function
|
|
833
|
-
let [t, n] =
|
|
832
|
+
function Et(e = "controls") {
|
|
833
|
+
let [t, n] = D(!1), [r, i] = D(e), a = (t) => {
|
|
834
834
|
i(t ?? e), n(!0);
|
|
835
|
-
}, o =
|
|
836
|
-
return o?.registerDialogOpener?.(a),
|
|
835
|
+
}, o = k(z);
|
|
836
|
+
return o?.registerDialogOpener?.(a), O(() => o?.registerDialogOpener?.(null)), {
|
|
837
837
|
showDialog: t,
|
|
838
838
|
setShowDialog: n,
|
|
839
839
|
openDialog: a,
|
|
@@ -854,15 +854,15 @@ function Dt(e = "controls") {
|
|
|
854
854
|
}
|
|
855
855
|
//#endregion
|
|
856
856
|
//#region src/framework/hooks/use-widget-entity-group.ts
|
|
857
|
-
function
|
|
858
|
-
let t = e.minEntities ?? 1, n =
|
|
857
|
+
function Dt(e) {
|
|
858
|
+
let t = e.minEntities ?? 1, n = E(() => e.entities().length), r = E(() => n() >= t), i = E(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = E(() => {
|
|
859
859
|
if (!r()) return;
|
|
860
860
|
let t = e.aggregationMode?.();
|
|
861
861
|
if (!t || t === "none") return;
|
|
862
862
|
let n = e.entities();
|
|
863
|
-
if (t === "light" || t === "binary-sensor" || t === "switch") return
|
|
864
|
-
if (t === "sensor") return
|
|
865
|
-
}), o =
|
|
863
|
+
if (t === "light" || t === "binary-sensor" || t === "switch") return Ge(n, e.allEntitiesMode);
|
|
864
|
+
if (t === "sensor") return Ke(n, e.sensorGroupType?.() ?? "mean", !0);
|
|
865
|
+
}), o = E(() => r() ? void 0 : e.emptyStateConfig);
|
|
866
866
|
return {
|
|
867
867
|
entities: e.entities,
|
|
868
868
|
groupData: i,
|
|
@@ -874,142 +874,142 @@ function Ot(e) {
|
|
|
874
874
|
}
|
|
875
875
|
//#endregion
|
|
876
876
|
//#region src/framework/gestures/cursors.ts
|
|
877
|
-
var
|
|
878
|
-
function
|
|
877
|
+
var G = 32, K = G / 2, q = "white", J = "rgba(0,0,0,0.4)", Y = 2, X = 3;
|
|
878
|
+
function Ot(e) {
|
|
879
879
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
882
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
881
|
+
function Z(e) {
|
|
882
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="0 0 ${G} ${G}">${e}</svg>`;
|
|
883
883
|
}
|
|
884
|
-
var
|
|
884
|
+
var kt = Z(`
|
|
885
885
|
<g transform="translate(6, 2)">
|
|
886
886
|
<!-- shadow -->
|
|
887
|
-
<g stroke="${
|
|
887
|
+
<g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
888
888
|
<path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
|
|
889
889
|
</g>
|
|
890
890
|
<!-- main -->
|
|
891
|
-
<g stroke="${
|
|
891
|
+
<g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
892
892
|
<path d="M10 8V3a2 2 0 0 1 4 0v10l4.5-4.5a2 2 0 0 1 2.83 2.83L14 18.5c-2 2-4 3.5-8 3.5-3 0-5-2-5-5v-6a2 2 0 0 1 4 0v2"/>
|
|
893
893
|
</g>
|
|
894
894
|
</g>
|
|
895
|
-
`),
|
|
895
|
+
`), At = Z(`
|
|
896
896
|
<g>
|
|
897
|
-
<circle cx="${
|
|
898
|
-
<circle cx="${
|
|
899
|
-
<circle cx="${
|
|
897
|
+
<circle cx="${K}" cy="${K}" r="8" stroke="${J}" stroke-width="${X}" fill="none"/>
|
|
898
|
+
<circle cx="${K}" cy="${K}" r="8" stroke="${q}" stroke-width="1.5" fill="none"/>
|
|
899
|
+
<circle cx="${K}" cy="${K}" r="1.5" fill="${q}"/>
|
|
900
900
|
</g>
|
|
901
|
-
`),
|
|
901
|
+
`), jt = Z(`
|
|
902
902
|
<g>
|
|
903
903
|
<!-- shadow -->
|
|
904
|
-
<g stroke="${
|
|
905
|
-
<line x1="6" y1="${
|
|
906
|
-
<polyline points="10,${
|
|
907
|
-
<polyline points="22,${
|
|
904
|
+
<g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
905
|
+
<line x1="6" y1="${K}" x2="26" y2="${K}"/>
|
|
906
|
+
<polyline points="10,${K - 4} 6,${K} 10,20"/>
|
|
907
|
+
<polyline points="22,${K - 4} 26,${K} 22,20"/>
|
|
908
908
|
</g>
|
|
909
909
|
<!-- main -->
|
|
910
|
-
<g stroke="${
|
|
911
|
-
<line x1="6" y1="${
|
|
912
|
-
<polyline points="10,${
|
|
913
|
-
<polyline points="22,${
|
|
910
|
+
<g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
911
|
+
<line x1="6" y1="${K}" x2="26" y2="${K}"/>
|
|
912
|
+
<polyline points="10,${K - 4} 6,${K} 10,20"/>
|
|
913
|
+
<polyline points="22,${K - 4} 26,${K} 22,20"/>
|
|
914
914
|
</g>
|
|
915
915
|
<!-- center grip dots -->
|
|
916
|
-
<circle cx="${
|
|
917
|
-
<circle cx="${
|
|
918
|
-
<circle cx="21" cy="${
|
|
916
|
+
<circle cx="${K}" cy="${K}" r="1.5" fill="${q}"/>
|
|
917
|
+
<circle cx="${K - 5}" cy="${K}" r="1" fill="${q}" opacity="0.6"/>
|
|
918
|
+
<circle cx="21" cy="${K}" r="1" fill="${q}" opacity="0.6"/>
|
|
919
919
|
</g>
|
|
920
|
-
`),
|
|
920
|
+
`), Mt = Z(`
|
|
921
921
|
<g>
|
|
922
922
|
<!-- shadow -->
|
|
923
|
-
<g stroke="${
|
|
924
|
-
<line x1="${
|
|
925
|
-
<polyline points="${
|
|
926
|
-
<polyline points="${
|
|
923
|
+
<g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
924
|
+
<line x1="${K}" y1="6" x2="${K}" y2="26"/>
|
|
925
|
+
<polyline points="${K - 4},10 ${K},6 20,10"/>
|
|
926
|
+
<polyline points="${K - 4},22 ${K},26 20,22"/>
|
|
927
927
|
</g>
|
|
928
928
|
<!-- main -->
|
|
929
|
-
<g stroke="${
|
|
930
|
-
<line x1="${
|
|
931
|
-
<polyline points="${
|
|
932
|
-
<polyline points="${
|
|
929
|
+
<g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
930
|
+
<line x1="${K}" y1="6" x2="${K}" y2="26"/>
|
|
931
|
+
<polyline points="${K - 4},10 ${K},6 20,10"/>
|
|
932
|
+
<polyline points="${K - 4},22 ${K},26 20,22"/>
|
|
933
933
|
</g>
|
|
934
934
|
<!-- center grip dots -->
|
|
935
|
-
<circle cx="${
|
|
936
|
-
<circle cx="${
|
|
937
|
-
<circle cx="${
|
|
935
|
+
<circle cx="${K}" cy="${K}" r="1.5" fill="${q}"/>
|
|
936
|
+
<circle cx="${K}" cy="${K - 5}" r="1" fill="${q}" opacity="0.6"/>
|
|
937
|
+
<circle cx="${K}" cy="21" r="1" fill="${q}" opacity="0.6"/>
|
|
938
938
|
</g>
|
|
939
|
-
`),
|
|
939
|
+
`), Nt = Z(`
|
|
940
940
|
<g>
|
|
941
941
|
<!-- shadow -->
|
|
942
|
-
<g stroke="${
|
|
943
|
-
<line x1="7" y1="${
|
|
944
|
-
<line x1="${
|
|
945
|
-
<polyline points="11,${
|
|
946
|
-
<polyline points="21,${
|
|
947
|
-
<polyline points="${
|
|
948
|
-
<polyline points="${
|
|
942
|
+
<g stroke="${J}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
943
|
+
<line x1="7" y1="${K}" x2="25" y2="${K}"/>
|
|
944
|
+
<line x1="${K}" y1="7" x2="${K}" y2="25"/>
|
|
945
|
+
<polyline points="11,${K - 3} 7,${K} 11,19"/>
|
|
946
|
+
<polyline points="21,${K - 3} 25,${K} 21,19"/>
|
|
947
|
+
<polyline points="${K - 3},11 ${K},7 19,11"/>
|
|
948
|
+
<polyline points="${K - 3},21 ${K},25 19,21"/>
|
|
949
949
|
</g>
|
|
950
950
|
<!-- main -->
|
|
951
|
-
<g stroke="${
|
|
952
|
-
<line x1="7" y1="${
|
|
953
|
-
<line x1="${
|
|
954
|
-
<polyline points="11,${
|
|
955
|
-
<polyline points="21,${
|
|
956
|
-
<polyline points="${
|
|
957
|
-
<polyline points="${
|
|
951
|
+
<g stroke="${q}" stroke-width="${Y}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
952
|
+
<line x1="7" y1="${K}" x2="25" y2="${K}"/>
|
|
953
|
+
<line x1="${K}" y1="7" x2="${K}" y2="25"/>
|
|
954
|
+
<polyline points="11,${K - 3} 7,${K} 11,19"/>
|
|
955
|
+
<polyline points="21,${K - 3} 25,${K} 21,19"/>
|
|
956
|
+
<polyline points="${K - 3},11 ${K},7 19,11"/>
|
|
957
|
+
<polyline points="${K - 3},21 ${K},25 19,21"/>
|
|
958
958
|
</g>
|
|
959
959
|
<!-- center dot -->
|
|
960
|
-
<circle cx="${
|
|
960
|
+
<circle cx="${K}" cy="${K}" r="2" fill="${q}"/>
|
|
961
961
|
</g>
|
|
962
962
|
`);
|
|
963
|
-
function
|
|
963
|
+
function Q(e, t, n) {
|
|
964
964
|
return {
|
|
965
|
-
css: `${
|
|
965
|
+
css: `${Ot(e)} ${t} ${n}, auto`,
|
|
966
966
|
hotspotX: t,
|
|
967
967
|
hotspotY: n
|
|
968
968
|
};
|
|
969
969
|
}
|
|
970
|
-
var
|
|
971
|
-
tap:
|
|
972
|
-
hold:
|
|
973
|
-
slideHorizontal:
|
|
974
|
-
slideVertical:
|
|
975
|
-
slideAuto:
|
|
970
|
+
var $ = {
|
|
971
|
+
tap: Q(kt, 12, 4),
|
|
972
|
+
hold: Q(At, 16, 16),
|
|
973
|
+
slideHorizontal: Q(jt, K, K),
|
|
974
|
+
slideVertical: Q(Mt, K, K),
|
|
975
|
+
slideAuto: Q(Nt, K, K)
|
|
976
976
|
};
|
|
977
977
|
//#endregion
|
|
978
978
|
//#region src/framework/gestures/haptics.ts
|
|
979
|
-
function
|
|
979
|
+
function Pt() {
|
|
980
980
|
if (typeof window > "u") return null;
|
|
981
981
|
let e = window;
|
|
982
982
|
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function Ft(e) {
|
|
985
985
|
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
|
|
986
986
|
navigator.vibrate(e);
|
|
987
987
|
} catch {}
|
|
988
988
|
}
|
|
989
|
-
var
|
|
989
|
+
var It = {
|
|
990
990
|
tick() {
|
|
991
|
-
let e =
|
|
991
|
+
let e = Pt();
|
|
992
992
|
if (e) {
|
|
993
993
|
e.impact({ style: "Light" }).catch(() => {});
|
|
994
994
|
return;
|
|
995
995
|
}
|
|
996
|
-
|
|
996
|
+
Ft(8);
|
|
997
997
|
},
|
|
998
998
|
bump() {
|
|
999
|
-
let e =
|
|
999
|
+
let e = Pt();
|
|
1000
1000
|
if (e) {
|
|
1001
1001
|
e.impact({ style: "Medium" }).catch(() => {});
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1004
|
+
Ft(20);
|
|
1005
1005
|
},
|
|
1006
1006
|
pulse() {
|
|
1007
|
-
let e =
|
|
1007
|
+
let e = Pt();
|
|
1008
1008
|
if (e) {
|
|
1009
1009
|
e.impact({ style: "Heavy" }).catch(() => {});
|
|
1010
1010
|
return;
|
|
1011
1011
|
}
|
|
1012
|
-
|
|
1012
|
+
Ft([
|
|
1013
1013
|
0,
|
|
1014
1014
|
15,
|
|
1015
1015
|
40,
|
|
@@ -1019,7 +1019,7 @@ var Ft = {
|
|
|
1019
1019
|
};
|
|
1020
1020
|
//#endregion
|
|
1021
1021
|
//#region src/framework/gestures/use-widget-gestures.ts
|
|
1022
|
-
function
|
|
1022
|
+
function Lt(e, t) {
|
|
1023
1023
|
let n = {
|
|
1024
1024
|
isDown: !1,
|
|
1025
1025
|
isTouch: !1,
|
|
@@ -1030,7 +1030,7 @@ function It(e, t) {
|
|
|
1030
1030
|
sliding: !1,
|
|
1031
1031
|
holdTimer: null,
|
|
1032
1032
|
element: null
|
|
1033
|
-
}, r = null, i = null, a = null, [o, s] =
|
|
1033
|
+
}, r = null, i = null, a = null, [o, s] = D(null);
|
|
1034
1034
|
function c(e) {
|
|
1035
1035
|
e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
|
|
1036
1036
|
let t = e[0];
|
|
@@ -1062,7 +1062,7 @@ function It(e, t) {
|
|
|
1062
1062
|
if (n.isDown = !0, n.isTouch = t.pointerType === "touch", n.element = t.currentTarget, c(n.element), n.startX = t.clientX, n.startY = t.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, r.hold) {
|
|
1063
1063
|
let e = r.hold.delay ?? 300;
|
|
1064
1064
|
n.holdTimer = setTimeout(() => {
|
|
1065
|
-
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (
|
|
1065
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (It.bump(), r.hold?.action(), n.isDown = !1);
|
|
1066
1066
|
}, e);
|
|
1067
1067
|
}
|
|
1068
1068
|
if (!n.isTouch && r.slide) try {
|
|
@@ -1099,9 +1099,9 @@ function It(e, t) {
|
|
|
1099
1099
|
let n = e();
|
|
1100
1100
|
if (n.slide) {
|
|
1101
1101
|
let e = n.slide.orientation;
|
|
1102
|
-
return e === "horizontal" ?
|
|
1102
|
+
return e === "horizontal" ? $.slideHorizontal.css : e === "vertical" ? $.slideVertical.css : (r || c(t), r && r.height > r.width ? $.slideVertical.css : $.slideHorizontal.css);
|
|
1103
1103
|
}
|
|
1104
|
-
return n.tap ?
|
|
1104
|
+
return n.tap ? $.tap.css : n.hold ? $.hold.css : "";
|
|
1105
1105
|
};
|
|
1106
1106
|
return {
|
|
1107
1107
|
onPointerDown: f,
|
|
@@ -1130,7 +1130,7 @@ function It(e, t) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
//#endregion
|
|
1132
1132
|
//#region src/framework/theming/svg-colors.ts
|
|
1133
|
-
var
|
|
1133
|
+
var Rt = {
|
|
1134
1134
|
solar: "oklch(0.74 0.18 60)",
|
|
1135
1135
|
grid: "oklch(0.62 0.12 245)",
|
|
1136
1136
|
battery: "oklch(0.70 0.18 145)",
|
|
@@ -1139,21 +1139,21 @@ var Lt = {
|
|
|
1139
1139
|
positive: "oklch(0.70 0.14 160)",
|
|
1140
1140
|
negative: "oklch(0.64 0.22 27)"
|
|
1141
1141
|
};
|
|
1142
|
-
function
|
|
1142
|
+
function zt(e) {
|
|
1143
1143
|
return {
|
|
1144
1144
|
fill: `color-mix(in oklch, ${e} 20%, transparent)`,
|
|
1145
1145
|
stroke: e,
|
|
1146
1146
|
solid: e
|
|
1147
1147
|
};
|
|
1148
1148
|
}
|
|
1149
|
-
var
|
|
1149
|
+
var Bt = Object.fromEntries(Object.entries(Rt).map(([e, t]) => [e, zt(t)])), Vt = n.enum([
|
|
1150
1150
|
"success",
|
|
1151
1151
|
"warning",
|
|
1152
1152
|
"danger",
|
|
1153
1153
|
"info",
|
|
1154
1154
|
"neutral",
|
|
1155
1155
|
"accent"
|
|
1156
|
-
]),
|
|
1156
|
+
]), Ht = {
|
|
1157
1157
|
title: () => n.string().optional().meta({
|
|
1158
1158
|
title: "Title",
|
|
1159
1159
|
description: "Optional display name override"
|
|
@@ -1176,7 +1176,7 @@ var zt = Object.fromEntries(Object.entries(Lt).map(([e, t]) => [e, Rt(t)])), Bt
|
|
|
1176
1176
|
};
|
|
1177
1177
|
//#endregion
|
|
1178
1178
|
//#region src/shared/spline.ts
|
|
1179
|
-
function
|
|
1179
|
+
function Ut(e) {
|
|
1180
1180
|
if (e.length < 2) return "";
|
|
1181
1181
|
let t = e[0], n = e[1];
|
|
1182
1182
|
if (!t || !n) return "";
|
|
@@ -1203,14 +1203,14 @@ function Ht(e) {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
//#endregion
|
|
1205
1205
|
//#region src/theme.ts
|
|
1206
|
-
function
|
|
1206
|
+
function Wt() {
|
|
1207
1207
|
return document.documentElement.classList.contains("dark");
|
|
1208
1208
|
}
|
|
1209
1209
|
//#endregion
|
|
1210
1210
|
//#region src/version.ts
|
|
1211
|
-
var
|
|
1211
|
+
var Gt = {
|
|
1212
1212
|
name: "@glasshome/widget-sdk",
|
|
1213
|
-
version: "1.
|
|
1213
|
+
version: "1.3.0",
|
|
1214
1214
|
description: "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
1215
1215
|
keywords: [
|
|
1216
1216
|
"glasshome",
|
|
@@ -1255,7 +1255,7 @@ var Wt = {
|
|
|
1255
1255
|
dev: "vite build --watch"
|
|
1256
1256
|
},
|
|
1257
1257
|
peerDependencies: {
|
|
1258
|
-
"@glasshome/sync-layer": "0.
|
|
1258
|
+
"@glasshome/sync-layer": "0.3.0",
|
|
1259
1259
|
"solid-js": "^1.9.11"
|
|
1260
1260
|
},
|
|
1261
1261
|
dependencies: {
|
|
@@ -1287,4 +1287,4 @@ var Wt = {
|
|
|
1287
1287
|
engines: { node: ">=18" }
|
|
1288
1288
|
}.version;
|
|
1289
1289
|
//#endregion
|
|
1290
|
-
export {
|
|
1290
|
+
export { Gt as SDK_VERSION, Vt as ToneSchema, W as Widget, Fe as WidgetContent, z as WidgetCtx, Ct as WidgetDialog, ze as WidgetIcon, e as WidgetManifestSchema, Ne as WidgetSliderFill, Ve as WidgetStatus, We as WidgetTitle, tt as WidgetValue, f as byDomain, Ge as calculateLightGroup, Ke as calculateSensorGroup, Xe as countActiveEntities, ve as defineWidget, t as formatSchemaError, Ye as getEntityAttribute, r as getForecasts, i as getStream, a as getWebRtcClientConfig, o as hassMediaUrl, ke as injectTokens, Wt as isDark, Je as isEntityActive, Ut as monotoneCubicPath, s as sendWebRtcCandidate, c as startWebRtcSession, l as state, Bt as svgColors, u as trackEntityHistory, d as untrackEntityHistory, p as useArea, m as useCamera, h as useConnection, g as useCurrency, _ as useEntities, v as useEntity, y as useEntityHistory, b as useEntityStatistics, x as useForecast, ee as useHassConfig, wt as useIntersectionPause, S as useLocale, Tt as useReducedMotion, xe as useService, ne as useStore, re as useTemperatureUnit, we as useToggle, Ce as useTurnOff, Se as useTurnOn, oe as useUnitSystem, ye as useWidgetContext, Et as useWidgetDialog, Dt as useWidgetEntityGroup, Lt as useWidgetGestures, Ht as widgetFields };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/widget-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"glasshome",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dev": "vite build --watch"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@glasshome/sync-layer": "0.
|
|
48
|
+
"@glasshome/sync-layer": "0.3.0",
|
|
49
49
|
"solid-js": "^1.9.11"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|