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