@glasshome/widget-sdk 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/framework/backgrounds/WidgetSliderFill.d.ts +2 -34
- package/dist/framework/components/WidgetContent.d.ts +0 -23
- package/dist/framework/components/WidgetIcon.d.ts +1 -35
- package/dist/framework/components/WidgetStatus.d.ts +0 -18
- package/dist/framework/components/WidgetTitle.d.ts +0 -22
- package/dist/framework/components/WidgetValue.d.ts +1 -23
- package/dist/framework/core/Widget.d.ts +13 -52
- package/dist/framework/gestures/use-widget-gestures.d.ts +4 -2
- package/dist/framework/hooks/index.d.ts +1 -1
- package/dist/framework/hooks/use-widget-context.d.ts +15 -59
- package/dist/framework/index.d.ts +2 -2
- package/dist/framework/types.d.ts +8 -55
- package/dist/index.js +639 -849
- package/package.json +1 -1
- package/dist/framework/design-system/spacing.d.ts +0 -40
- package/dist/framework/design-system/typography.d.ts +0 -40
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
import { WidgetManifestSchema as
|
|
3
|
-
import { effect as
|
|
4
|
-
import { createElementSize as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import { twMerge as
|
|
8
|
-
function
|
|
9
|
-
return
|
|
1
|
+
import { z as A } from "zod";
|
|
2
|
+
import { WidgetManifestSchema as Yt, formatSchemaError as Kt } from "./schemas.js";
|
|
3
|
+
import { effect as W, className as P, style as ne, template as b, insert as w, createComponent as x, memo as D, setStyleProperty as Y, addEventListener as L, use as me, delegateEvents as ve } from "solid-js/web";
|
|
4
|
+
import { createElementSize as we } from "@solid-primitives/resize-observer";
|
|
5
|
+
import { createContext as be, useContext as se, Show as T, onMount as pe, createSignal as B, createMemo as j, splitProps as xe, createEffect as oe, on as ae } from "solid-js";
|
|
6
|
+
import { clsx as ye } from "clsx";
|
|
7
|
+
import { twMerge as $e } from "tailwind-merge";
|
|
8
|
+
function ce(e) {
|
|
9
|
+
return A.toJSONSchema(e, {
|
|
10
10
|
override: (t) => {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
11
|
+
const i = A.globalRegistry.get(t.zodSchema);
|
|
12
|
+
return i && typeof i == "object" && Object.keys(i).length > 0 ? { ...t.jsonSchema, ...i } : t.jsonSchema;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function ke(e) {
|
|
17
17
|
try {
|
|
18
18
|
return e.parse({});
|
|
19
19
|
} catch {
|
|
20
20
|
return {};
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return e.configSchema && (e.manifest.schema || (e.manifest.schema =
|
|
23
|
+
function Vt(e) {
|
|
24
|
+
return e.configSchema && (e.manifest.schema || (e.manifest.schema = ce(e.configSchema)), e.manifest.defaultConfig || (e.manifest.defaultConfig = ke(e.configSchema))), e;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const G = {
|
|
27
27
|
/** Background layer (gradients, images, glows) */
|
|
28
28
|
BACKGROUND: 0,
|
|
29
29
|
/** Main content layer (icon, title, text) */
|
|
@@ -32,68 +32,72 @@ const F = {
|
|
|
32
32
|
OVERLAY: 20,
|
|
33
33
|
/** Action layer (buttons, edit controls) */
|
|
34
34
|
ACTIONS: 30
|
|
35
|
-
},
|
|
36
|
-
function
|
|
37
|
-
const e =
|
|
35
|
+
}, te = be();
|
|
36
|
+
function At() {
|
|
37
|
+
const e = se(te);
|
|
38
38
|
if (!e)
|
|
39
39
|
throw new Error("useWidgetContext must be used within a Widget component");
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const Ce = `/* Authoritative SDK CSS contract. Injected once on first Widget mount
|
|
43
|
+
* via framework/theming/tokens.ts.
|
|
43
44
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* All widget-internal visual scale is driven from CSS custom properties +
|
|
46
|
+
* container queries on the \`.glasshome-widget\` shell (\`container-type: size\`).
|
|
47
|
+
* No JS classifier, no size tier enum.
|
|
47
48
|
*/
|
|
48
49
|
|
|
49
|
-
/* Tone palette (VIS-C01) -- Phase 29 retune (VIS-P05).
|
|
50
|
-
Hand-tuned against apps/dash/src/routes/dev.palette-tune.tsx so each
|
|
51
|
-
tone reads vibrant at the 20% composition stop on both #fafaf9 (light)
|
|
52
|
-
and #0c0a09 (dark) without overpowering the calm-confidence aesthetic. */
|
|
53
50
|
:root {
|
|
54
|
-
--tone-success: oklch(0.70 0.18 145);
|
|
55
|
-
--tone-warning: oklch(0.80 0.17 75);
|
|
56
|
-
--tone-danger: oklch(0.64 0.22 27);
|
|
57
|
-
--tone-info: oklch(0.66 0.20 245);
|
|
58
|
-
--tone-neutral: oklch(0.65 0.02 250);
|
|
59
|
-
--tone-accent: oklch(0.74 0.18 60);
|
|
51
|
+
--tone-success: oklch(0.70 0.18 145);
|
|
52
|
+
--tone-warning: oklch(0.80 0.17 75);
|
|
53
|
+
--tone-danger: oklch(0.64 0.22 27);
|
|
54
|
+
--tone-info: oklch(0.66 0.20 245);
|
|
55
|
+
--tone-neutral: oklch(0.65 0.02 250);
|
|
56
|
+
--tone-accent: oklch(0.74 0.18 60);
|
|
60
57
|
|
|
61
|
-
/* Envelope vars (VIS-C03), light mode -- retained from Phase 25 baseline */
|
|
62
58
|
--widget-grad-strength: 1;
|
|
63
59
|
--widget-glow-default: 0.4;
|
|
64
60
|
--widget-border-highlight: oklch(0.98 0 0 / 0.4);
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
.dark {
|
|
68
|
-
--tone-success: oklch(0.74 0.18 145);
|
|
69
|
-
--tone-warning: oklch(0.82 0.17 75);
|
|
70
|
-
--tone-danger: oklch(0.68 0.22 27);
|
|
71
|
-
--tone-info: oklch(0.70 0.20 245);
|
|
72
|
-
--tone-neutral: oklch(0.69 0.02 250);
|
|
73
|
-
--tone-accent: oklch(0.78 0.18 60);
|
|
64
|
+
--tone-success: oklch(0.74 0.18 145);
|
|
65
|
+
--tone-warning: oklch(0.82 0.17 75);
|
|
66
|
+
--tone-danger: oklch(0.68 0.22 27);
|
|
67
|
+
--tone-info: oklch(0.70 0.20 245);
|
|
68
|
+
--tone-neutral: oklch(0.69 0.02 250);
|
|
69
|
+
--tone-accent: oklch(0.78 0.18 60);
|
|
74
70
|
|
|
75
71
|
--widget-grad-strength: 1.1;
|
|
76
72
|
--widget-glow-default: 0.5;
|
|
77
73
|
--widget-border-highlight: oklch(1 0 0 / 0.08);
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
/* @property declaration for animatable channel base (VIS-C04, D-11)
|
|
81
|
-
initial-value must be a literal <color>; cannot reference var(). */
|
|
82
76
|
@property --widget-color {
|
|
83
77
|
syntax: "<color>";
|
|
84
78
|
inherits: true;
|
|
85
79
|
initial-value: oklch(0.65 0.02 250);
|
|
86
80
|
}
|
|
87
81
|
|
|
88
|
-
/*
|
|
82
|
+
/* === Widget shell ===
|
|
83
|
+
* Fluid scale tokens — tied to the shell's own container box (cqmin/cqi/cqb).
|
|
84
|
+
* Same input box → same output, so two widgets at the same grid cell match
|
|
85
|
+
* exactly. Tune multipliers / clamps to adjust density. */
|
|
89
86
|
.glasshome-widget {
|
|
90
87
|
--widget-color: var(--tone-neutral);
|
|
91
88
|
--widget-glow-strength: var(--widget-glow-default);
|
|
92
|
-
}
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
--widget-icon-box: clamp(28px, 22cqmin, 64px);
|
|
91
|
+
--widget-icon-glyph: clamp(16px, 13cqmin, 36px);
|
|
92
|
+
--widget-pad: clamp(8px, 4cqmin, 24px);
|
|
93
|
+
--widget-gap: clamp(6px, 2cqmin, 16px);
|
|
94
|
+
--widget-title-size: clamp(12px, 2cqi, 18px);
|
|
95
|
+
--widget-subtitle: clamp(12px, 2.5cqi, 20px);
|
|
96
|
+
--widget-status-size: clamp(14px, 5cqi, 36px);
|
|
97
|
+
--widget-value-size: clamp(18px, 7cqi, 48px);
|
|
98
|
+
--widget-badge-size: clamp(11px, 1.6cqi, 14px);
|
|
99
|
+
}
|
|
95
100
|
|
|
96
|
-
/* VIS-P01 shell gradient + VIS-P02 inset highlight (D-02, D-03, D-06) */
|
|
97
101
|
.glasshome-widget {
|
|
98
102
|
background: var(--widget-gradient,
|
|
99
103
|
linear-gradient(135deg,
|
|
@@ -104,54 +108,125 @@ const Te = `/* packages/public/widget-sdk/src/framework/theming/tokens.css
|
|
|
104
108
|
box-shadow: inset 0 1px 0 var(--widget-border-highlight);
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
/*
|
|
111
|
+
/* === Slot: content layout === */
|
|
112
|
+
/* Default: column. Flip to row only on wide-and-short widgets (matches the
|
|
113
|
+
* old contentLayout heuristic: aspect > 1 AND height < 150px). */
|
|
114
|
+
.glasshome-widget-content {
|
|
115
|
+
position: relative;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
width: 100%;
|
|
120
|
+
height: 100%;
|
|
121
|
+
padding: var(--widget-pad);
|
|
122
|
+
gap: var(--widget-gap);
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
@container widget (min-aspect-ratio: 1) and (max-height: 149px) {
|
|
126
|
+
.glasshome-widget-content {
|
|
127
|
+
flex-direction: row;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: flex-start;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
.glasshome-widget-content [class*="ml-auto"] {
|
|
133
|
+
position: relative;
|
|
134
|
+
z-index: 30;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* === Slot: icon === */
|
|
108
138
|
.glasshome-widget-icon {
|
|
139
|
+
width: var(--widget-icon-box);
|
|
140
|
+
height: var(--widget-icon-box);
|
|
141
|
+
border-radius: var(--radius-sm, 12px);
|
|
109
142
|
background: var(--widget-icon-color, var(--widget-color));
|
|
110
143
|
box-shadow: 0 0 calc(var(--widget-glow-strength) * 30px)
|
|
111
144
|
color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 50%, transparent);
|
|
112
|
-
/* Glyph keeps icon-bg hue but flips to L extreme via sign() step + damps chroma.
|
|
113
|
-
bg L > 0.5 -> glyph L=0.09 (dark); bg L < 0.5 -> glyph L=0.95 (light).
|
|
114
|
-
Chroma 0.2x of bg keeps subtle hue tint without competing with bg saturation.
|
|
115
|
-
Requires CSS relative color (Chromium 119+, Safari 16.4+, Firefox 128+) and
|
|
116
|
-
sign() (Chromium 111+, Safari 18.2+, Firefox 118+). */
|
|
117
145
|
color: oklch(from var(--widget-icon-color, var(--widget-color)) calc(0.52 + sign(0.5 - l) * 0.43) calc(c * 0.2) h);
|
|
118
146
|
}
|
|
147
|
+
.glasshome-widget-icon-glyph {
|
|
148
|
+
font-size: var(--widget-icon-glyph);
|
|
149
|
+
line-height: 1;
|
|
150
|
+
}
|
|
151
|
+
.glasshome-widget-icon-stack {
|
|
152
|
+
position: absolute;
|
|
153
|
+
width: 102%;
|
|
154
|
+
height: 102%;
|
|
155
|
+
border-radius: var(--radius-sm, 12px);
|
|
156
|
+
}
|
|
157
|
+
.glasshome-widget-icon-stack-2 { bottom: -14%; right: -10%; opacity: 0.45; z-index: -2; }
|
|
158
|
+
.glasshome-widget-icon-stack-3 { bottom: -28%; right: -20%; opacity: 0.20; z-index: -3; }
|
|
159
|
+
|
|
160
|
+
/* === Slot: text === */
|
|
161
|
+
.glasshome-widget-title {
|
|
162
|
+
font-size: var(--widget-title-size);
|
|
163
|
+
line-height: 1.2;
|
|
164
|
+
color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
text-overflow: ellipsis;
|
|
167
|
+
white-space: nowrap;
|
|
168
|
+
}
|
|
169
|
+
.glasshome-widget-subtitle {
|
|
170
|
+
font-size: var(--widget-subtitle);
|
|
171
|
+
color: color-mix(in oklch, var(--color-foreground, currentColor) 60%, transparent);
|
|
172
|
+
}
|
|
173
|
+
.glasshome-widget-status {
|
|
174
|
+
font-size: var(--widget-status-size);
|
|
175
|
+
font-weight: 700;
|
|
176
|
+
color: var(--color-foreground, currentColor);
|
|
177
|
+
line-height: 1.1;
|
|
178
|
+
}
|
|
179
|
+
.glasshome-widget-value {
|
|
180
|
+
font-size: var(--widget-value-size);
|
|
181
|
+
font-weight: 700;
|
|
182
|
+
color: var(--color-foreground, currentColor);
|
|
183
|
+
line-height: 1.05;
|
|
184
|
+
}
|
|
185
|
+
.glasshome-widget-badge {
|
|
186
|
+
font-size: var(--widget-badge-size);
|
|
187
|
+
font-weight: 500;
|
|
188
|
+
padding: 0.125rem 0.5rem;
|
|
189
|
+
border-radius: 9999px;
|
|
190
|
+
background: color-mix(in oklch, var(--color-foreground, currentColor) 20%, transparent);
|
|
191
|
+
color: var(--color-foreground, currentColor);
|
|
192
|
+
}
|
|
119
193
|
|
|
120
|
-
/* D-13 loading overlay tint */
|
|
121
194
|
.glasshome-widget-loading {
|
|
122
195
|
background: color-mix(in oklch, var(--widget-color) 20%, transparent);
|
|
123
196
|
}
|
|
124
197
|
|
|
125
|
-
/* ===
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
Mirrors .glasshome-widget-icon precedent: --widget-icon-color override
|
|
129
|
-
with --widget-color fallback. Glow rendered via box-shadow on the same
|
|
130
|
-
fill element (D-07). 30% bg opacity preserves prior 0.3 default; 40px
|
|
131
|
-
blur approximates prior blur-2xl on the deleted glow div; glow radius
|
|
132
|
-
modulated by --widget-glow-strength to track the per-mode envelope. */
|
|
198
|
+
/* === Slider fill ===
|
|
199
|
+
* Value flows in via --widget-fill-value (0-100). Vertical orientation auto-
|
|
200
|
+
* detected via container query. */
|
|
133
201
|
.glasshome-widget-slider-fill {
|
|
202
|
+
--widget-fill-value: 0;
|
|
134
203
|
background: color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 30%, transparent);
|
|
135
204
|
box-shadow: 0 0 calc(var(--widget-glow-strength) * 40px)
|
|
136
205
|
color-mix(in oklch, var(--widget-icon-color, var(--widget-color)) 40%, transparent);
|
|
206
|
+
clip-path: inset(0 calc((100 - var(--widget-fill-value)) * 1%) 0 0);
|
|
207
|
+
}
|
|
208
|
+
@container widget (max-aspect-ratio: 1) {
|
|
209
|
+
.glasshome-widget-slider-fill {
|
|
210
|
+
clip-path: inset(calc((100 - var(--widget-fill-value)) * 1%) 0 0 0);
|
|
211
|
+
}
|
|
137
212
|
}
|
|
138
213
|
`;
|
|
139
|
-
let
|
|
140
|
-
function
|
|
141
|
-
if (
|
|
214
|
+
let Q = !1;
|
|
215
|
+
function Se(e) {
|
|
216
|
+
if (Q) return;
|
|
142
217
|
const t = e ?? (typeof document > "u" ? void 0 : document);
|
|
143
218
|
if (!t) return;
|
|
144
219
|
if (t.head.querySelector?.("style[data-glasshome-tokens]")) {
|
|
145
|
-
|
|
220
|
+
Q = !0;
|
|
146
221
|
return;
|
|
147
222
|
}
|
|
148
|
-
const
|
|
149
|
-
|
|
223
|
+
const i = t.createElement("style");
|
|
224
|
+
i.setAttribute("data-glasshome-tokens", ""), i.textContent = Ce, t.head.appendChild(i), Q = !0;
|
|
150
225
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
226
|
+
function H(...e) {
|
|
227
|
+
return $e(ye(e));
|
|
153
228
|
}
|
|
154
|
-
const
|
|
229
|
+
const Me = {
|
|
155
230
|
id: "classic-glass",
|
|
156
231
|
name: "Classic Glass",
|
|
157
232
|
description: "Default glassmorphism design with blur background and gradient",
|
|
@@ -179,7 +254,7 @@ const Oe = {
|
|
|
179
254
|
hoverScale: 1.02,
|
|
180
255
|
activeScale: 0.98
|
|
181
256
|
}
|
|
182
|
-
},
|
|
257
|
+
}, De = {
|
|
183
258
|
id: "minimal",
|
|
184
259
|
name: "Minimal",
|
|
185
260
|
description: "Clean, minimal design with no background effects",
|
|
@@ -208,7 +283,7 @@ const Oe = {
|
|
|
208
283
|
active: !1,
|
|
209
284
|
focus: !0
|
|
210
285
|
}
|
|
211
|
-
},
|
|
286
|
+
}, _e = {
|
|
212
287
|
id: "compact-horizontal",
|
|
213
288
|
name: "Compact Horizontal",
|
|
214
289
|
description: "Horizontal layout for compact widgets",
|
|
@@ -236,331 +311,108 @@ const Oe = {
|
|
|
236
311
|
hoverScale: 1.02,
|
|
237
312
|
activeScale: 0.98
|
|
238
313
|
}
|
|
239
|
-
},
|
|
240
|
-
"classic-glass":
|
|
241
|
-
minimal:
|
|
242
|
-
"compact-horizontal":
|
|
314
|
+
}, ze = {
|
|
315
|
+
"classic-glass": Me,
|
|
316
|
+
minimal: De,
|
|
317
|
+
"compact-horizontal": _e
|
|
243
318
|
};
|
|
244
|
-
function
|
|
245
|
-
return
|
|
319
|
+
function Te(e) {
|
|
320
|
+
return ze[e];
|
|
246
321
|
}
|
|
247
|
-
var
|
|
248
|
-
function
|
|
249
|
-
const t = Y(), r = () => t.orientation() === "vertical" ? `inset(${100 - e.value}% 0 0 0)` : `inset(0 ${100 - e.value}% 0 0)`, o = () => {
|
|
250
|
-
const n = {
|
|
251
|
-
"clip-path": r(),
|
|
252
|
-
"z-index": F.BACKGROUND
|
|
253
|
-
};
|
|
254
|
-
return e.color && (n["--widget-icon-color"] = e.color), n;
|
|
255
|
-
};
|
|
322
|
+
var Ee = /* @__PURE__ */ b("<div>");
|
|
323
|
+
function Ne(e) {
|
|
256
324
|
return (() => {
|
|
257
|
-
var
|
|
258
|
-
return
|
|
259
|
-
var
|
|
260
|
-
|
|
325
|
+
var t = Ee();
|
|
326
|
+
return W((i) => {
|
|
327
|
+
var r = H("glasshome-widget-slider-fill pointer-events-none absolute inset-0", e.isDragging ? "duration-0" : "transition-all duration-300 ease-out", e.class), n = {
|
|
328
|
+
"--widget-fill-value": e.value,
|
|
329
|
+
"z-index": G.BACKGROUND,
|
|
330
|
+
...e.color ? {
|
|
331
|
+
"--widget-icon-color": e.color
|
|
332
|
+
} : {}
|
|
333
|
+
};
|
|
334
|
+
return r !== i.e && P(t, i.e = r), i.t = ne(t, n, i.t), i;
|
|
261
335
|
}, {
|
|
262
336
|
e: void 0,
|
|
263
337
|
t: void 0
|
|
264
|
-
}),
|
|
338
|
+
}), t;
|
|
265
339
|
})();
|
|
266
340
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
S2: { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 },
|
|
270
|
-
S3: { xs: 8, sm: 10, md: 12, lg: 14, xl: 16 },
|
|
271
|
-
S4: { xs: 12, sm: 14, md: 16, lg: 18, xl: 20 }
|
|
272
|
-
}, H = {
|
|
273
|
-
/** Extra small spacing (4-8px) */
|
|
274
|
-
S1: (e) => `${X.S1[e]}px`,
|
|
275
|
-
/** Small spacing (6-14px) - default for most layouts */
|
|
276
|
-
S2: (e) => `${X.S2[e]}px`,
|
|
277
|
-
/** Medium spacing (8-16px) */
|
|
278
|
-
S3: (e) => `${X.S3[e]}px`,
|
|
279
|
-
/** Large spacing (12-20px) */
|
|
280
|
-
S4: (e) => `${X.S4[e]}px`,
|
|
281
|
-
/** Icon container size in pixels */
|
|
282
|
-
icon: (e) => ({
|
|
283
|
-
xs: 32,
|
|
284
|
-
// 1x1, 1x2 widgets
|
|
285
|
-
sm: 40,
|
|
286
|
-
// 2x1, 2x2 widgets (current WidgetIcon default)
|
|
287
|
-
md: 48,
|
|
288
|
-
// 2x3, 2x4 widgets
|
|
289
|
-
lg: 52,
|
|
290
|
-
// 2x6, 3x6, 4x2 widgets
|
|
291
|
-
xl: 56
|
|
292
|
-
// 4x4 widgets
|
|
293
|
-
})[e],
|
|
294
|
-
/** Icon stroke size for lucide icons */
|
|
295
|
-
iconSize: (e) => ({
|
|
296
|
-
xs: 18,
|
|
297
|
-
// Smaller stroke for tiny widgets
|
|
298
|
-
sm: 20,
|
|
299
|
-
// Current WidgetIcon default (size-5 = 20px)
|
|
300
|
-
md: 24,
|
|
301
|
-
// Medium widgets
|
|
302
|
-
lg: 26,
|
|
303
|
-
// Large widgets
|
|
304
|
-
xl: 28
|
|
305
|
-
// Extra large widgets
|
|
306
|
-
})[e],
|
|
307
|
-
/** Spacing between icon and title */
|
|
308
|
-
iconToTitle: (e) => ({
|
|
309
|
-
xs: "8px",
|
|
310
|
-
// Tight spacing for small widgets
|
|
311
|
-
sm: "10px",
|
|
312
|
-
// Slightly more room
|
|
313
|
-
md: "12px",
|
|
314
|
-
// Current pattern from LockWidget (@[300px]:mt-3 = 12px)
|
|
315
|
-
lg: "14px",
|
|
316
|
-
// More breathing room
|
|
317
|
-
xl: "16px"
|
|
318
|
-
// Maximum spacing (@[400px]:mt-4 = 16px)
|
|
319
|
-
})[e],
|
|
320
|
-
/** Container padding */
|
|
321
|
-
container: (e) => ({
|
|
322
|
-
xs: "8px",
|
|
323
|
-
// Minimal padding for tiny widgets
|
|
324
|
-
sm: "16px",
|
|
325
|
-
// Current BaseWidget default (p-4 = 16px)
|
|
326
|
-
md: "16px",
|
|
327
|
-
lg: "20px",
|
|
328
|
-
// More padding for larger widgets
|
|
329
|
-
xl: "20px"
|
|
330
|
-
})[e]
|
|
331
|
-
}, Ae = {
|
|
332
|
-
4: "gap-1",
|
|
333
|
-
6: "gap-1.5",
|
|
334
|
-
8: "gap-2",
|
|
335
|
-
10: "gap-2.5",
|
|
336
|
-
12: "gap-3",
|
|
337
|
-
14: "gap-3.5",
|
|
338
|
-
16: "gap-4",
|
|
339
|
-
18: "gap-[18px]",
|
|
340
|
-
20: "gap-5"
|
|
341
|
-
};
|
|
342
|
-
function Ie(e, t) {
|
|
343
|
-
const r = X[e][t];
|
|
344
|
-
return Ae[r] || `gap-[${r}px]`;
|
|
345
|
-
}
|
|
346
|
-
var Re = /* @__PURE__ */ y("<div>");
|
|
347
|
-
function Ge(e) {
|
|
348
|
-
const t = Y();
|
|
341
|
+
var Oe = /* @__PURE__ */ b("<div>");
|
|
342
|
+
function Ve(e) {
|
|
349
343
|
return (() => {
|
|
350
|
-
var
|
|
351
|
-
return
|
|
352
|
-
var n = E(
|
|
353
|
-
"relative flex h-full w-full overflow-hidden",
|
|
354
|
-
// Ensure controls (ml-auto divs) are above other content
|
|
355
|
-
"[&_div.ml-auto]:relative [&_div.ml-auto]:z-30",
|
|
356
|
-
t.contentLayout() === "horizontal" ? "flex-row items-center" : "flex-col justify-between",
|
|
357
|
-
Ie("S3", t.size()),
|
|
358
|
-
e.class
|
|
359
|
-
), i = H.container(t.size()), a = F.CONTENT;
|
|
360
|
-
return n !== o.e && N(r, o.e = n), i !== o.t && A(r, "padding", o.t = i), a !== o.a && A(r, "z-index", o.a = a), o;
|
|
361
|
-
}, {
|
|
362
|
-
e: void 0,
|
|
363
|
-
t: void 0,
|
|
364
|
-
a: void 0
|
|
365
|
-
}), r;
|
|
344
|
+
var t = Oe();
|
|
345
|
+
return w(t, () => e.children), W(() => P(t, H("glasshome-widget-content", e.class))), t;
|
|
366
346
|
})();
|
|
367
347
|
}
|
|
368
|
-
var
|
|
369
|
-
function
|
|
370
|
-
const t =
|
|
371
|
-
const n = {
|
|
372
|
-
width: `${H.icon(t.size())}px`,
|
|
373
|
-
height: `${H.icon(t.size())}px`,
|
|
374
|
-
"border-radius": "var(--radius-sm, 12px)"
|
|
375
|
-
};
|
|
376
|
-
return e.color && (n["--widget-icon-color"] = e.color), n;
|
|
377
|
-
}, o = (n, i, a) => ({
|
|
378
|
-
width: `${H.icon(t.size()) * 1.02}px`,
|
|
379
|
-
height: `${H.icon(t.size()) * 1.02}px`,
|
|
380
|
-
"border-radius": "var(--radius-sm, 12px)",
|
|
381
|
-
bottom: `${-H.icon(t.size()) * n}px`,
|
|
382
|
-
right: `${-H.icon(t.size()) * (n * 0.71)}px`,
|
|
383
|
-
"z-index": i,
|
|
384
|
-
opacity: a
|
|
385
|
-
});
|
|
348
|
+
var Ae = /* @__PURE__ */ b('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-2">'), We = /* @__PURE__ */ b('<div class="glasshome-widget-icon glasshome-widget-icon-stack glasshome-widget-icon-stack-3">'), He = /* @__PURE__ */ b('<div><div class="glasshome-widget-icon-glyph flex items-center justify-center">');
|
|
349
|
+
function Pe(e) {
|
|
350
|
+
const t = () => e.entityCount ?? 1;
|
|
386
351
|
return (() => {
|
|
387
|
-
var
|
|
388
|
-
return
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
352
|
+
var i = He(), r = i.firstChild;
|
|
353
|
+
return w(i, x(T, {
|
|
354
|
+
get when() {
|
|
355
|
+
return t() >= 2;
|
|
356
|
+
},
|
|
357
|
+
get children() {
|
|
358
|
+
return Ae();
|
|
359
|
+
}
|
|
360
|
+
}), r), w(i, x(T, {
|
|
361
|
+
get when() {
|
|
362
|
+
return t() >= 3;
|
|
363
|
+
},
|
|
364
|
+
get children() {
|
|
365
|
+
return We();
|
|
366
|
+
}
|
|
367
|
+
}), r), w(r, () => e.icon), W((n) => {
|
|
368
|
+
var a = H("glasshome-widget-icon", "relative flex shrink-0 items-center justify-center pointer-events-none transition-all", e.dimmed && "opacity-50", e.class), h = e.color ? {
|
|
369
|
+
"--widget-icon-color": e.color
|
|
370
|
+
} : void 0;
|
|
371
|
+
return a !== n.e && P(i, n.e = a), n.t = ne(i, h, n.t), n;
|
|
403
372
|
}, {
|
|
404
373
|
e: void 0,
|
|
405
|
-
t: void 0
|
|
406
|
-
|
|
407
|
-
}), n;
|
|
374
|
+
t: void 0
|
|
375
|
+
}), i;
|
|
408
376
|
})();
|
|
409
377
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
container: (e) => ({
|
|
413
|
-
xs: "text-xs",
|
|
414
|
-
// Smallest widgets
|
|
415
|
-
sm: "text-sm",
|
|
416
|
-
// Small widgets
|
|
417
|
-
md: "text-base",
|
|
418
|
-
// Medium widgets
|
|
419
|
-
lg: "text-base",
|
|
420
|
-
// Large widgets
|
|
421
|
-
xl: "text-lg"
|
|
422
|
-
// Extra large widgets
|
|
423
|
-
})[e],
|
|
424
|
-
/** Title text sizing (main heading) */
|
|
425
|
-
title: (e) => ({
|
|
426
|
-
xs: "text-xs",
|
|
427
|
-
// 12px - Very compact
|
|
428
|
-
sm: "text-xs",
|
|
429
|
-
// 12px - Stay small
|
|
430
|
-
md: "text-sm",
|
|
431
|
-
// 14px - More readable (@[300px] equivalent)
|
|
432
|
-
lg: "text-sm",
|
|
433
|
-
// 14px - Maintain size
|
|
434
|
-
xl: "text-sm"
|
|
435
|
-
// 14px - Don't go too large for secondary text
|
|
436
|
-
})[e],
|
|
437
|
-
/** Subtitle/secondary text sizing */
|
|
438
|
-
subtitle: (e) => ({
|
|
439
|
-
xs: "text-xs",
|
|
440
|
-
// 12px - Very compact
|
|
441
|
-
sm: "text-sm",
|
|
442
|
-
// 12px - Stay small
|
|
443
|
-
md: "text-base",
|
|
444
|
-
// 14px - More readable (@[300px] equivalent)
|
|
445
|
-
lg: "text-base",
|
|
446
|
-
// 14px - Maintain size
|
|
447
|
-
xl: "text-base"
|
|
448
|
-
// 14px - Don't go too large for secondary text
|
|
449
|
-
})[e],
|
|
450
|
-
/** Value display text sizing (large numbers) */
|
|
451
|
-
value: (e) => ({
|
|
452
|
-
xs: "text-lg",
|
|
453
|
-
// 18px - Still readable on small widgets
|
|
454
|
-
sm: "text-xl",
|
|
455
|
-
// 20px - Slightly larger
|
|
456
|
-
md: "text-2xl",
|
|
457
|
-
// 24px - Prominent
|
|
458
|
-
lg: "text-3xl",
|
|
459
|
-
// 30px - Very prominent
|
|
460
|
-
xl: "text-4xl"
|
|
461
|
-
// 36px - Maximum impact
|
|
462
|
-
})[e],
|
|
463
|
-
/** Badge text sizing (entity count badges) */
|
|
464
|
-
badge: (e) => ({
|
|
465
|
-
xs: "text-xs",
|
|
466
|
-
// 12px - Compact badge
|
|
467
|
-
sm: "text-xs",
|
|
468
|
-
// 12px - Keep small
|
|
469
|
-
md: "text-xs",
|
|
470
|
-
// 12px - Badges should stay small
|
|
471
|
-
lg: "text-sm",
|
|
472
|
-
// 14px - Slightly larger for readability
|
|
473
|
-
xl: "text-sm"
|
|
474
|
-
// 14px - Maximum badge size
|
|
475
|
-
})[e],
|
|
476
|
-
/** Metric label text sizing */
|
|
477
|
-
metricLabel: (e) => ({
|
|
478
|
-
xs: "text-xs",
|
|
479
|
-
// 12px - Compact labels
|
|
480
|
-
sm: "text-xs",
|
|
481
|
-
// 12px
|
|
482
|
-
md: "text-xs",
|
|
483
|
-
// 12px - Labels stay small
|
|
484
|
-
lg: "text-sm",
|
|
485
|
-
// 14px - More readable on large widgets
|
|
486
|
-
xl: "text-sm"
|
|
487
|
-
// 14px
|
|
488
|
-
})[e],
|
|
489
|
-
/** Metric value text sizing */
|
|
490
|
-
metricValue: (e) => ({
|
|
491
|
-
xs: "text-sm",
|
|
492
|
-
// 14px - Readable metric values
|
|
493
|
-
sm: "text-sm",
|
|
494
|
-
// 14px
|
|
495
|
-
md: "text-sm",
|
|
496
|
-
// 14px - Keep metrics compact
|
|
497
|
-
lg: "text-base",
|
|
498
|
-
// 16px - Slightly larger
|
|
499
|
-
xl: "text-base"
|
|
500
|
-
// 16px
|
|
501
|
-
})[e],
|
|
502
|
-
/** Status text (same as subtitle but semantic) */
|
|
503
|
-
status: (e) => ({
|
|
504
|
-
xs: "text-md",
|
|
505
|
-
sm: "text-xl",
|
|
506
|
-
md: "text-2xl",
|
|
507
|
-
lg: "text-3xl",
|
|
508
|
-
xl: "text-3xl"
|
|
509
|
-
})[e],
|
|
510
|
-
/** Empty state message text */
|
|
511
|
-
emptyState: (e) => ({
|
|
512
|
-
xs: "text-xs",
|
|
513
|
-
// 12px
|
|
514
|
-
sm: "text-sm",
|
|
515
|
-
// 14px
|
|
516
|
-
md: "text-sm",
|
|
517
|
-
// 14px
|
|
518
|
-
lg: "text-base",
|
|
519
|
-
// 16px
|
|
520
|
-
xl: "text-base"
|
|
521
|
-
// 16px
|
|
522
|
-
})[e]
|
|
523
|
-
};
|
|
524
|
-
var je = /* @__PURE__ */ y("<p>");
|
|
525
|
-
function Fe(e) {
|
|
526
|
-
const t = Y();
|
|
378
|
+
var Re = /* @__PURE__ */ b("<p>");
|
|
379
|
+
function Ue(e) {
|
|
527
380
|
return (() => {
|
|
528
|
-
var
|
|
529
|
-
return
|
|
530
|
-
var
|
|
531
|
-
return () =>
|
|
532
|
-
})()),
|
|
533
|
-
var
|
|
534
|
-
return
|
|
381
|
+
var t = Re();
|
|
382
|
+
return w(t, (() => {
|
|
383
|
+
var i = D(() => !!e.isUnavailable);
|
|
384
|
+
return () => i() ? "Unavailable" : e.children;
|
|
385
|
+
})()), W((i) => {
|
|
386
|
+
var r = H("glasshome-widget-status", "relative", e.dimmed && "opacity-40", e.class), n = G.ACTIONS;
|
|
387
|
+
return r !== i.e && P(t, i.e = r), n !== i.t && Y(t, "z-index", i.t = n), i;
|
|
535
388
|
}, {
|
|
536
389
|
e: void 0,
|
|
537
390
|
t: void 0
|
|
538
|
-
}),
|
|
391
|
+
}), t;
|
|
539
392
|
})();
|
|
540
393
|
}
|
|
541
|
-
var
|
|
542
|
-
function
|
|
543
|
-
const t = Y();
|
|
394
|
+
var je = /* @__PURE__ */ b('<span class="glasshome-widget-badge shrink-0">'), Be = /* @__PURE__ */ b("<div><h3 class=glasshome-widget-title>");
|
|
395
|
+
function Ie(e) {
|
|
544
396
|
return (() => {
|
|
545
|
-
var
|
|
546
|
-
return
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
397
|
+
var t = Be(), i = t.firstChild;
|
|
398
|
+
return w(i, () => e.children), w(t, x(T, {
|
|
399
|
+
get when() {
|
|
400
|
+
return D(() => e.badge !== void 0)() && e.badge > 0;
|
|
401
|
+
},
|
|
402
|
+
get children() {
|
|
403
|
+
var r = je();
|
|
404
|
+
return w(r, () => e.badge), r;
|
|
405
|
+
}
|
|
406
|
+
}), null), W((r) => {
|
|
407
|
+
var n = H("relative flex items-center gap-2", e.class), a = G.ACTIONS;
|
|
408
|
+
return n !== r.e && P(t, r.e = n), a !== r.t && Y(t, "z-index", r.t = a), r;
|
|
555
409
|
}, {
|
|
556
410
|
e: void 0,
|
|
557
|
-
t: void 0
|
|
558
|
-
|
|
559
|
-
o: void 0
|
|
560
|
-
}), r;
|
|
411
|
+
t: void 0
|
|
412
|
+
}), t;
|
|
561
413
|
})();
|
|
562
414
|
}
|
|
563
|
-
function
|
|
415
|
+
function Le(e, t = !1) {
|
|
564
416
|
if (e.length === 0)
|
|
565
417
|
return {
|
|
566
418
|
isGroup: !1,
|
|
@@ -574,64 +426,64 @@ function Xe(e, t = !1) {
|
|
|
574
426
|
totalCount: 0,
|
|
575
427
|
description: "No entities"
|
|
576
428
|
};
|
|
577
|
-
const
|
|
578
|
-
if (!
|
|
579
|
-
const
|
|
429
|
+
const i = e.length > 1;
|
|
430
|
+
if (!i) {
|
|
431
|
+
const v = e[0], S = v.state === "on", O = v.attributes?.brightness || 0, M = Math.round(O / 255 * 100);
|
|
580
432
|
return {
|
|
581
433
|
isGroup: !1,
|
|
582
|
-
state:
|
|
583
|
-
isOn:
|
|
584
|
-
isUnavailable:
|
|
585
|
-
brightness:
|
|
586
|
-
brightnessPercent:
|
|
587
|
-
color:
|
|
588
|
-
onCount:
|
|
434
|
+
state: v.state,
|
|
435
|
+
isOn: S,
|
|
436
|
+
isUnavailable: v.state === "unavailable",
|
|
437
|
+
brightness: O,
|
|
438
|
+
brightnessPercent: M,
|
|
439
|
+
color: le(v),
|
|
440
|
+
onCount: S ? 1 : 0,
|
|
589
441
|
totalCount: 1,
|
|
590
|
-
description:
|
|
442
|
+
description: S ? "On" : "Off"
|
|
591
443
|
};
|
|
592
444
|
}
|
|
593
|
-
let
|
|
594
|
-
const
|
|
595
|
-
for (const
|
|
596
|
-
switch (
|
|
445
|
+
let r = 0, n = 0, a = 0, h = 0, u = 0, p = 0;
|
|
446
|
+
const y = [];
|
|
447
|
+
for (const v of e)
|
|
448
|
+
switch (v.state) {
|
|
597
449
|
case "on":
|
|
598
|
-
|
|
450
|
+
r++, v.attributes?.brightness !== void 0 && (u += v.attributes.brightness, p++), v.attributes?.rgb_color && y.push(v.attributes.rgb_color);
|
|
599
451
|
break;
|
|
600
452
|
case "off":
|
|
601
453
|
n++;
|
|
602
454
|
break;
|
|
603
455
|
case "unknown":
|
|
604
|
-
|
|
456
|
+
a++;
|
|
605
457
|
break;
|
|
606
458
|
case "unavailable":
|
|
607
|
-
|
|
459
|
+
h++;
|
|
608
460
|
break;
|
|
609
461
|
}
|
|
610
|
-
const
|
|
611
|
-
let
|
|
612
|
-
t ?
|
|
613
|
-
const
|
|
614
|
-
let
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
|
|
462
|
+
const m = e.length, $ = h === m, E = a + h === m, d = r > 0, l = r === m, k = n === m;
|
|
463
|
+
let f, C;
|
|
464
|
+
t ? $ ? (f = "unavailable", C = !1) : a > 0 || h > 0 ? (f = "unknown", C = !1) : n > 0 ? (f = "off", C = !1) : (f = "on", C = !0) : $ ? (f = "unavailable", C = !1) : E ? (f = "unknown", C = !1) : d ? (f = "on", C = !0) : (f = "off", C = !1);
|
|
465
|
+
const N = p > 0 ? Math.round(u / p) : 0, R = Math.round(N / 255 * 100);
|
|
466
|
+
let c;
|
|
467
|
+
if (y.length > 0) {
|
|
468
|
+
const v = Math.round(y.reduce((s, _) => s + _[0], 0) / y.length), S = Math.round(y.reduce((s, _) => s + _[1], 0) / y.length), O = Math.round(y.reduce((s, _) => s + _[2], 0) / y.length), M = N / 255;
|
|
469
|
+
c = `rgb(${Math.round(v * M)}, ${Math.round(S * M)}, ${Math.round(O * M)})`;
|
|
618
470
|
} else
|
|
619
|
-
|
|
620
|
-
let
|
|
621
|
-
return
|
|
622
|
-
isGroup:
|
|
623
|
-
state:
|
|
471
|
+
c = le(e[0]);
|
|
472
|
+
let g;
|
|
473
|
+
return l ? g = "All on" : k ? g = "All off" : r > 0 ? g = `${r} of ${m} on` : g = "Off", {
|
|
474
|
+
isGroup: i,
|
|
475
|
+
state: f,
|
|
624
476
|
isOn: C,
|
|
625
|
-
isUnavailable:
|
|
626
|
-
brightness:
|
|
627
|
-
brightnessPercent:
|
|
628
|
-
color:
|
|
629
|
-
onCount:
|
|
630
|
-
totalCount:
|
|
631
|
-
description:
|
|
477
|
+
isUnavailable: f === "unavailable",
|
|
478
|
+
brightness: N,
|
|
479
|
+
brightnessPercent: R,
|
|
480
|
+
color: c,
|
|
481
|
+
onCount: r,
|
|
482
|
+
totalCount: m,
|
|
483
|
+
description: g
|
|
632
484
|
};
|
|
633
485
|
}
|
|
634
|
-
function
|
|
486
|
+
function Fe(e, t = "mean", i = !0) {
|
|
635
487
|
if (e.length === 0)
|
|
636
488
|
return {
|
|
637
489
|
isGroup: !1,
|
|
@@ -640,114 +492,114 @@ function Je(e, t = "mean", r = !0) {
|
|
|
640
492
|
isUnavailable: !0,
|
|
641
493
|
description: "No entities"
|
|
642
494
|
};
|
|
643
|
-
const
|
|
644
|
-
if (!
|
|
645
|
-
const
|
|
646
|
-
let
|
|
647
|
-
return Number.isNaN(
|
|
495
|
+
const r = e.length > 1;
|
|
496
|
+
if (!r) {
|
|
497
|
+
const d = e[0], l = Number.parseFloat(d.state);
|
|
498
|
+
let k = d.state;
|
|
499
|
+
return Number.isNaN(l) || (k = Number.isInteger(l) ? l.toString() : l.toFixed(1)), {
|
|
648
500
|
isGroup: !1,
|
|
649
|
-
state:
|
|
650
|
-
numericValue: Number.isNaN(
|
|
651
|
-
isUnavailable:
|
|
652
|
-
unit:
|
|
653
|
-
description:
|
|
501
|
+
state: k,
|
|
502
|
+
numericValue: Number.isNaN(l) ? null : l,
|
|
503
|
+
isUnavailable: d.state === "unavailable",
|
|
504
|
+
unit: d.unitOfMeasurement ?? void 0,
|
|
505
|
+
description: k
|
|
654
506
|
};
|
|
655
507
|
}
|
|
656
|
-
const n = [],
|
|
657
|
-
let
|
|
658
|
-
for (const
|
|
659
|
-
if (!
|
|
660
|
-
|
|
661
|
-
entityId:
|
|
508
|
+
const n = [], a = [];
|
|
509
|
+
let h = 0, u;
|
|
510
|
+
for (const d of e) {
|
|
511
|
+
if (!u && d.unitOfMeasurement && (u = d.unitOfMeasurement), d.state === "unavailable") {
|
|
512
|
+
h++, a.push({
|
|
513
|
+
entityId: d.id,
|
|
662
514
|
value: "unavailable",
|
|
663
|
-
friendly_name:
|
|
515
|
+
friendly_name: d.friendlyName
|
|
664
516
|
});
|
|
665
517
|
continue;
|
|
666
518
|
}
|
|
667
|
-
const
|
|
668
|
-
isNaN(
|
|
669
|
-
entityId:
|
|
670
|
-
value:
|
|
671
|
-
friendly_name:
|
|
672
|
-
}) : (n.push(
|
|
673
|
-
entityId:
|
|
674
|
-
value:
|
|
675
|
-
friendly_name:
|
|
519
|
+
const l = Number.parseFloat(d.state);
|
|
520
|
+
isNaN(l) ? i || a.push({
|
|
521
|
+
entityId: d.id,
|
|
522
|
+
value: d.state,
|
|
523
|
+
friendly_name: d.friendlyName
|
|
524
|
+
}) : (n.push(l), a.push({
|
|
525
|
+
entityId: d.id,
|
|
526
|
+
value: l,
|
|
527
|
+
friendly_name: d.friendlyName
|
|
676
528
|
}));
|
|
677
529
|
}
|
|
678
|
-
const
|
|
679
|
-
if (
|
|
530
|
+
const p = h === e.length, y = n.length === 0;
|
|
531
|
+
if (p || y)
|
|
680
532
|
return {
|
|
681
|
-
isGroup:
|
|
682
|
-
state:
|
|
533
|
+
isGroup: r,
|
|
534
|
+
state: p ? "unavailable" : "unknown",
|
|
683
535
|
numericValue: null,
|
|
684
|
-
isUnavailable:
|
|
685
|
-
unit:
|
|
686
|
-
description:
|
|
687
|
-
memberValues:
|
|
536
|
+
isUnavailable: p,
|
|
537
|
+
unit: u,
|
|
538
|
+
description: p ? "Unavailable" : "No numeric values",
|
|
539
|
+
memberValues: a
|
|
688
540
|
};
|
|
689
|
-
let
|
|
541
|
+
let m, $;
|
|
690
542
|
switch (t) {
|
|
691
543
|
case "min":
|
|
692
|
-
|
|
544
|
+
m = Math.min(...n), $ = "Minimum";
|
|
693
545
|
break;
|
|
694
546
|
case "max":
|
|
695
|
-
|
|
547
|
+
m = Math.max(...n), $ = "Maximum";
|
|
696
548
|
break;
|
|
697
549
|
case "mean":
|
|
698
|
-
|
|
550
|
+
m = n.reduce((d, l) => d + l, 0) / n.length, $ = "Average";
|
|
699
551
|
break;
|
|
700
552
|
case "median": {
|
|
701
|
-
const
|
|
702
|
-
|
|
553
|
+
const d = [...n].sort((k, f) => k - f), l = Math.floor(d.length / 2);
|
|
554
|
+
m = d.length % 2 === 0 ? (d[l - 1] + d[l]) / 2 : d[l], $ = "Median";
|
|
703
555
|
break;
|
|
704
556
|
}
|
|
705
557
|
case "sum":
|
|
706
|
-
|
|
558
|
+
m = n.reduce((d, l) => d + l, 0), $ = "Sum";
|
|
707
559
|
break;
|
|
708
560
|
case "last":
|
|
709
|
-
|
|
561
|
+
m = n[n.length - 1], $ = "Latest";
|
|
710
562
|
break;
|
|
711
563
|
case "range":
|
|
712
|
-
|
|
564
|
+
m = Math.max(...n) - Math.min(...n), $ = "Range";
|
|
713
565
|
break;
|
|
714
566
|
case "product":
|
|
715
|
-
|
|
567
|
+
m = n.reduce((d, l) => d * l, 1), $ = "Product";
|
|
716
568
|
break;
|
|
717
569
|
case "std_dev": {
|
|
718
|
-
const
|
|
719
|
-
|
|
570
|
+
const d = n.reduce((k, f) => k + f, 0) / n.length, l = n.reduce((k, f) => k + (f - d) ** 2, 0) / n.length;
|
|
571
|
+
m = Math.sqrt(l), $ = "Std Dev";
|
|
720
572
|
break;
|
|
721
573
|
}
|
|
722
574
|
default:
|
|
723
|
-
|
|
575
|
+
m = n.reduce((d, l) => d + l, 0) / n.length, $ = "Average";
|
|
724
576
|
}
|
|
725
|
-
const
|
|
577
|
+
const E = Number.isInteger(m) ? m.toString() : m.toFixed(1);
|
|
726
578
|
return {
|
|
727
|
-
isGroup:
|
|
728
|
-
state:
|
|
729
|
-
numericValue:
|
|
579
|
+
isGroup: r,
|
|
580
|
+
state: E,
|
|
581
|
+
numericValue: m,
|
|
730
582
|
isUnavailable: !1,
|
|
731
|
-
unit:
|
|
732
|
-
description: `${
|
|
733
|
-
memberValues:
|
|
583
|
+
unit: u,
|
|
584
|
+
description: `${$} of ${n.length}`,
|
|
585
|
+
memberValues: a
|
|
734
586
|
};
|
|
735
587
|
}
|
|
736
|
-
function
|
|
588
|
+
function le(e) {
|
|
737
589
|
if (e.state !== "on") return "rgb(100, 100, 100)";
|
|
738
|
-
const
|
|
590
|
+
const i = (e.attributes?.brightness ?? 255) / 255;
|
|
739
591
|
if (e.attributes?.rgb_color) {
|
|
740
|
-
const [
|
|
741
|
-
return `rgb(${Math.round(
|
|
592
|
+
const [r, n, a] = e.attributes.rgb_color;
|
|
593
|
+
return `rgb(${Math.round(r * i)}, ${Math.round(n * i)}, ${Math.round(a * i)})`;
|
|
742
594
|
}
|
|
743
595
|
if (e.attributes?.color_temp) {
|
|
744
596
|
const n = 1e6 / e.attributes.color_temp / 100;
|
|
745
|
-
let
|
|
746
|
-
return n <= 66 ? (
|
|
597
|
+
let a, h, u;
|
|
598
|
+
return n <= 66 ? (a = 255, h = n <= 19 ? 0 : 99.4708025861 * Math.log(n - 10) - 161.1195681661, u = n <= 19 ? 0 : n <= 66 ? 138.5177312231 * Math.log(n - 10) - 305.0447927307 : 255) : (a = 329.698727446 * (n - 60) ** -0.1332047592, h = 288.1221695283 * (n - 60) ** -0.0755148492, u = 255), a = Math.max(0, Math.min(255, a)) * i, h = Math.max(0, Math.min(255, h)) * i, u = Math.max(0, Math.min(255, u)) * i, `rgb(${Math.round(a)}, ${Math.round(h)}, ${Math.round(u)})`;
|
|
747
599
|
}
|
|
748
|
-
return `rgb(${Math.round(255 *
|
|
600
|
+
return `rgb(${Math.round(255 * i)}, ${Math.round(220 * i)}, ${Math.round(180 * i)})`;
|
|
749
601
|
}
|
|
750
|
-
function
|
|
602
|
+
function Ge(e) {
|
|
751
603
|
if (!e) return !1;
|
|
752
604
|
if (["on", "open", "locked", "home", "playing", "active"].includes(e.state))
|
|
753
605
|
return !0;
|
|
@@ -757,118 +609,63 @@ function Qe(e) {
|
|
|
757
609
|
}
|
|
758
610
|
return !1;
|
|
759
611
|
}
|
|
760
|
-
function
|
|
761
|
-
return e?.attributes ? e.attributes[t] ??
|
|
612
|
+
function Wt(e, t, i) {
|
|
613
|
+
return e?.attributes ? e.attributes[t] ?? i : i;
|
|
762
614
|
}
|
|
763
|
-
function
|
|
764
|
-
return e.filter(
|
|
615
|
+
function Ht(e) {
|
|
616
|
+
return e.filter(Ge).length;
|
|
765
617
|
}
|
|
766
|
-
function
|
|
767
|
-
const { decimals:
|
|
618
|
+
function qe(e, t, i) {
|
|
619
|
+
const { decimals: r, scale: n = !0 } = {};
|
|
768
620
|
if (typeof e == "string")
|
|
769
621
|
return t ? `${e}${t}` : e;
|
|
770
622
|
if (e == null || Number.isNaN(e))
|
|
771
623
|
return t ? `--${t}` : "--";
|
|
772
|
-
let
|
|
773
|
-
n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (
|
|
774
|
-
let
|
|
775
|
-
return
|
|
624
|
+
let a = e, h = t || "";
|
|
625
|
+
n && t && (t === "W" || t === "kW" || t === "MW") && (e >= 1e6 ? (a = e / 1e6, h = "MW") : e >= 1e3 ? (a = e / 1e3, h = "kW") : h = "W"), n && t && (t === "B" || t === "KB" || t === "MB" || t === "GB") && (e >= 1073741824 ? (a = e / 1073741824, h = "GB") : e >= 1048576 ? (a = e / 1048576, h = "MB") : e >= 1024 ? (a = e / 1024, h = "KB") : h = "B");
|
|
626
|
+
let u;
|
|
627
|
+
return r !== void 0 ? u = a.toFixed(r) : a !== e ? u = a.toFixed(1) : Number.isInteger(e) ? u = e.toString() : u = Number.parseFloat(e.toFixed(2)).toString(), h ? `${u}${h}` : u;
|
|
776
628
|
}
|
|
777
|
-
function
|
|
629
|
+
function Ye(e, t) {
|
|
778
630
|
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;
|
|
779
631
|
}
|
|
780
|
-
var
|
|
781
|
-
function
|
|
782
|
-
const t = Y();
|
|
632
|
+
var Ke = /* @__PURE__ */ b("<div class=glasshome-widget-subtitle>"), Xe = /* @__PURE__ */ b("<div><div class=glasshome-widget-value>");
|
|
633
|
+
function Je(e) {
|
|
783
634
|
return (() => {
|
|
784
|
-
var
|
|
785
|
-
return
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
t: void 0
|
|
795
|
-
}), i;
|
|
796
|
-
})();
|
|
797
|
-
})(), null), T((n) => {
|
|
798
|
-
var i = E("flex flex-col", e.class), a = E("font-bold text-foreground", Z.value(t.size()));
|
|
799
|
-
return i !== n.e && N(r, n.e = i), a !== n.t && N(o, n.t = a), n;
|
|
800
|
-
}, {
|
|
801
|
-
e: void 0,
|
|
802
|
-
t: void 0
|
|
803
|
-
}), r;
|
|
635
|
+
var t = Xe(), i = t.firstChild;
|
|
636
|
+
return w(i, () => qe(e.value, e.unit)), w(t, x(T, {
|
|
637
|
+
get when() {
|
|
638
|
+
return D(() => !!e.interpret)() && typeof e.value == "number";
|
|
639
|
+
},
|
|
640
|
+
get children() {
|
|
641
|
+
var r = Ke();
|
|
642
|
+
return w(r, () => Ye(e.value, e.unit)), r;
|
|
643
|
+
}
|
|
644
|
+
}), null), W(() => P(t, H("flex flex-col", e.class))), t;
|
|
804
645
|
})();
|
|
805
646
|
}
|
|
806
|
-
var
|
|
807
|
-
function
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
811
|
-
function ut(e, t) {
|
|
812
|
-
return e > t ? "horizontal" : t > e ? "vertical" : "square";
|
|
813
|
-
}
|
|
814
|
-
function gt(e, t) {
|
|
815
|
-
return t >= 150 ? "vertical" : e > t ? "horizontal" : t > e ? "vertical" : "square";
|
|
816
|
-
}
|
|
817
|
-
function ht(e) {
|
|
818
|
-
Ce(() => {
|
|
819
|
-
Ee();
|
|
820
|
-
});
|
|
821
|
-
let t;
|
|
822
|
-
const r = Se(() => t), o = 2, [n, i] = U(0), [a, c] = U(0);
|
|
823
|
-
R(() => {
|
|
824
|
-
const l = Math.round(r.width ?? 0), k = Math.round(r.height ?? 0), b = de(n), s = de(a);
|
|
825
|
-
(Math.abs(l - b) > o || Math.abs(k - s) > o) && (i(l), c(k));
|
|
647
|
+
var Qe = /* @__PURE__ */ b('<div><div class="relative h-full w-full">'), Ze = /* @__PURE__ */ b('<div class="glasshome-widget-loading pointer-events-none absolute inset-0 animate-pulse">'), et = /* @__PURE__ */ b('<div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">'), tt = /* @__PURE__ */ b('<div class="flex items-center justify-center text-white/30">'), nt = /* @__PURE__ */ b('<h3 class="font-semibold text-sm text-white/60">'), it = /* @__PURE__ */ b('<p class="text-white/50 text-xs">');
|
|
648
|
+
function rt(e) {
|
|
649
|
+
pe(() => {
|
|
650
|
+
Se();
|
|
826
651
|
});
|
|
827
|
-
const
|
|
828
|
-
if (e.variant)
|
|
829
|
-
return typeof e.variant == "string" ? We(e.variant) : e.variant;
|
|
830
|
-
}), w = V(() => ({
|
|
831
|
-
width: n(),
|
|
832
|
-
height: a(),
|
|
833
|
-
gridWidth: Math.max(1, Math.round(n() / 150)),
|
|
834
|
-
gridHeight: Math.max(1, Math.round(a() / 75))
|
|
835
|
-
}), void 0, {
|
|
836
|
-
equals: (l, k) => l.width === k.width && l.height === k.height && l.gridWidth === k.gridWidth && l.gridHeight === k.gridHeight
|
|
837
|
-
}), v = V(() => {
|
|
838
|
-
const l = w();
|
|
839
|
-
return dt(l.gridWidth, l.gridHeight);
|
|
840
|
-
}), S = V(() => {
|
|
841
|
-
const l = w();
|
|
842
|
-
return ut(l.width, l.height);
|
|
843
|
-
}), W = V(() => {
|
|
844
|
-
const l = w();
|
|
845
|
-
return gt(l.width, l.height);
|
|
846
|
-
}), g = fe(se), f = g;
|
|
847
|
-
f?._isStub?.() && f._bridge && (R(() => {
|
|
848
|
-
f._bridge.setSize(v());
|
|
849
|
-
}), R(() => {
|
|
850
|
-
f._bridge.setOrientation(S());
|
|
851
|
-
}), R(() => {
|
|
852
|
-
f._bridge.setContentLayout(W());
|
|
853
|
-
}), R(() => {
|
|
854
|
-
f._bridge.setDimensions(w());
|
|
855
|
-
}), R(() => {
|
|
856
|
-
f._bridge.setIsStub(!1);
|
|
857
|
-
}));
|
|
858
|
-
const D = {
|
|
859
|
-
size: v,
|
|
860
|
-
orientation: S,
|
|
861
|
-
contentLayout: W,
|
|
862
|
-
dimensions: w,
|
|
652
|
+
const t = se(te), [i, r] = B(), n = we(i), a = {
|
|
863
653
|
isEditMode: () => e.isEditMode ?? !1,
|
|
864
|
-
updateConfig:
|
|
654
|
+
updateConfig: t?.updateConfig ?? (() => {
|
|
655
|
+
}),
|
|
656
|
+
dimensions: () => ({
|
|
657
|
+
width: n.width ?? 0,
|
|
658
|
+
height: n.height ?? 0
|
|
865
659
|
})
|
|
866
|
-
},
|
|
660
|
+
}, h = j(() => {
|
|
661
|
+
if (e.variant)
|
|
662
|
+
return typeof e.variant == "string" ? Te(e.variant) : e.variant;
|
|
663
|
+
}), u = j(() => ({
|
|
867
664
|
"container-type": "size",
|
|
868
665
|
"container-name": "widget",
|
|
869
666
|
"touch-action": e.gestures && !e.isEditMode ? e.gestures.touchAction() : void 0,
|
|
870
|
-
...
|
|
871
|
-
...
|
|
667
|
+
...h()?.styles?.container,
|
|
668
|
+
...h()?.styles?.cssVars || {},
|
|
872
669
|
...e.tone ? {
|
|
873
670
|
"--widget-color": `var(--tone-${e.tone})`
|
|
874
671
|
} : {},
|
|
@@ -881,26 +678,26 @@ function ht(e) {
|
|
|
881
678
|
...e.gradient ? {
|
|
882
679
|
"--widget-gradient": e.gradient
|
|
883
680
|
} : {}
|
|
884
|
-
})),
|
|
885
|
-
|
|
886
|
-
}, B = (l) => {
|
|
887
|
-
C() && e.gestures?.onPointerDown(l);
|
|
888
|
-
}, u = (l) => {
|
|
889
|
-
C() && e.gestures?.onPointerMove(l);
|
|
890
|
-
}, h = (l) => {
|
|
891
|
-
C() && e.gestures?.onPointerUp(l);
|
|
681
|
+
})), p = () => !!e.gestures && !e.isEditMode, y = (l) => {
|
|
682
|
+
p() && e.gestures?.onPointerEnter(l);
|
|
892
683
|
}, m = (l) => {
|
|
893
|
-
|
|
684
|
+
p() && e.gestures?.onPointerDown(l);
|
|
685
|
+
}, $ = (l) => {
|
|
686
|
+
p() && e.gestures?.onPointerMove(l);
|
|
687
|
+
}, E = (l) => {
|
|
688
|
+
p() && e.gestures?.onPointerUp(l);
|
|
689
|
+
}, d = (l) => {
|
|
690
|
+
p() && e.gestures?.onPointerCancel(l);
|
|
894
691
|
};
|
|
895
|
-
return
|
|
896
|
-
value:
|
|
692
|
+
return x(te.Provider, {
|
|
693
|
+
value: a,
|
|
897
694
|
get children() {
|
|
898
|
-
var l =
|
|
899
|
-
return
|
|
900
|
-
|
|
901
|
-
}, l),
|
|
902
|
-
var
|
|
903
|
-
return () =>
|
|
695
|
+
var l = Qe(), k = l.firstChild;
|
|
696
|
+
return L(l, "pointercancel", d), L(l, "pointerup", E), L(l, "pointermove", $), L(l, "pointerdown", m), L(l, "pointerenter", y), me((f) => {
|
|
697
|
+
r(f), e.gestures?.bindElement(f);
|
|
698
|
+
}, l), w(k, (() => {
|
|
699
|
+
var f = D(() => !!e.emptyState);
|
|
700
|
+
return () => f() ? x(ot, {
|
|
904
701
|
get icon() {
|
|
905
702
|
return e.emptyState.icon;
|
|
906
703
|
},
|
|
@@ -911,22 +708,15 @@ function ht(e) {
|
|
|
911
708
|
return e.emptyState.message;
|
|
912
709
|
}
|
|
913
710
|
}) : e.children;
|
|
914
|
-
})()),
|
|
915
|
-
var
|
|
916
|
-
return () =>
|
|
917
|
-
var
|
|
918
|
-
return
|
|
711
|
+
})()), w(l, (() => {
|
|
712
|
+
var f = D(() => !!e.loading);
|
|
713
|
+
return () => f() && (() => {
|
|
714
|
+
var C = Ze();
|
|
715
|
+
return W((N) => Y(C, "z-index", G.OVERLAY)), C;
|
|
919
716
|
})();
|
|
920
|
-
})(), null),
|
|
921
|
-
var
|
|
922
|
-
|
|
923
|
-
"relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50",
|
|
924
|
-
// Variant styles (lowest priority)
|
|
925
|
-
x()?.styles?.class,
|
|
926
|
-
// Custom class (highest priority)
|
|
927
|
-
e.class
|
|
928
|
-
), z = $(), O = F.CONTENT;
|
|
929
|
-
return s !== b.e && N(l, b.e = s), b.t = Q(l, z, b.t), O !== b.a && A(k, "z-index", b.a = O), b;
|
|
717
|
+
})(), null), W((f) => {
|
|
718
|
+
var C = H("glasshome-widget", "relative h-full w-full select-none overflow-hidden rounded-xl border border-border/50", h()?.styles?.class, e.class), N = u(), R = G.CONTENT;
|
|
719
|
+
return C !== f.e && P(l, f.e = C), f.t = ne(l, N, f.t), R !== f.a && Y(k, "z-index", f.a = R), f;
|
|
930
720
|
}, {
|
|
931
721
|
e: void 0,
|
|
932
722
|
t: void 0,
|
|
@@ -935,68 +725,68 @@ function ht(e) {
|
|
|
935
725
|
}
|
|
936
726
|
});
|
|
937
727
|
}
|
|
938
|
-
function
|
|
728
|
+
function ot(e) {
|
|
939
729
|
return (() => {
|
|
940
|
-
var t =
|
|
941
|
-
return
|
|
942
|
-
var
|
|
943
|
-
return () =>
|
|
944
|
-
var
|
|
945
|
-
return
|
|
730
|
+
var t = et();
|
|
731
|
+
return w(t, (() => {
|
|
732
|
+
var i = D(() => !!e.icon);
|
|
733
|
+
return () => i() && (() => {
|
|
734
|
+
var r = tt();
|
|
735
|
+
return w(r, () => e.icon), r;
|
|
946
736
|
})();
|
|
947
|
-
})(), null),
|
|
948
|
-
var
|
|
949
|
-
return () =>
|
|
950
|
-
var
|
|
951
|
-
return
|
|
737
|
+
})(), null), w(t, (() => {
|
|
738
|
+
var i = D(() => !!e.title);
|
|
739
|
+
return () => i() && (() => {
|
|
740
|
+
var r = nt();
|
|
741
|
+
return w(r, () => e.title), r;
|
|
952
742
|
})();
|
|
953
|
-
})(), null),
|
|
954
|
-
var
|
|
955
|
-
return () =>
|
|
956
|
-
var
|
|
957
|
-
return
|
|
743
|
+
})(), null), w(t, (() => {
|
|
744
|
+
var i = D(() => !!e.message);
|
|
745
|
+
return () => i() && (() => {
|
|
746
|
+
var r = it();
|
|
747
|
+
return w(r, () => e.message), r;
|
|
958
748
|
})();
|
|
959
749
|
})(), null), t;
|
|
960
750
|
})();
|
|
961
751
|
}
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
var
|
|
970
|
-
function
|
|
752
|
+
const I = rt;
|
|
753
|
+
I.Content = Ve;
|
|
754
|
+
I.Icon = Pe;
|
|
755
|
+
I.Title = Ie;
|
|
756
|
+
I.Status = Ue;
|
|
757
|
+
I.Value = Je;
|
|
758
|
+
I.SliderFill = Ne;
|
|
759
|
+
var at = /* @__PURE__ */ b('<span class="inline-flex size-3.5 shrink-0 items-center">'), lt = /* @__PURE__ */ b("<button type=button>"), st = /* @__PURE__ */ b('<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">'), ct = /* @__PURE__ */ b('<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'), dt = /* @__PURE__ */ b('<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>'), ut = /* @__PURE__ */ b('<div class="rounded-lg bg-muted/30 p-2 text-center md:p-6"><p class="text-muted-foreground text-sm">No additional controls'), gt = /* @__PURE__ */ b('<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">'), ht = /* @__PURE__ */ b('<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'), ft = /* @__PURE__ */ b('<div class="min-w-0 shrink-0">'), mt = /* @__PURE__ */ b('<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">'), vt = /* @__PURE__ */ b('<div class="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">'), wt = /* @__PURE__ */ b('<div class="flex shrink-0 items-center justify-end gap-2 border-border/50 border-t pt-3">');
|
|
760
|
+
function bt(e) {
|
|
971
761
|
return (() => {
|
|
972
|
-
var t =
|
|
973
|
-
return t.$$click = () => e.onClick(),
|
|
762
|
+
var t = lt();
|
|
763
|
+
return t.$$click = () => e.onClick(), w(t, x(T, {
|
|
974
764
|
get when() {
|
|
975
765
|
return e.isActive;
|
|
976
766
|
},
|
|
977
767
|
get children() {
|
|
978
|
-
var
|
|
979
|
-
return
|
|
768
|
+
var i = at();
|
|
769
|
+
return w(i, () => e.icon), i;
|
|
980
770
|
}
|
|
981
|
-
}), null),
|
|
771
|
+
}), null), w(t, () => e.label, null), W(() => P(t, H("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;
|
|
982
772
|
})();
|
|
983
773
|
}
|
|
984
|
-
function
|
|
985
|
-
const [t] =
|
|
986
|
-
|
|
774
|
+
function Pt(e) {
|
|
775
|
+
const [t] = xe(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"]), i = () => !!t.configSchema && !!t.config && !!t.onConfigSave && !!t.SchemaForm, [r, n] = B({}), [a, h] = B(null);
|
|
776
|
+
oe(ae(() => t.config, (s) => {
|
|
987
777
|
s && n({
|
|
988
778
|
...s
|
|
989
779
|
});
|
|
990
|
-
})),
|
|
991
|
-
s &&
|
|
780
|
+
})), oe(ae(() => t.configSchema, (s) => {
|
|
781
|
+
s && h(ce(s));
|
|
992
782
|
}));
|
|
993
|
-
const
|
|
783
|
+
const u = () => i() && JSON.stringify(r()) !== JSON.stringify(t.config), p = (s) => {
|
|
994
784
|
!s && t.config && n({
|
|
995
785
|
...t.config
|
|
996
786
|
}), t.onOpenChange(s);
|
|
997
|
-
},
|
|
998
|
-
t.onConfigSave?.(
|
|
999
|
-
}, [
|
|
787
|
+
}, y = () => {
|
|
788
|
+
t.onConfigSave?.(r());
|
|
789
|
+
}, [m, $] = B(t.defaultTab ?? "controls"), E = () => {
|
|
1000
790
|
const s = t.maxWidth ?? "3xl";
|
|
1001
791
|
return {
|
|
1002
792
|
sm: "max-w-sm",
|
|
@@ -1007,83 +797,83 @@ function Ft(e) {
|
|
|
1007
797
|
"3xl": "max-w-3xl",
|
|
1008
798
|
"4xl": "max-w-4xl"
|
|
1009
799
|
}[s];
|
|
1010
|
-
},
|
|
800
|
+
}, d = () => {
|
|
1011
801
|
if (t.tabs) return t.tabs;
|
|
1012
802
|
const s = [];
|
|
1013
803
|
return s.push({
|
|
1014
804
|
id: "edit",
|
|
1015
805
|
label: "Edit",
|
|
1016
|
-
icon:
|
|
1017
|
-
content: t.editContent ?? (
|
|
806
|
+
icon: st(),
|
|
807
|
+
content: t.editContent ?? (i() && a() ? x(v, {
|
|
1018
808
|
get schema() {
|
|
1019
|
-
return
|
|
809
|
+
return a();
|
|
1020
810
|
},
|
|
1021
811
|
get data() {
|
|
1022
|
-
return
|
|
812
|
+
return r();
|
|
1023
813
|
},
|
|
1024
814
|
onChange: n
|
|
1025
|
-
}) :
|
|
815
|
+
}) : ct())
|
|
1026
816
|
}), s.push({
|
|
1027
817
|
id: "controls",
|
|
1028
818
|
label: "Controls",
|
|
1029
|
-
icon:
|
|
1030
|
-
content: t.controlsContent ??
|
|
819
|
+
icon: dt(),
|
|
820
|
+
content: t.controlsContent ?? ut()
|
|
1031
821
|
}), s.push({
|
|
1032
822
|
id: "debug",
|
|
1033
823
|
label: "Debug",
|
|
1034
|
-
icon:
|
|
1035
|
-
content: t.debugContent ??
|
|
824
|
+
icon: gt(),
|
|
825
|
+
content: t.debugContent ?? ht()
|
|
1036
826
|
}), s;
|
|
1037
|
-
},
|
|
827
|
+
}, l = async () => {
|
|
1038
828
|
if (t.debugData !== void 0)
|
|
1039
829
|
try {
|
|
1040
830
|
const s = typeof t.debugData == "string" ? t.debugData : JSON.stringify(t.debugData, null, 2);
|
|
1041
831
|
await navigator.clipboard.writeText(s);
|
|
1042
832
|
} catch {
|
|
1043
833
|
}
|
|
1044
|
-
},
|
|
1045
|
-
const s =
|
|
1046
|
-
return s.find((
|
|
1047
|
-
},
|
|
1048
|
-
return
|
|
834
|
+
}, k = () => {
|
|
835
|
+
const s = d();
|
|
836
|
+
return s.find((V) => V.id === m())?.content ?? s[0]?.content;
|
|
837
|
+
}, f = t.ResponsiveDialog, C = t.ResponsiveDialogContent, N = t.ResponsiveDialogHeader, R = t.ResponsiveDialogTitle, c = t.ResponsiveDialogDescription, g = t.Button, v = t.SchemaForm, S = (s) => i() ? p(s) : t.onOpenChange(s), O = () => i() ? u() : t.hasUnsavedChanges, M = () => i() ? y : t.onSave;
|
|
838
|
+
return x(f, {
|
|
1049
839
|
get open() {
|
|
1050
840
|
return t.open;
|
|
1051
841
|
},
|
|
1052
|
-
onOpenChange: (s) =>
|
|
842
|
+
onOpenChange: (s) => S(s),
|
|
1053
843
|
get children() {
|
|
1054
|
-
return
|
|
844
|
+
return x(C, {
|
|
1055
845
|
get class() {
|
|
1056
|
-
return E(
|
|
846
|
+
return H(E(), t.class);
|
|
1057
847
|
},
|
|
1058
848
|
get children() {
|
|
1059
|
-
return [
|
|
849
|
+
return [x(N, {
|
|
1060
850
|
class: "flex flex-row items-center justify-between gap-3",
|
|
1061
851
|
get children() {
|
|
1062
852
|
return [(() => {
|
|
1063
|
-
var s =
|
|
1064
|
-
return
|
|
853
|
+
var s = ft();
|
|
854
|
+
return w(s, x(R, {
|
|
1065
855
|
class: "truncate leading-tight",
|
|
1066
856
|
get children() {
|
|
1067
857
|
return t.title;
|
|
1068
858
|
}
|
|
1069
|
-
}), null),
|
|
859
|
+
}), null), w(s, x(c, {
|
|
1070
860
|
class: "sr-only",
|
|
1071
861
|
children: "Widget configuration dialog"
|
|
1072
862
|
}), null), s;
|
|
1073
863
|
})(), (() => {
|
|
1074
|
-
var s =
|
|
1075
|
-
return
|
|
864
|
+
var s = mt(), _ = s.firstChild;
|
|
865
|
+
return w(_, () => d().map((V) => x(bt, {
|
|
1076
866
|
get icon() {
|
|
1077
|
-
return
|
|
867
|
+
return V.icon;
|
|
1078
868
|
},
|
|
1079
869
|
get label() {
|
|
1080
|
-
return
|
|
870
|
+
return V.label;
|
|
1081
871
|
},
|
|
1082
872
|
get isActive() {
|
|
1083
|
-
return
|
|
873
|
+
return m() === V.id;
|
|
1084
874
|
},
|
|
1085
|
-
onClick: () =>
|
|
1086
|
-
}))),
|
|
875
|
+
onClick: () => $(V.id)
|
|
876
|
+
}))), w(s, x(T, {
|
|
1087
877
|
get when() {
|
|
1088
878
|
return t.headerActions;
|
|
1089
879
|
},
|
|
@@ -1094,49 +884,49 @@ function Ft(e) {
|
|
|
1094
884
|
})()];
|
|
1095
885
|
}
|
|
1096
886
|
}), (() => {
|
|
1097
|
-
var s =
|
|
1098
|
-
return
|
|
1099
|
-
})(),
|
|
887
|
+
var s = vt();
|
|
888
|
+
return w(s, k), s;
|
|
889
|
+
})(), x(T, {
|
|
1100
890
|
get when() {
|
|
1101
|
-
return
|
|
891
|
+
return D(() => m() === "edit")() && (M() || t.onDelete) || m() === "debug" && t.debugData !== void 0;
|
|
1102
892
|
},
|
|
1103
893
|
get children() {
|
|
1104
|
-
var s =
|
|
1105
|
-
return
|
|
894
|
+
var s = wt();
|
|
895
|
+
return w(s, x(T, {
|
|
1106
896
|
get when() {
|
|
1107
|
-
return
|
|
897
|
+
return D(() => m() === "edit")() && t.onDelete;
|
|
1108
898
|
},
|
|
1109
899
|
get children() {
|
|
1110
|
-
return
|
|
900
|
+
return x(g, {
|
|
1111
901
|
size: "sm",
|
|
1112
902
|
variant: "destructive",
|
|
1113
903
|
onClick: () => t.onDelete?.(),
|
|
1114
904
|
children: "Delete"
|
|
1115
905
|
});
|
|
1116
906
|
}
|
|
1117
|
-
}), null),
|
|
907
|
+
}), null), w(s, x(T, {
|
|
1118
908
|
get when() {
|
|
1119
|
-
return
|
|
909
|
+
return D(() => m() === "edit")() && M();
|
|
1120
910
|
},
|
|
1121
911
|
get children() {
|
|
1122
|
-
return
|
|
912
|
+
return x(g, {
|
|
1123
913
|
size: "sm",
|
|
1124
914
|
get disabled() {
|
|
1125
|
-
return !
|
|
915
|
+
return !O();
|
|
1126
916
|
},
|
|
1127
|
-
onClick: () =>
|
|
917
|
+
onClick: () => M()?.(),
|
|
1128
918
|
children: "Save"
|
|
1129
919
|
});
|
|
1130
920
|
}
|
|
1131
|
-
}), null),
|
|
921
|
+
}), null), w(s, x(T, {
|
|
1132
922
|
get when() {
|
|
1133
|
-
return
|
|
923
|
+
return D(() => m() === "debug")() && t.debugData !== void 0;
|
|
1134
924
|
},
|
|
1135
925
|
get children() {
|
|
1136
|
-
return
|
|
926
|
+
return x(g, {
|
|
1137
927
|
size: "sm",
|
|
1138
928
|
variant: "outline",
|
|
1139
|
-
onClick:
|
|
929
|
+
onClick: l,
|
|
1140
930
|
children: "Copy"
|
|
1141
931
|
});
|
|
1142
932
|
}
|
|
@@ -1148,157 +938,157 @@ function Ft(e) {
|
|
|
1148
938
|
}
|
|
1149
939
|
});
|
|
1150
940
|
}
|
|
1151
|
-
|
|
1152
|
-
function
|
|
1153
|
-
const [t,
|
|
941
|
+
ve(["click"]);
|
|
942
|
+
function Rt(e = "edit") {
|
|
943
|
+
const [t, i] = B(!1), [r, n] = B(e);
|
|
1154
944
|
return {
|
|
1155
945
|
showDialog: t,
|
|
1156
|
-
setShowDialog:
|
|
1157
|
-
openDialog: () =>
|
|
1158
|
-
closeDialog: () =>
|
|
1159
|
-
activeTab:
|
|
946
|
+
setShowDialog: i,
|
|
947
|
+
openDialog: () => i(!0),
|
|
948
|
+
closeDialog: () => i(!1),
|
|
949
|
+
activeTab: r,
|
|
1160
950
|
setActiveTab: n
|
|
1161
951
|
};
|
|
1162
952
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const t = e.minEntities ?? 1,
|
|
1165
|
-
if (!
|
|
1166
|
-
const
|
|
1167
|
-
if (!
|
|
1168
|
-
const
|
|
1169
|
-
if (
|
|
1170
|
-
return
|
|
1171
|
-
if (
|
|
1172
|
-
const
|
|
1173
|
-
return
|
|
953
|
+
function Ut(e) {
|
|
954
|
+
const t = e.minEntities ?? 1, i = j(() => e.entities().length), r = j(() => i() >= t), n = j(() => !r() || !e.calculateGroupData ? null : e.calculateGroupData(e.entities())), a = j(() => {
|
|
955
|
+
if (!r()) return;
|
|
956
|
+
const u = e.aggregationMode?.();
|
|
957
|
+
if (!u || u === "none") return;
|
|
958
|
+
const p = e.entities();
|
|
959
|
+
if (u === "light" || u === "binary-sensor" || u === "switch")
|
|
960
|
+
return Le(p, e.allEntitiesMode);
|
|
961
|
+
if (u === "sensor") {
|
|
962
|
+
const y = e.sensorGroupType?.() ?? "mean";
|
|
963
|
+
return Fe(p, y, !0);
|
|
1174
964
|
}
|
|
1175
|
-
}),
|
|
965
|
+
}), h = j(() => r() ? void 0 : e.emptyStateConfig);
|
|
1176
966
|
return {
|
|
1177
967
|
entities: e.entities,
|
|
1178
968
|
groupData: n,
|
|
1179
|
-
aggregatedData:
|
|
1180
|
-
emptyState:
|
|
1181
|
-
hasEntities:
|
|
1182
|
-
count:
|
|
969
|
+
aggregatedData: a,
|
|
970
|
+
emptyState: h,
|
|
971
|
+
hasEntities: r,
|
|
972
|
+
count: i
|
|
1183
973
|
};
|
|
1184
974
|
}
|
|
1185
|
-
const
|
|
1186
|
-
function
|
|
975
|
+
const F = 32, o = F / 2, z = "white", K = "rgba(0,0,0,0.4)", ie = 2, X = 3;
|
|
976
|
+
function pt(e) {
|
|
1187
977
|
return `url("data:image/svg+xml,${encodeURIComponent(e)}")`;
|
|
1188
978
|
}
|
|
1189
|
-
function
|
|
1190
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
979
|
+
function J(e) {
|
|
980
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${F}" height="${F}" viewBox="0 0 ${F} ${F}">${e}</svg>`;
|
|
1191
981
|
}
|
|
1192
|
-
const
|
|
982
|
+
const xt = J(`
|
|
1193
983
|
<g transform="translate(6, 2)">
|
|
1194
984
|
<!-- shadow -->
|
|
1195
|
-
<g stroke="${
|
|
985
|
+
<g stroke="${K}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1196
986
|
<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"/>
|
|
1197
987
|
</g>
|
|
1198
988
|
<!-- main -->
|
|
1199
|
-
<g stroke="${
|
|
989
|
+
<g stroke="${z}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1200
990
|
<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"/>
|
|
1201
991
|
</g>
|
|
1202
992
|
</g>
|
|
1203
|
-
`),
|
|
993
|
+
`), yt = J(`
|
|
1204
994
|
<g>
|
|
1205
|
-
<circle cx="${
|
|
1206
|
-
<circle cx="${
|
|
1207
|
-
<circle cx="${
|
|
995
|
+
<circle cx="${o}" cy="${o}" r="8" stroke="${K}" stroke-width="${X}" fill="none"/>
|
|
996
|
+
<circle cx="${o}" cy="${o}" r="8" stroke="${z}" stroke-width="1.5" fill="none"/>
|
|
997
|
+
<circle cx="${o}" cy="${o}" r="1.5" fill="${z}"/>
|
|
1208
998
|
</g>
|
|
1209
|
-
`),
|
|
999
|
+
`), $t = J(`
|
|
1210
1000
|
<g>
|
|
1211
1001
|
<!-- shadow -->
|
|
1212
|
-
<g stroke="${
|
|
1213
|
-
<line x1="6" y1="${
|
|
1214
|
-
<polyline points="10,${
|
|
1215
|
-
<polyline points="22,${
|
|
1002
|
+
<g stroke="${K}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1003
|
+
<line x1="6" y1="${o}" x2="26" y2="${o}"/>
|
|
1004
|
+
<polyline points="10,${o - 4} 6,${o} 10,${o + 4}"/>
|
|
1005
|
+
<polyline points="22,${o - 4} 26,${o} 22,${o + 4}"/>
|
|
1216
1006
|
</g>
|
|
1217
1007
|
<!-- main -->
|
|
1218
|
-
<g stroke="${
|
|
1219
|
-
<line x1="6" y1="${
|
|
1220
|
-
<polyline points="10,${
|
|
1221
|
-
<polyline points="22,${
|
|
1008
|
+
<g stroke="${z}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1009
|
+
<line x1="6" y1="${o}" x2="26" y2="${o}"/>
|
|
1010
|
+
<polyline points="10,${o - 4} 6,${o} 10,${o + 4}"/>
|
|
1011
|
+
<polyline points="22,${o - 4} 26,${o} 22,${o + 4}"/>
|
|
1222
1012
|
</g>
|
|
1223
1013
|
<!-- center grip dots -->
|
|
1224
|
-
<circle cx="${
|
|
1225
|
-
<circle cx="${
|
|
1226
|
-
<circle cx="${
|
|
1014
|
+
<circle cx="${o}" cy="${o}" r="1.5" fill="${z}"/>
|
|
1015
|
+
<circle cx="${o - 5}" cy="${o}" r="1" fill="${z}" opacity="0.6"/>
|
|
1016
|
+
<circle cx="${o + 5}" cy="${o}" r="1" fill="${z}" opacity="0.6"/>
|
|
1227
1017
|
</g>
|
|
1228
|
-
`),
|
|
1018
|
+
`), kt = J(`
|
|
1229
1019
|
<g>
|
|
1230
1020
|
<!-- shadow -->
|
|
1231
|
-
<g stroke="${
|
|
1232
|
-
<line x1="${
|
|
1233
|
-
<polyline points="${
|
|
1234
|
-
<polyline points="${
|
|
1021
|
+
<g stroke="${K}" stroke-width="${X}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1022
|
+
<line x1="${o}" y1="6" x2="${o}" y2="26"/>
|
|
1023
|
+
<polyline points="${o - 4},10 ${o},6 ${o + 4},10"/>
|
|
1024
|
+
<polyline points="${o - 4},22 ${o},26 ${o + 4},22"/>
|
|
1235
1025
|
</g>
|
|
1236
1026
|
<!-- main -->
|
|
1237
|
-
<g stroke="${
|
|
1238
|
-
<line x1="${
|
|
1239
|
-
<polyline points="${
|
|
1240
|
-
<polyline points="${
|
|
1027
|
+
<g stroke="${z}" stroke-width="${ie}" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
1028
|
+
<line x1="${o}" y1="6" x2="${o}" y2="26"/>
|
|
1029
|
+
<polyline points="${o - 4},10 ${o},6 ${o + 4},10"/>
|
|
1030
|
+
<polyline points="${o - 4},22 ${o},26 ${o + 4},22"/>
|
|
1241
1031
|
</g>
|
|
1242
1032
|
<!-- center grip dots -->
|
|
1243
|
-
<circle cx="${
|
|
1244
|
-
<circle cx="${
|
|
1245
|
-
<circle cx="${
|
|
1033
|
+
<circle cx="${o}" cy="${o}" r="1.5" fill="${z}"/>
|
|
1034
|
+
<circle cx="${o}" cy="${o - 5}" r="1" fill="${z}" opacity="0.6"/>
|
|
1035
|
+
<circle cx="${o}" cy="${o + 5}" r="1" fill="${z}" opacity="0.6"/>
|
|
1246
1036
|
</g>
|
|
1247
1037
|
`);
|
|
1248
|
-
function
|
|
1249
|
-
return { css: `${
|
|
1038
|
+
function q(e, t, i) {
|
|
1039
|
+
return { css: `${pt(e)} ${t} ${i}, auto`, hotspotX: t, hotspotY: i };
|
|
1250
1040
|
}
|
|
1251
|
-
const
|
|
1252
|
-
tap:
|
|
1253
|
-
hold:
|
|
1254
|
-
slideHorizontal:
|
|
1255
|
-
slideVertical:
|
|
1041
|
+
const U = {
|
|
1042
|
+
tap: q(xt, 12, 4),
|
|
1043
|
+
hold: q(yt, 16, 16),
|
|
1044
|
+
slideHorizontal: q($t, o, o),
|
|
1045
|
+
slideVertical: q(kt, o, o)
|
|
1256
1046
|
};
|
|
1257
|
-
function
|
|
1047
|
+
function Z() {
|
|
1258
1048
|
if (typeof window > "u") return null;
|
|
1259
1049
|
const e = window;
|
|
1260
1050
|
return e.Capacitor?.isNativePlatform?.() ? e.Capacitor.Plugins?.Haptics ?? null : null;
|
|
1261
1051
|
}
|
|
1262
|
-
function
|
|
1052
|
+
function ee(e) {
|
|
1263
1053
|
if (!(typeof navigator > "u" || typeof navigator.vibrate != "function"))
|
|
1264
1054
|
try {
|
|
1265
1055
|
navigator.vibrate(e);
|
|
1266
1056
|
} catch {
|
|
1267
1057
|
}
|
|
1268
1058
|
}
|
|
1269
|
-
const
|
|
1059
|
+
const Ct = {
|
|
1270
1060
|
/** Light confirmation — fires when slide gesture arms after user holds still. */
|
|
1271
1061
|
tick() {
|
|
1272
|
-
const e =
|
|
1062
|
+
const e = Z();
|
|
1273
1063
|
if (e) {
|
|
1274
1064
|
e.impact({ style: "Light" }).catch(() => {
|
|
1275
1065
|
});
|
|
1276
1066
|
return;
|
|
1277
1067
|
}
|
|
1278
|
-
|
|
1068
|
+
ee(8);
|
|
1279
1069
|
},
|
|
1280
1070
|
/** Medium bump — fires when hold gesture commits (detail opening). */
|
|
1281
1071
|
bump() {
|
|
1282
|
-
const e =
|
|
1072
|
+
const e = Z();
|
|
1283
1073
|
if (e) {
|
|
1284
1074
|
e.impact({ style: "Medium" }).catch(() => {
|
|
1285
1075
|
});
|
|
1286
1076
|
return;
|
|
1287
1077
|
}
|
|
1288
|
-
|
|
1078
|
+
ee(20);
|
|
1289
1079
|
},
|
|
1290
1080
|
/** Stronger pulse — reserved for edit-mode pickup (future use). */
|
|
1291
1081
|
pulse() {
|
|
1292
|
-
const e =
|
|
1082
|
+
const e = Z();
|
|
1293
1083
|
if (e) {
|
|
1294
1084
|
e.impact({ style: "Heavy" }).catch(() => {
|
|
1295
1085
|
});
|
|
1296
1086
|
return;
|
|
1297
1087
|
}
|
|
1298
|
-
|
|
1088
|
+
ee([0, 15, 40, 15]);
|
|
1299
1089
|
}
|
|
1300
1090
|
};
|
|
1301
|
-
function
|
|
1091
|
+
function jt(e, t) {
|
|
1302
1092
|
const n = {
|
|
1303
1093
|
isDown: !1,
|
|
1304
1094
|
isTouch: !1,
|
|
@@ -1310,139 +1100,139 @@ function qt(e, t) {
|
|
|
1310
1100
|
holdTimer: null,
|
|
1311
1101
|
element: null
|
|
1312
1102
|
};
|
|
1313
|
-
let
|
|
1314
|
-
function
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1317
|
-
if (
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1103
|
+
let a = null, h = null, u = null;
|
|
1104
|
+
function p(c) {
|
|
1105
|
+
c !== h && (u && u.disconnect(), u = new ResizeObserver((g) => {
|
|
1106
|
+
const v = g[0];
|
|
1107
|
+
if (v) {
|
|
1108
|
+
const S = v.borderBoxSize?.[0];
|
|
1109
|
+
S ? a = { width: S.inlineSize, height: S.blockSize } : a = { width: v.contentRect.width, height: v.contentRect.height };
|
|
1320
1110
|
}
|
|
1321
|
-
}),
|
|
1111
|
+
}), h = c, u.observe(c), a = { width: c.clientWidth, height: c.clientHeight });
|
|
1322
1112
|
}
|
|
1323
|
-
const
|
|
1113
|
+
const y = () => {
|
|
1324
1114
|
n.holdTimer && (clearTimeout(n.holdTimer), n.holdTimer = null);
|
|
1325
|
-
},
|
|
1115
|
+
}, m = () => {
|
|
1326
1116
|
n.isDown = !1, n.hasMoved = !1, n.sliding = !1;
|
|
1327
|
-
},
|
|
1328
|
-
const
|
|
1329
|
-
return
|
|
1330
|
-
},
|
|
1331
|
-
const
|
|
1332
|
-
if (!(!
|
|
1333
|
-
if (n.isDown = !0, n.isTouch =
|
|
1334
|
-
const
|
|
1117
|
+
}, $ = (c) => {
|
|
1118
|
+
const v = e().slide;
|
|
1119
|
+
return v?.orientation === "horizontal" ? "horizontal" : v?.orientation === "vertical" ? "vertical" : c && (a || p(c), a) ? a.height > a.width ? "vertical" : "horizontal" : (t?.() ?? "horizontal") === "horizontal" ? "horizontal" : "vertical";
|
|
1120
|
+
}, E = (c) => {
|
|
1121
|
+
const g = e();
|
|
1122
|
+
if (!(!g.tap && !g.hold && !g.slide)) {
|
|
1123
|
+
if (n.isDown = !0, n.isTouch = c.pointerType === "touch", n.element = c.currentTarget, p(n.element), n.startX = c.clientX, n.startY = c.clientY, n.startTime = Date.now(), n.hasMoved = !1, n.sliding = !1, g.hold) {
|
|
1124
|
+
const v = g.hold.delay ?? 500;
|
|
1335
1125
|
n.holdTimer = setTimeout(() => {
|
|
1336
|
-
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (
|
|
1337
|
-
},
|
|
1126
|
+
n.holdTimer = null, !(!n.isDown || n.hasMoved) && (Ct.bump(), g.hold?.action(), n.isDown = !1);
|
|
1127
|
+
}, v);
|
|
1338
1128
|
}
|
|
1339
|
-
if (!n.isTouch &&
|
|
1129
|
+
if (!n.isTouch && g.slide)
|
|
1340
1130
|
try {
|
|
1341
|
-
|
|
1131
|
+
c.currentTarget.setPointerCapture(c.pointerId);
|
|
1342
1132
|
} catch {
|
|
1343
1133
|
}
|
|
1344
1134
|
}
|
|
1345
|
-
},
|
|
1135
|
+
}, d = (c) => {
|
|
1346
1136
|
if (!n.isDown) return;
|
|
1347
|
-
const
|
|
1348
|
-
if (Math.sqrt(
|
|
1349
|
-
const
|
|
1137
|
+
const g = e(), v = c.clientX - n.startX, S = c.clientY - n.startY;
|
|
1138
|
+
if (Math.sqrt(v * v + S * S) > 10 && (y(), n.hasMoved = !0), !n.isTouch && g.slide && n.hasMoved) {
|
|
1139
|
+
const M = c.currentTarget, s = $(M);
|
|
1350
1140
|
n.sliding = !0;
|
|
1351
|
-
const
|
|
1352
|
-
|
|
1141
|
+
const _ = g.slide.min ?? 0, V = g.slide.max ?? 100, de = V - _, ue = s === "vertical" ? -S : v, re = a ?? { width: M.clientWidth, height: M.clientHeight }, ge = s === "vertical" ? re.height : re.width, he = ue / ge * de, fe = Math.max(_, Math.min(V, g.slide.value + he));
|
|
1142
|
+
g.slide.onChange(Math.round(fe)), n.startX = c.clientX, n.startY = c.clientY, c.preventDefault();
|
|
1353
1143
|
}
|
|
1354
|
-
},
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1144
|
+
}, l = (c) => {
|
|
1145
|
+
const g = e(), v = n.isDown, S = Date.now() - n.startTime, O = g.hold?.delay ?? 500;
|
|
1146
|
+
y(), v && g.tap && !n.hasMoved && S < O && g.tap();
|
|
1357
1147
|
try {
|
|
1358
|
-
|
|
1148
|
+
c.currentTarget.releasePointerCapture(c.pointerId);
|
|
1359
1149
|
} catch {
|
|
1360
1150
|
}
|
|
1361
|
-
|
|
1362
|
-
},
|
|
1363
|
-
|
|
1151
|
+
m();
|
|
1152
|
+
}, k = (c) => {
|
|
1153
|
+
y();
|
|
1364
1154
|
try {
|
|
1365
|
-
|
|
1155
|
+
c.currentTarget.releasePointerCapture(c.pointerId);
|
|
1366
1156
|
} catch {
|
|
1367
1157
|
}
|
|
1368
|
-
|
|
1369
|
-
},
|
|
1370
|
-
const
|
|
1371
|
-
if (
|
|
1372
|
-
const
|
|
1373
|
-
return
|
|
1158
|
+
m();
|
|
1159
|
+
}, f = (c) => {
|
|
1160
|
+
const g = e();
|
|
1161
|
+
if (g.slide) {
|
|
1162
|
+
const v = g.slide.orientation;
|
|
1163
|
+
return v === "horizontal" ? U.slideHorizontal.css : v === "vertical" ? U.slideVertical.css : (a || p(c), a && a.height > a.width ? U.slideVertical.css : U.slideHorizontal.css);
|
|
1374
1164
|
}
|
|
1375
|
-
return
|
|
1165
|
+
return g.tap ? U.tap.css : g.hold ? U.hold.css : "";
|
|
1376
1166
|
};
|
|
1377
1167
|
return {
|
|
1378
|
-
onPointerDown:
|
|
1379
|
-
onPointerMove:
|
|
1380
|
-
onPointerUp:
|
|
1381
|
-
onPointerCancel:
|
|
1382
|
-
onPointerEnter: (
|
|
1383
|
-
const
|
|
1384
|
-
n.element =
|
|
1168
|
+
onPointerDown: E,
|
|
1169
|
+
onPointerMove: d,
|
|
1170
|
+
onPointerUp: l,
|
|
1171
|
+
onPointerCancel: k,
|
|
1172
|
+
onPointerEnter: (c) => {
|
|
1173
|
+
const g = c.currentTarget;
|
|
1174
|
+
n.element = g, g.style.cursor = f(g);
|
|
1385
1175
|
},
|
|
1386
|
-
bindElement: (
|
|
1387
|
-
|
|
1176
|
+
bindElement: (c) => {
|
|
1177
|
+
c && (n.element = c, p(c));
|
|
1388
1178
|
},
|
|
1389
1179
|
touchAction: () => {
|
|
1390
|
-
const
|
|
1391
|
-
return
|
|
1180
|
+
const c = e();
|
|
1181
|
+
return c.tap || c.hold || c.slide ? "manipulation" : "auto";
|
|
1392
1182
|
},
|
|
1393
1183
|
dispose: () => {
|
|
1394
|
-
|
|
1184
|
+
y(), u && (u.disconnect(), u = null), h = null, a = null;
|
|
1395
1185
|
}
|
|
1396
1186
|
};
|
|
1397
1187
|
}
|
|
1398
|
-
const
|
|
1188
|
+
const Bt = A.enum([
|
|
1399
1189
|
"success",
|
|
1400
1190
|
"warning",
|
|
1401
1191
|
"danger",
|
|
1402
1192
|
"info",
|
|
1403
1193
|
"neutral",
|
|
1404
1194
|
"accent"
|
|
1405
|
-
]),
|
|
1195
|
+
]), It = {
|
|
1406
1196
|
/** Optional display name override (renders as text input) */
|
|
1407
|
-
title: () =>
|
|
1197
|
+
title: () => A.string().optional().meta({ title: "Title", description: "Optional display name override" }),
|
|
1408
1198
|
/** Multi-select entity picker for a HA domain */
|
|
1409
|
-
entityIds: (e) =>
|
|
1199
|
+
entityIds: (e) => A.array(A.string()).default([]).meta({ domain: e, title: "Entities" }),
|
|
1410
1200
|
/** Single-select entity picker for a HA domain */
|
|
1411
|
-
singleEntity: (e) =>
|
|
1201
|
+
singleEntity: (e) => A.array(A.string()).default([]).meta({ domain: e, title: "Entity", singleSelect: !0 }),
|
|
1412
1202
|
/** Area picker dropdown */
|
|
1413
|
-
areaId: () =>
|
|
1203
|
+
areaId: () => A.string().optional().meta({ formType: "area-picker", title: "Area" })
|
|
1414
1204
|
};
|
|
1415
|
-
function
|
|
1205
|
+
function Lt() {
|
|
1416
1206
|
return document.documentElement.classList.contains("dark");
|
|
1417
1207
|
}
|
|
1418
|
-
const
|
|
1419
|
-
version:
|
|
1420
|
-
},
|
|
1208
|
+
const St = "0.5.0", Mt = {
|
|
1209
|
+
version: St
|
|
1210
|
+
}, Ft = Mt.version;
|
|
1421
1211
|
export {
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1212
|
+
Ft as SDK_VERSION,
|
|
1213
|
+
Bt as ToneSchema,
|
|
1214
|
+
I as Widget,
|
|
1215
|
+
Ve as WidgetContent,
|
|
1216
|
+
te as WidgetCtx,
|
|
1217
|
+
Pt as WidgetDialog,
|
|
1218
|
+
Pe as WidgetIcon,
|
|
1219
|
+
Yt as WidgetManifestSchema,
|
|
1220
|
+
Ne as WidgetSliderFill,
|
|
1221
|
+
Ue as WidgetStatus,
|
|
1222
|
+
Ie as WidgetTitle,
|
|
1223
|
+
Je as WidgetValue,
|
|
1224
|
+
Le as calculateLightGroup,
|
|
1225
|
+
Fe as calculateSensorGroup,
|
|
1226
|
+
Ht as countActiveEntities,
|
|
1227
|
+
Vt as defineWidget,
|
|
1228
|
+
Kt as formatSchemaError,
|
|
1229
|
+
Wt as getEntityAttribute,
|
|
1230
|
+
Se as injectTokens,
|
|
1231
|
+
Lt as isDark,
|
|
1232
|
+
Ge as isEntityActive,
|
|
1233
|
+
At as useWidgetContext,
|
|
1234
|
+
Rt as useWidgetDialog,
|
|
1235
|
+
Ut as useWidgetEntityGroup,
|
|
1236
|
+
jt as useWidgetGestures,
|
|
1237
|
+
It as widgetFields
|
|
1448
1238
|
};
|