@vitrinka/web 0.5.3 → 0.7.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +145 -20
  3. package/build/hud.iife.js +150 -28
  4. package/build/index.d.ts +1 -0
  5. package/build/protocol/index.d.ts +10 -0
  6. package/build/recorder/RecorderProvider.js +5 -18
  7. package/build/recorder/api.d.ts +20 -0
  8. package/build/recorder/api.js +21 -9
  9. package/build/recorder/capture/console.d.ts +6 -1
  10. package/build/recorder/capture/console.js +28 -5
  11. package/build/recorder/capture/net.d.ts +10 -1
  12. package/build/recorder/capture/net.js +14 -1
  13. package/build/recorder/capture/redact.d.ts +1 -0
  14. package/build/recorder/capture/redact.js +6 -1
  15. package/build/recorder/capture/rrweb-lane.d.ts +19 -0
  16. package/build/recorder/capture/rrweb-lane.js +109 -0
  17. package/build/recorder/capture/rrweb.d.ts +2 -9
  18. package/build/recorder/capture/rrweb.js +11 -86
  19. package/build/recorder/config.d.ts +3 -1
  20. package/build/recorder/config.js +15 -2
  21. package/build/recorder/flight.d.ts +141 -22
  22. package/build/recorder/flight.js +312 -27
  23. package/build/recorder/hud/Hud.js +206 -31
  24. package/build/recorder/hud/NotesSheet.d.ts +24 -0
  25. package/build/recorder/hud/NotesSheet.js +147 -0
  26. package/build/recorder/hud/RecorderPill.d.ts +34 -12
  27. package/build/recorder/hud/RecorderPill.js +52 -14
  28. package/build/recorder/hud/Sheet.d.ts +18 -15
  29. package/build/recorder/hud/Sheet.js +13 -13
  30. package/build/recorder/hud/controller.d.ts +81 -4
  31. package/build/recorder/hud/drop.d.ts +26 -0
  32. package/build/recorder/hud/drop.js +35 -0
  33. package/build/recorder/hud/host-style.d.ts +14 -0
  34. package/build/recorder/hud/host-style.js +15 -0
  35. package/build/recorder/hud/host.js +1 -1
  36. package/build/recorder/hud/icons.d.ts +6 -0
  37. package/build/recorder/hud/icons.js +12 -0
  38. package/build/recorder/hud/notes-rows.d.ts +39 -0
  39. package/build/recorder/hud/notes-rows.js +49 -0
  40. package/build/recorder/hud/resize.d.ts +6 -3
  41. package/build/recorder/hud/resize.js +8 -4
  42. package/build/recorder/hud/styles.d.ts +2 -30
  43. package/build/recorder/hud/styles.js +63 -31
  44. package/build/recorder/page-controller.js +13 -7
  45. package/build/recorder/queue.d.ts +22 -1
  46. package/build/recorder/queue.js +84 -5
  47. package/build/recorder/recents.d.ts +20 -4
  48. package/build/recorder/recents.js +41 -6
  49. package/build/recorder/session.d.ts +25 -6
  50. package/build/recorder/session.js +50 -8
  51. package/build/recorder/state.d.ts +18 -1
  52. package/build/recorder/state.js +40 -1
  53. package/build/recorder/storage/capture.d.ts +44 -0
  54. package/build/recorder/storage/capture.js +136 -0
  55. package/build/recorder/version.d.ts +2 -2
  56. package/build/recorder/version.js +1 -1
  57. package/build/report/bundle.d.ts +4 -0
  58. package/build/report/bundle.js +30 -0
  59. package/build/report/element.d.ts +86 -0
  60. package/build/report/element.js +146 -0
  61. package/build/report/engine.d.ts +144 -0
  62. package/build/report/engine.js +402 -0
  63. package/build/report/i18n.d.ts +78 -0
  64. package/build/report/i18n.js +151 -0
  65. package/build/report/identity.d.ts +26 -0
  66. package/build/report/identity.js +36 -0
  67. package/build/report/index.d.ts +12 -0
  68. package/build/report/index.js +15 -0
  69. package/build/report/keybind.d.ts +29 -0
  70. package/build/report/keybind.js +99 -0
  71. package/build/report/markers.d.ts +77 -0
  72. package/build/report/markers.js +162 -0
  73. package/build/report/profile.d.ts +62 -0
  74. package/build/report/profile.js +115 -0
  75. package/build/report/recorder-face.d.ts +2 -0
  76. package/build/report/recorder-face.js +20 -0
  77. package/build/report/styles.d.ts +7 -0
  78. package/build/report/styles.js +226 -0
  79. package/build/report/widget.d.ts +109 -0
  80. package/build/report/widget.js +907 -0
  81. package/build/report/wire.d.ts +68 -0
  82. package/build/report/wire.js +96 -0
  83. package/build/report-widget.mjs +229 -0
  84. package/package.json +11 -4
@@ -2,35 +2,48 @@
2
2
  * The HUD's face: ONE glass pill whose faces are collapsible segments, so a
3
3
  * change of face tweens the pill's size instead of swapping boxes.
4
4
  *
5
- * - Idle: a puck — a hollow ring before the device is linked, a muted dot
6
- * once it is — whose label (and the ⋯ menu button) slide out on intent.
5
+ * - Idle: a puck — a hollow ring before the device is linked, a red record
6
+ * dot once it is — whose label (and the ⋯ menu button) slide out on intent;
7
+ * "Starting…" while a Start boots (HUD polish D3/D11).
7
8
  * - Recording: the handle (rec dot + clock) that unfolds into the tray
8
- * (sync chip · ⏸ ✎ ⌖ ■ ⋯) on hover, focus or tap and folds back ~2.5s
9
- * after the pointer and focus leave. On the middle row it stands up into a
10
- * vertical pill (a measured morph, see useMorph).
9
+ * (⏸ ✎ ⌖ ■ ⋯) on hover, focus or tap and folds back ~2.5s after the
10
+ * pointer and focus leave. The dot's ring is the sync state; the counts
11
+ * float above while the tray is open (`Stats`, D4). On the middle row it
12
+ * stands up into a vertical pill (a measured morph, see useMorph).
11
13
  * - Flows (flow.ts): the pill itself asks "Stop & save?" / "Unlink this
12
- * device?", spins while saving, says "Saved · Open board" until dismissed,
13
- * or says why it could not save (a bug report: "Sending…", "Sent",
14
- * "Couldn't send"). Always horizontal.
14
+ * device?", spins while saving, then follows the board's build — "Building
15
+ * board · 3/5", "Board ready · Open board", "Board build failed · Retry" —
16
+ * until Done (D1/D2), or says why it could not save (a bug report:
17
+ * "Sending…", "Sent", "Couldn't send"). Always horizontal.
18
+ * - Remote: the recording runs in another tab — a quiet "in another tab".
15
19
  * - Tucked: a 6px edge tab.
16
20
  * The handle, the puck and the tab are the drag handles. Tooltips are
17
21
  * `data-tip` / `data-keys` on the triggers (Tooltip.tsx paints them).
18
22
  */
19
23
  import { type ReactElement, type RefObject } from 'react';
20
- import type { HudSnapshot } from './controller';
24
+ import type { HudSnapshot, HudSync } from './controller';
21
25
  import type { Flow } from './flow';
22
26
  import { type Place } from './spots';
23
27
  import type { DockHandle } from './useDock';
24
28
  export declare const MOD: string;
25
- export type Face = 'tab' | 'idle' | 'rec' | 'flow';
29
+ export type Face = 'tab' | 'idle' | 'rec' | 'flow' | 'remote';
30
+ /** What the clock says after a note: `queued` until the server has it, then `saved`. */
31
+ export type Flash = 'queued' | 'saved' | null;
26
32
  /** Which face the pill shows. A flow wins over the recording it belongs to. */
27
33
  export declare function faceOf(snap: HudSnapshot, flow: Flow, place: Place): Face;
