@dawcore/components 0.0.35 → 0.0.36

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.mts CHANGED
@@ -788,6 +788,11 @@ declare class DawTrackControlsElement extends LitElement {
788
788
  pan: number;
789
789
  muted: boolean;
790
790
  soloed: boolean;
791
+ /** Show the reorder grip + move up/down buttons (set by the editor from
792
+ * its track-reordering attribute). */
793
+ reorderable: boolean;
794
+ trackIndex: number;
795
+ trackCount: number;
791
796
  static styles: lit.CSSResult;
792
797
  protected firstUpdated(): void;
793
798
  private _onVolumeInput;
@@ -796,6 +801,10 @@ declare class DawTrackControlsElement extends LitElement {
796
801
  private _onSoloClick;
797
802
  private _onRemoveClick;
798
803
  private _dispatchControl;
804
+ private _dispatchReorder;
805
+ private _onMoveUp;
806
+ private _onMoveDown;
807
+ private _onGripPointerDown;
799
808
  render(): lit.TemplateResult<1>;
800
809
  }
801
810
  declare global {
@@ -1300,6 +1309,16 @@ interface DawEffectReorderDetail {
1300
1309
  fromIndex: number;
1301
1310
  toIndex: number;
1302
1311
  }
1312
+ interface DawTrackReorderDetail {
1313
+ trackId: string;
1314
+ fromIndex: number;
1315
+ toIndex: number;
1316
+ }
1317
+ interface DawTrackReorderGrabDetail {
1318
+ trackId: string;
1319
+ pointerEvent: PointerEvent;
1320
+ gripElement: HTMLElement;
1321
+ }
1303
1322
  interface DawEffectErrorDetail {
1304
1323
  effectId: string;
1305
1324
  /** Plugin source URL (absent for Faust entries, which have no URL). */
@@ -1366,6 +1385,8 @@ interface DawEventMap {
1366
1385
  'daw-effect-bypass': CustomEvent<DawEffectBypassDetail>;
1367
1386
  'daw-effect-reorder': CustomEvent<DawEffectReorderDetail>;
1368
1387
  'daw-effect-error': CustomEvent<DawEffectErrorDetail>;
1388
+ 'daw-track-reorder': CustomEvent<DawTrackReorderDetail>;
1389
+ 'daw-track-reorder-grab': CustomEvent<DawTrackReorderGrabDetail>;
1369
1390
  'daw-annotation-connected': CustomEvent<DawAnnotationConnectedDetail>;
1370
1391
  'daw-annotation-update': CustomEvent<DawAnnotationUpdateDetail>;
1371
1392
  'daw-annotation-select': CustomEvent<DawAnnotationSelectDetail>;
@@ -1495,6 +1516,11 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1495
1516
  * the React provider's `fillViewport` prop.
1496
1517
  */
1497
1518
  fillViewport: boolean;
1519
+ /**
1520
+ * Enable vertical track reordering UI: grip + move up/down buttons on each
1521
+ * track's controls. Reordering is purely organizational.
1522
+ */
1523
+ trackReordering: boolean;
1498
1524
  /**
1499
1525
  * Default spectrogram FFT/render config inherited by tracks with
1500
1526
  * `render-mode="spectrogram"` that do not set their own. Wired into the
@@ -1699,6 +1725,7 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1699
1725
  private _spectrogramController;
1700
1726
  private _clipPointer;
1701
1727
  private _annotationDrag;
1728
+ private _trackReorderDrag;
1702
1729
  get _clipHandler(): ClipPointerHandler | null;
1703
1730
  get engine(): PlaylistEngine | null;
1704
1731
  get renderSamplesPerPixel(): number;
@@ -1887,6 +1914,15 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1887
1914
  * No-op if no matching track exists.
1888
1915
  */
1889
1916
  removeTrack(trackId: string): void;
1917
+ /**
1918
+ * Move a track to a new position in the vertical order (0-based index among
1919
+ * `<daw-track>` elements). Element-backed tracks move their DOM element —
1920
+ * the MutationObserver syncs the engine (single write path). Element-less
1921
+ * tracks (undo-resurrected) reorder the engine directly.
1922
+ */
1923
+ reorderTrack(trackId: string, toIndex: number): void;
1924
+ private _onTrackReorder;
1925
+ private _onTrackReorderGrab;
1890
1926
  /**
1891
1927
  * Update reflected attributes on a track. For DOM-element tracks the changes
1892
1928
  * are written to the `<daw-track>` element (which fires `daw-track-update`);
@@ -1990,6 +2026,28 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1990
2026
  private get _showControls();
1991
2027
  /** True when the ruler header band should be rendered (and its selector is valid). */
1992
2028
  private get _showRuler();
2029
+ /** Guards the statechange handler's engine→DOM sync (Task: reorder #612)
2030
+ * while the observer is pushing DOM order INTO the engine — the intermediate
2031
+ * statechange emissions during the transaction would otherwise bounce
2032
+ * half-applied orders back into the DOM. */
2033
+ _inOrderSync: boolean;
2034
+ /**
2035
+ * DOM → engine: make the engine's track order match the light-DOM
2036
+ * `<daw-track>` order. Single write path for reorders — editor-initiated
2037
+ * (buttons/drag move the element) and consumer-initiated (insertBefore)
2038
+ * mutations both land here via the MutationObserver. Element-less tracks
2039
+ * (undo-resurrected) keep their engine positions (stable sort).
2040
+ * Write-only-on-change: a no-op when orders already match, so the
2041
+ * engine→DOM direction (statechange handler) converges in one pass.
2042
+ */
2043
+ _syncEngineOrderToDom(): void;
2044
+ /**
2045
+ * Engine → DOM: after an engine-initiated order change (undo/redo), move
2046
+ * `<daw-track>` elements to match engine order. The resulting mutations fire
2047
+ * the observer's _syncEngineOrderToDom, which finds the orders equal and
2048
+ * no-ops — converges in one pass (write-only-on-change).
2049
+ */
2050
+ _syncDomToEngineOrder(tracks: ClipTrack[]): void;
1993
2051
  private _getOrderedTracks;
1994
2052
  render(): lit.TemplateResult<1>;
1995
2053
  }
package/dist/index.d.ts CHANGED
@@ -788,6 +788,11 @@ declare class DawTrackControlsElement extends LitElement {
788
788
  pan: number;
789
789
  muted: boolean;
790
790
  soloed: boolean;
791
+ /** Show the reorder grip + move up/down buttons (set by the editor from
792
+ * its track-reordering attribute). */
793
+ reorderable: boolean;
794
+ trackIndex: number;
795
+ trackCount: number;
791
796
  static styles: lit.CSSResult;
792
797
  protected firstUpdated(): void;
793
798
  private _onVolumeInput;
@@ -796,6 +801,10 @@ declare class DawTrackControlsElement extends LitElement {
796
801
  private _onSoloClick;
797
802
  private _onRemoveClick;
798
803
  private _dispatchControl;
804
+ private _dispatchReorder;
805
+ private _onMoveUp;
806
+ private _onMoveDown;
807
+ private _onGripPointerDown;
799
808
  render(): lit.TemplateResult<1>;
800
809
  }
801
810
  declare global {
@@ -1300,6 +1309,16 @@ interface DawEffectReorderDetail {
1300
1309
  fromIndex: number;
1301
1310
  toIndex: number;
1302
1311
  }
1312
+ interface DawTrackReorderDetail {
1313
+ trackId: string;
1314
+ fromIndex: number;
1315
+ toIndex: number;
1316
+ }
1317
+ interface DawTrackReorderGrabDetail {
1318
+ trackId: string;
1319
+ pointerEvent: PointerEvent;
1320
+ gripElement: HTMLElement;
1321
+ }
1303
1322
  interface DawEffectErrorDetail {
1304
1323
  effectId: string;
1305
1324
  /** Plugin source URL (absent for Faust entries, which have no URL). */
@@ -1366,6 +1385,8 @@ interface DawEventMap {
1366
1385
  'daw-effect-bypass': CustomEvent<DawEffectBypassDetail>;
1367
1386
  'daw-effect-reorder': CustomEvent<DawEffectReorderDetail>;
1368
1387
  'daw-effect-error': CustomEvent<DawEffectErrorDetail>;
1388
+ 'daw-track-reorder': CustomEvent<DawTrackReorderDetail>;
1389
+ 'daw-track-reorder-grab': CustomEvent<DawTrackReorderGrabDetail>;
1369
1390
  'daw-annotation-connected': CustomEvent<DawAnnotationConnectedDetail>;
1370
1391
  'daw-annotation-update': CustomEvent<DawAnnotationUpdateDetail>;
1371
1392
  'daw-annotation-select': CustomEvent<DawAnnotationSelectDetail>;
@@ -1495,6 +1516,11 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1495
1516
  * the React provider's `fillViewport` prop.
1496
1517
  */
1497
1518
  fillViewport: boolean;
1519
+ /**
1520
+ * Enable vertical track reordering UI: grip + move up/down buttons on each
1521
+ * track's controls. Reordering is purely organizational.
1522
+ */
1523
+ trackReordering: boolean;
1498
1524
  /**
1499
1525
  * Default spectrogram FFT/render config inherited by tracks with
1500
1526
  * `render-mode="spectrogram"` that do not set their own. Wired into the
@@ -1699,6 +1725,7 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1699
1725
  private _spectrogramController;
1700
1726
  private _clipPointer;
1701
1727
  private _annotationDrag;
1728
+ private _trackReorderDrag;
1702
1729
  get _clipHandler(): ClipPointerHandler | null;
1703
1730
  get engine(): PlaylistEngine | null;
1704
1731
  get renderSamplesPerPixel(): number;
@@ -1887,6 +1914,15 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1887
1914
  * No-op if no matching track exists.
1888
1915
  */
1889
1916
  removeTrack(trackId: string): void;
1917
+ /**
1918
+ * Move a track to a new position in the vertical order (0-based index among
1919
+ * `<daw-track>` elements). Element-backed tracks move their DOM element —
1920
+ * the MutationObserver syncs the engine (single write path). Element-less
1921
+ * tracks (undo-resurrected) reorder the engine directly.
1922
+ */
1923
+ reorderTrack(trackId: string, toIndex: number): void;
1924
+ private _onTrackReorder;
1925
+ private _onTrackReorderGrab;
1890
1926
  /**
1891
1927
  * Update reflected attributes on a track. For DOM-element tracks the changes
1892
1928
  * are written to the `<daw-track>` element (which fires `daw-track-update`);
@@ -1990,6 +2026,28 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
1990
2026
  private get _showControls();
1991
2027
  /** True when the ruler header band should be rendered (and its selector is valid). */
1992
2028
  private get _showRuler();
2029
+ /** Guards the statechange handler's engine→DOM sync (Task: reorder #612)
2030
+ * while the observer is pushing DOM order INTO the engine — the intermediate
2031
+ * statechange emissions during the transaction would otherwise bounce
2032
+ * half-applied orders back into the DOM. */
2033
+ _inOrderSync: boolean;
2034
+ /**
2035
+ * DOM → engine: make the engine's track order match the light-DOM
2036
+ * `<daw-track>` order. Single write path for reorders — editor-initiated
2037
+ * (buttons/drag move the element) and consumer-initiated (insertBefore)
2038
+ * mutations both land here via the MutationObserver. Element-less tracks
2039
+ * (undo-resurrected) keep their engine positions (stable sort).
2040
+ * Write-only-on-change: a no-op when orders already match, so the
2041
+ * engine→DOM direction (statechange handler) converges in one pass.
2042
+ */
2043
+ _syncEngineOrderToDom(): void;
2044
+ /**
2045
+ * Engine → DOM: after an engine-initiated order change (undo/redo), move
2046
+ * `<daw-track>` elements to match engine order. The resulting mutations fire
2047
+ * the observer's _syncEngineOrderToDom, which finds the orders equal and
2048
+ * no-ops — converges in one pass (write-only-on-change).
2049
+ */
2050
+ _syncDomToEngineOrder(tracks: ClipTrack[]): void;
1993
2051
  private _getOrderedTracks;
1994
2052
  render(): lit.TemplateResult<1>;
1995
2053
  }