@waveform-playlist/ui-components 13.1.0 → 13.1.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.mjs CHANGED
@@ -2345,7 +2345,11 @@ var usePlayoutStatusUpdate = () => useContext8(PlayoutStatusUpdateContext);
2345
2345
  // src/components/SpectrogramChannel.tsx
2346
2346
  import { useRef as useRef7, useEffect as useEffect6 } from "react";
2347
2347
  import styled20 from "styled-components";
2348
- import { MAX_CANVAS_WIDTH as MAX_CANVAS_WIDTH3 } from "@waveform-playlist/core";
2348
+ import {
2349
+ MAX_CANVAS_WIDTH as MAX_CANVAS_WIDTH3,
2350
+ buildSpectrogramCanvasId,
2351
+ parseSpectrogramCanvasId
2352
+ } from "@waveform-playlist/core";
2349
2353
  import { jsx as jsx23 } from "react/jsx-runtime";
2350
2354
  var Wrapper4 = styled20.div.attrs((props) => ({
2351
2355
  style: {
@@ -2402,12 +2406,12 @@ var SpectrogramChannel = ({
2402
2406
  const register = onCanvasRegisterRef.current;
2403
2407
  const remaining = [];
2404
2408
  for (const id of registeredIdsRef.current) {
2405
- const match = id.match(/chunk(\d+)$/);
2406
- if (!match) {
2409
+ const parsed = parseSpectrogramCanvasId(id);
2410
+ if (!parsed) {
2407
2411
  remaining.push(id);
2408
2412
  continue;
2409
2413
  }
2410
- const chunkIdx = parseInt(match[1], 10);
2414
+ const chunkIdx = parsed.chunkIndex;
2411
2415
  const canvas = canvasMapRef.current.get(chunkIdx);
2412
2416
  if (canvas && canvas.isConnected) {
2413
2417
  remaining.push(id);
@@ -2422,7 +2426,7 @@ var SpectrogramChannel = ({
2422
2426
  registeredIdsRef.current = remaining;
2423
2427
  for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
2424
2428
  if (transferredCanvasesRef.current.has(canvas)) continue;
2425
- const canvasId = `${clipId}-ch${channelIndex}-chunk${canvasIdx}`;
2429
+ const canvasId = buildSpectrogramCanvasId({ clipId, channelIndex, chunkIndex: canvasIdx });
2426
2430
  let offscreen;
2427
2431
  try {
2428
2432
  offscreen = canvas.transferControlToOffscreen();