34
+ /** A note's client id (D6/D7): random, names the note and nothing else. */
35
+ export declare function newCid(): string;
36
+ /** The details float's default face (D4): what reached vitrinka, by kind. */
37
+ export declare function Stats({ sync, now }: {
38
+ sync: HudSync;
39
+ now: number;
40
+ }): ReactElement;
28
41
  export interface RecorderPillProps {
29
42
  snap: HudSnapshot;
30
43
  now: number;
31
44
  flow: Flow;
32
- /** A note or annotation was just accepted: the clock briefly says so. */
33
- flash: boolean;
45
+ /** A note or annotation was just sent: the clock says `queued`, then briefly `Saved`. */
46
+ flash: Flash;
34
47
  composing: boolean;
35
48
  starting: boolean;
36
49
  menuOpen: boolean;
@@ -51,5 +64,14 @@ export interface RecorderPillProps {
51
64
  onCancel: () => void;
52
65
  onRetry: () => void;
53
66
  onDismiss: () => void;
67
+ /** Build the saved session's board again (a retryable failed build). */
68
+ onRetryBuild: (sessionId: string) => void;
69
+ /** The host implements `retryBuild`: only then does a failed build offer Retry. */
70
+ canRetryBuild: boolean;
71
+ /** The recording's tray unfolded or folded: the stats float follows it. */
72
+ onTrayOpen: (open: boolean) => void;
73
+ /** This recording's notes so far (the tray's notes button counts them, D5); absent = the host lists none. */
74
+ notesCount?: number;
75
+ onNotes: () => void;
54
76
  }
55
77
  export declare function RecorderPill(p: RecorderPillProps): ReactElement;
@@ -1,25 +1,29 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /**
3
3
  * The HUD's face: ONE glass pill whose faces are collapsible segments, so a
4
4
  * change of face tweens the pill's size instead of swapping boxes.
5
5
  *
6
- * - Idle: a puck — a hollow ring before the device is linked, a muted dot
7
- * once it is — whose label (and the ⋯ menu button) slide out on intent.
6
+ * - Idle: a puck — a hollow ring before the device is linked, a red record
7
+ * dot once it is — whose label (and the ⋯ menu button) slide out on intent;
8
+ * "Starting…" while a Start boots (HUD polish D3/D11).
8
9
  * - Recording: the handle (rec dot + clock) that unfolds into the tray
9
- * (sync chip · ⏸ ✎ ⌖ ■ ⋯) on hover, focus or tap and folds back ~2.5s
10
- * after the pointer and focus leave. On the middle row it stands up into a
11
- * vertical pill (a measured morph, see useMorph).
10
+ * (⏸ ✎ ⌖ ■ ⋯) on hover, focus or tap and folds back ~2.5s after the
11
+ * pointer and focus leave. The dot's ring is the sync state; the counts
12
+ * float above while the tray is open (`Stats`, D4). On the middle row it
13
+ * stands up into a vertical pill (a measured morph, see useMorph).
12
14
  * - Flows (flow.ts): the pill itself asks "Stop & save?" / "Unlink this
13
- * device?", spins while saving, says "Saved · Open board" until dismissed,
14
- * or says why it could not save (a bug report: "Sending…", "Sent",
15
- * "Couldn't send"). Always horizontal.
15
+ * device?", spins while saving, then follows the board's build — "Building
16
+ * board · 3/5", "Board ready · Open board", "Board build failed · Retry" —
17
+ * until Done (D1/D2), or says why it could not save (a bug report:
18
+ * "Sending…", "Sent", "Couldn't send"). Always horizontal.
19
+ * - Remote: the recording runs in another tab — a quiet "in another tab".
16
20
  * - Tucked: a 6px edge tab.
17
21
  * The handle, the puck and the tab are the drag handles. Tooltips are
18
22
  * `data-tip` / `data-keys` on the triggers (Tooltip.tsx paints them).
19
23
  */
20
24
  import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from 'react';
21
25
  import { saveProgress } from './flow';
22
- import { AlertIcon, AnnotateIcon, CheckIcon, CloseIcon, CircleCheckIcon, CloudOffIcon, MoreIcon, NewTabIcon, PauseIcon, PencilIcon, PlayIcon, SpinnerIcon, StopIcon, ArrowUpIcon, } from './icons';
26
+ import { AlertIcon, AnnotateIcon, CheckIcon, CloseIcon, CircleCheckIcon, CloudOffIcon, LayersIcon, ListIcon, MoreIcon, NewTabIcon, PauseIcon, PencilIcon, PlayIcon, SpinnerIcon, StopIcon, ArrowUpIcon, } from './icons';
23
27
  import { isVertical, untuck } from './spots';
24
28
  import { elapsedOf, fmtClock, syncChip } from './status';
25
29
  export const MOD = /Mac|iPhone|iPad/.test(globalThis.navigator?.platform ?? '') ? '⌥⇧' : 'Alt⇧';
@@ -35,8 +39,27 @@ export function faceOf(snap, flow, place) {
35
39
  return 'tab';
36
40
  if (flow.face !== 'none')
37
41
  return 'flow';
42
+ if (snap.following && snap.followingElsewhere)
43
+ return 'remote';
38
44
  return snap.recording ? 'rec' : 'idle';
39
45
  }
46
+ /** A note's client id (D6/D7): random, names the note and nothing else. */
47
+ export function newCid() {
48
+ const c = globalThis.crypto;
49
+ if (typeof c?.randomUUID === 'function')
50
+ return c.randomUUID();
51
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
52
+ }
53
+ /** The sync state and counts as one sentence — the handle's description (D4). */
54
+ function syncSentence(chip, a) {
55
+ return a ? `${chip.title} · ${a.actions} actions · ${a.frames} frames · ${a.notes} notes · ${a.pages} pages` : chip.title;
56
+ }
57
+ /** The details float's default face (D4): what reached vitrinka, by kind. */
58
+ export function Stats({ sync, now }) {
59
+ const chip = syncChip(sync, now);
60
+ const a = sync.acked;
61
+ return (_jsxs("span", { className: "stats", "data-e2e": "sync-chip", "data-kind": chip.kind, children: [_jsxs("span", { className: "s-head", children: [_jsx(SyncGlyph, { chip: chip }), chip.kind === 'synced' ? 'on vitrinka' : chip.label] }), a ? (_jsxs(_Fragment, { children: [_jsx("i", {}), _jsxs("span", { children: [_jsx("b", { children: a.actions }), " actions"] }), _jsxs("span", { children: [_jsx("b", { children: a.frames }), " frames"] }), _jsxs("span", { children: [_jsx("b", { children: a.notes }), " notes"] }), _jsxs("span", { children: [_jsx("b", { children: a.pages }), " pages"] })] })) : null] }));
62
+ }
40
63
  function reducedMotion() {
41
64
  return globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
42
65
  }
@@ -184,6 +207,9 @@ export function RecorderPill(p) {
184
207
  foldIn(FOLD_MS);
185
208
  }, [hold, open, cancelFold, foldIn]);
186
209
  const unfolded = open || (hold && face !== 'flow');
210
+ const trayShown = unfolded && face === 'rec';
211
+ const { onTrayOpen } = p;
212
+ useEffect(() => onTrayOpen(trayShown), [trayShown, onTrayOpen]);
187
213
  // Hover is read with NATIVE pointerenter/leave: React synthesises enter
188
214
  // from over/out pairs and drops an `over` whose related target belongs to
189
215
  // any React root — on a React page the pointer always arrives from the
