@dawcore/components 0.0.39-next.2 → 0.0.39-next.20
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/README.md +19 -15
- package/dist/index.d.mts +785 -246
- package/dist/index.d.ts +785 -246
- package/dist/index.js +3463 -1689
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3439 -1659
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@ Framework-agnostic Web Components for multi-track audio editing. Drop `<daw-edit
|
|
|
9
9
|
- **Canvas waveforms** — Chunked rendering with virtual scrolling for large timelines
|
|
10
10
|
- **Drag interactions** — Move clips, trim boundaries, split at playhead
|
|
11
11
|
- **Keyboard shortcuts** — Play/pause, split, undo/redo via `<daw-keyboard-shortcuts>`
|
|
12
|
-
- **Undo/redo** — Full transaction-based undo with Cmd/Ctrl+Z and Cmd/Ctrl+Shift+Z
|
|
12
|
+
- **Undo/redo** — Full transaction-based undo with Cmd/Ctrl+Z and Cmd/Ctrl+Shift+Z; mixer moves are undo steps too (one per slider drag, click, attribute update or `updateTrack` call)
|
|
13
13
|
- **File drop** — Drag audio files onto the editor to add tracks (enable with the `file-drop` attribute)
|
|
14
|
-
- **Recording** — Live mic recording with waveform preview (full clip chrome incl. header while capturing), pause/resume, cancelable clip creation; takes land at the playhead and replace overlapped clip content (punch-in), the recorded-over track
|
|
14
|
+
- **Recording** — Live mic recording with waveform preview (full clip chrome incl. header while capturing), pause/resume, cancelable clip creation; takes land at the playhead and replace overlapped clip content (punch-in), the recorded-over track plays muted during the take, and the end-of-timeline auto-stop is suppressed so takes run past existing audio
|
|
15
15
|
- **Pre-computed peaks** — Instant waveform rendering from `.dat` files before audio decodes
|
|
16
16
|
- **MIDI tracks** — Declarative or programmatic MIDI clips render as piano-roll. Playback via the Tone.js adapter. See [MIDI Tracks](#midi-tracks).
|
|
17
17
|
- **MIDI file loading** — `editor.loadMidi(urlOrFile)` parses a `.mid` file into piano-roll tracks via the optional `@dawcore/midi` peer
|
|
@@ -21,7 +21,7 @@ Framework-agnostic Web Components for multi-track audio editing. Drop `<daw-edit
|
|
|
21
21
|
- **Effect GUIs and persistence** — Mount plugin GUIs into your own panels; snapshot and restore whole chains. See [Effect GUIs](#effect-guis) and [Effects Persistence](#effects-persistence).
|
|
22
22
|
- **Offline export** — `editor.exportAudio()` renders the session (clips, mix, all effect chains) to an `AudioBuffer`. See [Offline Export](#offline-export).
|
|
23
23
|
- **Transport access** — Tempo, metronome, count-in, meter, effects via `@dawcore/transport`
|
|
24
|
-
- **Lightweight single-track player** — `<daw-player>` wraps `@waveform-playlist/media-element-playout` (`HTMLMediaElement`, no adapter/AudioContext/
|
|
24
|
+
- **Lightweight single-track player** — `<daw-player>` wraps `@waveform-playlist/media-element-playout` (`HTMLMediaElement`, no adapter/AudioContext/EditorEngine) for podcast/audiobook-style playback with pitch-preserving rate control (0.25×–4×). See [Single-Track Player](#single-track-player).
|
|
25
25
|
- **Time display & format** — `<daw-time-display>` / `<daw-time-format>` show and switch the playback clock (`hh:mm:ss.sss`, `hh:mm:ss`, `seconds`) for any transport target.
|
|
26
26
|
- **CSS theming** — Dark mode by default, fully customizable via CSS custom properties
|
|
27
27
|
- **Native Web Audio** — Uses `@dawcore/transport` for playback scheduling. No Tone.js dependency.
|
|
@@ -177,7 +177,7 @@ This expands to a MIDI track, `<daw-track kind="midi">`, containing a `<daw-clip
|
|
|
177
177
|
</script>
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
A clip is treated as MIDI iff `clip.midiNotes != null`. MIDI clips skip audio fetch + decode + peak generation. Move drag
|
|
180
|
+
A clip is treated as MIDI iff `clip.midiNotes != null`. MIDI clips skip audio fetch + decode + peak generation. Move drag and split-at-playhead work on MIDI clips (a split keeps the clip's notes, channel and program on both halves, each half playing and drawing the notes inside its own range); trim handles are inert on them.
|
|
181
181
|
|
|
182
182
|
**Theming:** the piano-roll honors `--daw-piano-roll-note-color` (default `#2a7070`), `--daw-piano-roll-selected-note-color` (default `#3d9e9e`), and `--daw-piano-roll-background` (default `#1a1a2e`).
|
|
183
183
|
|
|
@@ -390,15 +390,15 @@ const result = await editor.loadFiles(fileList);
|
|
|
390
390
|
</script>
|
|
391
391
|
```
|
|
392
392
|
|
|
393
|
-
A recorded take has no `<daw-clip>` element; its engine clip id is the `clipId` in `daw-recording-clip-add`, and it is also on the take's entry in `editor.tracks[n].clips` (`kind: 'drop'`, `clipId`).
|
|
393
|
+
A recorded take has no `<daw-clip>` element; its engine clip id is the `clipId` in `daw-recording-clip-add`, and it is also on the take's entry in `editor.tracks[n].clips` (`kind: 'drop'`, `clipId`). `editor.tracks` reads the arrangement, so the entry is where the clip is after `updateClip()`, a drag or a trim, and it is gone when the clip goes away (`removeClip()`, undo, a later punch-in over it). Splitting a take keeps its id on the left half (#848); the right half is a new clip, listed with its own id.
|
|
394
394
|
|
|
395
395
|
`daw-recording-clip-add` is not guaranteed after every `daw-recording-complete`: it is skipped when you cancel the complete event, when peak generation for the take fails (`daw-error` with `operation: 'recording-peaks'`), and when the track was removed in the meantime.
|
|
396
396
|
|
|
397
|
-
During a take the editor shows the live preview with full clip chrome (header label from `RecordingOptions.clipName`, default "Recording…"),
|
|
397
|
+
During a take the editor shows the live preview with full clip chrome (header label from `RecordingOptions.clipName`, default "Recording…"), mutes the recorded track for the take (punch-in replaces whatever the take overlaps, so the doomed material never plays under the overdub: the track plays muted, its controls and `editor.tracks` show it muted, and an `exportAudio()` during the take leaves it out; the take's mute is not an undo step and does not change the track's own mute, so a mute changed during the take stays after it), and suppresses the end-of-timeline auto-stop so the take can run past existing audio.
|
|
398
398
|
|
|
399
399
|
## Single-Track Player
|
|
400
400
|
|
|
401
|
-
`<daw-player>` is a standalone element for single-track playback (podcasts, audiobooks, previewing one file) — it wraps `@waveform-playlist/media-element-playout` and needs no `adapter`, `AudioContext`, or `
|
|
401
|
+
`<daw-player>` is a standalone element for single-track playback (podcasts, audiobooks, previewing one file) — it wraps `@waveform-playlist/media-element-playout` and needs no `adapter`, `AudioContext`, or `EditorEngine`. `@waveform-playlist/media-element-playout` ships as a direct dependency of `@dawcore/components`, so there's nothing extra to install:
|
|
402
402
|
|
|
403
403
|
```html
|
|
404
404
|
<daw-player
|
|
@@ -436,10 +436,12 @@ Add `<daw-keyboard-shortcuts>` as a child of `<daw-editor>`:
|
|
|
436
436
|
|
|
437
437
|
| Attribute | Shortcuts |
|
|
438
438
|
|-----------|-----------|
|
|
439
|
-
| `playback` | Space (play/pause),
|
|
439
|
+
| `playback` | Space (play/pause), Escape (stop), 0 (rewind to start) |
|
|
440
440
|
| `splitting` | S (split at playhead) |
|
|
441
441
|
| `undo` | Cmd/Ctrl+Z (undo), Cmd/Ctrl+Shift+Z (redo) |
|
|
442
442
|
|
|
443
|
+
During a clip move or trim, or a track-reorder drag, undo and redo do nothing (the keys and `editor.undo()` / `redo()`), and Escape only cancels the drag: it does not also stop playback.
|
|
444
|
+
|
|
443
445
|
Custom shortcuts via JS properties: `playbackShortcuts`, `splittingShortcuts`, `undoShortcuts`, `customShortcuts`.
|
|
444
446
|
|
|
445
447
|
## CSS Theming
|
|
@@ -459,6 +461,8 @@ daw-editor {
|
|
|
459
461
|
--daw-controls-text: #e0d4c8;
|
|
460
462
|
--daw-clip-header-background: rgba(0, 0, 0, 0.4);
|
|
461
463
|
--daw-clip-header-text: #e0d4c8;
|
|
464
|
+
--daw-placeholder-clip-opacity: 0.5; /* a clip whose audio is still loading */
|
|
465
|
+
--daw-clip-failed-color: #e06c75; /* the outline and tint of a clip whose audio failed */
|
|
462
466
|
--daw-controls-width: 180px;
|
|
463
467
|
--daw-min-height: 200px;
|
|
464
468
|
--daw-piano-roll-note-color: #2a7070;
|
|
@@ -494,25 +498,25 @@ Core orchestrator. Attributes:
|
|
|
494
498
|
| `eager-resume` | string | — | Resume AudioContext on first gesture; bare attribute targets the editor, or pass `"document"` / a CSS selector |
|
|
495
499
|
| `time-format` | string | `'hh:mm:ss.sss'` | Clock format read by `<daw-time-display>` / `<daw-time-format>`: `'hh:mm:ss.sss'`, `'hh:mm:ss'`, or `'seconds'` |
|
|
496
500
|
|
|
497
|
-
JS properties: `adapter` (required `PlayoutAdapter`), `recordingStream`, `bpm`, `ppqn`, `timeSignature`, `meterEntries`, `secondsToTicks` / `ticksToSeconds` (variable-tempo callbacks), `spectrogramConfig`, `spectrogramColorMap`. Read-only: `engine`, `audioContext` (from the adapter), `tracks`, `selection`, `selectedTrackId`, `currentTime`, `canUndo` / `canRedo`, `isRecording`.
|
|
501
|
+
JS properties: `adapter` (required `PlayoutAdapter`), `arrangement` (the arrangement the editor plays: its own, whose content the `<daw-track>` children declare, or one the app hands in with `editor.arrangement = createArrangement({ tracks })`, played alone until `null`; the adapter is kept across the swap), `recordingStream`, `bpm`, `ppqn`, `timeSignature`, `meterEntries`, `secondsToTicks` / `ticksToSeconds` (variable-tempo callbacks), `spectrogramConfig`, `spectrogramColorMap`. Read-only: `engine`, `audioContext` (from the adapter), `tracks`, `selection`, `selectedTrackId`, `currentTime`, `canUndo` / `canRedo`, `isRecording`.
|
|
498
502
|
|
|
499
503
|
Methods:
|
|
500
504
|
|
|
501
505
|
- Playback: `play(startTime?)`, `pause()`, `stop()`, `togglePlayPause()`, `seekTo(time)`
|
|
502
|
-
- Loading: `loadFiles(files)`, `loadMidi(urlOrFile, options?)`, `ready()`
|
|
506
|
+
- Loading: `loadFiles(files, options?)`, `loadMidi(urlOrFile, options?)`, `ready()`. `options.signal` cancels the call (an `AbortError`; what it added is taken out, with no undo step)
|
|
503
507
|
- Display: `setTimeFormat(format)` — sugar over the `timeFormat` property, fires `daw-time-format-change`
|
|
504
|
-
- Tracks & clips: `addTrack(config)`, `removeTrack(id)`, `updateTrack(id, partial)`, `addClip(trackId, config)`, `removeClip(trackId, clipId)`, `updateClip(trackId, clipId, partial)`
|
|
508
|
+
- Tracks & clips: `addTrack(config, options?)`, `removeTrack(id)`, `updateTrack(id, partial)`, `reorderTrack(id, toIndex)`, `addClip(trackId, config, options?)`, `removeClip(trackId, clipId)`, `updateClip(trackId, clipId, partial)`. They are calls on `editor.arrangement`: `addTrack` and `addClip` create no element, `updateTrack` / `updateClip` / `reorderTrack` write and move no element, and `removeTrack` / `removeClip` remove the element when there is one
|
|
505
509
|
- Editing: `splitAtPlayhead()`, `undo()`, `redo()`, `setSelection(start, end)`
|
|
506
510
|
- Recording: `startRecording(stream?, options?)`, `stopRecording()`, `pauseRecording()`, `resumeRecording()`, `togglePauseRecording()`. Options include `overdub` (start playback with the take), `latencyOffset` (seconds), and `clipName` (live-preview header + finalized clip name, default `"Recording"`)
|
|
507
511
|
- Effects & export: the master-chain effects API (see [Effects](#effects)), `getEffectsState()` / `setEffectsState(entries)`, `openEffectGui()` / `closeEffectGui()`, `exportAudio(options?)`
|
|
508
512
|
|
|
509
513
|
### `<daw-track>`
|
|
510
514
|
|
|
511
|
-
Declarative track data. Attributes: `src`, `name`, `volume`, `pan`, `muted`, `soloed`, `kind` (`'audio' | 'midi'`, default `'audio'`: what the track holds; set it before the track is added), `render-mode` (`'waveform' | 'spectrogram'`, default `'waveform'`: how an audio track is drawn; a MIDI track is always a piano roll). JS property: `spectrogramConfig` (per-track spectrogram override). Also exposes the per-track effects API (see [Effects](#effects)).
|
|
515
|
+
Declarative track data. Attributes: `src`, `name`, `volume`, `pan`, `pan-law` (`'mono'` or `'stereo'`: the pan law the track enters with; without it the track's first decoded audio decides, and the track keeps that law whatever clips follow; the live `panLaw` property reads it), `muted`, `soloed`, `kind` (`'audio' | 'midi'`, default `'audio'`: what the track holds; set it before the track is added), `render-mode` (`'waveform' | 'spectrogram'`, default `'waveform'`: how an audio track is drawn; a MIDI track is always a piano roll). JS property: `spectrogramConfig` (per-track spectrogram override). Also exposes the per-track effects API (see [Effects](#effects)). The attributes are the declaration and are never written by the editor; the properties `name`, `volume`, `pan`, `panLaw`, `muted` and `soloed` read the arrangement live (after an Undo they show the restored values), and setting one, or changing its attribute, is one undo step (`panLaw = 'auto'` on a track that has entered changes nothing: a decided law does not go back). `index` is the track's position in the arrangement. An element whose track left the arrangement (an Undo of its arrival, a removal made on the arrangement) or that waits while a handed-in arrangement is set is detached: `:state(detached)` in CSS, its properties read the declaration, and a change warns and does nothing. Moving a `<daw-track>` in the DOM reorders the track; an Undo moves no element. Fires `daw-track-update` `{ trackId, changed }` after a property changes. Loading does not clear the undo history.
|
|
512
516
|
|
|
513
517
|
### `<daw-clip>`
|
|
514
518
|
|
|
515
|
-
Declarative clip data. Attributes: `src`, `peaks-src`, `start`, `duration`, `offset`, `gain`, `name`, `color`, `midi-channel`, `midi-program`. JS-only property: `midiNotes: MidiNoteData[] | null` (note arrays are too large for attributes).
|
|
519
|
+
Declarative clip data. Attributes: `src`, `peaks-src`, `start`, `duration`, `offset`, `gain`, `name`, `color`, `fade-in`, `fade-out`, `fade-type`, `midi-channel`, `midi-program`. JS-only property: `midiNotes: MidiNoteData[] | null` (note arrays are too large for attributes). `start`, `duration`, `offset`, `gain`, `name` and the MIDI fields read the arrangement live (after a drag, `clipEl.start` is where the clip is; the attribute keeps what the page wrote), and setting one is one undo step. A split keeps the clip's id on its left half, so the element follows it.
|
|
516
520
|
|
|
517
521
|
### `<daw-piano-roll>`
|
|
518
522
|
|
|
@@ -524,7 +528,7 @@ Container that resolves target editor. Children: `<daw-play-button>`, `<daw-paus
|
|
|
524
528
|
|
|
525
529
|
### `<daw-track-controls>`
|
|
526
530
|
|
|
527
|
-
Per-track UI for volume, pan, mute, solo.
|
|
531
|
+
Per-track UI for volume, pan, mute, solo. Draws the arrangement's mix (so it follows Undo and Redo), dispatches `daw-track-control` and `daw-track-remove` events. One slider drag or key press is one undo step, each Mute or Solo click is one. Keyboard Undo does not fire while a slider has focus.
|
|
528
532
|
|
|
529
533
|
### `<daw-keyboard-shortcuts>`
|
|
530
534
|
|
|
@@ -540,7 +544,7 @@ Formatted playback-time readout. Must be inside a `<daw-transport for="editor-id
|
|
|
540
544
|
|
|
541
545
|
### `<daw-player>`
|
|
542
546
|
|
|
543
|
-
Standalone single-track player — see [Single-Track Player](#single-track-player). No `adapter`/`AudioContext`/`
|
|
547
|
+
Standalone single-track player — see [Single-Track Player](#single-track-player). No `adapter`/`AudioContext`/`EditorEngine`; wraps `@waveform-playlist/media-element-playout`.
|
|
544
548
|
|
|
545
549
|
Attributes: `src`, `peaks-src`, `wave-height` (default `128`), `timescale`, `mono`, `bar-width` (default `1`), `bar-gap` (default `0`), `rounded-bars`, `playback-rate` (default `1`, clamped `0.25`–`4`).
|
|
546
550
|
|