@bendyline/squisq-editor-react 2.4.0 → 2.4.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.
@@ -0,0 +1,508 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Doc, Theme, MediaProvider } from '@bendyline/squisq/schemas';
3
+ import { ContentContainer } from '@bendyline/squisq/storage';
4
+ import { i as TeleprompterRecordingDeps } from './useNarrationStage-Bqo18PBw.js';
5
+ import { CSSProperties, RefObject } from 'react';
6
+
7
+ /**
8
+ * Format probing for MediaRecorder.
9
+ *
10
+ * Different browsers expose different container/codec combinations. Chrome
11
+ * and Firefox produce WebM (VP8/VP9 + Opus); Safari produces MP4 (H.264 +
12
+ * AAC). We probe at runtime via `MediaRecorder.isTypeSupported()` and pick
13
+ * the best supported option, falling back to whatever the browser hands
14
+ * back when no probe succeeds.
15
+ */
16
+ /** What the recorded stream is intended to capture. */
17
+ type CaptureKind = 'audio' | 'video';
18
+ /** A probed format choice — what to pass to `MediaRecorder` and where to write it. */
19
+ interface ResolvedFormat {
20
+ /** MIME type to pass to `new MediaRecorder(stream, { mimeType })`. Empty string means "let the browser pick". */
21
+ mimeType: string;
22
+ /** File extension to use when writing to the container, including the leading dot. */
23
+ extension: string;
24
+ /** Container directory inside the `ContentContainer` (no trailing slash). */
25
+ directory: 'audio' | 'video';
26
+ }
27
+ /**
28
+ * Resolve the format the recorder will use for a given capture kind. If a
29
+ * `preferred` MIME type is supported, it wins; otherwise we fall through
30
+ * the priority list. When nothing matches (extremely old browser), we
31
+ * return an empty `mimeType` — `MediaRecorder` will pick a default and we
32
+ * tag the file with `.webm` as a best guess.
33
+ */
34
+ declare function resolveFormat(kind: CaptureKind, preferred?: string): ResolvedFormat;
35
+ /**
36
+ * `MediaRecorder` support probe. Returns false when running in a
37
+ * non-browser environment (e.g. SSR) or on a browser that doesn't
38
+ * implement the API at all.
39
+ */
40
+ declare function supportsMediaRecorder(): boolean;
41
+ /**
42
+ * `getUserMedia` support probe (for mic / camera capture).
43
+ */
44
+ declare function supportsUserMedia(): boolean;
45
+ /**
46
+ * `getDisplayMedia` support probe (for screen capture). Browsers may
47
+ * implement `mediaDevices` without `getDisplayMedia` (Firefox on Android
48
+ * being the long-standing example), so this is its own probe.
49
+ */
50
+ declare function supportsDisplayMedia(): boolean;
51
+ /**
52
+ * Build a default filename for a recording. `basename` is a hint
53
+ * (e.g. user-typed name); when omitted, a sortable timestamp is used so
54
+ * concurrent recordings don't collide. General recorder callers can supply a
55
+ * source-aware `seed`; dedicated narration callers omit it and retain the
56
+ * historical `narration-*` default.
57
+ */
58
+ type RecordingFilenameSeed = 'audio' | 'camera' | 'camera-audio' | 'screen' | 'screen-audio';
59
+ declare function buildFilename(kind: CaptureKind, extension: string, basename?: string, seed?: RecordingFilenameSeed): string;
60
+
61
+ /**
62
+ * useMediaRecorder
63
+ *
64
+ * React wrapper around `MediaRecorder` that handles stream acquisition,
65
+ * the recorder lifecycle, and produces a single `Blob` on stop. Selects
66
+ * a browser-supported MIME type via {@link resolveFormat}.
67
+ *
68
+ * Mirrors the shape of `useVideoExport` in `@bendyline/squisq-video-react`
69
+ * (request → start → stop → blob), inverted for capture rather than
70
+ * export.
71
+ *
72
+ * The `'screen+camera'` source is the one exception to "one stream, one
73
+ * blob": it drives TWO `MediaRecorder`s in lockstep (screen + system audio
74
+ * on the primary lane, camera + mic on a secondary lane), because a single
75
+ * recorder can only hold one video track. The secondary lane surfaces as
76
+ * {@link UseMediaRecorderResult.camera}; every other source leaves it null.
77
+ * The two lanes' start skew is measured (`cameraOffsetSec`) so the composed
78
+ * playback can line the presenter bubble up with the screen.
79
+ */
80
+
81
+ /**
82
+ * Which capture source to use. `screen+mic` mixes the microphone into the
83
+ * screen stream (one file); `screen+camera` records screen and camera as two
84
+ * separate files in lockstep.
85
+ */
86
+ type RecorderSource = 'mic' | 'camera' | 'screen' | 'screen+mic' | 'screen+camera';
87
+ /** Discriminated state describing what the recorder is currently doing. */
88
+ type RecorderState = 'idle' | 'requesting' | 'ready' | 'recording' | 'stopping' | 'stopped' | 'error';
89
+ /**
90
+ * The camera companion lane, present only for `source === 'screen+camera'`
91
+ * (null for every other source). Its `blob` is null until the take stops.
92
+ */
93
+ interface RecorderCameraLane {
94
+ /** Camera stream (video + mic when requested); inactive after stop, null after teardown. */
95
+ stream: MediaStream | null;
96
+ /** Final camera `Blob` after `stop()` resolves, or null while recording. */
97
+ blob: Blob | null;
98
+ /** MIME type of the camera lane (shares the video format with the screen lane). */
99
+ mimeType: string | null;
100
+ /** File extension matching `mimeType` (e.g. `.webm`). */
101
+ extension: string | null;
102
+ }
103
+ interface UseMediaRecorderOptions {
104
+ /** Which capture pipeline to use (default: `'mic'`). */
105
+ source?: RecorderSource;
106
+ /**
107
+ * Preferred MIME type override. When the browser supports it, this
108
+ * wins over the default candidate list. When unset (or unsupported),
109
+ * the hook probes a built-in priority list.
110
+ */
111
+ mimeType?: string;
112
+ /** Video track constraints for camera / screen sources. */
113
+ videoConstraints?: MediaTrackConstraints | boolean;
114
+ /** Audio track constraints for mic / camera / screen+mic sources. */
115
+ audioConstraints?: MediaTrackConstraints | boolean;
116
+ /**
117
+ * Bits-per-second hint passed to `MediaRecorder`. Most browsers cap to
118
+ * reasonable defaults internally; leaving this undefined is usually
119
+ * fine.
120
+ */
121
+ bitsPerSecond?: number;
122
+ /**
123
+ * Whether to capture system (tab/monitor) audio. Browser support is limited
124
+ * (desktop Chromium only); when unsupported the resulting stream simply omits
125
+ * it. How it is obtained depends on the source:
126
+ * - `'screen'` / `'screen+mic'` / `'screen+camera'` — folded into the screen
127
+ * lane's `getDisplayMedia` (rides the SCREEN file for the dual source).
128
+ * - `'mic'` / `'camera'` — captured via a SEPARATE `getDisplayMedia` whose
129
+ * video is discarded, then mixed into the mic/camera file. The browser still
130
+ * shows the screen/tab picker (audio-only display capture isn't allowed).
131
+ */
132
+ systemAudio?: boolean;
133
+ /**
134
+ * For `source === 'camera'`, whether to include the microphone track.
135
+ * Defaults to `true` (camera + mic). Set `false` to capture silent
136
+ * video. Ignored for `'mic'`/`'screen'`/`'screen+mic'`, whose mic
137
+ * handling is encoded in the source itself. For `'screen+camera'` this
138
+ * gates the microphone on the CAMERA lane (the screen lane never carries
139
+ * the mic — system audio rides it instead).
140
+ */
141
+ includeMicrophone?: boolean;
142
+ }
143
+ interface UseMediaRecorderResult {
144
+ /** Current recorder state. */
145
+ state: RecorderState;
146
+ /** `MediaStream` acquired by `request()`; live during preview/recording and
147
+ * inactive after stop. For `'screen+camera'` this is the SCREEN stream (see
148
+ * `camera` for the other). */
149
+ stream: MediaStream | null;
150
+ /** Final `Blob` after `stop()` resolves, or `null` while recording. For
151
+ * `'screen+camera'` this is the SCREEN file. */
152
+ blob: Blob | null;
153
+ /** MIME type the recorder actually used (after `request()`). */
154
+ mimeType: string | null;
155
+ /** File extension matching `mimeType` (e.g. `.webm`). */
156
+ extension: string | null;
157
+ /** Suggested container directory (`'audio'` for mic, `'video'` for camera/screen). */
158
+ directory: 'audio' | 'video' | null;
159
+ /** Milliseconds elapsed since `start()` was called. Updates ~10× per second while recording. */
160
+ durationMs: number;
161
+ /** Most recent error, if any. */
162
+ error: Error | null;
163
+ /**
164
+ * The camera companion lane for `source === 'screen+camera'`, else null.
165
+ * Its `blob` lands together with the primary `blob` when `stop()` resolves.
166
+ */
167
+ camera: RecorderCameraLane | null;
168
+ /**
169
+ * Camera onstart minus screen onstart, in seconds (positive = camera
170
+ * started later). Null until both lanes have reported `onstart`, and for
171
+ * every non-dual source.
172
+ */
173
+ cameraOffsetSec: number | null;
174
+ /**
175
+ * Acquire the stream and prepare a `MediaRecorder`. After this resolves
176
+ * the hook is in `'ready'` state and a `<video>`/`<audio>` element can
177
+ * preview `stream`. Call `start()` to begin recording.
178
+ */
179
+ request: () => Promise<void>;
180
+ /** Start recording. Must be called from `'ready'`. */
181
+ start: () => void;
182
+ /**
183
+ * Stop recording and resolve with the resulting `Blob`. Safe to call
184
+ * from `'recording'`; a no-op from any other state (resolves with the
185
+ * existing `blob`, or `null`). Once the take has flushed, all capture
186
+ * tracks are stopped so browser sharing / camera / microphone indicators
187
+ * do not remain active during review.
188
+ */
189
+ stop: () => Promise<Blob | null>;
190
+ /**
191
+ * Tear everything down — stops the recorder if running, releases all
192
+ * tracks, disposes the AudioContext mixer (if any), and returns to
193
+ * `'idle'`. Always safe to call.
194
+ */
195
+ cancel: () => void;
196
+ /** Clear the current take. A new permission request may be needed before re-recording. */
197
+ reset: () => void;
198
+ }
199
+ /**
200
+ * Returns the kind of capture that the given source produces. Exposed
201
+ * separately from {@link useMediaRecorder} so non-React callers
202
+ * (e.g. headless tests) can resolve a format up front.
203
+ */
204
+ declare function getCaptureKind(source: RecorderSource): CaptureKind;
205
+ declare function useMediaRecorder(options?: UseMediaRecorderOptions): UseMediaRecorderResult;
206
+
207
+ type RecorderColorScheme = 'light' | 'dark';
208
+ /**
209
+ * Everything narration mode needs beyond the base recorder props. Supplying
210
+ * this (with non-null `recording`) surfaces the "Show narration mode"
211
+ * checkbox; when checked, the dialog expands and mounts the teleprompter
212
+ * beside the capture preview, and mic recording switches to the narration
213
+ * pipeline (voice-aligned v3 timing sidecar + document preamble insertion).
214
+ */
215
+ interface RecorderNarrationOptions {
216
+ /** Parsed document the prompter script is built from. */
217
+ doc: Doc | null;
218
+ /** Theme for the prompter surface (colors/fonts). */
219
+ theme: Theme;
220
+ /** Editor plumbing for the narration save pipeline; null hides the checkbox. */
221
+ recording: TeleprompterRecordingDeps | null;
222
+ }
223
+ interface RecorderModalProps {
224
+ /** Required — recordings are written here. */
225
+ mediaProvider: MediaProvider;
226
+ /**
227
+ * Optional — when provided, narration-mode recordings drop a
228
+ * `.timing.json` sidecar at the matching container path so
229
+ * `resolveAudioMapping()` can auto-link them. Without it, only the
230
+ * raw recording is saved.
231
+ */
232
+ container?: ContentContainer | null;
233
+ /** Initial capture source. Defaults to `'mic'` (narration). */
234
+ initialMode?: RecorderSource;
235
+ /** Light/dark chrome scheme. Defaults to `'light'`. */
236
+ colorScheme?: RecorderColorScheme;
237
+ /** Called after the modal is dismissed (save or cancel). */
238
+ onClose: () => void;
239
+ /**
240
+ * Fired after a successful save. Hosts typically use this to insert a
241
+ * markdown reference at the cursor — see {@link RecorderSaveResult}
242
+ * for the fields a host needs to build that reference.
243
+ *
244
+ * NOT fired for narration-mode saves: the narration pipeline writes its
245
+ * own `{[audio …]}` document preamble (via `executeNarrationSave`), so a
246
+ * host insertion here would double up.
247
+ */
248
+ onSave?: (result: RecorderSaveResult) => void;
249
+ /** Enables the "Show narration mode" checkbox. Omit for the classic dialog. */
250
+ narration?: RecorderNarrationOptions | null;
251
+ }
252
+ /**
253
+ * The camera companion of a `'screen+camera'` save. Present only on that
254
+ * source's {@link RecorderSaveResult}; describes the picture-in-picture file
255
+ * that pairs with the screen recording in {@link RecorderSaveResult}.
256
+ */
257
+ interface RecorderCameraSaveResult {
258
+ /** Path returned by `mediaProvider.addMedia()` for the camera file. */
259
+ relativePath: string;
260
+ /** Filename the modal chose for the camera file. */
261
+ filename: string;
262
+ /** MIME type of the saved camera blob. */
263
+ mimeType: string;
264
+ /** Camera recording length in seconds. */
265
+ duration: number;
266
+ /**
267
+ * Camera start minus screen start, in seconds (may be negative). Drives the
268
+ * PiP clip's `startAt`/`clipStart` so the bubble lines up with the screen.
269
+ */
270
+ offsetSec: number;
271
+ }
272
+ /** Payload handed to {@link RecorderModalProps.onSave} on a successful save. */
273
+ interface RecorderSaveResult {
274
+ /** Path returned by `mediaProvider.addMedia()` — what the doc should reference.
275
+ * For `'screen+camera'` this is the SCREEN file (see {@link RecorderSaveResult.camera}). */
276
+ relativePath: string;
277
+ /** Filename the modal chose (e.g. `narration-20260516-091200.webm`). */
278
+ filename: string;
279
+ /** Capture source the user picked. */
280
+ source: RecorderSource;
281
+ /** MIME type of the saved blob. */
282
+ mimeType: string;
283
+ /** Recording length in seconds. */
284
+ duration: number;
285
+ /** Whether a narration sidecar was written. Always `false` for video sources. */
286
+ hasTimingSidecar: boolean;
287
+ /** Script text the user typed (narration only). */
288
+ sourceText?: string;
289
+ /** The paired camera file — present only for `source === 'screen+camera'`. */
290
+ camera?: RecorderCameraSaveResult;
291
+ }
292
+ declare function RecorderModal({ mediaProvider, container, initialMode, colorScheme, onClose, onSave, narration, }: RecorderModalProps): react_jsx_runtime.JSX.Element;
293
+
294
+ interface RecorderButtonProps {
295
+ /** Where to write the resulting recording. Required. */
296
+ mediaProvider: MediaProvider;
297
+ /** Optional container for narration `.timing.json` sidecar writes. */
298
+ container?: ContentContainer | null;
299
+ /** Initial capture source. Defaults to `'mic'`. */
300
+ initialMode?: RecorderSource;
301
+ /** Light/dark chrome scheme copied onto the portaled modal. */
302
+ colorScheme?: RecorderColorScheme;
303
+ /** Fired after a successful save. */
304
+ onSave?: (result: RecorderSaveResult) => void;
305
+ /** Enables the modal's "Show narration mode" checkbox. */
306
+ narration?: RecorderNarrationOptions | null;
307
+ /** Button label. Defaults to `'Record'`. */
308
+ label?: string;
309
+ /** Optional inline button styles. */
310
+ style?: CSSProperties;
311
+ /** Whether the button is disabled. */
312
+ disabled?: boolean;
313
+ }
314
+ declare function RecorderButton({ mediaProvider, container, initialMode, colorScheme, onSave, narration, label, style, disabled, }: RecorderButtonProps): react_jsx_runtime.JSX.Element;
315
+
316
+ interface RecorderPanelProps {
317
+ mediaProvider: MediaProvider;
318
+ container?: ContentContainer | null;
319
+ initialMode?: RecorderSource;
320
+ /** Light/dark chrome scheme copied onto the portaled modal. */
321
+ colorScheme?: RecorderColorScheme;
322
+ onSave?: (result: RecorderSaveResult) => void;
323
+ /** Enables the modal's "Show narration mode" checkbox. */
324
+ narration?: RecorderNarrationOptions | null;
325
+ /** ARIA / tooltip label. Defaults to `'Record media'`. */
326
+ tooltip?: string;
327
+ /** Optional className for the trigger button. */
328
+ className?: string;
329
+ /** Controlled modal state. Omit to let the panel manage its own state. */
330
+ open?: boolean;
331
+ /** Called whenever the trigger or modal requests an open-state change. */
332
+ onOpenChange?: (open: boolean) => void;
333
+ /** Render the built-in trigger button. Defaults to true. */
334
+ showTrigger?: boolean;
335
+ }
336
+ declare function RecorderPanel({ mediaProvider, container, initialMode, colorScheme, onSave, narration, tooltip, className, open: controlledOpen, onOpenChange, showTrigger, }: RecorderPanelProps): react_jsx_runtime.JSX.Element;
337
+
338
+ /**
339
+ * useStreamPreview — binds a `MediaStream` to a `<video>` element's
340
+ * `srcObject`. Decouples the preview surface from `useMediaRecorder`,
341
+ * letting hosts compose the preview element however they like.
342
+ */
343
+
344
+ /**
345
+ * Assign `stream` to `<video>.srcObject` whenever either changes; clears
346
+ * it on unmount or when `stream` is `null`. The element is set to
347
+ * `playsInline` + `muted` automatically because previewing your own
348
+ * microphone with audio playthrough creates a feedback loop.
349
+ *
350
+ * @example
351
+ * ```tsx
352
+ * const videoRef = useRef<HTMLVideoElement>(null);
353
+ * const { stream } = useMediaRecorder({ source: 'camera' });
354
+ * useStreamPreview(videoRef, stream);
355
+ * return <video ref={videoRef} autoPlay />;
356
+ * ```
357
+ */
358
+ declare function useStreamPreview(ref: RefObject<HTMLVideoElement | null>, stream: MediaStream | null): void;
359
+
360
+ /**
361
+ * Microphone-only capture via `getUserMedia({ audio: true })`.
362
+ */
363
+ /**
364
+ * Request a microphone-only `MediaStream`. Caller owns the stream and
365
+ * must stop its tracks when done.
366
+ *
367
+ * @param constraints - Optional audio constraints (sample rate, device
368
+ * id, echo cancellation, etc.). Defaults to `true` — let the browser
369
+ * pick.
370
+ * @throws When `mediaDevices` is unavailable, or when the user denies
371
+ * permission (the underlying `getUserMedia` rejection propagates).
372
+ */
373
+ declare function requestMicStream(constraints?: MediaTrackConstraints): Promise<MediaStream>;
374
+
375
+ /**
376
+ * Camera + microphone capture via `getUserMedia({ video, audio })`.
377
+ */
378
+ interface CameraStreamOptions {
379
+ /** Video track constraints (resolution, facing mode, frame rate). Pass `true` for browser default, or `false` to omit video. */
380
+ video?: boolean | MediaTrackConstraints;
381
+ /** Audio track constraints. Pass `true` for browser default, or `false` to omit audio. */
382
+ audio?: boolean | MediaTrackConstraints;
383
+ }
384
+ /**
385
+ * Request a camera + mic `MediaStream`. Caller owns the stream and must
386
+ * stop its tracks when done.
387
+ *
388
+ * Both tracks are requested by default. To capture video only, pass
389
+ * `audio: false`; to capture audio only use {@link requestMicStream}
390
+ * instead.
391
+ *
392
+ * @throws When `mediaDevices` is unavailable, or when the user denies
393
+ * permission.
394
+ */
395
+ declare function requestCameraStream(options?: CameraStreamOptions): Promise<MediaStream>;
396
+
397
+ /**
398
+ * Screen capture via `getDisplayMedia`, with optional microphone mixing.
399
+ *
400
+ * The browser-native `getDisplayMedia({ audio: true })` flag only
401
+ * captures *system* audio (and only on Chromium on desktop). For
402
+ * narrated screencasts, hosts usually want the speaker's voice too —
403
+ * we provide an opt-in "include mic" path that pulls a parallel
404
+ * `getUserMedia` audio track and mixes it into the screen stream via
405
+ * `AudioContext`, so the resulting `MediaStream` carries a single audio
406
+ * track and a single video track.
407
+ */
408
+ interface ScreenStreamOptions {
409
+ /** Video constraints for the screen surface. Pass `true` for browser default. */
410
+ video?: boolean | MediaTrackConstraints;
411
+ /**
412
+ * Whether to attempt to capture the system audio (tab / window / monitor
413
+ * audio). Browser support is limited (desktop Chromium only); when the
414
+ * platform doesn't honor this flag, the resulting stream simply omits
415
+ * the system audio track.
416
+ */
417
+ systemAudio?: boolean;
418
+ /**
419
+ * Whether to also pull the microphone via `getUserMedia` and mix it
420
+ * into the resulting stream's audio track. When both `systemAudio` and
421
+ * `includeMicrophone` produce tracks, they're combined via
422
+ * `AudioContext` into a single output track.
423
+ */
424
+ includeMicrophone?: boolean;
425
+ /** Microphone track constraints, when `includeMicrophone` is true. */
426
+ microphoneConstraints?: MediaTrackConstraints;
427
+ }
428
+ /**
429
+ * Handle returned by {@link requestScreenStream}. The `stream` is what
430
+ * gets handed to `MediaRecorder`; the `dispose()` callback shuts down
431
+ * any auxiliary resources (the mic-mix `AudioContext` plus the raw
432
+ * source tracks feeding it). Callers must also stop the stream's tracks
433
+ * via `stream.getTracks().forEach(t => t.stop())` when done —
434
+ * `dispose()` cleans up everything that isn't the stream itself.
435
+ *
436
+ * IMPORTANT for callers: when the microphone is mixed in, the raw
437
+ * system-audio / mic tracks are deliberately NOT members of `stream`
438
+ * (only the single mixed output track is). So stopping `stream`'s tracks
439
+ * alone leaves those captures live — `dispose()` is what releases them,
440
+ * and it must always be called alongside the stream teardown or the
441
+ * screen-share indicator stays lit.
442
+ */
443
+ interface ScreenStreamHandle {
444
+ stream: MediaStream;
445
+ /** Auxiliary cleanup beyond the stream tracks. Safe to call multiple times. */
446
+ dispose: () => void;
447
+ }
448
+ /**
449
+ * Request a screen-capture `MediaStream`, optionally with a mixed-in
450
+ * microphone track. Caller owns the resulting stream.
451
+ *
452
+ * @throws When `getDisplayMedia` isn't available, or when the user
453
+ * cancels the picker / denies permission.
454
+ */
455
+ declare function requestScreenStream(options?: ScreenStreamOptions): Promise<ScreenStreamHandle>;
456
+
457
+ /**
458
+ * Build the `.timing.json` sidecar that pairs with a narration recording.
459
+ *
460
+ * The shape matches what `resolveAudioMapping()` in
461
+ * `@bendyline/squisq` reads at runtime: `sourceText`, `duration`, and
462
+ * `bookmarks[]`. Sidecars are stored at `<audio-path>.timing.json`
463
+ * inside the same `ContentContainer`, so the recorder can drop them
464
+ * alongside its audio file and have the existing audio-mapping pipeline
465
+ * pick them up with no schema changes.
466
+ */
467
+ /**
468
+ * Word-level timing bookmark — same shape as `AudioBookmark` in
469
+ * `@bendyline/squisq`. Recorder output produces an empty `bookmarks`
470
+ * array; word-level timing is the domain of TTS pipelines, not
471
+ * browser-side dictation.
472
+ */
473
+ interface RecordedBookmark {
474
+ id: string;
475
+ time: number;
476
+ charOffset: number;
477
+ textFragment?: string;
478
+ }
479
+ interface TimingJson {
480
+ /** Plain text the user said (or intended to say) during the recording. */
481
+ sourceText: string;
482
+ /** Recording length in seconds. */
483
+ duration: number;
484
+ /** Word-level timing data. Empty by default — populated only when a downstream tool aligns the audio. */
485
+ bookmarks: RecordedBookmark[];
486
+ }
487
+ /**
488
+ * Build a `TimingJson` payload from a user-typed script and the
489
+ * recording's measured duration. Both fields are required by the
490
+ * downstream `parseTimingJson()` validator; missing them produces a
491
+ * sidecar that gets silently dropped by the audio-mapping pipeline.
492
+ */
493
+ declare function buildTimingJson(sourceText: string, durationSec: number): TimingJson;
494
+ /**
495
+ * Serialize a `TimingJson` payload to a `Uint8Array` ready to hand to
496
+ * `ContentContainer.writeFile()`. Pretty-printed so authors can hand-
497
+ * edit the sidecar if they ever want to.
498
+ */
499
+ declare function encodeTimingJson(timing: TimingJson): Uint8Array;
500
+ /**
501
+ * The container path convention `resolveAudioMapping()` expects:
502
+ * `<audio-path>.timing.json`. Pass the audio file's relative path
503
+ * (e.g. `'audio/narration-001.webm'`) and the matching sidecar path is
504
+ * returned (`'audio/narration-001.webm.timing.json'`).
505
+ */
506
+ declare function timingPathFor(audioRelativePath: string): string;
507
+
508
+ export { supportsMediaRecorder as A, supportsUserMedia as B, type CameraStreamOptions as C, timingPathFor as D, useMediaRecorder as E, useStreamPreview as F, type RecordedBookmark as R, type ScreenStreamHandle as S, type TimingJson as T, type UseMediaRecorderOptions as U, type CaptureKind as a, RecorderButton as b, type RecorderButtonProps as c, type RecorderCameraLane as d, type RecorderCameraSaveResult as e, type RecorderColorScheme as f, RecorderModal as g, type RecorderModalProps as h, type RecorderNarrationOptions as i, RecorderPanel as j, type RecorderPanelProps as k, type RecorderSaveResult as l, type RecorderSource as m, type RecorderState as n, type ResolvedFormat as o, type ScreenStreamOptions as p, type UseMediaRecorderResult as q, buildFilename as r, buildTimingJson as s, encodeTimingJson as t, getCaptureKind as u, requestCameraStream as v, requestMicStream as w, requestScreenStream as x, resolveFormat as y, supportsDisplayMedia as z };
@@ -1,4 +1,4 @@
1
- export { B as BlockTagVisibility, D as DocumentLinkCandidate, b as DocumentLinkProvider, c as EditorActions, d as EditorColorScheme, e as EditorContextValue, E as EditorHostMode, f as EditorMode, g as EditorProvider, h as EditorProviderProps, i as EditorShell, j as EditorShellProps, k as EditorState, l as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, m as MentionProvider, P as PreviewPanel, n as PreviewPanelProps, R as RawEditor, o as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, p as WysiwygEditor, q as WysiwygEditorProps, u as useEditorContext } from '../shell-9Kxzxjbn.js';
1
+ export { B as BlockTagVisibility, D as DocumentLinkCandidate, b as DocumentLinkProvider, c as EditorActions, d as EditorColorScheme, e as EditorContextValue, E as EditorHostMode, f as EditorMode, g as EditorProvider, h as EditorProviderProps, i as EditorShell, j as EditorShellProps, k as EditorState, l as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, m as MentionProvider, P as PreviewPanel, n as PreviewPanelProps, R as RawEditor, o as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, p as WysiwygEditor, q as WysiwygEditorProps, u as useEditorContext } from '../shell-CU4GpGuq.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@bendyline/squisq/schemas';
@@ -5,14 +5,14 @@ import {
5
5
  RawEditor,
6
6
  WysiwygEditor,
7
7
  useEditorContext
8
- } from "../chunk-UPEGQYF4.js";
8
+ } from "../chunk-XOMQK4JA.js";
9
9
  import "../chunk-V4NBQF5C.js";