@@ -258,7 +284,7 @@ export function RecorderPill(p) {
258
284
  const bad = live === 'offline' || live === 'error';
259
285
  const state = bad ? 'bad' : !rec || rec.paused || rec.dead ? 'paused' : 'rec';
260
286
  const unlinked = !p.snap.linked;
261
- const puckLabel = unlinked ? 'Link recorder' : 'Start recording';
287
+ const puckLabel = unlinked ? 'Link recorder' : p.starting ? 'Starting…' : 'Start recording';
262
288
  const confirming = p.flow.face === 'confirm';
263
289
  const dataFace = face === 'flow' && confirming && rec ? 'flow-rec' : face;
264
290
  const progress = saveProgress(p.flow, rec?.sync.queued ?? 0);
@@ -309,11 +335,23 @@ export function RecorderPill(p) {
309
335
  const savedUrl = shownFlow.face === 'saved'
310
336
  ? (shownFlow.boardUrl ?? p.snap.recents.find((r) => r.sessionId === shownFlow.sessionId)?.boardUrl)
311
337
  : undefined;
338
+ // The board's build after a stop (D1): building → ready, or a failure the tester can retry.
339
+ const savedSession = shownFlow.face === 'saved' ? shownFlow.sessionId : undefined;
340
+ const proj = savedSession ? p.snap.recents.find((r) => r.sessionId === savedSession)?.projection : undefined;
341
+ const build = savedUrl
342
+ ? 'ready'
343
+ : proj?.state === 'failed'
344
+ ? 'failed'
345
+ : proj?.state === 'empty'
346
+ ? 'empty'
347
+ : 'building';
348
+ const buildTotal = proj?.total ?? 0;
349
+ const buildProgress = buildTotal > 0 ? Math.min(1, Math.max(0, (proj?.done ?? 0) / buildTotal)) : null;
312
350
  const failure = shownFlow.face === 'failed' ? shownFlow.message : '';
313
351
  // A bug report's send: "Sending…", "Sent", "Couldn't send" — and it can always be retried.
314
352
  const report = 'report' in shownFlow && shownFlow.report === true;
315
353
  const startFailed = shownFlow.face === 'failed' && shownFlow.start === true;
316
- return (_jsxs("div", { ref: p.pillRef, className: "pill glass", "data-e2e": "recorder-pill", "data-face": dataFace, "data-orient": orient, "data-state": state, "data-open": unfolded && face !== 'flow' ? '' : undefined, onPointerDown: onTouch, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKey, children: [_jsx(Seg, { on: face === 'idle', className: "s-idle", children: _jsxs("button", { ref: puckRef, type: "button", className: "puck", "data-state": unlinked ? 'unlinked' : p.starting ? 'busy' : 'ready', "aria-label": puckLabel, onClick: unlinked ? p.onLink : p.onStart, disabled: p.starting, ...p.handle, children: [_jsx("span", { className: "ring" }), _jsx("span", { className: "lab", "aria-hidden": "true", children: _jsx("span", { children: puckLabel }) })] }) }), _jsx(Seg, { on: face === 'idle' && unfolded, className: "s-more", children: _jsx("button", { type: "button", className: "tb b-more", "aria-label": "More", "aria-haspopup": "menu", "aria-expanded": p.menuOpen, "data-tip": "Recents \u00B7 settings", onClick: (e) => p.onMenu(e.detail === 0), onKeyDown: onMoreKey, children: _jsx(MoreIcon, {}) }) }), _jsx(Seg, { on: face === 'rec' || (confirming && rec !== null), className: "s-handle", children: _jsxs("button", { type: "button", className: "handle", "aria-label": "Recorder controls", "aria-expanded": unfolded && face === 'rec', onClick: toggle, ...p.handle, children: [_jsx("span", { className: "dot" }), _jsxs("span", { className: "clock", children: [_jsx(Seg, { on: !p.flash, className: "c-time", children: _jsx("span", { className: "time", children: shownRec ? fmtClock(elapsedOf(shownRec, p.now)) : '00:00' }) }), _jsx(Seg, { on: p.flash, className: "c-flash", children: _jsxs("span", { className: "flash", "data-e2e": "saved-flash", children: [_jsx(CheckIcon, {}), _jsx("span", { children: "Saved" })] }) })] })] }) }), _jsx(Seg, { on: face === 'rec' && unfolded, className: "s-tray", children: _jsxs("div", { className: "tools seg-row", children: [_jsx("span", { className: "sep" }), chip ? (_jsxs("span", { className: "sync", "data-kind": chip.kind, "data-tip": chip.title, role: "status", "aria-label": chip.title, "data-e2e": "sync-chip", children: [_jsx("span", { className: "swap", children: _jsx(SyncGlyph, { chip: chip }) }, `glyph-${chip.kind}`), _jsx("span", { className: "word swap", children: chip.label }, `word-${chip.label}`)] })) : null, _jsx("button", { type: "button", className: "tb b-pause", "aria-label": shownRec?.paused ? 'Resume' : 'Pause', "aria-keyshortcuts": "Alt+Shift+P", "data-tip": shownRec?.paused ? 'Resume' : 'Pause', "data-keys": `${MOD}P`, onClick: p.onPause, children: shownRec?.paused ? _jsx(PlayIcon, {}) : _jsx(PauseIcon, {}) }), _jsx("button", { type: "button", className: "tb b-note", "aria-label": "Note", "aria-keyshortcuts": "Alt+Shift+N", "data-tip": "Note", "data-keys": `${MOD}N`, onClick: p.onNote, children: _jsx(PencilIcon, {}) }), _jsx("button", { type: "button", className: annotating ? 'tb b-annotate on' : 'tb b-annotate', "aria-label": "Annotate", "aria-pressed": annotating, "aria-keyshortcuts": "Alt+Shift+A", "data-tip": "Annotate", "data-keys": `${MOD}A`, onClick: p.onAnnotate, children: _jsx(AnnotateIcon, {}) }), _jsx("button", { ref: stopRef, type: "button", className: "tb b-stop", "aria-label": "Stop", "aria-keyshortcuts": "Alt+Shift+S", "data-tip": "Stop & save", "data-keys": `${MOD}S`, onClick: p.onAskStop, children: _jsx(StopIcon, {}) }), _jsx("button", { type: "button", className: "tb b-more", "aria-label": "More", "aria-haspopup": "menu", "aria-expanded": p.menuOpen, "data-tip": "More", onClick: (e) => p.onMenu(e.detail === 0), onKeyDown: onMoreKey, children: _jsx(MoreIcon, {}) })] }) }), _jsx(Seg, { on: p.flow.face === 'confirm', className: "s-confirm", children: _jsxs("div", { className: "flow confirm", role: "group", "aria-label": confirmAction === 'stop' ? 'Stop and save' : 'Unlink', children: [_jsx("span", { className: "q", children: confirmAction === 'stop' ? 'Stop & save?' : 'Unlink this device?' }), _jsx("button", { type: "button", className: "fb primary", onClick: p.onConfirm, children: confirmAction === 'stop' ? 'Stop' : 'Unlink' }), _jsx("button", { ref: keepRef, type: "button", className: "fb", onClick: p.onCancel, children: confirmAction === 'stop' ? 'Keep recording' : 'Cancel' })] }) }), _jsx(Seg, { on: p.flow.face === 'saving', className: "s-saving", children: _jsxs("div", { className: "flow saving", role: "status", "data-e2e": "saving", children: [_jsx(SpinnerIcon, {}), _jsx("span", { children: report ? 'Sending…' : 'Saving…' }), progress !== null && rec ? _jsxs("span", { className: "muted", children: [rec.sync.queued, " left"] }) : null, _jsx("span", { className: "bar-track", "data-indeterminate": progress === null ? '' : undefined, role: "progressbar", "aria-label": report ? 'Sending' : 'Saving', "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": progress === null ? undefined : Math.round(progress * 100), style: { '--p': String(progress ?? 0) }, children: _jsx("i", {}) })] }) }), _jsx(Seg, { on: p.flow.face === 'saved', className: "s-saved", children: _jsxs("div", { className: "flow saved", "data-e2e": "saved", children: [_jsx("span", { className: "ok t-check", "data-state": flowShown === 'saved' ? 'in' : undefined, children: _jsx(CheckIcon, {}) }), _jsx("span", { children: report ? 'Sent' : 'Saved' }), savedUrl ? (_jsxs("a", { ref: (el) => {
317
- savedRef.current = el;
318
- }, className: "fb", href: savedUrl, target: "_blank", rel: "noopener noreferrer", children: ["Open board ", _jsx(NewTabIcon, {})] })) : (_jsx("span", { className: "muted", children: "in Recents" })), _jsx("button", { ref: savedUrl ? undefined : (el) => void (savedRef.current = el), type: "button", className: "fb icon", "aria-label": "Dismiss", onClick: p.onDismiss, children: _jsx(CloseIcon, {}) })] }) }), _jsx(Seg, { on: p.flow.face === 'failed', className: "s-failed", children: _jsxs("div", { className: "flow failed", role: "alert", "data-tip": failure, children: [_jsx("span", { className: "warn", children: _jsx(AlertIcon, {}) }), _jsx("span", { className: "msg", children: shortFailure(failure, report, startFailed) }), _jsx("span", { className: "sr", children: failure }), (rec || report) && !startFailed ? (_jsx("button", { type: "button", className: "fb", onClick: p.onRetry, children: "Retry" })) : null, _jsx("button", { type: "button", className: "fb icon", "aria-label": "Dismiss", onClick: p.onDismiss, children: _jsx(CloseIcon, {}) })] }) })] }));
354
+ return (_jsxs("div", { ref: p.pillRef, className: "pill glass", "data-e2e": "recorder-pill", "data-face": dataFace, "data-orient": orient, "data-state": state, "data-open": (unfolded || p.starting) && face !== 'flow' ? '' : undefined, onPointerDown: onTouch, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKey, children: [_jsx(Seg, { on: face === 'idle', className: "s-idle", children: _jsxs("button", { ref: puckRef, type: "button", className: "puck", "data-state": unlinked ? 'unlinked' : p.starting ? 'busy' : 'ready', "aria-label": puckLabel, onClick: unlinked ? p.onLink : p.onStart, disabled: p.starting, ...p.handle, children: [_jsx("span", { className: "ring" }), _jsx("span", { className: "lab", "aria-hidden": "true", children: _jsx("span", { children: puckLabel }) })] }) }), _jsx(Seg, { on: face === 'idle' && unfolded, className: "s-more", children: _jsx("button", { type: "button", className: "tb b-more", "aria-label": "More", "aria-haspopup": "menu", "aria-expanded": p.menuOpen, "data-tip": "Recents \u00B7 settings", onClick: (e) => p.onMenu(e.detail === 0), onKeyDown: onMoreKey, children: _jsx(MoreIcon, {}) }) }), _jsxs(Seg, { on: face === 'rec' || (confirming && rec !== null), className: "s-handle", children: [_jsx("span", { id: "vt-sync-desc", className: "sr", children: chip ? syncSentence(chip, shownRec?.sync.acked) : '' }), _jsxs("button", { type: "button", className: "handle", "aria-label": "Recorder controls", "aria-describedby": "vt-sync-desc", "aria-expanded": unfolded && face === 'rec', onClick: toggle, ...p.handle, children: [_jsx("span", { className: "dot", "data-sync": chip?.kind }), _jsxs("span", { className: "clock", children: [_jsx(Seg, { on: p.flash === null, className: "c-time", children: _jsx("span", { className: "time", children: shownRec ? fmtClock(elapsedOf(shownRec, p.now)) : '00:00' }) }), _jsx(Seg, { on: p.flash !== null, className: "c-flash", children: _jsxs("span", { className: "flash", "data-e2e": "saved-flash", "data-word": p.flash ?? 'saved', children: [p.flash === 'queued' ? _jsx(ArrowUpIcon, {}) : _jsx(CheckIcon, {}), _jsx("span", { children: p.flash === 'queued' ? 'queued' : 'Saved' })] }) })] })] })] }), _jsx(Seg, { on: face === 'rec' && unfolded, className: "s-tray", children: _jsxs("div", { className: "tools seg-row", children: [_jsx("span", { className: "sep" }), p.notesCount !== undefined ? (_jsxs("button", { type: "button", className: "tb b-notes", "aria-label": `History · ${p.notesCount}`, "data-tip": "History", onClick: p.onNotes, children: [_jsx(ListIcon, {}), p.notesCount > 0 ? _jsx("span", { className: "cnt", children: p.notesCount }) : null] })) : null, _jsx("button", { type: "button", className: "tb b-pause", "aria-label": shownRec?.paused ? 'Resume' : 'Pause', "aria-keyshortcuts": "Alt+Shift+P", "data-tip": shownRec?.paused ? 'Resume' : 'Pause', "data-keys": `${MOD}P`, onClick: p.onPause, children: shownRec?.paused ? _jsx(PlayIcon, {}) : _jsx(PauseIcon, {}) }), _jsx("button", { type: "button", className: "tb b-note", "aria-label": "Note", "aria-keyshortcuts": "Alt+Shift+N", "data-tip": "Note", "data-keys": `${MOD}N`, onClick: p.onNote, children: _jsx(PencilIcon, {}) }), _jsx("button", { type: "button", className: annotating ? 'tb b-annotate on' : 'tb b-annotate', "aria-label": "Annotate", "aria-pressed": annotating, "aria-keyshortcuts": "Alt+Shift+A", "data-tip": "Annotate", "data-keys": `${MOD}A`, onClick: p.onAnnotate, children: _jsx(AnnotateIcon, {}) }), _jsx("button", { ref: stopRef, type: "button", className: "tb b-stop", "aria-label": "Stop", "aria-keyshortcuts": "Alt+Shift+S", "data-tip": "Stop & save", "data-keys": `${MOD}S`, onClick: p.onAskStop, children: _jsx(StopIcon, {}) }), _jsx("button", { type: "button", className: "tb b-more", "aria-label": "More", "aria-haspopup": "menu", "aria-expanded": p.menuOpen, "data-tip": "More", onClick: (e) => p.onMenu(e.detail === 0), onKeyDown: onMoreKey, children: _jsx(MoreIcon, {}) })] }) }), _jsx(Seg, { on: p.flow.face === 'confirm', className: "s-confirm", children: _jsxs("div", { className: "flow confirm", role: "group", "aria-label": confirmAction === 'stop' ? 'Stop and save' : 'Unlink', children: [_jsx("span", { className: "q", children: confirmAction === 'stop' ? 'Stop & save?' : 'Unlink this device?' }), _jsx("button", { type: "button", className: "fb primary", onClick: p.onConfirm, children: confirmAction === 'stop' ? 'Stop' : 'Unlink' }), _jsx("button", { ref: keepRef, type: "button", className: "fb", onClick: p.onCancel, children: confirmAction === 'stop' ? 'Keep recording' : 'Cancel' })] }) }), _jsx(Seg, { on: p.flow.face === 'saving', className: "s-saving", children: _jsxs("div", { className: "flow saving", role: "status", "data-e2e": "saving", children: [_jsx(SpinnerIcon, {}), _jsx("span", { children: report ? 'Sending…' : 'Saving…' }), progress !== null && rec ? _jsxs("span", { className: "muted", children: [rec.sync.queued, " left"] }) : null, _jsx("span", { className: "bar-track", "data-indeterminate": progress === null ? '' : undefined, role: "progressbar", "aria-label": report ? 'Sending' : 'Saving', "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": progress === null ? undefined : Math.round(progress * 100), style: { '--p': String(progress ?? 0) }, children: _jsx("i", {}) })] }) }), _jsx(Seg, { on: p.flow.face === 'saved', className: "s-saved", children: _jsxs("div", { className: "flow saved", "data-e2e": "saved", "data-build": build, children: [build === 'building' ? (_jsxs(_Fragment, { children: [_jsx(LayersIcon, {}), _jsx("span", { children: report ? 'Sent · building board' : 'Building board' }), proj?.step ? _jsx("span", { className: "muted step", children: proj.step }) : null, buildTotal > 0 ? (_jsxs("span", { className: "frac", children: [proj?.done ?? 0, "/", buildTotal] })) : null, _jsx("span", { className: "bar-track", "data-indeterminate": buildProgress === null ? '' : undefined, role: "progressbar", "aria-label": "Building the board", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": buildProgress === null ? undefined : Math.round(buildProgress * 100), style: { '--p': String(buildProgress ?? 0) }, children: _jsx("i", {}) })] })) : build === 'failed' ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "warn", children: _jsx(AlertIcon, {}) }), _jsx("span", { "data-tip": proj?.error, children: "Board build failed" }), _jsx("span", { className: "sr", children: proj?.error }), proj?.retryable && savedSession && p.canRetryBuild ? (_jsx("button", { type: "button", className: "fb", onClick: () => p.onRetryBuild(savedSession), children: "Retry" })) : null] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "ok t-check", "data-state": flowShown === 'saved' ? 'in' : undefined, children: _jsx(CheckIcon, {}) }), _jsx("span", { children: build === 'ready' ? (report ? 'Sent' : 'Board ready') : report ? 'Sent' : 'Saved' }), savedUrl ? (_jsxs("a", { ref: (el) => {
355
+ savedRef.current = el;
356
+ }, className: "fb primary", href: savedUrl, target: "_blank", rel: "noopener noreferrer", children: ["Open board ", _jsx(NewTabIcon, {})] })) : (_jsx("span", { className: "muted", children: "nothing to build" }))] })), _jsx("button", { ref: savedUrl ? undefined : (el) => void (savedRef.current = el), type: "button", className: "fb", onClick: p.onDismiss, children: "Done" })] }) }), _jsx(Seg, { on: face === 'remote', className: "s-remote", children: _jsxs("div", { className: "flow remote", "data-e2e": "recorder-remote", children: [_jsx("span", { className: "dot" }), _jsx("span", { className: "muted", children: "Recording in another tab" })] }) }), _jsx(Seg, { on: p.flow.face === 'failed', className: "s-failed", children: _jsxs("div", { className: "flow failed", role: "alert", "data-tip": failure, children: [_jsx("span", { className: "warn", children: _jsx(AlertIcon, {}) }), _jsx("span", { className: "msg", children: shortFailure(failure, report, startFailed) }), _jsx("span", { className: "sr", children: failure }), (rec || report) && !startFailed ? (_jsx("button", { type: "button", className: "fb", onClick: p.onRetry, children: "Retry" })) : null, _jsx("button", { type: "button", className: "fb icon", "aria-label": "Dismiss", onClick: p.onDismiss, children: _jsx(CloseIcon, {}) })] }) })] }));
319
357
  }
