@waveform-playlist/ui-components 9.4.1 → 9.5.0

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
@@ -334,7 +334,7 @@ var AutomaticScrollCheckbox = ({
334
334
  };
335
335
 
336
336
  // src/components/Channel.tsx
337
- import { useEffect as useEffect3 } from "react";
337
+ import { useLayoutEffect as useLayoutEffect2 } from "react";
338
338
  import styled9 from "styled-components";
339
339
 
340
340
  // src/wfpl-theme.ts
@@ -780,7 +780,7 @@ var Channel = (props) => {
780
780
  const { canvasRef, canvasMapRef } = useChunkedCanvasRefs();
781
781
  const clipOriginX = useClipViewportOrigin();
782
782
  const visibleChunkIndices = useVisibleChunkIndices(length, MAX_CANVAS_WIDTH, clipOriginX);
783
- useEffect3(() => {
783
+ useLayoutEffect2(() => {
784
784
  const step = barWidth + barGap;
785
785
  for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
786
786
  const globalPixelOffset = canvasIdx * MAX_CANVAS_WIDTH;
@@ -1296,7 +1296,7 @@ var MasterVolumeControl = ({
1296
1296
  };
1297
1297
 
1298
1298
  // src/components/PianoRollChannel.tsx
1299
- import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
1299
+ import { useLayoutEffect as useLayoutEffect3, useMemo as useMemo2 } from "react";
1300
1300
  import styled15 from "styled-components";
1301
1301
  import { MAX_CANVAS_WIDTH as MAX_CANVAS_WIDTH2 } from "@waveform-playlist/core";
1302
1302
  import { jsx as jsx12 } from "react/jsx-runtime";
@@ -1352,7 +1352,7 @@ var PianoRollChannel = ({
1352
1352
  return { minMidi: Math.max(0, min - 1), maxMidi: Math.min(127, max + 1) };
1353
1353
  }, [midiNotes]);
1354
1354
  const color = isSelected ? selectedNoteColor : noteColor;
1355
- useEffect4(() => {
1355
+ useLayoutEffect3(() => {
1356
1356
  const noteRange = maxMidi - minMidi + 1;
1357
1357
  const noteHeight = Math.max(2, waveHeight / noteRange);
1358
1358
  const pixelsPerSecond = sampleRate / samplesPerPixel;
@@ -1421,7 +1421,7 @@ var PianoRollChannel = ({
1421
1421
  };
1422
1422
 
1423
1423
  // src/components/Playhead.tsx
1424
- import { useRef as useRef3, useEffect as useEffect5 } from "react";
1424
+ import { useRef as useRef3, useEffect as useEffect3 } from "react";
1425
1425
  import styled16 from "styled-components";
1426
1426
  import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
1427
1427
  var PlayheadLine = styled16.div.attrs((props) => ({
@@ -1483,7 +1483,7 @@ var PlayheadWithMarker = ({
1483
1483
  }) => {
1484
1484
  const containerRef = useRef3(null);
1485
1485
  const animationFrameRef = useRef3(null);
1486
- useEffect5(() => {
1486
+ useEffect3(() => {
1487
1487
  const updatePosition = () => {
1488
1488
  if (containerRef.current) {
1489
1489
  let time;
@@ -1528,7 +1528,7 @@ var PlayheadWithMarker = ({
1528
1528
  getAudioContextTime,
1529
1529
  getPlaybackTime
1530
1530
  ]);
1531
- useEffect5(() => {
1531
+ useEffect3(() => {
1532
1532
  if (!isPlaying && containerRef.current) {
1533
1533
  const time = currentTimeRef.current ?? 0;
1534
1534
  const pos = time * sampleRate / samplesPerPixel + controlsOffset;
@@ -2013,10 +2013,10 @@ var TimescaleLoopRegion = ({
2013
2013
  };
2014
2014
 
2015
2015
  // src/components/SelectionTimeInputs.tsx
2016
- import { useEffect as useEffect7, useState as useState3 } from "react";
2016
+ import { useEffect as useEffect5, useState as useState3 } from "react";
2017
2017
 
2018
2018
  // src/components/TimeInput.tsx
2019
- import { useEffect as useEffect6, useState as useState2 } from "react";
2019
+ import { useEffect as useEffect4, useState as useState2 } from "react";
2020
2020
 
2021
2021
  // src/utils/timeFormat.ts
2022
2022
  function clockFormat(seconds, decimals) {
@@ -2077,7 +2077,7 @@ var TimeInput = ({
2077
2077
  readOnly = false
2078
2078
  }) => {
2079
2079
  const [displayValue, setDisplayValue] = useState2("");
2080
- useEffect6(() => {
2080
+ useEffect4(() => {
2081
2081
  const formatted = formatTime(value, format);
2082
2082
  setDisplayValue(formatted);
2083
2083
  }, [value, format, id]);
@@ -2124,7 +2124,7 @@ var SelectionTimeInputs = ({
2124
2124
  className
2125
2125
  }) => {
2126
2126
  const [timeFormat, setTimeFormat] = useState3("hh:mm:ss.uuu");
2127
- useEffect7(() => {
2127
+ useEffect5(() => {
2128
2128
  const timeFormatSelect = document.querySelector(".time-format");
2129
2129
  const handleFormatChange = () => {
2130
2130
  if (timeFormatSelect) {
@@ -2297,7 +2297,7 @@ var usePlayoutStatus = () => useContext8(PlayoutStatusContext);
2297
2297
  var usePlayoutStatusUpdate = () => useContext8(PlayoutStatusUpdateContext);
2298
2298
 
2299
2299
  // src/components/SpectrogramChannel.tsx
2300
- import { useRef as useRef6, useEffect as useEffect8 } from "react";
2300
+ import { useRef as useRef6, useEffect as useEffect6, useLayoutEffect as useLayoutEffect4 } from "react";
2301
2301
  import styled20 from "styled-components";
2302
2302
  import { MAX_CANVAS_WIDTH as MAX_CANVAS_WIDTH3 } from "@waveform-playlist/core";
2303
2303
  import { jsx as jsx23 } from "react/jsx-runtime";
@@ -2363,13 +2363,13 @@ var SpectrogramChannel = ({
2363
2363
  const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
2364
2364
  const scaleFn = frequencyScaleFn ?? LINEAR_FREQUENCY_SCALE;
2365
2365
  const hasCustomFrequencyScale = Boolean(frequencyScaleFn);
2366
- useEffect8(() => {
2366
+ useEffect6(() => {
2367
2367
  workerApiRef.current = workerApi;
2368
2368
  }, [workerApi]);
2369
- useEffect8(() => {
2369
+ useEffect6(() => {
2370
2370
  onCanvasesReadyRef.current = onCanvasesReady;
2371
2371
  }, [onCanvasesReady]);
2372
- useEffect8(() => {
2372
+ useEffect6(() => {
2373
2373
  if (!isWorkerMode) return;
2374
2374
  const currentWorkerApi = workerApiRef.current;
2375
2375
  if (!currentWorkerApi || !clipId) return;
@@ -2432,7 +2432,7 @@ var SpectrogramChannel = ({
2432
2432
  onCanvasesReadyRef.current?.(allIds, allWidths);
2433
2433
  }
2434
2434
  }, [canvasMapRef, isWorkerMode, clipId, channelIndex, length, visibleChunkIndices]);
2435
- useEffect8(() => {
2435
+ useEffect6(() => {
2436
2436
  return () => {
2437
2437
  const api = workerApiRef.current;
2438
2438
  if (!api) return;
@@ -2446,7 +2446,7 @@ var SpectrogramChannel = ({
2446
2446
  registeredIdsRef.current = [];
2447
2447
  };
2448
2448
  }, []);
2449
- useEffect8(() => {
2449
+ useLayoutEffect4(() => {
2450
2450
  if (isWorkerMode || !data) return;
2451
2451
  const {
2452
2452
  frequencyBinCount,
@@ -2695,7 +2695,7 @@ var SmartChannel = ({
2695
2695
  };
2696
2696
 
2697
2697
  // src/components/SpectrogramLabels.tsx
2698
- import { useRef as useRef7, useLayoutEffect as useLayoutEffect2 } from "react";
2698
+ import { useRef as useRef7, useLayoutEffect as useLayoutEffect5 } from "react";
2699
2699
  import styled21 from "styled-components";
2700
2700
  import { jsx as jsx25 } from "react/jsx-runtime";
2701
2701
  var LABELS_WIDTH = 72;
@@ -2752,7 +2752,7 @@ var SpectrogramLabels = ({
2752
2752
  const spectrogramHeight = renderMode === "both" ? Math.floor(waveHeight / 2) : waveHeight;
2753
2753
  const totalHeight = numChannels * waveHeight;
2754
2754
  const clipHeaderOffset = hasClipHeaders ? 22 : 0;
2755
- useLayoutEffect2(() => {
2755
+ useLayoutEffect5(() => {
2756
2756
  const canvas = canvasRef.current;
2757
2757
  if (!canvas) return;
2758
2758
  const ctx = canvas.getContext("2d");
@@ -2810,7 +2810,7 @@ import React19, { useContext as useContext10, useMemo as useMemo4 } from "react"
2810
2810
  import styled23 from "styled-components";
2811
2811
 
2812
2812
  // src/components/TimeScale.tsx
2813
- import { useLayoutEffect as useLayoutEffect3, useContext as useContext9 } from "react";
2813
+ import { useLayoutEffect as useLayoutEffect6, useContext as useContext9 } from "react";
2814
2814
  import styled22, { withTheme as withTheme2 } from "styled-components";
2815
2815
  import { MAX_CANVAS_WIDTH as MAX_CANVAS_WIDTH4 } from "@waveform-playlist/core";
2816
2816
  import { jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
@@ -2865,7 +2865,7 @@ var TimeScale = (props) => {
2865
2865
  const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] * MAX_CANVAS_WIDTH4 : 0;
2866
2866
  const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) * MAX_CANVAS_WIDTH4 : Infinity;
2867
2867
  const visibleMarkers = visibleChunkIndices.length > 0 ? timeMarkersWithPositions.filter(({ pix }) => pix >= firstChunkLeft && pix < lastChunkRight).map(({ element }) => element) : timeMarkersWithPositions.map(({ element }) => element);
2868
- useLayoutEffect3(() => {
2868
+ useLayoutEffect6(() => {
2869
2869
  for (const [chunkIdx, canvas] of canvasMapRef.current.entries()) {
2870
2870
  const ctx = canvas.getContext("2d");
2871
2871
  if (!ctx) continue;
@@ -3358,7 +3358,7 @@ var SliderWrapper = styled32.label`
3358
3358
  `;
3359
3359
 
3360
3360
  // src/components/TrackMenu.tsx
3361
- import React20, { useState as useState6, useEffect as useEffect9, useRef as useRef8, useCallback as useCallback5 } from "react";
3361
+ import React20, { useState as useState6, useEffect as useEffect7, useRef as useRef8, useCallback as useCallback5 } from "react";
3362
3362
  import { createPortal } from "react-dom";
3363
3363
  import styled33 from "styled-components";
3364
3364
  import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
@@ -3424,7 +3424,7 @@ var TrackMenu = ({ items: itemsProp }) => {
3424
3424
  }
3425
3425
  setDropdownPos({ top, left });
3426
3426
  }, []);
3427
- useEffect9(() => {
3427
+ useEffect7(() => {
3428
3428
  if (!open) return;
3429
3429
  updatePosition();
3430
3430
  const rafId = requestAnimationFrame(() => updatePosition());
@@ -3438,7 +3438,7 @@ var TrackMenu = ({ items: itemsProp }) => {
3438
3438
  window.removeEventListener("resize", onResize);
3439
3439
  };
3440
3440
  }, [open, updatePosition]);
3441
- useEffect9(() => {
3441
+ useEffect7(() => {
3442
3442
  if (!open) return;
3443
3443
  const handleClick = (e) => {
3444
3444
  const target = e.target;