@glasshome/widget-sdk 0.3.7 → 0.4.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/README.md +18 -0
- package/dist/framework/backgrounds/WidgetSliderFill.d.ts +24 -13
- package/dist/framework/components/WidgetContent.d.ts +2 -1
- package/dist/framework/components/WidgetIcon.d.ts +22 -24
- package/dist/framework/components/WidgetStatus.d.ts +2 -1
- package/dist/framework/components/WidgetTitle.d.ts +2 -1
- package/dist/framework/components/WidgetValue.d.ts +2 -1
- package/dist/framework/core/Widget.d.ts +30 -31
- package/dist/framework/gestures/cursors.d.ts +2 -1
- package/dist/framework/hooks/index.d.ts +2 -9
- package/dist/framework/hooks/use-widget-context.d.ts +0 -5
- package/dist/framework/index.d.ts +4 -16
- package/dist/framework/theming/index.d.ts +4 -5
- package/dist/framework/theming/tokens.d.ts +24 -0
- package/dist/framework/theming/tone.d.ts +10 -0
- package/dist/framework/types.d.ts +0 -67
- package/dist/framework/utils/entity-state.d.ts +0 -62
- package/dist/framework/utils/index.d.ts +5 -5
- package/dist/index.d.ts +2 -4
- package/dist/index.js +820 -1479
- package/dist/theme.d.ts +0 -12
- package/package.json +1 -2
- package/dist/create-entity.d.ts +0 -22
- package/dist/framework/backgrounds/Glow.d.ts +0 -24
- package/dist/framework/components/WidgetEmptyState.d.ts +0 -34
- package/dist/framework/components/WidgetMetrics.d.ts +0 -47
- package/dist/framework/components/WidgetSubtitle.d.ts +0 -28
- package/dist/framework/design-system/index.d.ts +0 -8
- package/dist/framework/hooks/use-debug-data.d.ts +0 -46
- package/dist/framework/hooks/use-widget-config.d.ts +0 -48
- package/dist/framework/hooks/use-widget-entity.d.ts +0 -53
- package/dist/framework/hooks/use-widget-form.d.ts +0 -79
- package/dist/framework/hooks/use-widget-responsive.d.ts +0 -41
- package/dist/framework/layout/WidgetStack.d.ts +0 -28
- package/dist/framework/theming/adaptive-color.d.ts +0 -28
- package/dist/framework/theming/colors.d.ts +0 -59
package/dist/index.js
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
function Mt(t) {
|
|
14
|
-
return X.toJSONSchema(t, {
|
|
15
|
-
override: (e) => {
|
|
16
|
-
const r = X.globalRegistry.get(e.zodSchema);
|
|
17
|
-
return r && typeof r == "object" && Object.keys(r).length > 0 ? { ...e.jsonSchema, ...r } : e.jsonSchema;
|
|
1
|
+
import { z as L } from "zod";
|
|
2
|
+
import { WidgetManifestSchema as nn, formatSchemaError as rn } from "./schemas.js";
|
|
3
|
+
import { effect as T, className as N, style as Q, template as y, insert as p, setStyleProperty as A, memo as _, createComponent as M, addEventListener as q, use as ye, delegateEvents as $e } from "solid-js/web";
|
|
4
|
+
import { createElementSize as Se } from "@solid-primitives/resize-observer";
|
|
5
|
+
import { createContext as ke, useContext as fe, onMount as Ce, createSignal as U, createEffect as R, untrack as de, createMemo as V, splitProps as Me, on as ue, Show as j } from "solid-js";
|
|
6
|
+
import { clsx as De } from "clsx";
|
|
7
|
+
import { twMerge as ze } from "tailwind-merge";
|
|
8
|
+
function me(e) {
|
|
9
|
+
return L.toJSONSchema(e, {
|
|
10
|
+
override: (t) => {
|
|
11
|
+
const r = L.globalRegistry.get(t.zodSchema);
|
|
12
|
+
return r && typeof r == "object" && Object.keys(r).length > 0 ? { ...t.jsonSchema, ...r } : t.jsonSchema;
|
|
18
13
|
}
|
|
19
14
|
});
|
|
20
15
|
}
|
|
21
|
-
function
|
|
16
|
+
function _e(e) {
|
|
22
17
|
try {
|
|
23
|
-
return
|
|
18
|
+
return e.parse({});
|
|
24
19
|
} catch {
|
|
25
20
|
return {};
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
23
|
+
function Ut(e) {
|
|
24
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = me(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = _e(e.configSchema))), e;
|
|
30
25
|
}
|
|
31
|
-
const
|
|
26
|
+
const F = {
|
|
32
27
|
/** Background layer (gradients, images, glows) */
|
|
33
28
|
BACKGROUND: 0,
|
|
34
29
|
/** Main content layer (icon, title, text) */
|
|
@@ -37,20 +32,126 @@ const U = {
|
|
|
37
32
|
OVERLAY: 20,
|
|
38
33
|
/** Action layer (buttons, edit controls) */
|
|
39
34
|
ACTIONS: 30
|
|
40
|
-
};
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function I() {
|
|
45
|
-
const t = Ct(ht);
|
|
46
|
-
if (!t)
|
|
35
|
+
}, se = ke();
|
|
36
|
+
function Y() {
|
|
37
|
+
const e = fe(se);
|
|
38
|
+
if (!e)
|
|
47
39
|
throw new Error("useWidgetContext must be used within a Widget component");
|
|
48
|
-
return
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
const Te = `/* packages/public/widget-sdk/src/framework/theming/tokens.css
|
|
43
|
+
*
|
|
44
|
+
* Phase 25: Channel Core + Tone Tokens
|
|
45
|
+
* Authoritative SDK CSS contract. Injected once on first Widget mount
|
|
46
|
+
* via framework/theming/tokens.ts. Final palette tuned in Phase 29.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/* Tone palette (VIS-C01) -- Phase 29 retune (VIS-P05).
|
|
50
|
+
Hand-tuned against apps/dash/src/routes/dev.palette-tune.tsx so each
|
|
51
|
+
tone reads vibrant at the 20% composition stop on both #fafaf9 (light)
|
|
52
|
+
and #0c0a09 (dark) without overpowering the calm-confidence aesthetic. */
|
|
53
|
+
:root {
|
|
54
|
+
--tone-success: oklch(0.70 0.18 145); /* deeper L vs placeholder lifts chroma at 20% on light bg without going neon */
|
|
55
|
+
--tone-warning: oklch(0.80 0.17 75); /* keeps amber readable at 22%/11% gradient stops without yellowing the shell */
|
|
56
|
+
--tone-danger: oklch(0.64 0.22 27); /* anchors red just below midline so 20% alpha stays unambiguous on light bg */
|
|
57
|
+
--tone-info: oklch(0.66 0.20 245); /* +0.01 chroma so info-blue keeps presence in 30%/40% slider fill against light */
|
|
58
|
+
--tone-neutral: oklch(0.65 0.02 250); /* pinned literal -- matches @property --widget-color initial-value (tokens.test) */
|
|
59
|
+
--tone-accent: oklch(0.74 0.18 60); /* +0.02 chroma for warm-amber accent so glow reads at 50% on light icon bg */
|
|
60
|
+
|
|
61
|
+
/* Envelope vars (VIS-C03), light mode -- retained from Phase 25 baseline */
|
|
62
|
+
--widget-grad-strength: 1;
|
|
63
|
+
--widget-glow-default: 0.4;
|
|
64
|
+
--widget-border-highlight: oklch(0.98 0 0 / 0.4);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dark {
|
|
68
|
+
--tone-success: oklch(0.74 0.18 145); /* +0.04 L lifts chroma at 20% alpha against #0c0a09 so green isn't muddy */
|
|
69
|
+
--tone-warning: oklch(0.82 0.17 75); /* +0.02 L only -- amber already bright on dark bg, more would wash the gradient */
|
|
70
|
+
--tone-danger: oklch(0.68 0.22 27); /* +0.04 L preserves red identity without dipping into maroon at low alpha */
|
|
71
|
+
--tone-info: oklch(0.70 0.20 245); /* +0.04 L plus chroma parity with light keeps info-blue vibrant at 30%/40% on dark */
|
|
72
|
+
--tone-neutral: oklch(0.69 0.02 250); /* +0.04 L vs light, chroma parity -- defaults read calm on dark widget surfaces */
|
|
73
|
+
--tone-accent: oklch(0.78 0.18 60); /* +0.04 L matches accent glow envelope so 50% icon glow stays warm on dark */
|
|
74
|
+
|
|
75
|
+
--widget-grad-strength: 1.1;
|
|
76
|
+
--widget-glow-default: 0.5;
|
|
77
|
+
--widget-border-highlight: oklch(1 0 0 / 0.08);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* @property declaration for animatable channel base (VIS-C04, D-11)
|
|
81
|
+
initial-value must be a literal <color>; cannot reference var(). */
|
|
82
|
+
@property --widget-color {
|
|
83
|
+
syntax: "<color>";
|
|
84
|
+
inherits: true;
|
|
85
|
+
initial-value: oklch(0.65 0.02 250);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Channel defaults on the Widget root (VIS-C02, D-08) */
|
|
89
|
+
.glasshome-widget {
|
|
90
|
+
--widget-color: var(--tone-neutral);
|
|
91
|
+
--widget-glow-strength: var(--widget-glow-default);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* === Phase 26 additions === */
|
|
95
|
+
|
|
96
|
+
/* VIS-P01 shell gradient + VIS-P02 inset highlight (D-02, D-03, D-06) */
|
|
97
|
+
.glasshome-widget {
|
|
98
|
+
background: var(--widget-gradient,
|
|
99
|
+
linear-gradient(135deg,
|
|
100
|
+
color-mix(in oklch, var(--widget-color) calc(22% * var(--widget-grad-strength)), transparent),
|
|
101
|
+
color-mix(in oklch, var(--widget-color-to, var(--widget-color)) calc(11% * var(--widget-grad-strength)), transparent)
|
|
102
|
+
)
|
|
103
|
+
);
|
|
104
|
+
box-shadow: inset 0 1px 0 var(--widget-border-highlight);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* VIS-P03 icon channel rendering (D-16) */
|
|
108
|
+
.glasshome-widget-icon {
|
|
109
|
+
background: var(--widget-icon-color, var(--widget-color));
|
|
110
|
+
box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)
|
|
111
|
+
color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);
|
|
112
|
+
/* Glyph keeps icon-bg hue but flips to L extreme via sign() step + damps chroma.
|
|
113
|
+
bg L > 0.5 -> glyph L=0.09 (dark); bg L < 0.5 -> glyph L=0.95 (light).
|
|
114
|
+
Chroma 0.2x of bg keeps subtle hue tint without competing with bg saturation.
|
|
115
|
+
Requires CSS relative color (Chromium 119+, Safari 16.4+, Firefox 128+) and
|
|
116
|
+
sign() (Chromium 111+, Safari 18.2+, Firefox 118+). */
|
|
117
|
+
color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* D-13 loading overlay tint */
|
|
121
|
+
.glasshome-widget-loading {
|
|
122
|
+
background: color-mix(in oklch, var(--widget-color) 20%, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* === Phase 27 additions === */
|
|
126
|
+
|
|
127
|
+
/* VIS-P04 slider fill channel rendering (D-05, D-06, D-08).
|
|
128
|
+
Mirrors .glasshome-widget-icon precedent: --widget-icon-color override
|
|
129
|
+
with --widget-color fallback. Glow rendered via box-shadow on the same
|
|
130
|
+
fill element (D-07). 30% bg opacity preserves prior 0.3 default; 40px
|
|
131
|
+
blur approximates prior blur-2xl on the deleted glow div; glow radius
|
|
132
|
+
modulated by --widget-glow-strength to track the per-mode envelope. */
|
|
133
|
+
.glasshome-widget-slider-fill {
|
|
134
|
+
background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);
|
|
135
|
+
box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)
|
|
136
|
+
color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
let ie = !1;
|
|
140
|
+
function Ee(e) {
|
|
141
|
+
if (ie) return;
|
|
142
|
+
const t = e ?? (typeof document > "u" ? void 0 : document);
|
|
143
|
+
if (!t) return;
|
|
144
|
+
if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
|
|
145
|
+
ie = !0;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const r = t.createElement("style");
|
|
149
|
+
r.setAttribute("data-glasshome-tokens", ""), r.textContent = Te, t.head.appendChild(r), ie = !0;
|
|
49
150
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
151
|
+
function E(...e) {
|
|
152
|
+
return ze(De(e));
|
|
52
153
|
}
|
|
53
|
-
const
|
|
154
|
+
const Oe = {
|
|
54
155
|
id: "classic-glass",
|
|
55
156
|
name: "Classic Glass",
|
|
56
157
|
description: "Default glassmorphism design with blur background and gradient",
|
|
@@ -78,7 +179,7 @@ const Ft = {
|
|
|
78
179
|
hoverScale: 1.02,
|
|
79
180
|
activeScale: 0.98
|
|
80
181
|
}
|
|
81
|
-
},
|
|
182
|
+
}, Ne = {
|
|
82
183
|
id: "minimal",
|
|
83
184
|
name: "Minimal",
|
|
84
185
|
description: "Clean, minimal design with no background effects",
|
|
@@ -107,7 +208,7 @@ const Ft = {
|
|
|
107
208
|
active: !1,
|
|
108
209
|
focus: !0
|
|
109
210
|
}
|
|
110
|
-
},
|
|
211
|
+
}, Ve = {
|
|
111
212
|
id: "compact-horizontal",
|
|
112
213
|
name: "Compact Horizontal",
|
|
113
214
|
description: "Horizontal layout for compact widgets",
|
|
@@ -135,160 +236,50 @@ const Ft = {
|
|
|
135
236
|
hoverScale: 1.02,
|
|
136
237
|
activeScale: 0.98
|
|
137
238
|
}
|
|
138
|
-
},
|
|
139
|
-
"classic-glass":
|
|
140
|
-
minimal:
|
|
141
|
-
"compact-horizontal":
|
|
239
|
+
}, Pe = {
|
|
240
|
+
"classic-glass": Oe,
|
|
241
|
+
minimal: Ne,
|
|
242
|
+
"compact-horizontal": Ve
|
|
142
243
|
};
|
|
143
|
-
function
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return e;
|
|
155
|
-
const r = { ...t };
|
|
156
|
-
for (const i in e) {
|
|
157
|
-
const n = e[i], a = t[i];
|
|
158
|
-
if (n !== void 0) {
|
|
159
|
-
if (Array.isArray(n)) {
|
|
160
|
-
r[i] = n;
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
164
|
-
typeof a == "object" && a !== null ? r[i] = zt(a, n) : r[i] = n;
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
r[i] = n;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return r;
|
|
171
|
-
}
|
|
172
|
-
function qt(t, e) {
|
|
173
|
-
if (!(!t && !e))
|
|
174
|
-
return t ? e ? {
|
|
175
|
-
container: { ...t.container, ...e.container },
|
|
176
|
-
class: e.class ?? t.class,
|
|
177
|
-
cssVars: { ...t.cssVars, ...e.cssVars }
|
|
178
|
-
} : t : e;
|
|
179
|
-
}
|
|
180
|
-
function Xt(t, e) {
|
|
181
|
-
return e ?? t;
|
|
182
|
-
}
|
|
183
|
-
function Jt(t, e) {
|
|
184
|
-
if (!(!t && !e))
|
|
185
|
-
return t ? e ? {
|
|
186
|
-
visible: { ...t.visible, ...e.visible },
|
|
187
|
-
styles: zt(t.styles ?? {}, e.styles ?? {}),
|
|
188
|
-
classNames: { ...t.classNames, ...e.classNames }
|
|
189
|
-
} : t : e;
|
|
190
|
-
}
|
|
191
|
-
function Zt(t, e) {
|
|
192
|
-
if (!(!t && !e))
|
|
193
|
-
return t ? e ? {
|
|
194
|
-
background: e.background ?? t.background,
|
|
195
|
-
overlay: e.overlay ?? t.overlay,
|
|
196
|
-
decorations: e.decorations ?? t.decorations
|
|
197
|
-
} : t : e;
|
|
198
|
-
}
|
|
199
|
-
function Qt(t, e) {
|
|
200
|
-
if (!(!t && !e))
|
|
201
|
-
return t ? e ? {
|
|
202
|
-
hover: e.hover ?? t.hover,
|
|
203
|
-
active: e.active ?? t.active,
|
|
204
|
-
focus: e.focus ?? t.focus,
|
|
205
|
-
hoverScale: e.hoverScale ?? t.hoverScale,
|
|
206
|
-
activeScale: e.activeScale ?? t.activeScale
|
|
207
|
-
} : t : e;
|
|
208
|
-
}
|
|
209
|
-
function xt(t, e) {
|
|
210
|
-
return {
|
|
211
|
-
id: e.id ?? t.id,
|
|
212
|
-
name: e.name ?? t.name,
|
|
213
|
-
description: e.description ?? t.description,
|
|
214
|
-
styles: qt(t.styles, e.styles),
|
|
215
|
-
layout: Xt(t.layout, e.layout),
|
|
216
|
-
elements: Jt(t.elements, e.elements),
|
|
217
|
-
plugins: Zt(t.plugins, e.plugins),
|
|
218
|
-
interactions: Qt(t.interactions, e.interactions),
|
|
219
|
-
extends: e.extends ?? t.extends
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
function In(t, e) {
|
|
223
|
-
return {
|
|
224
|
-
...e,
|
|
225
|
-
extends: t
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function Hn(...t) {
|
|
229
|
-
if (t.length === 0)
|
|
230
|
-
throw new Error("composeVariants requires at least one variant");
|
|
231
|
-
return t.length === 1 ? t[0] : t.reduce((e, r) => xt(e, r));
|
|
232
|
-
}
|
|
233
|
-
function Gn(t, e) {
|
|
234
|
-
return xt(t, { layout: e });
|
|
235
|
-
}
|
|
236
|
-
function Pn(t, e) {
|
|
237
|
-
return xt(t, {
|
|
238
|
-
styles: { cssVars: e }
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
function Ln(t = "column", e = "start", r = "start", i) {
|
|
242
|
-
return {
|
|
243
|
-
type: "flex",
|
|
244
|
-
direction: t,
|
|
245
|
-
align: e,
|
|
246
|
-
justify: r,
|
|
247
|
-
...i
|
|
244
|
+
function We(e) {
|
|
245
|
+
return Pe[e];
|
|
246
|
+
}
|
|
247
|
+
var He = /* @__PURE__ */ y("<div>");
|
|
248
|
+
function Le(e) {
|
|
249
|
+
const t = Y(), r = () => t.orientation() === "vertical" ? `inset(${100 - e.value}% 0 0 0)` : `inset(0 ${100 - e.value}% 0 0)`, o = () => {
|
|
250
|
+
const n = {
|
|
251
|
+
"clip-path": r(),
|
|
252
|
+
"z-index": F.BACKGROUND
|
|
253
|
+
};
|
|
254
|
+
return e.color && (n["--widget-icon-color"] = e.color), n;
|
|
248
255
|
};
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
var n = ee();
|
|
255
|
-
return z((a) => {
|
|
256
|
-
var o = i(), s = U.BACKGROUND;
|
|
257
|
-
return o !== a.e && M(n, "background", a.e = o), s !== a.t && M(n, "z-index", a.t = s), a;
|
|
256
|
+
return (() => {
|
|
257
|
+
var n = He();
|
|
258
|
+
return T((i) => {
|
|
259
|
+
var a = E("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), c = o();
|
|
260
|
+
return a !== i.e && N(n, i.e = a), i.t = Q(n, c, i.t), i;
|
|
258
261
|
}, {
|
|
259
262
|
e: void 0,
|
|
260
263
|
t: void 0
|
|
261
264
|
}), n;
|
|
262
|
-
})()
|
|
263
|
-
var n = te();
|
|
264
|
-
return z((a) => {
|
|
265
|
-
var o = k("pointer-events-none absolute inset-0", t.isDragging ? "duration-0" : "transition-all duration-300 ease-out", t.class), s = i(), l = r(), d = t.opacity ?? 0.3, c = U.BACKGROUND;
|
|
266
|
-
return o !== a.e && S(n, a.e = o), s !== a.t && M(n, "background", a.t = s), l !== a.a && M(n, "clip-path", a.a = l), d !== a.o && M(n, "opacity", a.o = d), c !== a.i && M(n, "z-index", a.i = c), a;
|
|
267
|
-
}, {
|
|
268
|
-
e: void 0,
|
|
269
|
-
t: void 0,
|
|
270
|
-
a: void 0,
|
|
271
|
-
o: void 0,
|
|
272
|
-
i: void 0
|
|
273
|
-
}), n;
|
|
274
|
-
})()];
|
|
265
|
+
})();
|
|
275
266
|
}
|
|
276
|
-
const
|
|
267
|
+
const X = {
|
|
277
268
|
S1: { xs: 4, sm: 4, md: 6, lg: 6, xl: 8 },
|
|
278
269
|
S2: { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 },
|
|
279
270
|
S3: { xs: 8, sm: 10, md: 12, lg: 14, xl: 16 },
|
|
280
271
|
S4: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20 }
|
|
281
|
-
},
|
|
272
|
+
}, H = {
|
|
282
273
|
/** Extra small spacing (4-8px) */
|
|
283
|
-
S1: (
|
|
274
|
+
S1: (e) => `${X.S1[e]}px`,
|
|
284
275
|
/** Small spacing (6-14px) - default for most layouts */
|
|
285
|
-
S2: (
|
|
276
|
+
S2: (e) => `${X.S2[e]}px`,
|
|
286
277
|
/** Medium spacing (8-16px) */
|
|
287
|
-
S3: (
|
|
278
|
+
S3: (e) => `${X.S3[e]}px`,
|
|
288
279
|
/** Large spacing (12-20px) */
|
|
289
|
-
S4: (
|
|
280
|
+
S4: (e) => `${X.S4[e]}px`,
|
|
290
281
|
/** Icon container size in pixels */
|
|
291
|
-
icon: (
|
|
282
|
+
icon: (e) => ({
|
|
292
283
|
xs: 32,
|
|
293
284
|
// 1x1, 1x2 widgets
|
|
294
285
|
sm: 40,
|
|
@@ -299,9 +290,9 @@ const rt = {
|
|
|
299
290
|
// 2x6, 3x6, 4x2 widgets
|
|
300
291
|
xl: 56
|
|
301
292
|
// 4x4 widgets
|
|
302
|
-
})[
|
|
293
|
+
})[e],
|
|
303
294
|
/** Icon stroke size for lucide icons */
|
|
304
|
-
iconSize: (
|
|
295
|
+
iconSize: (e) => ({
|
|
305
296
|
xs: 18,
|
|
306
297
|
// Smaller stroke for tiny widgets
|
|
307
298
|
sm: 20,
|
|
@@ -312,9 +303,9 @@ const rt = {
|
|
|
312
303
|
// Large widgets
|
|
313
304
|
xl: 28
|
|
314
305
|
// Extra large widgets
|
|
315
|
-
})[
|
|
306
|
+
})[e],
|
|
316
307
|
/** Spacing between icon and title */
|
|
317
|
-
iconToTitle: (
|
|
308
|
+
iconToTitle: (e) => ({
|
|
318
309
|
xs: "8px",
|
|
319
310
|
// Tight spacing for small widgets
|
|
320
311
|
sm: "10px",
|
|
@@ -325,9 +316,9 @@ const rt = {
|
|
|
325
316
|
// More breathing room
|
|
326
317
|
xl: "16px"
|
|
327
318
|
// Maximum spacing (@[400px]:mt-4 = 16px)
|
|
328
|
-
})[
|
|
319
|
+
})[e],
|
|
329
320
|
/** Container padding */
|
|
330
|
-
container: (
|
|
321
|
+
container: (e) => ({
|
|
331
322
|
xs: "8px",
|
|
332
323
|
// Minimal padding for tiny widgets
|
|
333
324
|
sm: "16px",
|
|
@@ -336,8 +327,8 @@ const rt = {
|
|
|
336
327
|
lg: "20px",
|
|
337
328
|
// More padding for larger widgets
|
|
338
329
|
xl: "20px"
|
|
339
|
-
})[
|
|
340
|
-
},
|
|
330
|
+
})[e]
|
|
331
|
+
}, Ae = {
|
|
341
332
|
4: "gap-1",
|
|
342
333
|
6: "gap-1.5",
|
|
343
334
|
8: "gap-2",
|
|
@@ -348,25 +339,25 @@ const rt = {
|
|
|
348
339
|
18: "gap-[18px]",
|
|
349
340
|
20: "gap-5"
|
|
350
341
|
};
|
|
351
|
-
function
|
|
352
|
-
const r =
|
|
353
|
-
return
|
|
342
|
+
function Ie(e, t) {
|
|
343
|
+
const r = X[e][t];
|
|
344
|
+
return Ae[r] || `gap-[${r}px]`;
|
|
354
345
|
}
|
|
355
|
-
var
|
|
356
|
-
function
|
|
357
|
-
const
|
|
346
|
+
var Re = /* @__PURE__ */ y("<div>");
|
|
347
|
+
function Ge(e) {
|
|
348
|
+
const t = Y();
|
|
358
349
|
return (() => {
|
|
359
|
-
var r =
|
|
360
|
-
return
|
|
361
|
-
var n =
|
|
350
|
+
var r = Re();
|
|
351
|
+
return p(r, () => e.children), T((o) => {
|
|
352
|
+
var n = E(
|
|
362
353
|
"relative flex h-full w-full overflow-hidden",
|
|
363
354
|
// Ensure controls (ml-auto divs) are above other content
|
|
364
355
|
"[&_div.ml-auto]:relative [&_div.ml-auto]:z-30",
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
),
|
|
369
|
-
return n !==
|
|
356
|
+
t.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
|
|
357
|
+
Ie("S3", t.size()),
|
|
358
|
+
e.class
|
|
359
|
+
), i = H.container(t.size()), a = F.CONTENT;
|
|
360
|
+
return n !== o.e && N(r, o.e = n), i !== o.t && A(r, "padding", o.t = i), a !== o.a && A(r, "z-index", o.a = a), o;
|
|
370
361
|
}, {
|
|
371
362
|
e: void 0,
|
|
372
363
|
t: void 0,
|
|
@@ -374,9 +365,51 @@ function oe(t) {
|
|
|
374
365
|
}), r;
|
|
375
366
|
})();
|
|
376
367
|
}
|
|
377
|
-
|
|
368
|
+
var Ue = /* @__PURE__ */ y('<div><div class="flex items-center justify-center">'), ge = /* @__PURE__ */ y('<div class="glasshome-widget-icon absolute">');
|
|
369
|
+
function Be(e) {
|
|
370
|
+
const t = Y(), r = () => {
|
|
371
|
+
const n = {
|
|
372
|
+
width: `${H.icon(t.size())}px`,
|
|
373
|
+
height: `${H.icon(t.size())}px`,
|
|
374
|
+
"border-radius": "var(--radius-sm, 12px)"
|
|
375
|
+
};
|
|
376
|
+
return e.color && (n["--widget-icon-color"] = e.color), n;
|
|
377
|
+
}, o = (n, i, a) => ({
|
|
378
|
+
width: `${H.icon(t.size()) * 1.02}px`,
|
|
379
|
+
height: `${H.icon(t.size()) * 1.02}px`,
|
|
380
|
+
"border-radius": "var(--radius-sm, 12px)",
|
|
381
|
+
bottom: `${-H.icon(t.size()) * n}px`,
|
|
382
|
+
right: `${-H.icon(t.size()) * (n * 0.71)}px`,
|
|
383
|
+
"z-index": i,
|
|
384
|
+
opacity: a
|
|
385
|
+
});
|
|
386
|
+
return (() => {
|
|
387
|
+
var n = Ue(), i = n.firstChild;
|
|
388
|
+
return p(n, (() => {
|
|
389
|
+
var a = _(() => (e.entityCount ?? 1) >= 2);
|
|
390
|
+
return () => a() && (() => {
|
|
391
|
+
var c = ge();
|
|
392
|
+
return T((x) => Q(c, o(0.14, -2, 0.45), x)), c;
|
|
393
|
+
})();
|
|
394
|
+
})(), i), p(n, (() => {
|
|
395
|
+
var a = _(() => (e.entityCount ?? 1) >= 3);
|
|
396
|
+
return () => a() && (() => {
|
|
397
|
+
var c = ge();
|
|
398
|
+
return T((x) => Q(c, o(0.28, -3, 0.2), x)), c;
|
|
399
|
+
})();
|
|
400
|
+
})(), i), p(i, () => e.icon), T((a) => {
|
|
401
|
+
var c = E("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center transition-all", "pointer-events-none", e.dimmed && "opacity-50", e.class), x = r(), w = `${H.iconSize(t.size())}px`;
|
|
402
|
+
return c !== a.e && N(n, a.e = c), a.t = Q(n, x, a.t), w !== a.a && A(i, "font-size", a.a = w), a;
|
|
403
|
+
}, {
|
|
404
|
+
e: void 0,
|
|
405
|
+
t: void 0,
|
|
406
|
+
a: void 0
|
|
407
|
+
}), n;
|
|
408
|
+
})();
|
|
409
|
+
}
|
|
410
|
+
const Z = {
|
|
378
411
|
/** Container base text sizing */
|
|
379
|
-
container: (
|
|
412
|
+
container: (e) => ({
|
|
380
413
|
xs: "text-xs",
|
|
381
414
|
// Smallest widgets
|
|
382
415
|
sm: "text-sm",
|
|
@@ -387,9 +420,9 @@ const F = {
|
|
|
387
420
|
// Large widgets
|
|
388
421
|
xl: "text-lg"
|
|
389
422
|
// Extra large widgets
|
|
390
|
-
})[
|
|
423
|
+
})[e],
|
|
391
424
|
/** Title text sizing (main heading) */
|
|
392
|
-
title: (
|
|
425
|
+
title: (e) => ({
|
|
393
426
|
xs: "text-xs",
|
|
394
427
|
// 12px - Very compact
|
|
395
428
|
sm: "text-xs",
|
|
@@ -400,9 +433,9 @@ const F = {
|
|
|
400
433
|
// 14px - Maintain size
|
|
401
434
|
xl: "text-sm"
|
|
402
435
|
// 14px - Don't go too large for secondary text
|
|
403
|
-
})[
|
|
436
|
+
})[e],
|
|
404
437
|
/** Subtitle/secondary text sizing */
|
|
405
|
-
subtitle: (
|
|
438
|
+
subtitle: (e) => ({
|
|
406
439
|
xs: "text-xs",
|
|
407
440
|
// 12px - Very compact
|
|
408
441
|
sm: "text-sm",
|
|
@@ -413,9 +446,9 @@ const F = {
|
|
|
413
446
|
// 14px - Maintain size
|
|
414
447
|
xl: "text-base"
|
|
415
448
|
// 14px - Don't go too large for secondary text
|
|
416
|
-
})[
|
|
449
|
+
})[e],
|
|
417
450
|
/** Value display text sizing (large numbers) */
|
|
418
|
-
value: (
|
|
451
|
+
value: (e) => ({
|
|
419
452
|
xs: "text-lg",
|
|
420
453
|
// 18px - Still readable on small widgets
|
|
421
454
|
sm: "text-xl",
|
|
@@ -426,9 +459,9 @@ const F = {
|
|
|
426
459
|
// 30px - Very prominent
|
|
427
460
|
xl: "text-4xl"
|
|
428
461
|
// 36px - Maximum impact
|
|
429
|
-
})[
|
|
462
|
+
})[e],
|
|
430
463
|
/** Badge text sizing (entity count badges) */
|
|
431
|
-
badge: (
|
|
464
|
+
badge: (e) => ({
|
|
432
465
|
xs: "text-xs",
|
|
433
466
|
// 12px - Compact badge
|
|
434
467
|
sm: "text-xs",
|
|
@@ -439,9 +472,9 @@ const F = {
|
|
|
439
472
|
// 14px - Slightly larger for readability
|
|
440
473
|
xl: "text-sm"
|
|
441
474
|
// 14px - Maximum badge size
|
|
442
|
-
})[
|
|
475
|
+
})[e],
|
|
443
476
|
/** Metric label text sizing */
|
|
444
|
-
metricLabel: (
|
|
477
|
+
metricLabel: (e) => ({
|
|
445
478
|
xs: "text-xs",
|
|
446
479
|
// 12px - Compact labels
|
|
447
480
|
sm: "text-xs",
|
|
@@ -452,9 +485,9 @@ const F = {
|
|
|
452
485
|
// 14px - More readable on large widgets
|
|
453
486
|
xl: "text-sm"
|
|
454
487
|
// 14px
|
|
455
|
-
})[
|
|
488
|
+
})[e],
|
|
456
489
|
/** Metric value text sizing */
|
|
457
|
-
metricValue: (
|
|
490
|
+
metricValue: (e) => ({
|
|
458
491
|
xs: "text-sm",
|
|
459
492
|
// 14px - Readable metric values
|
|
460
493
|
sm: "text-sm",
|
|
@@ -465,17 +498,17 @@ const F = {
|
|
|
465
498
|
// 16px - Slightly larger
|
|
466
499
|
xl: "text-base"
|
|
467
500
|
// 16px
|
|
468
|
-
})[
|
|
501
|
+
})[e],
|
|
469
502
|
/** Status text (same as subtitle but semantic) */
|
|
470
|
-
status: (
|
|
503
|
+
status: (e) => ({
|
|
471
504
|
xs: "text-md",
|
|
472
505
|
sm: "text-xl",
|
|
473
506
|
md: "text-2xl",
|
|
474
507
|
lg: "text-3xl",
|
|
475
508
|
xl: "text-3xl"
|
|
476
|
-
})[
|
|
509
|
+
})[e],
|
|
477
510
|
/** Empty state message text */
|
|
478
|
-
emptyState: (
|
|
511
|
+
emptyState: (e) => ({
|
|
479
512
|
xs: "text-xs",
|
|
480
513
|
// 12px
|
|
481
514
|
sm: "text-sm",
|
|
@@ -486,265 +519,39 @@ const F = {
|
|
|
486
519
|
// 16px
|
|
487
520
|
xl: "text-base"
|
|
488
521
|
// 16px
|
|
489
|
-
})[
|
|
522
|
+
})[e]
|
|
490
523
|
};
|
|
491
|
-
var
|
|
492
|
-
function
|
|
493
|
-
const
|
|
494
|
-
return (() => {
|
|
495
|
-
var i = se(), n = i.firstChild;
|
|
496
|
-
return b(i, (() => {
|
|
497
|
-
var a = _(() => !!t.icon);
|
|
498
|
-
return () => a() && (() => {
|
|
499
|
-
var o = le();
|
|
500
|
-
return b(o, () => t.icon), z((s) => {
|
|
501
|
-
var l = k("flex items-center justify-center text-foreground/30", r() ? "shrink-0" : ""), d = `${W.icon(e.size())}px`, c = `${W.icon(e.size())}px`;
|
|
502
|
-
return l !== s.e && S(o, s.e = l), d !== s.t && M(o, "width", s.t = d), c !== s.a && M(o, "height", s.a = c), s;
|
|
503
|
-
}, {
|
|
504
|
-
e: void 0,
|
|
505
|
-
t: void 0,
|
|
506
|
-
a: void 0
|
|
507
|
-
}), o;
|
|
508
|
-
})();
|
|
509
|
-
})(), n), b(n, (() => {
|
|
510
|
-
var a = _(() => !!(t.title ?? "No data"));
|
|
511
|
-
return () => a() && (() => {
|
|
512
|
-
var o = ce();
|
|
513
|
-
return b(o, () => t.title ?? "No data"), z((s) => {
|
|
514
|
-
var l = k("font-semibold text-foreground/60", F.subtitle(e.size())), d = r() ? "100%" : "80%";
|
|
515
|
-
return l !== s.e && S(o, s.e = l), d !== s.t && M(o, "max-width", s.t = d), s;
|
|
516
|
-
}, {
|
|
517
|
-
e: void 0,
|
|
518
|
-
t: void 0
|
|
519
|
-
}), o;
|
|
520
|
-
})();
|
|
521
|
-
})(), null), b(n, (() => {
|
|
522
|
-
var a = _(() => !!t.message);
|
|
523
|
-
return () => a() && (() => {
|
|
524
|
-
var o = ue();
|
|
525
|
-
return b(o, () => t.message), z((s) => {
|
|
526
|
-
var l = k("text-foreground/50", F.emptyState(e.size())), d = r() ? "100%" : "85%";
|
|
527
|
-
return l !== s.e && S(o, s.e = l), d !== s.t && M(o, "max-width", s.t = d), s;
|
|
528
|
-
}, {
|
|
529
|
-
e: void 0,
|
|
530
|
-
t: void 0
|
|
531
|
-
}), o;
|
|
532
|
-
})();
|
|
533
|
-
})(), null), b(n, (() => {
|
|
534
|
-
var a = _(() => !!t.action);
|
|
535
|
-
return () => a() && (() => {
|
|
536
|
-
var o = de();
|
|
537
|
-
return b(o, () => t.action), o;
|
|
538
|
-
})();
|
|
539
|
-
})(), null), z((a) => {
|
|
540
|
-
var o = k("flex h-full w-full", r() ? "flex-row items-center justify-start" : "flex-col items-center justify-center text-center", t.class), s = W.S2(e.size()), l = W.container(e.size()), d = k("flex flex-col", r() ? "items-start text-left" : "items-center text-center"), c = W.S1(e.size());
|
|
541
|
-
return o !== a.e && S(i, a.e = o), s !== a.t && M(i, "gap", a.t = s), l !== a.a && M(i, "padding", a.a = l), d !== a.o && S(n, a.o = d), c !== a.i && M(n, "gap", a.i = c), a;
|
|
542
|
-
}, {
|
|
543
|
-
e: void 0,
|
|
544
|
-
t: void 0,
|
|
545
|
-
a: void 0,
|
|
546
|
-
o: void 0,
|
|
547
|
-
i: void 0
|
|
548
|
-
}), i;
|
|
549
|
-
})();
|
|
550
|
-
}
|
|
551
|
-
function me(t) {
|
|
552
|
-
const e = t.match(/hsl\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*\)/);
|
|
553
|
-
return e ? { h: Number(e[1]), s: Number(e[2]), l: Number(e[3]) } : null;
|
|
554
|
-
}
|
|
555
|
-
function fe(t) {
|
|
556
|
-
const e = t.match(/rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)/);
|
|
557
|
-
return e ? Dt(Number(e[1]), Number(e[2]), Number(e[3])) : null;
|
|
558
|
-
}
|
|
559
|
-
function he(t) {
|
|
560
|
-
const e = t.match(/^#([0-9a-f]{3,8})$/i);
|
|
561
|
-
if (!e) return null;
|
|
562
|
-
let r = e[1];
|
|
563
|
-
r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]);
|
|
564
|
-
const i = Number.parseInt(r.slice(0, 2), 16), n = Number.parseInt(r.slice(2, 4), 16), a = Number.parseInt(r.slice(4, 6), 16);
|
|
565
|
-
return Dt(i, n, a);
|
|
566
|
-
}
|
|
567
|
-
function Dt(t, e, r) {
|
|
568
|
-
t /= 255, e /= 255, r /= 255;
|
|
569
|
-
const i = Math.max(t, e, r), n = Math.min(t, e, r), a = (i + n) / 2;
|
|
570
|
-
if (i === n) return { h: 0, s: 0, l: a * 100 };
|
|
571
|
-
const o = i - n, s = a > 0.5 ? o / (2 - i - n) : o / (i + n);
|
|
572
|
-
let l = 0;
|
|
573
|
-
return i === t ? l = ((e - r) / o + (e < r ? 6 : 0)) / 6 : i === e ? l = ((r - t) / o + 2) / 6 : l = ((t - e) / o + 4) / 6, { h: l * 360, s: s * 100, l: a * 100 };
|
|
574
|
-
}
|
|
575
|
-
function be(t) {
|
|
576
|
-
return me(t) ?? fe(t) ?? he(t);
|
|
577
|
-
}
|
|
578
|
-
function $t(t, e, r, i) {
|
|
579
|
-
const n = Math.round(t), a = Math.round(Math.min(100, Math.max(0, e))), o = Math.round(Math.min(100, Math.max(0, r)));
|
|
580
|
-
return i !== void 0 && i < 1 ? `hsla(${n}, ${a}%, ${o}%, ${i})` : `hsl(${n}, ${a}%, ${o}%)`;
|
|
581
|
-
}
|
|
582
|
-
function xe(t) {
|
|
583
|
-
const e = be(t);
|
|
584
|
-
if (!e) return null;
|
|
585
|
-
const { h: r, s: i, l: n } = e;
|
|
586
|
-
let a, o = Math.min(i + 10, 100);
|
|
587
|
-
n < 25 ? (a = n + 12, o = Math.min(i + 15, 100)) : n < 40 ? a = Math.max(n - 8, 15) : a = Math.max(18, n * 0.3), i < 15 && (o = 10, a = Math.max(a, 20));
|
|
588
|
-
const s = $t(r, o, a, 0.85), l = $t(r, Math.min(i, 90), Math.min(n, 55), 0.5);
|
|
589
|
-
return { background: s, glow: l };
|
|
590
|
-
}
|
|
591
|
-
var ve = /* @__PURE__ */ w('<div><div class="flex items-center justify-center text-foreground">'), pt = /* @__PURE__ */ w("<div>");
|
|
592
|
-
function ye(t) {
|
|
593
|
-
const e = I(), r = () => t.dynamicColor ? xe(t.dynamicColor) : null, i = () => !!r(), n = () => {
|
|
594
|
-
const l = r();
|
|
595
|
-
if (l)
|
|
596
|
-
return {
|
|
597
|
-
"background-color": l.background
|
|
598
|
-
};
|
|
599
|
-
}, a = () => {
|
|
600
|
-
const l = r();
|
|
601
|
-
if (l)
|
|
602
|
-
return {
|
|
603
|
-
"box-shadow": `0 0 25px ${l.glow}`
|
|
604
|
-
};
|
|
605
|
-
}, o = () => {
|
|
606
|
-
const l = {
|
|
607
|
-
width: `${W.icon(e.size())}px`,
|
|
608
|
-
height: `${W.icon(e.size())}px`,
|
|
609
|
-
"border-radius": "var(--radius-sm, 12px)"
|
|
610
|
-
}, d = n(), c = a();
|
|
611
|
-
return d && Object.assign(l, d), c && Object.assign(l, c), l;
|
|
612
|
-
}, s = (l, d, c) => {
|
|
613
|
-
const v = {
|
|
614
|
-
width: `${W.icon(e.size()) * 1.02}px`,
|
|
615
|
-
height: `${W.icon(e.size()) * 1.02}px`,
|
|
616
|
-
"border-radius": "var(--radius-sm, 12px)",
|
|
617
|
-
bottom: `${-W.icon(e.size()) * l}px`,
|
|
618
|
-
right: `${-W.icon(e.size()) * (l * 0.71)}px`,
|
|
619
|
-
"z-index": d,
|
|
620
|
-
opacity: c
|
|
621
|
-
}, C = n();
|
|
622
|
-
return C && Object.assign(v, C), v;
|
|
623
|
-
};
|
|
524
|
+
var je = /* @__PURE__ */ y("<p>");
|
|
525
|
+
function Fe(e) {
|
|
526
|
+
const t = Y();
|
|
624
527
|
return (() => {
|
|
625
|
-
var
|
|
626
|
-
return
|
|
627
|
-
var
|
|
628
|
-
return () =>
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
return m !== C.e && S(v, C.e = m), C.t = ot(v, x, C.t), C;
|
|
633
|
-
}, {
|
|
634
|
-
e: void 0,
|
|
635
|
-
t: void 0
|
|
636
|
-
}), v;
|
|
637
|
-
})();
|
|
638
|
-
})(), d), b(l, (() => {
|
|
639
|
-
var c = _(() => (t.entityCount ?? 1) >= 3);
|
|
640
|
-
return () => c() && (() => {
|
|
641
|
-
var v = pt();
|
|
642
|
-
return z((C) => {
|
|
643
|
-
var m = k("absolute", !i() && (t.color ?? "bg-foreground/10")), x = s(0.28, -3, 0.2);
|
|
644
|
-
return m !== C.e && S(v, C.e = m), C.t = ot(v, x, C.t), C;
|
|
645
|
-
}, {
|
|
646
|
-
e: void 0,
|
|
647
|
-
t: void 0
|
|
648
|
-
}), v;
|
|
649
|
-
})();
|
|
650
|
-
})(), d), b(d, () => t.icon), z((c) => {
|
|
651
|
-
var v = k(
|
|
652
|
-
"relative flex shrink-0 items-center justify-center transition-all",
|
|
653
|
-
"pointer-events-none",
|
|
654
|
-
t.dimmed && "opacity-50",
|
|
655
|
-
// Only apply Tailwind classes when not using dynamic colors
|
|
656
|
-
!i() && t.glow && "shadow-[0_0_25px_var(--tw-shadow-color,transparent)]",
|
|
657
|
-
!i() && (t.color ?? "bg-foreground/10"),
|
|
658
|
-
!i() && t.glow,
|
|
659
|
-
t.class
|
|
660
|
-
), C = o(), m = `${W.iconSize(e.size())}px`;
|
|
661
|
-
return v !== c.e && S(l, c.e = v), c.t = ot(l, C, c.t), m !== c.a && M(d, "font-size", c.a = m), c;
|
|
662
|
-
}, {
|
|
663
|
-
e: void 0,
|
|
664
|
-
t: void 0,
|
|
665
|
-
a: void 0
|
|
666
|
-
}), l;
|
|
667
|
-
})();
|
|
668
|
-
}
|
|
669
|
-
var we = /* @__PURE__ */ w("<div>"), $e = /* @__PURE__ */ w("<div><div><span></span></div><div>"), pe = /* @__PURE__ */ w("<span class=shrink-0>"), ke = /* @__PURE__ */ w('<span class="ml-1 text-foreground/70">');
|
|
670
|
-
function Se(t) {
|
|
671
|
-
const e = I(), r = () => {
|
|
672
|
-
const i = t.direction ?? "auto";
|
|
673
|
-
return i === "auto" ? e.orientation() === "horizontal" ? "horizontal" : "vertical" : i;
|
|
674
|
-
};
|
|
675
|
-
return (() => {
|
|
676
|
-
var i = we();
|
|
677
|
-
return b(i, () => t.children), z(() => S(i, k("flex", r() === "horizontal" ? "flex-row gap-4" : "flex-col gap-2", t.class))), i;
|
|
678
|
-
})();
|
|
679
|
-
}
|
|
680
|
-
function Ce(t) {
|
|
681
|
-
const e = I();
|
|
682
|
-
return (() => {
|
|
683
|
-
var r = $e(), i = r.firstChild, n = i.firstChild, a = i.nextSibling;
|
|
684
|
-
return b(i, (() => {
|
|
685
|
-
var o = _(() => !!t.icon);
|
|
686
|
-
return () => o() && (() => {
|
|
687
|
-
var s = pe();
|
|
688
|
-
return b(s, () => t.icon), s;
|
|
689
|
-
})();
|
|
690
|
-
})(), n), b(n, () => t.label), b(a, () => t.value, null), b(a, (() => {
|
|
691
|
-
var o = _(() => !!t.unit);
|
|
692
|
-
return () => o() && (() => {
|
|
693
|
-
var s = ke();
|
|
694
|
-
return b(s, () => t.unit), s;
|
|
695
|
-
})();
|
|
696
|
-
})(), null), z((o) => {
|
|
697
|
-
var s = k("flex flex-col", t.dimmed && "opacity-50", t.class), l = W.S1(e.size()), d = k("flex items-center gap-1 text-foreground/60", F.metricLabel(e.size())), c = k("font-semibold text-foreground", F.metricValue(e.size()));
|
|
698
|
-
return s !== o.e && S(r, o.e = s), l !== o.t && M(r, "gap", o.t = l), d !== o.a && S(i, o.a = d), c !== o.o && S(a, o.o = c), o;
|
|
699
|
-
}, {
|
|
700
|
-
e: void 0,
|
|
701
|
-
t: void 0,
|
|
702
|
-
a: void 0,
|
|
703
|
-
o: void 0
|
|
704
|
-
}), r;
|
|
705
|
-
})();
|
|
706
|
-
}
|
|
707
|
-
const _t = Se;
|
|
708
|
-
_t.Item = Ce;
|
|
709
|
-
var Me = /* @__PURE__ */ w("<p>");
|
|
710
|
-
function ze(t) {
|
|
711
|
-
const e = I();
|
|
712
|
-
return (() => {
|
|
713
|
-
var r = Me();
|
|
714
|
-
return b(r, (() => {
|
|
715
|
-
var i = _(() => !!t.isUnavailable);
|
|
716
|
-
return () => i() ? "Unavailable" : t.children;
|
|
717
|
-
})()), z((i) => {
|
|
718
|
-
var n = k("relative font-bold text-foreground", t.dimmed && "opacity-40", F.status(e.size()), t.class), a = U.ACTIONS;
|
|
719
|
-
return n !== i.e && S(r, i.e = n), a !== i.t && M(r, "z-index", i.t = a), i;
|
|
528
|
+
var r = je();
|
|
529
|
+
return p(r, (() => {
|
|
530
|
+
var o = _(() => !!e.isUnavailable);
|
|
531
|
+
return () => o() ? "Unavailable" : e.children;
|
|
532
|
+
})()), T((o) => {
|
|
533
|
+
var n = E("relative font-bold text-foreground", e.dimmed && "opacity-40", Z.status(t.size()), e.class), i = F.ACTIONS;
|
|
534
|
+
return n !== o.e && N(r, o.e = n), i !== o.t && A(r, "z-index", o.t = i), o;
|
|
720
535
|
}, {
|
|
721
536
|
e: void 0,
|
|
722
537
|
t: void 0
|
|
723
538
|
}), r;
|
|
724
539
|
})();
|
|
725
540
|
}
|
|
726
|
-
var
|
|
727
|
-
function
|
|
728
|
-
const
|
|
729
|
-
return (() => {
|
|
730
|
-
var r = De();
|
|
731
|
-
return b(r, () => t.children), z(() => S(r, k("truncate font-medium text-foreground/80", t.dimmed && "text-foreground/50", F.subtitle(e.size()), t.class))), r;
|
|
732
|
-
})();
|
|
733
|
-
}
|
|
734
|
-
var Ee = /* @__PURE__ */ w("<div><h3>"), Ne = /* @__PURE__ */ w("<span>");
|
|
735
|
-
function Oe(t) {
|
|
736
|
-
const e = I();
|
|
541
|
+
var Ye = /* @__PURE__ */ y("<div><h3>"), Ke = /* @__PURE__ */ y("<span>");
|
|
542
|
+
function qe(e) {
|
|
543
|
+
const t = Y();
|
|
737
544
|
return (() => {
|
|
738
|
-
var r =
|
|
739
|
-
return
|
|
740
|
-
var n = _(() =>
|
|
545
|
+
var r = Ye(), o = r.firstChild;
|
|
546
|
+
return p(o, () => e.children), p(r, (() => {
|
|
547
|
+
var n = _(() => e.badge !== void 0 && e.badge > 0);
|
|
741
548
|
return () => n() && (() => {
|
|
742
|
-
var
|
|
743
|
-
return
|
|
549
|
+
var i = Ke();
|
|
550
|
+
return p(i, () => e.badge), T(() => N(i, E("shrink-0 rounded-full bg-foreground/20 px-2 py-0.5 font-medium text-foreground", Z.badge(t.size())))), i;
|
|
744
551
|
})();
|
|
745
|
-
})(), null),
|
|
746
|
-
var
|
|
747
|
-
return
|
|
552
|
+
})(), null), T((n) => {
|
|
553
|
+
var i = E("relative flex items-center", e.class), a = H.S1(t.size()), c = F.ACTIONS, x = E("truncate text-foreground/60", Z.title(t.size()));
|
|
554
|
+
return i !== n.e && N(r, n.e = i), a !== n.t && A(r, "gap", n.t = a), c !== n.a && A(r, "z-index", n.a = c), x !== n.o && N(o, n.o = x), n;
|
|
748
555
|
}, {
|
|
749
556
|
e: void 0,
|
|
750
557
|
t: void 0,
|
|
@@ -753,15 +560,8 @@ function Oe(t) {
|
|
|
753
560
|
}), r;
|
|
754
561
|
})();
|
|
755
562
|
}
|
|
756
|
-
function
|
|
757
|
-
|
|
758
|
-
icon: t.icon,
|
|
759
|
-
title: t.title,
|
|
760
|
-
message: t.message || `Configure this widget to add ${t.entityType || "an entity"}`
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
function Te(t, e = !1) {
|
|
764
|
-
if (t.length === 0)
|
|
563
|
+
function Xe(e, t = !1) {
|
|
564
|
+
if (e.length === 0)
|
|
765
565
|
return {
|
|
766
566
|
isGroup: !1,
|
|
767
567
|
state: "unknown",
|
|
@@ -774,65 +574,65 @@ function Te(t, e = !1) {
|
|
|
774
574
|
totalCount: 0,
|
|
775
575
|
description: "No entities"
|
|
776
576
|
};
|
|
777
|
-
const r =
|
|
577
|
+
const r = e.length > 1;
|
|
778
578
|
if (!r) {
|
|
779
|
-
const
|
|
579
|
+
const m = e[0], l = m.state === "on", k = m.attributes?.brightness || 0, b = Math.round(k / 255 * 100);
|
|
780
580
|
return {
|
|
781
581
|
isGroup: !1,
|
|
782
|
-
state:
|
|
783
|
-
isOn:
|
|
784
|
-
isUnavailable:
|
|
785
|
-
brightness:
|
|
786
|
-
brightnessPercent:
|
|
787
|
-
color:
|
|
788
|
-
onCount:
|
|
582
|
+
state: m.state,
|
|
583
|
+
isOn: l,
|
|
584
|
+
isUnavailable: m.state === "unavailable",
|
|
585
|
+
brightness: k,
|
|
586
|
+
brightnessPercent: b,
|
|
587
|
+
color: he(m),
|
|
588
|
+
onCount: l ? 1 : 0,
|
|
789
589
|
totalCount: 1,
|
|
790
|
-
description:
|
|
590
|
+
description: l ? "On" : "Off"
|
|
791
591
|
};
|
|
792
592
|
}
|
|
793
|
-
let
|
|
794
|
-
const
|
|
795
|
-
for (const
|
|
796
|
-
switch (
|
|
593
|
+
let o = 0, n = 0, i = 0, a = 0, c = 0, x = 0;
|
|
594
|
+
const w = [];
|
|
595
|
+
for (const m of e)
|
|
596
|
+
switch (m.state) {
|
|
797
597
|
case "on":
|
|
798
|
-
|
|
598
|
+
o++, m.attributes?.brightness !== void 0 && (c += m.attributes.brightness, x++), m.attributes?.rgb_color && w.push(m.attributes.rgb_color);
|
|
799
599
|
break;
|
|
800
600
|
case "off":
|
|
801
601
|
n++;
|
|
802
602
|
break;
|
|
803
603
|
case "unknown":
|
|
804
|
-
|
|
604
|
+
i++;
|
|
805
605
|
break;
|
|
806
606
|
case "unavailable":
|
|
807
|
-
|
|
607
|
+
a++;
|
|
808
608
|
break;
|
|
809
609
|
}
|
|
810
|
-
const
|
|
811
|
-
let
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
let
|
|
815
|
-
if (
|
|
816
|
-
const
|
|
817
|
-
|
|
610
|
+
const v = e.length, S = a === v, W = i + a === v, g = o > 0, f = o === v, D = n === v;
|
|
611
|
+
let $, C;
|
|
612
|
+
t ? S ? ($ = "unavailable", C = !1) : i > 0 || a > 0 ? ($ = "unknown", C = !1) : n > 0 ? ($ = "off", C = !1) : ($ = "on", C = !0) : S ? ($ = "unavailable", C = !1) : W ? ($ = "unknown", C = !1) : g ? ($ = "on", C = !0) : ($ = "off", C = !1);
|
|
613
|
+
const I = x > 0 ? Math.round(c / x) : 0, B = Math.round(I / 255 * 100);
|
|
614
|
+
let u;
|
|
615
|
+
if (w.length > 0) {
|
|
616
|
+
const m = Math.round(w.reduce((s, z) => s + z[0], 0) / w.length), l = Math.round(w.reduce((s, z) => s + z[1], 0) / w.length), k = Math.round(w.reduce((s, z) => s + z[2], 0) / w.length), b = I / 255;
|
|
617
|
+
u = `rgb(${Math.round(m * b)}, ${Math.round(l * b)}, ${Math.round(k * b)})`;
|
|
818
618
|
} else
|
|
819
|
-
|
|
820
|
-
let
|
|
821
|
-
return
|
|
619
|
+
u = he(e[0]);
|
|
620
|
+
let h;
|
|
621
|
+
return f ? h = "All on" : D ? h = "All off" : o > 0 ? h = `${o} of ${v} on` : h = "Off", {
|
|
822
622
|
isGroup: r,
|
|
823
|
-
state:
|
|
824
|
-
isOn:
|
|
825
|
-
isUnavailable:
|
|
826
|
-
brightness:
|
|
623
|
+
state: $,
|
|
624
|
+
isOn: C,
|
|
625
|
+
isUnavailable: $ === "unavailable",
|
|
626
|
+
brightness: I,
|
|
827
627
|
brightnessPercent: B,
|
|
828
|
-
color:
|
|
829
|
-
onCount:
|
|
830
|
-
totalCount:
|
|
831
|
-
description:
|
|
628
|
+
color: u,
|
|
629
|
+
onCount: o,
|
|
630
|
+
totalCount: v,
|
|
631
|
+
description: h
|
|
832
632
|
};
|
|
833
633
|
}
|
|
834
|
-
function
|
|
835
|
-
if (
|
|
634
|
+
function Je(e, t = "mean", r = !0) {
|
|
635
|
+
if (e.length === 0)
|
|
836
636
|
return {
|
|
837
637
|
isGroup: !1,
|
|
838
638
|
state: "unknown",
|
|
@@ -840,426 +640,364 @@ function Ve(t, e = "mean", r = !0) {
|
|
|
840
640
|
isUnavailable: !0,
|
|
841
641
|
description: "No entities"
|
|
842
642
|
};
|
|
843
|
-
const
|
|
844
|
-
if (!
|
|
845
|
-
const
|
|
846
|
-
let
|
|
847
|
-
return Number.isNaN(
|
|
643
|
+
const o = e.length > 1;
|
|
644
|
+
if (!o) {
|
|
645
|
+
const g = e[0], f = Number.parseFloat(g.state);
|
|
646
|
+
let D = g.state;
|
|
647
|
+
return Number.isNaN(f) || (D = Number.isInteger(f) ? f.toString() : f.toFixed(1)), {
|
|
848
648
|
isGroup: !1,
|
|
849
|
-
state:
|
|
850
|
-
numericValue: Number.isNaN(
|
|
851
|
-
isUnavailable:
|
|
852
|
-
unit:
|
|
853
|
-
description:
|
|
649
|
+
state: D,
|
|
650
|
+
numericValue: Number.isNaN(f) ? null : f,
|
|
651
|
+
isUnavailable: g.state === "unavailable",
|
|
652
|
+
unit: g.unitOfMeasurement ?? void 0,
|
|
653
|
+
description: D
|
|
854
654
|
};
|
|
855
655
|
}
|
|
856
|
-
const n = [],
|
|
857
|
-
let
|
|
858
|
-
for (const
|
|
859
|
-
if (!
|
|
860
|
-
|
|
861
|
-
entityId:
|
|
656
|
+
const n = [], i = [];
|
|
657
|
+
let a = 0, c;
|
|
658
|
+
for (const g of e) {
|
|
659
|
+
if (!c && g.unitOfMeasurement && (c = g.unitOfMeasurement), g.state === "unavailable") {
|
|
660
|
+
a++, i.push({
|
|
661
|
+
entityId: g.id,
|
|
862
662
|
value: "unavailable",
|
|
863
|
-
friendly_name:
|
|
663
|
+
friendly_name: g.friendlyName
|
|
864
664
|
});
|
|
865
665
|
continue;
|
|
866
666
|
}
|
|
867
|
-
const
|
|
868
|
-
isNaN(
|
|
869
|
-
entityId:
|
|
870
|
-
value:
|
|
871
|
-
friendly_name:
|
|
872
|
-
}) : (n.push(
|
|
873
|
-
entityId:
|
|
874
|
-
value:
|
|
875
|
-
friendly_name:
|
|
667
|
+
const f = Number.parseFloat(g.state);
|
|
668
|
+
isNaN(f) ? r || i.push({
|
|
669
|
+
entityId: g.id,
|
|
670
|
+
value: g.state,
|
|
671
|
+
friendly_name: g.friendlyName
|
|
672
|
+
}) : (n.push(f), i.push({
|
|
673
|
+
entityId: g.id,
|
|
674
|
+
value: f,
|
|
675
|
+
friendly_name: g.friendlyName
|
|
876
676
|
}));
|
|
877
677
|
}
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
678
|
+
const x = a === e.length, w = n.length === 0;
|
|
679
|
+
if (x || w)
|
|
880
680
|
return {
|
|
881
|
-
isGroup:
|
|
882
|
-
state:
|
|
681
|
+
isGroup: o,
|
|
682
|
+
state: x ? "unavailable" : "unknown",
|
|
883
683
|
numericValue: null,
|
|
884
|
-
isUnavailable:
|
|
885
|
-
unit:
|
|
886
|
-
description:
|
|
887
|
-
memberValues:
|
|
684
|
+
isUnavailable: x,
|
|
685
|
+
unit: c,
|
|
686
|
+
description: x ? "Unavailable" : "No numeric values",
|
|
687
|
+
memberValues: i
|
|
888
688
|
};
|
|
889
|
-
let
|
|
890
|
-
switch (
|
|
689
|
+
let v, S;
|
|
690
|
+
switch (t) {
|
|
891
691
|
case "min":
|
|
892
|
-
|
|
692
|
+
v = Math.min(...n), S = "Minimum";
|
|
893
693
|
break;
|
|
894
694
|
case "max":
|
|
895
|
-
|
|
695
|
+
v = Math.max(...n), S = "Maximum";
|
|
896
696
|
break;
|
|
897
697
|
case "mean":
|
|
898
|
-
|
|
698
|
+
v = n.reduce((g, f) => g + f, 0) / n.length, S = "Average";
|
|
899
699
|
break;
|
|
900
700
|
case "median": {
|
|
901
|
-
const
|
|
902
|
-
|
|
701
|
+
const g = [...n].sort((D, $) => D - $), f = Math.floor(g.length / 2);
|
|
702
|
+
v = g.length % 2 === 0 ? (g[f - 1] + g[f]) / 2 : g[f], S = "Median";
|
|
903
703
|
break;
|
|
904
704
|
}
|
|
905
705
|
case "sum":
|
|
906
|
-
|
|
706
|
+
v = n.reduce((g, f) => g + f, 0), S = "Sum";
|
|
907
707
|
break;
|
|
908
708
|
case "last":
|
|
909
|
-
|
|
709
|
+
v = n[n.length - 1], S = "Latest";
|
|
910
710
|
break;
|
|
911
711
|
case "range":
|
|
912
|
-
|
|
712
|
+
v = Math.max(...n) - Math.min(...n), S = "Range";
|
|
913
713
|
break;
|
|
914
714
|
case "product":
|
|
915
|
-
|
|
715
|
+
v = n.reduce((g, f) => g * f, 1), S = "Product";
|
|
916
716
|
break;
|
|
917
717
|
case "std_dev": {
|
|
918
|
-
const
|
|
919
|
-
|
|
718
|
+
const g = n.reduce((D, $) => D + $, 0) / n.length, f = n.reduce((D, $) => D + ($ - g) ** 2, 0) / n.length;
|
|
719
|
+
v = Math.sqrt(f), S = "Std Dev";
|
|
920
720
|
break;
|
|
921
721
|
}
|
|
922
722
|
default:
|
|
923
|
-
|
|
723
|
+
v = n.reduce((g, f) => g + f, 0) / n.length, S = "Average";
|
|
924
724
|
}
|
|
925
|
-
const
|
|
725
|
+
const W = Number.isInteger(v) ? v.toString() : v.toFixed(1);
|
|
926
726
|
return {
|
|
927
|
-
isGroup:
|
|
928
|
-
state:
|
|
929
|
-
numericValue:
|
|
727
|
+
isGroup: o,
|
|
728
|
+
state: W,
|
|
729
|
+
numericValue: v,
|
|
930
730
|
isUnavailable: !1,
|
|
931
|
-
unit:
|
|
932
|
-
description: `${
|
|
933
|
-
memberValues:
|
|
731
|
+
unit: c,
|
|
732
|
+
description: `${S} of ${n.length}`,
|
|
733
|
+
memberValues: i
|
|
934
734
|
};
|
|
935
735
|
}
|
|
936
|
-
function
|
|
937
|
-
if (
|
|
938
|
-
const r = (
|
|
939
|
-
if (
|
|
940
|
-
const [
|
|
941
|
-
return `rgb(${Math.round(
|
|
736
|
+
function he(e) {
|
|
737
|
+
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
738
|
+
const r = (e.attributes?.brightness ?? 255) / 255;
|
|
739
|
+
if (e.attributes?.rgb_color) {
|
|
740
|
+
const [o, n, i] = e.attributes.rgb_color;
|
|
741
|
+
return `rgb(${Math.round(o * r)}, ${Math.round(n * r)}, ${Math.round(i * r)})`;
|
|
942
742
|
}
|
|
943
|
-
if (
|
|
944
|
-
const n = 1e6 /
|
|
945
|
-
let
|
|
946
|
-
return n <= 66 ? (
|
|
743
|
+
if (e.attributes?.color_temp) {
|
|
744
|
+
const n = 1e6 / e.attributes.color_temp / 100;
|
|
745
|
+
let i, a, c;
|
|
746
|
+
return n <= 66 ? (i = 255, a = n <= 19 ? 0 : 99.4708025861 * Math.log(n - 10) - 161.1195681661, c = n <= 19 ? 0 : n <= 66 ? 138.5177312231 * Math.log(n - 10) - 305.0447927307 : 255) : (i = 329.698727446 * (n - 60) ** -0.1332047592, a = 288.1221695283 * (n - 60) ** -0.0755148492, c = 255), i = Math.max(0, Math.min(255, i)) * r, a = Math.max(0, Math.min(255, a)) * r, c = Math.max(0, Math.min(255, c)) * r, `rgb(${Math.round(i)}, ${Math.round(a)}, ${Math.round(c)})`;
|
|
947
747
|
}
|
|
948
748
|
return `rgb(${Math.round(255 * r)}, ${Math.round(220 * r)}, ${Math.round(180 * r)})`;
|
|
949
749
|
}
|
|
950
|
-
function
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
function We(t) {
|
|
954
|
-
if (!t) return !1;
|
|
955
|
-
if (["on", "open", "locked", "home", "playing", "active"].includes(t.state))
|
|
750
|
+
function Qe(e) {
|
|
751
|
+
if (!e) return !1;
|
|
752
|
+
if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
|
|
956
753
|
return !0;
|
|
957
|
-
if (
|
|
958
|
-
const
|
|
959
|
-
return !isNaN(
|
|
754
|
+
if (e.domain === "sensor") {
|
|
755
|
+
const t = Number.parseFloat(e.state);
|
|
756
|
+
return !isNaN(t) && t > 0;
|
|
960
757
|
}
|
|
961
758
|
return !1;
|
|
962
759
|
}
|
|
963
|
-
function
|
|
964
|
-
return
|
|
965
|
-
}
|
|
966
|
-
function
|
|
967
|
-
return
|
|
968
|
-
}
|
|
969
|
-
function
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
function
|
|
985
|
-
const
|
|
986
|
-
if (typeof t == "string")
|
|
987
|
-
return e ? `${t}${e}` : t;
|
|
988
|
-
if (t == null || Number.isNaN(t))
|
|
989
|
-
return e ? `--${e}` : "--";
|
|
990
|
-
let a = t, o = e || "";
|
|
991
|
-
n && e && (e === "W" || e === "kW" || e === "MW") && (t >= 1e6 ? (a = t / 1e6, o = "MW") : t >= 1e3 ? (a = t / 1e3, o = "kW") : o = "W"), n && e && (e === "B" || e === "KB" || e === "MB" || e === "GB") && (t >= 1073741824 ? (a = t / 1073741824, o = "GB") : t >= 1048576 ? (a = t / 1048576, o = "MB") : t >= 1024 ? (a = t / 1024, o = "KB") : o = "B");
|
|
992
|
-
let s;
|
|
993
|
-
return i !== void 0 ? s = a.toFixed(i) : a !== t ? s = a.toFixed(1) : Number.isInteger(t) ? s = t.toString() : s = Number.parseFloat(t.toFixed(2)).toString(), o ? `${s}${o}` : s;
|
|
994
|
-
}
|
|
995
|
-
function Ie(t, e) {
|
|
996
|
-
return t == null || isNaN(t) ? null : e === "°C" ? t < 10 ? "Cold" : t < 18 ? "Cool" : t < 24 ? "Comfortable" : t < 28 ? "Warm" : "Hot" : e === "°F" ? t < 50 ? "Cold" : t < 64 ? "Cool" : t < 75 ? "Comfortable" : t < 82 ? "Warm" : "Hot" : e === "%" ? t < 20 ? "Very Low" : t < 40 ? "Low" : t < 60 ? "Medium" : t < 80 ? "High" : "Very High" : e === "ppm" ? t < 400 ? "Excellent" : t < 600 ? "Good" : t < 1e3 ? "Acceptable" : t < 1500 ? "Mediocre" : "Poor" : e === "lx" ? t < 50 ? "Dark" : t < 200 ? "Dim" : t < 500 ? "Moderate" : t < 1e3 ? "Bright" : "Very Bright" : e === "AQI" ? t <= 50 ? "Good" : t <= 100 ? "Moderate" : t <= 150 ? "Unhealthy for Sensitive" : t <= 200 ? "Unhealthy" : t <= 300 ? "Very Unhealthy" : "Hazardous" : e === "dB" ? t < 30 ? "Very Quiet" : t < 50 ? "Quiet" : t < 70 ? "Moderate" : t < 85 ? "Loud" : "Very Loud" : null;
|
|
997
|
-
}
|
|
998
|
-
var He = /* @__PURE__ */ w("<div><div>"), Ge = /* @__PURE__ */ w("<div>");
|
|
999
|
-
function Pe(t) {
|
|
1000
|
-
const e = I();
|
|
760
|
+
function Bt(e, t, r) {
|
|
761
|
+
return e?.attributes ? e.attributes[t] ?? r : r;
|
|
762
|
+
}
|
|
763
|
+
function jt(e) {
|
|
764
|
+
return e.filter(Qe).length;
|
|
765
|
+
}
|
|
766
|
+
function Ze(e, t, r) {
|
|
767
|
+
const { decimals: o, scale: n = !0 } = {};
|
|
768
|
+
if (typeof e == "string")
|
|
769
|
+
return t ? `${e}${t}` : e;
|
|
770
|
+
if (e == null || Number.isNaN(e))
|
|
771
|
+
return t ? `--${t}` : "--";
|
|
772
|
+
let i = e, a = t || "";
|
|
773
|
+
n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (i = e / 1e6, a = "MW") : e >= 1e3 ? (i = e / 1e3, a = "kW") : a = "W"), n && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (i = e / 1073741824, a = "GB") : e >= 1048576 ? (i = e / 1048576, a = "MB") : e >= 1024 ? (i = e / 1024, a = "KB") : a = "B");
|
|
774
|
+
let c;
|
|
775
|
+
return o !== void 0 ? c = i.toFixed(o) : i !== e ? c = i.toFixed(1) : Number.isInteger(e) ? c = e.toString() : c = Number.parseFloat(e.toFixed(2)).toString(), a ? `${c}${a}` : c;
|
|
776
|
+
}
|
|
777
|
+
function et(e, t) {
|
|
778
|
+
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;
|
|
779
|
+
}
|
|
780
|
+
var tt = /* @__PURE__ */ y("<div><div>"), nt = /* @__PURE__ */ y("<div>");
|
|
781
|
+
function rt(e) {
|
|
782
|
+
const t = Y();
|
|
1001
783
|
return (() => {
|
|
1002
|
-
var r =
|
|
1003
|
-
return
|
|
1004
|
-
var n = _(() => !!(
|
|
784
|
+
var r = tt(), o = r.firstChild;
|
|
785
|
+
return p(o, () => Ze(e.value, e.unit)), p(r, (() => {
|
|
786
|
+
var n = _(() => !!(e.interpret && typeof e.value == "number"));
|
|
1005
787
|
return () => n() && (() => {
|
|
1006
|
-
var
|
|
1007
|
-
return
|
|
1008
|
-
var
|
|
1009
|
-
return
|
|
788
|
+
var i = nt();
|
|
789
|
+
return p(i, () => et(e.value, e.unit)), T((a) => {
|
|
790
|
+
var c = E("text-foreground/60", Z.subtitle(t.size())), x = H.S1(t.size());
|
|
791
|
+
return c !== a.e && N(i, a.e = c), x !== a.t && A(i, "margin-top", a.t = x), a;
|
|
1010
792
|
}, {
|
|
1011
793
|
e: void 0,
|
|
1012
794
|
t: void 0
|
|
1013
|
-
}),
|
|
795
|
+
}), i;
|
|
1014
796
|
})();
|
|
1015
|
-
})(), null),
|
|
1016
|
-
var
|
|
1017
|
-
return
|
|
797
|
+
})(), null), T((n) => {
|
|
798
|
+
var i = E("flex flex-col", e.class), a = E("font-bold text-foreground", Z.value(t.size()));
|
|
799
|
+
return i !== n.e && N(r, n.e = i), a !== n.t && N(o, n.t = a), n;
|
|
1018
800
|
}, {
|
|
1019
801
|
e: void 0,
|
|
1020
802
|
t: void 0
|
|
1021
803
|
}), r;
|
|
1022
804
|
})();
|
|
1023
805
|
}
|
|
1024
|
-
var
|
|
1025
|
-
function
|
|
1026
|
-
const r =
|
|
806
|
+
var it = /* @__PURE__ */ y('<div><div class="relative h-full w-full">'), ot = /* @__PURE__ */ y('<div class="glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse">'), at = /* @__PURE__ */ y('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), st = /* @__PURE__ */ y('<div class="flex items-center justify-center text-white/30">'), lt = /* @__PURE__ */ y('<h3 class="font-semibold text-sm text-white/60">'), ct = /* @__PURE__ */ y('<p class="text-white/50 text-xs">');
|
|
807
|
+
function dt(e, t) {
|
|
808
|
+
const r = e * t;
|
|
1027
809
|
return r <= 2 ? "xs" : r <= 4 ? "sm" : r <= 8 ? "md" : r <= 18 ? "lg" : "xl";
|
|
1028
810
|
}
|
|
1029
|
-
function
|
|
1030
|
-
return
|
|
811
|
+
function ut(e, t) {
|
|
812
|
+
return e > t ? "horizontal" : t > e ? "vertical" : "square";
|
|
1031
813
|
}
|
|
1032
|
-
function
|
|
1033
|
-
return
|
|
814
|
+
function gt(e, t) {
|
|
815
|
+
return t >= 150 ? "vertical" : e > t ? "horizontal" : t > e ? "vertical" : "square";
|
|
1034
816
|
}
|
|
1035
|
-
function
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
817
|
+
function ht(e) {
|
|
818
|
+
Ce(() => {
|
|
819
|
+
Ee();
|
|
820
|
+
});
|
|
821
|
+
let t;
|
|
822
|
+
const r = Se(() => t), o = 2, [n, i] = U(0), [a, c] = U(0);
|
|
823
|
+
R(() => {
|
|
824
|
+
const l = Math.round(r.width ?? 0), k = Math.round(r.height ?? 0), b = de(n), s = de(a);
|
|
825
|
+
(Math.abs(l - b) > o || Math.abs(k - s) > o) && (i(l), c(k));
|
|
1041
826
|
});
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1044
|
-
return typeof
|
|
1045
|
-
}),
|
|
827
|
+
const x = V(() => {
|
|
828
|
+
if (e.variant)
|
|
829
|
+
return typeof e.variant == "string" ? We(e.variant) : e.variant;
|
|
830
|
+
}), w = V(() => ({
|
|
1046
831
|
width: n(),
|
|
1047
|
-
height:
|
|
832
|
+
height: a(),
|
|
1048
833
|
gridWidth: Math.max(1, Math.round(n() / 150)),
|
|
1049
|
-
gridHeight: Math.max(1, Math.round(
|
|
834
|
+
gridHeight: Math.max(1, Math.round(a() / 75))
|
|
1050
835
|
}), void 0, {
|
|
1051
|
-
equals: (
|
|
1052
|
-
}),
|
|
1053
|
-
const
|
|
1054
|
-
return
|
|
1055
|
-
}),
|
|
1056
|
-
const
|
|
1057
|
-
return
|
|
1058
|
-
}),
|
|
1059
|
-
const
|
|
1060
|
-
return
|
|
1061
|
-
}),
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
}),
|
|
1065
|
-
|
|
1066
|
-
}),
|
|
1067
|
-
|
|
1068
|
-
}),
|
|
1069
|
-
|
|
1070
|
-
}),
|
|
1071
|
-
|
|
836
|
+
equals: (l, k) => l.width === k.width && l.height === k.height && l.gridWidth === k.gridWidth && l.gridHeight === k.gridHeight
|
|
837
|
+
}), v = V(() => {
|
|
838
|
+
const l = w();
|
|
839
|
+
return dt(l.gridWidth, l.gridHeight);
|
|
840
|
+
}), S = V(() => {
|
|
841
|
+
const l = w();
|
|
842
|
+
return ut(l.width, l.height);
|
|
843
|
+
}), W = V(() => {
|
|
844
|
+
const l = w();
|
|
845
|
+
return gt(l.width, l.height);
|
|
846
|
+
}), g = fe(se), f = g;
|
|
847
|
+
f?._isStub?.() && f._bridge && (R(() => {
|
|
848
|
+
f._bridge.setSize(v());
|
|
849
|
+
}), R(() => {
|
|
850
|
+
f._bridge.setOrientation(S());
|
|
851
|
+
}), R(() => {
|
|
852
|
+
f._bridge.setContentLayout(W());
|
|
853
|
+
}), R(() => {
|
|
854
|
+
f._bridge.setDimensions(w());
|
|
855
|
+
}), R(() => {
|
|
856
|
+
f._bridge.setIsStub(!1);
|
|
1072
857
|
}));
|
|
1073
|
-
const
|
|
1074
|
-
size:
|
|
1075
|
-
orientation:
|
|
1076
|
-
contentLayout:
|
|
1077
|
-
dimensions:
|
|
1078
|
-
isEditMode: () =>
|
|
1079
|
-
updateConfig:
|
|
858
|
+
const D = {
|
|
859
|
+
size: v,
|
|
860
|
+
orientation: S,
|
|
861
|
+
contentLayout: W,
|
|
862
|
+
dimensions: w,
|
|
863
|
+
isEditMode: () => e.isEditMode ?? !1,
|
|
864
|
+
updateConfig: g?.updateConfig ?? (() => {
|
|
1080
865
|
})
|
|
1081
|
-
},
|
|
866
|
+
}, $ = V(() => ({
|
|
1082
867
|
"container-type": "size",
|
|
1083
868
|
"container-name": "widget",
|
|
1084
|
-
"touch-action":
|
|
1085
|
-
...
|
|
1086
|
-
...
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
869
|
+
"touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
|
|
870
|
+
...x()?.styles?.container,
|
|
871
|
+
...x()?.styles?.cssVars || {},
|
|
872
|
+
...e.tone ? {
|
|
873
|
+
"--widget-color": `var(--tone-${e.tone})`
|
|
874
|
+
} : {},
|
|
875
|
+
...e.color ? {
|
|
876
|
+
"--widget-color": e.color
|
|
877
|
+
} : {},
|
|
878
|
+
...e.colorTo ? {
|
|
879
|
+
"--widget-color-to": e.colorTo
|
|
880
|
+
} : {},
|
|
881
|
+
...e.gradient ? {
|
|
882
|
+
"--widget-gradient": e.gradient
|
|
883
|
+
} : {}
|
|
884
|
+
})), C = () => !!e.gestures && !e.isEditMode, I = (l) => {
|
|
885
|
+
C() && e.gestures?.onPointerEnter(l);
|
|
886
|
+
}, B = (l) => {
|
|
887
|
+
C() && e.gestures?.onPointerDown(l);
|
|
888
|
+
}, u = (l) => {
|
|
889
|
+
C() && e.gestures?.onPointerMove(l);
|
|
890
|
+
}, h = (l) => {
|
|
891
|
+
C() && e.gestures?.onPointerUp(l);
|
|
892
|
+
}, m = (l) => {
|
|
893
|
+
C() && e.gestures?.onPointerCancel(l);
|
|
1097
894
|
};
|
|
1098
|
-
return
|
|
1099
|
-
value:
|
|
895
|
+
return M(se.Provider, {
|
|
896
|
+
value: D,
|
|
1100
897
|
get children() {
|
|
1101
|
-
var
|
|
1102
|
-
return
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
var
|
|
1106
|
-
return () =>
|
|
1107
|
-
var G = Be(), Q = G.firstChild;
|
|
1108
|
-
return z((P) => {
|
|
1109
|
-
var J = U.BACKGROUND, ut = k("absolute inset-0 opacity-20 blur-2xl", t.backgroundGlow);
|
|
1110
|
-
return J !== P.e && M(G, "z-index", P.e = J), ut !== P.t && S(Q, P.t = ut), P;
|
|
1111
|
-
}, {
|
|
1112
|
-
e: void 0,
|
|
1113
|
-
t: void 0
|
|
1114
|
-
}), G;
|
|
1115
|
-
})();
|
|
1116
|
-
})(), A), b(A, (() => {
|
|
1117
|
-
var p = _(() => !!t.emptyState);
|
|
1118
|
-
return () => p() ? T(Qe, {
|
|
898
|
+
var l = it(), k = l.firstChild;
|
|
899
|
+
return q(l, "pointercancel", m), q(l, "pointerup", h), q(l, "pointermove", u), q(l, "pointerdown", B), q(l, "pointerenter", I), ye((b) => {
|
|
900
|
+
t = b, e.gestures?.bindElement(b);
|
|
901
|
+
}, l), p(k, (() => {
|
|
902
|
+
var b = _(() => !!e.emptyState);
|
|
903
|
+
return () => b() ? M(ft, {
|
|
1119
904
|
get icon() {
|
|
1120
|
-
return
|
|
905
|
+
return e.emptyState.icon;
|
|
1121
906
|
},
|
|
1122
907
|
get title() {
|
|
1123
|
-
return
|
|
908
|
+
return e.emptyState.title;
|
|
1124
909
|
},
|
|
1125
910
|
get message() {
|
|
1126
|
-
return
|
|
911
|
+
return e.emptyState.message;
|
|
1127
912
|
}
|
|
1128
|
-
}) :
|
|
1129
|
-
})()),
|
|
1130
|
-
var
|
|
1131
|
-
return () =>
|
|
1132
|
-
var
|
|
1133
|
-
return
|
|
913
|
+
}) : e.children;
|
|
914
|
+
})()), p(l, (() => {
|
|
915
|
+
var b = _(() => !!e.loading);
|
|
916
|
+
return () => b() && (() => {
|
|
917
|
+
var s = ot();
|
|
918
|
+
return T((z) => A(s, "z-index", F.OVERLAY)), s;
|
|
1134
919
|
})();
|
|
1135
|
-
})(), null),
|
|
1136
|
-
var
|
|
1137
|
-
"
|
|
920
|
+
})(), null), T((b) => {
|
|
921
|
+
var s = E(
|
|
922
|
+
"glasshome-widget",
|
|
923
|
+
"relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50",
|
|
1138
924
|
// Variant styles (lowest priority)
|
|
1139
|
-
|
|
925
|
+
x()?.styles?.class,
|
|
1140
926
|
// Custom class (highest priority)
|
|
1141
|
-
|
|
1142
|
-
),
|
|
1143
|
-
|
|
1144
|
-
// Gradient prop (overrides variant, auto-applied for empty state)
|
|
1145
|
-
R()
|
|
1146
|
-
), J = U.CONTENT;
|
|
1147
|
-
return G !== p.e && S(f, p.e = G), p.t = ot(f, Q, p.t), P !== p.a && S(u, p.a = P), J !== p.o && M(A, "z-index", p.o = J), p;
|
|
927
|
+
e.class
|
|
928
|
+
), z = $(), O = F.CONTENT;
|
|
929
|
+
return s !== b.e && N(l, b.e = s), b.t = Q(l, z, b.t), O !== b.a && A(k, "z-index", b.a = O), b;
|
|
1148
930
|
}, {
|
|
1149
931
|
e: void 0,
|
|
1150
932
|
t: void 0,
|
|
1151
|
-
a: void 0
|
|
1152
|
-
|
|
1153
|
-
}), f;
|
|
933
|
+
a: void 0
|
|
934
|
+
}), l;
|
|
1154
935
|
}
|
|
1155
936
|
});
|
|
1156
937
|
}
|
|
1157
|
-
function
|
|
938
|
+
function ft(e) {
|
|
1158
939
|
return (() => {
|
|
1159
|
-
var
|
|
1160
|
-
return
|
|
1161
|
-
var r = _(() => !!
|
|
940
|
+
var t = at();
|
|
941
|
+
return p(t, (() => {
|
|
942
|
+
var r = _(() => !!e.icon);
|
|
1162
943
|
return () => r() && (() => {
|
|
1163
|
-
var
|
|
1164
|
-
return
|
|
944
|
+
var o = st();
|
|
945
|
+
return p(o, () => e.icon), o;
|
|
1165
946
|
})();
|
|
1166
|
-
})(), null),
|
|
1167
|
-
var r = _(() => !!
|
|
947
|
+
})(), null), p(t, (() => {
|
|
948
|
+
var r = _(() => !!e.title);
|
|
1168
949
|
return () => r() && (() => {
|
|
1169
|
-
var
|
|
1170
|
-
return
|
|
950
|
+
var o = lt();
|
|
951
|
+
return p(o, () => e.title), o;
|
|
1171
952
|
})();
|
|
1172
|
-
})(), null),
|
|
1173
|
-
var r = _(() => !!
|
|
953
|
+
})(), null), p(t, (() => {
|
|
954
|
+
var r = _(() => !!e.message);
|
|
1174
955
|
return () => r() && (() => {
|
|
1175
|
-
var
|
|
1176
|
-
return
|
|
956
|
+
var o = ct();
|
|
957
|
+
return p(o, () => e.message), o;
|
|
1177
958
|
})();
|
|
1178
|
-
})(), null),
|
|
1179
|
-
})();
|
|
1180
|
-
}
|
|
1181
|
-
const Y = Ze;
|
|
1182
|
-
Y.Content = oe;
|
|
1183
|
-
Y.Icon = ye;
|
|
1184
|
-
Y.Title = Oe;
|
|
1185
|
-
Y.Subtitle = _e;
|
|
1186
|
-
Y.Status = ze;
|
|
1187
|
-
Y.Value = Pe;
|
|
1188
|
-
Y.Metrics = _t;
|
|
1189
|
-
Y.EmptyState = ge;
|
|
1190
|
-
Y.SliderFill = ne;
|
|
1191
|
-
var tn = /* @__PURE__ */ w("<div><div>");
|
|
1192
|
-
const en = {
|
|
1193
|
-
blue: "bg-blue-500/30",
|
|
1194
|
-
green: "bg-green-500/30",
|
|
1195
|
-
red: "bg-red-500/30",
|
|
1196
|
-
yellow: "bg-yellow-500/30",
|
|
1197
|
-
purple: "bg-purple-500/30",
|
|
1198
|
-
gray: "bg-gray-500/30"
|
|
1199
|
-
};
|
|
1200
|
-
function Jn(t) {
|
|
1201
|
-
const e = () => en[t.color] ?? t.color;
|
|
1202
|
-
return (() => {
|
|
1203
|
-
var r = tn(), i = r.firstChild;
|
|
1204
|
-
return z((n) => {
|
|
1205
|
-
var a = k("pointer-events-none absolute inset-0", t.class), o = U.BACKGROUND, s = k("absolute inset-0 opacity-40 blur-3xl", e());
|
|
1206
|
-
return a !== n.e && S(r, n.e = a), o !== n.t && M(r, "z-index", n.t = o), s !== n.a && S(i, n.a = s), n;
|
|
1207
|
-
}, {
|
|
1208
|
-
e: void 0,
|
|
1209
|
-
t: void 0,
|
|
1210
|
-
a: void 0
|
|
1211
|
-
}), r;
|
|
1212
|
-
})();
|
|
1213
|
-
}
|
|
1214
|
-
var nn = /* @__PURE__ */ w("<div>");
|
|
1215
|
-
function Zn(t) {
|
|
1216
|
-
const e = I(), r = () => {
|
|
1217
|
-
const i = t.spacing ?? "S2";
|
|
1218
|
-
return W[i](e.size());
|
|
1219
|
-
};
|
|
1220
|
-
return (() => {
|
|
1221
|
-
var i = nn();
|
|
1222
|
-
return b(i, () => t.children), z((n) => {
|
|
1223
|
-
var a = k("flex flex-col", t.class), o = r();
|
|
1224
|
-
return a !== n.e && S(i, n.e = a), o !== n.t && M(i, "gap", n.t = o), n;
|
|
1225
|
-
}, {
|
|
1226
|
-
e: void 0,
|
|
1227
|
-
t: void 0
|
|
1228
|
-
}), i;
|
|
959
|
+
})(), null), t;
|
|
1229
960
|
})();
|
|
1230
961
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
962
|
+
const K = ht;
|
|
963
|
+
K.Content = Ge;
|
|
964
|
+
K.Icon = Be;
|
|
965
|
+
K.Title = qe;
|
|
966
|
+
K.Status = Fe;
|
|
967
|
+
K.Value = rt;
|
|
968
|
+
K.SliderFill = Le;
|
|
969
|
+
var mt = /* @__PURE__ */ y('<span class="inline-flex size-3.5 shrink-0 items-center">'), vt = /* @__PURE__ */ y("<button type=button>"), xt = /* @__PURE__ */ y('<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">'), bt = /* @__PURE__ */ y('<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'), pt = /* @__PURE__ */ y('<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>'), wt = /* @__PURE__ */ y('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), yt = /* @__PURE__ */ y('<svg xmlns=http://www.w3.org/2000/svg class=size-3.5 fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2><path d="m8 2 1.88 1.88"></path><path d="M14.12 3.88 16 2"></path><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"></path><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"></path><path d="M12 20v-9"></path><path d="M6.53 9C4.6 8.8 3 7.1 3 5"></path><path d="M6 13H2"></path><path d="M3 21c0-2.1 1.7-3.9 3.8-4"></path><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"></path><path d="M22 13h-4"></path><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4">'), $t = /* @__PURE__ */ y('<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'), St = /* @__PURE__ */ y('<div class="min-w-0 shrink-0">'), kt = /* @__PURE__ */ y('<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">'), Ct = /* @__PURE__ */ y('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), Mt = /* @__PURE__ */ y('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
|
|
970
|
+
function Dt(e) {
|
|
1233
971
|
return (() => {
|
|
1234
|
-
var
|
|
1235
|
-
return
|
|
972
|
+
var t = vt();
|
|
973
|
+
return t.$$click = () => e.onClick(), p(t, M(j, {
|
|
1236
974
|
get when() {
|
|
1237
|
-
return
|
|
975
|
+
return e.isActive;
|
|
1238
976
|
},
|
|
1239
977
|
get children() {
|
|
1240
|
-
var r =
|
|
1241
|
-
return
|
|
978
|
+
var r = mt();
|
|
979
|
+
return p(r, () => e.icon), r;
|
|
1242
980
|
}
|
|
1243
|
-
}), null),
|
|
981
|
+
}), null), p(t, () => e.label, null), T(() => N(t, E("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;
|
|
1244
982
|
})();
|
|
1245
983
|
}
|
|
1246
|
-
function
|
|
1247
|
-
const [
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
...
|
|
984
|
+
function Ft(e) {
|
|
985
|
+
const [t] = Me(e, ["open", "onOpenChange", "title", "onSave", "hasUnsavedChanges", "onDelete", "editContent", "controlsContent", "debugContent", "debugData", "tabs", "class", "maxWidth", "defaultTab", "headerActions", "configSchema", "config", "onConfigSave", "ResponsiveDialog", "ResponsiveDialogContent", "ResponsiveDialogHeader", "ResponsiveDialogTitle", "ResponsiveDialogDescription", "Button", "SchemaForm"]), r = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [o, n] = U({}), [i, a] = U(null);
|
|
986
|
+
R(ue(() => t.config, (s) => {
|
|
987
|
+
s && n({
|
|
988
|
+
...s
|
|
1251
989
|
});
|
|
1252
|
-
})),
|
|
1253
|
-
|
|
990
|
+
})), R(ue(() => t.configSchema, (s) => {
|
|
991
|
+
s && a(me(s));
|
|
1254
992
|
}));
|
|
1255
|
-
const
|
|
1256
|
-
!
|
|
1257
|
-
...
|
|
1258
|
-
}),
|
|
1259
|
-
},
|
|
1260
|
-
|
|
1261
|
-
}, [
|
|
1262
|
-
const
|
|
993
|
+
const c = () => r() && JSON.stringify(o()) !== JSON.stringify(t.config), x = (s) => {
|
|
994
|
+
!s && t.config && n({
|
|
995
|
+
...t.config
|
|
996
|
+
}), t.onOpenChange(s);
|
|
997
|
+
}, w = () => {
|
|
998
|
+
t.onConfigSave?.(o());
|
|
999
|
+
}, [v, S] = U(t.defaultTab ?? "controls"), W = () => {
|
|
1000
|
+
const s = t.maxWidth ?? "3xl";
|
|
1263
1001
|
return {
|
|
1264
1002
|
sm: "max-w-sm",
|
|
1265
1003
|
md: "max-w-md",
|
|
@@ -1268,141 +1006,141 @@ function Qn(t) {
|
|
|
1268
1006
|
"2xl": "max-w-2xl",
|
|
1269
1007
|
"3xl": "max-w-3xl",
|
|
1270
1008
|
"4xl": "max-w-4xl"
|
|
1271
|
-
}[
|
|
1272
|
-
},
|
|
1273
|
-
if (
|
|
1274
|
-
const
|
|
1275
|
-
return
|
|
1009
|
+
}[s];
|
|
1010
|
+
}, g = () => {
|
|
1011
|
+
if (t.tabs) return t.tabs;
|
|
1012
|
+
const s = [];
|
|
1013
|
+
return s.push({
|
|
1276
1014
|
id: "edit",
|
|
1277
1015
|
label: "Edit",
|
|
1278
|
-
icon:
|
|
1279
|
-
content:
|
|
1016
|
+
icon: xt(),
|
|
1017
|
+
content: t.editContent ?? (r() && i() ? M(m, {
|
|
1280
1018
|
get schema() {
|
|
1281
|
-
return
|
|
1019
|
+
return i();
|
|
1282
1020
|
},
|
|
1283
1021
|
get data() {
|
|
1284
|
-
return
|
|
1022
|
+
return o();
|
|
1285
1023
|
},
|
|
1286
1024
|
onChange: n
|
|
1287
|
-
}) :
|
|
1288
|
-
}),
|
|
1025
|
+
}) : bt())
|
|
1026
|
+
}), s.push({
|
|
1289
1027
|
id: "controls",
|
|
1290
1028
|
label: "Controls",
|
|
1291
|
-
icon:
|
|
1292
|
-
content:
|
|
1293
|
-
}),
|
|
1029
|
+
icon: pt(),
|
|
1030
|
+
content: t.controlsContent ?? wt()
|
|
1031
|
+
}), s.push({
|
|
1294
1032
|
id: "debug",
|
|
1295
1033
|
label: "Debug",
|
|
1296
|
-
icon:
|
|
1297
|
-
content:
|
|
1298
|
-
}),
|
|
1299
|
-
},
|
|
1300
|
-
if (
|
|
1034
|
+
icon: yt(),
|
|
1035
|
+
content: t.debugContent ?? $t()
|
|
1036
|
+
}), s;
|
|
1037
|
+
}, f = async () => {
|
|
1038
|
+
if (t.debugData !== void 0)
|
|
1301
1039
|
try {
|
|
1302
|
-
const
|
|
1303
|
-
await navigator.clipboard.writeText(
|
|
1040
|
+
const s = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
|
|
1041
|
+
await navigator.clipboard.writeText(s);
|
|
1304
1042
|
} catch {
|
|
1305
1043
|
}
|
|
1306
|
-
},
|
|
1307
|
-
const
|
|
1308
|
-
return
|
|
1309
|
-
},
|
|
1310
|
-
return
|
|
1044
|
+
}, D = () => {
|
|
1045
|
+
const s = g();
|
|
1046
|
+
return s.find((O) => O.id === v())?.content ?? s[0]?.content;
|
|
1047
|
+
}, $ = t.ResponsiveDialog, C = t.ResponsiveDialogContent, I = t.ResponsiveDialogHeader, B = t.ResponsiveDialogTitle, u = t.ResponsiveDialogDescription, h = t.Button, m = t.SchemaForm, l = (s) => r() ? x(s) : t.onOpenChange(s), k = () => r() ? c() : t.hasUnsavedChanges, b = () => r() ? w : t.onSave;
|
|
1048
|
+
return M($, {
|
|
1311
1049
|
get open() {
|
|
1312
|
-
return
|
|
1050
|
+
return t.open;
|
|
1313
1051
|
},
|
|
1314
|
-
onOpenChange: (
|
|
1052
|
+
onOpenChange: (s) => l(s),
|
|
1315
1053
|
get children() {
|
|
1316
|
-
return
|
|
1054
|
+
return M(C, {
|
|
1317
1055
|
get class() {
|
|
1318
|
-
return
|
|
1056
|
+
return E(W(), t.class);
|
|
1319
1057
|
},
|
|
1320
1058
|
get children() {
|
|
1321
|
-
return [
|
|
1059
|
+
return [M(I, {
|
|
1322
1060
|
class: "flex flex-row items-center justify-between gap-3",
|
|
1323
1061
|
get children() {
|
|
1324
1062
|
return [(() => {
|
|
1325
|
-
var
|
|
1326
|
-
return
|
|
1063
|
+
var s = St();
|
|
1064
|
+
return p(s, M(B, {
|
|
1327
1065
|
class: "truncate leading-tight",
|
|
1328
1066
|
get children() {
|
|
1329
|
-
return
|
|
1067
|
+
return t.title;
|
|
1330
1068
|
}
|
|
1331
|
-
}), null),
|
|
1069
|
+
}), null), p(s, M(u, {
|
|
1332
1070
|
class: "sr-only",
|
|
1333
1071
|
children: "Widget configuration dialog"
|
|
1334
|
-
}), null),
|
|
1072
|
+
}), null), s;
|
|
1335
1073
|
})(), (() => {
|
|
1336
|
-
var
|
|
1337
|
-
return
|
|
1074
|
+
var s = kt(), z = s.firstChild;
|
|
1075
|
+
return p(z, () => g().map((O) => M(Dt, {
|
|
1338
1076
|
get icon() {
|
|
1339
|
-
return
|
|
1077
|
+
return O.icon;
|
|
1340
1078
|
},
|
|
1341
1079
|
get label() {
|
|
1342
|
-
return
|
|
1080
|
+
return O.label;
|
|
1343
1081
|
},
|
|
1344
1082
|
get isActive() {
|
|
1345
|
-
return
|
|
1083
|
+
return v() === O.id;
|
|
1346
1084
|
},
|
|
1347
|
-
onClick: () =>
|
|
1348
|
-
}))),
|
|
1085
|
+
onClick: () => S(O.id)
|
|
1086
|
+
}))), p(s, M(j, {
|
|
1349
1087
|
get when() {
|
|
1350
|
-
return
|
|
1088
|
+
return t.headerActions;
|
|
1351
1089
|
},
|
|
1352
1090
|
get children() {
|
|
1353
|
-
return
|
|
1091
|
+
return t.headerActions;
|
|
1354
1092
|
}
|
|
1355
|
-
}), null),
|
|
1093
|
+
}), null), s;
|
|
1356
1094
|
})()];
|
|
1357
1095
|
}
|
|
1358
1096
|
}), (() => {
|
|
1359
|
-
var
|
|
1360
|
-
return
|
|
1361
|
-
})(),
|
|
1097
|
+
var s = Ct();
|
|
1098
|
+
return p(s, D), s;
|
|
1099
|
+
})(), M(j, {
|
|
1362
1100
|
get when() {
|
|
1363
|
-
return _(() =>
|
|
1101
|
+
return _(() => v() === "edit")() && (b() || t.onDelete) || v() === "debug" && t.debugData !== void 0;
|
|
1364
1102
|
},
|
|
1365
1103
|
get children() {
|
|
1366
|
-
var
|
|
1367
|
-
return
|
|
1104
|
+
var s = Mt();
|
|
1105
|
+
return p(s, M(j, {
|
|
1368
1106
|
get when() {
|
|
1369
|
-
return _(() =>
|
|
1107
|
+
return _(() => v() === "edit")() && t.onDelete;
|
|
1370
1108
|
},
|
|
1371
1109
|
get children() {
|
|
1372
|
-
return
|
|
1110
|
+
return M(h, {
|
|
1373
1111
|
size: "sm",
|
|
1374
1112
|
variant: "destructive",
|
|
1375
|
-
onClick: () =>
|
|
1113
|
+
onClick: () => t.onDelete?.(),
|
|
1376
1114
|
children: "Delete"
|
|
1377
1115
|
});
|
|
1378
1116
|
}
|
|
1379
|
-
}), null),
|
|
1117
|
+
}), null), p(s, M(j, {
|
|
1380
1118
|
get when() {
|
|
1381
|
-
return _(() =>
|
|
1119
|
+
return _(() => v() === "edit")() && b();
|
|
1382
1120
|
},
|
|
1383
1121
|
get children() {
|
|
1384
|
-
return
|
|
1122
|
+
return M(h, {
|
|
1385
1123
|
size: "sm",
|
|
1386
1124
|
get disabled() {
|
|
1387
|
-
return !
|
|
1125
|
+
return !k();
|
|
1388
1126
|
},
|
|
1389
|
-
onClick: () =>
|
|
1127
|
+
onClick: () => b()?.(),
|
|
1390
1128
|
children: "Save"
|
|
1391
1129
|
});
|
|
1392
1130
|
}
|
|
1393
|
-
}), null),
|
|
1131
|
+
}), null), p(s, M(j, {
|
|
1394
1132
|
get when() {
|
|
1395
|
-
return _(() =>
|
|
1133
|
+
return _(() => v() === "debug")() && t.debugData !== void 0;
|
|
1396
1134
|
},
|
|
1397
1135
|
get children() {
|
|
1398
|
-
return
|
|
1136
|
+
return M(h, {
|
|
1399
1137
|
size: "sm",
|
|
1400
1138
|
variant: "outline",
|
|
1401
|
-
onClick:
|
|
1139
|
+
onClick: f,
|
|
1402
1140
|
children: "Copy"
|
|
1403
1141
|
});
|
|
1404
1142
|
}
|
|
1405
|
-
}), null),
|
|
1143
|
+
}), null), s;
|
|
1406
1144
|
}
|
|
1407
1145
|
})];
|
|
1408
1146
|
}
|
|
@@ -1410,124 +1148,157 @@ function Qn(t) {
|
|
|
1410
1148
|
}
|
|
1411
1149
|
});
|
|
1412
1150
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
return
|
|
1151
|
+
$e(["click"]);
|
|
1152
|
+
function Yt(e = "edit") {
|
|
1153
|
+
const [t, r] = U(!1), [o, n] = U(e);
|
|
1154
|
+
return {
|
|
1155
|
+
showDialog: t,
|
|
1156
|
+
setShowDialog: r,
|
|
1157
|
+
openDialog: () => r(!0),
|
|
1158
|
+
closeDialog: () => r(!1),
|
|
1159
|
+
activeTab: o,
|
|
1160
|
+
setActiveTab: n
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
function Kt(e) {
|
|
1164
|
+
const t = e.minEntities ?? 1, r = V(() => e.entities().length), o = V(() => r() >= t), n = V(() => !o() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), i = V(() => {
|
|
1165
|
+
if (!o()) return;
|
|
1166
|
+
const c = e.aggregationMode?.();
|
|
1167
|
+
if (!c || c === "none") return;
|
|
1168
|
+
const x = e.entities();
|
|
1169
|
+
if (c === "light" || c === "binary-sensor" || c === "switch")
|
|
1170
|
+
return Xe(x, e.allEntitiesMode);
|
|
1171
|
+
if (c === "sensor") {
|
|
1172
|
+
const w = e.sensorGroupType?.() ?? "mean";
|
|
1173
|
+
return Je(x, w, !0);
|
|
1174
|
+
}
|
|
1175
|
+
}), a = V(() => o() ? void 0 : e.emptyStateConfig);
|
|
1176
|
+
return {
|
|
1177
|
+
entities: e.entities,
|
|
1178
|
+
groupData: n,
|
|
1179
|
+
aggregatedData: i,
|
|
1180
|
+
emptyState: a,
|
|
1181
|
+
hasEntities: o,
|
|
1182
|
+
count: r
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
const J = 32, d = J / 2, P = "white", te = "rgba(0,0,0,0.4)", le = 2, ne = 3;
|
|
1186
|
+
function zt(e) {
|
|
1187
|
+
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
1417
1188
|
}
|
|
1418
|
-
function
|
|
1419
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
1189
|
+
function re(e) {
|
|
1190
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${J}" viewBox="0 0 ${J} ${J}">${e}</svg>`;
|
|
1420
1191
|
}
|
|
1421
|
-
const
|
|
1192
|
+
const _t = re(`
|
|
1422
1193
|
<g transform="translate(6, 2)">
|
|
1423
1194
|
<!-- shadow -->
|
|
1424
|
-
<g stroke="${
|
|
1195
|
+
<g stroke="${te}" stroke-width="${ne}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1425
1196
|
<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"/>
|
|
1426
1197
|
</g>
|
|
1427
1198
|
<!-- main -->
|
|
1428
|
-
<g stroke="${
|
|
1199
|
+
<g stroke="${P}" stroke-width="${le}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1429
1200
|
<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"/>
|
|
1430
1201
|
</g>
|
|
1431
1202
|
</g>
|
|
1432
|
-
`),
|
|
1203
|
+
`), Tt = re(`
|
|
1433
1204
|
<g>
|
|
1434
|
-
<circle cx="${
|
|
1435
|
-
<circle cx="${
|
|
1436
|
-
<circle cx="${
|
|
1205
|
+
<circle cx="${d}" cy="${d}" r="8" stroke="${te}" stroke-width="${ne}" fill="none"/>
|
|
1206
|
+
<circle cx="${d}" cy="${d}" r="8" stroke="${P}" stroke-width="1.5" fill="none"/>
|
|
1207
|
+
<circle cx="${d}" cy="${d}" r="1.5" fill="${P}"/>
|
|
1437
1208
|
</g>
|
|
1438
|
-
`),
|
|
1209
|
+
`), Et = re(`
|
|
1439
1210
|
<g>
|
|
1440
1211
|
<!-- shadow -->
|
|
1441
|
-
<g stroke="${
|
|
1442
|
-
<line x1="6" y1="${
|
|
1443
|
-
<polyline points="10,${
|
|
1444
|
-
<polyline points="22,${
|
|
1212
|
+
<g stroke="${te}" stroke-width="${ne}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1213
|
+
<line x1="6" y1="${d}" x2="26" y2="${d}"/>
|
|
1214
|
+
<polyline points="10,${d - 4} 6,${d} 10,${d + 4}"/>
|
|
1215
|
+
<polyline points="22,${d - 4} 26,${d} 22,${d + 4}"/>
|
|
1445
1216
|
</g>
|
|
1446
1217
|
<!-- main -->
|
|
1447
|
-
<g stroke="${
|
|
1448
|
-
<line x1="6" y1="${
|
|
1449
|
-
<polyline points="10,${
|
|
1450
|
-
<polyline points="22,${
|
|
1218
|
+
<g stroke="${P}" stroke-width="${le}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1219
|
+
<line x1="6" y1="${d}" x2="26" y2="${d}"/>
|
|
1220
|
+
<polyline points="10,${d - 4} 6,${d} 10,${d + 4}"/>
|
|
1221
|
+
<polyline points="22,${d - 4} 26,${d} 22,${d + 4}"/>
|
|
1451
1222
|
</g>
|
|
1452
1223
|
<!-- center grip dots -->
|
|
1453
|
-
<circle cx="${
|
|
1454
|
-
<circle cx="${
|
|
1455
|
-
<circle cx="${
|
|
1224
|
+
<circle cx="${d}" cy="${d}" r="1.5" fill="${P}"/>
|
|
1225
|
+
<circle cx="${d - 5}" cy="${d}" r="1" fill="${P}" opacity="0.6"/>
|
|
1226
|
+
<circle cx="${d + 5}" cy="${d}" r="1" fill="${P}" opacity="0.6"/>
|
|
1456
1227
|
</g>
|
|
1457
|
-
`),
|
|
1228
|
+
`), Ot = re(`
|
|
1458
1229
|
<g>
|
|
1459
1230
|
<!-- shadow -->
|
|
1460
|
-
<g stroke="${
|
|
1461
|
-
<line x1="${
|
|
1462
|
-
<polyline points="${
|
|
1463
|
-
<polyline points="${
|
|
1231
|
+
<g stroke="${te}" stroke-width="${ne}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1232
|
+
<line x1="${d}" y1="6" x2="${d}" y2="26"/>
|
|
1233
|
+
<polyline points="${d - 4},10 ${d},6 ${d + 4},10"/>
|
|
1234
|
+
<polyline points="${d - 4},22 ${d},26 ${d + 4},22"/>
|
|
1464
1235
|
</g>
|
|
1465
1236
|
<!-- main -->
|
|
1466
|
-
<g stroke="${
|
|
1467
|
-
<line x1="${
|
|
1468
|
-
<polyline points="${
|
|
1469
|
-
<polyline points="${
|
|
1237
|
+
<g stroke="${P}" stroke-width="${le}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1238
|
+
<line x1="${d}" y1="6" x2="${d}" y2="26"/>
|
|
1239
|
+
<polyline points="${d - 4},10 ${d},6 ${d + 4},10"/>
|
|
1240
|
+
<polyline points="${d - 4},22 ${d},26 ${d + 4},22"/>
|
|
1470
1241
|
</g>
|
|
1471
1242
|
<!-- center grip dots -->
|
|
1472
|
-
<circle cx="${
|
|
1473
|
-
<circle cx="${
|
|
1474
|
-
<circle cx="${
|
|
1243
|
+
<circle cx="${d}" cy="${d}" r="1.5" fill="${P}"/>
|
|
1244
|
+
<circle cx="${d}" cy="${d - 5}" r="1" fill="${P}" opacity="0.6"/>
|
|
1245
|
+
<circle cx="${d}" cy="${d + 5}" r="1" fill="${P}" opacity="0.6"/>
|
|
1475
1246
|
</g>
|
|
1476
1247
|
`);
|
|
1477
|
-
function
|
|
1478
|
-
return { css: `${
|
|
1479
|
-
}
|
|
1480
|
-
const
|
|
1481
|
-
tap:
|
|
1482
|
-
hold:
|
|
1483
|
-
slideHorizontal:
|
|
1484
|
-
slideVertical:
|
|
1248
|
+
function ee(e, t, r) {
|
|
1249
|
+
return { css: `${zt(e)} ${t} ${r}, auto`, hotspotX: t, hotspotY: r };
|
|
1250
|
+
}
|
|
1251
|
+
const G = {
|
|
1252
|
+
tap: ee(_t, 12, 4),
|
|
1253
|
+
hold: ee(Tt, 16, 16),
|
|
1254
|
+
slideHorizontal: ee(Et, d, d),
|
|
1255
|
+
slideVertical: ee(Ot, d, d)
|
|
1485
1256
|
};
|
|
1486
|
-
function
|
|
1257
|
+
function oe() {
|
|
1487
1258
|
if (typeof window > "u") return null;
|
|
1488
|
-
const
|
|
1489
|
-
return
|
|
1259
|
+
const e = window;
|
|
1260
|
+
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
1490
1261
|
}
|
|
1491
|
-
function
|
|
1262
|
+
function ae(e) {
|
|
1492
1263
|
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function"))
|
|
1493
1264
|
try {
|
|
1494
|
-
navigator.vibrate(
|
|
1265
|
+
navigator.vibrate(e);
|
|
1495
1266
|
} catch {
|
|
1496
1267
|
}
|
|
1497
1268
|
}
|
|
1498
|
-
const
|
|
1269
|
+
const Nt = {
|
|
1499
1270
|
/** Light confirmation — fires when slide gesture arms after user holds still. */
|
|
1500
1271
|
tick() {
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
|
|
1272
|
+
const e = oe();
|
|
1273
|
+
if (e) {
|
|
1274
|
+
e.impact({ style: "Light" }).catch(() => {
|
|
1504
1275
|
});
|
|
1505
1276
|
return;
|
|
1506
1277
|
}
|
|
1507
|
-
|
|
1278
|
+
ae(8);
|
|
1508
1279
|
},
|
|
1509
1280
|
/** Medium bump — fires when hold gesture commits (detail opening). */
|
|
1510
1281
|
bump() {
|
|
1511
|
-
const
|
|
1512
|
-
if (
|
|
1513
|
-
|
|
1282
|
+
const e = oe();
|
|
1283
|
+
if (e) {
|
|
1284
|
+
e.impact({ style: "Medium" }).catch(() => {
|
|
1514
1285
|
});
|
|
1515
1286
|
return;
|
|
1516
1287
|
}
|
|
1517
|
-
|
|
1288
|
+
ae(20);
|
|
1518
1289
|
},
|
|
1519
1290
|
/** Stronger pulse — reserved for edit-mode pickup (future use). */
|
|
1520
1291
|
pulse() {
|
|
1521
|
-
const
|
|
1522
|
-
if (
|
|
1523
|
-
|
|
1292
|
+
const e = oe();
|
|
1293
|
+
if (e) {
|
|
1294
|
+
e.impact({ style: "Heavy" }).catch(() => {
|
|
1524
1295
|
});
|
|
1525
1296
|
return;
|
|
1526
1297
|
}
|
|
1527
|
-
|
|
1298
|
+
ae([0, 15, 40, 15]);
|
|
1528
1299
|
}
|
|
1529
1300
|
};
|
|
1530
|
-
function
|
|
1301
|
+
function qt(e, t) {
|
|
1531
1302
|
const n = {
|
|
1532
1303
|
isDown: !1,
|
|
1533
1304
|
isTouch: !1,
|
|
@@ -1539,569 +1310,139 @@ function tr(t, e) {
|
|
|
1539
1310
|
holdTimer: null,
|
|
1540
1311
|
element: null
|
|
1541
1312
|
};
|
|
1542
|
-
let
|
|
1543
|
-
function
|
|
1544
|
-
|
|
1545
|
-
const
|
|
1546
|
-
if (
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1313
|
+
let i = null, a = null, c = null;
|
|
1314
|
+
function x(u) {
|
|
1315
|
+
u !== a && (c && c.disconnect(), c = new ResizeObserver((h) => {
|
|
1316
|
+
const m = h[0];
|
|
1317
|
+
if (m) {
|
|
1318
|
+
const l = m.borderBoxSize?.[0];
|
|
1319
|
+
l ? i = { width: l.inlineSize, height: l.blockSize } : i = { width: m.contentRect.width, height: m.contentRect.height };
|
|
1549
1320
|
}
|
|
1550
|
-
}),
|
|
1321
|
+
}), a = u, c.observe(u), i = { width: u.clientWidth, height: u.clientHeight });
|
|
1551
1322
|
}
|
|
1552
|
-
const
|
|
1323
|
+
const w = () => {
|
|
1553
1324
|
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null);
|
|
1554
|
-
},
|
|
1325
|
+
}, v = () => {
|
|
1555
1326
|
n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
|
|
1556
|
-
},
|
|
1557
|
-
const
|
|
1558
|
-
return
|
|
1559
|
-
},
|
|
1560
|
-
const
|
|
1561
|
-
if (!(!
|
|
1562
|
-
if (n.isDown = !0, n.isTouch =
|
|
1563
|
-
const
|
|
1327
|
+
}, S = (u) => {
|
|
1328
|
+
const m = e().slide;
|
|
1329
|
+
return m?.orientation === "horizontal" ? "horizontal" : m?.orientation === "vertical" ? "vertical" : u && (i || x(u), i) ? i.height > i.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1330
|
+
}, W = (u) => {
|
|
1331
|
+
const h = e();
|
|
1332
|
+
if (!(!h.tap && !h.hold && !h.slide)) {
|
|
1333
|
+
if (n.isDown = !0, n.isTouch = u.pointerType === "touch", n.element = u.currentTarget, x(n.element), n.startX = u.clientX, n.startY = u.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, h.hold) {
|
|
1334
|
+
const m = h.hold.delay ?? 500;
|
|
1564
1335
|
n.holdTimer = setTimeout(() => {
|
|
1565
|
-
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (
|
|
1566
|
-
},
|
|
1336
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Nt.bump(), h.hold?.action(), n.isDown = !1);
|
|
1337
|
+
}, m);
|
|
1567
1338
|
}
|
|
1568
|
-
if (!n.isTouch &&
|
|
1339
|
+
if (!n.isTouch && h.slide)
|
|
1569
1340
|
try {
|
|
1570
|
-
|
|
1341
|
+
u.currentTarget.setPointerCapture(u.pointerId);
|
|
1571
1342
|
} catch {
|
|
1572
1343
|
}
|
|
1573
1344
|
}
|
|
1574
|
-
},
|
|
1345
|
+
}, g = (u) => {
|
|
1575
1346
|
if (!n.isDown) return;
|
|
1576
|
-
const
|
|
1577
|
-
if (Math.sqrt(
|
|
1578
|
-
const
|
|
1347
|
+
const h = e(), m = u.clientX - n.startX, l = u.clientY - n.startY;
|
|
1348
|
+
if (Math.sqrt(m * m + l * l) > 10 && (w(), n.hasMoved = !0), !n.isTouch && h.slide && n.hasMoved) {
|
|
1349
|
+
const b = u.currentTarget, s = S(b);
|
|
1579
1350
|
n.sliding = !0;
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1351
|
+
const z = h.slide.min ?? 0, O = h.slide.max ?? 100, ve = O - z, xe = s === "vertical" ? -l : m, ce = i ?? { width: b.clientWidth, height: b.clientHeight }, be = s === "vertical" ? ce.height : ce.width, pe = xe / be * ve, we = Math.max(z, Math.min(O, h.slide.value + pe));
|
|
1352
|
+
h.slide.onChange(Math.round(we)), n.startX = u.clientX, n.startY = u.clientY, u.preventDefault();
|
|
1582
1353
|
}
|
|
1583
|
-
},
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1354
|
+
}, f = (u) => {
|
|
1355
|
+
const h = e(), m = n.isDown, l = Date.now() - n.startTime, k = h.hold?.delay ?? 500;
|
|
1356
|
+
w(), m && h.tap && !n.hasMoved && l < k && h.tap();
|
|
1586
1357
|
try {
|
|
1587
|
-
|
|
1358
|
+
u.currentTarget.releasePointerCapture(u.pointerId);
|
|
1588
1359
|
} catch {
|
|
1589
1360
|
}
|
|
1590
|
-
|
|
1591
|
-
},
|
|
1592
|
-
|
|
1361
|
+
v();
|
|
1362
|
+
}, D = (u) => {
|
|
1363
|
+
w();
|
|
1593
1364
|
try {
|
|
1594
|
-
|
|
1365
|
+
u.currentTarget.releasePointerCapture(u.pointerId);
|
|
1595
1366
|
} catch {
|
|
1596
1367
|
}
|
|
1597
|
-
|
|
1598
|
-
},
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
const
|
|
1602
|
-
return
|
|
1368
|
+
v();
|
|
1369
|
+
}, $ = (u) => {
|
|
1370
|
+
const h = e();
|
|
1371
|
+
if (h.slide) {
|
|
1372
|
+
const m = h.slide.orientation;
|
|
1373
|
+
return m === "horizontal" ? G.slideHorizontal.css : m === "vertical" ? G.slideVertical.css : (i || x(u), i && i.height > i.width ? G.slideVertical.css : G.slideHorizontal.css);
|
|
1603
1374
|
}
|
|
1604
|
-
return
|
|
1375
|
+
return h.tap ? G.tap.css : h.hold ? G.hold.css : "";
|
|
1605
1376
|
};
|
|
1606
1377
|
return {
|
|
1607
|
-
onPointerDown:
|
|
1608
|
-
onPointerMove:
|
|
1609
|
-
onPointerUp:
|
|
1610
|
-
onPointerCancel:
|
|
1611
|
-
onPointerEnter: (
|
|
1612
|
-
const
|
|
1613
|
-
n.element =
|
|
1378
|
+
onPointerDown: W,
|
|
1379
|
+
onPointerMove: g,
|
|
1380
|
+
onPointerUp: f,
|
|
1381
|
+
onPointerCancel: D,
|
|
1382
|
+
onPointerEnter: (u) => {
|
|
1383
|
+
const h = u.currentTarget;
|
|
1384
|
+
n.element = h, h.style.cursor = $(h);
|
|
1614
1385
|
},
|
|
1615
|
-
bindElement: (
|
|
1616
|
-
|
|
1386
|
+
bindElement: (u) => {
|
|
1387
|
+
u && (n.element = u, x(u));
|
|
1617
1388
|
},
|
|
1618
1389
|
touchAction: () => {
|
|
1619
|
-
const
|
|
1620
|
-
return
|
|
1390
|
+
const u = e();
|
|
1391
|
+
return u.tap || u.hold || u.slide ? "manipulation" : "auto";
|
|
1621
1392
|
},
|
|
1622
1393
|
dispose: () => {
|
|
1623
|
-
|
|
1394
|
+
w(), c && (c.disconnect(), c = null), a = null, i = null;
|
|
1624
1395
|
}
|
|
1625
1396
|
};
|
|
1626
1397
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
entity_id: i.id,
|
|
1636
|
-
state: i.state,
|
|
1637
|
-
domain: i.domain,
|
|
1638
|
-
friendly_name: i.friendlyName
|
|
1639
|
-
};
|
|
1640
|
-
return t.customEntityFields ? {
|
|
1641
|
-
...n,
|
|
1642
|
-
...t.customEntityFields(i)
|
|
1643
|
-
} : n;
|
|
1644
|
-
})
|
|
1645
|
-
};
|
|
1646
|
-
return t.additionalData && Object.assign(r, t.additionalData), r;
|
|
1647
|
-
});
|
|
1648
|
-
}
|
|
1649
|
-
function nr(t = {}) {
|
|
1650
|
-
const [e, r] = j(!1), [i, n] = j(!1);
|
|
1651
|
-
return {
|
|
1652
|
-
save: async (s) => {
|
|
1653
|
-
if (t.onSave) {
|
|
1654
|
-
r(!0);
|
|
1655
|
-
try {
|
|
1656
|
-
await t.onSave(s), t.onSaveSuccess?.();
|
|
1657
|
-
} finally {
|
|
1658
|
-
r(!1);
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
},
|
|
1662
|
-
remove: async () => {
|
|
1663
|
-
if (t.onDelete) {
|
|
1664
|
-
n(!0);
|
|
1665
|
-
try {
|
|
1666
|
-
await t.onDelete(), t.onDeleteSuccess?.();
|
|
1667
|
-
} finally {
|
|
1668
|
-
n(!1);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
},
|
|
1672
|
-
isSaving: e,
|
|
1673
|
-
isDeleting: i
|
|
1674
|
-
};
|
|
1675
|
-
}
|
|
1676
|
-
function rr(t = "edit") {
|
|
1677
|
-
const [e, r] = j(!1), [i, n] = j(t);
|
|
1678
|
-
return {
|
|
1679
|
-
showDialog: e,
|
|
1680
|
-
setShowDialog: r,
|
|
1681
|
-
openDialog: () => r(!0),
|
|
1682
|
-
closeDialog: () => r(!1),
|
|
1683
|
-
activeTab: i,
|
|
1684
|
-
setActiveTab: n
|
|
1685
|
-
};
|
|
1686
|
-
}
|
|
1687
|
-
function ir(t) {
|
|
1688
|
-
const e = N(() => t.entity() !== null), r = N(() => {
|
|
1689
|
-
const n = t.entity();
|
|
1690
|
-
return n ? t.calculateData(n) : null;
|
|
1691
|
-
}), i = N(() => e() ? void 0 : t.emptyStateConfig);
|
|
1692
|
-
return {
|
|
1693
|
-
entity: t.entity,
|
|
1694
|
-
data: r,
|
|
1695
|
-
emptyState: i,
|
|
1696
|
-
hasEntity: e
|
|
1697
|
-
};
|
|
1698
|
-
}
|
|
1699
|
-
function ar(t) {
|
|
1700
|
-
const e = t.minEntities ?? 1, r = N(() => t.entities().length), i = N(() => r() >= e), n = N(() => !i() || !t.calculateGroupData ? null : t.calculateGroupData(t.entities())), a = N(() => {
|
|
1701
|
-
if (!i()) return;
|
|
1702
|
-
const s = t.aggregationMode?.();
|
|
1703
|
-
if (!s || s === "none") return;
|
|
1704
|
-
const l = t.entities();
|
|
1705
|
-
if (s === "light" || s === "binary-sensor" || s === "switch")
|
|
1706
|
-
return Te(l, t.allEntitiesMode);
|
|
1707
|
-
if (s === "sensor") {
|
|
1708
|
-
const d = t.sensorGroupType?.() ?? "mean";
|
|
1709
|
-
return Ve(l, d, !0);
|
|
1710
|
-
}
|
|
1711
|
-
}), o = N(() => i() ? void 0 : t.emptyStateConfig);
|
|
1712
|
-
return {
|
|
1713
|
-
entities: t.entities,
|
|
1714
|
-
groupData: n,
|
|
1715
|
-
aggregatedData: a,
|
|
1716
|
-
emptyState: o,
|
|
1717
|
-
hasEntities: i,
|
|
1718
|
-
count: r
|
|
1719
|
-
};
|
|
1720
|
-
}
|
|
1721
|
-
function or(t) {
|
|
1722
|
-
const [e] = Ht({
|
|
1723
|
-
validate: Gt(t.schema),
|
|
1724
|
-
initialValues: t.initialValues
|
|
1725
|
-
}), r = N(() => e.dirty), i = N(() => e.submitting);
|
|
1726
|
-
return {
|
|
1727
|
-
form: e,
|
|
1728
|
-
isDirty: r,
|
|
1729
|
-
isSubmitting: i,
|
|
1730
|
-
handleSubmit: (a) => {
|
|
1731
|
-
t.onSubmit?.(a);
|
|
1732
|
-
},
|
|
1733
|
-
getValue: Bt,
|
|
1734
|
-
setValue: Lt,
|
|
1735
|
-
reset: Pt
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
const mt = ["xs", "sm", "md", "lg", "xl"];
|
|
1739
|
-
function sr() {
|
|
1740
|
-
const t = I(), e = N(() => mt.indexOf(t.size())), r = N(() => {
|
|
1741
|
-
const l = t.size();
|
|
1742
|
-
return l === "xs" || l === "sm";
|
|
1743
|
-
}), i = N(() => {
|
|
1744
|
-
const l = t.size();
|
|
1745
|
-
return l === "lg" || l === "xl";
|
|
1746
|
-
}), n = N(() => e() >= 2);
|
|
1747
|
-
return {
|
|
1748
|
-
isCompact: r,
|
|
1749
|
-
isLarge: i,
|
|
1750
|
-
showDetail: n,
|
|
1751
|
-
showOn: (l) => l.includes(t.size()),
|
|
1752
|
-
hideOn: (l) => !l.includes(t.size()),
|
|
1753
|
-
matches: (l) => {
|
|
1754
|
-
const d = l.trim();
|
|
1755
|
-
if (d.endsWith("+")) {
|
|
1756
|
-
const c = d.slice(0, -1), v = mt.indexOf(c);
|
|
1757
|
-
return v >= 0 && e() >= v;
|
|
1758
|
-
}
|
|
1759
|
-
if (d.endsWith("-")) {
|
|
1760
|
-
const c = d.slice(0, -1), v = mt.indexOf(c);
|
|
1761
|
-
return v >= 0 && e() <= v;
|
|
1762
|
-
}
|
|
1763
|
-
return t.size() === d;
|
|
1764
|
-
}
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
const D = {
|
|
1768
|
-
ocean: "bg-gradient-to-br from-cyan-600/20 to-blue-700/20",
|
|
1769
|
-
sunset: "bg-gradient-to-br from-orange-500/20 to-purple-700/20",
|
|
1770
|
-
forest: "bg-gradient-to-br from-emerald-600/20 to-teal-700/20",
|
|
1771
|
-
lavender: "bg-gradient-to-br from-purple-500/20 to-pink-500/20",
|
|
1772
|
-
golden: "bg-gradient-to-br from-yellow-500/20 to-orange-600/20",
|
|
1773
|
-
midnight: "bg-gradient-to-br from-blue-700/20 to-indigo-900/20",
|
|
1774
|
-
rose: "bg-gradient-to-br from-pink-400/20 to-red-500/20",
|
|
1775
|
-
mint: "bg-gradient-to-br from-green-400/20 to-cyan-500/20",
|
|
1776
|
-
slate: "bg-gradient-to-br from-slate-600/20 to-slate-800/20",
|
|
1777
|
-
coral: "bg-gradient-to-br from-pink-300/20 to-rose-400/20",
|
|
1778
|
-
aurora: "bg-gradient-to-br from-blue-500/20 to-cyan-400/20",
|
|
1779
|
-
ember: "bg-gradient-to-br from-red-500/20 to-yellow-500/20",
|
|
1780
|
-
steel: "bg-gradient-to-br from-gray-500/20 to-gray-700/20",
|
|
1781
|
-
twilight: "bg-gradient-to-br from-violet-600/20 to-indigo-700/20",
|
|
1782
|
-
sage: "bg-gradient-to-br from-lime-600/20 to-green-600/20",
|
|
1783
|
-
copper: "bg-gradient-to-br from-amber-600/20 to-amber-800/20",
|
|
1784
|
-
dusk: "bg-gradient-to-br from-blue-500/20 to-purple-600/20"
|
|
1785
|
-
}, lr = {
|
|
1786
|
-
ocean: "Ocean Breeze",
|
|
1787
|
-
sunset: "Sunset Glow",
|
|
1788
|
-
forest: "Forest Dawn",
|
|
1789
|
-
lavender: "Lavender Dreams",
|
|
1790
|
-
golden: "Golden Hour",
|
|
1791
|
-
midnight: "Deep Ocean",
|
|
1792
|
-
rose: "Rose Garden",
|
|
1793
|
-
mint: "Mint Fresh",
|
|
1794
|
-
slate: "Midnight",
|
|
1795
|
-
coral: "Cherry Blossom",
|
|
1796
|
-
aurora: "Electric Blue",
|
|
1797
|
-
ember: "Autumn Leaves",
|
|
1798
|
-
steel: "Steel",
|
|
1799
|
-
twilight: "Twilight",
|
|
1800
|
-
sage: "Sage",
|
|
1801
|
-
copper: "Copper",
|
|
1802
|
-
dusk: "Dusk"
|
|
1803
|
-
}, cr = Object.keys(D);
|
|
1804
|
-
function St(t) {
|
|
1805
|
-
const e = Object.keys(D);
|
|
1806
|
-
let r = 0;
|
|
1807
|
-
for (const n of t)
|
|
1808
|
-
r = (r << 5) - r + n.charCodeAt(0), r = r & r;
|
|
1809
|
-
const i = Math.abs(r) % e.length;
|
|
1810
|
-
return e[i];
|
|
1811
|
-
}
|
|
1812
|
-
function ur(t, e) {
|
|
1813
|
-
if (!t) {
|
|
1814
|
-
const i = St(e);
|
|
1815
|
-
return D[i];
|
|
1816
|
-
}
|
|
1817
|
-
if (typeof t == "string" && t in D)
|
|
1818
|
-
return D[t];
|
|
1819
|
-
if (typeof t == "string")
|
|
1820
|
-
return t;
|
|
1821
|
-
const r = St(e);
|
|
1822
|
-
return D[r];
|
|
1823
|
-
}
|
|
1824
|
-
const tt = {
|
|
1825
|
-
ocean: {
|
|
1826
|
-
gradient: D.ocean,
|
|
1827
|
-
bg: "bg-cyan-600/20",
|
|
1828
|
-
icon: "bg-cyan-500 dark:bg-cyan-400",
|
|
1829
|
-
glow: "shadow-cyan-500/50 dark:shadow-cyan-400/50",
|
|
1830
|
-
text: {
|
|
1831
|
-
primary: "text-cyan-400 dark:text-cyan-300",
|
|
1832
|
-
muted: "text-cyan-400/60 dark:text-cyan-300/60"
|
|
1833
|
-
}
|
|
1834
|
-
},
|
|
1835
|
-
sunset: {
|
|
1836
|
-
gradient: D.sunset,
|
|
1837
|
-
bg: "bg-orange-500/20",
|
|
1838
|
-
icon: "bg-orange-500 dark:bg-orange-400",
|
|
1839
|
-
glow: "shadow-orange-500/50 dark:shadow-orange-400/50",
|
|
1840
|
-
text: {
|
|
1841
|
-
primary: "text-orange-400 dark:text-orange-300",
|
|
1842
|
-
muted: "text-orange-400/60 dark:text-orange-300/60"
|
|
1843
|
-
}
|
|
1844
|
-
},
|
|
1845
|
-
forest: {
|
|
1846
|
-
gradient: D.forest,
|
|
1847
|
-
bg: "bg-emerald-600/20",
|
|
1848
|
-
icon: "bg-emerald-500 dark:bg-emerald-400",
|
|
1849
|
-
glow: "shadow-emerald-500/50 dark:shadow-emerald-400/50",
|
|
1850
|
-
text: {
|
|
1851
|
-
primary: "text-emerald-400 dark:text-emerald-300",
|
|
1852
|
-
muted: "text-emerald-400/60 dark:text-emerald-300/60"
|
|
1853
|
-
}
|
|
1854
|
-
},
|
|
1855
|
-
lavender: {
|
|
1856
|
-
gradient: D.lavender,
|
|
1857
|
-
bg: "bg-purple-500/20",
|
|
1858
|
-
icon: "bg-purple-500 dark:bg-purple-400",
|
|
1859
|
-
glow: "shadow-purple-500/50 dark:shadow-purple-400/50",
|
|
1860
|
-
text: {
|
|
1861
|
-
primary: "text-purple-400 dark:text-purple-300",
|
|
1862
|
-
muted: "text-purple-400/60 dark:text-purple-300/60"
|
|
1863
|
-
}
|
|
1864
|
-
},
|
|
1865
|
-
golden: {
|
|
1866
|
-
gradient: D.golden,
|
|
1867
|
-
bg: "bg-yellow-500/20",
|
|
1868
|
-
icon: "bg-yellow-500 dark:bg-yellow-400",
|
|
1869
|
-
glow: "shadow-yellow-500/50 dark:shadow-yellow-400/50",
|
|
1870
|
-
text: {
|
|
1871
|
-
primary: "text-yellow-400 dark:text-yellow-300",
|
|
1872
|
-
muted: "text-yellow-400/60 dark:text-yellow-300/60"
|
|
1873
|
-
}
|
|
1874
|
-
},
|
|
1875
|
-
midnight: {
|
|
1876
|
-
gradient: D.midnight,
|
|
1877
|
-
bg: "bg-blue-700/20",
|
|
1878
|
-
icon: "bg-blue-700 dark:bg-blue-600",
|
|
1879
|
-
glow: "shadow-blue-700/50 dark:shadow-blue-600/50",
|
|
1880
|
-
text: {
|
|
1881
|
-
primary: "text-blue-400 dark:text-blue-300",
|
|
1882
|
-
muted: "text-blue-400/60 dark:text-blue-300/60"
|
|
1883
|
-
}
|
|
1884
|
-
},
|
|
1885
|
-
rose: {
|
|
1886
|
-
gradient: D.rose,
|
|
1887
|
-
bg: "bg-pink-400/20",
|
|
1888
|
-
icon: "bg-pink-500 dark:bg-pink-400",
|
|
1889
|
-
glow: "shadow-pink-500/50 dark:shadow-pink-400/50",
|
|
1890
|
-
text: {
|
|
1891
|
-
primary: "text-pink-400 dark:text-pink-300",
|
|
1892
|
-
muted: "text-pink-400/60 dark:text-pink-300/60"
|
|
1893
|
-
}
|
|
1894
|
-
},
|
|
1895
|
-
mint: {
|
|
1896
|
-
gradient: D.mint,
|
|
1897
|
-
bg: "bg-green-400/20",
|
|
1898
|
-
icon: "bg-green-500 dark:bg-green-400",
|
|
1899
|
-
glow: "shadow-green-500/50 dark:shadow-green-400/50",
|
|
1900
|
-
text: {
|
|
1901
|
-
primary: "text-green-400 dark:text-green-300",
|
|
1902
|
-
muted: "text-green-400/60 dark:text-green-300/60"
|
|
1903
|
-
}
|
|
1904
|
-
},
|
|
1905
|
-
slate: {
|
|
1906
|
-
gradient: D.slate,
|
|
1907
|
-
bg: "bg-slate-600/20",
|
|
1908
|
-
icon: "bg-slate-600 dark:bg-slate-500",
|
|
1909
|
-
glow: "shadow-slate-600/50 dark:shadow-slate-500/50",
|
|
1910
|
-
text: {
|
|
1911
|
-
primary: "text-slate-400 dark:text-slate-300",
|
|
1912
|
-
muted: "text-slate-400/60 dark:text-slate-300/60"
|
|
1913
|
-
}
|
|
1914
|
-
},
|
|
1915
|
-
coral: {
|
|
1916
|
-
gradient: D.coral,
|
|
1917
|
-
bg: "bg-pink-300/20",
|
|
1918
|
-
icon: "bg-pink-400 dark:bg-pink-300",
|
|
1919
|
-
glow: "shadow-pink-400/50 dark:shadow-pink-300/50",
|
|
1920
|
-
text: {
|
|
1921
|
-
primary: "text-pink-400 dark:text-pink-300",
|
|
1922
|
-
muted: "text-pink-400/60 dark:text-pink-300/60"
|
|
1923
|
-
}
|
|
1924
|
-
},
|
|
1925
|
-
aurora: {
|
|
1926
|
-
gradient: D.aurora,
|
|
1927
|
-
bg: "bg-blue-500/20",
|
|
1928
|
-
icon: "bg-blue-500 dark:bg-blue-400",
|
|
1929
|
-
glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
|
|
1930
|
-
text: {
|
|
1931
|
-
primary: "text-blue-400 dark:text-blue-300",
|
|
1932
|
-
muted: "text-blue-400/60 dark:text-blue-300/60"
|
|
1933
|
-
}
|
|
1934
|
-
},
|
|
1935
|
-
ember: {
|
|
1936
|
-
gradient: D.ember,
|
|
1937
|
-
bg: "bg-red-500/20",
|
|
1938
|
-
icon: "bg-red-500 dark:bg-red-400",
|
|
1939
|
-
glow: "shadow-red-500/50 dark:shadow-red-400/50",
|
|
1940
|
-
text: {
|
|
1941
|
-
primary: "text-red-400 dark:text-red-300",
|
|
1942
|
-
muted: "text-red-400/60 dark:text-red-300/60"
|
|
1943
|
-
}
|
|
1944
|
-
},
|
|
1945
|
-
steel: {
|
|
1946
|
-
gradient: D.steel,
|
|
1947
|
-
bg: "bg-gray-500/20",
|
|
1948
|
-
icon: "bg-gray-500 dark:bg-gray-400",
|
|
1949
|
-
glow: void 0,
|
|
1950
|
-
text: {
|
|
1951
|
-
primary: "text-gray-400 dark:text-gray-300",
|
|
1952
|
-
muted: "text-gray-400/60 dark:text-gray-300/60"
|
|
1953
|
-
}
|
|
1954
|
-
},
|
|
1955
|
-
twilight: {
|
|
1956
|
-
gradient: D.twilight,
|
|
1957
|
-
bg: "bg-violet-600/20",
|
|
1958
|
-
icon: "bg-violet-500 dark:bg-violet-400",
|
|
1959
|
-
glow: "shadow-violet-500/50 dark:shadow-violet-400/50",
|
|
1960
|
-
text: {
|
|
1961
|
-
primary: "text-violet-400 dark:text-violet-300",
|
|
1962
|
-
muted: "text-violet-400/60 dark:text-violet-300/60"
|
|
1963
|
-
}
|
|
1964
|
-
},
|
|
1965
|
-
sage: {
|
|
1966
|
-
gradient: D.sage,
|
|
1967
|
-
bg: "bg-lime-600/20",
|
|
1968
|
-
icon: "bg-lime-500 dark:bg-lime-400",
|
|
1969
|
-
glow: "shadow-lime-500/50 dark:shadow-lime-400/50",
|
|
1970
|
-
text: {
|
|
1971
|
-
primary: "text-lime-400 dark:text-lime-300",
|
|
1972
|
-
muted: "text-lime-400/60 dark:text-lime-300/60"
|
|
1973
|
-
}
|
|
1974
|
-
},
|
|
1975
|
-
copper: {
|
|
1976
|
-
gradient: D.copper,
|
|
1977
|
-
bg: "bg-amber-600/20",
|
|
1978
|
-
icon: "bg-amber-600 dark:bg-amber-500",
|
|
1979
|
-
glow: "shadow-amber-600/50 dark:shadow-amber-500/50",
|
|
1980
|
-
text: {
|
|
1981
|
-
primary: "text-amber-400 dark:text-amber-300",
|
|
1982
|
-
muted: "text-amber-400/60 dark:text-amber-300/60"
|
|
1983
|
-
}
|
|
1984
|
-
},
|
|
1985
|
-
dusk: {
|
|
1986
|
-
gradient: D.dusk,
|
|
1987
|
-
bg: "bg-blue-500/20",
|
|
1988
|
-
icon: "bg-blue-500 dark:bg-blue-400",
|
|
1989
|
-
glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
|
|
1990
|
-
text: {
|
|
1991
|
-
primary: "text-blue-400 dark:text-blue-300",
|
|
1992
|
-
muted: "text-blue-400/60 dark:text-blue-300/60"
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
}, dr = {
|
|
1996
|
-
unavailable: tt.steel,
|
|
1997
|
-
active: tt.ocean,
|
|
1998
|
-
inactive: tt.steel,
|
|
1999
|
-
success: tt.forest,
|
|
2000
|
-
warning: tt.ember,
|
|
2001
|
-
error: tt.rose
|
|
2002
|
-
}, gr = {
|
|
1398
|
+
const Xt = L.enum([
|
|
1399
|
+
"success",
|
|
1400
|
+
"warning",
|
|
1401
|
+
"danger",
|
|
1402
|
+
"info",
|
|
1403
|
+
"neutral",
|
|
1404
|
+
"accent"
|
|
1405
|
+
]), Jt = {
|
|
2003
1406
|
/** Optional display name override (renders as text input) */
|
|
2004
|
-
title: () =>
|
|
1407
|
+
title: () => L.string().optional().meta({ title: "Title", description: "Optional display name override" }),
|
|
2005
1408
|
/** Multi-select entity picker for a HA domain */
|
|
2006
|
-
entityIds: (
|
|
1409
|
+
entityIds: (e) => L.array(L.string()).default([]).meta({ domain: e, title: "Entities" }),
|
|
2007
1410
|
/** Single-select entity picker for a HA domain */
|
|
2008
|
-
singleEntity: (
|
|
1411
|
+
singleEntity: (e) => L.array(L.string()).default([]).meta({ domain: e, title: "Entity", singleSelect: !0 }),
|
|
2009
1412
|
/** Area picker dropdown */
|
|
2010
|
-
areaId: () =>
|
|
1413
|
+
areaId: () => L.string().optional().meta({ formType: "area-picker", title: "Area" })
|
|
2011
1414
|
};
|
|
2012
|
-
|
|
2013
|
-
function kn() {
|
|
2014
|
-
return ft || (ft = getComputedStyle(document.documentElement)), ft;
|
|
2015
|
-
}
|
|
2016
|
-
function mr(t) {
|
|
2017
|
-
const e = t.startsWith("--") ? t : `--${t}`;
|
|
2018
|
-
return kn().getPropertyValue(e).trim();
|
|
2019
|
-
}
|
|
2020
|
-
function fr() {
|
|
1415
|
+
function Qt() {
|
|
2021
1416
|
return document.documentElement.classList.contains("dark");
|
|
2022
1417
|
}
|
|
2023
|
-
const
|
|
2024
|
-
version:
|
|
2025
|
-
},
|
|
1418
|
+
const Vt = "0.4.1", Pt = {
|
|
1419
|
+
version: Vt
|
|
1420
|
+
}, Zt = Pt.version;
|
|
2026
1421
|
export {
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
Pn as applyCssVars,
|
|
2054
|
-
Gn as applyLayout,
|
|
2055
|
-
bt as builtInVariants,
|
|
2056
|
-
Te as calculateLightGroup,
|
|
2057
|
-
Ve as calculateSensorGroup,
|
|
2058
|
-
Ft as classicGlass,
|
|
2059
|
-
k as cn,
|
|
2060
|
-
Yt as compactHorizontal,
|
|
2061
|
-
Hn as composeVariants,
|
|
2062
|
-
Kn as countActiveEntities,
|
|
2063
|
-
Yn as countAvailableEntities,
|
|
2064
|
-
Un as countEntitiesByState,
|
|
2065
|
-
Bn as createEmptyStateConfig,
|
|
2066
|
-
Tn as createEntity,
|
|
2067
|
-
Ln as createFlexLayout,
|
|
2068
|
-
Vn as defineWidget,
|
|
2069
|
-
xe as deriveAdaptiveIconColors,
|
|
2070
|
-
In as extendVariant,
|
|
2071
|
-
jt as extractDefaults,
|
|
2072
|
-
kr as formatSchemaError,
|
|
2073
|
-
Re as formatValue,
|
|
2074
|
-
Kt as getBuiltInVariant,
|
|
2075
|
-
Rn as getBuiltInVariantIds,
|
|
2076
|
-
Fn as getEntityAttribute,
|
|
2077
|
-
jn as getEntityState,
|
|
2078
|
-
ur as getGradient,
|
|
2079
|
-
St as getGradientFromString,
|
|
2080
|
-
ie as getSpacingClass,
|
|
2081
|
-
mr as getThemeToken,
|
|
2082
|
-
tt as gradientColorPresets,
|
|
2083
|
-
Ie as interpretValue,
|
|
2084
|
-
Wn as isBuiltInVariant,
|
|
2085
|
-
fr as isDark,
|
|
2086
|
-
We as isEntityActive,
|
|
2087
|
-
Ae as isEntityAvailable,
|
|
2088
|
-
xt as mergeVariants,
|
|
2089
|
-
Ut as minimal,
|
|
2090
|
-
Sr as parseGridSize,
|
|
2091
|
-
Cr as serializeGridSize,
|
|
2092
|
-
W as spacing,
|
|
2093
|
-
dr as stateColors,
|
|
2094
|
-
Mt as toFormSchema,
|
|
2095
|
-
F as typography,
|
|
2096
|
-
er as useDebugData,
|
|
2097
|
-
nr as useWidgetConfig,
|
|
2098
|
-
I as useWidgetContext,
|
|
2099
|
-
rr as useWidgetDialog,
|
|
2100
|
-
ir as useWidgetEntity,
|
|
2101
|
-
ar as useWidgetEntityGroup,
|
|
2102
|
-
or as useWidgetForm,
|
|
2103
|
-
tr as useWidgetGestures,
|
|
2104
|
-
sr as useWidgetResponsive,
|
|
2105
|
-
An as warnIfStub,
|
|
2106
|
-
gr as widgetFields
|
|
1422
|
+
Zt as SDK_VERSION,
|
|
1423
|
+
Xt as ToneSchema,
|
|
1424
|
+
K as Widget,
|
|
1425
|
+
Ge as WidgetContent,
|
|
1426
|
+
se as WidgetCtx,
|
|
1427
|
+
Ft as WidgetDialog,
|
|
1428
|
+
Be as WidgetIcon,
|
|
1429
|
+
nn as WidgetManifestSchema,
|
|
1430
|
+
Le as WidgetSliderFill,
|
|
1431
|
+
Fe as WidgetStatus,
|
|
1432
|
+
qe as WidgetTitle,
|
|
1433
|
+
rt as WidgetValue,
|
|
1434
|
+
Xe as calculateLightGroup,
|
|
1435
|
+
Je as calculateSensorGroup,
|
|
1436
|
+
jt as countActiveEntities,
|
|
1437
|
+
Ut as defineWidget,
|
|
1438
|
+
rn as formatSchemaError,
|
|
1439
|
+
Bt as getEntityAttribute,
|
|
1440
|
+
Ee as injectTokens,
|
|
1441
|
+
Qt as isDark,
|
|
1442
|
+
Qe as isEntityActive,
|
|
1443
|
+
Y as useWidgetContext,
|
|
1444
|
+
Yt as useWidgetDialog,
|
|
1445
|
+
Kt as useWidgetEntityGroup,
|
|
1446
|
+
qt as useWidgetGestures,
|
|
1447
|
+
Jt as widgetFields
|
|
2107
1448
|
};
|