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