10
- import "../chunk-MM3M2KUV.js";
10
+ import "../chunk-WLJ623UZ.js";
11
11
  import "../chunk-V44VP242.js";
12
- import "../chunk-F4NBECWR.js";
12
+ import "../chunk-PKGBWNUQ.js";
13
13
  import "../chunk-GS7QWYFT.js";
14
- import "../chunk-5JMHFAVW.js";
15
- import "../chunk-5Q4JN4I5.js";
14
+ import "../chunk-V6Z7GG55.js";
15
+ import "../chunk-PDCKJCOS.js";
16
16
  export {
17
17
  EditorProvider,
18
18
  EditorShell,
@@ -366,6 +366,13 @@ interface EditorContextValue extends EditorState, EditorActions {
366
366
  * host DOES resolve is unsupported. Executable schemes stay refused.
367
367
  */
368
368
  linkSchemes: readonly string[] | undefined;
369
+ /**
370
+ * File name the host opened this document as (e.g. `Longview Plan.md`), if
371
+ * any. Used as a display-title fallback — for example, the header of a
372
+ * heading-less leading "preamble" block in the slideshow preview when the
373
+ * document has no frontmatter `title:`.
374
+ */
375
+ fileName: string | undefined;
369
376
  }
370
377
  type ImageDisplayMode = 'inline' | 'thumbnail';
371
378
  /**
@@ -632,6 +639,18 @@ interface WriteCanvasSettings {
632
639
  textSize?: number;
633
640
  /** Unitless line-height multiplier for body text. */
634
641
  lineSpacing?: number;
642
+ /**
643
+ * CSS `font-family` value for Write-canvas headings. Applies only when no
644
+ * theme font override is active (the theme's title font always wins) — see
645
+ * the heading rule in `styles/editor.css`. Omit to inherit as before.
646
+ */
647
+ headerFont?: string;
648
+ /**
649
+ * CSS `font-family` value for Write-canvas body text. Applies only when no
650
+ * theme font override is active (the theme's body font always wins) — see
651
+ * the editor rule in `styles/editor.css`. Omit to inherit as before.
652
+ */
653
+ bodyFont?: string;
635
654
  }
