@bendyline/squisq-react 2.12.26 → 2.12.28

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,233 @@
1
+ import * as react from 'react';
2
+ import { RefObject } from 'react';
3
+ import { AudioTrack, ScheduledClip, Theme, MotionSpec, Doc, Block, MediaProvider, MediaClip, SurfaceScheme } from '@bendyline/squisq/schemas';
4
+ import { a as AudioController } from './AudioController-DAwQyEM_.js';
5
+ import { ViewportConfig, ViewportOrientation } from '@bendyline/squisq/doc';
6
+ import { ResourcePolicy } from '@bendyline/squisq/markdown';
7
+
8
+ /**
9
+ * useAudioSync Hook
10
+ *
11
+ * Synchronizes playback state with an audio element. Provides current
12
+ * playback time, playing state, and methods to control audio playback.
13
+ *
14
+ * Handles multiple audio segments (MP3 files) by tracking which segment
15
+ * is currently playing and calculating the overall timeline position.
16
+ *
17
+ * This is the HTML5 Audio implementation of the AudioController interface.
18
+ * Hosts that drive audio through an external player (e.g. a native shell)
19
+ * can supply their own AudioController to DocPlayer instead of this hook.
20
+ *
21
+ * In `synthetic` mode there is no audio element to follow, so a caller that
22
+ * has no segments passes `syntheticDuration` — the document's own timeline
23
+ * length — and the same segment machinery drives a timer instead.
24
+ *
25
+ * Each segment is downloaded whole and attached as a blob URL, so a segment is
26
+ * only playable once its download finishes. A `play()` that arrives earlier (a
27
+ * listener pressing Play right away, or right after seeking into another
28
+ * segment) is recorded as intent and started by the load path on `canplay`.
29
+ * Playing the element immediately would either start an element with no
30
+ * source, whose pending play the attaching `load()` aborts, or start the
31
+ * previous segment. An `AbortError` from `play()` therefore means "superseded",
32
+ * never "unavailable". Seeks are handled the same way: a seek into a segment
33
+ * that is still loading moves the pending position (a scrub drag keeps
34
+ * seeking after it crosses a chapter boundary), because the element still
35
+ * holds the previous segment. The next segment is downloaded shortly before the
36
+ * current one ends, so chapter boundaries do not stall on a fresh download.
37
+ *
38
+ * A segment whose download fails is retried a few times before the narration
39
+ * is reported unavailable, and the waits only count while the page is visible
40
+ * and online. A phone app in the background can lose its network; the segment
41
+ * that failed there now loads, and plays on, when the listener comes back.
42
+ */
43
+
44
+ type AudioSyncMode = 'media' | 'synthetic';
45
+ declare function useAudioSync(audioRef: RefObject<HTMLAudioElement>, track: AudioTrack | undefined, basePath?: string, enabled?: boolean, mode?: AudioSyncMode, syntheticDuration?: number): AudioController;
46
+
47
+ interface ModalDialogOptions {
48
+ /** The backdrop/portal root. Siblings of this branch are made inert. */
49
+ rootRef: RefObject<HTMLElement | null>;
50
+ /** The element with `role="dialog"`; focus is trapped within it. */
51
+ dialogRef: RefObject<HTMLElement | null>;
52
+ initialFocusRef?: RefObject<HTMLElement | null>;
53
+ /** Explicit opener/owner to restore after unmount (important when a child uses autofocus). */
54
+ returnFocusRef?: RefObject<HTMLElement | null>;
55
+ /** Whether Escape requests that the dialog close. Defaults to true. */
56
+ closeOnEscape?: boolean;
57
+ onClose: () => void;
58
+ }
59
+ /** Shared focus, keyboard, background-isolation, and restoration behavior for modal dialogs. */
60
+ declare function useModalDialog({ rootRef, dialogRef, initialFocusRef, returnFocusRef, closeOnEscape, onClose, }: ModalDialogOptions): void;
61
+
62
+ /**
63
+ * useMediaSchedule
64
+ *
65
+ * Pure follower of the playback clock for the media-clip model. Given the
66
+ * resolved {@link ScheduledClip}s and the current time, it returns the clips
67
+ * the player should mount and which of them are active right now.
68
+ * {@link MediaClipLayer} consumes this to drive one hidden `<audio>` /
69
+ * full-bleed `<video>` element per clip. (Annotation-authored clips all render
70
+ * at the player level; template-produced `VideoLayer`s are a separate path and
71
+ * are not part of the schedule.)
72
+ *
73
+ * It owns no clock: `currentTime`/`isPlaying` come from the existing
74
+ * `useAudioSync` provider via `DocPlayer`. With an empty schedule it returns
75
+ * empty lists, so documents without the new media model are unaffected.
76
+ */
77
+
78
+ interface MediaScheduleController {
79
+ /** Clips the player mounts (every scheduled clip). */
80
+ renderClips: ScheduledClip[];
81
+ /** Ids of clips whose [absoluteStart, absoluteEnd) contains currentTime. */
82
+ activeIds: Set<string>;
83
+ }
84
+ declare function useMediaSchedule(schedule: ScheduledClip[], currentTime: number): MediaScheduleController;
85
+
86
+ interface PlaybackState {
87
+ /** Currently visible block */
88
+ currentBlock: Block | null;
89
+ /** Index of current block */
90
+ currentBlockIndex: number;
91
+ /** Previous block (for transitions) */
92
+ previousBlock: Block | null;
93
+ /** Whether current block is entering */
94
+ isEntering: boolean;
95
+ /** Whether previous block is exiting */
96
+ isExiting: boolean;
97
+ /** Time relative to current block start */
98
+ blockTime: number;
99
+ /** Progress through current block (0-1) */
100
+ blockProgress: number;
101
+ /** Overall progress through doc (0-1) */
102
+ docProgress: number;
103
+ /** Expanded blocks (templates converted to full blocks with layers) */
104
+ blocks: Block[];
105
+ }
106
+ interface PlaybackActions {
107
+ /** Go to next block */
108
+ nextBlock: () => void;
109
+ /** Go to previous block */
110
+ prevBlock: () => void;
111
+ /** Go to specific block by index */
112
+ goToBlock: (index: number) => void;
113
+ /**
114
+ * Let the identified block enter without remounting the outgoing block.
115
+ * Used when another interaction (such as a swipe) already removed it.
116
+ */
117
+ suppressOutgoingForNextBlock: (blockId: string) => void;
118
+ }
119
+ interface UseDocPlaybackOptions {
120
+ /** Fallback media root for intrinsic feature metadata. */
121
+ basePath?: string;
122
+ /** Target viewport used to materialize template blocks. */
123
+ viewport?: ViewportConfig;
124
+ /** Active theme used for materialization and transition defaults. */
125
+ theme?: Theme;
126
+ /** Host seek callback used by block navigation actions. */
127
+ onSeek?: (time: number) => void;
128
+ /**
129
+ * Whether real audio-segment timing should reshape the authored block
130
+ * sequence. Synthetic preview tracks are only a playback clock; treating
131
+ * them as narration can merge short authored slides to satisfy narration
132
+ * pacing rules.
133
+ */
134
+ useAudioSegmentTiming?: boolean;
135
+ /**
136
+ * Derive the outgoing (exiting) block from block order instead of from the
137
+ * block rendered last. Offline capture seeks frames out of order (resume,
138
+ * dedupe, sampling), so the crossfade partner must be a pure function of
139
+ * time. Live playback keeps the render-history path so swipes and manual
140
+ * jumps crossfade from what the viewer actually saw.
141
+ */
142
+ deterministicTransitions?: boolean;
143
+ /**
144
+ * Motion profile override. Omitted → the doc's own `motion` / frontmatter
145
+ * `squisq-motion`, then the theme's `renderStyle.motionProfile`, then `calm`.
146
+ */
147
+ motion?: MotionSpec | null;
148
+ }
149
+ declare function useDocPlayback(script: Doc | null, currentTime: number, options?: UseDocPlaybackOptions): PlaybackState & PlaybackActions;
150
+
151
+ /**
152
+ * useViewportOrientation Hook
153
+ *
154
+ * Detects the current viewport orientation and returns the appropriate
155
+ * VIEWPORT_PRESET for rendering docs. Automatically updates when
156
+ * the window is resized.
157
+ *
158
+ * Thresholds:
159
+ * - Portrait: height > width * 1.2 (significantly taller than wide)
160
+ * - Square: width and height within 20% of each other
161
+ * - Landscape: width > height * 1.2 (significantly wider than tall)
162
+ */
163
+
164
+ interface UseViewportOrientationResult {
165
+ /** Current viewport preset configuration */
166
+ viewport: ViewportConfig;
167
+ /** Current orientation name */
168
+ orientation: ViewportOrientation;
169
+ /** Current window dimensions */
170
+ windowSize: {
171
+ width: number;
172
+ height: number;
173
+ };
174
+ }
175
+ /**
176
+ * Hook to detect viewport orientation and return appropriate preset.
177
+ * Updates automatically when window is resized.
178
+ */
179
+ declare function useViewportOrientation(): UseViewportOrientationResult;
180
+
181
+ /**
182
+ * React context holding the current MediaProvider (or null if none provided).
183
+ */
184
+ declare const MediaContext: react.Context<MediaProvider | null>;
185
+ /**
186
+ * The host's processed-audio lookup (`DocPlayer`'s `processedAudio`), for
187
+ * renderers below the schedule — a video laid out in a slide — that have to
188
+ * find a clip's cleaned-up sound themselves. Undefined when none is wired.
189
+ */
190
+ declare const ProcessedAudioContext: react.Context<((clip: MediaClip) => string | undefined) | undefined>;
191
+ /**
192
+ * Policy for document-controlled media URLs. Hosts rendering untrusted
193
+ * documents can provide `LOCAL_ONLY_RESOURCE_POLICY` or an explicit host
194
+ * allow-list without changing their MediaProvider.
195
+ */
196
+ declare const ResourcePolicyContext: react.Context<ResourcePolicy>;
197
+ declare function useResourcePolicy(): ResourcePolicy;
198
+ /**
199
+ * Hook to access the current MediaProvider from context.
200
+ * Returns null if no provider is set.
201
+ */
202
+ declare function useMediaProvider(): MediaProvider | null;
203
+ interface UseMediaUrlOptions {
204
+ /** For an SVG image: draw a still (no SMIL/CSS animation), for capture. */
205
+ staticSvg?: boolean;
206
+ }
207
+ /**
208
+ * Hook to resolve a media URL via the MediaProvider (if available).
209
+ * Only provider-less paths use basePath-based resolution; a failed workspace
210
+ * lookup stays unresolved instead of requesting the same path from the page origin.
211
+ *
212
+ * Returns the resolved URL string. Updates when the provider or path changes.
213
+ *
214
+ * An SVG image (`logo.svg`, or an SVG `data:` URL) resolves to core's
215
+ * sanitized re-serialization of it — never the file as written — exactly as
216
+ * an SVG island is shown; see `sanitizedSvgImageUrl`.
217
+ *
218
+ * @param relativePath - Relative media path from the document (e.g., 'hero.jpg')
219
+ * @param basePath - Fallback base path for URL construction
220
+ */
221
+ declare function useMediaUrl(relativePath: string, basePath: string, options?: UseMediaUrlOptions): string;
222
+
223
+ /**
224
+ * Live-track `prefers-color-scheme` and return a stable SurfaceScheme.
225
+ * `enabled: false` short-circuits to LIGHT_SURFACE (callers pass `false`
226
+ * when a static surface was provided so the hook never observes the
227
+ * media query). The `MediaQueryList` and the `subscribe`/`getSnapshot`
228
+ * callbacks are memoized so `useSyncExternalStore` doesn't resubscribe on
229
+ * every parent render.
230
+ */
231
+ declare function useAutoSurface(enabled: boolean): SurfaceScheme;
232
+
233
+ export { MediaContext as M, ProcessedAudioContext as P, ResourcePolicyContext as R, type UseDocPlaybackOptions as U, type MediaScheduleController as a, type ModalDialogOptions as b, useAutoSurface as c, useDocPlayback as d, useMediaProvider as e, useMediaSchedule as f, useMediaUrl as g, useModalDialog as h, useResourcePolicy as i, useViewportOrientation as j, useAudioSync as u };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as SquisqRenderAPI, V as VideoPresentation$1, P as PipSize, a as PipShape, b as PipPosition } from './player-C-k_8OaA.js';
2
- export { B as BlockMarker, c as BlockRenderer, C as CaptionMode, d as CaptionOverlay, e as CaptionPosition, f as CaptionStyle, g as ControlsLayout, D as DisplayMode, h as DocControlsBottom, i as DocControlsOverlay, j as DocControlsSidebar, k as DocControlsSlideshow, l as DocPlayer, m as DocPlayerProps, n as DocPlayerWithSidebar, o as DocProgressBar, F as FlashcardFaceView, p as FlashcardFaceViewProps, q as FlashcardView, r as FlashcardViewProps, I as InlineAudioPlayer, s as InlineAudioPlayerProps, t as InlineVideoPlayer, u as InlineVideoPlayerProps, M as MediaClipLayer, v as MediaClipLayerProps, w as PlaybackActions, x as PlaybackState, R as RenderAudioSegmentInfo, y as RenderBlockInfo, z as RenderCaptionInfo, A as RenderChapterInfo, E as RenderVideoFrameSelector, G as SlideNavActions, H as SocialCaptionOverlay, J as formatTime } from './player-C-k_8OaA.js';
3
- import { Theme, VideoPresentation, VideoPipSize, VideoPipShape, VideoPipPosition, MotionSpec, Doc, ScheduledClip, MediaProvider, Block, BuildCursor } from '@bendyline/squisq/schemas';
1
+ import { S as SquisqRenderAPI, V as VideoPresentation$1, P as PipSize, a as PipShape, b as PipPosition } from './player-B-2-utvs.js';
2
+ export { B as BlockMarker, c as BlockRenderer, C as CaptionMode, d as CaptionOverlay, e as CaptionPosition, f as CaptionStyle, g as ControlsLayout, D as DisplayMode, h as DocControlsBottom, i as DocControlsOverlay, j as DocControlsSidebar, k as DocControlsSlideshow, l as DocPlayer, m as DocPlayerProps, n as DocPlayerWithSidebar, o as DocProgressBar, F as FlashcardFaceView, p as FlashcardFaceViewProps, q as FlashcardView, r as FlashcardViewProps, I as InlineAudioPlayer, s as InlineAudioPlayerProps, t as InlineVideoPlayer, u as InlineVideoPlayerProps, M as MediaClipLayer, v as MediaClipLayerProps, w as PlaybackActions, x as PlaybackState, R as RenderAudioSegmentInfo, y as RenderBlockInfo, z as RenderCaptionInfo, A as RenderChapterInfo, E as RenderVideoFrameSelector, G as SlideNavActions, H as SocialCaptionOverlay, J as formatTime } from './player-B-2-utvs.js';
3
+ import { Theme, VideoPresentation, VideoPipSize, VideoPipShape, VideoPipPosition, MotionSpec, Doc, MediaProvider, ScheduledClip, Block, BuildCursor } from '@bendyline/squisq/schemas';
4
4
  import { DashboardStyleId, ViewportConfig, CoverSlideTemplate, CoverSlidePlayback } from '@bendyline/squisq/doc';
