@slidevideo/cli 0.9.0 → 0.11.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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.11.0
6
+
7
+ - Support standalone MP4 scenes (`scenes[].media`) separate from `slides.md` or `.pptx`—including intro/outro branding bumpers with source audio stings, mid-deck or deck-free screen recordings, direct FFmpeg splicing with normalized annotations, and native playback in `slidevideo play`.
8
+ - Support video-anchored narration, reveals, and annotations (`at: { media, time_ms }`) with optional phrase-to-frame alignment, beat-mismatch policies (`continuous`, `freeze`, `fit_video`) on `play` actions, and live media timestamp readouts in `slidevideo play`.
9
+
10
+ ## 0.10.0
11
+
12
+ - Extract per-slide speaker notes in `slidevideo inspect` for both Slidev and PowerPoint decks.
13
+ - Add `slidevideo init --deck <file>` to scaffold a runnable `slidevideo.yaml` directly from a Slidev or PowerPoint deck's slides, speaker notes, and reveal clicks without writing YAML by hand.
14
+
5
15
  ## 0.9.0
6
16
 
7
17
  - Add storyboard-controlled straight `arrow` annotations with normalized or explicitly anchored target endpoints, endpoint padding, solid or dashed strokes, filled or open arrowheads, and optional `fade` or `draw` motion for Slidev and PowerPoint.
package/README.md CHANGED
@@ -18,7 +18,7 @@ slidevideo build --storyboard slidevideo.yaml
18
18
 
19
19
  A completed build writes `final.mp4` (plus `final.vtt` and `final.srt` captions for narrated decks) inside a fresh `runs/<timestamp>` directory (or the path passed to `--run`) at `1920x1080` and `30 fps` by default, and caches generated speech in `.slidevideo/speech` beside the storyboard for reuse across runs (override with `--cache-dir` or disable with `--no-cache`). Pass `--width` and `--height` together and optional `--fps` to select another resolution or frame rate, and `--captions <vtt|srt|both|none>` to control subtitle export. Use `slidevideo setup --license` to activate a key. The installed version checks its bundled revocation list offline. New exports using a revoked key include the watermark.
20
20
 
21
- To draft or edit a storyboard with a coding agent, run `slidevideo skill --install` to link the bundled skill into `~/.agents/skills/slidevideo` and `~/.claude/skills/slidevideo` when Claude Code is detected, or ask the agent to run `slidevideo skill`. For non-interactive setup, run `slidevideo setup --install --json` and see `slidevideo setup --help` and `slidevideo skill --help` for provider and project flags. Use `slidevideo inspect --deck <file> --json` to list slide names, click counts, media IDs, and highlight targets before creating `slidevideo.yaml`. The CLI includes the skill and its storyboard, deck-compatibility, and recording references.
21
+ To draft or edit a storyboard with a coding agent, run `slidevideo skill --install` to link the bundled skill into `~/.agents/skills/slidevideo` and `~/.claude/skills/slidevideo` when Claude Code is detected, or ask the agent to run `slidevideo skill`. To create a starter `slidevideo.yaml` directly from an existing `.md` or `.pptx` deck without a coding agent, run `slidevideo init --deck <file>`. For non-interactive setup, run `slidevideo setup --install --json` and see `slidevideo setup --help`, `slidevideo init --help`, and `slidevideo skill --help` for provider and project flags. Use `slidevideo inspect --deck <file> --json` to list slide names, click counts, speaker notes, media IDs, and highlight targets before creating `slidevideo.yaml`. The CLI includes the skill and its storyboard, deck-compatibility, and recording references.
22
22
 
23
23
  CLI commands check `https://slidevideo.io/release.json` (falling back to npm) in the background at most once every 24 hours and show cached update notices on later interactive calls. Stable installations use `latest`; existing alpha installations use `alpha`. Notices include an exact-version upgrade command. If you installed with `--prefix`, add the same `--prefix` option to that command so npm updates the copy on your `PATH`. Set `SLIDEVIDEO_NO_UPDATE_CHECK=1` or `DO_NOT_TRACK=1` to disable checks and notices. CI, `--version`, `--help`, `setup --manual`, read-only `skill` views, `license`, and `impressum` skip both, and `--json` and `--quiet` suppress notices.
24
24
 
