@glasshome/widget-sdk 1.8.1 → 1.9.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 +16 -0
- package/dist/framework/config/index.d.ts +34 -1
- package/dist/framework/core/Widget.d.ts +2 -2
- package/dist/framework/dialogs/validate-config.d.ts +8 -0
- package/dist/framework/hooks/index.d.ts +2 -1
- package/dist/framework/hooks/use-widget-context.d.ts +8 -9
- package/dist/framework/hooks/use-widget-dimensions.d.ts +14 -0
- package/dist/framework/index.d.ts +1 -1
- package/dist/host/index.js +7 -7
- package/dist/host/instantiate-widget.d.ts +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +567 -431
- package/dist/ui.d.ts +17 -0
- package/dist/vite/index.d.ts +24 -12
- package/dist/vite/index.js +202 -138
- package/dist/vite/introspect.d.ts +4 -10
- package/dist/vite/introspect.js +34 -12
- package/package.json +4 -3
- package/dist/tokens-Bdfb1xYe.js +0 -33
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { deprecate as e, deprecations as t, formatDeprecation as n } from "./deprecations.js";
|
|
2
|
+
import { WidgetManifestSchema as r, formatSchemaError as i } from "./schemas.js";
|
|
3
|
+
import { z as a, z as o } from "zod";
|
|
4
|
+
import { getForecasts as s, getStream as c, getWebRtcClientConfig as l, hassMediaUrl as u, sendWebRtcCandidate as d, startWebRtcSession as f, state as p, trackEntityHistory as m, untrackEntityHistory as h } from "@glasshome/sync-layer";
|
|
5
|
+
import { byDomain as g, useArea as _, useCamera as v, useConnection as ee, useCurrency as y, useEntities as b, useEntity as te, useEntityHistory as ne, useEntityStatistics as re, useForecast as x, useHassConfig as ie, useLocale as ae, useService as oe, useStore as se, useTemperatureUnit as S, useToggle as ce, useTurnOff as le, useTurnOn as ue, useUnitSystem as de } from "@glasshome/sync-layer/solid";
|
|
6
|
+
import { Show as C, createContext as fe, createEffect as w, createMemo as T, createSignal as E, on as pe, onCleanup as D, onMount as me, splitProps as he, untrack as ge, useContext as O } from "solid-js";
|
|
7
|
+
import { addEventListener as k, className as A, createComponent as j, delegateEvents as _e, effect as M, insert as N, memo as P, setStyleProperty as F, style as ve, template as I, use as ye } from "solid-js/web";
|
|
8
|
+
import { clsx as be } from "clsx";
|
|
9
|
+
import { twMerge as xe } from "tailwind-merge";
|
|
10
|
+
import { Badge as Se, Button as Ce, ColorSlider as we, ColorWheel as Te, Input as Ee, Label as De, ResponsiveDialog as Oe, ResponsiveDialogContent as ke, ResponsiveDialogDescription as Ae, ResponsiveDialogHeader as je, ResponsiveDialogTitle as Me, SchemaForm as Ne, Select as Pe, SelectContent as Fe, SelectItem as Ie, SelectTrigger as Le, SelectValue as Re, Slider as ze, Switch as Be, parseColor as Ve } from "@glasshome/ui/solid";
|
|
11
11
|
//#region src/framework/to-form-schema.ts
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
let t =
|
|
12
|
+
function He(e) {
|
|
13
|
+
return o.toJSONSchema(e, { override: (e) => {
|
|
14
|
+
let t = o.globalRegistry.get(e.zodSchema);
|
|
15
15
|
return t && typeof t == "object" && Object.keys(t).length > 0 ? {
|
|
16
16
|
...e.jsonSchema,
|
|
17
17
|
...t
|
|
18
18
|
} : e.jsonSchema;
|
|
19
19
|
} });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Ue(e) {
|
|
22
22
|
try {
|
|
23
23
|
return e.parse({});
|
|
24
24
|
} catch {
|
|
@@ -27,68 +27,102 @@ function Se(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 We(e) {
|
|
31
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = He(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = Ue(e.configSchema))), e;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/framework/hooks/use-widget-context.ts
|
|
35
|
+
var L = fe();
|
|
36
|
+
function Ge() {
|
|
37
|
+
let e = O(L);
|
|
38
|
+
if (!e) throw Error("useWidgetContext must be used within a Widget component");
|
|
39
|
+
return e;
|
|
32
40
|
}
|
|
33
41
|
//#endregion
|
|
34
42
|
//#region src/framework/hooks/use-service.ts
|
|
35
|
-
function
|
|
43
|
+
function Ke(e) {
|
|
36
44
|
let t = Array.isArray(e) ? e[0] : e, n = t?.split(".")[0];
|
|
37
45
|
if (!n) throw Error(`Invalid entity ID: ${String(t)}`);
|
|
38
46
|
return n;
|
|
39
47
|
}
|
|
40
|
-
function
|
|
41
|
-
return (n, r = {}) => e(
|
|
48
|
+
function R(e, t) {
|
|
49
|
+
return (n, r = {}) => e(Ke(n), t, r, { entity_id: n });
|
|
42
50
|
}
|
|
43
|
-
function
|
|
44
|
-
let
|
|
45
|
-
return
|
|
46
|
-
callService:
|
|
47
|
-
turnOn:
|
|
48
|
-
turnOff:
|
|
49
|
-
toggle:
|
|
50
|
-
} :
|
|
51
|
+
function qe() {
|
|
52
|
+
let e = O(L)?.callService;
|
|
53
|
+
return e ? {
|
|
54
|
+
callService: e,
|
|
55
|
+
turnOn: R(e, "turn_on"),
|
|
56
|
+
turnOff: R(e, "turn_off"),
|
|
57
|
+
toggle: R(e, "toggle")
|
|
58
|
+
} : oe();
|
|
51
59
|
}
|
|
52
|
-
function
|
|
53
|
-
let
|
|
54
|
-
return
|
|
60
|
+
function Je() {
|
|
61
|
+
let e = O(L)?.callService;
|
|
62
|
+
return e ? R(e, "turn_on") : ue();
|
|
55
63
|
}
|
|
56
|
-
function
|
|
57
|
-
let
|
|
58
|
-
return
|
|
64
|
+
function Ye() {
|
|
65
|
+
let e = O(L)?.callService;
|
|
66
|
+
return e ? R(e, "turn_off") : le();
|
|
59
67
|
}
|
|
60
|
-
function
|
|
61
|
-
let
|
|
62
|
-
return
|
|
68
|
+
function Xe() {
|
|
69
|
+
let e = O(L)?.callService;
|
|
70
|
+
return e ? R(e, "toggle") : ce();
|
|
63
71
|
}
|
|
64
72
|
//#endregion
|
|
65
73
|
//#region src/framework/design-system/z-index.ts
|
|
66
|
-
var
|
|
74
|
+
var z = {
|
|
67
75
|
BACKGROUND: 0,
|
|
68
76
|
CONTENT: 10,
|
|
69
77
|
OVERLAY: 20,
|
|
70
78
|
ACTIONS: 30
|
|
71
|
-
};
|
|
79
|
+
}, Ze = fe();
|
|
80
|
+
function Qe() {
|
|
81
|
+
let e = O(Ze);
|
|
82
|
+
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).");
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/framework/theming/tokens.css?raw
|
|
87
|
+
var $e = "/* Authoritative SDK CSS contract. Injected once on first Widget mount\n * via framework/theming/tokens.ts.\n *\n * All widget-internal visual scale is driven from CSS custom properties +\n * container queries on the `.glasshome-widget` shell (`container-type: size`).\n * No JS classifier, no size tier enum.\n */\n\n:root {\n --tone-success: oklch(0.70 0.18 145);\n --tone-warning: oklch(0.80 0.17 75);\n --tone-danger: oklch(0.64 0.22 27);\n --tone-info: oklch(0.66 0.20 245);\n --tone-neutral: oklch(0.65 0.02 250);\n --tone-accent: oklch(0.74 0.18 60);\n\n --widget-grad-strength: 1;\n --widget-glow-default: 0.4;\n --widget-border-highlight: oklch(0.98 0 0 / 0.4);\n}\n\n.dark {\n --tone-success: oklch(0.74 0.18 145);\n --tone-warning: oklch(0.82 0.17 75);\n --tone-danger: oklch(0.68 0.22 27);\n --tone-info: oklch(0.70 0.20 245);\n --tone-neutral: oklch(0.69 0.02 250);\n --tone-accent: oklch(0.78 0.18 60);\n\n --widget-grad-strength: 1.1;\n --widget-glow-default: 0.5;\n --widget-border-highlight: oklch(1 0 0 / 0.08);\n}\n\n@property --widget-color {\n syntax: \"<color>\";\n inherits: true;\n initial-value: oklch(0.65 0.02 250);\n}\n\n/* === Widget shell ===\n * Fluid scale tokens — tied to the shell's own container box (cqb=height, cqi=width).\n * Icon/pad/gap track HEIGHT (cqb) not the shortest side: two widgets of equal\n * height match regardless of width (a 2×2 and a 4×2 get the same icon). cqmin\n * starved portrait tiles by pinning the icon to the narrow width. Tune\n * multipliers / clamps to adjust density. */\n.glasshome-widget {\n --widget-color: var(--tone-neutral);\n --widget-glow-strength: var(--widget-glow-default);\n\n --widget-icon-box: clamp(44px, 25cqb, 58px);\n --widget-icon-glyph: clamp(24px, 14cqb, 33px);\n --widget-pad: clamp(8px, 3.5cqb, 22px);\n --widget-gap: clamp(6px, 2cqb, 14px);\n --widget-title-size: clamp(12px, 2cqi, 18px);\n --widget-subtitle: clamp(12px, 2.5cqi, 20px);\n --widget-status-size: clamp(14px, 5cqi, 36px);\n --widget-value-size: clamp(18px, 7cqi, 48px);\n --widget-badge-size: clamp(11px, 1.6cqi, 14px);\n}\n\n/* 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}\n@container widget (min-aspect-ratio: 1) and (max-height: 149px) {\n .glasshome-widget-content {\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n }\n}\n\n/* === Compact 1×1 ===\n * Small in BOTH axes → stack the tile: icon on top, label + status centered\n * under it. Icon stays moderate (not a hero) so the text keeps room. Wide\n * tiles (2×1) fail the width test and keep the row layout above. Placed after\n * the row-flip so it wins. */\n@container widget (max-width: 189px) and (max-height: 189px) {\n .glasshome-widget-content {\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: clamp(4px, 2.5cqmin, 8px);\n }\n .glasshome-widget-content > * { align-items: center; text-align: center; }\n .glasshome-widget-icon {\n --widget-icon-box: clamp(36px, 30cqmin, 56px);\n --widget-icon-glyph: clamp(20px, 17cqmin, 32px);\n }\n .glasshome-widget-title { font-size: clamp(11px, 6cqmin, 14px); max-width: 100%; }\n .glasshome-widget-status,\n .glasshome-widget-value { font-size: clamp(13px, 7cqmin, 17px); }\n .glasshome-widget-content [class*=\"ml-auto\"] { margin-left: 0 !important; }\n}\n.glasshome-widget-content [class*=\"ml-auto\"] {\n position: relative;\n z-index: 30;\n}\n\n/* === Slot: icon === */\n.glasshome-widget-icon {\n width: var(--widget-icon-box);\n height: var(--widget-icon-box);\n border-radius: var(--radius-sm, 12px);\n background: var(--widget-icon-color, var(--widget-color));\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);\n color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);\n}\n.glasshome-widget-icon-glyph {\n font-size: var(--widget-icon-glyph);\n line-height: 1;\n}\n.glasshome-widget-icon-stack {\n position: absolute;\n width: 102%;\n height: 102%;\n border-radius: var(--radius-sm, 12px);\n}\n.glasshome-widget-icon-stack-2 { bottom: -14%; right: -10%; opacity: 0.45; z-index: -2; }\n.glasshome-widget-icon-stack-3 { bottom: -28%; right: -20%; opacity: 0.20; z-index: -3; }\n\n/* === Slot: text === */\n.glasshome-widget-title {\n font-size: var(--widget-title-size);\n line-height: 1.2;\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.glasshome-widget-subtitle {\n font-size: var(--widget-subtitle);\n color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);\n}\n.glasshome-widget-status {\n font-size: var(--widget-status-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.1;\n}\n.glasshome-widget-value {\n font-size: var(--widget-value-size);\n font-weight: 700;\n color: var(--color-foreground, currentColor);\n line-height: 1.05;\n}\n.glasshome-widget-badge {\n font-size: var(--widget-badge-size);\n font-weight: 500;\n padding: 0.125rem 0.5rem;\n border-radius: 9999px;\n background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);\n color: var(--color-foreground, currentColor);\n}\n\n.glasshome-widget-loading {\n background: color-mix(in oklch, var(--widget-color) 20%, transparent);\n}\n\n/* === Slider fill ===\n * Value flows in via --widget-fill-value (0-100). Vertical orientation auto-\n * detected via container query. */\n.glasshome-widget-slider-fill {\n --widget-fill-value: 0;\n background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);\n box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)\n color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);\n clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);\n}\n@container widget (max-aspect-ratio: 1) {\n .glasshome-widget-slider-fill {\n clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);\n }\n}\n", et = !1, B, tt = /* @__PURE__ */ new WeakSet();
|
|
88
|
+
function nt() {
|
|
89
|
+
return B || (B = new CSSStyleSheet(), B.replaceSync($e.replace(/:root\b/g, ":host").replace(/^\.dark\b/gm, ":host(.dark)"))), B;
|
|
90
|
+
}
|
|
91
|
+
function rt(e) {
|
|
92
|
+
if (typeof ShadowRoot < "u" && e instanceof ShadowRoot) {
|
|
93
|
+
if (tt.has(e)) return;
|
|
94
|
+
let t = nt();
|
|
95
|
+
e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]), tt.add(e);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (et) return;
|
|
99
|
+
let t = e ?? (typeof document > "u" ? void 0 : document);
|
|
100
|
+
if (!t) return;
|
|
101
|
+
if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
|
|
102
|
+
et = !0;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
let n = t.createElement("style");
|
|
106
|
+
n.setAttribute("data-glasshome-tokens", ""), n.textContent = $e, t.head.appendChild(n), et = !0;
|
|
107
|
+
}
|
|
72
108
|
//#endregion
|
|
73
109
|
//#region src/framework/utils/cn.ts
|
|
74
|
-
function
|
|
75
|
-
return be(
|
|
110
|
+
function V(...e) {
|
|
111
|
+
return xe(be(e));
|
|
76
112
|
}
|
|
77
|
-
var
|
|
113
|
+
var it = {
|
|
78
114
|
"classic-glass": {
|
|
79
115
|
id: "classic-glass",
|
|
80
116
|
name: "Classic Glass",
|
|
81
117
|
description: "Default glassmorphism design with blur background and gradient",
|
|
82
|
-
styles: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
class: "backdrop-blur-xl"
|
|
91
|
-
},
|
|
118
|
+
styles: { cssVars: {
|
|
119
|
+
"--widget-bg": "rgba(255, 255, 255, 0.1)",
|
|
120
|
+
"--widget-border": "rgba(255, 255, 255, 0.2)",
|
|
121
|
+
"--widget-blur": "12px",
|
|
122
|
+
"--widget-shadow": "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
123
|
+
"--widget-padding": "1.5rem",
|
|
124
|
+
"--widget-backdrop": "blur(var(--glass-blur, 24px)) saturate(1.8)"
|
|
125
|
+
} },
|
|
92
126
|
layout: {
|
|
93
127
|
type: "flex",
|
|
94
128
|
direction: "column",
|
|
@@ -134,16 +168,14 @@ var ke = {
|
|
|
134
168
|
id: "compact-horizontal",
|
|
135
169
|
name: "Compact Horizontal",
|
|
136
170
|
description: "Horizontal layout for compact widgets",
|
|
137
|
-
styles: {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
class: "backdrop-blur-lg"
|
|
146
|
-
},
|
|
171
|
+
styles: { cssVars: {
|
|
172
|
+
"--widget-bg": "rgba(255, 255, 255, 0.08)",
|
|
173
|
+
"--widget-border": "rgba(255, 255, 255, 0.15)",
|
|
174
|
+
"--widget-blur": "10px",
|
|
175
|
+
"--widget-padding": "1rem",
|
|
176
|
+
"--widget-icon-size": "2.5rem",
|
|
177
|
+
"--widget-backdrop": "blur(16px) saturate(1.8)"
|
|
178
|
+
} },
|
|
147
179
|
layout: {
|
|
148
180
|
type: "flex",
|
|
149
181
|
direction: "row",
|
|
@@ -160,22 +192,22 @@ var ke = {
|
|
|
160
192
|
}
|
|
161
193
|
}
|
|
162
194
|
};
|
|
163
|
-
function
|
|
164
|
-
return
|
|
195
|
+
function at(e) {
|
|
196
|
+
return it[e];
|
|
165
197
|
}
|
|
166
198
|
//#endregion
|
|
167
199
|
//#region src/framework/backgrounds/WidgetSliderFill.tsx
|
|
168
|
-
var
|
|
169
|
-
function
|
|
200
|
+
var ot = /*#__PURE__*/ I("<div>");
|
|
201
|
+
function st(e) {
|
|
170
202
|
return (() => {
|
|
171
|
-
var t =
|
|
172
|
-
return
|
|
173
|
-
var r =
|
|
203
|
+
var t = ot();
|
|
204
|
+
return M((n) => {
|
|
205
|
+
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 = {
|
|
174
206
|
"--widget-fill-value": e.value,
|
|
175
|
-
"z-index":
|
|
207
|
+
"z-index": z.BACKGROUND,
|
|
176
208
|
...e.color ? { "--widget-icon-color": e.color } : {}
|
|
177
209
|
};
|
|
178
|
-
return r !== n.e &&
|
|
210
|
+
return r !== n.e && A(t, n.e = r), n.t = ve(t, i, n.t), n;
|
|
179
211
|
}, {
|
|
180
212
|
e: void 0,
|
|
181
213
|
t: void 0
|
|
@@ -184,37 +216,37 @@ function Me(e) {
|
|
|
184
216
|
}
|
|
185
217
|
//#endregion
|
|
186
218
|
//#region src/framework/components/WidgetContent.tsx
|
|
187
|
-
var
|
|
188
|
-
function
|
|
219
|
+
var ct = /*#__PURE__*/ I("<div>");
|
|
220
|
+
function lt(e) {
|
|
189
221
|
return (() => {
|
|
190
|
-
var t =
|
|
191
|
-
return
|
|
222
|
+
var t = ct();
|
|
223
|
+
return N(t, () => e.children), M(() => A(t, V("glasshome-widget-content", e.class))), t;
|
|
192
224
|
})();
|
|
193
225
|
}
|
|
194
226
|
//#endregion
|
|
195
227
|
//#region src/framework/components/WidgetIcon.tsx
|
|
196
|
-
var
|
|
197
|
-
function
|
|
228
|
+
var ut = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2\">"), dt = /*#__PURE__*/ I("<div class=\"glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3\">"), ft = /*#__PURE__*/ I("<div><div class=\"glasshome-widget-icon-glyph flex items-center justify-center\">");
|
|
229
|
+
function pt(e) {
|
|
198
230
|
let t = () => e.entityCount ?? 1;
|
|
199
231
|
return (() => {
|
|
200
|
-
var n =
|
|
201
|
-
return
|
|
232
|
+
var n = ft(), r = n.firstChild;
|
|
233
|
+
return N(n, j(C, {
|
|
202
234
|
get when() {
|
|
203
235
|
return t() >= 2;
|
|
204
236
|
},
|
|
205
237
|
get children() {
|
|
206
|
-
return
|
|
238
|
+
return ut();
|
|
207
239
|
}
|
|
208
|
-
}), r),
|
|
240
|
+
}), r), N(n, j(C, {
|
|
209
241
|
get when() {
|
|
210
242
|
return t() >= 3;
|
|
211
243
|
},
|
|
212
244
|
get children() {
|
|
213
|
-
return
|
|
245
|
+
return dt();
|
|
214
246
|
}
|
|
215
|
-
}), r),
|
|
216
|
-
var r =
|
|
217
|
-
return r !== t.e &&
|
|
247
|
+
}), r), N(r, () => e.icon), M((t) => {
|
|
248
|
+
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;
|
|
249
|
+
return r !== t.e && A(n, t.e = r), t.t = ve(n, i, t.t), t;
|
|
218
250
|
}, {
|
|
219
251
|
e: void 0,
|
|
220
252
|
t: void 0
|
|
@@ -223,16 +255,16 @@ function Re(e) {
|
|
|
223
255
|
}
|
|
224
256
|
//#endregion
|
|
225
257
|
//#region src/framework/components/WidgetStatus.tsx
|
|
226
|
-
var
|
|
227
|
-
function
|
|
258
|
+
var mt = /*#__PURE__*/ I("<p>");
|
|
259
|
+
function ht(e) {
|
|
228
260
|
return (() => {
|
|
229
|
-
var t =
|
|
230
|
-
return
|
|
231
|
-
var t =
|
|
261
|
+
var t = mt();
|
|
262
|
+
return N(t, (() => {
|
|
263
|
+
var t = P(() => !!e.isUnavailable);
|
|
232
264
|
return () => t() ? "Unavailable" : e.children;
|
|
233
|
-
})()),
|
|
234
|
-
var r =
|
|
235
|
-
return r !== n.e &&
|
|
265
|
+
})()), M((n) => {
|
|
266
|
+
var r = V("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), i = z.ACTIONS;
|
|
267
|
+
return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
|
|
236
268
|
}, {
|
|
237
269
|
e: void 0,
|
|
238
270
|
t: void 0
|
|
@@ -241,21 +273,21 @@ function Be(e) {
|
|
|
241
273
|
}
|
|
242
274
|
//#endregion
|
|
243
275
|
//#region src/framework/components/WidgetTitle.tsx
|
|
244
|
-
var
|
|
245
|
-
function
|
|
276
|
+
var gt = /*#__PURE__*/ I("<span class=\"glasshome-widget-badge shrink-0\">"), _t = /*#__PURE__*/ I("<div><h3 class=glasshome-widget-title>");
|
|
277
|
+
function vt(e) {
|
|
246
278
|
return (() => {
|
|
247
|
-
var t =
|
|
248
|
-
return
|
|
279
|
+
var t = _t(), n = t.firstChild;
|
|
280
|
+
return N(n, () => e.children), N(t, j(C, {
|
|
249
281
|
get when() {
|
|
250
|
-
return
|
|
282
|
+
return P(() => e.badge !== void 0)() && e.badge > 0;
|
|
251
283
|
},
|
|
252
284
|
get children() {
|
|
253
|
-
var t =
|
|
254
|
-
return
|
|
285
|
+
var t = gt();
|
|
286
|
+
return N(t, () => e.badge), t;
|
|
255
287
|
}
|
|
256
|
-
}), null),
|
|
257
|
-
var r =
|
|
258
|
-
return r !== n.e &&
|
|
288
|
+
}), null), M((n) => {
|
|
289
|
+
var r = V("relative flex items-center gap-2", e.class), i = z.ACTIONS;
|
|
290
|
+
return r !== n.e && A(t, n.e = r), i !== n.t && F(t, "z-index", n.t = i), n;
|
|
259
291
|
}, {
|
|
260
292
|
e: void 0,
|
|
261
293
|
t: void 0
|
|
@@ -264,7 +296,7 @@ function Ue(e) {
|
|
|
264
296
|
}
|
|
265
297
|
//#endregion
|
|
266
298
|
//#region src/framework/utils/entity-aggregation.ts
|
|
267
|
-
function
|
|
299
|
+
function yt(e, t = !1) {
|
|
268
300
|
if (e.length === 0) return {
|
|
269
301
|
isGroup: !1,
|
|
270
302
|
state: "unknown",
|
|
@@ -287,7 +319,7 @@ function We(e, t = !1) {
|
|
|
287
319
|
isUnavailable: t.state === "unavailable",
|
|
288
320
|
brightness: r,
|
|
289
321
|
brightnessPercent: i,
|
|
290
|
-
color:
|
|
322
|
+
color: St(t),
|
|
291
323
|
onCount: +!!n,
|
|
292
324
|
totalCount: 1,
|
|
293
325
|
description: n ? "On" : "Off"
|
|
@@ -299,7 +331,7 @@ function We(e, t = !1) {
|
|
|
299
331
|
if (r++, t.attributes?.brightness !== void 0 && (s += t.attributes.brightness, c++), t.attributes?.rgb_color) l.push(t.attributes.rgb_color);
|
|
300
332
|
else if (t.attributes?.hs_color) {
|
|
301
333
|
let [e, n] = t.attributes.hs_color;
|
|
302
|
-
l.push(
|
|
334
|
+
l.push(xt(e, n));
|
|
303
335
|
}
|
|
304
336
|
break;
|
|
305
337
|
case "off":
|
|
@@ -308,9 +340,7 @@ function We(e, t = !1) {
|
|
|
308
340
|
case "unknown":
|
|
309
341
|
a++;
|
|
310
342
|
break;
|
|
311
|
-
case "unavailable":
|
|
312
|
-
o++;
|
|
313
|
-
break;
|
|
343
|
+
case "unavailable": o++;
|
|
314
344
|
}
|
|
315
345
|
let u = e.length, d = o === u, f = a + o === u, p = r > 0, m = r === u, h = i === u, g, _;
|
|
316
346
|
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);
|
|
@@ -318,7 +348,7 @@ function We(e, t = !1) {
|
|
|
318
348
|
if (l.length > 0) {
|
|
319
349
|
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;
|
|
320
350
|
y = `rgb(${Math.round(e * r)}, ${Math.round(t * r)}, ${Math.round(n * r)})`;
|
|
321
|
-
} else y =
|
|
351
|
+
} else y = St(e[0]);
|
|
322
352
|
let b;
|
|
323
353
|
return b = m ? "All on" : h ? "All off" : r > 0 ? `${r} of ${u} on` : "Off", {
|
|
324
354
|
isGroup: n,
|
|
@@ -333,7 +363,7 @@ function We(e, t = !1) {
|
|
|
333
363
|
description: b
|
|
334
364
|
};
|
|
335
365
|
}
|
|
336
|
-
function
|
|
366
|
+
function bt(e, t = "mean", n = !0) {
|
|
337
367
|
if (e.length === 0) return {
|
|
338
368
|
isGroup: !1,
|
|
339
369
|
state: "unknown",
|
|
@@ -429,7 +459,7 @@ function Ge(e, t = "mean", n = !0) {
|
|
|
429
459
|
memberValues: a
|
|
430
460
|
};
|
|
431
461
|
}
|
|
432
|
-
function
|
|
462
|
+
function xt(e, t) {
|
|
433
463
|
let n = t / 100, r = n * (1 - Math.abs(e / 60 % 2 - 1)), i = 1 - n, a = 0, o = 0, s = 0;
|
|
434
464
|
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], [
|
|
435
465
|
(a + i) * 255,
|
|
@@ -437,7 +467,7 @@ function Ke(e, t) {
|
|
|
437
467
|
(s + i) * 255
|
|
438
468
|
];
|
|
439
469
|
}
|
|
440
|
-
function
|
|
470
|
+
function St(e) {
|
|
441
471
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
442
472
|
let t = (e.attributes?.brightness ?? 255) / 255;
|
|
443
473
|
if (e.attributes?.rgb_color) {
|
|
@@ -445,7 +475,7 @@ function qe(e) {
|
|
|
445
475
|
return `rgb(${Math.round(n * t)}, ${Math.round(r * t)}, ${Math.round(i * t)})`;
|
|
446
476
|
}
|
|
447
477
|
if (e.attributes?.hs_color) {
|
|
448
|
-
let [n, r] = e.attributes.hs_color, [i, a, o] =
|
|
478
|
+
let [n, r] = e.attributes.hs_color, [i, a, o] = xt(n, r);
|
|
449
479
|
return `rgb(${Math.round(i * t)}, ${Math.round(a * t)}, ${Math.round(o * t)})`;
|
|
450
480
|
}
|
|
451
481
|
if (e.attributes?.color_temp) {
|
|
@@ -456,7 +486,7 @@ function qe(e) {
|
|
|
456
486
|
}
|
|
457
487
|
//#endregion
|
|
458
488
|
//#region src/framework/utils/entity-state.ts
|
|
459
|
-
function
|
|
489
|
+
function Ct(e) {
|
|
460
490
|
if (!e) return !1;
|
|
461
491
|
if ([
|
|
462
492
|
"on",
|
|
@@ -472,15 +502,15 @@ function Je(e) {
|
|
|
472
502
|
}
|
|
473
503
|
return !1;
|
|
474
504
|
}
|
|
475
|
-
function
|
|
505
|
+
function wt(e, t, n) {
|
|
476
506
|
return e?.attributes ? e.attributes[t] ?? n : n;
|
|
477
507
|
}
|
|
478
|
-
function
|
|
479
|
-
return e.filter(
|
|
508
|
+
function Tt(e) {
|
|
509
|
+
return e.filter(Ct).length;
|
|
480
510
|
}
|
|
481
511
|
//#endregion
|
|
482
512
|
//#region src/framework/utils/format-value.ts
|
|
483
|
-
function
|
|
513
|
+
function Et(e, t, n) {
|
|
484
514
|
let { decimals: r, scale: i = !0 } = n || {};
|
|
485
515
|
if (typeof e == "string") return t ? `${e}${t}` : e;
|
|
486
516
|
if (e == null || Number.isNaN(e)) return t ? `--${t}` : "--";
|
|
@@ -491,41 +521,41 @@ function Ze(e, t, n) {
|
|
|
491
521
|
}
|
|
492
522
|
//#endregion
|
|
493
523
|
//#region src/framework/utils/interpret-value.ts
|
|
494
|
-
function
|
|
524
|
+
function Dt(e, t) {
|
|
495
525
|
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;
|
|
496
526
|
}
|
|
497
527
|
//#endregion
|
|
498
528
|
//#region src/framework/components/WidgetValue.tsx
|
|
499
|
-
var
|
|
500
|
-
function
|
|
529
|
+
var Ot = /*#__PURE__*/ I("<div class=glasshome-widget-subtitle>"), kt = /*#__PURE__*/ I("<div><div class=glasshome-widget-value>");
|
|
530
|
+
function At(e) {
|
|
501
531
|
return (() => {
|
|
502
|
-
var t =
|
|
503
|
-
return
|
|
532
|
+
var t = kt(), n = t.firstChild;
|
|
533
|
+
return N(n, () => Et(e.value, e.unit)), N(t, j(C, {
|
|
504
534
|
get when() {
|
|
505
|
-
return
|
|
535
|
+
return P(() => !!e.interpret)() && typeof e.value == "number";
|
|
506
536
|
},
|
|
507
537
|
get children() {
|
|
508
|
-
var t =
|
|
509
|
-
return
|
|
538
|
+
var t = Ot();
|
|
539
|
+
return N(t, () => Dt(e.value, e.unit)), t;
|
|
510
540
|
}
|
|
511
|
-
}), null),
|
|
541
|
+
}), null), M(() => A(t, V("flex flex-col", e.class))), t;
|
|
512
542
|
})();
|
|
513
543
|
}
|
|
514
544
|
//#endregion
|
|
515
545
|
//#region src/framework/core/Widget.tsx
|
|
516
|
-
var
|
|
517
|
-
function
|
|
518
|
-
let
|
|
546
|
+
var jt = /*#__PURE__*/ I("<div><div class=\"relative h-full w-full\">"), Mt = /*#__PURE__*/ I("<div class=\"glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse\">"), Nt = /*#__PURE__*/ I("<div class=\"flex h-full w-full flex-col items-center justify-center gap-2 text-center\">"), Pt = /*#__PURE__*/ I("<div class=\"flex items-center justify-center text-white/30\">"), Ft = /*#__PURE__*/ I("<h3 class=\"font-semibold text-sm text-white/60\">"), It = /*#__PURE__*/ I("<p class=\"text-white/50 text-xs\">");
|
|
547
|
+
function Lt(t) {
|
|
548
|
+
let n = O(L), [r, i] = E(), [a, o] = E({
|
|
519
549
|
width: 0,
|
|
520
550
|
height: 0
|
|
521
551
|
});
|
|
522
|
-
|
|
523
|
-
let e =
|
|
552
|
+
w(() => {
|
|
553
|
+
let e = r();
|
|
524
554
|
if (!e) return;
|
|
525
555
|
let t = new ResizeObserver(([e]) => {
|
|
526
556
|
if (!e) return;
|
|
527
557
|
let t = e.borderBoxSize?.[0];
|
|
528
|
-
|
|
558
|
+
o(t ? {
|
|
529
559
|
width: t.inlineSize,
|
|
530
560
|
height: t.blockSize
|
|
531
561
|
} : {
|
|
@@ -533,133 +563,159 @@ function ct(t) {
|
|
|
533
563
|
height: e.contentRect.height
|
|
534
564
|
});
|
|
535
565
|
});
|
|
536
|
-
t.observe(e),
|
|
566
|
+
t.observe(e), D(() => t.disconnect());
|
|
537
567
|
}), me(() => {
|
|
538
|
-
let e =
|
|
539
|
-
|
|
568
|
+
let e = r()?.getRootNode();
|
|
569
|
+
rt(typeof ShadowRoot < "u" && e instanceof ShadowRoot || typeof Document < "u" && e instanceof Document ? e : void 0);
|
|
540
570
|
});
|
|
541
|
-
let
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}), u = E(() => ({
|
|
571
|
+
let s = {
|
|
572
|
+
updateConfig: n?.updateConfig ?? (() => {}),
|
|
573
|
+
registerDialogOpener: n?.registerDialogOpener,
|
|
574
|
+
callService: n?.callService,
|
|
575
|
+
dimensions: e(() => a(), "ctx.dimensions")
|
|
576
|
+
}, c = T(() => {
|
|
577
|
+
if (t.variant) return typeof t.variant == "string" ? at(t.variant) : t.variant;
|
|
578
|
+
}), l = T(() => ({
|
|
550
579
|
"container-type": "size",
|
|
551
580
|
"container-name": "widget",
|
|
552
581
|
"touch-action": t.gestures && !t.isEditMode ? t.gestures.touchAction() : void 0,
|
|
553
|
-
...
|
|
554
|
-
...
|
|
582
|
+
...c()?.styles?.container,
|
|
583
|
+
...c()?.styles?.cssVars || {},
|
|
555
584
|
...t.tone ? { "--widget-color": `var(--tone-${t.tone})` } : {},
|
|
556
585
|
...t.color ? { "--widget-color": t.color } : {},
|
|
557
586
|
...t.colorTo ? { "--widget-color-to": t.colorTo } : {},
|
|
558
587
|
...t.gradient ? { "--widget-gradient": t.gradient } : {}
|
|
559
|
-
})),
|
|
560
|
-
|
|
588
|
+
})), u = () => !!t.gestures && !t.isEditMode, d = (e) => {
|
|
589
|
+
u() && t.gestures?.onPointerEnter(e);
|
|
590
|
+
}, f = (e) => {
|
|
591
|
+
u() && t.gestures?.onPointerDown(e);
|
|
561
592
|
}, p = (e) => {
|
|
562
|
-
|
|
593
|
+
u() && t.gestures?.onPointerMove(e);
|
|
563
594
|
}, m = (e) => {
|
|
564
|
-
|
|
595
|
+
u() && t.gestures?.onPointerUp(e);
|
|
565
596
|
}, h = (e) => {
|
|
566
|
-
|
|
567
|
-
}, g = (e) => {
|
|
568
|
-
d() && t.gestures?.onPointerCancel(e);
|
|
597
|
+
u() && t.gestures?.onPointerCancel(e);
|
|
569
598
|
};
|
|
570
|
-
return
|
|
571
|
-
value:
|
|
599
|
+
return j(L.Provider, {
|
|
600
|
+
value: s,
|
|
572
601
|
get children() {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
602
|
+
return j(Ze.Provider, {
|
|
603
|
+
value: a,
|
|
604
|
+
get children() {
|
|
605
|
+
var e = jt(), n = e.firstChild;
|
|
606
|
+
return k(e, "pointercancel", h), k(e, "pointerup", m), k(e, "pointermove", p), k(e, "pointerdown", f), k(e, "pointerenter", d), ye((e) => {
|
|
607
|
+
i(e), t.gestures?.bindElement(e);
|
|
608
|
+
}, e), N(n, (() => {
|
|
609
|
+
var e = P(() => !!t.emptyState);
|
|
610
|
+
return () => e() ? j(Rt, {
|
|
611
|
+
get icon() {
|
|
612
|
+
return t.emptyState.icon;
|
|
613
|
+
},
|
|
614
|
+
get title() {
|
|
615
|
+
return t.emptyState.title;
|
|
616
|
+
},
|
|
617
|
+
get message() {
|
|
618
|
+
return t.emptyState.message;
|
|
619
|
+
}
|
|
620
|
+
}) : t.children;
|
|
621
|
+
})()), N(e, (() => {
|
|
622
|
+
var e = P(() => !!t.loading);
|
|
623
|
+
return () => e() && (() => {
|
|
624
|
+
var e = Mt();
|
|
625
|
+
return M((t) => F(e, "z-index", z.OVERLAY)), e;
|
|
626
|
+
})();
|
|
627
|
+
})(), null), M((r) => {
|
|
628
|
+
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 = z.CONTENT;
|
|
629
|
+
return i !== r.e && A(e, r.e = i), r.t = ve(e, a, r.t), o !== r.a && F(n, "z-index", r.a = o), r;
|
|
630
|
+
}, {
|
|
631
|
+
e: void 0,
|
|
632
|
+
t: void 0,
|
|
633
|
+
a: void 0
|
|
634
|
+
}), e;
|
|
635
|
+
}
|
|
636
|
+
});
|
|
603
637
|
}
|
|
604
638
|
});
|
|
605
639
|
}
|
|
606
|
-
function
|
|
640
|
+
function Rt(e) {
|
|
607
641
|
return (() => {
|
|
608
|
-
var t =
|
|
609
|
-
return
|
|
610
|
-
var t =
|
|
642
|
+
var t = Nt();
|
|
643
|
+
return N(t, (() => {
|
|
644
|
+
var t = P(() => !!e.icon);
|
|
611
645
|
return () => t() && (() => {
|
|
612
|
-
var t =
|
|
613
|
-
return
|
|
646
|
+
var t = Pt();
|
|
647
|
+
return N(t, () => e.icon), t;
|
|
614
648
|
})();
|
|
615
|
-
})(), null),
|
|
616
|
-
var t =
|
|
649
|
+
})(), null), N(t, (() => {
|
|
650
|
+
var t = P(() => !!e.title);
|
|
617
651
|
return () => t() && (() => {
|
|
618
|
-
var t =
|
|
619
|
-
return
|
|
652
|
+
var t = Ft();
|
|
653
|
+
return N(t, () => e.title), t;
|
|
620
654
|
})();
|
|
621
|
-
})(), null),
|
|
622
|
-
var t =
|
|
655
|
+
})(), null), N(t, (() => {
|
|
656
|
+
var t = P(() => !!e.message);
|
|
623
657
|
return () => t() && (() => {
|
|
624
|
-
var t =
|
|
625
|
-
return
|
|
658
|
+
var t = It();
|
|
659
|
+
return N(t, () => e.message), t;
|
|
626
660
|
})();
|
|
627
661
|
})(), null), t;
|
|
628
662
|
})();
|
|
629
663
|
}
|
|
630
|
-
var
|
|
631
|
-
|
|
664
|
+
var H = Lt;
|
|
665
|
+
H.Content = lt, H.Icon = pt, H.Title = vt, H.Status = ht, H.Value = At, H.SliderFill = st;
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region src/framework/dialogs/validate-config.ts
|
|
668
|
+
function zt(e) {
|
|
669
|
+
let t = "";
|
|
670
|
+
for (let n of e) t += typeof n == "number" ? `[${n}]` : t ? `.${String(n)}` : String(n);
|
|
671
|
+
return t;
|
|
672
|
+
}
|
|
673
|
+
function Bt(e, t) {
|
|
674
|
+
let n = e.safeParse(t);
|
|
675
|
+
return n.success ? null : n.error.issues.map((e) => {
|
|
676
|
+
let t = zt(e.path);
|
|
677
|
+
return t ? `${t}: ${e.message}` : e.message;
|
|
678
|
+
});
|
|
679
|
+
}
|
|
632
680
|
//#endregion
|
|
633
681
|
//#region src/framework/dialogs/WidgetDialog.tsx
|
|
634
|
-
var
|
|
635
|
-
function
|
|
682
|
+
var Vt = /*#__PURE__*/ I("<span class=\"inline-flex size-3.5 shrink-0 items-center\">"), Ht = /*#__PURE__*/ I("<button type=button>"), Ut = /*#__PURE__*/ I("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"></path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\">"), Wt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No edit options available"), Gt = /*#__PURE__*/ I("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><line x1=4 y1=21 x2=4 y2=14></line><line x1=4 y1=10 x2=4 y2=3></line><line x1=12 y1=21 x2=12 y2=12></line><line x1=12 y1=8 x2=12 y2=3></line><line x1=20 y1=21 x2=20 y2=16></line><line x1=20 y1=12 x2=20 y2=3></line><line x1=1 y1=14 x2=7 y2=14></line><line x1=9 y1=8 x2=15 y2=8></line><line x1=17 y1=16 x2=23 y2=16>"), Kt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No additional controls"), qt = /*#__PURE__*/ I("<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2><path d=\"m8 2 1.88 1.88\"></path><path d=\"M14.12 3.88 16 2\"></path><path d=\"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1\"></path><path d=\"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6\"></path><path d=\"M12 20v-9\"></path><path d=\"M6.53 9C4.6 8.8 3 7.1 3 5\"></path><path d=\"M6 13H2\"></path><path d=\"M3 21c0-2.1 1.7-3.9 3.8-4\"></path><path d=\"M20.97 5c0 2.1-1.6 3.8-3.5 4\"></path><path d=\"M22 13h-4\"></path><path d=\"M17.2 17c2.1.1 3.8 1.9 3.8 4\">"), Jt = /*#__PURE__*/ I("<div class=\"rounded-lg bg-muted/30 p-2 text-center md:p-6\"><p class=\"text-muted-foreground text-sm\">No debug information available"), Yt = /*#__PURE__*/ I("<div class=\"min-w-0 shrink-0\">"), Xt = /*#__PURE__*/ I("<div class=\"flex items-center gap-2\"><div class=\"flex h-8 items-center rounded-lg border border-border/50 bg-muted/30 p-0.5\">"), Zt = /*#__PURE__*/ I("<div class=\"gh-scroll min-h-0 flex-1 overflow-y-auto px-6\">"), Qt = /*#__PURE__*/ I("<div class=\"flex shrink-0 items-center justify-end gap-2 border-border/50 border-t px-6 pt-3\">");
|
|
683
|
+
function $t(e) {
|
|
636
684
|
return (() => {
|
|
637
|
-
var t =
|
|
638
|
-
return t.$$click = () => e.onClick(),
|
|
685
|
+
var t = Ht();
|
|
686
|
+
return t.$$click = () => e.onClick(), N(t, j(C, {
|
|
639
687
|
get when() {
|
|
640
688
|
return e.isActive;
|
|
641
689
|
},
|
|
642
690
|
get children() {
|
|
643
|
-
var t =
|
|
644
|
-
return
|
|
691
|
+
var t = Vt();
|
|
692
|
+
return N(t, () => e.icon), t;
|
|
645
693
|
}
|
|
646
|
-
}), null),
|
|
694
|
+
}), null), N(t, () => e.label, null), M(() => A(t, V("flex cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-xs transition-all duration-300 ease-in-out", e.isActive ? "gap-1.5 bg-foreground/10 font-semibold text-foreground shadow-sm" : "gap-0 text-muted-foreground hover:bg-foreground/5 hover:text-foreground"))), t;
|
|
647
695
|
})();
|
|
648
696
|
}
|
|
649
|
-
function
|
|
650
|
-
let [t] = he(e, /* @__PURE__ */ "open.onOpenChange.title.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.Button.SchemaForm".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] =
|
|
651
|
-
|
|
697
|
+
function en(e) {
|
|
698
|
+
let [t] = he(e, /* @__PURE__ */ "open.onOpenChange.title.onSave.hasUnsavedChanges.onDelete.editContent.controlsContent.debugContent.debugData.tabs.class.maxWidth.defaultTab.activeTab.onActiveTabChange.headerActions.configSchema.config.onConfigSave.ResponsiveDialog.ResponsiveDialogContent.ResponsiveDialogHeader.ResponsiveDialogTitle.ResponsiveDialogDescription.Button.SchemaForm".split(".")), n = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, i] = E({}), [a, o] = E(null), [s, c] = E([]);
|
|
699
|
+
w(pe(() => t.config, (e) => {
|
|
652
700
|
e && i({ ...e });
|
|
653
|
-
})),
|
|
654
|
-
e && o(
|
|
701
|
+
})), w(pe(() => t.configSchema, (e) => {
|
|
702
|
+
e && o(He(e));
|
|
655
703
|
}));
|
|
656
|
-
let
|
|
657
|
-
!e && t.config && i({ ...t.config }), t.onOpenChange(e);
|
|
658
|
-
},
|
|
659
|
-
t.
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
704
|
+
let l = () => n() && JSON.stringify(r()) !== JSON.stringify(t.config), u = (e) => {
|
|
705
|
+
!e && t.config && (i({ ...t.config }), c([])), t.onOpenChange(e);
|
|
706
|
+
}, d = () => {
|
|
707
|
+
let e = t.configSchema;
|
|
708
|
+
if (e) {
|
|
709
|
+
let t = Bt(e, r());
|
|
710
|
+
if (t) {
|
|
711
|
+
c(t);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
c([]), t.onConfigSave?.(r());
|
|
716
|
+
}, [f, p] = E(t.defaultTab ?? "controls"), m = () => t.activeTab ?? f(), h = (e) => {
|
|
717
|
+
t.onActiveTabChange ? t.onActiveTabChange(e) : p(e);
|
|
718
|
+
}, g = () => ({
|
|
663
719
|
sm: "max-w-sm",
|
|
664
720
|
md: "max-w-md",
|
|
665
721
|
lg: "max-w-lg",
|
|
@@ -667,76 +723,80 @@ function Ct(e) {
|
|
|
667
723
|
"2xl": "max-w-2xl",
|
|
668
724
|
"3xl": "max-w-3xl",
|
|
669
725
|
"4xl": "max-w-4xl"
|
|
670
|
-
})[t.maxWidth ?? "3xl"],
|
|
726
|
+
})[t.maxWidth ?? "3xl"], _ = () => {
|
|
671
727
|
if (t.tabs) return t.tabs;
|
|
672
728
|
let e = [];
|
|
673
729
|
return e.push({
|
|
674
730
|
id: "edit",
|
|
675
731
|
label: "Edit",
|
|
676
|
-
icon:
|
|
677
|
-
content: t.editContent ?? (
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
732
|
+
icon: Ut(),
|
|
733
|
+
content: t.editContent ?? (() => {
|
|
734
|
+
let e = n() ? a() : void 0;
|
|
735
|
+
return e ? j(ie, {
|
|
736
|
+
schema: e,
|
|
737
|
+
get data() {
|
|
738
|
+
return ge(r);
|
|
739
|
+
},
|
|
740
|
+
onChange: i,
|
|
741
|
+
get errors() {
|
|
742
|
+
return s();
|
|
743
|
+
}
|
|
744
|
+
}) : Wt();
|
|
745
|
+
})()
|
|
686
746
|
}), e.push({
|
|
687
747
|
id: "controls",
|
|
688
748
|
label: "Controls",
|
|
689
|
-
icon:
|
|
690
|
-
content: t.controlsContent ??
|
|
749
|
+
icon: Gt(),
|
|
750
|
+
content: t.controlsContent ?? Kt()
|
|
691
751
|
}), e.push({
|
|
692
752
|
id: "debug",
|
|
693
753
|
label: "Debug",
|
|
694
|
-
icon:
|
|
695
|
-
content: t.debugContent ??
|
|
754
|
+
icon: qt(),
|
|
755
|
+
content: t.debugContent ?? Jt()
|
|
696
756
|
}), e;
|
|
697
|
-
},
|
|
757
|
+
}, v = async () => {
|
|
698
758
|
if (t.debugData !== void 0) try {
|
|
699
759
|
let e = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
|
|
700
760
|
await navigator.clipboard.writeText(e);
|
|
701
761
|
} catch {}
|
|
702
|
-
},
|
|
703
|
-
let e =
|
|
704
|
-
return e.find((e) => e.id ===
|
|
705
|
-
},
|
|
762
|
+
}, ee = () => {
|
|
763
|
+
let e = ae();
|
|
764
|
+
return e.find((e) => e.id === m())?.content ?? e[0]?.content;
|
|
765
|
+
}, y = t.ResponsiveDialog, b = t.ResponsiveDialogContent, te = t.ResponsiveDialogHeader, ne = t.ResponsiveDialogTitle, re = t.ResponsiveDialogDescription, x = t.Button, ie = t.SchemaForm, ae = T(pe([
|
|
706
766
|
() => t.open,
|
|
707
767
|
a,
|
|
708
768
|
() => t.config,
|
|
709
769
|
() => t.tabs
|
|
710
|
-
], () =>
|
|
711
|
-
return
|
|
770
|
+
], () => _())), oe = (e) => n() ? u(e) : t.onOpenChange(e), se = () => n() ? l() : t.hasUnsavedChanges, S = () => n() ? d : t.onSave;
|
|
771
|
+
return j(y, {
|
|
712
772
|
get open() {
|
|
713
773
|
return t.open;
|
|
714
774
|
},
|
|
715
|
-
onOpenChange: (e) =>
|
|
775
|
+
onOpenChange: (e) => oe(e),
|
|
716
776
|
get children() {
|
|
717
|
-
return
|
|
777
|
+
return j(b, {
|
|
718
778
|
get class() {
|
|
719
|
-
return
|
|
779
|
+
return V(g(), "px-0", t.class);
|
|
720
780
|
},
|
|
721
781
|
get children() {
|
|
722
782
|
return [
|
|
723
|
-
|
|
783
|
+
j(te, {
|
|
724
784
|
class: "flex flex-row items-center justify-between gap-3 px-6",
|
|
725
785
|
get children() {
|
|
726
786
|
return [(() => {
|
|
727
|
-
var e =
|
|
728
|
-
return
|
|
787
|
+
var e = Yt();
|
|
788
|
+
return N(e, j(ne, {
|
|
729
789
|
class: "truncate leading-tight",
|
|
730
790
|
get children() {
|
|
731
791
|
return t.title;
|
|
732
792
|
}
|
|
733
|
-
}), null),
|
|
793
|
+
}), null), N(e, j(re, {
|
|
734
794
|
class: "sr-only",
|
|
735
795
|
children: "Widget configuration dialog"
|
|
736
796
|
}), null), e;
|
|
737
797
|
})(), (() => {
|
|
738
|
-
var e =
|
|
739
|
-
return
|
|
798
|
+
var e = Xt(), n = e.firstChild;
|
|
799
|
+
return N(n, () => ae().map((e) => j($t, {
|
|
740
800
|
get icon() {
|
|
741
801
|
return e.icon;
|
|
742
802
|
},
|
|
@@ -744,10 +804,10 @@ function Ct(e) {
|
|
|
744
804
|
return e.label;
|
|
745
805
|
},
|
|
746
806
|
get isActive() {
|
|
747
|
-
return
|
|
807
|
+
return m() === e.id;
|
|
748
808
|
},
|
|
749
|
-
onClick: () =>
|
|
750
|
-
}))),
|
|
809
|
+
onClick: () => h(e.id)
|
|
810
|
+
}))), N(e, j(C, {
|
|
751
811
|
get when() {
|
|
752
812
|
return t.headerActions;
|
|
753
813
|
},
|
|
@@ -759,50 +819,50 @@ function Ct(e) {
|
|
|
759
819
|
}
|
|
760
820
|
}),
|
|
761
821
|
(() => {
|
|
762
|
-
var e =
|
|
763
|
-
return
|
|
822
|
+
var e = Zt();
|
|
823
|
+
return N(e, ee), e;
|
|
764
824
|
})(),
|
|
765
|
-
|
|
825
|
+
j(C, {
|
|
766
826
|
get when() {
|
|
767
|
-
return
|
|
827
|
+
return P(() => m() === "edit")() && (S() || t.onDelete) || m() === "debug" && t.debugData !== void 0;
|
|
768
828
|
},
|
|
769
829
|
get children() {
|
|
770
|
-
var e =
|
|
771
|
-
return
|
|
830
|
+
var e = Qt();
|
|
831
|
+
return N(e, j(C, {
|
|
772
832
|
get when() {
|
|
773
|
-
return
|
|
833
|
+
return P(() => m() === "edit")() && t.onDelete;
|
|
774
834
|
},
|
|
775
835
|
get children() {
|
|
776
|
-
return
|
|
836
|
+
return j(x, {
|
|
777
837
|
size: "sm",
|
|
778
838
|
variant: "destructive",
|
|
779
839
|
onClick: () => t.onDelete?.(),
|
|
780
840
|
children: "Delete"
|
|
781
841
|
});
|
|
782
842
|
}
|
|
783
|
-
}), null),
|
|
843
|
+
}), null), N(e, j(C, {
|
|
784
844
|
get when() {
|
|
785
|
-
return
|
|
845
|
+
return P(() => m() === "edit")() && S();
|
|
786
846
|
},
|
|
787
847
|
get children() {
|
|
788
|
-
return
|
|
848
|
+
return j(x, {
|
|
789
849
|
size: "sm",
|
|
790
850
|
get disabled() {
|
|
791
|
-
return !
|
|
851
|
+
return !se();
|
|
792
852
|
},
|
|
793
|
-
onClick: () =>
|
|
853
|
+
onClick: () => S()?.(),
|
|
794
854
|
children: "Save"
|
|
795
855
|
});
|
|
796
856
|
}
|
|
797
|
-
}), null),
|
|
857
|
+
}), null), N(e, j(C, {
|
|
798
858
|
get when() {
|
|
799
|
-
return
|
|
859
|
+
return P(() => m() === "debug")() && t.debugData !== void 0;
|
|
800
860
|
},
|
|
801
861
|
get children() {
|
|
802
|
-
return
|
|
862
|
+
return j(x, {
|
|
803
863
|
size: "sm",
|
|
804
864
|
variant: "outline",
|
|
805
|
-
onClick:
|
|
865
|
+
onClick: v,
|
|
806
866
|
children: "Copy"
|
|
807
867
|
});
|
|
808
868
|
}
|
|
@@ -818,60 +878,60 @@ function Ct(e) {
|
|
|
818
878
|
_e(["click"]);
|
|
819
879
|
//#endregion
|
|
820
880
|
//#region src/framework/hooks/use-intersection-pause.ts
|
|
821
|
-
function
|
|
881
|
+
function tn(e) {
|
|
822
882
|
if (typeof IntersectionObserver > "u") return () => !1;
|
|
823
|
-
let [t, n] =
|
|
883
|
+
let [t, n] = E(!1), r = new IntersectionObserver((e) => {
|
|
824
884
|
let t = e[0];
|
|
825
885
|
t && n(!t.isIntersecting);
|
|
826
886
|
});
|
|
827
|
-
return
|
|
887
|
+
return w(() => {
|
|
828
888
|
let t = e();
|
|
829
889
|
r.disconnect(), t && r.observe(t);
|
|
830
|
-
}),
|
|
890
|
+
}), D(() => r.disconnect()), t;
|
|
831
891
|
}
|
|
832
892
|
//#endregion
|
|
833
893
|
//#region src/framework/hooks/use-reduced-motion.ts
|
|
834
|
-
function
|
|
894
|
+
function nn() {
|
|
835
895
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => !1;
|
|
836
|
-
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] =
|
|
837
|
-
return e.addEventListener("change", r),
|
|
896
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), [t, n] = E(e.matches), r = (e) => n(e.matches);
|
|
897
|
+
return e.addEventListener("change", r), D(() => e.removeEventListener("change", r)), t;
|
|
838
898
|
}
|
|
839
899
|
//#endregion
|
|
840
900
|
//#region src/framework/hooks/use-widget-dialog.ts
|
|
841
|
-
function
|
|
842
|
-
let [
|
|
843
|
-
|
|
844
|
-
},
|
|
845
|
-
return
|
|
846
|
-
showDialog:
|
|
847
|
-
setShowDialog:
|
|
848
|
-
openDialog:
|
|
849
|
-
closeDialog: () =>
|
|
850
|
-
activeTab:
|
|
851
|
-
setActiveTab:
|
|
901
|
+
function rn(e = "controls") {
|
|
902
|
+
let [t, n] = E(!1), [r, i] = E(e), a = (t) => {
|
|
903
|
+
i(t ?? e), n(!0);
|
|
904
|
+
}, o = O(L);
|
|
905
|
+
return o?.registerDialogOpener?.(a), D(() => o?.registerDialogOpener?.(null)), {
|
|
906
|
+
showDialog: t,
|
|
907
|
+
setShowDialog: n,
|
|
908
|
+
openDialog: a,
|
|
909
|
+
closeDialog: () => n(!1),
|
|
910
|
+
activeTab: r,
|
|
911
|
+
setActiveTab: i,
|
|
852
912
|
dialogProps: {
|
|
853
913
|
get open() {
|
|
854
|
-
return
|
|
914
|
+
return t();
|
|
855
915
|
},
|
|
856
|
-
onOpenChange:
|
|
916
|
+
onOpenChange: n,
|
|
857
917
|
get activeTab() {
|
|
858
|
-
return
|
|
918
|
+
return r();
|
|
859
919
|
},
|
|
860
|
-
onActiveTabChange:
|
|
920
|
+
onActiveTabChange: i
|
|
861
921
|
}
|
|
862
922
|
};
|
|
863
923
|
}
|
|
864
924
|
//#endregion
|
|
865
925
|
//#region src/framework/hooks/use-widget-entity-group.ts
|
|
866
|
-
function
|
|
867
|
-
let t = e.minEntities ?? 1, n =
|
|
926
|
+
function an(e) {
|
|
927
|
+
let t = e.minEntities ?? 1, n = T(() => e.entities().length), r = T(() => n() >= t), i = T(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = T(() => {
|
|
868
928
|
if (!r()) return;
|
|
869
929
|
let t = e.aggregationMode?.();
|
|
870
930
|
if (!t || t === "none") return;
|
|
871
931
|
let n = e.entities();
|
|
872
|
-
if (t === "light" || t === "binary-sensor" || t === "switch") return
|
|
873
|
-
if (t === "sensor") return
|
|
874
|
-
}), o =
|
|
932
|
+
if (t === "light" || t === "binary-sensor" || t === "switch") return yt(n, e.allEntitiesMode);
|
|
933
|
+
if (t === "sensor") return bt(n, e.sensorGroupType?.() ?? "mean", !0);
|
|
934
|
+
}), o = T(() => r() ? void 0 : e.emptyStateConfig);
|
|
875
935
|
return {
|
|
876
936
|
entities: e.entities,
|
|
877
937
|
groupData: i,
|
|
@@ -883,142 +943,142 @@ function Dt(e) {
|
|
|
883
943
|
}
|
|
884
944
|
//#endregion
|
|
885
945
|
//#region src/framework/gestures/cursors.ts
|
|
886
|
-
var
|
|
887
|
-
function
|
|
946
|
+
var U = 32, W = U / 2, G = "white", K = "rgba(0,0,0,0.4)", q = 2, J = 3;
|
|
947
|
+
function on(e) {
|
|
888
948
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
889
949
|
}
|
|
890
|
-
function
|
|
891
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
950
|
+
function Y(e) {
|
|
951
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${U}" viewBox="0 0 ${U} ${U}">${e}</svg>`;
|
|
892
952
|
}
|
|
893
|
-
var
|
|
953
|
+
var sn = Y(`
|
|
894
954
|
<g transform="translate(6, 2)">
|
|
895
955
|
<!-- shadow -->
|
|
896
|
-
<g stroke="${
|
|
956
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
897
957
|
<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"/>
|
|
898
958
|
</g>
|
|
899
959
|
<!-- main -->
|
|
900
|
-
<g stroke="${
|
|
960
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
901
961
|
<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"/>
|
|
902
962
|
</g>
|
|
903
963
|
</g>
|
|
904
|
-
`),
|
|
964
|
+
`), cn = Y(`
|
|
905
965
|
<g>
|
|
906
|
-
<circle cx="${
|
|
907
|
-
<circle cx="${
|
|
908
|
-
<circle cx="${
|
|
966
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${K}" stroke-width="${J}" fill="none"/>
|
|
967
|
+
<circle cx="${W}" cy="${W}" r="8" stroke="${G}" stroke-width="1.5" fill="none"/>
|
|
968
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
909
969
|
</g>
|
|
910
|
-
`),
|
|
970
|
+
`), ln = Y(`
|
|
911
971
|
<g>
|
|
912
972
|
<!-- shadow -->
|
|
913
|
-
<g stroke="${
|
|
914
|
-
<line x1="6" y1="${
|
|
915
|
-
<polyline points="10
|
|
916
|
-
<polyline points="22
|
|
973
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
974
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
975
|
+
<polyline points="10,12 6,${W} 10,20"/>
|
|
976
|
+
<polyline points="22,12 26,${W} 22,20"/>
|
|
917
977
|
</g>
|
|
918
978
|
<!-- main -->
|
|
919
|
-
<g stroke="${
|
|
920
|
-
<line x1="6" y1="${
|
|
921
|
-
<polyline points="10
|
|
922
|
-
<polyline points="22
|
|
979
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
980
|
+
<line x1="6" y1="${W}" x2="26" y2="${W}"/>
|
|
981
|
+
<polyline points="10,12 6,${W} 10,20"/>
|
|
982
|
+
<polyline points="22,12 26,${W} 22,20"/>
|
|
923
983
|
</g>
|
|
924
984
|
<!-- center grip dots -->
|
|
925
|
-
<circle cx="${
|
|
926
|
-
<circle cx="
|
|
927
|
-
<circle cx="21" cy="${
|
|
985
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
986
|
+
<circle cx="11" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
987
|
+
<circle cx="21" cy="${W}" r="1" fill="${G}" opacity="0.6"/>
|
|
928
988
|
</g>
|
|
929
|
-
`),
|
|
989
|
+
`), un = Y(`
|
|
930
990
|
<g>
|
|
931
991
|
<!-- shadow -->
|
|
932
|
-
<g stroke="${
|
|
933
|
-
<line x1="${
|
|
934
|
-
<polyline points="
|
|
935
|
-
<polyline points="
|
|
992
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
993
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
994
|
+
<polyline points="12,10 ${W},6 20,10"/>
|
|
995
|
+
<polyline points="12,22 ${W},26 20,22"/>
|
|
936
996
|
</g>
|
|
937
997
|
<!-- main -->
|
|
938
|
-
<g stroke="${
|
|
939
|
-
<line x1="${
|
|
940
|
-
<polyline points="
|
|
941
|
-
<polyline points="
|
|
998
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
999
|
+
<line x1="${W}" y1="6" x2="${W}" y2="26"/>
|
|
1000
|
+
<polyline points="12,10 ${W},6 20,10"/>
|
|
1001
|
+
<polyline points="12,22 ${W},26 20,22"/>
|
|
942
1002
|
</g>
|
|
943
1003
|
<!-- center grip dots -->
|
|
944
|
-
<circle cx="${
|
|
945
|
-
<circle cx="${
|
|
946
|
-
<circle cx="${
|
|
1004
|
+
<circle cx="${W}" cy="${W}" r="1.5" fill="${G}"/>
|
|
1005
|
+
<circle cx="${W}" cy="11" r="1" fill="${G}" opacity="0.6"/>
|
|
1006
|
+
<circle cx="${W}" cy="21" r="1" fill="${G}" opacity="0.6"/>
|
|
947
1007
|
</g>
|
|
948
|
-
`),
|
|
1008
|
+
`), dn = Y(`
|
|
949
1009
|
<g>
|
|
950
1010
|
<!-- shadow -->
|
|
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="
|
|
1011
|
+
<g stroke="${K}" stroke-width="${J}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1012
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
1013
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
1014
|
+
<polyline points="11,13 7,${W} 11,19"/>
|
|
1015
|
+
<polyline points="21,13 25,${W} 21,19"/>
|
|
1016
|
+
<polyline points="13,11 ${W},7 19,11"/>
|
|
1017
|
+
<polyline points="13,21 ${W},25 19,21"/>
|
|
958
1018
|
</g>
|
|
959
1019
|
<!-- main -->
|
|
960
|
-
<g stroke="${
|
|
961
|
-
<line x1="7" y1="${
|
|
962
|
-
<line x1="${
|
|
963
|
-
<polyline points="11
|
|
964
|
-
<polyline points="21
|
|
965
|
-
<polyline points="
|
|
966
|
-
<polyline points="
|
|
1020
|
+
<g stroke="${G}" stroke-width="${q}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1021
|
+
<line x1="7" y1="${W}" x2="25" y2="${W}"/>
|
|
1022
|
+
<line x1="${W}" y1="7" x2="${W}" y2="25"/>
|
|
1023
|
+
<polyline points="11,13 7,${W} 11,19"/>
|
|
1024
|
+
<polyline points="21,13 25,${W} 21,19"/>
|
|
1025
|
+
<polyline points="13,11 ${W},7 19,11"/>
|
|
1026
|
+
<polyline points="13,21 ${W},25 19,21"/>
|
|
967
1027
|
</g>
|
|
968
1028
|
<!-- center dot -->
|
|
969
|
-
<circle cx="${
|
|
1029
|
+
<circle cx="${W}" cy="${W}" r="2" fill="${G}"/>
|
|
970
1030
|
</g>
|
|
971
1031
|
`);
|
|
972
|
-
function
|
|
1032
|
+
function X(e, t, n) {
|
|
973
1033
|
return {
|
|
974
|
-
css: `${
|
|
1034
|
+
css: `${on(e)} ${t} ${n}, auto`,
|
|
975
1035
|
hotspotX: t,
|
|
976
1036
|
hotspotY: n
|
|
977
1037
|
};
|
|
978
1038
|
}
|
|
979
|
-
var
|
|
980
|
-
tap:
|
|
981
|
-
hold:
|
|
982
|
-
slideHorizontal:
|
|
983
|
-
slideVertical:
|
|
984
|
-
slideAuto:
|
|
1039
|
+
var Z = {
|
|
1040
|
+
tap: X(sn, 12, 4),
|
|
1041
|
+
hold: X(cn, 16, 16),
|
|
1042
|
+
slideHorizontal: X(ln, W, W),
|
|
1043
|
+
slideVertical: X(un, W, W),
|
|
1044
|
+
slideAuto: X(dn, W, W)
|
|
985
1045
|
};
|
|
986
1046
|
//#endregion
|
|
987
1047
|
//#region src/framework/gestures/haptics.ts
|
|
988
|
-
function
|
|
1048
|
+
function fn() {
|
|
989
1049
|
if (typeof window > "u") return null;
|
|
990
1050
|
let e = window;
|
|
991
1051
|
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
992
1052
|
}
|
|
993
|
-
function
|
|
1053
|
+
function pn(e) {
|
|
994
1054
|
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function")) try {
|
|
995
1055
|
navigator.vibrate(e);
|
|
996
1056
|
} catch {}
|
|
997
1057
|
}
|
|
998
|
-
var
|
|
1058
|
+
var mn = {
|
|
999
1059
|
tick() {
|
|
1000
|
-
let e =
|
|
1060
|
+
let e = fn();
|
|
1001
1061
|
if (e) {
|
|
1002
1062
|
e.impact({ style: "Light" }).catch(() => {});
|
|
1003
1063
|
return;
|
|
1004
1064
|
}
|
|
1005
|
-
|
|
1065
|
+
pn(8);
|
|
1006
1066
|
},
|
|
1007
1067
|
bump() {
|
|
1008
|
-
let e =
|
|
1068
|
+
let e = fn();
|
|
1009
1069
|
if (e) {
|
|
1010
1070
|
e.impact({ style: "Medium" }).catch(() => {});
|
|
1011
1071
|
return;
|
|
1012
1072
|
}
|
|
1013
|
-
|
|
1073
|
+
pn(20);
|
|
1014
1074
|
},
|
|
1015
1075
|
pulse() {
|
|
1016
|
-
let e =
|
|
1076
|
+
let e = fn();
|
|
1017
1077
|
if (e) {
|
|
1018
1078
|
e.impact({ style: "Heavy" }).catch(() => {});
|
|
1019
1079
|
return;
|
|
1020
1080
|
}
|
|
1021
|
-
|
|
1081
|
+
pn([
|
|
1022
1082
|
0,
|
|
1023
1083
|
15,
|
|
1024
1084
|
40,
|
|
@@ -1028,7 +1088,7 @@ var It = {
|
|
|
1028
1088
|
};
|
|
1029
1089
|
//#endregion
|
|
1030
1090
|
//#region src/framework/gestures/use-widget-gestures.ts
|
|
1031
|
-
function
|
|
1091
|
+
function hn(e, t) {
|
|
1032
1092
|
let n = {
|
|
1033
1093
|
isDown: !1,
|
|
1034
1094
|
isTouch: !1,
|
|
@@ -1039,7 +1099,7 @@ function Lt(e, t) {
|
|
|
1039
1099
|
sliding: !1,
|
|
1040
1100
|
holdTimer: null,
|
|
1041
1101
|
element: null
|
|
1042
|
-
}, r = null, i = null, a = null, [o, s] =
|
|
1102
|
+
}, r = null, i = null, a = null, [o, s] = E(null);
|
|
1043
1103
|
function c(e) {
|
|
1044
1104
|
e !== i && (a && a.disconnect(), a = new ResizeObserver((e) => {
|
|
1045
1105
|
let t = e[0];
|
|
@@ -1071,7 +1131,7 @@ function Lt(e, t) {
|
|
|
1071
1131
|
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) {
|
|
1072
1132
|
let e = r.hold.delay ?? 300;
|
|
1073
1133
|
n.holdTimer = setTimeout(() => {
|
|
1074
|
-
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (
|
|
1134
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (mn.bump(), r.hold?.action(), n.isDown = !1);
|
|
1075
1135
|
}, e);
|
|
1076
1136
|
}
|
|
1077
1137
|
if (!n.isTouch && r.slide) try {
|
|
@@ -1108,9 +1168,9 @@ function Lt(e, t) {
|
|
|
1108
1168
|
let n = e();
|
|
1109
1169
|
if (n.slide) {
|
|
1110
1170
|
let e = n.slide.orientation;
|
|
1111
|
-
return e === "horizontal" ?
|
|
1171
|
+
return e === "horizontal" ? Z.slideHorizontal.css : e === "vertical" ? Z.slideVertical.css : (r || c(t), r && r.height > r.width ? Z.slideVertical.css : Z.slideHorizontal.css);
|
|
1112
1172
|
}
|
|
1113
|
-
return n.tap ?
|
|
1173
|
+
return n.tap ? Z.tap.css : n.hold ? Z.hold.css : "";
|
|
1114
1174
|
};
|
|
1115
1175
|
return {
|
|
1116
1176
|
onPointerDown: f,
|
|
@@ -1139,7 +1199,7 @@ function Lt(e, t) {
|
|
|
1139
1199
|
}
|
|
1140
1200
|
//#endregion
|
|
1141
1201
|
//#region src/framework/theming/svg-colors.ts
|
|
1142
|
-
var
|
|
1202
|
+
var gn = {
|
|
1143
1203
|
solar: "oklch(0.74 0.18 60)",
|
|
1144
1204
|
grid: "oklch(0.62 0.12 245)",
|
|
1145
1205
|
battery: "oklch(0.70 0.18 145)",
|
|
@@ -1148,90 +1208,88 @@ var Rt = {
|
|
|
1148
1208
|
positive: "oklch(0.70 0.14 160)",
|
|
1149
1209
|
negative: "oklch(0.64 0.22 27)"
|
|
1150
1210
|
};
|
|
1151
|
-
function
|
|
1211
|
+
function _n(e) {
|
|
1152
1212
|
return {
|
|
1153
1213
|
fill: `color-mix(in oklch, ${e} 20%, transparent)`,
|
|
1154
1214
|
stroke: e,
|
|
1155
1215
|
solid: e
|
|
1156
1216
|
};
|
|
1157
1217
|
}
|
|
1158
|
-
var
|
|
1218
|
+
var vn = Object.fromEntries(Object.entries(gn).map(([e, t]) => [e, _n(t)])), yn = o.enum([
|
|
1159
1219
|
"success",
|
|
1160
1220
|
"warning",
|
|
1161
1221
|
"danger",
|
|
1162
1222
|
"info",
|
|
1163
1223
|
"neutral",
|
|
1164
1224
|
"accent"
|
|
1165
|
-
]),
|
|
1166
|
-
title:
|
|
1225
|
+
]), bn = {
|
|
1226
|
+
title: e(() => o.string().optional().meta({
|
|
1167
1227
|
title: "Title",
|
|
1168
1228
|
description: "Optional display name override"
|
|
1169
1229
|
}), "widgetFields.title"),
|
|
1170
|
-
entityIds:
|
|
1230
|
+
entityIds: e((e, t) => o.array(o.string()).default([]).meta({
|
|
1171
1231
|
domain: e,
|
|
1172
1232
|
title: "Entities",
|
|
1173
1233
|
...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
|
|
1174
1234
|
}), "widgetFields.entityIds"),
|
|
1175
|
-
singleEntity:
|
|
1235
|
+
singleEntity: e((e, t) => o.array(o.string()).default([]).meta({
|
|
1176
1236
|
domain: e,
|
|
1177
1237
|
title: "Entity",
|
|
1178
1238
|
singleSelect: !0,
|
|
1179
1239
|
...t?.deviceClass ? { deviceClass: t.deviceClass } : {}
|
|
1180
1240
|
}), "widgetFields.singleEntity"),
|
|
1181
|
-
areaId:
|
|
1241
|
+
areaId: e(() => o.string().optional().meta({
|
|
1182
1242
|
formType: "area-picker",
|
|
1183
1243
|
title: "Area"
|
|
1184
1244
|
}), "widgetFields.areaId")
|
|
1185
|
-
};
|
|
1186
|
-
|
|
1187
|
-
//#region src/framework/config/index.ts
|
|
1188
|
-
function $(e) {
|
|
1245
|
+
}, xn = 24;
|
|
1246
|
+
function Q(e) {
|
|
1189
1247
|
let t = {};
|
|
1190
1248
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
1191
1249
|
return t;
|
|
1192
1250
|
}
|
|
1193
|
-
function
|
|
1194
|
-
return
|
|
1251
|
+
function Sn() {
|
|
1252
|
+
return o.string().optional().meta({
|
|
1195
1253
|
title: "Title",
|
|
1196
1254
|
description: "Optional display name override"
|
|
1197
1255
|
});
|
|
1198
1256
|
}
|
|
1199
|
-
function
|
|
1200
|
-
return (e.default === void 0 ?
|
|
1257
|
+
function Cn(e) {
|
|
1258
|
+
return (e.default === void 0 ? o.string().optional() : o.string().default(e.default)).meta(Q({
|
|
1201
1259
|
title: e.title,
|
|
1202
1260
|
description: e.description
|
|
1203
1261
|
}));
|
|
1204
1262
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let t =
|
|
1207
|
-
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(
|
|
1263
|
+
function wn(e) {
|
|
1264
|
+
let t = o.number();
|
|
1265
|
+
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({
|
|
1208
1266
|
title: e.title,
|
|
1209
1267
|
description: e.description
|
|
1210
1268
|
}));
|
|
1211
1269
|
}
|
|
1212
|
-
function
|
|
1213
|
-
return
|
|
1270
|
+
function Tn(e) {
|
|
1271
|
+
return o.boolean().default(e.default ?? !1).meta(Q({
|
|
1214
1272
|
title: e.title,
|
|
1215
1273
|
description: e.description
|
|
1216
1274
|
}));
|
|
1217
1275
|
}
|
|
1218
|
-
function
|
|
1219
|
-
let n =
|
|
1220
|
-
return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(
|
|
1276
|
+
function En(e, t) {
|
|
1277
|
+
let n = o.enum(e);
|
|
1278
|
+
return (t.default === void 0 ? n.optional() : n.default(t.default)).meta(Q({
|
|
1221
1279
|
title: t.title,
|
|
1222
1280
|
description: t.description
|
|
1223
1281
|
}));
|
|
1224
1282
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
1283
|
+
function Dn(e, t) {
|
|
1284
|
+
return o.array(o.string()).default([]).meta(Q({
|
|
1227
1285
|
domain: e,
|
|
1228
1286
|
title: t?.title ?? "Entities",
|
|
1229
1287
|
description: t?.description,
|
|
1230
1288
|
deviceClass: t?.deviceClass
|
|
1231
1289
|
}));
|
|
1232
1290
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1291
|
+
function On(e, t) {
|
|
1292
|
+
return o.array(o.string()).default([]).meta(Q({
|
|
1235
1293
|
domain: e,
|
|
1236
1294
|
title: t?.title ?? "Entity",
|
|
1237
1295
|
description: t?.description,
|
|
@@ -1239,48 +1297,125 @@ function Yt(e, t) {
|
|
|
1239
1297
|
singleSelect: !0
|
|
1240
1298
|
}));
|
|
1241
1299
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return
|
|
1300
|
+
function kn(e) {
|
|
1301
|
+
return o.string().optional().meta({
|
|
1244
1302
|
formType: "area-picker",
|
|
1245
1303
|
title: e?.title ?? "Area"
|
|
1246
1304
|
});
|
|
1247
1305
|
}
|
|
1248
|
-
function
|
|
1249
|
-
let t =
|
|
1306
|
+
function An(e) {
|
|
1307
|
+
let t = o.string().meta({
|
|
1250
1308
|
formType: "icon-picker",
|
|
1251
1309
|
title: e?.title ?? "Icon"
|
|
1252
1310
|
});
|
|
1253
1311
|
return e?.default === void 0 ? t.optional() : t.default(e.default);
|
|
1254
1312
|
}
|
|
1255
|
-
function
|
|
1256
|
-
return
|
|
1313
|
+
function jn(e) {
|
|
1314
|
+
return o.array(o.string()).default([]).meta(Q({
|
|
1257
1315
|
title: e.title,
|
|
1258
1316
|
description: e.description
|
|
1259
1317
|
}));
|
|
1260
1318
|
}
|
|
1261
|
-
function
|
|
1262
|
-
let n =
|
|
1263
|
-
return n.default(
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1319
|
+
function Mn(e, t) {
|
|
1320
|
+
let n = o.object(e);
|
|
1321
|
+
return n.default(Ue(n)).meta({ title: t.title });
|
|
1322
|
+
}
|
|
1323
|
+
function Nn(e) {
|
|
1324
|
+
return e.def;
|
|
1325
|
+
}
|
|
1326
|
+
function $(e) {
|
|
1327
|
+
if (o.globalRegistry.get(e)?.formType === "list") return !0;
|
|
1328
|
+
let t = Nn(e);
|
|
1329
|
+
return t.shape ? Object.values(t.shape).some($) : t.options ? t.options.some($) : t.element ? $(t.element) : t.innerType ? $(t.innerType) : !1;
|
|
1330
|
+
}
|
|
1331
|
+
function Pn(e) {
|
|
1332
|
+
let t = e, n = Nn(t).innerType;
|
|
1333
|
+
for (; n;) t = n, n = Nn(t).innerType;
|
|
1334
|
+
return t;
|
|
1335
|
+
}
|
|
1336
|
+
function Fn(e) {
|
|
1337
|
+
let t = Nn(Pn(e));
|
|
1338
|
+
if (t.shape) return new Set(Object.keys(t.shape));
|
|
1339
|
+
if (t.options) {
|
|
1340
|
+
let e = [];
|
|
1341
|
+
for (let n of t.options) {
|
|
1342
|
+
let t = Fn(n);
|
|
1343
|
+
if (!t) return null;
|
|
1344
|
+
e.push(t);
|
|
1345
|
+
}
|
|
1346
|
+
let [n, ...r] = e;
|
|
1347
|
+
if (!n) return null;
|
|
1348
|
+
let i = /* @__PURE__ */ new Set();
|
|
1349
|
+
for (let e of n) r.every((t) => t.has(e)) && i.add(e);
|
|
1350
|
+
return i;
|
|
1351
|
+
}
|
|
1352
|
+
return null;
|
|
1353
|
+
}
|
|
1354
|
+
function In(e, t, n) {
|
|
1355
|
+
let r = { [t]: n };
|
|
1356
|
+
try {
|
|
1357
|
+
return e.parse(r);
|
|
1358
|
+
} catch {
|
|
1359
|
+
return r;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
function Ln(e, t) {
|
|
1363
|
+
if (!Number.isInteger(t.max) || t.max < 1) throw Error(`field.list: max must be a positive integer, got ${t.max}`);
|
|
1364
|
+
if (t.max > xn) throw Error(`field.list: max ${t.max} exceeds the ceiling of ${xn}`);
|
|
1365
|
+
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}`);
|
|
1366
|
+
if ($(e)) throw Error("field.list: a list item cannot contain another field.list (depth 1 only)");
|
|
1367
|
+
if (t.labelField !== void 0 && !Fn(e)?.has(t.labelField)) throw Error(`field.list: labelField "${t.labelField}" must name a field present in every item`);
|
|
1368
|
+
let n = o.array(e);
|
|
1369
|
+
return t.min !== void 0 && (n = n.min(t.min)), n = n.max(t.max), n.default([]).meta(Q({
|
|
1370
|
+
formType: "list",
|
|
1371
|
+
title: t.title,
|
|
1372
|
+
description: t.description,
|
|
1373
|
+
addLabel: t.addLabel,
|
|
1374
|
+
labelField: t.labelField
|
|
1375
|
+
}));
|
|
1376
|
+
}
|
|
1377
|
+
function Rn(e, t, n) {
|
|
1378
|
+
let r = Object.keys(t)[0];
|
|
1379
|
+
if (r === void 0) throw Error("field.variants: at least one variant is required");
|
|
1380
|
+
if (n.shared && e in n.shared) throw Error(`field.variants: shared fields cannot redefine the discriminator "${e}"`);
|
|
1381
|
+
for (let [n, r] of Object.entries(t)) if (e in r) throw Error(`field.variants: variant "${n}" cannot redefine the discriminator "${e}"`);
|
|
1382
|
+
if (n.labels) {
|
|
1383
|
+
for (let e of Object.keys(n.labels)) if (!(e in t)) throw Error(`field.variants: labels names unknown variant "${e}"`);
|
|
1384
|
+
}
|
|
1385
|
+
let i = Object.entries(t).map(([t, r]) => o.object({
|
|
1386
|
+
...n.shared ?? {},
|
|
1387
|
+
...r,
|
|
1388
|
+
[e]: o.literal(t)
|
|
1389
|
+
})), a = o.discriminatedUnion(e, i), s = i[0];
|
|
1390
|
+
return a.default(s ? In(s, e, r) : {}).meta(Q({
|
|
1391
|
+
formType: "variants",
|
|
1392
|
+
discriminator: e,
|
|
1393
|
+
title: n.title,
|
|
1394
|
+
description: n.description,
|
|
1395
|
+
labels: n.labels
|
|
1396
|
+
}));
|
|
1397
|
+
}
|
|
1398
|
+
var zn = {
|
|
1399
|
+
title: Sn,
|
|
1400
|
+
text: Cn,
|
|
1401
|
+
number: wn,
|
|
1402
|
+
toggle: Tn,
|
|
1403
|
+
choice: En,
|
|
1404
|
+
entities: Dn,
|
|
1405
|
+
entity: On,
|
|
1406
|
+
area: kn,
|
|
1407
|
+
icon: An,
|
|
1408
|
+
stringList: jn,
|
|
1409
|
+
group: Mn,
|
|
1410
|
+
list: Ln,
|
|
1411
|
+
variants: Rn
|
|
1277
1412
|
};
|
|
1278
|
-
function
|
|
1279
|
-
return
|
|
1413
|
+
function Bn(e) {
|
|
1414
|
+
return o.object(e);
|
|
1280
1415
|
}
|
|
1281
1416
|
//#endregion
|
|
1282
1417
|
//#region src/shared/spline.ts
|
|
1283
|
-
function
|
|
1418
|
+
function Vn(e) {
|
|
1284
1419
|
if (e.length < 2) return "";
|
|
1285
1420
|
let t = e[0], n = e[1];
|
|
1286
1421
|
if (!t || !n) return "";
|
|
@@ -1307,14 +1442,14 @@ function nn(e) {
|
|
|
1307
1442
|
}
|
|
1308
1443
|
//#endregion
|
|
1309
1444
|
//#region src/theme.ts
|
|
1310
|
-
function
|
|
1445
|
+
function Hn() {
|
|
1311
1446
|
return document.documentElement.classList.contains("dark");
|
|
1312
1447
|
}
|
|
1313
1448
|
//#endregion
|
|
1314
1449
|
//#region src/version.ts
|
|
1315
|
-
var
|
|
1450
|
+
var Un = {
|
|
1316
1451
|
name: "@glasshome/widget-sdk",
|
|
1317
|
-
version: "1.
|
|
1452
|
+
version: "1.9.1",
|
|
1318
1453
|
description: "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
1319
1454
|
keywords: [
|
|
1320
1455
|
"glasshome",
|
|
@@ -1365,13 +1500,14 @@ var an = {
|
|
|
1365
1500
|
"tailwind-sources.css"
|
|
1366
1501
|
],
|
|
1367
1502
|
scripts: {
|
|
1368
|
-
build: "vite build && tsc",
|
|
1503
|
+
build: "vite build && tsc && bun scripts/check-host-singleton.ts",
|
|
1369
1504
|
dev: "vite build --watch",
|
|
1370
1505
|
test: "bun test",
|
|
1371
1506
|
"typecheck:test": "tsc --noEmit -p tsconfig.test.json"
|
|
1372
1507
|
},
|
|
1373
1508
|
peerDependencies: {
|
|
1374
|
-
"@glasshome/sync-layer": "0.
|
|
1509
|
+
"@glasshome/sync-layer": "0.6.0",
|
|
1510
|
+
"@glasshome/ui": "1.3.0",
|
|
1375
1511
|
"solid-js": "^1.9.11"
|
|
1376
1512
|
},
|
|
1377
1513
|
dependencies: {
|
|
@@ -1403,4 +1539,4 @@ var an = {
|
|
|
1403
1539
|
engines: { node: ">=18" }
|
|
1404
1540
|
}.version;
|
|
1405
1541
|
//#endregion
|
|
1406
|
-
export {
|
|
1542
|
+
export { Se as Badge, Ce as Button, we as ColorSlider, Te as ColorWheel, Ee as Input, De as Label, Oe as ResponsiveDialog, ke as ResponsiveDialogContent, Ae as ResponsiveDialogDescription, je as ResponsiveDialogHeader, Me as ResponsiveDialogTitle, Un as SDK_VERSION, Ne as SchemaForm, Pe as Select, Fe as SelectContent, Ie as SelectItem, Le as SelectTrigger, Re as SelectValue, ze as Slider, Be as Switch, yn as ToneSchema, H as Widget, lt as WidgetContent, L as WidgetCtx, en as WidgetDialog, pt as WidgetIcon, r as WidgetManifestSchema, Ze as WidgetSizeCtx, st as WidgetSliderFill, ht as WidgetStatus, vt as WidgetTitle, At as WidgetValue, g as byDomain, yt as calculateLightGroup, bt as calculateSensorGroup, Tt as countActiveEntities, Bn as defineConfig, We as defineWidget, t as deprecations, zn as field, n as formatDeprecation, i as formatSchemaError, wt as getEntityAttribute, s as getForecasts, c as getStream, l as getWebRtcClientConfig, u as hassMediaUrl, rt as injectTokens, Hn as isDark, Ct as isEntityActive, Vn as monotoneCubicPath, Ve as parseColor, d as sendWebRtcCandidate, f as startWebRtcSession, p as state, vn as svgColors, m as trackEntityHistory, h as untrackEntityHistory, _ as useArea, v as useCamera, ee as useConnection, y as useCurrency, b as useEntities, te as useEntity, ne as useEntityHistory, re as useEntityStatistics, x as useForecast, ie as useHassConfig, tn as useIntersectionPause, ae as useLocale, nn as useReducedMotion, qe as useService, se as useStore, S as useTemperatureUnit, Xe as useToggle, Ye as useTurnOff, Je as useTurnOn, de as useUnitSystem, Ge as useWidgetContext, rn as useWidgetDialog, Qe as useWidgetDimensions, an as useWidgetEntityGroup, hn as useWidgetGestures, bn as widgetFields, a as z };
|