@dawcore/components 0.0.39-next.5 → 0.0.39-next.6

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
@@ -2,7 +2,7 @@ import * as lit from 'lit';
2
2
  import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
3
3
  import { AnnotationData, AnnotationShortcutMap, MidiNoteData, TrackKind, RenderMode, SpectrogramConfig, Peaks, Bits, FadeType, PeakData, MeterEntry, SnapTo, ColorMapValue, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
4
4
  import WaveformData from 'waveform-data';
5
- import { TrackMixerValues, PlayoutAdapter, PlaylistEngine } from '@waveform-playlist/engine';
5
+ import { Arrangement, PlayoutAdapter, PlaylistEngine, TrackMixerValues } from '@waveform-playlist/engine';
6
6
  import { MidiLoadOptions, MidiLoadResult } from '@dawcore/midi';
7
7
  import { ClipRegistration, CanvasRegistration, ViewportState } from '@dawcore/spectrogram';
8
8
 
@@ -590,8 +590,8 @@ interface BaseClipDescriptor {
590
590
  /**
591
591
  * A clip descriptor sourced from a `<daw-clip>` DOM element. `clipId` is
592
592
  * always set — `<daw-clip>.clipId` is a `crypto.randomUUID()` generated at
593
- * construction. Engine `clip.id` is aligned with this id in `_loadTrack`
594
- * and `_loadAndAppendClip` so DOM and engine reference the same clip.
593
+ * construction. The arrangement clip's id is this id (`buildArrangementTrack`,
594
+ * `_loadAndAppendClip`), so the DOM and the arrangement name the same clip.
595
595
  */
596
596
  interface DomClipDescriptor extends BaseClipDescriptor {
597
597
  kind: 'dom';
@@ -600,16 +600,18 @@ interface DomClipDescriptor extends BaseClipDescriptor {
600
600
  /**
601
601
  * A clip descriptor synthesized from a non-DOM source — file drops, the
602
602
  * `<daw-track src>` shorthand fallback, or recording-clip insertion. There
603
- * is no DOM element to align with; the engine generates its own id at
604
- * clip-creation time.
603
+ * is no DOM element to align with.
605
604
  *
606
- * `clipId` is that engine clip id when the editor knows it at descriptor
607
- * creation — currently recorded takes (#659). Pass it to
608
- * `editor.updateClip()` / `removeClip()` to address the clip.
605
+ * `clipId` is the arrangement clip's id: set at creation for a recorded take
606
+ * (#659), and written in when a dropped file or the shorthand enters the
607
+ * arrangement (#848). Pass it to `editor.updateClip()` / `removeClip()` to
608
+ * address the clip.
609
609
  */
610
610
  interface DropClipDescriptor extends BaseClipDescriptor {
611
611
  kind: 'drop';
612
612
  clipId?: string;
613
+ /** A dropped file the clip loads (`src` is then ''): a File cannot be an attribute (#848). */
614
+ file?: File;
613
615
  }
614
616
  type ClipDescriptor = DomClipDescriptor | DropClipDescriptor;
615
617
  /**
@@ -940,7 +942,6 @@ interface RecordingHost extends ReactiveControllerHost {
940
942
  * position and misplaces punch-in (record-during-playback) clips. */
941
943
  readonly currentTime: number;
942
944
  readonly shadowRoot: ShadowRoot | null;
943
- resolveAudioContextSampleRate(rate: number): void;
944
945
  _addRecordedClip?(trackId: string, buf: AudioBuffer, startSample: number, durSamples: number, offsetSamples?: number, clipName?: string): void;
945
946
  /** Structural view of the editor's engine for the take's mute (#843):
946
947
  * punch-in replaces the overlapped content, so the recorded-over track's
@@ -1210,14 +1211,13 @@ interface DawTrackUpdateDetail {
1210
1211
  */
1211
1212
  changed: readonly string[];
1212
1213
  }
1214
+ /**
1215
+ * `daw-track-error`: every clip of the track failed to load or was refused
1216
+ * for its kind. The track stays in the editor; `retryTrack` loads it again.
1217
+ */
1213
1218
  interface DawTrackErrorDetail {
1214
1219
  trackId: string;
1215
1220
  error: unknown;
1216
- /** Present when the load was CANCELLED rather than failed: the track was
1217
- * removed (or the editor disconnected) while its clips were still loading.
1218
- * Consumer error UIs should filter these — nothing actually failed; the
1219
- * event exists so addTrack()/loadMidi() awaiters settle. */
1220
- reason?: 'removed' | 'disconnected';
1221
1221
  }
1222
1222
  interface DawFilesLoadErrorDetail {
1223
1223
  file: File;
@@ -1455,12 +1455,13 @@ interface LoadFilesResult {
1455
1455
  * Minimal host surface needed by `loadMidiImpl`. `<daw-editor>` satisfies this
1456
1456
  * structurally. `querySelectorAll` is needed for cleanup-on-failure so the
1457
1457
  * loader can identify `<daw-track>` elements appended during this call (both
1458
- * those whose `addTrack` resolved and those that rejected after `_loadTrack`
1459
- * fired `daw-track-error` — the latter aren't in the `addTrack` resolution
1460
- * value, so we need DOM observation to find them).
1458
+ * those whose `addTrack` resolved and those whose entry was refused — the
1459
+ * latter aren't in the `addTrack` resolution value, so we need DOM
1460
+ * observation to find them).
1461
1461
  */
1462
1462
  interface MidiLoaderHost {
1463
- addTrack(config: TrackConfig): Promise<DawTrackElement>;
1463
+ /** Resolves with the track id once the track has entered (#848). */
1464
+ addTrack(config: TrackConfig): Promise<string>;
1464
1465
  querySelectorAll(selector: string): NodeListOf<Element>;
1465
1466
  }
1466
1467
 
@@ -1631,19 +1632,45 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1631
1632
  /** True when the consumer provided BOTH tick conversion callbacks — the
1632
1633
  * external tempo map is authoritative and `bpm` is display/grid-only (#407). */
1633
1634
  get _hasTickCallbacks(): boolean;
1634
- /** Sample rate — reads from adapter's AudioContext when available, otherwise falls back to 48000. */
1635
+ /**
1636
+ * Sample rate: the adapter's AudioContext rate. Without an adapter (after a
1637
+ * disconnect let it go), the rate of the loaded clips the arrangement holds,
1638
+ * else 48000. Decoded audio is at the context's rate, so the two agree.
1639
+ */
1635
1640
  get sampleRate(): number;
1636
- /** Resolved sample rate — falls back to sampleRate property until first audio decode. */
1637
- _resolvedSampleRate: number | null;
1641
+ private _loadedClipSampleRate;
1642
+ /**
1643
+ * The one owner of the tracks, the clips, the mix, the undo history and
1644
+ * loading (#848). Made with the editor, kept across a disconnect; the
1645
+ * engine plays it once there is an adapter.
1646
+ */
1647
+ _arrangement: Arrangement;
1648
+ /** Sends the load events, read from the arrangement (#848). */
1649
+ private _announcer;
1650
+ constructor();
1651
+ /**
1652
+ * Ids of tracks registered (a `<daw-track>` connected, a file dropped) and
1653
+ * not yet in the arrangement: they enter at the next flush, once there is
1654
+ * an engine (#848).
1655
+ */
1656
+ private _entryQueue;
1657
+ private _entryFlushScheduled;
1658
+ /**
1659
+ * Clips an `addClip()` is waiting for, with their track and the way to
1660
+ * reject the call: a removal of the clip or of its track before the clip
1661
+ * loads settles it here, without a public event (#917).
1662
+ */
1663
+ private _awaitedClips;
1664
+ /** Reject the `addClip()` calls waiting for clips that match `which`. */
1665
+ private _rejectAwaitedClips;
1666
+ /** `<daw-track>` elements `addTrack()` made: every other one is the page's (the history rule). */
1667
+ private _editorMadeTracks;
1668
+ /** `.dat` peaks drawn for a clip still loading, by clip id (an editor-only render cache). */
1669
+ _previewPeaks: Map<string, PeakData>;
1670
+ /** The `.dat` data of those clips, handed to the peak pipeline when the audio arrives. */
1671
+ private _previewWaveforms;
1638
1672
  /** Per-track descriptors, without the mix: the arrangement owns that (#843). */
1639
1673
  _tracks: Map<string, StoredTrackDescriptor>;
1640
- /**
1641
- * The mix of a track the engine does not hold yet: what it will enter the
1642
- * arrangement with (from the `<daw-track>` element or the `addTrack` config,
1643
- * changed by a control or `updateTrack` while it loads). Deleted once
1644
- * `engine.getState().tracks` holds the id; read only through `_mixOf`.
1645
- */
1646
- _seedMix: Map<string, TrackMixerValues>;
1647
1674
  _engineTracks: Map<string, ClipTrack>;
1648
1675
  _peaksData: Map<string, PeakData>;
1649
1676
  _isPlaying: boolean;
@@ -1657,9 +1684,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1657
1684
  set adapter(value: PlayoutAdapter | null);
1658
1685
  get adapter(): PlayoutAdapter | null;
1659
1686
  private _externalAdapter;
1660
- /** True after a disconnect disposed the consumer's adapter via the engine
1661
- * — rebuild attempts fail loudly until a fresh adapter is set. */
1662
- private _adapterConsumedByDispose;
1663
1687
  private _effectsManager;
1664
1688
  private get _effects();
1665
1689
  /**
@@ -1742,8 +1766,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1742
1766
  _engine: PlaylistEngine | null;
1743
1767
  private _warnedMissingTicksToSeconds;
1744
1768
  private _warnedMissingSecondsToTicks;
1745
- private _enginePromise;
1746
- _audioCache: Map<string, Promise<AudioBuffer>>;
1747
1769
  private _peaksCache;
1748
1770
  _clipBuffers: Map<string, AudioBuffer>;
1749
1771
  _clipOffsets: Map<string, {
@@ -1754,11 +1776,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1754
1776
  /** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
1755
1777
  private _minSamplesPerPixel;
1756
1778
  private _trackElements;
1757
- /** Track ids with a _loadTrack in flight. Distinct from `_engineTracks`
1758
- * membership: the peaks-first path inserts a render-only PREVIEW track
1759
- * into _engineTracks mid-load, so `has()` alone cannot answer "is this
1760
- * track still loading?". */
1761
- private _loadingTracks;
1762
1779
  private _childObserver;
1763
1780
  private _audioResume;
1764
1781
  eagerResume?: string;
@@ -1803,7 +1820,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1803
1820
  private _scrollSync;
1804
1821
  static styles: lit.CSSResult[];
1805
1822
  get effectiveSampleRate(): number;
1806
- resolveAudioContextSampleRate(rate: number): void;
1807
1823
  /**
1808
1824
  * In beats mode, derive samplesPerPixel from ticksPerPixel so that
1809
1825
  * clip positions, waveforms, and the tick-space grid all align.
@@ -1821,20 +1837,23 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1821
1837
  /** Grid height when no tracks exist — matches scroll area's rendered height. */
1822
1838
  private get _emptyGridHeight();
1823
1839
  _setSelectedTrackId(trackId: string | null): void;
1840
+ /**
1841
+ * Every track: those in the arrangement, in its order, then those still
1842
+ * waiting to enter (#848). A `<daw-track>` whose track an Undo took out of
1843
+ * the arrangement is not listed (its descriptor stays for a Redo).
1844
+ */
1824
1845
  get tracks(): TrackWithId[];
1825
1846
  /**
1826
- * A track's mix, from its one owner: the arrangement (through
1827
- * `_engineTracks`, which follows `mixerVersion`) for a track the engine
1828
- * holds, the seed for one still on its way in (#843).
1847
+ * A track's mix, from its one owner, the arrangement (#843), as the engine
1848
+ * plays it: its projection carries the take's mute, which `getMixer()`
1849
+ * leaves out (the stored mute comes back when the take ends). A track still
1850
+ * waiting to enter shows what its element declares.
1829
1851
  */
1830
1852
  _mixOf(trackId: string): TrackMixerValues;
1831
- /** Replace a track's seed (a new Map: `_seedMix` is reactive state). */
1832
- private _setSeedMix;
1833
- private _deleteSeedMix;
1834
1853
  /**
1835
- * Change one mixer field of a track: the seed while the track is loading
1836
- * (not an undo step, nothing sent), else the engine's setter with
1837
- * `options` (an undo step; changes with one `gesture` id are one step).
1854
+ * Change one mixer field of a track: the arrangement's setter with
1855
+ * `options` (an undo step; changes with one `gesture` id are one step). A
1856
+ * track that has not entered yet changes nothing.
1838
1857
  */
1839
1858
  private _writeMix;
1840
1859
  /**
@@ -1842,8 +1861,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1842
1861
  * of them carry one fresh gesture id. A field left out is not sent.
1843
1862
  */
1844
1863
  private _writeMixFields;
1845
- /** The ordered tracks for `engine.setTracks`, a loading track with its seed. */
1846
- private _tracksForEngine;
1847
1864
  get selectedTrackId(): string | null;
1848
1865
  get selection(): {
1849
1866
  start: number;
@@ -1894,72 +1911,126 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1894
1911
  private _onClipConnected;
1895
1912
  private _onClipUpdate;
1896
1913
  private _onClipRemovedFromDom;
1914
+ /**
1915
+ * A `<daw-clip>` appended to a track that has entered: the clip goes in as
1916
+ * a loading clip (a loaded one for MIDI), one undo step. Its audio loads
1917
+ * like any other; `daw-clip-ready` or `daw-clip-error` follows (#848).
1918
+ */
1897
1919
  private _loadAndAppendClip;
1898
1920
  /**
1899
1921
  * Resolve pre-computed peaks for a clip: fetch the .dat/.json, validate the
1900
1922
  * sample rate matches the AudioContext, return the WaveformData or null.
1901
1923
  * Warns on fetch failure and on sample-rate mismatch — never silent.
1902
1924
  *
1903
- * Shared between `_loadTrack` (peaks-first preview path) and
1904
- * `_loadAndAppendClip` (incremental late-append).
1925
+ * Used by `_requestPreview` for a clip that is still loading.
1905
1926
  */
1906
1927
  private _resolvePeaks;
1907
- /**
1908
- * Construct an AudioClip from a decoded buffer (and optional WaveformData),
1909
- * align its id with the source `<daw-clip>.clipId` when present, populate
1910
- * `_clipBuffers` / `_clipOffsets`, generate peaks via the worker pipeline,
1911
- * and populate `_peaksData`. Returns the finished AudioClip.
1912
- *
1913
- * Shared between `_loadTrack`'s standard path and `_loadAndAppendClip`.
1914
- * Not used by `_loadTrack`'s peaks-first preview path because that path
1915
- * uses sync `extractPeaks` and inserts a preview track BEFORE audio decode.
1916
- */
1917
- private _finalizeAudioClip;
1918
- /**
1919
- * Filter MIDI notes to only those with finite, in-range fields. Logs a
1920
- * warning for each dropped note. Used by _buildMidiClip and the
1921
- * _applyClipUpdate MIDI branch to prevent NaN propagation through the
1922
- * timeline.
1923
- */
1924
- private _validMidiNotes;
1925
- /**
1926
- * A clip descriptor is treated as MIDI when it has no audio src.
1927
- * Includes placeholder MIDI clips (no notes, no duration yet — registered
1928
- * with a 1s default span; notes upgrade via _applyClipUpdate). Warns when
1929
- * a clip ambiguously has both src and midiNotes — the audio path runs
1930
- * and notes would be silently ignored.
1931
- */
1932
- private _isMidiDescriptor;
1933
- /**
1934
- * Build an engine clip from a MIDI clip descriptor. Always returns a clip
1935
- * — empty notes / no declared duration get a 1-second placeholder span so
1936
- * the clip is reachable via `engine.updateTrack` once notes arrive.
1937
- */
1938
- private _buildMidiClip;
1939
1928
  /** Remove a single clip from all per-clip caches. Used by error rollbacks. */
1940
1929
  private _purgeClipCaches;
1941
1930
  /**
1942
- * Recompute duration and forward an updated track to the engine. Single
1943
- * source of truth for the incremental-vs-full-rebuild policy used by every
1944
- * clip-level mutation (addClip, updateClip, removeClip, _applyClipUpdate).
1945
- * Use the engine's incremental updateTrack when available; otherwise fall
1946
- * back to full setTracks (legacy adapters).
1931
+ * Replace one loaded clip of a track in the arrangement: an undo step. The
1932
+ * function form, so the track's loading clips stay as they are (#848).
1947
1933
  */
1948
- private _commitTrackChange;
1934
+ private _replaceClip;
1949
1935
  private _applyClipUpdate;
1936
+ /** Remove a clip (loaded or still loading) from a track of the arrangement: an undo step. */
1950
1937
  private _removeClipFromTrack;
1951
1938
  private _readTrackDescriptor;
1939
+ private _readClipDescriptor;
1940
+ private _isEntered;
1941
+ /** Queue a registered track for the next flush. */
1942
+ _queueEntry(trackId: string): void;
1943
+ /**
1944
+ * Enter the queued tracks into the arrangement, in DOM order. Without an
1945
+ * engine they wait (the sample rate of a MIDI clip comes from the
1946
+ * adapter); the engine's build flushes again. The page's tracks entering
1947
+ * while the arrangement has no history are not undo steps: the history is
1948
+ * cleared after them, so Undo right after load removes nothing (and the
1949
+ * next page track finds it empty again).
1950
+ */
1951
+ _flushTrackEntries(): void;
1952
+ private _waitingForDragEnd;
1953
+ /** Flush the queue once the drag in progress has ended (its pointer or key is released). */
1954
+ private _flushAfterDrag;
1955
+ /** Enter one registered track. False when it is gone, already in, or refused. */
1956
+ private _enterTrack;
1957
+ /**
1958
+ * The `<daw-track src>` shorthand changed its src: the entered track gets a
1959
+ * new loading clip for it, one undo step. A track whose clips are
1960
+ * `<daw-clip>` children keeps them. A track still queued reads the new
1961
+ * descriptor when it enters.
1962
+ */
1963
+ private _replaceShorthandClips;
1964
+ /** Run the load announcements over the arrangement's current state. */
1965
+ private _announceLoading;
1966
+ /**
1967
+ * Fetch a loading clip's `.dat` peaks and draw them until its audio
1968
+ * arrives (an editor-only cache, not the arrangement: writing the clip
1969
+ * after it entered would be an undo step).
1970
+ */
1971
+ private _requestPreview;
1972
+ /** The peak sync made a clip's peaks: its zoom floor holds, its preview goes. */
1973
+ _clipPeaksReady(clipId: string, audioBuffer: AudioBuffer): void;
1974
+ /** Who waits for a track to enter (addTrack, a dropped file). */
1975
+ private _entryWaiters;
1976
+ private _waitForEntry;
1977
+ /** Settle the wait for a track's entry: entered (`null`), or refused or gone. */
1978
+ private _settleEntry;
1979
+ /**
1980
+ * A dropped file as a track with no element (a File cannot be an attribute):
1981
+ * one loading clip whose source is the file. Resolves with the track id once
1982
+ * it has entered, an undo step like any track an editor method adds.
1983
+ */
1984
+ _addDroppedFile(file: File): Promise<string>;
1985
+ /**
1986
+ * Take a track out for good: no undo step, and no undo or redo brings it
1987
+ * back (a dropped file that could not be loaded was never a declaration).
1988
+ */
1989
+ _discardTrack(trackId: string): void;
1990
+ /** Ends the waits of `_whenTrackLoaded` (as loaded) when the editor is disconnected. */
1991
+ private _loadWaitEnds;
1992
+ /**
1993
+ * Resolves once the track has loaded (`daw-track-ready`), or when the
1994
+ * editor is disconnected meanwhile (the track is kept and loads after a
1995
+ * reparent); rejects when its audio failed (`daw-track-error`).
1996
+ */
1997
+ _whenTrackLoaded(trackId: string): Promise<void>;
1998
+ /**
1999
+ * Load again every failed source the track's clips name (#848). A track
2000
+ * whose audio failed stays in the editor, like a broken `<img>`;
2001
+ * `daw-track-ready` follows when it loads.
2002
+ */
2003
+ retryTrack(trackId: string): void;
2004
+ private _fetchPeaks;
1952
2005
  /**
1953
- * The error for a clip whose kind is not its track's (#756), or null. A clip
1954
- * with no `src` is a MIDI clip (see _isMidiDescriptor).
2006
+ * The timeline's duration, the one writer of `_duration`: the loaded clips,
2007
+ * and the clips still loading whose length is known (a duration, or `.dat`
2008
+ * peaks), so the timeline is as wide as what is drawn (#848).
1955
2009
  */
1956
- private _clipKindError;
1957
- private _loadTrack;
1958
- _fetchAndDecode(src: string): Promise<AudioBuffer>;
1959
- private _fetchPeaks;
1960
2010
  _recomputeDuration(): void;
2011
+ /** How long a loading clip is drawn: its duration, else what its `.dat` peaks cover; null when unknown. */
2012
+ private _placeholderSeconds;
2013
+ /**
2014
+ * The engine, built now when the editor is connected with an adapter.
2015
+ * Rejects without an adapter, and on a detached editor (an engine built
2016
+ * there would hold the adapter's graph with nothing to dispose it).
2017
+ */
1961
2018
  _ensureEngine(): Promise<PlaylistEngine>;
2019
+ /** Build the engine from the adapter setter or a connect: a failure is reported, not thrown. */
2020
+ private _buildEngineReporting;
2021
+ /** Last versions the statechange handler worked from; reset for each engine. */
2022
+ private _lastTracksVersion;
2023
+ private _lastMixerVersion;
1962
2024
  private _buildEngine;
2025
+ /**
2026
+ * Clips whose audio has just arrived: a `.dat` preview's data goes to the
2027
+ * peak pipeline (no worker run), a spectrogram track gets the audio. The
2028
+ * peak sync then makes their peaks.
2029
+ */
2030
+ private _adoptLoadedClips;
2031
+ /** The engine's state changed: follow it (the one writer of `_engineTracks`). */
2032
+ private _onEngineState;
2033
+ private _onEngineStop;
1963
2034
  private _disposeEngine;
1964
2035
  private _onDragOver;
1965
2036
  private _onDragLeave;
@@ -1986,20 +2057,15 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1986
2057
  */
1987
2058
  ready(): Promise<PlaylistEngine>;
1988
2059
  /**
1989
- * Wait for either `readyEvent` or `errorEvent` to fire on this editor for
1990
- * the entity matching `matchesId`. Listeners are wired synchronously, then
1991
- * `setup` is called (typical: appendChild). Resolves with `resolveValue`
1992
- * on ready; rejects with a normalized Error on error. Used by addTrack and
1993
- * addClip to share their Promise-with-listener-cleanup machinery.
1994
- */
1995
- private _awaitId;
1996
- /**
1997
- * Append a `<daw-track>` element built from `config` and resolve once the
1998
- * track finishes loading (or reject on `daw-track-error`). Goes through
1999
- * the same `_loadTrack` pipeline as declarative tracks, so descriptors,
2000
- * peaks, and clip buffers are populated correctly.
2060
+ * Append a `<daw-track>` element built from `config` and resolve with its
2061
+ * track id once the track has entered the arrangement (#848), before its
2062
+ * audio has loaded. To follow loading, add the `daw-track-ready` /
2063
+ * `daw-track-error` listener BEFORE calling: for a track with nothing to
2064
+ * fetch, or whose audio is already loaded, it fires before this resolves.
2065
+ * Without `editor.adapter` it waits for one. Rejects when the track is
2066
+ * refused by the arrangement or removed before it enters.
2001
2067
  */
2002
- addTrack(config?: TrackConfig): Promise<DawTrackElement>;
2068
+ addTrack(config?: TrackConfig): Promise<string>;
2003
2069
  /**
2004
2070
  * Remove a track by id. Equivalent to `trackElement.remove()` —
2005
2071
  * the editor's MutationObserver handles engine and cache cleanup.
@@ -2017,16 +2083,18 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
2017
2083
  private _onTrackReorderGrab;
2018
2084
  /**
2019
2085
  * Update reflected attributes on a track. The mixer fields go to their
2020
- * owner as one undo step (#843): the engine, or while the track is loading
2021
- * the values it will enter with (not a step). For DOM-element tracks the
2086
+ * owner, the arrangement, as one undo step (#843; also while the track
2087
+ * loads, #848). For DOM-element tracks the
2022
2088
  * changes are also written to the `<daw-track>` element; for tracks
2023
2089
  * without a DOM element (file drops) the descriptor is updated in place.
2024
2090
  */
2025
2091
  updateTrack(trackId: string, partial: Partial<TrackConfig>): void;
2026
2092
  /**
2027
2093
  * Append a clip to an existing track. Builds a `<daw-clip>` from `config`
2028
- * and appends it to the track's DOM element when one exists; resolves with
2029
- * the new clip's id once the audio decode + peak generation finish.
2094
+ * and appends it to the track's DOM element; resolves with the new clip's
2095
+ * id once its audio has loaded (`daw-clip-ready`, before its peaks are
2096
+ * drawn); rejects when it fails to load, is refused, or leaves the
2097
+ * arrangement before it loads (a removal, an Undo).
2030
2098
  */
2031
2099
  addClip(trackId: string, config: ClipConfig): Promise<string>;
2032
2100
  /**
@@ -2162,7 +2230,17 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
2162
2230
  * no-ops — converges in one pass (write-only-on-change).
2163
2231
  */
2164
2232
  _syncDomToEngineOrder(tracks: readonly ClipTrack[]): void;
2233
+ /**
2234
+ * The rows, in the arrangement's order (#848): each track's loaded clips
2235
+ * (the engine's projection, with the current mix) and the clips still loading.
2236
+ */
2165
2237
  private _getOrderedTracks;
2238
+ /**
2239
+ * A clip still loading: a placeholder box where its length is known, with
2240
+ * its `.dat` peaks when they came, drawn failed when its source failed. Its
2241
+ * header carries no clip id, so it cannot be dragged.
2242
+ */
2243
+ private _renderPlaceholder;
2166
2244
  render(): lit.TemplateResult<1>;
2167
2245
  }
2168
2246
  declare global {