@@ -1,15 +1,16 @@
1
1
  /**
2
2
  * The composer sheet — the extension's hud.html, as a component: 440px wide
3
3
  * by default, anchored to the dock (a bottom sheet on phones), a 14px textarea
4
- * (16px on touch, so iOS never zooms) that grows with the draft up to a cap
5
- * and then scrolls, a resize grip on the corner away from the dock (width
6
- * and cap are HUD prefs — resize.ts), ✕ in the title row, a three-column footer
7
- * (board|task · context · ↑ Send) and the hint line (hidden on touch). Enter sends, ⇧Enter newlines, Esc
8
- * cancels. The DRAFT is owned by the caller so a cancel keeps it until the
9
- * next send (recorder-hud-polish D3); the board|task choice resets on every
10
- * open — a destination is per observation, not a mode. The bug report is the
11
- * same sheet: a required description and "Mark on screen" in the board|task
12
- * slot.
4
+ * (16px on touch, so iOS never zooms) that grows with the draft and then
5
+ * scrolls, a resize grip on the corner away from the dock (width and the
6
+ * dragged height — a minimum — are HUD prefs, resize.ts), ✕ in the title
7
+ * row, the caller's `head` (what an annotation points at) under it and its
8
+ * `below` (↳ references) under the text, a footer (context · ↑ Send) and the
9
+ * hint line (hidden on touch). Enter sends, ⇧Enter newlines, Esc cancels.
10
+ * The DRAFT is owned by the caller so a cancel keeps it until the next send
11
+ * (recorder-hud-polish D3). Everything lands on the board — there is no
12
+ * destination to pick (HUD polish 2026-10-14). The bug report is the same
13
+ * sheet: a required description and "Mark on screen" left of the context.
13
14
  *
14
15
  * Images (recorder attachments), only when the caller passes `images`: the
15
16
  * paperclip beside Send picks them, an image paste on the textarea and a
@@ -20,7 +21,7 @@
20
21
  * image, the cap) shows in the footer's context slot — one line, so the
21
22
  * footer never moves.
22
23
  */