636
655
 
637
656
  /**
@@ -749,6 +768,11 @@ interface EditorShellProps {
749
768
  onSaveVersion?: (result: SaveVersionResult) => void;
750
769
  /** Show the Files toggle in the toolbar. Defaults to true when mediaProvider is passed. */
751
770
  showFilesToggle?: boolean;
771
+ /**
772
+ * Whether the Files panel offers browser downloads for its binary entries.
773
+ * Defaults to true. Pass false to remove the built-in download affordance.
774
+ */
775
+ allowBinaryDownloads?: boolean;
752
776
  /** Content rendered at the left edge of the toolbar, before the view tabs. */
753
777
  toolbarSlotLeft?: ReactNode;
754
778
  /** Content rendered after the formatting controls (in the middle area of the toolbar). */
@@ -1041,7 +1065,7 @@ interface EditorShellProps {
1041
1065
  * Complete markdown editor shell with toolbar, view switcher, and three
1042
1066
  * editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
1043
1067
  */
1044
- declare function EditorShell({ initialMarkdown, initialView, hostMode, defaultViewportPreset, articleId, basePath, onChange, onLinkClick, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, allowPresentationWindow, allowPresentationFullscreen, allowPrint, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, language, findMode, onFindModeChange, mentionProvider, documentLinkProvider, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
1068
+ declare function EditorShell({ initialMarkdown, initialView, hostMode, defaultViewportPreset, articleId, basePath, onChange, onLinkClick, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, allowBinaryDownloads, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, allowPresentationWindow, allowPresentationFullscreen, allowPrint, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, language, findMode, onFindModeChange, mentionProvider, documentLinkProvider, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
1045
1069
 
1046
1070
  /**
1047
1071
  * RawEditor