@sentinel-nvr/web 0.20.2 → 0.22.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.
@@ -0,0 +1,368 @@
1
+ /*! Theme tokens derived from HAPulse (https://github.com/jlnbln/HAPulse) — MIT License, Copyright (c) 2026 Julian */
2
+ /**
3
+ * Theme tokens: the four colour identities (aurora / sunset / ocean / forest),
4
+ * each with light + dark token sets, plus the pure mode/accent maths.
5
+ *
6
+ * Copied from HAPulse (https://github.com/jlnbln/HAPulse, packages/core/src/themes.ts),
7
+ * MIT License, Copyright (c) 2026 Julian — see NOTICE.md. Kept verbatim so both
8
+ * consumers stay pixel-identical.
9
+ */
10
+ type ThemeName = 'aurora' | 'sunset' | 'ocean' | 'forest';
11
+ type ThemeMode = 'light' | 'dark' | 'auto';
12
+ type ResolvedMode = 'light' | 'dark';
13
+ declare const THEME_NAMES: readonly ThemeName[];
14
+ /** Human-facing labels for the theme identities. */
15
+ declare const THEME_LABELS: Record<ThemeName, string>;
16
+ interface ThemeTokens {
17
+ /** Page background */
18
+ bg: string;
19
+ /** Raised surface (sidebar, sheets) */
20
+ bgRaised: string;
21
+ /** Card surface */
22
+ bgCard: string;
23
+ /** Card hover surface */
24
+ bgCardHover: string;
25
+ /** Subtle inset surface (icon chips, inputs) */
26
+ bgSubtle: string;
27
+ text: string;
28
+ textDim: string;
29
+ textFaint: string;
30
+ /** Primary accent — orange family for aurora (= lights) */
31
+ accent: string;
32
+ accentSoft: string;
33
+ onAccent: string;
34
+ /** Hairline divider (alpha) */
35
+ line: string;
36
+ /** Solid card border */
37
+ border: string;
38
+ positive: string;
39
+ positiveSoft: string;
40
+ warning: string;
41
+ warningSoft: string;
42
+ danger: string;
43
+ dangerSoft: string;
44
+ info: string;
45
+ infoSoft: string;
46
+ shadowCard: string;
47
+ shadowElevated: string;
48
+ shadowActive: string;
49
+ }
50
+ interface ThemeVariants {
51
+ light: ThemeTokens;
52
+ dark: ThemeTokens;
53
+ }
54
+ declare const THEMES: Record<ThemeName, ThemeVariants>;
55
+ /**
56
+ * Resolve 'auto' to the concrete light/dark based on the OS preference.
57
+ *
58
+ * Pure function — the caller supplies `systemPrefersDark` (e.g. from
59
+ * `window.matchMedia('(prefers-color-scheme: dark)').matches` in the browser,
60
+ * or the platform's equivalent on mobile) so this module stays DOM-free.
61
+ */
62
+ declare function resolveThemeMode(mode: ThemeMode, systemPrefersDark: boolean): ResolvedMode;
63
+ /**
64
+ * Compute the `accent` / `accentSoft` / `onAccent` token overrides for a
65
+ * custom accent hue (0–360), matching the HSL math the dashboard's
66
+ * `applyTheme()` has always used. Mirrors the current inline override exactly:
67
+ * lightness differs by resolved mode (60% dark / 50% light), saturation is
68
+ * fixed at 78%, and the soft alpha differs by mode (0.16 dark / 0.12 light).
69
+ */
70
+ declare function accentOverride(hue: number, resolvedMode: ResolvedMode): {
71
+ accent: string;
72
+ accentSoft: string;
73
+ onAccent: string;
74
+ };
75
+
76
+ /**
77
+ * [fork] Design tokens of the second style "Glas" — pure data + pure functions, DOM-free.
78
+ *
79
+ * Source of every value: docs/GLAS-DESIGN.md and docs/glas/glas-tokens.json (the colour table below is a verbatim
80
+ * copy of `color`). The dashboard's `theme/glasAppearance.ts` writes `glasCssVars(…)` inline on :root after
81
+ * `applyTheme` — the classic token names (so every existing component looks "Glas" without its own CSS) plus the
82
+ * Glas-own `--g-*` variables. Plan and deviations: docs/glas/PLAN-ETAPPE-0-1.md, docs/glas/PLAN-ETAPPE-2.md (frame:
83
+ * surface tints, sheet material, shadows).
84
+ */
85
+
86
+ type GlasMode = 'light' | 'dark';
87
+ type GlasStrength = 'clear' | 'tinted' | 'opaque';
88
+ type UiStyle = 'classic' | 'glas';
89
+ declare const UI_STYLES: readonly UiStyle[];
90
+ declare const GLAS_STRENGTHS: readonly GlasStrength[];
91
+ declare const LIGHT: {
92
+ bg: string;
93
+ card: string;
94
+ card2: string;
95
+ cardSolid: string;
96
+ cardHover: string;
97
+ group: string;
98
+ sheetSolid: string;
99
+ fill: string;
100
+ fill2: string;
101
+ fillSolid: string;
102
+ sep: string;
103
+ sepStrong: string;
104
+ label: string;
105
+ label2: string;
106
+ label3: string;
107
+ glassLabel2: string;
108
+ textFaint: string;
109
+ glyphDark: string;
110
+ onMedia: string;
111
+ mediaBg: string;
112
+ grabber: string;
113
+ yellow: string;
114
+ yellowInk: string;
115
+ yellowSoft: string;
116
+ orange: string;
117
+ orangeInk: string;
118
+ orangeSoft: string;
119
+ teal: string;
120
+ tealInk: string;
121
+ tealSoft: string;
122
+ green: string;
123
+ greenInk: string;
124
+ greenSoft: string;
125
+ red: string;
126
+ redInk: string;
127
+ redSoft: string;
128
+ blue: string;
129
+ blueInk: string;
130
+ blueSoft: string;
131
+ purple: string;
132
+ purpleInk: string;
133
+ indigo: string;
134
+ indigoInk: string;
135
+ gray: string;
136
+ warnInk: string;
137
+ warnSoft: string;
138
+ switchOn: string;
139
+ switchOff: string;
140
+ knob: string;
141
+ badge: string;
142
+ onBadge: string;
143
+ live: string;
144
+ liveDot: string;
145
+ actDel: string;
146
+ actOk: string;
147
+ actNeutral: string;
148
+ binRest: string;
149
+ binPaper: string;
150
+ binYellow: string;
151
+ binBio: string;
152
+ binBrown: string;
153
+ ct1: string;
154
+ ct2: string;
155
+ ct3: string;
156
+ ct4: string;
157
+ tileOn: string;
158
+ tileOff: string;
159
+ tileOffLabel: string;
160
+ chartNetz: string;
161
+ chartSolar: string;
162
+ chartSolarEdge: string;
163
+ chartBar: string;
164
+ chartLine: string;
165
+ chartArea: string;
166
+ chartGrid: string;
167
+ chartAvg: string;
168
+ seg: string;
169
+ segShadow: string;
170
+ lens: string;
171
+ hover: string;
172
+ scrim: string;
173
+ scrimDesktop: string;
174
+ ctxDim: string;
175
+ ctxScrimDesktop: string;
176
+ avDim: string;
177
+ glow: string;
178
+ toastBg: string;
179
+ toastText: string;
180
+ bannerReconnecting: string;
181
+ bannerLost: string;
182
+ edgeTint: string;
183
+ wallTint: string;
184
+ };
185
+ type GlasColorKey = keyof typeof LIGHT;
186
+ declare const GLAS_COLORS: Readonly<Record<GlasMode, Readonly<Record<GlasColorKey, string>>>>;
187
+ /** `--g-glass-tint` per strength; "opaque" has no tint (solid fill, no blur). */
188
+ declare const GLAS_TINT: Readonly<Record<'clear' | 'tinted', number>>;
189
+ /**
190
+ * Minimum tint per surface; effective tint = max(surface, strength) (GLAS-DESIGN §3.4). `glasCssVars` writes the value
191
+ * of the current strength as `--g-tint-<surface>` (plan Etappe 2, K28); a surface sets
192
+ * `--g-surface-tint: var(--g-tint-<surface>)` and the material recipe takes the maximum.
193
+ */
194
+ declare const GLAS_SURFACE_TINT: {
195
+ readonly default: {
196
+ readonly clear: 0.25;
197
+ readonly tinted: 0.75;
198
+ };
199
+ readonly tabBar: {
200
+ readonly clear: 0.6;
201
+ readonly tinted: 0.75;
202
+ };
203
+ readonly avatarButton: {
204
+ readonly clear: 0.6;
205
+ readonly tinted: 0.75;
206
+ };
207
+ readonly backButton: {
208
+ readonly clear: 0.5;
209
+ readonly tinted: 0.75;
210
+ };
211
+ readonly dateChip: {
212
+ readonly clear: 0.55;
213
+ readonly tinted: 0.75;
214
+ };
215
+ readonly headerCapsule: {
216
+ readonly clear: 0.25;
217
+ readonly tinted: 0.75;
218
+ };
219
+ readonly sidebar: {
220
+ readonly clear: 0.5;
221
+ readonly tinted: 0.8;
222
+ };
223
+ readonly sheetMedium: {
224
+ readonly clear: 0.7;
225
+ readonly tinted: 0.75;
226
+ };
227
+ readonly dialogDesktop: {
228
+ readonly clear: 0.68;
229
+ readonly tinted: 0.85;
230
+ };
231
+ readonly inspector: {
232
+ readonly clear: 0.68;
233
+ readonly tinted: 0.85;
234
+ };
235
+ readonly toastDesktop: {
236
+ readonly clear: 0.68;
237
+ readonly tinted: 0.85;
238
+ };
239
+ readonly menu: {
240
+ readonly clear: 0.88;
241
+ readonly tinted: 0.94;
242
+ };
243
+ };
244
+ /**
245
+ * Shadows of the frame (glas-tokens.json → elevation: menuDesktop, popoverDesktop, banner, toastPhone, prominent;
246
+ * "übrige Schatten wie hell" — the same in both modes, the mode lives in `--g-glass-inner`). `chip`: the desktop
247
+ * header's chips and weather pill (GLAS-DESIGN §7.3). `live`: the camera page's LIVE badge and pill (§7.33, stage 6).
248
+ */
249
+ declare const GLAS_SHADOWS: {
250
+ readonly menu: "var(--g-glass-inner), 0 2px 6px rgba(0,0,0,.08), 0 24px 60px rgba(0,0,0,.25)";
251
+ readonly popover: "var(--g-glass-inner), 0 2px 6px rgba(0,0,0,.08), 0 24px 60px rgba(0,0,0,.22)";
252
+ readonly banner: "0 4px 16px rgba(0,0,0,.08)";
253
+ readonly toast: "0 10px 30px rgba(0,0,0,.25)";
254
+ readonly prominent: "0 1px 2px rgba(0,0,0,.08), 0 6px 18px rgba(0,0,0,.12)";
255
+ readonly chip: "0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08)";
256
+ readonly live: "0 2px 8px rgba(0,0,0,.25)";
257
+ };
258
+ type GlasWindowShadow = 'dialog' | 'inspector' | 'sheetLarge' | 'pushedScreen' | 'liftContext' | 'liftContextDesktop' | 'cardHover' | 'tileLift' | 'tileOnDesktop' | 'knob' | 'lightGlow';
259
+ /**
260
+ * Shadows of windows and gestures (stage 3, plan docs/glas/PLAN-ETAPPE-3.md §5.1; glas-tokens.json → elevation, verbatim):
261
+ * desktop dialog, inspector, large sheet, the page pushed over a sheet and the lifted card of the context menu; since
262
+ * stage 4 (docs/glas/PLAN-ETAPPE-4.md K83) also the tiles: card hover, an "on" tile (phone / desktop), the switch knob
263
+ * and the glow of a lit light circle. Dark overrides `sheetLarge`, both lifts, `cardHover`, `tileLift` and
264
+ * `tileOnDesktop`; the others are the same in both modes.
265
+ */
266
+ declare const GLAS_WINDOW_SHADOWS: Record<GlasMode, Record<GlasWindowShadow, string>>;
267
+ declare const GLAS_SPRINGS: {
268
+ readonly smooth: {
269
+ readonly linear: "linear(0, 0.0263, 0.0895, 0.1722, 0.2626, 0.3534, 0.4399, 0.5197, 0.5916, 0.6551, 0.7104, 0.7581, 0.7988, 0.8334, 0.8624, 0.8868, 0.9071, 0.9239, 0.9379, 0.9494, 0.9588, 0.9665, 0.9729, 0.978, 0.9822, 0.9857, 0.9884, 0.9907, 0.9925, 0.994, 0.9952, 0.9961, 0.9969, 0.9975, 0.998, 0.9984, 0.9987, 0.999, 0.9992, 0.9993, 1)";
270
+ readonly fallback: "cubic-bezier(.3,.6,.04,1)";
271
+ readonly duration: ".5s";
272
+ };
273
+ readonly snappy: {
274
+ readonly linear: "linear(0, 0.0217, 0.0778, 0.1568, 0.2492, 0.3477, 0.4464, 0.5414, 0.6296, 0.7093, 0.7795, 0.8398, 0.8905, 0.932, 0.9651, 0.9908, 1.0099, 1.0234, 1.0323, 1.0375, 1.0398, 1.0398, 1.0381, 1.0354, 1.0319, 1.028, 1.0241, 1.0202, 1.0165, 1.0131, 1.0101, 1.0075, 1.0053, 1.0035, 1.002, 1.0008, 0.9999, 0.9993, 0.9989, 0.9986, 1)";
275
+ readonly fallback: "cubic-bezier(.34,.65,0,1.2)";
276
+ readonly duration: ".35s";
277
+ };
278
+ readonly bouncy: {
279
+ readonly linear: "linear(0, 0.0371, 0.131, 0.2588, 0.4016, 0.5451, 0.679, 0.7967, 0.8947, 0.9716, 1.0283, 1.0667, 1.0892, 1.099, 1.099, 1.092, 1.0806, 1.0669, 1.0524, 1.0384, 1.0258, 1.015, 1.0063, 0.9997, 0.995, 0.992, 0.9904, 0.99, 0.9904, 0.9913, 0.9926, 0.9941, 0.9955, 0.9968, 0.998, 0.999, 0.9997, 1.0003, 1.0007, 1.0009, 1)";
280
+ readonly fallback: "cubic-bezier(.34,1.2,0,1.12)";
281
+ readonly duration: ".6s";
282
+ };
283
+ };
284
+ interface Rgba {
285
+ r: number;
286
+ g: number;
287
+ b: number;
288
+ a: number;
289
+ }
290
+ /** #rgb, #rrggbb, rgb()/rgba() with commas or spaces; `transparent`. Anything else (color-mix, gradients) → null. */
291
+ declare function parseColor(input: string): Rgba | null;
292
+ declare function toHex(c: Pick<Rgba, 'r' | 'g' | 'b'>): string;
293
+ /** Alpha-composite `fg` over an opaque `bg` → opaque hex. */
294
+ declare function compositeOver(fg: string, bg: string): string;
295
+ declare function relativeLuminance(color: string): number;
296
+ /** WCAG contrast ratio of two opaque colours (1…21). */
297
+ declare function contrastRatio(a: string, b: string): number;
298
+ declare function hslToHex(h: number, s: number, l: number): string;
299
+ /**
300
+ * The backdrop of a regular glass surface after its backdrop-filter (brightness only — saturate and blur do not
301
+ * change a uniform grey/white/black backdrop), then the gradient's weakest stop on top. For the contrast tests.
302
+ */
303
+ declare function glassOver(backdrop: string, mode: GlasMode, tint: number): string;
304
+ /** Like `glassOver` for the sheet material: brightness of its filter, then its weaker gradient stop. */
305
+ declare function sheetOver(backdrop: string, mode: GlasMode): string;
306
+ /**
307
+ * The resting ground of a window (sheet, desktop dialog, the phone's context menu): the sheet material over the page
308
+ * under the window's scrim (Etappe 7, K109 — the pairs before left the scrim out). The dialog's own filter is a little
309
+ * brighter (1.06); the sheet's 1.04 is the safer value.
310
+ */
311
+ declare function windowGround(mode: GlasMode, scrim: string, page: string): string;
312
+ /** `color-mix(in srgb, A p%, B)` of two opaque colours → hex (the banner surfaces); a plain colour is returned as is. */
313
+ declare function resolveMix(input: string): string;
314
+ interface GlasAccent {
315
+ /** Bright accent — surfaces only (`--g-accent`) */
316
+ accent: string;
317
+ /** Accessible text/glyph variant (`--g-accent-ink`; also the classic `--accent` in Glas, plan K6) */
318
+ accentInk: string;
319
+ /** Active tab on the lens */
320
+ tabInk: string;
321
+ accentSoft: string;
322
+ /** The one prominent primary action per view */
323
+ prominent: string;
324
+ onProminent: string;
325
+ /** Best text colour on `accentInk` (classic `--on-accent` in Glas) */
326
+ onAccentInk: string;
327
+ focus: string;
328
+ }
329
+ /** Accent family for the user's hue (HAPulse accent slider); without a hue the iOS orange of the sketch. */
330
+ declare function glasAccent(hue: number | undefined, mode: GlasMode): GlasAccent;
331
+ /**
332
+ * The third tone of a focus ring on a picture (GLAS-DESIGN §2.5 rule 7, WCAG technique C40): two tones ≥ 9:1 apart make
333
+ * sure that one of them stands out ≥ 3:1 against any picture. The focus colour and the card colour inside it are that
334
+ * far apart in dark mode (orange 9.54:1), not in light mode (5.79:1): there a band in the card's counter-tone follows
335
+ * inside. `transparent` when the two are enough.
336
+ */
337
+ declare function focusPair(focus: string, card: string): string;
338
+ interface GlasInput {
339
+ mode: GlasMode;
340
+ accentHue?: number | undefined;
341
+ /** Effective strength — "opaque" when the admin's "reduce transparency" or the device's system setting asks for it */
342
+ strength: GlasStrength;
343
+ /** `prefers-contrast: more` on this device */
344
+ contrastMore?: boolean | undefined;
345
+ /** `CSS.supports('transition-timing-function', 'linear(0, 1)')` — else the cubic-bezier fallbacks */
346
+ supportsLinear?: boolean | undefined;
347
+ }
348
+ /** The 24 classic HAPulse tokens in Glas (GLAS-DESIGN §2.6; `--accent` = ink, plan K6; `--border`, plan K14). */
349
+ declare function glasThemeTokens(input: GlasInput): ThemeTokens;
350
+ /** CSS variable of a classic token key: `bgCardHover` → `--bg-card-hover` (same names as the dashboard's applyTheme). */
351
+ declare const classicTokenVar: (key: keyof ThemeTokens) => string;
352
+ /** CSS variable of a Glas colour: `glassLabel2` → `--g-glass-label-2`, `ct1` → `--g-ct-1`. */
353
+ declare const glasColorVar: (key: GlasColorKey) => string;
354
+ /**
355
+ * Everything `applyAppearance` writes inline on :root in Glas: the 24 classic names + `--g-*`. Every key is either a
356
+ * classic token name (so `applyTheme` resets it when switching back to Klassisch) or starts with `--g-` (removed).
357
+ */
358
+ declare function glasCssVars(input: GlasInput): Record<string, string>;
359
+ interface ContrastPair {
360
+ name: string;
361
+ fg: string;
362
+ bg: string;
363
+ min: number;
364
+ }
365
+ /** Text/glyph pairs that must hold in Glas for a mode/strength; colours composited onto opaque backgrounds. */
366
+ declare function glasContrastPairs(input: GlasInput): ContrastPair[];
367
+
368
+ export { relativeLuminance as A, resolveMix as B, type ContrastPair as C, sheetOver as D, toHex as E, windowGround as F, type GlasStrength as G, type ThemeTokens as H, type ResolvedMode as I, THEMES as J, THEME_LABELS as K, THEME_NAMES as L, accentOverride as M, resolveThemeMode as N, type Rgba as R, type ThemeName as T, type UiStyle as U, type ThemeMode as a, GLAS_COLORS as b, GLAS_SHADOWS as c, GLAS_SPRINGS as d, GLAS_STRENGTHS as e, GLAS_SURFACE_TINT as f, GLAS_TINT as g, GLAS_WINDOW_SHADOWS as h, type GlasAccent as i, type GlasColorKey as j, type GlasInput as k, type GlasMode as l, type GlasWindowShadow as m, UI_STYLES as n, classicTokenVar as o, compositeOver as p, contrastRatio as q, focusPair as r, glasAccent as s, glasColorVar as t, glasContrastPairs as u, glasCssVars as v, glasThemeTokens as w, glassOver as x, hslToHex as y, parseColor as z };