@waveform-playlist/ui-components 6.0.0 → 6.0.1
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -420,8 +420,10 @@ interface SpectrogramWorkerCanvasApi {
|
|
|
420
420
|
unregisterCanvas(canvasId: string): void;
|
|
421
421
|
}
|
|
422
422
|
interface SpectrogramChannelProps {
|
|
423
|
-
/**
|
|
423
|
+
/** Visual position index — used for CSS positioning (top offset). */
|
|
424
424
|
index: number;
|
|
425
|
+
/** Audio channel index for canvas ID construction. Defaults to `index` when omitted. */
|
|
426
|
+
channelIndex?: number;
|
|
425
427
|
/** Computed spectrogram data (not needed when workerApi is provided) */
|
|
426
428
|
data?: SpectrogramData;
|
|
427
429
|
/** Width in CSS pixels */
|
package/dist/index.d.ts
CHANGED
|
@@ -420,8 +420,10 @@ interface SpectrogramWorkerCanvasApi {
|
|
|
420
420
|
unregisterCanvas(canvasId: string): void;
|
|
421
421
|
}
|
|
422
422
|
interface SpectrogramChannelProps {
|
|
423
|
-
/**
|
|
423
|
+
/** Visual position index — used for CSS positioning (top offset). */
|
|
424
424
|
index: number;
|
|
425
|
+
/** Audio channel index for canvas ID construction. Defaults to `index` when omitted. */
|
|
426
|
+
channelIndex?: number;
|
|
425
427
|
/** Computed spectrogram data (not needed when workerApi is provided) */
|
|
426
428
|
data?: SpectrogramData;
|
|
427
429
|
/** Width in CSS pixels */
|
package/dist/index.js
CHANGED
|
@@ -2033,6 +2033,7 @@ function defaultGetColorMap() {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
var SpectrogramChannel = ({
|
|
2035
2035
|
index,
|
|
2036
|
+
channelIndex: channelIndexProp,
|
|
2036
2037
|
data,
|
|
2037
2038
|
length,
|
|
2038
2039
|
waveHeight,
|
|
@@ -2046,6 +2047,7 @@ var SpectrogramChannel = ({
|
|
|
2046
2047
|
clipId,
|
|
2047
2048
|
onCanvasesReady
|
|
2048
2049
|
}) => {
|
|
2050
|
+
const channelIndex = channelIndexProp ?? index;
|
|
2049
2051
|
const canvasesRef = (0, import_react12.useRef)([]);
|
|
2050
2052
|
const registeredIdsRef = (0, import_react12.useRef)([]);
|
|
2051
2053
|
const transferredCanvasesRef = (0, import_react12.useRef)(/* @__PURE__ */ new WeakSet());
|
|
@@ -2070,7 +2072,7 @@ var SpectrogramChannel = ({
|
|
|
2070
2072
|
const canvas = canvases2[i];
|
|
2071
2073
|
if (!canvas) continue;
|
|
2072
2074
|
if (transferredCanvasesRef.current.has(canvas)) continue;
|
|
2073
|
-
const canvasId = `${clipId}-ch${
|
|
2075
|
+
const canvasId = `${clipId}-ch${channelIndex}-chunk${i}`;
|
|
2074
2076
|
try {
|
|
2075
2077
|
const offscreen = canvas.transferControlToOffscreen();
|
|
2076
2078
|
workerApi.registerCanvas(canvasId, offscreen);
|
|
@@ -2092,7 +2094,7 @@ var SpectrogramChannel = ({
|
|
|
2092
2094
|
}
|
|
2093
2095
|
registeredIdsRef.current = [];
|
|
2094
2096
|
};
|
|
2095
|
-
}, [isWorkerMode, clipId,
|
|
2097
|
+
}, [isWorkerMode, clipId, channelIndex, length]);
|
|
2096
2098
|
const lut = colorLUT ?? defaultGetColorMap();
|
|
2097
2099
|
const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
|
|
2098
2100
|
const scaleFn = frequencyScaleFn ?? ((f, minF, maxF2) => (f - minF) / (maxF2 - minF));
|
|
@@ -2244,6 +2246,7 @@ var SmartChannel = ({
|
|
|
2244
2246
|
SpectrogramChannel,
|
|
2245
2247
|
{
|
|
2246
2248
|
index: props.index * 2,
|
|
2249
|
+
channelIndex: props.index,
|
|
2247
2250
|
data: spectrogramData,
|
|
2248
2251
|
length: props.length,
|
|
2249
2252
|
waveHeight: halfHeight,
|