@glasshome/widget-sdk 0.2.5 → 0.3.3
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 +819 -759
- package/dist/schemas.d.ts +17 -1
- package/dist/schemas.js +33 -17
- 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 A, 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 _, 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
|
+
}
|
|
27
|
+
}
|
|
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;
|
|
14
30
|
}
|
|
15
|
-
const
|
|
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 [_(() => _(() => !!((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(), m = 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), m !== a.o && C(r, "opacity", a.o = m), 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 = _(() => !!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" : ""), m = `${W.icon(e.size())}px`, d = `${W.icon(e.size())}px`;
|
|
502
|
+
return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "width", s.t = m), 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 = _(() => !!(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())), m = n() ? "100%" : "80%";
|
|
515
|
+
return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "max-width", s.t = m), 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 = _(() => !!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())), m = n() ? "100%" : "85%";
|
|
527
|
+
return l !== s.e && k(o, s.e = l), m !== s.t && C(o, "max-width", s.t = m), 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 = _(() => !!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()), m = $("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), m !== a.o && k(r, a.o = m), 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
|
-
},
|
|
595
|
-
return
|
|
596
|
-
},
|
|
597
|
-
const
|
|
598
|
-
width: `${
|
|
599
|
-
height: `${
|
|
610
|
+
}, m = r(), d = a();
|
|
611
|
+
return m && Object.assign(l, m), d && Object.assign(l, d), l;
|
|
612
|
+
}, s = (l, m, 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: `${-
|
|
603
|
-
"z-index":
|
|
617
|
+
bottom: `${-W.icon(e.size()) * l}px`,
|
|
618
|
+
right: `${-W.icon(e.size()) * (l * 0.71)}px`,
|
|
619
|
+
"z-index": m,
|
|
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(), m = l.firstChild;
|
|
626
|
+
return h(l, (() => {
|
|
627
|
+
var d = _(() => (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
|
-
})(),
|
|
623
|
-
var d =
|
|
638
|
+
})(), m), h(l, (() => {
|
|
639
|
+
var d = _(() => (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
|
-
})(),
|
|
635
|
-
var
|
|
650
|
+
})(), m), h(m, () => 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(m, "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 = _(() => !!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 = _(() => !!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()), m = $("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), m !== o.a && k(i, o.a = m), 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 = _(() => !!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 = _(() => 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,
|
|
778
|
-
const
|
|
779
|
-
for (const
|
|
780
|
-
switch (
|
|
793
|
+
let i = 0, r = 0, a = 0, o = 0, s = 0, l = 0;
|
|
794
|
+
const m = [];
|
|
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 && m.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
|
|
798
|
-
let
|
|
799
|
-
if (
|
|
800
|
-
const
|
|
801
|
-
|
|
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);
|
|
814
|
+
let N;
|
|
815
|
+
if (m.length > 0) {
|
|
816
|
+
const z = Math.round(m.reduce((g, R) => g + R[0], 0) / m.length), S = Math.round(m.reduce((g, R) => g + R[1], 0) / m.length), E = Math.round(m.reduce((g, R) => g + R[2], 0) / m.length), I = P / 255;
|
|
817
|
+
N = `rgb(${Math.round(z * I)}, ${Math.round(S * I)}, ${Math.round(E * I)})`;
|
|
802
818
|
} else
|
|
803
|
-
|
|
804
|
-
let
|
|
805
|
-
return
|
|
819
|
+
N = 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:
|
|
812
|
-
color:
|
|
823
|
+
state: y,
|
|
824
|
+
isOn: O,
|
|
825
|
+
isUnavailable: y === "unavailable",
|
|
826
|
+
brightness: P,
|
|
827
|
+
brightnessPercent: w,
|
|
828
|
+
color: N,
|
|
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, m = r.length === 0;
|
|
879
|
+
if (l || m)
|
|
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 = _(() => !!(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), N = Math.round(n.height ?? 0), T = dt(r), z = dt(o);
|
|
1040
|
+
(Math.abs(w - T) > i || Math.abs(N - z) > i) && (a(w), s(N));
|
|
1025
1041
|
});
|
|
1026
|
-
const
|
|
1042
|
+
const l = A(() => {
|
|
1027
1043
|
if (t.variant)
|
|
1028
|
-
return typeof t.variant == "string" ?
|
|
1029
|
-
}),
|
|
1044
|
+
return typeof t.variant == "string" ? Gt(t.variant) : t.variant;
|
|
1045
|
+
}), m = A(() => ({
|
|
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, N) => w.width === N.width && w.height === N.height && w.gridWidth === N.gridWidth && w.gridHeight === N.gridHeight
|
|
1052
|
+
}), d = A(() => {
|
|
1053
|
+
const w = m();
|
|
1054
|
+
return He(w.gridWidth, w.gridHeight);
|
|
1055
|
+
}), x = A(() => {
|
|
1056
|
+
const w = m();
|
|
1057
|
+
return Be(w.width, w.height);
|
|
1058
|
+
}), p = A(() => {
|
|
1059
|
+
const w = m();
|
|
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(m());
|
|
1070
|
+
}), Y(() => {
|
|
1071
|
+
u._bridge.setIsStub(!1);
|
|
1056
1072
|
}));
|
|
1057
1073
|
const b = {
|
|
1058
1074
|
size: d,
|
|
1059
|
-
orientation:
|
|
1060
|
-
contentLayout:
|
|
1061
|
-
dimensions:
|
|
1075
|
+
orientation: x,
|
|
1076
|
+
contentLayout: p,
|
|
1077
|
+
dimensions: m,
|
|
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 = A(() => t.emptyState && !t.gradient ? y : t.gradient), P = A(() => ({
|
|
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(), N = w.firstChild, T = N.firstChild, z = e;
|
|
1091
|
+
return typeof z == "function" ? Ct(z, w) : e = w, h(N, (() => {
|
|
1092
|
+
var S = _(() => !!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((g) => {
|
|
1096
|
+
var R = F.BACKGROUND, H = $("absolute inset-0 opacity-20 blur-2xl", t.backgroundGlow);
|
|
1097
|
+
return R !== g.e && C(E, "z-index", g.e = R), H !== g.t && k(I, g.t = H), g;
|
|
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 = _(() => !!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(N, (() => {
|
|
1117
|
+
var S = _(() => !!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(), g = $(
|
|
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), g !== S.a && k(N, S.a = g), 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 = _(() => !!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 = _(() => !!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 = _(() => !!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 [scrollbar-gutter:stable]">'), on = /* @__PURE__ */ v('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t 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, (g) => {
|
|
1236
|
+
g && r({
|
|
1237
|
+
...g
|
|
1238
|
+
});
|
|
1239
|
+
})), Y(gt(() => e.configSchema, (g) => {
|
|
1240
|
+
g && o(bt(g));
|
|
1241
|
+
}));
|
|
1242
|
+
const s = () => n() && JSON.stringify(i()) !== JSON.stringify(e.config), l = (g) => {
|
|
1243
|
+
!g && e.config && r({
|
|
1244
|
+
...e.config
|
|
1245
|
+
}), e.onOpenChange(g);
|
|
1246
|
+
}, m = () => {
|
|
1247
|
+
e.onConfigSave?.(i());
|
|
1248
|
+
}, [d, x] = L(e.defaultTab ?? "controls"), p = () => {
|
|
1249
|
+
const g = e.maxWidth ?? "3xl";
|
|
1220
1250
|
return {
|
|
1221
1251
|
sm: "max-w-sm",
|
|
1222
1252
|
md: "max-w-md",
|
|
@@ -1225,125 +1255,141 @@ function Wn(t) {
|
|
|
1225
1255
|
"2xl": "max-w-2xl",
|
|
1226
1256
|
"3xl": "max-w-3xl",
|
|
1227
1257
|
"4xl": "max-w-4xl"
|
|
1228
|
-
}[
|
|
1229
|
-
},
|
|
1258
|
+
}[g];
|
|
1259
|
+
}, c = () => {
|
|
1230
1260
|
if (e.tabs) return e.tabs;
|
|
1231
|
-
const
|
|
1232
|
-
return
|
|
1261
|
+
const g = [];
|
|
1262
|
+
return g.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
|
+
}), g.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
|
+
}), g.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
|
+
}), g;
|
|
1286
|
+
}, u = async () => {
|
|
1249
1287
|
if (e.debugData !== void 0)
|
|
1250
1288
|
try {
|
|
1251
|
-
const
|
|
1252
|
-
await navigator.clipboard.writeText(
|
|
1289
|
+
const g = typeof e.debugData == "string" ? e.debugData : JSON.stringify(e.debugData, null, 2);
|
|
1290
|
+
await navigator.clipboard.writeText(g);
|
|
1253
1291
|
} catch {
|
|
1254
1292
|
}
|
|
1255
|
-
},
|
|
1256
|
-
const
|
|
1257
|
-
return
|
|
1258
|
-
},
|
|
1259
|
-
return
|
|
1293
|
+
}, b = () => {
|
|
1294
|
+
const g = c();
|
|
1295
|
+
return g.find((H) => H.id === d())?.content ?? g[0]?.content;
|
|
1296
|
+
}, y = e.ResponsiveDialog, O = e.ResponsiveDialogContent, P = e.ResponsiveDialogHeader, w = e.ResponsiveDialogTitle, N = e.ResponsiveDialogDescription, T = e.Button, z = e.SchemaForm, S = (g) => n() ? l(g) : e.onOpenChange(g), E = () => n() ? s() : e.hasUnsavedChanges, I = () => n() ? m : 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: (g) => S(g),
|
|
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
|
|
1312
|
+
var g = nn();
|
|
1313
|
+
return h(g, V(w, {
|
|
1278
1314
|
class: "truncate leading-tight",
|
|
1279
1315
|
get children() {
|
|
1280
1316
|
return e.title;
|
|
1281
1317
|
}
|
|
1282
|
-
}), null),
|
|
1318
|
+
}), null), h(g, V(N, {
|
|
1283
1319
|
class: "sr-only",
|
|
1284
1320
|
children: "Widget configuration dialog"
|
|
1285
|
-
}), null),
|
|
1321
|
+
}), null), g;
|
|
1286
1322
|
})(), (() => {
|
|
1287
|
-
var
|
|
1288
|
-
return
|
|
1323
|
+
var g = rn(), R = g.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
|
-
}))),
|
|
1334
|
+
onClick: () => x(H.id)
|
|
1335
|
+
}))), h(g, 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),
|
|
1307
|
-
get when() {
|
|
1308
|
-
return D(() => !!(n() === "edit" && e.onSave))() && e.hasUnsavedChanges;
|
|
1309
|
-
},
|
|
1310
|
-
get children() {
|
|
1311
|
-
return W(u, {
|
|
1312
|
-
size: "sm",
|
|
1313
|
-
onClick: () => e.onSave?.(),
|
|
1314
|
-
children: "Save"
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
}), null), f(s, W(K, {
|
|
1318
|
-
get when() {
|
|
1319
|
-
return D(() => n() === "edit")() && e.onDelete;
|
|
1320
|
-
},
|
|
1321
|
-
get children() {
|
|
1322
|
-
return W(u, {
|
|
1323
|
-
size: "sm",
|
|
1324
|
-
variant: "destructive",
|
|
1325
|
-
onClick: () => e.onDelete?.(),
|
|
1326
|
-
children: "Delete"
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
}), null), s;
|
|
1342
|
+
}), null), g;
|
|
1330
1343
|
})()];
|
|
1331
1344
|
}
|
|
1332
1345
|
}), (() => {
|
|
1333
|
-
var
|
|
1334
|
-
return
|
|
1335
|
-
})(),
|
|
1346
|
+
var g = an();
|
|
1347
|
+
return h(g, b), g;
|
|
1348
|
+
})(), V(J, {
|
|
1336
1349
|
get when() {
|
|
1337
|
-
return
|
|
1350
|
+
return _(() => d() === "edit")() && (I() || e.onDelete) || d() === "debug" && e.debugData !== void 0;
|
|
1338
1351
|
},
|
|
1339
1352
|
get children() {
|
|
1340
|
-
var
|
|
1341
|
-
return
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
children
|
|
1346
|
-
|
|
1353
|
+
var g = on();
|
|
1354
|
+
return h(g, V(J, {
|
|
1355
|
+
get when() {
|
|
1356
|
+
return _(() => d() === "edit")() && e.onDelete;
|
|
1357
|
+
},
|
|
1358
|
+
get children() {
|
|
1359
|
+
return V(T, {
|
|
1360
|
+
size: "sm",
|
|
1361
|
+
variant: "destructive",
|
|
1362
|
+
onClick: () => e.onDelete?.(),
|
|
1363
|
+
children: "Delete"
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
}), null), h(g, V(J, {
|
|
1367
|
+
get when() {
|
|
1368
|
+
return _(() => d() === "edit")() && I();
|
|
1369
|
+
},
|
|
1370
|
+
get children() {
|
|
1371
|
+
return V(T, {
|
|
1372
|
+
size: "sm",
|
|
1373
|
+
get disabled() {
|
|
1374
|
+
return !E();
|
|
1375
|
+
},
|
|
1376
|
+
onClick: () => I()?.(),
|
|
1377
|
+
children: "Save"
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
}), null), h(g, V(J, {
|
|
1381
|
+
get when() {
|
|
1382
|
+
return _(() => d() === "debug")() && e.debugData !== void 0;
|
|
1383
|
+
},
|
|
1384
|
+
get children() {
|
|
1385
|
+
return V(T, {
|
|
1386
|
+
size: "sm",
|
|
1387
|
+
variant: "outline",
|
|
1388
|
+
onClick: u,
|
|
1389
|
+
children: "Copy"
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
}), null), g;
|
|
1347
1393
|
}
|
|
1348
1394
|
})];
|
|
1349
1395
|
}
|
|
@@ -1351,80 +1397,80 @@ function Wn(t) {
|
|
|
1351
1397
|
}
|
|
1352
1398
|
});
|
|
1353
1399
|
}
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
function
|
|
1400
|
+
Mt(["click"]);
|
|
1401
|
+
const Q = 32, f = Q / 2, B = "white", nt = "rgba(0,0,0,0.4)", ut = 2, rt = 3;
|
|
1402
|
+
function ln(t) {
|
|
1357
1403
|
return `url("data:image/svg+xml,${encodeURIComponent(t)}")`;
|
|
1358
1404
|
}
|
|
1359
|
-
function
|
|
1360
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
1405
|
+
function it(t) {
|
|
1406
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}">${t}</svg>`;
|
|
1361
1407
|
}
|
|
1362
|
-
const
|
|
1408
|
+
const cn = it(`
|
|
1363
1409
|
<g transform="translate(6, 2)">
|
|
1364
1410
|
<!-- shadow -->
|
|
1365
|
-
<g stroke="${
|
|
1411
|
+
<g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1366
1412
|
<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
1413
|
</g>
|
|
1368
1414
|
<!-- main -->
|
|
1369
|
-
<g stroke="${B}" stroke-width="${
|
|
1415
|
+
<g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1370
1416
|
<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
1417
|
</g>
|
|
1372
1418
|
</g>
|
|
1373
|
-
`),
|
|
1419
|
+
`), un = it(`
|
|
1374
1420
|
<g>
|
|
1375
|
-
<circle cx="${
|
|
1376
|
-
<circle cx="${
|
|
1377
|
-
<circle cx="${
|
|
1421
|
+
<circle cx="${f}" cy="${f}" r="8" stroke="${nt}" stroke-width="${rt}" fill="none"/>
|
|
1422
|
+
<circle cx="${f}" cy="${f}" r="8" stroke="${B}" stroke-width="1.5" fill="none"/>
|
|
1423
|
+
<circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
|
|
1378
1424
|
</g>
|
|
1379
|
-
`),
|
|
1425
|
+
`), dn = it(`
|
|
1380
1426
|
<g>
|
|
1381
1427
|
<!-- shadow -->
|
|
1382
|
-
<g stroke="${
|
|
1383
|
-
<line x1="6" y1="${
|
|
1384
|
-
<polyline points="10,${
|
|
1385
|
-
<polyline points="22,${
|
|
1428
|
+
<g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1429
|
+
<line x1="6" y1="${f}" x2="26" y2="${f}"/>
|
|
1430
|
+
<polyline points="10,${f - 4} 6,${f} 10,${f + 4}"/>
|
|
1431
|
+
<polyline points="22,${f - 4} 26,${f} 22,${f + 4}"/>
|
|
1386
1432
|
</g>
|
|
1387
1433
|
<!-- main -->
|
|
1388
|
-
<g stroke="${B}" stroke-width="${
|
|
1389
|
-
<line x1="6" y1="${
|
|
1390
|
-
<polyline points="10,${
|
|
1391
|
-
<polyline points="22,${
|
|
1434
|
+
<g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1435
|
+
<line x1="6" y1="${f}" x2="26" y2="${f}"/>
|
|
1436
|
+
<polyline points="10,${f - 4} 6,${f} 10,${f + 4}"/>
|
|
1437
|
+
<polyline points="22,${f - 4} 26,${f} 22,${f + 4}"/>
|
|
1392
1438
|
</g>
|
|
1393
1439
|
<!-- center grip dots -->
|
|
1394
|
-
<circle cx="${
|
|
1395
|
-
<circle cx="${
|
|
1396
|
-
<circle cx="${
|
|
1440
|
+
<circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
|
|
1441
|
+
<circle cx="${f - 5}" cy="${f}" r="1" fill="${B}" opacity="0.6"/>
|
|
1442
|
+
<circle cx="${f + 5}" cy="${f}" r="1" fill="${B}" opacity="0.6"/>
|
|
1397
1443
|
</g>
|
|
1398
|
-
`),
|
|
1444
|
+
`), gn = it(`
|
|
1399
1445
|
<g>
|
|
1400
1446
|
<!-- shadow -->
|
|
1401
|
-
<g stroke="${
|
|
1402
|
-
<line x1="${
|
|
1403
|
-
<polyline points="${
|
|
1404
|
-
<polyline points="${
|
|
1447
|
+
<g stroke="${nt}" stroke-width="${rt}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1448
|
+
<line x1="${f}" y1="6" x2="${f}" y2="26"/>
|
|
1449
|
+
<polyline points="${f - 4},10 ${f},6 ${f + 4},10"/>
|
|
1450
|
+
<polyline points="${f - 4},22 ${f},26 ${f + 4},22"/>
|
|
1405
1451
|
</g>
|
|
1406
1452
|
<!-- main -->
|
|
1407
|
-
<g stroke="${B}" stroke-width="${
|
|
1408
|
-
<line x1="${
|
|
1409
|
-
<polyline points="${
|
|
1410
|
-
<polyline points="${
|
|
1453
|
+
<g stroke="${B}" stroke-width="${ut}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1454
|
+
<line x1="${f}" y1="6" x2="${f}" y2="26"/>
|
|
1455
|
+
<polyline points="${f - 4},10 ${f},6 ${f + 4},10"/>
|
|
1456
|
+
<polyline points="${f - 4},22 ${f},26 ${f + 4},22"/>
|
|
1411
1457
|
</g>
|
|
1412
1458
|
<!-- center grip dots -->
|
|
1413
|
-
<circle cx="${
|
|
1414
|
-
<circle cx="${
|
|
1415
|
-
<circle cx="${
|
|
1459
|
+
<circle cx="${f}" cy="${f}" r="1.5" fill="${B}"/>
|
|
1460
|
+
<circle cx="${f}" cy="${f - 5}" r="1" fill="${B}" opacity="0.6"/>
|
|
1461
|
+
<circle cx="${f}" cy="${f + 5}" r="1" fill="${B}" opacity="0.6"/>
|
|
1416
1462
|
</g>
|
|
1417
1463
|
`);
|
|
1418
|
-
function
|
|
1419
|
-
return { css: `${
|
|
1420
|
-
}
|
|
1421
|
-
const
|
|
1422
|
-
tap:
|
|
1423
|
-
hold:
|
|
1424
|
-
slideHorizontal:
|
|
1425
|
-
slideVertical:
|
|
1464
|
+
function tt(t, e, n) {
|
|
1465
|
+
return { css: `${ln(t)} ${e} ${n}, auto`, hotspotX: e, hotspotY: n };
|
|
1466
|
+
}
|
|
1467
|
+
const K = {
|
|
1468
|
+
tap: tt(cn, 12, 4),
|
|
1469
|
+
hold: tt(un, 16, 16),
|
|
1470
|
+
slideHorizontal: tt(dn, f, f),
|
|
1471
|
+
slideVertical: tt(gn, f, f)
|
|
1426
1472
|
};
|
|
1427
|
-
function
|
|
1473
|
+
function Pn(t, e) {
|
|
1428
1474
|
const n = {
|
|
1429
1475
|
isDown: !1,
|
|
1430
1476
|
startX: 0,
|
|
@@ -1440,79 +1486,79 @@ function In(t, e) {
|
|
|
1440
1486
|
element: null
|
|
1441
1487
|
}, i = 10, r = 5, a = () => {
|
|
1442
1488
|
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null), n.slideActivationTimer && (clearTimeout(n.slideActivationTimer), n.slideActivationTimer = null);
|
|
1443
|
-
}, o = (
|
|
1489
|
+
}, o = (c) => {
|
|
1444
1490
|
const b = t().slide;
|
|
1445
1491
|
if (b?.orientation === "horizontal") return "horizontal";
|
|
1446
1492
|
if (b?.orientation === "vertical") return "vertical";
|
|
1447
|
-
if (
|
|
1448
|
-
const
|
|
1449
|
-
return
|
|
1493
|
+
if (c) {
|
|
1494
|
+
const O = c.getBoundingClientRect();
|
|
1495
|
+
return O.height > O.width ? "vertical" : "horizontal";
|
|
1450
1496
|
}
|
|
1451
1497
|
return (e?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1452
|
-
},
|
|
1453
|
-
const
|
|
1454
|
-
if (!(!
|
|
1455
|
-
if (
|
|
1456
|
-
const b =
|
|
1498
|
+
}, s = (c) => {
|
|
1499
|
+
const u = t();
|
|
1500
|
+
if (!(!u.tap && !u.hold && !u.slide)) {
|
|
1501
|
+
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) {
|
|
1502
|
+
const b = u.hold.delay ?? 300;
|
|
1457
1503
|
n.holdTimer = setTimeout(() => {
|
|
1458
|
-
n.isDown && !n.hasMoved && (
|
|
1504
|
+
n.isDown && !n.hasMoved && (u.hold.action(), n.isDown = !1);
|
|
1459
1505
|
}, b);
|
|
1460
1506
|
}
|
|
1461
|
-
if (
|
|
1462
|
-
const b =
|
|
1507
|
+
if (u.slide) {
|
|
1508
|
+
const b = u.slide.activationDelay ?? 0;
|
|
1463
1509
|
b > 0 ? n.slideActivationTimer = setTimeout(() => {
|
|
1464
1510
|
n.slideActive = !0;
|
|
1465
1511
|
}, b) : n.slideActive = !0;
|
|
1466
1512
|
}
|
|
1467
1513
|
}
|
|
1468
|
-
},
|
|
1514
|
+
}, l = (c) => {
|
|
1469
1515
|
if (!n.isDown) return;
|
|
1470
|
-
const
|
|
1471
|
-
n.currentX =
|
|
1472
|
-
const b = n.currentX - n.startX,
|
|
1473
|
-
if (!n.lockedAxis &&
|
|
1474
|
-
|
|
1516
|
+
const u = t();
|
|
1517
|
+
n.currentX = c.clientX, n.currentY = c.clientY;
|
|
1518
|
+
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), N = c.currentTarget, T = o(N);
|
|
1519
|
+
if (!n.lockedAxis && w > r && (O > P ? n.lockedAxis = "horizontal" : n.lockedAxis = "vertical", u.slide && n.lockedAxis !== T)) {
|
|
1520
|
+
N.releasePointerCapture(c.pointerId), n.isDown = !1, n.slideActive = !1, a();
|
|
1475
1521
|
return;
|
|
1476
1522
|
}
|
|
1477
|
-
if (
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1523
|
+
if (w > i && (n.hasMoved = !0, a()), u.slide && n.slideActive && n.hasMoved && n.lockedAxis === T) {
|
|
1524
|
+
const z = u.slide.min ?? 0, S = u.slide.max ?? 100, E = S - z, I = T === "vertical" ? -y : b, g = T === "vertical" ? c.currentTarget.clientHeight : c.currentTarget.clientWidth, H = I / g * E, kt = Math.max(z, Math.min(S, u.slide.value + H));
|
|
1525
|
+
u.slide.onChange(Math.round(kt)), n.startX = n.currentX, n.startY = n.currentY, c.preventDefault();
|
|
1480
1526
|
}
|
|
1481
|
-
},
|
|
1527
|
+
}, m = (c) => {
|
|
1482
1528
|
if (!n.isDown) return;
|
|
1483
|
-
const
|
|
1484
|
-
if (a(),
|
|
1485
|
-
const
|
|
1486
|
-
n.isDown &&
|
|
1529
|
+
const u = t(), b = u.hold?.delay ?? 300;
|
|
1530
|
+
if (a(), u.tap && !n.hasMoved) {
|
|
1531
|
+
const y = Date.now() - n.startTime;
|
|
1532
|
+
n.isDown && y < b && u.tap();
|
|
1487
1533
|
}
|
|
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
|
|
1534
|
+
n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, c.currentTarget.releasePointerCapture(c.pointerId);
|
|
1535
|
+
}, d = (c) => {
|
|
1536
|
+
a(), n.isDown = !1, n.hasMoved = !1, n.slideActive = !1, n.lockedAxis = null, c.currentTarget.releasePointerCapture(c.pointerId);
|
|
1537
|
+
}, x = (c) => {
|
|
1538
|
+
const u = t();
|
|
1539
|
+
if (u.slide) {
|
|
1540
|
+
const b = u.slide.orientation;
|
|
1541
|
+
if (b === "horizontal") return K.slideHorizontal.css;
|
|
1542
|
+
if (b === "vertical") return K.slideVertical.css;
|
|
1543
|
+
const y = c.getBoundingClientRect();
|
|
1544
|
+
return y.height > y.width ? K.slideVertical.css : K.slideHorizontal.css;
|
|
1499
1545
|
}
|
|
1500
|
-
return
|
|
1546
|
+
return u.tap ? K.tap.css : u.hold ? K.hold.css : "";
|
|
1501
1547
|
};
|
|
1502
1548
|
return {
|
|
1503
|
-
onPointerDown:
|
|
1504
|
-
onPointerMove:
|
|
1505
|
-
onPointerUp:
|
|
1549
|
+
onPointerDown: s,
|
|
1550
|
+
onPointerMove: l,
|
|
1551
|
+
onPointerUp: m,
|
|
1506
1552
|
onPointerCancel: d,
|
|
1507
|
-
onPointerEnter: (
|
|
1508
|
-
const
|
|
1509
|
-
n.element =
|
|
1553
|
+
onPointerEnter: (c) => {
|
|
1554
|
+
const u = c.currentTarget;
|
|
1555
|
+
n.element = u, u.style.cursor = x(u);
|
|
1510
1556
|
},
|
|
1511
1557
|
dispose: a
|
|
1512
1558
|
};
|
|
1513
1559
|
}
|
|
1514
|
-
function
|
|
1515
|
-
return
|
|
1560
|
+
function Fn(t) {
|
|
1561
|
+
return A(() => {
|
|
1516
1562
|
const e = t.entities();
|
|
1517
1563
|
if (e.length === 0) return;
|
|
1518
1564
|
const n = {
|
|
@@ -1533,14 +1579,14 @@ function Rn(t) {
|
|
|
1533
1579
|
return t.additionalData && Object.assign(n, t.additionalData), n;
|
|
1534
1580
|
});
|
|
1535
1581
|
}
|
|
1536
|
-
function
|
|
1537
|
-
const [e, n] =
|
|
1582
|
+
function Un(t = {}) {
|
|
1583
|
+
const [e, n] = L(!1), [i, r] = L(!1);
|
|
1538
1584
|
return {
|
|
1539
|
-
save: async (
|
|
1585
|
+
save: async (s) => {
|
|
1540
1586
|
if (t.onSave) {
|
|
1541
1587
|
n(!0);
|
|
1542
1588
|
try {
|
|
1543
|
-
await t.onSave(
|
|
1589
|
+
await t.onSave(s), t.onSaveSuccess?.();
|
|
1544
1590
|
} finally {
|
|
1545
1591
|
n(!1);
|
|
1546
1592
|
}
|
|
@@ -1560,8 +1606,8 @@ function Gn(t = {}) {
|
|
|
1560
1606
|
isDeleting: i
|
|
1561
1607
|
};
|
|
1562
1608
|
}
|
|
1563
|
-
function
|
|
1564
|
-
const [e, n] =
|
|
1609
|
+
function Yn(t = "edit") {
|
|
1610
|
+
const [e, n] = L(!1), [i, r] = L(t);
|
|
1565
1611
|
return {
|
|
1566
1612
|
showDialog: e,
|
|
1567
1613
|
setShowDialog: n,
|
|
@@ -1571,11 +1617,11 @@ function Bn(t = "edit") {
|
|
|
1571
1617
|
setActiveTab: r
|
|
1572
1618
|
};
|
|
1573
1619
|
}
|
|
1574
|
-
function
|
|
1575
|
-
const e =
|
|
1620
|
+
function Xn(t) {
|
|
1621
|
+
const e = A(() => t.entity() !== null), n = A(() => {
|
|
1576
1622
|
const r = t.entity();
|
|
1577
1623
|
return r ? t.calculateData(r) : null;
|
|
1578
|
-
}), i =
|
|
1624
|
+
}), i = A(() => e() ? void 0 : t.emptyStateConfig);
|
|
1579
1625
|
return {
|
|
1580
1626
|
entity: t.entity,
|
|
1581
1627
|
data: n,
|
|
@@ -1583,19 +1629,19 @@ function Hn(t) {
|
|
|
1583
1629
|
hasEntity: e
|
|
1584
1630
|
};
|
|
1585
1631
|
}
|
|
1586
|
-
function
|
|
1587
|
-
const e = t.minEntities ?? 1, n =
|
|
1632
|
+
function Kn(t) {
|
|
1633
|
+
const e = t.minEntities ?? 1, n = A(() => t.entities().length), i = A(() => n() >= e), r = A(() => !i() || !t.calculateGroupData ? null : t.calculateGroupData(t.entities())), a = A(() => {
|
|
1588
1634
|
if (!i()) return;
|
|
1589
|
-
const
|
|
1590
|
-
if (!
|
|
1591
|
-
const
|
|
1592
|
-
if (
|
|
1593
|
-
return
|
|
1594
|
-
if (
|
|
1595
|
-
const
|
|
1596
|
-
return
|
|
1635
|
+
const s = t.aggregationMode?.();
|
|
1636
|
+
if (!s || s === "none") return;
|
|
1637
|
+
const l = t.entities();
|
|
1638
|
+
if (s === "light" || s === "binary-sensor" || s === "switch")
|
|
1639
|
+
return Se(l, t.allEntitiesMode);
|
|
1640
|
+
if (s === "sensor") {
|
|
1641
|
+
const m = t.sensorGroupType?.() ?? "mean";
|
|
1642
|
+
return Ce(l, m, !0);
|
|
1597
1643
|
}
|
|
1598
|
-
}), o =
|
|
1644
|
+
}), o = A(() => i() ? void 0 : t.emptyStateConfig);
|
|
1599
1645
|
return {
|
|
1600
1646
|
entities: t.entities,
|
|
1601
1647
|
groupData: r,
|
|
@@ -1605,11 +1651,11 @@ function Ln(t) {
|
|
|
1605
1651
|
count: n
|
|
1606
1652
|
};
|
|
1607
1653
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const [e] =
|
|
1610
|
-
validate:
|
|
1654
|
+
function qn(t) {
|
|
1655
|
+
const [e] = At({
|
|
1656
|
+
validate: Nt(t.schema),
|
|
1611
1657
|
initialValues: t.initialValues
|
|
1612
|
-
}), n =
|
|
1658
|
+
}), n = A(() => e.dirty), i = A(() => e.submitting);
|
|
1613
1659
|
return {
|
|
1614
1660
|
form: e,
|
|
1615
1661
|
isDirty: n,
|
|
@@ -1617,41 +1663,41 @@ function Pn(t) {
|
|
|
1617
1663
|
handleSubmit: (a) => {
|
|
1618
1664
|
t.onSubmit?.(a);
|
|
1619
1665
|
},
|
|
1620
|
-
getValue:
|
|
1621
|
-
setValue:
|
|
1622
|
-
reset:
|
|
1666
|
+
getValue: Et,
|
|
1667
|
+
setValue: Ot,
|
|
1668
|
+
reset: Tt
|
|
1623
1669
|
};
|
|
1624
1670
|
}
|
|
1625
|
-
const
|
|
1626
|
-
function
|
|
1627
|
-
const t = G(), e =
|
|
1628
|
-
const
|
|
1629
|
-
return
|
|
1630
|
-
}), i =
|
|
1631
|
-
const
|
|
1632
|
-
return
|
|
1633
|
-
}), r =
|
|
1671
|
+
const at = ["xs", "sm", "md", "lg", "xl"];
|
|
1672
|
+
function Jn() {
|
|
1673
|
+
const t = G(), e = A(() => at.indexOf(t.size())), n = A(() => {
|
|
1674
|
+
const l = t.size();
|
|
1675
|
+
return l === "xs" || l === "sm";
|
|
1676
|
+
}), i = A(() => {
|
|
1677
|
+
const l = t.size();
|
|
1678
|
+
return l === "lg" || l === "xl";
|
|
1679
|
+
}), r = A(() => e() >= 2);
|
|
1634
1680
|
return {
|
|
1635
1681
|
isCompact: n,
|
|
1636
1682
|
isLarge: i,
|
|
1637
1683
|
showDetail: r,
|
|
1638
|
-
showOn: (
|
|
1639
|
-
hideOn: (
|
|
1640
|
-
matches: (
|
|
1641
|
-
const
|
|
1642
|
-
if (
|
|
1643
|
-
const d =
|
|
1644
|
-
return
|
|
1684
|
+
showOn: (l) => l.includes(t.size()),
|
|
1685
|
+
hideOn: (l) => !l.includes(t.size()),
|
|
1686
|
+
matches: (l) => {
|
|
1687
|
+
const m = l.trim();
|
|
1688
|
+
if (m.endsWith("+")) {
|
|
1689
|
+
const d = m.slice(0, -1), x = at.indexOf(d);
|
|
1690
|
+
return x >= 0 && e() >= x;
|
|
1645
1691
|
}
|
|
1646
|
-
if (
|
|
1647
|
-
const d =
|
|
1648
|
-
return
|
|
1692
|
+
if (m.endsWith("-")) {
|
|
1693
|
+
const d = m.slice(0, -1), x = at.indexOf(d);
|
|
1694
|
+
return x >= 0 && e() <= x;
|
|
1649
1695
|
}
|
|
1650
|
-
return t.size() ===
|
|
1696
|
+
return t.size() === m;
|
|
1651
1697
|
}
|
|
1652
1698
|
};
|
|
1653
1699
|
}
|
|
1654
|
-
const
|
|
1700
|
+
const D = {
|
|
1655
1701
|
ocean: "bg-gradient-to-br from-cyan-600/20 to-blue-700/20",
|
|
1656
1702
|
sunset: "bg-gradient-to-br from-orange-500/20 to-purple-700/20",
|
|
1657
1703
|
forest: "bg-gradient-to-br from-emerald-600/20 to-teal-700/20",
|
|
@@ -1669,7 +1715,7 @@ const M = {
|
|
|
1669
1715
|
sage: "bg-gradient-to-br from-lime-600/20 to-green-600/20",
|
|
1670
1716
|
copper: "bg-gradient-to-br from-amber-600/20 to-amber-800/20",
|
|
1671
1717
|
dusk: "bg-gradient-to-br from-blue-500/20 to-purple-600/20"
|
|
1672
|
-
},
|
|
1718
|
+
}, Zn = {
|
|
1673
1719
|
ocean: "Ocean Breeze",
|
|
1674
1720
|
sunset: "Sunset Glow",
|
|
1675
1721
|
forest: "Forest Dawn",
|
|
@@ -1687,30 +1733,30 @@ const M = {
|
|
|
1687
1733
|
sage: "Sage",
|
|
1688
1734
|
copper: "Copper",
|
|
1689
1735
|
dusk: "Dusk"
|
|
1690
|
-
},
|
|
1691
|
-
function
|
|
1692
|
-
const e = Object.keys(
|
|
1736
|
+
}, Qn = Object.keys(D);
|
|
1737
|
+
function xt(t) {
|
|
1738
|
+
const e = Object.keys(D);
|
|
1693
1739
|
let n = 0;
|
|
1694
1740
|
for (const r of t)
|
|
1695
1741
|
n = (n << 5) - n + r.charCodeAt(0), n = n & n;
|
|
1696
1742
|
const i = Math.abs(n) % e.length;
|
|
1697
1743
|
return e[i];
|
|
1698
1744
|
}
|
|
1699
|
-
function
|
|
1745
|
+
function tr(t, e) {
|
|
1700
1746
|
if (!t) {
|
|
1701
|
-
const i =
|
|
1702
|
-
return
|
|
1747
|
+
const i = xt(e);
|
|
1748
|
+
return D[i];
|
|
1703
1749
|
}
|
|
1704
|
-
if (typeof t == "string" && t in
|
|
1705
|
-
return
|
|
1750
|
+
if (typeof t == "string" && t in D)
|
|
1751
|
+
return D[t];
|
|
1706
1752
|
if (typeof t == "string")
|
|
1707
1753
|
return t;
|
|
1708
|
-
const n =
|
|
1709
|
-
return
|
|
1754
|
+
const n = xt(e);
|
|
1755
|
+
return D[n];
|
|
1710
1756
|
}
|
|
1711
|
-
const
|
|
1757
|
+
const q = {
|
|
1712
1758
|
ocean: {
|
|
1713
|
-
gradient:
|
|
1759
|
+
gradient: D.ocean,
|
|
1714
1760
|
bg: "bg-cyan-600/20",
|
|
1715
1761
|
icon: "bg-cyan-500 dark:bg-cyan-400",
|
|
1716
1762
|
glow: "shadow-cyan-500/50 dark:shadow-cyan-400/50",
|
|
@@ -1720,7 +1766,7 @@ const X = {
|
|
|
1720
1766
|
}
|
|
1721
1767
|
},
|
|
1722
1768
|
sunset: {
|
|
1723
|
-
gradient:
|
|
1769
|
+
gradient: D.sunset,
|
|
1724
1770
|
bg: "bg-orange-500/20",
|
|
1725
1771
|
icon: "bg-orange-500 dark:bg-orange-400",
|
|
1726
1772
|
glow: "shadow-orange-500/50 dark:shadow-orange-400/50",
|
|
@@ -1730,7 +1776,7 @@ const X = {
|
|
|
1730
1776
|
}
|
|
1731
1777
|
},
|
|
1732
1778
|
forest: {
|
|
1733
|
-
gradient:
|
|
1779
|
+
gradient: D.forest,
|
|
1734
1780
|
bg: "bg-emerald-600/20",
|
|
1735
1781
|
icon: "bg-emerald-500 dark:bg-emerald-400",
|
|
1736
1782
|
glow: "shadow-emerald-500/50 dark:shadow-emerald-400/50",
|
|
@@ -1740,7 +1786,7 @@ const X = {
|
|
|
1740
1786
|
}
|
|
1741
1787
|
},
|
|
1742
1788
|
lavender: {
|
|
1743
|
-
gradient:
|
|
1789
|
+
gradient: D.lavender,
|
|
1744
1790
|
bg: "bg-purple-500/20",
|
|
1745
1791
|
icon: "bg-purple-500 dark:bg-purple-400",
|
|
1746
1792
|
glow: "shadow-purple-500/50 dark:shadow-purple-400/50",
|
|
@@ -1750,7 +1796,7 @@ const X = {
|
|
|
1750
1796
|
}
|
|
1751
1797
|
},
|
|
1752
1798
|
golden: {
|
|
1753
|
-
gradient:
|
|
1799
|
+
gradient: D.golden,
|
|
1754
1800
|
bg: "bg-yellow-500/20",
|
|
1755
1801
|
icon: "bg-yellow-500 dark:bg-yellow-400",
|
|
1756
1802
|
glow: "shadow-yellow-500/50 dark:shadow-yellow-400/50",
|
|
@@ -1760,7 +1806,7 @@ const X = {
|
|
|
1760
1806
|
}
|
|
1761
1807
|
},
|
|
1762
1808
|
midnight: {
|
|
1763
|
-
gradient:
|
|
1809
|
+
gradient: D.midnight,
|
|
1764
1810
|
bg: "bg-blue-700/20",
|
|
1765
1811
|
icon: "bg-blue-700 dark:bg-blue-600",
|
|
1766
1812
|
glow: "shadow-blue-700/50 dark:shadow-blue-600/50",
|
|
@@ -1770,7 +1816,7 @@ const X = {
|
|
|
1770
1816
|
}
|
|
1771
1817
|
},
|
|
1772
1818
|
rose: {
|
|
1773
|
-
gradient:
|
|
1819
|
+
gradient: D.rose,
|
|
1774
1820
|
bg: "bg-pink-400/20",
|
|
1775
1821
|
icon: "bg-pink-500 dark:bg-pink-400",
|
|
1776
1822
|
glow: "shadow-pink-500/50 dark:shadow-pink-400/50",
|
|
@@ -1780,7 +1826,7 @@ const X = {
|
|
|
1780
1826
|
}
|
|
1781
1827
|
},
|
|
1782
1828
|
mint: {
|
|
1783
|
-
gradient:
|
|
1829
|
+
gradient: D.mint,
|
|
1784
1830
|
bg: "bg-green-400/20",
|
|
1785
1831
|
icon: "bg-green-500 dark:bg-green-400",
|
|
1786
1832
|
glow: "shadow-green-500/50 dark:shadow-green-400/50",
|
|
@@ -1790,7 +1836,7 @@ const X = {
|
|
|
1790
1836
|
}
|
|
1791
1837
|
},
|
|
1792
1838
|
slate: {
|
|
1793
|
-
gradient:
|
|
1839
|
+
gradient: D.slate,
|
|
1794
1840
|
bg: "bg-slate-600/20",
|
|
1795
1841
|
icon: "bg-slate-600 dark:bg-slate-500",
|
|
1796
1842
|
glow: "shadow-slate-600/50 dark:shadow-slate-500/50",
|
|
@@ -1800,7 +1846,7 @@ const X = {
|
|
|
1800
1846
|
}
|
|
1801
1847
|
},
|
|
1802
1848
|
coral: {
|
|
1803
|
-
gradient:
|
|
1849
|
+
gradient: D.coral,
|
|
1804
1850
|
bg: "bg-pink-300/20",
|
|
1805
1851
|
icon: "bg-pink-400 dark:bg-pink-300",
|
|
1806
1852
|
glow: "shadow-pink-400/50 dark:shadow-pink-300/50",
|
|
@@ -1810,7 +1856,7 @@ const X = {
|
|
|
1810
1856
|
}
|
|
1811
1857
|
},
|
|
1812
1858
|
aurora: {
|
|
1813
|
-
gradient:
|
|
1859
|
+
gradient: D.aurora,
|
|
1814
1860
|
bg: "bg-blue-500/20",
|
|
1815
1861
|
icon: "bg-blue-500 dark:bg-blue-400",
|
|
1816
1862
|
glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
|
|
@@ -1820,7 +1866,7 @@ const X = {
|
|
|
1820
1866
|
}
|
|
1821
1867
|
},
|
|
1822
1868
|
ember: {
|
|
1823
|
-
gradient:
|
|
1869
|
+
gradient: D.ember,
|
|
1824
1870
|
bg: "bg-red-500/20",
|
|
1825
1871
|
icon: "bg-red-500 dark:bg-red-400",
|
|
1826
1872
|
glow: "shadow-red-500/50 dark:shadow-red-400/50",
|
|
@@ -1830,7 +1876,7 @@ const X = {
|
|
|
1830
1876
|
}
|
|
1831
1877
|
},
|
|
1832
1878
|
steel: {
|
|
1833
|
-
gradient:
|
|
1879
|
+
gradient: D.steel,
|
|
1834
1880
|
bg: "bg-gray-500/20",
|
|
1835
1881
|
icon: "bg-gray-500 dark:bg-gray-400",
|
|
1836
1882
|
glow: void 0,
|
|
@@ -1840,7 +1886,7 @@ const X = {
|
|
|
1840
1886
|
}
|
|
1841
1887
|
},
|
|
1842
1888
|
twilight: {
|
|
1843
|
-
gradient:
|
|
1889
|
+
gradient: D.twilight,
|
|
1844
1890
|
bg: "bg-violet-600/20",
|
|
1845
1891
|
icon: "bg-violet-500 dark:bg-violet-400",
|
|
1846
1892
|
glow: "shadow-violet-500/50 dark:shadow-violet-400/50",
|
|
@@ -1850,7 +1896,7 @@ const X = {
|
|
|
1850
1896
|
}
|
|
1851
1897
|
},
|
|
1852
1898
|
sage: {
|
|
1853
|
-
gradient:
|
|
1899
|
+
gradient: D.sage,
|
|
1854
1900
|
bg: "bg-lime-600/20",
|
|
1855
1901
|
icon: "bg-lime-500 dark:bg-lime-400",
|
|
1856
1902
|
glow: "shadow-lime-500/50 dark:shadow-lime-400/50",
|
|
@@ -1860,7 +1906,7 @@ const X = {
|
|
|
1860
1906
|
}
|
|
1861
1907
|
},
|
|
1862
1908
|
copper: {
|
|
1863
|
-
gradient:
|
|
1909
|
+
gradient: D.copper,
|
|
1864
1910
|
bg: "bg-amber-600/20",
|
|
1865
1911
|
icon: "bg-amber-600 dark:bg-amber-500",
|
|
1866
1912
|
glow: "shadow-amber-600/50 dark:shadow-amber-500/50",
|
|
@@ -1870,7 +1916,7 @@ const X = {
|
|
|
1870
1916
|
}
|
|
1871
1917
|
},
|
|
1872
1918
|
dusk: {
|
|
1873
|
-
gradient:
|
|
1919
|
+
gradient: D.dusk,
|
|
1874
1920
|
bg: "bg-blue-500/20",
|
|
1875
1921
|
icon: "bg-blue-500 dark:bg-blue-400",
|
|
1876
1922
|
glow: "shadow-blue-500/50 dark:shadow-blue-400/50",
|
|
@@ -1879,102 +1925,116 @@ const X = {
|
|
|
1879
1925
|
muted: "text-blue-400/60 dark:text-blue-300/60"
|
|
1880
1926
|
}
|
|
1881
1927
|
}
|
|
1882
|
-
},
|
|
1883
|
-
unavailable:
|
|
1884
|
-
active:
|
|
1885
|
-
inactive:
|
|
1886
|
-
success:
|
|
1887
|
-
warning:
|
|
1888
|
-
error:
|
|
1928
|
+
}, er = {
|
|
1929
|
+
unavailable: q.steel,
|
|
1930
|
+
active: q.ocean,
|
|
1931
|
+
inactive: q.steel,
|
|
1932
|
+
success: q.forest,
|
|
1933
|
+
warning: q.ember,
|
|
1934
|
+
error: q.rose
|
|
1935
|
+
}, nr = {
|
|
1936
|
+
/** Optional display name override (renders as text input) */
|
|
1937
|
+
title: () => X.string().optional().meta({ title: "Title", description: "Optional display name override" }),
|
|
1938
|
+
/** Multi-select entity picker for a HA domain */
|
|
1939
|
+
entityIds: (t) => X.array(X.string()).default([]).meta({ domain: t, title: "Entities" }),
|
|
1940
|
+
/** Single-select entity picker for a HA domain */
|
|
1941
|
+
singleEntity: (t) => X.array(X.string()).default([]).meta({ domain: t, title: "Entity", singleSelect: !0 }),
|
|
1942
|
+
/** Area picker dropdown */
|
|
1943
|
+
areaId: () => X.string().optional().meta({ formType: "area-picker", title: "Area" })
|
|
1889
1944
|
};
|
|
1890
|
-
let
|
|
1891
|
-
function
|
|
1892
|
-
return
|
|
1945
|
+
let ot = null;
|
|
1946
|
+
function mn() {
|
|
1947
|
+
return ot || (ot = getComputedStyle(document.documentElement)), ot;
|
|
1893
1948
|
}
|
|
1894
|
-
function
|
|
1949
|
+
function rr(t) {
|
|
1895
1950
|
const e = t.startsWith("--") ? t : `--${t}`;
|
|
1896
|
-
return
|
|
1951
|
+
return mn().getPropertyValue(e).trim();
|
|
1897
1952
|
}
|
|
1898
|
-
function
|
|
1953
|
+
function ir() {
|
|
1899
1954
|
return document.documentElement.classList.contains("dark");
|
|
1900
1955
|
}
|
|
1901
|
-
const
|
|
1956
|
+
const fn = "0.3.3", hn = {
|
|
1957
|
+
version: fn
|
|
1958
|
+
}, ar = hn.version;
|
|
1902
1959
|
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
|
-
|
|
1960
|
+
Zn as GRADIENT_NAMES,
|
|
1961
|
+
D as GRADIENT_PRESETS,
|
|
1962
|
+
Qn as GRADIENT_PRESET_KEYS,
|
|
1963
|
+
Bn as Glow,
|
|
1964
|
+
lr as GridSizeSchema,
|
|
1965
|
+
cr as PublishBodySchema,
|
|
1966
|
+
ur as PublishConfirmSchema,
|
|
1967
|
+
dr as PublishRequestSchema,
|
|
1968
|
+
ar as SDK_VERSION,
|
|
1969
|
+
F as WIDGET_Z,
|
|
1970
|
+
U as Widget,
|
|
1971
|
+
Jt as WidgetContent,
|
|
1972
|
+
st as WidgetCtx,
|
|
1973
|
+
jn as WidgetDialog,
|
|
1974
|
+
re as WidgetEmptyState,
|
|
1975
|
+
ue as WidgetIcon,
|
|
1976
|
+
gr as WidgetManifestSchema,
|
|
1977
|
+
$t as WidgetMetrics,
|
|
1978
|
+
Yt as WidgetSliderFill,
|
|
1979
|
+
Ln as WidgetStack,
|
|
1980
|
+
be as WidgetStatus,
|
|
1981
|
+
we as WidgetSubtitle,
|
|
1982
|
+
pe as WidgetTitle,
|
|
1983
|
+
Te as WidgetValue,
|
|
1984
|
+
Gn as allEntitiesInState,
|
|
1985
|
+
Hn as anyEntityInState,
|
|
1986
|
+
Nn as applyCssVars,
|
|
1987
|
+
An as applyLayout,
|
|
1988
|
+
lt as builtInVariants,
|
|
1989
|
+
Se as calculateLightGroup,
|
|
1990
|
+
Ce as calculateSensorGroup,
|
|
1991
|
+
Wt as classicGlass,
|
|
1992
|
+
$ as cn,
|
|
1993
|
+
Rt as compactHorizontal,
|
|
1994
|
+
_n as composeVariants,
|
|
1995
|
+
Rn as countActiveEntities,
|
|
1996
|
+
In as countAvailableEntities,
|
|
1997
|
+
Wn as countEntitiesByState,
|
|
1998
|
+
On as createEmptyStateConfig,
|
|
1999
|
+
pn as createEntity,
|
|
2000
|
+
Tn as createFlexLayout,
|
|
2001
|
+
Sn as defineWidget,
|
|
2002
|
+
le as deriveAdaptiveIconColors,
|
|
2003
|
+
Dn as extendVariant,
|
|
2004
|
+
Vt as extractDefaults,
|
|
2005
|
+
mr as formatSchemaError,
|
|
2006
|
+
De as formatValue,
|
|
2007
|
+
Gt as getBuiltInVariant,
|
|
2008
|
+
zn as getBuiltInVariantIds,
|
|
2009
|
+
Vn as getEntityAttribute,
|
|
2010
|
+
En as getEntityState,
|
|
2011
|
+
tr as getGradient,
|
|
2012
|
+
xt as getGradientFromString,
|
|
2013
|
+
Kt as getSpacingClass,
|
|
2014
|
+
rr as getThemeToken,
|
|
2015
|
+
q as gradientColorPresets,
|
|
2016
|
+
_e as interpretValue,
|
|
2017
|
+
Mn as isBuiltInVariant,
|
|
2018
|
+
ir as isDark,
|
|
2019
|
+
ze as isEntityActive,
|
|
2020
|
+
Me as isEntityAvailable,
|
|
2021
|
+
ct as mergeVariants,
|
|
2022
|
+
It as minimal,
|
|
2023
|
+
fr as parseGridSize,
|
|
2024
|
+
hr as serializeGridSize,
|
|
2025
|
+
W as spacing,
|
|
2026
|
+
er as stateColors,
|
|
2027
|
+
bt as toFormSchema,
|
|
2028
|
+
j as typography,
|
|
2029
|
+
Fn as useDebugData,
|
|
2030
|
+
Un as useWidgetConfig,
|
|
1972
2031
|
G as useWidgetContext,
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2032
|
+
Yn as useWidgetDialog,
|
|
2033
|
+
Xn as useWidgetEntity,
|
|
2034
|
+
Kn as useWidgetEntityGroup,
|
|
2035
|
+
qn as useWidgetForm,
|
|
2036
|
+
Pn as useWidgetGestures,
|
|
2037
|
+
Jn as useWidgetResponsive,
|
|
2038
|
+
Cn as warnIfStub,
|
|
2039
|
+
nr as widgetFields
|
|
1980
2040
|
};
|