@@ -101,6 +101,10 @@ function stopMedia(element: HTMLMediaElement, completed: boolean) {
101
101
  if (window.__slidevideoTimers) window.__slidevideoTimers.clearInternalInterval(monitor.timer)
102
102
  else window.clearInterval(monitor.timer)
103
103
  monitors.delete(element); element.pause()
104
+ if (completed && monitor.item.action.type === 'play' && monitor.item.action.trim_end_ms !== undefined) {
105
+ const endSeconds = monitor.item.action.trim_end_ms / 1000
106
+ if (Math.abs(element.currentTime - endSeconds) > 0.02) element.currentTime = endSeconds
107
+ }
104
108
  if (completed) state.events.push({ id: `${monitor.item.id}:ended`, type: 'media-ended', scheduled_ms: monitor.item.end_ms, observed_ms: scheduleNow(), media_ms: element.currentTime * 1000 })
105
109
  }
106
110
  const waits = new Map<number, () => void>()
@@ -156,7 +160,8 @@ async function apply(item: ScheduledAction) {
156
160
  if (action.type === 'play') {
157
161
  const element = media(action.media)
158
162
  stopMedia(element, true)
159
- element.currentTime = (action.trim_start_ms ?? 0) / 1000
163
+ const startSeconds = (action.trim_start_ms ?? 0) / 1000
164
+ if (Math.abs(element.currentTime - startSeconds) > 0.02) element.currentTime = startSeconds
160
165
  element.playbackRate = action.rate ?? 1
161
166
  element.muted = true
162
167
  await element.play()
@@ -446,13 +451,21 @@ async function play(verifyTiming = false, plannedSkips: StaticSkip[] = []) {
446
451
  origin = start
447
452
  const requests = geometryRequests(schedule)
448
453
  if (requests.length) geometry = geometryCollector(requests, state.annotation_geometry, () => ({ slide: String(nav.currentSlideRoute.value.meta.slide.frontmatter.name ?? `slide-${nav.currentSlideNo.value}`), visit, click: nav.clicks.value, index: nav.currentSlideNo.value }), () => scheduleNow(), message => { state.failure = message })
449
- for (const entry of playbackEntries(schedule)) {
454
+ const entries: (ReturnType<typeof playbackEntries>[number] | { at: number; order: number; type: 'media-end'; id: string })[] = playbackEntries(schedule)
455
+ for (const item of schedule.actions) if (item.action.type === 'play') entries.push({ at: item.end_ms, order: 0, type: 'media-end', id: item.action.media })
456
+ entries.sort((a, b) => a.at - b.at || a.order - b.order)
457
+ for (const entry of entries) {
450
458
  await waitUntilSchedule(entry.at, current, skips, skipCursor)
451
459
  if (current !== generation) throw new Error('Playback reset')
452
460
  if (state.failure) throw new Error(state.failure)
453
461
  if (entry.type === 'geometry-start') { geometry!.start(entry.request); continue }
454
462
  if (entry.type === 'geometry-end') { geometry!.end(entry.request); continue }
455
463
  if (entry.type === 'annotation-start' || entry.type === 'annotation-end') continue
464
+ if (entry.type === 'media-end') {
465
+ const element = document.getElementById(entry.id)
466
+ if (element instanceof HTMLMediaElement) stopMedia(element, true)
467
+ continue
468
+ }
456
469
  const item = entry.item
457
470
  await apply(item)
458
471
  const observed_ms = scheduleNow()
@@ -33,8 +33,8 @@ export function createPreview(
33
33
  const media = new Set<HTMLMediaElement>()
34
34
  const animations = new Set<Animation>()
35
35
  const allGeometryRequests = geometryRequests(schedule)
36
- const entries: (ReturnType<typeof playbackEntries>[number] | { at: number; order: number; type: 'media-end'; id: string })[] = playbackEntries(schedule)
37
- for (const item of schedule.actions) if (item.action.type === 'play') entries.push({ at: item.end_ms, order: 0, type: 'media-end', id: item.action.media })
36
+ const entries: (ReturnType<typeof playbackEntries>[number] | { at: number; order: number; type: 'media-end'; id: string; trimEndSeconds?: number })[] = playbackEntries(schedule)
37
+ for (const item of schedule.actions) if (item.action.type === 'play') entries.push({ at: item.end_ms, order: 0, type: 'media-end', id: item.action.media, trimEndSeconds: item.action.trim_end_ms !== undefined ? item.action.trim_end_ms / 1000 : undefined })
38
38
  entries.sort((a, b) => a.at - b.at || a.order - b.order)
39
39
 
40
40
  const elapsed = () => Math.min(schedule.duration_ms, status === 'playing' ? offset + performance.now() - origin : offset)
@@ -206,6 +206,7 @@ export function createPreview(
206
206
  const element = document.getElementById(clip.id)
207
207
  if (element instanceof HTMLMediaElement) element.pause()
208
208
  }
209
+ const activeMedia = new Set<string>()
209
210
  for (const item of schedule.actions) {
210
211
  if (item.action.type !== 'play') continue
211
212
  if (item.start_ms <= targetMs && targetMs < item.end_ms) {
@@ -217,11 +218,28 @@ export function createPreview(
217
218
  element.playbackRate = rate
218
219
  await seekMediaElement(element, mediaMs / 1000)
219
220
  media.add(element)
221
+ activeMedia.add(item.action.media)
220
222
  if (shouldPlay) await element.play()
221
223
  else element.pause()
222
224
  }
223
225
  }
224
226
  }
227
+ const frozenMedia = new Map<string, number>()
228
+ for (const item of schedule.actions) {
229
+ if (item.action.type !== 'play' || activeMedia.has(item.action.media)) continue
230
+ if (item.end_ms <= targetMs) {
231
+ const endMs = item.action.trim_end_ms ?? ((item.action.trim_start_ms ?? 0) + (item.end_ms - item.start_ms) * (item.action.rate ?? 1))
232
+ frozenMedia.set(item.action.media, endMs)
233
+ }
234
+ }
235
+ for (const [mediaId, endMs] of frozenMedia) {
236
+ const element = document.getElementById(mediaId)
237
+ if (element instanceof HTMLMediaElement) {
238
+ element.muted = true
239
+ element.pause()
240
+ await seekMediaElement(element, endMs / 1000)
241
+ }
242
+ }
225
243
  activateCollectorAt(targetMs, shouldPlay)
226
244
  }
227
245
  async function run(current: number, startIndex: number) {
@@ -236,7 +254,13 @@ export function createPreview(
236
254
  else if (entry.type === 'annotation-end') { active.delete(entry.annotation.id); paint() }
237
255
  else if (entry.type === 'media-end') {
238
256
  const element = document.getElementById(entry.id)
239
- if (element instanceof HTMLMediaElement) { element.pause(); media.delete(element) }
257
+ if (element instanceof HTMLMediaElement) {
258
+ element.pause()
259
+ if (entry.trimEndSeconds !== undefined && Math.abs(element.currentTime - entry.trimEndSeconds) > 0.02) {
260
+ element.currentTime = entry.trimEndSeconds
261
+ }
262
+ media.delete(element)
263
+ }
240
264
  } else {
241
265
  await apply(entry.item)
242
266
  if (current !== generation) return
@@ -4,7 +4,8 @@ import { tmpdir } from 'node:os';
4
4
  import { extname, join, resolve } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { nativePreview } from './powerpoint-preview.js';
7
- import { defaultVideoOutput, defaultViewport } from '../contracts.js';
7
+ import { defaultVideoOutput, defaultViewport, normalizeSpeakerNotes } from '../contracts.js';
8
+ import { deckMediaIds, hasStandaloneMediaSchedule, isSlideScene, projectDeckSchedule, slideSceneCues } from '../standalone-media.js';
8
9
  import { geometryRequests } from '../annotation-paint.js';
9
10
  import { planStaticSkips, remapCaptureTimestamps } from './capture-compression.js';
10
11
  import { calibrate, estimateOrigin } from '../calibration.js';
@@ -46,7 +47,7 @@ function slideEntrySettleMs(slide) {
46
47
  function parseDeck(value) {
47
48
  requireCondition(object(value) && value.version === 1 && value.kind === 'inspection' && typeof value.deck_sha256 === 'string' && finite(value.width) && finite(value.height) && value.width > 0 && value.height > 0 && Array.isArray(value.slides) && value.slides.length > 0 && Array.isArray(value.media) && Array.isArray(value.unsupported) && object(value.dependencies), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid catalog', 5);
48
49
  for (const slide of value.slides) {
49
- requireCondition(object(slide) && typeof slide.id === 'string' && ['native_id', 'index', 'transition', 'transition_duration_ms', 'auto_advance', 'hidden', 'interactive'].every(key => finite(slide[key])) && Array.isArray(slide.effects) && Array.isArray(slide.shapes), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid slide', 5);
50
+ requireCondition(object(slide) && typeof slide.id === 'string' && (slide.notes === undefined || typeof slide.notes === 'string') && ['native_id', 'index', 'transition', 'transition_duration_ms', 'auto_advance', 'hidden', 'interactive'].every(key => finite(slide[key])) && Array.isArray(slide.effects) && Array.isArray(slide.shapes), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid slide', 5);
50
51
  for (const shape of slide.shapes) {
51
52
  requireCondition(object(shape), 'POWERPOINT_PROTOCOL', 'Native inspection returned an invalid shape identity', 5);
52
53
  const bounds = shape.bounds;
@@ -354,16 +355,20 @@ export class PowerPointAdapter {
354
355
  const unsupported = deckCapabilityIssues(this.deck);
355
356
  return {
356
357
  dimensions: { width: this.deck.width, height: this.deck.height },
357
- slides: this.deck.slides.map(slide => ({
358
- id: slide.id || `slide-${slide.native_id}`,
359
- ...(slide.id ? { alias: `slide-${slide.native_id}` } : {}),
360
- index: slide.index,
361
- clicks: slide.clicks.length,
362
- clicks_known: true,
363
- ...(slide.transition_duration_ms > 0 ? { transition_duration_ms: slide.transition_duration_ms } : {}),
364
- ...(slide.entry_duration_ms > 0 ? { entry_duration_ms: slide.entry_duration_ms } : {}),
365
- ...(slide.clicks.length ? { click_durations_ms: [...slide.clicks] } : {}),
366
- })),
358
+ slides: this.deck.slides.map(slide => {
359
+ const notes = normalizeSpeakerNotes(slide.notes);
360
+ return {
361
+ id: slide.id || `slide-${slide.native_id}`,
362
+ ...(slide.id ? { alias: `slide-${slide.native_id}` } : {}),
363
+ index: slide.index,
364
+ clicks: slide.clicks.length,
365
+ clicks_known: true,
366
+ ...(slide.transition_duration_ms > 0 ? { transition_duration_ms: slide.transition_duration_ms } : {}),
367
+ ...(slide.entry_duration_ms > 0 ? { entry_duration_ms: slide.entry_duration_ms } : {}),
368
+ ...(slide.clicks.length ? { click_durations_ms: [...slide.clicks] } : {}),
369
+ ...(notes ? { notes } : {}),
370
+ };
371
+ }),
367
372
  media_ids: [...new Set(this.deck.media.map(media => media.id))],
368
373
  ...(this.deck.media.length ? {
369
374
  media: this.deck.media.map(media => {
@@ -424,7 +429,12 @@ export class PowerPointAdapter {
424
429
  }
425
430
  for (const media of deck.media)
426
431
  requireCondition(isSupportedNativeMedia(media), 'POWERPOINT_CAPABILITY', `Video ${media.id} requires full-source embedded media with no native trim, autoplay, loop, rewind or fullscreen transform`, 3);
432
+ const slideScenes = story.scenes.filter(isSlideScene);
433
+ const slideSceneIds = new Set(slideScenes.map(scene => scene.id));
434
+ const usedDeckMedia = deckMediaIds(story);
427
435
  for (const declaration of story.media) {
436
+ if (!usedDeckMedia.has(declaration.id))
437
+ continue;
428
438
  const candidates = deck.media.filter(media => media.id === declaration.id);
429
439
  requireCondition(candidates.length > 0, 'MEDIA_TARGET', `The native deck has no embedded video named ${declaration.id}`, 3);
430
440
  let hash;
@@ -436,19 +446,23 @@ export class PowerPointAdapter {
436
446
  }
437
447
  requireCondition(candidates.every(media => media.sha256 === hash), 'MEDIA_SOURCE_MISMATCH', `Storyboard media ${declaration.id} does not match the exact embedded video bytes in the deck`);
438
448
  }
439
- for (const scene of story.scenes)
449
+ for (const scene of slideScenes)
440
450
  this.slide(scene.slide);
441
- const actions = [...story.scenes.flatMap(scene => scene.actions), ...story.cues.map(cue => ({ ...cue.action, id: cue.id }))];
451
+ const actions = [...slideScenes.flatMap(scene => scene.actions), ...slideSceneCues(story).map(cue => ({ ...cue.action, id: cue.id }))];
442
452
  for (const action of actions) {
443
453
  if (action.type === 'slide') {
444
454
  const targetSlide = this.slide(action.target);
445
455
  const requiredSettle = slideEntrySettleMs(targetSlide);
446
456
  requireCondition(action.duration_ms + 0.1 >= requiredSettle, 'SLIDE_TRANSITION_DURATION', `Slide action ${action.id} must reserve at least ${requiredSettle} ms for ${targetSlide.id} transition and automatic entry animations`, 3);
447
457
  }
448
- if (action.type === 'play')
458
+ if (action.type === 'play') {
449
459
  requireCondition((action.rate ?? 1) === 1, 'POWERPOINT_CAPABILITY', `Video action ${action.id} requires playback rate 1 in native PowerPoint playback`, 3);
460
+ requireCondition((action.overflow ?? 'continuous') === 'continuous', 'POWERPOINT_CAPABILITY', `Video action ${action.id} uses overflow ${action.overflow}, which is not supported in native PowerPoint playback`, 3);
461
+ }
450
462
  }
451
463
  for (const annotation of story.annotations) {
464
+ if (!slideSceneIds.has(annotation.scene))
465
+ continue;
452
466
  const targets = annotation.target.type === 'path'
453
467
  ? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
454
468
  : annotation.target.type === 'connector'
@@ -459,64 +473,69 @@ export class PowerPointAdapter {
459
473
  }
460
474
  }
461
475
  if (schedule) {
462
- this.operations(story, schedule);
463
- for (const annotation of schedule.annotations) {
464
- const slide = this.slide(annotation.slide);
465
- const targets = annotation.target.type === 'path'
466
- ? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
467
- : annotation.target.type === 'connector'
468
- ? [annotation.target.from, annotation.target.to].flatMap(ep => 'target' in ep ? [ep.target] : [])
469
- : [annotation.target];
470
- for (const target of targets) {
471
- if (target.type === 'shape') {
472
- const candidates = slide.shapes.filter(shape => shape.id === target.id);
473
- requireCondition(candidates.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: shape ${target.id} is missing or ambiguous`, 3);
474
- const shape = candidates[0];
475
- requireCondition(shape.unsupported.length === 0 && annotation.click >= shape.visible_from_click, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}, shape ${shape.id} (${shape.name}): ${shape.unsupported.join('; ') || `hidden until click ${shape.visible_from_click}`}`, 3);
476
- }
477
- if (target.type === 'text') {
478
- const needle = target.text.trim().replace(/\s+/g, ' ');
479
- let shapes;
480
- if (target.container) {
481
- requireCondition(target.container.type === 'shape', 'ANNOTATION_TARGET', `Annotation ${annotation.id}: PowerPoint text container requires a shape ID`, 3);
482
- const containerId = target.container.id;
483
- const candidates = slide.shapes.filter(shape => shape.id === containerId);
484
- requireCondition(candidates.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: shape ${containerId} is missing or ambiguous`, 3);
476
+ const projection = hasStandaloneMediaSchedule(schedule) ? projectDeckSchedule(story, schedule) : undefined;
477
+ const deckStory = projection?.storyboard ?? story;
478
+ const deckSchedule = projection?.schedule ?? schedule;
479
+ if (!hasStandaloneMediaSchedule(schedule) || projection) {
480
+ this.operations(deckStory, deckSchedule);
481
+ for (const annotation of deckSchedule.annotations) {
482
+ const slide = this.slide(annotation.slide);
483
+ const targets = annotation.target.type === 'path'
484
+ ? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
485
+ : annotation.target.type === 'connector'
486
+ ? [annotation.target.from, annotation.target.to].flatMap(ep => 'target' in ep ? [ep.target] : [])
487
+ : [annotation.target];
488
+ for (const target of targets) {
489
+ if (target.type === 'shape') {
490
+ const candidates = slide.shapes.filter(shape => shape.id === target.id);
491
+ requireCondition(candidates.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: shape ${target.id} is missing or ambiguous`, 3);
485
492
  const shape = candidates[0];
486
- const issues = [...shape.unsupported, ...(shape.text_unsupported ?? [])];
487
- requireCondition(issues.length === 0 && annotation.click >= shape.visible_from_click && Boolean(shape.text), 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}, shape ${shape.id} (${shape.name}): ${issues.join('; ') || (annotation.click < shape.visible_from_click ? `hidden until click ${shape.visible_from_click}` : 'shape contains no text')}`, 3);
488
- shapes = [shape];
489
- }
490
- else {
491
- shapes = slide.shapes.filter(shape => shape.unsupported.length === 0 && (shape.text_unsupported ?? []).length === 0 && annotation.click >= shape.visible_from_click && Boolean(shape.text));
493
+ requireCondition(shape.unsupported.length === 0 && annotation.click >= shape.visible_from_click, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}, shape ${shape.id} (${shape.name}): ${shape.unsupported.join('; ') || `hidden until click ${shape.visible_from_click}`}`, 3);
492
494
  }
493
- const matches = [];
494
- for (const shape of shapes) {
495
- const text = shape.text ?? '';
496
- let pos = text.indexOf(needle);
497
- while (pos >= 0) {
498
- matches.push({ shape, pos });
499
- pos = text.indexOf(needle, pos + 1);
495
+ if (target.type === 'text') {
496
+ const needle = target.text.trim().replace(/\s+/g, ' ');
497
+ let shapes;
498
+ if (target.container) {
499
+ requireCondition(target.container.type === 'shape', 'ANNOTATION_TARGET', `Annotation ${annotation.id}: PowerPoint text container requires a shape ID`, 3);
500
+ const containerId = target.container.id;
501
+ const candidates = slide.shapes.filter(shape => shape.id === containerId);
502
+ requireCondition(candidates.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: shape ${containerId} is missing or ambiguous`, 3);
503
+ const shape = candidates[0];
504
+ const issues = [...shape.unsupported, ...(shape.text_unsupported ?? [])];
505
+ requireCondition(issues.length === 0 && annotation.click >= shape.visible_from_click && Boolean(shape.text), 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}, shape ${shape.id} (${shape.name}): ${issues.join('; ') || (annotation.click < shape.visible_from_click ? `hidden until click ${shape.visible_from_click}` : 'shape contains no text')}`, 3);
506
+ shapes = [shape];
500
507
  }
508
+ else {
509
+ shapes = slide.shapes.filter(shape => shape.unsupported.length === 0 && (shape.text_unsupported ?? []).length === 0 && annotation.click >= shape.visible_from_click && Boolean(shape.text));
510
+ }
511
+ const matches = [];
512
+ for (const shape of shapes) {
513
+ const text = shape.text ?? '';
514
+ let pos = text.indexOf(needle);
515
+ while (pos >= 0) {
516
+ matches.push({ shape, pos });
517
+ pos = text.indexOf(needle, pos + 1);
518
+ }
519
+ }
520
+ if (matches.length === 0) {
521
+ const unsupportedMatch = !target.container
522
+ ? slide.shapes.find(shape => shape.unsupported.length === 0 && (shape.text_unsupported ?? []).length > 0 && annotation.click >= shape.visible_from_click && (shape.text ?? '').includes(needle))
523
+ : undefined;
524
+ const detail = unsupportedMatch
525
+ ? `shape ${unsupportedMatch.id} (${unsupportedMatch.name}): ${(unsupportedMatch.text_unsupported ?? []).join('; ')}`
526
+ : `text ${JSON.stringify(needle)} not found in visible supported shapes`;
527
+ requireCondition(false, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: ${detail}`, 3);
528
+ }
529
+ requireCondition(target.occurrence !== undefined || matches.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: text ${JSON.stringify(needle)} matched ${matches.length} times; specify container or occurrence`, 3);
530
+ const selected = matches[(target.occurrence ?? 1) - 1];
531
+ requireCondition(selected !== undefined, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: text occurrence ${target.occurrence} does not exist`, 3);
501
532
  }
502
- if (matches.length === 0) {
503
- const unsupportedMatch = !target.container
504
- ? slide.shapes.find(shape => shape.unsupported.length === 0 && (shape.text_unsupported ?? []).length > 0 && annotation.click >= shape.visible_from_click && (shape.text ?? '').includes(needle))
505
- : undefined;
506
- const detail = unsupportedMatch
507
- ? `shape ${unsupportedMatch.id} (${unsupportedMatch.name}): ${(unsupportedMatch.text_unsupported ?? []).join('; ')}`
508
- : `text ${JSON.stringify(needle)} not found in visible supported shapes`;
509
- requireCondition(false, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: ${detail}`, 3);
510
- }
511
- requireCondition(target.occurrence !== undefined || matches.length === 1, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: text ${JSON.stringify(needle)} matched ${matches.length} times; specify container or occurrence`, 3);
512
- const selected = matches[(target.occurrence ?? 1) - 1];
513
- requireCondition(selected !== undefined, 'ANNOTATION_TARGET', `Annotation ${annotation.id}, slide ${annotation.slide}: text occurrence ${target.occurrence} does not exist`, 3);
514
533
  }
515
534
  }
516
535
  }
517
536
  }
518
537
  else if (!story.cues.some(cue => cue.action.type === 'slide' || cue.action.type === 'reveal')) {
519
- for (const scene of story.scenes) {
538
+ for (const scene of slideScenes) {
520
539
  let slide = this.slide(scene.slide);
521
540
  let click = 0;
522
541
  for (const action of scene.actions) {
@@ -1,4 +1,4 @@
1
- import type { PresentationInspection, Storyboard, Schedule, Viewport } from '../contracts.js';
1
+ import { type PresentationInspection, type Storyboard, type Schedule, type Viewport } from '../contracts.js';
2
2
  export declare function inspectSlidev(deck: string): Promise<PresentationInspection>;
3
3
  export declare function validateSlidev(story: Storyboard, inspection: PresentationInspection, options?: {
4
4
  viewport?: Viewport;
@@ -2,6 +2,8 @@ import { access } from 'node:fs/promises';
2
2
  import { fork } from 'node:child_process';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { dirname } from 'node:path';
5
+ import { normalizeSpeakerNotes } from '../contracts.js';
6
+ import { isSlideScene, slideSceneCues } from '../standalone-media.js';
5
7
  import { slidevInputs } from './slidev-inputs.js';
6
8
  import { requireCondition, ProductionError } from '../errors.js';
7
9
  async function loadDeck(deck) {
@@ -36,20 +38,28 @@ export async function inspectSlidev(deck) {
36
38
  }
37
39
  const parsed = await loadDeck(deck);
38
40
  requireCondition(parsed.errors.length === 0, 'DECK_SYNTAX', parsed.errors.join('\n'));
39
- const slides = parsed.slides.map((slide, index) => ({
40
- id: String(slide.frontmatter.name ?? `slide-${index + 1}`), index: index + 1,
41
- clicks: Number(slide.frontmatter.clicks ?? 0), clicks_known: slide.frontmatter.clicks != null,
42
- }));
41
+ const slides = parsed.slides.map((slide, index) => {
42
+ const notes = normalizeSpeakerNotes(slide.note);
43
+ return {
44
+ id: String(slide.frontmatter.name ?? `slide-${index + 1}`), index: index + 1,
45
+ clicks: Number(slide.frontmatter.clicks ?? 0), clicks_known: slide.frontmatter.clicks != null,
46
+ ...(notes ? { notes } : {}),
47
+ };
48
+ });
43
49
  requireCondition(new Set(slides.map(s => s.id)).size === slides.length, 'SLIDE_ID', 'Slide names must be unique');
44
50
  const media_ids = parsed.slides.flatMap(slide => [...slide.content.matchAll(/<(?:video|audio)\b[^>]*\bid=["']([^"']+)["']/g)].map(match => match[1]));
45
51
  return { slides, media_ids, files: await slidevInputs(deck, parsed.headmatter, parsed.files), capabilities: ['slide', 'reveal', 'play', 'highlight:region', 'highlight:element', 'highlight:text', 'underline:region', 'underline:element', 'underline:text', 'spotlight:region', 'spotlight:element', 'spotlight:text', 'zoom:region', 'zoom:element', 'zoom:text', 'laser:path', 'laser:region', 'laser:element', 'laser:text', 'stamp:point', 'stamp:region', 'stamp:element', 'stamp:text', 'arrow:connector', 'arrow:region', 'arrow:element', 'arrow:text'] };
46
52
  }
47
53
  export function validateSlidev(story, inspection, options) {
48
54
  const schedule = options?.schedule;
49
- for (const scene of story.scenes) {
55
+ const slideScenes = story.scenes.filter(isSlideScene);
56
+ const slideSceneIds = new Set(slideScenes.map(scene => scene.id));
57
+ for (const scene of slideScenes) {
50
58
  requireCondition(inspection.slides.some(s => s.id === scene.slide), 'SLIDE_REFERENCE', `Scene ${scene.id} has unknown slide ${scene.slide}`);
51
59
  }
52
60
  for (const annotation of story.annotations) {
61
+ if (!slideSceneIds.has(annotation.scene))
62
+ continue;
53
63
  const targets = annotation.target.type === 'path'
54
64
  ? annotation.target.points.flatMap(point => 'target' in point ? [point.target] : [])
55
65
  : annotation.target.type === 'connector'
@@ -59,7 +69,7 @@ export function validateSlidev(story, inspection, options) {
59
69
  requireCondition(target.type !== 'shape' && !(target.type === 'text' && target.container?.type === 'shape'), 'ANNOTATION_TARGET', `Annotation ${annotation.id} uses a PowerPoint shape target unsupported by Slidev`, 3, { annotation: annotation.id });
60
70
  }
61
71
  }
62
- const actions = [...story.scenes.flatMap(s => s.actions), ...story.cues.map(c => ({ ...c.action, id: c.id }))];
72
+ const actions = [...slideScenes.flatMap(s => s.actions), ...slideSceneCues(story).map(c => ({ ...c.action, id: c.id }))];
63
73
  for (const action of actions) {
64
74
  if (action.type === 'slide')
65
75
  requireCondition(inspection.slides.some(s => s.id === action.target), 'SLIDE_REFERENCE', `Unknown slide ${action.target}`);
@@ -67,7 +77,9 @@ export function validateSlidev(story, inspection, options) {
67
77
  requireCondition(inspection.media_ids.includes(action.media), 'MEDIA_TARGET', `Deck has no media element ${action.media}`, 3);
68
78
  }
69
79
  const slides = new Map(inspection.slides.map(slide => [slide.id, slide]));
70
- const sequence = schedule ? schedule.actions.map(item => item.action) : story.scenes.flatMap(scene => [{ id: `${scene.id}:slide`, type: 'slide', target: scene.slide, duration_ms: 0 }, ...scene.actions]);
80
+ const sequence = schedule
81
+ ? schedule.actions.filter(item => slideSceneIds.has(item.scene)).map(item => item.action)
82
+ : slideScenes.flatMap(scene => [{ id: `${scene.id}:slide`, type: 'slide', target: scene.slide, duration_ms: 0 }, ...scene.actions]);
71
83
  let active;
72
84
  let click = 0;
73
85
  const pendingNavigation = !schedule && story.cues.some(cue => cue.action.type === 'slide');
@@ -17,7 +17,7 @@ if (port === 'inspect') {
17
17
  if (!process.send || !process.disconnect)
18
18
  throw new Error('Inspection requires an IPC channel');
19
19
  process.send({
20
- slides: options.data.slides.map(slide => ({ frontmatter: slide.frontmatter, content: slide.content })),
20
+ slides: options.data.slides.map(slide => ({ frontmatter: slide.frontmatter, content: slide.content, note: slide.note })),
21
21
  headmatter: options.data.headmatter,
22
22
  files: Object.keys(options.data.markdownFiles),
23
23
  errors: Object.values(options.data.markdownFiles).flatMap(file => (file.errors ?? []).map(error => `${file.filepath}:${error.row + 1}: ${error.message}`)),
@@ -1,4 +1,4 @@
1
- import { type Schedule, type SpeechManifest, type VisualArtifact, type ProductionOptions } from './contracts.js';
1
+ import { type CaptureMapping, type Schedule, type SpeechManifest, type VisualArtifact, type ProductionOptions } from './contracts.js';
2
2
  type AssemblyOptions = ProductionOptions & {
3
3
  licensed?: boolean;
4
4
  inputHashes?: Record<string, string>;
@@ -12,7 +12,7 @@ export declare function assemble(schedule: Schedule, speech: SpeechManifest, vis
12
12
  final_hold: string;
13
13
  trim_start_ms: number;
14
14
  trim_end_ms: number;
15
- mapping: import("./contracts.js").CaptureMapping;
15
+ mapping: CaptureMapping;
16
16
  transformations: unknown[];
17
17
  editorial_review: string;
18
18
  compositor?: {