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