5
5
  export { getAnimationStyle, getTransitionClass } from '@bendyline/squisq/doc';
6
6
  import { C as CodeBlockCopyHandler } from './MarkdownRenderer-C63CQ9Ca.js';
@@ -8,15 +8,16 @@ export { a as CodeBlockCopyContext, M as MarkdownRenderer, b as MarkdownRenderer
8
8
  export { FenceRendererContext, MermaidDiagram, MermaidDiagramProps, VideoEmbedFrame, VideoEmbedFrameProps, useFenceRenderers } from './markdown/index.js';
9
9
  export { CanvasSection, CanvasSectionProps, ImageDisplayMode, LinearDocView, LinearDocViewProps, PageSectionView, PageSectionViewProps, PageViewContext, PageViewContextValue, PaginatedDocPage, PaginatedDocView, PaginatedDocViewProps, usePageView } from './page/index.js';
10
10
  import * as react from 'react';
11
- import { ReactNode, RefObject } from 'react';
11
+ import { ReactNode, RefObject, CSSProperties } from 'react';
12
12
  import { AnimatedImageInfo } from '@bendyline/squisq/imageEdit';
13
13
  export { ImageLayer, MapLayer, MermaidLayer, PathLayer, ShapeLayer, SvgLayer, TextLayer, TreeLayer } from './layers/index.js';
14
14
  export { T as TableLayer, a as TableLayerContentRenderer, b as TableLayerContentRendererProps, V as VideoLayer } from './VideoLayer-sT0mrnNQ.js';
15
- export { MediaContext, MediaScheduleController, ModalDialogOptions, ResourcePolicyContext, UseDocPlaybackOptions, useAudioSync, useAutoSurface, useDocPlayback, useMediaProvider, useMediaSchedule, useMediaUrl, useModalDialog, useResourcePolicy, useViewportOrientation } from './hooks/index.js';
15
+ export { M as MediaContext, a as MediaScheduleController, b as ModalDialogOptions, P as ProcessedAudioContext, R as ResourcePolicyContext, U as UseDocPlaybackOptions, u as useAudioSync, c as useAutoSurface, d as useDocPlayback, e as useMediaProvider, f as useMediaSchedule, g as useMediaUrl, h as useModalDialog, i as useResourcePolicy, j as useViewportOrientation } from './hooks-Dxpfol0l.js';
16
+ import { ResourcePolicy } from '@bendyline/squisq/markdown';
17
+ import { MediaCrop, MediaCut, MediaTimeMap } from '@bendyline/squisq/mediaEdit';
16
18
  export { FenceRenderContext, FenceRenderer, FenceRendererMap } from '@bendyline/squisq/fence';
17
19
  export { A as AudioActions, a as AudioController, b as AudioState } from './AudioController-DAwQyEM_.js';
18
20
  export { JsonFormFenceAction, JsonFormFenceRendererOptions, JsonView, JsonViewProps, createJsonFormFenceRenderer } from './json-view/index.js';
19
- import '@bendyline/squisq/markdown';
20
21
  import '@bendyline/squisq/jsonForm';
21
22
 
22
23
  /**
@@ -315,14 +316,93 @@ declare function resolveDocPlayerAppearance(doc: Doc, overrides?: DocPlayerAppea
315
316
  *
316
317
  * Only video clips are probed — an over-scheduled audio clip merely goes silent,
317
318
  * which is not the visible "frozen frame" bug this addresses.
319
+ *
320
+ * The same probe measures the videos a block plays, which hold the block open
321
+ * for their length (`applyVideoDurations` in core): {@link useVideoDurations}
322
+ * for any list of sources, and {@link probeVideoDurations} for non-React
323
+ * callers such as an exporter.
318
324
  */
319
325
 
326
+ /** Where {@link probeVideoDurations} resolves sources from. */
327
+ interface VideoDurationProbeOptions {
328
+ /** Resolves document-relative sources (a workspace's files). */
329
+ provider?: MediaProvider | null;
330
+ /** Base for relative sources when there is no provider. Default `/`. */
331
+ basePath?: string;
332
+ /** URLs the document may load. Default: the interactive policy. */
333
+ resourcePolicy?: ResourcePolicy;
334
+ }
335
+ /**
336
+ * Measure the length of each video source, resolved the way the player
337
+ * resolves it. Resolves to a map of the lengths that could be read (keyed by
338
+ * the raw `src`); an unreadable, disallowed or slow file is left out. Never
339
+ * rejects. Browser-only — outside a DOM it resolves empty.
340
+ */
341
+ declare function probeVideoDurations(srcs: Iterable<string>, options?: VideoDurationProbeOptions): Promise<Map<string, number>>;
342
+ /**
343
+ * Hold each block of `doc` open for the videos it plays: measure the files
344
+ * whose length the document does not state and apply core's
345
+ * `applyVideoDurations`. The async counterpart of what the editor does live,
346
+ * for pipelines that build their own Doc (exporters). Call it on
347
+ * `markdownToDoc` output, before `resolveAudioMapping` and `buildPreviewDoc`.
348
+ * Returns `doc` unchanged when nothing needs measuring or nothing grows.
349
+ */
350
+ declare function resolveVideoDurations(doc: Doc, options?: VideoDurationProbeOptions): Promise<Doc>;
320
351
  /**
321
352
  * Probe the intrinsic durations of the video clips in `schedule`. Returns a map
322
353
  * keyed by the clip's raw `src`. Pass the resolved `MediaProvider` explicitly
323
354
  * (editor hosts) or rely on {@link MediaContext} (player hosts) by omitting it.
324
355
  */
325
356
  declare function useMediaClipDurations(schedule: ScheduledClip[], basePath: string, mediaProviderOverride?: MediaProvider | null): Map<string, number>;
357
+ /**
358
+ * Probe the intrinsic durations of `srcs` (video files). Returns a map keyed by
359
+ * the raw `src`, filled in as each file's metadata arrives; a file that cannot
360
+ * be read is simply absent. Provider resolution follows
361
+ * {@link useMediaClipDurations}.
362
+ */
363
+ declare function useVideoDurations(srcs: readonly string[], basePath: string, mediaProviderOverride?: MediaProvider | null): Map<string, number>;
364
+
365
+ /**
366
+ * Applying a media-edit recipe to a playing `<video>` / `<audio>` element.
367
+ *
368
+ * Scheduled clips get their recipe from the schedule (`MediaClipLayer`). The
369
+ * same media also plays in places with no schedule — a video laid out in a
370
+ * slide's body, the inline players of the Write and Document views — and
371
+ * there the element itself has to honor the recipe. These are the pieces
372
+ * those players share: skipping cuts, cropping the frame, and setting a level.
373
+ */
374
+
375
+ /**
376
+ * Source time ↔ played time through a clip's cuts, or null for an uncut clip.
377
+ * Unbounded at the far end: the caller caps a timed clip at its own out-point.
378
+ */
379
+ declare function useCutTimeMap(cuts: readonly MediaCut[] | null | undefined, clipStart?: number): MediaTimeMap | null;
380
+ /**
381
+ * While the element plays, move it out of any cut it runs into, on the next
382
+ * animation frame. Works whatever drives the element — a doc clock that ticks
383
+ * coarsely, or the viewer's hand on native controls. A paused element is left
384
+ * where it is, and so is one a frame capture is positioning.
385
+ *
386
+ * `source` re-arms the watch when the element is replaced or reloaded.
387
+ */
388
+ declare function useSkipCuts(ref: RefObject<HTMLMediaElement | null>, timeMap: MediaTimeMap | null, source?: unknown): void;
389
+ /**
390
+ * Crop via CSS `object-view-box` (Chromium): the crop region replaces the
391
+ * frame before object-fit applies, so framing matches the export exactly.
392
+ * Browsers without it show the uncropped frame.
393
+ */
394
+ declare function mediaCropStyle(crop: MediaCrop | null | undefined): CSSProperties;
395
+ /**
396
+ * Linear level of a recipe at a played position: its gain times the fade at
397
+ * either end of the played clip. 1 for a clip with neither.
398
+ */
399
+ declare function recipeLevelAt(recipe: {
400
+ gain?: number;
401
+ fadeIn?: number;
402
+ fadeOut?: number;
403
+ }, played: number, playedDuration: number): number;
404
+ /** Apply a linear level to an element: `volume` for attenuation, a GainNode for boosts. */
405
+ declare function applyMediaLevel(el: HTMLMediaElement, level: number): void;
326
406
 
327
407
  /** A manual build clock never seeks or starts the document's audio clock. */
328
408
  declare function useBuildNavigation(block: Block | null | undefined, enabled: boolean, motion: boolean): {
@@ -334,4 +414,4 @@ declare function useBuildNavigation(block: Block | null | undefined, enabled: bo
334
414
  showAll: () => void;
335
415
  };
336
416
 
337
- export { AnimatedImageControls, type AnimatedImageControlsProps, type AnimatedImagePlayback, type AnimatedImageStatus, CodeBlockCopyHandler, DashboardView, type DashboardViewProps, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SanitizedSvgImageOptions, type SquisqPlayerHandle, SquisqRenderAPI, SvgIslandImage, type SvgIslandImageProps, VideoPresentation$1 as VideoPresentation, decodeSvgImages, isLocalSvgUrl, resolveDocPlayerAppearance, sanitizedSvgImageUrl, useAnimatedImage, useBuildNavigation, useMediaClipDurations, useSanitizedSvgImage, withMermaidLabelWrapping };
417
+ export { AnimatedImageControls, type AnimatedImageControlsProps, type AnimatedImagePlayback, type AnimatedImageStatus, CodeBlockCopyHandler, DashboardView, type DashboardViewProps, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SanitizedSvgImageOptions, type SquisqPlayerHandle, SquisqRenderAPI, SvgIslandImage, type SvgIslandImageProps, type VideoDurationProbeOptions, VideoPresentation$1 as VideoPresentation, applyMediaLevel, decodeSvgImages, isLocalSvgUrl, mediaCropStyle, probeVideoDurations, recipeLevelAt, resolveDocPlayerAppearance, resolveVideoDurations, sanitizedSvgImageUrl, useAnimatedImage, useBuildNavigation, useCutTimeMap, useMediaClipDurations, useSanitizedSvgImage, useSkipCuts, useVideoDurations, withMermaidLabelWrapping };
package/dist/index.js CHANGED
@@ -14,20 +14,23 @@ import {
14
14
  SocialCaptionOverlay,
15
15
  decodeSvgImages,
16
16
  formatTime,
17
+ probeVideoDurations,
17
18
  resolveDocPlayerAppearance,
19
+ resolveVideoDurations,
18
20
  useBuildNavigation,
19
- useMediaClipDurations
20
- } from "./chunk-XR3KNKLP.js";
21
+ useMediaClipDurations,
22
+ useVideoDurations
23
+ } from "./chunk-NZHL2VKW.js";
21
24
  import {
22
25
  PaginatedDocView
23
- } from "./chunk-74MMSPTK.js";
26
+ } from "./chunk-M4IUYVXU.js";
24
27
  import {
25
28
  CanvasSection,
26
29
  LinearDocView,
27
30
  PageSectionView,
28
31
  PageViewContext,
29
32
  usePageView
30
- } from "./chunk-L3PODEKP.js";
33
+ } from "./chunk-Q66DDGKP.js";
31
34
  import {
32
35
  useModalDialog
33
36
  } from "./chunk-JP457U6N.js";
