@glasshome/widget-sdk 0.3.6 → 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/gestures/haptics.d.ts +19 -0
- package/dist/framework/gestures/use-widget-gestures.d.ts +19 -41
- 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 +1093 -1023
- 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 [t] =
|
|
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
11
|
return t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function ke(e) {
|
|
14
|
+
return j.toJSONSchema(e, {
|
|
15
15
|
override: (t) => {
|
|
16
|
-
const
|
|
17
|
-
return
|
|
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
23
|
return e.parse({});
|
|
24
24
|
} catch {
|
|
25
25
|
return {};
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return e.configSchema && (e.manifest.schema || (e.manifest.schema =
|
|
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 e =
|
|
43
|
+
const ue = Ee();
|
|
44
|
+
function P() {
|
|
45
|
+
const e = pe(ue);
|
|
46
46
|
if (!e)
|
|
47
47
|
throw new Error("useWidgetContext must be used within a Widget component");
|
|
48
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 Le = {
|
|
|
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 Le = {
|
|
|
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,41 +244,41 @@ const Le = {
|
|
|
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 e in
|
|
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
|
|
261
|
+
function $e(e, t) {
|
|
153
262
|
if (typeof e != "object" || e === null)
|
|
154
263
|
return t;
|
|
155
|
-
const
|
|
156
|
-
for (const
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
if (Array.isArray(
|
|
160
|
-
|
|
264
|
+
const r = { ...e };
|
|
265
|
+
for (const i in t) {
|
|
266
|
+
const n = t[i], a = e[i];
|
|
267
|
+
if (n !== void 0) {
|
|
268
|
+
if (Array.isArray(n)) {
|
|
269
|
+
r[i] = n;
|
|
161
270
|
continue;
|
|
162
271
|
}
|
|
163
|
-
if (typeof
|
|
164
|
-
typeof a == "object" && a !== null ?
|
|
272
|
+
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
273
|
+
typeof a == "object" && a !== null ? r[i] = $e(a, n) : r[i] = n;
|
|
165
274
|
continue;
|
|
166
275
|
}
|
|
167
|
-
|
|
276
|
+
r[i] = n;
|
|
168
277
|
}
|
|
169
278
|
}
|
|
170
|
-
return
|
|
279
|
+
return r;
|
|
171
280
|
}
|
|
172
|
-
function
|
|
281
|
+
function Xe(e, t) {
|
|
173
282
|
if (!(!e && !t))
|
|
174
283
|
return e ? t ? {
|
|
175
284
|
container: { ...e.container, ...t.container },
|
|
@@ -177,18 +286,18 @@ function Ye(e, t) {
|
|
|
177
286
|
cssVars: { ...e.cssVars, ...t.cssVars }
|
|
178
287
|
} : e : t;
|
|
179
288
|
}
|
|
180
|
-
function
|
|
289
|
+
function Je(e, t) {
|
|
181
290
|
return t ?? e;
|
|
182
291
|
}
|
|
183
|
-
function
|
|
292
|
+
function Ze(e, t) {
|
|
184
293
|
if (!(!e && !t))
|
|
185
294
|
return e ? t ? {
|
|
186
295
|
visible: { ...e.visible, ...t.visible },
|
|
187
|
-
styles:
|
|
296
|
+
styles: $e(e.styles ?? {}, t.styles ?? {}),
|
|
188
297
|
classNames: { ...e.classNames, ...t.classNames }
|
|
189
298
|
} : e : t;
|
|
190
299
|
}
|
|
191
|
-
function
|
|
300
|
+
function Qe(e, t) {
|
|
192
301
|
if (!(!e && !t))
|
|
193
302
|
return e ? t ? {
|
|
194
303
|
background: t.background ?? e.background,
|
|
@@ -196,7 +305,7 @@ function qe(e, t) {
|
|
|
196
305
|
decorations: t.decorations ?? e.decorations
|
|
197
306
|
} : e : t;
|
|
198
307
|
}
|
|
199
|
-
function
|
|
308
|
+
function et(e, t) {
|
|
200
309
|
if (!(!e && !t))
|
|
201
310
|
return e ? t ? {
|
|
202
311
|
hover: t.hover ?? e.hover,
|
|
@@ -206,87 +315,81 @@ function Je(e, t) {
|
|
|
206
315
|
activeScale: t.activeScale ?? e.activeScale
|
|
207
316
|
} : e : t;
|
|
208
317
|
}
|
|
209
|
-
function
|
|
318
|
+
function me(e, t) {
|
|
210
319
|
return {
|
|
211
320
|
id: t.id ?? e.id,
|
|
212
321
|
name: t.name ?? e.name,
|
|
213
322
|
description: t.description ?? e.description,
|
|
214
|
-
styles:
|
|
215
|
-
layout:
|
|
216
|
-
elements:
|
|
217
|
-
plugins:
|
|
218
|
-
interactions:
|
|
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),
|
|
219
328
|
extends: t.extends ?? e.extends
|
|
220
329
|
};
|
|
221
330
|
}
|
|
222
|
-
function
|
|
331
|
+
function On(e, t) {
|
|
223
332
|
return {
|
|
224
333
|
...t,
|
|
225
334
|
extends: e
|
|
226
335
|
};
|
|
227
336
|
}
|
|
228
|
-
function
|
|
337
|
+
function Vn(...e) {
|
|
229
338
|
if (e.length === 0)
|
|
230
339
|
throw new Error("composeVariants requires at least one variant");
|
|
231
|
-
return e.length === 1 ? e[0] : e.reduce((t,
|
|
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
|
|
345
|
+
function Wn(e, t) {
|
|
346
|
+
return me(e, {
|
|
238
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
353
|
direction: e,
|
|
245
354
|
align: t,
|
|
246
|
-
justify:
|
|
247
|
-
...
|
|
355
|
+
justify: r,
|
|
356
|
+
...i
|
|
248
357
|
};
|
|
249
358
|
}
|
|
250
|
-
var
|
|
251
|
-
function
|
|
252
|
-
const t =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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();
|
|
370
|
+
return z((a) => {
|
|
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
|
-
}),
|
|
262
|
-
})()
|
|
263
|
-
var i = Ze();
|
|
264
|
-
return D((a) => {
|
|
265
|
-
var o = S("pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), s = r(), l = n(), d = e.opacity ?? 0.3, c = U.BACKGROUND;
|
|
266
|
-
return o !== a.e && C(i, a.e = o), s !== a.t && z(i, "background", a.t = s), l !== a.a && z(i, "clip-path", a.a = l), d !== a.o && z(i, "opacity", a.o = d), c !== a.i && z(i, "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
|
-
}), i;
|
|
274
|
-
})()];
|
|
376
|
+
}), n;
|
|
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: (e) => `${
|
|
386
|
+
S1: (e) => `${ee.S1[e]}px`,
|
|
284
387
|
/** Small spacing (6-14px) - default for most layouts */
|
|
285
|
-
S2: (e) => `${
|
|
388
|
+
S2: (e) => `${ee.S2[e]}px`,
|
|
286
389
|
/** Medium spacing (8-16px) */
|
|
287
|
-
S3: (e) => `${
|
|
390
|
+
S3: (e) => `${ee.S3[e]}px`,
|
|
288
391
|
/** Large spacing (12-20px) */
|
|
289
|
-
S4: (e) => `${
|
|
392
|
+
S4: (e) => `${ee.S4[e]}px`,
|
|
290
393
|
/** Icon container size in pixels */
|
|
291
394
|
icon: (e) => ({
|
|
292
395
|
xs: 32,
|
|
@@ -337,7 +440,7 @@ const re = {
|
|
|
337
440
|
// More padding for larger widgets
|
|
338
441
|
xl: "20px"
|
|
339
442
|
})[e]
|
|
340
|
-
},
|
|
443
|
+
}, rt = {
|
|
341
444
|
4: "gap-1",
|
|
342
445
|
6: "gap-1.5",
|
|
343
446
|
8: "gap-2",
|
|
@@ -348,33 +451,33 @@ const re = {
|
|
|
348
451
|
18: "gap-[18px]",
|
|
349
452
|
20: "gap-5"
|
|
350
453
|
};
|
|
351
|
-
function
|
|
352
|
-
const
|
|
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 t =
|
|
458
|
+
var at = /* @__PURE__ */ v("<div>");
|
|
459
|
+
function ot(e) {
|
|
460
|
+
const t = P();
|
|
358
461
|
return (() => {
|
|
359
|
-
var
|
|
360
|
-
return
|
|
361
|
-
var
|
|
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
468
|
t.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
|
|
366
|
-
|
|
469
|
+
it("S3", t.size()),
|
|
367
470
|
e.class
|
|
368
|
-
), a = W.container(t.size()), o =
|
|
369
|
-
return
|
|
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,
|
|
373
476
|
a: void 0
|
|
374
|
-
}),
|
|
477
|
+
}), r;
|
|
375
478
|
})();
|
|
376
479
|
}
|
|
377
|
-
const
|
|
480
|
+
const G = {
|
|
378
481
|
/** Container base text sizing */
|
|
379
482
|
container: (e) => ({
|
|
380
483
|
xs: "text-xs",
|
|
@@ -488,279 +591,203 @@ const F = {
|
|
|
488
591
|
// 16px
|
|
489
592
|
})[e]
|
|
490
593
|
};
|
|
491
|
-
var
|
|
492
|
-
function
|
|
493
|
-
const t =
|
|
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
|
|
496
|
-
return
|
|
598
|
+
var i = st(), n = i.firstChild;
|
|
599
|
+
return h(i, (() => {
|
|
497
600
|
var a = E(() => !!e.icon);
|
|
498
601
|
return () => a() && (() => {
|
|
499
|
-
var o =
|
|
500
|
-
return
|
|
501
|
-
var l =
|
|
502
|
-
return l !== s.e &&
|
|
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
|
-
})(),
|
|
612
|
+
})(), n), h(n, (() => {
|
|
510
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 &&
|
|
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),
|
|
624
|
+
})(), null), h(n, (() => {
|
|
522
625
|
var a = E(() => !!e.message);
|
|
523
626
|
return () => a() && (() => {
|
|
524
|
-
var o =
|
|
525
|
-
return
|
|
526
|
-
var l =
|
|
527
|
-
return l !== s.e &&
|
|
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),
|
|
636
|
+
})(), null), h(n, (() => {
|
|
534
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
|
-
})(), null),
|
|
540
|
-
var o =
|
|
541
|
-
return o !== a.e &&
|
|
642
|
+
})(), null), z((a) => {
|
|
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,
|
|
545
648
|
a: void 0,
|
|
546
649
|
o: void 0,
|
|
547
650
|
i: void 0
|
|
548
|
-
}),
|
|
651
|
+
}), i;
|
|
549
652
|
})();
|
|
550
653
|
}
|
|
551
|
-
|
|
552
|
-
const t = e.match(/hsl\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*\)/);
|
|
553
|
-
return t ? { h: Number(t[1]), s: Number(t[2]), l: Number(t[3]) } : null;
|
|
554
|
-
}
|
|
555
|
-
function gt(e) {
|
|
556
|
-
const t = e.match(/rgb\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)/);
|
|
557
|
-
return t ? Me(Number(t[1]), Number(t[2]), Number(t[3])) : null;
|
|
558
|
-
}
|
|
559
|
-
function mt(e) {
|
|
560
|
-
const t = e.match(/^#([0-9a-f]{3,8})$/i);
|
|
561
|
-
if (!t) return null;
|
|
562
|
-
let n = t[1];
|
|
563
|
-
n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]);
|
|
564
|
-
const r = Number.parseInt(n.slice(0, 2), 16), i = Number.parseInt(n.slice(2, 4), 16), a = Number.parseInt(n.slice(4, 6), 16);
|
|
565
|
-
return Me(r, i, a);
|
|
566
|
-
}
|
|
567
|
-
function Me(e, t, n) {
|
|
568
|
-
e /= 255, t /= 255, n /= 255;
|
|
569
|
-
const r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
570
|
-
if (r === i) return { h: 0, s: 0, l: a * 100 };
|
|
571
|
-
const o = r - i, s = a > 0.5 ? o / (2 - r - i) : o / (r + i);
|
|
572
|
-
let l = 0;
|
|
573
|
-
return r === e ? l = ((t - n) / o + (t < n ? 6 : 0)) / 6 : r === t ? l = ((n - e) / o + 2) / 6 : l = ((e - t) / o + 4) / 6, { h: l * 360, s: s * 100, l: a * 100 };
|
|
574
|
-
}
|
|
654
|
+
var mt = /* @__PURE__ */ v('<div><div class="flex items-center justify-center">'), ve = /* @__PURE__ */ v('<div class="glasshome-widget-icon absolute">');
|
|
575
655
|
function ft(e) {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
function ye(e, t, n, r) {
|
|
579
|
-
const i = Math.round(e), a = Math.round(Math.min(100, Math.max(0, t))), o = Math.round(Math.min(100, Math.max(0, n)));
|
|
580
|
-
return r !== void 0 && r < 1 ? `hsla(${i}, ${a}%, ${o}%, ${r})` : `hsl(${i}, ${a}%, ${o}%)`;
|
|
581
|
-
}
|
|
582
|
-
function ht(e) {
|
|
583
|
-
const t = ft(e);
|
|
584
|
-
if (!t) return null;
|
|
585
|
-
const { h: n, s: r, l: i } = t;
|
|
586
|
-
let a, o = Math.min(r + 10, 100);
|
|
587
|
-
i < 25 ? (a = i + 12, o = Math.min(r + 15, 100)) : i < 40 ? a = Math.max(i - 8, 15) : a = Math.max(18, i * 0.3), r < 15 && (o = 10, a = Math.max(a, 20));
|
|
588
|
-
const s = ye(n, o, a, 0.85), l = ye(n, Math.min(r, 90), Math.min(i, 55), 0.5);
|
|
589
|
-
return { background: s, glow: l };
|
|
590
|
-
}
|
|
591
|
-
var xt = /* @__PURE__ */ w('<div><div class="flex items-center justify-center text-foreground">'), we = /* @__PURE__ */ w("<div>");
|
|
592
|
-
function vt(e) {
|
|
593
|
-
const t = G(), n = () => e.dynamicColor ? ht(e.dynamicColor) : null, r = () => !!n(), i = () => {
|
|
594
|
-
const l = n();
|
|
595
|
-
if (l)
|
|
596
|
-
return {
|
|
597
|
-
"background-color": l.background
|
|
598
|
-
};
|
|
599
|
-
}, a = () => {
|
|
600
|
-
const l = n();
|
|
601
|
-
if (l)
|
|
602
|
-
return {
|
|
603
|
-
"box-shadow": `0 0 25px ${l.glow}`
|
|
604
|
-
};
|
|
605
|
-
}, o = () => {
|
|
606
|
-
const l = {
|
|
656
|
+
const t = P(), r = () => {
|
|
657
|
+
const n = {
|
|
607
658
|
width: `${W.icon(t.size())}px`,
|
|
608
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
|
-
}, M = i();
|
|
622
|
-
return M && Object.assign(y, M), y;
|
|
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
|
|
631
|
-
var f = S("absolute", !r() && (e.color ?? "bg-foreground/10")), v = s(0.14, -2, 0.45);
|
|
632
|
-
return f !== M.e && C(y, M.e = f), M.t = se(y, v, M.t), M;
|
|
633
|
-
}, {
|
|
634
|
-
e: void 0,
|
|
635
|
-
t: void 0
|
|
636
|
-
}), y;
|
|
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
|
|
643
|
-
var f = S("absolute", !r() && (e.color ?? "bg-foreground/10")), v = s(0.28, -3, 0.2);
|
|
644
|
-
return f !== M.e && C(y, M.e = f), M.t = se(y, v, M.t), M;
|
|
645
|
-
}, {
|
|
646
|
-
e: void 0,
|
|
647
|
-
t: void 0
|
|
648
|
-
}), y;
|
|
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
|
-
e.dimmed && "opacity-50",
|
|
655
|
-
// Only apply Tailwind classes when not using dynamic colors
|
|
656
|
-
!r() && e.glow && "shadow-[0_0_25px_var(--tw-shadow-color,transparent)]",
|
|
657
|
-
!r() && (e.color ?? "bg-foreground/10"),
|
|
658
|
-
!r() && e.glow,
|
|
659
|
-
e.class
|
|
660
|
-
), M = o(), f = `${W.iconSize(t.size())}px`;
|
|
661
|
-
return y !== c.e && C(l, c.e = y), c.t = se(l, M, c.t), f !== c.a && z(d, "font-size", c.a = f), 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 t =
|
|
672
|
-
const
|
|
673
|
-
return
|
|
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
|
|
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 t =
|
|
707
|
+
function yt(e) {
|
|
708
|
+
const t = P();
|
|
682
709
|
return (() => {
|
|
683
|
-
var
|
|
684
|
-
return
|
|
710
|
+
var r = xt(), i = r.firstChild, n = i.firstChild, a = i.nextSibling;
|
|
711
|
+
return h(i, (() => {
|
|
685
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
|
-
})(),
|
|
717
|
+
})(), n), h(n, () => e.label), h(a, () => e.value, null), h(a, (() => {
|
|
691
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
|
-
})(), null),
|
|
697
|
-
var s =
|
|
698
|
-
return s !== o.e &&
|
|
723
|
+
})(), null), z((o) => {
|
|
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,
|
|
702
729
|
a: void 0,
|
|
703
730
|
o: void 0
|
|
704
|
-
}),
|
|
731
|
+
}), r;
|
|
705
732
|
})();
|
|
706
733
|
}
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
var pt = /* @__PURE__ */
|
|
710
|
-
function
|
|
711
|
-
const t =
|
|
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
|
|
714
|
-
return
|
|
715
|
-
var
|
|
716
|
-
return () =>
|
|
717
|
-
})()),
|
|
718
|
-
var
|
|
719
|
-
return
|
|
740
|
+
var r = pt();
|
|
741
|
+
return h(r, (() => {
|
|
742
|
+
var i = E(() => !!e.isUnavailable);
|
|
743
|
+
return () => i() ? "Unavailable" : e.children;
|
|
744
|
+
})()), z((i) => {
|
|
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 t =
|
|
753
|
+
var $t = /* @__PURE__ */ v("<p>");
|
|
754
|
+
function St(e) {
|
|
755
|
+
const t = P();
|
|
729
756
|
return (() => {
|
|
730
|
-
var
|
|
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 t =
|
|
761
|
+
var Ct = /* @__PURE__ */ v("<div><h3>"), Dt = /* @__PURE__ */ v("<span>");
|
|
762
|
+
function zt(e) {
|
|
763
|
+
const t = P();
|
|
737
764
|
return (() => {
|
|
738
|
-
var
|
|
739
|
-
return
|
|
740
|
-
var
|
|
741
|
-
return () =>
|
|
742
|
-
var a =
|
|
743
|
-
return
|
|
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);
|
|
768
|
+
return () => n() && (() => {
|
|
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
|
-
})(), null),
|
|
746
|
-
var a =
|
|
747
|
-
return a !==
|
|
772
|
+
})(), null), z((n) => {
|
|
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,
|
|
751
778
|
a: void 0,
|
|
752
779
|
o: void 0
|
|
753
|
-
}),
|
|
780
|
+
}), r;
|
|
754
781
|
})();
|
|
755
782
|
}
|
|
756
|
-
function
|
|
783
|
+
function In(e) {
|
|
757
784
|
return {
|
|
758
785
|
icon: e.icon,
|
|
759
786
|
title: e.title,
|
|
760
787
|
message: e.message || `Configure this widget to add ${e.entityType || "an entity"}`
|
|
761
788
|
};
|
|
762
789
|
}
|
|
763
|
-
function
|
|
790
|
+
function Mt(e, t = !1) {
|
|
764
791
|
if (e.length === 0)
|
|
765
792
|
return {
|
|
766
793
|
isGroup: !1,
|
|
@@ -774,31 +801,31 @@ function At(e, t = !1) {
|
|
|
774
801
|
totalCount: 0,
|
|
775
802
|
description: "No entities"
|
|
776
803
|
};
|
|
777
|
-
const
|
|
778
|
-
if (!
|
|
779
|
-
const
|
|
804
|
+
const r = e.length > 1;
|
|
805
|
+
if (!r) {
|
|
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
|
-
let
|
|
794
|
-
const
|
|
795
|
-
for (const
|
|
796
|
-
switch (
|
|
820
|
+
let i = 0, n = 0, a = 0, o = 0, s = 0, l = 0;
|
|
821
|
+
const g = [];
|
|
822
|
+
for (const y of e)
|
|
823
|
+
switch (y.state) {
|
|
797
824
|
case "on":
|
|
798
|
-
|
|
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++;
|
|
802
829
|
break;
|
|
803
830
|
case "unknown":
|
|
804
831
|
a++;
|
|
@@ -807,31 +834,31 @@ function At(e, t = !1) {
|
|
|
807
834
|
o++;
|
|
808
835
|
break;
|
|
809
836
|
}
|
|
810
|
-
const
|
|
811
|
-
let
|
|
812
|
-
t ?
|
|
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
|
|
822
|
-
isGroup:
|
|
823
|
-
state:
|
|
824
|
-
isOn:
|
|
825
|
-
isUnavailable:
|
|
826
|
-
brightness:
|
|
827
|
-
brightnessPercent:
|
|
828
|
-
color:
|
|
829
|
-
onCount:
|
|
830
|
-
totalCount:
|
|
831
|
-
description:
|
|
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", {
|
|
849
|
+
isGroup: r,
|
|
850
|
+
state: D,
|
|
851
|
+
isOn: T,
|
|
852
|
+
isUnavailable: D === "unavailable",
|
|
853
|
+
brightness: F,
|
|
854
|
+
brightnessPercent: q,
|
|
855
|
+
color: f,
|
|
856
|
+
onCount: i,
|
|
857
|
+
totalCount: m,
|
|
858
|
+
description: b
|
|
832
859
|
};
|
|
833
860
|
}
|
|
834
|
-
function
|
|
861
|
+
function _t(e, t = "mean", r = !0) {
|
|
835
862
|
if (e.length === 0)
|
|
836
863
|
return {
|
|
837
864
|
isGroup: !1,
|
|
@@ -840,45 +867,45 @@ function Nt(e, t = "mean", n = !0) {
|
|
|
840
867
|
isUnavailable: !0,
|
|
841
868
|
description: "No entities"
|
|
842
869
|
};
|
|
843
|
-
const
|
|
844
|
-
if (!
|
|
845
|
-
const
|
|
846
|
-
let
|
|
847
|
-
return Number.isNaN(
|
|
870
|
+
const i = e.length > 1;
|
|
871
|
+
if (!i) {
|
|
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
|
-
const
|
|
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
|
-
}) : (
|
|
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 === e.length,
|
|
879
|
-
if (l ||
|
|
905
|
+
const l = o === e.length, g = n.length === 0;
|
|
906
|
+
if (l || g)
|
|
880
907
|
return {
|
|
881
|
-
isGroup:
|
|
908
|
+
isGroup: i,
|
|
882
909
|
state: l ? "unavailable" : "unknown",
|
|
883
910
|
numericValue: null,
|
|
884
911
|
isUnavailable: l,
|
|
@@ -886,68 +913,68 @@ function Nt(e, t = "mean", n = !0) {
|
|
|
886
913
|
description: l ? "Unavailable" : "No numeric values",
|
|
887
914
|
memberValues: a
|
|
888
915
|
};
|
|
889
|
-
let
|
|
916
|
+
let m, k;
|
|
890
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
|
-
isGroup:
|
|
928
|
-
state:
|
|
929
|
-
numericValue:
|
|
954
|
+
isGroup: i,
|
|
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
|
|
963
|
+
function we(e) {
|
|
937
964
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
938
|
-
const
|
|
965
|
+
const r = (e.attributes?.brightness ?? 255) / 255;
|
|
939
966
|
if (e.attributes?.rgb_color) {
|
|
940
|
-
const [
|
|
941
|
-
return `rgb(${Math.round(
|
|
967
|
+
const [i, n, a] = e.attributes.rgb_color;
|
|
968
|
+
return `rgb(${Math.round(i * r)}, ${Math.round(n * r)}, ${Math.round(a * r)})`;
|
|
942
969
|
}
|
|
943
970
|
if (e.attributes?.color_temp) {
|
|
944
|
-
const
|
|
971
|
+
const n = 1e6 / e.attributes.color_temp / 100;
|
|
945
972
|
let a, o, s;
|
|
946
|
-
return
|
|
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
|
-
return `rgb(${Math.round(255 *
|
|
975
|
+
return `rgb(${Math.round(255 * r)}, ${Math.round(220 * r)}, ${Math.round(180 * r)})`;
|
|
949
976
|
}
|
|
950
|
-
function
|
|
977
|
+
function Et(e) {
|
|
951
978
|
return e ? e.state !== "unavailable" && e.state !== "unknown" : !1;
|
|
952
979
|
}
|
|
953
980
|
function Tt(e) {
|
|
@@ -960,162 +987,165 @@ function Tt(e) {
|
|
|
960
987
|
}
|
|
961
988
|
return !1;
|
|
962
989
|
}
|
|
963
|
-
function
|
|
990
|
+
function Pn(e, t = "unknown") {
|
|
964
991
|
return e?.state ?? t;
|
|
965
992
|
}
|
|
966
|
-
function Ln(e, t,
|
|
967
|
-
return e?.attributes ? e.attributes[t] ??
|
|
993
|
+
function Ln(e, t, r) {
|
|
994
|
+
return e?.attributes ? e.attributes[t] ?? r : r;
|
|
968
995
|
}
|
|
969
|
-
function
|
|
970
|
-
return e.filter((
|
|
996
|
+
function Rn(e, t) {
|
|
997
|
+
return e.filter((r) => r.state === t).length;
|
|
971
998
|
}
|
|
972
|
-
function
|
|
973
|
-
return e.filter(
|
|
999
|
+
function Hn(e) {
|
|
1000
|
+
return e.filter(Et).length;
|
|
974
1001
|
}
|
|
975
|
-
function
|
|
1002
|
+
function Gn(e) {
|
|
976
1003
|
return e.filter(Tt).length;
|
|
977
1004
|
}
|
|
978
|
-
function
|
|
979
|
-
return e.length > 0 && e.every((
|
|
1005
|
+
function jn(e, t) {
|
|
1006
|
+
return e.length > 0 && e.every((r) => r.state === t);
|
|
980
1007
|
}
|
|
981
|
-
function
|
|
982
|
-
return e.some((
|
|
1008
|
+
function Bn(e, t) {
|
|
1009
|
+
return e.some((r) => r.state === t);
|
|
983
1010
|
}
|
|
984
|
-
function
|
|
985
|
-
const { decimals:
|
|
1011
|
+
function Ot(e, t, r) {
|
|
1012
|
+
const { decimals: i, scale: n = !0 } = r || {};
|
|
986
1013
|
if (typeof e == "string")
|
|
987
1014
|
return t ? `${e}${t}` : e;
|
|
988
1015
|
if (e == null || Number.isNaN(e))
|
|
989
1016
|
return t ? `--${t}` : "--";
|
|
990
1017
|
let a = e, o = t || "";
|
|
991
|
-
|
|
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
|
|
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
|
|
1022
|
+
function Vt(e, t) {
|
|
996
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 t =
|
|
1025
|
+
var Nt = /* @__PURE__ */ v("<div><div>"), Wt = /* @__PURE__ */ v("<div>");
|
|
1026
|
+
function At(e) {
|
|
1027
|
+
const t = P();
|
|
1001
1028
|
return (() => {
|
|
1002
|
-
var
|
|
1003
|
-
return
|
|
1004
|
-
var
|
|
1005
|
-
return () =>
|
|
1006
|
-
var a =
|
|
1007
|
-
return
|
|
1008
|
-
var s =
|
|
1009
|
-
return s !== o.e &&
|
|
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"));
|
|
1032
|
+
return () => n() && (() => {
|
|
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
|
-
})(), null),
|
|
1016
|
-
var a =
|
|
1017
|
-
return a !==
|
|
1042
|
+
})(), null), z((n) => {
|
|
1043
|
+
var a = $("flex flex-col", e.class), o = $("font-bold text-foreground", G.value(t.size()));
|
|
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,
|
|
1020
1047
|
t: void 0
|
|
1021
|
-
}),
|
|
1048
|
+
}), r;
|
|
1022
1049
|
})();
|
|
1023
1050
|
}
|
|
1024
|
-
var
|
|
1025
|
-
function
|
|
1026
|
-
const
|
|
1027
|
-
return
|
|
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;
|
|
1054
|
+
return r <= 2 ? "xs" : r <= 4 ? "sm" : r <= 8 ? "md" : r <= 18 ? "lg" : "xl";
|
|
1028
1055
|
}
|
|
1029
|
-
function
|
|
1056
|
+
function Bt(e, t) {
|
|
1030
1057
|
return e > t ? "horizontal" : t > e ? "vertical" : "square";
|
|
1031
1058
|
}
|
|
1032
|
-
function
|
|
1059
|
+
function Ft(e, t) {
|
|
1033
1060
|
return t >= 150 ? "vertical" : e > t ? "horizontal" : t > e ? "vertical" : "square";
|
|
1034
1061
|
}
|
|
1035
|
-
function
|
|
1062
|
+
function Ut(e) {
|
|
1063
|
+
Te(() => {
|
|
1064
|
+
Fe();
|
|
1065
|
+
});
|
|
1036
1066
|
let t;
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
const
|
|
1040
|
-
(Math.abs(
|
|
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 =
|
|
1072
|
+
const l = M(() => {
|
|
1043
1073
|
if (e.variant)
|
|
1044
|
-
return typeof e.variant == "string" ?
|
|
1045
|
-
}),
|
|
1046
|
-
width:
|
|
1074
|
+
return typeof e.variant == "string" ? qe(e.variant) : e.variant;
|
|
1075
|
+
}), g = M(() => ({
|
|
1076
|
+
width: n(),
|
|
1047
1077
|
height: o(),
|
|
1048
|
-
gridWidth: Math.max(1, Math.round(
|
|
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:
|
|
1103
|
+
const N = {
|
|
1104
|
+
size: m,
|
|
1105
|
+
orientation: k,
|
|
1106
|
+
contentLayout: R,
|
|
1107
|
+
dimensions: g,
|
|
1078
1108
|
isEditMode: () => e.isEditMode ?? !1,
|
|
1079
|
-
updateConfig:
|
|
1109
|
+
updateConfig: x?.updateConfig ?? (() => {
|
|
1080
1110
|
})
|
|
1081
|
-
},
|
|
1111
|
+
}, D = M(() => ({
|
|
1082
1112
|
"container-type": "size",
|
|
1083
1113
|
"container-name": "widget",
|
|
1084
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
|
-
t =
|
|
1104
|
-
},
|
|
1105
|
-
var
|
|
1106
|
-
return () =>
|
|
1107
|
-
var R = Ht(), Q = R.firstChild;
|
|
1108
|
-
return D((L) => {
|
|
1109
|
-
var K = U.BACKGROUND, ae = S("absolute inset-0 opacity-20 blur-2xl", e.backgroundGlow);
|
|
1110
|
-
return K !== L.e && z(R, "z-index", L.e = K), ae !== L.t && C(Q, L.t = ae), L;
|
|
1111
|
-
}, {
|
|
1112
|
-
e: void 0,
|
|
1113
|
-
t: void 0
|
|
1114
|
-
}), R;
|
|
1115
|
-
})();
|
|
1116
|
-
})(), O), x(O, (() => {
|
|
1117
|
-
var k = E(() => !!e.emptyState);
|
|
1118
|
-
return () => k() ? T(Jt, {
|
|
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
1150
|
return e.emptyState.icon;
|
|
1121
1151
|
},
|
|
@@ -1126,140 +1156,133 @@ function qt(e) {
|
|
|
1126
1156
|
return e.emptyState.message;
|
|
1127
1157
|
}
|
|
1128
1158
|
}) : e.children;
|
|
1129
|
-
})()),
|
|
1130
|
-
var
|
|
1131
|
-
return () =>
|
|
1132
|
-
var
|
|
1133
|
-
return
|
|
1159
|
+
})()), h(d, (() => {
|
|
1160
|
+
var p = E(() => !!e.loading);
|
|
1161
|
+
return () => p() && (() => {
|
|
1162
|
+
var c = Pt();
|
|
1163
|
+
return z((A) => V(c, "z-index", K.OVERLAY)), c;
|
|
1134
1164
|
})();
|
|
1135
|
-
})(), null),
|
|
1136
|
-
var
|
|
1137
|
-
"
|
|
1165
|
+
})(), null), z((p) => {
|
|
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
1172
|
e.class
|
|
1142
|
-
),
|
|
1143
|
-
|
|
1144
|
-
// Gradient prop (overrides variant, auto-applied for empty state)
|
|
1145
|
-
I()
|
|
1146
|
-
), K = U.CONTENT;
|
|
1147
|
-
return R !== k.e && C(h, k.e = R), k.t = se(h, Q, k.t), L !== k.a && C(u, k.a = L), K !== k.o && z(O, "z-index", k.o = K), k;
|
|
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
|
-
}), h;
|
|
1178
|
+
a: void 0
|
|
1179
|
+
}), d;
|
|
1154
1180
|
}
|
|
1155
1181
|
});
|
|
1156
1182
|
}
|
|
1157
|
-
function
|
|
1183
|
+
function Yt(e) {
|
|
1158
1184
|
return (() => {
|
|
1159
1185
|
var t = Lt();
|
|
1160
|
-
return
|
|
1161
|
-
var
|
|
1162
|
-
return () =>
|
|
1163
|
-
var
|
|
1164
|
-
return
|
|
1186
|
+
return h(t, (() => {
|
|
1187
|
+
var r = E(() => !!e.icon);
|
|
1188
|
+
return () => r() && (() => {
|
|
1189
|
+
var i = Rt();
|
|
1190
|
+
return h(i, () => e.icon), i;
|
|
1165
1191
|
})();
|
|
1166
|
-
})(), null),
|
|
1167
|
-
var
|
|
1168
|
-
return () =>
|
|
1169
|
-
var
|
|
1170
|
-
return
|
|
1192
|
+
})(), null), h(t, (() => {
|
|
1193
|
+
var r = E(() => !!e.title);
|
|
1194
|
+
return () => r() && (() => {
|
|
1195
|
+
var i = Ht();
|
|
1196
|
+
return h(i, () => e.title), i;
|
|
1171
1197
|
})();
|
|
1172
|
-
})(), null),
|
|
1173
|
-
var
|
|
1174
|
-
return () =>
|
|
1175
|
-
var
|
|
1176
|
-
return
|
|
1198
|
+
})(), null), h(t, (() => {
|
|
1199
|
+
var r = E(() => !!e.message);
|
|
1200
|
+
return () => r() && (() => {
|
|
1201
|
+
var i = Gt();
|
|
1202
|
+
return h(i, () => e.message), i;
|
|
1177
1203
|
})();
|
|
1178
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 Kn(e) {
|
|
1201
|
-
const t = () => Qt[e.color] ?? e.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
|
|
1204
|
-
return
|
|
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
|
-
|
|
1211
|
-
}), n;
|
|
1233
|
+
t: void 0
|
|
1234
|
+
}), r;
|
|
1212
1235
|
})();
|
|
1213
1236
|
}
|
|
1214
|
-
var
|
|
1215
|
-
function
|
|
1216
|
-
const t =
|
|
1217
|
-
const
|
|
1218
|
-
return W[
|
|
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
|
|
1222
|
-
return
|
|
1223
|
-
var a =
|
|
1224
|
-
return a !==
|
|
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 t =
|
|
1235
|
-
return t.$$click = () => e.onClick(),
|
|
1257
|
+
var t = Jt();
|
|
1258
|
+
return t.$$click = () => e.onClick(), h(t, O(J, {
|
|
1236
1259
|
get when() {
|
|
1237
1260
|
return e.isActive;
|
|
1238
1261
|
},
|
|
1239
1262
|
get children() {
|
|
1240
|
-
var
|
|
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 [t] =
|
|
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 = () =>
|
|
1256
|
-
!
|
|
1278
|
+
const s = () => r() && JSON.stringify(i()) !== JSON.stringify(t.config), l = (c) => {
|
|
1279
|
+
!c && t.config && n({
|
|
1257
1280
|
...t.config
|
|
1258
|
-
}), t.onOpenChange(
|
|
1259
|
-
},
|
|
1260
|
-
t.onConfigSave?.(
|
|
1261
|
-
}, [
|
|
1262
|
-
const
|
|
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,141 +1291,141 @@ function Jn(e) {
|
|
|
1268
1291
|
"2xl": "max-w-2xl",
|
|
1269
1292
|
"3xl": "max-w-3xl",
|
|
1270
1293
|
"4xl": "max-w-4xl"
|
|
1271
|
-
}[
|
|
1272
|
-
},
|
|
1294
|
+
}[c];
|
|
1295
|
+
}, x = () => {
|
|
1273
1296
|
if (t.tabs) return t.tabs;
|
|
1274
|
-
const
|
|
1275
|
-
return
|
|
1297
|
+
const c = [];
|
|
1298
|
+
return c.push({
|
|
1276
1299
|
id: "edit",
|
|
1277
1300
|
label: "Edit",
|
|
1278
|
-
icon:
|
|
1279
|
-
content: t.editContent ?? (
|
|
1301
|
+
icon: Zt(),
|
|
1302
|
+
content: t.editContent ?? (r() && a() ? O(y, {
|
|
1280
1303
|
get schema() {
|
|
1281
1304
|
return a();
|
|
1282
1305
|
},
|
|
1283
1306
|
get data() {
|
|
1284
|
-
return
|
|
1307
|
+
return i();
|
|
1285
1308
|
},
|
|
1286
|
-
onChange:
|
|
1287
|
-
}) :
|
|
1288
|
-
}),
|
|
1309
|
+
onChange: n
|
|
1310
|
+
}) : Qt())
|
|
1311
|
+
}), c.push({
|
|
1289
1312
|
id: "controls",
|
|
1290
1313
|
label: "Controls",
|
|
1291
|
-
icon:
|
|
1292
|
-
content: t.controlsContent ??
|
|
1293
|
-
}),
|
|
1314
|
+
icon: en(),
|
|
1315
|
+
content: t.controlsContent ?? tn()
|
|
1316
|
+
}), c.push({
|
|
1294
1317
|
id: "debug",
|
|
1295
1318
|
label: "Debug",
|
|
1296
|
-
icon:
|
|
1297
|
-
content: t.debugContent ??
|
|
1298
|
-
}),
|
|
1299
|
-
},
|
|
1319
|
+
icon: nn(),
|
|
1320
|
+
content: t.debugContent ?? rn()
|
|
1321
|
+
}), c;
|
|
1322
|
+
}, w = async () => {
|
|
1300
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
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
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
1373
|
return t.headerActions;
|
|
1351
1374
|
},
|
|
1352
1375
|
get children() {
|
|
1353
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 E(() =>
|
|
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 E(() =>
|
|
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
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 E(() =>
|
|
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 E(() =>
|
|
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,322 +1433,361 @@ function Jn(e) {
|
|
|
1410
1433
|
}
|
|
1411
1434
|
});
|
|
1412
1435
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
1417
|
-
}
|
|
1418
|
-
function ue(e) {
|
|
1419
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${ie}" height="${ie}" viewBox="0 0 ${ie} ${ie}">${e}</svg>`;
|
|
1420
|
-
}
|
|
1421
|
-
const xn = ue(`
|
|
1422
|
-
<g transform="translate(6, 2)">
|
|
1423
|
-
<!-- shadow -->
|
|
1424
|
-
<g stroke="${le}" stroke-width="${ce}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1425
|
-
<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
|
-
</g>
|
|
1427
|
-
<!-- main -->
|
|
1428
|
-
<g stroke="${H}" stroke-width="${xe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1429
|
-
<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
|
-
</g>
|
|
1431
|
-
</g>
|
|
1432
|
-
`), vn = ue(`
|
|
1433
|
-
<g>
|
|
1434
|
-
<circle cx="${g}" cy="${g}" r="8" stroke="${le}" stroke-width="${ce}" fill="none"/>
|
|
1435
|
-
<circle cx="${g}" cy="${g}" r="8" stroke="${H}" stroke-width="1.5" fill="none"/>
|
|
1436
|
-
<circle cx="${g}" cy="${g}" r="1.5" fill="${H}"/>
|
|
1437
|
-
</g>
|
|
1438
|
-
`), bn = ue(`
|
|
1439
|
-
<g>
|
|
1440
|
-
<!-- shadow -->
|
|
1441
|
-
<g stroke="${le}" stroke-width="${ce}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1442
|
-
<line x1="6" y1="${g}" x2="26" y2="${g}"/>
|
|
1443
|
-
<polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
|
|
1444
|
-
<polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
|
|
1445
|
-
</g>
|
|
1446
|
-
<!-- main -->
|
|
1447
|
-
<g stroke="${H}" stroke-width="${xe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1448
|
-
<line x1="6" y1="${g}" x2="26" y2="${g}"/>
|
|
1449
|
-
<polyline points="10,${g - 4} 6,${g} 10,${g + 4}"/>
|
|
1450
|
-
<polyline points="22,${g - 4} 26,${g} 22,${g + 4}"/>
|
|
1451
|
-
</g>
|
|
1452
|
-
<!-- center grip dots -->
|
|
1453
|
-
<circle cx="${g}" cy="${g}" r="1.5" fill="${H}"/>
|
|
1454
|
-
<circle cx="${g - 5}" cy="${g}" r="1" fill="${H}" opacity="0.6"/>
|
|
1455
|
-
<circle cx="${g + 5}" cy="${g}" r="1" fill="${H}" opacity="0.6"/>
|
|
1456
|
-
</g>
|
|
1457
|
-
`), yn = ue(`
|
|
1458
|
-
<g>
|
|
1459
|
-
<!-- shadow -->
|
|
1460
|
-
<g stroke="${le}" stroke-width="${ce}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1461
|
-
<line x1="${g}" y1="6" x2="${g}" y2="26"/>
|
|
1462
|
-
<polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
|
|
1463
|
-
<polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
|
|
1464
|
-
</g>
|
|
1465
|
-
<!-- main -->
|
|
1466
|
-
<g stroke="${H}" stroke-width="${xe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1467
|
-
<line x1="${g}" y1="6" x2="${g}" y2="26"/>
|
|
1468
|
-
<polyline points="${g - 4},10 ${g},6 ${g + 4},10"/>
|
|
1469
|
-
<polyline points="${g - 4},22 ${g},26 ${g + 4},22"/>
|
|
1470
|
-
</g>
|
|
1471
|
-
<!-- center grip dots -->
|
|
1472
|
-
<circle cx="${g}" cy="${g}" r="1.5" fill="${H}"/>
|
|
1473
|
-
<circle cx="${g}" cy="${g - 5}" r="1" fill="${H}" opacity="0.6"/>
|
|
1474
|
-
<circle cx="${g}" cy="${g + 5}" r="1" fill="${H}" opacity="0.6"/>
|
|
1475
|
-
</g>
|
|
1476
|
-
`);
|
|
1477
|
-
function oe(e, t, n) {
|
|
1478
|
-
return { css: `${hn(e)} ${t} ${n}, auto`, hotspotX: t, hotspotY: n };
|
|
1479
|
-
}
|
|
1480
|
-
const Z = {
|
|
1481
|
-
tap: oe(xn, 12, 4),
|
|
1482
|
-
hold: oe(vn, 16, 16),
|
|
1483
|
-
slideHorizontal: oe(bn, g, g),
|
|
1484
|
-
slideVertical: oe(yn, g, g)
|
|
1485
|
-
};
|
|
1486
|
-
function Zn(e, t) {
|
|
1487
|
-
const n = {
|
|
1488
|
-
isDown: !1,
|
|
1489
|
-
startX: 0,
|
|
1490
|
-
startY: 0,
|
|
1491
|
-
currentX: 0,
|
|
1492
|
-
currentY: 0,
|
|
1493
|
-
startTime: 0,
|
|
1494
|
-
hasMoved: !1,
|
|
1495
|
-
holdTimer: null,
|
|
1496
|
-
slideActive: !1,
|
|
1497
|
-
slideActivationTimer: null,
|
|
1498
|
-
lockedAxis: null,
|
|
1499
|
-
element: null
|
|
1500
|
-
};
|
|
1501
|
-
let r = null, i = null, a = null;
|
|
1502
|
-
function o(m) {
|
|
1503
|
-
m !== i && (a && a.disconnect(), a = new ResizeObserver((b) => {
|
|
1504
|
-
const $ = b[0];
|
|
1505
|
-
if ($) {
|
|
1506
|
-
const p = $.borderBoxSize?.[0];
|
|
1507
|
-
p ? r = { width: p.inlineSize, height: p.blockSize } : r = { width: $.contentRect.width, height: $.contentRect.height };
|
|
1508
|
-
}
|
|
1509
|
-
}), i = m, a.observe(m), r = { width: m.clientWidth, height: m.clientHeight });
|
|
1510
|
-
}
|
|
1511
|
-
const s = 10, l = 5, d = () => {
|
|
1512
|
-
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null), n.slideActivationTimer && (clearTimeout(n.slideActivationTimer), n.slideActivationTimer = null);
|
|
1513
|
-
}, c = (m) => {
|
|
1514
|
-
const $ = e().slide;
|
|
1515
|
-
return $?.orientation === "horizontal" ? "horizontal" : $?.orientation === "vertical" ? "vertical" : m && (r || o(m), r) ? r.height > r.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1516
|
-
}, y = (m) => {
|
|
1517
|
-
const b = e();
|
|
1518
|
-
if (!(!b.tap && !b.hold && !b.slide)) {
|
|
1519
|
-
if (m.preventDefault(), n.isDown = !0, n.element = m.currentTarget, o(n.element), n.startX = m.clientX, n.startY = m.clientY, n.currentX = m.clientX, n.currentY = m.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, m.currentTarget.setPointerCapture(m.pointerId), b.hold) {
|
|
1520
|
-
const $ = b.hold.delay ?? 300;
|
|
1521
|
-
n.holdTimer = setTimeout(() => {
|
|
1522
|
-
n.isDown && !n.hasMoved && (b.hold.action(), n.isDown = !1);
|
|
1523
|
-
}, $);
|
|
1524
|
-
}
|
|
1525
|
-
if (b.slide) {
|
|
1526
|
-
const $ = b.slide.activationDelay ?? 0;
|
|
1527
|
-
$ > 0 ? n.slideActivationTimer = setTimeout(() => {
|
|
1528
|
-
n.slideActive = !0;
|
|
1529
|
-
}, $) : n.slideActive = !0;
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
}, M = (m) => {
|
|
1533
|
-
if (!n.isDown) return;
|
|
1534
|
-
const b = e();
|
|
1535
|
-
n.currentX = m.clientX, n.currentY = m.clientY;
|
|
1536
|
-
const $ = n.currentX - n.startX, p = n.currentY - n.startY, P = Math.abs($), B = Math.abs(p), h = Math.sqrt($ * $ + p * p), u = m.currentTarget, O = c(u);
|
|
1537
|
-
if (!n.lockedAxis && h > l && (P > B ? n.lockedAxis = "horizontal" : n.lockedAxis = "vertical", b.slide && n.lockedAxis !== O)) {
|
|
1538
|
-
u.releasePointerCapture(m.pointerId), n.isDown = !1, n.slideActive = !1, d();
|
|
1539
|
-
return;
|
|
1540
|
-
}
|
|
1541
|
-
if (h > s && (n.hasMoved = !0, d()), b.slide && n.slideActive && n.hasMoved && n.lockedAxis === O) {
|
|
1542
|
-
const k = b.slide.min ?? 0, R = b.slide.max ?? 100, Q = R - k, L = O === "vertical" ? -p : $, K = r ?? { width: u.clientWidth, height: u.clientHeight }, ae = O === "vertical" ? K.height : K.width, De = L / ae * Q, _e = Math.max(k, Math.min(R, b.slide.value + De));
|
|
1543
|
-
b.slide.onChange(Math.round(_e)), n.startX = n.currentX, n.startY = n.currentY, m.preventDefault();
|
|
1544
|
-
}
|
|
1545
|
-
}, f = (m) => {
|
|
1546
|
-
if (!n.isDown) return;
|
|
1547
|
-
const b = e(), $ = b.hold?.delay ?? 300;
|
|
1548
|
-
if (d(), b.tap && !n.hasMoved) {
|
|
1549
|
-
const p = Date.now() - n.startTime;
|
|
1550
|
-
n.isDown && p < $ && b.tap();
|
|
1551
|
-
}
|
|
1552
|
-
n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, m.currentTarget.releasePointerCapture(m.pointerId);
|
|
1553
|
-
}, v = (m) => {
|
|
1554
|
-
d(), n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, m.currentTarget.releasePointerCapture(m.pointerId);
|
|
1555
|
-
}, V = (m) => {
|
|
1556
|
-
const b = e();
|
|
1557
|
-
if (b.slide) {
|
|
1558
|
-
const $ = b.slide.orientation;
|
|
1559
|
-
return $ === "horizontal" ? Z.slideHorizontal.css : $ === "vertical" ? Z.slideVertical.css : (r || o(m), r && r.height > r.width ? Z.slideVertical.css : Z.slideHorizontal.css);
|
|
1560
|
-
}
|
|
1561
|
-
return b.tap ? Z.tap.css : b.hold ? Z.hold.css : "";
|
|
1562
|
-
};
|
|
1563
|
-
return {
|
|
1564
|
-
onPointerDown: y,
|
|
1565
|
-
onPointerMove: M,
|
|
1566
|
-
onPointerUp: f,
|
|
1567
|
-
onPointerCancel: v,
|
|
1568
|
-
onPointerEnter: (m) => {
|
|
1569
|
-
const b = m.currentTarget;
|
|
1570
|
-
n.element = b, b.style.cursor = V(b);
|
|
1571
|
-
},
|
|
1572
|
-
bindElement: (m) => {
|
|
1573
|
-
m && (n.element = m, o(m));
|
|
1574
|
-
},
|
|
1575
|
-
touchAction: () => {
|
|
1576
|
-
const m = e();
|
|
1577
|
-
if (m.slide) {
|
|
1578
|
-
const b = m.slide.orientation;
|
|
1579
|
-
return b === "horizontal" ? "pan-y" : b === "vertical" || r && r.height > r.width ? "pan-x" : "pan-y";
|
|
1580
|
-
}
|
|
1581
|
-
return m.tap || m.hold ? "manipulation" : "auto";
|
|
1582
|
-
},
|
|
1583
|
-
dispose: () => {
|
|
1584
|
-
d(), a && (a.disconnect(), a = null), i = null, r = null;
|
|
1585
|
-
}
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1588
|
-
function Qn(e) {
|
|
1589
|
-
return A(() => {
|
|
1436
|
+
Ne(["click"]);
|
|
1437
|
+
function Kn(e) {
|
|
1438
|
+
return M(() => {
|
|
1590
1439
|
const t = e.entities();
|
|
1591
1440
|
if (t.length === 0) return;
|
|
1592
|
-
const
|
|
1441
|
+
const r = {
|
|
1593
1442
|
widgetConfig: e.widgetConfig,
|
|
1594
|
-
entities: t.map((
|
|
1595
|
-
const
|
|
1596
|
-
entity_id:
|
|
1597
|
-
state:
|
|
1598
|
-
domain:
|
|
1599
|
-
friendly_name:
|
|
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
|
|
1600
1449
|
};
|
|
1601
1450
|
return e.customEntityFields ? {
|
|
1602
|
-
...
|
|
1603
|
-
...e.customEntityFields(
|
|
1604
|
-
} :
|
|
1451
|
+
...n,
|
|
1452
|
+
...e.customEntityFields(i)
|
|
1453
|
+
} : n;
|
|
1605
1454
|
})
|
|
1606
1455
|
};
|
|
1607
|
-
return e.additionalData && Object.assign(
|
|
1456
|
+
return e.additionalData && Object.assign(r, e.additionalData), r;
|
|
1608
1457
|
});
|
|
1609
1458
|
}
|
|
1610
|
-
function
|
|
1611
|
-
const [t,
|
|
1459
|
+
function qn(e = {}) {
|
|
1460
|
+
const [t, r] = H(!1), [i, n] = H(!1);
|
|
1612
1461
|
return {
|
|
1613
1462
|
save: async (s) => {
|
|
1614
1463
|
if (e.onSave) {
|
|
1615
|
-
|
|
1464
|
+
r(!0);
|
|
1616
1465
|
try {
|
|
1617
1466
|
await e.onSave(s), e.onSaveSuccess?.();
|
|
1618
1467
|
} finally {
|
|
1619
|
-
|
|
1468
|
+
r(!1);
|
|
1620
1469
|
}
|
|
1621
1470
|
}
|
|
1622
1471
|
},
|
|
1623
1472
|
remove: async () => {
|
|
1624
1473
|
if (e.onDelete) {
|
|
1625
|
-
|
|
1474
|
+
n(!0);
|
|
1626
1475
|
try {
|
|
1627
1476
|
await e.onDelete(), e.onDeleteSuccess?.();
|
|
1628
1477
|
} finally {
|
|
1629
|
-
|
|
1478
|
+
n(!1);
|
|
1630
1479
|
}
|
|
1631
1480
|
}
|
|
1632
1481
|
},
|
|
1633
1482
|
isSaving: t,
|
|
1634
|
-
isDeleting:
|
|
1483
|
+
isDeleting: i
|
|
1635
1484
|
};
|
|
1636
1485
|
}
|
|
1637
|
-
function
|
|
1638
|
-
const [t,
|
|
1486
|
+
function Xn(e = "edit") {
|
|
1487
|
+
const [t, r] = H(!1), [i, n] = H(e);
|
|
1639
1488
|
return {
|
|
1640
1489
|
showDialog: t,
|
|
1641
|
-
setShowDialog:
|
|
1642
|
-
openDialog: () =>
|
|
1643
|
-
closeDialog: () =>
|
|
1644
|
-
activeTab:
|
|
1645
|
-
setActiveTab:
|
|
1490
|
+
setShowDialog: r,
|
|
1491
|
+
openDialog: () => r(!0),
|
|
1492
|
+
closeDialog: () => r(!1),
|
|
1493
|
+
activeTab: i,
|
|
1494
|
+
setActiveTab: n
|
|
1646
1495
|
};
|
|
1647
1496
|
}
|
|
1648
|
-
function
|
|
1649
|
-
const t =
|
|
1650
|
-
const
|
|
1651
|
-
return
|
|
1652
|
-
}),
|
|
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);
|
|
1653
1502
|
return {
|
|
1654
1503
|
entity: e.entity,
|
|
1655
|
-
data:
|
|
1656
|
-
emptyState:
|
|
1504
|
+
data: r,
|
|
1505
|
+
emptyState: i,
|
|
1657
1506
|
hasEntity: t
|
|
1658
1507
|
};
|
|
1659
1508
|
}
|
|
1660
|
-
function
|
|
1661
|
-
const t = e.minEntities ?? 1,
|
|
1662
|
-
if (!
|
|
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;
|
|
1663
1512
|
const s = e.aggregationMode?.();
|
|
1664
1513
|
if (!s || s === "none") return;
|
|
1665
1514
|
const l = e.entities();
|
|
1666
1515
|
if (s === "light" || s === "binary-sensor" || s === "switch")
|
|
1667
|
-
return
|
|
1516
|
+
return Mt(l, e.allEntitiesMode);
|
|
1668
1517
|
if (s === "sensor") {
|
|
1669
|
-
const
|
|
1670
|
-
return
|
|
1518
|
+
const g = e.sensorGroupType?.() ?? "mean";
|
|
1519
|
+
return _t(l, g, !0);
|
|
1671
1520
|
}
|
|
1672
|
-
}), o =
|
|
1521
|
+
}), o = M(() => i() ? void 0 : e.emptyStateConfig);
|
|
1673
1522
|
return {
|
|
1674
1523
|
entities: e.entities,
|
|
1675
|
-
groupData:
|
|
1524
|
+
groupData: n,
|
|
1676
1525
|
aggregatedData: a,
|
|
1677
1526
|
emptyState: o,
|
|
1678
|
-
hasEntities:
|
|
1679
|
-
count:
|
|
1527
|
+
hasEntities: i,
|
|
1528
|
+
count: r
|
|
1680
1529
|
};
|
|
1681
1530
|
}
|
|
1682
|
-
function
|
|
1683
|
-
const [t] =
|
|
1684
|
-
validate:
|
|
1531
|
+
function Qn(e) {
|
|
1532
|
+
const [t] = Pe({
|
|
1533
|
+
validate: Le(e.schema),
|
|
1685
1534
|
initialValues: e.initialValues
|
|
1686
|
-
}),
|
|
1535
|
+
}), r = M(() => t.dirty), i = M(() => t.submitting);
|
|
1687
1536
|
return {
|
|
1688
1537
|
form: t,
|
|
1689
|
-
isDirty:
|
|
1690
|
-
isSubmitting:
|
|
1538
|
+
isDirty: r,
|
|
1539
|
+
isSubmitting: i,
|
|
1691
1540
|
handleSubmit: (a) => {
|
|
1692
1541
|
e.onSubmit?.(a);
|
|
1693
1542
|
},
|
|
1694
|
-
getValue:
|
|
1695
|
-
setValue:
|
|
1696
|
-
reset:
|
|
1543
|
+
getValue: Ge,
|
|
1544
|
+
setValue: He,
|
|
1545
|
+
reset: Re
|
|
1697
1546
|
};
|
|
1698
1547
|
}
|
|
1699
|
-
const
|
|
1700
|
-
function
|
|
1701
|
-
const e =
|
|
1548
|
+
const se = ["xs", "sm", "md", "lg", "xl"];
|
|
1549
|
+
function er() {
|
|
1550
|
+
const e = P(), t = M(() => se.indexOf(e.size())), r = M(() => {
|
|
1702
1551
|
const l = e.size();
|
|
1703
1552
|
return l === "xs" || l === "sm";
|
|
1704
|
-
}),
|
|
1553
|
+
}), i = M(() => {
|
|
1705
1554
|
const l = e.size();
|
|
1706
1555
|
return l === "lg" || l === "xl";
|
|
1707
|
-
}),
|
|
1556
|
+
}), n = M(() => t() >= 2);
|
|
1708
1557
|
return {
|
|
1709
|
-
isCompact:
|
|
1710
|
-
isLarge:
|
|
1711
|
-
showDetail:
|
|
1558
|
+
isCompact: r,
|
|
1559
|
+
isLarge: i,
|
|
1560
|
+
showDetail: n,
|
|
1712
1561
|
showOn: (l) => l.includes(e.size()),
|
|
1713
1562
|
hideOn: (l) => !l.includes(e.size()),
|
|
1714
1563
|
matches: (l) => {
|
|
1715
|
-
const
|
|
1716
|
-
if (
|
|
1717
|
-
const
|
|
1718
|
-
return
|
|
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)}")`;
|
|
1580
|
+
}
|
|
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>`;
|
|
1583
|
+
}
|
|
1584
|
+
const un = ae(`
|
|
1585
|
+
<g transform="translate(6, 2)">
|
|
1586
|
+
<!-- shadow -->
|
|
1587
|
+
<g stroke="${re}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
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"/>
|
|
1589
|
+
</g>
|
|
1590
|
+
<!-- main -->
|
|
1591
|
+
<g stroke="${L}" stroke-width="${fe}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
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"/>
|
|
1593
|
+
</g>
|
|
1594
|
+
</g>
|
|
1595
|
+
`), gn = ae(`
|
|
1596
|
+
<g>
|
|
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}"/>
|
|
1600
|
+
</g>
|
|
1601
|
+
`), mn = ae(`
|
|
1602
|
+
<g>
|
|
1603
|
+
<!-- shadow -->
|
|
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}"/>
|
|
1608
|
+
</g>
|
|
1609
|
+
<!-- main -->
|
|
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}"/>
|
|
1614
|
+
</g>
|
|
1615
|
+
<!-- center grip dots -->
|
|
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"/>
|
|
1619
|
+
</g>
|
|
1620
|
+
`), fn = ae(`
|
|
1621
|
+
<g>
|
|
1622
|
+
<!-- shadow -->
|
|
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"/>
|
|
1627
|
+
</g>
|
|
1628
|
+
<!-- main -->
|
|
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"/>
|
|
1633
|
+
</g>
|
|
1634
|
+
<!-- center grip dots -->
|
|
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"/>
|
|
1638
|
+
</g>
|
|
1639
|
+
`);
|
|
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)
|
|
1648
|
+
};
|
|
1649
|
+
function le() {
|
|
1650
|
+
if (typeof window > "u") return null;
|
|
1651
|
+
const e = window;
|
|
1652
|
+
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
1653
|
+
}
|
|
1654
|
+
function ce(e) {
|
|
1655
|
+
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function"))
|
|
1656
|
+
try {
|
|
1657
|
+
navigator.vibrate(e);
|
|
1658
|
+
} catch {
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
const hn = {
|
|
1662
|
+
/** Light confirmation — fires when slide gesture arms after user holds still. */
|
|
1663
|
+
tick() {
|
|
1664
|
+
const e = le();
|
|
1665
|
+
if (e) {
|
|
1666
|
+
e.impact({ style: "Light" }).catch(() => {
|
|
1667
|
+
});
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
ce(8);
|
|
1671
|
+
},
|
|
1672
|
+
/** Medium bump — fires when hold gesture commits (detail opening). */
|
|
1673
|
+
bump() {
|
|
1674
|
+
const e = le();
|
|
1675
|
+
if (e) {
|
|
1676
|
+
e.impact({ style: "Medium" }).catch(() => {
|
|
1677
|
+
});
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
ce(20);
|
|
1681
|
+
},
|
|
1682
|
+
/** Stronger pulse — reserved for edit-mode pickup (future use). */
|
|
1683
|
+
pulse() {
|
|
1684
|
+
const e = le();
|
|
1685
|
+
if (e) {
|
|
1686
|
+
e.impact({ style: "Heavy" }).catch(() => {
|
|
1687
|
+
});
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
ce([0, 15, 40, 15]);
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
function tr(e, t) {
|
|
1694
|
+
const n = {
|
|
1695
|
+
isDown: !1,
|
|
1696
|
+
isTouch: !1,
|
|
1697
|
+
startX: 0,
|
|
1698
|
+
startY: 0,
|
|
1699
|
+
startTime: 0,
|
|
1700
|
+
hasMoved: !1,
|
|
1701
|
+
sliding: !1,
|
|
1702
|
+
holdTimer: null,
|
|
1703
|
+
element: null
|
|
1704
|
+
};
|
|
1705
|
+
let a = null, o = null, s = null;
|
|
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 };
|
|
1719
1712
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1713
|
+
}), o = f, s.observe(f), a = { width: f.clientWidth, height: f.clientHeight });
|
|
1714
|
+
}
|
|
1715
|
+
const g = () => {
|
|
1716
|
+
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null);
|
|
1717
|
+
}, m = () => {
|
|
1718
|
+
n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
|
|
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;
|
|
1727
|
+
n.holdTimer = setTimeout(() => {
|
|
1728
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (hn.bump(), b.hold?.action(), n.isDown = !1);
|
|
1729
|
+
}, y);
|
|
1723
1730
|
}
|
|
1724
|
-
|
|
1731
|
+
if (!n.isTouch && b.slide)
|
|
1732
|
+
try {
|
|
1733
|
+
f.currentTarget.setPointerCapture(f.pointerId);
|
|
1734
|
+
} catch {
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}, x = (f) => {
|
|
1738
|
+
if (!n.isDown) return;
|
|
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);
|
|
1742
|
+
n.sliding = !0;
|
|
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();
|
|
1745
|
+
}
|
|
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();
|
|
1749
|
+
try {
|
|
1750
|
+
f.currentTarget.releasePointerCapture(f.pointerId);
|
|
1751
|
+
} catch {
|
|
1752
|
+
}
|
|
1753
|
+
m();
|
|
1754
|
+
}, N = (f) => {
|
|
1755
|
+
g();
|
|
1756
|
+
try {
|
|
1757
|
+
f.currentTarget.releasePointerCapture(f.pointerId);
|
|
1758
|
+
} catch {
|
|
1759
|
+
}
|
|
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);
|
|
1766
|
+
}
|
|
1767
|
+
return b.tap ? Y.tap.css : b.hold ? Y.hold.css : "";
|
|
1768
|
+
};
|
|
1769
|
+
return {
|
|
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);
|
|
1777
|
+
},
|
|
1778
|
+
bindElement: (f) => {
|
|
1779
|
+
f && (n.element = f, l(f));
|
|
1780
|
+
},
|
|
1781
|
+
touchAction: () => {
|
|
1782
|
+
const f = e();
|
|
1783
|
+
return f.tap || f.hold || f.slide ? "manipulation" : "auto";
|
|
1784
|
+
},
|
|
1785
|
+
dispose: () => {
|
|
1786
|
+
g(), s && (s.disconnect(), s = null), o = null, a = null;
|
|
1725
1787
|
}
|
|
1726
1788
|
};
|
|
1727
1789
|
}
|
|
1728
|
-
const
|
|
1790
|
+
const C = {
|
|
1729
1791
|
ocean: "bg-gradient-to-br from-cyan-600/20 to-blue-700/20",
|
|
1730
1792
|
sunset: "bg-gradient-to-br from-orange-500/20 to-purple-700/20",
|
|
1731
1793
|
forest: "bg-gradient-to-br from-emerald-600/20 to-teal-700/20",
|
|
@@ -1743,7 +1805,7 @@ const _ = {
|
|
|
1743
1805
|
sage: "bg-gradient-to-br from-lime-600/20 to-green-600/20",
|
|
1744
1806
|
copper: "bg-gradient-to-br from-amber-600/20 to-amber-800/20",
|
|
1745
1807
|
dusk: "bg-gradient-to-br from-blue-500/20 to-purple-600/20"
|
|
1746
|
-
},
|
|
1808
|
+
}, nr = {
|
|
1747
1809
|
ocean: "Ocean Breeze",
|
|
1748
1810
|
sunset: "Sunset Glow",
|
|
1749
1811
|
forest: "Forest Dawn",
|
|
@@ -1761,30 +1823,30 @@ const _ = {
|
|
|
1761
1823
|
sage: "Sage",
|
|
1762
1824
|
copper: "Copper",
|
|
1763
1825
|
dusk: "Dusk"
|
|
1764
|
-
},
|
|
1765
|
-
function
|
|
1766
|
-
const t = Object.keys(
|
|
1767
|
-
let
|
|
1768
|
-
for (const
|
|
1769
|
-
|
|
1770
|
-
const
|
|
1771
|
-
return t[
|
|
1772
|
-
}
|
|
1773
|
-
function
|
|
1826
|
+
}, rr = Object.keys(C);
|
|
1827
|
+
function ye(e) {
|
|
1828
|
+
const t = Object.keys(C);
|
|
1829
|
+
let r = 0;
|
|
1830
|
+
for (const n of e)
|
|
1831
|
+
r = (r << 5) - r + n.charCodeAt(0), r = r & r;
|
|
1832
|
+
const i = Math.abs(r) % t.length;
|
|
1833
|
+
return t[i];
|
|
1834
|
+
}
|
|
1835
|
+
function ir(e, t) {
|
|
1774
1836
|
if (!e) {
|
|
1775
|
-
const
|
|
1776
|
-
return
|
|
1837
|
+
const i = ye(t);
|
|
1838
|
+
return C[i];
|
|
1777
1839
|
}
|
|
1778
|
-
if (typeof e == "string" && e in
|
|
1779
|
-
return
|
|
1840
|
+
if (typeof e == "string" && e in C)
|
|
1841
|
+
return C[e];
|
|
1780
1842
|
if (typeof e == "string")
|
|
1781
1843
|
return e;
|
|
1782
|
-
const
|
|
1783
|
-
return
|
|
1844
|
+
const r = ye(t);
|
|
1845
|
+
return C[r];
|
|
1784
1846
|
}
|
|
1785
|
-
const
|
|
1847
|
+
const X = {
|
|
1786
1848
|
ocean: {
|
|
1787
|
-
gradient:
|
|
1849
|
+
gradient: C.ocean,
|
|
1788
1850
|
bg: "bg-cyan-600/20",
|
|
1789
1851
|
icon: "bg-cyan-500 dark:bg-cyan-400",
|
|
1790
1852
|
glow: "shadow-cyan-500/50 dark:shadow-cyan-400/50",
|
|
@@ -1794,7 +1856,7 @@ const ee = {
|
|
|
1794
1856
|
}
|
|
1795
1857
|
},
|
|
1796
1858
|
sunset: {
|
|
1797
|
-
gradient:
|
|
1859
|
+
gradient: C.sunset,
|
|
1798
1860
|
bg: "bg-orange-500/20",
|
|
1799
1861
|
icon: "bg-orange-500 dark:bg-orange-400",
|
|
1800
1862
|
glow: "shadow-orange-500/50 dark:shadow-orange-400/50",
|
|
@@ -1804,7 +1866,7 @@ const ee = {
|
|
|
1804
1866
|
}
|
|
1805
1867
|
},
|
|
1806
1868
|
forest: {
|
|
1807
|
-
gradient:
|
|
1869
|
+
gradient: C.forest,
|
|
1808
1870
|
bg: "bg-emerald-600/20",
|
|
1809
1871
|
icon: "bg-emerald-500 dark:bg-emerald-400",
|
|
1810
1872
|
glow: "shadow-emerald-500/50 dark:shadow-emerald-400/50",
|
|
@@ -1814,7 +1876,7 @@ const ee = {
|
|
|
1814
1876
|
}
|
|
1815
1877
|
},
|
|
1816
1878
|
lavender: {
|
|
1817
|
-
gradient:
|
|
1879
|
+
gradient: C.lavender,
|
|
1818
1880
|
bg: "bg-purple-500/20",
|
|
1819
1881
|
icon: "bg-purple-500 dark:bg-purple-400",
|
|
1820
1882
|
glow: "shadow-purple-500/50 dark:shadow-purple-400/50",
|
|
@@ -1824,7 +1886,7 @@ const ee = {
|
|
|
1824
1886
|
}
|
|
1825
1887
|
},
|
|
1826
1888
|
golden: {
|
|
1827
|
-
gradient:
|
|
1889
|
+
gradient: C.golden,
|
|
1828
1890
|
bg: "bg-yellow-500/20",
|
|
1829
1891
|
icon: "bg-yellow-500 dark:bg-yellow-400",
|
|
1830
1892
|
glow: "shadow-yellow-500/50 dark:shadow-yellow-400/50",
|
|
@@ -1834,7 +1896,7 @@ const ee = {
|
|
|
1834
1896
|
}
|
|
1835
1897
|
},
|
|
1836
1898
|
midnight: {
|
|
1837
|
-
gradient:
|
|
1899
|
+
gradient: C.midnight,
|
|
1838
1900
|
bg: "bg-blue-700/20",
|
|
1839
1901
|
icon: "bg-blue-700 dark:bg-blue-600",
|
|
1840
1902
|
glow: "shadow-blue-700/50 dark:shadow-blue-600/50",
|
|
@@ -1844,7 +1906,7 @@ const ee = {
|
|
|
1844
1906
|
}
|
|
1845
1907
|
},
|
|
1846
1908
|
rose: {
|
|
1847
|
-
gradient:
|
|
1909
|
+
gradient: C.rose,
|
|
1848
1910
|
bg: "bg-pink-400/20",
|
|
1849
1911
|
icon: "bg-pink-500 dark:bg-pink-400",
|
|
1850
1912
|
glow: "shadow-pink-500/50 dark:shadow-pink-400/50",
|
|
@@ -1854,7 +1916,7 @@ const ee = {
|
|
|
1854
1916
|
}
|
|
1855
1917
|
},
|
|
1856
1918
|
mint: {
|
|
1857
|
-
gradient:
|
|
1919
|
+
gradient: C.mint,
|
|
1858
1920
|
bg: "bg-green-400/20",
|
|
1859
1921
|
icon: "bg-green-500 dark:bg-green-400",
|
|
1860
1922
|
glow: "shadow-green-500/50 dark:shadow-green-400/50",
|
|
@@ -1864,7 +1926,7 @@ const ee = {
|
|
|
1864
1926
|
}
|
|
1865
1927
|
},
|
|
1866
1928
|
slate: {
|
|
1867
|
-
gradient:
|
|
1929
|
+
gradient: C.slate,
|
|
1868
1930
|
bg: "bg-slate-600/20",
|
|
1869
1931
|
icon: "bg-slate-600 dark:bg-slate-500",
|
|
1870
1932
|
glow: "shadow-slate-600/50 dark:shadow-slate-500/50",
|
|
@@ -1874,7 +1936,7 @@ const ee = {
|
|
|
1874
1936
|
}
|
|
1875
1937
|
},
|
|
1876
1938
|
coral: {
|
|
1877
|
-
gradient:
|
|
1939
|
+
gradient: C.coral,
|
|
1878
1940
|
bg: "bg-pink-300/20",
|
|
1879
1941
|
icon: "bg-pink-400 dark:bg-pink-300",
|
|
1880
1942
|
glow: "shadow-pink-400/50 dark:shadow-pink-300/50",
|
|
@@ -1884,7 +1946,7 @@ const ee = {
|
|
|
1884
1946
|
}
|
|
1885
1947
|
},
|
|
1886
1948
|
aurora: {
|
|
1887
|
-
gradient:
|
|
1949
|
+
gradient: C.aurora,
|
|
1888
1950
|
bg: "bg-blue-500/20",
|
|
1889
1951
|
icon: "bg-blue-500 dark:bg-blue-400",
|
|
1890
1952
|
glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
|
|
@@ -1894,7 +1956,7 @@ const ee = {
|
|
|
1894
1956
|
}
|
|
1895
1957
|
},
|
|
1896
1958
|
ember: {
|
|
1897
|
-
gradient:
|
|
1959
|
+
gradient: C.ember,
|
|
1898
1960
|
bg: "bg-red-500/20",
|
|
1899
1961
|
icon: "bg-red-500 dark:bg-red-400",
|
|
1900
1962
|
glow: "shadow-red-500/50 dark:shadow-red-400/50",
|
|
@@ -1904,7 +1966,7 @@ const ee = {
|
|
|
1904
1966
|
}
|
|
1905
1967
|
},
|
|
1906
1968
|
steel: {
|
|
1907
|
-
gradient:
|
|
1969
|
+
gradient: C.steel,
|
|
1908
1970
|
bg: "bg-gray-500/20",
|
|
1909
1971
|
icon: "bg-gray-500 dark:bg-gray-400",
|
|
1910
1972
|
glow: void 0,
|
|
@@ -1914,7 +1976,7 @@ const ee = {
|
|
|
1914
1976
|
}
|
|
1915
1977
|
},
|
|
1916
1978
|
twilight: {
|
|
1917
|
-
gradient:
|
|
1979
|
+
gradient: C.twilight,
|
|
1918
1980
|
bg: "bg-violet-600/20",
|
|
1919
1981
|
icon: "bg-violet-500 dark:bg-violet-400",
|
|
1920
1982
|
glow: "shadow-violet-500/50 dark:shadow-violet-400/50",
|
|
@@ -1924,7 +1986,7 @@ const ee = {
|
|
|
1924
1986
|
}
|
|
1925
1987
|
},
|
|
1926
1988
|
sage: {
|
|
1927
|
-
gradient:
|
|
1989
|
+
gradient: C.sage,
|
|
1928
1990
|
bg: "bg-lime-600/20",
|
|
1929
1991
|
icon: "bg-lime-500 dark:bg-lime-400",
|
|
1930
1992
|
glow: "shadow-lime-500/50 dark:shadow-lime-400/50",
|
|
@@ -1934,7 +1996,7 @@ const ee = {
|
|
|
1934
1996
|
}
|
|
1935
1997
|
},
|
|
1936
1998
|
copper: {
|
|
1937
|
-
gradient:
|
|
1999
|
+
gradient: C.copper,
|
|
1938
2000
|
bg: "bg-amber-600/20",
|
|
1939
2001
|
icon: "bg-amber-600 dark:bg-amber-500",
|
|
1940
2002
|
glow: "shadow-amber-600/50 dark:shadow-amber-500/50",
|
|
@@ -1944,7 +2006,7 @@ const ee = {
|
|
|
1944
2006
|
}
|
|
1945
2007
|
},
|
|
1946
2008
|
dusk: {
|
|
1947
|
-
gradient:
|
|
2009
|
+
gradient: C.dusk,
|
|
1948
2010
|
bg: "bg-blue-500/20",
|
|
1949
2011
|
icon: "bg-blue-500 dark:bg-blue-400",
|
|
1950
2012
|
glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
|
|
@@ -1953,116 +2015,124 @@ const ee = {
|
|
|
1953
2015
|
muted: "text-blue-400/60 dark:text-blue-300/60"
|
|
1954
2016
|
}
|
|
1955
2017
|
}
|
|
1956
|
-
},
|
|
1957
|
-
unavailable:
|
|
1958
|
-
active:
|
|
1959
|
-
inactive:
|
|
1960
|
-
success:
|
|
1961
|
-
warning:
|
|
1962
|
-
error:
|
|
1963
|
-
},
|
|
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 = {
|
|
1964
2033
|
/** Optional display name override (renders as text input) */
|
|
1965
|
-
title: () =>
|
|
2034
|
+
title: () => j.string().optional().meta({ title: "Title", description: "Optional display name override" }),
|
|
1966
2035
|
/** Multi-select entity picker for a HA domain */
|
|
1967
|
-
entityIds: (e) =>
|
|
2036
|
+
entityIds: (e) => j.array(j.string()).default([]).meta({ domain: e, title: "Entities" }),
|
|
1968
2037
|
/** Single-select entity picker for a HA domain */
|
|
1969
|
-
singleEntity: (e) =>
|
|
2038
|
+
singleEntity: (e) => j.array(j.string()).default([]).meta({ domain: e, title: "Entity", singleSelect: !0 }),
|
|
1970
2039
|
/** Area picker dropdown */
|
|
1971
|
-
areaId: () =>
|
|
2040
|
+
areaId: () => j.string().optional().meta({ formType: "area-picker", title: "Area" })
|
|
1972
2041
|
};
|
|
1973
|
-
let
|
|
1974
|
-
function
|
|
1975
|
-
return
|
|
2042
|
+
let de = null;
|
|
2043
|
+
function xn() {
|
|
2044
|
+
return de || (de = getComputedStyle(document.documentElement)), de;
|
|
1976
2045
|
}
|
|
1977
|
-
function
|
|
2046
|
+
function lr(e) {
|
|
1978
2047
|
const t = e.startsWith("--") ? e : `--${e}`;
|
|
1979
|
-
return
|
|
2048
|
+
return xn().getPropertyValue(t).trim();
|
|
1980
2049
|
}
|
|
1981
|
-
function
|
|
2050
|
+
function cr() {
|
|
1982
2051
|
return document.documentElement.classList.contains("dark");
|
|
1983
2052
|
}
|
|
1984
|
-
const
|
|
1985
|
-
version:
|
|
1986
|
-
},
|
|
2053
|
+
const bn = "0.4.0", vn = {
|
|
2054
|
+
version: bn
|
|
2055
|
+
}, dr = vn.version;
|
|
1987
2056
|
export {
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
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,
|
|
2037
2106
|
Ln as getEntityAttribute,
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
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,
|
|
2047
2117
|
Tt as isEntityActive,
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2118
|
+
Et as isEntityAvailable,
|
|
2119
|
+
me as mergeVariants,
|
|
2120
|
+
Ye as minimal,
|
|
2121
|
+
wr as parseGridSize,
|
|
2122
|
+
yr as serializeGridSize,
|
|
2053
2123
|
W as spacing,
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
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,
|
|
2134
|
+
tr as useWidgetGestures,
|
|
2135
|
+
er as useWidgetResponsive,
|
|
2136
|
+
_n as warnIfStub,
|
|
2137
|
+
sr as widgetFields
|
|
2068
2138
|
};
|