23
- import { type Dispatch, type ReactElement, type SetStateAction } from 'react';
24
+ import { type Dispatch, type ReactElement, type ReactNode, type SetStateAction } from 'react';
24
25
  import type { HudAttachment } from './controller';
25
26
  import { type Grip } from './resize';
26
27
  export interface SheetProps {
@@ -30,16 +31,18 @@ export interface SheetProps {
30
31
  origin: string;
31
32
  title: string;
32
33
  ctx: string;
33
- /** True when the sheet composes an annotation (shows board|task). */
34
- pick: boolean;
34
+ /** Under the title: what the annotation points at (its crop or size · route chip, Reselect — HUD polish D9/D15). */
35
+ head?: ReactNode;
36
+ /** Under the text box: the notes this one references (↳ chips, D7). */
37
+ below?: ReactNode;
35
38
  draft: string;
36
39
  onDraft: (text: string) => void;
37
- onSend: (text: string, task: boolean) => void;
40
+ onSend: (text: string) => void;
38
41
  onClose: () => void;
39
42
  placeholder?: string;
40
43
  /** Send stays off until the description has text. */
41
44
  required?: boolean;
42
- /** Shows "Mark on screen" (instead of board|task): pick a region or element. */
45
+ /** Shows "Mark on screen": pick a region or element. */
43
46
  onMark?: () => void;
44
47
  /** Something is marked (the button reads pressed). */
45
48
  marked?: boolean;
@@ -66,4 +69,4 @@ export interface SheetProps {
66
69
  /** The sheet's box changed size: place it again before it paints. */
67
70
  onLayout?: () => void;
68
71
  }
69
- export declare function Sheet({ className, origin, title, ctx, pick, draft, onDraft, onSend, onClose, placeholder, required, onMark, marked, images, onImages, preparing: busy, onPreparing, kind, sheetW, sheetH, room, grip, onResize, onLayout, }: SheetProps): ReactElement;
72
+ export declare function Sheet({ className, origin, title, ctx, head, below, draft, onDraft, onSend, onClose, placeholder, required, onMark, marked, images, onImages, preparing: busy, onPreparing, kind, sheetW, sheetH, room, grip, onResize, onLayout, }: SheetProps): ReactElement;
@@ -2,15 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
3
  * The composer sheet — the extension's hud.html, as a component: 440px wide
4
4
  * by default, anchored to the dock (a bottom sheet on phones), a 14px textarea
5
- * (16px on touch, so iOS never zooms) that grows with the draft up to a cap
6
- * and then scrolls, a resize grip on the corner away from the dock (width
7
- * and cap are HUD prefs — resize.ts), ✕ in the title row, a three-column footer
8
- * (board|task · context · ↑ Send) and the hint line (hidden on touch). Enter sends, ⇧Enter newlines, Esc
9
- * cancels. The DRAFT is owned by the caller so a cancel keeps it until the
10
- * next send (recorder-hud-polish D3); the board|task choice resets on every
11
- * open — a destination is per observation, not a mode. The bug report is the
12
- * same sheet: a required description and "Mark on screen" in the board|task
13
- * slot.
5
+ * (16px on touch, so iOS never zooms) that grows with the draft and then
6
+ * scrolls, a resize grip on the corner away from the dock (width and the
7
+ * dragged height — a minimum — are HUD prefs, resize.ts), ✕ in the title
8
+ * row, the caller's `head` (what an annotation points at) under it and its
9
+ * `below` (↳ references) under the text, a footer (context · ↑ Send) and the
10
+ * hint line (hidden on touch). Enter sends, ⇧Enter newlines, Esc cancels.
11
+ * The DRAFT is owned by the caller so a cancel keeps it until the next send
12
+ * (recorder-hud-polish D3). Everything lands on the board — there is no
13
+ * destination to pick (HUD polish 2026-10-14). The bug report is the same
14
+ * sheet: a required description and "Mark on screen" left of the context.
14
15
  *
15
16
  * Images (recorder attachments), only when the caller passes `images`: the
16
17
  * paperclip beside Send picks them, an image paste on the textarea and a
@@ -48,12 +49,11 @@ function Thumb({ image, onRemove }) {
48
49
  }, [image.blob]);
49
50
  return (_jsxs("li", { className: "att", children: [src ? _jsx("img", { src: src, alt: image.name }) : null, _jsx("button", { type: "button", className: "attx", "aria-label": `Remove ${image.name}`, onClick: onRemove, children: _jsx(CloseIcon, {}) })] }));
50
51
  }