@@ -36,11 +39,11 @@ import {
36
39
  useDocPlayback,
37
40
  useMediaSchedule,
38
41
  useViewportOrientation
39
- } from "./chunk-UUGOEH5Q.js";
42
+ } from "./chunk-MNY6M5QG.js";
40
43
  import {
41
44
  JsonView,
42
45
  createJsonFormFenceRenderer
43
- } from "./chunk-26J5MZBI.js";
46
+ } from "./chunk-RVTMYNVX.js";
44
47
  import {
45
48
  useAutoSurface
46
49
  } from "./chunk-TT6ENR6T.js";
@@ -54,10 +57,10 @@ import {
54
57
  VideoEmbedFrame,
55
58
  useAnimatedImage,
56
59
  useFenceRenderers
57
- } from "./chunk-OWC7DNGJ.js";
60
+ } from "./chunk-CFJRBRRG.js";
58
61
  import {
59
62
  BlockRenderer
60
- } from "./chunk-HPABEDRG.js";
63
+ } from "./chunk-3UITZDNL.js";
61
64
  import {
62
65
  ImageLayer,
63
66
  MapLayer,
@@ -71,12 +74,18 @@ import {
71
74
  VideoLayer,
72
75
  getAnimationStyle,
73
76
  getTransitionClass
74
- } from "./chunk-E7TEWUNF.js";
77
+ } from "./chunk-DRPMS5JK.js";
75
78
  import {
76
- MermaidDiagram
77
- } from "./chunk-A65WPCGZ.js";
79
+ MermaidDiagram,
80
+ applyMediaLevel,
81
+ mediaCropStyle,
82
+ recipeLevelAt,
83
+ useCutTimeMap,
84
+ useSkipCuts
85
+ } from "./chunk-FXAKS6KU.js";
78
86
  import {
79
87
  MediaContext,
88
+ ProcessedAudioContext,
80
89
  ResourcePolicyContext,
81
90
  isLocalSvgUrl,
82
91
  sanitizedSvgImageUrl,
@@ -85,7 +94,7 @@ import {
85
94
  useResourcePolicy,
86
95
  useSanitizedSvgImage,
87
96
  withMermaidLabelWrapping
88
- } from "./chunk-OTYJ4MRH.js";
97
+ } from "./chunk-ZKMBIWAA.js";
89
98
  export {
90
99
  AnimatedImageControls,
91
100
  BlockRenderer,
@@ -117,6 +126,7 @@ export {
117
126
  PageViewContext,
118
127
  PaginatedDocView,
119
128
  PathLayer,
129
+ ProcessedAudioContext,
120
130
  ResourcePolicyContext,
121
131
  ShapeLayer,
122
132
  SocialCaptionOverlay,
@@ -127,18 +137,24 @@ export {
127
137
  TreeLayer,
128
138
  VideoEmbedFrame,
129
139
  VideoLayer,
140
+ applyMediaLevel,
130
141
  createJsonFormFenceRenderer,
131
142
  decodeSvgImages,
132
143
  formatTime,
133
144
  getAnimationStyle,
134
145
  getTransitionClass,
135
146
  isLocalSvgUrl,
147
+ mediaCropStyle,
148
+ probeVideoDurations,
149
+ recipeLevelAt,
136
150
  resolveDocPlayerAppearance,
151
+ resolveVideoDurations,
137
152
  sanitizedSvgImageUrl,
138
153
  useAnimatedImage,
139
154
  useAudioSync,
140
155
  useAutoSurface,
141
156
  useBuildNavigation,
157
+ useCutTimeMap,
142
158
  useDocPlayback,
143
159
  useFenceRenderers,
144
160
  useMediaClipDurations,
@@ -149,6 +165,8 @@ export {
149
165
  usePageView,
150
166
  useResourcePolicy,
151
167
  useSanitizedSvgImage,
168
+ useSkipCuts,
169
+ useVideoDurations,
152
170
  useViewportOrientation,
153
171
  withMermaidLabelWrapping
154
172
  };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  JsonView,
3
3
  createJsonFormFenceRenderer
4
- } from "../chunk-26J5MZBI.js";
4
+ } from "../chunk-RVTMYNVX.js";
5
5
  import "../chunk-TT6ENR6T.js";
6
- import "../chunk-OWC7DNGJ.js";
7
- import "../chunk-A65WPCGZ.js";
8
- import "../chunk-OTYJ4MRH.js";
6
+ import "../chunk-CFJRBRRG.js";
7
+ import "../chunk-FXAKS6KU.js";
8
+ import "../chunk-ZKMBIWAA.js";
9
9
  export {
10
10
  JsonView,
11
11
  createJsonFormFenceRenderer
@@ -9,9 +9,9 @@ import {
9
9
  TextLayer,
10
10
  TreeLayer,
11
11
  VideoLayer
12
- } from "../chunk-E7TEWUNF.js";
13
- import "../chunk-A65WPCGZ.js";
14
- import "../chunk-OTYJ4MRH.js";
12
+ } from "../chunk-DRPMS5JK.js";
13
+ import "../chunk-FXAKS6KU.js";
14
+ import "../chunk-ZKMBIWAA.js";
15
15
  export {
16
16
  ImageLayer,
17
17
  MapLayer,
@@ -3,11 +3,11 @@ import {
3
3
  MarkdownRenderer,
4
4
  VideoEmbedFrame,
5
5
  useFenceRenderers
6
- } from "../chunk-OWC7DNGJ.js";
6
+ } from "../chunk-CFJRBRRG.js";
7
7
  import {
8
8
  MermaidDiagram
9
- } from "../chunk-A65WPCGZ.js";
10
- import "../chunk-OTYJ4MRH.js";
9
+ } from "../chunk-FXAKS6KU.js";
10
+ import "../chunk-ZKMBIWAA.js";
11
11
  export {
12
12
  FenceRendererContext,
13
13
  MarkdownRenderer,
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  PaginatedDocView
3
- } from "../chunk-74MMSPTK.js";
3
+ } from "../chunk-M4IUYVXU.js";
4
4
  import {
5
5
  CanvasSection,
6
6
  LinearDocView,
7
7
  PageSectionView,
8
8
  PageViewContext,
9
9
  usePageView
10
- } from "../chunk-L3PODEKP.js";
10
+ } from "../chunk-Q66DDGKP.js";
11
11
  import "../chunk-TT6ENR6T.js";
