@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.
- package/CHANGELOG.md +113 -0
- package/README.md +145 -20
- package/build/hud.iife.js +150 -28
- package/build/index.d.ts +1 -0
- package/build/protocol/index.d.ts +10 -0
- package/build/recorder/RecorderProvider.js +5 -18
- package/build/recorder/api.d.ts +20 -0
- package/build/recorder/api.js +21 -9
- package/build/recorder/capture/console.d.ts +6 -1
- package/build/recorder/capture/console.js +28 -5
- package/build/recorder/capture/net.d.ts +10 -1
- package/build/recorder/capture/net.js +14 -1
- package/build/recorder/capture/redact.d.ts +1 -0
- package/build/recorder/capture/redact.js +6 -1
- package/build/recorder/capture/rrweb-lane.d.ts +19 -0
- package/build/recorder/capture/rrweb-lane.js +109 -0
- package/build/recorder/capture/rrweb.d.ts +2 -9
- package/build/recorder/capture/rrweb.js +11 -86
- package/build/recorder/config.d.ts +3 -1
- package/build/recorder/config.js +15 -2
- package/build/recorder/flight.d.ts +141 -22
- package/build/recorder/flight.js +312 -27
- package/build/recorder/hud/Hud.js +206 -31
- package/build/recorder/hud/NotesSheet.d.ts +24 -0
- package/build/recorder/hud/NotesSheet.js +147 -0
- package/build/recorder/hud/RecorderPill.d.ts +34 -12
- package/build/recorder/hud/RecorderPill.js +52 -14
- package/build/recorder/hud/Sheet.d.ts +18 -15
- package/build/recorder/hud/Sheet.js +13 -13
- package/build/recorder/hud/controller.d.ts +81 -4
- package/build/recorder/hud/drop.d.ts +26 -0
- package/build/recorder/hud/drop.js +35 -0
- package/build/recorder/hud/host-style.d.ts +14 -0
- package/build/recorder/hud/host-style.js +15 -0
- package/build/recorder/hud/host.js +1 -1
- package/build/recorder/hud/icons.d.ts +6 -0
- package/build/recorder/hud/icons.js +12 -0
- package/build/recorder/hud/notes-rows.d.ts +39 -0
- package/build/recorder/hud/notes-rows.js +49 -0
- package/build/recorder/hud/resize.d.ts +6 -3
- package/build/recorder/hud/resize.js +8 -4
- package/build/recorder/hud/styles.d.ts +2 -30
- package/build/recorder/hud/styles.js +63 -31
- package/build/recorder/page-controller.js +13 -7
- package/build/recorder/queue.d.ts +22 -1
- package/build/recorder/queue.js +84 -5
- package/build/recorder/recents.d.ts +20 -4
- package/build/recorder/recents.js +41 -6
- package/build/recorder/session.d.ts +25 -6
- package/build/recorder/session.js +50 -8
- package/build/recorder/state.d.ts +18 -1
- package/build/recorder/state.js +40 -1
- package/build/recorder/storage/capture.d.ts +44 -0
- package/build/recorder/storage/capture.js +136 -0
- package/build/recorder/version.d.ts +2 -2
- package/build/recorder/version.js +1 -1
- package/build/report/bundle.d.ts +4 -0
- package/build/report/bundle.js +30 -0
- package/build/report/element.d.ts +86 -0
- package/build/report/element.js +146 -0
- package/build/report/engine.d.ts +144 -0
- package/build/report/engine.js +402 -0
- package/build/report/i18n.d.ts +78 -0
- package/build/report/i18n.js +151 -0
- package/build/report/identity.d.ts +26 -0
- package/build/report/identity.js +36 -0
- package/build/report/index.d.ts +12 -0
- package/build/report/index.js +15 -0
- package/build/report/keybind.d.ts +29 -0
- package/build/report/keybind.js +99 -0
- package/build/report/markers.d.ts +77 -0
- package/build/report/markers.js +162 -0
- package/build/report/profile.d.ts +62 -0
- package/build/report/profile.js +115 -0
- package/build/report/recorder-face.d.ts +2 -0
- package/build/report/recorder-face.js +20 -0
- package/build/report/styles.d.ts +7 -0
- package/build/report/styles.js +226 -0
- package/build/report/widget.d.ts +109 -0
- package/build/report/widget.js +907 -0
- package/build/report/wire.d.ts +68 -0
- package/build/report/wire.js +96 -0
- package/build/report-widget.mjs +229 -0
- package/package.json +11 -4
|
@@ -13,6 +13,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, } from 'react';
|
|
14
14
|
import { createPortal } from 'react-dom';
|
|
15
15
|
import { AnnotateOverlay } from './AnnotateOverlay';
|
|
16
|
+
import { DraftDrop } from './drop';
|
|
17
|
+
import { AnnotateIcon, CloseIcon, ReplyIcon } from './icons';
|
|
18
|
+
import { NotesSheet } from './NotesSheet';
|
|
19
|
+
import { noteRows } from './notes-rows';
|
|
16
20
|
import { bindChords } from './chords';
|
|
17
21
|
import { flowReducer, NO_FLOW } from './flow';
|
|
18
22
|
import { createSheetHost, insideHud, sheetTarget } from './host';
|
|
@@ -21,7 +25,7 @@ import { LinkSheet } from './LinkSheet';
|
|
|
21
25
|
import { listen } from './listen';
|
|
22
26
|
import { Menu } from './Menu';
|
|
23
27
|
import { alignFor, towardCentre } from './place';
|
|
24
|
-
import { RecorderPill } from './RecorderPill';
|
|
28
|
+
import { newCid, RecorderPill, Stats } from './RecorderPill';
|
|
25
29
|
import { gripFor } from './resize';
|
|
26
30
|
import { Sheet } from './Sheet';
|
|
27
31
|
import { colOf, rowOf } from './spots';
|
|
@@ -48,6 +52,8 @@ function reportSheet(mark, recording) {
|
|
|
48
52
|
const MIN_SAVING_MS = 700;
|
|
49
53
|
/** How long the clock says "Saved" after a note or annotation. */
|
|
50
54
|
const FLASH_MS = 1600;
|
|
55
|
+
/** The HUD storage key that remembers the first-run hint was seen. */
|
|
56
|
+
const HINTED_KEY = 'hud.hinted';
|
|
51
57
|
/** A clock that ticks every second while `active` (the timer, ages, the sync chip). */
|
|
52
58
|
function useNow(active) {
|
|
53
59
|
const [now, setNow] = useState(() => Date.now());
|
|
@@ -80,7 +86,23 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
80
86
|
const [starting, setStarting] = useState(false);
|
|
81
87
|
const [menu, setMenu] = useState(false);
|
|
82
88
|
const [flow, dispatch] = useReducer(flowReducer, NO_FLOW);
|
|
83
|
-
|
|
89
|
+
// The clock's word after a note (D11): `queued` until the server has it, then `saved`.
|
|
90
|
+
const [flash, setFlash] = useState(null);
|
|
91
|
+
const [flashCid, setFlashCid] = useState(null);
|
|
92
|
+
// The tray is unfolded on the recording face: the stats float shows (D4).
|
|
93
|
+
const [trayOpen, setTrayOpen] = useState(false);
|
|
94
|
+
// The first-run hint (D3): once per origin, the idle puck says what Start does.
|
|
95
|
+
const [hinted, setHinted] = useState(() => storage.getString(HINTED_KEY) === '1');
|
|
96
|
+
const hintRef = useRef(null);
|
|
97
|
+
const markHinted = useCallback(() => {
|
|
98
|
+
setHinted(true);
|
|
99
|
+
try {
|
|
100
|
+
storage.set(HINTED_KEY, '1');
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
console.warn('vitrinka: could not remember the first-run hint', e);
|
|
104
|
+
}
|
|
105
|
+
}, [storage]);
|
|
84
106
|
const annotating = snap.annotating;
|
|
85
107
|
const now = useNow(rec !== null || menu || flow.face !== 'none');
|
|
86
108
|
const rootRef = useRef(null);
|
|
@@ -127,41 +149,112 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
127
149
|
})
|
|
128
150
|
.catch((e) => setLink({ phase: 'error', flow: null, error: errorText(e) }));
|
|
129
151
|
}, [controller]);
|
|
130
|
-
|
|
152
|
+
// A composer closed with words or images in it PARKS (D10/D13): the pill
|
|
153
|
+
// shows the draft drop until it is resumed, sent, or emptied.
|
|
154
|
+
const [parked, setParked] = useState(null);
|
|
155
|
+
const sheetNow = useRef(sheet);
|
|
156
|
+
sheetNow.current = sheet;
|
|
157
|
+
const draftNow = useRef({ draft, images });
|
|
158
|
+
draftNow.current = { draft, images };
|
|
159
|
+
const closeSheet = useCallback(() => {
|
|
160
|
+
const s = sheetNow.current;
|
|
161
|
+
const d = draftNow.current;
|
|
162
|
+
if (s && !s.report && !s.notes && (d.draft.trim() !== '' || d.images.length > 0))
|
|
163
|
+
setParked(s);
|
|
164
|
+
setSheet(null);
|
|
165
|
+
}, []);
|
|
131
166
|
// A drag closes the composer (its draft survives) and the menu; the link sheet follows the dock.
|
|
132
167
|
const onMoveStart = useCallback(() => {
|
|
133
|
-
|
|
168
|
+
closeSheet();
|
|
134
169
|
setMenu(false);
|
|
135
|
-
}, []);
|
|
170
|
+
}, [closeSheet]);
|
|
171
|
+
// The notes this draft references (D7), and the live recording's notes for the sheet (D5).
|
|
172
|
+
const [refs, setRefs] = useState([]);
|
|
173
|
+
const [notes, setNotes] = useState([]);
|
|
174
|
+
const [notesTick, setNotesTick] = useState(0);
|
|
175
|
+
const recId = rec?.sessionId ?? null;
|
|
176
|
+
const pendingKey = rec?.sync.pendingNotes?.join(',') ?? '';
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
if (!recId || !controller.listNotes) {
|
|
179
|
+
setNotes([]);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
let live = true;
|
|
183
|
+
void controller.listNotes().then((list) => {
|
|
184
|
+
if (live)
|
|
185
|
+
setNotes(list ?? []);
|
|
186
|
+
});
|
|
187
|
+
return () => {
|
|
188
|
+
live = false;
|
|
189
|
+
};
|
|
190
|
+
}, [controller, recId, pendingKey, notesTick]);
|
|
191
|
+
const rows = useMemo(() => noteRows(notes, rec?.sync.pendingNotes ?? []), [notes, rec?.sync.pendingNotes]);
|
|
136
192
|
const dock = useDock(onMoveStart, storage);
|
|
137
193
|
const phone = useMedia(PHONE_QUERY);
|
|
194
|
+
// The composer a note opens: the PARKED draft when there is one — it carries
|
|
195
|
+
// its pick, and a fresh Note sheet would send that annotation as a plain note.
|
|
196
|
+
const parkedNow = useRef(parked);
|
|
197
|
+
parkedNow.current = parked;
|
|
198
|
+
const composeNote = useCallback(() => {
|
|
199
|
+
setSheet(parkedNow.current ?? { title: 'Note', ctx: `step · ${location.pathname}`, pick: null });
|
|
200
|
+
setParked(null);
|
|
201
|
+
}, []);
|
|
138
202
|
const openNote = useCallback(() => {
|
|
139
203
|
if (!controller.getSnapshot().recording)
|
|
140
204
|
return;
|
|
141
205
|
controller.setAnnotating(false);
|
|
142
206
|
setMenu(false);
|
|
143
|
-
|
|
144
|
-
}, [controller]);
|
|
207
|
+
composeNote();
|
|
208
|
+
}, [controller, composeNote]);
|
|
209
|
+
// The composer that Reselect left: Esc in pick mode goes back to it unchanged (D9).
|
|
210
|
+
const reselectRef = useRef(null);
|
|
145
211
|
const toggleAnnotate = useCallback(() => {
|
|
146
212
|
const s = controller.getSnapshot();
|
|
147
213
|
if (!s.recording)
|
|
148
214
|
return;
|
|
149
|
-
|
|
215
|
+
reselectRef.current = null;
|
|
216
|
+
closeSheet();
|
|
150
217
|
setMenu(false);
|
|
151
218
|
setMarking(false);
|
|
152
219
|
controller.setAnnotating(!s.annotating);
|
|
220
|
+
}, [controller, closeSheet]);
|
|
221
|
+
const reselect = useCallback(() => {
|
|
222
|
+
reselectRef.current = sheetNow.current;
|
|
223
|
+
setSheet(null);
|
|
224
|
+
controller.setAnnotating(true);
|
|
153
225
|
}, [controller]);
|
|
226
|
+
const openNotes = useCallback(() => {
|
|
227
|
+
if (!controller.getSnapshot().recording)
|
|
228
|
+
return;
|
|
229
|
+
controller.setAnnotating(false);
|
|
230
|
+
setMenu(false);
|
|
231
|
+
closeSheet();
|
|
232
|
+
setNotesTick((t) => t + 1);
|
|
233
|
+
setSheet({ title: 'Notes', ctx: '', pick: null, notes: true });
|
|
234
|
+
}, [controller, closeSheet]);
|
|
154
235
|
const onPick = useCallback((pick) => {
|
|
155
236
|
controller.setAnnotating(false);
|
|
237
|
+
reselectRef.current = null;
|
|
156
238
|
if (marking) {
|
|
157
239
|
setMarking(false);
|
|
158
240
|
setSheet(reportSheet(pick, controller.getSnapshot().recording !== null));
|
|
159
241
|
return;
|
|
160
242
|
}
|
|
161
|
-
|
|
243
|
+
setParked(null);
|
|
244
|
+
setSheet({ title: pick.selector ? 'Annotate element' : 'Annotate region', ctx: '', pick, crop: null });
|
|
245
|
+
// The host's pixels, when it has any (the extension): the header shows them once they arrive.
|
|
246
|
+
void controller.captureRegion?.(pick.rect).then((crop) => {
|
|
247
|
+
if (crop)
|
|
248
|
+
setSheet((s) => (s?.pick === pick ? { ...s, crop } : s));
|
|
249
|
+
});
|
|
162
250
|
}, [controller, marking]);
|
|
163
251
|
const cancelAnnotate = useCallback(() => {
|
|
164
252
|
controller.setAnnotating(false);
|
|
253
|
+
if (reselectRef.current) {
|
|
254
|
+
setSheet(reselectRef.current);
|
|
255
|
+
reselectRef.current = null;
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
165
258
|
if (!marking)
|
|
166
259
|
return;
|
|
167
260
|
// Back to the report as it was (its earlier mark, if any).
|
|
@@ -187,11 +280,32 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
187
280
|
controller.setAnnotating(true);
|
|
188
281
|
}, [sheet, controller]);
|
|
189
282
|
const flashTimer = useRef(undefined);
|
|
190
|
-
const
|
|
283
|
+
const sayFlash = useCallback((word) => {
|
|
191
284
|
clearTimeout(flashTimer.current);
|
|
192
|
-
setFlash(
|
|
193
|
-
flashTimer.current = setTimeout(() => setFlash(
|
|
285
|
+
setFlash(word);
|
|
286
|
+
flashTimer.current = setTimeout(() => setFlash(null), FLASH_MS);
|
|
194
287
|
}, []);
|
|
288
|
+
// A note went out under `cid`: "queued" while its event waits, "Saved" once
|
|
289
|
+
// the server acknowledged it. A host that does not report pending notes
|
|
290
|
+
// (an older extension) says Saved at once, as before.
|
|
291
|
+
const saidSaved = useCallback((cid) => {
|
|
292
|
+
const pending = controller.getSnapshot().recording?.sync.pendingNotes;
|
|
293
|
+
if (!cid || pending === undefined) {
|
|
294
|
+
setFlashCid(null);
|
|
295
|
+
sayFlash('saved');
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
clearTimeout(flashTimer.current);
|
|
299
|
+
setFlashCid(cid);
|
|
300
|
+
setFlash('queued');
|
|
301
|
+
}, [controller, sayFlash]);
|
|
302
|
+
const pendingNotes = rec?.sync.pendingNotes;
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
if (flashCid === null || pendingNotes === undefined || pendingNotes.includes(flashCid))
|
|
305
|
+
return;
|
|
306
|
+
setFlashCid(null);
|
|
307
|
+
sayFlash('saved');
|
|
308
|
+
}, [flashCid, pendingNotes, sayFlash]);
|
|
195
309
|
useEffect(() => () => clearTimeout(flashTimer.current), []);
|
|
196
310
|
// The frozen last minute lives while the report is composed (sheet open or
|
|
197
311
|
// marking); any other close drops it. A send already took it.
|
|
@@ -230,11 +344,12 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
230
344
|
dispatch({ type: 'send' });
|
|
231
345
|
runReport(r);
|
|
232
346
|
}, [controller, runReport, saidSaved]);
|
|
233
|
-
const onSend = useCallback((text
|
|
347
|
+
const onSend = useCallback((text) => {
|
|
234
348
|
const s = sheet;
|
|
235
349
|
setSheet(null);
|
|
236
350
|
if (!s)
|
|
237
351
|
return;
|
|
352
|
+
setParked(null);
|
|
238
353
|
// Images ride only while the host takes them (a policy switched off mid-draft drops them).
|
|
239
354
|
const held = controller.getSnapshot().canAttach === true ? (s.report ? reportImages : images) : [];
|
|
240
355
|
const attachments = held.length ? { attachments: held } : {};
|
|
@@ -242,23 +357,22 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
242
357
|
fileReport({ text, rect: s.pick?.rect ?? null, selector: s.pick?.selector ?? '', ...attachments });
|
|
243
358
|
return;
|
|
244
359
|
}
|
|
360
|
+
const link = { cid: newCid(), ...(refs.length ? { refs: refs.map((r) => r.cid) } : {}) };
|
|
245
361
|
if (s.pick) {
|
|
246
|
-
controller.annotate({ text, rect: s.pick.rect, selector: s.pick.selector,
|
|
247
|
-
setDraft('');
|
|
248
|
-
setImages([]);
|
|
249
|
-
saidSaved();
|
|
362
|
+
controller.annotate({ text, rect: s.pick.rect, selector: s.pick.selector, ...attachments, link });
|
|
250
363
|
}
|
|
251
364
|
else if (text || held.length) {
|
|
252
365
|
// An image can BE the note: text may be empty when it carries one.
|
|
253
|
-
|
|
254
|
-
controller.note(text, held);
|
|
255
|
-
else
|
|
256
|
-
controller.note(text);
|
|
257
|
-
setDraft('');
|
|
258
|
-
setImages([]);
|
|
259
|
-
saidSaved();
|
|
366
|
+
controller.note(text, held.length ? held : undefined, link);
|
|
260
367
|
}
|
|
261
|
-
|
|
368
|
+
else
|
|
369
|
+
return;
|
|
370
|
+
setDraft('');
|
|
371
|
+
setImages([]);
|
|
372
|
+
setRefs([]);
|
|
373
|
+
setNotesTick((t) => t + 1);
|
|
374
|
+
saidSaved(link.cid);
|
|
375
|
+
}, [sheet, controller, saidSaved, fileReport, images, reportImages, refs]);
|
|
262
376
|
const onStart = useCallback(() => {
|
|
263
377
|
if (!controller.getSnapshot().linked) {
|
|
264
378
|
beginLink();
|
|
@@ -330,6 +444,21 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
330
444
|
controller.holdReport?.(false);
|
|
331
445
|
dispatch({ type: 'dismiss' });
|
|
332
446
|
}, [failedReport, controller]);
|
|
447
|
+
// The notes sheet's doors (D6/D7): an edit is a new note replacing the newest
|
|
448
|
+
// version; a reference opens the note composer with the note as a ↳ chip.
|
|
449
|
+
const onEditNote = useCallback((row, text) => {
|
|
450
|
+
const link = { cid: newCid(), replaces: row.latestCid };
|
|
451
|
+
controller.note(text, undefined, link);
|
|
452
|
+
setNotesTick((t) => t + 1);
|
|
453
|
+
saidSaved(link.cid);
|
|
454
|
+
}, [controller, saidSaved]);
|
|
455
|
+
const onReferenceNote = useCallback((row) => {
|
|
456
|
+
setRefs((list) => (list.some((r) => r.cid === row.cid) ? list : [...list, row]));
|
|
457
|
+
composeNote();
|
|
458
|
+
}, [composeNote]);
|
|
459
|
+
const onRetryBuild = useCallback((sessionId) => {
|
|
460
|
+
controller.retryBuild?.(sessionId).catch((e) => console.warn('vitrinka: retry the board build —', errorText(e)));
|
|
461
|
+
}, [controller]);
|
|
333
462
|
const onRetry = useCallback(() => {
|
|
334
463
|
// A refused Start has nothing to retry (and must never run a Stop).
|
|
335
464
|
if (flow.face === 'failed' && flow.start)
|
|
@@ -554,14 +683,30 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
554
683
|
useFloat(menuRef, anchor, side, align, menuP.mounted);
|
|
555
684
|
const tucked = 'tuck' in dock.place;
|
|
556
685
|
const line = rec ? healthLine(rec.sync, now) : '';
|
|
557
|
-
|
|
686
|
+
// The details float (D4): the stats pill while the tray is unfolded, the
|
|
687
|
+
// health line whenever something is wrong, everything in verbose mode.
|
|
688
|
+
const detailOn = rec !== null &&
|
|
689
|
+
(snap.prefs.verbose || line !== '' || trayOpen) &&
|
|
690
|
+
!menu &&
|
|
691
|
+
!layerOpen &&
|
|
692
|
+
flow.face === 'none' &&
|
|
693
|
+
!dock.dragging &&
|
|
694
|
+
!tucked;
|
|
558
695
|
const detailP = usePresence(detailOn, 150);
|
|
559
696
|
useFloat(detailRef, anchor, side, align, detailP.mounted);
|
|
697
|
+
// A first recording, however it began (puck, shortcut, the hint), has taught it.
|
|
698
|
+
useEffect(() => {
|
|
699
|
+
if (rec && !hinted)
|
|
700
|
+
markHinted();
|
|
701
|
+
}, [rec, hinted, markHinted]);
|
|
702
|
+
const hintOn = !hinted && rec === null && snap.linked && following === null && !menu && !layerOpen && flow.face === 'none' && !dock.dragging && !tucked;
|
|
703
|
+
const hintP = usePresence(hintOn, 150);
|
|
704
|
+
useFloat(hintRef, anchor, side, align, hintP.mounted);
|
|
560
705
|
const lastRec = useRef(rec);
|
|
561
706
|
if (rec)
|
|
562
707
|
lastRec.current = rec;
|
|
563
708
|
const detailRec = rec ?? lastRec.current;
|
|
564
|
-
const sheetEl = shownSheet && portal ? (_jsxs("div", { className: "hud", "data-size": snap.prefs.size, children: [portal.own ? _jsx("style", { children: HUD_CSS }) : null, _jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: _jsx(Sheet, { className: `${motionCls} ${sheetP.cls}`, origin: layer.origin, title: shownSheet.title, ctx: shownSheet.ctx, pick: shownSheet.pick
|
|
709
|
+
const sheetEl = shownSheet && portal ? (_jsxs("div", { className: "hud", "data-size": snap.prefs.size, children: [portal.own ? _jsx("style", { children: HUD_CSS }) : null, _jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: shownSheet.notes ? (_jsx(NotesSheet, { className: `${motionCls} ${sheetP.cls}`, origin: layer.origin, rows: rows, now: now, onEdit: onEditNote, onReference: onReferenceNote, onClose: closeSheet })) : (_jsx(Sheet, { className: `${motionCls} ${sheetP.cls}`, origin: layer.origin, title: shownSheet.title, ctx: shownSheet.ctx, head: shownSheet.pick && !shownSheet.report ? _jsx(PickHead, { pick: shownSheet.pick, crop: shownSheet.crop ?? null, onReselect: reselect }) : null, below: !shownSheet.report && refs.length ? (_jsx(RefChips, { refs: refs, onRemove: (cid) => setRefs((list) => list.filter((r) => r.cid !== cid)) })) : null, draft: shownSheet.report ? reportDraft : draft, onDraft: shownSheet.report ? setReportDraft : setDraft, onSend: onSend, onClose: closeSheet, kind: shownSheet.report ? 'report' : shownSheet.pick ? 'annotation' : 'note',
|
|
565
710
|
// `|| 0`: a host's snapshot from before the sheet size lacks the fields.
|
|
566
711
|
sheetW: snap.prefs.sheetW || 0, sheetH: snap.prefs.sheetH || 0, room: layer.room,
|
|
567
712
|
// A phone's bottom sheet spans the viewport: its grip sizes the cap alone.
|
|
@@ -571,7 +716,7 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
571
716
|
? shownSheet.report
|
|
572
717
|
? { images: reportImages, onImages: setReportImages, preparing: reportPreparing, onPreparing: setReportPreparing }
|
|
573
718
|
: { images, onImages: setImages, preparing, onPreparing: setPreparing }
|
|
574
|
-
: {}) }, shownSheet.report ? 'report' : 'note') })] })) : null;
|
|
719
|
+
: {}) }, shownSheet.report ? 'report' : 'note')) })] })) : null;
|
|
575
720
|
// Stable phrases only: a live region re-announces on every text change.
|
|
576
721
|
const hs = rec?.sync.state ?? null;
|
|
577
722
|
const status = !rec
|
|
@@ -590,7 +735,37 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
590
735
|
? { 'data-tuck': place.tuck, style: { '--ty': String(place.y) } }
|
|
591
736
|
: { 'data-row': rowOf(place.spot), 'data-col': colOf(place.spot) };
|
|
592
737
|
// A remote shows nothing (D7: one pill per document) — except a refused
|
|
593
|
-
// Start's face, which says why the pill steps aside until it is dismissed
|
|
594
|
-
|
|
595
|
-
|
|
738
|
+
// Start's face, which says why the pill steps aside until it is dismissed,
|
|
739
|
+
// and a leader in ANOTHER document: this one would otherwise show no
|
|
740
|
+
// recorder at all, so the pill says where the recording is (HUD polish D11).
|
|
741
|
+
const hidden = following !== null && snap.followingElsewhere !== true && !(flow.face === 'failed' && flow.start === true);
|
|
742
|
+
return (_jsxs("div", { ref: rootRef, className: "hud", "data-size": snap.prefs.size, "data-spot": 'spot' in place ? place.spot : undefined, ...(hidden ? { 'data-following': following, style: { display: 'none' } } : {}), children: [_jsx("style", { children: HUD_CSS }), annotating && (rec || marking) ? _jsx(AnnotateOverlay, { onPick: onPick, onCancel: cancelAnnotate }) : null, _jsxs("div", { ref: dock.ref, className: dock.dragging ? 'dock dragging' : 'dock', ...dockAttrs, onClickCapture: dock.onClickCapture, children: [_jsx(RecorderPill, { snap: snap, now: now, flow: flow, flash: flash, composing: sheet !== null, starting: starting, menuOpen: menu, place: place, dragging: dock.dragging, handle: dock.handle, pillRef: pillRef, onMove: dock.moveTo, onLink: beginLink, onStart: onStart, onPause: onPause, onNote: openNote, onAnnotate: toggleAnnotate, onMenu: toggleMenu, onAskStop: askStop, onConfirm: onConfirm, onCancel: onCancel, onRetry: onRetry, onDismiss: onDismiss, onRetryBuild: onRetryBuild, canRetryBuild: typeof controller.retryBuild === 'function', onTrayOpen: setTrayOpen, ...(controller.listNotes ? { notesCount: rows.length } : {}), onNotes: openNotes }), parked && !sheet && rec && !annotating && 'spot' in place ? (_jsx(DraftDrop, { text: draft, crop: parked.crop ?? null, side: colOf(place.spot) === 'r' ? 'start' : 'end', onResume: () => {
|
|
743
|
+
setSheet(parked);
|
|
744
|
+
setParked(null);
|
|
745
|
+
} })) : null] }), menuP.mounted ? (_jsx(Menu, { snap: snap, now: now, place: place, className: `grow ${menuP.cls}`, menuRef: menuRef, onClose: () => setMenu(false), onMove: dock.moveTo, onSize: (size) => void controller.setPrefs({ size }), onVerbose: (verbose) => void controller.setPrefs({ verbose }), onAskUnlink: askUnlink, onLink: beginLink, ...(snap.canReport && controller.report ? { onReport: openReport } : {}) })) : null, _jsx(Tooltip, { root: rootRef, side: side, suppressed: dock.dragging || menu || layerOpen }), detailP.mounted && detailRec ? (_jsx("div", { ref: detailRef, className: [
|
|
746
|
+
'float detail grow',
|
|
747
|
+
detailP.cls,
|
|
748
|
+
snap.prefs.verbose ? '' : 'line',
|
|
749
|
+
line ? 'bad' : '',
|
|
750
|
+
snap.prefs.verbose || line ? '' : 'statsf',
|
|
751
|
+
]
|
|
752
|
+
.filter(Boolean)
|
|
753
|
+
.join(' '), "data-e2e": "recorder-detail", "aria-hidden": "true", children: snap.prefs.verbose ? (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "events" }), _jsx("dd", { children: detailRec.sync.events }), _jsx("dt", { children: "queue" }), _jsxs("dd", { children: [detailRec.sync.queued, detailRec.sync.chunks ? ` (${detailRec.sync.chunks} chunk${detailRec.sync.chunks === 1 ? '' : 's'})` : ''] }), _jsx("dt", { children: "last sync" }), _jsx("dd", { children: detailRec.sync.lastSyncAt === null ? '—' : `${fmtAgo(now - detailRec.sync.lastSyncAt)} · ${detailRec.sync.state}` }), _jsx("dt", { children: "server seq" }), _jsx("dd", { children: Math.max(0, detailRec.sync.serverMaxSeq) }), _jsx("dt", { children: "session" }), _jsx("dd", { children: detailRec.sessionId }), _jsx("dt", { children: "recorder" }), _jsx("dd", { children: snap.version })] }), line ? _jsx("div", { className: "warnline", children: line }) : null] })) : line ? (line) : (_jsx(Stats, { sync: detailRec.sync, now: now })) })) : null, hintP.mounted ? (_jsxs("div", { ref: hintRef, className: `float firstrun pop grow ${hintP.cls}`, role: "dialog", "aria-label": "Record this session", children: [_jsx("b", { children: "Record this session" }), _jsx("p", { children: "Clicks, pages, network and your notes go to a vitrinka board. Nothing is captured until you start." }), _jsxs("div", { className: "row2", children: [_jsx("button", { type: "button", className: "fb primary", onClick: () => {
|
|
754
|
+
markHinted();
|
|
755
|
+
onStart();
|
|
756
|
+
}, children: "Start" }), _jsx("button", { type: "button", className: "fb", onClick: markHinted, children: "Got it" })] })] })) : null, sheetEl && portal ? createPortal(sheetEl, portal.mount) : null, linkP.mounted && shownLink ? (_jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: _jsx(LinkSheet, { className: `${motionCls} ${linkP.cls}`, origin: layer.origin, phase: shownLink.phase, start: shownLink.flow?.start ?? null, error: shownLink.error, onRetry: beginLink, onClose: closeLink }) })) : null, _jsx("div", { className: "sr", role: "status", "aria-live": "polite", children: status })] }));
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* What an annotation points at (D9/D15): the host's crop of it when there
|
|
760
|
+
* is one (the extension), else just its size · route — never a made-up
|
|
761
|
+
* picture — and Reselect, which keeps the draft.
|
|
762
|
+
*/
|
|
763
|
+
function PickHead({ pick, crop, onReselect }) {
|
|
764
|
+
const what = pick.selector ? 'Element' : 'Region';
|
|
765
|
+
const size = `${Math.round(pick.rect.w)}×${Math.round(pick.rect.h)}`;
|
|
766
|
+
return (_jsxs("div", { className: crop ? 'selhead has-crop' : 'selhead', "data-e2e": "pick-head", children: [crop ? _jsx("img", { className: "selcrop", src: crop, alt: `The picked ${what.toLowerCase()}` }) : _jsx(AnnotateIcon, {}), _jsxs("span", { className: "selmeta", children: [_jsxs("b", { children: [what, " ", size] }), _jsx("span", { children: pick.selector || location.pathname })] }), _jsx("button", { type: "button", className: "fb", onClick: onReselect, children: "Reselect" })] }));
|
|
767
|
+
}
|
|
768
|
+
/** The notes a draft references (D7): ↳ chips, each removable. */
|
|
769
|
+
function RefChips({ refs, onRemove }) {
|
|
770
|
+
return (_jsx("ul", { className: "refs", "aria-label": "References", children: refs.map((r) => (_jsxs("li", { className: "ref", children: [_jsx(ReplyIcon, {}), _jsxs("span", { className: "t", children: ["re ", _jsxs("b", { children: ["\u2116", r.number] }), " \u00B7 ", r.text || '(no text)'] }), _jsx("button", { type: "button", "aria-label": `Remove the reference to №${r.number}`, onClick: () => onRemove(r.cid), children: _jsx(CloseIcon, {}) })] }, r.cid))) }));
|
|
596
771
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The notes sheet (recorder HUD polish D5/D12): this recording's notes and
|
|
3
|
+
* annotations in the board annotation island's anatomy, ported onto the
|
|
4
|
+
* HUD's tokens — a LIST face (№ · kind · age kicker, text, state dot; a
|
|
5
|
+
* filter; ← → ↑ ↓ walk, ↵ opens) and a SPLIT face (the № rail beside the
|
|
6
|
+
* open note: its versions, an edit box, ↳ reference). An edit is a new note
|
|
7
|
+
* that replaces the newest version (D6); a reference opens the note composer
|
|
8
|
+
* with the note as a ↳ chip (D7). Rows come from `noteRows` (notes-rows.ts).
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactElement } from 'react';
|
|
11
|
+
import { type NoteRow } from './notes-rows';
|
|
12
|
+
export interface NotesSheetProps {
|
|
13
|
+
/** Presence classes (`grow`/`rise` + `is-open`/`is-closing`). */
|
|
14
|
+
className: string;
|
|
15
|
+
origin: string;
|
|
16
|
+
rows: readonly NoteRow[];
|
|
17
|
+
now: number;
|
|
18
|
+
onEdit: (row: NoteRow, text: string) => void;
|
|
19
|
+
onReference: (row: NoteRow) => void;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function NotesSheet({ className, origin, rows, now, onEdit, onReference, onClose }: NotesSheetProps): ReactElement;
|
|
23
|
+
/** The notes sheet's CSS (appended to HUD_CSS): the island's grammar on the HUD's tokens. */
|
|
24
|
+
export declare const NOTES_CSS = "\n.pop.notes { width:min(calc(400px * var(--s)), calc(100vw - 24px)); padding:0 0 8px; overflow:hidden; }\n.pop.notes.split { width:min(calc(460px * var(--s)), calc(100vw - 24px)); }\n.notes .pop-head { height:44px; padding:0 8px 0 16px; }\n.n-title { font-weight:700; font-size:calc(var(--fs) + 2.5px); letter-spacing:-.02em; color:var(--fg); }\n.n-count, .n-kick { font:500 var(--fs-s)/1.4 ui-monospace, \"SF Mono\", Menlo, monospace; letter-spacing:.06em; text-transform:uppercase; color:var(--fg-3); }\n.n-count { margin-left:6px; }\n.n-head, .n-acts { display:flex; align-items:center; gap:6px; min-width:0; }\n.n-head .n-kick { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }\n.n-word { all:unset; cursor:pointer; display:inline-flex; align-items:center; gap:4px; padding:5px 7px; border-radius:6px;\n font:500 var(--fs-s)/1 ui-monospace, \"SF Mono\", Menlo, monospace; letter-spacing:.06em; text-transform:uppercase; color:var(--fg-2); }\n.n-word:focus-visible { outline:2px solid var(--rec); outline-offset:-2px; }\n@media (hover: hover) { .n-word:hover { color:var(--fg); background:var(--ink-2); } }\n.n-filter { display:flex; gap:4px; padding:0 12px 8px; }\n.n-filter button { all:unset; cursor:pointer; padding:4px 9px; border-radius:999px; font-size:calc(var(--fs) - .5px); font-weight:600; color:var(--fg-3); }\n.n-filter button[aria-pressed=\"true\"] { background:var(--ink-3); color:var(--fg); }\n.n-filter button:focus-visible { outline:2px solid var(--rec); outline-offset:-2px; }\n.n-list { max-height:min(60vh, calc(360px * var(--s))); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }\n.n-row { position:relative; }\n.n-row + .n-row { border-top:1px solid rgba(255,255,255,.07); }\n.n-row.on::before { content:\"\"; position:absolute; left:6px; top:50%; width:4px; height:4px; margin-top:-2px; border-radius:9px; background:var(--rec); }\n.n-open { all:unset; box-sizing:border-box; cursor:pointer; width:100%; display:grid; grid-template-columns:calc(44px * var(--s)) minmax(0,1fr) 8px;\n gap:12px; align-items:center; padding:10px 16px; }\n.n-open:focus-visible { outline:2px solid var(--rec); outline-offset:-2px; border-radius:8px; }\n@media (hover: hover) { .n-open:hover { background:rgba(255,255,255,.04); } }\n.n-face { display:grid; place-items:center; height:calc(32px * var(--s)); border-radius:5px; background:rgba(0,0,0,.28);\n box-shadow:inset 0 0 0 1.5px rgba(255,59,87,.6); color:var(--rec); }\n.n-face.note { box-shadow:inset 0 0 0 1px var(--edge); color:var(--fg-3); }\n.n-lines { display:flex; flex-direction:column; gap:2px; min-width:0; }\n.n-text { color:var(--fg); font-size:calc(var(--fs) + .5px); line-height:1.35; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }\n.n-dot { width:7px; height:7px; border-radius:50%; }\n.n-dot.sent { background:var(--ok); }\n.n-dot.queued { background:var(--warn); }\n.n-dot.edited { background:#8fb8ff; }\n.n-empty { margin:4px 16px 8px; font-size:var(--fs-s); color:var(--fg-3); }\n.n-split { display:flex; min-height:0; }\n.n-rail { flex:0 0 calc(60px * var(--s)); display:flex; flex-direction:column; align-items:center; gap:7px; padding:4px 0 8px;\n border-right:1px solid rgba(255,255,255,.08); max-height:min(60vh, calc(380px * var(--s))); overflow-y:auto; scrollbar-width:none; }\n.n-th { all:unset; cursor:pointer; position:relative; display:grid; place-items:center; width:calc(40px * var(--s)); height:calc(30px * var(--s));\n border-radius:7px; background:rgba(0,0,0,.28); box-shadow:inset 0 0 0 1px var(--edge); color:var(--fg-3); opacity:.7; }\n.n-th b { position:absolute; left:4px; bottom:2px; font:600 9px/1 ui-monospace, Menlo, monospace; color:var(--fg-2); }\n.n-th.on { opacity:1; box-shadow:0 0 0 2px var(--rec); color:var(--fg); }\n.n-th:focus-visible { outline:2px solid var(--rec); outline-offset:2px; }\n.n-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:8px; padding:4px 14px 4px;\n max-height:min(60vh, calc(380px * var(--s))); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }\n.n-meta { font-size:var(--fs-s); color:var(--fg-3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }\n.n-ver { padding:8px 10px; border-radius:9px; background:rgba(0,0,0,.22); box-shadow:inset 0 0 0 1px var(--edge);\n font-size:calc(var(--fs) + .5px); line-height:1.4; color:var(--fg); white-space:pre-wrap; overflow-wrap:anywhere; }\n.n-ver .n-kick { display:block; margin-bottom:3px; }\n.n-ver.old { color:var(--fg-3); text-decoration:line-through; text-decoration-color:rgba(244,239,234,.25); }\n.n-ver.old .n-kick { text-decoration:none; }\ntextarea.n-edit { margin-top:0; min-height:calc(44px * var(--s)); resize:vertical; overflow-y:auto; }\n.n-body .row { margin-top:0; }\n";
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The notes sheet (recorder HUD polish D5/D12): this recording's notes and
|
|
4
|
+
* annotations in the board annotation island's anatomy, ported onto the
|
|
5
|
+
* HUD's tokens — a LIST face (№ · kind · age kicker, text, state dot; a
|
|
6
|
+
* filter; ← → ↑ ↓ walk, ↵ opens) and a SPLIT face (the № rail beside the
|
|
7
|
+
* open note: its versions, an edit box, ↳ reference). An edit is a new note
|
|
8
|
+
* that replaces the newest version (D6); a reference opens the note composer
|
|
9
|
+
* with the note as a ↳ chip (D7). Rows come from `noteRows` (notes-rows.ts).
|
|
10
|
+
*/
|
|
11
|
+
import { useEffect, useRef, useState } from 'react';
|
|
12
|
+
import { AnnotateIcon, CheckIcon, CloseIcon, PencilIcon, ReplyIcon } from './icons';
|
|
13
|
+
import { filterRows, walkRows } from './notes-rows';
|
|
14
|
+
import { fmtAgo } from './status';
|
|
15
|
+
const FILTERS = [
|
|
16
|
+
{ value: 'all', label: 'all' },
|
|
17
|
+
{ value: 'regions', label: 'regions' },
|
|
18
|
+
{ value: 'notes', label: 'notes' },
|
|
19
|
+
];
|
|
20
|
+
function kicker(r, now) {
|
|
21
|
+
const edited = r.versions.length > 1 ? ' · edited' : '';
|
|
22
|
+
return `№${r.number} · ${r.region ? 'region' : 'note'} · ${fmtAgo(now - r.at)}${edited}`;
|
|
23
|
+
}
|
|
24
|
+
export function NotesSheet({ className, origin, rows, now, onEdit, onReference, onClose }) {
|
|
25
|
+
const [filter, setFilter] = useState('all');
|
|
26
|
+
const [focused, setFocused] = useState(null);
|
|
27
|
+
const [open, setOpen] = useState(null);
|
|
28
|
+
const [edit, setEdit] = useState('');
|
|
29
|
+
const list = useRef(null);
|
|
30
|
+
const visible = filterRows(rows, filter);
|
|
31
|
+
// The one tabbable row: the focused one while the filter shows it, else the first.
|
|
32
|
+
const tabCid = visible.some((r) => r.cid === focused) ? focused : (visible[0]?.cid ?? null);
|
|
33
|
+
const row = open ? rows.find((r) => r.cid === open) : undefined;
|
|
34
|
+
// Opening a note puts its newest text in the edit box — only when ANOTHER
|
|
35
|
+
// note opens: a sent edit of this one must not reset the box under the hand.
|
|
36
|
+
const openText = row?.text ?? '';
|
|
37
|
+
const opened = useRef(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (opened.current === open)
|
|
40
|
+
return;
|
|
41
|
+
opened.current = open;
|
|
42
|
+
setEdit(openText);
|
|
43
|
+
}, [open, openText]);
|
|
44
|
+
const walk = (e) => {
|
|
45
|
+
// Esc steps back from an open note, else closes the sheet — from any control in it.
|
|
46
|
+
if (e.key === 'Escape') {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
if (open)
|
|
50
|
+
setOpen(null);
|
|
51
|
+
else
|
|
52
|
+
onClose();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const step = e.key === 'ArrowDown' || e.key === 'ArrowRight' ? 1 : e.key === 'ArrowUp' || e.key === 'ArrowLeft' ? -1 : 0;
|
|
56
|
+
if (!step)
|
|
57
|
+
return;
|
|
58
|
+
if (e.target instanceof HTMLTextAreaElement)
|
|
59
|
+
return;
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
const next = walkRows(visible, open ?? focused, step);
|
|
62
|
+
if (open)
|
|
63
|
+
setOpen(next);
|
|
64
|
+
else {
|
|
65
|
+
setFocused(next);
|
|
66
|
+
if (next)
|
|
67
|
+
list.current?.querySelector(`[data-cid="${next}"]`)?.focus();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const save = () => {
|
|
71
|
+
if (!row)
|
|
72
|
+
return;
|
|
73
|
+
const text = edit.trim();
|
|
74
|
+
if (!text || text === row.text)
|
|
75
|
+
return;
|
|
76
|
+
onEdit(row, text);
|
|
77
|
+
};
|
|
78
|
+
if (row) {
|
|
79
|
+
return (_jsxs("div", { className: `pop notes split ${className}`, style: { transformOrigin: origin }, role: "dialog", "aria-label": `Note №${row.number}`, onKeyDown: walk, children: [_jsxs("div", { className: "pop-head", children: [_jsxs("span", { className: "n-head", children: [_jsx("button", { type: "button", className: "n-word", "aria-label": "Back to the list", onClick: () => setOpen(null), children: "\u2039" }), _jsx("span", { className: "n-kick", children: kicker(row, now) })] }), _jsxs("span", { className: "n-acts", children: [_jsxs("button", { type: "button", className: "n-word", onClick: () => onReference(row), children: [_jsx(ReplyIcon, {}), " reference"] }), _jsx("button", { type: "button", className: "closeb", "aria-label": "Close", onClick: onClose, children: _jsx(CloseIcon, {}) })] })] }), _jsxs("div", { className: "n-split", children: [_jsxs("nav", { className: "n-rail", "aria-label": "Notes", children: [_jsxs("button", { type: "button", className: "n-word", onClick: () => setOpen(null), children: ["all ", rows.length] }), visible.map((r) => (_jsxs("button", { type: "button", className: r.cid === row.cid ? 'n-th on' : 'n-th', "aria-current": r.cid === row.cid || undefined, "aria-label": `№${r.number}`, onClick: () => setOpen(r.cid), children: [r.region ? _jsx(AnnotateIcon, {}) : _jsx(PencilIcon, {}), _jsx("b", { children: r.number })] }, r.cid)))] }), _jsxs("div", { className: "n-body", children: [_jsxs("div", { className: "n-meta", children: [row.region && row.w !== undefined && row.h !== undefined ? `Region ${row.w}×${row.h} · ` : '', row.route || '/'] }), row.versions.map((v, i) => (_jsxs("div", { className: i === row.versions.length - 1 ? 'n-ver' : 'n-ver old', children: [_jsxs("span", { className: "n-kick", children: ["v", i + 1, " \u00B7 ", fmtAgo(now - v.at), i === row.versions.length - 1 ? ' · current' : ''] }), v.text || '(no text)'] }, v.cid))), _jsx("textarea", { className: "n-edit", "aria-label": `Edit note №${row.number}`, value: edit, onChange: (e) => setEdit(e.target.value), onKeyDown: (e) => {
|
|
80
|
+
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
save();
|
|
83
|
+
}
|
|
84
|
+
else if (e.key === 'Escape') {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
setOpen(null);
|
|
88
|
+
}
|
|
89
|
+
} }), _jsxs("div", { className: "row nodest", children: [_jsxs("span", { className: "ctx", children: ["\u21A9 save as v", row.versions.length + 1, " \u00B7 esc back"] }), _jsxs("button", { type: "button", className: "sendb", "aria-disabled": !edit.trim() || edit.trim() === row.text || undefined, onClick: save, children: [_jsx(CheckIcon, {}), " Save edit"] })] })] })] })] }));
|
|
90
|
+
}
|
|
91
|
+
return (_jsxs("div", { className: `pop notes ${className}`, style: { transformOrigin: origin }, role: "dialog", "aria-label": "Notes", onKeyDown: walk, children: [_jsxs("div", { className: "pop-head", children: [_jsxs("span", { className: "n-title", children: ["Notes ", _jsx("span", { className: "n-count", children: rows.length })] }), _jsx("button", { type: "button", className: "closeb", "aria-label": "Close", onClick: onClose, children: _jsx(CloseIcon, {}) })] }), _jsx("div", { className: "n-filter", role: "group", "aria-label": "Show", children: FILTERS.map((f) => (_jsxs("button", { type: "button", "aria-pressed": filter === f.value, onClick: () => setFilter(f.value), children: [f.label, " ", filterRows(rows, f.value).length] }, f.value))) }), visible.length === 0 ? (_jsx("p", { className: "n-empty", children: rows.length === 0 ? 'Notes and annotations you send while recording show here.' : `No ${filter} yet.` })) : (_jsx("div", { ref: list, className: "n-list", role: "list", "aria-label": "Notes", children: visible.map((r) => (_jsx("div", { role: "listitem", className: r.cid === focused ? 'n-row on' : 'n-row', children: _jsxs("button", { type: "button", className: "n-open", "data-cid": r.cid, tabIndex: r.cid === tabCid ? 0 : -1, "aria-label": `${kicker(r, now)} — ${r.text}`, onFocus: () => setFocused(r.cid), onClick: () => setOpen(r.cid), children: [_jsx("span", { className: r.region ? 'n-face' : 'n-face note', children: r.region ? _jsx(AnnotateIcon, {}) : _jsx(PencilIcon, {}) }), _jsxs("span", { className: "n-lines", children: [_jsx("span", { className: "n-kick", children: kicker(r, now) }), _jsx("span", { className: "n-text", children: r.text || '(no text)' })] }), _jsx("i", { className: r.queued ? 'n-dot queued' : r.versions.length > 1 ? 'n-dot edited' : 'n-dot sent', "aria-hidden": "true" })] }) }, r.cid))) }))] }));
|
|
92
|
+
}
|
|
93
|
+
/** The notes sheet's CSS (appended to HUD_CSS): the island's grammar on the HUD's tokens. */
|
|
94
|
+
export const NOTES_CSS = `
|
|
95
|
+
.pop.notes { width:min(calc(400px * var(--s)), calc(100vw - 24px)); padding:0 0 8px; overflow:hidden; }
|
|
96
|
+
.pop.notes.split { width:min(calc(460px * var(--s)), calc(100vw - 24px)); }
|
|
97
|
+
.notes .pop-head { height:44px; padding:0 8px 0 16px; }
|
|
98
|
+
.n-title { font-weight:700; font-size:calc(var(--fs) + 2.5px); letter-spacing:-.02em; color:var(--fg); }
|
|
99
|
+
.n-count, .n-kick { font:500 var(--fs-s)/1.4 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing:.06em; text-transform:uppercase; color:var(--fg-3); }
|
|
100
|
+
.n-count { margin-left:6px; }
|
|
101
|
+
.n-head, .n-acts { display:flex; align-items:center; gap:6px; min-width:0; }
|
|
102
|
+
.n-head .n-kick { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
103
|
+
.n-word { all:unset; cursor:pointer; display:inline-flex; align-items:center; gap:4px; padding:5px 7px; border-radius:6px;
|
|
104
|
+
font:500 var(--fs-s)/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing:.06em; text-transform:uppercase; color:var(--fg-2); }
|
|
105
|
+
.n-word:focus-visible { outline:2px solid var(--rec); outline-offset:-2px; }
|
|
106
|
+
@media (hover: hover) { .n-word:hover { color:var(--fg); background:var(--ink-2); } }
|
|
107
|
+
.n-filter { display:flex; gap:4px; padding:0 12px 8px; }
|
|
108
|
+
.n-filter button { all:unset; cursor:pointer; padding:4px 9px; border-radius:999px; font-size:calc(var(--fs) - .5px); font-weight:600; color:var(--fg-3); }
|
|
109
|
+
.n-filter button[aria-pressed="true"] { background:var(--ink-3); color:var(--fg); }
|
|
110
|
+
.n-filter button:focus-visible { outline:2px solid var(--rec); outline-offset:-2px; }
|
|
111
|
+
.n-list { max-height:min(60vh, calc(360px * var(--s))); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
|
|
112
|
+
.n-row { position:relative; }
|
|
113
|
+
.n-row + .n-row { border-top:1px solid rgba(255,255,255,.07); }
|
|
114
|
+
.n-row.on::before { content:""; position:absolute; left:6px; top:50%; width:4px; height:4px; margin-top:-2px; border-radius:9px; background:var(--rec); }
|
|
115
|
+
.n-open { all:unset; box-sizing:border-box; cursor:pointer; width:100%; display:grid; grid-template-columns:calc(44px * var(--s)) minmax(0,1fr) 8px;
|
|
116
|
+
gap:12px; align-items:center; padding:10px 16px; }
|
|
117
|
+
.n-open:focus-visible { outline:2px solid var(--rec); outline-offset:-2px; border-radius:8px; }
|
|
118
|
+
@media (hover: hover) { .n-open:hover { background:rgba(255,255,255,.04); } }
|
|
119
|
+
.n-face { display:grid; place-items:center; height:calc(32px * var(--s)); border-radius:5px; background:rgba(0,0,0,.28);
|
|
120
|
+
box-shadow:inset 0 0 0 1.5px rgba(255,59,87,.6); color:var(--rec); }
|
|
121
|
+
.n-face.note { box-shadow:inset 0 0 0 1px var(--edge); color:var(--fg-3); }
|
|
122
|
+
.n-lines { display:flex; flex-direction:column; gap:2px; min-width:0; }
|
|
123
|
+
.n-text { color:var(--fg); font-size:calc(var(--fs) + .5px); line-height:1.35; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
|
|
124
|
+
.n-dot { width:7px; height:7px; border-radius:50%; }
|
|
125
|
+
.n-dot.sent { background:var(--ok); }
|
|
126
|
+
.n-dot.queued { background:var(--warn); }
|
|
127
|
+
.n-dot.edited { background:#8fb8ff; }
|
|
128
|
+
.n-empty { margin:4px 16px 8px; font-size:var(--fs-s); color:var(--fg-3); }
|
|
129
|
+
.n-split { display:flex; min-height:0; }
|
|
130
|
+
.n-rail { flex:0 0 calc(60px * var(--s)); display:flex; flex-direction:column; align-items:center; gap:7px; padding:4px 0 8px;
|
|
131
|
+
border-right:1px solid rgba(255,255,255,.08); max-height:min(60vh, calc(380px * var(--s))); overflow-y:auto; scrollbar-width:none; }
|
|
132
|
+
.n-th { all:unset; cursor:pointer; position:relative; display:grid; place-items:center; width:calc(40px * var(--s)); height:calc(30px * var(--s));
|
|
133
|
+
border-radius:7px; background:rgba(0,0,0,.28); box-shadow:inset 0 0 0 1px var(--edge); color:var(--fg-3); opacity:.7; }
|
|
134
|
+
.n-th b { position:absolute; left:4px; bottom:2px; font:600 9px/1 ui-monospace, Menlo, monospace; color:var(--fg-2); }
|
|
135
|
+
.n-th.on { opacity:1; box-shadow:0 0 0 2px var(--rec); color:var(--fg); }
|
|
136
|
+
.n-th:focus-visible { outline:2px solid var(--rec); outline-offset:2px; }
|
|
137
|
+
.n-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:8px; padding:4px 14px 4px;
|
|
138
|
+
max-height:min(60vh, calc(380px * var(--s))); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
|
|
139
|
+
.n-meta { font-size:var(--fs-s); color:var(--fg-3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
140
|
+
.n-ver { padding:8px 10px; border-radius:9px; background:rgba(0,0,0,.22); box-shadow:inset 0 0 0 1px var(--edge);
|
|
141
|
+
font-size:calc(var(--fs) + .5px); line-height:1.4; color:var(--fg); white-space:pre-wrap; overflow-wrap:anywhere; }
|
|
142
|
+
.n-ver .n-kick { display:block; margin-bottom:3px; }
|
|
143
|
+
.n-ver.old { color:var(--fg-3); text-decoration:line-through; text-decoration-color:rgba(244,239,234,.25); }
|
|
144
|
+
.n-ver.old .n-kick { text-decoration:none; }
|
|
145
|
+
textarea.n-edit { margin-top:0; min-height:calc(44px * var(--s)); resize:vertical; overflow-y:auto; }
|
|
146
|
+
.n-body .row { margin-top:0; }
|
|
147
|
+
`;
|