deictic 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +143 -2
- package/dist/annotations/client.d.ts +4 -0
- package/dist/annotations/client.d.ts.map +1 -0
- package/dist/annotations/client.js +497 -0
- package/dist/annotations/client.js.map +1 -0
- package/dist/annotations/index.d.ts +110 -0
- package/dist/annotations/index.d.ts.map +1 -0
- package/dist/annotations/index.js +22 -0
- package/dist/annotations/index.js.map +1 -0
- package/dist/astro.d.ts +29 -0
- package/dist/astro.d.ts.map +1 -0
- package/dist/astro.js +24 -0
- package/dist/astro.js.map +1 -0
- package/dist/bun.d.ts +12 -0
- package/dist/bun.d.ts.map +1 -0
- package/dist/bun.js +67 -0
- package/dist/bun.js.map +1 -0
- package/dist/client/index.d.ts +93 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1329 -0
- package/dist/client/index.js.map +1 -0
- package/dist/endpoints.js +354 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/index.d.ts +220 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/index2.d.ts +23 -0
- package/dist/index3.d.ts +98 -0
- package/dist/index3.d.ts.map +1 -0
- package/dist/index4.d.ts +74 -0
- package/dist/index4.d.ts.map +1 -0
- package/dist/index5.d.ts +70 -0
- package/dist/index5.d.ts.map +1 -0
- package/dist/integration.d.ts +19 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +277 -0
- package/dist/integration.js.map +1 -0
- package/dist/kept.js +23 -0
- package/dist/kept.js.map +1 -0
- package/dist/loader.d.ts +15 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +17 -0
- package/dist/loader.js.map +1 -0
- package/dist/marks.js +14 -0
- package/dist/marks.js.map +1 -0
- package/dist/next.d.ts +17 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +150 -0
- package/dist/next.js.map +1 -0
- package/dist/playwright.js +105 -0
- package/dist/playwright.js.map +1 -0
- package/dist/recommended/index.d.ts +25 -0
- package/dist/recommended/index.d.ts.map +1 -0
- package/dist/recommended/index.js +19 -0
- package/dist/recommended/index.js.map +1 -0
- package/dist/recordings/client.d.ts +4 -0
- package/dist/recordings/client.d.ts.map +1 -0
- package/dist/recordings/client.js +376 -0
- package/dist/recordings/client.js.map +1 -0
- package/dist/recordings/index.d.ts +2 -0
- package/dist/recordings/index.js +3 -0
- package/dist/recordings.js +235 -0
- package/dist/recordings.js.map +1 -0
- package/dist/screenshots/client.d.ts +23 -0
- package/dist/screenshots/client.d.ts.map +1 -0
- package/dist/screenshots/client.js +76 -0
- package/dist/screenshots/client.js.map +1 -0
- package/dist/screenshots/dom.d.ts +4 -0
- package/dist/screenshots/dom.d.ts.map +1 -0
- package/dist/screenshots/dom.js +92 -0
- package/dist/screenshots/dom.js.map +1 -0
- package/dist/screenshots/index.d.ts +2 -0
- package/dist/screenshots/index.js +98 -0
- package/dist/screenshots/index.js.map +1 -0
- package/dist/screenshots/rrweb.d.ts +9 -0
- package/dist/screenshots/rrweb.d.ts.map +1 -0
- package/dist/screenshots/rrweb.js +60 -0
- package/dist/screenshots/rrweb.js.map +1 -0
- package/dist/shortcut.js +63 -0
- package/dist/shortcut.js.map +1 -0
- package/dist/tailwind/client.d.ts +4 -0
- package/dist/tailwind/client.d.ts.map +1 -0
- package/dist/tailwind/client.js +613 -0
- package/dist/tailwind/client.js.map +1 -0
- package/dist/tailwind/index.d.ts +2 -0
- package/dist/tailwind/index.js +557 -0
- package/dist/tailwind/index.js.map +1 -0
- package/dist/tasks/client.d.ts +6 -0
- package/dist/tasks/client.d.ts.map +1 -0
- package/dist/tasks/client.js +642 -0
- package/dist/tasks/client.js.map +1 -0
- package/dist/tasks/index.d.ts +159 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +348 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/vite.d.ts +17 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +44 -0
- package/dist/vite.js.map +1 -0
- package/dist/voice/client.d.ts +4 -0
- package/dist/voice/client.d.ts.map +1 -0
- package/dist/voice/client.js +66 -0
- package/dist/voice/client.js.map +1 -0
- package/dist/voice/index.d.ts +47 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +74 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/waveform.js +93 -0
- package/dist/waveform.js.map +1 -0
- package/dist/webpack.d.ts +50 -0
- package/dist/webpack.d.ts.map +1 -0
- package/dist/webpack.js +78 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +313 -4
- package/skills/deictic/SKILL.md +47 -0
- package/skills/deictic/references/install.md +81 -0
- package/skills/deictic/references/recordings.md +83 -0
- package/skills/deictic/references/tasks.md +79 -0
- package/skills/deictic/references/watch.md +43 -0
- package/skills/deictic/scripts/frame.mjs +62 -0
- package/skills/deictic/scripts/lib.mjs +193 -0
- package/skills/deictic/scripts/recording.mjs +186 -0
- package/skills/deictic/scripts/task.mjs +84 -0
- package/skills/deictic/scripts/transcribe.mjs +93 -0
- package/skills/deictic/scripts/voice.mjs +50 -0
- package/skills/deictic/scripts/watch.mjs +51 -0
- package/src/astro.ts +34 -0
- package/src/bun.ts +79 -0
- package/src/client/index.ts +833 -0
- package/src/client/lightbox.ts +256 -0
- package/src/client/style.ts +243 -0
- package/src/client/tooltip.ts +78 -0
- package/src/client/waveform.ts +98 -0
- package/src/index.ts +240 -0
- package/src/loader.ts +28 -0
- package/src/next.ts +133 -0
- package/src/plugins/annotations/client.ts +301 -0
- package/src/plugins/annotations/draw.ts +169 -0
- package/src/plugins/annotations/index.ts +105 -0
- package/src/plugins/annotations/svg.ts +61 -0
- package/src/plugins/recommended/index.ts +35 -0
- package/src/plugins/recordings/client.ts +315 -0
- package/src/plugins/recordings/index.ts +174 -0
- package/src/plugins/recordings/marks.ts +11 -0
- package/src/plugins/recordings/ours.ts +70 -0
- package/src/plugins/recordings/replay.ts +139 -0
- package/src/plugins/screenshots/client.ts +63 -0
- package/src/plugins/screenshots/dom.ts +79 -0
- package/src/plugins/screenshots/index.ts +194 -0
- package/src/plugins/screenshots/playwright.ts +119 -0
- package/src/plugins/screenshots/rrweb.ts +45 -0
- package/src/plugins/tailwind/catalog.ts +396 -0
- package/src/plugins/tailwind/client.ts +669 -0
- package/src/plugins/tailwind/index.ts +267 -0
- package/src/plugins/tasks/client.ts +622 -0
- package/src/plugins/tasks/index.ts +513 -0
- package/src/plugins/voice/client.ts +57 -0
- package/src/plugins/voice/index.ts +114 -0
- package/src/shortcut.ts +83 -0
- package/src/tools/astro.ts +81 -0
- package/src/tools/editor.ts +22 -0
- package/src/tools/endpoints.ts +163 -0
- package/src/tools/history.ts +203 -0
- package/src/tools/integration.ts +106 -0
- package/src/tools/kept.ts +21 -0
- package/src/tools/locate.ts +94 -0
- package/src/tools/plugins.ts +41 -0
- package/src/tools/source.ts +72 -0
- package/src/vite.ts +62 -0
- package/src/webpack.ts +107 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
// src/plugins/screenshots/playwright.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `rrweb()` renderer's server half: rebuilds a page's snapshot in a browser beside the dev server and
|
|
5
|
+
* screenshots it at the page's viewport, scroll and pixel density, so text lays out as the page's does. The
|
|
6
|
+
* browser is launched on the first shot and kept for the next; Playwright closes it with the process.
|
|
7
|
+
*
|
|
8
|
+
* The snapshot is rebuilt into a sandboxed iframe filling a blank page on the page's own origin, which
|
|
9
|
+
* Playwright answers itself, so nothing asks the dev server for it: rrweb has made the snapshot's URLs
|
|
10
|
+
* whole, and its stylesheets' fonts and images load from the dev server as the page's did.
|
|
11
|
+
*/
|
|
12
|
+
const HOST = "<!doctype html><html><body style=\"margin:0\"></body></html>";
|
|
13
|
+
const browsers = /* @__PURE__ */ new Map();
|
|
14
|
+
/** A browser by the options, launched once: the one named, or Playwright's own Chromium, then Chrome, then Edge. */
|
|
15
|
+
function browserOf(options) {
|
|
16
|
+
const key = JSON.stringify(options);
|
|
17
|
+
const known = browsers.get(key);
|
|
18
|
+
if (known !== void 0) return known;
|
|
19
|
+
const launched = launch(options);
|
|
20
|
+
browsers.set(key, launched);
|
|
21
|
+
launched.catch(() => browsers.delete(key));
|
|
22
|
+
return launched;
|
|
23
|
+
}
|
|
24
|
+
async function launch({ executablePath, channel }) {
|
|
25
|
+
const { chromium } = await import("playwright-core").catch((e) => {
|
|
26
|
+
throw new Error("the rrweb() renderer needs playwright-core: add it to your devDependencies", { cause: e });
|
|
27
|
+
});
|
|
28
|
+
if (executablePath !== void 0 || channel !== void 0) return chromium.launch({
|
|
29
|
+
executablePath,
|
|
30
|
+
channel
|
|
31
|
+
});
|
|
32
|
+
const tried = [];
|
|
33
|
+
for (const attempt of [
|
|
34
|
+
{},
|
|
35
|
+
{ channel: "chrome" },
|
|
36
|
+
{ channel: "msedge" }
|
|
37
|
+
]) try {
|
|
38
|
+
return await chromium.launch(attempt);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
tried.push(`${"channel" in attempt ? attempt.channel : "Playwright's Chromium"}: ${(e instanceof Error ? e.message : String(e)).split("\n", 1)[0]}`);
|
|
41
|
+
}
|
|
42
|
+
throw new Error(`the rrweb() renderer found no browser to render in (${tried.join("; ")}): run \`npx playwright install chromium\`, or pass rrweb({ executablePath })`);
|
|
43
|
+
}
|
|
44
|
+
/** The rrweb-snapshot bundle that defines `rrwebSnapshot` in a page: its CommonJS entry is that bundle. */
|
|
45
|
+
const bundle = () => createRequire(import.meta.url).resolve("rrweb-snapshot");
|
|
46
|
+
async function render(input, options) {
|
|
47
|
+
const shot = input;
|
|
48
|
+
if (typeof shot?.url !== "string" || typeof shot.snapshot !== "object" || typeof shot.viewport?.width !== "number") throw new Error("screenshots: that is not a snapshot the rrweb() renderer took");
|
|
49
|
+
const context = await (await browserOf(options)).newContext({
|
|
50
|
+
viewport: shot.viewport,
|
|
51
|
+
deviceScaleFactor: shot.scale
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
const page = await context.newPage();
|
|
55
|
+
const host = new URL("/__deictic/plugins/screenshots/host", shot.url).href;
|
|
56
|
+
await page.route(host, (route) => route.fulfill({
|
|
57
|
+
contentType: "text/html",
|
|
58
|
+
body: HOST
|
|
59
|
+
}));
|
|
60
|
+
await page.goto(host);
|
|
61
|
+
await page.addScriptTag({ path: bundle() });
|
|
62
|
+
await page.evaluate(async ({ snapshot, scroll, overlay }) => {
|
|
63
|
+
const { rebuildIntoSandboxedIframe, createCache, createMirror } = globalThis.rrwebSnapshot;
|
|
64
|
+
const { iframe } = rebuildIntoSandboxedIframe(snapshot, {
|
|
65
|
+
root: document.body,
|
|
66
|
+
cache: createCache(),
|
|
67
|
+
mirror: createMirror(),
|
|
68
|
+
iframeAttributes: { style: "border:0;position:fixed;inset:0;width:100vw;height:100vh" }
|
|
69
|
+
});
|
|
70
|
+
const doc = iframe.contentDocument;
|
|
71
|
+
if (doc === null) throw new Error("screenshots: the snapshot was rebuilt where it cannot be read");
|
|
72
|
+
await doc.fonts.ready;
|
|
73
|
+
await Promise.all([...doc.images].map((img) => img.decode().catch(() => {})));
|
|
74
|
+
iframe.contentWindow?.scrollTo(scroll.x, scroll.y);
|
|
75
|
+
if (overlay === void 0) return;
|
|
76
|
+
const marks = document.createElement("div");
|
|
77
|
+
marks.style.cssText = "position:fixed;inset:0;z-index:1;pointer-events:none";
|
|
78
|
+
marks.innerHTML = overlay;
|
|
79
|
+
document.body.append(marks);
|
|
80
|
+
}, shot);
|
|
81
|
+
const clip = shot.clip === void 0 ? void 0 : clamp(shot.clip, shot.viewport);
|
|
82
|
+
return new Uint8Array(await page.screenshot({
|
|
83
|
+
type: "png",
|
|
84
|
+
...clip === void 0 ? {} : { clip }
|
|
85
|
+
}));
|
|
86
|
+
} finally {
|
|
87
|
+
await context.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** A box kept within the viewport: an element partly scrolled out of it shows only the part that's in. */
|
|
91
|
+
function clamp(box, viewport) {
|
|
92
|
+
const x = Math.max(0, box.x);
|
|
93
|
+
const y = Math.max(0, box.y);
|
|
94
|
+
const width = Math.min(viewport.width, box.x + box.width) - x;
|
|
95
|
+
const height = Math.min(viewport.height, box.y + box.height) - y;
|
|
96
|
+
return width > 0 && height > 0 ? {
|
|
97
|
+
x,
|
|
98
|
+
y,
|
|
99
|
+
width,
|
|
100
|
+
height
|
|
101
|
+
} : void 0;
|
|
102
|
+
}
|
|
103
|
+
export { render };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=playwright.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.js","names":[],"sources":["../src/plugins/screenshots/playwright.ts"],"sourcesContent":["/**\n * The `rrweb()` renderer's server half: rebuilds a page's snapshot in a browser beside the dev server and\n * screenshots it at the page's viewport, scroll and pixel density, so text lays out as the page's does. The\n * browser is launched on the first shot and kept for the next; Playwright closes it with the process.\n *\n * The snapshot is rebuilt into a sandboxed iframe filling a blank page on the page's own origin, which\n * Playwright answers itself, so nothing asks the dev server for it: rrweb has made the snapshot's URLs\n * whole, and its stylesheets' fonts and images load from the dev server as the page's did.\n */\nimport { createRequire } from 'node:module';\n\nimport type { Browser } from 'playwright-core';\nimport type * as Rrweb from 'rrweb-snapshot';\n\nimport type { Box, BrowserOptions } from './index.ts';\n\n/** What the page sends: its snapshot and what's needed to show it as the page does. */\n/** A node of an rrweb snapshot, as `snapshot()` answers it. */\nexport type SnapshotNode = NonNullable<ReturnType<typeof Rrweb.snapshot>>;\n\nexport interface Snapshot {\n snapshot: SnapshotNode;\n url: string;\n viewport: { width: number; height: number };\n scroll: { x: number; y: number };\n scale: number;\n /** The part of the viewport to keep, for a shot of an element alone. */\n clip?: Box;\n /** An SVG the viewport's size, drawn over the page: the annotations, where there are any. */\n overlay?: string;\n}\n\nconst HOST = '<!doctype html><html><body style=\"margin:0\"></body></html>';\n\nconst browsers = new Map<string, Promise<Browser>>();\n\n/** A browser by the options, launched once: the one named, or Playwright's own Chromium, then Chrome, then Edge. */\nexport function browserOf(options: BrowserOptions): Promise<Browser> {\n const key = JSON.stringify(options);\n const known = browsers.get(key);\n if (known !== undefined) return known;\n const launched = launch(options);\n browsers.set(key, launched);\n // A launch that failed is tried again on the next shot, after the user installs what it said to.\n launched.catch(() => browsers.delete(key));\n return launched;\n}\n\nasync function launch({ executablePath, channel }: BrowserOptions): Promise<Browser> {\n const { chromium } = await import('playwright-core').catch((e: unknown) => {\n throw new Error('the rrweb() renderer needs playwright-core: add it to your devDependencies', { cause: e });\n });\n if (executablePath !== undefined || channel !== undefined) return chromium.launch({ executablePath, channel });\n const tried: string[] = [];\n for (const attempt of [{}, { channel: 'chrome' }, { channel: 'msedge' }]) {\n try {\n return await chromium.launch(attempt);\n } catch (e) {\n tried.push(\n `${'channel' in attempt ? attempt.channel : \"Playwright's Chromium\"}: ${(e instanceof Error ? e.message : String(e)).split('\\n', 1)[0]}`,\n );\n }\n }\n throw new Error(\n `the rrweb() renderer found no browser to render in (${tried.join('; ')}): run \\`npx playwright install chromium\\`, or pass rrweb({ executablePath })`,\n );\n}\n\n/** The rrweb-snapshot bundle that defines `rrwebSnapshot` in a page: its CommonJS entry is that bundle. */\nconst bundle = () => createRequire(import.meta.url).resolve('rrweb-snapshot');\n\nexport async function render(input: unknown, options: BrowserOptions): Promise<Uint8Array> {\n const shot = input as Snapshot;\n if (typeof shot?.url !== 'string' || typeof shot.snapshot !== 'object' || typeof shot.viewport?.width !== 'number')\n throw new Error('screenshots: that is not a snapshot the rrweb() renderer took');\n const browser = await browserOf(options);\n const context = await browser.newContext({ viewport: shot.viewport, deviceScaleFactor: shot.scale });\n try {\n const page = await context.newPage();\n const host = new URL('/__deictic/plugins/screenshots/host', shot.url).href;\n await page.route(host, (route) => route.fulfill({ contentType: 'text/html', body: HOST }));\n await page.goto(host);\n await page.addScriptTag({ path: bundle() });\n await page.evaluate(async ({ snapshot, scroll, overlay }) => {\n const { rebuildIntoSandboxedIframe, createCache, createMirror } = (globalThis as unknown as { rrwebSnapshot: typeof Rrweb })\n .rrwebSnapshot;\n const { iframe } = rebuildIntoSandboxedIframe(snapshot, {\n root: document.body,\n cache: createCache(),\n mirror: createMirror(),\n iframeAttributes: { style: 'border:0;position:fixed;inset:0;width:100vw;height:100vh' },\n });\n const doc = iframe.contentDocument;\n if (doc === null) throw new Error('screenshots: the snapshot was rebuilt where it cannot be read');\n await doc.fonts.ready;\n await Promise.all([...doc.images].map((img) => img.decode().catch(() => {})));\n iframe.contentWindow?.scrollTo(scroll.x, scroll.y);\n if (overlay === undefined) return;\n // Over the page and its scroll: the SVG is the viewport's, already where it scrolled to.\n const marks = document.createElement('div');\n marks.style.cssText = 'position:fixed;inset:0;z-index:1;pointer-events:none';\n marks.innerHTML = overlay;\n document.body.append(marks);\n }, shot);\n const clip = shot.clip === undefined ? undefined : clamp(shot.clip, shot.viewport);\n return new Uint8Array(await page.screenshot({ type: 'png', ...(clip === undefined ? {} : { clip }) }));\n } finally {\n await context.close();\n }\n}\n\n/** A box kept within the viewport: an element partly scrolled out of it shows only the part that's in. */\nfunction clamp(box: Box, viewport: { width: number; height: number }): Box | undefined {\n const x = Math.max(0, box.x);\n const y = Math.max(0, box.y);\n const width = Math.min(viewport.width, box.x + box.width) - x;\n const height = Math.min(viewport.height, box.y + box.height) - y;\n return width > 0 && height > 0 ? { x, y, width, height } : undefined;\n}\n"],"mappings":";;;;;;;;;;;AAgCA,MAAM,OAAO;AAEb,MAAM,2BAAW,IAAI,IAA8B;;AAGnD,SAAgB,UAAU,SAA2C;CACnE,MAAM,MAAM,KAAK,UAAU,OAAO;CAClC,MAAM,QAAQ,SAAS,IAAI,GAAG;CAC9B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,WAAW,OAAO,OAAO;CAC/B,SAAS,IAAI,KAAK,QAAQ;CAE1B,SAAS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AI,IAAI,IAAI,KAAK,IAAI;CAC5D,MAAM,SAAS,KAAK,IAAI,SAAS,QAAQ,IAAI,IAAI,IAAI,MAAM,IAAI;CAC/D,OAAO,QAAQ,KAAK,SAAS,IAAI;EAAE;EAAG;EAAG;EAAO;CAAO,IAAI,KAAA;AAC7D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what
|
|
3
|
+
* should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.
|
|
4
|
+
*
|
|
5
|
+
* Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin
|
|
6
|
+
* outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.
|
|
7
|
+
*/
|
|
8
|
+
import { g as ServerPlugin } from "../index.js";
|
|
9
|
+
import { AnnotationsOptions } from "../annotations/index.js";
|
|
10
|
+
import { a as RecordingsOptions } from "../index4.js";
|
|
11
|
+
import { l as ScreenshotsOptions } from "../index3.js";
|
|
12
|
+
import { TasksOptions } from "../tasks/index.js";
|
|
13
|
+
import { VoiceOptions } from "../voice/index.js";
|
|
14
|
+
/** Each plugin's options, by its name, or `false` to leave it out. */
|
|
15
|
+
export interface RecommendedOptions {
|
|
16
|
+
tasks?: TasksOptions | false;
|
|
17
|
+
screenshots?: ScreenshotsOptions | false;
|
|
18
|
+
annotations?: AnnotationsOptions | false;
|
|
19
|
+
recordings?: RecordingsOptions | false;
|
|
20
|
+
voice?: VoiceOptions | false;
|
|
21
|
+
}
|
|
22
|
+
/** Tasks, screenshots, annotations, recordings and voice, in that order: the order of their tabs. */
|
|
23
|
+
export declare function recommended(options?: RecommendedOptions): ServerPlugin[];
|
|
24
|
+
export { recommended as default };
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/recommended/index.ts"],"mappings":";;;;;;;;;;;;;;iBAeiB;EACf,QAAQ;EACR,cAAc;EACd,cAAc;EACd,aAAa;EACb,QAAQ;;;wBAIM,YAAY,UAAS,qBAA0B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { annotations } from "../annotations/index.js";
|
|
2
|
+
import { t as recordings } from "../recordings.js";
|
|
3
|
+
import screenshots from "../screenshots/index.js";
|
|
4
|
+
import tasks from "../tasks/index.js";
|
|
5
|
+
import voice from "../voice/index.js";
|
|
6
|
+
// src/plugins/recommended/index.ts
|
|
7
|
+
/** Tasks, screenshots, annotations, recordings and voice, in that order: the order of their tabs. */
|
|
8
|
+
function recommended(options = {}) {
|
|
9
|
+
const plugins = [];
|
|
10
|
+
if (options.tasks !== false) plugins.push(tasks(options.tasks));
|
|
11
|
+
if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));
|
|
12
|
+
if (options.annotations !== false) plugins.push(annotations(options.annotations));
|
|
13
|
+
if (options.recordings !== false) plugins.push(recordings(options.recordings));
|
|
14
|
+
if (options.voice !== false) plugins.push(voice(options.voice));
|
|
15
|
+
return plugins;
|
|
16
|
+
}
|
|
17
|
+
export { recommended as default, recommended };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/recommended/index.ts"],"sourcesContent":["/**\n * `deictic/recommended`: the plugins for describing a change rather than making it. Alt-click an element, say what\n * should change, attach a screenshot to draw on, a screen recording or your voice, and it goes to a Vercel Board.\n *\n * Only the server halves, as every factory is: each names its page half, which the integration imports. A plugin\n * outside the preset (Tailwind, your own) goes beside it: `plugins: [...recommended(), tailwind()]`.\n */\nimport type { ServerPlugin } from '#src/index.ts';\nimport { annotations, type AnnotationsOptions } from '#src/plugins/annotations/index.ts';\nimport { recordings, type RecordingsOptions } from '#src/plugins/recordings/index.ts';\nimport { screenshots, type ScreenshotsOptions } from '#src/plugins/screenshots/index.ts';\nimport { tasks, type TasksOptions } from '#src/plugins/tasks/index.ts';\nimport { voice, type VoiceOptions } from '#src/plugins/voice/index.ts';\n\n/** Each plugin's options, by its name, or `false` to leave it out. */\nexport interface RecommendedOptions {\n tasks?: TasksOptions | false;\n screenshots?: ScreenshotsOptions | false;\n annotations?: AnnotationsOptions | false;\n recordings?: RecordingsOptions | false;\n voice?: VoiceOptions | false;\n}\n\n/** Tasks, screenshots, annotations, recordings and voice, in that order: the order of their tabs. */\nexport function recommended(options: RecommendedOptions = {}): ServerPlugin[] {\n const plugins: ServerPlugin[] = [];\n if (options.tasks !== false) plugins.push(tasks(options.tasks));\n if (options.screenshots !== false) plugins.push(screenshots(options.screenshots));\n if (options.annotations !== false) plugins.push(annotations(options.annotations));\n if (options.recordings !== false) plugins.push(recordings(options.recordings));\n if (options.voice !== false) plugins.push(voice(options.voice));\n return plugins;\n}\n\nexport default recommended;\n"],"mappings":";;;;;;;AAwBA,SAAgB,YAAY,UAA8B,CAAC,GAAmB;CAC5E,MAAM,UAA0B,CAAC;CACjC,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAC9D,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,gBAAgB,OAAO,QAAQ,KAAK,YAAY,QAAQ,WAAW,CAAC;CAChF,IAAI,QAAQ,eAAe,OAAO,QAAQ,KAAK,WAAW,QAAQ,UAAU,CAAC;CAC7E,IAAI,QAAQ,UAAU,OAAO,QAAQ,KAAK,MAAM,QAAQ,KAAK,CAAC;CAC9D,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/plugins/recordings/client.ts"],"mappings":";cAiIA,4B"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { n as liveWaveform } from "../waveform.js";
|
|
2
|
+
import { defineClientPlugin } from "../index.js";
|
|
3
|
+
import { n as MARKS, t as END } from "../marks.js";
|
|
4
|
+
// src/plugins/recordings/ours.ts
|
|
5
|
+
/** rrweb's numbers: an incremental snapshot, and the sources whose data is a list of pointer positions. */
|
|
6
|
+
const INCREMENTAL = 3;
|
|
7
|
+
const MUTATION = 0;
|
|
8
|
+
const POSITIONS = /* @__PURE__ */ new Set([
|
|
9
|
+
1,
|
|
10
|
+
6,
|
|
11
|
+
12
|
|
12
|
+
]);
|
|
13
|
+
/** A filter for `emit`: the event without our nodes, or nothing when nothing else is left in it. */
|
|
14
|
+
function dropOurs(hostId, pageId) {
|
|
15
|
+
const ours = /* @__PURE__ */ new Set();
|
|
16
|
+
return (event) => {
|
|
17
|
+
if (ours.size === 0) {
|
|
18
|
+
const id = hostId();
|
|
19
|
+
if (id > 0) ours.add(id);
|
|
20
|
+
}
|
|
21
|
+
if (event.type !== INCREMENTAL || typeof event.data !== "object" || event.data === null) return event;
|
|
22
|
+
const data = event.data;
|
|
23
|
+
if (data.source === MUTATION) {
|
|
24
|
+
const m = data;
|
|
25
|
+
for (let grew = true; grew;) {
|
|
26
|
+
grew = false;
|
|
27
|
+
for (const add of m.adds) if (ours.has(add.parentId) && !ours.has(add.node.id)) {
|
|
28
|
+
ours.add(add.node.id);
|
|
29
|
+
grew = true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const kept = {
|
|
33
|
+
...m,
|
|
34
|
+
adds: m.adds.filter((a) => !ours.has(a.node.id)),
|
|
35
|
+
removes: m.removes.filter((r) => !ours.has(r.id) && !ours.has(r.parentId)),
|
|
36
|
+
texts: m.texts.filter((t) => !ours.has(t.id)),
|
|
37
|
+
attributes: m.attributes.filter((a) => !ours.has(a.id))
|
|
38
|
+
};
|
|
39
|
+
return kept.adds.length + kept.removes.length + kept.texts.length + kept.attributes.length === 0 ? void 0 : {
|
|
40
|
+
...event,
|
|
41
|
+
data: kept
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (POSITIONS.has(data.source) && Array.isArray(data.positions)) {
|
|
45
|
+
const page = pageId();
|
|
46
|
+
const positions = data.positions.map((p) => ours.has(p.id) ? {
|
|
47
|
+
...p,
|
|
48
|
+
id: page
|
|
49
|
+
} : p);
|
|
50
|
+
return {
|
|
51
|
+
...event,
|
|
52
|
+
data: {
|
|
53
|
+
...data,
|
|
54
|
+
positions
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return data.id !== void 0 && ours.has(data.id) ? void 0 : event;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// src/plugins/recordings/client.ts
|
|
62
|
+
/**
|
|
63
|
+
* The recordings plugin's page half: `record()` starts rrweb (imported then) and shows the toolbar, a bar
|
|
64
|
+
* docked to an edge of the window that its grip drags to any other, kept between recordings. It holds the
|
|
65
|
+
* time, annotate mode's tools where that plugin is loaded, and Stop and Discard. Stop sends the events to
|
|
66
|
+
* the `add` route.
|
|
67
|
+
*
|
|
68
|
+
* Nothing of deictic's is recorded: the overlay is blocked, as rrweb blocks. The marks are, as custom
|
|
69
|
+
* events: the page's annotations and the toolbar's own, which go when it does, as SVGs in page
|
|
70
|
+
* coordinates, at the start and at each change.
|
|
71
|
+
*/
|
|
72
|
+
const DOCK = "deictic:recorder";
|
|
73
|
+
const MARGIN = 12;
|
|
74
|
+
const STYLE = `
|
|
75
|
+
.recorder { position: fixed; z-index: 2147483647; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
|
|
76
|
+
border: 1px solid var(--deictic-line); border-radius: 10px; background: var(--deictic-bg); color: var(--deictic-fg);
|
|
77
|
+
box-shadow: 0 12px 32px rgb(0 0 0 / 0.35); font: 13px/1.4 system-ui, sans-serif; user-select: none; }
|
|
78
|
+
.recorder.vertical { flex-direction: column; }
|
|
79
|
+
.recorder.vertical .annotations-tools { flex-direction: column; }
|
|
80
|
+
.recorder.vertical .annotations-tools .gap { width: auto; height: 1px; margin: 4px 2px; }
|
|
81
|
+
.recorder .grip { display: inline-flex; padding: 2px; color: var(--deictic-muted); cursor: grab; touch-action: none; }
|
|
82
|
+
.recorder .grip:active { cursor: grabbing; }
|
|
83
|
+
.recorder .grip svg { width: 16px; height: 16px; }
|
|
84
|
+
.recorder .live { display: inline-flex; align-items: center; gap: 6px; font: 12px ui-monospace, monospace; }
|
|
85
|
+
.recorder .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: deictic-blink 1.2s infinite; }
|
|
86
|
+
.recorder .sep { align-self: stretch; width: 1px; background: var(--deictic-line); }
|
|
87
|
+
.recorder.vertical .sep { width: auto; height: 1px; }
|
|
88
|
+
.recorder .icon { display: inline-flex; align-items: center; justify-content: center; padding: 3px 5px; }
|
|
89
|
+
.recorder .icon svg { width: 16px; height: 16px; }
|
|
90
|
+
.recorder .mic[aria-pressed='true'] { background: #ef4444; border-color: #ef4444; color: #fff; }
|
|
91
|
+
.recorder .wave { width: 44px; height: 18px; }
|
|
92
|
+
.recorder.vertical .wave { width: 28px; }
|
|
93
|
+
.recorder .wave[hidden] { display: none; }
|
|
94
|
+
.recorder .mic.problem { border-color: var(--deictic-problem); color: var(--deictic-problem); }
|
|
95
|
+
@keyframes deictic-blink { 50% { opacity: 0.3; } }
|
|
96
|
+
`;
|
|
97
|
+
const svg = (paths) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
|
|
98
|
+
const GRIP = svg("<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\"/>");
|
|
99
|
+
const STOP = svg("<rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"1\" fill=\"currentColor\"/>");
|
|
100
|
+
const DISCARD = svg("<path d=\"M6 6l12 12M18 6 6 18\"/>");
|
|
101
|
+
const MIC = svg("<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\"/>");
|
|
102
|
+
const clock = (ms) => {
|
|
103
|
+
const s = Math.floor(ms / 1e3);
|
|
104
|
+
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
105
|
+
};
|
|
106
|
+
function storedDock() {
|
|
107
|
+
try {
|
|
108
|
+
const dock = JSON.parse(localStorage.getItem(DOCK) ?? "null");
|
|
109
|
+
if (dock !== null && [
|
|
110
|
+
"top",
|
|
111
|
+
"bottom",
|
|
112
|
+
"left",
|
|
113
|
+
"right"
|
|
114
|
+
].includes(dock.edge) && dock.along >= 0 && dock.along <= 1) return dock;
|
|
115
|
+
} catch {}
|
|
116
|
+
return {
|
|
117
|
+
edge: "bottom",
|
|
118
|
+
along: .5
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function iconButton(icon, name, run) {
|
|
122
|
+
const el = Object.assign(document.createElement("button"), {
|
|
123
|
+
type: "button",
|
|
124
|
+
className: "icon",
|
|
125
|
+
title: name,
|
|
126
|
+
innerHTML: icon
|
|
127
|
+
});
|
|
128
|
+
el.setAttribute("aria-label", name);
|
|
129
|
+
el.addEventListener("click", run);
|
|
130
|
+
return el;
|
|
131
|
+
}
|
|
132
|
+
/** Puts the bar on its edge, laid out along it, and how far along. */
|
|
133
|
+
function place(bar, { edge, along }) {
|
|
134
|
+
bar.classList.toggle("vertical", edge === "left" || edge === "right");
|
|
135
|
+
const { width, height } = bar.getBoundingClientRect();
|
|
136
|
+
const across = (room, size) => `${MARGIN + along * Math.max(0, room - size - 24)}px`;
|
|
137
|
+
Object.assign(bar.style, {
|
|
138
|
+
left: edge === "left" ? `${MARGIN}px` : edge === "right" ? `${innerWidth - width - MARGIN}px` : across(innerWidth, width),
|
|
139
|
+
top: edge === "top" ? `${MARGIN}px` : edge === "bottom" ? `${innerHeight - height - MARGIN}px` : across(innerHeight, height)
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** Dragging the bar by its grip, freely; let go, it docks to the nearest edge. */
|
|
143
|
+
function draggable(bar, grip, docked) {
|
|
144
|
+
grip.addEventListener("pointerdown", (e) => {
|
|
145
|
+
if (e.button !== 0) return;
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
grip.setPointerCapture(e.pointerId);
|
|
148
|
+
const start = bar.getBoundingClientRect();
|
|
149
|
+
const dx = e.clientX - start.left;
|
|
150
|
+
const dy = e.clientY - start.top;
|
|
151
|
+
const move = (m) => {
|
|
152
|
+
bar.style.left = `${m.clientX - dx}px`;
|
|
153
|
+
bar.style.top = `${m.clientY - dy}px`;
|
|
154
|
+
};
|
|
155
|
+
const up = () => {
|
|
156
|
+
grip.removeEventListener("pointermove", move);
|
|
157
|
+
const r = bar.getBoundingClientRect();
|
|
158
|
+
const x = r.left + r.width / 2;
|
|
159
|
+
const y = r.top + r.height / 2;
|
|
160
|
+
const [edge] = [
|
|
161
|
+
["left", x],
|
|
162
|
+
["right", innerWidth - x],
|
|
163
|
+
["top", y],
|
|
164
|
+
["bottom", innerHeight - y]
|
|
165
|
+
].reduce((a, b) => b[1] < a[1] ? b : a);
|
|
166
|
+
const ratio = (at, room) => Math.min(1, Math.max(0, at / room));
|
|
167
|
+
docked({
|
|
168
|
+
edge,
|
|
169
|
+
along: edge === "left" || edge === "right" ? ratio(y, innerHeight) : ratio(x, innerWidth)
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
grip.addEventListener("pointermove", move);
|
|
173
|
+
grip.addEventListener("pointerup", up, { once: true });
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
var client_default = defineClientPlugin({
|
|
177
|
+
name: "recordings",
|
|
178
|
+
setup: ({ base, root, options, use, request }) => {
|
|
179
|
+
const { masking } = options;
|
|
180
|
+
let going = false;
|
|
181
|
+
const record = async () => {
|
|
182
|
+
const rrweb = await import("rrweb").catch((e) => {
|
|
183
|
+
throw new Error("recordings need rrweb: add it to your devDependencies", { cause: e });
|
|
184
|
+
});
|
|
185
|
+
const events = [];
|
|
186
|
+
const startedAt = Date.now();
|
|
187
|
+
const viewport = {
|
|
188
|
+
width: document.documentElement.clientWidth,
|
|
189
|
+
height: document.documentElement.clientHeight
|
|
190
|
+
};
|
|
191
|
+
const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
192
|
+
const host = root.host;
|
|
193
|
+
const keep = dropOurs(() => rrweb.record.mirror.getId(host), () => rrweb.record.mirror.getId(document.documentElement));
|
|
194
|
+
const stopRecording = rrweb.record({
|
|
195
|
+
emit: (event) => {
|
|
196
|
+
const kept = keep(event);
|
|
197
|
+
if (kept !== void 0) events.push(kept);
|
|
198
|
+
},
|
|
199
|
+
blockClass: masking.blockClass,
|
|
200
|
+
blockSelector: ["deictic-overlay", ...masking.blockSelector ? [masking.blockSelector] : []].join(", "),
|
|
201
|
+
maskTextClass: masking.maskTextClass,
|
|
202
|
+
...masking.maskTextSelector ? { maskTextSelector: masking.maskTextSelector } : {},
|
|
203
|
+
maskAllInputs: masking.maskAllInputs,
|
|
204
|
+
maskInputOptions: { password: true },
|
|
205
|
+
inlineStylesheet: true
|
|
206
|
+
});
|
|
207
|
+
const marks = use("annotations");
|
|
208
|
+
const tools = marks?.tools();
|
|
209
|
+
const mark = () => {
|
|
210
|
+
const area = {
|
|
211
|
+
x: -scrollX,
|
|
212
|
+
y: -scrollY,
|
|
213
|
+
width: 1,
|
|
214
|
+
height: 1
|
|
215
|
+
};
|
|
216
|
+
rrweb.record.addCustomEvent(MARKS, {
|
|
217
|
+
svg: [marks?.svg(area), tools?.marks.svg(area)].filter(Boolean).join(""),
|
|
218
|
+
annotations: [...marks?.list() ?? [], ...tools?.marks.list() ?? []]
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
mark();
|
|
222
|
+
const unsubscribe = [marks?.subscribe(mark), tools?.marks.subscribe(mark)];
|
|
223
|
+
return new Promise((done, fail) => {
|
|
224
|
+
const bar = document.createElement("div");
|
|
225
|
+
bar.className = "recorder";
|
|
226
|
+
bar.setAttribute("role", "toolbar");
|
|
227
|
+
bar.setAttribute("aria-label", "Recording");
|
|
228
|
+
const grip = Object.assign(document.createElement("span"), {
|
|
229
|
+
className: "grip",
|
|
230
|
+
title: "Drag to any edge",
|
|
231
|
+
innerHTML: GRIP
|
|
232
|
+
});
|
|
233
|
+
const live = Object.assign(document.createElement("span"), { className: "live" });
|
|
234
|
+
const dot = Object.assign(document.createElement("span"), { className: "dot" });
|
|
235
|
+
const time = document.createElement("span");
|
|
236
|
+
live.append(dot, time);
|
|
237
|
+
const sep = () => Object.assign(document.createElement("span"), { className: "sep" });
|
|
238
|
+
const voice = use("voice");
|
|
239
|
+
const clips = [];
|
|
240
|
+
let take;
|
|
241
|
+
const wave = Object.assign(document.createElement("canvas"), {
|
|
242
|
+
className: "wave",
|
|
243
|
+
hidden: true
|
|
244
|
+
});
|
|
245
|
+
let stopWave;
|
|
246
|
+
const unwave = () => {
|
|
247
|
+
stopWave?.();
|
|
248
|
+
stopWave = void 0;
|
|
249
|
+
wave.hidden = true;
|
|
250
|
+
};
|
|
251
|
+
let busy = Promise.resolve();
|
|
252
|
+
const micOff = async () => {
|
|
253
|
+
const ending = take;
|
|
254
|
+
take = void 0;
|
|
255
|
+
unwave();
|
|
256
|
+
if (ending === void 0) return;
|
|
257
|
+
try {
|
|
258
|
+
const clip = await ending.stop();
|
|
259
|
+
clips.push({
|
|
260
|
+
id: clip.id,
|
|
261
|
+
at: ending.started - startedAt,
|
|
262
|
+
duration: clip.duration
|
|
263
|
+
});
|
|
264
|
+
} catch (e) {
|
|
265
|
+
console.warn("deictic: the voice clip was not kept", e);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const mic = voice === void 0 ? void 0 : iconButton(MIC, "Turn the mic on", () => toggle());
|
|
269
|
+
const toggle = () => {
|
|
270
|
+
busy = busy.then(async () => {
|
|
271
|
+
if (voice === void 0 || mic === void 0) return;
|
|
272
|
+
if (take !== void 0) await micOff();
|
|
273
|
+
else try {
|
|
274
|
+
take = await voice.start();
|
|
275
|
+
mic.classList.remove("problem");
|
|
276
|
+
wave.hidden = false;
|
|
277
|
+
stopWave = liveWaveform(wave, take.stream, {
|
|
278
|
+
played: "#ef4444",
|
|
279
|
+
rest: "#52525b"
|
|
280
|
+
});
|
|
281
|
+
} catch (e) {
|
|
282
|
+
mic.classList.add("problem");
|
|
283
|
+
mic.title = e instanceof Error ? e.message : String(e);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const on = take !== void 0;
|
|
287
|
+
mic.setAttribute("aria-pressed", String(on));
|
|
288
|
+
mic.title = on ? "Turn the mic off" : "Turn the mic on";
|
|
289
|
+
mic.setAttribute("aria-label", mic.title);
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
mic?.classList.add("mic");
|
|
293
|
+
mic?.setAttribute("aria-pressed", "false");
|
|
294
|
+
const end = async (keep) => {
|
|
295
|
+
rrweb.record.addCustomEvent(END, {});
|
|
296
|
+
stopRecording?.();
|
|
297
|
+
for (const stop of unsubscribe) stop?.();
|
|
298
|
+
tools?.close();
|
|
299
|
+
clearInterval(ticking);
|
|
300
|
+
removeEventListener("resize", replace);
|
|
301
|
+
bar.remove();
|
|
302
|
+
await busy;
|
|
303
|
+
if (!keep) {
|
|
304
|
+
unwave();
|
|
305
|
+
take?.cancel();
|
|
306
|
+
return done(void 0);
|
|
307
|
+
}
|
|
308
|
+
await micOff();
|
|
309
|
+
const duration = Date.now() - startedAt;
|
|
310
|
+
const voiced = clips.length > 0 ? { voice: clips } : {};
|
|
311
|
+
const kept = {
|
|
312
|
+
page: location.href,
|
|
313
|
+
viewport,
|
|
314
|
+
colorScheme,
|
|
315
|
+
startedAt,
|
|
316
|
+
duration,
|
|
317
|
+
events,
|
|
318
|
+
...voiced
|
|
319
|
+
};
|
|
320
|
+
try {
|
|
321
|
+
const res = await request("add", {
|
|
322
|
+
method: "POST",
|
|
323
|
+
headers: { "content-type": "application/json" },
|
|
324
|
+
body: JSON.stringify(kept)
|
|
325
|
+
});
|
|
326
|
+
const { id, problem } = await res.json();
|
|
327
|
+
if (id === void 0) throw new Error(`recordings: ${problem ?? res.statusText}`);
|
|
328
|
+
done({
|
|
329
|
+
id,
|
|
330
|
+
url: `${base}__deictic/plugins/recordings/replay/${id}`,
|
|
331
|
+
duration,
|
|
332
|
+
...voiced
|
|
333
|
+
});
|
|
334
|
+
} catch (e) {
|
|
335
|
+
fail(e);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
const stop = iconButton(STOP, "Stop, and keep the recording", () => void end(true));
|
|
339
|
+
const discard = iconButton(DISCARD, "Discard the recording", () => void end(false));
|
|
340
|
+
bar.append(grip, live, ...tools ? [sep(), tools.element] : [], sep(), ...mic ? [mic, wave] : [], stop, discard);
|
|
341
|
+
const style = Object.assign(document.createElement("style"), { textContent: STYLE });
|
|
342
|
+
bar.prepend(style);
|
|
343
|
+
root.append(bar);
|
|
344
|
+
const tick = () => time.textContent = clock(Date.now() - startedAt);
|
|
345
|
+
tick();
|
|
346
|
+
const ticking = setInterval(tick, 250);
|
|
347
|
+
let dock = storedDock();
|
|
348
|
+
const replace = () => place(bar, dock);
|
|
349
|
+
replace();
|
|
350
|
+
addEventListener("resize", replace);
|
|
351
|
+
draggable(bar, grip, (next) => {
|
|
352
|
+
dock = next;
|
|
353
|
+
replace();
|
|
354
|
+
try {
|
|
355
|
+
localStorage.setItem(DOCK, JSON.stringify(dock));
|
|
356
|
+
} catch {}
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
return {
|
|
361
|
+
recording: () => going,
|
|
362
|
+
record: async () => {
|
|
363
|
+
if (going) throw new Error("recordings: one is going already: stop it first");
|
|
364
|
+
going = true;
|
|
365
|
+
try {
|
|
366
|
+
return await record();
|
|
367
|
+
} finally {
|
|
368
|
+
going = false;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
export { client_default as default };
|
|
375
|
+
|
|
376
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +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. Stop sends the events to\n * the `add` route.\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 { ResolvedMasking } from '#src/plugins/screenshots/index.ts';\n\nimport type { Take } from '#src/plugins/voice/index.ts';\n\nimport type { Kept, Recorder, Recording, VoiceClip } from './index.ts';\nimport { END, MARKS } 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';\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 } = options as { masking: ResolvedMasking };\n let going = false;\n\n const record = async (): Promise<Recording | undefined> => {\n const rrweb = await import('rrweb').catch((e: unknown) => {\n throw new Error('recordings need rrweb: add it to your devDependencies', { cause: e });\n });\n const events: { type: number; data?: unknown }[] = [];\n const startedAt = Date.now();\n const viewport = { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };\n const colorScheme = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n const host = root.host;\n const keep = dropOurs<(typeof events)[number]>(\n () => rrweb.record.mirror.getId(host),\n () => rrweb.record.mirror.getId(document.documentElement),\n );\n const stopRecording = rrweb.record({\n emit: (event) => {\n const kept = keep(event);\n if (kept !== undefined) events.push(kept);\n },\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 });\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 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 const unsubscribe = [marks?.subscribe(mark), tools?.marks.subscribe(mark)];\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, 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 const clips: VoiceClip[] = [];\n let take: Take | undefined;\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 });\n };\n mic?.classList.add('mic');\n mic?.setAttribute('aria-pressed', 'false');\n\n const end = async (keep: boolean) => {\n rrweb.record.addCustomEvent(END, {});\n stopRecording?.();\n for (const stop of unsubscribe) stop?.();\n tools?.close();\n clearInterval(ticking);\n removeEventListener('resize', replace);\n bar.remove();\n await busy;\n if (!keep) {\n unwave();\n take?.cancel();\n return done(undefined);\n }\n await micOff();\n const duration = Date.now() - startedAt;\n const voiced = clips.length > 0 ? { voice: clips } : {};\n const kept: Kept = { page: location.href, viewport, colorScheme, startedAt, duration, events, ...voiced };\n try {\n const res = await request('add', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(kept),\n });\n const { id, problem } = (await res.json()) as { id?: string; problem?: string };\n if (id === undefined) throw new Error(`recordings: ${problem ?? res.statusText}`);\n done({ id, 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 = () => (time.textContent = clock(Date.now() - startedAt));\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 return {\n recording: () => going,\n record: async () => {\n if (going) throw new Error('recordings: one is going already: stop it first');\n going = true;\n try {\n return await record();\n } finally {\n going = false;\n }\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,MAAM,EAAE,KAAK,QAAQ,MAAM,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;IAC/C,SAAS,EAAE,QAAQ,QAAQ,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,QAAQ,CAAC;IACzE,OAAO,EAAE,MAAM,QAAQ,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;IAC5C,YA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C;KAC3F,SAAS,GAAG;MACV,KAAK,CAAC;KACR;IACF;IACA,MAAM,OAAO,WAAW,MAAM,sCAAsC,KAAK,IAAI,IAAI,CAAC;IAClF,MAAM,UAAU,WAAW,SAAS,+BAA+B,KAAK,IAAI,KAAK,CAAC;IAClF,IAAI,OAAO,MAAM,MAAM,GAAI,QAAQ,CAAC,IAAI,GAAG,MAAM,OAAO,IAAI,CAAC,GAAI,IAAI,GAAG,GAAI,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,GAAI,MAAM,OAAO;IAClH,MAAM,QAAQ,OAAO,OAAO,SAAS,cAAc,OAAO,GAAG,EAAE,aAAa,MAAM,CAAC;IACnF,IAAI,QAAQ,KAAK;IACjB,KAAK,OAAO,GAAG;IAEf,MAAM,aAAc,KAAK,cAAc,MAAM,KAAK,IAAI,IAAI,SAAS;IACnE,KAAK;IACL,MAAM,UAAU,YAAY,MAAM,GAAG;IACrC,IAAI,OAAO,WAAW;IACtB,MAAM,gBAAgB,MAAM,KAAK,IAAI;IACrC,QAAQ;IACR,iBAAiB,UAAU,OAAO;IAClC,UAAU,KAAK,OAAO,SAAS;KAC7B,OAAO;KACP,QAAQ;KACR,IAAI;MACF,aAAa,QAAQ,MAAM,KAAK,UAAU,IAAI,CAAC;KACjD,QAAQ,CAER;IACF,CAAC;GACH,CAAC;EACH;EAEA,OAAO;GACL,iBAAiB;GACjB,QAAQ,YAAY;IAClB,IAAI,OAAO,MAAM,IAAI,MAAM,iDAAiD;IAC5E,QAAQ;IACR,IAAI;KACF,OAAO,MAAM,OAAO;IACtB,UAAU;KACR,QAAQ;IACV;GACF;EACF;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as RecordingsOptions, c as MARKS, i as Recordings, n as Recorder, o as VoiceClip, r as Recording, s as recordings, t as Kept } from "../index4.js";
|
|
2
|
+
export { Kept, MARKS, Recorder, Recording, Recordings, RecordingsOptions, VoiceClip, recordings as default, recordings };
|