@vitrinka/web 0.2.0 → 0.2.2
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 +34 -0
- package/README.md +3 -3
- package/build/hud.iife.js +6 -6
- package/build/recorder/capture/click.d.ts +6 -0
- package/build/recorder/capture/click.js +15 -4
- package/build/recorder/capture/redact.d.ts +9 -0
- package/build/recorder/capture/redact.js +17 -13
- package/build/recorder/capture/rrweb.js +3 -2
- package/build/recorder/capture/selector.d.ts +7 -1
- package/build/recorder/capture/selector.js +14 -4
- package/build/recorder/hud/AnnotateOverlay.js +19 -23
- package/build/recorder/hud/Hud.js +6 -6
- package/build/recorder/hud/controller.d.ts +1 -1
- package/build/recorder/hud/listen.d.ts +24 -0
- package/build/recorder/hud/listen.js +27 -0
- package/build/recorder/hud/useDock.js +2 -2
- package/build/recorder/link.js +1 -1
- package/build/recorder/session.d.ts +2 -2
- package/build/recorder/session.js +3 -3
- package/package.json +3 -3
|
@@ -7,6 +7,12 @@ export declare function imageRect(el: Element): {
|
|
|
7
7
|
w: number;
|
|
8
8
|
h: number;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* A click's `text` under the active rules: '' when a `maskAllText` policy
|
|
12
|
+
* has rrweb mask every text node, otherwise `elementText` (no form-field
|
|
13
|
+
* values, nothing rr-masked) through the free-text scrub.
|
|
14
|
+
*/
|
|
15
|
+
export declare function clickText(el: Element): string;
|
|
10
16
|
export interface ClickLaneOptions {
|
|
11
17
|
/** True while the HUD owns the pointer (annotate mode) or the target is HUD chrome. */
|
|
12
18
|
ignore: (target: EventTarget | null) => boolean;
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* Click lane — a capture-phase document listener (sees clicks the app
|
|
3
3
|
* swallows). Shape matches the extension's content script exactly:
|
|
4
4
|
* `{selector, text, rect}` — `shortSelector` (id > data-testid > a ≤4-hop
|
|
5
|
-
* tag.class path), the element's text (redacted, 80 chars
|
|
6
|
-
* rect in device pixels
|
|
5
|
+
* tag.class path), the element's text (`clickText`: redacted, 80 chars,
|
|
6
|
+
* never more than the DOM lane shows) and its bounding rect in device pixels
|
|
7
|
+
* — plus `route`.
|
|
7
8
|
*/
|
|
8
9
|
import { pushEvent } from '../queue';
|
|
9
10
|
import { currentRoute } from '../state';
|
|
10
|
-
import { redactText } from './redact';
|
|
11
|
+
import { maskDirectives, redactText } from './redact';
|
|
11
12
|
import { elementText, shortSelector } from './selector';
|
|
12
13
|
export { elementText, shortSelector };
|
|
13
14
|
const CLICKABLE = 'a,button,[role=button],input,select,textarea,label';
|
|
@@ -22,6 +23,16 @@ export function imageRect(el) {
|
|
|
22
23
|
h: Math.round(r.height * s),
|
|
23
24
|
};
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A click's `text` under the active rules: '' when a `maskAllText` policy
|
|
28
|
+
* has rrweb mask every text node, otherwise `elementText` (no form-field
|
|
29
|
+
* values, nothing rr-masked) through the free-text scrub.
|
|
30
|
+
*/
|
|
31
|
+
export function clickText(el) {
|
|
32
|
+
if (maskDirectives().maskAllText)
|
|
33
|
+
return '';
|
|
34
|
+
return redactText(elementText(el)) ?? '';
|
|
35
|
+
}
|
|
25
36
|
/** Install the click lane; returns the uninstaller. */
|
|
26
37
|
export function installClickLane(opts) {
|
|
27
38
|
const onClick = (e) => {
|
|
@@ -34,7 +45,7 @@ export function installClickLane(opts) {
|
|
|
34
45
|
return;
|
|
35
46
|
pushEvent('click', {
|
|
36
47
|
selector: shortSelector(el),
|
|
37
|
-
text:
|
|
48
|
+
text: clickText(el),
|
|
38
49
|
rect: imageRect(el),
|
|
39
50
|
route: currentRoute.pathname,
|
|
40
51
|
}, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Capture layers import the bound helpers below so every call site stays a
|
|
12
12
|
* one-liner and can never forget to pass the rules.
|
|
13
13
|
*/
|
|
14
|
+
import type { eventWithTime } from '@rrweb/types';
|
|
14
15
|
import { type MaskDirectives, type RedactionPolicy, type RuleSet } from '@vitrinka/redact';
|
|
15
16
|
export { isSecretKey, REDACTED, type RedactionPolicy } from '@vitrinka/redact';
|
|
16
17
|
/**
|
|
@@ -32,6 +33,14 @@ export declare function redactText(text: string | undefined): string | undefined
|
|
|
32
33
|
export declare function redactAndCap(body: string, cap: number, contentType?: string): string | undefined;
|
|
33
34
|
/** Scrub URL query/fragment secrets under the active rules. */
|
|
34
35
|
export declare function redactUrl(url: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Scrub an rrweb event before it is buffered. The Meta event that opens every
|
|
38
|
+
* full snapshot (start, each checkout, resume) carries the page's raw
|
|
39
|
+
* `location.href`, query and fragment included; it gets `redactUrl`. Every
|
|
40
|
+
* other event passes through as is — the DOM itself is masked by rrweb under
|
|
41
|
+
* `maskDirectives`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function redactRRWebEvent(ev: eventWithTime): eventWithTime;
|
|
35
44
|
/** Scrub + cap a captured header map under the active rules. */
|
|
36
45
|
export declare function redactHeaders(headers: Record<string, unknown> | undefined): Record<string, string> | undefined;
|
|
37
46
|
/** rrweb masking options under the active rules (maskAllInputs / maskAllText). */
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redaction bridge — binds the shared engine (@vitrinka/redact) to the
|
|
3
|
-
* CURRENT session's workspace policy.
|
|
4
|
-
*
|
|
5
|
-
* The engine itself owns all semantics (key classification, JSON/form/
|
|
6
|
-
* multipart bodies, URL query+fragment scrubbing, patterns, fullFidelity);
|
|
7
|
-
* this module owns which RULES apply right now: the safe defaults until a
|
|
8
|
-
* session starts, the session's fetched policy after. FAIL CLOSED — a failed
|
|
9
|
-
* or slow policy fetch means the defaults, never capture-everything.
|
|
10
|
-
*
|
|
11
|
-
* Capture layers import the bound helpers below so every call site stays a
|
|
12
|
-
* one-liner and can never forget to pass the rules.
|
|
13
|
-
*/
|
|
14
1
|
import { compileRules, redactAndCap as engineRedactAndCap, redactHeaders as engineRedactHeaders, redactText as engineRedactText, redactUrl as engineRedactUrl, maskDirectives as engineMaskDirectives, } from '@vitrinka/redact';
|
|
15
2
|
// Engine primitives that need no binding, re-exported for tests and callers.
|
|
16
3
|
export { isSecretKey, REDACTED } from '@vitrinka/redact';
|
|
@@ -44,6 +31,23 @@ export function redactAndCap(body, cap, contentType) {
|
|
|
44
31
|
export function redactUrl(url) {
|
|
45
32
|
return engineRedactUrl(rules, url);
|
|
46
33
|
}
|
|
34
|
+
/** rrweb's `EventType.Meta`; `@rrweb/types` is type-only here, so the value. */
|
|
35
|
+
const RRWEB_META = 4;
|
|
36
|
+
function isMetaEvent(ev) {
|
|
37
|
+
return ev.type === RRWEB_META;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Scrub an rrweb event before it is buffered. The Meta event that opens every
|
|
41
|
+
* full snapshot (start, each checkout, resume) carries the page's raw
|
|
42
|
+
* `location.href`, query and fragment included; it gets `redactUrl`. Every
|
|
43
|
+
* other event passes through as is — the DOM itself is masked by rrweb under
|
|
44
|
+
* `maskDirectives`.
|
|
45
|
+
*/
|
|
46
|
+
export function redactRRWebEvent(ev) {
|
|
47
|
+
if (!isMetaEvent(ev))
|
|
48
|
+
return ev;
|
|
49
|
+
return { ...ev, data: { ...ev.data, href: redactUrl(ev.data.href) } };
|
|
50
|
+
}
|
|
47
51
|
/** Scrub + cap a captured header map under the active rules. */
|
|
48
52
|
export function redactHeaders(headers) {
|
|
49
53
|
return engineRedactHeaders(rules, headers);
|
|
@@ -2,7 +2,7 @@ import { record } from 'rrweb';
|
|
|
2
2
|
import { RRWEB_BLOCK_ATTR } from '../block';
|
|
3
3
|
import { pushRRWebBatch } from '../queue';
|
|
4
4
|
import { currentRoute } from '../state';
|
|
5
|
-
import { maskDirectives } from './redact';
|
|
5
|
+
import { maskDirectives, redactRRWebEvent } from './redact';
|
|
6
6
|
export { RRWEB_BLOCK_ATTR };
|
|
7
7
|
const BATCH_MS = 2000;
|
|
8
8
|
/** A fresh full snapshot every 5 min keeps long recordings seekable. */
|
|
@@ -26,8 +26,9 @@ export function startRRWeb() {
|
|
|
26
26
|
const mask = maskDirectives();
|
|
27
27
|
try {
|
|
28
28
|
const stopFn = record({
|
|
29
|
+
// Scrubbed on the way in: nothing raw ever sits in the buffer.
|
|
29
30
|
emit: (ev) => {
|
|
30
|
-
buf.push(ev);
|
|
31
|
+
buf.push(redactRRWebEvent(ev));
|
|
31
32
|
},
|
|
32
33
|
checkoutEveryNms: CHECKOUT_MS,
|
|
33
34
|
// Never inline: to read a no-CORS cross-origin image rrweb sets
|
|
@@ -4,5 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** The extension's selector heuristic — id, then testid, then a short path. */
|
|
6
6
|
export declare function shortSelector(el: Element | null): string;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The element's own visible text, trimmed and capped — never more than the
|
|
9
|
+
* DOM lane shows. Never a form field's value or text (rrweb masks every
|
|
10
|
+
* input, so a click on a filled password field must not record it), and ''
|
|
11
|
+
* for an element at, under or around `.rr-mask` / `.rr-block`: `innerText`
|
|
12
|
+
* of a wrapper would carry its masked child's text.
|
|
13
|
+
*/
|
|
8
14
|
export declare function elementText(el: Element): string;
|
|
@@ -27,9 +27,19 @@ export function shortSelector(el) {
|
|
|
27
27
|
}
|
|
28
28
|
return parts.join(' > ');
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
30
|
+
/** Form fields: rrweb masks every input value, so their text is never read. */
|
|
31
|
+
const FORM_FIELD = 'input,textarea,select';
|
|
32
|
+
/** What the DOM lane already hides — rrweb's mask and block classes. */
|
|
33
|
+
const MASKED = '.rr-mask,.rr-block';
|
|
34
|
+
/**
|
|
35
|
+
* The element's own visible text, trimmed and capped — never more than the
|
|
36
|
+
* DOM lane shows. Never a form field's value or text (rrweb masks every
|
|
37
|
+
* input, so a click on a filled password field must not record it), and ''
|
|
38
|
+
* for an element at, under or around `.rr-mask` / `.rr-block`: `innerText`
|
|
39
|
+
* of a wrapper would carry its masked child's text.
|
|
40
|
+
*/
|
|
31
41
|
export function elementText(el) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
42
|
+
if (el.matches(FORM_FIELD) || el.closest(MASKED) || el.querySelector(MASKED))
|
|
43
|
+
return '';
|
|
44
|
+
return (el.innerText || '').trim().slice(0, TEXT_CAP);
|
|
35
45
|
}
|
|
@@ -30,6 +30,7 @@ import { elementText, shortSelector } from '../capture/selector';
|
|
|
30
30
|
import { RRWEB_BLOCK_ATTR } from '../block';
|
|
31
31
|
import { AnnotateIcon } from './icons';
|
|
32
32
|
import { insideHud } from './host';
|
|
33
|
+
import { listen } from './listen';
|
|
33
34
|
import { ANNOTATE_PAGE_CSS } from './styles';
|
|
34
35
|
const TOUCH = ['touchstart', 'touchmove', 'touchend'];
|
|
35
36
|
const TAIL = ['touchend', 'mousedown', 'mouseup', 'click'];
|
|
@@ -60,13 +61,12 @@ function swallowGestureTail() {
|
|
|
60
61
|
if (e.type === 'click')
|
|
61
62
|
off();
|
|
62
63
|
};
|
|
64
|
+
const offs = TAIL.map((t) => listen(window, t, eat, { capture: true }));
|
|
63
65
|
const off = () => {
|
|
64
|
-
for (const
|
|
65
|
-
|
|
66
|
+
for (const o of offs)
|
|
67
|
+
o();
|
|
66
68
|
window.removeEventListener('pointerdown', off, true);
|
|
67
69
|
};
|
|
68
|
-
for (const t of TAIL)
|
|
69
|
-
window.addEventListener(t, eat, { capture: true, passive: false });
|
|
70
70
|
window.addEventListener('pointerdown', off, true);
|
|
71
71
|
}
|
|
72
72
|
export function AnnotateOverlay({ onPick, onCancel }) {
|
|
@@ -224,36 +224,32 @@ export function AnnotateOverlay({ onPick, onCancel }) {
|
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
window.addEventListener('pointermove', move, true);
|
|
227
|
-
window.addEventListener('pointerdown', down, true);
|
|
228
|
-
window.addEventListener('pointerup', up, true);
|
|
229
|
-
window.addEventListener('click', swallowClick, true);
|
|
230
227
|
window.addEventListener('pointercancel', cancel, true);
|
|
231
|
-
window.addEventListener('dragstart', noDrag, true);
|
|
232
|
-
window.addEventListener('mousedown', noSelect, true);
|
|
233
|
-
window.addEventListener('selectstart', noSelect, true);
|
|
234
228
|
for (const t of HUSHED)
|
|
235
229
|
window.addEventListener(t, hush, true);
|
|
236
|
-
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
230
|
+
// Every cancelling listener goes through `listen`: non-passive (window
|
|
231
|
+
// touch listeners default to passive) and native, so a zone.js host
|
|
232
|
+
// cannot fold it into a passive listener registered before it.
|
|
233
|
+
const offs = [
|
|
234
|
+
listen(window, 'pointerdown', down, { capture: true }),
|
|
235
|
+
listen(window, 'pointerup', up, { capture: true }),
|
|
236
|
+
listen(window, 'click', swallowClick, { capture: true }),
|
|
237
|
+
listen(window, 'dragstart', noDrag, { capture: true }),
|
|
238
|
+
listen(window, 'mousedown', noSelect, { capture: true }),
|
|
239
|
+
listen(window, 'selectstart', noSelect, { capture: true }),
|
|
240
|
+
listen(document, 'keydown', key, { capture: true }),
|
|
241
|
+
...TOUCH.map((t) => listen(window, t, blockTouch, { capture: true })),
|
|
242
|
+
];
|
|
240
243
|
return () => {
|
|
241
244
|
pageCss.remove();
|
|
242
245
|
if (raf !== 0)
|
|
243
246
|
cancelAnimationFrame(raf);
|
|
244
247
|
window.removeEventListener('pointermove', move, true);
|
|
245
|
-
window.removeEventListener('pointerdown', down, true);
|
|
246
|
-
window.removeEventListener('pointerup', up, true);
|
|
247
|
-
window.removeEventListener('click', swallowClick, true);
|
|
248
248
|
window.removeEventListener('pointercancel', cancel, true);
|
|
249
|
-
window.removeEventListener('dragstart', noDrag, true);
|
|
250
|
-
window.removeEventListener('mousedown', noSelect, true);
|
|
251
|
-
window.removeEventListener('selectstart', noSelect, true);
|
|
252
249
|
for (const t of HUSHED)
|
|
253
250
|
window.removeEventListener(t, hush, true);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
window.removeEventListener(t, blockTouch, true);
|
|
251
|
+
for (const off of offs)
|
|
252
|
+
off();
|
|
257
253
|
};
|
|
258
254
|
}, [onPick, onCancel]);
|
|
259
255
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "dim", "data-e2e": "annotate-dim" }), box ? (_jsx("div", { className: "outline", style: { left: box.x, top: box.y, width: box.w, height: box.h } })) : null, _jsxs("div", { className: "hint", children: [_jsx(AnnotateIcon, {}), " Click an element or drag an area", _jsx("span", { className: "keys", children: " \u00B7 esc cancels" })] })] }));
|
|
@@ -16,6 +16,7 @@ import { flowReducer, NO_FLOW } from './flow';
|
|
|
16
16
|
import { createSheetHost, insideHud, sheetTarget } from './host';
|
|
17
17
|
import { anchoredLayer, hostOrigin, PHONE_QUERY, phoneLayer, restingBox, useFloat, useMedia, usePresence, useViewportTick, } from './layer';
|
|
18
18
|
import { LinkSheet } from './LinkSheet';
|
|
19
|
+
import { listen } from './listen';
|
|
19
20
|
import { Menu } from './Menu';
|
|
20
21
|
import { alignFor, towardCentre } from './place';
|
|
21
22
|
import { RecorderPill } from './RecorderPill';
|
|
@@ -255,8 +256,7 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
255
256
|
return;
|
|
256
257
|
e.preventDefault();
|
|
257
258
|
};
|
|
258
|
-
window
|
|
259
|
-
return () => window.removeEventListener('keydown', key, true);
|
|
259
|
+
return listen(window, 'keydown', key, { capture: true });
|
|
260
260
|
}, [toggleAnnotate, openNote, onPause, askStop]);
|
|
261
261
|
// Esc anywhere and click-outside close the sheet (capture-phase, so the
|
|
262
262
|
// page's own dialog never sees the Esc that closed ours).
|
|
@@ -275,10 +275,10 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
275
275
|
return;
|
|
276
276
|
closeSheet();
|
|
277
277
|
};
|
|
278
|
-
document
|
|
278
|
+
const offKey = listen(document, 'keydown', key, { capture: true });
|
|
279
279
|
document.addEventListener('pointerdown', down, true);
|
|
280
280
|
return () => {
|
|
281
|
-
|
|
281
|
+
offKey();
|
|
282
282
|
document.removeEventListener('pointerdown', down, true);
|
|
283
283
|
};
|
|
284
284
|
}, [sheet, closeSheet]);
|
|
@@ -299,10 +299,10 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
299
299
|
if (!path.includes(menuRef.current) && !path.includes(pillRef.current))
|
|
300
300
|
setMenu(false);
|
|
301
301
|
};
|
|
302
|
-
document
|
|
302
|
+
const offKey = listen(document, 'keydown', key, { capture: true });
|
|
303
303
|
document.addEventListener('pointerdown', down, true);
|
|
304
304
|
return () => {
|
|
305
|
-
|
|
305
|
+
offKey();
|
|
306
306
|
document.removeEventListener('pointerdown', down, true);
|
|
307
307
|
};
|
|
308
308
|
}, [menu]);
|
|
@@ -92,7 +92,7 @@ export interface HudSnapshot {
|
|
|
92
92
|
recents: readonly HudRecent[];
|
|
93
93
|
/** "Go to vitrinka": the configured workspace URL. */
|
|
94
94
|
workspaceUrl: string;
|
|
95
|
-
/** Recorder id, e.g. `web/0.2.
|
|
95
|
+
/** Recorder id, e.g. `web/0.2.1` (verbose mode shows it). */
|
|
96
96
|
version: string;
|
|
97
97
|
}
|
|
98
98
|
/** The code half of a device link, as the link sheet paints it. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `listen` — the ONE way the HUD registers a window/document listener that
|
|
3
|
+
* cancels its event (`preventDefault`). It is always `{ passive: false }` and
|
|
4
|
+
* always the browser's own registration, never a host's patched one.
|
|
5
|
+
*
|
|
6
|
+
* Why not plain `addEventListener(…, { passive: false })`: zone.js (every
|
|
7
|
+
* Angular host) patches `addEventListener` and funnels every listener of one
|
|
8
|
+
* target + type + phase through ONE native listener, registered with the
|
|
9
|
+
* options of whoever came FIRST. Angular CDK's InputModalityDetector registers
|
|
10
|
+
* `keydown`, `mousedown` and `touchstart` on document `{ passive: true,
|
|
11
|
+
* capture: true }` at boot, so the HUD's Esc handler ran inside a passive
|
|
12
|
+
* invocation: Chrome logged "Unable to preventDefault inside passive event
|
|
13
|
+
* listener invocation" and the default went ahead anyway. zone.js keeps the
|
|
14
|
+
* unpatched functions under `__zone_symbol__addEventListener` /
|
|
15
|
+
* `__zone_symbol__removeEventListener`; registering through them gives the
|
|
16
|
+
* handler its own native listener with its own options (and keeps the HUD's
|
|
17
|
+
* pointer traffic out of the host's change detection).
|
|
18
|
+
*/
|
|
19
|
+
export interface ListenOptions {
|
|
20
|
+
capture?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function listen<K extends keyof WindowEventMap>(target: Window, type: K, fn: (e: WindowEventMap[K]) => void, opts?: ListenOptions): () => void;
|
|
23
|
+
export declare function listen<K extends keyof DocumentEventMap>(target: Document, type: K, fn: (e: DocumentEventMap[K]) => void, opts?: ListenOptions): () => void;
|
|
24
|
+
export declare function listen(target: EventTarget, type: string, fn: (e: Event) => void, opts?: ListenOptions): () => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `listen` — the ONE way the HUD registers a window/document listener that
|
|
3
|
+
* cancels its event (`preventDefault`). It is always `{ passive: false }` and
|
|
4
|
+
* always the browser's own registration, never a host's patched one.
|
|
5
|
+
*
|
|
6
|
+
* Why not plain `addEventListener(…, { passive: false })`: zone.js (every
|
|
7
|
+
* Angular host) patches `addEventListener` and funnels every listener of one
|
|
8
|
+
* target + type + phase through ONE native listener, registered with the
|
|
9
|
+
* options of whoever came FIRST. Angular CDK's InputModalityDetector registers
|
|
10
|
+
* `keydown`, `mousedown` and `touchstart` on document `{ passive: true,
|
|
11
|
+
* capture: true }` at boot, so the HUD's Esc handler ran inside a passive
|
|
12
|
+
* invocation: Chrome logged "Unable to preventDefault inside passive event
|
|
13
|
+
* listener invocation" and the default went ahead anyway. zone.js keeps the
|
|
14
|
+
* unpatched functions under `__zone_symbol__addEventListener` /
|
|
15
|
+
* `__zone_symbol__removeEventListener`; registering through them gives the
|
|
16
|
+
* handler its own native listener with its own options (and keeps the HUD's
|
|
17
|
+
* pointer traffic out of the host's change detection).
|
|
18
|
+
*/
|
|
19
|
+
/** Register a cancelling listener natively and non-passive; returns its remover. */
|
|
20
|
+
export function listen(target, type, fn, opts = {}) {
|
|
21
|
+
const zone = target;
|
|
22
|
+
const add = zone.__zone_symbol__addEventListener ?? target.addEventListener;
|
|
23
|
+
const remove = zone.__zone_symbol__removeEventListener ?? target.removeEventListener;
|
|
24
|
+
const capture = opts.capture ?? false;
|
|
25
|
+
add.call(target, type, fn, { capture, passive: false });
|
|
26
|
+
return () => remove.call(target, type, fn, capture);
|
|
27
|
+
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* remembered per origin in the HUD's storage.
|
|
10
10
|
*/
|
|
11
11
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
12
|
+
import { listen } from './listen';
|
|
12
13
|
import { colOf, neighbour, parsePlace, rowOf, settle, untuck } from './spots';
|
|
13
14
|
const DOCK_KEY = 'dock';
|
|
14
15
|
/** Travel before a press becomes a drag — below it a press stays a tap. */
|
|
@@ -120,8 +121,7 @@ export function useDock(onMoveStart, storage) {
|
|
|
120
121
|
if (press.current)
|
|
121
122
|
e.preventDefault();
|
|
122
123
|
};
|
|
123
|
-
document
|
|
124
|
-
return () => document.removeEventListener('dragstart', guard, true);
|
|
124
|
+
return listen(document, 'dragstart', guard, { capture: true });
|
|
125
125
|
}, []);
|
|
126
126
|
const release = useCallback((e, cancelled) => {
|
|
127
127
|
const p = press.current;
|
package/build/recorder/link.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function linkDevice() {
|
|
|
21
21
|
const workspace = linkWorkspace(url);
|
|
22
22
|
const start = await startLink(url, { label: defaultLinkLabel(), workspace });
|
|
23
23
|
const ac = new AbortController();
|
|
24
|
-
const linked = pollLink(url, start.device_code, { interval: start.interval, workspace, signal: ac.signal }).then((l) => {
|
|
24
|
+
const linked = pollLink(url, start.device_code, { interval: start.interval, expiresIn: start.expires_in, workspace, signal: ac.signal }).then((l) => {
|
|
25
25
|
storeLink(l);
|
|
26
26
|
return l;
|
|
27
27
|
});
|
|
@@ -17,8 +17,8 @@ import { type SessionState } from './queue';
|
|
|
17
17
|
export { currentRoute, notify, subscribe } from './state';
|
|
18
18
|
export type { SessionDone } from '../protocol';
|
|
19
19
|
/** Sent as `meta.recorder`; bumped with the package version. */
|
|
20
|
-
export declare const RECORDER_VERSION = "0.2.
|
|
21
|
-
export declare const RECORDER_ID = "web/0.2.
|
|
20
|
+
export declare const RECORDER_VERSION = "0.2.2";
|
|
21
|
+
export declare const RECORDER_ID = "web/0.2.2";
|
|
22
22
|
/** What `POST /api/v1/sessions` answers (the fields this recorder keeps). */
|
|
23
23
|
export interface SessionOut {
|
|
24
24
|
id: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { api, fetchPolicy, permanentStatus, VitrinkaApiError } from './api';
|
|
2
|
-
import { setRedactionPolicy } from './capture/redact';
|
|
2
|
+
import { redactUrl, setRedactionPolicy } from './capture/redact';
|
|
3
3
|
import { recorderConfig } from './config';
|
|
4
4
|
import { armReconcile, capturesSettled, disarmReconcile, drainBuffer, getState, pushEvent, queuedCount, resetHealth, resetIdle, resetQueues, setState, } from './queue';
|
|
5
5
|
import { noteRecent, updateRecent } from './recents';
|
|
6
6
|
import { currentRoute, notify } from './state';
|
|
7
7
|
export { currentRoute, notify, subscribe } from './state';
|
|
8
8
|
/** Sent as `meta.recorder`; bumped with the package version. */
|
|
9
|
-
export const RECORDER_VERSION = '0.2.
|
|
9
|
+
export const RECORDER_VERSION = '0.2.2';
|
|
10
10
|
export const RECORDER_ID = `web/${RECORDER_VERSION}`;
|
|
11
11
|
/**
|
|
12
12
|
* Re-apply a RECOVERED session's redaction policy after a reload — and
|
|
@@ -105,7 +105,7 @@ export async function startSession(opts = {}) {
|
|
|
105
105
|
});
|
|
106
106
|
await attachTags(ses.id, opts.tags);
|
|
107
107
|
armReconcile();
|
|
108
|
-
pushEvent('nav', { url: currentUrl(), route: currentRoute.pathname }, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
|
|
108
|
+
pushEvent('nav', { url: redactUrl(currentUrl()), route: currentRoute.pathname }, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
|
|
109
109
|
notify();
|
|
110
110
|
return getState();
|
|
111
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitrinka/web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "vitrinka toolkit for React DOM apps — the journey recorder: capture manual-testing sessions (rrweb DOM stream, clicks, navigation, network, console, notes) straight into vitrinka boards.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"prepublishOnly": "tsc -p tsconfig.build.json && bun run build:hud"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vitrinka/link": "^0.1.
|
|
55
|
-
"@vitrinka/redact": "^0.1.
|
|
54
|
+
"@vitrinka/link": "^0.1.3",
|
|
55
|
+
"@vitrinka/redact": "^0.1.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": ">=18",
|