12
- import "../chunk-OWC7DNGJ.js";
13
- import "../chunk-HPABEDRG.js";
14
- import "../chunk-E7TEWUNF.js";
15
- import "../chunk-A65WPCGZ.js";
16
- import "../chunk-OTYJ4MRH.js";
12
+ import "../chunk-CFJRBRRG.js";
13
+ import "../chunk-3UITZDNL.js";
14
+ import "../chunk-DRPMS5JK.js";
15
+ import "../chunk-FXAKS6KU.js";
16
+ import "../chunk-ZKMBIWAA.js";
17
17
  export {
18
18
  CanvasSection,
19
19
  LinearDocView,
@@ -1,4 +1,4 @@
1
- export { B as BlockMarker, c as BlockRenderer, C as CaptionMode, d as CaptionOverlay, f as CaptionStyle, g as ControlsLayout, D as DisplayMode, h as DocControlsBottom, i as DocControlsOverlay, j as DocControlsSidebar, k as DocControlsSlideshow, l as DocPlayer, m as DocPlayerProps, n as DocPlayerWithSidebar, o as DocProgressBar, F as FlashcardFaceView, p as FlashcardFaceViewProps, q as FlashcardView, r as FlashcardViewProps, I as InlineAudioPlayer, s as InlineAudioPlayerProps, t as InlineVideoPlayer, u as InlineVideoPlayerProps, M as MediaClipLayer, v as MediaClipLayerProps, b as PipPosition, a as PipShape, P as PipSize, w as PlaybackActions, x as PlaybackState, R as RenderAudioSegmentInfo, y as RenderBlockInfo, z as RenderCaptionInfo, A as RenderChapterInfo, G as SlideNavActions, H as SocialCaptionOverlay, S as SquisqRenderAPI, V as VideoPresentation, J as formatTime } from '../player-C-k_8OaA.js';
1
+ export { B as BlockMarker, c as BlockRenderer, C as CaptionMode, d as CaptionOverlay, f as CaptionStyle, g as ControlsLayout, D as DisplayMode, h as DocControlsBottom, i as DocControlsOverlay, j as DocControlsSidebar, k as DocControlsSlideshow, l as DocPlayer, m as DocPlayerProps, n as DocPlayerWithSidebar, o as DocProgressBar, F as FlashcardFaceView, p as FlashcardFaceViewProps, q as FlashcardView, r as FlashcardViewProps, I as InlineAudioPlayer, s as InlineAudioPlayerProps, t as InlineVideoPlayer, u as InlineVideoPlayerProps, M as MediaClipLayer, v as MediaClipLayerProps, b as PipPosition, a as PipShape, P as PipSize, w as PlaybackActions, x as PlaybackState, R as RenderAudioSegmentInfo, y as RenderBlockInfo, z as RenderCaptionInfo, A as RenderChapterInfo, G as SlideNavActions, H as SocialCaptionOverlay, S as SquisqRenderAPI, V as VideoPresentation, J as formatTime } from '../player-B-2-utvs.js';
2
2
  export { a as CodeBlockCopyContext, C as CodeBlockCopyHandler } from '../MarkdownRenderer-C63CQ9Ca.js';
3
3
  import 'react';
4
4
  import '@bendyline/squisq/schemas';
@@ -12,20 +12,20 @@ import {
12
12
  MediaClipLayer,
13
13
  SocialCaptionOverlay,
14
14
  formatTime
15
- } from "../chunk-XR3KNKLP.js";
16
- import "../chunk-L3PODEKP.js";
17
- import "../chunk-UUGOEH5Q.js";
15
+ } from "../chunk-NZHL2VKW.js";
16
+ import "../chunk-Q66DDGKP.js";
17
+ import "../chunk-MNY6M5QG.js";
18
18
  import "../chunk-TT6ENR6T.js";
