@sentinel-nvr/web 0.16.0 → 0.16.1

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.
@@ -1,4 +1,4 @@
1
- export { P as PipResult, a as PlayerController, b as PlayerLabel, c as PlayerOptions, d as PlayerRefs, e as PlayerState } from '../controller-BJvKiDMZ.js';
1
+ export { P as PipResult, a as PlayerController, b as PlayerLabel, c as PlayerOptions, d as PlayerRefs, e as PlayerState } from '../controller-D8rAubW4.js';
2
2
  import { g as SentinelClient } from '../client-DS5wDfMN.js';
3
3
 
4
4
  /** Recorded playback runs ~17 s behind real time (fragment flush + relay); a forward jump closer to "now" than this has no
@@ -10,6 +10,39 @@ declare const SKIP_LIVE_EDGE_MS = 20000;
10
10
  */
11
11
  declare function skipTarget(live: boolean, currentTs: number | null | undefined, ms: number, now: number): number | 'live' | null;
12
12
 
13
+ /** "At the target": the servo stops within ±1.5 s of it (SERVO_DONE_MS), leaving key mode re-enters the nearest keyframe
14
+ * (± half a 4-s GOP), then it plays on at 1× until two polls have shown that. */
15
+ declare const SETTLE_NEAR_MS = 5000;
16
+ /** "Normal speed" between the last two polls (poll jitter, keyframe re-entry). */
17
+ declare const SETTLE_V_MIN = 0.5;
18
+ declare const SETTLE_V_MAX = 2;
19
+ /** Give up when the distance has not shrunk by SETTLE_PROGRESS_MS for this long (no footage at the target, polls stuck,
20
+ * server lost the target). */
21
+ declare const SETTLE_STALL_MS = 3000;
22
+ declare const SETTLE_PROGRESS_MS = 1000;
23
+ /** Hard cap, however slowly the picture still approaches. */
24
+ declare const SETTLE_CAP_MS = 30000;
25
+ interface SettleTrack {
26
+ t0: number;
27
+ best: number;
28
+ bestAt: number;
29
+ }
30
+ /** One relay-pos poll: picture on screen, when it was received, the server's current rate (null = not reported), and the
31
+ * poll before it (same command generation) for the speed. */
32
+ interface SettleSample {
33
+ pos: number;
34
+ at: number;
35
+ r: number | null;
36
+ prev: {
37
+ pos: number;
38
+ at: number;
39
+ } | null;
40
+ }
41
+ type SettleState = 'arrived' | 'wait' | 'giveup';
42
+ declare function settleStart(pos: number, target: number, now: number): SettleTrack;
43
+ /** One check against the gesture's final target. Updates `s`. */
44
+ declare function settleStep(s: SettleTrack, x: SettleSample, target: number, now: number): SettleState;
45
+
13
46
  /**
14
47
  * WebRTC session over the plugin's WebSocket signaling (docs/API.md §6).
15
48
  * Battle-tested flow: options first, createLocalDescription/setRemoteDescription
@@ -64,4 +97,4 @@ declare class WebRtcSession {
64
97
  declare function setRlogClient(c: SentinelClient | null, b?: string): void;
65
98
  declare function rlog(tag: string, data?: Record<string, unknown>): void;
66
99
 
67
- export { SKIP_LIVE_EDGE_MS, type SessionCallbacks, type SessionOptions, WebRtcSession, mobileClient, rlog, setRlogClient, skipTarget };
100
+ export { SETTLE_CAP_MS, SETTLE_NEAR_MS, SETTLE_PROGRESS_MS, SETTLE_STALL_MS, SETTLE_V_MAX, SETTLE_V_MIN, SKIP_LIVE_EDGE_MS, type SessionCallbacks, type SessionOptions, type SettleSample, type SettleState, type SettleTrack, WebRtcSession, mobileClient, rlog, setRlogClient, settleStart, settleStep, skipTarget };
@@ -1,20 +1,36 @@
1
1
  import {
2
2
  PlayerController,
3
+ SETTLE_CAP_MS,
4
+ SETTLE_NEAR_MS,
5
+ SETTLE_PROGRESS_MS,
6
+ SETTLE_STALL_MS,
7
+ SETTLE_V_MAX,
8
+ SETTLE_V_MIN,
3
9
  SKIP_LIVE_EDGE_MS,
4
10
  WebRtcSession,
5
11
  mobileClient,
6
12
  rlog,
7
13
  setRlogClient,
14
+ settleStart,
15
+ settleStep,
8
16
  skipTarget
9
- } from "../chunk-XOLSBEY5.js";
17
+ } from "../chunk-JRYP7MG6.js";
10
18
  import "../chunk-Y4WFO6G3.js";
11
19
  export {
12
20
  PlayerController,
21
+ SETTLE_CAP_MS,
22
+ SETTLE_NEAR_MS,
23
+ SETTLE_PROGRESS_MS,
24
+ SETTLE_STALL_MS,
25
+ SETTLE_V_MAX,
26
+ SETTLE_V_MIN,
13
27
  SKIP_LIVE_EDGE_MS,
14
28
  WebRtcSession,
15
29
  mobileClient,
16
30
  rlog,
17
31
  setRlogClient,
32
+ settleStart,
33
+ settleStep,
18
34
  skipTarget
19
35
  };
20
36
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { g as SentinelClient, l as SentinelEventClass, n as SentinelRecentEvent, f as SentinelCamera, j as SentinelEvent, q as SentinelStats, h as SentinelClip } from '../client-DS5wDfMN.js';
4
- import { e as PlayerState } from '../controller-BJvKiDMZ.js';
4
+ import { e as PlayerState } from '../controller-D8rAubW4.js';
5
5
 
6
6
  /**
7
7
  * Minimal translation core with the same dictionary semantics as HAPulse:
@@ -267,7 +267,8 @@ interface ScrubHandlers {
267
267
  * drift becomes a seek — every seek shows ~2.4 s of stale stream before the new picture, so step-wise wheel scrolling
268
268
  * with a seek per step made the picture run back and forth (user 23.09.) */
