@glasshome/widget-sdk 1.14.3 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deprecations.js +8 -0
- package/dist/framework/config/index.d.ts +14 -0
- package/dist/framework/hooks/index.d.ts +3 -1
- package/dist/framework/hooks/use-widget-context.d.ts +13 -0
- package/dist/framework/hooks/use-widget-dashboard.d.ts +2 -0
- package/dist/framework/hooks/use-widget-viewer.d.ts +4 -0
- package/dist/framework/index.d.ts +1 -1
- package/dist/index.js +286 -258
- package/dist/ui.d.ts +3 -2
- package/dist/vite/index.js +136 -123
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,13 +3,13 @@ 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
5
|
import { byDomain as g, useArea as _, useCalendarEvents as v, useCamera as ee, useConnection as y, useCurrency as b, useEntities as te, useEntity as ne, useEntityHistory as re, useEntityStatistics as ie, useForecast as ae, useHassConfig as oe, useLocale as se, useService as ce, useStore as x, useTemperatureUnit as S, useToggle as le, useTurnOff as ue, useTurnOn as C, useUnitSystem as w } from "@glasshome/sync-layer/solid";
|
|
6
|
-
import { For as de, Show as T, createContext as fe, createEffect as
|
|
6
|
+
import { For as de, Show as T, createContext as fe, createEffect as E, createMemo as D, createSignal as O, on as pe, onCleanup as me, onMount as he, splitProps as ge, useContext as k } from "solid-js";
|
|
7
7
|
import { addEventListener as A, className as j, createComponent as M, effect as N, insert as P, memo as F, setStyleProperty as I, style as _e, template as L, use as ve } from "solid-js/web";
|
|
8
8
|
import { clsx as ye } from "clsx";
|
|
9
9
|
import { twMerge as be } from "tailwind-merge";
|
|
10
|
-
import { Badge as xe, Button as Se, Carousel as Ce, CarouselContent as we, CarouselDots as Te, CarouselItem as Ee, CarouselNext as De, CarouselPrevious as Oe, ColorSlider as ke, ColorWheel as Ae,
|
|
10
|
+
import { Badge as xe, Button as Se, Carousel as Ce, CarouselContent as we, CarouselDots as Te, CarouselItem as Ee, CarouselNext as De, CarouselPrevious as Oe, ColorSlider as ke, ColorWheel as Ae, CountPill as je, Icon as Me, Input as Ne, Label as Pe, ResponsiveDialog as Fe, ResponsiveDialogBody as Ie, ResponsiveDialogBody as Le, ResponsiveDialogClose as Re, ResponsiveDialogContent as ze, ResponsiveDialogDescription as Be, ResponsiveDialogFooter as Ve, ResponsiveDialogFooter as He, ResponsiveDialogHeader as Ue, ResponsiveDialogTitle as We, SchemaForm as Ge, SectionIcon as Ke, SectionTitle as qe, Select as Je, SelectContent as Ye, SelectItem as Xe, SelectTrigger as Ze, SelectValue as Qe, Slider as $e, Switch as et, Tabs as tt, Tabs as nt, TabsContent as rt, TabsContent as it, TabsList as at, TabsList as ot, TabsTrigger as st, TabsTrigger as ct, imageUrl as lt, mediaUrl as ut, parseColor as dt } from "@glasshome/ui/solid";
|
|
11
11
|
//#region src/framework/to-form-schema.ts
|
|
12
|
-
function
|
|
12
|
+
function ft(e) {
|
|
13
13
|
return o.toJSONSchema(e, { override: (e) => {
|
|
14
14
|
let t = o.globalRegistry.get(e.zodSchema);
|
|
15
15
|
return t && typeof t == "object" && Object.keys(t).length > 0 ? {
|
|
@@ -18,7 +18,7 @@ function ct(e) {
|
|
|
18
18
|
} : e.jsonSchema;
|
|
19
19
|
} });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function pt(e) {
|
|
22
22
|
try {
|
|
23
23
|
return e.parse({});
|
|
24
24
|
} catch {
|
|
@@ -27,30 +27,30 @@ function lt(e) {
|
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/define-widget.ts
|
|
30
|
-
function
|
|
31
|
-
return e.configSchema && (e.manifest.schema || (e.manifest.schema =
|
|
30
|
+
function mt(e) {
|
|
31
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = ft(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = pt(e.configSchema))), e;
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/framework/hooks/use-widget-context.ts
|
|
35
35
|
var R = fe();
|
|
36
|
-
function
|
|
36
|
+
function ht() {
|
|
37
37
|
let e = k(R);
|
|
38
38
|
if (!e) throw Error("useWidgetContext must be used within a Widget component");
|
|
39
39
|
return e;
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/framework/hooks/use-service.ts
|
|
43
|
-
function
|
|
43
|
+
function gt(e) {
|
|
44
44
|
let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
|
|
45
45
|
if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
|
|
46
46
|
return n;
|
|
47
47
|
}
|
|
48
48
|
function z(e, t) {
|
|
49
49
|
return async (n, r = {}) => {
|
|
50
|
-
await e(
|
|
50
|
+
await e(gt(n), t, r, { entity_id: n });
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function _t() {
|
|
54
54
|
let e = k(R)?.callService;
|
|
55
55
|
return e ? {
|
|
56
56
|
callService: e,
|
|
@@ -59,15 +59,15 @@ function pt() {
|
|
|
59
59
|
toggle: z(e, "toggle")
|
|
60
60
|
} : ce();
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function vt() {
|
|
63
63
|
let e = k(R)?.callService;
|
|
64
64
|
return e ? z(e, "turn_on") : C();
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function yt() {
|
|
67
67
|
let e = k(R)?.callService;
|
|
68
68
|
return e ? z(e, "turn_off") : ue();
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function bt() {
|
|
71
71
|
let e = k(R)?.callService;
|
|
72
72
|
return e ? z(e, "toggle") : le();
|
|
73
73
|
}
|
|
@@ -78,41 +78,41 @@ var B = {
|
|
|
78
78
|
CONTENT: 10,
|
|
79
79
|
OVERLAY: 20,
|
|
80
80
|
ACTIONS: 30
|
|
81
|
-
},
|
|
82
|
-
function
|
|
83
|
-
let e = k(
|
|
81
|
+
}, xt = fe();
|
|
82
|
+
function St() {
|
|
83
|
+
let e = k(xt);
|
|
84
84
|
if (!e) throw Error("useWidgetDimensions must be called inside <Widget>: move the call into a component rendered within <Widget> (the top-level widget scope only sees the host stub).");
|
|
85
85
|
return e;
|
|
86
86
|
}
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/framework/theming/tokens.css?raw
|
|
89
|
-
var
|
|
90
|
-
function
|
|
91
|
-
return
|
|
89
|
+
var Ct = "/* 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 --widget-radius: var(--radius-xl, 12px);\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/* Shell material. Two channels, both host/variant-driven:\n * - `--widget-backdrop`: the live backdrop filter (the shared glass recipe is\n * blur + saturate, matching ui's CARD_BLUR). Default none — a variant opts\n * in (classic-glass), and a performant-blur host disables it via override\n * sheet when it paints a precomputed frost instead.\n * - `--glass-frost`: one full background layer (image + position / size +\n * repeat) composited at the BOTTOM, under the accent gradient — the same\n * frost slot ui's `.glass` formula ends its background list with. Unset →\n * none. A performant-blur host sets it per shell with the viewport-aligned\n * slice of its pre-blurred bitmap. */\n.glasshome-widget {\n background:\n 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 var(--glass-frost, none);\n backdrop-filter: var(--widget-backdrop, none);\n -webkit-backdrop-filter: var(--widget-backdrop, none);\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 border-radius: var(--widget-radius);\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: var(--color-muted-foreground, currentColor);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.glasshome-widget-subtitle {\n font-size: var(--widget-subtitle);\n color: var(--color-muted-foreground, currentColor);\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 round var(--widget-radius));\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 round var(--widget-radius));\n }\n}\n", wt = !1, Tt, Et = /* @__PURE__ */ new WeakSet();
|
|
90
|
+
function Dt() {
|
|
91
|
+
return Tt || (Tt = new CSSStyleSheet(), Tt.replaceSync(Ct.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), Tt;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Ot(e) {
|
|
94
94
|
if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
|
|
95
|
-
if (
|
|
96
|
-
let t =
|
|
97
|
-
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]),
|
|
95
|
+
if (Et.has(e)) return;
|
|
96
|
+
let t = Dt();
|
|
97
|
+
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), Et.add(e);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
100
|
+
if (wt) return;
|
|
101
101
|
let t = e ?? (typeof document > "u" ? void 0 : document);
|
|
102
102
|
if (!t) return;
|
|
103
103
|
if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
|
|
104
|
-
|
|
104
|
+
wt = !0;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
let n = t.createElement("style");
|
|
108
|
-
n.setAttribute("data-glasshome-tokens", ""), n.textContent =
|
|
108
|
+
n.setAttribute("data-glasshome-tokens", ""), n.textContent = Ct, t.head.appendChild(n), wt = !0;
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
111
|
//#region src/framework/utils/cn.ts
|
|
112
|
-
function
|
|
112
|
+
function V(...e) {
|
|
113
113
|
return be(ye(e));
|
|
114
114
|
}
|
|
115
|
-
var
|
|
115
|
+
var kt = {
|
|
116
116
|
"classic-glass": {
|
|
117
117
|
id: "classic-glass",
|
|
118
118
|
name: "Classic Glass",
|
|
@@ -194,17 +194,17 @@ var wt = {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
-
function
|
|
198
|
-
return
|
|
197
|
+
function At(e) {
|
|
198
|
+
return kt[e];
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/framework/backgrounds/WidgetSliderFill.tsx
|
|
202
|
-
var
|
|
203
|
-
function
|
|
202
|
+
var jt = /*#__PURE__*/ L("<div>");
|
|
203
|
+
function Mt(e) {
|
|
204
204
|
return (() => {
|
|
205
|
-
var t =
|
|
205
|
+
var t = jt();
|
|
206
206
|
return N((n) => {
|
|
207
|
-
var r =
|
|
207
|
+
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 = {
|
|
208
208
|
"--widget-fill-value": e.value,
|
|
209
209
|
"z-index": B.BACKGROUND,
|
|
210
210
|
...e.color ? { "--widget-icon-color": e.color } : {}
|
|
@@ -218,36 +218,36 @@ function Dt(e) {
|
|
|
218
218
|
}
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region src/framework/components/WidgetContent.tsx
|
|
221
|
-
var
|
|
222
|
-
function
|
|
221
|
+
var Nt = /*#__PURE__*/ L("<div>");
|
|
222
|
+
function Pt(e) {
|
|
223
223
|
return (() => {
|
|
224
|
-
var t =
|
|
225
|
-
return P(t, () => e.children), N(() => j(t,
|
|
224
|
+
var t = Nt();
|
|
225
|
+
return P(t, () => e.children), N(() => j(t, V("glasshome-widget-content", e.class))), t;
|
|
226
226
|
})();
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/framework/components/WidgetIcon.tsx
|
|
230
|
-
var
|
|
231
|
-
function
|
|
230
|
+
var Ft = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), It = /*#__PURE__*/ L("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), Lt = /*#__PURE__*/ L("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
|
|
231
|
+
function Rt(e) {
|
|
232
232
|
let t = () => e.entityCount ?? 1;
|
|
233
233
|
return (() => {
|
|
234
|
-
var n =
|
|
234
|
+
var n = Lt(), r = n.firstChild;
|
|
235
235
|
return P(n, M(T, {
|
|
236
236
|
get when() {
|
|
237
237
|
return t() >= 2;
|
|
238
238
|
},
|
|
239
239
|
get children() {
|
|
240
|
-
return
|
|
240
|
+
return Ft();
|
|
241
241
|
}
|
|
242
242
|
}), r), P(n, M(T, {
|
|
243
243
|
get when() {
|
|
244
244
|
return t() >= 3;
|
|
245
245
|
},
|
|
246
246
|
get children() {
|
|
247
|
-
return
|
|
247
|
+
return It();
|
|
248
248
|
}
|
|
249
249
|
}), r), P(r, () => e.icon), N((t) => {
|
|
250
|
-
var r =
|
|
250
|
+
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;
|
|
251
251
|
return r !== t.e && j(n, t.e = r), t.t = _e(n, i, t.t), t;
|
|
252
252
|
}, {
|
|
253
253
|
e: void 0,
|
|
@@ -257,15 +257,15 @@ function Nt(e) {
|
|
|
257
257
|
}
|
|
258
258
|
//#endregion
|
|
259
259
|
//#region src/framework/components/WidgetStatus.tsx
|
|
260
|
-
var
|
|
261
|
-
function
|
|
260
|
+
var zt = /*#__PURE__*/ L("<p>");
|
|
261
|
+
function Bt(e) {
|
|
262
262
|
return (() => {
|
|
263
|
-
var t =
|
|
263
|
+
var t = zt();
|
|
264
264
|
return P(t, (() => {
|
|
265
265
|
var t = F(() => !!e.isUnavailable);
|
|
266
266
|
return () => t() ? "Unavailable" : e.children;
|
|
267
267
|
})()), N((n) => {
|
|
268
|
-
var r =
|
|
268
|
+
var r = V("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = B.ACTIONS;
|
|
269
269
|
return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
|
|
270
270
|
}, {
|
|
271
271
|
e: void 0,
|
|
@@ -275,20 +275,20 @@ function Ft(e) {
|
|
|
275
275
|
}
|
|
276
276
|
//#endregion
|
|
277
277
|
//#region src/framework/components/WidgetTitle.tsx
|
|
278
|
-
var
|
|
279
|
-
function
|
|
278
|
+
var Vt = /*#__PURE__*/ L("<span class=\"glasshome-widget-badge shrink-0\">"), Ht = /*#__PURE__*/ L("<div><h3 class=glasshome-widget-title>");
|
|
279
|
+
function Ut(e) {
|
|
280
280
|
return (() => {
|
|
281
|
-
var t =
|
|
281
|
+
var t = Ht(), n = t.firstChild;
|
|
282
282
|
return P(n, () => e.children), P(t, M(T, {
|
|
283
283
|
get when() {
|
|
284
284
|
return F(() => e.badge !== void 0)() && e.badge > 0;
|
|
285
285
|
},
|
|
286
286
|
get children() {
|
|
287
|
-
var t =
|
|
287
|
+
var t = Vt();
|
|
288
288
|
return P(t, () => e.badge), t;
|
|
289
289
|
}
|
|
290
290
|
}), null), N((n) => {
|
|
291
|
-
var r =
|
|
291
|
+
var r = V("relative flex items-center gap-2", e.class), i = B.ACTIONS;
|
|
292
292
|
return r !== n.e && j(t, n.e = r), i !== n.t && I(t, "z-index", n.t = i), n;
|
|
293
293
|
}, {
|
|
294
294
|
e: void 0,
|
|
@@ -298,7 +298,7 @@ function Rt(e) {
|
|
|
298
298
|
}
|
|
299
299
|
//#endregion
|
|
300
300
|
//#region src/framework/utils/entity-aggregation.ts
|
|
301
|
-
function
|
|
301
|
+
function Wt(e, t = !1) {
|
|
302
302
|
if (e.length === 0) return {
|
|
303
303
|
isGroup: !1,
|
|
304
304
|
state: "unknown",
|
|
@@ -321,7 +321,7 @@ function zt(e, t = !1) {
|
|
|
321
321
|
isUnavailable: t.state === "unavailable",
|
|
322
322
|
brightness: r,
|
|
323
323
|
brightnessPercent: i,
|
|
324
|
-
color:
|
|
324
|
+
color: qt(t),
|
|
325
325
|
onCount: +!!n,
|
|
326
326
|
totalCount: 1,
|
|
327
327
|
description: n ? "On" : "Off"
|
|
@@ -333,7 +333,7 @@ function zt(e, t = !1) {
|
|
|
333
333
|
if (r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color) l.push(t.attributes.rgb_color);
|
|
334
334
|
else if (t.attributes?.hs_color) {
|
|
335
335
|
let [e, n] = t.attributes.hs_color;
|
|
336
|
-
l.push(
|
|
336
|
+
l.push(Kt(e, n));
|
|
337
337
|
}
|
|
338
338
|
break;
|
|
339
339
|
case "off":
|
|
@@ -350,7 +350,7 @@ function zt(e, t = !1) {
|
|
|
350
350
|
if (l.length > 0) {
|
|
351
351
|
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;
|
|
352
352
|
y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
|
|
353
|
-
} else y =
|
|
353
|
+
} else y = qt(e[0]);
|
|
354
354
|
let b;
|
|
355
355
|
return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
|
|
356
356
|
isGroup: n,
|
|
@@ -365,7 +365,7 @@ function zt(e, t = !1) {
|
|
|
365
365
|
description: b
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Gt(e, t = "mean", n = !0) {
|
|
369
369
|
if (e.length === 0) return {
|
|
370
370
|
isGroup: !1,
|
|
371
371
|
state: "unknown",
|
|
@@ -461,7 +461,7 @@ function Bt(e, t = "mean", n = !0) {
|
|
|
461
461
|
memberValues: a
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function Kt(e, t) {
|
|
465
465
|
let n = t / 100, r = n * (1 - Math.abs(e / 60 % 2 - 1)), i = 1 - n, a = 0, o = 0, s = 0;
|
|
466
466
|
return e < 60 ? [a, o] = [n, r] : e < 120 ? [a, o] = [r, n] : e < 180 ? [o, s] = [n, r] : e < 240 ? [o, s] = [r, n] : e < 300 ? [a, s] = [r, n] : [a, s] = [n, r], [
|
|
467
467
|
(a + i) * 255,
|
|
@@ -469,7 +469,7 @@ function Vt(e, t) {
|
|
|
469
469
|
(s + i) * 255
|
|
470
470
|
];
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function qt(e) {
|
|
473
473
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
474
474
|
let t = (e.attributes?.brightness ?? 255) / 255;
|
|
475
475
|
if (e.attributes?.rgb_color) {
|
|
@@ -477,7 +477,7 @@ function Ht(e) {
|
|
|
477
477
|
return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
|
|
478
478
|
}
|
|
479
479
|
if (e.attributes?.hs_color) {
|
|
480
|
-
let [n, r] = e.attributes.hs_color, [i, a, o] =
|
|
480
|
+
let [n, r] = e.attributes.hs_color, [i, a, o] = Kt(n, r);
|
|
481
481
|
return `rgb(${Math.round(i * t)}, ${Math.round(a * t)}, ${Math.round(o * t)})`;
|
|
482
482
|
}
|
|
483
483
|
if (e.attributes?.color_temp) {
|
|
@@ -488,7 +488,7 @@ function Ht(e) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/framework/utils/entity-state.ts
|
|
491
|
-
function
|
|
491
|
+
function Jt(e) {
|
|
492
492
|
if (!e) return !1;
|
|
493
493
|
if ([
|
|
494
494
|
"on",
|
|
@@ -504,15 +504,15 @@ function Ut(e) {
|
|
|
504
504
|
}
|
|
505
505
|
return !1;
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Yt(e, t, n) {
|
|
508
508
|
return e?.attributes ? e.attributes[t] ?? n : n;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
return e.filter(
|
|
510
|
+
function Xt(e) {
|
|
511
|
+
return e.filter(Jt).length;
|
|
512
512
|
}
|
|
513
513
|
//#endregion
|
|
514
514
|
//#region src/framework/utils/format-value.ts
|
|
515
|
-
function
|
|
515
|
+
function Zt(e, t, n) {
|
|
516
516
|
let { decimals: r, scale: i = !0 } = n || {};
|
|
517
517
|
if (typeof e == "string") return t ? `${e}${t}` : e;
|
|
518
518
|
if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
|
|
@@ -523,35 +523,35 @@ function Kt(e, t, n) {
|
|
|
523
523
|
}
|
|
524
524
|
//#endregion
|
|
525
525
|
//#region src/framework/utils/interpret-value.ts
|
|
526
|
-
function
|
|
526
|
+
function Qt(e, t) {
|
|
527
527
|
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;
|
|
528
528
|
}
|
|
529
529
|
//#endregion
|
|
530
530
|
//#region src/framework/components/WidgetValue.tsx
|
|
531
|
-
var
|
|
532
|
-
function
|
|
531
|
+
var $t = /*#__PURE__*/ L("<div class=glasshome-widget-subtitle>"), en = /*#__PURE__*/ L("<div><div class=glasshome-widget-value>");
|
|
532
|
+
function tn(e) {
|
|
533
533
|
return (() => {
|
|
534
|
-
var t =
|
|
535
|
-
return P(n, () =>
|
|
534
|
+
var t = en(), n = t.firstChild;
|
|
535
|
+
return P(n, () => Zt(e.value, e.unit)), P(t, M(T, {
|
|
536
536
|
get when() {
|
|
537
537
|
return F(() => !!e.interpret)() && typeof e.value == "number";
|
|
538
538
|
},
|
|
539
539
|
get children() {
|
|
540
|
-
var t =
|
|
541
|
-
return P(t, () =>
|
|
540
|
+
var t = $t();
|
|
541
|
+
return P(t, () => Qt(e.value, e.unit)), t;
|
|
542
542
|
}
|
|
543
|
-
}), null), N(() => j(t,
|
|
543
|
+
}), null), N(() => j(t, V("flex flex-col", e.class))), t;
|
|
544
544
|
})();
|
|
545
545
|
}
|
|
546
546
|
//#endregion
|
|
547
547
|
//#region src/framework/core/Widget.tsx
|
|
548
|
-
var
|
|
549
|
-
function
|
|
550
|
-
let n = k(R), [r, i] =
|
|
548
|
+
var nn = /*#__PURE__*/ L("<div><div class=\"relative h-full w-full\">"), rn = /*#__PURE__*/ L("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), an = /*#__PURE__*/ L("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), on = /*#__PURE__*/ L("<div class=\"flex items-center justify-center text-white/30\">"), sn = /*#__PURE__*/ L("<h3 class=\"font-semibold text-sm text-white/60\">"), cn = /*#__PURE__*/ L("<p class=\"text-white/50 text-xs\">");
|
|
549
|
+
function ln(t) {
|
|
550
|
+
let n = k(R), [r, i] = O(), [a, o] = O({
|
|
551
551
|
width: 0,
|
|
552
552
|
height: 0
|
|
553
553
|
});
|
|
554
|
-
|
|
554
|
+
E(() => {
|
|
555
555
|
let e = r();
|
|
556
556
|
if (!e) return;
|
|
557
557
|
let t = new ResizeObserver(([e]) => {
|
|
@@ -565,19 +565,19 @@ function rn(t) {
|
|
|
565
565
|
height: e.contentRect.height
|
|
566
566
|
});
|
|
567
567
|
});
|
|
568
|
-
t.observe(e),
|
|
568
|
+
t.observe(e), me(() => t.disconnect());
|
|
569
569
|
}), he(() => {
|
|
570
570
|
let e = r()?.getRootNode();
|
|
571
|
-
|
|
571
|
+
Ot(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
|
|
572
572
|
});
|
|
573
573
|
let s = {
|
|
574
574
|
updateConfig: n?.updateConfig ?? (() => {}),
|
|
575
575
|
registerDialogOpener: n?.registerDialogOpener,
|
|
576
576
|
callService: n?.callService,
|
|
577
577
|
dimensions: e(() => a(), "ctx.dimensions")
|
|
578
|
-
}, c =
|
|
579
|
-
if (t.variant) return typeof t.variant == "string" ?
|
|
580
|
-
}), l =
|
|
578
|
+
}, c = D(() => {
|
|
579
|
+
if (t.variant) return typeof t.variant == "string" ? At(t.variant) : t.variant;
|
|
580
|
+
}), l = D(() => ({
|
|
581
581
|
"container-type": "size",
|
|
582
582
|
"container-name": "widget",
|
|
583
583
|
"touch-action": t.gestures && !t.isEditMode ? t.gestures.touchAction() : void 0,
|
|
@@ -601,15 +601,15 @@ function rn(t) {
|
|
|
601
601
|
return M(R.Provider, {
|
|
602
602
|
value: s,
|
|
603
603
|
get children() {
|
|
604
|
-
return M(
|
|
604
|
+
return M(xt.Provider, {
|
|
605
605
|
value: a,
|
|
606
606
|
get children() {
|
|
607
|
-
var e =
|
|
607
|
+
var e = nn(), n = e.firstChild;
|
|
608
608
|
return A(e, "pointercancel", h), A(e, "pointerup", m), A(e, "pointermove", p), A(e, "pointerdown", f), A(e, "pointerenter", d), ve((e) => {
|
|
609
609
|
i(e), t.gestures?.bindElement(e);
|
|
610
610
|
}, e), P(n, (() => {
|
|
611
611
|
var e = F(() => !!t.emptyState);
|
|
612
|
-
return () => e() ? M(
|
|
612
|
+
return () => e() ? M(un, {
|
|
613
613
|
get icon() {
|
|
614
614
|
return t.emptyState.icon;
|
|
615
615
|
},
|
|
@@ -623,11 +623,11 @@ function rn(t) {
|
|
|
623
623
|
})()), P(e, (() => {
|
|
624
624
|
var e = F(() => !!t.loading);
|
|
625
625
|
return () => e() && (() => {
|
|
626
|
-
var e =
|
|
626
|
+
var e = rn();
|
|
627
627
|
return N((t) => I(e, "z-index", B.OVERLAY)), e;
|
|
628
628
|
})();
|
|
629
629
|
})(), null), N((r) => {
|
|
630
|
-
var i =
|
|
630
|
+
var i = V("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", c()?.styles?.class, t.class), a = l(), o = B.CONTENT;
|
|
631
631
|
return i !== r.e && j(e, r.e = i), r.t = _e(e, a, r.t), o !== r.a && I(n, "z-index", r.a = o), r;
|
|
632
632
|
}, {
|
|
633
633
|
e: void 0,
|
|
@@ -639,49 +639,49 @@ function rn(t) {
|
|
|
639
639
|
}
|
|
640
640
|
});
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function un(e) {
|
|
643
643
|
return (() => {
|
|
644
|
-
var t =
|
|
644
|
+
var t = an();
|
|
645
645
|
return P(t, (() => {
|
|
646
646
|
var t = F(() => !!e.icon);
|
|
647
647
|
return () => t() && (() => {
|
|
648
|
-
var t =
|
|
648
|
+
var t = on();
|
|
649
649
|
return P(t, () => e.icon), t;
|
|
650
650
|
})();
|
|
651
651
|
})(), null), P(t, (() => {
|
|
652
652
|
var t = F(() => !!e.title);
|
|
653
653
|
return () => t() && (() => {
|
|
654
|
-
var t =
|
|
654
|
+
var t = sn();
|
|
655
655
|
return P(t, () => e.title), t;
|
|
656
656
|
})();
|
|
657
657
|
})(), null), P(t, (() => {
|
|
658
658
|
var t = F(() => !!e.message);
|
|
659
659
|
return () => t() && (() => {
|
|
660
|
-
var t =
|
|
660
|
+
var t = cn();
|
|
661
661
|
return P(t, () => e.message), t;
|
|
662
662
|
})();
|
|
663
663
|
})(), null), t;
|
|
664
664
|
})();
|
|
665
665
|
}
|
|
666
|
-
var
|
|
667
|
-
|
|
666
|
+
var H = ln;
|
|
667
|
+
H.Content = Pt, H.Icon = Rt, H.Title = Ut, H.Status = Bt, H.Value = tn, H.SliderFill = Mt;
|
|
668
668
|
//#endregion
|
|
669
669
|
//#region src/framework/dialogs/validate-config.ts
|
|
670
|
-
function
|
|
670
|
+
function dn(e) {
|
|
671
671
|
let t = "";
|
|
672
672
|
for (let n of e) t += typeof n == "number" ? `[${n}]` : t ? `.${String(n)}` : String(n);
|
|
673
673
|
return t;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function fn(e, t) {
|
|
676
676
|
let n = e.safeParse(t);
|
|
677
677
|
return n.success ? null : n.error.issues.map((e) => {
|
|
678
|
-
let t =
|
|
678
|
+
let t = dn(e.path);
|
|
679
679
|
return t ? `${t}: ${e.message}` : e.message;
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
682
|
//#endregion
|
|
683
683
|
//#region src/framework/dialogs/WidgetDialog.tsx
|
|
684
|
-
var
|
|
684
|
+
var pn = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"></path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\">"), mn = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No edit options available"), hn = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>"), gn = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), _n = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"m8 2 1.88 1.88\"></path><path d=\"M14.12 3.88 16 2\"></path><path d=\"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1\"></path><path d=\"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6\"></path><path d=\"M12 20v-9\"></path><path d=\"M6.53 9C4.6 8.8 3 7.1 3 5\"></path><path d=\"M6 13H2\"></path><path d=\"M3 21c0-2.1 1.7-3.9 3.8-4\"></path><path d=\"M20.97 5c0 2.1-1.6 3.8-3.5 4\"></path><path d=\"M22 13h-4\"></path><path d=\"M17.2 17c2.1.1 3.8 1.9 3.8 4\">"), vn = /*#__PURE__*/ L("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No debug information available"), yn = /*#__PURE__*/ L("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), bn = (e) => ft(e), xn = {
|
|
685
685
|
sm: "sm",
|
|
686
686
|
md: "md",
|
|
687
687
|
lg: "lg",
|
|
@@ -691,37 +691,37 @@ var cn = /*#__PURE__*/ L("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 f
|
|
|
691
691
|
"3xl": "xl",
|
|
692
692
|
"4xl": "full"
|
|
693
693
|
};
|
|
694
|
-
function
|
|
695
|
-
let [t] = ge(e, /* @__PURE__ */ "open.onOpenChange.title.description.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.ResponsiveDialogBody.ResponsiveDialogFooter.Button.SchemaForm.Tabs.TabsList.TabsTrigger.TabsContent".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] =
|
|
696
|
-
pe(
|
|
694
|
+
function Sn(e) {
|
|
695
|
+
let [t] = ge(e, /* @__PURE__ */ "open.onOpenChange.title.description.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.ResponsiveDialogBody.ResponsiveDialogFooter.Button.SchemaForm.Tabs.TabsList.TabsTrigger.TabsContent".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = O({}), [a, o] = O(null), [s, c] = O([]);
|
|
696
|
+
E(pe(() => t.config, (e) => {
|
|
697
697
|
e && i({ ...e });
|
|
698
|
-
})), pe(
|
|
699
|
-
e && o(
|
|
698
|
+
})), E(pe(() => t.configSchema, (e) => {
|
|
699
|
+
e && o(bn(e));
|
|
700
700
|
}));
|
|
701
701
|
let l = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), u = (e) => {
|
|
702
702
|
!e && t.config && (i({ ...t.config }), c([])), t.onOpenChange(e);
|
|
703
703
|
}, d = () => {
|
|
704
704
|
let e = t.configSchema;
|
|
705
705
|
if (e) {
|
|
706
|
-
let t =
|
|
706
|
+
let t = fn(e, r());
|
|
707
707
|
if (t) {
|
|
708
708
|
c(t);
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
c([]), t.onConfigSave?.(r());
|
|
713
|
-
}, [f, p] =
|
|
713
|
+
}, [f, p] = O(t.defaultTab ?? "controls"), m = () => t.activeTab ?? f(), h = (e) => {
|
|
714
714
|
t.onActiveTabChange ? t.onActiveTabChange(e) : p(e);
|
|
715
|
-
}, g = () =>
|
|
715
|
+
}, g = () => xn[t.maxWidth ?? "xl"], _ = () => {
|
|
716
716
|
if (t.tabs) return t.tabs;
|
|
717
717
|
let e = [];
|
|
718
718
|
return e.push({
|
|
719
719
|
id: "edit",
|
|
720
720
|
label: "Edit",
|
|
721
|
-
icon:
|
|
721
|
+
icon: pn(),
|
|
722
722
|
content: t.editContent ?? (() => {
|
|
723
723
|
let e = t.SchemaForm, o = n() ? a() : void 0;
|
|
724
|
-
return !o || !e ?
|
|
724
|
+
return !o || !e ? mn() : M(e, {
|
|
725
725
|
schema: o,
|
|
726
726
|
get data() {
|
|
727
727
|
return r();
|
|
@@ -735,20 +735,20 @@ function _n(e) {
|
|
|
735
735
|
}), e.push({
|
|
736
736
|
id: "controls",
|
|
737
737
|
label: "Controls",
|
|
738
|
-
icon:
|
|
739
|
-
content: t.controlsContent ??
|
|
738
|
+
icon: hn(),
|
|
739
|
+
content: t.controlsContent ?? gn()
|
|
740
740
|
}), e.push({
|
|
741
741
|
id: "debug",
|
|
742
742
|
label: "Debug",
|
|
743
|
-
icon:
|
|
744
|
-
content: t.debugContent ??
|
|
743
|
+
icon: _n(),
|
|
744
|
+
content: t.debugContent ?? vn()
|
|
745
745
|
}), e;
|
|
746
746
|
}, v = async () => {
|
|
747
747
|
if (t.debugData !== void 0) try {
|
|
748
748
|
let e = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
|
|
749
749
|
await navigator.clipboard.writeText(e);
|
|
750
750
|
} catch {}
|
|
751
|
-
}, ee = t.ResponsiveDialog, y = t.ResponsiveDialogContent, b = t.ResponsiveDialogHeader, te = t.ResponsiveDialogTitle, ne = t.ResponsiveDialogDescription, re = t.ResponsiveDialogBody ??
|
|
751
|
+
}, ee = t.ResponsiveDialog, y = t.ResponsiveDialogContent, b = t.ResponsiveDialogHeader, te = t.ResponsiveDialogTitle, ne = t.ResponsiveDialogDescription, re = t.ResponsiveDialogBody ?? Le, ie = t.ResponsiveDialogFooter ?? He, ae = t.Tabs ?? nt, oe = t.TabsList ?? ot, se = t.TabsTrigger ?? ct, ce = t.TabsContent ?? it, x = t.Button, S = D(pe([
|
|
752
752
|
() => t.open,
|
|
753
753
|
a,
|
|
754
754
|
() => t.config,
|
|
@@ -795,7 +795,7 @@ function _n(e) {
|
|
|
795
795
|
},
|
|
796
796
|
get children() {
|
|
797
797
|
return [(() => {
|
|
798
|
-
var t =
|
|
798
|
+
var t = yn();
|
|
799
799
|
return P(t, () => e.icon), t;
|
|
800
800
|
})(), F(() => e.label)];
|
|
801
801
|
}
|
|
@@ -898,32 +898,50 @@ function _n(e) {
|
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
900
|
//#endregion
|
|
901
|
+
//#region src/framework/hooks/use-widget-dashboard.ts
|
|
902
|
+
var Cn = {
|
|
903
|
+
name: "",
|
|
904
|
+
icon: "",
|
|
905
|
+
areaId: null
|
|
906
|
+
};
|
|
907
|
+
function wn() {
|
|
908
|
+
let e = k(R);
|
|
909
|
+
return () => e?.dashboard?.() ?? Cn;
|
|
910
|
+
}
|
|
911
|
+
//#endregion
|
|
912
|
+
//#region src/framework/hooks/use-widget-viewer.ts
|
|
913
|
+
var Tn = { name: null };
|
|
914
|
+
function En() {
|
|
915
|
+
let e = k(R);
|
|
916
|
+
return () => e?.viewer?.() ?? Tn;
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
901
919
|
//#region src/framework/hooks/use-intersection-pause.ts
|
|
902
|
-
function
|
|
920
|
+
function Dn(e) {
|
|
903
921
|
if (typeof IntersectionObserver > "u") return () => !1;
|
|
904
|
-
let [t, n] =
|
|
922
|
+
let [t, n] = O(!1), r = new IntersectionObserver((e) => {
|
|
905
923
|
let t = e[0];
|
|
906
924
|
t && n(!t.isIntersecting);
|
|
907
925
|
});
|
|
908
|
-
return
|
|
926
|
+
return E(() => {
|
|
909
927
|
let t = e();
|
|
910
928
|
r.disconnect(), t && r.observe(t);
|
|
911
|
-
}),
|
|
929
|
+
}), me(() => r.disconnect()), t;
|
|
912
930
|
}
|
|
913
931
|
//#endregion
|
|
914
932
|
//#region src/framework/hooks/use-reduced-motion.ts
|
|
915
|
-
function
|
|
933
|
+
function On() {
|
|
916
934
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
|
|
917
|
-
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] =
|
|
918
|
-
return e.addEventListener("change", r),
|
|
935
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = O(e.matches), r = (e) => n(e.matches);
|
|
936
|
+
return e.addEventListener("change", r), me(() => e.removeEventListener("change", r)), t;
|
|
919
937
|
}
|
|
920
938
|
//#endregion
|
|
921
939
|
//#region src/framework/hooks/use-widget-dialog.ts
|
|
922
|
-
function
|
|
923
|
-
let [t, n] =
|
|
940
|
+
function kn(e = "controls") {
|
|
941
|
+
let [t, n] = O(!1), [r, i] = O(e), a = (t) => {
|
|
924
942
|
i(t ?? e), n(!0);
|
|
925
943
|
}, o = k(R);
|
|
926
|
-
return o?.registerDialogOpener?.(a),
|
|
944
|
+
return o?.registerDialogOpener?.(a), me(() => o?.registerDialogOpener?.(null)), {
|
|
927
945
|
showDialog: t,
|
|
928
946
|
setShowDialog: n,
|
|
929
947
|
openDialog: a,
|
|
@@ -944,15 +962,15 @@ function bn(e = "controls") {
|
|
|
944
962
|
}
|
|
945
963
|
//#endregion
|
|
946
964
|
//#region src/framework/hooks/use-widget-entity-group.ts
|
|
947
|
-
function
|
|
948
|
-
let t = e.minEntities ?? 1, n =
|
|
965
|
+
function An(e) {
|
|
966
|
+
let t = e.minEntities ?? 1, n = D(() => e.entities().length), r = D(() => n() >= t), i = D(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = D(() => {
|
|
949
967
|
if (!r()) return;
|
|
950
968
|
let t = e.aggregationMode?.();
|
|
951
969
|
if (!t || t === "none") return;
|
|
952
970
|
let n = e.entities();
|
|
953
|
-
if (t === "light" || t === "binary-sensor" || t === "switch") return
|
|
954
|
-
if (t === "sensor") return
|
|
955
|
-
}), o =
|
|
971
|
+
if (t === "light" || t === "binary-sensor" || t === "switch") return Wt(n, e.allEntitiesMode);
|
|
972
|
+
if (t === "sensor") return Gt(n, e.sensorGroupType?.() ?? "mean", !0);
|
|
973
|
+
}), o = D(() => r() ? void 0 : e.emptyStateConfig);
|
|
956
974
|
return {
|
|
957
975
|
entities: e.entities,
|
|
958
976
|
groupData: i,
|
|
@@ -964,142 +982,142 @@ function xn(e) {
|
|
|
964
982
|
}
|
|
965
983
|
//#endregion
|
|
966
984
|
//#region src/framework/gestures/cursors.ts
|
|
967
|
-
var
|
|
968
|
-
function
|
|
985
|
+
var U = 32, W = U / 2, G = "white", K = "rgba(0,0,0,0.4)", q = 2, J = 3;
|
|
986
|
+
function jn(e) {
|
|
969
987
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
970
988
|
}
|
|
971
989
|
function Y(e) {
|
|
972
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
990
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${U}" viewBox="0 0 ${U} ${U}">${e}</svg>`;
|
|
973
991
|
}
|
|
974
|
-
var
|
|
992
|
+
var Mn = Y(`
|
|
975
993
|
<g transform="translate(6, 2)">
|
|
976
994
|
<!-- shadow -->
|
|
977
|
-
<g stroke="${
|
|
995
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
978
996
|
<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"/>
|
|
979
997
|
</g>
|
|
980
998
|
<!-- main -->
|
|
981
|
-
<g stroke="${
|
|
999
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
982
1000
|
<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"/>
|
|
983
1001
|
</g>
|
|
984
1002
|
</g>
|
|
985
|
-
`),
|
|
1003
|
+
`), Nn = Y(`
|
|
986
1004
|
<g>
|
|
987
|
-
<circle cx="${
|
|
988
|
-
<circle cx="${
|
|
989
|
-
<circle cx="${
|
|
1005
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${K}" stroke-width="${J}" fill="none"/>
|
|
1006
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${G}" stroke-width="1.5" fill="none"/>
|
|
1007
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
990
1008
|
</g>
|
|
991
|
-
`),
|
|
1009
|
+
`), Pn = Y(`
|
|
992
1010
|
<g>
|
|
993
1011
|
<!-- shadow -->
|
|
994
|
-
<g stroke="${
|
|
995
|
-
<line x1="6" y1="${
|
|
996
|
-
<polyline points="10,12 6,${
|
|
997
|
-
<polyline points="22,12 26,${
|
|
1012
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1013
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
1014
|
+
<polyline points="10,12 6,${W} 10,20"/>
|
|
1015
|
+
<polyline points="22,12 26,${W} 22,20"/>
|
|
998
1016
|
</g>
|
|
999
1017
|
<!-- main -->
|
|
1000
|
-
<g stroke="${
|
|
1001
|
-
<line x1="6" y1="${
|
|
1002
|
-
<polyline points="10,12 6,${
|
|
1003
|
-
<polyline points="22,12 26,${
|
|
1018
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1019
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
1020
|
+
<polyline points="10,12 6,${W} 10,20"/>
|
|
1021
|
+
<polyline points="22,12 26,${W} 22,20"/>
|
|
1004
1022
|
</g>
|
|
1005
1023
|
<!-- center grip dots -->
|
|
1006
|
-
<circle cx="${
|
|
1007
|
-
<circle cx="11" cy="${
|
|
1008
|
-
<circle cx="21" cy="${
|
|
1024
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
1025
|
+
<circle cx="11" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
1026
|
+
<circle cx="21" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
1009
1027
|
</g>
|
|
1010
|
-
`),
|
|
1028
|
+
`), Fn = Y(`
|
|
1011
1029
|
<g>
|
|
1012
1030
|
<!-- shadow -->
|
|
1013
|
-
<g stroke="${
|
|
1014
|
-
<line x1="${
|
|
1015
|
-
<polyline points="12,10 ${
|
|
1016
|
-
<polyline points="12,22 ${
|
|
1031
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1032
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
1033
|
+
<polyline points="12,10 ${W},6 20,10"/>
|
|
1034
|
+
<polyline points="12,22 ${W},26 20,22"/>
|
|
1017
1035
|
</g>
|
|
1018
1036
|
<!-- main -->
|
|
1019
|
-
<g stroke="${
|
|
1020
|
-
<line x1="${
|
|
1021
|
-
<polyline points="12,10 ${
|
|
1022
|
-
<polyline points="12,22 ${
|
|
1037
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1038
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
1039
|
+
<polyline points="12,10 ${W},6 20,10"/>
|
|
1040
|
+
<polyline points="12,22 ${W},26 20,22"/>
|
|
1023
1041
|
</g>
|
|
1024
1042
|
<!-- center grip dots -->
|
|
1025
|
-
<circle cx="${
|
|
1026
|
-
<circle cx="${
|
|
1027
|
-
<circle cx="${
|
|
1043
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
1044
|
+
<circle cx="${W}" cy="11" r="1" fill="${G}" opacity="0.6"/>
|
|
1045
|
+
<circle cx="${W}" cy="21" r="1" fill="${G}" opacity="0.6"/>
|
|
1028
1046
|
</g>
|
|
1029
|
-
`),
|
|
1047
|
+
`), In = Y(`
|
|
1030
1048
|
<g>
|
|
1031
1049
|
<!-- shadow -->
|
|
1032
|
-
<g stroke="${
|
|
1033
|
-
<line x1="7" y1="${
|
|
1034
|
-
<line x1="${
|
|
1035
|
-
<polyline points="11,13 7,${
|
|
1036
|
-
<polyline points="21,13 25,${
|
|
1037
|
-
<polyline points="13,11 ${
|
|
1038
|
-
<polyline points="13,21 ${
|
|
1050
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1051
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
1052
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
1053
|
+
<polyline points="11,13 7,${W} 11,19"/>
|
|
1054
|
+
<polyline points="21,13 25,${W} 21,19"/>
|
|
1055
|
+
<polyline points="13,11 ${W},7 19,11"/>
|
|
1056
|
+
<polyline points="13,21 ${W},25 19,21"/>
|
|
1039
1057
|
</g>
|
|
1040
1058
|
<!-- main -->
|
|
1041
|
-
<g stroke="${
|
|
1042
|
-
<line x1="7" y1="${
|
|
1043
|
-
<line x1="${
|
|
1044
|
-
<polyline points="11,13 7,${
|
|
1045
|
-
<polyline points="21,13 25,${
|
|
1046
|
-
<polyline points="13,11 ${
|
|
1047
|
-
<polyline points="13,21 ${
|
|
1059
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1060
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
1061
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
1062
|
+
<polyline points="11,13 7,${W} 11,19"/>
|
|
1063
|
+
<polyline points="21,13 25,${W} 21,19"/>
|
|
1064
|
+
<polyline points="13,11 ${W},7 19,11"/>
|
|
1065
|
+
<polyline points="13,21 ${W},25 19,21"/>
|
|
1048
1066
|
</g>
|
|
1049
1067
|
<!-- center dot -->
|
|
1050
|
-
<circle cx="${
|
|
1068
|
+
<circle cx="${W}" cy="${W}" r="2" fill="${G}"/>
|
|
1051
1069
|
</g>
|
|
1052
1070
|
`);
|
|
1053
1071
|
function X(e, t, n) {
|
|
1054
1072
|
return {
|
|
1055
|
-
css: `${
|
|
1073
|
+
css: `${jn(e)} ${t} ${n}, auto`,
|
|
1056
1074
|
hotspotX: t,
|
|
1057
1075
|
hotspotY: n
|
|
1058
1076
|
};
|
|
1059
1077
|
}
|
|
1060
1078
|
var Z = {
|
|
1061
|
-
tap: X(
|
|
1062
|
-
hold: X(
|
|
1063
|
-
slideHorizontal: X(
|
|
1064
|
-
slideVertical: X(
|
|
1065
|
-
slideAuto: X(
|
|
1079
|
+
tap: X(Mn, 12, 4),
|
|
1080
|
+
hold: X(Nn, 16, 16),
|
|
1081
|
+
slideHorizontal: X(Pn, W, W),
|
|
1082
|
+
slideVertical: X(Fn, W, W),
|
|
1083
|
+
slideAuto: X(In, W, W)
|
|
1066
1084
|
};
|
|
1067
1085
|
//#endregion
|
|
1068
1086
|
//#region src/framework/gestures/haptics.ts
|
|
1069
|
-
function
|
|
1087
|
+
function Ln() {
|
|
1070
1088
|
if (typeof window > "u") return null;
|
|
1071
1089
|
let e = window;
|
|
1072
1090
|
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
1073
1091
|
}
|
|
1074
|
-
function
|
|
1092
|
+
function Rn(e) {
|
|
1075
1093
|
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
|
|
1076
1094
|
navigator.vibrate(e);
|
|
1077
1095
|
} catch {}
|
|
1078
1096
|
}
|
|
1079
|
-
var
|
|
1097
|
+
var zn = {
|
|
1080
1098
|
tick() {
|
|
1081
|
-
let e =
|
|
1099
|
+
let e = Ln();
|
|
1082
1100
|
if (e) {
|
|
1083
1101
|
e.impact({ style: "Light" }).catch(() => {});
|
|
1084
1102
|
return;
|
|
1085
1103
|
}
|
|
1086
|
-
|
|
1104
|
+
Rn(8);
|
|
1087
1105
|
},
|
|
1088
1106
|
bump() {
|
|
1089
|
-
let e =
|
|
1107
|
+
let e = Ln();
|
|
1090
1108
|
if (e) {
|
|
1091
1109
|
e.impact({ style: "Medium" }).catch(() => {});
|
|
1092
1110
|
return;
|
|
1093
1111
|
}
|
|
1094
|
-
|
|
1112
|
+
Rn(20);
|
|
1095
1113
|
},
|
|
1096
1114
|
pulse() {
|
|
1097
|
-
let e =
|
|
1115
|
+
let e = Ln();
|
|
1098
1116
|
if (e) {
|
|
1099
1117
|
e.impact({ style: "Heavy" }).catch(() => {});
|
|
1100
1118
|
return;
|
|
1101
1119
|
}
|
|
1102
|
-
|
|
1120
|
+
Rn([
|
|
1103
1121
|
0,
|
|
1104
1122
|
15,
|
|
1105
1123
|
40,
|
|
@@ -1109,7 +1127,7 @@ var jn = {
|
|
|
1109
1127
|
};
|
|
1110
1128
|
//#endregion
|
|
1111
1129
|
//#region src/framework/gestures/use-widget-gestures.ts
|
|
1112
|
-
function
|
|
1130
|
+
function Bn(e, t) {
|
|
1113
1131
|
let n = {
|
|
1114
1132
|
isDown: !1,
|
|
1115
1133
|
isTouch: !1,
|
|
@@ -1120,7 +1138,7 @@ function Mn(e, t) {
|
|
|
1120
1138
|
sliding: !1,
|
|
1121
1139
|
holdTimer: null,
|
|
1122
1140
|
element: null
|
|
1123
|
-
}, r = null, i = null, a = null, [o, s] =
|
|
1141
|
+
}, r = null, i = null, a = null, [o, s] = O(null);
|
|
1124
1142
|
function c(e) {
|
|
1125
1143
|
e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
|
|
1126
1144
|
let t = e[0];
|
|
@@ -1152,7 +1170,7 @@ function Mn(e, t) {
|
|
|
1152
1170
|
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) {
|
|
1153
1171
|
let e = r.hold.delay ?? 300;
|
|
1154
1172
|
n.holdTimer = setTimeout(() => {
|
|
1155
|
-
n.holdTimer = null, n.isDown && !n.hasMoved && (
|
|
1173
|
+
n.holdTimer = null, n.isDown && !n.hasMoved && (zn.bump(), r.hold?.action(), n.isDown = !1);
|
|
1156
1174
|
}, e);
|
|
1157
1175
|
}
|
|
1158
1176
|
if (!n.isTouch && r.slide) try {
|
|
@@ -1220,7 +1238,7 @@ function Mn(e, t) {
|
|
|
1220
1238
|
}
|
|
1221
1239
|
//#endregion
|
|
1222
1240
|
//#region src/framework/theming/svg-colors.ts
|
|
1223
|
-
var
|
|
1241
|
+
var Vn = {
|
|
1224
1242
|
solar: "oklch(0.74 0.18 60)",
|
|
1225
1243
|
grid: "oklch(0.62 0.12 245)",
|
|
1226
1244
|
battery: "oklch(0.70 0.18 145)",
|
|
@@ -1229,21 +1247,21 @@ var Nn = {
|
|
|
1229
1247
|
positive: "oklch(0.70 0.14 160)",
|
|
1230
1248
|
negative: "oklch(0.64 0.22 27)"
|
|
1231
1249
|
};
|
|
1232
|
-
function
|
|
1250
|
+
function Hn(e) {
|
|
1233
1251
|
return {
|
|
1234
1252
|
fill: `color-mix(in oklch, ${e} 20%, transparent)`,
|
|
1235
1253
|
stroke: e,
|
|
1236
1254
|
solid: e
|
|
1237
1255
|
};
|
|
1238
1256
|
}
|
|
1239
|
-
var
|
|
1257
|
+
var Un = Object.fromEntries(Object.entries(Vn).map(([e, t]) => [e, Hn(t)])), Wn = o.enum([
|
|
1240
1258
|
"success",
|
|
1241
1259
|
"warning",
|
|
1242
1260
|
"danger",
|
|
1243
1261
|
"info",
|
|
1244
1262
|
"neutral",
|
|
1245
1263
|
"accent"
|
|
1246
|
-
]),
|
|
1264
|
+
]), Gn = {
|
|
1247
1265
|
title: e(() => o.string().optional().meta({
|
|
1248
1266
|
title: "Title",
|
|
1249
1267
|
description: "Optional display name override"
|
|
@@ -1263,45 +1281,53 @@ var Fn = Object.fromEntries(Object.entries(Nn).map(([e, t]) => [e, Pn(t)])), In
|
|
|
1263
1281
|
formType: "area-picker",
|
|
1264
1282
|
title: "Area"
|
|
1265
1283
|
}), "widgetFields.areaId")
|
|
1266
|
-
},
|
|
1284
|
+
}, Kn = 24;
|
|
1267
1285
|
function Q(e) {
|
|
1268
1286
|
let t = {};
|
|
1269
1287
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
1270
1288
|
return t;
|
|
1271
1289
|
}
|
|
1272
|
-
function
|
|
1290
|
+
function qn() {
|
|
1273
1291
|
return o.string().optional().meta({
|
|
1274
1292
|
title: "Title",
|
|
1275
1293
|
description: "Optional display name override"
|
|
1276
1294
|
});
|
|
1277
1295
|
}
|
|
1278
|
-
function
|
|
1296
|
+
function Jn(e) {
|
|
1279
1297
|
return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta(Q({
|
|
1280
1298
|
title: e.title,
|
|
1281
1299
|
description: e.description
|
|
1282
1300
|
}));
|
|
1283
1301
|
}
|
|
1284
|
-
function
|
|
1302
|
+
function Yn(e) {
|
|
1285
1303
|
let t = o.number();
|
|
1286
1304
|
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(Q({
|
|
1287
1305
|
title: e.title,
|
|
1288
1306
|
description: e.description
|
|
1289
1307
|
}));
|
|
1290
1308
|
}
|
|
1291
|
-
function
|
|
1309
|
+
function Xn(e) {
|
|
1292
1310
|
return o.boolean().default(e.default ?? !1).meta(Q({
|
|
1293
1311
|
title: e.title,
|
|
1294
1312
|
description: e.description
|
|
1295
1313
|
}));
|
|
1296
1314
|
}
|
|
1297
|
-
function
|
|
1315
|
+
function Zn(e, t) {
|
|
1298
1316
|
let n = o.enum(e);
|
|
1299
1317
|
return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(Q({
|
|
1300
1318
|
title: t.title,
|
|
1301
|
-
description: t.description
|
|
1319
|
+
description: t.description,
|
|
1320
|
+
labels: t.labels
|
|
1321
|
+
}));
|
|
1322
|
+
}
|
|
1323
|
+
function Qn(e, t) {
|
|
1324
|
+
return o.array(o.enum(e)).default([...t.default ?? []]).meta(Q({
|
|
1325
|
+
title: t.title,
|
|
1326
|
+
description: t.description,
|
|
1327
|
+
labels: t.labels
|
|
1302
1328
|
}));
|
|
1303
1329
|
}
|
|
1304
|
-
function
|
|
1330
|
+
function $n(e, t) {
|
|
1305
1331
|
return o.array(o.string()).default([]).meta(Q({
|
|
1306
1332
|
domain: e,
|
|
1307
1333
|
title: t?.title ?? "Entities",
|
|
@@ -1309,7 +1335,7 @@ function Wn(e, t) {
|
|
|
1309
1335
|
deviceClass: t?.deviceClass
|
|
1310
1336
|
}));
|
|
1311
1337
|
}
|
|
1312
|
-
function
|
|
1338
|
+
function er(e, t) {
|
|
1313
1339
|
return o.array(o.string()).default([]).meta(Q({
|
|
1314
1340
|
domain: e,
|
|
1315
1341
|
title: t?.title ?? "Entity",
|
|
@@ -1318,20 +1344,21 @@ function Gn(e, t) {
|
|
|
1318
1344
|
singleSelect: !0
|
|
1319
1345
|
}));
|
|
1320
1346
|
}
|
|
1321
|
-
function
|
|
1347
|
+
function tr(e) {
|
|
1322
1348
|
return o.string().optional().meta({
|
|
1323
1349
|
formType: "area-picker",
|
|
1324
1350
|
title: e?.title ?? "Area"
|
|
1325
1351
|
});
|
|
1326
1352
|
}
|
|
1327
|
-
function
|
|
1328
|
-
let t = o.string().meta({
|
|
1353
|
+
function nr(e) {
|
|
1354
|
+
let t = o.string().meta(Q({
|
|
1329
1355
|
formType: "icon-picker",
|
|
1330
|
-
title: e?.title ?? "Icon"
|
|
1331
|
-
|
|
1356
|
+
title: e?.title ?? "Icon",
|
|
1357
|
+
description: e?.description
|
|
1358
|
+
}));
|
|
1332
1359
|
return e?.default === void 0 ? t.optional() : t.default(e.default);
|
|
1333
1360
|
}
|
|
1334
|
-
function
|
|
1361
|
+
function rr(e) {
|
|
1335
1362
|
let t = o.string().meta(Q({
|
|
1336
1363
|
formType: "image-picker",
|
|
1337
1364
|
title: e?.title ?? "Image",
|
|
@@ -1339,36 +1366,36 @@ function Jn(e) {
|
|
|
1339
1366
|
}));
|
|
1340
1367
|
return e?.default === void 0 ? t.optional() : t.default(e.default);
|
|
1341
1368
|
}
|
|
1342
|
-
function
|
|
1369
|
+
function ir(e) {
|
|
1343
1370
|
return o.array(o.string()).default([]).meta(Q({
|
|
1344
1371
|
title: e.title,
|
|
1345
1372
|
description: e.description
|
|
1346
1373
|
}));
|
|
1347
1374
|
}
|
|
1348
|
-
function
|
|
1375
|
+
function ar(e, t) {
|
|
1349
1376
|
let n = o.object(e);
|
|
1350
|
-
return n.default(
|
|
1377
|
+
return n.default(pt(n)).meta({ title: t.title });
|
|
1351
1378
|
}
|
|
1352
|
-
function
|
|
1379
|
+
function or(e) {
|
|
1353
1380
|
return e.def;
|
|
1354
1381
|
}
|
|
1355
1382
|
function $(e) {
|
|
1356
1383
|
if (o.globalRegistry.get(e)?.formType === "list") return !0;
|
|
1357
|
-
let t =
|
|
1384
|
+
let t = or(e);
|
|
1358
1385
|
return t.shape ? Object.values(t.shape).some($) : t.options ? t.options.some($) : t.element ? $(t.element) : t.innerType ? $(t.innerType) : !1;
|
|
1359
1386
|
}
|
|
1360
|
-
function
|
|
1361
|
-
let t = e, n =
|
|
1362
|
-
for (; n;) t = n, n =
|
|
1387
|
+
function sr(e) {
|
|
1388
|
+
let t = e, n = or(t).innerType;
|
|
1389
|
+
for (; n;) t = n, n = or(t).innerType;
|
|
1363
1390
|
return t;
|
|
1364
1391
|
}
|
|
1365
|
-
function
|
|
1366
|
-
let t =
|
|
1392
|
+
function cr(e) {
|
|
1393
|
+
let t = or(sr(e));
|
|
1367
1394
|
if (t.shape) return new Set(Object.keys(t.shape));
|
|
1368
1395
|
if (t.options) {
|
|
1369
1396
|
let e = [];
|
|
1370
1397
|
for (let n of t.options) {
|
|
1371
|
-
let t =
|
|
1398
|
+
let t = cr(n);
|
|
1372
1399
|
if (!t) return null;
|
|
1373
1400
|
e.push(t);
|
|
1374
1401
|
}
|
|
@@ -1380,7 +1407,7 @@ function $n(e) {
|
|
|
1380
1407
|
}
|
|
1381
1408
|
return null;
|
|
1382
1409
|
}
|
|
1383
|
-
function
|
|
1410
|
+
function lr(e, t, n) {
|
|
1384
1411
|
let r = { [t]: n };
|
|
1385
1412
|
try {
|
|
1386
1413
|
return e.parse(r);
|
|
@@ -1388,12 +1415,12 @@ function er(e, t, n) {
|
|
|
1388
1415
|
return r;
|
|
1389
1416
|
}
|
|
1390
1417
|
}
|
|
1391
|
-
function
|
|
1418
|
+
function ur(e, t) {
|
|
1392
1419
|
if (!Number.isInteger(t.max) || t.max < 1) throw Error(`field.list: max must be a positive integer, got ${t.max}`);
|
|
1393
|
-
if (t.max >
|
|
1420
|
+
if (t.max > Kn) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${Kn}`);
|
|
1394
1421
|
if (t.min !== void 0 && (!Number.isInteger(t.min) || t.min < 0 || t.min > t.max)) throw Error(`field.list: min must be an integer between 0 and max, got ${t.min}`);
|
|
1395
1422
|
if ($(e)) throw Error("field.list: a list item cannot contain another field.list (depth 1 only)");
|
|
1396
|
-
if (t.labelField !== void 0 &&
|
|
1423
|
+
if (t.labelField !== void 0 && !cr(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
|
|
1397
1424
|
let n = o.array(e);
|
|
1398
1425
|
return t.min !== void 0 && (n = n.min(t.min)), n = n.max(t.max), n.default([]).meta(Q({
|
|
1399
1426
|
formType: "list",
|
|
@@ -1403,7 +1430,7 @@ function tr(e, t) {
|
|
|
1403
1430
|
labelField: t.labelField
|
|
1404
1431
|
}));
|
|
1405
1432
|
}
|
|
1406
|
-
function
|
|
1433
|
+
function dr(e, t, n) {
|
|
1407
1434
|
let r = Object.keys(t)[0];
|
|
1408
1435
|
if (r === void 0) throw Error("field.variants: at least one variant is required");
|
|
1409
1436
|
if (n.shared && e in n.shared) throw Error(`field.variants: shared fields cannot redefine the discriminator "${e}"`);
|
|
@@ -1416,7 +1443,7 @@ function nr(e, t, n) {
|
|
|
1416
1443
|
...r,
|
|
1417
1444
|
[e]: o.literal(t)
|
|
1418
1445
|
})), a = o.discriminatedUnion(e, i), s = i[0];
|
|
1419
|
-
return a.default(s ?
|
|
1446
|
+
return a.default(s ? lr(s, e, r) : {}).meta(Q({
|
|
1420
1447
|
formType: "variants",
|
|
1421
1448
|
discriminator: e,
|
|
1422
1449
|
title: n.title,
|
|
@@ -1424,28 +1451,29 @@ function nr(e, t, n) {
|
|
|
1424
1451
|
labels: n.labels
|
|
1425
1452
|
}));
|
|
1426
1453
|
}
|
|
1427
|
-
var
|
|
1428
|
-
title:
|
|
1429
|
-
text:
|
|
1430
|
-
number:
|
|
1431
|
-
toggle:
|
|
1432
|
-
choice:
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1454
|
+
var fr = {
|
|
1455
|
+
title: qn,
|
|
1456
|
+
text: Jn,
|
|
1457
|
+
number: Yn,
|
|
1458
|
+
toggle: Xn,
|
|
1459
|
+
choice: Zn,
|
|
1460
|
+
choices: Qn,
|
|
1461
|
+
entities: $n,
|
|
1462
|
+
entity: er,
|
|
1463
|
+
area: tr,
|
|
1464
|
+
icon: nr,
|
|
1465
|
+
image: rr,
|
|
1466
|
+
stringList: ir,
|
|
1467
|
+
group: ar,
|
|
1468
|
+
list: ur,
|
|
1469
|
+
variants: dr
|
|
1442
1470
|
};
|
|
1443
|
-
function
|
|
1471
|
+
function pr(e) {
|
|
1444
1472
|
return o.object(e);
|
|
1445
1473
|
}
|
|
1446
1474
|
//#endregion
|
|
1447
1475
|
//#region src/shared/spline.ts
|
|
1448
|
-
function
|
|
1476
|
+
function mr(e) {
|
|
1449
1477
|
if (e.length < 2) return "";
|
|
1450
1478
|
let t = e[0], n = e[1];
|
|
1451
1479
|
if (!t || !n) return "";
|
|
@@ -1472,14 +1500,14 @@ function ar(e) {
|
|
|
1472
1500
|
}
|
|
1473
1501
|
//#endregion
|
|
1474
1502
|
//#region src/theme.ts
|
|
1475
|
-
function
|
|
1503
|
+
function hr() {
|
|
1476
1504
|
return document.documentElement.classList.contains("dark");
|
|
1477
1505
|
}
|
|
1478
1506
|
//#endregion
|
|
1479
1507
|
//#region src/version.ts
|
|
1480
|
-
var
|
|
1508
|
+
var gr = {
|
|
1481
1509
|
name: "@glasshome/widget-sdk",
|
|
1482
|
-
version: "1.
|
|
1510
|
+
version: "1.15.1",
|
|
1483
1511
|
description: "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
1484
1512
|
keywords: [
|
|
1485
1513
|
"glasshome",
|
|
@@ -1539,7 +1567,7 @@ var sr = {
|
|
|
1539
1567
|
},
|
|
1540
1568
|
peerDependencies: {
|
|
1541
1569
|
"@glasshome/sync-layer": "0.8.1",
|
|
1542
|
-
"@glasshome/ui": "1.
|
|
1570
|
+
"@glasshome/ui": "1.14.0",
|
|
1543
1571
|
"solid-js": "^1.9.11"
|
|
1544
1572
|
},
|
|
1545
1573
|
dependencies: {
|
|
@@ -1554,9 +1582,9 @@ var sr = {
|
|
|
1554
1582
|
zod: "^4.1.13"
|
|
1555
1583
|
},
|
|
1556
1584
|
devDependencies: {
|
|
1557
|
-
"@glasshome/ui": "1.
|
|
1585
|
+
"@glasshome/ui": "1.14.0",
|
|
1558
1586
|
"@solidjs/testing-library": "^0.8.10",
|
|
1559
|
-
"@types/bun": "
|
|
1587
|
+
"@types/bun": "^1.4.0",
|
|
1560
1588
|
"@types/node": "^25.2.2",
|
|
1561
1589
|
typescript: "^7.0.2",
|
|
1562
1590
|
vite: "^8.1.0",
|
|
@@ -1575,4 +1603,4 @@ var sr = {
|
|
|
1575
1603
|
engines: { node: ">=18" }
|
|
1576
1604
|
}.version;
|
|
1577
1605
|
//#endregion
|
|
1578
|
-
export { xe as Badge, Se as Button, Ce as Carousel, we as CarouselContent, Te as CarouselDots, Ee as CarouselItem, De as CarouselNext, Oe as CarouselPrevious, ke as ColorSlider, Ae as ColorWheel, je as
|
|
1606
|
+
export { xe as Badge, Se as Button, Ce as Carousel, we as CarouselContent, Te as CarouselDots, Ee as CarouselItem, De as CarouselNext, Oe as CarouselPrevious, ke as ColorSlider, Ae as ColorWheel, je as CountPill, Me as Icon, Ne as Input, Pe as Label, Fe as ResponsiveDialog, Ie as ResponsiveDialogBody, Re as ResponsiveDialogClose, ze as ResponsiveDialogContent, Be as ResponsiveDialogDescription, Ve as ResponsiveDialogFooter, Ue as ResponsiveDialogHeader, We as ResponsiveDialogTitle, gr as SDK_VERSION, Ge as SchemaForm, Ke as SectionIcon, qe as SectionTitle, Je as Select, Ye as SelectContent, Xe as SelectItem, Ze as SelectTrigger, Qe as SelectValue, $e as Slider, et as Switch, tt as Tabs, rt as TabsContent, at as TabsList, st as TabsTrigger, Wn as ToneSchema, H as Widget, Pt as WidgetContent, R as WidgetCtx, Sn as WidgetDialog, Rt as WidgetIcon, r as WidgetManifestSchema, xt as WidgetSizeCtx, Mt as WidgetSliderFill, Bt as WidgetStatus, Ut as WidgetTitle, tn as WidgetValue, g as byDomain, Wt as calculateLightGroup, Gt as calculateSensorGroup, Xt as countActiveEntities, pr as defineConfig, mt as defineWidget, t as deprecations, fr as field, n as formatDeprecation, i as formatSchemaError, Yt as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, lt as imageUrl, Ot as injectTokens, hr as isDark, Jt as isEntityActive, ut as mediaUrl, mr as monotoneCubicPath, dt as parseColor, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, Un as svgColors, m as trackEntityHistory, h as untrackEntityHistory, _ as useArea, v as useCalendarEvents, ee as useCamera, y as useConnection, b as useCurrency, te as useEntities, ne as useEntity, re as useEntityHistory, ie as useEntityStatistics, ae as useForecast, oe as useHassConfig, Dn as useIntersectionPause, se as useLocale, On as useReducedMotion, _t as useService, x as useStore, S as useTemperatureUnit, bt as useToggle, yt as useTurnOff, vt as useTurnOn, w as useUnitSystem, ht as useWidgetContext, wn as useWidgetDashboard, kn as useWidgetDialog, St as useWidgetDimensions, An as useWidgetEntityGroup, Bn as useWidgetGestures, En as useWidgetViewer, Gn as widgetFields, a as z };
|