@sentinel-nvr/web 0.20.1 → 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 +22 -1
- package/dist/chunk-KUDATN2V.js +324 -0
- package/dist/chunk-KUDATN2V.js.map +1 -0
- package/dist/{chunk-ZQAVFNC2.js → chunk-WMCYC4WL.js} +24 -7
- package/dist/chunk-WMCYC4WL.js.map +1 -0
- package/dist/{controller-Ch_YXh1_.d.ts → controller-CaekZ6RJ.d.ts} +3 -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/player/index.d.ts +1 -1
- package/dist/player/index.js +1 -1
- package/dist/ui/glas.css +1250 -0
- package/dist/ui/index.d.ts +69 -97
- package/dist/ui/index.js +783 -684
- 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/dist/chunk-ZQAVFNC2.js.map +0 -1
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
|
|
|
@@ -40,7 +41,8 @@ on older servers, but only get their full behaviour with the matching plugin ver
|
|
|
40
41
|
| 0.17.x | plugin with `features: ["export"]` (older plugins: no clip button, everything else as 0.16.x) | clip download on the camera page: "Download clip" in the info bar and per event in the list, range as a band on the timeline, edges set over the playhead line, `api/export` → `api/export-status` → `api/export-file` (save, or share up to 100 MB); `SentinelClient.startExport/exportStatus/exportFileUrl/cancelExport`, `SentinelHttpError.code`. |
|
|
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
|
-
| 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. |
|
|
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;AA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AE,QAAQ;AACrC,aAAW,OAAO,OAAO,KAAK,YAAY;AACxC,SAAK,MAAM,YAAY,aAAa,GAAG,GAAG,OAAO,GAAG,CAAC;AACvD,OAAK,aAAa,cAAc,KAAK;AACrC,OAAK,aAAa,aAAa,QAAQ;AACvC,OAAK,MAAM,YAAY,gBAAgB,QAAQ;AAC/C,MAAI,cAAc,QAAW;AAC3B,UAAM,IAAI,eAAe,WAAW,QAAQ;AAC5C,SAAK,MAAM,YAAY,YAAY,EAAE,MAAM;AAC3C,SAAK,MAAM,YAAY,iBAAiB,EAAE,UAAU;AACpD,SAAK,MAAM,YAAY,eAAe,EAAE,QAAQ;AAAA,EAClD;AACA,SAAO;AACT;AAGO,SAAS,gBACd,UACY;AACZ,QAAM,MAAM,QAAQ;AACpB,MAAI,CAAC;AACH,WAAO,MAAM;AAAA,IAEb;AACF,QAAM,KAAK,MAAM;AACf,UAAM,IAAI,SAAS;AACnB,QAAI,EAAE,SAAS,OAAQ,YAAW,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS;AAAA,EAChE;AACA,MAAI,iBAAiB,UAAU,EAAE;AACjC,SAAO,MAAM,IAAI,oBAAoB,UAAU,EAAE;AACnD;","names":[]}
|
|
@@ -394,6 +394,13 @@ function relayPosVerdict(d, fresh, now, seekAt, seekTarget) {
|
|
|
394
394
|
if (d && d.t <= 0) return "dead";
|
|
395
395
|
return "ignore";
|
|
396
396
|
}
|
|
397
|
+
var VIS_RATE_MS = 600;
|
|
398
|
+
function relayPlayhead(pos, at, now, v, rate, target) {
|
|
399
|
+
const dt = now - at;
|
|
400
|
+
const x = v == null ? pos + dt * (rate || 1) : pos + Math.min(dt, VIS_RATE_MS) * v + Math.max(0, dt - VIS_RATE_MS) * (rate || 1);
|
|
401
|
+
if (target == null) return x;
|
|
402
|
+
return Math.min(Math.max(pos, target), Math.max(Math.min(pos, target), x));
|
|
403
|
+
}
|
|
397
404
|
var DEAD_POLLS = 3;
|
|
398
405
|
var RELAY_RETRIES = 2;
|
|
399
406
|
function relayFailure(n) {
|
|
@@ -435,6 +442,9 @@ var PlayerController = class {
|
|
|
435
442
|
rwBase = null;
|
|
436
443
|
rwPosTs = null;
|
|
437
444
|
rwPosAt = 0;
|
|
445
|
+
/** speed of the picture over the next poll interval from relay-pos `v` (null = server without it, or re-anchored
|
|
446
|
+
* locally since) — the playhead interpolates with it; the server's `r` runs up to 0.8 s ahead of the picture */
|
|
447
|
+
rwPosV = null;
|
|
438
448
|
rwRate = 1;
|
|
439
449
|
rwSrate = 1;
|
|
440
450
|
rwScrub = false;
|
|
@@ -822,12 +832,14 @@ var PlayerController = class {
|
|
|
822
832
|
currentTs() {
|
|
823
833
|
if (this.rw?.active) {
|
|
824
834
|
if (this.rwPosTs != null) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
835
|
+
return relayPlayhead(
|
|
836
|
+
this.rwPosTs,
|
|
837
|
+
this.rwPosAt,
|
|
838
|
+
Date.now(),
|
|
839
|
+
this.rwPosV,
|
|
840
|
+
this.rwRate,
|
|
841
|
+
(this.rwScrub || this.scrubMoves > 0) && this.rwLastTarget ? this.rwLastTarget : null
|
|
842
|
+
);
|
|
831
843
|
}
|
|
832
844
|
if (this.rwBase != null && this.v.currentTime > 0)
|
|
833
845
|
return this.rwStartMs + (this.v.currentTime - this.rwBase) * 1e3 * (this.rwRate || 1);
|
|
@@ -1506,6 +1518,7 @@ var PlayerController = class {
|
|
|
1506
1518
|
this.rw = void 0;
|
|
1507
1519
|
this.rwBase = null;
|
|
1508
1520
|
this.rwPosTs = null;
|
|
1521
|
+
this.rwPosV = null;
|
|
1509
1522
|
this.rwPoll = null;
|
|
1510
1523
|
this.rwScrub = false;
|
|
1511
1524
|
this.rwSeekBusy = false;
|
|
@@ -1660,6 +1673,7 @@ var PlayerController = class {
|
|
|
1660
1673
|
this.wdGrace = Date.now() + 5e3;
|
|
1661
1674
|
this.rwPosTs = ts;
|
|
1662
1675
|
this.rwPosAt = Date.now();
|
|
1676
|
+
this.rwPosV = null;
|
|
1663
1677
|
this.setLabel(this.rwScrub ? "scrub" : "loading");
|
|
1664
1678
|
this.rwSeekBusy = true;
|
|
1665
1679
|
this.seekTarget = ts;
|
|
@@ -1713,6 +1727,7 @@ var PlayerController = class {
|
|
|
1713
1727
|
if (c != null) {
|
|
1714
1728
|
this.rwPosTs = c;
|
|
1715
1729
|
this.rwPosAt = Date.now();
|
|
1730
|
+
this.rwPosV = null;
|
|
1716
1731
|
}
|
|
1717
1732
|
if (!this.rwScrub) this.rwRate = r;
|
|
1718
1733
|
this.cmdSeq++;
|
|
@@ -1774,6 +1789,7 @@ var PlayerController = class {
|
|
|
1774
1789
|
if (c != null) {
|
|
1775
1790
|
this.rwPosTs = c;
|
|
1776
1791
|
this.rwPosAt = Date.now();
|
|
1792
|
+
this.rwPosV = null;
|
|
1777
1793
|
}
|
|
1778
1794
|
if (this.label === "scrub") this.setLabel("playing");
|
|
1779
1795
|
}
|
|
@@ -1875,6 +1891,7 @@ var PlayerController = class {
|
|
|
1875
1891
|
this.wdDead = 0;
|
|
1876
1892
|
this.rwPosTs = d.t;
|
|
1877
1893
|
this.rwPosAt = Date.now();
|
|
1894
|
+
this.rwPosV = typeof d.v === "number" && isFinite(d.v) ? d.v : null;
|
|
1878
1895
|
const P = this.rwPoll;
|
|
1879
1896
|
this.rwPoll = {
|
|
1880
1897
|
t: d.t,
|
|
@@ -2662,4 +2679,4 @@ export {
|
|
|
2662
2679
|
settleStep,
|
|
2663
2680
|
PlayerController
|
|
2664
2681
|
};
|
|
2665
|
-
//# sourceMappingURL=chunk-
|
|
2682
|
+
//# sourceMappingURL=chunk-WMCYC4WL.js.map
|