@waveform-playlist/ui-components 9.4.1 → 9.5.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 +4 -24
- package/dist/index.d.ts +4 -24
- package/dist/index.js +5 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -149
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -334,7 +334,7 @@ var AutomaticScrollCheckbox = ({
|
|
|
334
334
|
};
|
|
335
335
|
|
|
336
336
|
// src/components/Channel.tsx
|
|
337
|
-
import {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
2016
|
+
import { useEffect as useEffect5, useState as useState3 } from "react";
|
|
2017
2017
|
|
|
2018
2018
|
// src/components/TimeInput.tsx
|
|
2019
|
-
import { useEffect as
|
|
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
|
-
|
|
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
|
-
|
|
2127
|
+
useEffect5(() => {
|
|
2128
2128
|
const timeFormatSelect = document.querySelector(".time-format");
|
|
2129
2129
|
const handleFormatChange = () => {
|
|
2130
2130
|
if (timeFormatSelect) {
|
|
@@ -2297,11 +2297,10 @@ 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
|
|
2300
|
+
import { useRef as useRef6, useEffect as useEffect6 } 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";
|
|
2304
|
-
var LINEAR_FREQUENCY_SCALE = (f, minF, maxF) => (f - minF) / (maxF - minF);
|
|
2305
2304
|
var Wrapper4 = styled20.div.attrs((props) => ({
|
|
2306
2305
|
style: {
|
|
2307
2306
|
top: `${props.$waveHeight * props.$index}px`,
|
|
@@ -2326,26 +2325,13 @@ var SpectrogramCanvas = styled20.canvas.attrs((props) => ({
|
|
|
2326
2325
|
image-rendering: pixelated;
|
|
2327
2326
|
image-rendering: crisp-edges;
|
|
2328
2327
|
`;
|
|
2329
|
-
function defaultGetColorMap() {
|
|
2330
|
-
const lut = new Uint8Array(256 * 3);
|
|
2331
|
-
for (let i = 0; i < 256; i++) {
|
|
2332
|
-
lut[i * 3] = lut[i * 3 + 1] = lut[i * 3 + 2] = i;
|
|
2333
|
-
}
|
|
2334
|
-
return lut;
|
|
2335
|
-
}
|
|
2336
|
-
var DEFAULT_COLOR_LUT = defaultGetColorMap();
|
|
2337
2328
|
var SpectrogramChannel = ({
|
|
2338
2329
|
index,
|
|
2339
2330
|
channelIndex: channelIndexProp,
|
|
2340
|
-
data,
|
|
2341
2331
|
length,
|
|
2342
2332
|
waveHeight,
|
|
2343
2333
|
devicePixelRatio = 1,
|
|
2344
|
-
samplesPerPixel,
|
|
2345
|
-
colorLUT,
|
|
2346
|
-
frequencyScaleFn,
|
|
2347
|
-
minFrequency = 0,
|
|
2348
|
-
maxFrequency,
|
|
2334
|
+
samplesPerPixel: _samplesPerPixel,
|
|
2349
2335
|
workerApi,
|
|
2350
2336
|
clipId,
|
|
2351
2337
|
onCanvasesReady
|
|
@@ -2356,21 +2342,15 @@ var SpectrogramChannel = ({
|
|
|
2356
2342
|
const transferredCanvasesRef = useRef6(/* @__PURE__ */ new WeakSet());
|
|
2357
2343
|
const workerApiRef = useRef6(workerApi);
|
|
2358
2344
|
const onCanvasesReadyRef = useRef6(onCanvasesReady);
|
|
2359
|
-
const isWorkerMode = !!(workerApi && clipId);
|
|
2360
2345
|
const clipOriginX = useClipViewportOrigin();
|
|
2361
2346
|
const visibleChunkIndices = useVisibleChunkIndices(length, MAX_CANVAS_WIDTH3, clipOriginX);
|
|
2362
|
-
|
|
2363
|
-
const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
|
|
2364
|
-
const scaleFn = frequencyScaleFn ?? LINEAR_FREQUENCY_SCALE;
|
|
2365
|
-
const hasCustomFrequencyScale = Boolean(frequencyScaleFn);
|
|
2366
|
-
useEffect8(() => {
|
|
2347
|
+
useEffect6(() => {
|
|
2367
2348
|
workerApiRef.current = workerApi;
|
|
2368
2349
|
}, [workerApi]);
|
|
2369
|
-
|
|
2350
|
+
useEffect6(() => {
|
|
2370
2351
|
onCanvasesReadyRef.current = onCanvasesReady;
|
|
2371
2352
|
}, [onCanvasesReady]);
|
|
2372
|
-
|
|
2373
|
-
if (!isWorkerMode) return;
|
|
2353
|
+
useEffect6(() => {
|
|
2374
2354
|
const currentWorkerApi = workerApiRef.current;
|
|
2375
2355
|
if (!currentWorkerApi || !clipId) return;
|
|
2376
2356
|
const previousCount = registeredIdsRef.current.length;
|
|
@@ -2431,8 +2411,8 @@ var SpectrogramChannel = ({
|
|
|
2431
2411
|
});
|
|
2432
2412
|
onCanvasesReadyRef.current?.(allIds, allWidths);
|
|
2433
2413
|
}
|
|
2434
|
-
}, [canvasMapRef,
|
|
2435
|
-
|
|
2414
|
+
}, [canvasMapRef, clipId, channelIndex, length, visibleChunkIndices]);
|
|
2415
|
+
useEffect6(() => {
|
|
2436
2416
|
return () => {
|
|
2437
2417
|
const api = workerApiRef.current;
|
|
2438
2418
|
if (!api) return;
|
|
@@ -2446,94 +2426,6 @@ var SpectrogramChannel = ({
|
|
|
2446
2426
|
registeredIdsRef.current = [];
|
|
2447
2427
|
};
|
|
2448
2428
|
}, []);
|
|
2449
|
-
useEffect8(() => {
|
|
2450
|
-
if (isWorkerMode || !data) return;
|
|
2451
|
-
const {
|
|
2452
|
-
frequencyBinCount,
|
|
2453
|
-
frameCount,
|
|
2454
|
-
hopSize,
|
|
2455
|
-
sampleRate,
|
|
2456
|
-
gainDb,
|
|
2457
|
-
rangeDb: rawRangeDb
|
|
2458
|
-
} = data;
|
|
2459
|
-
const rangeDb = rawRangeDb === 0 ? 1 : rawRangeDb;
|
|
2460
|
-
const binToFreq = (bin) => bin / frequencyBinCount * (sampleRate / 2);
|
|
2461
|
-
for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2462
|
-
const globalPixelOffset = canvasIdx * MAX_CANVAS_WIDTH3;
|
|
2463
|
-
const ctx = canvas.getContext("2d");
|
|
2464
|
-
if (!ctx) continue;
|
|
2465
|
-
const canvasWidth = canvas.width / devicePixelRatio;
|
|
2466
|
-
const canvasHeight = waveHeight;
|
|
2467
|
-
ctx.resetTransform();
|
|
2468
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
2469
|
-
ctx.imageSmoothingEnabled = false;
|
|
2470
|
-
ctx.scale(devicePixelRatio, devicePixelRatio);
|
|
2471
|
-
const imgData = ctx.createImageData(canvasWidth, canvasHeight);
|
|
2472
|
-
const pixels = imgData.data;
|
|
2473
|
-
for (let x = 0; x < canvasWidth; x++) {
|
|
2474
|
-
const globalX = globalPixelOffset + x;
|
|
2475
|
-
const samplePos = globalX * samplesPerPixel;
|
|
2476
|
-
const frame = Math.floor(samplePos / hopSize);
|
|
2477
|
-
if (frame < 0 || frame >= frameCount) continue;
|
|
2478
|
-
const frameOffset = frame * frequencyBinCount;
|
|
2479
|
-
for (let y = 0; y < canvasHeight; y++) {
|
|
2480
|
-
const normalizedY = 1 - y / canvasHeight;
|
|
2481
|
-
let bin = Math.floor(normalizedY * frequencyBinCount);
|
|
2482
|
-
if (hasCustomFrequencyScale) {
|
|
2483
|
-
let lo = 0;
|
|
2484
|
-
let hi = frequencyBinCount - 1;
|
|
2485
|
-
while (lo < hi) {
|
|
2486
|
-
const mid = lo + hi >> 1;
|
|
2487
|
-
const freq = binToFreq(mid);
|
|
2488
|
-
const scaled = scaleFn(freq, minFrequency, maxF);
|
|
2489
|
-
if (scaled < normalizedY) {
|
|
2490
|
-
lo = mid + 1;
|
|
2491
|
-
} else {
|
|
2492
|
-
hi = mid;
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
bin = lo;
|
|
2496
|
-
}
|
|
2497
|
-
if (bin < 0 || bin >= frequencyBinCount) continue;
|
|
2498
|
-
const db = data.data[frameOffset + bin];
|
|
2499
|
-
const normalized = Math.max(0, Math.min(1, (db + rangeDb + gainDb) / rangeDb));
|
|
2500
|
-
const colorIdx = Math.floor(normalized * 255);
|
|
2501
|
-
const pixelIdx = (y * canvasWidth + x) * 4;
|
|
2502
|
-
pixels[pixelIdx] = lut[colorIdx * 3];
|
|
2503
|
-
pixels[pixelIdx + 1] = lut[colorIdx * 3 + 1];
|
|
2504
|
-
pixels[pixelIdx + 2] = lut[colorIdx * 3 + 2];
|
|
2505
|
-
pixels[pixelIdx + 3] = 255;
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
ctx.resetTransform();
|
|
2509
|
-
ctx.putImageData(imgData, 0, 0);
|
|
2510
|
-
if (devicePixelRatio !== 1) {
|
|
2511
|
-
const tmpCanvas = document.createElement("canvas");
|
|
2512
|
-
tmpCanvas.width = canvasWidth;
|
|
2513
|
-
tmpCanvas.height = canvasHeight;
|
|
2514
|
-
const tmpCtx = tmpCanvas.getContext("2d");
|
|
2515
|
-
if (!tmpCtx) continue;
|
|
2516
|
-
tmpCtx.putImageData(imgData, 0, 0);
|
|
2517
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
2518
|
-
ctx.imageSmoothingEnabled = false;
|
|
2519
|
-
ctx.drawImage(tmpCanvas, 0, 0, canvas.width, canvas.height);
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
}, [
|
|
2523
|
-
canvasMapRef,
|
|
2524
|
-
isWorkerMode,
|
|
2525
|
-
data,
|
|
2526
|
-
length,
|
|
2527
|
-
waveHeight,
|
|
2528
|
-
devicePixelRatio,
|
|
2529
|
-
samplesPerPixel,
|
|
2530
|
-
lut,
|
|
2531
|
-
minFrequency,
|
|
2532
|
-
maxF,
|
|
2533
|
-
scaleFn,
|
|
2534
|
-
hasCustomFrequencyScale,
|
|
2535
|
-
visibleChunkIndices
|
|
2536
|
-
]);
|
|
2537
2429
|
const canvases = visibleChunkIndices.map((i) => {
|
|
2538
2430
|
const chunkLeft = i * MAX_CANVAS_WIDTH3;
|
|
2539
2431
|
const currentWidth = Math.min(length - chunkLeft, MAX_CANVAS_WIDTH3);
|
|
@@ -2560,12 +2452,7 @@ var SmartChannel = ({
|
|
|
2560
2452
|
isSelected,
|
|
2561
2453
|
transparentBackground,
|
|
2562
2454
|
renderMode = "waveform",
|
|
2563
|
-
spectrogramData,
|
|
2564
|
-
spectrogramColorLUT,
|
|
2565
2455
|
samplesPerPixel: sppProp,
|
|
2566
|
-
spectrogramFrequencyScaleFn,
|
|
2567
|
-
spectrogramMinFrequency,
|
|
2568
|
-
spectrogramMaxFrequency,
|
|
2569
2456
|
spectrogramWorkerApi,
|
|
2570
2457
|
spectrogramClipId,
|
|
2571
2458
|
spectrogramOnCanvasesReady,
|
|
@@ -2587,21 +2474,16 @@ var SmartChannel = ({
|
|
|
2587
2474
|
const waveOutlineColor = isSelected && theme ? theme.selectedWaveOutlineColor : theme?.waveOutlineColor;
|
|
2588
2475
|
const waveFillColor = isSelected && theme ? theme.selectedWaveFillColor : theme?.waveFillColor;
|
|
2589
2476
|
const drawMode = theme?.waveformDrawMode || "inverted";
|
|
2590
|
-
const hasSpectrogram =
|
|
2477
|
+
const hasSpectrogram = spectrogramWorkerApi && spectrogramClipId;
|
|
2591
2478
|
if (renderMode === "spectrogram" && hasSpectrogram) {
|
|
2592
2479
|
return /* @__PURE__ */ jsx24(
|
|
2593
2480
|
SpectrogramChannel,
|
|
2594
2481
|
{
|
|
2595
2482
|
index: props.index,
|
|
2596
|
-
data: spectrogramData,
|
|
2597
2483
|
length: props.length,
|
|
2598
2484
|
waveHeight,
|
|
2599
2485
|
devicePixelRatio,
|
|
2600
2486
|
samplesPerPixel,
|
|
2601
|
-
colorLUT: spectrogramColorLUT,
|
|
2602
|
-
frequencyScaleFn: spectrogramFrequencyScaleFn,
|
|
2603
|
-
minFrequency: spectrogramMinFrequency,
|
|
2604
|
-
maxFrequency: spectrogramMaxFrequency,
|
|
2605
2487
|
workerApi: spectrogramWorkerApi,
|
|
2606
2488
|
clipId: spectrogramClipId,
|
|
2607
2489
|
onCanvasesReady: spectrogramOnCanvasesReady
|
|
@@ -2616,15 +2498,10 @@ var SmartChannel = ({
|
|
|
2616
2498
|
{
|
|
2617
2499
|
index: props.index * 2,
|
|
2618
2500
|
channelIndex: props.index,
|
|
2619
|
-
data: spectrogramData,
|
|
2620
2501
|
length: props.length,
|
|
2621
2502
|
waveHeight: halfHeight,
|
|
2622
2503
|
devicePixelRatio,
|
|
2623
2504
|
samplesPerPixel,
|
|
2624
|
-
colorLUT: spectrogramColorLUT,
|
|
2625
|
-
frequencyScaleFn: spectrogramFrequencyScaleFn,
|
|
2626
|
-
minFrequency: spectrogramMinFrequency,
|
|
2627
|
-
maxFrequency: spectrogramMaxFrequency,
|
|
2628
2505
|
workerApi: spectrogramWorkerApi,
|
|
2629
2506
|
clipId: spectrogramClipId,
|
|
2630
2507
|
onCanvasesReady: spectrogramOnCanvasesReady
|
|
@@ -2695,7 +2572,7 @@ var SmartChannel = ({
|
|
|
2695
2572
|
};
|
|
2696
2573
|
|
|
2697
2574
|
// src/components/SpectrogramLabels.tsx
|
|
2698
|
-
import { useRef as useRef7, useLayoutEffect as
|
|
2575
|
+
import { useRef as useRef7, useLayoutEffect as useLayoutEffect4 } from "react";
|
|
2699
2576
|
import styled21 from "styled-components";
|
|
2700
2577
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2701
2578
|
var LABELS_WIDTH = 72;
|
|
@@ -2752,7 +2629,7 @@ var SpectrogramLabels = ({
|
|
|
2752
2629
|
const spectrogramHeight = renderMode === "both" ? Math.floor(waveHeight / 2) : waveHeight;
|
|
2753
2630
|
const totalHeight = numChannels * waveHeight;
|
|
2754
2631
|
const clipHeaderOffset = hasClipHeaders ? 22 : 0;
|
|
2755
|
-
|
|
2632
|
+
useLayoutEffect4(() => {
|
|
2756
2633
|
const canvas = canvasRef.current;
|
|
2757
2634
|
if (!canvas) return;
|
|
2758
2635
|
const ctx = canvas.getContext("2d");
|
|
@@ -2810,7 +2687,7 @@ import React19, { useContext as useContext10, useMemo as useMemo4 } from "react"
|
|
|
2810
2687
|
import styled23 from "styled-components";
|
|
2811
2688
|
|
|
2812
2689
|
// src/components/TimeScale.tsx
|
|
2813
|
-
import { useLayoutEffect as
|
|
2690
|
+
import { useLayoutEffect as useLayoutEffect5, useContext as useContext9 } from "react";
|
|
2814
2691
|
import styled22, { withTheme as withTheme2 } from "styled-components";
|
|
2815
2692
|
import { MAX_CANVAS_WIDTH as MAX_CANVAS_WIDTH4 } from "@waveform-playlist/core";
|
|
2816
2693
|
import { jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
@@ -2865,7 +2742,7 @@ var TimeScale = (props) => {
|
|
|
2865
2742
|
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] * MAX_CANVAS_WIDTH4 : 0;
|
|
2866
2743
|
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) * MAX_CANVAS_WIDTH4 : Infinity;
|
|
2867
2744
|
const visibleMarkers = visibleChunkIndices.length > 0 ? timeMarkersWithPositions.filter(({ pix }) => pix >= firstChunkLeft && pix < lastChunkRight).map(({ element }) => element) : timeMarkersWithPositions.map(({ element }) => element);
|
|
2868
|
-
|
|
2745
|
+
useLayoutEffect5(() => {
|
|
2869
2746
|
for (const [chunkIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2870
2747
|
const ctx = canvas.getContext("2d");
|
|
2871
2748
|
if (!ctx) continue;
|
|
@@ -3358,7 +3235,7 @@ var SliderWrapper = styled32.label`
|
|
|
3358
3235
|
`;
|
|
3359
3236
|
|
|
3360
3237
|
// src/components/TrackMenu.tsx
|
|
3361
|
-
import React20, { useState as useState6, useEffect as
|
|
3238
|
+
import React20, { useState as useState6, useEffect as useEffect7, useRef as useRef8, useCallback as useCallback5 } from "react";
|
|
3362
3239
|
import { createPortal } from "react-dom";
|
|
3363
3240
|
import styled33 from "styled-components";
|
|
3364
3241
|
import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -3424,7 +3301,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3424
3301
|
}
|
|
3425
3302
|
setDropdownPos({ top, left });
|
|
3426
3303
|
}, []);
|
|
3427
|
-
|
|
3304
|
+
useEffect7(() => {
|
|
3428
3305
|
if (!open) return;
|
|
3429
3306
|
updatePosition();
|
|
3430
3307
|
const rafId = requestAnimationFrame(() => updatePosition());
|
|
@@ -3438,7 +3315,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3438
3315
|
window.removeEventListener("resize", onResize);
|
|
3439
3316
|
};
|
|
3440
3317
|
}, [open, updatePosition]);
|
|
3441
|
-
|
|
3318
|
+
useEffect7(() => {
|
|
3442
3319
|
if (!open) return;
|
|
3443
3320
|
const handleClick = (e) => {
|
|
3444
3321
|
const target = e.target;
|