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