@phil65/demoreel 0.6.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +8 -5
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/args.js +1 -1
  4. package/dist/cli.js +3 -3
  5. package/dist/compose.d.ts +9 -1
  6. package/dist/compose.js +38 -3
  7. package/dist/idle.js +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +2 -2
  10. package/dist/layout.d.ts +10 -1
  11. package/dist/layout.js +41 -0
  12. package/dist/marks.d.ts +7 -12
  13. package/dist/marks.js +73 -43
  14. package/dist/mcp.js +2 -2
  15. package/dist/project.d.ts +261 -11
  16. package/dist/project.js +255 -8
  17. package/dist/record.js +8 -0
  18. package/dist/renderer/assets/{CanvasPool-PBu3bHFZ.js → CanvasPool-SkgMbnEH.js} +1 -1
  19. package/dist/renderer/assets/{CanvasRenderer-HmF-4gyW.js → CanvasRenderer-CEGuSdsG.js} +1 -1
  20. package/dist/renderer/assets/{RenderTargetSystem-Dk1U4wDJ.js → RenderTargetSystem-um8Nv1HQ.js} +1 -1
  21. package/dist/renderer/assets/{WebGLRenderer-C0v9HBel.js → WebGLRenderer-BnY2xfDL.js} +1 -1
  22. package/dist/renderer/assets/{WebGPURenderer-Ce0-U9Q1.js → WebGPURenderer-D9KI_sD9.js} +1 -1
  23. package/dist/renderer/assets/{browserAll-DhvWQ7nM.js → browserAll-vQt6iTAv.js} +1 -1
  24. package/dist/renderer/assets/{canvasUtils-KRroregW.js → canvasUtils-CZLntkW8.js} +1 -1
  25. package/dist/renderer/assets/{getTexelRangeRects-D3pwCyRt.js → getTexelRangeRects-CRAnqulP.js} +1 -1
  26. package/dist/renderer/assets/{index-CE-lli1m.js → index-41-d13J1.js} +4 -4
  27. package/dist/renderer/assets/{init-DfmWKarH.js → init-D6nA7FlC.js} +1 -1
  28. package/dist/renderer/assets/webworkerAll-BEIrFubI.js +1 -0
  29. package/dist/renderer/index.html +1 -1
  30. package/dist/scene.d.ts +93 -1
  31. package/dist/scene.js +177 -3
  32. package/dist/types.d.ts +73 -1
  33. package/dist/voice.d.ts +18 -6
  34. package/dist/voice.js +74 -6
  35. package/package.json +2 -2
  36. package/skills/demoreel/SKILL.md +6 -2
  37. package/dist/renderer/assets/webworkerAll-B41hok0-.js +0 -1
package/README.md CHANGED
@@ -106,10 +106,13 @@ Each run writes into `out/<name>/`:
106
106
  | `scroll(target \| { by: px })` | smooth scroll (the page's or the target's scroll container) |
107
107
  | `press(key, { show, duration })` | keyboard shortcut (Playwright syntax); optional keycap HUD pill |
108
108
  | `pause(ms)` | wait |
109
- | `caption(text, { duration, wait })` | caption overlay (an OpenScreen text annotation, sharp at any zoom) |
110
- | `say(text, [opts], [fn])` | voiceover narration via `@phil65/anyvoice` (free Edge TTS by default, OpenAI, ElevenLabs); supports `say(text, async (cue) => { await cue.at("word"); ... })` + `.vtt` subtitles |
109
+ | `caption(text, { duration, wait, animation })` | caption overlay (an OpenScreen text annotation, sharp at any zoom; optional `fade` / `rise` / `pop` / `typewriter` animation) |
110
+ | `say(text, [opts], [fn])` | voiceover narration via `@phil65/anyvoice` (free Edge TTS by default, OpenAI, ElevenLabs, Gemini, Cartesia, Deepgram); supports `say(text, async (cue) => { await cue.at("word"); ... })` + `.vtt` subtitles |
111
111
  | `zoom(target, { depth, duration, context, wait })` | explicit zoom (integer tier `1..6`: 1.25x..5x) overriding auto zooms |
112
112
  | `highlight(target, { duration, color, dim, badge, zoom })` | outline with optional spotlight dim backdrop and callout badge |
113
+ | `blur(target, { type, shape, intensity, mode, duration })` | blur or pixelate (`type: "mosaic"`) sensitive UI elements (alias `redact()`; DOM Gaussian blurs track scroll & zoom automatically; defaults to `"end"`) |
114
+ | `arrow(target, { direction, color, duration })` | draw a crisp camera-tracked OpenScreen vector arrow pointing at an element |
115
+ | `image(src, { x, y, width, height, duration })` | overlay a local PNG/JPG/SVG/WebP image or `data:image/...` URL on the rendered canvas |
113
116
 
