@dawcore/components 0.0.19 → 0.0.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/dist/index.d.mts +127 -113
- package/dist/index.d.ts +127 -113
- package/dist/index.js +83 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -174,7 +174,7 @@ var DawTrackElement = class extends LitElement2 {
|
|
|
174
174
|
this.pan = 0;
|
|
175
175
|
this.muted = false;
|
|
176
176
|
this.soloed = false;
|
|
177
|
-
this.
|
|
177
|
+
this._renderMode = "waveform";
|
|
178
178
|
this.spectrogramConfig = null;
|
|
179
179
|
this.trackId = crypto.randomUUID();
|
|
180
180
|
// Track removal is detected by the editor's MutationObserver,
|
|
@@ -182,6 +182,21 @@ var DawTrackElement = class extends LitElement2 {
|
|
|
182
182
|
// cannot bubble events to ancestors).
|
|
183
183
|
this._hasRendered = false;
|
|
184
184
|
}
|
|
185
|
+
get renderMode() {
|
|
186
|
+
return this._renderMode;
|
|
187
|
+
}
|
|
188
|
+
set renderMode(value) {
|
|
189
|
+
const old = this._renderMode;
|
|
190
|
+
let next = value;
|
|
191
|
+
if (next === "both") {
|
|
192
|
+
console.warn(
|
|
193
|
+
`[dawcore] <daw-track render-mode="both"> is not yet supported; falling back to 'spectrogram'`
|
|
194
|
+
);
|
|
195
|
+
next = "spectrogram";
|
|
196
|
+
}
|
|
197
|
+
this._renderMode = next;
|
|
198
|
+
this.requestUpdate("renderMode", old);
|
|
199
|
+
}
|
|
185
200
|
// Light DOM so <daw-clip> children are queryable.
|
|
186
201
|
createRenderRoot() {
|
|
187
202
|
return this;
|
|
@@ -244,8 +259,8 @@ __decorateClass([
|
|
|
244
259
|
property2({ type: Boolean })
|
|
245
260
|
], DawTrackElement.prototype, "soloed", 2);
|
|
246
261
|
__decorateClass([
|
|
247
|
-
property2({ attribute: "render-mode" })
|
|
248
|
-
], DawTrackElement.prototype, "renderMode",
|
|
262
|
+
property2({ attribute: "render-mode", noAccessor: true })
|
|
263
|
+
], DawTrackElement.prototype, "renderMode", 1);
|
|
249
264
|
__decorateClass([
|
|
250
265
|
property2({ attribute: false })
|
|
251
266
|
], DawTrackElement.prototype, "spectrogramConfig", 2);
|
|
@@ -2725,15 +2740,10 @@ var RecordingController = class {
|
|
|
2725
2740
|
import {
|
|
2726
2741
|
SpectrogramOrchestrator
|
|
2727
2742
|
} from "@dawcore/spectrogram";
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
minFrequency: 0,
|
|
2733
|
-
gainDb: 20,
|
|
2734
|
-
rangeDb: 80
|
|
2735
|
-
};
|
|
2736
|
-
var LIBRARY_DEFAULT_COLOR_MAP = "viridis";
|
|
2743
|
+
import {
|
|
2744
|
+
SPECTROGRAM_DEFAULTS as LIBRARY_DEFAULTS,
|
|
2745
|
+
DEFAULT_SPECTROGRAM_COLOR_MAP as LIBRARY_DEFAULT_COLOR_MAP
|
|
2746
|
+
} from "@waveform-playlist/core";
|
|
2737
2747
|
var SpectrogramController = class {
|
|
2738
2748
|
constructor(host, workerFactory) {
|
|
2739
2749
|
this.orchestrator = null;
|
|
@@ -2807,7 +2817,21 @@ var SpectrogramController = class {
|
|
|
2807
2817
|
const detail = e.detail;
|
|
2808
2818
|
this.host.dispatchEvent(
|
|
2809
2819
|
new CustomEvent("daw-spectrogram-ready", {
|
|
2810
|
-
detail,
|
|
2820
|
+
detail: { trackId: detail.trackId, generation: detail.generation },
|
|
2821
|
+
bubbles: true,
|
|
2822
|
+
composed: true
|
|
2823
|
+
})
|
|
2824
|
+
);
|
|
2825
|
+
});
|
|
2826
|
+
this.orchestrator.addEventListener("viewport-error", (e) => {
|
|
2827
|
+
const detail = e.detail;
|
|
2828
|
+
this.host.dispatchEvent(
|
|
2829
|
+
new CustomEvent("daw-spectrogram-error", {
|
|
2830
|
+
detail: {
|
|
2831
|
+
trackId: detail.trackId,
|
|
2832
|
+
generation: detail.generation,
|
|
2833
|
+
error: detail.error
|
|
2834
|
+
},
|
|
2811
2835
|
bubbles: true,
|
|
2812
2836
|
composed: true
|
|
2813
2837
|
})
|
|
@@ -3886,7 +3910,10 @@ var DawEditorElement = class extends LitElement10 {
|
|
|
3886
3910
|
* `_selectedTrackId`, etc.) — most of which don't affect the spectrogram
|
|
3887
3911
|
* viewport. Skip the cross-controller call when nothing changed.
|
|
3888
3912
|
*
|
|
3889
|
-
* The orchestrator dedupes too,
|
|
3913
|
+
* The orchestrator dedupes identical viewports too, so removing this cache
|
|
3914
|
+
* wouldn't change observable behavior — but it would push a fresh
|
|
3915
|
+
* `setViewport` call (with object allocation) into every Lit reactive
|
|
3916
|
+
* update for properties unrelated to the viewport.
|
|
3890
3917
|
*/
|
|
3891
3918
|
this._lastSpectrogramViewport = null;
|
|
3892
3919
|
// --- Track Events ---
|
|
@@ -4129,9 +4156,10 @@ var DawEditorElement = class extends LitElement10 {
|
|
|
4129
4156
|
this._spectrogramController?.unregisterCanvas(canvasId);
|
|
4130
4157
|
}
|
|
4131
4158
|
/**
|
|
4132
|
-
*
|
|
4133
|
-
*
|
|
4134
|
-
*
|
|
4159
|
+
* Forward a clip's AudioBuffer to the spectrogram controller if the parent
|
|
4160
|
+
* track is in spectrogram render-mode. Eagerly creates the controller via
|
|
4161
|
+
* `_ensureSpectrogramController` so the audio data is queued for the first
|
|
4162
|
+
* render — even if no canvases have been registered yet.
|
|
4135
4163
|
*/
|
|
4136
4164
|
_maybeRegisterSpectrogramClipAudio(trackId, clip) {
|
|
4137
4165
|
const descriptor = this._tracks.get(trackId);
|
|
@@ -5248,6 +5276,13 @@ var DawEditorElement = class extends LitElement10 {
|
|
|
5248
5276
|
}
|
|
5249
5277
|
const oldDesc = this._tracks.get(trackId);
|
|
5250
5278
|
if (!oldDesc) return;
|
|
5279
|
+
let normalizedRenderMode = partial.renderMode;
|
|
5280
|
+
if (normalizedRenderMode === "both") {
|
|
5281
|
+
console.warn(
|
|
5282
|
+
`[dawcore] render-mode="both" is not yet supported; falling back to 'spectrogram'`
|
|
5283
|
+
);
|
|
5284
|
+
normalizedRenderMode = "spectrogram";
|
|
5285
|
+
}
|
|
5251
5286
|
const newDesc = {
|
|
5252
5287
|
...oldDesc,
|
|
5253
5288
|
...partial.name !== void 0 && { name: partial.name },
|
|
@@ -5255,7 +5290,7 @@ var DawEditorElement = class extends LitElement10 {
|
|
|
5255
5290
|
...partial.pan !== void 0 && { pan: partial.pan },
|
|
5256
5291
|
...partial.muted !== void 0 && { muted: partial.muted },
|
|
5257
5292
|
...partial.soloed !== void 0 && { soloed: partial.soloed },
|
|
5258
|
-
...
|
|
5293
|
+
...normalizedRenderMode !== void 0 && { renderMode: normalizedRenderMode }
|
|
5259
5294
|
};
|
|
5260
5295
|
this._tracks = new Map(this._tracks).set(trackId, newDesc);
|
|
5261
5296
|
if (this._engine) {
|
|
@@ -6552,6 +6587,7 @@ var DawSpectrogramElement = class extends LitElement14 {
|
|
|
6552
6587
|
this.originX = 0;
|
|
6553
6588
|
this._canvases = [];
|
|
6554
6589
|
this._registeredCanvasIds = [];
|
|
6590
|
+
this._warnedNoHost = false;
|
|
6555
6591
|
}
|
|
6556
6592
|
get samplesPerPixel() {
|
|
6557
6593
|
return this._samplesPerPixel;
|
|
@@ -6618,7 +6654,15 @@ var DawSpectrogramElement = class extends LitElement14 {
|
|
|
6618
6654
|
}
|
|
6619
6655
|
_registerCanvases() {
|
|
6620
6656
|
const editor = this._findHostEditor();
|
|
6621
|
-
if (!editor || typeof editor._spectrogramRegisterCanvas !== "function")
|
|
6657
|
+
if (!editor || typeof editor._spectrogramRegisterCanvas !== "function") {
|
|
6658
|
+
if (!this._warnedNoHost) {
|
|
6659
|
+
this._warnedNoHost = true;
|
|
6660
|
+
console.warn(
|
|
6661
|
+
"[dawcore] <daw-spectrogram> (clip " + this.clipId + ") could not find host <daw-editor>. Canvases will not render. Ensure the element is mounted inside a <daw-editor>."
|
|
6662
|
+
);
|
|
6663
|
+
}
|
|
6664
|
+
return;
|
|
6665
|
+
}
|
|
6622
6666
|
for (let i = 0; i < this._canvases.length; i++) {
|
|
6623
6667
|
const canvas = this._canvases[i];
|
|
6624
6668
|
const canvasId = this.clipId + "-ch" + this.channelIndex + "-chunk" + i;
|