@waveform-playlist/browser 16.0.1 → 17.0.0-next.1

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/dist/index.d.ts CHANGED
@@ -1,13 +1,10 @@
1
- import { EffectsFunction, SoundFontCache, TrackEffectsFunction } from '@waveform-playlist/playout';
2
- export { EffectsFunction, TrackEffectsFunction } from '@waveform-playlist/playout';
3
- import * as React$1 from 'react';
4
- import React__default, { ReactNode, RefObject } from 'react';
5
- import { PlayoutAdapter, PlaylistEngine, EngineState } from '@waveform-playlist/engine';
6
- import { PeakData, Fade, MidiNoteData, ClipTrack, AnnotationData, AnnotationAction, WaveformDataObject, KeyboardShortcut, AnnotationActionOptions, RenderAnnotationItemProps, TrackSpectrogramOverrides, SpectrogramConfig, ColorMapValue, RenderMode } from '@waveform-playlist/core';
7
- export { AnnotationData, AudioClip, ClipTrack, Fade, getShortcutLabel } from '@waveform-playlist/core';
8
- import { WaveformPlaylistTheme, TimeFormat, RenderPlayheadFunction, TrackMenuItem, SnapTo } from '@waveform-playlist/ui-components';
9
- export { TimeFormat } from '@waveform-playlist/ui-components';
10
- import { MediaElementPlayout, FadeConfig } from '@waveform-playlist/media-element-playout';
1
+ import * as react from 'react';
2
+ import react__default, { ReactNode, RefObject } from 'react';
3
+ import { EffectsFunction, TrackEffectsFunction, SoundFontCache } from '@waveform-playlist/playout';
4
+ import { PlaylistEngine, Arrangement, PlayoutAdapter, EngineState, LoadSource, ArrangementSourcesValue } from '@waveform-playlist/engine';
5
+ import { ValueSourceHandle, AnnotationData, ClipTrack, PeakData, Fade, MidiNoteData, WaveformDataObject, KeyboardShortcut, ArrangementTrack, RecordingProgressSource, AnnotationAction, RenderAnnotationItemProps, TrackKind, RenderMode, AnnotationActionOptions, TrackSpectrogramOverrides, SpectrogramConfig, ColorMapValue, SpectrogramCanvasRegistration } from '@waveform-playlist/core';
6
+ import { TimeFormat, WaveformPlaylistTheme, RenderPlayheadFunction, TrackMenuItem, BeatsAndBarsSnapTo } from '@waveform-playlist/ui-components';
7
+ import { FadeConfig, MediaElementPlayout } from '@waveform-playlist/media-element-playout';
11
8
  import * as _dnd_kit_abstract from '@dnd-kit/abstract';
12
9
  import { DragStartEvent, DragMoveEvent, DragEndEvent, PluginDescriptor, Modifier, DragDropManager, DragOperation } from '@dnd-kit/abstract';
13
10
  import { PointerSensor } from '@dnd-kit/dom';
@@ -24,32 +21,67 @@ interface TrackDragPreview {
24
21
  toIndex: number;
25
22
  }
26
23
 
