@wallets-e2e/walkthrough 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yehia Tarek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # @wallets-e2e/walkthrough
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Captioned demo videos of a dapp driven by real wallet extensions. One Playwright test plays the demo; the result is an mp4 a reviewer, a client or a slide deck can show:
4
+
5
+ - the browser's own screencast at 1920×1080,
6
+ - an animated cursor with click ripples,
7
+ - captions with a step chip, and full-screen title cards,
8
+ - **every wallet prompt shown inside the picture**, as the wallet displayed it,
9
+ - long chain waits cut down to a short hold,
10
+ - subtitles (`.vtt`, `.srt`) and a chapter list made from the same captions.
11
+
12
+ Wallet mirroring requires a driver method that calls `beforeAnswer`: MetaMask's transaction approval
13
+ and Freighter's connection and transaction prompts support it. Both wallets can be loaded in one browser.
14
+ An AI agent can author and run the scenario; this package records it and does not generate scenarios itself.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install --save-dev @wallets-e2e/walkthrough @playwright/test
20
+ ```
21
+
22
+ Encoding needs `ffmpeg` and `ffprobe` (with `libx264`) on the machine.
23
+
24
+ ## Record
25
+
26
+ ```ts
27
+ import { metamaskDriver } from '@wallets-e2e/metamask';
28
+ import { createWalkthrough } from '@wallets-e2e/walkthrough';
29
+ import { test } from './fixtures'; // your createMetamaskTest()
30
+
31
+ test('demo', async ({ extensionContext: context, page }) => {
32
+ // Off camera: import the wallet and connect. A recovery phrase must never be on screen while recording.
33
+ await metamaskDriver.importWallet(context, process.env.WALLETS_E2E_SEED_PHRASE!);
34
+
35
+ await page.goto('/');
36
+ const show = await createWalkthrough(page, { outputDir: `demo-output/run-${Date.now()}` });
37
+ await page.reload(); // mounts the cursor layer
38
+ await show.start();
39
+
40
+ await show.card({ kicker: 'Live demo', title: 'A deposit, start to finish', body: 'On Sepolia, with a real wallet.' });
41
+ await show.caption('Step 1', 'I enter the amount to deposit.');
42
+ await show.type(page.getByTestId('amount'), '25');
43
+
44
+ // The wallet's prompt, mirrored into the recording, explained, then confirmed by the driver.
45
+ await show.walletPrompt({
46
+ label: 'MetaMask',
47
+ accent: '#f6851b',
48
+ explain: ['MetaMask opens on Sepolia: the deposit goes to the vault contract.'],
49
+ trigger: () => show.press(page.getByTestId('deposit')),
50
+ answer: (trigger, beforeAnswer) => metamaskDriver.confirmTransaction(context, trigger, { beforeAnswer }),
51
+ });
52
+
53
+ // A chain wait is not worth watching: pause, wait, resume. It becomes a short cut.
54
+ show.pause();
55
+ await page.getByTestId('deposit-confirmed').waitFor({ timeout: 180_000 });
56
+ await show.resume();
57
+ await show.caption('Step 1', 'Confirmed on chain.');
58
+
59
+ await show.stop();
60
+ });
61
+ ```
62
+
63
+ For a Stellar dapp the `answer` line is the only one that changes:
64
+
65
+ ```ts
66
+ answer: (trigger, beforeAnswer) => freighterDriver.confirmTransaction(context, trigger, { beforeAnswer }),
67
+ ```
68
+
69
+ Run the test with video and traces of your own off (`use: { trace: 'off' }`): the walkthrough records itself, and a trace would hold everything typed.
70
+
71
+ ## Encode
72
+
73
+ ```bash
74
+ npx wallets-e2e-walkthrough encode --out evidence/demo --name demo.mp4 --title "Deposit demo"
75
+ ```
76
+
77
+ It takes the newest `run-*` folder under `demo-output/` (or the run you name) and writes:
78
+
79
+ | File | What |
80
+ |---|---|
81
+ | `demo.mp4` | The video, H.264 with captions burnt in; plays in browsers and slide decks |
82
+ | `captions.vtt`, `captions.srt` | The captions as a sidecar track |
83
+ | `chapters.txt` | A chapter per title card and per step, ready for a video description |
84
+ | `README.md` | Title, length, description and chapters |
85
+
86
+ The same from code: `encodeWalkthrough({ runDir, outDir, fileName, title, description })`.
87
+
88
+ ## The API
89
+
90
+ | Call | What it draws |
91
+ |---|---|
92
+ | `show.card({ kicker, title, body, items, holdMs })` | A full-screen title card; starts a chapter |
93
+ | `show.caption(step, text, holdMs)` / `show.hideCaption()` | A caption with a step chip; a new step starts a chapter |
94
+ | `show.press(locator)` | Cursor glides over, ripple, click |
95
+ | `show.type(locator, text)` / `show.choose(locator, value)` | Typing at a human pace; picking an option |
96
+ | `show.scrollTo(locator \| 'top')` | A smooth scroll |
97
+ | `show.walletPrompt({ label, explain, trigger, answer })` | A wallet prompt mirrored into the page, captioned, then answered by the driver |
98
+ | `show.pause()` / `show.resume()` | Leaves a wait out of the video |
99
+ | `show.stop()` | Writes the frame list and the chapters |
100
+
101
+ `createWalkthrough(page, { theme })` takes your colours and fonts for everything it draws; every field has a default.
102
+
103
+ ## Keep secrets off camera
104
+
105
+ The recording starts at `show.start()`. Import wallets and type passwords before it. A wallet prompt is mirrored only between the moment the driver finds it and the moment it is answered, and the prompts mirrored are the wallet's approval screens, which show accounts, networks and amounts, never keys.
@@ -0,0 +1,14 @@
1
+ export interface CliArgs {
2
+ command: 'encode' | 'help';
3
+ runDir?: string;
4
+ root: string;
5
+ out?: string;
6
+ name?: string;
7
+ title?: string;
8
+ description?: string;
9
+ madeWith?: string;
10
+ }
11
+ export declare const USAGE = "wallets-e2e-walkthrough encode [run-dir] --out <dir> [options]\n\nEncodes a recorded walkthrough into an mp4 with captions, subtitles and chapters.\n\n run-dir The run to encode. Default: the newest run-* folder under --root.\n --root <dir> Where runs are recorded. Default: demo-output\n --out <dir> Where the video goes. Required.\n --name <file.mp4> The video's file name. Default: walkthrough.mp4\n --title <text> The README's title.\n --description <text> What the video shows, for the README.\n --made-with <text> How the video was made, for the README.\n\nNeeds ffmpeg and ffprobe on PATH.";
12
+ /** Parses the command line; throws with a message for the user on anything it does not know. */
13
+ export declare function parseArgs(argv: readonly string[]): CliArgs;
14
+ //# sourceMappingURL=cli-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,KAAK,gpBAYgB,CAAC;AAWnC,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAoB1D"}
@@ -0,0 +1,51 @@
1
+ // No runtime imports: `node --test` runs this file straight from source.
2
+ export const USAGE = `wallets-e2e-walkthrough encode [run-dir] --out <dir> [options]
3
+
4
+ Encodes a recorded walkthrough into an mp4 with captions, subtitles and chapters.
5
+
6
+ run-dir The run to encode. Default: the newest run-* folder under --root.
7
+ --root <dir> Where runs are recorded. Default: demo-output
8
+ --out <dir> Where the video goes. Required.
9
+ --name <file.mp4> The video's file name. Default: walkthrough.mp4
10
+ --title <text> The README's title.
11
+ --description <text> What the video shows, for the README.
12
+ --made-with <text> How the video was made, for the README.
13
+
14
+ Needs ffmpeg and ffprobe on PATH.`;
15
+ const FLAGS = {
16
+ '--root': 'root',
17
+ '--out': 'out',
18
+ '--name': 'name',
19
+ '--title': 'title',
20
+ '--description': 'description',
21
+ '--made-with': 'madeWith',
22
+ };
23
+ /** Parses the command line; throws with a message for the user on anything it does not know. */
24
+ export function parseArgs(argv) {
25
+ const args = { command: 'encode', root: 'demo-output' };
26
+ const rest = [...argv];
27
+ if (rest[0] === 'encode')
28
+ rest.shift();
29
+ for (let i = 0; i < rest.length; i++) {
30
+ const arg = rest[i];
31
+ if (arg === '--help' || arg === '-h' || arg === 'help')
32
+ return { ...args, command: 'help' };
33
+ const key = FLAGS[arg];
34
+ if (key) {
35
+ const value = rest[++i];
36
+ if (value === undefined || value.startsWith('--'))
37
+ throw new Error(`${arg} needs a value.`);
38
+ args[key] = value;
39
+ continue;
40
+ }
41
+ if (arg.startsWith('--'))
42
+ throw new Error(`Unknown option ${arg}.`);
43
+ if (args.runDir !== undefined)
44
+ throw new Error(`Only one run directory can be encoded; got "${args.runDir}" and "${arg}".`);
45
+ args.runDir = arg;
46
+ }
47
+ if (!args.out)
48
+ throw new Error('--out <dir> is required.');
49
+ return args;
50
+ }
51
+ //# sourceMappingURL=cli-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAazE,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;kCAYa,CAAC;AAEnC,MA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AAI,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,IAAI,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC;QAC5H,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import { resolve } from 'node:path';
3
+ import { parseArgs, USAGE } from './cli-args.js';
4
+ import { encodeWalkthrough, newestRun } from './encode.js';
5
+ try {
6
+ const args = parseArgs(process.argv.slice(2));
7
+ if (args.command === 'help') {
8
+ console.log(USAGE);
9
+ }
10
+ else {
11
+ const runDir = args.runDir ? resolve(args.runDir) : newestRun(resolve(args.root));
12
+ if (!runDir)
13
+ throw new Error(`No run-* folder under ${resolve(args.root)}: record a walkthrough first.`);
14
+ const result = encodeWalkthrough({
15
+ runDir,
16
+ outDir: resolve(args.out),
17
+ fileName: args.name,
18
+ title: args.title,
19
+ description: args.description,
20
+ madeWith: args.madeWith,
21
+ });
22
+ console.log(JSON.stringify({ out: result.outDir, video: result.video, seconds: result.seconds, captions: result.captions, chapters: result.chapters.length }));
23
+ }
24
+ }
25
+ catch (error) {
26
+ console.error(`[wallets-e2e/walkthrough] ${error instanceof Error ? error.message : String(error)}`);
27
+ console.error(`\n${USAGE}`);
28
+ process.exit(1);
29
+ }
30
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"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,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACjK,CAAC;AACH,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrG,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { type ChapterMark } from './timeline.js';
2
+ export interface EncodeOptions {
3
+ /** The run to encode: the folder `Walkthrough.stop()` wrote (it holds `frames/`). */
4
+ runDir: string;
5
+ /** Where the video and its sidecar files go. Created when missing. */
6
+ outDir: string;
7
+ /** The video's file name. Default `walkthrough.mp4`. */
8
+ fileName?: string;
9
+ /** The README's title. Default "Captioned walkthrough". */
10
+ title?: string;
11
+ /** A paragraph for the README: what the video shows. */
12
+ description?: string;
13
+ /** A closing line for the README: how the video was made. */
14
+ madeWith?: string;
15
+ /** The video's size. Default 1920×1080. */
16
+ size?: {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ /** Frames per second. Default 30. */
21
+ fps?: number;
22
+ /** x264 quality, lower is better. Default 18. */
23
+ crf?: number;
24
+ /** The ffmpeg and ffprobe executables. Default: the ones on PATH. */
25
+ ffmpeg?: string;
26
+ ffprobe?: string;
27
+ }
28
+ export interface EncodeResult {
29
+ outDir: string;
30
+ video: string;
31
+ seconds: number;
32
+ captions: number;
33
+ chapters: ChapterMark[];
34
+ }
35
+ /** The newest `run-*` folder under `root`, or null. */
36
+ export declare function newestRun(root: string): string | null;
37
+ /** The README written next to the video. */
38
+ export declare function readme(options: {
39
+ title: string;
40
+ fileName: string;
41
+ seconds: number;
42
+ date: string;
43
+ description?: string;
44
+ madeWith?: string;
45
+ marks: readonly ChapterMark[];
46
+ }): string;
47
+ /**
48
+ * Encodes a recorded run into a shareable folder: an H.264 mp4 that plays in browsers and slide
49
+ * decks (captions are part of the picture), the same captions as WebVTT and SubRip, a chapter list
50
+ * and a README. Needs `ffmpeg` and `ffprobe`.
51
+ */
52
+ export declare function encodeWalkthrough(options: EncodeOptions): EncodeResult;
53
+ //# sourceMappingURL=encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAElH,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED,4CAA4C;AAC5C,wBAAgB,MAAM,CAAC,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,GAAG,MAAM,CAoBlL;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CA0CtE"}
package/dist/encode.js ADDED
@@ -0,0 +1,84 @@
1
+ import { execFileSync } from 'node:child_process';
2
+ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { join, resolve } from 'node:path';
4
+ import { buildCues, chapterMarks, shortStamp, toSrt, toVtt } from './timeline.js';
5
+ /** The newest `run-*` folder under `root`, or null. */
6
+ export function newestRun(root) {
7
+ if (!existsSync(root))
8
+ return null;
9
+ const runs = readdirSync(root).filter((name) => name.startsWith('run-')).sort();
10
+ const newest = runs.at(-1);
11
+ return newest ? join(root, newest) : null;
12
+ }
13
+ /** The README written next to the video. */
14
+ export function readme(options) {
15
+ const { title, fileName, seconds, date, description, madeWith, marks } = options;
16
+ return [
17
+ `# ${title}`,
18
+ '',
19
+ `Recorded ${date}. Length ${shortStamp(seconds)}.`,
20
+ ...(description ? ['', description] : []),
21
+ '',
22
+ '| File | What |',
23
+ '|---|---|',
24
+ `| \`${fileName}\` | The video, captions burnt in |`,
25
+ '| `captions.vtt`, `captions.srt` | The captions as a sidecar track |',
26
+ '| `chapters.txt` | Chapter list (paste into a video description) |',
27
+ '',
28
+ '## Chapters',
29
+ '',
30
+ ...marks.map((mark) => `- ${shortStamp(mark.at)} ${mark.label}`),
31
+ ...(madeWith ? ['', madeWith] : []),
32
+ '',
33
+ ].join('\n');
34
+ }
35
+ /**
36
+ * Encodes a recorded run into a shareable folder: an H.264 mp4 that plays in browsers and slide
37
+ * decks (captions are part of the picture), the same captions as WebVTT and SubRip, a chapter list
38
+ * and a README. Needs `ffmpeg` and `ffprobe`.
39
+ */
40
+ export function encodeWalkthrough(options) {
41
+ const runDir = resolve(options.runDir);
42
+ const outDir = resolve(options.outDir);
43
+ const fileName = options.fileName ?? 'walkthrough.mp4';
44
+ const { width, height } = options.size ?? { width: 1920, height: 1080 };
45
+ const frames = join(runDir, 'frames');
46
+ const concat = join(frames, 'frames.ffconcat');
47
+ const chaptersFile = join(frames, 'chapters.json');
48
+ if (!existsSync(concat))
49
+ throw new Error(`${concat} is missing: the walkthrough did not finish recording.`);
50
+ const chapters = (existsSync(chaptersFile) ? JSON.parse(readFileSync(chaptersFile, 'utf8')) : []);
51
+ mkdirSync(outDir, { recursive: true });
52
+ const video = join(outDir, fileName);
53
+ try {
54
+ execFileSync(options.ffmpeg ?? 'ffmpeg', [
55
+ '-y', '-loglevel', 'error',
56
+ '-f', 'concat', '-safe', '0', '-i', concat,
57
+ '-vf', `scale=${width}:${height}:flags=lanczos,fps=${options.fps ?? 30},format=yuv420p`,
58
+ '-c:v', 'libx264', '-preset', 'slow', '-crf', String(options.crf ?? 18), '-movflags', '+faststart',
59
+ video,
60
+ ], { stdio: ['ignore', 'inherit', 'inherit'] });
61
+ }
62
+ catch (error) {
63
+ if (error.code === 'ENOENT')
64
+ throw new Error('ffmpeg was not found. Install FFmpeg (with libx264) and run again.');
65
+ throw error;
66
+ }
67
+ const seconds = Number(execFileSync(options.ffprobe ?? 'ffprobe', ['-v', 'error', '-show_entries', 'format=duration', '-of', 'csv=p=0', video]).toString().trim());
68
+ const cues = buildCues(chapters, seconds);
69
+ const marks = chapterMarks(cues);
70
+ writeFileSync(join(outDir, 'captions.vtt'), toVtt(cues));
71
+ writeFileSync(join(outDir, 'captions.srt'), toSrt(cues));
72
+ writeFileSync(join(outDir, 'chapters.txt'), `${marks.map((mark) => `${shortStamp(mark.at)} ${mark.label}`).join('\n')}\n`);
73
+ writeFileSync(join(outDir, 'README.md'), readme({
74
+ title: options.title ?? 'Captioned walkthrough',
75
+ fileName,
76
+ seconds,
77
+ date: new Date().toISOString().slice(0, 10),
78
+ description: options.description,
79
+ madeWith: options.madeWith,
80
+ marks,
81
+ }));
82
+ return { outDir, video, seconds: Math.round(seconds), captions: cues.length, chapters: marks };
83
+ }
84
+ //# sourceMappingURL=encode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.js","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAkC,MAAM,eAAe,CAAC;AAkClH,uDAAuD;AACvD,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAChF,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,MAAM,C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AC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACjG,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { createWalkthrough, Walkthrough, type CardOptions, type PromptHook, type WalkthroughOptions, type WalkthroughRun, type WalletPromptOptions, } from './walkthrough.js';
2
+ export { DEFAULT_THEME, type WalkthroughTheme } from './theme.js';
3
+ export { encodeWalkthrough, newestRun, type EncodeOptions, type EncodeResult } from './encode.js';
4
+ export { buildCues, chapterMarks, type Chapter, type ChapterMark, type Cue } from './timeline.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { createWalkthrough, Walkthrough, } from './walkthrough.js';
2
+ export { DEFAULT_THEME } from './theme.js';
3
+ export { encodeWalkthrough, newestRun } from './encode.js';
4
+ export { buildCues, chapterMarks } from './timeline.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,WAAW,GAMZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAyB,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAyC,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,YAAY,EAA4C,MAAM,eAAe,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** The look of everything the walkthrough draws over the page. Every field has a default. */
2
+ export interface WalkthroughTheme {
3
+ /** Dark background of captions and title cards. */
4
+ ink: string;
5
+ /** A second dark tone, the centre of a title card's gradient. */
6
+ inkSoft: string;
7
+ /** Text on the dark background. */
8
+ paper: string;
9
+ /** Secondary text on a title card. */
10
+ muted: string;
11
+ /** The step chip, a title card's kicker, the caption's edge. */
12
+ accent: string;
13
+ /** Click ripples and the numbers of a title card's list. */
14
+ highlight: string;
15
+ /** Captions and body text. */
16
+ fontBody: string;
17
+ /** The title of a title card. */
18
+ fontTitle: string;
19
+ /** Step chips, kickers and numbers. */
20
+ fontMono: string;
21
+ }
22
+ export declare const DEFAULT_THEME: WalkthroughTheme;
23
+ /** A value safe to put inside a CSS declaration: nothing that could close it or open another rule. */
24
+ export declare function cssValue(value: string): string;
25
+ /** The stylesheet of the cursor, the ripples, the caption and the title card. Element ids are `wt-…`. */
26
+ export declare function overlayStyle(theme: WalkthroughTheme): string;
27
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,aAAa,EAAE,gBAU3B,CAAC;AAEF,sGAAsG;AACtG,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,yGAAyG;AACzG,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAgC5D"}
package/dist/theme.js ADDED
@@ -0,0 +1,51 @@
1
+ // No runtime imports: `node --test` runs this file straight from source.
2
+ export const DEFAULT_THEME = {
3
+ ink: '#14141f',
4
+ inkSoft: '#26263a',
5
+ paper: '#f7f7fa',
6
+ muted: '#cfd0dc',
7
+ accent: '#6ea8fe',
8
+ highlight: '#ff7a33',
9
+ fontBody: 'Inter, system-ui, sans-serif',
10
+ fontTitle: 'Georgia, "Times New Roman", serif',
11
+ fontMono: 'ui-monospace, "SF Mono", Menlo, monospace',
12
+ };
13
+ /** A value safe to put inside a CSS declaration: nothing that could close it or open another rule. */
14
+ export function cssValue(value) {
15
+ return value.replace(/[;{}<>\\]/g, '');
16
+ }
17
+ /** The stylesheet of the cursor, the ripples, the caption and the title card. Element ids are `wt-…`. */
18
+ export function overlayStyle(theme) {
19
+ const t = Object.fromEntries(Object.entries(theme).map(([key, value]) => [key, cssValue(value)]));
20
+ return `
21
+ #wt-cursor{position:fixed;left:0;top:0;width:24px;height:24px;z-index:2147483647;pointer-events:none;
22
+ transition:transform .7s cubic-bezier(.45,.05,.25,1);filter:drop-shadow(0 2px 3px rgba(0,0,0,.35))}
23
+ .wt-ripple{position:fixed;width:36px;height:36px;margin:-18px 0 0 -18px;border-radius:50%;
24
+ border:3px solid ${t.highlight};z-index:2147483646;pointer-events:none;animation:wt-ripple .6s ease-out forwards}
25
+ @keyframes wt-ripple{from{transform:scale(.3);opacity:1}to{transform:scale(1.7);opacity:0}}
26
+ #wt-caption{position:fixed;left:50%;bottom:30px;transform:translate(-50%,12px);opacity:0;z-index:2147483640;
27
+ max-width:1180px;width:max-content;pointer-events:none;background:${t.ink};color:${t.paper};
28
+ border-radius:4px;border-left:4px solid ${t.accent};padding:14px 26px;font:500 19px/1.45 ${t.fontBody};
29
+ box-shadow:0 12px 32px rgba(0,0,0,.3);transition:opacity .35s,transform .35s;display:flex;gap:16px;align-items:center}
30
+ #wt-caption.show{opacity:.97;transform:translate(-50%,0)}
31
+ #wt-caption b{background:${t.accent};color:${t.ink};border-radius:2px;padding:3px 10px;font:600 13px/1.4 ${t.fontMono};
32
+ letter-spacing:.06em;text-transform:uppercase;white-space:nowrap}
33
+ #wt-card{position:fixed;inset:0;z-index:2147483645;display:flex;flex-direction:column;align-items:center;justify-content:center;
34
+ text-align:center;background:radial-gradient(1200px 600px at 50% 30%,${t.inkSoft},${t.ink});color:${t.paper};
35
+ font-family:${t.fontBody};opacity:0;transition:opacity .5s}
36
+ #wt-card.show{opacity:1}
37
+ #wt-card .k{font:600 14px ${t.fontMono};letter-spacing:.24em;text-transform:uppercase;color:${t.accent};margin-bottom:20px}
38
+ #wt-card h1{font:600 54px/1.15 ${t.fontTitle};margin:0 0 18px;max-width:1100px}
39
+ #wt-card p{font-size:22px;color:${t.muted};margin:0;max-width:940px;line-height:1.5}
40
+ #wt-card ol{margin:30px 0 0;padding:0;list-style:none;font-size:20px;color:${t.paper};text-align:left}
41
+ #wt-card li{margin:9px 0}#wt-card li span{color:${t.highlight};font-family:${t.fontMono};margin-right:12px}
42
+ #wt-wallet{position:fixed;z-index:2147483644;border-radius:10px;overflow:hidden;background:#fff;
43
+ box-shadow:0 24px 60px rgba(0,0,0,.45),0 0 0 1px rgba(0,0,0,.14);
44
+ opacity:0;transform:translateY(-10px) scale(.98);transition:opacity .3s,transform .3s;pointer-events:none}
45
+ #wt-wallet.show{opacity:1;transform:none}
46
+ #wt-wallet header{display:flex;align-items:center;gap:8px;height:30px;padding:0 12px;background:${t.ink};
47
+ font:600 12px ${t.fontBody};color:${t.paper}}
48
+ #wt-wallet header i{width:10px;height:10px;border-radius:50%;display:inline-block}
49
+ #wt-wallet img{display:block;width:100%;height:auto}`;
50
+ }
51
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAwBzE,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C,GAAG,EAAE,SAAS;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,8BAA8B;IACxC,SAAS,EAAE,mCAAmC;IAC9C,QAAQ,EAAE,2CAA2C;CACtD,CAAC;AAEF,sGAAsG;AACtG,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,YAAY,CAAC,KAAuB;IAClD,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAgC,CAAC;IACjI,OAAO;;;;qBAIY,CAAC,CAAC,SAAS;;;sEAGsC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,KAAK;4CAChD,CAAC,CAAC,MAAM,yCAAyC,CAAC,CAAC,QAAQ;;;2BAG5E,CAAC,CAAC,MAAM,UAAU,CAAC,CAAC,GAAG,yDAAyD,CAAC,CAAC,QAAQ;;;yEAG5C,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,KAAK;gBAC7F,CAAC,CAAC,QAAQ;;4BAEE,CAAC,CAAC,QAAQ,wDAAwD,CAAC,CAAC,MAAM;iCACrE,CAAC,CAAC,SAAS;kCACV,CAAC,CAAC,KAAK;6EACoC,CAAC,CAAC,KAAK;kDAClC,CAAC,CAAC,SAAS,gBAAgB,CAAC,CAAC,QAAQ;;;;;kGAKW,CAAC,CAAC,GAAG;kBACrF,CAAC,CAAC,QAAQ,UAAU,CAAC,CAAC,KAAK;;qDAEQ,CAAC;AACtD,CAAC"}
@@ -0,0 +1,53 @@
1
+ /** One screencast frame: when it was captured, and whether recording had just been resumed. */
2
+ export interface FrameMark {
3
+ at: number;
4
+ gapBefore: boolean;
5
+ }
6
+ /** A caption or a title card, as noted while recording (`wall`) and as placed in the video (`at`, seconds). */
7
+ export interface Chapter {
8
+ wall: number;
9
+ at: number;
10
+ step: string | null;
11
+ text: string;
12
+ kind: 'caption' | 'card';
13
+ }
14
+ /** The longest a still frame is held: a page that does not repaint is one frame, however long it lasted. */
15
+ export declare const MAX_STILL_SECONDS = 12;
16
+ /** How long the cut over a pause lasts: a chain wait of minutes becomes this. */
17
+ export declare const PAUSE_SECONDS = 0.4;
18
+ /**
19
+ * How long each frame is shown. A frame lasts until the next one, capped; the frame before a pause
20
+ * lasts only `PAUSE_SECONDS`, which is how a long confirmation wait is shortened in the video.
21
+ */
22
+ export declare function frameDurations(frames: readonly FrameMark[], end: number): number[];
23
+ /**
24
+ * The video time of each chapter: the frames shown before its wall-clock instant, plus how far into
25
+ * the current frame it falls. A chapter noted before the first frame lands at 0.
26
+ */
27
+ export declare function placeChapters(chapters: readonly Chapter[], frames: readonly FrameMark[], durations: readonly number[]): Chapter[];
28
+ /** The ffmpeg concat list for the frames: each file with its duration, the last one repeated as ffmpeg requires. */
29
+ export declare function concatList(files: readonly string[], durations: readonly number[]): string;
30
+ /** A subtitle cue. */
31
+ export interface Cue {
32
+ start: number;
33
+ end: number;
34
+ text: string;
35
+ step: string | null;
36
+ kind: 'caption' | 'card';
37
+ }
38
+ /** Each chapter as a subtitle cue that lasts until the next one, at least one second, never past the video's end. */
39
+ export declare function buildCues(chapters: readonly Chapter[], seconds: number): Cue[];
40
+ /** `HH:MM:SS.mmm` for WebVTT (`separator` "."), `HH:MM:SS,mmm` for SubRip (","). */
41
+ export declare function stamp(seconds: number, separator: '.' | ','): string;
42
+ /** `M:SS`, as a video description lists chapters. */
43
+ export declare function shortStamp(seconds: number): string;
44
+ export declare function toVtt(cues: readonly Cue[]): string;
45
+ export declare function toSrt(cues: readonly Cue[]): string;
46
+ /** A chapter of the video: where it starts and what it is called. */
47
+ export interface ChapterMark {
48
+ at: number;
49
+ label: string;
50
+ }
51
+ /** A chapter starts at each title card and at the first caption of each new step. The first one starts at 0. */
52
+ export declare function chapterMarks(cues: readonly Cue[]): ChapterMark[];
53
+ //# sourceMappingURL=timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,+GAA+G;AAC/G,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;CAC1B;AAED,4GAA4G;AAC5G,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,iFAAiF;AACjF,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,C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