51
- export function Sheet({ className, origin, title, ctx, pick, draft, onDraft, onSend, onClose, placeholder = "what's wrong / what to refine…", required = false, onMark, marked = false, images, onImages, preparing: busy = 0, onPreparing, kind = 'note', sheetW = 0, sheetH = 0, room = 0, grip = null, onResize, onLayout, }) {
52
+ export function Sheet({ className, origin, title, ctx, head, below, draft, onDraft, onSend, onClose, placeholder = "what's wrong / what to refine…", required = false, onMark, marked = false, images, onImages, preparing: busy = 0, onPreparing, kind = 'note', sheetW = 0, sheetH = 0, room = 0, grip = null, onResize, onLayout, }) {
52
53
  const pop = useRef(null);
53
54
  const ta = useRef(null);
54
55
  const file = useRef(null);
55
56
  const size = useSheetSize({ sheet: pop, text: ta, width: sheetW, cap: sheetH, room, grip, onResize, onLayout });
56
- const [task, setTask] = useState(false);
57
57
  const [refusal, setRefusal] = useState('');
58
58
  const [dropping, setDropping] = useState(false);
59
59
  useEffect(() => {
@@ -77,7 +77,7 @@ export function Sheet({ className, origin, title, ctx, pick, draft, onDraft, onS
77
77
  ta.current?.focus();
78
78
  return;
79
79
  }
80
- onSend(draft.trim(), task);
80
+ onSend(draft.trim());
81
81
  };
82
82
  // Normalize in order (the strip keeps the order they came in); the cap is
83
83
  // re-checked as each lands, so two quick adds never pass it. The work can
@@ -164,7 +164,7 @@ export function Sheet({ className, origin, title, ctx, pick, draft, onDraft, onS
164
164
  send();
165
165
  }
166
166
  };
167
- return (_jsxs("div", { ref: pop, className: `pop compose ${className}${dropping ? ' dropping' : ''}`, style: { transformOrigin: origin, ...size.style }, role: "dialog", "aria-labelledby": "vt-pop-title", onKeyDown: onKey, ...(onImages ? { onDragEnter: onDragOver, onDragOver, onDragLeave, onDrop } : {}), children: [_jsxs("div", { className: "pop-head", children: [_jsxs("span", { className: "title", children: [_jsx("i", {}), _jsx("span", { id: "vt-pop-title", children: title })] }), _jsx("button", { type: "button", className: "closeb", "aria-label": "Close", onClick: onClose, children: _jsx(CloseIcon, {}) })] }), _jsx("textarea", { ref: ta, placeholder: placeholder, "aria-required": required || undefined, value: draft, onChange: (e) => onDraft(e.target.value), onKeyDown: onTaKey, ...(onImages ? { onPaste } : {}) }), images && (images.length > 0 || busy > 0) ? (_jsxs("ul", { className: "atts", "aria-label": "Attached images", children: [images.map((image) => (_jsx(Thumb, { image: image, onRemove: () => remove(image) }, keyOf(image)))), Array.from({ length: busy }, (_, i) => (_jsx("li", { className: "att busy", "aria-label": "Preparing image", children: _jsx(SpinnerIcon, {}) }, `busy${i}`)))] })) : null, _jsxs("div", { className: pick || onMark ? 'row' : 'row nodest', children: [onMark ? (_jsx("span", { className: "dest", children: _jsx("button", { type: "button", "aria-pressed": marked, onClick: onMark, children: "Mark on screen" }) })) : pick ? (_jsxs("span", { className: "dest", role: "group", "aria-label": "Where this snap lands", children: [_jsx("button", { type: "button", "aria-pressed": !task, onClick: () => setTask(false), children: "board" }), _jsx("button", { type: "button", "aria-pressed": task, onClick: () => setTask(true), children: "task" })] })) : null, refusal ? (_jsx("span", { className: "ctx bad", title: refusal, children: refusal })) : (_jsx("span", { className: "ctx", children: ctx })), onImages ? (_jsxs("span", { className: "acts", children: [_jsx("button", { type: "button", className: "clipb", "aria-label": "Attach image", "aria-disabled": full || undefined, onClick: browse, children: _jsx(PaperclipIcon, {}) }), _jsx("input", { ref: file, type: "file", accept: "image/*", multiple: true, hidden: true, onChange: (e) => {
167
+ return (_jsxs("div", { ref: pop, className: `pop compose ${className}${dropping ? ' dropping' : ''}`, style: { transformOrigin: origin, ...size.style }, role: "dialog", "aria-labelledby": "vt-pop-title", onKeyDown: onKey, ...(onImages ? { onDragEnter: onDragOver, onDragOver, onDragLeave, onDrop } : {}), children: [_jsxs("div", { className: "pop-head", children: [_jsxs("span", { className: "title", children: [_jsx("i", {}), _jsx("span", { id: "vt-pop-title", children: title })] }), _jsx("button", { type: "button", className: "closeb", "aria-label": "Close", onClick: onClose, children: _jsx(CloseIcon, {}) })] }), head, _jsx("textarea", { ref: ta, placeholder: placeholder, "aria-required": required || undefined, value: draft, onChange: (e) => onDraft(e.target.value), onKeyDown: onTaKey, ...(onImages ? { onPaste } : {}) }), below, images && (images.length > 0 || busy > 0) ? (_jsxs("ul", { className: "atts", "aria-label": "Attached images", children: [images.map((image) => (_jsx(Thumb, { image: image, onRemove: () => remove(image) }, keyOf(image)))), Array.from({ length: busy }, (_, i) => (_jsx("li", { className: "att busy", "aria-label": "Preparing image", children: _jsx(SpinnerIcon, {}) }, `busy${i}`)))] })) : null, _jsxs("div", { className: onMark ? 'row' : 'row nodest', children: [onMark ? (_jsx("span", { className: "dest", children: _jsx("button", { type: "button", "aria-pressed": marked, onClick: onMark, children: "Mark on screen" }) })) : null, refusal ? (_jsx("span", { className: "ctx bad", title: refusal, children: refusal })) : (_jsx("span", { className: "ctx", children: ctx })), onImages ? (_jsxs("span", { className: "acts", children: [_jsx("button", { type: "button", className: "clipb", "aria-label": "Attach image", "aria-disabled": full || undefined, onClick: browse, children: _jsx(PaperclipIcon, {}) }), _jsx("input", { ref: file, type: "file", accept: "image/*", multiple: true, hidden: true, onChange: (e) => {
168
168
  attach(Array.from(e.currentTarget.files ?? []));
169
169
  // The same file picked again is a change too.
170
170
  e.currentTarget.value = '';
@@ -21,7 +21,11 @@ export interface HudPrefs {
21
21
  verbose: boolean;
22
22
  /** The note / annotate / report sheet's width, CSS px; 0 = the HUD's default. */
23
23
  sheetW: number;
24
- /** The cap its text box grows to before it scrolls, CSS px; 0 = the HUD's default (20 rows). */
24
+ /**
25
+ * The height its text box was dragged to, CSS px: it never stands shorter
26
+ * and still grows with its draft (a minimum, HUD polish D8); 0 = the HUD's
27
+ * default (fit the draft, up to 20 rows).
28
+ */
25
29
  sheetH: number;
26
30
  }
27
31
  /** Who the recorder token belongs to (`GET /api/v1/recorder/me`). */
@@ -56,6 +60,32 @@ export interface HudSync {
56
60
  events: number;
57
61
  serverMaxSeq: number;
58
62
  deadReason: string;
63
+ /** What the server acknowledged from this tab, by kind (the stats float). Absent = the host does not count. */
64
+ acked?: HudAcked;
65
+ /** Client ids of this tab's notes not yet acknowledged; the "Saved" flash waits for its note to leave. */
66
+ pendingNotes?: readonly string[];
67
+ }
68
+ /** Acknowledged deliveries, as a tester names them. */
69
+ export interface HudAcked {
70
+ /** Clicks. */
71
+ actions: number;
72
+ /** Navigations. */
73
+ pages: number;
74
+ /** DOM frames (rrweb events). */
75
+ frames: number;
76
+ /** Notes and annotations. */
77
+ notes: number;
78
+ }
79
+ /** The server's board build of a saved session (`GET /api/v1/sessions/{id}` → `projection`). */
80
+ export interface HudProjection {
81
+ state: 'idle' | 'queued' | 'running' | 'ready' | 'empty' | 'failed';
82
+ /** What the running pass is doing, in the server's words. */
83
+ step?: string;
84
+ done?: number;
85
+ total?: number;
86
+ error?: string;
87
+ /** A failed build another `POST …/project` may fix. */
88
+ retryable?: boolean;
59
89
  }
60
90
  export interface HudRecording {
61
91
  sessionId: string;
@@ -80,6 +110,8 @@ export interface HudRecent {
80
110
  durationMs?: number;
81
111
  status: HudRecentStatus;
82
112
  boardUrl?: string;
113
+ /** The board build while the HUD waits for it; absent once the link is known or nobody polls. */
114
+ projection?: HudProjection;
83
115
  }
84
116
  export interface HudSnapshot {
85
117
  /** Something to authenticate with (an explicit key or a stored link). */
@@ -116,6 +148,13 @@ export interface HudSnapshot {
116
148
  * stays) and binds no shortcut. Absent = this HUD's host leads or is idle.
117
149
  */
118
150
  following?: 'page' | 'extension';
151
+ /**
152
+ * With `following`: the leader records in ANOTHER document (it holds no
153
+ * claim here), so this document shows no pill of its own — the HUD then
154
+ * shows a quiet "Recording in another tab" instead of hiding (HUD polish
155
+ * D11). False or absent: the leader's pill is in this document.
156
+ */
157
+ followingElsewhere?: boolean;
119
158
  }
120
159
  /** The pill's inline flow face (`hud/flow.ts`), as `faceChanged` reports it. */
121
160
  export type HudFace = 'none' | 'confirm' | 'saving' | 'saved' | 'failed';
@@ -149,14 +188,37 @@ export interface HudRect {
149
188
  w: number;
150
189
  h: number;
151
190
  }
191
+ /**
192
+ * A note's identity (D6/D7): the HUD mints `cid`; `replaces` supersedes the
193
+ * named note (an edit), `refs` points at others. Client ids, never seqs.
194
+ */
195
+ export interface HudNoteLink {
196
+ cid: string;
197
+ replaces?: string;
198
+ refs?: readonly string[];
199
+ }
152
200
  export interface HudAnnotation {
153
201
  text: string;
154
202
  rect: HudRect;
155
203
  /** '' for a free region. */
156
204
  selector: string;
157
- /** Also file it as an intake task. */
158
- task: boolean;
159
205
  attachments?: readonly HudAttachment[];
206
+ link?: HudNoteLink;
207
+ }
208
+ /** One note of the live recording, as `listNotes` keeps it. */
209
+ export interface HudNote {
210
+ cid: string;
211
+ text: string;
212
+ /** Epoch ms of capture. */
213
+ at: number;
214
+ route: string;
215
+ /** A region / element annotation, or a plain note. */
216
+ region: boolean;
217
+ /** CSS-pixel size of the region, when it is one. */
218
+ w?: number;
219
+ h?: number;
220
+ replaces?: string;
221
+ refs?: readonly string[];
160
222
  }
161
223
  /** What "Report a bug" sends from the sheet. */
162
224
  export interface HudReport {
@@ -187,8 +249,23 @@ export interface HudController {
187
249
  /** Drains, then closes the session; rejects (session kept) while unreachable. */
188
250
  stop(): Promise<HudSaved>;
189
251
  /** `attachments` only when `canAttach`; with them, `text` may be empty. */
190
- note(text: string, attachments?: readonly HudAttachment[]): void;
252
+ note(text: string, attachments?: readonly HudAttachment[], link?: HudNoteLink): void;
191
253
  annotate(a: HudAnnotation): void;
254
+ /**
255
+ * The live recording's notes, every tab's, oldest first — what the notes
256
+ * sheet lists (a recorder token reads nothing back from the server, so the
257
+ * host keeps them on the device for the recording's life). Optional; never
258
+ * rejects (null = no live recording).
259
+ */
260
+ listNotes?(): Promise<HudNote[] | null>;
261
+ /**
262
+ * The picked region's pixels, for the composer's thumbnail (D15): a data
263
+ * URL, or null where the host cannot read pixels (the page recorder never
264
+ * can — it simply omits this). Never rejects.
265
+ */
266
+ captureRegion?(rect: HudRect): Promise<string | null>;
267
+ /** Ask the server to build a saved session's board again (a retryable failure). Rejects with the reason. */
268
+ retryBuild?(sessionId: string): Promise<void>;
192
269
  setAnnotating(active: boolean): void;
193
270
  link(): Promise<HudLinkFlow>;
194
271
  unlink(): void;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The draft drop (recorder HUD polish D10/D13/D14): a composer closed with
3
+ * words or images in it parks as a 16px glass bead fused to the pill's end
4
+ * that faces the screen's centre — a small liquid fillet joins them. At rest
5
+ * it is the bead and an amber dot; hovered or focused it stretches into a bar
6
+ * with the draft's crop (when the host had pixels) and first line; a click
7
+ * resumes the composer exactly as it was. No page chrome: the region is not
8
+ * drawn while the draft waits (D14).
9
+ *
10
+ * Not an SVG goo filter: a filter on the pill's ancestor would cut its
11
+ * backdrop blur, and `url(#…)` filter references are unreliable inside a
12
+ * shadow root. The fillet is drawn, the bead is the HUD's own glass.
13
+ */
14
+ import type { ReactElement } from 'react';
15
+ export interface DraftDropProps {
16
+ /** The draft's first line ('' for an image-only draft). */
17
+ text: string;
18
+ /** The picked region's pixels, when the host could read them (D15). */
19
+ crop: string | null;
20
+ /** Which side of the pill it buds from: the one toward the screen's centre. */
21
+ side: 'start' | 'end';
22
+ onResume: () => void;
23
+ }
24
+ export declare function DraftDrop({ text, crop, side, onResume }: DraftDropProps): ReactElement;
25
+ /** The drop's CSS (appended to HUD_CSS). */
26
+ export declare const DROP_CSS = "\n.draft { position:relative; display:flex; align-items:center; flex:none; }\n.draft[data-side=\"start\"] { order:-1; margin-right:-1px; }\n.draft[data-side=\"end\"] { order:1; margin-left:-1px; flex-direction:row-reverse; }\n.draft .fillet { width:8px; height:16px; flex:none; overflow:visible; }\n.draft .fillet .f-body { fill:var(--ink-pop); }\n.draft .fillet .f-rim { fill:none; stroke:rgba(255,255,255,.16); stroke-width:1; vector-effect:non-scaling-stroke; }\n.draft[data-side=\"start\"] .fillet { order:1; transform:scaleX(-1); }\n.hud .draft .bead { all:unset; box-sizing:border-box; cursor:pointer; display:inline-flex; align-items:center; height:18px; min-width:18px;\n padding:0 5px; border-radius:999px; color:var(--fg); font-size:calc(var(--fs) - 1px); font-weight:600;\n background:var(--ink); -webkit-backdrop-filter:blur(16px) saturate(1.5); backdrop-filter:blur(16px) saturate(1.5);\n box-shadow: inset 0 0 0 1px var(--edge), 0 0 0 .5px var(--rim), 0 6px 16px -8px rgba(0,0,0,.5);\n animation: drop-in var(--duration-medium) var(--ease-spring) both;\n transition: height var(--duration-fast) var(--ease-smooth-out); }\n.draft .d-dot { width:8px; height:8px; flex:none; border-radius:50%; background:var(--warn); }\n.draft .d-more { display:grid; grid-template-columns:0fr; opacity:0;\n transition: grid-template-columns var(--duration-resize) var(--ease-smooth-out), opacity var(--duration-quick) var(--ease-out); }\n.draft .d-in { min-width:0; overflow:hidden; display:inline-flex; align-items:center; gap:6px; white-space:nowrap; padding-left:6px; }\n.draft .d-in svg { color:var(--warn); }\n.draft .d-crop { width:28px; height:18px; object-fit:cover; border-radius:3px; box-shadow:0 0 0 1px var(--rec); }\n.draft .d-text { max-width:calc(170px * var(--s)); overflow:hidden; text-overflow:ellipsis; color:var(--fg-2); font-weight:500; }\n.draft kbd { font:600 var(--fs-s)/1 ui-monospace, \"SF Mono\", Menlo, monospace; color:var(--fg-3); }\n.hud .draft .bead:hover, .hud .draft .bead:focus-visible { height:26px; }\n.draft .bead:hover .d-more, .draft .bead:focus-visible .d-more { grid-template-columns:1fr; opacity:1; }\n.draft .bead:focus-visible { outline:2px solid var(--rec); outline-offset:2px; }\n@keyframes drop-in { from { transform:scale(.3); opacity:0; } }\n.dock.dragging .draft { display:none; }\n";
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PencilIcon } from './icons';
3
+ export function DraftDrop({ text, crop, side, onResume }) {
4
+ const line = text.split('\n')[0]?.trim() || 'Image draft';
5
+ return (_jsxs("div", { className: "draft", "data-side": side, "data-e2e": "draft-drop", children: [_jsxs("svg", { className: "fillet", viewBox: "0 0 8 16", "aria-hidden": "true", children: [_jsx("path", { className: "f-body", d: "M0 0 C 3 4, 5 4, 8 3 L 8 13 C 5 12, 3 12, 0 16 Z" }), _jsx("path", { className: "f-rim", d: "M0 0.5 C 3 4.5, 5 4.5, 8 3.5 M0 15.5 C 3 11.5, 5 11.5, 8 12.5" })] }), _jsxs("button", { type: "button", className: "bead glass", "aria-label": `Resume the draft: ${line}`, onClick: onResume, children: [_jsx("span", { className: "d-dot" }), _jsx("span", { className: "d-more", children: _jsxs("span", { className: "d-in", children: [crop ? _jsx("img", { className: "d-crop", src: crop, alt: "" }) : _jsx(PencilIcon, {}), _jsx("span", { className: "d-text", children: line }), _jsx("kbd", { children: "\u21A9" })] }) })] })] }));
6
+ }
7
+ /** The drop's CSS (appended to HUD_CSS). */
8
+ export const DROP_CSS = `
9
+ .draft { position:relative; display:flex; align-items:center; flex:none; }
10
+ .draft[data-side="start"] { order:-1; margin-right:-1px; }
11
+ .draft[data-side="end"] { order:1; margin-left:-1px; flex-direction:row-reverse; }
12
+ .draft .fillet { width:8px; height:16px; flex:none; overflow:visible; }
13
+ .draft .fillet .f-body { fill:var(--ink-pop); }
14
+ .draft .fillet .f-rim { fill:none; stroke:rgba(255,255,255,.16); stroke-width:1; vector-effect:non-scaling-stroke; }
15
+ .draft[data-side="start"] .fillet { order:1; transform:scaleX(-1); }
16
+ .hud .draft .bead { all:unset; box-sizing:border-box; cursor:pointer; display:inline-flex; align-items:center; height:18px; min-width:18px;
17
+ padding:0 5px; border-radius:999px; color:var(--fg); font-size:calc(var(--fs) - 1px); font-weight:600;
18
+ background:var(--ink); -webkit-backdrop-filter:blur(16px) saturate(1.5); backdrop-filter:blur(16px) saturate(1.5);
19
+ box-shadow: inset 0 0 0 1px var(--edge), 0 0 0 .5px var(--rim), 0 6px 16px -8px rgba(0,0,0,.5);
20
+ animation: drop-in var(--duration-medium) var(--ease-spring) both;
21
+ transition: height var(--duration-fast) var(--ease-smooth-out); }
22
+ .draft .d-dot { width:8px; height:8px; flex:none; border-radius:50%; background:var(--warn); }
23
+ .draft .d-more { display:grid; grid-template-columns:0fr; opacity:0;
24
+ transition: grid-template-columns var(--duration-resize) var(--ease-smooth-out), opacity var(--duration-quick) var(--ease-out); }
25
+ .draft .d-in { min-width:0; overflow:hidden; display:inline-flex; align-items:center; gap:6px; white-space:nowrap; padding-left:6px; }
26
+ .draft .d-in svg { color:var(--warn); }
27
+ .draft .d-crop { width:28px; height:18px; object-fit:cover; border-radius:3px; box-shadow:0 0 0 1px var(--rec); }
28
+ .draft .d-text { max-width:calc(170px * var(--s)); overflow:hidden; text-overflow:ellipsis; color:var(--fg-2); font-weight:500; }
29
+ .draft kbd { font:600 var(--fs-s)/1 ui-monospace, "SF Mono", Menlo, monospace; color:var(--fg-3); }
30
+ .hud .draft .bead:hover, .hud .draft .bead:focus-visible { height:26px; }
31
+ .draft .bead:hover .d-more, .draft .bead:focus-visible .d-more { grid-template-columns:1fr; opacity:1; }
32
+ .draft .bead:focus-visible { outline:2px solid var(--rec); outline-offset:2px; }
33
+ @keyframes drop-in { from { transform:scale(.3); opacity:0; } }
34
+ .dock.dragging .draft { display:none; }
35
+ `;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Inline style of the HUD host: a 0×0 fixed box at the viewport origin (the
3
+ * dock and sheets are fixed children of its shadow root). Zero-size keeps
4
+ * rrweb's placeholder for this blocked node empty in every replay — rrweb 2
5
+ * has no "omit entirely" mode, a blocked node always leaves a sized
6
+ * placeholder — and `pointer-events:none` lets the page under the HUD's gaps
7
+ * take every click. Overrides the [popover] UA sheet.
8
+ *
9
+ * Its own leaf module so host.ts (which the React-free report face mounts
10
+ * into) never pulls the HUD's React sheets in through styles.ts.
11
+ */
12
+ export declare const HOST_STYLE: string;
13
+ /** Inline style of a sheet host portaled into a dialog — the same 0×0 origin box. */
14
+ export declare const SHEET_HOST_STYLE: string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Inline style of the HUD host: a 0×0 fixed box at the viewport origin (the
3
+ * dock and sheets are fixed children of its shadow root). Zero-size keeps
4
+ * rrweb's placeholder for this blocked node empty in every replay — rrweb 2
5
+ * has no "omit entirely" mode, a blocked node always leaves a sized
6
+ * placeholder — and `pointer-events:none` lets the page under the HUD's gaps
7
+ * take every click. Overrides the [popover] UA sheet.
8
+ *
9
+ * Its own leaf module so host.ts (which the React-free report face mounts
10
+ * into) never pulls the HUD's React sheets in through styles.ts.
11
+ */
12
+ export const HOST_STYLE = 'all:initial;position:fixed;z-index:2147483647;inset:0 auto auto 0;margin:0;padding:0;border:0;' +
13
+ 'background:transparent;overflow:visible;width:0;height:0;pointer-events:none;color-scheme:normal;';
14
+ /** Inline style of a sheet host portaled into a dialog — the same 0×0 origin box. */
15
+ export const SHEET_HOST_STYLE = HOST_STYLE;
@@ -12,7 +12,7 @@
12
12
  * — no preventDefault, so buttons and the textarea still focus.
13
13
  */
14
14
  import { RRWEB_BLOCK_ATTR } from '../block';
15
- import { HOST_STYLE, SHEET_HOST_STYLE } from './styles';
15
+ import { HOST_STYLE, SHEET_HOST_STYLE } from './host-style';
16
16
  const SHIELDED = [
17
17
  'pointerdown', 'pointerup', 'pointermove', 'pointerover', 'pointerout', 'pointercancel',
18
18
  'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'click', 'dblclick', 'auxclick',