269
269
  hold: (centerTs: number) => void;
270
- /** gesture settled → back to auto-follow; the player lands exactly on centerTs if it drifted */
270
+ /** gesture settled (700 ms quiet): centerTs is the final target; auto-follow resumes once `following()` is true again —
271
+ * on the relay only when the picture plays at the target (PlayerController.scrubSettling) */
271
272
  idle: (centerTs: number) => void;
272
273
  }
273
274
  interface TimelineProps {
@@ -298,9 +299,9 @@ interface TimelineProps {
298
299
  * FIXED centre line is the playhead; the content scrolls natively and simply
299
300
  * continues across midnight (day separators in the axis). Recording band,
300
301
  * motion stretches, class-coloured event markers with thumbnails, LIVE line.
301
- * Scrolling = scrub time-lapse (server-side rate from the scroll velocity): a
302
- * brief hold preview-seeks, the release lands on the centre at 1×, 700 ms of
303
- * silence hands control back to auto-follow. Only the visible window is
302
+ * Scrolling = scrub time-lapse (the server steers onto the centre): 700 ms of
303
+ * silence end the gesture, and the view stays parked on the centre until the
304
+ * picture plays there at 1× (then auto-follow). Only the visible window is
304
305
  * rendered (a fortnight of markers would otherwise be thousands of nodes).
305
306
  */
306
307
  declare function VerticalTimeline(p: TimelineProps): react.JSX.Element;
package/dist/ui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PlayerController,
3
3
  rlog
4
- } from "../chunk-XOLSBEY5.js";
4
+ } from "../chunk-JRYP7MG6.js";
5
5
  import {
6
6
  SENTINEL_DAY_MS,
7
7
  SENTINEL_EVENT_CLASSES,
@@ -991,7 +991,7 @@ function StorageCard({ stats }) {
991
991
  }
992
992
 
993
993
  // src/ui/components/VerticalTimeline.tsx
994
- import { useEffect as useEffect2, useMemo, useRef, useState as useState3 } from "react";
994
+ import { useEffect as useEffect2, useLayoutEffect, useMemo, useRef, useState as useState3 } from "react";
995
995
  import { Plus, Minus, ArrowUp } from "lucide-react";
996
996
  import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
997
997
  function VerticalTimeline(p) {
@@ -1036,8 +1036,15 @@ function VerticalTimeline(p) {
1036
1036
  const span = p.rangeEnd - p.rangeStart;
1037
1037
  const yFor = (ts) => PAD + (p.rangeEnd - ts) * px;
1038
1038
  const tsForY = (y) => p.rangeEnd - (y - PAD) / px;
1039
- const centerTs = () => tsForY((scroll.current?.scrollTop || 0) + vh * HEAD);
1039
+ const geo = useRef({ rangeStart: p.rangeStart, rangeEnd: p.rangeEnd, px, vh, PAD });
1040
+ geo.current = { rangeStart: p.rangeStart, rangeEnd: p.rangeEnd, px, vh, PAD };
1041
+ const centerTs = () => {
1042
+ const g = geo.current;
1043
+ if (!(g.px > 0)) return Math.min(Date.now(), g.rangeEnd - 1);
1044
+ return g.rangeEnd - ((scroll.current?.scrollTop || 0) + g.vh * HEAD - g.PAD) / g.px;
1045
+ };
1040
1046
  const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
1047
+ const clampRange = (ts) => clamp(ts, geo.current.rangeStart, geo.current.rangeEnd - 1);
1041
1048
  const setTop = (el, top2, why) => {
1042
1049
  const v = VT.current;
1043
1050
  v.selfAt = Date.now();
@@ -1074,11 +1081,14 @@ function VerticalTimeline(p) {
1074
1081
  scrollCenter(Date.now());
1075
1082
  }, [px]);
1076
1083
  const prevEnd = useRef(p.rangeEnd);
1077
- useEffect2(() => {
1084
+ useLayoutEffect(() => {
1078
1085
  const d = p.rangeEnd - prevEnd.current;
1079
1086
  prevEnd.current = p.rangeEnd;
1080
1087
  const el = scroll.current;
1081
- if (d && el && px) setTop(el, el.scrollTop + d * px, "range");
1088
+ if (d && el && px) {
1089
+ setTop(el, el.scrollTop + d * px, "range");
1090
+ tick((n) => n + 1);
1091
+ }
1082
1092
  }, [p.rangeEnd, px]);
1083
1093
  useEffect2(() => {
1084
1094
  if (p.jump && px) scrollCenter(p.jump.ts, "jump");
@@ -1131,22 +1141,22 @@ function VerticalTimeline(p) {
1131
1141
  const v = VT.current;
1132
1142
  if (Date.now() - v.lastCenterCb < 400) return;
1133
1143
  v.lastCenterCb = Date.now();
1134
- p.onCenter(clamp(centerTs(), p.rangeStart, p.rangeEnd - 1));
1144
+ p.onCenter(clampRange(centerTs()));
1135
1145
  };
1136
1146
  const scrubSeek = (ts) => {
1137
1147
  const v = VT.current;
1138
1148
  v.previewing = true;
1139
- p.scrub.seek(clamp(ts ?? centerTs(), p.rangeStart, p.rangeEnd - 1));
1149
+ p.scrub.seek(clampRange(ts ?? centerTs()));
1140
1150
  };
1141
1151
  const userIdle = () => {
1142
1152
  VT.current.user = 0;
1143
1153
  VT.current.idleAt = Date.now();
1144
- p.scrub.idle(clamp(centerTs(), p.rangeStart, p.rangeEnd - 1));
1154
+ p.scrub.idle(clampRange(centerTs()));
1145
1155
  };
1146
1156
  const scrubHold = () => {
1147
1157
  const v = VT.current;
1148
1158
  v.previewing = true;
1149
- p.scrub.hold(clamp(centerTs(), p.rangeStart, p.rangeEnd - 1));
1159
+ p.scrub.hold(clampRange(centerTs()));
1150
1160
  };
1151
1161
  const markUser = () => {
1152
1162
  const v = VT.current;