deictic 0.6.0 → 0.8.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/API.md +156 -31
- package/README.md +6 -4
- package/dist/annotations/client.d.ts +1 -1
- package/dist/annotations/client.d.ts.map +1 -1
- package/dist/annotations/client.js +161 -176
- package/dist/annotations/client.js.map +1 -1
- package/dist/annotations/index.d.ts +2 -11
- package/dist/bun.js +1 -1
- package/dist/client/index.d.ts +7 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1077 -236
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/next.js +1 -1
- package/dist/recommended/index.d.ts +2 -2
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +89 -154
- package/dist/recordings/client.js.map +1 -1
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/shared/annotations.js +3 -4
- package/dist/shared/annotations.js.map +1 -1
- package/dist/shared/board.js +1 -1
- package/dist/shared/client.js +45 -2
- package/dist/shared/client.js.map +1 -1
- package/dist/shared/component.js +62 -0
- package/dist/shared/component.js.map +1 -0
- package/dist/shared/dom.js +79 -0
- package/dist/shared/dom.js.map +1 -0
- package/dist/shared/drawer.js +217 -0
- package/dist/shared/drawer.js.map +1 -0
- package/dist/shared/endpoints.js +26 -6
- package/dist/shared/endpoints.js.map +1 -1
- package/dist/shared/index.d.ts +150 -9
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +9 -19
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index7.d.ts +123 -26
- package/dist/shared/index7.d.ts.map +1 -1
- package/dist/shared/index9.d.ts +1 -1
- package/dist/shared/integration.d.ts +1 -1
- package/dist/shared/integration.js +59 -5
- package/dist/shared/integration.js.map +1 -1
- package/dist/shared/package.js +23 -0
- package/dist/shared/package.js.map +1 -0
- package/dist/shared/packages.js +14 -23
- package/dist/shared/packages.js.map +1 -1
- package/dist/shared/playwright.js +11 -3
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/recording.js +31 -3
- package/dist/shared/recording.js.map +1 -1
- package/dist/shared/src.js.map +1 -1
- package/dist/shared/task.js +55 -31
- package/dist/shared/task.js.map +1 -1
- package/dist/shared/tasks.js +279 -61
- package/dist/shared/tasks.js.map +1 -1
- package/dist/shared/vb.js +1 -1
- package/dist/shared/voice2.js +6 -4
- package/dist/shared/voice2.js.map +1 -1
- package/dist/shared/watch.js +15 -14
- package/dist/shared/watch.js.map +1 -1
- package/dist/tailwind/index.js +7 -2
- package/dist/tailwind/index.js.map +1 -1
- package/dist/tasks/client.d.ts +2 -2
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +1870 -741
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +154 -57
- package/dist/voice/client.js.map +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +2 -1
- package/skills/deictic/SKILL.md +22 -28
- package/src/cli/recording.ts +34 -3
- package/src/cli/task.ts +78 -33
- package/src/cli/voice.ts +9 -4
- package/src/cli/watch.ts +16 -13
- package/src/client/away.ts +3 -1
- package/src/client/component.ts +98 -0
- package/src/client/dom.ts +70 -0
- package/src/client/drawer.ts +258 -0
- package/src/client/index.ts +290 -165
- package/src/client/lightbox.ts +8 -8
- package/src/client/lighting.ts +279 -0
- package/src/client/style.ts +263 -44
- package/src/client/tools.ts +279 -0
- package/src/client/tooltip.ts +25 -5
- package/src/client/tray.ts +48 -0
- package/src/index.ts +148 -8
- package/src/plugins/annotations/client.ts +103 -129
- package/src/plugins/annotations/draw.ts +68 -72
- package/src/plugins/annotations/index.ts +12 -19
- package/src/plugins/recordings/client.ts +96 -168
- package/src/plugins/screenshots/client.ts +53 -2
- package/src/plugins/screenshots/playwright.ts +8 -3
- package/src/plugins/tailwind/index.ts +3 -2
- package/src/plugins/tasks/client.ts +229 -748
- package/src/plugins/tasks/composer.ts +797 -0
- package/src/plugins/tasks/drawer.ts +516 -0
- package/src/plugins/tasks/index.ts +436 -80
- package/src/plugins/tasks/pins.ts +280 -0
- package/src/plugins/tasks/store.ts +132 -0
- package/src/plugins/tasks/which.ts +34 -0
- package/src/plugins/voice/client.ts +96 -5
- package/src/tools/endpoints.ts +31 -5
- package/src/tools/packages.ts +12 -4
- package/src/tools/plugins.ts +18 -4
- package/src/tools/problems.ts +60 -0
- package/skills/deictic/references/recordings.md +0 -13
- package/skills/deictic/references/tasks.md +0 -22
- package/skills/deictic/references/watch.md +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
*
|
|
20
20
|
* Both halves import from here, so the parser is imported for its types only: the browser must not load it.
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
23
|
-
export { ApiOf, ClientApis, ClientContext, ClientPlugin, Done, LightboxAction, LightboxItem, LightboxOptions, Loc, type Modifier, PanelContext, Refusal, Resumed, Route, ServerApis, ServerContext, ServerPlugin, type Shortcut, Source, Standalone, Target, TextEdit, defineClientPlugin, definePlugin };
|
|
22
|
+
import { A as Modifier, C as Target, D as TrayItem, E as Tray, O as defineClientPlugin, S as Standalone, T as ToolPanel, _ as ServerApis, a as Done, b as Source, c as LightboxItem, d as PanelContext, f as Point, g as Route, h as Resumed, i as ClientPlugin, j as Shortcut, k as definePlugin, l as LightboxOptions, m as Refusal, n as ClientApis, o as Drawer, p as Problem, r as ClientContext, s as LightboxAction, t as ApiOf, u as Loc, v as ServerContext, w as TextEdit, x as Spot, y as ServerPlugin } from "./shared/index.js";
|
|
23
|
+
export { ApiOf, ClientApis, ClientContext, ClientPlugin, Done, Drawer, LightboxAction, LightboxItem, LightboxOptions, Loc, type Modifier, PanelContext, Point, Problem, Refusal, Resumed, Route, ServerApis, ServerContext, ServerPlugin, type Shortcut, Source, Spot, Standalone, Target, TextEdit, ToolPanel, Tray, TrayItem, defineClientPlugin, definePlugin };
|
package/dist/next.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServer } from "node:http";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { n as nodeMiddleware, r as redirect, t as endpoints } from "./shared/endpoints.js";
|
|
4
|
-
import {
|
|
4
|
+
import { h as JSX, o as prepare, s as writeClient, t as beside } from "./shared/integration.js";
|
|
5
5
|
// src/next.ts
|
|
6
6
|
/**
|
|
7
7
|
* `deictic/next`: deictic in `next dev`, on Turbopack or webpack (`--webpack`). Nothing runs in `next build`.
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin
|
|
7
7
|
* outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { y as ServerPlugin } from "../shared/index.js";
|
|
10
10
|
import { i as AnnotationsOptions } from "../shared/index2.js";
|
|
11
11
|
import { n as LogsOptions } from "../shared/index5.js";
|
|
12
12
|
import { t as NetworkOptions } from "../shared/index6.js";
|
|
13
13
|
import { c as RecordingsOptions } from "../shared/index4.js";
|
|
14
14
|
import { l as ScreenshotsOptions } from "../shared/index3.js";
|
|
15
|
-
import {
|
|
15
|
+
import { _ as TasksOptions } from "../shared/index7.js";
|
|
16
16
|
import { a as VoiceOptions } from "../shared/index8.js";
|
|
17
17
|
/** Each plugin's options, by its name, or `false` to leave it out. */
|
|
18
18
|
export interface RecommendedOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/recordings/client.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/recordings/client.ts"],"mappings":";cAuFA,4B"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { u as toolButton } from "../shared/dom.js";
|
|
2
|
+
import { n as playMark, r as trayed } from "../shared/drawer.js";
|
|
1
3
|
import { n as liveWaveform } from "../shared/waveform.js";
|
|
2
4
|
import { n as defineClientPlugin } from "../shared/src.js";
|
|
3
5
|
import { n as MARKS, r as PAGE, t as END } from "../shared/marks.js";
|
|
@@ -60,21 +62,19 @@ function dropOurs(hostId, pageId) {
|
|
|
60
62
|
}
|
|
61
63
|
// src/plugins/recordings/client.ts
|
|
62
64
|
/**
|
|
63
|
-
* The recordings plugin's page half: `record()` starts rrweb (imported
|
|
64
|
-
*
|
|
65
|
-
*
|
|
65
|
+
* The recordings plugin's page half. Its tool in the tool panel is Record: `record()` starts rrweb (imported
|
|
66
|
+
* then), and while one is going the panel stays, with the time, the mic where the voice plugin is loaded, and
|
|
67
|
+
* Stop and Discard in Record's place. A recording that's stopped goes in the tray, for the next task.
|
|
66
68
|
*
|
|
67
69
|
* The events go to the server as they happen (`begin`, a `part` each second, `end` on Stop), and what the next
|
|
68
70
|
* page needs to carry on is kept in the tab's session storage: a reload, or a link to another page of the site,
|
|
69
71
|
* leaves the recording going. The page that loads starts rrweb again under the same ID, which makes it a
|
|
70
|
-
* recording of several pages as rrweb has them (a `Meta` and a snapshot for each), puts
|
|
71
|
-
*
|
|
72
|
+
* recording of several pages as rrweb has them (a `Meta` and a snapshot for each), puts its controls back with
|
|
73
|
+
* the time running, and turns the mic back on where it was.
|
|
72
74
|
*
|
|
73
75
|
* Nothing of deictic's is recorded: the overlay is blocked, as rrweb blocks. The marks are, as custom
|
|
74
|
-
* events: the page's annotations
|
|
75
|
-
* coordinates, at the start and at each change.
|
|
76
|
+
* events: the page's annotations, as SVGs in page coordinates, at the start and at each change.
|
|
76
77
|
*/
|
|
77
|
-
const DOCK = "deictic:recorder";
|
|
78
78
|
/** Where the recording going on is kept, for the tab's next page to carry on with. */
|
|
79
79
|
const GOING = "deictic:recording";
|
|
80
80
|
/** How often the events are sent, in milliseconds. */
|
|
@@ -92,114 +92,60 @@ function carry(going) {
|
|
|
92
92
|
else sessionStorage.setItem(GOING, JSON.stringify(going));
|
|
93
93
|
} catch {}
|
|
94
94
|
}
|
|
95
|
-
const MARGIN = 12;
|
|
96
95
|
const STYLE = `
|
|
97
|
-
.recorder {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
.recorder.
|
|
102
|
-
.
|
|
103
|
-
.recorder .
|
|
104
|
-
.recorder .
|
|
105
|
-
.recorder .grip svg { width: 16px; height: 16px; }
|
|
106
|
-
.recorder .live { display: inline-flex; align-items: center; gap: 6px; font: 12px ui-monospace, monospace; }
|
|
96
|
+
.recorder .going { display: flex; align-items: center; gap: 4px; }
|
|
97
|
+
/* Away while nothing records: laid out empty, it would still count in the group's gap. */
|
|
98
|
+
.recorder .going[hidden] { display: none; }
|
|
99
|
+
/* While one goes, its controls are its section's alone: the other tools that capture (a shot, the mic, a task) wait. */
|
|
100
|
+
.tool-panel:has(.recorder.going) .tool-group[data-section='capture']:not(.recorder) { display: none; }
|
|
101
|
+
.tool-panel.vertical .recorder .going { flex-direction: column; }
|
|
102
|
+
.recorder .live { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; font: 12px ui-monospace, monospace; }
|
|
103
|
+
.tool-panel.vertical .recorder .live { flex-direction: column; gap: 2px; padding: 4px 0; }
|
|
107
104
|
.recorder .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: deictic-blink 1.2s infinite; }
|
|
108
|
-
.recorder .
|
|
109
|
-
.recorder.vertical .sep { width: auto; height: 1px; }
|
|
110
|
-
.recorder .icon { display: inline-flex; align-items: center; justify-content: center; padding: 3px 5px; }
|
|
111
|
-
.recorder .icon svg { width: 16px; height: 16px; }
|
|
112
|
-
.recorder .mic[aria-pressed='true'] { background: #ef4444; border-color: #ef4444; color: #fff; }
|
|
105
|
+
.recorder .mic[aria-pressed='true'], .recorder .mic[aria-pressed='true']:hover { background: #ef4444; color: #fff; }
|
|
113
106
|
.recorder .wave { width: 44px; height: 18px; }
|
|
114
|
-
.
|
|
115
|
-
.recorder .wave[hidden] { display: none; }
|
|
116
|
-
.recorder .mic.problem { border-color: var(--deictic-problem); color: var(--deictic-problem); }
|
|
107
|
+
.tool-panel.vertical .recorder .wave { width: 28px; }
|
|
117
108
|
@keyframes deictic-blink { 50% { opacity: 0.3; } }
|
|
118
109
|
`;
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
const STOP =
|
|
122
|
-
const DISCARD =
|
|
123
|
-
const MIC =
|
|
110
|
+
/** Each icon's strokes, on a 24-pixel grid. */
|
|
111
|
+
const RECORD = "<circle cx=\"12\" cy=\"12\" r=\"8\"/><circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\"/>";
|
|
112
|
+
const STOP = "<rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"1\" fill=\"currentColor\"/>";
|
|
113
|
+
const DISCARD = "<path d=\"M6 6l12 12M18 6 6 18\"/>";
|
|
114
|
+
const MIC = "<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\"/>";
|
|
124
115
|
const clock = (ms) => {
|
|
125
116
|
const s = Math.floor(ms / 1e3);
|
|
126
117
|
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
127
118
|
};
|
|
128
|
-
function storedDock() {
|
|
129
|
-
try {
|
|
130
|
-
const dock = JSON.parse(localStorage.getItem(DOCK) ?? "null");
|
|
131
|
-
if (dock !== null && [
|
|
132
|
-
"top",
|
|
133
|
-
"bottom",
|
|
134
|
-
"left",
|
|
135
|
-
"right"
|
|
136
|
-
].includes(dock.edge) && dock.along >= 0 && dock.along <= 1) return dock;
|
|
137
|
-
} catch {}
|
|
138
|
-
return {
|
|
139
|
-
edge: "bottom",
|
|
140
|
-
along: .5
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function iconButton(icon, name, run) {
|
|
144
|
-
const el = Object.assign(document.createElement("button"), {
|
|
145
|
-
type: "button",
|
|
146
|
-
className: "icon",
|
|
147
|
-
title: name,
|
|
148
|
-
innerHTML: icon
|
|
149
|
-
});
|
|
150
|
-
el.setAttribute("aria-label", name);
|
|
151
|
-
el.addEventListener("click", run);
|
|
152
|
-
return el;
|
|
153
|
-
}
|
|
154
|
-
/** Puts the bar on its edge, laid out along it, and how far along. */
|
|
155
|
-
function place(bar, { edge, along }) {
|
|
156
|
-
bar.classList.toggle("vertical", edge === "left" || edge === "right");
|
|
157
|
-
const { width, height } = bar.getBoundingClientRect();
|
|
158
|
-
const across = (room, size) => `${MARGIN + along * Math.max(0, room - size - 24)}px`;
|
|
159
|
-
Object.assign(bar.style, {
|
|
160
|
-
left: edge === "left" ? `${MARGIN}px` : edge === "right" ? `${innerWidth - width - MARGIN}px` : across(innerWidth, width),
|
|
161
|
-
top: edge === "top" ? `${MARGIN}px` : edge === "bottom" ? `${innerHeight - height - MARGIN}px` : across(innerHeight, height)
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
/** Dragging the bar by its grip, freely; let go, it docks to the nearest edge. */
|
|
165
|
-
function draggable(bar, grip, docked) {
|
|
166
|
-
grip.addEventListener("pointerdown", (e) => {
|
|
167
|
-
if (e.button !== 0) return;
|
|
168
|
-
e.preventDefault();
|
|
169
|
-
grip.setPointerCapture(e.pointerId);
|
|
170
|
-
const start = bar.getBoundingClientRect();
|
|
171
|
-
const dx = e.clientX - start.left;
|
|
172
|
-
const dy = e.clientY - start.top;
|
|
173
|
-
const move = (m) => {
|
|
174
|
-
bar.style.left = `${m.clientX - dx}px`;
|
|
175
|
-
bar.style.top = `${m.clientY - dy}px`;
|
|
176
|
-
};
|
|
177
|
-
const up = () => {
|
|
178
|
-
grip.removeEventListener("pointermove", move);
|
|
179
|
-
const r = bar.getBoundingClientRect();
|
|
180
|
-
const x = r.left + r.width / 2;
|
|
181
|
-
const y = r.top + r.height / 2;
|
|
182
|
-
const [edge] = [
|
|
183
|
-
["left", x],
|
|
184
|
-
["right", innerWidth - x],
|
|
185
|
-
["top", y],
|
|
186
|
-
["bottom", innerHeight - y]
|
|
187
|
-
].reduce((a, b) => b[1] < a[1] ? b : a);
|
|
188
|
-
const ratio = (at, room) => Math.min(1, Math.max(0, at / room));
|
|
189
|
-
docked({
|
|
190
|
-
edge,
|
|
191
|
-
along: edge === "left" || edge === "right" ? ratio(y, innerHeight) : ratio(x, innerWidth)
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
grip.addEventListener("pointermove", move);
|
|
195
|
-
grip.addEventListener("pointerup", up, { once: true });
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
119
|
var client_default = defineClientPlugin({
|
|
199
120
|
name: "recordings",
|
|
200
|
-
setup: ({ base, root, options, use, request }) => {
|
|
121
|
+
setup: ({ base, root, options, use, request, report, tools, tray, drawer, lightbox }) => {
|
|
201
122
|
const { masking, canvas } = options;
|
|
202
|
-
let
|
|
123
|
+
let running;
|
|
124
|
+
const group = Object.assign(document.createElement("div"), { className: "tool-group recorder" });
|
|
125
|
+
const going = Object.assign(document.createElement("div"), {
|
|
126
|
+
className: "going",
|
|
127
|
+
hidden: true
|
|
128
|
+
});
|
|
129
|
+
const start = toolButton(RECORD, "Record", "R", () => {
|
|
130
|
+
run().catch((e) => {
|
|
131
|
+
start.classList.add("problem");
|
|
132
|
+
start.title = e instanceof Error ? e.message : String(e);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
group.append(Object.assign(document.createElement("style"), { textContent: STYLE }), start, going);
|
|
136
|
+
tools.add(group, { section: "capture" });
|
|
137
|
+
drawer.add(trayed({ tray }, "recordings", "Recordings", (item, i, all) => {
|
|
138
|
+
const { url, duration, voice } = item.value;
|
|
139
|
+
const name = `${all.length === 1 ? "Recording" : `Recording ${i + 1}`} ${clock(duration)}`;
|
|
140
|
+
return {
|
|
141
|
+
label: [playMark(), `${name}${voice === void 0 ? "" : " · voice"}`],
|
|
142
|
+
open: (from) => lightbox([{
|
|
143
|
+
kind: "page",
|
|
144
|
+
url: `${url}${url.includes("?") ? "&" : "?"}embed`,
|
|
145
|
+
title: name
|
|
146
|
+
}], { from })
|
|
147
|
+
};
|
|
148
|
+
}));
|
|
203
149
|
const post = async (route, body, keepalive = false) => {
|
|
204
150
|
const res = await request(route, {
|
|
205
151
|
method: "POST",
|
|
@@ -231,7 +177,13 @@ var client_default = defineClientPlugin({
|
|
|
231
177
|
})).id;
|
|
232
178
|
};
|
|
233
179
|
const extra = (name) => use(name)?.plugin({ sinceLoad: from !== void 0 }).catch((e) => {
|
|
234
|
-
|
|
180
|
+
const why = e instanceof Error ? e.message : String(e);
|
|
181
|
+
report({
|
|
182
|
+
key: `page:recordings:${name}:${why.split("\n", 1)[0].slice(0, 200)}`,
|
|
183
|
+
kind: "setup",
|
|
184
|
+
message: `recordings go without ${name}, as it couldn't be loaded: install what it needs (\`deictic init\` does), then load the page again: ${why}`,
|
|
185
|
+
...e instanceof Error && e.stack !== void 0 ? { details: e.stack } : {}
|
|
186
|
+
});
|
|
235
187
|
});
|
|
236
188
|
const [rrweb, id, ...extras] = await Promise.all([
|
|
237
189
|
import("rrweb").catch((e) => {
|
|
@@ -276,8 +228,6 @@ var client_default = defineClientPlugin({
|
|
|
276
228
|
}
|
|
277
229
|
});
|
|
278
230
|
const marks = use("annotations");
|
|
279
|
-
const tools = marks?.tools();
|
|
280
|
-
if (from?.path === location.pathname) for (const shape of from.marks) tools?.marks.add(shape);
|
|
281
231
|
const mark = () => {
|
|
282
232
|
const area = {
|
|
283
233
|
x: -scrollX,
|
|
@@ -286,8 +236,8 @@ var client_default = defineClientPlugin({
|
|
|
286
236
|
height: 1
|
|
287
237
|
};
|
|
288
238
|
rrweb.record.addCustomEvent(MARKS, {
|
|
289
|
-
svg:
|
|
290
|
-
annotations:
|
|
239
|
+
svg: marks?.svg(area) ?? "",
|
|
240
|
+
annotations: marks?.list() ?? []
|
|
291
241
|
});
|
|
292
242
|
};
|
|
293
243
|
mark();
|
|
@@ -300,14 +250,9 @@ var client_default = defineClientPlugin({
|
|
|
300
250
|
startedAt,
|
|
301
251
|
seq,
|
|
302
252
|
clips,
|
|
303
|
-
mic: take !== void 0
|
|
304
|
-
path: location.pathname,
|
|
305
|
-
marks: tools?.marks.list().map((a) => a.shape) ?? []
|
|
253
|
+
mic: take !== void 0
|
|
306
254
|
});
|
|
307
|
-
const unsubscribe =
|
|
308
|
-
mark();
|
|
309
|
-
save();
|
|
310
|
-
})];
|
|
255
|
+
const unsubscribe = marks?.subscribe(mark);
|
|
311
256
|
let sending = Promise.resolve();
|
|
312
257
|
const flush = () => {
|
|
313
258
|
const next = sending.catch(() => {}).then(async () => {
|
|
@@ -329,20 +274,10 @@ var client_default = defineClientPlugin({
|
|
|
329
274
|
const flushing = setInterval(() => void flush().catch(() => {}), EVERY);
|
|
330
275
|
save();
|
|
331
276
|
return new Promise((done, fail) => {
|
|
332
|
-
const bar = document.createElement("div");
|
|
333
|
-
bar.className = "recorder";
|
|
334
|
-
bar.setAttribute("role", "toolbar");
|
|
335
|
-
bar.setAttribute("aria-label", "Recording");
|
|
336
|
-
const grip = Object.assign(document.createElement("span"), {
|
|
337
|
-
className: "grip",
|
|
338
|
-
title: "Drag to any edge",
|
|
339
|
-
innerHTML: GRIP
|
|
340
|
-
});
|
|
341
277
|
const live = Object.assign(document.createElement("span"), { className: "live" });
|
|
342
278
|
const dot = Object.assign(document.createElement("span"), { className: "dot" });
|
|
343
279
|
const time = document.createElement("span");
|
|
344
280
|
live.append(dot, time);
|
|
345
|
-
const sep = () => Object.assign(document.createElement("span"), { className: "sep" });
|
|
346
281
|
const wave = Object.assign(document.createElement("canvas"), {
|
|
347
282
|
className: "wave",
|
|
348
283
|
hidden: true
|
|
@@ -370,7 +305,7 @@ var client_default = defineClientPlugin({
|
|
|
370
305
|
console.warn("deictic: the voice clip was not kept", e);
|
|
371
306
|
}
|
|
372
307
|
};
|
|
373
|
-
const mic = voice === void 0 ? void 0 :
|
|
308
|
+
const mic = voice === void 0 ? void 0 : toolButton(MIC, "Turn the mic on", "K", () => toggle());
|
|
374
309
|
const toggle = () => {
|
|
375
310
|
busy = busy.then(async () => {
|
|
376
311
|
if (voice === void 0 || mic === void 0) return;
|
|
@@ -415,13 +350,11 @@ var client_default = defineClientPlugin({
|
|
|
415
350
|
const end = async (kept) => {
|
|
416
351
|
rrweb.record.addCustomEvent(END, {});
|
|
417
352
|
stopRecording?.();
|
|
418
|
-
|
|
419
|
-
tools?.close();
|
|
353
|
+
unsubscribe?.();
|
|
420
354
|
clearInterval(flushing);
|
|
421
355
|
clearInterval(ticking);
|
|
422
|
-
removeEventListener("resize", replace);
|
|
423
356
|
removeEventListener("pagehide", leave);
|
|
424
|
-
|
|
357
|
+
idle();
|
|
425
358
|
over = true;
|
|
426
359
|
carry(void 0);
|
|
427
360
|
await busy;
|
|
@@ -450,36 +383,38 @@ var client_default = defineClientPlugin({
|
|
|
450
383
|
fail(e);
|
|
451
384
|
}
|
|
452
385
|
};
|
|
453
|
-
const stop =
|
|
454
|
-
const discard =
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
386
|
+
const stop = toolButton(STOP, "Stop", "R", () => void end(true));
|
|
387
|
+
const discard = toolButton(DISCARD, "Discard", "Shift+R", () => void end(false));
|
|
388
|
+
going.replaceChildren(live, ...mic ? [mic, wave] : [], stop, discard);
|
|
389
|
+
const unkeep = tools.keep();
|
|
390
|
+
start.hidden = true;
|
|
391
|
+
going.hidden = false;
|
|
392
|
+
group.classList.add("going");
|
|
393
|
+
const idle = () => {
|
|
394
|
+
unkeep();
|
|
395
|
+
going.replaceChildren();
|
|
396
|
+
going.hidden = true;
|
|
397
|
+
start.hidden = false;
|
|
398
|
+
group.classList.remove("going");
|
|
399
|
+
};
|
|
459
400
|
const tick = () => {
|
|
460
401
|
moved();
|
|
461
402
|
time.textContent = clock(Date.now() - startedAt);
|
|
462
403
|
};
|
|
463
404
|
tick();
|
|
464
405
|
const ticking = setInterval(tick, 250);
|
|
465
|
-
let dock = storedDock();
|
|
466
|
-
const replace = () => place(bar, dock);
|
|
467
|
-
replace();
|
|
468
|
-
addEventListener("resize", replace);
|
|
469
|
-
draggable(bar, grip, (next) => {
|
|
470
|
-
dock = next;
|
|
471
|
-
replace();
|
|
472
|
-
try {
|
|
473
|
-
localStorage.setItem(DOCK, JSON.stringify(dock));
|
|
474
|
-
} catch {}
|
|
475
|
-
});
|
|
476
406
|
});
|
|
477
407
|
};
|
|
478
408
|
const run = (from) => {
|
|
409
|
+
start.disabled = true;
|
|
410
|
+
start.classList.remove("problem");
|
|
411
|
+
start.title = "Record";
|
|
479
412
|
const mine = record(from).finally(() => {
|
|
480
|
-
if (
|
|
413
|
+
if (running === mine) running = void 0;
|
|
414
|
+
start.disabled = false;
|
|
481
415
|
});
|
|
482
|
-
|
|
416
|
+
running = mine;
|
|
417
|
+
mine.then((recording) => recording !== void 0 && tray.add("recordings", recording.id, recording), () => {});
|
|
483
418
|
return mine;
|
|
484
419
|
};
|
|
485
420
|
const left = carried();
|
|
@@ -488,13 +423,13 @@ var client_default = defineClientPlugin({
|
|
|
488
423
|
console.warn("deictic: the recording did not carry on, or was not kept", e);
|
|
489
424
|
});
|
|
490
425
|
window.addEventListener("pageshow", (e) => {
|
|
491
|
-
if (e.persisted && (
|
|
426
|
+
if (e.persisted && (running !== void 0 || carried() !== void 0)) location.reload();
|
|
492
427
|
});
|
|
493
428
|
return {
|
|
494
|
-
recording: () =>
|
|
495
|
-
going: () =>
|
|
429
|
+
recording: () => running !== void 0,
|
|
430
|
+
going: () => running,
|
|
496
431
|
record: async () => {
|
|
497
|
-
if (
|
|
432
|
+
if (running !== void 0) throw new Error("recordings: one is going already: stop it first");
|
|
498
433
|
return run();
|
|
499
434
|
}
|
|
500
435
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../../src/plugins/recordings/ours.ts","../../src/plugins/recordings/client.ts"],"sourcesContent":["/**\n * Keeps deictic's own UI out of a recording. Blocking the overlay keeps it out of the first snapshot,\n * but rrweb watches a blocked host's shadow root all the same, so what's added there later (the toolbar,\n * a note's field) comes as mutations. This drops them, and clicks and input on those nodes, by the IDs\n * rrweb gave them: the host's, and every node added under one of ours.\n *\n * The pointer's moves over them stay, on the page's root instead: the replay moves its cursor only over a\n * node it has, and while a drawing tool is picked the pointer is over ours the whole time.\n */\n\n/** The parts of rrweb's events this reads; the rest passes as it is. */\ninterface Event {\n type: number;\n data?: unknown;\n}\n\ninterface Mutation {\n source: 0;\n adds: { parentId: number; node: { id: number } }[];\n removes: { parentId: number; id: number }[];\n texts: { id: number }[];\n attributes: { id: number }[];\n}\n\n/** rrweb's numbers: an incremental snapshot, and the sources whose data is a list of pointer positions. */\nconst INCREMENTAL = 3;\nconst MUTATION = 0;\nconst POSITIONS = new Set([1, 6, 12]);\n\n/** A filter for `emit`: the event without our nodes, or nothing when nothing else is left in it. */\nexport function dropOurs<E extends Event>(hostId: () => number, pageId: () => number): (event: E) => E | undefined {\n const ours = new Set<number>();\n return (event) => {\n if (ours.size === 0) {\n const id = hostId();\n if (id > 0) ours.add(id);\n }\n if (event.type !== INCREMENTAL || typeof event.data !== 'object' || event.data === null) return event;\n const data = event.data as { source: number; id?: number; positions?: { id: number }[] };\n\n if (data.source === MUTATION) {\n const m = data as Mutation;\n // Added parents and children come in any order: claim until nothing more is ours.\n for (let grew = true; grew;) {\n grew = false;\n for (const add of m.adds) {\n if (ours.has(add.parentId) && !ours.has(add.node.id)) {\n ours.add(add.node.id);\n grew = true;\n }\n }\n }\n const kept: Mutation = {\n ...m,\n adds: m.adds.filter((a) => !ours.has(a.node.id)),\n removes: m.removes.filter((r) => !ours.has(r.id) && !ours.has(r.parentId)),\n texts: m.texts.filter((t) => !ours.has(t.id)),\n attributes: m.attributes.filter((a) => !ours.has(a.id)),\n };\n const left = kept.adds.length + kept.removes.length + kept.texts.length + kept.attributes.length;\n return left === 0 ? undefined : { ...event, data: kept };\n }\n if (POSITIONS.has(data.source) && Array.isArray(data.positions)) {\n const page = pageId();\n const positions = data.positions.map((p) => (ours.has(p.id) ? { ...p, id: page } : p));\n return { ...event, data: { ...data, positions } };\n }\n return data.id !== undefined && ours.has(data.id) ? undefined : event;\n };\n}\n","/**\n * The recordings plugin's page half: `record()` starts rrweb (imported then) and shows the toolbar, a bar\n * docked to an edge of the window that its grip drags to any other, kept between recordings. It holds the\n * time, annotate mode's tools where that plugin is loaded, and Stop and Discard.\n *\n * The events go to the server as they happen (`begin`, a `part` each second, `end` on Stop), and what the next\n * page needs to carry on is kept in the tab's session storage: a reload, or a link to another page of the site,\n * leaves the recording going. The page that loads starts rrweb again under the same ID, which makes it a\n * recording of several pages as rrweb has them (a `Meta` and a snapshot for each), puts the toolbar back with\n * its time running, and turns the mic back on where it was.\n *\n * Nothing of deictic's is recorded: the overlay is blocked, as rrweb blocks. The marks are, as custom\n * events: the page's annotations and the toolbar's own, which go when it does, as SVGs in page\n * coordinates, at the start and at each change.\n */\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport { defineClientPlugin } from '#src/index.ts';\nimport type { Shape } from '#src/plugins/annotations/index.ts';\nimport type { ResolvedMasking } from '#src/plugins/screenshots/index.ts';\n\nimport type { Take } from '#src/plugins/voice/index.ts';\n\nimport type { Kept, Meta, Recorder, Recording, RecordPlugin, VoiceClip } from './index.ts';\nimport { END, MARKS, PAGE } from './marks.ts';\nimport { dropOurs } from './ours.ts';\n\ntype Edge = 'top' | 'bottom' | 'left' | 'right';\n/** Where the bar is: the edge it's docked to, and how far along it, from 0 to 1. */\ninterface Dock {\n edge: Edge;\n along: number;\n}\n\nconst DOCK = 'deictic:recorder';\n/** Where the recording going on is kept, for the tab's next page to carry on with. */\nconst GOING = 'deictic:recording';\n/** How often the events are sent, in milliseconds. */\nconst EVERY = 1000;\n\n/** A recording going on, as the next page needs it. */\ninterface Carried {\n id: string;\n startedAt: number;\n /** The next part's place among the parts. */\n seq: number;\n /** The mic's clips so far, and whether it was on. */\n clips: VoiceClip[];\n mic: boolean;\n /** What was drawn from the toolbar, and on which page: it's about that page, so only a reload of it shows it again. */\n path: string;\n marks: Shape[];\n}\n\nfunction carried(): Carried | undefined {\n try {\n return (JSON.parse(sessionStorage.getItem(GOING) ?? 'null') as Carried | null) ?? undefined;\n } catch {\n // Storage can be off: nothing carries over, then.\n return undefined;\n }\n}\n\nfunction carry(going: Carried | undefined): void {\n try {\n if (going === undefined) sessionStorage.removeItem(GOING);\n else sessionStorage.setItem(GOING, JSON.stringify(going));\n } catch {\n // Not kept, then: a page load ends the recording.\n }\n}\nconst MARGIN = 12;\n\nconst STYLE = `\n.recorder { position: fixed; z-index: 2147483647; display: flex; align-items: center; gap: 6px; padding: 6px 8px;\n border: 1px solid var(--deictic-line); border-radius: 10px; background: var(--deictic-bg); color: var(--deictic-fg);\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.35); font: 13px/1.4 system-ui, sans-serif; user-select: none; }\n.recorder.vertical { flex-direction: column; }\n.recorder.vertical .annotations-tools { flex-direction: column; }\n.recorder.vertical .annotations-tools .gap { width: auto; height: 1px; margin: 4px 2px; }\n.recorder .grip { display: inline-flex; padding: 2px; color: var(--deictic-muted); cursor: grab; touch-action: none; }\n.recorder .grip:active { cursor: grabbing; }\n.recorder .grip svg { width: 16px; height: 16px; }\n.recorder .live { display: inline-flex; align-items: center; gap: 6px; font: 12px ui-monospace, monospace; }\n.recorder .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: deictic-blink 1.2s infinite; }\n.recorder .sep { align-self: stretch; width: 1px; background: var(--deictic-line); }\n.recorder.vertical .sep { width: auto; height: 1px; }\n.recorder .icon { display: inline-flex; align-items: center; justify-content: center; padding: 3px 5px; }\n.recorder .icon svg { width: 16px; height: 16px; }\n.recorder .mic[aria-pressed='true'] { background: #ef4444; border-color: #ef4444; color: #fff; }\n.recorder .wave { width: 44px; height: 18px; }\n.recorder.vertical .wave { width: 28px; }\n.recorder .wave[hidden] { display: none; }\n.recorder .mic.problem { border-color: var(--deictic-problem); color: var(--deictic-problem); }\n@keyframes deictic-blink { 50% { opacity: 0.3; } }\n`;\n\nconst svg = (paths: string) =>\n `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${paths}</svg>`;\nconst GRIP = svg(\n '<circle cx=\"9\" cy=\"6\" r=\"1\"/><circle cx=\"15\" cy=\"6\" r=\"1\"/><circle cx=\"9\" cy=\"12\" r=\"1\"/><circle cx=\"15\" cy=\"12\" r=\"1\"/><circle cx=\"9\" cy=\"18\" r=\"1\"/><circle cx=\"15\" cy=\"18\" r=\"1\"/>',\n);\nconst STOP = svg('<rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"1\" fill=\"currentColor\"/>');\nconst DISCARD = svg('<path d=\"M6 6l12 12M18 6 6 18\"/>');\nconst MIC = svg('<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\"/>');\n\nconst clock = (ms: number) => {\n const s = Math.floor(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nfunction storedDock(): Dock {\n try {\n const dock = JSON.parse(localStorage.getItem(DOCK) ?? 'null') as Dock | null;\n if (dock !== null && ['top', 'bottom', 'left', 'right'].includes(dock.edge) && dock.along >= 0 && dock.along <= 1) return dock;\n } catch {\n // Storage can be off, or hold something else: the default, then.\n }\n return { edge: 'bottom', along: 0.5 };\n}\n\nfunction iconButton(icon: string, name: string, run: () => void): HTMLButtonElement {\n const el = Object.assign(document.createElement('button'), { type: 'button', className: 'icon', title: name, innerHTML: icon });\n el.setAttribute('aria-label', name);\n el.addEventListener('click', run);\n return el;\n}\n\n/** Puts the bar on its edge, laid out along it, and how far along. */\nfunction place(bar: HTMLElement, { edge, along }: Dock): void {\n bar.classList.toggle('vertical', edge === 'left' || edge === 'right');\n const { width, height } = bar.getBoundingClientRect();\n const across = (room: number, size: number) => `${MARGIN + along * Math.max(0, room - size - MARGIN * 2)}px`;\n Object.assign(bar.style, {\n left: edge === 'left' ? `${MARGIN}px` : edge === 'right' ? `${innerWidth - width - MARGIN}px` : across(innerWidth, width),\n top: edge === 'top' ? `${MARGIN}px` : edge === 'bottom' ? `${innerHeight - height - MARGIN}px` : across(innerHeight, height),\n });\n}\n\n/** Dragging the bar by its grip, freely; let go, it docks to the nearest edge. */\nfunction draggable(bar: HTMLElement, grip: HTMLElement, docked: (dock: Dock) => void): void {\n grip.addEventListener('pointerdown', (e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n grip.setPointerCapture(e.pointerId);\n const start = bar.getBoundingClientRect();\n const dx = e.clientX - start.left;\n const dy = e.clientY - start.top;\n const move = (m: PointerEvent) => {\n bar.style.left = `${m.clientX - dx}px`;\n bar.style.top = `${m.clientY - dy}px`;\n };\n const up = () => {\n grip.removeEventListener('pointermove', move);\n const r = bar.getBoundingClientRect();\n const x = r.left + r.width / 2;\n const y = r.top + r.height / 2;\n const away: [Edge, number][] = [\n ['left', x],\n ['right', innerWidth - x],\n ['top', y],\n ['bottom', innerHeight - y],\n ];\n const [edge] = away.reduce((a, b) => (b[1] < a[1] ? b : a));\n const ratio = (at: number, room: number) => Math.min(1, Math.max(0, at / room));\n docked({ edge, along: edge === 'left' || edge === 'right' ? ratio(y, innerHeight) : ratio(x, innerWidth) });\n };\n grip.addEventListener('pointermove', move);\n grip.addEventListener('pointerup', up, { once: true });\n });\n}\n\nexport default defineClientPlugin<never, never, Recorder>({\n name: 'recordings',\n setup: ({ base, root, options, use, request }) => {\n const { masking, canvas } = options as { masking: ResolvedMasking; canvas?: false | { fps: number } };\n let going: Promise<Recording | undefined> | undefined;\n\n const post = async (route: string, body: unknown, keepalive = false) => {\n const res = await request(route, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n ...(keepalive ? { keepalive } : {}),\n });\n // `url`: where it replays, said by what keeps it with no server to serve it from (a `standalone` build).\n const answer = (await res.json()) as { id?: string; url?: string; problem?: string };\n if (answer.id === undefined) throw new Error(`recordings: ${answer.problem ?? res.statusText}`);\n return { id: answer.id, url: answer.url };\n };\n\n /** Records until Stop or Discard: a new recording, or `from`, one a page before this started. */\n const record = async (from?: Carried): Promise<Recording | undefined> => {\n const startedAt = from?.startedAt ?? Date.now();\n const begin = async (): Promise<string> => {\n const viewport = { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };\n const colorScheme = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n return (await post('begin', { page: location.href, viewport, colorScheme, startedAt } satisfies Meta)).id;\n };\n // What else goes in the recording, where its plugin is loaded: the console's lines and the page's requests, each\n // rrweb's own plugin, which listens from when rrweb starts until it stops. One that can't be had (its package\n // isn't installed) is said, and the recording goes on without.\n const extra = (name: 'logs' | 'network'): Promise<RecordPlugin | undefined> | undefined =>\n use(name)\n // A page that carries a recording on made requests before this: those of its load are the recording's too.\n ?.plugin({ sinceLoad: from !== undefined })\n .catch((e: unknown) => {\n console.warn(`deictic: this recording has no ${name}`, e);\n return undefined;\n });\n const [rrweb, id, ...extras] = await Promise.all([\n import('rrweb').catch((e: unknown) => {\n throw new Error('recordings need rrweb: add it to your devDependencies', { cause: e });\n }),\n from?.id ?? begin(),\n extra('logs'),\n extra('network'),\n ]);\n const clips: VoiceClip[] = from?.clips ?? [];\n // What the server doesn't have yet, and the place of the next part sent.\n let unsent: { type: number; data?: unknown }[] = [];\n let seq = from?.seq ?? 0;\n const host = root.host;\n const keep = dropOurs<(typeof unsent)[number]>(\n () => rrweb.record.mirror.getId(host),\n () => rrweb.record.mirror.getId(document.documentElement),\n );\n // The page's address changing with no load (a router's `pushState`, Back within the app, a hash), which rrweb\n // doesn't record: a custom event, so the recording says where each stretch happened. Nothing tells of\n // `pushState`, so it's read as each event comes, and as the clock ticks for a route that draws nothing.\n let href = location.href;\n const moved = () => {\n if (location.href === href) return;\n href = location.href;\n rrweb.record.addCustomEvent(PAGE, { href });\n };\n const stopRecording = rrweb.record({\n emit: (event) => {\n // Before what the new route drew, which is what comes next.\n moved();\n const kept = keep(event);\n if (kept !== undefined) unsent.push(kept);\n },\n plugins: extras.filter((plugin) => plugin !== undefined),\n blockClass: masking.blockClass,\n // deictic's own UI, the overlay: a blocked element is kept as an empty box its size, and it has none.\n blockSelector: ['deictic-overlay', ...(masking.blockSelector ? [masking.blockSelector] : [])].join(', '),\n maskTextClass: masking.maskTextClass,\n ...(masking.maskTextSelector ? { maskTextSelector: masking.maskTextSelector } : {}),\n maskAllInputs: masking.maskAllInputs,\n maskInputOptions: { password: true },\n inlineStylesheet: true,\n // A canvas as pictures of it, a few a second and only when it changed: rrweb's other way keeps every call\n // drawn on it, for which it wraps each drawing method of every canvas.\n ...(canvas === false || canvas === undefined\n ? {}\n : { recordCanvas: true, sampling: { canvas: canvas.fps }, dataURLOptions: { type: 'image/webp', quality: 0.6 } }),\n });\n\n // The marks, now and at each change: an SVG whose view is the page from its top left, at 1:1.\n const marks = use('annotations');\n // The toolbar's own, drawn while recording: shown with the page's, gone when it ends.\n const tools = marks?.tools();\n if (from?.path === location.pathname) for (const shape of from.marks) tools?.marks.add(shape);\n const mark = () => {\n const area = { x: -scrollX, y: -scrollY, width: 1, height: 1 };\n rrweb.record.addCustomEvent(MARKS, {\n svg: [marks?.svg(area), tools?.marks.svg(area)].filter(Boolean).join(''),\n // The same marks as data, in page coordinates, for whatever reads the recording but doesn't draw it.\n annotations: [...(marks?.list() ?? []), ...(tools?.marks.list() ?? [])],\n });\n };\n mark();\n\n // The mic, where the voice plugin is loaded: each stretch it's on is a clip, at its time in the recording.\n const voice = use('voice');\n let take: Take | undefined;\n /** What the next page carries on from, kept as it changes: a page that's going has no time to say it then. */\n let over = false;\n const save = () =>\n // Not once it's ended, as its last events go: the next page would carry on with one that's over.\n over ||\n carry({\n id,\n startedAt,\n seq,\n clips,\n mic: take !== undefined,\n path: location.pathname,\n marks: tools?.marks.list().map((a) => a.shape) ?? [],\n });\n const unsubscribe = [\n marks?.subscribe(mark),\n tools?.marks.subscribe(() => {\n mark();\n save();\n }),\n ];\n\n // One part at a time, each with its place. A part that didn't arrive goes again with the next, before it.\n let sending: Promise<void> = Promise.resolve();\n const flush = () => {\n const next = sending\n .catch(() => {})\n .then(async () => {\n if (unsent.length === 0) return;\n const part = unsent;\n unsent = [];\n const at = seq++;\n save();\n try {\n await post(`part/${id}?seq=${at}`, part);\n } catch (e) {\n unsent = [...part, ...unsent];\n throw e;\n }\n });\n sending = next;\n return next;\n };\n // A problem is heard at Stop, where it matters: a part that fails meanwhile goes again a second on.\n const flushing = setInterval(() => void flush().catch(() => {}), EVERY);\n save();\n\n return new Promise((done, fail) => {\n const bar = document.createElement('div');\n bar.className = 'recorder';\n bar.setAttribute('role', 'toolbar');\n bar.setAttribute('aria-label', 'Recording');\n const grip = Object.assign(document.createElement('span'), { className: 'grip', title: 'Drag to any edge', innerHTML: GRIP });\n const live = Object.assign(document.createElement('span'), { className: 'live' });\n const dot = Object.assign(document.createElement('span'), { className: 'dot' });\n const time = document.createElement('span');\n live.append(dot, time);\n const sep = () => Object.assign(document.createElement('span'), { className: 'sep' });\n\n // The mic's live waveform beside it while it's on, so it's plain it hears.\n const wave = Object.assign(document.createElement('canvas'), { className: 'wave', hidden: true });\n let stopWave: (() => void) | undefined;\n const unwave = () => {\n stopWave?.();\n stopWave = undefined;\n wave.hidden = true;\n };\n // What the mic is doing (asking for it, keeping a take): the next toggle, and the end, wait for it.\n let busy: Promise<void> = Promise.resolve();\n const micOff = async () => {\n const ending = take;\n take = undefined;\n unwave();\n if (ending === undefined) return;\n try {\n const clip = await ending.stop();\n clips.push({ id: clip.id, at: ending.started - startedAt, duration: clip.duration });\n } catch (e) {\n // The recording is worth keeping without it.\n console.warn('deictic: the voice clip was not kept', e);\n }\n };\n const mic = voice === undefined ? undefined : iconButton(MIC, 'Turn the mic on', () => toggle());\n const toggle = () => {\n busy = busy.then(async () => {\n if (voice === undefined || mic === undefined) return;\n if (take !== undefined) {\n await micOff();\n } else {\n try {\n take = await voice.start();\n mic.classList.remove('problem');\n wave.hidden = false;\n stopWave = liveWaveform(wave, take.stream, { played: '#ef4444', rest: '#52525b' });\n } catch (e) {\n mic.classList.add('problem');\n mic.title = e instanceof Error ? e.message : String(e);\n return;\n }\n }\n const on = take !== undefined;\n mic.setAttribute('aria-pressed', String(on));\n mic.title = on ? 'Turn the mic off' : 'Turn the mic on';\n mic.setAttribute('aria-label', mic.title);\n save();\n });\n };\n mic?.classList.add('mic');\n mic?.setAttribute('aria-pressed', 'false');\n // On, as the page before left it: a browser that was let use the mic gives it again without asking.\n if (from?.mic === true) toggle();\n\n // The page is going, for another or for good, with no time to wait for anything: what's sent of the mic's\n // take is its clip, the next page is told where things stand, and the last events go as the page does.\n const leave = () => {\n const spoken = take?.soFar();\n if (take !== undefined && spoken !== undefined)\n clips.push({ id: spoken.id, at: take.started - startedAt, duration: spoken.duration });\n const part = unsent;\n unsent = [];\n const at = seq++;\n save();\n // Not behind `sending`, which a page that's going never gets to: the server orders the parts by their place.\n // A browser sends 64 KB at most for a page that's gone, so a last second busier than that is lost.\n if (part.length > 0) void post(`part/${id}?seq=${at}`, part, true).catch(() => {});\n };\n addEventListener('pagehide', leave);\n\n const end = async (kept: boolean) => {\n rrweb.record.addCustomEvent(END, {});\n stopRecording?.();\n for (const stop of unsubscribe) stop?.();\n tools?.close();\n clearInterval(flushing);\n clearInterval(ticking);\n removeEventListener('resize', replace);\n removeEventListener('pagehide', leave);\n bar.remove();\n over = true;\n carry(undefined);\n await busy;\n if (!kept) {\n unwave();\n take?.cancel();\n void post(`discard/${id}`, {}).catch(() => {});\n return done(undefined);\n }\n await micOff();\n const duration = Date.now() - startedAt;\n const voiced = clips.length > 0 ? { voice: clips } : {};\n try {\n await flush();\n const { url } = await post(`end/${id}`, { duration, ...voiced } satisfies Pick<Kept, 'duration' | 'voice'>);\n done({ id, url: url ?? `${base}__deictic/plugins/recordings/replay/${id}`, duration, ...voiced });\n } catch (e) {\n fail(e);\n }\n };\n const stop = iconButton(STOP, 'Stop, and keep the recording', () => void end(true));\n const discard = iconButton(DISCARD, 'Discard the recording', () => void end(false));\n bar.append(grip, live, ...(tools ? [sep(), tools.element] : []), sep(), ...(mic ? [mic, wave] : []), stop, discard);\n const style = Object.assign(document.createElement('style'), { textContent: STYLE });\n bar.prepend(style);\n root.append(bar);\n\n const tick = () => {\n moved();\n time.textContent = clock(Date.now() - startedAt);\n };\n tick();\n const ticking = setInterval(tick, 250);\n let dock = storedDock();\n const replace = () => place(bar, dock);\n replace();\n addEventListener('resize', replace);\n draggable(bar, grip, (next) => {\n dock = next;\n replace();\n try {\n localStorage.setItem(DOCK, JSON.stringify(dock));\n } catch {\n // Not kept, then: the next recording starts at the bottom.\n }\n });\n });\n };\n\n const run = (from?: Carried) => {\n const mine = record(from).finally(() => {\n if (going === mine) going = undefined;\n });\n going = mine;\n return mine;\n };\n // One the page before this left going: carried on at once, whoever asks for it later (`going`), or no one.\n const left = carried();\n if (left !== undefined) {\n run(left).catch((e: unknown) => {\n // Not for the page after this to try again.\n carry(undefined);\n console.warn('deictic: the recording did not carry on, or was not kept', e);\n });\n }\n // A page shown again as it was left (Back, out of the browser's cache) knows nothing of what happened since:\n // loaded afresh, it carries on like any other.\n window.addEventListener('pageshow', (e) => {\n if (e.persisted && (going !== undefined || carried() !== undefined)) location.reload();\n });\n\n return {\n recording: () => going !== undefined,\n going: () => going,\n record: async () => {\n if (going !== undefined) throw new Error('recordings: one is going already: stop it first');\n return run();\n },\n };\n },\n});\n"],"mappings":";;;;;AAyBA,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,MAAM,4BAAY,IAAI,IAAI;CAAC;CAAG;CAAG;AAAE,CAAC;;AAGpC,SAAgB,SAA0B,QAAsB,QAAmD;CACjH,MAAM,uBAAO,IAAI,IAAY;CAC7B,QAAQ,UAAU;EAChB,IAAI,KAAK,SAAS,GAAG;GACnB,MAAM,KAAK,OAAO;GAClB,IAAI,KAAK,GAAG,KAAK,IAAI,EAAE;EAC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client.ts"],"sourcesContent":["/**\n * Keeps deictic's own UI out of a recording. Blocking the overlay keeps it out of the first snapshot,\n * but rrweb watches a blocked host's shadow root all the same, so what's added there later (the toolbar,\n * a note's field) comes as mutations. This drops them, and clicks and input on those nodes, by the IDs\n * rrweb gave them: the host's, and every node added under one of ours.\n *\n * The pointer's moves over them stay, on the page's root instead: the replay moves its cursor only over a\n * node it has, and while a drawing tool is picked the pointer is over ours the whole time.\n */\n\n/** The parts of rrweb's events this reads; the rest passes as it is. */\ninterface Event {\n type: number;\n data?: unknown;\n}\n\ninterface Mutation {\n source: 0;\n adds: { parentId: number; node: { id: number } }[];\n removes: { parentId: number; id: number }[];\n texts: { id: number }[];\n attributes: { id: number }[];\n}\n\n/** rrweb's numbers: an incremental snapshot, and the sources whose data is a list of pointer positions. */\nconst INCREMENTAL = 3;\nconst MUTATION = 0;\nconst POSITIONS = new Set([1, 6, 12]);\n\n/** A filter for `emit`: the event without our nodes, or nothing when nothing else is left in it. */\nexport function dropOurs<E extends Event>(hostId: () => number, pageId: () => number): (event: E) => E | undefined {\n const ours = new Set<number>();\n return (event) => {\n if (ours.size === 0) {\n const id = hostId();\n if (id > 0) ours.add(id);\n }\n if (event.type !== INCREMENTAL || typeof event.data !== 'object' || event.data === null) return event;\n const data = event.data as { source: number; id?: number; positions?: { id: number }[] };\n\n if (data.source === MUTATION) {\n const m = data as Mutation;\n // Added parents and children come in any order: claim until nothing more is ours.\n for (let grew = true; grew;) {\n grew = false;\n for (const add of m.adds) {\n if (ours.has(add.parentId) && !ours.has(add.node.id)) {\n ours.add(add.node.id);\n grew = true;\n }\n }\n }\n const kept: Mutation = {\n ...m,\n adds: m.adds.filter((a) => !ours.has(a.node.id)),\n removes: m.removes.filter((r) => !ours.has(r.id) && !ours.has(r.parentId)),\n texts: m.texts.filter((t) => !ours.has(t.id)),\n attributes: m.attributes.filter((a) => !ours.has(a.id)),\n };\n const left = kept.adds.length + kept.removes.length + kept.texts.length + kept.attributes.length;\n return left === 0 ? undefined : { ...event, data: kept };\n }\n if (POSITIONS.has(data.source) && Array.isArray(data.positions)) {\n const page = pageId();\n const positions = data.positions.map((p) => (ours.has(p.id) ? { ...p, id: page } : p));\n return { ...event, data: { ...data, positions } };\n }\n return data.id !== undefined && ours.has(data.id) ? undefined : event;\n };\n}\n","/**\n * The recordings plugin's page half. Its tool in the tool panel is Record: `record()` starts rrweb (imported\n * then), and while one is going the panel stays, with the time, the mic where the voice plugin is loaded, and\n * Stop and Discard in Record's place. A recording that's stopped goes in the tray, for the next task.\n *\n * The events go to the server as they happen (`begin`, a `part` each second, `end` on Stop), and what the next\n * page needs to carry on is kept in the tab's session storage: a reload, or a link to another page of the site,\n * leaves the recording going. The page that loads starts rrweb again under the same ID, which makes it a\n * recording of several pages as rrweb has them (a `Meta` and a snapshot for each), puts its controls back with\n * the time running, and turns the mic back on where it was.\n *\n * Nothing of deictic's is recorded: the overlay is blocked, as rrweb blocks. The marks are, as custom\n * events: the page's annotations, as SVGs in page coordinates, at the start and at each change.\n */\nimport { toolButton } from '#src/client/dom.ts';\nimport { playMark, trayed } from '#src/client/drawer.ts';\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport { defineClientPlugin } from '#src/index.ts';\nimport type { ResolvedMasking } from '#src/plugins/screenshots/index.ts';\n\nimport type { Take } from '#src/plugins/voice/index.ts';\n\nimport type { Kept, Meta, Recorder, Recording, RecordPlugin, VoiceClip } from './index.ts';\nimport { END, MARKS, PAGE } from './marks.ts';\nimport { dropOurs } from './ours.ts';\n\n/** Where the recording going on is kept, for the tab's next page to carry on with. */\nconst GOING = 'deictic:recording';\n/** How often the events are sent, in milliseconds. */\nconst EVERY = 1000;\n\n/** A recording going on, as the next page needs it. */\ninterface Carried {\n id: string;\n startedAt: number;\n /** The next part's place among the parts. */\n seq: number;\n /** The mic's clips so far, and whether it was on. */\n clips: VoiceClip[];\n mic: boolean;\n}\n\nfunction carried(): Carried | undefined {\n try {\n return (JSON.parse(sessionStorage.getItem(GOING) ?? 'null') as Carried | null) ?? undefined;\n } catch {\n // Storage can be off: nothing carries over, then.\n return undefined;\n }\n}\n\nfunction carry(going: Carried | undefined): void {\n try {\n if (going === undefined) sessionStorage.removeItem(GOING);\n else sessionStorage.setItem(GOING, JSON.stringify(going));\n } catch {\n // Not kept, then: a page load ends the recording.\n }\n}\n\nconst STYLE = `\n.recorder .going { display: flex; align-items: center; gap: 4px; }\n/* Away while nothing records: laid out empty, it would still count in the group's gap. */\n.recorder .going[hidden] { display: none; }\n/* While one goes, its controls are its section's alone: the other tools that capture (a shot, the mic, a task) wait. */\n.tool-panel:has(.recorder.going) .tool-group[data-section='capture']:not(.recorder) { display: none; }\n.tool-panel.vertical .recorder .going { flex-direction: column; }\n.recorder .live { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; font: 12px ui-monospace, monospace; }\n.tool-panel.vertical .recorder .live { flex-direction: column; gap: 2px; padding: 4px 0; }\n.recorder .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: deictic-blink 1.2s infinite; }\n.recorder .mic[aria-pressed='true'], .recorder .mic[aria-pressed='true']:hover { background: #ef4444; color: #fff; }\n.recorder .wave { width: 44px; height: 18px; }\n.tool-panel.vertical .recorder .wave { width: 28px; }\n@keyframes deictic-blink { 50% { opacity: 0.3; } }\n`;\n\n/** Each icon's strokes, on a 24-pixel grid. */\nconst RECORD = '<circle cx=\"12\" cy=\"12\" r=\"8\"/><circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\"/>';\nconst STOP = '<rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"1\" fill=\"currentColor\"/>';\nconst DISCARD = '<path d=\"M6 6l12 12M18 6 6 18\"/>';\nconst MIC = '<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\"/>';\n\nconst clock = (ms: number) => {\n const s = Math.floor(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nexport default defineClientPlugin<never, never, Recorder>({\n name: 'recordings',\n setup: ({ base, root, options, use, request, report, tools, tray, drawer, lightbox }) => {\n const { masking, canvas } = options as { masking: ResolvedMasking; canvas?: false | { fps: number } };\n let running: Promise<Recording | undefined> | undefined;\n\n // In the tool panel: Record, and in its place while one is going, what `record` puts there.\n const group = Object.assign(document.createElement('div'), { className: 'tool-group recorder' });\n const going = Object.assign(document.createElement('div'), { className: 'going', hidden: true });\n const start = toolButton(RECORD, 'Record', 'R', () => {\n run().catch((e: unknown) => {\n // Said where it was asked for: its tooltip, which a missing package's fix fits in.\n start.classList.add('problem');\n start.title = e instanceof Error ? e.message : String(e);\n });\n });\n group.append(Object.assign(document.createElement('style'), { textContent: STYLE }), start, going);\n // Beside the other tools that capture the page: a shot, a recording, the mic.\n tools.add(group, { section: 'capture' });\n // In the drawer until a task takes them: each plays back in the lightbox.\n drawer.add(\n trayed({ tray }, 'recordings', 'Recordings', (item, i, all) => {\n const { url, duration, voice } = item.value as Recording;\n const name = `${all.length === 1 ? 'Recording' : `Recording ${i + 1}`} ${clock(duration)}`;\n return {\n label: [playMark(), `${name}${voice === undefined ? '' : ' · voice'}`],\n // The replay filling the frame, without a header of its own: the lightbox names it.\n open: (from) => lightbox([{ kind: 'page', url: `${url}${url.includes('?') ? '&' : '?'}embed`, title: name }], { from }),\n };\n }),\n );\n\n const post = async (route: string, body: unknown, keepalive = false) => {\n const res = await request(route, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n ...(keepalive ? { keepalive } : {}),\n });\n // `url`: where it replays, said by what keeps it with no server to serve it from (a `standalone` build).\n const answer = (await res.json()) as { id?: string; url?: string; problem?: string };\n if (answer.id === undefined) throw new Error(`recordings: ${answer.problem ?? res.statusText}`);\n return { id: answer.id, url: answer.url };\n };\n\n /** Records until Stop or Discard: a new recording, or `from`, one a page before this started. */\n const record = async (from?: Carried): Promise<Recording | undefined> => {\n const startedAt = from?.startedAt ?? Date.now();\n const begin = async (): Promise<string> => {\n const viewport = { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };\n const colorScheme = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n return (await post('begin', { page: location.href, viewport, colorScheme, startedAt } satisfies Meta)).id;\n };\n // What else goes in the recording, where its plugin is loaded: the console's lines and the page's requests, each\n // rrweb's own plugin, which listens from when rrweb starts until it stops. One that can't be had (its package\n // isn't installed) is said, and the recording goes on without.\n const extra = (name: 'logs' | 'network'): Promise<RecordPlugin | undefined> | undefined =>\n use(name)\n // A page that carries a recording on made requests before this: those of its load are the recording's too.\n ?.plugin({ sinceLoad: from !== undefined })\n .catch((e: unknown) => {\n const why = e instanceof Error ? e.message : String(e);\n report({\n key: `page:recordings:${name}:${why.split('\\n', 1)[0]!.slice(0, 200)}`,\n kind: 'setup',\n message: `recordings go without ${name}, as it couldn't be loaded: install what it needs (\\`deictic init\\` does), then load the page again: ${why}`,\n ...(e instanceof Error && e.stack !== undefined ? { details: e.stack } : {}),\n });\n return undefined;\n });\n const [rrweb, id, ...extras] = await Promise.all([\n import('rrweb').catch((e: unknown) => {\n throw new Error('recordings need rrweb: add it to your devDependencies', { cause: e });\n }),\n from?.id ?? begin(),\n extra('logs'),\n extra('network'),\n ]);\n const clips: VoiceClip[] = from?.clips ?? [];\n // What the server doesn't have yet, and the place of the next part sent.\n let unsent: { type: number; data?: unknown }[] = [];\n let seq = from?.seq ?? 0;\n const host = root.host;\n const keep = dropOurs<(typeof unsent)[number]>(\n () => rrweb.record.mirror.getId(host),\n () => rrweb.record.mirror.getId(document.documentElement),\n );\n // The page's address changing with no load (a router's `pushState`, Back within the app, a hash), which rrweb\n // doesn't record: a custom event, so the recording says where each stretch happened. Nothing tells of\n // `pushState`, so it's read as each event comes, and as the clock ticks for a route that draws nothing.\n let href = location.href;\n const moved = () => {\n if (location.href === href) return;\n href = location.href;\n rrweb.record.addCustomEvent(PAGE, { href });\n };\n const stopRecording = rrweb.record({\n emit: (event) => {\n // Before what the new route drew, which is what comes next.\n moved();\n const kept = keep(event);\n if (kept !== undefined) unsent.push(kept);\n },\n plugins: extras.filter((plugin) => plugin !== undefined),\n blockClass: masking.blockClass,\n // deictic's own UI, the overlay: a blocked element is kept as an empty box its size, and it has none.\n blockSelector: ['deictic-overlay', ...(masking.blockSelector ? [masking.blockSelector] : [])].join(', '),\n maskTextClass: masking.maskTextClass,\n ...(masking.maskTextSelector ? { maskTextSelector: masking.maskTextSelector } : {}),\n maskAllInputs: masking.maskAllInputs,\n maskInputOptions: { password: true },\n inlineStylesheet: true,\n // A canvas as pictures of it, a few a second and only when it changed: rrweb's other way keeps every call\n // drawn on it, for which it wraps each drawing method of every canvas.\n ...(canvas === false || canvas === undefined\n ? {}\n : { recordCanvas: true, sampling: { canvas: canvas.fps }, dataURLOptions: { type: 'image/webp', quality: 0.6 } }),\n });\n\n // The marks, now and at each change: an SVG whose view is the page from its top left, at 1:1.\n const marks = use('annotations');\n const mark = () => {\n const area = { x: -scrollX, y: -scrollY, width: 1, height: 1 };\n rrweb.record.addCustomEvent(MARKS, {\n svg: marks?.svg(area) ?? '',\n // The same marks as data, in page coordinates, for whatever reads the recording but doesn't draw it.\n annotations: marks?.list() ?? [],\n });\n };\n mark();\n\n // The mic, where the voice plugin is loaded: each stretch it's on is a clip, at its time in the recording.\n const voice = use('voice');\n let take: Take | undefined;\n /** What the next page carries on from, kept as it changes: a page that's going has no time to say it then. */\n let over = false;\n const save = () =>\n // Not once it's ended, as its last events go: the next page would carry on with one that's over.\n over || carry({ id, startedAt, seq, clips, mic: take !== undefined });\n const unsubscribe = marks?.subscribe(mark);\n\n // One part at a time, each with its place. A part that didn't arrive goes again with the next, before it.\n let sending: Promise<void> = Promise.resolve();\n const flush = () => {\n const next = sending\n .catch(() => {})\n .then(async () => {\n if (unsent.length === 0) return;\n const part = unsent;\n unsent = [];\n const at = seq++;\n save();\n try {\n await post(`part/${id}?seq=${at}`, part);\n } catch (e) {\n unsent = [...part, ...unsent];\n throw e;\n }\n });\n sending = next;\n return next;\n };\n // A problem is heard at Stop, where it matters: a part that fails meanwhile goes again a second on.\n const flushing = setInterval(() => void flush().catch(() => {}), EVERY);\n save();\n\n return new Promise((done, fail) => {\n const live = Object.assign(document.createElement('span'), { className: 'live' });\n const dot = Object.assign(document.createElement('span'), { className: 'dot' });\n const time = document.createElement('span');\n live.append(dot, time);\n\n // The mic's live waveform beside it while it's on, so it's plain it hears.\n const wave = Object.assign(document.createElement('canvas'), { className: 'wave', hidden: true });\n let stopWave: (() => void) | undefined;\n const unwave = () => {\n stopWave?.();\n stopWave = undefined;\n wave.hidden = true;\n };\n // What the mic is doing (asking for it, keeping a take): the next toggle, and the end, wait for it.\n let busy: Promise<void> = Promise.resolve();\n const micOff = async () => {\n const ending = take;\n take = undefined;\n unwave();\n if (ending === undefined) return;\n try {\n const clip = await ending.stop();\n clips.push({ id: clip.id, at: ending.started - startedAt, duration: clip.duration });\n } catch (e) {\n // The recording is worth keeping without it.\n console.warn('deictic: the voice clip was not kept', e);\n }\n };\n const mic = voice === undefined ? undefined : toolButton(MIC, 'Turn the mic on', 'K', () => toggle());\n const toggle = () => {\n busy = busy.then(async () => {\n if (voice === undefined || mic === undefined) return;\n if (take !== undefined) {\n await micOff();\n } else {\n try {\n take = await voice.start();\n mic.classList.remove('problem');\n wave.hidden = false;\n stopWave = liveWaveform(wave, take.stream, { played: '#ef4444', rest: '#52525b' });\n } catch (e) {\n mic.classList.add('problem');\n mic.title = e instanceof Error ? e.message : String(e);\n return;\n }\n }\n const on = take !== undefined;\n mic.setAttribute('aria-pressed', String(on));\n mic.title = on ? 'Turn the mic off' : 'Turn the mic on';\n mic.setAttribute('aria-label', mic.title);\n save();\n });\n };\n mic?.classList.add('mic');\n mic?.setAttribute('aria-pressed', 'false');\n // On, as the page before left it: a browser that was let use the mic gives it again without asking.\n if (from?.mic === true) toggle();\n\n // The page is going, for another or for good, with no time to wait for anything: what's sent of the mic's\n // take is its clip, the next page is told where things stand, and the last events go as the page does.\n const leave = () => {\n const spoken = take?.soFar();\n if (take !== undefined && spoken !== undefined)\n clips.push({ id: spoken.id, at: take.started - startedAt, duration: spoken.duration });\n const part = unsent;\n unsent = [];\n const at = seq++;\n save();\n // Not behind `sending`, which a page that's going never gets to: the server orders the parts by their place.\n // A browser sends 64 KB at most for a page that's gone, so a last second busier than that is lost.\n if (part.length > 0) void post(`part/${id}?seq=${at}`, part, true).catch(() => {});\n };\n addEventListener('pagehide', leave);\n\n const end = async (kept: boolean) => {\n rrweb.record.addCustomEvent(END, {});\n stopRecording?.();\n unsubscribe?.();\n clearInterval(flushing);\n clearInterval(ticking);\n removeEventListener('pagehide', leave);\n idle();\n over = true;\n carry(undefined);\n await busy;\n if (!kept) {\n unwave();\n take?.cancel();\n void post(`discard/${id}`, {}).catch(() => {});\n return done(undefined);\n }\n await micOff();\n const duration = Date.now() - startedAt;\n const voiced = clips.length > 0 ? { voice: clips } : {};\n try {\n await flush();\n const { url } = await post(`end/${id}`, { duration, ...voiced } satisfies Pick<Kept, 'duration' | 'voice'>);\n done({ id, url: url ?? `${base}__deictic/plugins/recordings/replay/${id}`, duration, ...voiced });\n } catch (e) {\n fail(e);\n }\n };\n // Record's key again: it's Stop while one is going.\n const stop = toolButton(STOP, 'Stop', 'R', () => void end(true));\n const discard = toolButton(DISCARD, 'Discard', 'Shift+R', () => void end(false));\n going.replaceChildren(live, ...(mic ? [mic, wave] : []), stop, discard);\n // The panel stays while it goes: its controls are what ends it.\n const unkeep = tools.keep();\n start.hidden = true;\n going.hidden = false;\n group.classList.add('going');\n const idle = () => {\n unkeep();\n going.replaceChildren();\n going.hidden = true;\n start.hidden = false;\n group.classList.remove('going');\n };\n\n const tick = () => {\n moved();\n time.textContent = clock(Date.now() - startedAt);\n };\n tick();\n const ticking = setInterval(tick, 250);\n });\n };\n\n const run = (from?: Carried) => {\n start.disabled = true;\n start.classList.remove('problem');\n start.title = 'Record';\n const mine = record(from).finally(() => {\n if (running === mine) running = undefined;\n start.disabled = false;\n });\n running = mine;\n // One that's stopped and kept is the next task's, whoever started it.\n mine.then(\n (recording) => recording !== undefined && tray.add('recordings', recording.id, recording),\n () => {},\n );\n return mine;\n };\n // One the page before this left going: carried on at once, whoever asks for it later (`going`), or no one.\n const left = carried();\n if (left !== undefined) {\n run(left).catch((e: unknown) => {\n // Not for the page after this to try again.\n carry(undefined);\n console.warn('deictic: the recording did not carry on, or was not kept', e);\n });\n }\n // A page shown again as it was left (Back, out of the browser's cache) knows nothing of what happened since:\n // loaded afresh, it carries on like any other.\n window.addEventListener('pageshow', (e) => {\n if (e.persisted && (running !== undefined || carried() !== undefined)) location.reload();\n });\n\n return {\n recording: () => running !== undefined,\n going: () => running,\n record: async () => {\n if (running !== undefined) throw new Error('recordings: one is going already: stop it first');\n return run();\n },\n };\n },\n});\n"],"mappings":";;;;;;;AAyBA,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,MAAM,4BAAY,IAAI,IAAI;CAAC;CAAG;CAAG;AAAE,CAAC;;AAGpC,SAAgB,SAA0B,QAAsB,QAAmD;CACjH,MAAM,uBAAO,IAAI,IAAY;CAC7B,QAAQ,UAAU;EAChB,IAAI,KAAK,SAAS,GAAG;GACnB,MAAM,KAAK,OAAO;GAClB,IAAI,KAAK,GAAG,KAAK,IAAI,EAAE;EACzB;EACA,IAAI,MAAM,SAAS,eAAe,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MAAM,OAAO;EAChG,MAAM,OAAO,MAAM;EAEnB,IAAI,KAAK,WAAW,UAAU;GAC5B,MAAM,IAAI;GAEV,KAAK,IAAI,OAAO,MAAM,OAAO;IAC3B,OAAO;IACP,KAAK,MAAM,OAAO,EAAE,MAClB,IAAI,KAAK,IAAI,IAAI,QAAQ,KAAK,CAAC,KAAK,IAAI,IAAI,KAAK,EAAE,GAAG;KACpD,KAAK,IAAI,IAAI,KAAK,EAAE;KACpB,OAAO;IACT;GAEJ;GACA,MAAM,OAAiB;IACrB,GAAG;IACH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OAAO;GACL,iBAAiB,YAAY,KAAA;GAC7B,aAAa;GACb,QAAQ,YAAY;IAClB,IAAI,YAAY,KAAA,GAAW,MAAM,IAAI,MAAM,iDAAiD;IAC5F,OAAO,IAAI;GACb;EACF;CACF;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/screenshots/client.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/screenshots/client.ts"],"mappings":";;;;;;;YAqBY,eACV,SAAS,SACT;EACE,MAAM,YAAY;EAClB,SAAS;EACT;EACA,UAAU,MAAM;MAEf;EAAU,MAAM;EAAe;EAAc,KAAK;;;qBAG1C,UAAO,MAAU;;wBAGd,MAAM,SAAS,SAAS,MAAM,YAAY,0BAA0B;;;;;;wBAgBpE,KAAK,MAAM,MAAM,GAAG;wBAqBpB,kBAAkB,SAAS,gCAAW,2BAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as definePlugin } from "./src.js";
|
|
2
2
|
// src/plugins/annotations/index.ts
|
|
3
3
|
/**
|
|
4
|
-
* `deictic/annotations`: mark up the page itself. Its
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `deictic/annotations`: mark up the page itself. Its tools are in the tool panel: boxes, arrows, a pen and notes,
|
|
5
|
+
* drawn where the page is, so they stay with it as it scrolls. They're kept for the tab's session, per page, until
|
|
6
|
+
* they're cleared or a task takes them.
|
|
7
7
|
*
|
|
8
8
|
* They're data other plugins build on, through `use('annotations')` in the page: screenshots draw them
|
|
9
9
|
* over the page (`svg(area)`), tasks repeat their notes, and a recording can keep each change as it
|
|
@@ -13,7 +13,6 @@ function annotations(options = {}) {
|
|
|
13
13
|
return definePlugin({
|
|
14
14
|
name: "annotations",
|
|
15
15
|
client: "deictic/annotations/client",
|
|
16
|
-
shortcut: options.shortcut,
|
|
17
16
|
clientOptions: { color: options.color ?? "#ef4444" }
|
|
18
17
|
});
|
|
19
18
|
}
|