@waveform-playlist/ui-components 8.0.0 → 9.0.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.d.mts +39 -40
- package/dist/index.d.ts +39 -40
- package/dist/index.js +135 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -17
package/dist/index.js
CHANGED
|
@@ -949,8 +949,7 @@ var PlaylistErrorBoundary = class extends import_react5.default.Component {
|
|
|
949
949
|
|
|
950
950
|
// src/components/Clip.tsx
|
|
951
951
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
952
|
-
var
|
|
953
|
-
var import_utilities = require("@dnd-kit/utilities");
|
|
952
|
+
var import_react7 = require("@dnd-kit/react");
|
|
954
953
|
|
|
955
954
|
// src/components/ClipHeader.tsx
|
|
956
955
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
@@ -964,7 +963,7 @@ var HeaderContainer = import_styled_components10.default.div`
|
|
|
964
963
|
display: flex;
|
|
965
964
|
align-items: center;
|
|
966
965
|
padding: 0 8px;
|
|
967
|
-
cursor: ${(props) => props.$interactive ?
|
|
966
|
+
cursor: ${(props) => props.$interactive ? "grab" : "default"};
|
|
968
967
|
user-select: none;
|
|
969
968
|
z-index: 110;
|
|
970
969
|
flex-shrink: 0;
|
|
@@ -994,7 +993,7 @@ var ClipHeaderPresentational = ({
|
|
|
994
993
|
trackName,
|
|
995
994
|
isSelected = false
|
|
996
995
|
}) => {
|
|
997
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderContainer, { $
|
|
996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderContainer, { $interactive: false, $isSelected: isSelected, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TrackName, { children: trackName }) });
|
|
998
997
|
};
|
|
999
998
|
var ClipHeader = ({
|
|
1000
999
|
clipId,
|
|
@@ -1008,16 +1007,14 @@ var ClipHeader = ({
|
|
|
1008
1007
|
if (disableDrag || !dragHandleProps) {
|
|
1009
1008
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ClipHeaderPresentational, { trackName, isSelected });
|
|
1010
1009
|
}
|
|
1011
|
-
const {
|
|
1010
|
+
const { handleRef } = dragHandleProps;
|
|
1012
1011
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1013
1012
|
HeaderContainer,
|
|
1014
1013
|
{
|
|
1015
|
-
ref:
|
|
1014
|
+
ref: handleRef,
|
|
1016
1015
|
"data-clip-id": clipId,
|
|
1017
1016
|
$interactive: true,
|
|
1018
1017
|
$isSelected: isSelected,
|
|
1019
|
-
...listeners,
|
|
1020
|
-
...attributes,
|
|
1021
1018
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TrackName, { children: trackName })
|
|
1022
1019
|
}
|
|
1023
1020
|
);
|
|
@@ -1070,11 +1067,11 @@ var ClipBoundary = ({
|
|
|
1070
1067
|
if (!dragHandleProps) {
|
|
1071
1068
|
return null;
|
|
1072
1069
|
}
|
|
1073
|
-
const {
|
|
1070
|
+
const { ref: boundaryRef, isDragging } = dragHandleProps;
|
|
1074
1071
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1075
1072
|
BoundaryContainer,
|
|
1076
1073
|
{
|
|
1077
|
-
ref:
|
|
1074
|
+
ref: boundaryRef,
|
|
1078
1075
|
"data-clip-id": clipId,
|
|
1079
1076
|
"data-boundary-edge": edge,
|
|
1080
1077
|
$edge: edge,
|
|
@@ -1082,9 +1079,7 @@ var ClipBoundary = ({
|
|
|
1082
1079
|
$isHovered: isHovered,
|
|
1083
1080
|
$touchOptimized: touchOptimized,
|
|
1084
1081
|
onMouseEnter: () => setIsHovered(true),
|
|
1085
|
-
onMouseLeave: () => setIsHovered(false)
|
|
1086
|
-
...listeners,
|
|
1087
|
-
...attributes
|
|
1082
|
+
onMouseLeave: () => setIsHovered(false)
|
|
1088
1083
|
}
|
|
1089
1084
|
);
|
|
1090
1085
|
};
|
|
@@ -1205,42 +1200,34 @@ var Clip = ({
|
|
|
1205
1200
|
const width = endPixel - left;
|
|
1206
1201
|
const enableDrag = showHeader && !disableHeaderDrag && !isOverlay;
|
|
1207
1202
|
const draggableId = `clip-${trackIndex}-${clipIndex}`;
|
|
1208
|
-
const {
|
|
1203
|
+
const {
|
|
1204
|
+
ref: clipRef,
|
|
1205
|
+
handleRef,
|
|
1206
|
+
isDragSource
|
|
1207
|
+
} = (0, import_react7.useDraggable)({
|
|
1209
1208
|
id: draggableId,
|
|
1210
1209
|
data: { clipId, trackIndex, clipIndex },
|
|
1211
1210
|
disabled: !enableDrag
|
|
1212
1211
|
});
|
|
1213
1212
|
const leftBoundaryId = `clip-boundary-left-${trackIndex}-${clipIndex}`;
|
|
1214
|
-
const {
|
|
1215
|
-
attributes: leftBoundaryAttributes,
|
|
1216
|
-
listeners: leftBoundaryListeners,
|
|
1217
|
-
setActivatorNodeRef: setLeftBoundaryActivatorRef,
|
|
1218
|
-
isDragging: isLeftBoundaryDragging
|
|
1219
|
-
} = (0, import_core2.useDraggable)({
|
|
1213
|
+
const { ref: leftBoundaryRef, isDragSource: isLeftBoundaryDragging } = (0, import_react7.useDraggable)({
|
|
1220
1214
|
id: leftBoundaryId,
|
|
1221
1215
|
data: { clipId, trackIndex, clipIndex, boundary: "left" },
|
|
1222
|
-
disabled: !enableDrag
|
|
1216
|
+
disabled: !enableDrag,
|
|
1217
|
+
feedback: "none"
|
|
1223
1218
|
});
|
|
1224
1219
|
const rightBoundaryId = `clip-boundary-right-${trackIndex}-${clipIndex}`;
|
|
1225
|
-
const {
|
|
1226
|
-
attributes: rightBoundaryAttributes,
|
|
1227
|
-
listeners: rightBoundaryListeners,
|
|
1228
|
-
setActivatorNodeRef: setRightBoundaryActivatorRef,
|
|
1229
|
-
isDragging: isRightBoundaryDragging
|
|
1230
|
-
} = (0, import_core2.useDraggable)({
|
|
1220
|
+
const { ref: rightBoundaryRef, isDragSource: isRightBoundaryDragging } = (0, import_react7.useDraggable)({
|
|
1231
1221
|
id: rightBoundaryId,
|
|
1232
1222
|
data: { clipId, trackIndex, clipIndex, boundary: "right" },
|
|
1233
|
-
disabled: !enableDrag
|
|
1223
|
+
disabled: !enableDrag,
|
|
1224
|
+
feedback: "none"
|
|
1234
1225
|
});
|
|
1235
|
-
const style =
|
|
1236
|
-
transform: import_utilities.CSS.Translate.toString(transform),
|
|
1237
|
-
zIndex: isDragging ? 100 : void 0
|
|
1238
|
-
// Below controls (z-index: 999) but above other clips
|
|
1239
|
-
} : void 0;
|
|
1226
|
+
const style = isDragSource ? { zIndex: 100 } : void 0;
|
|
1240
1227
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1241
1228
|
ClipContainer,
|
|
1242
1229
|
{
|
|
1243
|
-
ref:
|
|
1230
|
+
ref: clipRef,
|
|
1244
1231
|
style,
|
|
1245
1232
|
className,
|
|
1246
1233
|
$left: left,
|
|
@@ -1259,7 +1246,7 @@ var Clip = ({
|
|
|
1259
1246
|
trackName,
|
|
1260
1247
|
isSelected,
|
|
1261
1248
|
disableDrag: disableHeaderDrag,
|
|
1262
|
-
dragHandleProps: enableDrag ? {
|
|
1249
|
+
dragHandleProps: enableDrag ? { handleRef } : void 0
|
|
1263
1250
|
}
|
|
1264
1251
|
),
|
|
1265
1252
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ClipViewportOriginProvider, { originX: left, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(ChannelsWrapper, { $isOverlay: isOverlay, children: [
|
|
@@ -1293,9 +1280,7 @@ var Clip = ({
|
|
|
1293
1280
|
edge: "left",
|
|
1294
1281
|
touchOptimized,
|
|
1295
1282
|
dragHandleProps: {
|
|
1296
|
-
|
|
1297
|
-
listeners: leftBoundaryListeners,
|
|
1298
|
-
setActivatorNodeRef: setLeftBoundaryActivatorRef,
|
|
1283
|
+
ref: leftBoundaryRef,
|
|
1299
1284
|
isDragging: isLeftBoundaryDragging
|
|
1300
1285
|
}
|
|
1301
1286
|
}
|
|
@@ -1309,9 +1294,7 @@ var Clip = ({
|
|
|
1309
1294
|
edge: "right",
|
|
1310
1295
|
touchOptimized,
|
|
1311
1296
|
dragHandleProps: {
|
|
1312
|
-
|
|
1313
|
-
listeners: rightBoundaryListeners,
|
|
1314
|
-
setActivatorNodeRef: setRightBoundaryActivatorRef,
|
|
1297
|
+
ref: rightBoundaryRef,
|
|
1315
1298
|
isDragging: isRightBoundaryDragging
|
|
1316
1299
|
}
|
|
1317
1300
|
}
|
|
@@ -1363,7 +1346,7 @@ var MasterVolumeControl = ({
|
|
|
1363
1346
|
};
|
|
1364
1347
|
|
|
1365
1348
|
// src/components/Playhead.tsx
|
|
1366
|
-
var
|
|
1349
|
+
var import_react8 = require("react");
|
|
1367
1350
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1368
1351
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1369
1352
|
var PlayheadLine = import_styled_components15.default.div.attrs((props) => ({
|
|
@@ -1420,17 +1403,24 @@ var PlayheadWithMarker = ({
|
|
|
1420
1403
|
samplesPerPixel,
|
|
1421
1404
|
sampleRate,
|
|
1422
1405
|
controlsOffset,
|
|
1423
|
-
getAudioContextTime
|
|
1406
|
+
getAudioContextTime,
|
|
1407
|
+
getPlaybackTime
|
|
1424
1408
|
}) => {
|
|
1425
|
-
const containerRef = (0,
|
|
1426
|
-
const animationFrameRef = (0,
|
|
1427
|
-
(0,
|
|
1409
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
1410
|
+
const animationFrameRef = (0, import_react8.useRef)(null);
|
|
1411
|
+
(0, import_react8.useEffect)(() => {
|
|
1428
1412
|
const updatePosition = () => {
|
|
1429
1413
|
if (containerRef.current) {
|
|
1430
1414
|
let time;
|
|
1431
|
-
if (isPlaying
|
|
1432
|
-
|
|
1433
|
-
|
|
1415
|
+
if (isPlaying) {
|
|
1416
|
+
if (getPlaybackTime) {
|
|
1417
|
+
time = getPlaybackTime();
|
|
1418
|
+
} else if (getAudioContextTime) {
|
|
1419
|
+
const elapsed = getAudioContextTime() - (playbackStartTimeRef.current ?? 0);
|
|
1420
|
+
time = (audioStartPositionRef.current ?? 0) + elapsed;
|
|
1421
|
+
} else {
|
|
1422
|
+
time = currentTimeRef.current ?? 0;
|
|
1423
|
+
}
|
|
1434
1424
|
} else {
|
|
1435
1425
|
time = currentTimeRef.current ?? 0;
|
|
1436
1426
|
}
|
|
@@ -1460,9 +1450,10 @@ var PlayheadWithMarker = ({
|
|
|
1460
1450
|
currentTimeRef,
|
|
1461
1451
|
playbackStartTimeRef,
|
|
1462
1452
|
audioStartPositionRef,
|
|
1463
|
-
getAudioContextTime
|
|
1453
|
+
getAudioContextTime,
|
|
1454
|
+
getPlaybackTime
|
|
1464
1455
|
]);
|
|
1465
|
-
(0,
|
|
1456
|
+
(0, import_react8.useEffect)(() => {
|
|
1466
1457
|
if (!isPlaying && containerRef.current) {
|
|
1467
1458
|
const time = currentTimeRef.current ?? 0;
|
|
1468
1459
|
const pos = time * sampleRate / samplesPerPixel + controlsOffset;
|
|
@@ -1477,7 +1468,7 @@ var PlayheadWithMarker = ({
|
|
|
1477
1468
|
|
|
1478
1469
|
// src/components/Playlist.tsx
|
|
1479
1470
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
1480
|
-
var
|
|
1471
|
+
var import_react9 = require("react");
|
|
1481
1472
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1482
1473
|
var Wrapper2 = import_styled_components16.default.div`
|
|
1483
1474
|
overflow-y: hidden;
|
|
@@ -1532,8 +1523,8 @@ var Playlist = ({
|
|
|
1532
1523
|
isSelecting,
|
|
1533
1524
|
"data-playlist-state": playlistState
|
|
1534
1525
|
}) => {
|
|
1535
|
-
const wrapperRef = (0,
|
|
1536
|
-
const handleRef = (0,
|
|
1526
|
+
const wrapperRef = (0, import_react9.useRef)(null);
|
|
1527
|
+
const handleRef = (0, import_react9.useCallback)(
|
|
1537
1528
|
(el) => {
|
|
1538
1529
|
wrapperRef.current = el;
|
|
1539
1530
|
scrollContainerRef?.(el);
|
|
@@ -1590,7 +1581,7 @@ var Selection = ({
|
|
|
1590
1581
|
};
|
|
1591
1582
|
|
|
1592
1583
|
// src/components/LoopRegion.tsx
|
|
1593
|
-
var
|
|
1584
|
+
var import_react10 = require("react");
|
|
1594
1585
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
1595
1586
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1596
1587
|
var LoopRegionOverlayDiv = import_styled_components18.default.div.attrs((props) => ({
|
|
@@ -1741,12 +1732,12 @@ var LoopRegionMarkers = ({
|
|
|
1741
1732
|
minPosition = 0,
|
|
1742
1733
|
maxPosition = Infinity
|
|
1743
1734
|
}) => {
|
|
1744
|
-
const [draggingMarker, setDraggingMarker] = (0,
|
|
1745
|
-
const dragStartX = (0,
|
|
1746
|
-
const dragStartPosition = (0,
|
|
1747
|
-
const dragStartEnd = (0,
|
|
1735
|
+
const [draggingMarker, setDraggingMarker] = (0, import_react10.useState)(null);
|
|
1736
|
+
const dragStartX = (0, import_react10.useRef)(0);
|
|
1737
|
+
const dragStartPosition = (0, import_react10.useRef)(0);
|
|
1738
|
+
const dragStartEnd = (0, import_react10.useRef)(0);
|
|
1748
1739
|
const width = Math.max(0, endPosition - startPosition);
|
|
1749
|
-
const handleMarkerMouseDown = (0,
|
|
1740
|
+
const handleMarkerMouseDown = (0, import_react10.useCallback)(
|
|
1750
1741
|
(e, marker) => {
|
|
1751
1742
|
e.preventDefault();
|
|
1752
1743
|
e.stopPropagation();
|
|
@@ -1774,7 +1765,7 @@ var LoopRegionMarkers = ({
|
|
|
1774
1765
|
},
|
|
1775
1766
|
[startPosition, endPosition, minPosition, maxPosition, onLoopStartChange, onLoopEndChange]
|
|
1776
1767
|
);
|
|
1777
|
-
const handleRegionMouseDown = (0,
|
|
1768
|
+
const handleRegionMouseDown = (0, import_react10.useCallback)(
|
|
1778
1769
|
(e) => {
|
|
1779
1770
|
e.preventDefault();
|
|
1780
1771
|
e.stopPropagation();
|
|
@@ -1868,11 +1859,11 @@ var TimescaleLoopRegion = ({
|
|
|
1868
1859
|
maxPosition = Infinity,
|
|
1869
1860
|
controlsOffset = 0
|
|
1870
1861
|
}) => {
|
|
1871
|
-
const [, setIsCreating] = (0,
|
|
1872
|
-
const createStartX = (0,
|
|
1873
|
-
const containerRef = (0,
|
|
1862
|
+
const [, setIsCreating] = (0, import_react10.useState)(false);
|
|
1863
|
+
const createStartX = (0, import_react10.useRef)(0);
|
|
1864
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
1874
1865
|
const hasLoopRegion = endPosition > startPosition;
|
|
1875
|
-
const handleBackgroundMouseDown = (0,
|
|
1866
|
+
const handleBackgroundMouseDown = (0, import_react10.useCallback)(
|
|
1876
1867
|
(e) => {
|
|
1877
1868
|
const target = e.target;
|
|
1878
1869
|
if (target.closest("[data-loop-marker-handle]") || target.closest("[data-loop-region-timescale]")) {
|
|
@@ -1929,10 +1920,10 @@ var TimescaleLoopRegion = ({
|
|
|
1929
1920
|
};
|
|
1930
1921
|
|
|
1931
1922
|
// src/components/SelectionTimeInputs.tsx
|
|
1932
|
-
var
|
|
1923
|
+
var import_react12 = require("react");
|
|
1933
1924
|
|
|
1934
1925
|
// src/components/TimeInput.tsx
|
|
1935
|
-
var
|
|
1926
|
+
var import_react11 = require("react");
|
|
1936
1927
|
|
|
1937
1928
|
// src/utils/timeFormat.ts
|
|
1938
1929
|
function clockFormat(seconds, decimals) {
|
|
@@ -1992,8 +1983,8 @@ var TimeInput = ({
|
|
|
1992
1983
|
onChange,
|
|
1993
1984
|
readOnly = false
|
|
1994
1985
|
}) => {
|
|
1995
|
-
const [displayValue, setDisplayValue] = (0,
|
|
1996
|
-
(0,
|
|
1986
|
+
const [displayValue, setDisplayValue] = (0, import_react11.useState)("");
|
|
1987
|
+
(0, import_react11.useEffect)(() => {
|
|
1997
1988
|
const formatted = formatTime(value, format);
|
|
1998
1989
|
setDisplayValue(formatted);
|
|
1999
1990
|
}, [value, format, id]);
|
|
@@ -2039,8 +2030,8 @@ var SelectionTimeInputs = ({
|
|
|
2039
2030
|
onSelectionChange,
|
|
2040
2031
|
className
|
|
2041
2032
|
}) => {
|
|
2042
|
-
const [timeFormat, setTimeFormat] = (0,
|
|
2043
|
-
(0,
|
|
2033
|
+
const [timeFormat, setTimeFormat] = (0, import_react12.useState)("hh:mm:ss.uuu");
|
|
2034
|
+
(0, import_react12.useEffect)(() => {
|
|
2044
2035
|
const timeFormatSelect = document.querySelector(".time-format");
|
|
2045
2036
|
const handleFormatChange = () => {
|
|
2046
2037
|
if (timeFormatSelect) {
|
|
@@ -2092,14 +2083,14 @@ var SelectionTimeInputs = ({
|
|
|
2092
2083
|
};
|
|
2093
2084
|
|
|
2094
2085
|
// src/contexts/DevicePixelRatio.tsx
|
|
2095
|
-
var
|
|
2086
|
+
var import_react13 = require("react");
|
|
2096
2087
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2097
2088
|
function getScale() {
|
|
2098
2089
|
return window.devicePixelRatio;
|
|
2099
2090
|
}
|
|
2100
|
-
var DevicePixelRatioContext = (0,
|
|
2091
|
+
var DevicePixelRatioContext = (0, import_react13.createContext)(getScale());
|
|
2101
2092
|
var DevicePixelRatioProvider = ({ children }) => {
|
|
2102
|
-
const [scale, setScale] = (0,
|
|
2093
|
+
const [scale, setScale] = (0, import_react13.useState)(getScale());
|
|
2103
2094
|
matchMedia(`(resolution: ${getScale()}dppx)`).addEventListener(
|
|
2104
2095
|
"change",
|
|
2105
2096
|
() => {
|
|
@@ -2109,11 +2100,11 @@ var DevicePixelRatioProvider = ({ children }) => {
|
|
|
2109
2100
|
);
|
|
2110
2101
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DevicePixelRatioContext.Provider, { value: Math.ceil(scale), children });
|
|
2111
2102
|
};
|
|
2112
|
-
var useDevicePixelRatio = () => (0,
|
|
2103
|
+
var useDevicePixelRatio = () => (0, import_react13.useContext)(DevicePixelRatioContext);
|
|
2113
2104
|
|
|
2114
2105
|
// src/contexts/PlaylistInfo.tsx
|
|
2115
|
-
var
|
|
2116
|
-
var PlaylistInfoContext = (0,
|
|
2106
|
+
var import_react14 = require("react");
|
|
2107
|
+
var PlaylistInfoContext = (0, import_react14.createContext)({
|
|
2117
2108
|
sampleRate: 48e3,
|
|
2118
2109
|
samplesPerPixel: 1e3,
|
|
2119
2110
|
zoomLevels: [1e3, 1500, 2e3, 2500],
|
|
@@ -2127,21 +2118,21 @@ var PlaylistInfoContext = (0, import_react13.createContext)({
|
|
|
2127
2118
|
barWidth: 1,
|
|
2128
2119
|
barGap: 0
|
|
2129
2120
|
});
|
|
2130
|
-
var usePlaylistInfo = () => (0,
|
|
2121
|
+
var usePlaylistInfo = () => (0, import_react14.useContext)(PlaylistInfoContext);
|
|
2131
2122
|
|
|
2132
2123
|
// src/contexts/Theme.tsx
|
|
2133
|
-
var
|
|
2124
|
+
var import_react15 = require("react");
|
|
2134
2125
|
var import_styled_components19 = require("styled-components");
|
|
2135
|
-
var useTheme2 = () => (0,
|
|
2126
|
+
var useTheme2 = () => (0, import_react15.useContext)(import_styled_components19.ThemeContext);
|
|
2136
2127
|
|
|
2137
2128
|
// src/contexts/TrackControls.tsx
|
|
2138
|
-
var
|
|
2129
|
+
var import_react16 = require("react");
|
|
2139
2130
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2140
|
-
var TrackControlsContext = (0,
|
|
2141
|
-
var useTrackControls = () => (0,
|
|
2131
|
+
var TrackControlsContext = (0, import_react16.createContext)(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react16.Fragment, {}));
|
|
2132
|
+
var useTrackControls = () => (0, import_react16.useContext)(TrackControlsContext);
|
|
2142
2133
|
|
|
2143
2134
|
// src/contexts/Playout.tsx
|
|
2144
|
-
var
|
|
2135
|
+
var import_react17 = require("react");
|
|
2145
2136
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2146
2137
|
var defaultProgress = 0;
|
|
2147
2138
|
var defaultIsPlaying = false;
|
|
@@ -2153,8 +2144,8 @@ var defaultPlayout = {
|
|
|
2153
2144
|
selectionStart: defaultSelectionStart,
|
|
2154
2145
|
selectionEnd: defaultSelectionEnd
|
|
2155
2146
|
};
|
|
2156
|
-
var PlayoutStatusContext = (0,
|
|
2157
|
-
var PlayoutStatusUpdateContext = (0,
|
|
2147
|
+
var PlayoutStatusContext = (0, import_react17.createContext)(defaultPlayout);
|
|
2148
|
+
var PlayoutStatusUpdateContext = (0, import_react17.createContext)({
|
|
2158
2149
|
setIsPlaying: () => {
|
|
2159
2150
|
},
|
|
2160
2151
|
setProgress: () => {
|
|
@@ -2163,23 +2154,23 @@ var PlayoutStatusUpdateContext = (0, import_react16.createContext)({
|
|
|
2163
2154
|
}
|
|
2164
2155
|
});
|
|
2165
2156
|
var PlayoutProvider = ({ children }) => {
|
|
2166
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
2167
|
-
const [progress, setProgress] = (0,
|
|
2168
|
-
const [selectionStart, setSelectionStart] = (0,
|
|
2169
|
-
const [selectionEnd, setSelectionEnd] = (0,
|
|
2157
|
+
const [isPlaying, setIsPlaying] = (0, import_react17.useState)(defaultIsPlaying);
|
|
2158
|
+
const [progress, setProgress] = (0, import_react17.useState)(defaultProgress);
|
|
2159
|
+
const [selectionStart, setSelectionStart] = (0, import_react17.useState)(defaultSelectionStart);
|
|
2160
|
+
const [selectionEnd, setSelectionEnd] = (0, import_react17.useState)(defaultSelectionEnd);
|
|
2170
2161
|
const setSelection = (start, end) => {
|
|
2171
2162
|
setSelectionStart(start);
|
|
2172
2163
|
setSelectionEnd(end);
|
|
2173
2164
|
};
|
|
2174
2165
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PlayoutStatusUpdateContext.Provider, { value: { setIsPlaying, setProgress, setSelection }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PlayoutStatusContext.Provider, { value: { isPlaying, progress, selectionStart, selectionEnd }, children }) });
|
|
2175
2166
|
};
|
|
2176
|
-
var usePlayoutStatus = () => (0,
|
|
2177
|
-
var usePlayoutStatusUpdate = () => (0,
|
|
2167
|
+
var usePlayoutStatus = () => (0, import_react17.useContext)(PlayoutStatusContext);
|
|
2168
|
+
var usePlayoutStatusUpdate = () => (0, import_react17.useContext)(PlayoutStatusUpdateContext);
|
|
2178
2169
|
|
|
2179
2170
|
// src/components/SpectrogramChannel.tsx
|
|
2180
|
-
var
|
|
2171
|
+
var import_react18 = require("react");
|
|
2181
2172
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2182
|
-
var
|
|
2173
|
+
var import_core2 = require("@waveform-playlist/core");
|
|
2183
2174
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2184
2175
|
var LINEAR_FREQUENCY_SCALE = (f, minF, maxF) => (f - minF) / (maxF - minF);
|
|
2185
2176
|
var Wrapper3 = import_styled_components20.default.div.attrs((props) => ({
|
|
@@ -2234,24 +2225,24 @@ var SpectrogramChannel = ({
|
|
|
2234
2225
|
}) => {
|
|
2235
2226
|
const channelIndex = channelIndexProp ?? index;
|
|
2236
2227
|
const { canvasRef, canvasMapRef } = useChunkedCanvasRefs();
|
|
2237
|
-
const registeredIdsRef = (0,
|
|
2238
|
-
const transferredCanvasesRef = (0,
|
|
2239
|
-
const workerApiRef = (0,
|
|
2240
|
-
const onCanvasesReadyRef = (0,
|
|
2228
|
+
const registeredIdsRef = (0, import_react18.useRef)([]);
|
|
2229
|
+
const transferredCanvasesRef = (0, import_react18.useRef)(/* @__PURE__ */ new WeakSet());
|
|
2230
|
+
const workerApiRef = (0, import_react18.useRef)(workerApi);
|
|
2231
|
+
const onCanvasesReadyRef = (0, import_react18.useRef)(onCanvasesReady);
|
|
2241
2232
|
const isWorkerMode = !!(workerApi && clipId);
|
|
2242
2233
|
const clipOriginX = useClipViewportOrigin();
|
|
2243
|
-
const visibleChunkIndices = useVisibleChunkIndices(length,
|
|
2234
|
+
const visibleChunkIndices = useVisibleChunkIndices(length, import_core2.MAX_CANVAS_WIDTH, clipOriginX);
|
|
2244
2235
|
const lut = colorLUT ?? DEFAULT_COLOR_LUT;
|
|
2245
2236
|
const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
|
|
2246
2237
|
const scaleFn = frequencyScaleFn ?? LINEAR_FREQUENCY_SCALE;
|
|
2247
2238
|
const hasCustomFrequencyScale = Boolean(frequencyScaleFn);
|
|
2248
|
-
(0,
|
|
2239
|
+
(0, import_react18.useEffect)(() => {
|
|
2249
2240
|
workerApiRef.current = workerApi;
|
|
2250
2241
|
}, [workerApi]);
|
|
2251
|
-
(0,
|
|
2242
|
+
(0, import_react18.useEffect)(() => {
|
|
2252
2243
|
onCanvasesReadyRef.current = onCanvasesReady;
|
|
2253
2244
|
}, [onCanvasesReady]);
|
|
2254
|
-
(0,
|
|
2245
|
+
(0, import_react18.useEffect)(() => {
|
|
2255
2246
|
if (!isWorkerMode) return;
|
|
2256
2247
|
const currentWorkerApi = workerApiRef.current;
|
|
2257
2248
|
if (!currentWorkerApi || !clipId) return;
|
|
@@ -2306,15 +2297,15 @@ var SpectrogramChannel = ({
|
|
|
2306
2297
|
const match = id.match(/chunk(\d+)$/);
|
|
2307
2298
|
if (!match) {
|
|
2308
2299
|
console.warn(`[spectrogram] Unexpected canvas ID format: ${id}`);
|
|
2309
|
-
return
|
|
2300
|
+
return import_core2.MAX_CANVAS_WIDTH;
|
|
2310
2301
|
}
|
|
2311
2302
|
const chunkIdx = parseInt(match[1], 10);
|
|
2312
|
-
return Math.min(length - chunkIdx *
|
|
2303
|
+
return Math.min(length - chunkIdx * import_core2.MAX_CANVAS_WIDTH, import_core2.MAX_CANVAS_WIDTH);
|
|
2313
2304
|
});
|
|
2314
2305
|
onCanvasesReadyRef.current?.(allIds, allWidths);
|
|
2315
2306
|
}
|
|
2316
2307
|
}, [canvasMapRef, isWorkerMode, clipId, channelIndex, length, visibleChunkIndices]);
|
|
2317
|
-
(0,
|
|
2308
|
+
(0, import_react18.useEffect)(() => {
|
|
2318
2309
|
return () => {
|
|
2319
2310
|
const api = workerApiRef.current;
|
|
2320
2311
|
if (!api) return;
|
|
@@ -2328,7 +2319,7 @@ var SpectrogramChannel = ({
|
|
|
2328
2319
|
registeredIdsRef.current = [];
|
|
2329
2320
|
};
|
|
2330
2321
|
}, []);
|
|
2331
|
-
(0,
|
|
2322
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
2332
2323
|
if (isWorkerMode || !data) return;
|
|
2333
2324
|
const {
|
|
2334
2325
|
frequencyBinCount,
|
|
@@ -2341,7 +2332,7 @@ var SpectrogramChannel = ({
|
|
|
2341
2332
|
const rangeDb = rawRangeDb === 0 ? 1 : rawRangeDb;
|
|
2342
2333
|
const binToFreq = (bin) => bin / frequencyBinCount * (sampleRate / 2);
|
|
2343
2334
|
for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2344
|
-
const globalPixelOffset = canvasIdx *
|
|
2335
|
+
const globalPixelOffset = canvasIdx * import_core2.MAX_CANVAS_WIDTH;
|
|
2345
2336
|
const ctx = canvas.getContext("2d");
|
|
2346
2337
|
if (!ctx) continue;
|
|
2347
2338
|
const canvasWidth = canvas.width / devicePixelRatio;
|
|
@@ -2417,8 +2408,8 @@ var SpectrogramChannel = ({
|
|
|
2417
2408
|
visibleChunkIndices
|
|
2418
2409
|
]);
|
|
2419
2410
|
const canvases = visibleChunkIndices.map((i) => {
|
|
2420
|
-
const chunkLeft = i *
|
|
2421
|
-
const currentWidth = Math.min(length - chunkLeft,
|
|
2411
|
+
const chunkLeft = i * import_core2.MAX_CANVAS_WIDTH;
|
|
2412
|
+
const currentWidth = Math.min(length - chunkLeft, import_core2.MAX_CANVAS_WIDTH);
|
|
2422
2413
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2423
2414
|
SpectrogramCanvas,
|
|
2424
2415
|
{
|
|
@@ -2548,7 +2539,7 @@ var SmartChannel = ({
|
|
|
2548
2539
|
};
|
|
2549
2540
|
|
|
2550
2541
|
// src/components/SpectrogramLabels.tsx
|
|
2551
|
-
var
|
|
2542
|
+
var import_react19 = require("react");
|
|
2552
2543
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2553
2544
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2554
2545
|
var LABELS_WIDTH = 72;
|
|
@@ -2600,12 +2591,12 @@ var SpectrogramLabels = ({
|
|
|
2600
2591
|
renderMode = "spectrogram",
|
|
2601
2592
|
hasClipHeaders = false
|
|
2602
2593
|
}) => {
|
|
2603
|
-
const canvasRef = (0,
|
|
2594
|
+
const canvasRef = (0, import_react19.useRef)(null);
|
|
2604
2595
|
const devicePixelRatio = useDevicePixelRatio();
|
|
2605
2596
|
const spectrogramHeight = renderMode === "both" ? Math.floor(waveHeight / 2) : waveHeight;
|
|
2606
2597
|
const totalHeight = numChannels * waveHeight;
|
|
2607
2598
|
const clipHeaderOffset = hasClipHeaders ? 22 : 0;
|
|
2608
|
-
(0,
|
|
2599
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
2609
2600
|
const canvas = canvasRef.current;
|
|
2610
2601
|
if (!canvas) return;
|
|
2611
2602
|
const ctx = canvas.getContext("2d");
|
|
@@ -2659,10 +2650,10 @@ var SpectrogramLabels = ({
|
|
|
2659
2650
|
};
|
|
2660
2651
|
|
|
2661
2652
|
// src/components/SmartScale.tsx
|
|
2662
|
-
var
|
|
2653
|
+
var import_react21 = require("react");
|
|
2663
2654
|
|
|
2664
2655
|
// src/components/TimeScale.tsx
|
|
2665
|
-
var
|
|
2656
|
+
var import_react20 = __toESM(require("react"));
|
|
2666
2657
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2667
2658
|
|
|
2668
2659
|
// src/utils/conversions.ts
|
|
@@ -2686,7 +2677,7 @@ function secondsToPixels(seconds, samplesPerPixel, sampleRate) {
|
|
|
2686
2677
|
}
|
|
2687
2678
|
|
|
2688
2679
|
// src/components/TimeScale.tsx
|
|
2689
|
-
var
|
|
2680
|
+
var import_core3 = require("@waveform-playlist/core");
|
|
2690
2681
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2691
2682
|
function formatTime2(milliseconds) {
|
|
2692
2683
|
const seconds = Math.floor(milliseconds / 1e3);
|
|
@@ -2744,9 +2735,9 @@ var TimeScale = (props) => {
|
|
|
2744
2735
|
samplesPerPixel,
|
|
2745
2736
|
timeScaleHeight,
|
|
2746
2737
|
controls: { show: showControls, width: controlWidth }
|
|
2747
|
-
} = (0,
|
|
2738
|
+
} = (0, import_react20.useContext)(PlaylistInfoContext);
|
|
2748
2739
|
const devicePixelRatio = useDevicePixelRatio();
|
|
2749
|
-
const { widthX, canvasInfo, timeMarkersWithPositions } = (0,
|
|
2740
|
+
const { widthX, canvasInfo, timeMarkersWithPositions } = (0, import_react20.useMemo)(() => {
|
|
2750
2741
|
const nextCanvasInfo = /* @__PURE__ */ new Map();
|
|
2751
2742
|
const nextMarkers = [];
|
|
2752
2743
|
const nextWidthX = secondsToPixels(duration / 1e3, samplesPerPixel, sampleRate);
|
|
@@ -2757,7 +2748,7 @@ var TimeScale = (props) => {
|
|
|
2757
2748
|
if (counter % marker === 0) {
|
|
2758
2749
|
const timeMs = counter;
|
|
2759
2750
|
const timestamp = formatTime2(timeMs);
|
|
2760
|
-
const element = renderTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2751
|
+
const element = renderTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react20.default.Fragment, { children: renderTimestamp(timeMs, pix) }, `timestamp-${counter}`) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TimeStamp, { $left: pix, children: timestamp }, timestamp);
|
|
2761
2752
|
nextMarkers.push({ pix, element });
|
|
2762
2753
|
nextCanvasInfo.set(pix, timeScaleHeight);
|
|
2763
2754
|
} else if (counter % bigStep === 0) {
|
|
@@ -2782,10 +2773,10 @@ var TimeScale = (props) => {
|
|
|
2782
2773
|
renderTimestamp,
|
|
2783
2774
|
timeScaleHeight
|
|
2784
2775
|
]);
|
|
2785
|
-
const visibleChunkIndices = useVisibleChunkIndices(widthX,
|
|
2776
|
+
const visibleChunkIndices = useVisibleChunkIndices(widthX, import_core3.MAX_CANVAS_WIDTH);
|
|
2786
2777
|
const visibleChunks = visibleChunkIndices.map((i) => {
|
|
2787
|
-
const chunkLeft = i *
|
|
2788
|
-
const chunkWidth = Math.min(widthX - chunkLeft,
|
|
2778
|
+
const chunkLeft = i * import_core3.MAX_CANVAS_WIDTH;
|
|
2779
|
+
const chunkWidth = Math.min(widthX - chunkLeft, import_core3.MAX_CANVAS_WIDTH);
|
|
2789
2780
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2790
2781
|
TimeTickChunk,
|
|
2791
2782
|
{
|
|
@@ -2800,14 +2791,14 @@ var TimeScale = (props) => {
|
|
|
2800
2791
|
`timescale-${i}`
|
|
2801
2792
|
);
|
|
2802
2793
|
});
|
|
2803
|
-
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] *
|
|
2804
|
-
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) *
|
|
2794
|
+
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] * import_core3.MAX_CANVAS_WIDTH : 0;
|
|
2795
|
+
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) * import_core3.MAX_CANVAS_WIDTH : Infinity;
|
|
2805
2796
|
const visibleMarkers = visibleChunkIndices.length > 0 ? timeMarkersWithPositions.filter(({ pix }) => pix >= firstChunkLeft && pix < lastChunkRight).map(({ element }) => element) : timeMarkersWithPositions.map(({ element }) => element);
|
|
2806
|
-
(0,
|
|
2797
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
2807
2798
|
for (const [chunkIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2808
2799
|
const ctx = canvas.getContext("2d");
|
|
2809
2800
|
if (!ctx) continue;
|
|
2810
|
-
const chunkLeft = chunkIdx *
|
|
2801
|
+
const chunkLeft = chunkIdx * import_core3.MAX_CANVAS_WIDTH;
|
|
2811
2802
|
const chunkWidth = canvas.width / devicePixelRatio;
|
|
2812
2803
|
ctx.resetTransform();
|
|
2813
2804
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
@@ -2920,7 +2911,7 @@ function getScaleInfo(samplesPerPixel) {
|
|
|
2920
2911
|
return config;
|
|
2921
2912
|
}
|
|
2922
2913
|
var SmartScale = ({ renderTimestamp }) => {
|
|
2923
|
-
const { samplesPerPixel, duration } = (0,
|
|
2914
|
+
const { samplesPerPixel, duration } = (0, import_react21.useContext)(PlaylistInfoContext);
|
|
2924
2915
|
let config = getScaleInfo(samplesPerPixel);
|
|
2925
2916
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2926
2917
|
StyledTimeScale,
|
|
@@ -3151,7 +3142,7 @@ var ButtonGroup = import_styled_components26.default.div`
|
|
|
3151
3142
|
|
|
3152
3143
|
// src/components/TrackControls/CloseButton.tsx
|
|
3153
3144
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
3154
|
-
var
|
|
3145
|
+
var import_react22 = require("@phosphor-icons/react");
|
|
3155
3146
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3156
3147
|
var StyledCloseButton = import_styled_components27.default.button`
|
|
3157
3148
|
position: absolute;
|
|
@@ -3176,7 +3167,7 @@ var StyledCloseButton = import_styled_components27.default.button`
|
|
|
3176
3167
|
color: #dc3545;
|
|
3177
3168
|
}
|
|
3178
3169
|
`;
|
|
3179
|
-
var CloseButton = ({ onClick, title = "Remove track" }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3170
|
+
var CloseButton = ({ onClick, title = "Remove track" }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react22.X, { size: 12, weight: "bold" }) });
|
|
3180
3171
|
|
|
3181
3172
|
// src/components/TrackControls/Controls.tsx
|
|
3182
3173
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
@@ -3211,24 +3202,24 @@ var Header = import_styled_components29.default.header`
|
|
|
3211
3202
|
`;
|
|
3212
3203
|
|
|
3213
3204
|
// src/components/TrackControls/VolumeDownIcon.tsx
|
|
3214
|
-
var
|
|
3205
|
+
var import_react23 = require("@phosphor-icons/react");
|
|
3215
3206
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3216
|
-
var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3207
|
+
var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react23.SpeakerLowIcon, { weight: "light", ...props });
|
|
3217
3208
|
|
|
3218
3209
|
// src/components/TrackControls/VolumeUpIcon.tsx
|
|
3219
|
-
var
|
|
3210
|
+
var import_react24 = require("@phosphor-icons/react");
|
|
3220
3211
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3221
|
-
var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3212
|
+
var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react24.SpeakerHighIcon, { weight: "light", ...props });
|
|
3222
3213
|
|
|
3223
3214
|
// src/components/TrackControls/TrashIcon.tsx
|
|
3224
|
-
var
|
|
3215
|
+
var import_react25 = require("@phosphor-icons/react");
|
|
3225
3216
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3226
|
-
var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3217
|
+
var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react25.TrashIcon, { weight: "light", ...props });
|
|
3227
3218
|
|
|
3228
3219
|
// src/components/TrackControls/DotsIcon.tsx
|
|
3229
|
-
var
|
|
3220
|
+
var import_react26 = require("@phosphor-icons/react");
|
|
3230
3221
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3231
|
-
var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3222
|
+
var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react26.DotsThreeIcon, { weight: "bold", ...props });
|
|
3232
3223
|
|
|
3233
3224
|
// src/components/TrackControls/Slider.tsx
|
|
3234
3225
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
@@ -3296,7 +3287,7 @@ var SliderWrapper = import_styled_components31.default.label`
|
|
|
3296
3287
|
`;
|
|
3297
3288
|
|
|
3298
3289
|
// src/components/TrackMenu.tsx
|
|
3299
|
-
var
|
|
3290
|
+
var import_react27 = __toESM(require("react"));
|
|
3300
3291
|
var import_react_dom = require("react-dom");
|
|
3301
3292
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
3302
3293
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -3338,13 +3329,13 @@ var Divider = import_styled_components32.default.hr`
|
|
|
3338
3329
|
margin: 0.35rem 0;
|
|
3339
3330
|
`;
|
|
3340
3331
|
var TrackMenu = ({ items: itemsProp }) => {
|
|
3341
|
-
const [open, setOpen] = (0,
|
|
3332
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
3342
3333
|
const close = () => setOpen(false);
|
|
3343
3334
|
const items = typeof itemsProp === "function" ? itemsProp(close) : itemsProp;
|
|
3344
|
-
const [dropdownPos, setDropdownPos] = (0,
|
|
3345
|
-
const buttonRef = (0,
|
|
3346
|
-
const dropdownRef = (0,
|
|
3347
|
-
(0,
|
|
3335
|
+
const [dropdownPos, setDropdownPos] = (0, import_react27.useState)({ top: 0, left: 0 });
|
|
3336
|
+
const buttonRef = (0, import_react27.useRef)(null);
|
|
3337
|
+
const dropdownRef = (0, import_react27.useRef)(null);
|
|
3338
|
+
(0, import_react27.useEffect)(() => {
|
|
3348
3339
|
if (open && buttonRef.current) {
|
|
3349
3340
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
3350
3341
|
setDropdownPos({
|
|
@@ -3353,7 +3344,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3353
3344
|
});
|
|
3354
3345
|
}
|
|
3355
3346
|
}, [open]);
|
|
3356
|
-
(0,
|
|
3347
|
+
(0, import_react27.useEffect)(() => {
|
|
3357
3348
|
if (!open) return;
|
|
3358
3349
|
const handleClick = (e) => {
|
|
3359
3350
|
const target = e.target;
|
|
@@ -3387,7 +3378,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3387
3378
|
$top: dropdownPos.top,
|
|
3388
3379
|
$left: dropdownPos.left,
|
|
3389
3380
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3390
|
-
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3381
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react27.default.Fragment, { children: [
|
|
3391
3382
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Divider, {}),
|
|
3392
3383
|
item.content
|
|
3393
3384
|
] }, item.id))
|