27
- interface ClipPeaks {
28
- clipId: string;
29
- trackName: string;
30
- peaks: PeakData;
31
- startSample: number;
32
- durationSamples: number;
33
- fadeIn?: Fade;
34
- fadeOut?: Fade;
35
- midiNotes?: MidiNoteData[];
24
+ /**
25
+ * Where an annotation edge drag shows its moves while it is in progress:
26
+ * the annotations as the drag would leave them, or `null` when no drag is
27
+ * running. Both providers have one (`annotationPreview` in their controls).
28
+ */
29
+ type AnnotationPreviewHandle = ValueSourceHandle<AnnotationData[] | null>;
30
+ interface UseAnnotationDragHandlersOptions {
31
+ annotations: AnnotationData[];
32
+ onAnnotationsChange: (annotations: AnnotationData[]) => void;
33
+ samplesPerPixel: number;
34
+ /** Sample rate for pixel-to-time conversion. Providers pass the real rate from
35
+ * context; defaults to 48000 (the engine default) for out-of-provider usage. */
36
36
  sampleRate?: number;
37
- offsetSamples?: number;
37
+ duration: number;
38
+ linkEndpoints: boolean;
39
+ /**
40
+ * Pass the provider's `annotationPreview` to keep the drag out of your own
41
+ * state: each move is published there (the built-in annotation boxes and
42
+ * list follow it), and `onAnnotationsChange` is called once, on release.
43
+ * Without it `onAnnotationsChange` is called on every move, which
44
+ * re-renders whatever holds the annotations for each one.
45
+ */
46
+ preview?: AnnotationPreviewHandle;
38
47
  }
39
- type TrackClipPeaks = ClipPeaks[];
48
+ /**
49
+ * Custom hook for handling annotation drag operations (boundary trimming)
50
+ *
51
+ * Provides drag handlers for use with @dnd-kit/react DragDropProvider.
52
+ * Handles annotation boundary resizing with linked endpoints support.
53
+ * A cancelled drag (Escape) puts back every annotation it moved.
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * const { onDragStart, onDragMove, onDragEnd } = useAnnotationDragHandlers({
58
+ * annotations,
59
+ * onAnnotationsChange: setAnnotations,
60
+ * preview: annotationPreview, // from usePlaybackControls()
61
+ * samplesPerPixel,
62
+ * sampleRate,
63
+ * duration,
64
+ * linkEndpoints,
65
+ * });
66
+ *
67
+ * return (
68
+ * <DragDropProvider
69
+ * onDragStart={onDragStart}
70
+ * onDragMove={onDragMove}
71
+ * onDragEnd={onDragEnd}
72
+ * modifiers={[RestrictToHorizontalAxis]}
73
+ * >
74
+ * {renderAnnotations()}
75
+ * </DragDropProvider>
76
+ * );
77
+ * ```
78
+ */
79
+ declare function useAnnotationDragHandlers({ annotations, onAnnotationsChange, samplesPerPixel, sampleRate, duration, linkEndpoints, preview, }: UseAnnotationDragHandlersOptions): {
80
+ onDragStart: (event: DragStartEvent) => void;
81
+ onDragMove: (event: DragMoveEvent) => void;
82
+ onDragEnd: (event: DragEndEvent) => void;
83
+ };
40
84
 
41
- interface WaveformTrack {
42
- src: string | AudioBuffer;
43
- name?: string;
44
- effects?: TrackEffectsFunction;
45
- }
46
- interface TrackState {
47
- name: string;
48
- muted: boolean;
49
- soloed: boolean;
50
- volume: number;
51
- pan: number;
52
- }
53
85
  /** Per-frame data passed to registered animation callbacks. */
54
86
  interface FrameData {
55
87
  /** Raw engine time (for state/logic — NOT for visual positioning). */
@@ -60,102 +92,208 @@ interface FrameData {
60
92
  readonly sampleRate: number;
61
93
  readonly samplesPerPixel: number;
62
94
  }
63
- interface PlaybackAnimationContextValue {
95
+
96
+ /**
97
+ * Whether playback is running. Its own context (#768): it is the only value of
98
+ * the playback state that changes on play, pause and stop, and a component
99
+ * that needs a ref or a frame callback (`usePlaybackRefs`) must not re-render
100
+ * with it.
101
+ */
102
+ interface IsPlayingContextValue {
64
103
  isPlaying: boolean;
65
- currentTime: number;
66
- currentTimeRef: React__default.RefObject<number>;
67
- /**
68
- * Visually-aligned playback time (engine.getAudibleTime() while playing;
69
- * raw resting time otherwise). Kept current by the animation loop during playback
70
- * and by pause/seek/stop paths when stopped. Read from this for any visual
71
- * positioning that should match the audible output.
72
- */
73
- visualTimeRef: React__default.RefObject<number>;
74
- playbackStartTimeRef: React__default.RefObject<number>;
75
- audioStartPositionRef: React__default.RefObject<number>;
76
- /** Returns raw playback time from engine (auto-wraps at loop boundaries). */
77
- getPlaybackTime: () => number;
78
- /** Current time of the adapter's AudioContext, in seconds. */
79
- getAudioContextTime: () => number;
80
- /**
81
- * Returns the current adapter scheduler lookahead (Tone ~0.1s, native 0).
82
- * Use this for any audible-latency calculation that must match the playhead
83
- * (e.g., recording live-preview peak slicing).
84
- */
85
- getLookAhead: () => number;
104
+ }
105
+ /**
106
+ * Refs and functions that keep their identity for the life of the provider
107
+ * (#768). Reading this never causes a re-render: read a ref's `.current` in an
108
+ * event handler, an effect or a frame callback, not during render.
109
+ */
110
+ interface PlaybackRefsContextValue {
111
+ /** The playback position, in seconds. Advances during playback. */
112
+ currentTimeRef: React.RefObject<number>;
86
113
  /**
87
- * Returns the adapter AudioContext's output latency in seconds.
88
- * Use this for audible-latency calculations (e.g., recording live-preview peak slicing).
114
+ * The position to DRAW. Under the WebAudio provider it is the audible
115
+ * position (the raw time less output latency and lookahead while playing);
116
+ * under the MediaElement provider it is `currentTimeRef` itself, because a
117
+ * media element reports the audible position.
89
118
  */
90
- getOutputLatency: () => number;
91
- /** Register a per-frame callback driven by the single animation loop. */
119
+ visualTimeRef: React.RefObject<number>;
120
+ /** Register a per-frame callback driven by the provider's one animation loop. */
92
121
  registerFrameCallback: (id: string, cb: (data: FrameData) => void) => void;
93
122
  /** Unregister a per-frame callback. */
94
123
  unregisterFrameCallback: (id: string) => void;
95
124
  }
96
- interface PlaylistStateContextValue {
97
- continuousPlay: boolean;
98
- linkEndpoints: boolean;
99
- annotationsEditable: boolean;
100
- isAutomaticScroll: boolean;
101
- isLoopEnabled: boolean;
102
- annotations: AnnotationData[];
103
- activeAnnotationId: string | null;
125
+ /**
126
+ * The selected time range, in seconds. Apart from the state context because it
127
+ * is the only state that changes on every pointer move of a selection drag
128
+ * (#733). `selectionStart === selectionEnd` means nothing is selected.
129
+ */
130
+ interface SelectionContextValue {
104
131
  selectionStart: number;
105
132
  selectionEnd: number;
106
- selectedTrackId: string | null;
107
- loopStart: number;
108
- loopEnd: number;
109
- /** Whether playback continues past the end of loaded audio instead of
110
- * auto-stopping (implies the fillViewport layout) */
111
- indefinitePlayback: boolean;
112
- /** Whether the timeline visually fills the scroll container even when the
113
- * audio is shorter (layout only — no effect on playback) */
114
- fillViewport: boolean;
115
- /** Whether undo is available */
116
- canUndo: boolean;
117
- /** Whether redo is available */
118
- canRedo: boolean;
119
133
  }
120
- interface PlaylistControlsContextValue {
134
+ /**
135
+ * Where the cursor rests, in seconds: the position playback starts from. It
136
+ * changes on a seek, a pause, a stop (including playback reaching the end) and
137
+ * a selection whose start moves; it does NOT advance during playback (read
138
+ * `currentTimeRef`, or register a frame callback, for that). Apart from the
139
+ * other values so that a component reading `isPlaying` or a ref is not
140
+ * re-rendered by every seek, nor by every pointer move of a leftward selection
141
+ * drag (#740).
142
+ */
143
+ interface CurrentTimeContextValue {
144
+ currentTime: number;
145
+ }
146
+ /**
147
+ * The annotation that is playing or was last chosen. Its own context because
148
+ * it changes at every annotation boundary during playback (#740).
149
+ */
150
+ interface ActiveAnnotationContextValue {
151
+ activeAnnotationId: string | null;
152
+ }
153
+ /**
154
+ * The annotations. Changes on an annotation edit; an edge drag changes it
155
+ * once, on release (its moves go through the preview source).
156
+ */
157
+ interface AnnotationsContextValue {
158
+ annotations: AnnotationData[];
159
+ }
160
+ /**
161
+ * The three annotation options, under both providers (#686): whether
162
+ * annotations can be edited, whether an edge takes the edge it touches along,
163
+ * and whether playback runs on past the end of an annotation. They start from
164
+ * the provider's `annotationList` prop and are set with
165
+ * `setAnnotationsEditable`, `setLinkEndpoints` and `setContinuousPlay` of
166
+ * `usePlaybackControls()`.
167
+ */
168
+ interface AnnotationOptionsContextValue {
169
+ editable: boolean;
170
+ linkEndpoints: boolean;
171
+ continuousPlay: boolean;
172
+ }
173
+ /**
174
+ * The actions both providers have (#688). The value never changes, so reading
175
+ * it never re-renders.
176
+ */
177
+ interface PlaybackControlsContextValue {
178
+ /**
179
+ * Starts playback at `startTime` (default: the cursor). With `playDuration`
180
+ * it stops by itself after that many seconds of audio.
181
+ */
121
182
  play: (startTime?: number, playDuration?: number) => Promise<void>;
122
183
  pause: () => void;
184
+ /** Ends playback and returns the cursor to where playback started. */
123
185
  stop: () => void;
186
+ /** Moves the cursor, clamped to the audio. During playback, playback restarts there. */
124
187
  seekTo: (time: number) => void;
188
+ /** Sets the selected range and moves the cursor to its start. During playback, playback
189
+ * restarts: a range is played start to end (open-ended under WaveformPlaylistProvider with
190
+ * looping on), a collapsed one carries on from there. */
191
+ setSelection: (start: number, end: number) => void;
192
+ setTimeFormat: (format: TimeFormat) => void;
193
+ setAutomaticScroll: (enabled: boolean) => void;
194
+ setScrollContainer: (element: HTMLDivElement | null) => void;
195
+ scrollContainerRef: React.RefObject<HTMLDivElement | null>;
196
+ setContinuousPlay: (enabled: boolean) => void;
197
+ setAnnotationsEditable: (enabled: boolean) => void;
198
+ setLinkEndpoints: (enabled: boolean) => void;
199
+ setAnnotations: React.Dispatch<React.SetStateAction<AnnotationData[]>>;
200
+ /**
201
+ * Where an annotation edge drag shows its moves while it is in progress.
202
+ * Pass it to `useAnnotationDragHandlers({ preview })`; read it in a custom
203
+ * annotation renderer with `useAnnotationsWithPreview`. Stable identity.
204
+ */
205
+ annotationPreview: AnnotationPreviewHandle;
206
+ setActiveAnnotationId: (id: string | null) => void;
207
+ /**
208
+ * What a click on an annotation does (its box, or its row in the list): the
209
+ * annotation becomes the active one and is played from its start. With
210
+ * continuous play off, playback ends where the annotation ends. Call it
211
+ * from a box or a row of your own. Each provider plays an annotation its
212
+ * own way: `WaveformPlaylistProvider` starts a play of the annotation's
213
+ * length, `MediaElementPlaylistProvider` starts an open-ended play that its
214
+ * loop ends with the active annotation. Left alone, both end at the
215
+ * annotation's end. They differ when something changes during the play:
216
+ * under MediaElement the play follows an end that is moved, and continuous
217
+ * play switched on lets it run on; under WebAudio the first keeps the end
218
+ * it started with. A start that fails is logged as a warning.
219
+ */
220
+ playAnnotation: (annotation: AnnotationData) => void;
221
+ }
222
+ /**
223
+ * What the provider was configured with that a view also reads (#768, #689).
224
+ * Changes on a prop change (and once when the real sample rate is known),
225
+ * never during an interaction.
226
+ *
227
+ * The options that only affect how a view draws (row height, bar style,
228
+ * playhead width, the filled layout) are not here: they are
229
+ * `<WaveformViewOptions>`, and what is drawn reads them from ui-components'
230
+ * `usePlaylistInfo()` inside a root.
231
+ */
232
+ interface PlaylistViewContextValue {
233
+ sampleRate: number;
234
+ /**
235
+ * Whether tracks are drawn and analysed as one channel. On the provider
236
+ * because the provider computes the peaks with it. Always false under the
237
+ * MediaElement provider.
238
+ */
239
+ mono: boolean;
240
+ /**
241
+ * Whether playback continues past the end of the audio instead of stopping
242
+ * there. On the provider because its animation loop and `seekTo` follow it;
243
+ * the multitrack root also draws the timeline as wide as its container
244
+ * then. Always false under the MediaElement provider.
245
+ */
246
+ indefinitePlayback: boolean;
247
+ }
248
+ /**
249
+ * The two settings a user toggles (#768). Apart from the view value because
250
+ * every clip overlay and the visualization shell read that one: a toggle here
251
+ * renders only the components that show the setting.
252
+ */
253
+ interface PlaylistSettingsContextValue {
254
+ timeFormat: TimeFormat;
255
+ isAutomaticScroll: boolean;
256
+ }
257
+ /**
258
+ * The zoom level (#768). Changes on a zoom. Under the MediaElement provider
259
+ * the level is fixed: `canZoomIn` and `canZoomOut` are always false.
260
+ */
261
+ interface PlaylistZoomContextValue {
262
+ samplesPerPixel: number;
263
+ canZoomIn: boolean;
264
+ canZoomOut: boolean;
265
+ }
266
+ /**
267
+ * The actions only the multitrack editor has (#688). The value never changes.
268
+ */
269
+ interface EditorControlsContextValue {
270
+ /**
271
+ * Moves the cursor without touching playback. `seekTo` is the one to use
272
+ * from a control; this is for the view's own press and drag handling.
273
+ */
125
274
  setCurrentTime: (time: number) => void;
126
- setTrackMute: (trackIndex: number, muted: boolean) => void;
127
- setTrackSolo: (trackIndex: number, soloed: boolean) => void;
128
- setTrackVolume: (trackIndex: number, volume: number) => void;
129
- setTrackPan: (trackIndex: number, pan: number) => void;
275
+ setTrackMute: (trackId: string, muted: boolean) => void;
276
+ setTrackSolo: (trackId: string, soloed: boolean) => void;
277
+ setTrackVolume: (trackId: string, volume: number) => void;
278
+ setTrackPan: (trackId: string, pan: number) => void;
130
279
  /** Move a track to a new index in the vertical track order. Purely
131
- * organizational — playback is not interrupted. The reordered tracks
132
- * array flows back through onTracksChange. */
280
+ * organizational — playback is not interrupted. An undo step of the
281
+ * arrangement (#812). */
133
282
  reorderTrack: (trackId: string, toIndex: number) => void;
134
283
  /** Internal: call after every track-reorder DRAG interaction ends
135
- * (committed or canceled) to force PlaylistVisualization to remount the
136
- * track-controls slots, discarding any @dnd-kit sortable-plugin DOM
284
+ * (committed or canceled) to force the view's track-controls part to remount
285
+ * its slots, discarding any @dnd-kit sortable-plugin DOM
137
286
  * corruption. Not needed for button-driven reorderTrack calls (they never
138
287
  * touch dnd-kit's DOM). See bumpTrackReorderEpoch in the provider. */
139
288
  bumpTrackReorderEpoch: () => void;
140
289
  /** INTERNAL wiring for ClipInteractionProvider: publishes/clears the live
141
290
  * track-reorder drag preview. Custom drag integrations may call it, but
142
- * most consumers only ever READ trackDragPreview from usePlaylistData(). */
143
- setTrackDragPreview: React__default.Dispatch<React__default.SetStateAction<TrackDragPreview | null>>;
144
- setSelection: (start: number, end: number) => void;
291
+ * most consumers only ever READ trackDragPreview from useTrackReorderPreview(). */
292
+ setTrackDragPreview: React.Dispatch<React.SetStateAction<TrackDragPreview | null>>;
145
293
  setSelectedTrackId: (trackId: string | null) => void;
146
- setTimeFormat: (format: TimeFormat) => void;
147
- formatTime: (seconds: number) => string;
148
294
  zoomIn: () => void;
149
295
  zoomOut: () => void;
150
296
  setMasterVolume: (volume: number) => void;
151
- setAutomaticScroll: (enabled: boolean) => void;
152
- setScrollContainer: (element: HTMLDivElement | null) => void;
153
- scrollContainerRef: React__default.RefObject<HTMLDivElement | null>;
154
- setContinuousPlay: (enabled: boolean) => void;
155
- setLinkEndpoints: (enabled: boolean) => void;
156
- setAnnotationsEditable: (enabled: boolean) => void;
157
- setAnnotations: React__default.Dispatch<React__default.SetStateAction<AnnotationData[]>>;
158
- setActiveAnnotationId: (id: string | null) => void;
159
297
  setLoopEnabled: (enabled: boolean) => void;
160
298
  setLoopRegion: (start: number, end: number) => void;
161
299
  setLoopRegionFromSelection: () => void;
@@ -164,125 +302,346 @@ interface PlaylistControlsContextValue {
164
302
  redo: () => void;
165
303
  /** Mark a recording session active/inactive. While active: (1) the
166
304
  * end-of-audio auto-stop is suppressed so overdub playback runs past the
167
- * end of existing material, and (2) with an `armedTrackId`, that track's
168
- * existing content is transiently muted — punch-in recording replaces
169
- * whatever the take overlaps (#579), so the doomed material must not play
170
- * under the overdub; its previous mute state is restored when the session
171
- * ends (audio-only, the UI mute control is untouched). Wired automatically
172
- * from the Waveform / PlaylistVisualization `recordingState` prop; overdub
173
- * flows should also call it eagerly (before `play()`). */
305
+ * end of existing material, and (2) with an `armedTrackId`, that track is
306
+ * muted in the arrangement's mix for the session (#812): punch-in
307
+ * recording replaces whatever the take overlaps (#579), so the doomed
308
+ * material must not play under the overdub. The mixer and the track's Mute
309
+ * button show it muted, the built-in `<TrackMuteButton />` of that track
310
+ * is disabled, and `useTrack().isRecordingArmed` is true for it. The mute
311
+ * from before the session is written back when it ends or the armed track
312
+ * changes, whatever was set in between; nothing is written for a track
313
+ * that is no longer in the arrangement. `useRecordingSession` calls it for
314
+ * the length of a take; overdub flows should also call it eagerly (before
315
+ * `play()`). */
174
316
  setRecordingActive: (active: boolean, armedTrackId?: string | null) => void;
175
317
  }
176
- interface PlaylistDataContextValue {
177
- duration: number;
178
- audioBuffers: AudioBuffer[];
318
+ /**
319
+ * Refs and functions of the multitrack engine (#688). Like
320
+ * `usePlaybackRefs()`, the value never changes.
321
+ */
322
+ interface EngineRefsContextValue {
323
+ playbackStartTimeRef: React.RefObject<number>;
324
+ audioStartPositionRef: React.RefObject<number>;
325
+ /** Returns raw playback time from engine (auto-wraps at loop boundaries). */
326
+ getPlaybackTime: () => number;
327
+ /** Current time of the adapter's AudioContext, in seconds. */
328
+ getAudioContextTime: () => number;
329
+ /**
330
+ * Returns the current adapter scheduler lookahead (Tone ~0.1s, native 0).
331
+ * Use this for any audible-latency calculation that must match the playhead
332
+ * (e.g., recording live-preview peak slicing).
333
+ */
334
+ getLookAhead: () => number;
335
+ /**
336
+ * Returns the adapter AudioContext's output latency in seconds.
337
+ * Use this for audible-latency calculations (e.g., recording live-preview peak slicing).
338
+ */
339
+ getOutputLatency: () => number;
340
+ /** The engine. `current` is null until the first build and during a rebuild. */
341
+ playoutRef: React.RefObject<PlaylistEngine | null>;
342
+ }
343
+ /** Loop region (separate from selection), Audacity-style loop points (#768). */
344
+ interface LoopContextValue {
345
+ isLoopEnabled: boolean;
346
+ loopStart: number;
347
+ loopEnd: number;
348
+ }
349
+ /** The track selected for editing operations (#768). */
350
+ interface SelectedTrackIdContextValue {
351
+ selectedTrackId: string | null;
352
+ }
353
+ /** Whether undo and redo are available (#768). Changes after an edit. */
354
+ interface UndoRedoContextValue {
355
+ canUndo: boolean;
356
+ canRedo: boolean;
357
+ }
358
+ /**
359
+ * What is on the timeline (#768). Changes on every clip operation (a trim
360
+ * once, on release: its moves are a preview only the dragged clip follows,
361
+ * #812) and on a zoom (the peaks are computed per zoom level), so call
362
+ * `usePlaylistTimeline()` only in a component
363
+ * that draws tracks or needs the timeline length during render.
364
+ */
365
+ interface PlaylistTimelineContextValue {
366
+ /**
367
+ * The arrangement's tracks without the clips that are still loading
368
+ * (#812): derived from the arrangement, never written back. Change them
369
+ * through `useArrangement()`.
370
+ */
371
+ tracks: readonly ClipTrack[];
372
+ /**
373
+ * One row per track, in the order of `tracks`. A row also holds the
374
+ * placeholder record (`isPlaceholder: true`) of each clip still loading,
375
+ * which `tracks` does not have: find a record by `clipId`, never by position.
376
+ */
179
377
  peaksDataArray: TrackClipPeaks[];
378
+ /** The end, in seconds, of the loaded audio. */
379
+ duration: number;
380
+ /**
381
+ * False until an engine is attached and the first sources have settled;
382
+ * then false while a later engine is being built.
383
+ */
384
+ isReady: boolean;
385
+ }
386
+ /** Mixer state (#768). Changes on every mute, solo, volume or pan change. */
387
+ interface PlaylistMixerContextValue {
180
388
  trackStates: TrackState[];
181
- tracks: ClipTrack[];
182
- sampleRate: number;
183
- waveHeight: number;
184
- timeScaleHeight: number;
185
- minimumPlaylistHeight: number;
186
- controls: {
187
- show: boolean;
188
- width: number;
189
- };
190
- playoutRef: React__default.RefObject<PlaylistEngine | null>;
191
- samplesPerPixel: number;
192
- timeFormat: TimeFormat;
193
389
  masterVolume: number;
194
- canZoomIn: boolean;
195
- canZoomOut: boolean;
196
- barWidth: number;
197
- barGap: number;
198
- /** Draw bars with pill-shaped rounded caps (radius barWidth/2). */
199
- roundedBars: boolean;
200
- /** Width in pixels of progress bars. Defaults to barWidth + barGap (fills gaps). */
201
- progressBarWidth: number;
202
- /** Whether the playlist has finished loading all tracks */
203
- isReady: boolean;
204
- /** Internal: incremented after every track-reorder drag interaction ends.
205
- * PlaylistVisualization folds this into the track-controls slot `key` to
206
- * force a remount, working around @dnd-kit sortable-plugin DOM corruption
207
- * (see bumpTrackReorderEpoch in PlaylistControlsContextValue). */
208
- trackReorderEpoch: number;
390
+ }
391
+ /** The live track-reorder drag (#768). Changes on every drag-over. */
392
+ interface TrackReorderPreviewContextValue {
209
393
  /** Non-null while a track-reorder drag is live: the dragged track and the
210
394
  * index it would drop at. Both playlist columns derive their display
211
- * layout from it; custom renderTrackControls consumers can read it to
212
- * mirror the preview in their own UI. */
395
+ * layout from it; a track's panel can read it to mirror the preview in
396
+ * its own UI. */
213
397
  trackDragPreview: TrackDragPreview | null;
214
- /** Whether tracks are rendered in mono mode */
215
- mono: boolean;
216
- /** Ref set by useClipDragHandlers during boundary trim drags.
217
- * When true, loadAudio skips engine rebuild — visual updates flow via React state only. */
218
- isDraggingRef: React__default.MutableRefObject<boolean>;
219
- onTracksChange: ((tracks: ClipTrack[]) => void) | undefined;
398
+ /** Internal: incremented after every track-reorder drag interaction ends.
399
+ * The view's track-controls part folds this into each slot's `key` to
400
+ * force a remount, working around @dnd-kit sortable-plugin DOM corruption
401
+ * (see bumpTrackReorderEpoch in EditorControlsContextValue). */
402
+ trackReorderEpoch: number;
403
+ }
404
+ /** The playback speed and its setter (#688). Changes when the speed does. */
405
+ interface PlaybackRateContextValue {
406
+ /** 0.5 to 2. */
407
+ playbackRate: number;
408
+ /** Clamped to 0.5–2. Stable identity. */
409
+ setPlaybackRate: (rate: number) => void;
410
+ }
411
+ /**
412
+ * The one track of a MediaElement player (#688). Changes when the track or the
413
+ * zoom level does, and when the player becomes ready.
414
+ */
415
+ interface MediaElementTrackContextValue {
416
+ /** The length of the track's audio, from its waveform data. Never 0 for a real track. */
417
+ duration: number;
418
+ /**
419
+ * True once the media element has loaded its metadata, false again while a
420
+ * replaced player loads. Use this, not `duration`, as "the player can be used".
421
+ */
422
+ isReady: boolean;
423
+ /** One track with one clip (`[]` when the peak data could not be read). The clip carries the track's fadeIn / fadeOut. */
424
+ peaksDataArray: TrackClipPeaks[];
425
+ fadeIn?: FadeConfig;
426
+ fadeOut?: FadeConfig;
427
+ /** The player. `current` is null until it has been created. */
428
+ playoutRef: React.RefObject<MediaElementPlayout | null>;
429
+ }
430
+ /** `{ isPlaying }`. Re-renders on play, pause and stop. */
431
+ declare const useIsPlaying: () => IsPlayingContextValue;
432
+ /**
433
+ * Refs and functions that never change identity: `currentTimeRef`,
434
+ * `visualTimeRef`, `registerFrameCallback`, `unregisterFrameCallback`. Calling
435
+ * this never re-renders the component. Read `.current` in a handler, an effect
436
+ * or a frame callback; to re-render when the value behind a ref changes, also
437
+ * call the hook that carries it (`useCurrentTime()`, `useIsPlaying()`).
438
+ */
439
+ declare const usePlaybackRefs: () => PlaybackRefsContextValue;
440
+ /**
441
+ * The selected time range. A component that calls this re-renders on every
442
+ * pointer move of a selection drag, so call it in the smallest component that
443
+ * shows the selection.
444
+ */
445
+ declare const useSelection: () => SelectionContextValue;
446
+ /**
447
+ * Where the cursor rests, in seconds. A component that calls this re-renders
448
+ * on every seek, pause and stop, and on every pointer move of a selection drag
449
+ * to the left. The value does not advance during playback: for a live position
450
+ * read `currentTimeRef` from `usePlaybackRefs()` or register a frame callback
451
+ * there.
452
+ */
453
+ declare const useCurrentTime: () => CurrentTimeContextValue;
454
+ /**
455
+ * The id of the annotation that is playing or was last chosen, or `null`. A
456
+ * component that calls this re-renders at every annotation boundary during
457
+ * playback, so call it in the smallest component that shows the active one.
458
+ */
459
+ declare const useActiveAnnotation: () => ActiveAnnotationContextValue;
460
+ /** `{ annotations }`. Re-renders on an annotation edit. */
461
+ declare const useAnnotations: () => AnnotationsContextValue;
462
+ /**
463
+ * `{ editable, linkEndpoints, continuousPlay }`: the one home of the three
464
+ * annotation options, under both providers. Re-renders when one is toggled.
465
+ */
466
+ declare const useAnnotationOptions: () => AnnotationOptionsContextValue;
467
+ /**
468
+ * The actions both providers have: `play`, `pause`, `stop`, `seekTo`,
469
+ * `setSelection`, and the annotation, scroll and time-format setters. The
470
+ * value never changes, so calling this never re-renders.
471
+ */
472
+ declare const usePlaybackControls: () => PlaybackControlsContextValue;
473
+ /**
474
+ * `{ sampleRate, mono, indefinitePlayback }`: what the provider was
475
+ * configured with that a view also reads. Re-renders on a prop change.
476
+ */
477
+ declare const usePlaylistView: () => PlaylistViewContextValue;
478
+ /** `{ timeFormat, isAutomaticScroll }`. Re-renders when the user changes either. */
479
+ declare const usePlaylistSettings: () => PlaylistSettingsContextValue;
480
+ /** `{ samplesPerPixel, canZoomIn, canZoomOut }`. Re-renders on a zoom. */
481
+ declare const usePlaylistZoom: () => PlaylistZoomContextValue;
482
+ /**
483
+ * The arrangement of the nearest WaveformPlaylistProvider: the owner of the
484
+ * tracks, the mix, the undo history and the loading (#812). Change the tracks
485
+ * through it; the provider and the engine follow. The value never changes,
486
+ * so calling this never re-renders.
487
+ */
488
+ declare const useArrangement: () => Arrangement;
489
+ /**
490
+ * The multitrack editor's actions: track mixer and order, zoom, loop, undo,
491
+ * annotation editing settings, recording. WaveformPlaylistProvider only. The
492
+ * value never changes.
493
+ */
494
+ declare const useEditorControls: () => EditorControlsContextValue;
495
+ /**
496
+ * The multitrack engine's refs and clock functions (`playoutRef`,
497
+ * `getPlaybackTime`, `getLookAhead`, …). WaveformPlaylistProvider only. The
498
+ * value never changes.
499
+ */
500
+ declare const useEngineRefs: () => EngineRefsContextValue;
501
+ /** `{ isLoopEnabled, loopStart, loopEnd }`. Re-renders on a loop change. */
502
+ declare const useLoop: () => LoopContextValue;
503
+ /** `{ selectedTrackId }`. Re-renders when another track is selected. */
504
+ declare const useSelectedTrackId: () => SelectedTrackIdContextValue;
505
+ /** `{ canUndo, canRedo }`. Re-renders after an edit. */
506
+ declare const useUndoRedo: () => UndoRedoContextValue;
507
+ /**
508
+ * `{ tracks, peaksDataArray, duration, isReady }`. A component that calls this
509
+ * re-renders on every clip operation (a trim once, on release), on a zoom and
510
+ * when audio arrives for a clip.
511
+ */
512
+ declare const usePlaylistTimeline: () => PlaylistTimelineContextValue;
513
+ /**
514
+ * `{ trackStates, masterVolume }`. A component that calls this re-renders on
515
+ * every mute, solo, volume or pan change (each step of a slider drag).
516
+ */
517
+ declare const usePlaylistMixer: () => PlaylistMixerContextValue;
518
+ /**
519
+ * `{ trackDragPreview, trackReorderEpoch }`. A component that calls this
520
+ * re-renders on every drag-over of a track reorder.
521
+ */
522
+ declare const useTrackReorderPreview: () => TrackReorderPreviewContextValue;
523
+ /** `{ playbackRate, setPlaybackRate }`. MediaElementPlaylistProvider only. */
524
+ declare const usePlaybackRate: () => PlaybackRateContextValue;
525
+ /**
526
+ * `{ duration, isReady, peaksDataArray, fadeIn, fadeOut, playoutRef }`: the
527
+ * one track of a MediaElement player. MediaElementPlaylistProvider only.
528
+ */
529
+ declare const useMediaElementTrack: () => MediaElementTrackContextValue;
530
+
531
+ /**
532
+ * The `annotationList` prop of both providers. The provider holds the three
533
+ * options as state (`useAnnotationOptions()`, and the three setters of
534
+ * `usePlaybackControls()`), and that state follows the prop: when the value
535
+ * of a field changes, the option takes it. Between two changes of the prop a
536
+ * setter (or one of the checkboxes) changes the option; the prop is not told.
537
+ */
538
+ interface AnnotationListProp {
539
+ annotations?: AnnotationData[];
540
+ /** Whether annotations can be edited (text, ids, edges). Default: false. */
541
+ editable?: boolean;
542
+ /** Whether a dragged edge takes the edge it touches along. Default: false. */
543
+ linkEndpoints?: boolean;
544
+ /** Whether playback runs on past the end of an annotation. Default: false. */
545
+ isContinuousPlay?: boolean;
546
+ }
547
+
548
+ /**
549
+ * What one clip is drawn from.
550
+ *
551
+ * `isPlaceholder` is true for the record of a clip whose audio is still loading
552
+ * (`placeholderPeaks`): it is drawn without drag or trim handles, and there is
553
+ * NO clip for it in `usePlaylistTimeline().tracks`, so look it up by `clipId`,
554
+ * never by position. Every other record has it false.
555
+ */
556
+ interface ClipPeaks {
557
+ clipId: string;
558
+ trackName: string;
559
+ peaks: PeakData;
560
+ startSample: number;
561
+ durationSamples: number;
562
+ fadeIn?: Fade;
563
+ fadeOut?: Fade;
564
+ midiNotes?: MidiNoteData[];
565
+ sampleRate?: number;
566
+ offsetSamples?: number;
567
+ /** The clip's linear gain — drawn into the waveform when
568
+ * `<WaveformTracks gainScaled />` is set. */
569
+ gain?: number;
570
+ isPlaceholder: boolean;
571
+ }
572
+ type TrackClipPeaks = ClipPeaks[];
573
+
574
+ interface TrackState {
575
+ name: string;
576
+ muted: boolean;
577
+ soloed: boolean;
578
+ volume: number;
579
+ pan: number;
220
580
  }
221
581
  interface WaveformPlaylistProviderProps {
222
- tracks: ClipTrack[];
223
- timescale?: boolean;
582
+ /**
583
+ * What the provider plays and draws: the tracks, their mix, the undo
584
+ * history and the loading of their audio (#812). Make it with
585
+ * `useCreateArrangement` and change it through its methods (or
586
+ * `useArrangement()` below the provider); the provider follows it. A new
587
+ * object is a new playlist: everything below the provider mounts again.
588
+ */
589
+ arrangement: Arrangement;
590
+ /**
591
+ * Draw and analyse every track as one channel. A provider option, not a
592
+ * view option: the provider computes the peaks with it.
593
+ */
224
594
  mono?: boolean;
225
- waveHeight?: number;
226
595
  samplesPerPixel?: number;
227
596
  zoomLevels?: number[];
228
597
  automaticScroll?: boolean;
229
598
  theme?: Partial<WaveformPlaylistTheme>;
230
- controls?: {
231
- show: boolean;
232
- width: number;
233
- };
234
- annotationList?: {
235
- annotations?: AnnotationData[];
236
- editable?: boolean;
237
- isContinuousPlay?: boolean;
238
- linkEndpoints?: boolean;
239
- controls?: AnnotationAction[];
240
- };
599
+ /**
600
+ * The annotations and the three annotation options (`editable`,
601
+ * `linkEndpoints`, `isContinuousPlay`). The provider follows all four: an
602
+ * option takes a new value of its field, and a setter or checkbox changes
603
+ * it in between.
604
+ */
605
+ annotationList?: AnnotationListProp;
606
+ /** Master effects chain (default Tone.js adapter only). A new function builds a new engine. */
241
607
  effects?: EffectsFunction;
608
+ /**
609
+ * Returns the effects function of a track by id, or `undefined` for none:
610
+ * pass `getTrackEffectsFunction` from `useTrackDynamicEffects()`. Default
611
+ * Tone.js adapter only; with `createAdapter`, give the same function to your
612
+ * own `createToneAdapter({ trackEffects })`.
613
+ *
614
+ * It is called when a track's audio graph is built, with the function passed
615
+ * on the latest render. A new function identity does not rebuild anything,
616
+ * so an inline arrow is fine; a different result for a track that is already
617
+ * built applies the next time that track is built.
618
+ */
619
+ trackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
620
+ /**
621
+ * Called once per mount, the first time an engine is attached and no source
622
+ * of the arrangement is still pending. Read when it is called: a new
623
+ * function identity builds nothing.
624
+ */
242
625
  onReady?: () => void;
243
- /** Called when audio/engine initialization fails (e.g. a missing optional peer,
244
- * a throwing `createAdapter`, or an invalid `zoomLevels`/`samplesPerPixel`). The
626
+ /** Called when the engine or its adapter cannot be built (e.g. a missing
627
+ * optional peer, a throwing `createAdapter`, or an invalid
628
+ * `zoomLevels`/`samplesPerPixel`), and when `onReady` throws. A source that
629
+ * fails to load is not reported here: see `useArrangementSources`. The
245
630
  * provider already logs the error; use this to surface it in your UI. */
246
631
  onError?: (err: Error) => void;
247
- /** @deprecated Use onAnnotationsChange instead */
248
- onAnnotationUpdate?: (annotations: AnnotationData[]) => void;
249
632
  /** Callback when annotations are changed (drag, edit, etc.) */
250
633
  onAnnotationsChange?: (annotations: AnnotationData[]) => void;
251
- /** Width in pixels of waveform bars. Default: 1 */
252
- barWidth?: number;
253
- /** Spacing in pixels between waveform bars. Default: 0 */
254
- barGap?: number;
255
- /** Draw bars with pill-shaped rounded caps (radius barWidth/2). Default: false */
256
- roundedBars?: boolean;
257
- /** Width in pixels of progress bars. Default: barWidth + barGap (fills gaps). */
258
- progressBarWidth?: number;
259
- /** Callback when engine clip operations (move, trim, split) change tracks.
260
- * The provider calls this so the parent can update its tracks state without
261
- * triggering a full engine rebuild.
262
- *
263
- * **Important:** The parent must pass the received `tracks` reference back as
264
- * the `tracks` prop (i.e. `setState(tracks)`). The provider uses reference
265
- * identity (`tracks === engineTracksRef.current`) to detect engine-originated
266
- * updates and skip the expensive `loadAudio` rebuild. */
267
- onTracksChange?: (tracks: ClipTrack[]) => void;
268
634
  /** SoundFont cache for sample-based MIDI playback. When provided, MIDI clips
269
635
  * use SoundFont samples instead of PolySynth synthesis. */
270
636
  soundFontCache?: SoundFontCache;
271
- /** When true, tracks render visually but the engine build is deferred.
272
- * Use this during progressive loading to avoid rebuilding the engine for
273
- * each track — flip to false when all tracks are ready for a single build. */
274
- deferEngineRebuild?: boolean;
275
637
  /** Disable the automatic stop when the cursor reaches the end of the
276
638
  * longest track — the transport rolls until an explicit stop/pause
277
- * (DAW-style). Implies the fillViewport layout. Recording sessions
278
- * suppress the auto-stop automatically, so most recording UIs don't
279
- * need this. */
639
+ * (DAW-style). The multitrack view then draws the timeline as wide as its
640
+ * container, as `<WaveformViewOptions fillViewport>` does. Recording
641
+ * sessions suppress the auto-stop automatically, so most recording UIs
642
+ * don't need this. A provider option, not a view option: the animation
643
+ * loop and `seekTo` follow it. */
280
644
  indefinitePlayback?: boolean;
281
- /** Extend the timeline (background + timescale) to fill the visible scroll
282
- * container even when the audio is shorter. Layout only. Recording UIs
283
- * typically want this so the empty timeline doesn't collapse to the audio
284
- * width. */
285
- fillViewport?: boolean;
286
645
  /** Desired AudioContext sample rate. Creates a cross-browser AudioContext at
287
646
  * this rate via standardized-audio-context. Pre-computed peaks (.dat files)
288
647
  * render instantly when they match. On mismatch, falls back to worker. */
@@ -290,24 +649,12 @@ interface WaveformPlaylistProviderProps {
290
649
  /** Factory for a custom PlayoutAdapter. When omitted, the Tone.js engine
291
650
  * (@waveform-playlist/playout) is dynamically imported — so a custom adapter
292
651
  * lets a consumer use neither @waveform-playlist/playout nor tone. Called once
293
- * per engine rebuild; the provider owns and disposes the returned instance.
294
- * Pass a stable reference (module-level or useCallback) — it is read directly
295
- * inside the curated `loadAudio` effect, not via its dependency array. */
652
+ * per engine build; the provider owns and disposes the returned instance.
653
+ * Read when an engine is built: a new function identity builds nothing. */
296
654
  createAdapter?: () => PlayoutAdapter;
297
655
  children: ReactNode;
298
656
  }
299
- declare const WaveformPlaylistProvider: React__default.FC<WaveformPlaylistProviderProps>;
300
- declare const usePlaybackAnimation: () => PlaybackAnimationContextValue;
301
- declare const usePlaylistState: () => PlaylistStateContextValue;
302
- declare const usePlaylistControls: () => PlaylistControlsContextValue;
303
- declare const usePlaylistData: () => PlaylistDataContextValue;
304
- /**
305
- * Like {@link usePlaylistData} but returns `null` instead of throwing when there
306
- * is no WaveformPlaylistProvider ancestor. Use this in hooks/components that may
307
- * also run in the MediaElement path (MediaElementPlaylistProvider), where the
308
- * WebAudio playlist context is absent.
309
- */
310
- declare const usePlaylistDataOptional: () => PlaylistDataContextValue | null;
657
+ declare const WaveformPlaylistProvider: react__default.FC<WaveformPlaylistProviderProps>;
311
658
 
312
659
  interface MediaElementTrackConfig {
313
660
  /** Audio source URL or Blob URL */
@@ -321,61 +668,15 @@ interface MediaElementTrackConfig {
321
668
  /** Fade out configuration (requires audioContext on provider) */
322
669
  fadeOut?: FadeConfig;
323
670
  }
324
- interface MediaElementAnimationContextValue {
325
- isPlaying: boolean;
326
- currentTime: number;
327
- currentTimeRef: React__default.RefObject<number>;
328
- }
329
- interface MediaElementStateContextValue {
330
- continuousPlay: boolean;
331
- annotations: AnnotationData[];
332
- activeAnnotationId: string | null;
333
- playbackRate: number;
334
- isAutomaticScroll: boolean;
335
- }
336
- interface MediaElementControlsContextValue {
337
- play: (startTime?: number) => void;
338
- pause: () => void;
339
- stop: () => void;
340
- seekTo: (time: number) => void;
341
- setPlaybackRate: (rate: number) => void;
342
- setContinuousPlay: (enabled: boolean) => void;
343
- setAnnotations: React__default.Dispatch<React__default.SetStateAction<AnnotationData[]>>;
344
- setActiveAnnotationId: (id: string | null) => void;
345
- setAutomaticScroll: (enabled: boolean) => void;
346
- setScrollContainer: (element: HTMLDivElement | null) => void;
347
- scrollContainerRef: React__default.RefObject<HTMLDivElement | null>;
348
- }
349
- interface MediaElementDataContextValue {
350
- duration: number;
351
- peaksDataArray: TrackClipPeaks[];
352
- sampleRate: number;
353
- waveHeight: number;
354
- timeScaleHeight: number;
355
- samplesPerPixel: number;
356
- playoutRef: React__default.RefObject<MediaElementPlayout | null>;
357
- controls: {
358
- show: boolean;
359
- width: number;
360
- };
361
- barWidth: number;
362
- barGap: number;
363
- /** Draw bars with pill-shaped rounded caps (radius barWidth/2). */
364
- roundedBars: boolean;
365
- progressBarWidth: number;
366
- fadeIn?: FadeConfig;
367
- fadeOut?: FadeConfig;
368
- }
369
671
  interface MediaElementPlaylistProviderProps {
370
672
  /** Single track configuration with source URL and waveform data */
371
673
  track: MediaElementTrackConfig;
372
674
  /** Initial samples per pixel (zoom level) */
373
675
  samplesPerPixel?: number;
374
- /** Height of each waveform track */
375
- waveHeight?: number;
376
- /** Show timescale */
377
- timescale?: boolean;
378
- /** Initial playback rate (0.5 to 2.0) */
676
+ /** Playback rate (default 1). Not clamped by the provider: the bundled
677
+ * engine is created at it as given, while `setPlaybackRate` clamps to
678
+ * 0.5–2. The user's `setPlaybackRate` overrides it; a later change of this
679
+ * prop overrides that, until they choose again. */
379
680
  playbackRate?: number;
380
681
  /** Whether to preserve pitch when changing playback rate (default: true).
381
682
  * Set to false when using an external pitch processor like SoundTouch. */
@@ -384,24 +685,13 @@ interface MediaElementPlaylistProviderProps {
384
685
  automaticScroll?: boolean;
385
686
  /** Theme configuration */
386
687
  theme?: Partial<WaveformPlaylistTheme>;
387
- /** Track controls configuration */
388
- controls?: {
389
- show: boolean;
390
- width: number;
391
- };
392
- /** Annotations */
393
- annotationList?: {
394
- annotations?: AnnotationData[];
395
- isContinuousPlay?: boolean;
396
- };
397
- /** Width of waveform bars */
398
- barWidth?: number;
399
- /** Gap between waveform bars */
400
- barGap?: number;
401
- /** Draw bars with pill-shaped rounded caps (radius barWidth/2). Default: false */
402
- roundedBars?: boolean;
403
- /** Width of progress bars */
404
- progressBarWidth?: number;
688
+ /**
689
+ * The annotations and the three annotation options (`editable`,
690
+ * `linkEndpoints`, `isContinuousPlay`). The provider follows all four: an
691
+ * option takes a new value of its field, and a setter or checkbox changes
692
+ * it in between.
693
+ */
694
+ annotationList?: AnnotationListProp;
405
695
  /** Callback when annotations are changed (drag, edit, etc.) */
406
696
  onAnnotationsChange?: (annotations: AnnotationData[]) => void;
407
697
  /**
@@ -414,14 +704,18 @@ interface MediaElementPlaylistProviderProps {
414
704
  * createMediaElementSource() is called once per audio element.
415
705
  */
416
706
  audioContext?: AudioContext;
417
- /** Callback when audio is ready */
707
+ /** Called when the media element has loaded its metadata (it knows its
708
+ * length and can be played and seeked), once per player. */
418
709
  onReady?: () => void;
419
710
  /** Called when playout initialization fails (e.g. a missing optional peer,
420
- * a throwing `createPlayout`, or an `addTrack` error). The provider already
421
- * logs the error; use this to surface it in your UI. */
711
+ * a throwing `createPlayout`, or an `addTrack` error) and when the media
712
+ * element reports an error (a source that cannot be loaded or decoded).
713
+ * The provider already logs the error; use this to surface it in your UI. */
422
714
  onError?: (err: Error) => void;
423
715
  /** Factory for a custom MediaElement playout. When omitted, the bundled engine
424
- * (@waveform-playlist/media-element-playout) is dynamically imported. */
716
+ * (@waveform-playlist/media-element-playout) is dynamically imported. A
717
+ * custom playout must implement `on()` and emit `loadedmetadata`: the
718
+ * provider is not ready until it does. */
425
719
  createPlayout?: () => MediaElementPlayout;
426
720
  children: ReactNode;
427
721
  }
@@ -441,11 +735,7 @@ interface MediaElementPlaylistProviderProps {
441
735
  *
442
736
  * For multi-track editing, use WaveformPlaylistProvider instead.
443
737
  */
444
- declare const MediaElementPlaylistProvider: React__default.FC<MediaElementPlaylistProviderProps>;
445
- declare const useMediaElementAnimation: () => MediaElementAnimationContextValue;
446
- declare const useMediaElementState: () => MediaElementStateContextValue;
447
- declare const useMediaElementControls: () => MediaElementControlsContextValue;
448
- declare const useMediaElementData: () => MediaElementDataContextValue;
738
+ declare const MediaElementPlaylistProvider: react__default.FC<MediaElementPlaylistProviderProps>;
449
739
 
450
740
  interface TimeFormatControls {
451
741
  timeFormat: TimeFormat;
@@ -512,111 +802,80 @@ interface MasterVolumeControls {
512
802
  * setMasterVolume delegates to the engine. State is mirrored back from
513
803
  * the engine via onEngineState(), which the provider's statechange
514
804
  * handler calls on every engine event.
515
- */
516
- declare function useMasterVolume({ engineRef, initialVolume, }: UseMasterVolumeProps): MasterVolumeControls & {
517
- onEngineState: (state: EngineState) => void;
518
- };
519
-
520
- interface UseClipDragHandlersOptions {
521
- tracks: ClipTrack[];
522
- onTracksChange: (tracks: ClipTrack[]) => void;
523
- samplesPerPixel: number;
524
- engineRef: React__default.RefObject<PlaylistEngine | null>;
525
- /** Ref toggled during boundary trim drags. When true, the provider's loadAudio
526
- * skips engine rebuilds so engine keeps original clip positions. On drag end,
527
- * engine.trimClip() commits the final delta. Obtain from usePlaylistData(). */
528
- isDraggingRef: React__default.MutableRefObject<boolean>;
529
- /** Optional function that snaps a sample position to the nearest grid position.
530
- * Used for boundary trim snapping (move snapping is handled by the SnapToGridModifier). */
531
- snapSamplePosition?: (samplePosition: number) => number;
532
- }
533
- /**
534
- * Custom hook for handling clip drag operations (movement and trimming)
535
- *
536
- * Provides drag handlers for use with @dnd-kit/react DragDropProvider.
537
- * Handles both clip movement (dragging entire clips) and boundary trimming (adjusting clip edges).
538
- *
539
- * Collision detection for clip moves is handled by `ClipCollisionModifier` (passed to DragDropProvider).
540
- *
541
- * **Move:** `onDragEnd` delegates to `engine.moveClip()` in one shot.
542
- *
543
- * **Trim:** `onDragMove` updates React state per-frame via `onTracksChange` for smooth
544
- * visual feedback (using cumulative deltas from the original clip snapshot). `isDraggingRef`
545
- * prevents loadAudio from rebuilding the engine during the drag, so the engine keeps the
546
- * original clip positions. On drag end, `engine.trimClip()` commits the final delta.
547
- *
548
- * @example
549
- * ```tsx
550
- * const { onDragStart, onDragMove, onDragEnd } = useClipDragHandlers({
551
- * tracks,
552
- * onTracksChange: setTracks,
553
- * samplesPerPixel,
554
- * engineRef: playoutRef,
555
- * isDraggingRef,
556
- * });
557
- *
558
- * return (
559
- * <DragDropProvider
560
- * onDragStart={onDragStart}
561
- * onDragMove={onDragMove}
562
- * onDragEnd={onDragEnd}
563
- * modifiers={[RestrictToHorizontalAxis, ClipCollisionModifier.configure({ tracks, samplesPerPixel })]}
564
- * >
565
- * <Waveform showClipHeaders={true} />
566
- * </DragDropProvider>
567
- * );
568
- * ```
569
- */
570
- declare function useClipDragHandlers({ tracks, onTracksChange, samplesPerPixel, engineRef, isDraggingRef, snapSamplePosition, }: UseClipDragHandlersOptions): {
571
- onDragStart: (event: DragStartEvent) => void;
572
- onDragMove: (event: DragMoveEvent) => void;
573
- onDragEnd: (event: DragEndEvent) => void;
805
+ */
806
+ declare function useMasterVolume({ engineRef, initialVolume, }: UseMasterVolumeProps): MasterVolumeControls & {
807
+ onEngineState: (state: EngineState) => void;
574
808
  };
575
809
 
576
- interface UseAnnotationDragHandlersOptions {
577
- annotations: AnnotationData[];
578
- onAnnotationsChange: (annotations: AnnotationData[]) => void;
810
+ interface UseClipDragHandlersOptions {
579
811
  samplesPerPixel: number;
580
- /** Sample rate for pixel-to-time conversion. Providers pass the real rate from
581
- * context; defaults to 48000 (the engine default) for out-of-provider usage. */
582
- sampleRate?: number;
583
- duration: number;
584
- linkEndpoints: boolean;
812
+ /** Optional function that snaps a sample position to the nearest grid position.
813
+ * Used for boundary trim snapping (move snapping is handled by the SnapToGridModifier). */
814
+ snapSamplePosition?: (samplePosition: number) => number;
585
815
  }
586
816
  /**
587
- * Custom hook for handling annotation drag operations (boundary trimming)
817
+ * Custom hook for handling clip drag operations (movement and trimming)
588
818
  *
589
819
  * Provides drag handlers for use with @dnd-kit/react DragDropProvider.
590
- * Handles annotation boundary resizing with linked endpoints support.
820
+ * Handles both clip movement (dragging entire clips) and boundary trimming (adjusting clip edges).
821
+ *
822
+ * Collision detection for clip moves is handled by `ClipCollisionModifier` (passed to DragDropProvider).
823
+ *
824
+ * It changes the provider's arrangement (`useArrangement()`), so it works
825
+ * whether an engine is attached or not, and throws outside
826
+ * `WaveformPlaylistProvider`.
827
+ *
828
+ * **Move:** `onDragStart` notes the clip and its track by id; `onDragEnd`
829
+ * makes one `arrangement.moveClip()` of that clip on that track, also when
830
+ * the tracks were reordered or the row's clips changed meanwhile.
831
+ *
832
+ * **Trim (#812):** each `onDragMove` publishes where the clip would be to the
833
+ * provider's trim preview, which only the dragged clip's view follows; the
834
+ * tracks are not changed. Each move is computed from the clip as it was when
835
+ * the drag started, constrained as the release will be
836
+ * (`arrangement.constrainTrimDelta`), so the preview shows what the release
837
+ * commits. `onDragEnd` makes one `arrangement.trimClip()` with the delta of
838
+ * the last preview and clears the preview in the same render; Escape clears
839
+ * the preview only. Each of `moveClip` and `trimClip` is one undo step.
840
+ *
841
+ * The returned handlers read the tracks from the arrangement when they run,
842
+ * so they keep their identity and are safe to pass straight to
843
+ * `DragDropProvider`.
591
844
  *
592
845
  * @example
593
846
  * ```tsx
594
- * const { onDragStart, onDragMove, onDragEnd } = useAnnotationDragHandlers({
595
- * annotations,
596
- * onAnnotationsChange: setAnnotations,
597
- * samplesPerPixel,
598
- * duration,
599
- * linkEndpoints,
600
- * });
847
+ * const { tracks } = usePlaylistTimeline();
848
+ * const { onDragStart, onDragMove, onDragEnd } = useClipDragHandlers({ samplesPerPixel });
601
849
  *
602
850
  * return (
603
851
  * <DragDropProvider
604
852
  * onDragStart={onDragStart}
605
853
  * onDragMove={onDragMove}
606
854
  * onDragEnd={onDragEnd}
607
- * modifiers={[RestrictToHorizontalAxis]}
855
+ * modifiers={[RestrictToHorizontalAxis, ClipCollisionModifier.configure({ tracks, samplesPerPixel })]}
608
856
  * >
609
- * {renderAnnotations()}
857
+ * <WaveformEditor />
610
858
  * </DragDropProvider>
611
859
  * );
612
860
  * ```
613
861
  */
614
- declare function useAnnotationDragHandlers({ annotations, onAnnotationsChange, samplesPerPixel, sampleRate, duration, linkEndpoints, }: UseAnnotationDragHandlersOptions): {
862
+ declare function useClipDragHandlers({ samplesPerPixel, snapSamplePosition, }: UseClipDragHandlersOptions): {
615
863
  onDragStart: (event: DragStartEvent) => void;
616
864
  onDragMove: (event: DragMoveEvent) => void;
617
865
  onDragEnd: (event: DragEndEvent) => void;
618
866
  };
619
867
 
868
+ /**
869
+ * The annotations to draw: the provider's, or while an edge is being dragged
870
+ * with a preview (`useAnnotationDragHandlers({ preview })`), the annotations
871
+ * as the drag would leave them.
872
+ *
873
+ * Call it in the component that draws annotations (a custom list or row of
874
+ * boxes), with `annotationPreview` from the provider's controls. Only that
875
+ * component then re-renders per pointer move of the drag.
876
+ */
877
+ declare function useAnnotationsWithPreview(annotations: AnnotationData[], preview: AnnotationPreviewHandle): AnnotationData[];
878
+
620
879
  /**
621
880
  * Hook for configuring @dnd-kit sensors for clip dragging
622
881
  *
@@ -668,31 +927,26 @@ interface DragSensorOptions {
668
927
  declare function useDragSensors(options?: DragSensorOptions): (typeof PointerSensor | PluginDescriptor<any, any, any>)[];
669
928
 
670
929
  interface UseClipSplittingOptions {
671
- tracks: ClipTrack[];
672
930
  samplesPerPixel: number;
673
- engineRef: React__default.RefObject<PlaylistEngine | null>;
674
931
  }
675
932
  interface UseClipSplittingResult {
676
933
  splitClipAtPlayhead: () => boolean;
677
- splitClipAt: (trackIndex: number, clipIndex: number, splitTime: number) => boolean;
934
+ splitClipAt: (trackId: string, clipId: string, splitTime: number) => boolean;
678
935
  }
679
936
  /**
680
937
  * Hook for splitting clips at the playhead or at a specific time
681
938
  *
682
- * Splitting delegates to `engine.splitClip()` — the engine handles clip creation,
683
- * adapter sync, and emits statechange. The provider's statechange handler propagates
684
- * the updated tracks to the parent via `onTracksChange`.
939
+ * Splitting is one `arrangement.splitClip()` on the provider's arrangement
940
+ * (`useArrangement()`): an undo step, engine or not; the engine and the view
941
+ * follow the arrangement. Throws outside `WaveformPlaylistProvider`.
685
942
  *
686
943
  * @param options - Configuration options
687
944
  * @returns Object with split functions
688
945
  *
689
946
  * @example
690
947
  * ```tsx
691
- * const { splitClipAtPlayhead } = useClipSplitting({
692
- * tracks,
693
- * samplesPerPixel,
694
- * engineRef: playoutRef,
695
- * });
948
+ * const { samplesPerPixel } = usePlaylistZoom();
949
+ * const { splitClipAtPlayhead } = useClipSplitting({ samplesPerPixel });
696
950
  *
697
951
  * // In keyboard handler
698
952
  * const handleKeyPress = (e: KeyboardEvent) => {
@@ -856,33 +1110,67 @@ declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId
856
1110
  playActiveAnnotation: () => void;
857
1111
  };
858
1112
 
859
- declare const PlayButton: React__default.FC<{
1113
+ interface UseCreateArrangementOptions {
1114
+ /** How a clip's source is fetched and decoded. Nothing is fetched until a decode context is attached. */
1115
+ loadSource?: LoadSource;
1116
+ /** How many undo steps the arrangement keeps. */
1117
+ undoLimit?: number;
1118
+ }
1119
+ /**
1120
+ * Create the `Arrangement` that owns a multitrack editor's tracks, one per
1121
+ * component instance. Returns the same arrangement on every render.
1122
+ *
1123
+ * `init` and `options` are read once, on the first render; a later render
1124
+ * with other values changes nothing. An initializer that throws (a track
1125
+ * with a wrong kind, a duplicate track id, two clips with one id) throws out
1126
+ * of the render, to the nearest error boundary.
1127
+ *
1128
+ * Under StrictMode React calls the initializer twice and keeps one result;
1129
+ * neither arrangement fetches anything, because none has a decode context.
1130
+ */
1131
+ declare function useCreateArrangement(init?: () => readonly ArrangementTrack[], options?: UseCreateArrangementOptions): Arrangement;
1132
+
1133
+ /**
1134
+ * The tracks of `arrangement`, loaded and loading clips alike. The same
1135
+ * array until the tracks change: a mix change (volume, mute, solo, pan)
1136
+ * does not re-render. Never write to what it returns.
1137
+ */
1138
+ declare function useArrangementTracks(arrangement: Arrangement): readonly ArrangementTrack[];
1139
+
1140
+ /**
1141
+ * The audio sources the clips of `arrangement` name, and whether each is
1142
+ * pending, loaded or failed. The same object until a source settles or the
1143
+ * set of sources changes.
1144
+ */
1145
+ declare function useArrangementSources(arrangement: Arrangement): ArrangementSourcesValue;
1146
+
1147
+ declare const PlayButton: react__default.FC<{
860
1148
  className?: string;
861
1149
  }>;
862
- declare const PauseButton: React__default.FC<{
1150
+ declare const PauseButton: react__default.FC<{
863
1151
  className?: string;
864
1152
  }>;
865
- declare const StopButton: React__default.FC<{
1153
+ declare const StopButton: react__default.FC<{
866
1154
  className?: string;
867
1155
  }>;
868
- declare const RewindButton: React__default.FC<{
1156
+ declare const RewindButton: react__default.FC<{
869
1157
  className?: string;
870
1158
  }>;
871
- declare const FastForwardButton: React__default.FC<{
1159
+ declare const FastForwardButton: react__default.FC<{
872
1160
  className?: string;
873
1161
  }>;
874
- declare const SkipBackwardButton: React__default.FC<{
1162
+ declare const SkipBackwardButton: react__default.FC<{
875
1163
  skipAmount?: number;
876
1164
  className?: string;
877
1165
  }>;
878
- declare const SkipForwardButton: React__default.FC<{
1166
+ declare const SkipForwardButton: react__default.FC<{
879
1167
  skipAmount?: number;
880
1168
  className?: string;
881
1169
  }>;
882
- declare const LoopButton: React__default.FC<{
1170
+ declare const LoopButton: react__default.FC<{
883
1171
  className?: string;
884
1172
  }>;
885
- declare const SetLoopRegionButton: React__default.FC<{
1173
+ declare const SetLoopRegionButton: react__default.FC<{
886
1174
  className?: string;
887
1175
  }>;
888
1176
  interface ClearAllButtonProps {
@@ -890,13 +1178,13 @@ interface ClearAllButtonProps {
890
1178
  label?: string;
891
1179
  className?: string;
892
1180
  }
893
- declare const ClearAllButton: React__default.FC<ClearAllButtonProps>;
1181
+ declare const ClearAllButton: react__default.FC<ClearAllButtonProps>;
894
1182
 
895
- declare const ZoomInButton: React__default.FC<{
1183
+ declare const ZoomInButton: react__default.FC<{
896
1184
  className?: string;
897
1185
  disabled?: boolean;
898
1186
  }>;
899
- declare const ZoomOutButton: React__default.FC<{
1187
+ declare const ZoomOutButton: react__default.FC<{
900
1188
  className?: string;
901
1189
  disabled?: boolean;
902
1190
  }>;
@@ -904,13 +1192,13 @@ declare const ZoomOutButton: React__default.FC<{
904
1192
  /**
905
1193
  * Master volume control that uses the playlist context
906
1194
  */
907
- declare const MasterVolumeControl: React__default.FC<{
1195
+ declare const MasterVolumeControl: react__default.FC<{
908
1196
  className?: string;
909
1197
  }>;
910
1198
  /**
911
1199
  * Time format selector that uses the playlist context
912
1200
  */
913
- declare const TimeFormatSelect: React__default.FC<{
1201
+ declare const TimeFormatSelect: react__default.FC<{
914
1202
  className?: string;
915
1203
  }>;
916
1204
  /**
@@ -918,339 +1206,465 @@ declare const TimeFormatSelect: React__default.FC<{
918
1206
  * Updates via the shared animation frame registry — no own rAF loop.
919
1207
  * Direct DOM manipulation avoids React re-renders.
920
1208
  */
921
- declare const AudioPosition: React__default.FC<{
1209
+ declare const AudioPosition: react__default.FC<{
1210
+ className?: string;
1211
+ }>;
1212
+ /**
1213
+ * Playback speed dropdown. MediaElementPlaylistProvider only (#688).
1214
+ * `rates` lists the speeds to offer (default 0.5× to 2×).
1215
+ */
1216
+ declare const PlaybackRateSelect: react__default.FC<{
1217
+ rates?: readonly number[];
922
1218
  className?: string;
923
1219
  }>;
924
1220
  /**
925
- * Selection time inputs that use the playlist context
1221
+ * Selection time inputs bound to the provider: its selection, and its time
1222
+ * format (the one `TimeFormatSelect` and `setTimeFormat()` set).
926
1223
  */
927
- declare const SelectionTimeInputs: React__default.FC<{
1224
+ declare const SelectionTimeInputs: react__default.FC<{
928
1225
  className?: string;
929
1226
  }>;
930
1227
  /**
931
1228
  * Automatic scroll checkbox that uses the playlist context
932
1229
  * Uses split contexts to avoid re-rendering during animation
933
1230
  */
934
- declare const AutomaticScrollCheckbox: React__default.FC<{
1231
+ declare const AutomaticScrollCheckbox: react__default.FC<{
935
1232
  className?: string;
936
1233
  }>;
937
1234
 
938
1235
  /**
939
- * Continuous play checkbox that uses the playlist context.
940
- * Must be used within <AnnotationProvider>.
1236
+ * The props of the two ready-made multitrack views: `className`. What the
1237
+ * view is made of is not an option here, and neither are the options of its
1238
+ * parts (#686 moved the annotation ones onto `WaveformAnnotationBoxes` and
1239
+ * `AnnotationList`). For anything else, compose the parts inside
1240
+ * `WaveformRoot`.
941
1241
  */
942
- declare const ContinuousPlayCheckbox: React__default.FC<{
1242
+ interface WaveformProps {
943
1243
  className?: string;
944
- }>;
1244
+ }
1245
+ type WaveformEditorProps = WaveformProps;
945
1246
  /**
946
- * Link endpoints checkbox that uses the playlist context.
947
- * Must be used within <AnnotationProvider>.
1247
+ * The multitrack view, ready-made: the timescale, the loop region, the track
1248
+ * controls (200 px), the tracks, the annotation boxes, the selection and the
1249
+ * playhead, with the annotation text list below when there are annotations.
1250
+ *
1251
+ * It is a composition of the public parts with no options for them. To leave
1252
+ * a part out, give one an option (`renderTick`, a column width, a label for
1253
+ * the annotation boxes, a height or actions for the annotation list), compose the
1254
+ * panel of a track (a remove button, a reorder grip, your own control) or
1255
+ * add your own element, write the composition yourself:
1256
+ *
1257
+ * ```tsx
1258
+ * <WaveformRoot>
1259
+ * <WaveformTimescale />
1260
+ * <WaveformLoopRegion />
1261
+ * <WaveformTrackControls />
1262
+ * <WaveformTracks />
1263
+ * <WaveformAnnotationBoxes />
1264
+ * <WaveformSelection />
1265
+ * <WaveformPlayhead />
1266
+ * </WaveformRoot>
1267
+ * <AnnotationList />
1268
+ * ```
948
1269
  */
949
- declare const LinkEndpointsCheckbox: React__default.FC<{
950
- className?: string;
951
- }>;
1270
+ declare const Waveform: react__default.FC<WaveformProps>;
952
1271
  /**
953
- * Editable annotations checkbox that uses the playlist context.
954
- * Must be used within <AnnotationProvider>.
1272
+ * `Waveform` with clip headers and fade curves: `<WaveformTracks>` holds
1273
+ * `<WaveformClipHeaders />` and `<WaveformFades />`. Inside a
1274
+ * `ClipInteractionProvider` the header is what a clip is dragged by, and the
1275
+ * trim handles come with it.
955
1276
  */
956
- declare const EditableCheckbox: React__default.FC<{
957
- className?: string;
958
- }>;
1277
+ declare const WaveformEditor: react__default.FC<WaveformEditorProps>;
1278
+
959
1279
  /**
960
- * Download annotations button that uses the playlist context.
961
- * Must be used within <AnnotationProvider>.
1280
+ * `className`. What the view is made of is not an option here, and neither
1281
+ * are the options of its parts: compose the parts inside
1282
+ * `MediaElementWaveformRoot` for anything else.
962
1283
  */
963
- declare const DownloadAnnotationsButton: React__default.FC<{
964
- filename?: string;
1284
+ interface MediaElementWaveformProps {
965
1285
  className?: string;
966
- }>;
967
-
1286
+ }
968
1287
  /**
969
- * Shared annotation types used across Waveform components
1288
+ * The view of `MediaElementPlaylistProvider`, ready-made: the timescale, the
1289
+ * one track, the annotation boxes, the selection and the playhead, with the
1290
+ * annotation text list below when there are annotations.
1291
+ *
1292
+ * It is a composition of the public parts with no options for them. To leave
1293
+ * the timescale out, show fades, use your own playhead or give the
1294
+ * annotation boxes or the annotation list an option, write the composition
1295
+ * yourself:
1296
+ *
1297
+ * ```tsx
1298
+ * <MediaElementWaveformRoot>
1299
+ * <WaveformTimescale />
1300
+ * <WaveformTracks>
1301
+ * <WaveformFades />
1302
+ * </WaveformTracks>
1303
+ * <WaveformAnnotationBoxes />
1304
+ * <WaveformSelection />
1305
+ * <WaveformPlayhead renderPlayhead={…} />
1306
+ * </MediaElementWaveformRoot>
1307
+ * <AnnotationList />
1308
+ * ```
970
1309
  */
1310
+ declare const MediaElementWaveform: react__default.FC<MediaElementWaveformProps>;
971
1311
 
1312
+ interface WaveformRootProps {
1313
+ className?: string;
1314
+ /** The parts (see waveformParts.tsx), and anything else to draw over the tracks. */
1315
+ children?: ReactNode;
1316
+ }
972
1317
  /**
973
- * Custom function to generate the label shown on annotation boxes in the waveform.
974
- * Receives the annotation data and its index in the list, returns a string label.
975
- * Default behavior: displays annotation.id
1318
+ * The root of the multitrack view (#685), exported from the package.
1319
+ *
1320
+ * It owns what the parts share and nothing they draw: the size of the
1321
+ * timeline, the vertical layout of the rows (one layout for the tracks and
1322
+ * the controls column, so they cannot disagree), what a press on the tracks
1323
+ * does beyond the selection drag, and the spectrogram settings modal. The
1324
+ * scrolling frame (`Playlist`), the selection drag and the context for the
1325
+ * drawing primitives are shared with the MediaElement root: `useWaveformFrame`.
1326
+ *
1327
+ * It renders on its own state (a drag in progress, the settings modal, the
1328
+ * measured container width), on play and stop (its selection drag reads
1329
+ * `isPlaying`), on every change of the timeline, the zoom, the view settings,
1330
+ * the reorder preview, the spectrogram integration and the theme, on a
1331
+ * recording layout step, on a 10-second step of a trim dragged past the end
1332
+ * of the timeline, and whenever the component that composes it renders.
1333
+ * None of that renders a part by itself: the
1334
+ * parts are `children`, whose elements are the same as on the previous render
1335
+ * unless the component that composed them rendered too, and each part follows
1336
+ * the two layout values below and the provider contexts it reads. Keep it so:
1337
+ * both values are memoized, and everything in them must keep its identity
1338
+ * across a render that did not change it.
976
1339
  */
977
- type GetAnnotationBoxLabelFn = (annotation: AnnotationData, index: number) => string;
1340
+ declare const WaveformRoot: react__default.FC<WaveformRootProps>;
1341
+
1342
+ interface MediaElementWaveformRootProps {
1343
+ className?: string;
1344
+ /** The parts, and anything else to draw over the track. */
1345
+ children?: ReactNode;
1346
+ }
978
1347
  /**
979
- * Callback when annotations are updated (e.g., boundaries dragged).
980
- * Called with the full updated annotations array.
1348
+ * The root of the MediaElement view (#685), exported from the package.
1349
+ *
1350
+ * The counterpart of `WaveformRoot` for `MediaElementPlaylistProvider`: it
1351
+ * works out what only this provider knows (the timeline is as long as the
1352
+ * audio; there is one row, empty when its peaks could not be extracted) and hands it to
1353
+ * the shared frame. The parts are the multitrack view's.
1354
+ *
1355
+ * It renders on what the frame follows (a drag in progress, play and stop, a
1356
+ * zoom, the view settings, the theme), when the track or its peaks change, when the
1357
+ * player becomes ready, and whenever the component that composes it renders.
1358
+ * The root's render never renders a part; a part renders when a value it
1359
+ * reads changes. See `WaveformRoot`.
1360
+ *
1361
+ * No controls column is drawn: there is no controls part for this provider.
981
1362
  */
982
- type OnAnnotationUpdateFn = (annotations: AnnotationData[]) => void;
1363
+ declare const MediaElementWaveformRoot: react__default.FC<MediaElementWaveformRootProps>;
983
1364
 
984
- interface WaveformProps {
985
- renderTrackControls?: (trackIndex: number) => ReactNode;
986
- /** Custom render function for timescale tick labels. `label` is a formatted string
987
- * (bar/beat notation like "2.3" in beats mode, or "m:ss" in temporal mode). */
988
- renderTick?: (label: string, pixelPosition: number) => ReactNode;
989
- /** @deprecated Use `renderTick` instead. */
990
- renderTimestamp?: (timeMs: number, pixelPosition: number) => ReactNode;
991
- /** Custom playhead render function. Receives position (pixels) and color from theme. */
992
- renderPlayhead?: RenderPlayheadFunction;
993
- annotationControls?: AnnotationAction[];
994
- annotationListConfig?: AnnotationActionOptions;
995
- annotationTextHeight?: number;
1365
+ /** Live recording state for the real-time waveform preview. */
1366
+ interface WaveformRecordingState {
1367
+ isRecording: boolean;
1368
+ /** Which track is being recorded into. */
1369
+ trackId: string;
1370
+ /** Where on the timeline the take started. */
1371
+ startSample: number;
996
1372
  /**
997
- * Custom render function for annotation items in the text list.
998
- * Use this to completely customize how each annotation is displayed.
1373
+ * The take's elapsed time and per-channel preview peaks, from
1374
+ * `useRecording` / `useIntegratedRecording`. A source, not values: only the
1375
+ * preview clip follows it frame by frame, so the component that renders
1376
+ * `<Waveform>` does not re-render while recording.
999
1377
  */
1000
- renderAnnotationItem?: (props: RenderAnnotationItemProps) => ReactNode;
1378
+ progress: RecordingProgressSource;
1379
+ /** Bit depth of the peak values. */
1380
+ bits: 8 | 16;
1001
1381
  /**
1002
- * Custom function to generate the label shown on annotation boxes in the waveform.
1003
- * Receives the annotation data and its index, returns a string label.
1004
- * Default: annotation.id
1382
+ * Latency offset (seconds) to skip in the live preview. Absolute replacement
1383
+ * for the auto-computed outputLatency + lookAhead value. Pass the same value
1384
+ * given to useIntegratedRecording so preview and finalized clip match.
1005
1385
  */
1006
- getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
1007
- /** Where to position the active annotation when auto-scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */
1008
- scrollActivePosition?: ScrollLogicalPosition;
1009
- /** Which scrollable containers to scroll: 'nearest' (only the annotation list) or 'all' (including viewport). Defaults to 'nearest'. */
1010
- scrollActiveContainer?: 'nearest' | 'all';
1011
- className?: string;
1012
- showClipHeaders?: boolean;
1013
- interactiveClips?: boolean;
1014
- showFades?: boolean;
1386
+ latencyOffset?: number;
1387
+ }
1388
+
1389
+ /**
1390
+ * Marker: clips get a header. With clip interaction enabled the header is also
1391
+ * what a clip is dragged by, and the trim handles come with it. It adds to the
1392
+ * height of every row, which is why the root must know of it before anything
1393
+ * is drawn: it renders nothing itself.
1394
+ */
1395
+ declare const WaveformClipHeaders: react__default.FC;
1396
+ /** Marker: clips show their fade-in and fade-out curves. Renders nothing itself. */
1397
+ declare const WaveformFades: react__default.FC;
1398
+ interface WaveformRecordingPreviewProps {
1399
+ recordingState: WaveformRecordingState;
1400
+ }
1401
+ /**
1402
+ * Marker: the take being recorded is drawn into its track as it grows. The
1403
+ * preview clip is drawn by that track's row; this renders nothing itself.
1404
+ */
1405
+ declare const WaveformRecordingPreview: react__default.FC<WaveformRecordingPreviewProps>;
1406
+ interface WaveformTracksProps {
1407
+ /** Draw each clip's waveform scaled by its gain. */
1408
+ gainScaled?: boolean;
1015
1409
  /**
1016
- * Enable mobile-optimized touch interactions.
1017
- * When true, increases touch target sizes for clip boundaries.
1018
- * Use with useDragSensors({ touchOptimized: true }) for best results.
1410
+ * `WaveformClipHeaders`, `WaveformFades`, `WaveformRecordingPreview`: markers that
1411
+ * switch a per-clip part on. Nothing else is rendered from here.
1019
1412
  */
1020
- touchOptimized?: boolean;
1021
- /** Callback when a track's close button is clicked. Only renders close button when provided. */
1022
- onRemoveTrack?: (trackIndex: number) => void;
1023
- /** Enable vertical track reordering: a drag grip + move up/down buttons on
1024
- * each default track control panel. Drag requires ClipInteractionProvider
1025
- * (the ambient DragDropProvider); the buttons work regardless. Default: false. */
1026
- trackReordering?: boolean;
1027
- recordingState?: {
1028
- isRecording: boolean;
1029
- trackId: string;
1030
- startSample: number;
1031
- durationSamples: number;
1032
- peaks: (Int8Array | Int16Array)[];
1033
- bits: 8 | 16;
1034
- /**
1035
- * Latency offset (seconds) to skip in the live preview. Absolute replacement
1036
- * for the auto-computed outputLatency + lookAhead value. Pass the same value
1037
- * given to useIntegratedRecording so preview and finalized clip match.
1038
- */
1039
- latencyOffset?: number;
1040
- };
1413
+ children?: ReactNode;
1041
1414
  }
1042
1415
  /**
1043
- * Waveform visualization component that uses the playlist context.
1416
+ * All track rows: the tracks part of the view (#685).
1044
1417
  *
1045
- * Composes PlaylistVisualization (waveform + tracks) and
1046
- * PlaylistAnnotationList (annotation text list below the waveform).
1418
+ * It takes the rows, their peaks and the layout from the root's rows value
1419
+ * (not from a provider's track value, see waveformLayoutContext.ts) and the
1420
+ * selected row from a context both providers serve (`useSelectedRow`), so it
1421
+ * draws under either provider. It is
1422
+ * deliberately free of the time selection, the cursor and the annotation
1423
+ * state: those change on every pointer move of a selection drag and
1424
+ * throughout playback, and nothing in a track row depends on them. Read one
1425
+ * of them here and every row is back on that path (#693).
1426
+ *
1427
+ * It is not memoized: its children are new elements whenever the component
1428
+ * that composes the view renders. That costs this component's own render; the
1429
+ * rows below are memoized and get primitives, stable callbacks and the
1430
+ * identity-stable pieces of the peaks.
1047
1431
  */
1048
- declare const Waveform: React__default.FC<WaveformProps>;
1432
+ declare const WaveformTracks: react__default.FC<WaveformTracksProps>;
1049
1433
 
1050
- interface MediaElementWaveformProps {
1051
- /** Height in pixels for the annotation text list */
1052
- annotationTextHeight?: number;
1053
- /** Custom function to generate the label shown on annotation boxes */
1054
- getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
1434
+ interface WaveformTrackControlsProps {
1055
1435
  /**
1056
- * Custom render function for annotation items in the text list.
1057
- * When provided, completely replaces the default annotation item rendering.
1058
- * Use this to customize the appearance of each annotation (e.g., add furigana).
1436
+ * Width of the controls column in pixels. Default 200. The root reads it
1437
+ * from the element (the column is its own, beside the scrolling area), so it
1438
+ * must be on the part itself.
1059
1439
  */
1060
- renderAnnotationItem?: (props: RenderAnnotationItemProps) => React__default.ReactNode;
1061
- /** Whether annotation boundaries can be edited by dragging. Defaults to false. */
1062
- editable?: boolean;
1063
- /** Whether dragging one annotation boundary also moves the adjacent annotation's boundary. Defaults to false. */
1064
- linkEndpoints?: boolean;
1440
+ width?: number;
1065
1441
  /**
1066
- * Callback when annotations are updated (e.g., boundaries dragged).
1067
- * Called with the full updated annotations array.
1442
+ * The control panel of a track, as a template: it is rendered once per
1443
+ * track, inside that track's context, which `useTrack()` and the built-in
1444
+ * pieces (`<TrackName />`, `<TrackMuteButton />`, …) read. Default:
1445
+ * `<DefaultTrackControls />`.
1068
1446
  */
1069
- onAnnotationUpdate?: OnAnnotationUpdateFn;
1070
- /** Where to position the active annotation when auto-scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */
1071
- scrollActivePosition?: ScrollLogicalPosition;
1072
- /** Which scrollable containers to scroll: 'nearest' (only the annotation list) or 'all' (including viewport). Defaults to 'nearest'. */
1073
- scrollActiveContainer?: 'nearest' | 'all';
1074
- /** Custom playhead render function. Receives position, color, and animation refs for smooth 60fps animation. */
1075
- renderPlayhead?: RenderPlayheadFunction;
1076
- /** Show fade in/out overlays on the waveform. Defaults to false. */
1077
- showFades?: boolean;
1078
- className?: string;
1447
+ children?: ReactNode;
1079
1448
  }
1080
1449
  /**
1081
- * Simplified Waveform component for MediaElementPlaylistProvider
1450
+ * The control panels of all tracks, one height-synced slot per track, for the
1451
+ * ControlsColumn outside the scroll area: the track-controls part of the view
1452
+ * (#685). Its children are the panel of ONE track, a template it renders once
1453
+ * per track inside that track's context (#687); without children the panel is
1454
+ * `<DefaultTrackControls />`.
1082
1455
  *
1083
- * This is a stripped-down version of Waveform that works with the
1084
- * MediaElement context. It supports:
1085
- * - Single track visualization
1086
- * - Click to seek
1087
- * - Annotation display and click-to-play
1088
- * - Playhead animation
1456
+ * Memoized (#693): it takes the rows and the layout from the root's rows
1457
+ * value, reads the selected track itself, and no time selection, cursor or
1458
+ * annotation state, so a selection drag or an active-annotation change during
1459
+ * playback does not re-render the panels. It reads the mixer state itself
1460
+ * (#768), so a volume or pan step renders this column, the slot of that track
1461
+ * and the pieces of that track, and not the root above it.
1462
+ */
1463
+ declare function WaveformTrackControlsImpl({ children }: WaveformTrackControlsProps): react__default.JSX.Element;
1464
+ declare const WaveformTrackControls: react__default.MemoExoticComponent<typeof WaveformTrackControlsImpl>;
1465
+
1466
+ /**
1467
+ * The parts of the visualization that follow selection, cursor, loop and
1468
+ * annotation state. They are small siblings of the track rows (#693): these
1469
+ * re-render on every pointer move of a selection drag and on every
1470
+ * active-annotation change during playback, and the rows do not.
1089
1471
  *
1090
- * For multi-track editing, use the full Waveform with WaveformPlaylistProvider.
1472
+ * `WaveformSelection` and `WaveformPlayhead` read shared hooks only and are
1473
+ * rendered under both providers (#688). The loop region is multitrack only.
1474
+ * (The annotation boxes are `WaveformAnnotationBoxes.tsx`, for both providers.)
1091
1475
  */
1092
- declare const MediaElementWaveform: React__default.FC<MediaElementWaveformProps>;
1093
1476
 
1094
- interface MediaElementPlaylistProps {
1095
- /** Custom function to generate the label shown on annotation boxes */
1096
- getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
1097
- /** Whether annotation boundaries can be edited by dragging. Defaults to false. */
1098
- editable?: boolean;
1099
- /** Whether dragging one annotation boundary also moves the adjacent annotation's boundary. Defaults to false. */
1100
- linkEndpoints?: boolean;
1101
- /**
1102
- * Callback when annotations are updated (e.g., boundaries dragged).
1103
- * Called with the full updated annotations array.
1104
- */
1105
- onAnnotationUpdate?: OnAnnotationUpdateFn;
1106
- /** Custom playhead render function. Receives position, color, and animation refs for smooth 60fps animation. */
1477
+ /**
1478
+ * The highlighted selection range. Renders nothing for a collapsed selection.
1479
+ * While a drag is drawing a range during playback it shows that range.
1480
+ * Memoized (it takes no props): a render of the view around it (play, pause,
1481
+ * a press) is not its concern, only the selection, the zoom, the view settings
1482
+ * and the theme are.
1483
+ */
1484
+ declare const WaveformSelection: react__default.FC;
1485
+ interface WaveformPlayheadProps {
1486
+ /** Custom playhead render function. Receives position (pixels) and color from theme. */
1107
1487
  renderPlayhead?: RenderPlayheadFunction;
1108
- /** Show fade in/out overlays on the waveform. Defaults to false. */
1109
- showFades?: boolean;
1110
- className?: string;
1111
1488
  }
1112
1489
  /**
1113
- * Standalone waveform + annotation boxes component for MediaElementPlaylistProvider.
1114
- *
1115
- * Renders the waveform visualization, annotation boxes, selection, and playhead.
1116
- * Does NOT render the annotation text list — use `MediaElementAnnotationList` for that.
1490
+ * The playhead: shown while playing, and at rest when no range is selected.
1491
+ * The same under either provider.
1492
+ */
1493
+ declare const WaveformPlayhead: react__default.FC<WaveformPlayheadProps>;
1494
+ /**
1495
+ * The draggable loop region in the timescale, bounded by the root's timeline.
1496
+ * Renders nothing while looping is off. Memoized: it takes no props.
1497
+ */
1498
+ declare const WaveformLoopRegion: react__default.NamedExoticComponent<object>;
1499
+
1500
+ /**
1501
+ * The parts of the view (#685), exported from the package: a consumer
1502
+ * composes them inside `WaveformRoot` (or, the ones its provider can serve,
1503
+ * inside `MediaElementWaveformRoot`). `Waveform`, `WaveformEditor` and
1504
+ * `MediaElementWaveform` are ready-made compositions of them.
1117
1505
  *
1118
- * Must be used inside a `MediaElementPlaylistProvider`.
1506
+ * A part reads what it draws from the provider's contexts and from the root's
1507
+ * two layout values (waveformLayoutContext.ts); its props are the options of
1508
+ * that part alone. The root sorts its children into the three places a
1509
+ * playlist has (the timescale strip, the controls column, the scrolling
1510
+ * tracks area) by part type, see `sortWaveformParts`.
1119
1511
  *
1120
- * This component can be placed independently in consumer layouts, allowing the
1121
- * waveform and annotation list to be positioned separately (e.g., in different
1122
- * panels or with custom elements between them).
1512
+ * A part is the component that draws, not a wrapper that forwards to one:
1513
+ * the tracks part is in TrackRows.tsx, the controls in
1514
+ * TrackControlsColumn.tsx, the overlays in VisualizationOverlays.tsx. The
1515
+ * parts with no children are memoized, except the playhead: the component
1516
+ * that composes them usually re-renders with the tracks (it holds them), and
1517
+ * a part whose props did not change should not follow.
1123
1518
  */
1124
- declare const MediaElementPlaylist: React__default.FC<MediaElementPlaylistProps>;
1125
1519
 
1126
- interface MediaElementAnnotationListProps {
1127
- /** Height in pixels for the annotation text list */
1128
- height?: number;
1129
- /**
1130
- * Custom render function for annotation items in the text list.
1131
- * When provided, completely replaces the default annotation item rendering.
1132
- */
1133
- renderAnnotationItem?: (props: RenderAnnotationItemProps) => React__default.ReactNode;
1134
- /**
1135
- * Callback when annotations are updated (e.g., text edited).
1136
- * Called with the full updated annotations array.
1137
- */
1138
- onAnnotationUpdate?: OnAnnotationUpdateFn;
1139
- /** Whether annotation text can be edited. Defaults to false. */
1140
- editable?: boolean;
1141
- /**
1142
- * Action controls to show on each annotation item (e.g., delete, split).
1143
- * Only rendered when `editable` is true.
1144
- */
1145
- controls?: AnnotationAction[];
1520
+ interface WaveformTimescaleProps {
1521
+ /** Custom tick label. `label` is already formatted for the scale mode. */
1522
+ renderTick?: (label: string, pixelPosition: number) => ReactNode;
1146
1523
  /**
1147
- * Override annotation list config. Falls back to context values
1148
- * `{ linkEndpoints: false, continuousPlay }` if not provided.
1524
+ * Height in pixels of the timescale strip. The root reads it from the
1525
+ * element, as it reads the width of the controls part: the strip is the
1526
+ * root's own, above the scrolling area. Default: 30
1149
1527
  */
1150
- annotationListConfig?: AnnotationActionOptions;
1151
- /** Where to position the active annotation when auto-scrolling. Defaults to 'center'. */
1152
- scrollActivePosition?: ScrollLogicalPosition;
1153
- /** Which scrollable containers to scroll: 'nearest' or 'all'. Defaults to 'nearest'. */
1154
- scrollActiveContainer?: 'nearest' | 'all';
1528
+ height?: number;
1155
1529
  }
1530
+ /** The time ruler, as long as the root's timeline. */
1531
+ declare const WaveformTimescale: react__default.NamedExoticComponent<WaveformTimescaleProps>;
1532
+
1533
+ /**
1534
+ * Shared annotation types used across Waveform components
1535
+ */
1536
+
1156
1537
  /**
1157
- * Standalone annotation text list component for MediaElementPlaylistProvider.
1538
+ * Custom function to generate the label shown on annotation boxes in the waveform.
1539
+ * Receives the annotation data and its index in the list, returns a string label.
1540
+ * Default behavior: displays annotation.id
1158
1541
  *
1159
- * Requires @waveform-playlist/annotations with AnnotationProvider.
1160
- * Throws if used without `<AnnotationProvider>` wrapping the component tree.
1542
+ * Called for every annotation whenever the row of boxes renders. Return the
1543
+ * same string for an unchanged annotation, so that its box can skip the render.
1161
1544
  */
1162
- declare const MediaElementAnnotationList: React__default.FC<MediaElementAnnotationListProps>;
1545
+ type GetAnnotationBoxLabelFn = (annotation: AnnotationData, index: number) => string;
1163
1546
 
1164
- interface PlaylistVisualizationProps {
1165
- renderTrackControls?: (trackIndex: number) => ReactNode;
1166
- renderTick?: (label: string, pixelPosition: number) => ReactNode;
1167
- /** Custom playhead render function. Receives position (pixels) and color from theme. */
1168
- renderPlayhead?: RenderPlayheadFunction;
1169
- annotationControls?: AnnotationAction[];
1547
+ interface WaveformAnnotationBoxesProps {
1170
1548
  /**
1171
- * Custom function to generate the label shown on annotation boxes in the waveform.
1172
- * Receives the annotation data and its index, returns a string label.
1173
- * Default: annotation.id
1549
+ * The label of a box, from the annotation and its index. Default: the
1550
+ * annotation's id. Pass a function that keeps its identity (defined outside
1551
+ * the component, or memoized): a new one renders every box.
1174
1552
  */
1175
- getAnnotationBoxLabel?: GetAnnotationBoxLabelFn;
1176
- className?: string;
1177
- showClipHeaders?: boolean;
1178
- interactiveClips?: boolean;
1179
- showFades?: boolean;
1553
+ getLabel?: GetAnnotationBoxLabelFn;
1554
+ /** Height of the row in pixels. Default: 30. */
1555
+ height?: number;
1556
+ }
1557
+ /**
1558
+ * The row of annotation boxes: a part of either root (`WaveformRoot`,
1559
+ * `MediaElementWaveformRoot`), as wide as the root's timeline. Needs the
1560
+ * annotation integration (`<AnnotationProvider>`); draws nothing without it
1561
+ * or without annotations.
1562
+ *
1563
+ * It wires the drag of a box's edges itself (#686): its own
1564
+ * `DragDropProvider` around the row, the moves shown through the provider's
1565
+ * preview, one `onAnnotationsChange` on release. The edges can be dragged
1566
+ * while the provider's `editable` option is on; `linkEndpoints` and
1567
+ * `continuousPlay` come from the same place (`useAnnotationOptions()`). The
1568
+ * touch setting of the drag is `ClipInteractionOptions`' `touchOptimized`.
1569
+ * The box colour is the theme's `annotationBoxBorder`.
1570
+ *
1571
+ * It is the one part of the view that reads the annotations and the active
1572
+ * annotation, so an annotation boundary during playback renders this and not
1573
+ * the waveform (#744). Memoized: a render of the component that composes the
1574
+ * view does not render it while its props keep their identity.
1575
+ */
1576
+ declare const WaveformAnnotationBoxes: react__default.NamedExoticComponent<WaveformAnnotationBoxesProps>;
1577
+
1578
+ /**
1579
+ * The options that only affect how a view draws (#689): row height, bar
1580
+ * style, playhead width, and whether a multitrack timeline fills its
1581
+ * container. One home for them, read by the root of each view below.
1582
+ *
1583
+ * It is a context and not props of a root or a part because several
1584
+ * components draw with these values (the root lays the rows out, the channels
1585
+ * draw the bars, the playhead takes its width) and because one set of options
1586
+ * often serves several views: ten players on a page, each under its own
1587
+ * provider, are styled by one `<WaveformViewOptions>` above them all.
1588
+ */
1589
+
1590
+ interface WaveformViewOptionsValue {
1591
+ /** Height in pixels of one channel of a track. Default: 80 */
1592
+ waveHeight?: number;
1593
+ /** Width in pixels of a waveform bar. Default: 1 */
1594
+ barWidth?: number;
1595
+ /** Space in pixels between two bars. Default: 0 */
1596
+ barGap?: number;
1597
+ /** Draw bars with rounded caps (radius `barWidth / 2`). Default: false */
1598
+ roundedBars?: boolean;
1599
+ /** Width in pixels of the playhead line. Default: `barWidth + barGap` */
1600
+ progressBarWidth?: number;
1180
1601
  /**
1181
- * Enable mobile-optimized touch interactions.
1182
- * When true, increases touch target sizes for clip boundaries.
1183
- * Use with useDragSensors({ touchOptimized: true }) for best results.
1602
+ * Draw the timeline at least as wide as its scroll container when the audio
1603
+ * is shorter. `WaveformRoot` only: a MediaElement timeline is as long as
1604
+ * its audio. Default: false
1184
1605
  */
1185
- touchOptimized?: boolean;
1186
- /** Callback when a track's close button is clicked. Only renders close button when provided. */
1187
- onRemoveTrack?: (trackIndex: number) => void;
1188
- recordingState?: {
1189
- isRecording: boolean;
1190
- trackId: string;
1191
- startSample: number;
1192
- durationSamples: number;
1193
- peaks: (Int8Array | Int16Array)[];
1194
- bits: 8 | 16;
1195
- /**
1196
- * Latency offset (seconds) to skip in the live preview. Absolute replacement
1197
- * for the auto-computed outputLatency + lookAhead value. Pass the same value
1198
- * given to useIntegratedRecording so preview and finalized clip match.
1199
- */
1200
- latencyOffset?: number;
1201
- };
1202
- /** Enable vertical track reordering: a drag grip + move up/down buttons on
1203
- * each default track control panel. Drag requires ClipInteractionProvider
1204
- * (the ambient DragDropProvider); the buttons work regardless. Default: false. */
1205
- trackReordering?: boolean;
1606
+ fillViewport?: boolean;
1607
+ }
1608
+ interface WaveformViewOptionsProps extends WaveformViewOptionsValue {
1609
+ children?: ReactNode;
1206
1610
  }
1207
1611
  /**
1208
- * Standalone playlist visualization component (WebAudio version).
1612
+ * Sets view options for every waveform root below it, under either provider.
1613
+ * It may sit above the provider, and above several.
1209
1614
  *
1210
- * Renders the waveform tracks, timescale, annotations boxes, selection,
1211
- * playhead, loop regions, and track controls — everything that lives
1212
- * inside <Playlist> plus wrapping providers.
1615
+ * A prop that is left out is taken from the `<WaveformViewOptions>` above
1616
+ * (`??`, so `0` and `false` are values), and from the defaults when there is
1617
+ * none: nest one to change a single option for part of the tree. A nested one
1618
+ * cannot return an option to its default: write the value.
1213
1619
  *
1214
- * Does NOT render AnnotationText (the annotation list below the waveform).
1215
- * Pair with PlaylistAnnotationList for a full annotation editing UI.
1620
+ * It goes ABOVE a root. A root reads the options above itself, so one written
1621
+ * among a root's children does nothing for that root (and warns).
1216
1622
  */
1217
- declare const PlaylistVisualization: React__default.FC<PlaylistVisualizationProps>;
1623
+ declare const WaveformViewOptions: react__default.FC<WaveformViewOptionsProps>;
1218
1624
 
1219
- interface PlaylistAnnotationListProps {
1220
- /** Height in pixels for the annotation text list */
1625
+ interface AnnotationListProps {
1626
+ /** Height of the list in pixels. Without it the list is at most 200 px high. */
1221
1627
  height?: number;
1222
1628
  /**
1223
- * Custom render function for annotation items in the text list.
1224
- * When provided, completely replaces the default annotation item rendering.
1225
- */
1226
- renderAnnotationItem?: (props: RenderAnnotationItemProps) => React__default.ReactNode;
1227
- /**
1228
- * Callback when annotations are updated (e.g., text edited).
1229
- * Called with the full updated annotations array.
1629
+ * Buttons shown on each row while the provider's `editable` option is on
1630
+ * (delete, split, …). An action is called with the annotation, its index,
1631
+ * the annotations and `{ linkEndpoints, continuousPlay }` as the provider
1632
+ * has them. Pass an array that keeps its identity: a new one renders every
1633
+ * row.
1230
1634
  */
1231
- onAnnotationUpdate?: OnAnnotationUpdateFn;
1635
+ actions?: AnnotationAction[];
1232
1636
  /**
1233
- * Action controls to show on each annotation item (e.g., delete, split).
1234
- * Only rendered when `annotationsEditable` is true in context.
1637
+ * Where the active annotation is put when the list scrolls to it during
1638
+ * playback, or `'none'` for a list that does not follow. Default: `'center'`.
1235
1639
  */
1236
- controls?: AnnotationAction[];
1640
+ scrollActivePosition?: ScrollLogicalPosition | 'none';
1641
+ /** Which containers scroll: only the list (`'nearest'`), or the page too (`'all'`). Default: `'nearest'`. */
1642
+ scrollActiveContainer?: 'nearest' | 'all';
1237
1643
  /**
1238
- * Override annotation list config. Falls back to context values
1239
- * `{ linkEndpoints, continuousPlay }` if not provided.
1644
+ * Draws a row, in place of the default one: called with
1645
+ * `{ annotation, index, isActive, onClick, formatTime }`. Define the
1646
+ * function outside the component (or memoize it): one written inline is a
1647
+ * new function on every render of your component and renders every row.
1240
1648
  */
1241
- annotationListConfig?: AnnotationActionOptions;
1242
- /** Where to position the active annotation when auto-scrolling. Defaults to 'center'. */
1243
- scrollActivePosition?: ScrollLogicalPosition;
1244
- /** Which scrollable containers to scroll: 'nearest' or 'all'. Defaults to 'nearest'. */
1245
- scrollActiveContainer?: 'nearest' | 'all';
1649
+ children?: (item: RenderAnnotationItemProps) => react__default.ReactNode;
1246
1650
  }
1247
1651
  /**
1248
- * Standalone annotation text list component for WaveformPlaylistProvider (WebAudio).
1652
+ * The annotation text list, for both providers (#686). Render it anywhere
1653
+ * under the provider: below the view, in a sidebar, more than once. It reads
1654
+ * everything from the provider (the annotations, the active one, the
1655
+ * `editable` / `linkEndpoints` / `continuousPlay` options) and reports edits
1656
+ * through the provider's `onAnnotationsChange`. A click on a row plays the
1657
+ * annotation, as a click on its box does.
1249
1658
  *
1250
- * Requires @waveform-playlist/annotations with AnnotationProvider.
1251
- * Throws if used without `<AnnotationProvider>` wrapping the component tree.
1659
+ * Needs the annotation integration (`<AnnotationProvider>` from
1660
+ * `@waveform-playlist/annotations`). Without it, and without annotations, it
1661
+ * draws nothing.
1662
+ *
1663
+ * It renders at every annotation boundary during playback, and the rows are
1664
+ * memoized, so everything it hands down except the active annotation keeps
1665
+ * its identity across such a render.
1252
1666
  */
1253
- declare const PlaylistAnnotationList: React__default.FC<PlaylistAnnotationListProps>;
1667
+ declare const AnnotationList: react__default.FC<AnnotationListProps>;
1254
1668
 
1255
1669
  interface KeyboardShortcutsProps {
1256
1670
  /** Enable default playback shortcuts (Space, Escape, 0). Defaults to false. */
@@ -1270,39 +1684,195 @@ interface KeyboardShortcutsProps {
1270
1684
  *
1271
1685
  * @example
1272
1686
  * ```tsx
1273
- * <WaveformPlaylistProvider tracks={tracks} {...}>
1687
+ * <WaveformPlaylistProvider arrangement={arrangement} {...}>
1274
1688
  * <KeyboardShortcuts playback clipSplitting />
1275
1689
  * <Waveform />
1276
1690
  * </WaveformPlaylistProvider>
1277
1691
  * ```
1278
1692
  */
1279
- declare const KeyboardShortcuts: React__default.FC<KeyboardShortcutsProps>;
1693
+ declare const KeyboardShortcuts: react__default.FC<KeyboardShortcutsProps>;
1280
1694
 
1281
- interface SortableTrackControlsRenderProps {
1282
- /** Attach to the slot wrapper element (the sortable item). */
1283
- ref: (element: Element | null) => void;
1284
- /** Attach to the drag grip element. */
1285
- handleRef: (element: Element | null) => void;
1286
- isDragSource: boolean;
1695
+ /**
1696
+ * The default control panel of a track: its name, the track menu (under a
1697
+ * `<SpectrogramProvider>`, for an audio track), mute, solo, volume and pan.
1698
+ * It is what `<WaveformTrackControls />` renders when it has no children
1699
+ * (#687). It has no remove button and no reorder grip: render
1700
+ * `<TrackRemoveButton />` or `<TrackReorderGrip />` beside it for those (both
1701
+ * place themselves at an edge of the slot), or compose a panel from the
1702
+ * pieces.
1703
+ *
1704
+ * Its children are drawn inside the panel, below the pan slider: the place
1705
+ * for one more control of your own. An element rendered BESIDE the panel is
1706
+ * outside it, and the panel fills the slot, so that element is only visible
1707
+ * when it positions itself, as the remove button and the grip do.
1708
+ *
1709
+ * It reads no context itself: the pieces read the track.
1710
+ */
1711
+ interface DefaultTrackControlsProps {
1712
+ /** Drawn inside the panel, below the pan slider. */
1713
+ children?: ReactNode;
1287
1714
  }
1288
- interface SortableTrackControlsProps {
1289
- trackId: string;
1715
+ declare function DefaultTrackControlsImpl({ children }: DefaultTrackControlsProps): react__default.JSX.Element;
1716
+ declare const DefaultTrackControls: react__default.MemoExoticComponent<typeof DefaultTrackControlsImpl>;
1717
+
1718
+ /**
1719
+ * The pieces of a track's control panel (#687). Each is bound to the track
1720
+ * whose panel it is rendered in (`useTrack()`), takes no prop for the track,
1721
+ * and is drawn by being rendered among the children of
1722
+ * `<WaveformTrackControls>`.
1723
+ */
1724
+
1725
+ /** The track's name, on one line, cut off with an ellipsis. */
1726
+ declare const TrackName: react__default.FC;
1727
+ /**
1728
+ * Mutes and unmutes the track. Disabled while a take is recorded onto the
1729
+ * track (`useTrack().isRecordingArmed`): the track is muted for the take and
1730
+ * its mute from before is written back when the take ends (#812).
1731
+ */
1732
+ declare const TrackMuteButton: react__default.FC;
1733
+ /** Solos and unsolos the track. */
1734
+ declare const TrackSoloButton: react__default.FC;
1735
+ /** The track's volume, 0 to 1. */
1736
+ declare const TrackVolumeSlider: react__default.FC;
1737
+ /** The track's pan, -1 (left) to 1 (right). */
1738
+ declare const TrackPanSlider: react__default.FC;
1739
+ /**
1740
+ * The track's menu: how the track is drawn (waveform, spectrogram, both) and
1741
+ * its spectrogram settings. Draws nothing without a `<SpectrogramProvider>`
1742
+ * and nothing for a MIDI track, which is always a piano roll.
1743
+ */
1744
+ declare const TrackMenuButton: react__default.FC;
1745
+ interface TrackRemoveButtonProps {
1746
+ /** Called with the track's id. Removing the track from your `tracks` is yours to do. */
1747
+ onRemove: (trackId: string) => void;
1748
+ }
1749
+ /**
1750
+ * A close button at the top left corner of the track's slot. A click calls
1751
+ * `onRemove` with the track's id and does not select the track.
1752
+ */
1753
+ declare const TrackRemoveButton: react__default.FC<TrackRemoveButtonProps>;
1754
+ /**
1755
+ * A drag grip with a move-up and a move-down button, at the right edge of the
1756
+ * track's slot. The buttons work with no other setup; dragging needs a
1757
+ * `ClipInteractionProvider` above the view. The default panel makes room for
1758
+ * it. Neither the grip nor the buttons select the track.
1759
+ */
1760
+ declare const TrackReorderGrip: react__default.FC;
1761
+
1762
+ /** What `useTrack()` returns: one track's identity, mixer state and bound actions. */
1763
+ interface TrackContextValue {
1764
+ /** The track's id. */
1765
+ id: string;
1766
+ /** `'audio'` or `'midi'`. */
1767
+ kind: TrackKind;
1768
+ /** The track's position in the list of tracks, from 0. Changes on a reorder. */
1290
1769
  index: number;
1291
- disabled?: boolean;
1292
- children: (props: SortableTrackControlsRenderProps) => React__default.ReactNode;
1770
+ /** The track's name, or "Track N" (N is the position, from 1) when it has none and while it is loading. */
1771
+ name: string;
1772
+ muted: boolean;
1773
+ soloed: boolean;
1774
+ /** 0 to 1. */
1775
+ volume: number;
1776
+ /** -1 (left) to 1 (right). */
1777
+ pan: number;
1778
+ /** How the track is drawn. Always `'waveform'` for a MIDI track. */
1779
+ renderMode: RenderMode;
1780
+ /** Whether this is the selected track. */
1781
+ isSelected: boolean;
1782
+ isFirst: boolean;
1783
+ isLast: boolean;
1784
+ /**
1785
+ * True for an audio track under a `<SpectrogramProvider>`: `setRenderMode`
1786
+ * and `openSpectrogramSettings` then do something.
1787
+ */
1788
+ hasSpectrogram: boolean;
1789
+ /**
1790
+ * True while a take is being recorded onto this track (`setRecordingActive`,
1791
+ * `useRecordingSession`). The track is muted for the take and its mute from
1792
+ * before is written back when the take ends, so a change made meanwhile does
1793
+ * not stay: the built-in `<TrackMuteButton />` is disabled while this is
1794
+ * true, and an app's own mute control can do the same.
1795
+ */
1796
+ isRecordingArmed: boolean;
1797
+ setMuted: (muted: boolean) => void;
1798
+ setSoloed: (soloed: boolean) => void;
1799
+ setVolume: (volume: number) => void;
1800
+ setPan: (pan: number) => void;
1801
+ /** Makes this the selected track. */
1802
+ select: () => void;
1803
+ /** Moves the track one position up. Nothing happens for the first track. */
1804
+ moveUp: () => void;
1805
+ /** Moves the track one position down. Nothing happens for the last track. */
1806
+ moveDown: () => void;
1807
+ /** Nothing happens without a `<SpectrogramProvider>`. */
1808
+ setRenderMode: (mode: RenderMode) => void;
1809
+ /** Opens the spectrogram settings of this track. Nothing happens without a `<SpectrogramProvider>`. */
1810
+ openSpectrogramSettings: () => void;
1293
1811
  }
1294
1812
  /**
1295
- * Registers a track-controls row as a vertical sortable item in the ambient
1296
- * DragDropProvider (ClipInteractionProvider). The per-source modifiers
1297
- * REPLACE the provider's clip modifiers for this operation, so track drags
1298
- * are vertical-only and skip clip collision/snap. Data kind 'track-reorder'
1813
+ * The track whose control panel the calling component is part of. For the
1814
+ * children of `<WaveformTrackControls>`, which renders them once per track.
1815
+ */
1816
+ declare function useTrack(): TrackContextValue;
1817
+
1818
+ interface TrackReorderHandle {
1819
+ /** Attach to the element the track is dragged by (a grip). */
1820
+ handleRef: (element: Element | null) => void;
1821
+ /** True while this track is the one being dragged. */
1822
+ isDragSource: boolean;
1823
+ }
1824
+ /**
1825
+ * Makes the track whose control panel the caller is part of a vertical
1826
+ * sortable item in the ambient `DragDropProvider` (`ClipInteractionProvider`),
1827
+ * dragged by the element `handleRef` is attached to (#687; it replaces
1828
+ * `SortableTrackControls`). `<TrackReorderGrip />` is this hook with the
1829
+ * built-in grip; call it yourself for a grip of your own. Once per panel: two
1830
+ * calls for one track register the same sortable id twice.
1831
+ *
1832
+ * The item that moves is the slot `<WaveformTrackControls>` draws around the
1833
+ * panel, not an element of the caller. The per-source modifiers REPLACE the
1834
+ * provider's clip modifiers for this operation, so track drags are
1835
+ * vertical-only and skip clip collision and snap. Data kind 'track-reorder'
1299
1836
  * is the discriminator the shared drag handlers branch on.
1300
1837
  */
1301
- declare const SortableTrackControls: React__default.FC<SortableTrackControlsProps>;
1838
+ declare function useTrackReorderHandle(): TrackReorderHandle;
1839
+
1840
+ interface RecordingSessionOptions {
1841
+ /** True while a take is being recorded. */
1842
+ isRecording: boolean;
1843
+ /** The track being recorded into, or null when there is none. */
1844
+ trackId: string | null | undefined;
1845
+ }
1846
+ /**
1847
+ * Tells the playlist that a take is being recorded into a track, for as long
1848
+ * as `isRecording` is true (#685). The provider then keeps playback running
1849
+ * past the end of the audio and mutes the armed track in the arrangement for
1850
+ * the take, so what it already holds does not play under a punch-in that
1851
+ * replaces it (#812: the mixer shows the track muted, its built-in Mute
1852
+ * button is disabled and `useTrack().isRecordingArmed` is true). The mute
1853
+ * from before the take is written back when the take ends, the track changes
1854
+ * or the component unmounts, whatever was set in between; the provider also
1855
+ * writes it back in its own cleanup (its unmount or an `<Activity>` hide)
1856
+ * while a track is still armed. An `<Activity>` hide of the component ends
1857
+ * the session the same way, and the reveal starts it again from the track's
1858
+ * mute at that moment.
1859
+ *
1860
+ * Call it in the component that calls `useIntegratedRecording`, under
1861
+ * `WaveformPlaylistProvider`. `<WaveformRecordingPreview>` only draws the
1862
+ * take: without this hook the armed track is not muted.
1863
+ *
1864
+ * A handler that starts playback together with the recording should also call
1865
+ * `setRecordingActive(true, trackId)` (from `useEditorControls()`) before
1866
+ * `play()`: this effect runs after the render that follows, which is too late
1867
+ * for the first animation frame. `play()` does nothing before the playlist's
1868
+ * first ready (`usePlaylistTimeline().isReady`), so a take started during the
1869
+ * first load records without playback.
1870
+ */
1871
+ declare function useRecordingSession({ isRecording, trackId }: RecordingSessionOptions): void;
1302
1872
 
1303
1873
  /**
1304
1874
  * Props the browser package passes to the AnnotationText component.
1305
- * Mirrors what PlaylistAnnotationList and MediaElementAnnotationList actually use.
1875
+ * Mirrors what `AnnotationList` actually uses.
1306
1876
  */
1307
1877
  interface AnnotationTextIntegrationProps {
1308
1878
  annotations: AnnotationData[];
@@ -1314,12 +1884,14 @@ interface AnnotationTextIntegrationProps {
1314
1884
  controls?: AnnotationAction[];
1315
1885
  annotationListConfig?: AnnotationActionOptions;
1316
1886
  height?: number;
1887
+ /** A click on a row (not in a field being edited, not on an action button). */
1888
+ onAnnotationClick?: (annotation: AnnotationData) => void;
1317
1889
  onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
1318
1890
  renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;
1319
1891
  }
1320
1892
  /**
1321
1893
  * Props the browser package passes to the AnnotationBox component.
1322
- * Mirrors what PlaylistVisualization and MediaElementPlaylist actually use.
1894
+ * Mirrors what `WaveformAnnotationBoxes` actually uses.
1323
1895
  */
1324
1896
  interface AnnotationBoxIntegrationProps {
1325
1897
  annotationId: string;
@@ -1334,7 +1906,7 @@ interface AnnotationBoxIntegrationProps {
1334
1906
  }
1335
1907
  /**
1336
1908
  * Props the browser package passes to the AnnotationBoxesWrapper component.
1337
- * Mirrors what PlaylistVisualization and MediaElementPlaylist actually use.
1909
+ * Mirrors what `WaveformAnnotationBoxes` actually uses.
1338
1910
  */
1339
1911
  interface AnnotationBoxesWrapperIntegrationProps {
1340
1912
  children?: React.ReactNode;
@@ -1344,8 +1916,8 @@ interface AnnotationBoxesWrapperIntegrationProps {
1344
1916
  /**
1345
1917
  * Interface for annotation integration provided by @waveform-playlist/annotations.
1346
1918
  *
1347
- * The browser package defines what it needs, and the optional annotations package
1348
- * provides it via <AnnotationProvider>.
1919
+ * The browser package defines what its views need, and the optional annotations
1920
+ * package provides it via <AnnotationProvider>.
1349
1921
  */
1350
1922
  interface AnnotationIntegration {
1351
1923
  parseAeneas: (data: unknown) => AnnotationData;
@@ -1353,28 +1925,8 @@ interface AnnotationIntegration {
1353
1925
  AnnotationText: React.ComponentType<AnnotationTextIntegrationProps>;
1354
1926
  AnnotationBox: React.ComponentType<AnnotationBoxIntegrationProps>;
1355
1927
  AnnotationBoxesWrapper: React.ComponentType<AnnotationBoxesWrapperIntegrationProps>;
1356
- ContinuousPlayCheckbox: React.ComponentType<{
1357
- checked: boolean;
1358
- onChange: (checked: boolean) => void;
1359
- className?: string;
1360
- }>;
1361
- LinkEndpointsCheckbox: React.ComponentType<{
1362
- checked: boolean;
1363
- onChange: (checked: boolean) => void;
1364
- className?: string;
1365
- }>;
1366
- EditableCheckbox: React.ComponentType<{
1367
- checked: boolean;
1368
- onChange: (checked: boolean) => void;
1369
- className?: string;
1370
- }>;
1371
- DownloadAnnotationsButton: React.ComponentType<{
1372
- annotations: AnnotationData[];
1373
- filename?: string;
1374
- className?: string;
1375
- }>;
1376
1928
  }
1377
- declare const AnnotationIntegrationProvider: React$1.Provider<AnnotationIntegration | null>;
1929
+ declare const AnnotationIntegrationProvider: react.Provider<AnnotationIntegration | null>;
1378
1930
  /**
1379
1931
  * Hook to access annotation integration provided by @waveform-playlist/annotations.
1380
1932
  * Throws if used without <AnnotationProvider> wrapping the component tree.
@@ -1384,23 +1936,6 @@ declare const AnnotationIntegrationProvider: React$1.Provider<AnnotationIntegrat
1384
1936
  */
1385
1937
  declare function useAnnotationIntegration(): AnnotationIntegration;
1386
1938
 
1387
- /**
1388
- * Single-call canvas registration shape. Consolidates the OffscreenCanvas
1389
- * transfer and per-canvas metadata that earlier required two separate
1390
- * registration paths.
1391
- *
1392
- * Provider/orchestrator look up trackId from clipId and derive
1393
- * globalPixelOffset = chunkIndex * MAX_CANVAS_WIDTH.
1394
- */
1395
- interface SpectrogramCanvasRegistration {
1396
- canvasId: string;
1397
- canvas: OffscreenCanvas;
1398
- clipId: string;
1399
- channelIndex: number;
1400
- chunkIndex: number;
1401
- widthPx: number;
1402
- heightPx: number;
1403
- }
1404
1939
  interface SpectrogramIntegration {
1405
1940
  trackSpectrogramOverrides: Map<string, TrackSpectrogramOverrides>;
1406
1941
  spectrogramConfig?: SpectrogramConfig;
@@ -1430,7 +1965,7 @@ interface SpectrogramIntegration {
1430
1965
  /** Get frequency scale function for a scale name */
1431
1966
  getFrequencyScale: (name: string) => (f: number, minF: number, maxF: number) => number;
1432
1967
  }
1433
- declare const SpectrogramIntegrationProvider: React$1.Provider<SpectrogramIntegration | null>;
1968
+ declare const SpectrogramIntegrationProvider: react.Provider<SpectrogramIntegration | null>;
1434
1969
  /**
1435
1970
  * Hook to access spectrogram integration provided by @waveform-playlist/spectrogram.
1436
1971
  * Throws if used without <SpectrogramProvider> wrapping the component tree.
@@ -1446,15 +1981,47 @@ interface ClipInteractionProviderProps {
1446
1981
  * (if present with scaleMode="beats" and snapTo!="off"), otherwise
1447
1982
  * falls back to timescale-based snapping. Default: false. */
1448
1983
  snap?: boolean;
1984
+ /** Touch-friendly interaction: drag sensors that wait 250ms on touch (so a
1985
+ * swipe still scrolls) and wider clip trim handles. Left out: inherited from
1986
+ * a `ClipInteractionOptions` or `ClipInteractionProvider` above (false at
1987
+ * the top). */
1449
1988
  touchOptimized?: boolean;
1450
- children: React__default.ReactNode;
1989
+ children: react__default.ReactNode;
1451
1990
  }
1452
- declare const ClipInteractionProvider: React__default.FC<ClipInteractionProviderProps>;
1991
+ declare const ClipInteractionProvider: react__default.FC<ClipInteractionProviderProps>;
1453
1992
 
1993
+ interface ClipInteractionOptionsProps {
1994
+ /** Clips below can be dragged and trimmed. Left out: inherited (false at the top). */
1995
+ enabled?: boolean;
1996
+ /**
1997
+ * Touch handling below: clips get wider trim handles, and a touch on an
1998
+ * annotation edge must be held (250 ms) before it drags, so a swipe is not
1999
+ * taken for a drag. Left out: inherited (false at the top).
2000
+ */
2001
+ touchOptimized?: boolean;
2002
+ children: react__default.ReactNode;
2003
+ }
2004
+ /**
2005
+ * The one source of the clip interaction options (#690). Every clip below
2006
+ * reads them from here; `<Waveform>` takes neither as a prop.
2007
+ *
2008
+ * `ClipInteractionProvider` renders this for you. Use it directly when you
2009
+ * wire up your own `DragDropProvider`, or nested inside a
2010
+ * `ClipInteractionProvider` to change one option for part of the tree: an
2011
+ * option you leave out keeps the value from above.
2012
+ */
2013
+ declare const ClipInteractionOptions: react__default.FC<ClipInteractionOptionsProps>;
2014
+ /** True when clips here can be dragged and trimmed. */
1454
2015
  declare function useClipInteractionEnabled(): boolean;
1455
2016
 
1456
2017
  interface ClipCollisionOptions {
1457
- tracks: ClipTrack[];
2018
+ /**
2019
+ * The tracks to check against, or a function returning them. Pass a function
2020
+ * (reading a ref, say) to keep the configured modifier's identity stable while
2021
+ * tracks change, so the modifiers array handed to DragDropProvider is not
2022
+ * rebuilt on every edit.
2023
+ */
2024
+ tracks: readonly ClipTrack[] | (() => readonly ClipTrack[]);
1458
2025
  samplesPerPixel: number;
1459
2026
  }
1460
2027
  /**
@@ -1463,8 +2030,9 @@ interface ClipCollisionOptions {
1463
2030
  * For clip move operations: constrains horizontal transform to valid positions
1464
2031
  * using the engine's collision detection.
1465
2032
  *
1466
- * For boundary trim operations: returns zero transform because visual feedback
1467
- * comes from React state updates resizing the clip, not from CSS translate.
2033
+ * For boundary trim operations: returns zero transform because the trim is
2034
+ * shown by the trim preview, which draws the clip at its previewed geometry,
2035
+ * not by a CSS translate.
1468
2036
  */
1469
2037
  declare class ClipCollisionModifier extends Modifier<DragDropManager<any, any>, ClipCollisionOptions> {
1470
2038
  apply(operation: DragOperation): {
@@ -1476,7 +2044,7 @@ declare class ClipCollisionModifier extends Modifier<DragDropManager<any, any>,
1476
2044
 
1477
2045
  interface SnapToGridBeatsOptions {
1478
2046
  mode: 'beats';
1479
- snapTo: SnapTo;
2047
+ snapTo: BeatsAndBarsSnapTo;
1480
2048
  bpm: number;
1481
2049
  timeSignature: [number, number];
1482
2050
  samplesPerPixel: number;
@@ -1561,4 +2129,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
1561
2129
  bits: 8 | 16;
1562
2130
  }>;
1563
2131
 
1564
- export { type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, SortableTrackControls, type SortableTrackControlsProps, type SortableTrackControlsRenderProps, type SpectrogramCanvasRegistration, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackState, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useKeyboardShortcuts, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistDataOptional, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useZoomControls, waveformDataToPeaks };
2132
+ export { type ActiveAnnotationContextValue, type AnnotationIntegration, AnnotationIntegrationProvider, AnnotationList, type AnnotationListProp, type AnnotationListProps, type AnnotationOptionsContextValue, type AnnotationPreviewHandle, type AnnotationsContextValue, AudioPosition, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionOptions, type ClipInteractionOptionsProps, ClipInteractionProvider, type ClipInteractionProviderProps, type ClipPeaks, type CurrentTimeContextValue, DefaultTrackControls, type DefaultTrackControlsProps, type EditorControlsContextValue, type EngineRefsContextValue, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, type IsPlayingContextValue, KeyboardShortcuts, type KeyboardShortcutsProps, LoopButton, type LoopContextValue, MasterVolumeControl, type MasterVolumeControls, MediaElementPlaylistProvider, type MediaElementTrackConfig, type MediaElementTrackContextValue, MediaElementWaveform, type MediaElementWaveformProps, MediaElementWaveformRoot, type MediaElementWaveformRootProps, PauseButton, PlayButton, type PlaybackControlsContextValue, type PlaybackRateContextValue, PlaybackRateSelect, type PlaybackRefsContextValue, type PlaylistMixerContextValue, type PlaylistSettingsContextValue, type PlaylistTimelineContextValue, type PlaylistViewContextValue, type PlaylistZoomContextValue, type RecordingSessionOptions, RewindButton, type SelectedTrackIdContextValue, type SelectionContextValue, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackClipPeaks, type TrackContextValue, type TrackDragPreview, TrackMenuButton, TrackMuteButton, TrackName, TrackPanSlider, TrackRemoveButton, type TrackRemoveButtonProps, TrackReorderGrip, type TrackReorderHandle, type TrackReorderPreviewContextValue, TrackSoloButton, type TrackState, TrackVolumeSlider, type UndoRedoContextValue, type UseCreateArrangementOptions, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, Waveform, WaveformAnnotationBoxes, type WaveformAnnotationBoxesProps, WaveformClipHeaders, WaveformEditor, type WaveformEditorProps, WaveformFades, WaveformLoopRegion, WaveformPlayhead, type WaveformPlayheadProps, WaveformPlaylistProvider, type WaveformProps, WaveformRecordingPreview, type WaveformRecordingPreviewProps, type WaveformRecordingState, WaveformRoot, type WaveformRootProps, WaveformSelection, WaveformTimescale, type WaveformTimescaleProps, WaveformTrackControls, type WaveformTrackControlsProps, WaveformTracks, type WaveformTracksProps, WaveformViewOptions, type WaveformViewOptionsProps, type ZoomControls, ZoomInButton, ZoomOutButton, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, useActiveAnnotation, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAnnotationOptions, useAnnotations, useAnnotationsWithPreview, useArrangement, useArrangementSources, useArrangementTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useCreateArrangement, useCurrentTime, useDragSensors, useEditorControls, useEngineRefs, useIsPlaying, useKeyboardShortcuts, useLoop, useMasterVolume, useMediaElementTrack, usePlaybackControls, usePlaybackRate, usePlaybackRefs, usePlaybackShortcuts, usePlaylistMixer, usePlaylistSettings, usePlaylistTimeline, usePlaylistView, usePlaylistZoom, useRecordingSession, useSelectedTrackId, useSelection, useSpectrogramIntegration, useTimeFormat, useTrack, useTrackReorderHandle, useTrackReorderPreview, useUndoRedo, useZoomControls, waveformDataToPeaks };