19
19
  import {
20
20
  InlineAudioPlayer,
21
21
  InlineVideoPlayer
22
- } from "../chunk-OWC7DNGJ.js";
22
+ } from "../chunk-CFJRBRRG.js";
23
23
  import {
24
24
  BlockRenderer
25
- } from "../chunk-HPABEDRG.js";
26
- import "../chunk-E7TEWUNF.js";
27
- import "../chunk-A65WPCGZ.js";
28
- import "../chunk-OTYJ4MRH.js";
25
+ } from "../chunk-3UITZDNL.js";
26
+ import "../chunk-DRPMS5JK.js";
27
+ import "../chunk-FXAKS6KU.js";
28
+ import "../chunk-ZKMBIWAA.js";
29
29
  export {
30
30
  BlockRenderer,
31
31
  CaptionOverlay,
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties } from 'react';
3
- import { Block, VideoPresentation as VideoPresentation$1, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, MediaScheduleOptions, Theme, MotionSpec, SurfaceScheme, BuildCursor, Transition, CaptionTrack, ViewportConfig as ViewportConfig$1, CustomTemplateDefinition, ScheduledClip } from '@bendyline/squisq/schemas';
3
+ import { Block, VideoPresentation as VideoPresentation$1, VideoPipSize, VideoPipShape, VideoPipPosition, Doc, MediaScheduleOptions, Theme, MotionSpec, SurfaceScheme, BuildCursor, Transition, CaptionTrack, ViewportConfig as ViewportConfig$1, CustomTemplateDefinition, MediaEdits, ScheduledClip } from '@bendyline/squisq/schemas';
4
4
  import { ViewportConfig, DashboardStyleId, CoverSlideTemplate, CoverSlidePlayback, FlashcardFace, FlashcardSourceMode } from '@bendyline/squisq/doc';
