@sentinel-nvr/web 0.20.2 → 0.21.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/README.md +21 -0
- package/dist/chunk-KUDATN2V.js +324 -0
- package/dist/chunk-KUDATN2V.js.map +1 -0
- package/dist/glas/index.d.ts +76 -0
- package/dist/glas/index.js +949 -0
- package/dist/glas/index.js.map +1 -0
- package/dist/glas-data-CSRWRmcF.d.ts +368 -0
- package/dist/ui/glas.css +1250 -0
- package/dist/ui/index.d.ts +68 -96
- package/dist/ui/index.js +782 -683
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/locales/de.json +14 -0
- package/dist/ui/locales/en.json +14 -0
- package/dist/ui/locales/es.json +14 -0
- package/dist/ui/locales/fr.json +14 -0
- package/dist/ui/locales/it.json +14 -0
- package/dist/ui/locales/pt.json +14 -0
- package/dist/ui/locales/sv.json +14 -0
- package/dist/ui/ui.css +44 -0
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ One npm package, **`@sentinel-nvr/web`**, with subpath entry points (one version
|
|
|
16
16
|
| `@sentinel-nvr/web/api` | **available** | DOM-free data model + types mirroring the plugin's `docs/API.md`, URL/setup parsing, event classification, storage forecast, timeline clip-run merge, locale formatters, and a `fetch`/WebSocket `SentinelClient`. No framework deps. |
|
|
17
17
|
| `@sentinel-nvr/web/player` | **available** | `PlayerController`, WebRTC signaling, the no-reneg recorded-playback relay client, watchdog and the live/recorded fallback chain. |
|
|
18
18
|
| `@sentinel-nvr/web/ui` | **available** | React components — the whole **camera page** (`CameraPage`: stage, control pill, info bar, tabs, class filters, vertical timeline, events list, date chip; `CameraTitle` header row), class badges, event strip, camera tiles, date picker, stat cards — the i18n dictionaries (`nvr.*`, 7 locales) and the theme system (4 identities × light/dark/auto + accent hue). Styles in `@sentinel-nvr/web/ui/ui.css` (HAPulse tokens). |
|
|
19
|
+
| `@sentinel-nvr/web/glas` | **available** (0.21.0) | The style "Glas" without React: its values (`glas-data`, a verbatim copy of HAPulse's `glasTokens.ts`) and `applyAppearance`/`watchAppearance`, which write them on `<html>` next to the classic theme. Its stylesheet for the package's parts is `@sentinel-nvr/web/ui/glas.css` (load after `ui.css`). |
|
|
19
20
|
|
|
20
21
|
The earlier `@sentinel-nvr/api@0.1.0` is deprecated in favour of `@sentinel-nvr/web/api`.
|
|
21
22
|
|
|
@@ -41,6 +42,7 @@ on older servers, but only get their full behaviour with the matching plugin ver
|
|
|
41
42
|
| 0.18.x | any | opt-in immersive camera page: `CameraPage appearance="immersive"` (`data-nvr-appearance` on the page) — picture edge to edge with the header over it on phones, floating controls, tabs as a segment, styled by the host through `--nvr-ctl-*`, `--nvr-float-*`, `--nvr-seg-*`, `--nvr-live-*`, `--nvr-shade-top`/`-bottom`, `--nvr-ease`/`--nvr-dur`; `header(at, { live })`, `CameraTitle` `live`/`at` (LIVE badge or the picture's time). Without the prop the page is unchanged. Client only. |
|
|
42
43
|
| 0.19.x | any (clip download: as 0.17.x) | immersive clip mode (`CameraPage appearance="immersive"`): the clip bar as a floating card with the edges as a segment, the picture edge to edge on phones; the clip bar's close button never wraps (both appearances); optional `icon` in front of the `EventsStrip` / `CameraGrid` titles. 0.19.1: below 900 px the immersive picture card is sticky (it cannot move), so that, according to WebKit's source, an iOS 26 home-screen app on an iPhone shows the status bar on the stage's background instead of blurring the top of the picture (pictures at least 90 % as wide as the screen). 0.19.2: camera tiles carry `data-nvr-camera` and hold the picture in one box (`.nvr-camtile__pic`); a tile that mounts again shows the camera's last picture (`.nvr-camtile__img--last`, also while the remembered image loads its next snapshot) until its own snapshot is decoded (`drawLastTileSnapshot` / `hasLastTileSnapshot` for a host's own pictures). Client only. |
|
|
43
44
|
| 0.20.x | any (start picture: plugin with `features: ["frame"]`, older plugins keep the detection frame) | event click: the still picture until the video runs is the first picture of the playback (`api/frame`), so the video no longer jumps back when it takes over; `PlayerController.posterEvent(ts, start?)`. 0.20.1: a jump into a gap of up to 2 s between two recordings plays the next one instead of "no recording" (`clipAt`, `GAP_SNAP_MS`); MSE fallback: the next segment is fetched only after the previous one is appended (sporadic decode error) — client only. 0.20.2: while scrubbing the playhead moves at the speed of the picture (`relay-pos` `v`, plugin from 19.10.2026; older plugins: the former rate interpolation). |
|
|
45
|
+
| 0.21.x | any (client only) | the style "Glas": entry `@sentinel-nvr/web/glas`, `ui/glas.css`, the Glas overview parts (`GlassCameras`, `GlassEvents`, `GlassNvr`, `GlassSections`), `Hero appearance="glass"`, the style rows in `AppearanceSection`. Without them every part renders as in 0.20.x. |
|
|
44
46
|
|
|
45
47
|
Lab note: Scrypted's WebRTC sink re-encodes (1280 px, 15 fps) for clients that are not Windows/macOS/iOS and report a
|
|
46
48
|
screen below 1920 physical pixels, unless the source declares a width ≤ 1280. Plugin ≥ 1.2.0 declares it for recorded
|
|
@@ -90,6 +92,25 @@ The server keeps its own types; `docs/API.md` in the plugin repository is the co
|
|
|
90
92
|
surface must carry them), its edges are a segment with the `--nvr-seg-*` hooks (`.nvr-clipbar__edges[data-edge]`,
|
|
91
93
|
`data-was` = the edge before).
|
|
92
94
|
|
|
95
|
+
- **Glas** (0.21.0, opt-in; HAPulse leads the look, the package holds what both apps show): `applyAppearance({ theme,
|
|
96
|
+
mode, accentHue, uiStyle, glassStrength, reduceTransparency })` from `@sentinel-nvr/web/glas` applies the classic theme
|
|
97
|
+
and, for `uiStyle: 'glas'`, the Glas values and `data-style="glas"` on `<html>` (`data-glass` = the strength, opaque
|
|
98
|
+
under more contrast or reduced transparency; a `<style id="glas-dark-scope">` for the dark subtree). Back to
|
|
99
|
+
Klassisch nothing of Glas stays. `watchAppearance(get)` re-applies on the system's light/dark, contrast and
|
|
100
|
+
transparency changes. `setAppearanceHost({ floating, classicThemeColor })` names the host's floating surfaces over the
|
|
101
|
+
camera page and who sets the browser colour in Klassisch. Every rule of `ui/glas.css` sits under
|
|
102
|
+
`:root[data-style='glas']`; without the attribute the file does nothing. Host contract (as HAPulse's base): the root
|
|
103
|
+
values (`--g-font`, `--font-*`, `--radius-card`, tabular figures), the class `nvr-overview` on the overview's content,
|
|
104
|
+
`--nvr-gl-bleed` (default 16 px, how far the strips reach past the content on a phone), `data-glas-scheme="dark"`
|
|
105
|
+
on the part that shows the camera page. Parts: `GlassNvr` (cameras and events as strips, the snapshots refresh every
|
|
106
|
+
`refreshMs`, a failed one shows the last thumbnail until a background probe loads, every 30 s), `GlassSections` (the
|
|
107
|
+
same with section titles), `GlassCameras`, `GlassEvents`; a tile is the `button[data-nvr-camera]` with its picture
|
|
108
|
+
box `.nvr-camtile__pic` as first child (a host's transition between tile and camera page finds it there); opening
|
|
109
|
+
goes through `nav.openCamera(id)` (tile) or `nav.openCamera(id, at, ev)` (event). `Hero appearance="glass"` is the
|
|
110
|
+
status board (`.nvr-tafel`). `AppearanceSection` shows the style rows when the host passes `onUiStyle` (and in Glas
|
|
111
|
+
`onGlassStrength`, `onReduceTransparency`); in Glas a hint replaces the theme cards. Without these props every part
|
|
112
|
+
renders the markup of 0.20.x (test `classic-markup`).
|
|
113
|
+
|
|
93
114
|
## Develop
|
|
94
115
|
|
|
95
116
|
```bash
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
// src/ui/themes-data.ts
|
|
2
|
+
var THEME_NAMES = ["aurora", "sunset", "ocean", "forest"];
|
|
3
|
+
var THEME_LABELS = {
|
|
4
|
+
aurora: "Aurora",
|
|
5
|
+
sunset: "Sunset",
|
|
6
|
+
ocean: "Ocean",
|
|
7
|
+
forest: "Forest"
|
|
8
|
+
};
|
|
9
|
+
var THEMES = {
|
|
10
|
+
// Aurora — the default: neutral surfaces, warm orange accent (matches mockups)
|
|
11
|
+
aurora: {
|
|
12
|
+
light: {
|
|
13
|
+
bg: "#f3f4f6",
|
|
14
|
+
bgRaised: "#ffffff",
|
|
15
|
+
bgCard: "#ffffff",
|
|
16
|
+
bgCardHover: "#f8f9fb",
|
|
17
|
+
bgSubtle: "#f1f3f5",
|
|
18
|
+
text: "#1a1d23",
|
|
19
|
+
textDim: "#697079",
|
|
20
|
+
textFaint: "#9aa1ab",
|
|
21
|
+
accent: "#f2941c",
|
|
22
|
+
accentSoft: "rgba(242, 148, 28, 0.12)",
|
|
23
|
+
onAccent: "#ffffff",
|
|
24
|
+
line: "rgba(20, 24, 30, 0.07)",
|
|
25
|
+
border: "#e8eaee",
|
|
26
|
+
positive: "#16a34a",
|
|
27
|
+
positiveSoft: "rgba(22, 163, 74, 0.12)",
|
|
28
|
+
warning: "#e59411",
|
|
29
|
+
warningSoft: "rgba(229, 148, 17, 0.12)",
|
|
30
|
+
danger: "#e5484d",
|
|
31
|
+
dangerSoft: "rgba(229, 72, 77, 0.10)",
|
|
32
|
+
info: "#3b82f6",
|
|
33
|
+
infoSoft: "rgba(59, 130, 246, 0.12)",
|
|
34
|
+
shadowCard: "0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)",
|
|
35
|
+
shadowElevated: "0 12px 32px -8px rgba(16, 24, 40, 0.16)",
|
|
36
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(242, 148, 28, 0.30)"
|
|
37
|
+
},
|
|
38
|
+
dark: {
|
|
39
|
+
bg: "#0f1116",
|
|
40
|
+
bgRaised: "#171a21",
|
|
41
|
+
bgCard: "#171a21",
|
|
42
|
+
bgCardHover: "#1e222b",
|
|
43
|
+
bgSubtle: "#22262f",
|
|
44
|
+
text: "#f2f4f7",
|
|
45
|
+
textDim: "#9aa1ad",
|
|
46
|
+
textFaint: "#646b76",
|
|
47
|
+
accent: "#f5a623",
|
|
48
|
+
accentSoft: "rgba(245, 166, 35, 0.16)",
|
|
49
|
+
onAccent: "#1a1205",
|
|
50
|
+
line: "rgba(255, 255, 255, 0.08)",
|
|
51
|
+
border: "rgba(255, 255, 255, 0.09)",
|
|
52
|
+
positive: "#3ad07f",
|
|
53
|
+
positiveSoft: "rgba(58, 208, 127, 0.15)",
|
|
54
|
+
warning: "#f5b53d",
|
|
55
|
+
warningSoft: "rgba(245, 181, 61, 0.15)",
|
|
56
|
+
danger: "#f0686d",
|
|
57
|
+
dangerSoft: "rgba(240, 104, 109, 0.15)",
|
|
58
|
+
info: "#5fa0f5",
|
|
59
|
+
infoSoft: "rgba(95, 160, 245, 0.15)",
|
|
60
|
+
shadowCard: "0 2px 8px -2px rgba(0, 0, 0, 0.5)",
|
|
61
|
+
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.7)",
|
|
62
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(245, 166, 35, 0.30)"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
// Sunset — warm amber identity, warm-tinted surfaces
|
|
66
|
+
sunset: {
|
|
67
|
+
light: {
|
|
68
|
+
bg: "#f6f1ea",
|
|
69
|
+
bgRaised: "#fffdfa",
|
|
70
|
+
bgCard: "#fffdfa",
|
|
71
|
+
bgCardHover: "#f7f1e9",
|
|
72
|
+
bgSubtle: "#f1e9dd",
|
|
73
|
+
text: "#241d15",
|
|
74
|
+
textDim: "#7c6f5e",
|
|
75
|
+
textFaint: "#b3a692",
|
|
76
|
+
accent: "#d98324",
|
|
77
|
+
accentSoft: "rgba(217, 131, 36, 0.13)",
|
|
78
|
+
onAccent: "#ffffff",
|
|
79
|
+
line: "rgba(40, 30, 18, 0.09)",
|
|
80
|
+
border: "#ece2d3",
|
|
81
|
+
positive: "#3f8a5d",
|
|
82
|
+
positiveSoft: "rgba(63, 138, 93, 0.13)",
|
|
83
|
+
warning: "#c98a1e",
|
|
84
|
+
warningSoft: "rgba(201, 138, 30, 0.14)",
|
|
85
|
+
danger: "#c75a44",
|
|
86
|
+
dangerSoft: "rgba(199, 90, 68, 0.12)",
|
|
87
|
+
info: "#3f7da0",
|
|
88
|
+
infoSoft: "rgba(63, 125, 160, 0.13)",
|
|
89
|
+
shadowCard: "0 1px 3px rgba(80, 55, 20, 0.07)",
|
|
90
|
+
shadowElevated: "0 12px 32px -8px rgba(80, 55, 20, 0.18)",
|
|
91
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(217, 131, 36, 0.30)"
|
|
92
|
+
},
|
|
93
|
+
dark: {
|
|
94
|
+
bg: "#161310",
|
|
95
|
+
bgRaised: "#1f1b16",
|
|
96
|
+
bgCard: "#241f19",
|
|
97
|
+
bgCardHover: "#2a241d",
|
|
98
|
+
bgSubtle: "#2f2820",
|
|
99
|
+
text: "#f2ece2",
|
|
100
|
+
textDim: "#a39a8c",
|
|
101
|
+
textFaint: "#6f675c",
|
|
102
|
+
accent: "#e8a84b",
|
|
103
|
+
accentSoft: "rgba(232, 168, 75, 0.16)",
|
|
104
|
+
onAccent: "#1c1610",
|
|
105
|
+
line: "rgba(242, 236, 226, 0.08)",
|
|
106
|
+
border: "rgba(242, 236, 226, 0.09)",
|
|
107
|
+
positive: "#8fc7a2",
|
|
108
|
+
positiveSoft: "rgba(143, 199, 162, 0.16)",
|
|
109
|
+
warning: "#e8a84b",
|
|
110
|
+
warningSoft: "rgba(232, 168, 75, 0.16)",
|
|
111
|
+
danger: "#e08a78",
|
|
112
|
+
dangerSoft: "rgba(224, 138, 120, 0.16)",
|
|
113
|
+
info: "#8fb7c7",
|
|
114
|
+
infoSoft: "rgba(143, 183, 199, 0.16)",
|
|
115
|
+
shadowCard: "0 2px 10px -3px rgba(0, 0, 0, 0.5)",
|
|
116
|
+
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.66)",
|
|
117
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(232, 168, 75, 0.28)"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
// Ocean — cool steel-blue identity
|
|
121
|
+
ocean: {
|
|
122
|
+
light: {
|
|
123
|
+
bg: "#eef1f5",
|
|
124
|
+
bgRaised: "#ffffff",
|
|
125
|
+
bgCard: "#ffffff",
|
|
126
|
+
bgCardHover: "#f4f7fa",
|
|
127
|
+
bgSubtle: "#eaeef3",
|
|
128
|
+
text: "#172029",
|
|
129
|
+
textDim: "#5f6c7a",
|
|
130
|
+
textFaint: "#9aa6b3",
|
|
131
|
+
accent: "#2f7fd6",
|
|
132
|
+
accentSoft: "rgba(47, 127, 214, 0.12)",
|
|
133
|
+
onAccent: "#ffffff",
|
|
134
|
+
line: "rgba(20, 30, 45, 0.08)",
|
|
135
|
+
border: "#e3e8ee",
|
|
136
|
+
positive: "#159a6e",
|
|
137
|
+
positiveSoft: "rgba(21, 154, 110, 0.12)",
|
|
138
|
+
warning: "#e09112",
|
|
139
|
+
warningSoft: "rgba(224, 145, 18, 0.13)",
|
|
140
|
+
danger: "#e0495a",
|
|
141
|
+
dangerSoft: "rgba(224, 73, 90, 0.11)",
|
|
142
|
+
info: "#2f7fd6",
|
|
143
|
+
infoSoft: "rgba(47, 127, 214, 0.12)",
|
|
144
|
+
shadowCard: "0 1px 3px rgba(20, 35, 60, 0.07)",
|
|
145
|
+
shadowElevated: "0 12px 32px -8px rgba(20, 35, 60, 0.16)",
|
|
146
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(47, 127, 214, 0.28)"
|
|
147
|
+
},
|
|
148
|
+
dark: {
|
|
149
|
+
bg: "#0a0c10",
|
|
150
|
+
bgRaised: "#0f1218",
|
|
151
|
+
bgCard: "#12151c",
|
|
152
|
+
bgCardHover: "#181c25",
|
|
153
|
+
bgSubtle: "#1d2230",
|
|
154
|
+
text: "#e8ecf2",
|
|
155
|
+
textDim: "#8a9ab0",
|
|
156
|
+
textFaint: "#566173",
|
|
157
|
+
accent: "#5fa8e8",
|
|
158
|
+
accentSoft: "rgba(95, 168, 232, 0.16)",
|
|
159
|
+
onAccent: "#06090f",
|
|
160
|
+
line: "rgba(232, 236, 242, 0.08)",
|
|
161
|
+
border: "rgba(232, 236, 242, 0.09)",
|
|
162
|
+
positive: "#4dc596",
|
|
163
|
+
positiveSoft: "rgba(77, 197, 150, 0.16)",
|
|
164
|
+
warning: "#e3b256",
|
|
165
|
+
warningSoft: "rgba(227, 178, 86, 0.16)",
|
|
166
|
+
danger: "#e68086",
|
|
167
|
+
dangerSoft: "rgba(230, 128, 134, 0.16)",
|
|
168
|
+
info: "#5fa8e8",
|
|
169
|
+
infoSoft: "rgba(95, 168, 232, 0.16)",
|
|
170
|
+
shadowCard: "0 2px 12px -3px rgba(0, 0, 0, 0.6)",
|
|
171
|
+
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.72)",
|
|
172
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(95, 168, 232, 0.30)"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
// Forest — muted green identity
|
|
176
|
+
forest: {
|
|
177
|
+
light: {
|
|
178
|
+
bg: "#edf1ec",
|
|
179
|
+
bgRaised: "#ffffff",
|
|
180
|
+
bgCard: "#ffffff",
|
|
181
|
+
bgCardHover: "#f3f7f2",
|
|
182
|
+
bgSubtle: "#e8eee7",
|
|
183
|
+
text: "#1b2620",
|
|
184
|
+
textDim: "#5f6f64",
|
|
185
|
+
textFaint: "#9aa89f",
|
|
186
|
+
accent: "#3f9a63",
|
|
187
|
+
accentSoft: "rgba(63, 154, 99, 0.13)",
|
|
188
|
+
onAccent: "#ffffff",
|
|
189
|
+
line: "rgba(24, 36, 28, 0.08)",
|
|
190
|
+
border: "#e0e8e1",
|
|
191
|
+
positive: "#2f9a5e",
|
|
192
|
+
positiveSoft: "rgba(47, 154, 94, 0.13)",
|
|
193
|
+
warning: "#cf9120",
|
|
194
|
+
warningSoft: "rgba(207, 145, 32, 0.13)",
|
|
195
|
+
danger: "#cf5746",
|
|
196
|
+
dangerSoft: "rgba(207, 87, 70, 0.11)",
|
|
197
|
+
info: "#3f86a0",
|
|
198
|
+
infoSoft: "rgba(63, 134, 160, 0.13)",
|
|
199
|
+
shadowCard: "0 1px 3px rgba(24, 45, 32, 0.07)",
|
|
200
|
+
shadowElevated: "0 12px 32px -8px rgba(24, 45, 32, 0.16)",
|
|
201
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(63, 154, 99, 0.28)"
|
|
202
|
+
},
|
|
203
|
+
dark: {
|
|
204
|
+
bg: "#0c110d",
|
|
205
|
+
bgRaised: "#121812",
|
|
206
|
+
bgCard: "#161d17",
|
|
207
|
+
bgCardHover: "#1d261e",
|
|
208
|
+
bgSubtle: "#212c22",
|
|
209
|
+
text: "#e9efe9",
|
|
210
|
+
textDim: "#8ba091",
|
|
211
|
+
textFaint: "#586860",
|
|
212
|
+
accent: "#5cc486",
|
|
213
|
+
accentSoft: "rgba(92, 196, 134, 0.16)",
|
|
214
|
+
onAccent: "#06120a",
|
|
215
|
+
line: "rgba(233, 239, 233, 0.08)",
|
|
216
|
+
border: "rgba(233, 239, 233, 0.09)",
|
|
217
|
+
positive: "#5cc486",
|
|
218
|
+
positiveSoft: "rgba(92, 196, 134, 0.16)",
|
|
219
|
+
warning: "#e0b455",
|
|
220
|
+
warningSoft: "rgba(224, 180, 85, 0.16)",
|
|
221
|
+
danger: "#e6807a",
|
|
222
|
+
dangerSoft: "rgba(230, 128, 122, 0.16)",
|
|
223
|
+
info: "#62b0c4",
|
|
224
|
+
infoSoft: "rgba(98, 176, 196, 0.16)",
|
|
225
|
+
shadowCard: "0 2px 12px -3px rgba(0, 0, 0, 0.55)",
|
|
226
|
+
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.7)",
|
|
227
|
+
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(92, 196, 134, 0.30)"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function resolveThemeMode(mode, systemPrefersDark) {
|
|
232
|
+
if (mode === "light" || mode === "dark") return mode;
|
|
233
|
+
return systemPrefersDark ? "dark" : "light";
|
|
234
|
+
}
|
|
235
|
+
function accentOverride(hue, resolvedMode) {
|
|
236
|
+
const isDark = resolvedMode === "dark";
|
|
237
|
+
const l = isDark ? 60 : 50;
|
|
238
|
+
const s = 78;
|
|
239
|
+
return {
|
|
240
|
+
accent: `hsl(${hue}, ${s}%, ${l}%)`,
|
|
241
|
+
accentSoft: `hsla(${hue}, ${s}%, ${l}%, ${isDark ? 0.16 : 0.12})`,
|
|
242
|
+
onAccent: isDark ? "#140e04" : "#ffffff"
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// src/ui/theme.ts
|
|
247
|
+
var TOKEN_TO_VAR = {
|
|
248
|
+
bg: "--bg",
|
|
249
|
+
bgRaised: "--bg-raised",
|
|
250
|
+
bgCard: "--bg-card",
|
|
251
|
+
bgCardHover: "--bg-card-hover",
|
|
252
|
+
bgSubtle: "--bg-subtle",
|
|
253
|
+
text: "--text",
|
|
254
|
+
textDim: "--text-dim",
|
|
255
|
+
textFaint: "--text-faint",
|
|
256
|
+
accent: "--accent",
|
|
257
|
+
accentSoft: "--accent-soft",
|
|
258
|
+
onAccent: "--on-accent",
|
|
259
|
+
line: "--line",
|
|
260
|
+
border: "--border",
|
|
261
|
+
positive: "--positive",
|
|
262
|
+
positiveSoft: "--positive-soft",
|
|
263
|
+
warning: "--warning",
|
|
264
|
+
warningSoft: "--warning-soft",
|
|
265
|
+
danger: "--danger",
|
|
266
|
+
dangerSoft: "--danger-soft",
|
|
267
|
+
info: "--info",
|
|
268
|
+
infoSoft: "--info-soft",
|
|
269
|
+
shadowCard: "--shadow-card",
|
|
270
|
+
shadowElevated: "--shadow-elevated",
|
|
271
|
+
shadowActive: "--shadow-active"
|
|
272
|
+
};
|
|
273
|
+
var darkMql = () => typeof window !== "undefined" && window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
274
|
+
function resolveMode(mode) {
|
|
275
|
+
return resolveThemeMode(mode, darkMql()?.matches ?? false);
|
|
276
|
+
}
|
|
277
|
+
function isThemeName(name) {
|
|
278
|
+
return THEME_NAMES.includes(name);
|
|
279
|
+
}
|
|
280
|
+
function applyTheme(name, mode = "light", accentHue) {
|
|
281
|
+
const root = document.documentElement;
|
|
282
|
+
const theme = isThemeName(name) ? name : "aurora";
|
|
283
|
+
const resolved = resolveMode(mode);
|
|
284
|
+
const tokens = THEMES[theme][resolved];
|
|
285
|
+
for (const key of Object.keys(TOKEN_TO_VAR))
|
|
286
|
+
root.style.setProperty(TOKEN_TO_VAR[key], tokens[key]);
|
|
287
|
+
root.setAttribute("data-theme", theme);
|
|
288
|
+
root.setAttribute("data-mode", resolved);
|
|
289
|
+
root.style.setProperty("color-scheme", resolved);
|
|
290
|
+
if (accentHue !== void 0) {
|
|
291
|
+
const o = accentOverride(accentHue, resolved);
|
|
292
|
+
root.style.setProperty("--accent", o.accent);
|
|
293
|
+
root.style.setProperty("--accent-soft", o.accentSoft);
|
|
294
|
+
root.style.setProperty("--on-accent", o.onAccent);
|
|
295
|
+
}
|
|
296
|
+
return resolved;
|
|
297
|
+
}
|
|
298
|
+
function watchSystemMode(getState) {
|
|
299
|
+
const mql = darkMql();
|
|
300
|
+
if (!mql)
|
|
301
|
+
return () => {
|
|
302
|
+
};
|
|
303
|
+
const on = () => {
|
|
304
|
+
const s = getState();
|
|
305
|
+
if (s.mode === "auto") applyTheme(s.theme, s.mode, s.accentHue);
|
|
306
|
+
};
|
|
307
|
+
mql.addEventListener("change", on);
|
|
308
|
+
return () => mql.removeEventListener("change", on);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export {
|
|
312
|
+
THEME_NAMES,
|
|
313
|
+
THEME_LABELS,
|
|
314
|
+
THEMES,
|
|
315
|
+
resolveThemeMode,
|
|
316
|
+
accentOverride,
|
|
317
|
+
TOKEN_TO_VAR,
|
|
318
|
+
resolveMode,
|
|
319
|
+
isThemeName,
|
|
320
|
+
applyTheme,
|
|
321
|
+
watchSystemMode
|
|
322
|
+
};
|
|
323
|
+
/*! Theme tokens derived from HAPulse (https://github.com/jlnbln/HAPulse) — MIT License, Copyright (c) 2026 Julian */
|
|
324
|
+
//# sourceMappingURL=chunk-KUDATN2V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/themes-data.ts","../src/ui/theme.ts"],"sourcesContent":["/*! Theme tokens derived from HAPulse (https://github.com/jlnbln/HAPulse) — MIT License, Copyright (c) 2026 Julian */\n/**\n * Theme tokens: the four colour identities (aurora / sunset / ocean / forest),\n * each with light + dark token sets, plus the pure mode/accent maths.\n *\n * Copied from HAPulse (https://github.com/jlnbln/HAPulse, packages/core/src/themes.ts),\n * MIT License, Copyright (c) 2026 Julian — see NOTICE.md. Kept verbatim so both\n * consumers stay pixel-identical.\n */\nexport type ThemeName = 'aurora' | 'sunset' | 'ocean' | 'forest';\nexport type ThemeMode = 'light' | 'dark' | 'auto';\nexport type ResolvedMode = 'light' | 'dark';\n\nexport const THEME_NAMES: readonly ThemeName[] = ['aurora', 'sunset', 'ocean', 'forest'];\n\n/** Human-facing labels for the theme identities. */\nexport const THEME_LABELS: Record<ThemeName, string> = {\n aurora: 'Aurora',\n sunset: 'Sunset',\n ocean: 'Ocean',\n forest: 'Forest',\n};\n\nexport interface ThemeTokens {\n /** Page background */\n bg: string;\n /** Raised surface (sidebar, sheets) */\n bgRaised: string;\n /** Card surface */\n bgCard: string;\n /** Card hover surface */\n bgCardHover: string;\n /** Subtle inset surface (icon chips, inputs) */\n bgSubtle: string;\n\n text: string;\n textDim: string;\n textFaint: string;\n\n /** Primary accent — orange family for aurora (= lights) */\n accent: string;\n accentSoft: string;\n onAccent: string;\n\n /** Hairline divider (alpha) */\n line: string;\n /** Solid card border */\n border: string;\n\n positive: string;\n positiveSoft: string;\n warning: string;\n warningSoft: string;\n danger: string;\n dangerSoft: string;\n info: string;\n infoSoft: string;\n\n shadowCard: string;\n shadowElevated: string;\n shadowActive: string;\n}\n\ninterface ThemeVariants {\n light: ThemeTokens;\n dark: ThemeTokens;\n}\n\n// ---------------------------------------------------------------------------\n// Palettes\n// ---------------------------------------------------------------------------\n\nexport const THEMES: Record<ThemeName, ThemeVariants> = {\n // Aurora — the default: neutral surfaces, warm orange accent (matches mockups)\n aurora: {\n light: {\n bg: '#f3f4f6',\n bgRaised: '#ffffff',\n bgCard: '#ffffff',\n bgCardHover: '#f8f9fb',\n bgSubtle: '#f1f3f5',\n text: '#1a1d23',\n textDim: '#697079',\n textFaint: '#9aa1ab',\n accent: '#f2941c',\n accentSoft: 'rgba(242, 148, 28, 0.12)',\n onAccent: '#ffffff',\n line: 'rgba(20, 24, 30, 0.07)',\n border: '#e8eaee',\n positive: '#16a34a',\n positiveSoft: 'rgba(22, 163, 74, 0.12)',\n warning: '#e59411',\n warningSoft: 'rgba(229, 148, 17, 0.12)',\n danger: '#e5484d',\n dangerSoft: 'rgba(229, 72, 77, 0.10)',\n info: '#3b82f6',\n infoSoft: 'rgba(59, 130, 246, 0.12)',\n shadowCard: '0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)',\n shadowElevated: '0 12px 32px -8px rgba(16, 24, 40, 0.16)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(242, 148, 28, 0.30)',\n },\n dark: {\n bg: '#0f1116',\n bgRaised: '#171a21',\n bgCard: '#171a21',\n bgCardHover: '#1e222b',\n bgSubtle: '#22262f',\n text: '#f2f4f7',\n textDim: '#9aa1ad',\n textFaint: '#646b76',\n accent: '#f5a623',\n accentSoft: 'rgba(245, 166, 35, 0.16)',\n onAccent: '#1a1205',\n line: 'rgba(255, 255, 255, 0.08)',\n border: 'rgba(255, 255, 255, 0.09)',\n positive: '#3ad07f',\n positiveSoft: 'rgba(58, 208, 127, 0.15)',\n warning: '#f5b53d',\n warningSoft: 'rgba(245, 181, 61, 0.15)',\n danger: '#f0686d',\n dangerSoft: 'rgba(240, 104, 109, 0.15)',\n info: '#5fa0f5',\n infoSoft: 'rgba(95, 160, 245, 0.15)',\n shadowCard: '0 2px 8px -2px rgba(0, 0, 0, 0.5)',\n shadowElevated: '0 16px 40px -12px rgba(0, 0, 0, 0.7)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(245, 166, 35, 0.30)',\n },\n },\n\n // Sunset — warm amber identity, warm-tinted surfaces\n sunset: {\n light: {\n bg: '#f6f1ea',\n bgRaised: '#fffdfa',\n bgCard: '#fffdfa',\n bgCardHover: '#f7f1e9',\n bgSubtle: '#f1e9dd',\n text: '#241d15',\n textDim: '#7c6f5e',\n textFaint: '#b3a692',\n accent: '#d98324',\n accentSoft: 'rgba(217, 131, 36, 0.13)',\n onAccent: '#ffffff',\n line: 'rgba(40, 30, 18, 0.09)',\n border: '#ece2d3',\n positive: '#3f8a5d',\n positiveSoft: 'rgba(63, 138, 93, 0.13)',\n warning: '#c98a1e',\n warningSoft: 'rgba(201, 138, 30, 0.14)',\n danger: '#c75a44',\n dangerSoft: 'rgba(199, 90, 68, 0.12)',\n info: '#3f7da0',\n infoSoft: 'rgba(63, 125, 160, 0.13)',\n shadowCard: '0 1px 3px rgba(80, 55, 20, 0.07)',\n shadowElevated: '0 12px 32px -8px rgba(80, 55, 20, 0.18)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(217, 131, 36, 0.30)',\n },\n dark: {\n bg: '#161310',\n bgRaised: '#1f1b16',\n bgCard: '#241f19',\n bgCardHover: '#2a241d',\n bgSubtle: '#2f2820',\n text: '#f2ece2',\n textDim: '#a39a8c',\n textFaint: '#6f675c',\n accent: '#e8a84b',\n accentSoft: 'rgba(232, 168, 75, 0.16)',\n onAccent: '#1c1610',\n line: 'rgba(242, 236, 226, 0.08)',\n border: 'rgba(242, 236, 226, 0.09)',\n positive: '#8fc7a2',\n positiveSoft: 'rgba(143, 199, 162, 0.16)',\n warning: '#e8a84b',\n warningSoft: 'rgba(232, 168, 75, 0.16)',\n danger: '#e08a78',\n dangerSoft: 'rgba(224, 138, 120, 0.16)',\n info: '#8fb7c7',\n infoSoft: 'rgba(143, 183, 199, 0.16)',\n shadowCard: '0 2px 10px -3px rgba(0, 0, 0, 0.5)',\n shadowElevated: '0 16px 40px -12px rgba(0, 0, 0, 0.66)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(232, 168, 75, 0.28)',\n },\n },\n\n // Ocean — cool steel-blue identity\n ocean: {\n light: {\n bg: '#eef1f5',\n bgRaised: '#ffffff',\n bgCard: '#ffffff',\n bgCardHover: '#f4f7fa',\n bgSubtle: '#eaeef3',\n text: '#172029',\n textDim: '#5f6c7a',\n textFaint: '#9aa6b3',\n accent: '#2f7fd6',\n accentSoft: 'rgba(47, 127, 214, 0.12)',\n onAccent: '#ffffff',\n line: 'rgba(20, 30, 45, 0.08)',\n border: '#e3e8ee',\n positive: '#159a6e',\n positiveSoft: 'rgba(21, 154, 110, 0.12)',\n warning: '#e09112',\n warningSoft: 'rgba(224, 145, 18, 0.13)',\n danger: '#e0495a',\n dangerSoft: 'rgba(224, 73, 90, 0.11)',\n info: '#2f7fd6',\n infoSoft: 'rgba(47, 127, 214, 0.12)',\n shadowCard: '0 1px 3px rgba(20, 35, 60, 0.07)',\n shadowElevated: '0 12px 32px -8px rgba(20, 35, 60, 0.16)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(47, 127, 214, 0.28)',\n },\n dark: {\n bg: '#0a0c10',\n bgRaised: '#0f1218',\n bgCard: '#12151c',\n bgCardHover: '#181c25',\n bgSubtle: '#1d2230',\n text: '#e8ecf2',\n textDim: '#8a9ab0',\n textFaint: '#566173',\n accent: '#5fa8e8',\n accentSoft: 'rgba(95, 168, 232, 0.16)',\n onAccent: '#06090f',\n line: 'rgba(232, 236, 242, 0.08)',\n border: 'rgba(232, 236, 242, 0.09)',\n positive: '#4dc596',\n positiveSoft: 'rgba(77, 197, 150, 0.16)',\n warning: '#e3b256',\n warningSoft: 'rgba(227, 178, 86, 0.16)',\n danger: '#e68086',\n dangerSoft: 'rgba(230, 128, 134, 0.16)',\n info: '#5fa8e8',\n infoSoft: 'rgba(95, 168, 232, 0.16)',\n shadowCard: '0 2px 12px -3px rgba(0, 0, 0, 0.6)',\n shadowElevated: '0 16px 40px -12px rgba(0, 0, 0, 0.72)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(95, 168, 232, 0.30)',\n },\n },\n\n // Forest — muted green identity\n forest: {\n light: {\n bg: '#edf1ec',\n bgRaised: '#ffffff',\n bgCard: '#ffffff',\n bgCardHover: '#f3f7f2',\n bgSubtle: '#e8eee7',\n text: '#1b2620',\n textDim: '#5f6f64',\n textFaint: '#9aa89f',\n accent: '#3f9a63',\n accentSoft: 'rgba(63, 154, 99, 0.13)',\n onAccent: '#ffffff',\n line: 'rgba(24, 36, 28, 0.08)',\n border: '#e0e8e1',\n positive: '#2f9a5e',\n positiveSoft: 'rgba(47, 154, 94, 0.13)',\n warning: '#cf9120',\n warningSoft: 'rgba(207, 145, 32, 0.13)',\n danger: '#cf5746',\n dangerSoft: 'rgba(207, 87, 70, 0.11)',\n info: '#3f86a0',\n infoSoft: 'rgba(63, 134, 160, 0.13)',\n shadowCard: '0 1px 3px rgba(24, 45, 32, 0.07)',\n shadowElevated: '0 12px 32px -8px rgba(24, 45, 32, 0.16)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(63, 154, 99, 0.28)',\n },\n dark: {\n bg: '#0c110d',\n bgRaised: '#121812',\n bgCard: '#161d17',\n bgCardHover: '#1d261e',\n bgSubtle: '#212c22',\n text: '#e9efe9',\n textDim: '#8ba091',\n textFaint: '#586860',\n accent: '#5cc486',\n accentSoft: 'rgba(92, 196, 134, 0.16)',\n onAccent: '#06120a',\n line: 'rgba(233, 239, 233, 0.08)',\n border: 'rgba(233, 239, 233, 0.09)',\n positive: '#5cc486',\n positiveSoft: 'rgba(92, 196, 134, 0.16)',\n warning: '#e0b455',\n warningSoft: 'rgba(224, 180, 85, 0.16)',\n danger: '#e6807a',\n dangerSoft: 'rgba(230, 128, 122, 0.16)',\n info: '#62b0c4',\n infoSoft: 'rgba(98, 176, 196, 0.16)',\n shadowCard: '0 2px 12px -3px rgba(0, 0, 0, 0.55)',\n shadowElevated: '0 16px 40px -12px rgba(0, 0, 0, 0.7)',\n shadowActive: '0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(92, 196, 134, 0.30)',\n },\n },\n};\n\n// ---------------------------------------------------------------------------\n// Mode resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve 'auto' to the concrete light/dark based on the OS preference.\n *\n * Pure function — the caller supplies `systemPrefersDark` (e.g. from\n * `window.matchMedia('(prefers-color-scheme: dark)').matches` in the browser,\n * or the platform's equivalent on mobile) so this module stays DOM-free.\n */\nexport function resolveThemeMode(mode: ThemeMode, systemPrefersDark: boolean): ResolvedMode {\n if (mode === 'light' || mode === 'dark') return mode;\n return systemPrefersDark ? 'dark' : 'light';\n}\n\n// ---------------------------------------------------------------------------\n// Accent-hue override\n// ---------------------------------------------------------------------------\n\n/**\n * Compute the `accent` / `accentSoft` / `onAccent` token overrides for a\n * custom accent hue (0–360), matching the HSL math the dashboard's\n * `applyTheme()` has always used. Mirrors the current inline override exactly:\n * lightness differs by resolved mode (60% dark / 50% light), saturation is\n * fixed at 78%, and the soft alpha differs by mode (0.16 dark / 0.12 light).\n */\nexport function accentOverride(\n hue: number,\n resolvedMode: ResolvedMode,\n): { accent: string; accentSoft: string; onAccent: string } {\n const isDark = resolvedMode === 'dark';\n const l = isDark ? 60 : 50;\n const s = 78;\n return {\n accent: `hsl(${hue}, ${s}%, ${l}%)`,\n accentSoft: `hsla(${hue}, ${s}%, ${l}%, ${isDark ? 0.16 : 0.12})`,\n onAccent: isDark ? '#140e04' : '#ffffff',\n };\n}\n","/**\n * Apply a theme to the document (port of HAPulse's dashboard theme façade, MIT,\n * © 2026 Julian — see NOTICE.md). Writes every token as an inline CSS custom\n * property on :root and sets data-theme / data-mode / color-scheme.\n */\nimport {\n THEMES,\n THEME_NAMES,\n accentOverride,\n resolveThemeMode,\n type ThemeName,\n type ThemeMode,\n type ResolvedMode,\n type ThemeTokens,\n} from './themes-data';\n\nexport * from './themes-data';\n\nexport const TOKEN_TO_VAR: Record<keyof ThemeTokens, string> = {\n bg: '--bg',\n bgRaised: '--bg-raised',\n bgCard: '--bg-card',\n bgCardHover: '--bg-card-hover',\n bgSubtle: '--bg-subtle',\n text: '--text',\n textDim: '--text-dim',\n textFaint: '--text-faint',\n accent: '--accent',\n accentSoft: '--accent-soft',\n onAccent: '--on-accent',\n line: '--line',\n border: '--border',\n positive: '--positive',\n positiveSoft: '--positive-soft',\n warning: '--warning',\n warningSoft: '--warning-soft',\n danger: '--danger',\n dangerSoft: '--danger-soft',\n info: '--info',\n infoSoft: '--info-soft',\n shadowCard: '--shadow-card',\n shadowElevated: '--shadow-elevated',\n shadowActive: '--shadow-active',\n};\n\nconst darkMql = (): MediaQueryList | null =>\n typeof window !== 'undefined' && window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;\n\n/** Resolve 'auto' to light/dark from the OS preference. */\nexport function resolveMode(mode: ThemeMode): ResolvedMode {\n return resolveThemeMode(mode, darkMql()?.matches ?? false);\n}\n\nexport function isThemeName(name: string): name is ThemeName {\n return (THEME_NAMES as readonly string[]).includes(name);\n}\n\n/** Apply identity + mode (+ optional accent hue override) to <html>. */\nexport function applyTheme(name: ThemeName, mode: ThemeMode = 'light', accentHue?: number): ResolvedMode {\n const root = document.documentElement;\n const theme: ThemeName = isThemeName(name) ? name : 'aurora';\n const resolved = resolveMode(mode);\n const tokens = THEMES[theme][resolved];\n for (const key of Object.keys(TOKEN_TO_VAR) as (keyof ThemeTokens)[])\n root.style.setProperty(TOKEN_TO_VAR[key], tokens[key]);\n root.setAttribute('data-theme', theme);\n root.setAttribute('data-mode', resolved);\n root.style.setProperty('color-scheme', resolved);\n if (accentHue !== undefined) {\n const o = accentOverride(accentHue, resolved);\n root.style.setProperty('--accent', o.accent);\n root.style.setProperty('--accent-soft', o.accentSoft);\n root.style.setProperty('--on-accent', o.onAccent);\n }\n return resolved;\n}\n\n/** Re-apply while mode === 'auto' when the OS scheme flips. Returns a cleanup. */\nexport function watchSystemMode(\n getState: () => { theme: ThemeName; mode: ThemeMode; accentHue?: number | undefined },\n): () => void {\n const mql = darkMql();\n if (!mql)\n return () => {\n /* no matchMedia */\n };\n const on = () => {\n const s = getState();\n if (s.mode === 'auto') applyTheme(s.theme, s.mode, s.accentHue);\n };\n mql.addEventListener('change', on);\n return () => mql.removeEventListener('change', on);\n}\n"],"mappings":";AAaO,IAAM,cAAoC,CAAC,UAAU,UAAU,SAAS,QAAQ;AAGhF,IAAM,eAA0C;AAAA,EACrD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACV;AAmDO,IAAM,SAA2C;AAAA;AAAA,EAEtD,QAAQ;AAAA,IACN,OAAO;AAAA,MACL,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,cAAc;AAAA,MACd,SAAS;AAAA,MACT,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,cAAc;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,cAAc;AAAA,MACd,SAAS;AAA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IAAI,oBAAoB,UAAU,EAAE;AACnD;","names":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { T as ThemeName, a as ThemeMode, U as UiStyle, G as GlasStrength } from '../glas-data-CSRWRmcF.js';
|
|
2
|
+
export { C as ContrastPair, b as GLAS_COLORS, c as GLAS_SHADOWS, d as GLAS_SPRINGS, e as GLAS_STRENGTHS, f as GLAS_SURFACE_TINT, g as GLAS_TINT, h as GLAS_WINDOW_SHADOWS, i as GlasAccent, j as GlasColorKey, k as GlasInput, l as GlasMode, m as GlasWindowShadow, R as Rgba, n as UI_STYLES, o as classicTokenVar, p as compositeOver, q as contrastRatio, r as focusPair, s as glasAccent, t as glasColorVar, u as glasContrastPairs, v as glasCssVars, w as glasThemeTokens, x as glassOver, y as hslToHex, z as parseColor, A as relativeLuminance, B as resolveMix, D as sheetOver, E as toHex, F as windowGround } from '../glas-data-CSRWRmcF.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Appearance = the classic theme (`applyTheme`, unchanged) plus the optional second style "Glas" — a port of HAPulse's
|
|
6
|
+
* `apps/dashboard/src/theme/glasAppearance.ts` (MIT, see NOTICE.md) for hosts without HAPulse's settings store.
|
|
7
|
+
*
|
|
8
|
+
* Klassisch stays exactly as before: `applyAppearance` calls `applyTheme` first and, in Klassisch, only removes what
|
|
9
|
+
* Glas left behind (`--g-*` inline variables, `data-glass`, `data-contrast`, the dark subtree) and hands the browser
|
|
10
|
+
* colour back to the host. In Glas it then writes `glasCssVars(…)` inline on :root — the classic token names plus the
|
|
11
|
+
* Glas-own `--g-*` variables — and sets `data-style="glas"`, which `ui/glas.css` keys on. `prefers-contrast: more` and
|
|
12
|
+
* `prefers-reduced-transparency` are read here and written as values, so `glas-data.ts` stays the only source of
|
|
13
|
+
* numbers.
|
|
14
|
+
*
|
|
15
|
+
* Dark subtree: in Glas a `<style id="glas-dark-scope">` holds the same variables in dark mode for
|
|
16
|
+
* `[data-glas-scheme="dark"]` — the host puts that attribute on the part that is always dark (the camera page) — and,
|
|
17
|
+
* while `data-g-immersive` is set on :root, on the host's floating surfaces (`setAppearanceHost`).
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface AppearanceInput {
|
|
21
|
+
theme: ThemeName;
|
|
22
|
+
mode: ThemeMode;
|
|
23
|
+
accentHue?: number | undefined;
|
|
24
|
+
uiStyle: UiStyle;
|
|
25
|
+
glassStrength: GlasStrength;
|
|
26
|
+
reduceTransparency: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** What this device asks for (system settings) and what its browser can do. */
|
|
29
|
+
interface MediaEnv {
|
|
30
|
+
contrastMore: boolean;
|
|
31
|
+
reducedTransparency: boolean;
|
|
32
|
+
supportsLinear: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface StyleFields {
|
|
35
|
+
uiStyle: UiStyle;
|
|
36
|
+
glassStrength: GlasStrength;
|
|
37
|
+
reduceTransparency: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** What the host adds to the shared rules. */
|
|
40
|
+
interface AppearanceHost {
|
|
41
|
+
/** Surfaces the host floats over the page from `<body>` (windows, panels): dark while the camera page is shown.
|
|
42
|
+
* One selector per entry (no comma lists: each entry gets the Glas prefix in front). */
|
|
43
|
+
floating?: readonly string[];
|
|
44
|
+
/** Klassisch: the host's own browser colour (e.g. from `--bg`); without it the page's original value comes back. */
|
|
45
|
+
classicThemeColor?: () => void;
|
|
46
|
+
}
|
|
47
|
+
declare const CLASSIC_STYLE: StyleFields;
|
|
48
|
+
declare const normalizeUiStyle: (v: unknown) => UiStyle;
|
|
49
|
+
declare const normalizeGlassStrength: (v: unknown) => GlasStrength;
|
|
50
|
+
/** The style fields of a (possibly old or hand-edited) stored object, normalized. */
|
|
51
|
+
declare function styleFields(c: {
|
|
52
|
+
uiStyle?: unknown;
|
|
53
|
+
glassStrength?: unknown;
|
|
54
|
+
reduceTransparency?: unknown;
|
|
55
|
+
} | null | undefined): StyleFields;
|
|
56
|
+
declare function readMediaEnv(): MediaEnv;
|
|
57
|
+
/** Glas strength in effect: "opaque" when the switch, the system or more contrast asks for it. */
|
|
58
|
+
declare function effectiveStrength(a: Pick<AppearanceInput, 'glassStrength' | 'reduceTransparency'>, env: MediaEnv): GlasStrength;
|
|
59
|
+
/** Id of the style element with the dark subtree's variables. */
|
|
60
|
+
declare const DARK_SCOPE_ID = "glas-dark-scope";
|
|
61
|
+
/** Pure: the dark subtree's rule — the Glas variables of dark mode on `[data-glas-scheme='dark']` and, while the
|
|
62
|
+
* camera page is shown (`data-g-immersive`), on the floating surfaces. */
|
|
63
|
+
declare function darkScopeCss(vars: Readonly<Record<string, string>>, floating?: readonly string[]): string;
|
|
64
|
+
/** Glas: while the camera page is shown, the browser colour is its dark page's (Klassisch ignores it). */
|
|
65
|
+
declare function setImmersiveThemeColor(on: boolean): void;
|
|
66
|
+
/** Set what the host adds (floating surfaces, its Klassisch browser colour); applies again on the next call. */
|
|
67
|
+
declare function setAppearanceHost(next: AppearanceHost): void;
|
|
68
|
+
/** Apply theme + style to <html>. */
|
|
69
|
+
declare function applyAppearance(a: AppearanceInput, env?: MediaEnv): void;
|
|
70
|
+
/**
|
|
71
|
+
* Re-applies on OS changes — colour scheme (only in "auto"), more contrast and reduced transparency (only in Glas).
|
|
72
|
+
* Pass a getter so the latest settings are read. Returns a cleanup function; replaces `watchSystemMode`.
|
|
73
|
+
*/
|
|
74
|
+
declare function watchAppearance(get: () => AppearanceInput): () => void;
|
|
75
|
+
|
|
76
|
+
export { type AppearanceHost, type AppearanceInput, CLASSIC_STYLE, DARK_SCOPE_ID, GlasStrength, type MediaEnv, type StyleFields, UiStyle, applyAppearance, darkScopeCss, effectiveStrength, normalizeGlassStrength, normalizeUiStyle, readMediaEnv, setAppearanceHost, setImmersiveThemeColor, styleFields, watchAppearance };
|