@dawcore/components 0.0.2 → 0.0.4
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 +107 -9
- package/dist/index.d.ts +107 -9
- package/dist/index.js +471 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +470 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
-
import { Peaks, Bits, FadeType, PeakData, ClipTrack } from '@waveform-playlist/core';
|
|
3
|
+
import { Peaks, Bits, FadeType, PeakData, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
4
|
+
import WaveformData from 'waveform-data';
|
|
4
5
|
import { PlaylistEngine } from '@waveform-playlist/engine';
|
|
5
6
|
|
|
6
7
|
declare class DawClipElement extends LitElement {
|
|
@@ -184,6 +185,7 @@ interface TrackDescriptor {
|
|
|
184
185
|
}
|
|
185
186
|
interface ClipDescriptor {
|
|
186
187
|
src: string;
|
|
188
|
+
peaksSrc: string;
|
|
187
189
|
start: number;
|
|
188
190
|
duration: number;
|
|
189
191
|
offset: number;
|
|
@@ -213,6 +215,11 @@ declare class PeakPipeline {
|
|
|
213
215
|
private _baseScale;
|
|
214
216
|
private _bits;
|
|
215
217
|
constructor(baseScale?: number, bits?: 8 | 16);
|
|
218
|
+
/**
|
|
219
|
+
* Inject externally-loaded WaveformData (e.g., from a .dat file) into the cache.
|
|
220
|
+
* Prevents worker generation for this AudioBuffer on all subsequent calls.
|
|
221
|
+
*/
|
|
222
|
+
cacheWaveformData(audioBuffer: AudioBuffer, waveformData: WaveformData): void;
|
|
216
223
|
/**
|
|
217
224
|
* Generate PeakData for a clip from its AudioBuffer.
|
|
218
225
|
* Uses cached WaveformData when available; otherwise generates via worker.
|
|
@@ -221,14 +228,26 @@ declare class PeakPipeline {
|
|
|
221
228
|
generatePeaks(audioBuffer: AudioBuffer, samplesPerPixel: number, isMono: boolean, offsetSamples?: number, durationSamples?: number): Promise<PeakData>;
|
|
222
229
|
/**
|
|
223
230
|
* Re-extract peaks for all clips at a new zoom level using cached WaveformData.
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
231
|
+
* Returns a new Map of clipId → PeakData. Clips without cached data are skipped.
|
|
232
|
+
* When the requested scale is finer than cached data, peaks are clamped to the
|
|
233
|
+
* cached scale and a single summary warning is logged.
|
|
227
234
|
*/
|
|
228
235
|
reextractPeaks(clipBuffers: ReadonlyMap<string, AudioBuffer>, samplesPerPixel: number, isMono: boolean, clipOffsets?: ReadonlyMap<string, {
|
|
229
236
|
offsetSamples: number;
|
|
230
237
|
durationSamples: number;
|
|
231
238
|
}>): Map<string, PeakData>;
|
|
239
|
+
/**
|
|
240
|
+
* Clamp requested scale to cached WaveformData scale.
|
|
241
|
+
* WaveformData.resample() can only go coarser — if the requested zoom is
|
|
242
|
+
* finer than the cached data, use the cached scale. Set warn=true to log
|
|
243
|
+
* (default); reextractPeaks passes false and logs a single summary instead.
|
|
244
|
+
*/
|
|
245
|
+
private _clampScale;
|
|
246
|
+
/**
|
|
247
|
+
* Return the coarsest (largest) scale among cached WaveformData entries
|
|
248
|
+
* that correspond to the given clip buffers. Returns 0 if none are cached.
|
|
249
|
+
*/
|
|
250
|
+
getMaxCachedScale(clipBuffers: ReadonlyMap<string, AudioBuffer>): number;
|
|
232
251
|
terminate(): void;
|
|
233
252
|
private _getWaveformData;
|
|
234
253
|
}
|
|
@@ -335,13 +354,19 @@ interface ClipBounds {
|
|
|
335
354
|
}
|
|
336
355
|
/** Narrow engine contract for clip move/trim interactions. */
|
|
337
356
|
interface ClipEngineContract {
|
|
338
|
-
moveClip(trackId: string, clipId: string, deltaSamples: number, skipAdapter?: boolean):
|
|
357
|
+
moveClip(trackId: string, clipId: string, deltaSamples: number, skipAdapter?: boolean): number;
|
|
339
358
|
trimClip(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number, skipAdapter?: boolean): void;
|
|
340
359
|
updateTrack(trackId: string): void;
|
|
341
360
|
/** Get a clip's full bounds for trim constraint computation. */
|
|
342
361
|
getClipBounds(trackId: string, clipId: string): ClipBounds | null;
|
|
343
362
|
/** Constrain a trim delta using the engine's collision/bounds logic. */
|
|
344
363
|
constrainTrimDelta(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number): number;
|
|
364
|
+
/** Begin a transaction — groups mutations into one undo step. */
|
|
365
|
+
beginTransaction(): void;
|
|
366
|
+
/** Commit the transaction — pushes one undo step for all grouped mutations. */
|
|
367
|
+
commitTransaction(): void;
|
|
368
|
+
/** Abort the transaction — restores pre-transaction state without pushing to undo. */
|
|
369
|
+
abortTransaction(): void;
|
|
345
370
|
}
|
|
346
371
|
/** Peak data returned by reextractClipPeaks for imperative waveform updates. */
|
|
347
372
|
interface ClipPeakSlice {
|
|
@@ -510,7 +535,9 @@ interface LoadFilesResult {
|
|
|
510
535
|
}
|
|
511
536
|
|
|
512
537
|
declare class DawEditorElement extends LitElement {
|
|
513
|
-
samplesPerPixel: number;
|
|
538
|
+
get samplesPerPixel(): number;
|
|
539
|
+
set samplesPerPixel(value: number);
|
|
540
|
+
private _samplesPerPixel;
|
|
514
541
|
waveHeight: number;
|
|
515
542
|
timescale: boolean;
|
|
516
543
|
mono: boolean;
|
|
@@ -537,12 +564,15 @@ declare class DawEditorElement extends LitElement {
|
|
|
537
564
|
_engine: PlaylistEngine | null;
|
|
538
565
|
private _enginePromise;
|
|
539
566
|
_audioCache: Map<string, Promise<AudioBuffer>>;
|
|
567
|
+
private _peaksCache;
|
|
540
568
|
_clipBuffers: Map<string, AudioBuffer>;
|
|
541
569
|
_clipOffsets: Map<string, {
|
|
542
570
|
offsetSamples: number;
|
|
543
571
|
durationSamples: number;
|
|
544
572
|
}>;
|
|
545
573
|
_peakPipeline: PeakPipeline;
|
|
574
|
+
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
575
|
+
private _minSamplesPerPixel;
|
|
546
576
|
private _trackElements;
|
|
547
577
|
private _childObserver;
|
|
548
578
|
private _audioResume;
|
|
@@ -582,6 +612,7 @@ declare class DawEditorElement extends LitElement {
|
|
|
582
612
|
private _readTrackDescriptor;
|
|
583
613
|
private _loadTrack;
|
|
584
614
|
_fetchAndDecode(src: string): Promise<AudioBuffer>;
|
|
615
|
+
private _fetchPeaks;
|
|
585
616
|
_recomputeDuration(): void;
|
|
586
617
|
_ensureEngine(): Promise<PlaylistEngine>;
|
|
587
618
|
private _buildEngine;
|
|
@@ -593,10 +624,19 @@ declare class DawEditorElement extends LitElement {
|
|
|
593
624
|
play(startTime?: number): Promise<void>;
|
|
594
625
|
pause(): void;
|
|
595
626
|
stop(): void;
|
|
627
|
+
/** Toggle between play and pause. */
|
|
628
|
+
togglePlayPause(): void;
|
|
596
629
|
seekTo(time: number): void;
|
|
630
|
+
/** Undo the last structural edit. */
|
|
631
|
+
undo(): void;
|
|
632
|
+
/** Redo the last undone edit. */
|
|
633
|
+
redo(): void;
|
|
634
|
+
/** Whether undo is available. */
|
|
635
|
+
get canUndo(): boolean;
|
|
636
|
+
/** Whether redo is available. */
|
|
637
|
+
get canRedo(): boolean;
|
|
597
638
|
/** Split the clip under the playhead on the selected track. */
|
|
598
639
|
splitAtPlayhead(): boolean;
|
|
599
|
-
private _onKeyDown;
|
|
600
640
|
recordingStream: MediaStream | null;
|
|
601
641
|
get currentTime(): number;
|
|
602
642
|
get isRecording(): boolean;
|
|
@@ -668,6 +708,59 @@ declare global {
|
|
|
668
708
|
}
|
|
669
709
|
}
|
|
670
710
|
|
|
711
|
+
/** Key binding for remapping — derived from KeyboardShortcut to stay in sync. */
|
|
712
|
+
type KeyBinding = Pick<KeyboardShortcut, 'key' | 'ctrlKey' | 'shiftKey' | 'metaKey' | 'altKey'>;
|
|
713
|
+
interface PlaybackShortcutMap {
|
|
714
|
+
playPause?: KeyBinding;
|
|
715
|
+
stop?: KeyBinding;
|
|
716
|
+
rewindToStart?: KeyBinding;
|
|
717
|
+
}
|
|
718
|
+
interface SplittingShortcutMap {
|
|
719
|
+
splitAtPlayhead?: KeyBinding;
|
|
720
|
+
}
|
|
721
|
+
interface UndoShortcutMap {
|
|
722
|
+
undo?: KeyBinding;
|
|
723
|
+
redo?: KeyBinding;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Render-less element that enables keyboard shortcuts for a parent <daw-editor>.
|
|
727
|
+
* Place inside the editor element. Boolean attributes enable preset categories;
|
|
728
|
+
* JS properties allow remapping and custom shortcuts.
|
|
729
|
+
*
|
|
730
|
+
* ```html
|
|
731
|
+
* <daw-editor>
|
|
732
|
+
* <daw-keyboard-shortcuts playback splitting undo></daw-keyboard-shortcuts>
|
|
733
|
+
* </daw-editor>
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
declare class DawKeyboardShortcutsElement extends LitElement {
|
|
737
|
+
playback: boolean;
|
|
738
|
+
splitting: boolean;
|
|
739
|
+
undo: boolean;
|
|
740
|
+
playbackShortcuts: PlaybackShortcutMap | null;
|
|
741
|
+
splittingShortcuts: SplittingShortcutMap | null;
|
|
742
|
+
undoShortcuts: UndoShortcutMap | null;
|
|
743
|
+
/** Additional custom shortcuts. */
|
|
744
|
+
customShortcuts: KeyboardShortcut[];
|
|
745
|
+
private _editor;
|
|
746
|
+
private _cachedShortcuts;
|
|
747
|
+
/** All active shortcuts (read-only, cached). */
|
|
748
|
+
get shortcuts(): KeyboardShortcut[];
|
|
749
|
+
/** Invalidate cached shortcuts when Lit properties change. */
|
|
750
|
+
updated(): void;
|
|
751
|
+
connectedCallback(): void;
|
|
752
|
+
disconnectedCallback(): void;
|
|
753
|
+
createRenderRoot(): this;
|
|
754
|
+
private _buildShortcuts;
|
|
755
|
+
private _makeShortcut;
|
|
756
|
+
private _onKeyDown;
|
|
757
|
+
}
|
|
758
|
+
declare global {
|
|
759
|
+
interface HTMLElementTagNameMap {
|
|
760
|
+
'daw-keyboard-shortcuts': DawKeyboardShortcutsElement;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
671
764
|
declare class AudioResumeController implements ReactiveController {
|
|
672
765
|
private _host;
|
|
673
766
|
private _target;
|
|
@@ -704,15 +797,20 @@ interface SplitEngineContract {
|
|
|
704
797
|
interface SplitHost {
|
|
705
798
|
readonly effectiveSampleRate: number;
|
|
706
799
|
readonly currentTime: number;
|
|
800
|
+
readonly isPlaying: boolean;
|
|
707
801
|
readonly engine: SplitEngineContract | null;
|
|
708
802
|
dispatchEvent(event: Event): boolean;
|
|
803
|
+
stop(): void;
|
|
804
|
+
play(time: number): void;
|
|
709
805
|
}
|
|
710
806
|
/**
|
|
711
|
-
*
|
|
807
|
+
* Split the clip under the playhead on the selected track.
|
|
808
|
+
* Stops playback before split and resumes after to avoid duplicate audio
|
|
809
|
+
* from Transport rescheduling during playback.
|
|
712
810
|
*
|
|
713
811
|
* Returns true if the split occurred and dispatched a daw-clip-split event.
|
|
714
812
|
* Returns false for any guard failure or engine no-op.
|
|
715
813
|
*/
|
|
716
814
|
declare function splitAtPlayhead(host: SplitHost): boolean;
|
|
717
815
|
|
|
718
|
-
export { AudioResumeController, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, DawClipElement, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawPauseButtonElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type LoadFilesResult, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SplitEngineContract, type SplitHost, type TrackDescriptor, splitAtPlayhead };
|
|
816
|
+
export { AudioResumeController, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, DawClipElement, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackDescriptor, type UndoShortcutMap, splitAtPlayhead };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
-
import { Peaks, Bits, FadeType, PeakData, ClipTrack } from '@waveform-playlist/core';
|
|
3
|
+
import { Peaks, Bits, FadeType, PeakData, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
4
|
+
import WaveformData from 'waveform-data';
|
|
4
5
|
import { PlaylistEngine } from '@waveform-playlist/engine';
|
|
5
6
|
|
|
6
7
|
declare class DawClipElement extends LitElement {
|
|
@@ -184,6 +185,7 @@ interface TrackDescriptor {
|
|
|
184
185
|
}
|
|
185
186
|
interface ClipDescriptor {
|
|
186
187
|
src: string;
|
|
188
|
+
peaksSrc: string;
|
|
187
189
|
start: number;
|
|
188
190
|
duration: number;
|
|
189
191
|
offset: number;
|
|
@@ -213,6 +215,11 @@ declare class PeakPipeline {
|
|
|
213
215
|
private _baseScale;
|
|
214
216
|
private _bits;
|
|
215
217
|
constructor(baseScale?: number, bits?: 8 | 16);
|
|
218
|
+
/**
|
|
219
|
+
* Inject externally-loaded WaveformData (e.g., from a .dat file) into the cache.
|
|
220
|
+
* Prevents worker generation for this AudioBuffer on all subsequent calls.
|
|
221
|
+
*/
|
|
222
|
+
cacheWaveformData(audioBuffer: AudioBuffer, waveformData: WaveformData): void;
|
|
216
223
|
/**
|
|
217
224
|
* Generate PeakData for a clip from its AudioBuffer.
|
|
218
225
|
* Uses cached WaveformData when available; otherwise generates via worker.
|
|
@@ -221,14 +228,26 @@ declare class PeakPipeline {
|
|
|
221
228
|
generatePeaks(audioBuffer: AudioBuffer, samplesPerPixel: number, isMono: boolean, offsetSamples?: number, durationSamples?: number): Promise<PeakData>;
|
|
222
229
|
/**
|
|
223
230
|
* Re-extract peaks for all clips at a new zoom level using cached WaveformData.
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
231
|
+
* Returns a new Map of clipId → PeakData. Clips without cached data are skipped.
|
|
232
|
+
* When the requested scale is finer than cached data, peaks are clamped to the
|
|
233
|
+
* cached scale and a single summary warning is logged.
|
|
227
234
|
*/
|
|
228
235
|
reextractPeaks(clipBuffers: ReadonlyMap<string, AudioBuffer>, samplesPerPixel: number, isMono: boolean, clipOffsets?: ReadonlyMap<string, {
|
|
229
236
|
offsetSamples: number;
|
|
230
237
|
durationSamples: number;
|
|
231
238
|
}>): Map<string, PeakData>;
|
|
239
|
+
/**
|
|
240
|
+
* Clamp requested scale to cached WaveformData scale.
|
|
241
|
+
* WaveformData.resample() can only go coarser — if the requested zoom is
|
|
242
|
+
* finer than the cached data, use the cached scale. Set warn=true to log
|
|
243
|
+
* (default); reextractPeaks passes false and logs a single summary instead.
|
|
244
|
+
*/
|
|
245
|
+
private _clampScale;
|
|
246
|
+
/**
|
|
247
|
+
* Return the coarsest (largest) scale among cached WaveformData entries
|
|
248
|
+
* that correspond to the given clip buffers. Returns 0 if none are cached.
|
|
249
|
+
*/
|
|
250
|
+
getMaxCachedScale(clipBuffers: ReadonlyMap<string, AudioBuffer>): number;
|
|
232
251
|
terminate(): void;
|
|
233
252
|
private _getWaveformData;
|
|
234
253
|
}
|
|
@@ -335,13 +354,19 @@ interface ClipBounds {
|
|
|
335
354
|
}
|
|
336
355
|
/** Narrow engine contract for clip move/trim interactions. */
|
|
337
356
|
interface ClipEngineContract {
|
|
338
|
-
moveClip(trackId: string, clipId: string, deltaSamples: number, skipAdapter?: boolean):
|
|
357
|
+
moveClip(trackId: string, clipId: string, deltaSamples: number, skipAdapter?: boolean): number;
|
|
339
358
|
trimClip(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number, skipAdapter?: boolean): void;
|
|
340
359
|
updateTrack(trackId: string): void;
|
|
341
360
|
/** Get a clip's full bounds for trim constraint computation. */
|
|
342
361
|
getClipBounds(trackId: string, clipId: string): ClipBounds | null;
|
|
343
362
|
/** Constrain a trim delta using the engine's collision/bounds logic. */
|
|
344
363
|
constrainTrimDelta(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number): number;
|
|
364
|
+
/** Begin a transaction — groups mutations into one undo step. */
|
|
365
|
+
beginTransaction(): void;
|
|
366
|
+
/** Commit the transaction — pushes one undo step for all grouped mutations. */
|
|
367
|
+
commitTransaction(): void;
|
|
368
|
+
/** Abort the transaction — restores pre-transaction state without pushing to undo. */
|
|
369
|
+
abortTransaction(): void;
|
|
345
370
|
}
|
|
346
371
|
/** Peak data returned by reextractClipPeaks for imperative waveform updates. */
|
|
347
372
|
interface ClipPeakSlice {
|
|
@@ -510,7 +535,9 @@ interface LoadFilesResult {
|
|
|
510
535
|
}
|
|
511
536
|
|
|
512
537
|
declare class DawEditorElement extends LitElement {
|
|
513
|
-
samplesPerPixel: number;
|
|
538
|
+
get samplesPerPixel(): number;
|
|
539
|
+
set samplesPerPixel(value: number);
|
|
540
|
+
private _samplesPerPixel;
|
|
514
541
|
waveHeight: number;
|
|
515
542
|
timescale: boolean;
|
|
516
543
|
mono: boolean;
|
|
@@ -537,12 +564,15 @@ declare class DawEditorElement extends LitElement {
|
|
|
537
564
|
_engine: PlaylistEngine | null;
|
|
538
565
|
private _enginePromise;
|
|
539
566
|
_audioCache: Map<string, Promise<AudioBuffer>>;
|
|
567
|
+
private _peaksCache;
|
|
540
568
|
_clipBuffers: Map<string, AudioBuffer>;
|
|
541
569
|
_clipOffsets: Map<string, {
|
|
542
570
|
offsetSamples: number;
|
|
543
571
|
durationSamples: number;
|
|
544
572
|
}>;
|
|
545
573
|
_peakPipeline: PeakPipeline;
|
|
574
|
+
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
575
|
+
private _minSamplesPerPixel;
|
|
546
576
|
private _trackElements;
|
|
547
577
|
private _childObserver;
|
|
548
578
|
private _audioResume;
|
|
@@ -582,6 +612,7 @@ declare class DawEditorElement extends LitElement {
|
|
|
582
612
|
private _readTrackDescriptor;
|
|
583
613
|
private _loadTrack;
|
|
584
614
|
_fetchAndDecode(src: string): Promise<AudioBuffer>;
|
|
615
|
+
private _fetchPeaks;
|
|
585
616
|
_recomputeDuration(): void;
|
|
586
617
|
_ensureEngine(): Promise<PlaylistEngine>;
|
|
587
618
|
private _buildEngine;
|
|
@@ -593,10 +624,19 @@ declare class DawEditorElement extends LitElement {
|
|
|
593
624
|
play(startTime?: number): Promise<void>;
|
|
594
625
|
pause(): void;
|
|
595
626
|
stop(): void;
|
|
627
|
+
/** Toggle between play and pause. */
|
|
628
|
+
togglePlayPause(): void;
|
|
596
629
|
seekTo(time: number): void;
|
|
630
|
+
/** Undo the last structural edit. */
|
|
631
|
+
undo(): void;
|
|
632
|
+
/** Redo the last undone edit. */
|
|
633
|
+
redo(): void;
|
|
634
|
+
/** Whether undo is available. */
|
|
635
|
+
get canUndo(): boolean;
|
|
636
|
+
/** Whether redo is available. */
|
|
637
|
+
get canRedo(): boolean;
|
|
597
638
|
/** Split the clip under the playhead on the selected track. */
|
|
598
639
|
splitAtPlayhead(): boolean;
|
|
599
|
-
private _onKeyDown;
|
|
600
640
|
recordingStream: MediaStream | null;
|
|
601
641
|
get currentTime(): number;
|
|
602
642
|
get isRecording(): boolean;
|
|
@@ -668,6 +708,59 @@ declare global {
|
|
|
668
708
|
}
|
|
669
709
|
}
|
|
670
710
|
|
|
711
|
+
/** Key binding for remapping — derived from KeyboardShortcut to stay in sync. */
|
|
712
|
+
type KeyBinding = Pick<KeyboardShortcut, 'key' | 'ctrlKey' | 'shiftKey' | 'metaKey' | 'altKey'>;
|
|
713
|
+
interface PlaybackShortcutMap {
|
|
714
|
+
playPause?: KeyBinding;
|
|
715
|
+
stop?: KeyBinding;
|
|
716
|
+
rewindToStart?: KeyBinding;
|
|
717
|
+
}
|
|
718
|
+
interface SplittingShortcutMap {
|
|
719
|
+
splitAtPlayhead?: KeyBinding;
|
|
720
|
+
}
|
|
721
|
+
interface UndoShortcutMap {
|
|
722
|
+
undo?: KeyBinding;
|
|
723
|
+
redo?: KeyBinding;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Render-less element that enables keyboard shortcuts for a parent <daw-editor>.
|
|
727
|
+
* Place inside the editor element. Boolean attributes enable preset categories;
|
|
728
|
+
* JS properties allow remapping and custom shortcuts.
|
|
729
|
+
*
|
|
730
|
+
* ```html
|
|
731
|
+
* <daw-editor>
|
|
732
|
+
* <daw-keyboard-shortcuts playback splitting undo></daw-keyboard-shortcuts>
|
|
733
|
+
* </daw-editor>
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
declare class DawKeyboardShortcutsElement extends LitElement {
|
|
737
|
+
playback: boolean;
|
|
738
|
+
splitting: boolean;
|
|
739
|
+
undo: boolean;
|
|
740
|
+
playbackShortcuts: PlaybackShortcutMap | null;
|
|
741
|
+
splittingShortcuts: SplittingShortcutMap | null;
|
|
742
|
+
undoShortcuts: UndoShortcutMap | null;
|
|
743
|
+
/** Additional custom shortcuts. */
|
|
744
|
+
customShortcuts: KeyboardShortcut[];
|
|
745
|
+
private _editor;
|
|
746
|
+
private _cachedShortcuts;
|
|
747
|
+
/** All active shortcuts (read-only, cached). */
|
|
748
|
+
get shortcuts(): KeyboardShortcut[];
|
|
749
|
+
/** Invalidate cached shortcuts when Lit properties change. */
|
|
750
|
+
updated(): void;
|
|
751
|
+
connectedCallback(): void;
|
|
752
|
+
disconnectedCallback(): void;
|
|
753
|
+
createRenderRoot(): this;
|
|
754
|
+
private _buildShortcuts;
|
|
755
|
+
private _makeShortcut;
|
|
756
|
+
private _onKeyDown;
|
|
757
|
+
}
|
|
758
|
+
declare global {
|
|
759
|
+
interface HTMLElementTagNameMap {
|
|
760
|
+
'daw-keyboard-shortcuts': DawKeyboardShortcutsElement;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
671
764
|
declare class AudioResumeController implements ReactiveController {
|
|
672
765
|
private _host;
|
|
673
766
|
private _target;
|
|
@@ -704,15 +797,20 @@ interface SplitEngineContract {
|
|
|
704
797
|
interface SplitHost {
|
|
705
798
|
readonly effectiveSampleRate: number;
|
|
706
799
|
readonly currentTime: number;
|
|
800
|
+
readonly isPlaying: boolean;
|
|
707
801
|
readonly engine: SplitEngineContract | null;
|
|
708
802
|
dispatchEvent(event: Event): boolean;
|
|
803
|
+
stop(): void;
|
|
804
|
+
play(time: number): void;
|
|
709
805
|
}
|
|
710
806
|
/**
|
|
711
|
-
*
|
|
807
|
+
* Split the clip under the playhead on the selected track.
|
|
808
|
+
* Stops playback before split and resumes after to avoid duplicate audio
|
|
809
|
+
* from Transport rescheduling during playback.
|
|
712
810
|
*
|
|
713
811
|
* Returns true if the split occurred and dispatched a daw-clip-split event.
|
|
714
812
|
* Returns false for any guard failure or engine no-op.
|
|
715
813
|
*/
|
|
716
814
|
declare function splitAtPlayhead(host: SplitHost): boolean;
|
|
717
815
|
|
|
718
|
-
export { AudioResumeController, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, DawClipElement, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawPauseButtonElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type LoadFilesResult, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SplitEngineContract, type SplitHost, type TrackDescriptor, splitAtPlayhead };
|
|
816
|
+
export { AudioResumeController, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, DawClipElement, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackDescriptor, type UndoShortcutMap, splitAtPlayhead };
|