5
5
  import { FenceRendererMap } from '@bendyline/squisq/fence';
6
6
  import { a as AudioController } from './AudioController-DAwQyEM_.js';
@@ -581,8 +581,13 @@ interface InlineVideoPlayerProps {
581
581
  className?: string;
582
582
  /** Accessible name — a markdown reference's alt text; `<video>` has no `alt`. */
583
583
  label?: string;
584
+ /**
585
+ * The clip's edit recipe (`data-squisq-video-*`). The player skips its cuts
586
+ * as it plays and shows its crop; the sound is the file's own.
587
+ */
588
+ edits?: MediaEdits;
584
589
  }
585
- declare function InlineVideoPlayer({ src, basePath, width, height, poster, controls, preload, className, label, }: InlineVideoPlayerProps): react.JSX.Element | null;
590
+ declare function InlineVideoPlayer({ src, basePath, width, height, poster, controls, preload, className, label, edits, }: InlineVideoPlayerProps): react.JSX.Element | null;
586
591
 
587
592
  interface InlineAudioPlayerProps {
588
593
  /** Source path — resolved through MediaContext when relative. */
@@ -597,8 +602,10 @@ interface InlineAudioPlayerProps {
597
602
  className?: string;
598
603
  /** Accessible name — a markdown reference's alt text; `<audio>` has no `alt`. */
599
604
  label?: string;
605
+ /** The clip's edit recipe (`data-squisq-audio-*`); the player skips its cuts. */
606
+ edits?: MediaEdits;
600
607
  }
601
- declare function InlineAudioPlayer({ src, basePath, controls, preload, className, label, }: InlineAudioPlayerProps): react.JSX.Element | null;
608
+ declare function InlineAudioPlayer({ src, basePath, controls, preload, className, label, edits, }: InlineAudioPlayerProps): react.JSX.Element | null;
602
609
 
603
610
  interface MediaClipLayerProps {
604
611
  schedule: ScheduledClip[];