114
117
  `target` is a structured accessibility-first spec (`{ role, name?, exact?, nth? }`,
115
118
  `{ label, exact?, nth? }`, `{ placeholder, exact?, nth? }`, `{ text, exact?, nth? }`,
@@ -122,10 +125,10 @@ Scenario options: `viewport`, `cssZoom` (crisper text: lay out at a smaller size
122
125
  up), `serve` (static dir served at `ctx.baseUrl`), `storageState` (Playwright storageState
123
126
  JSON, relative to the scenario file), `colorScheme`, `seed`, `pacing`
124
127
  (`speed`, `beforeAction`, `afterClick`, `typeDelay`, ...), `zoom` (see below), `look`
125
- (`wallpaper`, `padding`, `borderRadius`, `shadowIntensity`, `aspectRatio`,
126
- `captionPosition`, `showKeys`), `cursor` (`size`, `clickBounce`, `smoothing`, `motionBlur`,
128
+ (`wallpaper`, `padding`, `borderRadius`, `shadowIntensity`, `showBlur`, `crop`, `aspectRatio`,
129
+ `captionPosition`, `captionFontSize`, `captionAnimation`, `showKeys`, `watermark`), `cursor` (`size`, `clickBounce`, `smoothing`, `motionBlur`,
127
130
  `show`), `clickRipple`, `trimIdle` (`true` or `{ minMs, keepMs, mode, speed, ignoreFrames }`),
128
- `voice` (`{ provider: "edge" | "openai" | "elevenlabs", voice, model, speed, pitch, volume, instructions, gapMs, padMs, captions: "vtt" | "burned" | "off", cacheDir }`).
131
+ `voice` (`{ provider: "edge" | "openai" | "elevenlabs" | "gemini" | "cartesia" | "deepgram", voice, model, language, speed, pitch, volume, instructions, gapMs, padMs, captions: "vtt" | "burned" | "off", cacheDir }`).
129
132
 
130
133
  ### Voiceover narration (`scene.say`)
131
134
 
@@ -14,7 +14,7 @@ are listed in `vendor/openscreen/VENDORED.md` in the demoreel repository.
14
14
 
15
15
  | package | version | license | text | source |
16
16
  | --- | --- | --- | --- | --- |
17
- | colord | 2.14.0 | MIT | [licenses/colord.txt](licenses/colord.txt) | https://github.com/omgovich/colord |
17
+ | colord | 2.14.1 | MIT | [licenses/colord.txt](licenses/colord.txt) | https://github.com/omgovich/colord |
18
18
  | earcut | 3.2.4 | ISC | [licenses/earcut.txt](licenses/earcut.txt) | git://github.com/mapbox/earcut |
19
19
  | eventemitter3 | 5.0.4 | MIT | [licenses/eventemitter3.txt](licenses/eventemitter3.txt) | git://github.com/primus/eventemitter3 |
20
20
  | gif.js | 0.2.0 | MIT | [licenses/gif.js.txt](licenses/gif.js.txt) | https://github.com/jnordberg/gif.js |
package/dist/args.js CHANGED
@@ -24,7 +24,7 @@ export const COMMANDS = {
24
24
  viewport: { type: "string", value: "WxH", description: "override the scenario viewport, e.g. 1280x720" },
25
25
  state: { type: "string", value: "FILE", description: "Playwright storageState JSON (overrides scenario.storageState)" },
26
26
  "dry-run": { type: "boolean", description: "run the scenario fast without ffmpeg, recording, or writing files" },
27
- "voice-provider": { type: "string", value: "NAME", description: "override voiceover TTS provider: edge (free) | openai | elevenlabs" },
27
+ "voice-provider": { type: "string", value: "NAME", description: "override voiceover TTS provider: edge (free) | openai | elevenlabs | gemini | cartesia | deepgram" },
28
28
  voice: { type: "string", value: "ID", description: "override voiceover voice ID" },
29
29
  "no-voice": { type: "boolean", description: "skip voiceover TTS synthesis for this run" },
30
30
  headed: { type: "boolean", description: "show the browser while recording" },
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import { PACKAGE_ROOT } from "./openscreen.js";
13
13
  import { dryRunScenario, recordScenario, resolveStorageState } from "./record.js";
14
14
  import { renderProject, validateProject } from "./render.js";
15
15
  import { extractFrame, findFramesheet, reviewSheet } from "./sheet.js";
16
- import { formatDryRunVoiceSummary, formatVoiceSummary } from "./voice.js";
16
+ import { formatDryRunVoiceSummary, formatVoiceSummary, VOICE_PROVIDERS } from "./voice.js";
17
17
  const fmt = (ms) => `${(ms / 1000).toFixed(1)}s`;
18
18
  const log = (msg) => console.error(msg);
19
19
  function progressPrinter(enabled) {
@@ -69,8 +69,8 @@ async function cmdRun({ positionals, flags }) {
69
69
  const voice = { ...scenario.voice };
70
70
  if (flags["voice-provider"] !== undefined) {
71
71
  const p = String(flags["voice-provider"]);
72
- if (!["edge", "openai", "elevenlabs"].includes(p)) {
73
- throw new UsageError("--voice-provider must be edge, openai, or elevenlabs");
72
+ if (!VOICE_PROVIDERS.includes(p)) {
73
+ throw new UsageError(`--voice-provider must be ${VOICE_PROVIDERS.join(", ")}`);
74
74
  }
75
75
  voice.provider = p;
76
76
  }
package/dist/compose.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type IdleOptions } from "./idle.ts";
2
2
  import { type Marks } from "./marks.ts";
3
3
  import { buildProject, type LookOptions } from "./project.ts";
4
4
  import type { CursorStyle } from "./render.ts";
5
- import type { ActionRecord, Caption, CursorSample, SpeedRegion, TrimRegion, Viewport, VoiceCue, ZoomRegion } from "./types.ts";
5
+ import type { ActionRecord, ArrowAnnotation, BlurAnnotation, Caption, CursorSample, ImageAnnotation, SpeedRegion, TrimRegion, Viewport, VoiceCue, ZoomRegion } from "./types.ts";
6
6
  import type { VoiceConfig } from "./voice.ts";
7
7
  import { type ZoomOptions } from "./zoom.ts";
8
8
  export declare const TIMELINE_VERSION = 1;
@@ -29,6 +29,9 @@ export interface Timeline {
29
29
  trimRegions: TrimRegion[];
30
30
  speedRegions: SpeedRegion[];
31
31
  captions: Caption[];
32
+ blurs?: BlurAnnotation[];
33
+ arrows?: ArrowAnnotation[];
34
+ images?: ImageAnnotation[];
32
35
  voiceCues?: VoiceCue[];
33
36
  timings: Record<string, number>;
34
37
  files: {
@@ -45,6 +48,8 @@ export interface Timeline {
45
48
  export interface ComposeInput {
46
49
  name: string;
47
50
  outDir: string;
51
+ /** Base directory for resolving relative image/watermark paths (scenario file directory). */
52
+ baseDir?: string;
48
53
  videoPath: string;
49
54
  durationMs: number;
50
55
  frameCount: number;
@@ -52,6 +57,9 @@ export interface ComposeInput {
52
57
  frameSize: Viewport;
53
58
  actions: ActionRecord[];
54
59
  captions: Caption[];
60
+ blurs?: BlurAnnotation[];
61
+ arrows?: ArrowAnnotation[];
62
+ images?: ImageAnnotation[];
55
63
  voiceCues?: VoiceCue[];
56
64
  samples: CursorSample[];
57
65
  frameTimes: number[];
package/dist/compose.js CHANGED
@@ -30,14 +30,35 @@ export function compose(input, opts = {}) {
30
30
  }, idleOpts)
31
31
  : { trimRegions: [], speedRegions: [] };
32
32
  const projectPath = path.join(input.outDir, `${input.name}.openscreen`);
33
+ const resolvedImages = (input.images ?? []).map((img) => ({
34
+ ...img,
35
+ src: img.src.startsWith("data:") || path.isAbsolute(img.src) ? img.src : path.resolve(input.baseDir ?? process.cwd(), img.src),
36
+ }));
37
+ const resolvedLook = look.watermark
38
+ ? {
39
+ ...look,
40
+ watermark: {
41
+ ...look.watermark,
42
+ src: look.watermark.src.startsWith("data:") || path.isAbsolute(look.watermark.src)
43
+ ? look.watermark.src
44
+ : path.resolve(input.baseDir ?? process.cwd(), look.watermark.src),
45
+ },
46
+ }
47
+ : look;
33
48
  let project = buildProject({
34
49
  videoPath: input.videoPath,
35
50
  zoomRegions,
36
51
  captions,
52
+ blurs: input.blurs,
53
+ arrows: input.arrows,
54
+ images: resolvedImages,
37
55
  actions: input.actions,
38
56
  trimRegions,
39
57
  speedRegions,
40
- look,
58
+ look: resolvedLook,
59
+ viewport: input.viewport,
60
+ durationMs: input.durationMs,
61
+ baseDir: input.baseDir,
41
62
  });
42
63
  if (opts.keepProjectFrom && fs.existsSync(opts.keepProjectFrom)) {
43
64
  // rezoom: keep edits made in OpenScreen, replace only the derived regions.
@@ -55,12 +76,15 @@ export function compose(input, opts = {}) {
55
76
  durationMs: input.durationMs,
56
77
  actions: input.actions,
57
78
  captions,
79
+ blurs: input.blurs,
80
+ arrows: input.arrows,
81
+ images: resolvedImages,
58
82
  voiceCues,
59
83
  zoomRegions,
60
84
  trimRegions,
61
85
  speedRegions,
62
86
  layout,
63
- look,
87
+ look: resolvedLook,
64
88
  });
65
89
  const marksPath = path.join(input.outDir, "marks.json");
66
90
  fs.writeFileSync(marksPath, JSON.stringify(marks, null, 1));
@@ -77,7 +101,12 @@ export function compose(input, opts = {}) {
77
101
  frameSize: input.frameSize,
78
102
  options: {
79
103
  zoom: input.zoom ?? {},
80
- look: input.look ?? {},
104
+ look: input.look
105
+ ? {
106
+ ...input.look,
107
+ ...(resolvedLook.watermark ? { watermark: resolvedLook.watermark } : {}),
108
+ }
109
+ : {},
81
110
  trimIdle: idleOpts ?? false,
82
111
  ...(input.cursor ? { cursor: input.cursor } : {}),
83
112
  ...(safeVoice ? { voice: safeVoice } : {}),
@@ -87,6 +116,9 @@ export function compose(input, opts = {}) {
87
116
  trimRegions,
88
117
  speedRegions,
89
118
  captions: captions.map((c) => ({ ...c, startMs: Math.round(c.startMs), endMs: Math.round(c.endMs) })),
119
+ ...(input.blurs?.length ? { blurs: input.blurs } : {}),
120
+ ...(input.arrows?.length ? { arrows: input.arrows } : {}),
121
+ ...(resolvedImages.length ? { images: resolvedImages } : {}),
90
122
  ...(voiceCues.length
91
123
  ? { voiceCues: voiceCues.map((c) => ({ ...c, startMs: Math.round(c.startMs), endMs: Math.round(c.endMs) })) }
92
124
  : {}),
@@ -147,6 +179,9 @@ export function rezoom(dir, overrides = {}) {
147
179
  frameSize: tl.frameSize,
148
180
  actions: tl.actions,
149
181
  captions: tl.captions,
182
+ blurs: tl.blurs,
183
+ arrows: tl.arrows,
184
+ images: tl.images,
150
185
  voiceCues: tl.voiceCues,
151
186
  samples,
152
187
  frameTimes: tl.frameTimes ?? [],
package/dist/idle.js CHANGED
@@ -19,7 +19,7 @@ function mergeIntervals(list) {
19
19
  export function busyIntervals(input, opts = {}) {
20
20
  const busy = [];
21
21
  for (const a of input.actions) {
22
- if (a.kind === "pause" || a.kind === "caption" || a.kind === "say")
22
+ if (a.kind === "pause" || a.kind === "caption" || a.kind === "say" || a.kind === "blur")
23
23
  continue;
24
24
  busy.push([a.startMs - 150, a.endMs + 250]);
25
25
  }
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /** demoreel: scripted product demo videos (videos as code), rendered by OpenScreen's exporter. */
2
2
  export { type DryRunError, type DryRunOptions, type DryRunResult, type RecordOptions, type RecordResult, type Scenario, type ScenarioContext, defineScenario, dryRunScenario, recordScenario, resolveStorageState, } from "./record.ts";
3
- export { type ActionOptions, applyZoomAnchor, type ClickRippleOptions, DEFAULT_PACING, describeTarget, type HighlightOptions, type PacingOptions, type PressOptions, resolveTarget, type SayOptions, Scene, type SceneClock, type Target, type TargetSpec, type VoiceCueHandle, ZOOM_ATTRIBUTE, type ZoomOptions as SceneZoomOptions, } from "./scene.ts";
4
- export { buildVoiceVtt, createVoiceSynthesizer, DEFAULT_VOICE_GAP_MS, DEFAULT_VOICE_PAD_MS, findWordTiming, formatDryRunVoiceSummary, formatVoiceSummary, lintVoiceCues, muxVoiceTrack, type SayDeliveryOptions, type SynthesizedCue, type VoiceConfig, type VoiceFinding, type VoiceProviderName, type VoiceSynthesizer, } from "./voice.ts";
3
+ export { type ActionOptions, applyZoomAnchor, type ArrowOptions, type BlurOptions, type ClickRippleOptions, DEFAULT_PACING, describeTarget, type HighlightOptions, type ImageOptions, type PacingOptions, type PressOptions, resolveTarget, type SayOptions, Scene, type SceneClock, type Target, type TargetSpec, type VoiceCueHandle, ZOOM_ATTRIBUTE, type ZoomOptions as SceneZoomOptions, } from "./scene.ts";
4
+ export { buildVoiceVtt, chunkVoiceCaptions, createVoiceSynthesizer, DEFAULT_VOICE_GAP_MS, DEFAULT_VOICE_PAD_MS, findWordTiming, formatDryRunVoiceSummary, formatVoiceSummary, lintVoiceCues, muxVoiceTrack, type SayDeliveryOptions, type SynthesizedCue, type VoiceConfig, type VoiceFinding, VOICE_PROVIDERS, type VoiceProviderName, type VoiceSynthesizer, } from "./voice.ts";
5
5
  export { DEFAULT_ZOOM_OPTIONS, DEPTH_SCALES, deriveZoomRegions, depthForBox, normalizeDepth, type ZoomOptions } from "./zoom.ts";
6
6
  export { DEFAULT_IDLE_OPTIONS, deriveIdleRegions, idleIntervals, type IdleOptions, sourceToOutputMs } from "./idle.ts";
7
- export { buildCursorData, buildProject, type BuildProjectOptions, captionAnnotations, DEFAULT_LOOK, formatKeycap, keycapAnnotations, type KeyHudOptions, type KeyHudPosition, keycapRect, type LookOptions, normalizeSamples, type OpenScreenProject, writeProject, } from "./project.ts";
7
+ export { arrowAnnotations, blurAnnotations, buildCursorData, buildProject, type BuildProjectOptions, captionAnnotations, DEFAULT_LOOK, formatKeycap, imageAnnotations, keycapAnnotations, type KeyHudOptions, type KeyHudPosition, keycapRect, type LookOptions, normalizeSamples, type OpenScreenProject, resolveImageDataUrl, type WatermarkOptions, type WatermarkPosition, writeProject, } from "./project.ts";
8
8
  export { exportGif, type GifOptions, type GifResult } from "./gif.ts";
9
9
  export { buildMarks, type Marks, type MarkPoint, type MarkRegion, type MarkSpan, type MarksInput } from "./marks.ts";
10
10
  export { stageLayout, type StageLayout } from "./layout.ts";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /** demoreel: scripted product demo videos (videos as code), rendered by OpenScreen's exporter. */
2
2
  export { defineScenario, dryRunScenario, recordScenario, resolveStorageState, } from "./record.js";
3
3
  export { applyZoomAnchor, DEFAULT_PACING, describeTarget, resolveTarget, Scene, ZOOM_ATTRIBUTE, } from "./scene.js";
4
- export { buildVoiceVtt, createVoiceSynthesizer, DEFAULT_VOICE_GAP_MS, DEFAULT_VOICE_PAD_MS, findWordTiming, formatDryRunVoiceSummary, formatVoiceSummary, lintVoiceCues, muxVoiceTrack, } from "./voice.js";
4
+ export { buildVoiceVtt, chunkVoiceCaptions, createVoiceSynthesizer, DEFAULT_VOICE_GAP_MS, DEFAULT_VOICE_PAD_MS, findWordTiming, formatDryRunVoiceSummary, formatVoiceSummary, lintVoiceCues, muxVoiceTrack, VOICE_PROVIDERS, } from "./voice.js";
5
5
  export { DEFAULT_ZOOM_OPTIONS, DEPTH_SCALES, deriveZoomRegions, depthForBox, normalizeDepth } from "./zoom.js";
6
6
  export { DEFAULT_IDLE_OPTIONS, deriveIdleRegions, idleIntervals, sourceToOutputMs } from "./idle.js";
7
- export { buildCursorData, buildProject, captionAnnotations, DEFAULT_LOOK, formatKeycap, keycapAnnotations, keycapRect, normalizeSamples, writeProject, } from "./project.js";
7
+ export { arrowAnnotations, blurAnnotations, buildCursorData, buildProject, captionAnnotations, DEFAULT_LOOK, formatKeycap, imageAnnotations, keycapAnnotations, keycapRect, normalizeSamples, resolveImageDataUrl, writeProject, } from "./project.js";
8
8
  export { exportGif } from "./gif.js";
9
9
  export { buildMarks } from "./marks.js";
10
10
  export { stageLayout } from "./layout.js";
package/dist/layout.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * compositeLayout.ts::centerRect, focusUtils.ts::clampFocusToScale and
5
5
  * zoomTransform.ts::computeZoomTransform for the no-webcam, no-crop case demoreel writes.
6
6
  */
7
- import type { Box, Depth, Viewport } from "./types.ts";
7
+ import type { Box, Depth, Viewport, ZoomRegion } from "./types.ts";
8
8
  /** OpenScreen ZOOM_DEPTH_SCALES (src/components/video-editor/types.ts). */
9
9
  export declare const DEPTH_SCALES: Record<Depth, number>;
10
10
  /** A rectangle in stage-normalised coordinates (0-1 of the output canvas). */
@@ -50,3 +50,12 @@ export declare function zoomRect(r: NormRect, depth: Depth, focus: {
50
50
  }): NormRect;
51
51
  /** Clips a rect to the unit square; null if nothing is left. */
52
52
  export declare function clipUnit(r: NormRect): NormRect | null;
53
+ /** Approximate zoom progress (0-1) of a region at recording time t. */
54
+ export declare function zoomProgress(r: ZoomRegion, t: number): number;
55
+ /** The camera at time t: the dominant zoom region and its progress. */
56
+ export declare function cameraAt(regions: ZoomRegion[], t: number): {
57
+ region: ZoomRegion;
58
+ p: number;
59
+ } | null;
60
+ /** Stage rect -> output-frame rect under the camera at time t (OpenScreen computeZoomTransform). */
61
+ export declare function applyCamera(rect: NormRect, regions: ZoomRegion[], t: number): NormRect;
package/dist/layout.js CHANGED
@@ -53,3 +53,44 @@ export function clipUnit(r) {
53
53
  return null;
54
54
  return { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };
55
55
  }
56
+ const ZOOM_IN_BEFORE_MS = 1022;
57
+ const ZOOM_IN_AFTER_MS = 500;
58
+ const ZOOM_OUT_MS = 1016;
59
+ const smooth = (x) => {
60
+ const t = Math.min(1, Math.max(0, x));
61
+ return t * t * (3 - 2 * t);
62
+ };
63
+ /** Approximate zoom progress (0-1) of a region at recording time t. */
64
+ export function zoomProgress(r, t) {
65
+ const inStart = r.startMs - ZOOM_IN_BEFORE_MS;
66
+ if (t <= inStart || t >= r.endMs + ZOOM_OUT_MS)
67
+ return 0;
68
+ if (t < r.startMs + ZOOM_IN_AFTER_MS)
69
+ return smooth((t - inStart) / (ZOOM_IN_BEFORE_MS + ZOOM_IN_AFTER_MS));
70
+ if (t <= r.endMs)
71
+ return 1;
72
+ return 1 - smooth((t - r.endMs) / ZOOM_OUT_MS);
73
+ }
74
+ /** The camera at time t: the dominant zoom region and its progress. */
75
+ export function cameraAt(regions, t) {
76
+ let best = null;
77
+ for (const r of regions) {
78
+ const p = zoomProgress(r, t);
79
+ if (p > 0 && (!best || p > best.p))
80
+ best = { region: r, p };
81
+ }
82
+ return best;
83
+ }
84
+ /** Stage rect -> output-frame rect under the camera at time t (OpenScreen computeZoomTransform). */
85
+ export function applyCamera(rect, regions, t) {
86
+ const cam = cameraAt(regions, t);
87
+ if (!cam)
88
+ return rect;
89
+ const depth = Math.min(6, Math.max(1, Math.round(cam.region.depth)));
90
+ const s = DEPTH_SCALES[depth];
91
+ const f = clampFocus(cam.region.focus, s);
92
+ const scale = 1 + (s - 1) * cam.p;
93
+ const ox = (0.5 - f.cx * s) * cam.p;
94
+ const oy = (0.5 - f.cy * s) * cam.p;
95
+ return { x: rect.x * scale + ox, y: rect.y * scale + oy, w: rect.w * scale, h: rect.h * scale };
96
+ }
package/dist/marks.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { type NormRect, type StageLayout } from "./layout.ts";
1
+ import { applyCamera, cameraAt, type NormRect, type StageLayout, zoomProgress } from "./layout.ts";
2
2
  import { type LookOptions } from "./project.ts";
3
- import type { ActionRecord, Caption, SpeedRegion, TrimRegion, Viewport, VoiceCue, ZoomRegion } from "./types.ts";
3
+ import type { ActionRecord, ArrowAnnotation, BlurAnnotation, Caption, ImageAnnotation, SpeedRegion, TrimRegion, Viewport, VoiceCue, ZoomRegion } from "./types.ts";
4
+ export { applyCamera, cameraAt, zoomProgress };
4
5
  export interface MarkPoint {
5
6
  t: number;
6
7
  x: number;
@@ -36,12 +37,15 @@ export interface MarksInput {
36
37
  durationMs: number;
37
38
  actions: ActionRecord[];
38
39
  captions: Caption[];
40
+ blurs?: BlurAnnotation[];
41
+ arrows?: ArrowAnnotation[];
42
+ images?: ImageAnnotation[];
39
43
  voiceCues?: VoiceCue[];
40
44
  zoomRegions: ZoomRegion[];
41
45
  trimRegions?: TrimRegion[];
42
46
  speedRegions?: SpeedRegion[];
43
47
  layout: StageLayout;
44
- look: Pick<LookOptions, "captionPosition">;
48
+ look: Pick<LookOptions, "captionPosition" | "watermark">;
45
49
  }
46
50
  export interface TargetRect {
47
51
  action: ActionRecord;
@@ -58,13 +62,4 @@ export declare function targetRects(input: Pick<MarksInput, "actions" | "viewpor
58
62
  * while it is shown (with 400 ms slack); then top, if that overlaps less.
59
63
  */
60
64
  export declare function placeCaptions(captions: Caption[], targets: TargetRect[], position: LookOptions["captionPosition"]): Caption[];
61
- /** Approximate zoom progress (0-1) of a region at recording time t. */
62
- export declare function zoomProgress(r: ZoomRegion, t: number): number;
63
- /** The camera at time t: the dominant zoom region and its progress. */
64
- export declare function cameraAt(regions: ZoomRegion[], t: number): {
65
- region: ZoomRegion;
66
- p: number;
67
- } | null;
68
- /** Stage rect -> output-frame rect under the camera at time t (OpenScreen computeZoomTransform). */
69
- export declare function applyCamera(rect: NormRect, regions: ZoomRegion[], t: number): NormRect;
70
65
  export declare function buildMarks(input: MarksInput): Marks;
package/dist/marks.js CHANGED
@@ -6,14 +6,15 @@
6
6
  * so `framesheet inspect out.mp4 --marks marks.json` draws them where they appear.
7
7
  */
8
8
  import { sourceToOutputMs } from "./idle.js";
9
- import { clipUnit, DEPTH_SCALES, boxToStage, clampFocus, toStage } from "./layout.js";
10
- import { captionRect } from "./project.js";
9
+ import { applyCamera, boxToStage, cameraAt, clipUnit, DEPTH_SCALES, toStage, zoomProgress, } from "./layout.js";
10
+ import { arrowRectForTarget, captionRect } from "./project.js";
11
11
  import { normalizeDepth } from "./zoom.js";
12
+ export { applyCamera, cameraAt, zoomProgress };
12
13
  /** Action target boxes in output-frame coordinates (padding + zoom camera applied). */
13
14
  export function targetRects(input) {
14
15
  const out = [];
15
16
  for (const a of input.actions) {
16
- if (!a.box || a.kind === "zoom")
17
+ if (!a.box || a.kind === "zoom" || a.kind === "blur" || a.kind === "arrow" || a.kind === "image")
17
18
  continue;
18
19
  // Sample the camera once the cursor has landed (zoom is then (nearly) complete).
19
20
  const t = Math.min(a.endMs, a.arriveMs + 300);
@@ -42,46 +43,6 @@ export function placeCaptions(captions, targets, position) {
42
43
  return { ...c, position: bottom > 0 && cost("top") < bottom ? "top" : "bottom" };
43
44
  });
44
45
  }
45
- const ZOOM_IN_BEFORE_MS = 1022;
46
- const ZOOM_IN_AFTER_MS = 500;
47
- const ZOOM_OUT_MS = 1016;
48
- const smooth = (x) => {
49
- const t = Math.min(1, Math.max(0, x));
50
- return t * t * (3 - 2 * t);
51
- };
52
- /** Approximate zoom progress (0-1) of a region at recording time t. */
53
- export function zoomProgress(r, t) {
54
- const inStart = r.startMs - ZOOM_IN_BEFORE_MS;
55
- if (t <= inStart || t >= r.endMs + ZOOM_OUT_MS)
56
- return 0;
57
- if (t < r.startMs + ZOOM_IN_AFTER_MS)
58
- return smooth((t - inStart) / (ZOOM_IN_BEFORE_MS + ZOOM_IN_AFTER_MS));
59
- if (t <= r.endMs)
60
- return 1;
61
- return 1 - smooth((t - r.endMs) / ZOOM_OUT_MS);
62
- }
63
- /** The camera at time t: the dominant zoom region and its progress. */
64
- export function cameraAt(regions, t) {
65
- let best = null;
66
- for (const r of regions) {
67
- const p = zoomProgress(r, t);
68
- if (p > 0 && (!best || p > best.p))
69
- best = { region: r, p };
70
- }
71
- return best;
72
- }
73
- /** Stage rect -> output-frame rect under the camera at time t (OpenScreen computeZoomTransform). */
74
- export function applyCamera(rect, regions, t) {
75
- const cam = cameraAt(regions, t);
76
- if (!cam)
77
- return rect;
78
- const s = DEPTH_SCALES[normalizeDepth(cam.region.depth)];
79
- const f = clampFocus(cam.region.focus, s);
80
- const scale = 1 + (s - 1) * cam.p;
81
- const ox = (0.5 - f.cx * s) * cam.p;
82
- const oy = (0.5 - f.cy * s) * cam.p;
83
- return { x: rect.x * scale + ox, y: rect.y * scale + oy, w: rect.w * scale, h: rect.h * scale };
84
- }
85
46
  const r4 = (v) => Math.round(v * 10000) / 10000;
86
47
  const r3 = (v) => Math.round(v * 1000) / 1000;
87
48
  function describe(a) {
@@ -141,6 +102,75 @@ export function buildMarks(input) {
141
102
  kind: "voice",
142
103
  });
143
104
  }
105
+ for (const b of input.blurs ?? []) {
106
+ const bEndMs = b.endMs === "end" ? input.durationMs : b.endMs;
107
+ const start = out(b.startMs);
108
+ const sampleT = Math.min(bEndMs, b.startMs + Math.min(350, (bEndMs - b.startMs) / 2));
109
+ let rect = null;
110
+ if (b.rect) {
111
+ rect = clipUnit({ x: b.rect.x / 100, y: b.rect.y / 100, w: b.rect.width / 100, h: b.rect.height / 100 });
112
+ }
113
+ else if (b.box) {
114
+ const pad = b.padding ?? 4;
115
+ const padded = {
116
+ x: Math.max(0, b.box.x - pad),
117
+ y: Math.max(0, b.box.y - pad),
118
+ width: b.box.width + pad * 2,
119
+ height: b.box.height + pad * 2,
120
+ };
121
+ rect = clipUnit(applyCamera(boxToStage(layout, vp, padded), zr, sampleT));
122
+ }
123
+ marks.regions.push({
124
+ start,
125
+ end: Math.max(start, Math.min(endS, out(bEndMs))),
126
+ ...(box(rect) ?? {}),
127
+ label: b.label ?? "blur",
128
+ kind: "blur",
129
+ });
130
+ }
131
+ for (const a of input.arrows ?? []) {
132
+ const start = out(a.startMs);
133
+ const sizePct = Math.min(40, Math.max(3, a.size ?? 9));
134
+ let rect = null;
135
+ if (a.rect) {
136
+ rect = clipUnit({ x: a.rect.x / 100, y: a.rect.y / 100, w: a.rect.width / 100, h: a.rect.height / 100 });
137
+ }
138
+ else if (a.box) {
139
+ const sampleT = Math.min(a.endMs, a.startMs + Math.min(350, (a.endMs - a.startMs) / 2));
140
+ const stage = applyCamera(boxToStage(layout, vp, a.box), zr, sampleT);
141
+ const r = arrowRectForTarget(stage, a.direction, sizePct);
142
+ rect = clipUnit({ x: r.x / 100, y: r.y / 100, w: r.width / 100, h: r.height / 100 });
143
+ }
144
+ marks.regions.push({
145
+ start,
146
+ end: Math.max(start, Math.min(endS, out(a.endMs))),
147
+ ...(box(rect) ?? {}),
148
+ label: a.label ?? `arrow ${a.direction}`,
149
+ kind: "arrow",
150
+ });
151
+ }
152
+ const imageList = [...(input.images ?? [])];
153
+ if (input.look.watermark) {
154
+ const wm = input.look.watermark;
155
+ const w = wm.width ?? 10;
156
+ const h = wm.height ?? 8;
157
+ const pos = wm.position ?? "bottom-right";
158
+ const x = typeof pos === "object" ? pos.x : pos.endsWith("left") ? 2.5 : 97.5 - w;
159
+ const y = typeof pos === "object" ? pos.y : pos.startsWith("top") ? 2.5 : 97.5 - h;
160
+ imageList.push({ startMs: 0, endMs: "end", src: wm.src, x, y, width: w, height: h, label: "watermark" });
161
+ }
162
+ for (const img of imageList) {
163
+ const imgEndMs = img.endMs === "end" ? input.durationMs : img.endMs;
164
+ const start = out(img.startMs);
165
+ const rect = clipUnit({ x: img.x / 100, y: img.y / 100, w: img.width / 100, h: img.height / 100 });
166
+ marks.regions.push({
167
+ start,
168
+ end: Math.max(start, Math.min(endS, out(imgEndMs))),
169
+ ...(box(rect) ?? {}),
170
+ label: img.label ?? "image",
171
+ kind: "image",
172
+ });
173
+ }
144
174
  for (const cap of input.captions) {
145
175
  const c = captionRect(cap.position ?? input.look.captionPosition);
146
176
  const start = out(cap.startMs);
package/dist/mcp.js CHANGED
@@ -175,7 +175,7 @@ export function createMcpServer() {
175
175
  scenarioPath: z.string().describe("Path to the scenario file (*.scenario.ts/.mts/.mjs)."),
176
176
  viewport: z.string().optional().describe("Optional WxH viewport override."),
177
177
  state: z.string().optional().describe("Optional Playwright storageState JSON file path."),
178
- voiceProvider: z.enum(["edge", "openai", "elevenlabs"]).optional().describe("Override voiceover TTS provider."),
178
+ voiceProvider: z.enum(["edge", "openai", "elevenlabs", "gemini", "cartesia", "deepgram"]).optional().describe("Override voiceover TTS provider."),
179
179
  voice: z.string().optional().describe("Override voiceover voice ID."),
180
180
  noVoice: z.boolean().optional().describe("Skip TTS synthesis during dry-run."),
181
181
  }),
@@ -245,7 +245,7 @@ export function createMcpServer() {
245
245
  frames: z.number().int().min(4).max(32).optional().default(12).describe("Number of contact-sheet tiles (default 12)."),
246
246
  state: z.string().optional().describe("Optional Playwright storageState JSON file path."),
247
247
  render: z.boolean().optional().default(true).describe("Render MP4 after recording (default true)."),
248
- voiceProvider: z.enum(["edge", "openai", "elevenlabs"]).optional().describe("Override voiceover TTS provider."),
248
+ voiceProvider: z.enum(["edge", "openai", "elevenlabs", "gemini", "cartesia", "deepgram"]).optional().describe("Override voiceover TTS provider."),
249
249
  voice: z.string().optional().describe("Override voiceover voice ID."),
250
250
  noVoice: z.boolean().optional().describe("Disable voiceover synthesis for this run."),
251
251
  }),