@waveform-playlist/ui-components 6.0.0 → 6.0.2

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.mjs CHANGED
@@ -1927,6 +1927,7 @@ function defaultGetColorMap() {
1927
1927
  }
1928
1928
  var SpectrogramChannel = ({
1929
1929
  index,
1930
+ channelIndex: channelIndexProp,
1930
1931
  data,
1931
1932
  length,
1932
1933
  waveHeight,
@@ -1940,6 +1941,7 @@ var SpectrogramChannel = ({
1940
1941
  clipId,
1941
1942
  onCanvasesReady
1942
1943
  }) => {
1944
+ const channelIndex = channelIndexProp ?? index;
1943
1945
  const canvasesRef = useRef4([]);
1944
1946
  const registeredIdsRef = useRef4([]);
1945
1947
  const transferredCanvasesRef = useRef4(/* @__PURE__ */ new WeakSet());
@@ -1964,7 +1966,7 @@ var SpectrogramChannel = ({
1964
1966
  const canvas = canvases2[i];
1965
1967
  if (!canvas) continue;
1966
1968
  if (transferredCanvasesRef.current.has(canvas)) continue;
1967
- const canvasId = `${clipId}-ch${index}-chunk${i}`;
1969
+ const canvasId = `${clipId}-ch${channelIndex}-chunk${i}`;
1968
1970
  try {
1969
1971
  const offscreen = canvas.transferControlToOffscreen();
1970
1972
  workerApi.registerCanvas(canvasId, offscreen);
@@ -1986,7 +1988,7 @@ var SpectrogramChannel = ({
1986
1988
  }
1987
1989
  registeredIdsRef.current = [];
1988
1990
  };
1989
- }, [isWorkerMode, clipId, index, length]);
1991
+ }, [isWorkerMode, clipId, channelIndex, length]);
1990
1992
  const lut = colorLUT ?? defaultGetColorMap();
1991
1993
  const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
1992
1994
  const scaleFn = frequencyScaleFn ?? ((f, minF, maxF2) => (f - minF) / (maxF2 - minF));
@@ -2138,6 +2140,7 @@ var SmartChannel = ({
2138
2140
  SpectrogramChannel,
2139
2141
  {
2140
2142
  index: props.index * 2,
2143
+ channelIndex: props.index,
2141
2144
  data: spectrogramData,
2142
2145
  length: props.length,
2143
2146
  waveHeight: halfHeight,