@dawcore/components 0.0.23 → 0.0.25

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
@@ -46,6 +46,87 @@ declare global {
46
46
  }
47
47
  }
48
48
 
49
+ /** Range/display metadata for one effect parameter. */
50
+ interface EffectParamDef {
51
+ min: number;
52
+ max: number;
53
+ step?: number;
54
+ /** 's', 'ms', 'Hz', 'dB', '%' … */
55
+ unit?: string;
56
+ }
57
+ /**
58
+ * A live, wired effect. `input`/`output` are the chain attachment points
59
+ * (the same node for single-node effects). `applyParams` updates AudioParams
60
+ * in place — the chain never rebuilds for parameter changes.
61
+ */
62
+ interface EffectInstance {
63
+ input: AudioNode;
64
+ output: AudioNode;
65
+ applyParams: (params: Record<string, number>) => void;
66
+ dispose?: () => void;
67
+ /** Serializable snapshot of plugin-internal state (WAM getState). */
68
+ getState?: () => Promise<unknown>;
69
+ /** Builds the plugin's own GUI element (WAM createGui). GUI lifecycle is
70
+ * independent of audio — hiding/destroying a GUI never stops processing. */
71
+ createGui?: () => Promise<HTMLElement>;
72
+ /** Releases a GUI element previously built by `createGui` (WAM destroyGui). */
73
+ destroyGui?: (gui: HTMLElement) => void;
74
+ /** Parameter metadata for the generic fallback panel (WAM getParameterInfo). */
75
+ getParameterInfo?: () => Promise<unknown>;
76
+ }
77
+ /** A registered effect type. `create` must work on any BaseAudioContext so
78
+ * the same definitions serve offline rendering. */
79
+ interface EffectDefinition {
80
+ label: string;
81
+ category: string;
82
+ defaults: Record<string, number>;
83
+ params: Record<string, EffectParamDef>;
84
+ /** Name of the wet/dry param, when the effect has one. Bypass zeroes it
85
+ * (storing the original); effects without one are bypassed by
86
+ * disconnection. */
87
+ wetParam?: string;
88
+ create: (audioContext: BaseAudioContext, params: Record<string, number>) => EffectInstance;
89
+ }
90
+ /** Public, serializable view of one chain entry. */
91
+ interface EffectState {
92
+ id: string;
93
+ kind: string;
94
+ type: string;
95
+ params: Record<string, number>;
96
+ bypassed: boolean;
97
+ url?: string;
98
+ /** Present on Faust entries: the DSP source this effect was compiled from. */
99
+ source?: {
100
+ faust: string;
101
+ };
102
+ label?: string;
103
+ error?: string;
104
+ }
105
+ /** Persisted form of a chain — see README for the consumer contract. */
106
+ type SerializedEffectEntry = {
107
+ kind: 'native';
108
+ type: string;
109
+ params: Record<string, number>;
110
+ bypassed: boolean;
111
+ } | {
112
+ kind: 'wam';
113
+ /** Module URL for url-loaded plugins. Absent for Faust entries. */
114
+ url?: string;
115
+ bypassed: boolean;
116
+ state?: unknown;
117
+ /** Faust DSP source — restore recompiles in-browser via @dawcore/faust
118
+ * instead of fetching a URL. */
119
+ faustDsp?: string;
120
+ /** Name the Faust entry was compiled under (restores the same label). */
121
+ faustName?: string;
122
+ };
123
+ /** Result of creating an effect via the registry. */
124
+ interface CreatedEffect {
125
+ instance: EffectInstance;
126
+ params: Record<string, number>;
127
+ wetParam?: string;
128
+ }
129
+
49
130
  declare class DawTrackElement extends LitElement {
50
131
  src: string;
51
132
  name: string;
@@ -59,6 +140,35 @@ declare class DawTrackElement extends LitElement {
59
140
  spectrogramConfig: SpectrogramConfig | null;
60
141
  readonly trackId: `${string}-${string}-${string}-${string}-${string}`;
61
142
  createRenderRoot(): this;
143
+ addEffect(type: string, params?: Record<string, number>): string;
144
+ /** Load a WAM plugin (via the optional @dawcore/wam peer) into this track's chain. */
145
+ addWamPlugin(url: string, initialState?: unknown): Promise<string>;
146
+ /**
147
+ * Compile Faust DSP source in the browser (via the optional @dawcore/faust
148
+ * peer) and add the resulting WAM to this track's chain. Compile errors
149
+ * keep their Faust line/column diagnostics and leave the chain untouched.
150
+ */
151
+ addFaustEffect(dspCode: string, options?: {
152
+ name?: string;
153
+ }): Promise<string>;
154
+ /** Snapshot this track's chain in its persisted form (see dawcore README). */
155
+ getEffectsState(): Promise<SerializedEffectEntry[]>;
156
+ /** Replace this track's chain with a persisted snapshot. */
157
+ setEffectsState(entries: SerializedEffectEntry[]): Promise<void>;
158
+ /**
159
+ * Open (lazily creating) the GUI for one of this track's effects into a
160
+ * consumer-provided container. Closing hides without interrupting audio;
161
+ * the element is cached for reopen. See <daw-editor>.openEffectGui.
162
+ */
163
+ openEffectGui(effectId: string, container: HTMLElement): Promise<HTMLElement>;
164
+ /** Hide an effect's GUI (cached for reopen — never destroys). */
165
+ closeEffectGui(effectId: string): void;
166
+ removeEffect(effectId: string): void;
167
+ setEffectParams(effectId: string, params: Record<string, number>): void;
168
+ setEffectBypassed(effectId: string, bypassed: boolean): void;
169
+ moveEffect(effectId: string, newIndex: number): void;
170
+ get effects(): EffectState[];
171
+ private _effectsEditor;
62
172
  connectedCallback(): void;
63
173
  private _hasRendered;
64
174
  updated(changed: PropertyValues): void;
@@ -171,17 +281,14 @@ declare global {
171
281
  }
172
282
 
173
283
  declare class DawPlayheadElement extends LitElement {
174
- private _animation;
175
284
  private _line;
176
285
  static styles: lit.CSSResult;
177
286
  render(): lit.TemplateResult<1>;
178
287
  firstUpdated(): void;
179
- startAnimation(getTime: () => number, sampleRate: number, samplesPerPixel: number): void;
180
- stopAnimation(time: number, sampleRate: number, samplesPerPixel: number): void;
181
- startBeatsAnimation(getTime: () => number, bpm: number, ppqn: number, ticksPerPixel: number): void;
182
- stopBeatsAnimation(time: number, bpm: number, ppqn: number, ticksPerPixel: number): void;
183
- startBeatsAnimationWithMap(getTime: () => number, secondsToTicks: (s: number) => number, ticksPerPixel: number): void;
184
- stopBeatsAnimationWithMap(time: number, secondsToTicks: (s: number) => number, ticksPerPixel: number): void;
288
+ /** Position the playhead line at an absolute pixel offset on the timeline.
289
+ * The editor's PlaybackAnimationController drives this each frame — the
290
+ * playhead owns no animation loop or time math of its own. */
291
+ setPosition(px: number): void;
185
292
  }
186
293
  declare global {
187
294
  interface HTMLElementTagNameMap {
@@ -202,10 +309,28 @@ declare global {
202
309
 
203
310
  /**
204
311
  * Base class for transport button elements.
205
- * Finds target daw-editor via closest <daw-transport>.
312
+ * Finds target via closest <daw-transport>. Capability detection is
313
+ * duck-typed (#474): subclasses declare requiredTargetMethods and render
314
+ * `?disabled=${!this.targetSupported}`; targets lacking the methods get a
315
+ * disabled control and a one-time console warning on interaction.
206
316
  */
207
317
  declare class DawTransportButton extends LitElement {
318
+ /** Methods the transport target must implement for this control to be
319
+ * enabled. Empty = works with any target. */
320
+ protected static requiredTargetMethods: readonly string[];
208
321
  protected get target(): any;
322
+ private get _requiredMethods();
323
+ /**
324
+ * False when this control declares requirements its target doesn't meet.
325
+ * An undetermined target (missing, or a not-yet-upgraded custom element)
326
+ * gets the benefit of the doubt and stays enabled — click-time resolution
327
+ * warns if it's still unusable.
328
+ */
329
+ protected get targetSupported(): boolean;
330
+ connectedCallback(): void;
331
+ disconnectedCallback(): void;
332
+ private _onCapabilityPointerEnter;
333
+ private _onCapabilityPointerDown;
209
334
  static styles: lit.CSSResultGroup;
210
335
  }
211
336
 
@@ -721,6 +846,20 @@ declare class ClipPointerHandler {
721
846
  private _reset;
722
847
  }
723
848
 
849
+ /**
850
+ * Time display formats for <daw-time-display> / <daw-time-format> and the
851
+ * editor's `time-format` attribute. The three formats come from the
852
+ * web-components-migration spec ("Element Registry": hh:mm:ss.sss | hh:mm:ss
853
+ * | seconds). parseDisplayTime exists for the selection inputs (#463).
854
+ */
855
+ type TimeDisplayFormat = 'hh:mm:ss.sss' | 'hh:mm:ss' | 'seconds';
856
+ declare const TIME_DISPLAY_FORMATS: readonly TimeDisplayFormat[];
857
+ declare function isTimeDisplayFormat(value: unknown): value is TimeDisplayFormat;
858
+ /** Format seconds for display. Non-finite or negative input renders as 0. */
859
+ declare function formatDisplayTime(seconds: number, format: TimeDisplayFormat): string;
860
+ /** Parse a formatted time string back to seconds. Lenient: returns 0 for empty/unparseable input; does not validate segment ranges. */
861
+ declare function parseDisplayTime(value: string, format: TimeDisplayFormat): number;
862
+
724
863
  interface DawSelectionDetail {
725
864
  start: number;
726
865
  end: number;
@@ -728,6 +867,13 @@ interface DawSelectionDetail {
728
867
  interface DawSeekDetail {
729
868
  time: number;
730
869
  }
870
+ interface DawTimeUpdateDetail {
871
+ /** Current playback time in seconds (latency-compensated while playing). */
872
+ time: number;
873
+ }
874
+ interface DawTimeFormatChangeDetail {
875
+ format: TimeDisplayFormat;
876
+ }
731
877
  interface DawTrackSelectDetail {
732
878
  trackId: string;
733
879
  }
@@ -826,9 +972,50 @@ interface DawSpectrogramErrorDetail {
826
972
  generation: number;
827
973
  error: Error;
828
974
  }
975
+ interface DawEffectAddDetail {
976
+ effectId: string;
977
+ kind: string;
978
+ type: string;
979
+ params: Record<string, number>;
980
+ index: number;
981
+ /** Plugin source URL (kind 'wam', url-loaded). */
982
+ url?: string;
983
+ /** Faust DSP source (kind 'wam', compiled in-browser via @dawcore/faust). */
984
+ source?: {
985
+ faust: string;
986
+ };
987
+ }
988
+ interface DawEffectRemoveDetail {
989
+ effectId: string;
990
+ }
991
+ interface DawEffectChangeDetail {
992
+ effectId: string;
993
+ params: Record<string, number>;
994
+ }
995
+ interface DawEffectBypassDetail {
996
+ effectId: string;
997
+ bypassed: boolean;
998
+ }
999
+ interface DawEffectReorderDetail {
1000
+ effectId: string;
1001
+ fromIndex: number;
1002
+ toIndex: number;
1003
+ }
1004
+ interface DawEffectErrorDetail {
1005
+ effectId: string;
1006
+ /** Plugin source URL (absent for Faust entries, which have no URL). */
1007
+ url?: string;
1008
+ /** Faust DSP source of the failed entry, when applicable. */
1009
+ source?: {
1010
+ faust: string;
1011
+ };
1012
+ message: string;
1013
+ }
829
1014
  interface DawEventMap {
830
1015
  'daw-selection': CustomEvent<DawSelectionDetail>;
831
1016
  'daw-seek': CustomEvent<DawSeekDetail>;
1017
+ 'daw-timeupdate': CustomEvent<DawTimeUpdateDetail>;
1018
+ 'daw-time-format-change': CustomEvent<DawTimeFormatChangeDetail>;
832
1019
  'daw-track-select': CustomEvent<DawTrackSelectDetail>;
833
1020
  'daw-track-connected': CustomEvent<DawTrackConnectedDetail>;
834
1021
  'daw-track-update': CustomEvent<DawTrackIdDetail>;
@@ -855,6 +1042,12 @@ interface DawEventMap {
855
1042
  'daw-clip-split': CustomEvent<DawClipSplitDetail>;
856
1043
  'daw-spectrogram-ready': CustomEvent<DawSpectrogramReadyDetail>;
857
1044
  'daw-spectrogram-error': CustomEvent<DawSpectrogramErrorDetail>;
1045
+ 'daw-effect-add': CustomEvent<DawEffectAddDetail>;
1046
+ 'daw-effect-remove': CustomEvent<DawEffectRemoveDetail>;
1047
+ 'daw-effect-change': CustomEvent<DawEffectChangeDetail>;
1048
+ 'daw-effect-bypass': CustomEvent<DawEffectBypassDetail>;
1049
+ 'daw-effect-reorder': CustomEvent<DawEffectReorderDetail>;
1050
+ 'daw-effect-error': CustomEvent<DawEffectErrorDetail>;
858
1051
  }
859
1052
  type DawEvent<K extends keyof DawEventMap> = DawEventMap[K];
860
1053
  interface LoadFilesResult {
@@ -887,10 +1080,56 @@ interface MidiLoaderHost {
887
1080
  querySelectorAll(selector: string): NodeListOf<Element>;
888
1081
  }
889
1082
 
1083
+ interface ExportOptions {
1084
+ /** Default: the host's sample rate. */
1085
+ sampleRate?: number;
1086
+ /** Window start in seconds. Default: 0. */
1087
+ startTime?: number;
1088
+ /** Window length in seconds. Default: host duration minus startTime. */
1089
+ duration?: number;
1090
+ /** Default: 2 (stereo). */
1091
+ channels?: 1 | 2;
1092
+ }
1093
+ interface ExportClip {
1094
+ startSample: number;
1095
+ durationSamples: number;
1096
+ offsetSamples: number;
1097
+ sampleRate: number;
1098
+ gain?: number;
1099
+ audioBuffer?: AudioBuffer;
1100
+ }
1101
+ interface ExportTrack {
1102
+ id: string;
1103
+ volume: number;
1104
+ pan: number;
1105
+ muted: boolean;
1106
+ soloed: boolean;
1107
+ clips: ExportClip[];
1108
+ }
1109
+ /** What the editor provides to the export pipeline. */
1110
+ interface ExportAudioHost {
1111
+ effectiveSampleRate: number;
1112
+ /** Natural session duration in seconds. */
1113
+ duration: number;
1114
+ tracks: ExportTrack[];
1115
+ getMasterEffectsState(): Promise<SerializedEffectEntry[]>;
1116
+ getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
1117
+ }
1118
+
890
1119
  declare class DawEditorElement extends LitElement implements MidiLoaderHost {
891
1120
  get samplesPerPixel(): number;
892
1121
  set samplesPerPixel(value: number);
893
1122
  private _samplesPerPixel;
1123
+ private _timeFormat;
1124
+ /**
1125
+ * Time display format used by <daw-time-display> and (future, #463) the
1126
+ * selection inputs. Lives on the editor — the target element owns the
1127
+ * state, the transport controls reflect it (native-form style).
1128
+ */
1129
+ get timeFormat(): TimeDisplayFormat;
1130
+ set timeFormat(value: TimeDisplayFormat);
1131
+ /** Set the time display format. Sugar over the `timeFormat` property. */
1132
+ setTimeFormat(format: TimeDisplayFormat): void;
894
1133
  waveHeight: number;
895
1134
  timescale: boolean;
896
1135
  mono: boolean;
@@ -989,6 +1228,57 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
989
1228
  set adapter(value: PlayoutAdapter | null);
990
1229
  get adapter(): PlayoutAdapter | null;
991
1230
  private _externalAdapter;
1231
+ private _effectsManager;
1232
+ private get _effects();
1233
+ /** Master effects chain — inserted between the master bus and the destination. */
1234
+ addEffect(type: string, params?: Record<string, number>): string;
1235
+ removeEffect(effectId: string): void;
1236
+ setEffectParams(effectId: string, params: Record<string, number>): void;
1237
+ setEffectBypassed(effectId: string, bypassed: boolean): void;
1238
+ moveEffect(effectId: string, newIndex: number): void;
1239
+ get effects(): EffectState[];
1240
+ /** Load a WAM plugin (via the optional @dawcore/wam peer) into the master chain. */
1241
+ addWamPlugin(url: string, initialState?: unknown): Promise<string>;
1242
+ /**
1243
+ * Compile Faust DSP source in the browser (via the optional @dawcore/faust
1244
+ * peer) and add the resulting WAM to the master chain. Compile errors keep
1245
+ * their Faust line/column diagnostics and leave the chain untouched.
1246
+ */
1247
+ addFaustEffect(dspCode: string, options?: {
1248
+ name?: string;
1249
+ }): Promise<string>;
1250
+ /**
1251
+ * Open (lazily creating) the GUI for a master-chain effect into a
1252
+ * consumer-provided container. WAM plugins mount their own GUI; plugins
1253
+ * without one — and native effects — get the generic parameter panel from
1254
+ * @dawcore/wam. The element is cached: closeEffectGui hides it without
1255
+ * interrupting audio, reopening remounts the same element.
1256
+ */
1257
+ openEffectGui(effectId: string, container: HTMLElement): Promise<HTMLElement>;
1258
+ /** Hide a master-chain effect's GUI (cached for reopen — never destroys). */
1259
+ closeEffectGui(effectId: string): void;
1260
+ /** Snapshot the master chain in its persisted form (see dawcore README). */
1261
+ getEffectsState(): Promise<SerializedEffectEntry[]>;
1262
+ /** Replace the master chain with a persisted snapshot. */
1263
+ setEffectsState(entries: SerializedEffectEntry[]): Promise<void>;
1264
+ /**
1265
+ * Render the session offline through all effect chains (per-track +
1266
+ * master), including WAM plugins (re-instantiated on the offline context
1267
+ * with their live state). Returns the rendered AudioBuffer.
1268
+ */
1269
+ exportAudio(options?: ExportOptions): Promise<AudioBuffer>;
1270
+ /** Internal — <daw-track> effects API delegates here (dawcore-internal contract). */
1271
+ _trackAddEffect(trackId: string, target: EventTarget, type: string, params?: Record<string, number>): string;
1272
+ _trackEffectOp(trackId: string, target: EventTarget, op: 'remove' | 'setParams' | 'setBypassed' | 'move', effectId: string, arg?: any): void;
1273
+ _trackEffects(trackId: string): EffectState[];
1274
+ _trackAddWamPlugin(trackId: string, target: EventTarget, url: string, initialState?: unknown): Promise<string>;
1275
+ _trackAddFaustEffect(trackId: string, target: EventTarget, dspCode: string, options?: {
1276
+ name?: string;
1277
+ }): Promise<string>;
1278
+ _trackOpenEffectGui(trackId: string, target: EventTarget, effectId: string, container: HTMLElement): Promise<HTMLElement>;
1279
+ _trackCloseEffectGui(_trackId: string, effectId: string): void;
1280
+ _trackGetEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
1281
+ _trackSetEffectsState(trackId: string, target: EventTarget, entries: SerializedEffectEntry[]): Promise<void>;
992
1282
  get audioContext(): AudioContext;
993
1283
  _engine: PlaylistEngine | null;
994
1284
  private _warnedMissingTicksToSeconds;
@@ -1009,6 +1299,14 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1009
1299
  private _audioResume;
1010
1300
  eagerResume?: string;
1011
1301
  private _recordingController;
1302
+ private _playbackAnimation;
1303
+ /**
1304
+ * True while a seek-while-playing stop+play transition is in flight.
1305
+ * Suppresses the transient settle dispatch from the engine 'stop' handler
1306
+ * (which would otherwise leak a backward-jumping daw-timeupdate at the
1307
+ * play-start position). Non-private: pointer-handler's seek path sets it.
1308
+ */
1309
+ _inSeekTransition: boolean;
1012
1310
  private _spectrogramController;
1013
1311
  private _clipPointer;
1014
1312
  get _clipHandler(): ClipPointerHandler | null;
@@ -1234,6 +1532,10 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1234
1532
  splitAtPlayhead(): boolean;
1235
1533
  recordingStream: MediaStream | null;
1236
1534
  get currentTime(): number;
1535
+ /** Read-only: whether playback is running (HTMLMediaElement-adjacent). */
1536
+ get isPlaying(): boolean;
1537
+ /** Read-only: total content duration in seconds. */
1538
+ get duration(): number;
1237
1539
  get isRecording(): boolean;
1238
1540
  get isRecordingPaused(): boolean;
1239
1541
  pauseRecording(): void;
@@ -1255,6 +1557,8 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1255
1557
  createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode;
1256
1558
  startRecording(stream?: MediaStream, options?: RecordingOptions): Promise<void>;
1257
1559
  private _renderRecordingPreview;
1560
+ /** Convert playback seconds to a timeline pixel offset for the active mode. */
1561
+ private _timeToPixels;
1258
1562
  _startPlayhead(): void;
1259
1563
  _stopPlayhead(): void;
1260
1564
  private _getPlayhead;
@@ -1284,6 +1588,7 @@ declare global {
1284
1588
  }
1285
1589
 
1286
1590
  declare class DawRecordButtonElement extends DawTransportButton {
1591
+ protected static requiredTargetMethods: readonly string[];
1287
1592
  private _isRecording;
1288
1593
  private _targetRef;
1289
1594
  private _onStart;
@@ -1396,6 +1701,69 @@ declare global {
1396
1701
  }
1397
1702
  }
1398
1703
 
1704
+ /**
1705
+ * Formatted playback time readout for <daw-transport>.
1706
+ *
1707
+ * Subscribes to bubbled `daw-timeupdate` / `daw-time-format-change` events at
1708
+ * the document level and filters by its transport target — works with any
1709
+ * target that dispatches them (<daw-editor> today, <daw-player> later) and
1710
+ * tolerates targets that upgrade after this element connects.
1711
+ *
1712
+ * Accessibility (spec): role="status", aria-live="off" — not announced every
1713
+ * frame; screen reader users query on demand.
1714
+ */
1715
+ declare class DawTimeDisplayElement extends LitElement {
1716
+ /** Null until the first successful target sync or daw-timeupdate. */
1717
+ private _time;
1718
+ private _format;
1719
+ static styles: lit.CSSResult;
1720
+ private get target();
1721
+ private _onTimeUpdate;
1722
+ private _onFormatChange;
1723
+ connectedCallback(): void;
1724
+ disconnectedCallback(): void;
1725
+ private _syncFromTarget;
1726
+ render(): lit.TemplateResult<1>;
1727
+ }
1728
+ declare global {
1729
+ interface HTMLElementTagNameMap {
1730
+ 'daw-time-display': DawTimeDisplayElement;
1731
+ }
1732
+ }
1733
+
1734
+ /**
1735
+ * Time format select for <daw-transport>. Sets the format ON the target
1736
+ * (`target.setTimeFormat(...)`) — the target owns the state (native-form
1737
+ * style), and every display/input syncs via the bubbled
1738
+ * `daw-time-format-change` event. Renders disabled when the target doesn't
1739
+ * implement setTimeFormat (duck-typed capability detection, #474).
1740
+ */
1741
+ declare class DawTimeFormatElement extends LitElement {
1742
+ private _format;
1743
+ static styles: lit.CSSResult;
1744
+ private get target();
1745
+ /**
1746
+ * False when the target doesn't implement setTimeFormat. An undetermined
1747
+ * target (missing, or a not-yet-upgraded custom element) gets the benefit
1748
+ * of the doubt and stays enabled — interaction-time resolution warns if
1749
+ * it's still unusable.
1750
+ */
1751
+ private get _targetSupported();
1752
+ private _onFormatChange;
1753
+ private _onPointerEnter;
1754
+ private _onPointerDown;
1755
+ connectedCallback(): void;
1756
+ disconnectedCallback(): void;
1757
+ protected updated(): void;
1758
+ private _onSelectChange;
1759
+ render(): lit.TemplateResult<1>;
1760
+ }
1761
+ declare global {
1762
+ interface HTMLElementTagNameMap {
1763
+ 'daw-time-format': DawTimeFormatElement;
1764
+ }
1765
+ }
1766
+
1399
1767
  interface SpectrogramControllerHost extends ReactiveControllerHost {
1400
1768
  dispatchEvent(event: Event): boolean;
1401
1769
  }
@@ -1459,6 +1827,78 @@ declare class AudioResumeController implements ReactiveController {
1459
1827
  private _removeListeners;
1460
1828
  }
1461
1829
 
1830
+ interface PlayheadLike {
1831
+ setPosition(px: number): void;
1832
+ }
1833
+ interface PlaybackAnimationOptions {
1834
+ /** Convert playback seconds to a timeline pixel offset. */
1835
+ timeToPixels: (time: number) => number;
1836
+ /** Resolve the playhead element (re-queried per call — templates may recreate it). */
1837
+ getPlayhead: () => PlayheadLike | null;
1838
+ }
1839
+ /**
1840
+ * The single editor-owned playback animation loop (mirror of the React
1841
+ * `usePlaybackAnimation` pattern). Each frame reads the latency-compensated
1842
+ * playback time ONCE, positions the playhead, and dispatches `daw-timeupdate`
1843
+ * from the host element. External consumers hook into the same loop by
1844
+ * listening for `daw-timeupdate` — never add a second RAF loop for
1845
+ * playback-time concerns.
1846
+ *
1847
+ * `timeToPixels` and `getPlayhead` are injected once at construction — they
1848
+ * are stable per host, and threading them through every `start`/`stop` call
1849
+ * invited desync between the two call sites.
1850
+ *
1851
+ * HTMLMediaElement-adjacent: `stop()` dispatches one final event so idle
1852
+ * displays settle on the exact commanded position (media elements fire
1853
+ * `timeupdate` on pause and seek too). Pass `{ dispatch: false }` for
1854
+ * transitional stops (stop+play seeks) whose settle position must not leak
1855
+ * to consumers.
1856
+ */
1857
+ declare class PlaybackAnimationController {
1858
+ private _animation;
1859
+ private _host;
1860
+ private _options;
1861
+ private _running;
1862
+ private _lastDispatchedTime;
1863
+ constructor(host: ReactiveControllerHost & HTMLElement, options: PlaybackAnimationOptions);
1864
+ start(getTime: () => number): void;
1865
+ stop(finalTime: number, opts?: {
1866
+ dispatch?: boolean;
1867
+ }): void;
1868
+ private _dispatchTimeUpdate;
1869
+ }
1870
+
1871
+ /**
1872
+ * Transport target resolution + duck-typed capability detection.
1873
+ *
1874
+ * Transport controls never instanceof-check their target — they probe for the
1875
+ * methods they need (`typeof target[m] === 'function'`). This is what lets the
1876
+ * same controls drive <daw-editor>, the future <daw-player> (#454), or any
1877
+ * conforming element, and lets editor-only controls render disabled against a
1878
+ * player (#474, spec "Transport Compatibility").
1879
+ */
1880
+ /**
1881
+ * Resolve the target of the closest <daw-transport for="..."> ancestor.
1882
+ * Walks light-DOM ancestors only (`closest` does not cross shadow boundaries).
1883
+ */
1884
+ declare function resolveTransportTarget(el: Element): HTMLElement | null;
1885
+ /** True when target exists and every named method is a function on it. */
1886
+ declare function targetSupports(target: unknown, methods: readonly string[]): boolean;
1887
+ /**
1888
+ * One-time console warning for a transport control.
1889
+ * Dedup is per element per message — distinct messages on the same element
1890
+ * each warn once, while repeats of the same message stay silent. A
1891
+ * missing-target warn and an unsupported-target warn no longer suppress each
1892
+ * other.
1893
+ */
1894
+ declare function warnOnce(element: Element, message: string): void;
1895
+ /**
1896
+ * One-time console warning explaining why a control is disabled.
1897
+ * Delegates to {@link warnOnce} — an element that already triggered a
1898
+ * missing-target warn will not warn again here.
1899
+ */
1900
+ declare function warnUnsupportedOnce(element: Element, methods: readonly string[]): void;
1901
+
1462
1902
  /** Narrow engine contract for pointer interactions. */
1463
1903
  interface PointerEngineContract {
1464
1904
  setSelection(start: number, end: number): void;
@@ -1496,4 +1936,9 @@ interface SplitHost {
1496
1936
  */
1497
1937
  declare function splitAtPlayhead(host: SplitHost): boolean;
1498
1938
 
1499
- export { AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawSpectrogramElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, SpectrogramController, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type UndoShortcutMap, type WaveformSegment, isDomClip, splitAtPlayhead };
1939
+ declare function registerEffect(type: string, definition: EffectDefinition): void;
1940
+ /** A copy — mutating the returned map does not affect the registry. */
1941
+ declare function getEffectDefinitions(): Map<string, EffectDefinition>;
1942
+ declare function createEffectInstance(type: string, audioContext: BaseAudioContext, params?: Record<string, number>): CreatedEffect;
1943
+
1944
+ export { AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawSpectrogramElement, DawStopButtonElement, DawTimeDisplayElement, type DawTimeFormatChangeDetail, DawTimeFormatElement, type DawTimeUpdateDetail, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type EffectDefinition, type EffectInstance, type EffectParamDef, type EffectState, type ExportAudioHost, type ExportOptions, type KeyBinding, type LoadFilesResult, PlaybackAnimationController, type PlaybackAnimationOptions, type PlaybackShortcutMap, type PlayheadLike, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SerializedEffectEntry, SpectrogramController, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, TIME_DISPLAY_FORMATS, type TimeDisplayFormat, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type UndoShortcutMap, type WaveformSegment, createEffectInstance, formatDisplayTime, getEffectDefinitions, isDomClip, isTimeDisplayFormat, parseDisplayTime, registerEffect, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };