@waveform-playlist/ui-components 8.1.0 → 9.0.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 +37 -40
- package/dist/index.d.ts +37 -40
- package/dist/index.js +163 -152
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -17
package/dist/index.js
CHANGED
|
@@ -758,6 +758,40 @@ function useChunkedCanvasRefs() {
|
|
|
758
758
|
|
|
759
759
|
// src/components/Channel.tsx
|
|
760
760
|
var import_core = require("@waveform-playlist/core");
|
|
761
|
+
|
|
762
|
+
// src/utils/peakRendering.ts
|
|
763
|
+
function aggregatePeaks(data, bits, startIndex, endIndex) {
|
|
764
|
+
if (startIndex * 2 + 1 >= data.length) {
|
|
765
|
+
return null;
|
|
766
|
+
}
|
|
767
|
+
const maxValue = 2 ** (bits - 1);
|
|
768
|
+
let minPeak = data[startIndex * 2] / maxValue;
|
|
769
|
+
let maxPeak = data[startIndex * 2 + 1] / maxValue;
|
|
770
|
+
for (let p = startIndex + 1; p < endIndex; p++) {
|
|
771
|
+
if (p * 2 + 1 >= data.length) break;
|
|
772
|
+
const pMin = data[p * 2] / maxValue;
|
|
773
|
+
const pMax = data[p * 2 + 1] / maxValue;
|
|
774
|
+
if (pMin < minPeak) minPeak = pMin;
|
|
775
|
+
if (pMax > maxPeak) maxPeak = pMax;
|
|
776
|
+
}
|
|
777
|
+
return { min: minPeak, max: maxPeak };
|
|
778
|
+
}
|
|
779
|
+
function calculateBarRects(x, barWidth, halfHeight, minPeak, maxPeak, drawMode) {
|
|
780
|
+
const min = Math.abs(minPeak * halfHeight);
|
|
781
|
+
const max = Math.abs(maxPeak * halfHeight);
|
|
782
|
+
if (drawMode === "normal") {
|
|
783
|
+
return [{ x, y: halfHeight - max, width: barWidth, height: max + min }];
|
|
784
|
+
}
|
|
785
|
+
return [
|
|
786
|
+
{ x, y: 0, width: barWidth, height: halfHeight - max },
|
|
787
|
+
{ x, y: halfHeight + min, width: barWidth, height: halfHeight - min }
|
|
788
|
+
];
|
|
789
|
+
}
|
|
790
|
+
function calculateFirstBarPosition(canvasStartGlobal, barWidth, step) {
|
|
791
|
+
return Math.floor((canvasStartGlobal - barWidth + step) / step) * step;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// src/components/Channel.tsx
|
|
761
795
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
762
796
|
function createCanvasFillStyle(ctx, color, width, height) {
|
|
763
797
|
if (!isWaveformGradient(color)) {
|
|
@@ -827,7 +861,6 @@ var Channel = (props) => {
|
|
|
827
861
|
const globalPixelOffset = canvasIdx * import_core.MAX_CANVAS_WIDTH;
|
|
828
862
|
const ctx = canvas.getContext("2d");
|
|
829
863
|
const h2 = Math.floor(waveHeight / 2);
|
|
830
|
-
const maxValue = 2 ** (bits - 1);
|
|
831
864
|
if (ctx) {
|
|
832
865
|
ctx.resetTransform();
|
|
833
866
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
@@ -843,21 +876,16 @@ var Channel = (props) => {
|
|
|
843
876
|
ctx.fillStyle = createCanvasFillStyle(ctx, fillColor, canvasWidth, waveHeight);
|
|
844
877
|
const canvasStartGlobal = globalPixelOffset;
|
|
845
878
|
const canvasEndGlobal = globalPixelOffset + canvasWidth;
|
|
846
|
-
const firstBarGlobal =
|
|
879
|
+
const firstBarGlobal = calculateFirstBarPosition(canvasStartGlobal, barWidth, step);
|
|
847
880
|
for (let barGlobal = Math.max(0, firstBarGlobal); barGlobal < canvasEndGlobal; barGlobal += step) {
|
|
848
881
|
const x = barGlobal - canvasStartGlobal;
|
|
849
882
|
if (x + barWidth <= 0) continue;
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
const
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
if (drawMode === "normal") {
|
|
857
|
-
ctx.fillRect(x, h2 - max, barWidth, max + min);
|
|
858
|
-
} else {
|
|
859
|
-
ctx.fillRect(x, 0, barWidth, h2 - max);
|
|
860
|
-
ctx.fillRect(x, h2 + min, barWidth, h2 - min);
|
|
883
|
+
const peakEnd = Math.min(barGlobal + step, length);
|
|
884
|
+
const peak = aggregatePeaks(data, bits, barGlobal, peakEnd);
|
|
885
|
+
if (peak) {
|
|
886
|
+
const rects = calculateBarRects(x, barWidth, h2, peak.min, peak.max, drawMode);
|
|
887
|
+
for (const rect of rects) {
|
|
888
|
+
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
861
889
|
}
|
|
862
890
|
}
|
|
863
891
|
}
|
|
@@ -949,8 +977,7 @@ var PlaylistErrorBoundary = class extends import_react5.default.Component {
|
|
|
949
977
|
|
|
950
978
|
// src/components/Clip.tsx
|
|
951
979
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
952
|
-
var
|
|
953
|
-
var import_utilities = require("@dnd-kit/utilities");
|
|
980
|
+
var import_react7 = require("@dnd-kit/react");
|
|
954
981
|
|
|
955
982
|
// src/components/ClipHeader.tsx
|
|
956
983
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
@@ -964,7 +991,7 @@ var HeaderContainer = import_styled_components10.default.div`
|
|
|
964
991
|
display: flex;
|
|
965
992
|
align-items: center;
|
|
966
993
|
padding: 0 8px;
|
|
967
|
-
cursor: ${(props) => props.$interactive ?
|
|
994
|
+
cursor: ${(props) => props.$interactive ? "grab" : "default"};
|
|
968
995
|
user-select: none;
|
|
969
996
|
z-index: 110;
|
|
970
997
|
flex-shrink: 0;
|
|
@@ -994,7 +1021,7 @@ var ClipHeaderPresentational = ({
|
|
|
994
1021
|
trackName,
|
|
995
1022
|
isSelected = false
|
|
996
1023
|
}) => {
|
|
997
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderContainer, { $
|
|
1024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderContainer, { $interactive: false, $isSelected: isSelected, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TrackName, { children: trackName }) });
|
|
998
1025
|
};
|
|
999
1026
|
var ClipHeader = ({
|
|
1000
1027
|
clipId,
|
|
@@ -1008,16 +1035,14 @@ var ClipHeader = ({
|
|
|
1008
1035
|
if (disableDrag || !dragHandleProps) {
|
|
1009
1036
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ClipHeaderPresentational, { trackName, isSelected });
|
|
1010
1037
|
}
|
|
1011
|
-
const {
|
|
1038
|
+
const { handleRef } = dragHandleProps;
|
|
1012
1039
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1013
1040
|
HeaderContainer,
|
|
1014
1041
|
{
|
|
1015
|
-
ref:
|
|
1042
|
+
ref: handleRef,
|
|
1016
1043
|
"data-clip-id": clipId,
|
|
1017
1044
|
$interactive: true,
|
|
1018
1045
|
$isSelected: isSelected,
|
|
1019
|
-
...listeners,
|
|
1020
|
-
...attributes,
|
|
1021
1046
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TrackName, { children: trackName })
|
|
1022
1047
|
}
|
|
1023
1048
|
);
|
|
@@ -1070,11 +1095,11 @@ var ClipBoundary = ({
|
|
|
1070
1095
|
if (!dragHandleProps) {
|
|
1071
1096
|
return null;
|
|
1072
1097
|
}
|
|
1073
|
-
const {
|
|
1098
|
+
const { ref: boundaryRef, isDragging } = dragHandleProps;
|
|
1074
1099
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1075
1100
|
BoundaryContainer,
|
|
1076
1101
|
{
|
|
1077
|
-
ref:
|
|
1102
|
+
ref: boundaryRef,
|
|
1078
1103
|
"data-clip-id": clipId,
|
|
1079
1104
|
"data-boundary-edge": edge,
|
|
1080
1105
|
$edge: edge,
|
|
@@ -1082,9 +1107,7 @@ var ClipBoundary = ({
|
|
|
1082
1107
|
$isHovered: isHovered,
|
|
1083
1108
|
$touchOptimized: touchOptimized,
|
|
1084
1109
|
onMouseEnter: () => setIsHovered(true),
|
|
1085
|
-
onMouseLeave: () => setIsHovered(false)
|
|
1086
|
-
...listeners,
|
|
1087
|
-
...attributes
|
|
1110
|
+
onMouseLeave: () => setIsHovered(false)
|
|
1088
1111
|
}
|
|
1089
1112
|
);
|
|
1090
1113
|
};
|
|
@@ -1205,42 +1228,34 @@ var Clip = ({
|
|
|
1205
1228
|
const width = endPixel - left;
|
|
1206
1229
|
const enableDrag = showHeader && !disableHeaderDrag && !isOverlay;
|
|
1207
1230
|
const draggableId = `clip-${trackIndex}-${clipIndex}`;
|
|
1208
|
-
const {
|
|
1231
|
+
const {
|
|
1232
|
+
ref: clipRef,
|
|
1233
|
+
handleRef,
|
|
1234
|
+
isDragSource
|
|
1235
|
+
} = (0, import_react7.useDraggable)({
|
|
1209
1236
|
id: draggableId,
|
|
1210
1237
|
data: { clipId, trackIndex, clipIndex },
|
|
1211
1238
|
disabled: !enableDrag
|
|
1212
1239
|
});
|
|
1213
1240
|
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)({
|
|
1241
|
+
const { ref: leftBoundaryRef, isDragSource: isLeftBoundaryDragging } = (0, import_react7.useDraggable)({
|
|
1220
1242
|
id: leftBoundaryId,
|
|
1221
1243
|
data: { clipId, trackIndex, clipIndex, boundary: "left" },
|
|
1222
|
-
disabled: !enableDrag
|
|
1244
|
+
disabled: !enableDrag,
|
|
1245
|
+
feedback: "none"
|
|
1223
1246
|
});
|
|
1224
1247
|
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)({
|
|
1248
|
+
const { ref: rightBoundaryRef, isDragSource: isRightBoundaryDragging } = (0, import_react7.useDraggable)({
|
|
1231
1249
|
id: rightBoundaryId,
|
|
1232
1250
|
data: { clipId, trackIndex, clipIndex, boundary: "right" },
|
|
1233
|
-
disabled: !enableDrag
|
|
1251
|
+
disabled: !enableDrag,
|
|
1252
|
+
feedback: "none"
|
|
1234
1253
|
});
|
|
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;
|
|
1254
|
+
const style = isDragSource ? { zIndex: 100 } : void 0;
|
|
1240
1255
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1241
1256
|
ClipContainer,
|
|
1242
1257
|
{
|
|
1243
|
-
ref:
|
|
1258
|
+
ref: clipRef,
|
|
1244
1259
|
style,
|
|
1245
1260
|
className,
|
|
1246
1261
|
$left: left,
|
|
@@ -1259,7 +1274,7 @@ var Clip = ({
|
|
|
1259
1274
|
trackName,
|
|
1260
1275
|
isSelected,
|
|
1261
1276
|
disableDrag: disableHeaderDrag,
|
|
1262
|
-
dragHandleProps: enableDrag ? {
|
|
1277
|
+
dragHandleProps: enableDrag ? { handleRef } : void 0
|
|
1263
1278
|
}
|
|
1264
1279
|
),
|
|
1265
1280
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ClipViewportOriginProvider, { originX: left, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(ChannelsWrapper, { $isOverlay: isOverlay, children: [
|
|
@@ -1293,9 +1308,7 @@ var Clip = ({
|
|
|
1293
1308
|
edge: "left",
|
|
1294
1309
|
touchOptimized,
|
|
1295
1310
|
dragHandleProps: {
|
|
1296
|
-
|
|
1297
|
-
listeners: leftBoundaryListeners,
|
|
1298
|
-
setActivatorNodeRef: setLeftBoundaryActivatorRef,
|
|
1311
|
+
ref: leftBoundaryRef,
|
|
1299
1312
|
isDragging: isLeftBoundaryDragging
|
|
1300
1313
|
}
|
|
1301
1314
|
}
|
|
@@ -1309,9 +1322,7 @@ var Clip = ({
|
|
|
1309
1322
|
edge: "right",
|
|
1310
1323
|
touchOptimized,
|
|
1311
1324
|
dragHandleProps: {
|
|
1312
|
-
|
|
1313
|
-
listeners: rightBoundaryListeners,
|
|
1314
|
-
setActivatorNodeRef: setRightBoundaryActivatorRef,
|
|
1325
|
+
ref: rightBoundaryRef,
|
|
1315
1326
|
isDragging: isRightBoundaryDragging
|
|
1316
1327
|
}
|
|
1317
1328
|
}
|
|
@@ -1363,7 +1374,7 @@ var MasterVolumeControl = ({
|
|
|
1363
1374
|
};
|
|
1364
1375
|
|
|
1365
1376
|
// src/components/Playhead.tsx
|
|
1366
|
-
var
|
|
1377
|
+
var import_react8 = require("react");
|
|
1367
1378
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1368
1379
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1369
1380
|
var PlayheadLine = import_styled_components15.default.div.attrs((props) => ({
|
|
@@ -1423,9 +1434,9 @@ var PlayheadWithMarker = ({
|
|
|
1423
1434
|
getAudioContextTime,
|
|
1424
1435
|
getPlaybackTime
|
|
1425
1436
|
}) => {
|
|
1426
|
-
const containerRef = (0,
|
|
1427
|
-
const animationFrameRef = (0,
|
|
1428
|
-
(0,
|
|
1437
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
1438
|
+
const animationFrameRef = (0, import_react8.useRef)(null);
|
|
1439
|
+
(0, import_react8.useEffect)(() => {
|
|
1429
1440
|
const updatePosition = () => {
|
|
1430
1441
|
if (containerRef.current) {
|
|
1431
1442
|
let time;
|
|
@@ -1470,7 +1481,7 @@ var PlayheadWithMarker = ({
|
|
|
1470
1481
|
getAudioContextTime,
|
|
1471
1482
|
getPlaybackTime
|
|
1472
1483
|
]);
|
|
1473
|
-
(0,
|
|
1484
|
+
(0, import_react8.useEffect)(() => {
|
|
1474
1485
|
if (!isPlaying && containerRef.current) {
|
|
1475
1486
|
const time = currentTimeRef.current ?? 0;
|
|
1476
1487
|
const pos = time * sampleRate / samplesPerPixel + controlsOffset;
|
|
@@ -1485,7 +1496,7 @@ var PlayheadWithMarker = ({
|
|
|
1485
1496
|
|
|
1486
1497
|
// src/components/Playlist.tsx
|
|
1487
1498
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
1488
|
-
var
|
|
1499
|
+
var import_react9 = require("react");
|
|
1489
1500
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1490
1501
|
var Wrapper2 = import_styled_components16.default.div`
|
|
1491
1502
|
overflow-y: hidden;
|
|
@@ -1540,8 +1551,8 @@ var Playlist = ({
|
|
|
1540
1551
|
isSelecting,
|
|
1541
1552
|
"data-playlist-state": playlistState
|
|
1542
1553
|
}) => {
|
|
1543
|
-
const wrapperRef = (0,
|
|
1544
|
-
const handleRef = (0,
|
|
1554
|
+
const wrapperRef = (0, import_react9.useRef)(null);
|
|
1555
|
+
const handleRef = (0, import_react9.useCallback)(
|
|
1545
1556
|
(el) => {
|
|
1546
1557
|
wrapperRef.current = el;
|
|
1547
1558
|
scrollContainerRef?.(el);
|
|
@@ -1598,7 +1609,7 @@ var Selection = ({
|
|
|
1598
1609
|
};
|
|
1599
1610
|
|
|
1600
1611
|
// src/components/LoopRegion.tsx
|
|
1601
|
-
var
|
|
1612
|
+
var import_react10 = require("react");
|
|
1602
1613
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
1603
1614
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1604
1615
|
var LoopRegionOverlayDiv = import_styled_components18.default.div.attrs((props) => ({
|
|
@@ -1749,12 +1760,12 @@ var LoopRegionMarkers = ({
|
|
|
1749
1760
|
minPosition = 0,
|
|
1750
1761
|
maxPosition = Infinity
|
|
1751
1762
|
}) => {
|
|
1752
|
-
const [draggingMarker, setDraggingMarker] = (0,
|
|
1753
|
-
const dragStartX = (0,
|
|
1754
|
-
const dragStartPosition = (0,
|
|
1755
|
-
const dragStartEnd = (0,
|
|
1763
|
+
const [draggingMarker, setDraggingMarker] = (0, import_react10.useState)(null);
|
|
1764
|
+
const dragStartX = (0, import_react10.useRef)(0);
|
|
1765
|
+
const dragStartPosition = (0, import_react10.useRef)(0);
|
|
1766
|
+
const dragStartEnd = (0, import_react10.useRef)(0);
|
|
1756
1767
|
const width = Math.max(0, endPosition - startPosition);
|
|
1757
|
-
const handleMarkerMouseDown = (0,
|
|
1768
|
+
const handleMarkerMouseDown = (0, import_react10.useCallback)(
|
|
1758
1769
|
(e, marker) => {
|
|
1759
1770
|
e.preventDefault();
|
|
1760
1771
|
e.stopPropagation();
|
|
@@ -1782,7 +1793,7 @@ var LoopRegionMarkers = ({
|
|
|
1782
1793
|
},
|
|
1783
1794
|
[startPosition, endPosition, minPosition, maxPosition, onLoopStartChange, onLoopEndChange]
|
|
1784
1795
|
);
|
|
1785
|
-
const handleRegionMouseDown = (0,
|
|
1796
|
+
const handleRegionMouseDown = (0, import_react10.useCallback)(
|
|
1786
1797
|
(e) => {
|
|
1787
1798
|
e.preventDefault();
|
|
1788
1799
|
e.stopPropagation();
|
|
@@ -1876,11 +1887,11 @@ var TimescaleLoopRegion = ({
|
|
|
1876
1887
|
maxPosition = Infinity,
|
|
1877
1888
|
controlsOffset = 0
|
|
1878
1889
|
}) => {
|
|
1879
|
-
const [, setIsCreating] = (0,
|
|
1880
|
-
const createStartX = (0,
|
|
1881
|
-
const containerRef = (0,
|
|
1890
|
+
const [, setIsCreating] = (0, import_react10.useState)(false);
|
|
1891
|
+
const createStartX = (0, import_react10.useRef)(0);
|
|
1892
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
1882
1893
|
const hasLoopRegion = endPosition > startPosition;
|
|
1883
|
-
const handleBackgroundMouseDown = (0,
|
|
1894
|
+
const handleBackgroundMouseDown = (0, import_react10.useCallback)(
|
|
1884
1895
|
(e) => {
|
|
1885
1896
|
const target = e.target;
|
|
1886
1897
|
if (target.closest("[data-loop-marker-handle]") || target.closest("[data-loop-region-timescale]")) {
|
|
@@ -1937,10 +1948,10 @@ var TimescaleLoopRegion = ({
|
|
|
1937
1948
|
};
|
|
1938
1949
|
|
|
1939
1950
|
// src/components/SelectionTimeInputs.tsx
|
|
1940
|
-
var
|
|
1951
|
+
var import_react12 = require("react");
|
|
1941
1952
|
|
|
1942
1953
|
// src/components/TimeInput.tsx
|
|
1943
|
-
var
|
|
1954
|
+
var import_react11 = require("react");
|
|
1944
1955
|
|
|
1945
1956
|
// src/utils/timeFormat.ts
|
|
1946
1957
|
function clockFormat(seconds, decimals) {
|
|
@@ -2000,8 +2011,8 @@ var TimeInput = ({
|
|
|
2000
2011
|
onChange,
|
|
2001
2012
|
readOnly = false
|
|
2002
2013
|
}) => {
|
|
2003
|
-
const [displayValue, setDisplayValue] = (0,
|
|
2004
|
-
(0,
|
|
2014
|
+
const [displayValue, setDisplayValue] = (0, import_react11.useState)("");
|
|
2015
|
+
(0, import_react11.useEffect)(() => {
|
|
2005
2016
|
const formatted = formatTime(value, format);
|
|
2006
2017
|
setDisplayValue(formatted);
|
|
2007
2018
|
}, [value, format, id]);
|
|
@@ -2047,8 +2058,8 @@ var SelectionTimeInputs = ({
|
|
|
2047
2058
|
onSelectionChange,
|
|
2048
2059
|
className
|
|
2049
2060
|
}) => {
|
|
2050
|
-
const [timeFormat, setTimeFormat] = (0,
|
|
2051
|
-
(0,
|
|
2061
|
+
const [timeFormat, setTimeFormat] = (0, import_react12.useState)("hh:mm:ss.uuu");
|
|
2062
|
+
(0, import_react12.useEffect)(() => {
|
|
2052
2063
|
const timeFormatSelect = document.querySelector(".time-format");
|
|
2053
2064
|
const handleFormatChange = () => {
|
|
2054
2065
|
if (timeFormatSelect) {
|
|
@@ -2100,14 +2111,14 @@ var SelectionTimeInputs = ({
|
|
|
2100
2111
|
};
|
|
2101
2112
|
|
|
2102
2113
|
// src/contexts/DevicePixelRatio.tsx
|
|
2103
|
-
var
|
|
2114
|
+
var import_react13 = require("react");
|
|
2104
2115
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2105
2116
|
function getScale() {
|
|
2106
2117
|
return window.devicePixelRatio;
|
|
2107
2118
|
}
|
|
2108
|
-
var DevicePixelRatioContext = (0,
|
|
2119
|
+
var DevicePixelRatioContext = (0, import_react13.createContext)(getScale());
|
|
2109
2120
|
var DevicePixelRatioProvider = ({ children }) => {
|
|
2110
|
-
const [scale, setScale] = (0,
|
|
2121
|
+
const [scale, setScale] = (0, import_react13.useState)(getScale());
|
|
2111
2122
|
matchMedia(`(resolution: ${getScale()}dppx)`).addEventListener(
|
|
2112
2123
|
"change",
|
|
2113
2124
|
() => {
|
|
@@ -2117,11 +2128,11 @@ var DevicePixelRatioProvider = ({ children }) => {
|
|
|
2117
2128
|
);
|
|
2118
2129
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DevicePixelRatioContext.Provider, { value: Math.ceil(scale), children });
|
|
2119
2130
|
};
|
|
2120
|
-
var useDevicePixelRatio = () => (0,
|
|
2131
|
+
var useDevicePixelRatio = () => (0, import_react13.useContext)(DevicePixelRatioContext);
|
|
2121
2132
|
|
|
2122
2133
|
// src/contexts/PlaylistInfo.tsx
|
|
2123
|
-
var
|
|
2124
|
-
var PlaylistInfoContext = (0,
|
|
2134
|
+
var import_react14 = require("react");
|
|
2135
|
+
var PlaylistInfoContext = (0, import_react14.createContext)({
|
|
2125
2136
|
sampleRate: 48e3,
|
|
2126
2137
|
samplesPerPixel: 1e3,
|
|
2127
2138
|
zoomLevels: [1e3, 1500, 2e3, 2500],
|
|
@@ -2135,21 +2146,21 @@ var PlaylistInfoContext = (0, import_react13.createContext)({
|
|
|
2135
2146
|
barWidth: 1,
|
|
2136
2147
|
barGap: 0
|
|
2137
2148
|
});
|
|
2138
|
-
var usePlaylistInfo = () => (0,
|
|
2149
|
+
var usePlaylistInfo = () => (0, import_react14.useContext)(PlaylistInfoContext);
|
|
2139
2150
|
|
|
2140
2151
|
// src/contexts/Theme.tsx
|
|
2141
|
-
var
|
|
2152
|
+
var import_react15 = require("react");
|
|
2142
2153
|
var import_styled_components19 = require("styled-components");
|
|
2143
|
-
var useTheme2 = () => (0,
|
|
2154
|
+
var useTheme2 = () => (0, import_react15.useContext)(import_styled_components19.ThemeContext);
|
|
2144
2155
|
|
|
2145
2156
|
// src/contexts/TrackControls.tsx
|
|
2146
|
-
var
|
|
2157
|
+
var import_react16 = require("react");
|
|
2147
2158
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2148
|
-
var TrackControlsContext = (0,
|
|
2149
|
-
var useTrackControls = () => (0,
|
|
2159
|
+
var TrackControlsContext = (0, import_react16.createContext)(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react16.Fragment, {}));
|
|
2160
|
+
var useTrackControls = () => (0, import_react16.useContext)(TrackControlsContext);
|
|
2150
2161
|
|
|
2151
2162
|
// src/contexts/Playout.tsx
|
|
2152
|
-
var
|
|
2163
|
+
var import_react17 = require("react");
|
|
2153
2164
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2154
2165
|
var defaultProgress = 0;
|
|
2155
2166
|
var defaultIsPlaying = false;
|
|
@@ -2161,8 +2172,8 @@ var defaultPlayout = {
|
|
|
2161
2172
|
selectionStart: defaultSelectionStart,
|
|
2162
2173
|
selectionEnd: defaultSelectionEnd
|
|
2163
2174
|
};
|
|
2164
|
-
var PlayoutStatusContext = (0,
|
|
2165
|
-
var PlayoutStatusUpdateContext = (0,
|
|
2175
|
+
var PlayoutStatusContext = (0, import_react17.createContext)(defaultPlayout);
|
|
2176
|
+
var PlayoutStatusUpdateContext = (0, import_react17.createContext)({
|
|
2166
2177
|
setIsPlaying: () => {
|
|
2167
2178
|
},
|
|
2168
2179
|
setProgress: () => {
|
|
@@ -2171,23 +2182,23 @@ var PlayoutStatusUpdateContext = (0, import_react16.createContext)({
|
|
|
2171
2182
|
}
|
|
2172
2183
|
});
|
|
2173
2184
|
var PlayoutProvider = ({ children }) => {
|
|
2174
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
2175
|
-
const [progress, setProgress] = (0,
|
|
2176
|
-
const [selectionStart, setSelectionStart] = (0,
|
|
2177
|
-
const [selectionEnd, setSelectionEnd] = (0,
|
|
2185
|
+
const [isPlaying, setIsPlaying] = (0, import_react17.useState)(defaultIsPlaying);
|
|
2186
|
+
const [progress, setProgress] = (0, import_react17.useState)(defaultProgress);
|
|
2187
|
+
const [selectionStart, setSelectionStart] = (0, import_react17.useState)(defaultSelectionStart);
|
|
2188
|
+
const [selectionEnd, setSelectionEnd] = (0, import_react17.useState)(defaultSelectionEnd);
|
|
2178
2189
|
const setSelection = (start, end) => {
|
|
2179
2190
|
setSelectionStart(start);
|
|
2180
2191
|
setSelectionEnd(end);
|
|
2181
2192
|
};
|
|
2182
2193
|
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 }) });
|
|
2183
2194
|
};
|
|
2184
|
-
var usePlayoutStatus = () => (0,
|
|
2185
|
-
var usePlayoutStatusUpdate = () => (0,
|
|
2195
|
+
var usePlayoutStatus = () => (0, import_react17.useContext)(PlayoutStatusContext);
|
|
2196
|
+
var usePlayoutStatusUpdate = () => (0, import_react17.useContext)(PlayoutStatusUpdateContext);
|
|
2186
2197
|
|
|
2187
2198
|
// src/components/SpectrogramChannel.tsx
|
|
2188
|
-
var
|
|
2199
|
+
var import_react18 = require("react");
|
|
2189
2200
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2190
|
-
var
|
|
2201
|
+
var import_core2 = require("@waveform-playlist/core");
|
|
2191
2202
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2192
2203
|
var LINEAR_FREQUENCY_SCALE = (f, minF, maxF) => (f - minF) / (maxF - minF);
|
|
2193
2204
|
var Wrapper3 = import_styled_components20.default.div.attrs((props) => ({
|
|
@@ -2242,24 +2253,24 @@ var SpectrogramChannel = ({
|
|
|
2242
2253
|
}) => {
|
|
2243
2254
|
const channelIndex = channelIndexProp ?? index;
|
|
2244
2255
|
const { canvasRef, canvasMapRef } = useChunkedCanvasRefs();
|
|
2245
|
-
const registeredIdsRef = (0,
|
|
2246
|
-
const transferredCanvasesRef = (0,
|
|
2247
|
-
const workerApiRef = (0,
|
|
2248
|
-
const onCanvasesReadyRef = (0,
|
|
2256
|
+
const registeredIdsRef = (0, import_react18.useRef)([]);
|
|
2257
|
+
const transferredCanvasesRef = (0, import_react18.useRef)(/* @__PURE__ */ new WeakSet());
|
|
2258
|
+
const workerApiRef = (0, import_react18.useRef)(workerApi);
|
|
2259
|
+
const onCanvasesReadyRef = (0, import_react18.useRef)(onCanvasesReady);
|
|
2249
2260
|
const isWorkerMode = !!(workerApi && clipId);
|
|
2250
2261
|
const clipOriginX = useClipViewportOrigin();
|
|
2251
|
-
const visibleChunkIndices = useVisibleChunkIndices(length,
|
|
2262
|
+
const visibleChunkIndices = useVisibleChunkIndices(length, import_core2.MAX_CANVAS_WIDTH, clipOriginX);
|
|
2252
2263
|
const lut = colorLUT ?? DEFAULT_COLOR_LUT;
|
|
2253
2264
|
const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
|
|
2254
2265
|
const scaleFn = frequencyScaleFn ?? LINEAR_FREQUENCY_SCALE;
|
|
2255
2266
|
const hasCustomFrequencyScale = Boolean(frequencyScaleFn);
|
|
2256
|
-
(0,
|
|
2267
|
+
(0, import_react18.useEffect)(() => {
|
|
2257
2268
|
workerApiRef.current = workerApi;
|
|
2258
2269
|
}, [workerApi]);
|
|
2259
|
-
(0,
|
|
2270
|
+
(0, import_react18.useEffect)(() => {
|
|
2260
2271
|
onCanvasesReadyRef.current = onCanvasesReady;
|
|
2261
2272
|
}, [onCanvasesReady]);
|
|
2262
|
-
(0,
|
|
2273
|
+
(0, import_react18.useEffect)(() => {
|
|
2263
2274
|
if (!isWorkerMode) return;
|
|
2264
2275
|
const currentWorkerApi = workerApiRef.current;
|
|
2265
2276
|
if (!currentWorkerApi || !clipId) return;
|
|
@@ -2314,15 +2325,15 @@ var SpectrogramChannel = ({
|
|
|
2314
2325
|
const match = id.match(/chunk(\d+)$/);
|
|
2315
2326
|
if (!match) {
|
|
2316
2327
|
console.warn(`[spectrogram] Unexpected canvas ID format: ${id}`);
|
|
2317
|
-
return
|
|
2328
|
+
return import_core2.MAX_CANVAS_WIDTH;
|
|
2318
2329
|
}
|
|
2319
2330
|
const chunkIdx = parseInt(match[1], 10);
|
|
2320
|
-
return Math.min(length - chunkIdx *
|
|
2331
|
+
return Math.min(length - chunkIdx * import_core2.MAX_CANVAS_WIDTH, import_core2.MAX_CANVAS_WIDTH);
|
|
2321
2332
|
});
|
|
2322
2333
|
onCanvasesReadyRef.current?.(allIds, allWidths);
|
|
2323
2334
|
}
|
|
2324
2335
|
}, [canvasMapRef, isWorkerMode, clipId, channelIndex, length, visibleChunkIndices]);
|
|
2325
|
-
(0,
|
|
2336
|
+
(0, import_react18.useEffect)(() => {
|
|
2326
2337
|
return () => {
|
|
2327
2338
|
const api = workerApiRef.current;
|
|
2328
2339
|
if (!api) return;
|
|
@@ -2336,7 +2347,7 @@ var SpectrogramChannel = ({
|
|
|
2336
2347
|
registeredIdsRef.current = [];
|
|
2337
2348
|
};
|
|
2338
2349
|
}, []);
|
|
2339
|
-
(0,
|
|
2350
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
2340
2351
|
if (isWorkerMode || !data) return;
|
|
2341
2352
|
const {
|
|
2342
2353
|
frequencyBinCount,
|
|
@@ -2349,7 +2360,7 @@ var SpectrogramChannel = ({
|
|
|
2349
2360
|
const rangeDb = rawRangeDb === 0 ? 1 : rawRangeDb;
|
|
2350
2361
|
const binToFreq = (bin) => bin / frequencyBinCount * (sampleRate / 2);
|
|
2351
2362
|
for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2352
|
-
const globalPixelOffset = canvasIdx *
|
|
2363
|
+
const globalPixelOffset = canvasIdx * import_core2.MAX_CANVAS_WIDTH;
|
|
2353
2364
|
const ctx = canvas.getContext("2d");
|
|
2354
2365
|
if (!ctx) continue;
|
|
2355
2366
|
const canvasWidth = canvas.width / devicePixelRatio;
|
|
@@ -2425,8 +2436,8 @@ var SpectrogramChannel = ({
|
|
|
2425
2436
|
visibleChunkIndices
|
|
2426
2437
|
]);
|
|
2427
2438
|
const canvases = visibleChunkIndices.map((i) => {
|
|
2428
|
-
const chunkLeft = i *
|
|
2429
|
-
const currentWidth = Math.min(length - chunkLeft,
|
|
2439
|
+
const chunkLeft = i * import_core2.MAX_CANVAS_WIDTH;
|
|
2440
|
+
const currentWidth = Math.min(length - chunkLeft, import_core2.MAX_CANVAS_WIDTH);
|
|
2430
2441
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2431
2442
|
SpectrogramCanvas,
|
|
2432
2443
|
{
|
|
@@ -2556,7 +2567,7 @@ var SmartChannel = ({
|
|
|
2556
2567
|
};
|
|
2557
2568
|
|
|
2558
2569
|
// src/components/SpectrogramLabels.tsx
|
|
2559
|
-
var
|
|
2570
|
+
var import_react19 = require("react");
|
|
2560
2571
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2561
2572
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2562
2573
|
var LABELS_WIDTH = 72;
|
|
@@ -2608,12 +2619,12 @@ var SpectrogramLabels = ({
|
|
|
2608
2619
|
renderMode = "spectrogram",
|
|
2609
2620
|
hasClipHeaders = false
|
|
2610
2621
|
}) => {
|
|
2611
|
-
const canvasRef = (0,
|
|
2622
|
+
const canvasRef = (0, import_react19.useRef)(null);
|
|
2612
2623
|
const devicePixelRatio = useDevicePixelRatio();
|
|
2613
2624
|
const spectrogramHeight = renderMode === "both" ? Math.floor(waveHeight / 2) : waveHeight;
|
|
2614
2625
|
const totalHeight = numChannels * waveHeight;
|
|
2615
2626
|
const clipHeaderOffset = hasClipHeaders ? 22 : 0;
|
|
2616
|
-
(0,
|
|
2627
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
2617
2628
|
const canvas = canvasRef.current;
|
|
2618
2629
|
if (!canvas) return;
|
|
2619
2630
|
const ctx = canvas.getContext("2d");
|
|
@@ -2667,10 +2678,10 @@ var SpectrogramLabels = ({
|
|
|
2667
2678
|
};
|
|
2668
2679
|
|
|
2669
2680
|
// src/components/SmartScale.tsx
|
|
2670
|
-
var
|
|
2681
|
+
var import_react21 = require("react");
|
|
2671
2682
|
|
|
2672
2683
|
// src/components/TimeScale.tsx
|
|
2673
|
-
var
|
|
2684
|
+
var import_react20 = __toESM(require("react"));
|
|
2674
2685
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2675
2686
|
|
|
2676
2687
|
// src/utils/conversions.ts
|
|
@@ -2694,7 +2705,7 @@ function secondsToPixels(seconds, samplesPerPixel, sampleRate) {
|
|
|
2694
2705
|
}
|
|
2695
2706
|
|
|
2696
2707
|
// src/components/TimeScale.tsx
|
|
2697
|
-
var
|
|
2708
|
+
var import_core3 = require("@waveform-playlist/core");
|
|
2698
2709
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2699
2710
|
function formatTime2(milliseconds) {
|
|
2700
2711
|
const seconds = Math.floor(milliseconds / 1e3);
|
|
@@ -2752,9 +2763,9 @@ var TimeScale = (props) => {
|
|
|
2752
2763
|
samplesPerPixel,
|
|
2753
2764
|
timeScaleHeight,
|
|
2754
2765
|
controls: { show: showControls, width: controlWidth }
|
|
2755
|
-
} = (0,
|
|
2766
|
+
} = (0, import_react20.useContext)(PlaylistInfoContext);
|
|
2756
2767
|
const devicePixelRatio = useDevicePixelRatio();
|
|
2757
|
-
const { widthX, canvasInfo, timeMarkersWithPositions } = (0,
|
|
2768
|
+
const { widthX, canvasInfo, timeMarkersWithPositions } = (0, import_react20.useMemo)(() => {
|
|
2758
2769
|
const nextCanvasInfo = /* @__PURE__ */ new Map();
|
|
2759
2770
|
const nextMarkers = [];
|
|
2760
2771
|
const nextWidthX = secondsToPixels(duration / 1e3, samplesPerPixel, sampleRate);
|
|
@@ -2765,7 +2776,7 @@ var TimeScale = (props) => {
|
|
|
2765
2776
|
if (counter % marker === 0) {
|
|
2766
2777
|
const timeMs = counter;
|
|
2767
2778
|
const timestamp = formatTime2(timeMs);
|
|
2768
|
-
const element = renderTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2779
|
+
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);
|
|
2769
2780
|
nextMarkers.push({ pix, element });
|
|
2770
2781
|
nextCanvasInfo.set(pix, timeScaleHeight);
|
|
2771
2782
|
} else if (counter % bigStep === 0) {
|
|
@@ -2790,10 +2801,10 @@ var TimeScale = (props) => {
|
|
|
2790
2801
|
renderTimestamp,
|
|
2791
2802
|
timeScaleHeight
|
|
2792
2803
|
]);
|
|
2793
|
-
const visibleChunkIndices = useVisibleChunkIndices(widthX,
|
|
2804
|
+
const visibleChunkIndices = useVisibleChunkIndices(widthX, import_core3.MAX_CANVAS_WIDTH);
|
|
2794
2805
|
const visibleChunks = visibleChunkIndices.map((i) => {
|
|
2795
|
-
const chunkLeft = i *
|
|
2796
|
-
const chunkWidth = Math.min(widthX - chunkLeft,
|
|
2806
|
+
const chunkLeft = i * import_core3.MAX_CANVAS_WIDTH;
|
|
2807
|
+
const chunkWidth = Math.min(widthX - chunkLeft, import_core3.MAX_CANVAS_WIDTH);
|
|
2797
2808
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2798
2809
|
TimeTickChunk,
|
|
2799
2810
|
{
|
|
@@ -2808,14 +2819,14 @@ var TimeScale = (props) => {
|
|
|
2808
2819
|
`timescale-${i}`
|
|
2809
2820
|
);
|
|
2810
2821
|
});
|
|
2811
|
-
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] *
|
|
2812
|
-
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) *
|
|
2822
|
+
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] * import_core3.MAX_CANVAS_WIDTH : 0;
|
|
2823
|
+
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) * import_core3.MAX_CANVAS_WIDTH : Infinity;
|
|
2813
2824
|
const visibleMarkers = visibleChunkIndices.length > 0 ? timeMarkersWithPositions.filter(({ pix }) => pix >= firstChunkLeft && pix < lastChunkRight).map(({ element }) => element) : timeMarkersWithPositions.map(({ element }) => element);
|
|
2814
|
-
(0,
|
|
2825
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
2815
2826
|
for (const [chunkIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2816
2827
|
const ctx = canvas.getContext("2d");
|
|
2817
2828
|
if (!ctx) continue;
|
|
2818
|
-
const chunkLeft = chunkIdx *
|
|
2829
|
+
const chunkLeft = chunkIdx * import_core3.MAX_CANVAS_WIDTH;
|
|
2819
2830
|
const chunkWidth = canvas.width / devicePixelRatio;
|
|
2820
2831
|
ctx.resetTransform();
|
|
2821
2832
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
@@ -2928,7 +2939,7 @@ function getScaleInfo(samplesPerPixel) {
|
|
|
2928
2939
|
return config;
|
|
2929
2940
|
}
|
|
2930
2941
|
var SmartScale = ({ renderTimestamp }) => {
|
|
2931
|
-
const { samplesPerPixel, duration } = (0,
|
|
2942
|
+
const { samplesPerPixel, duration } = (0, import_react21.useContext)(PlaylistInfoContext);
|
|
2932
2943
|
let config = getScaleInfo(samplesPerPixel);
|
|
2933
2944
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2934
2945
|
StyledTimeScale,
|
|
@@ -3159,7 +3170,7 @@ var ButtonGroup = import_styled_components26.default.div`
|
|
|
3159
3170
|
|
|
3160
3171
|
// src/components/TrackControls/CloseButton.tsx
|
|
3161
3172
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
3162
|
-
var
|
|
3173
|
+
var import_react22 = require("@phosphor-icons/react");
|
|
3163
3174
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3164
3175
|
var StyledCloseButton = import_styled_components27.default.button`
|
|
3165
3176
|
position: absolute;
|
|
@@ -3184,7 +3195,7 @@ var StyledCloseButton = import_styled_components27.default.button`
|
|
|
3184
3195
|
color: #dc3545;
|
|
3185
3196
|
}
|
|
3186
3197
|
`;
|
|
3187
|
-
var CloseButton = ({ onClick, title = "Remove track" }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3198
|
+
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" }) });
|
|
3188
3199
|
|
|
3189
3200
|
// src/components/TrackControls/Controls.tsx
|
|
3190
3201
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
@@ -3219,24 +3230,24 @@ var Header = import_styled_components29.default.header`
|
|
|
3219
3230
|
`;
|
|
3220
3231
|
|
|
3221
3232
|
// src/components/TrackControls/VolumeDownIcon.tsx
|
|
3222
|
-
var
|
|
3233
|
+
var import_react23 = require("@phosphor-icons/react");
|
|
3223
3234
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3224
|
-
var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3235
|
+
var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react23.SpeakerLowIcon, { weight: "light", ...props });
|
|
3225
3236
|
|
|
3226
3237
|
// src/components/TrackControls/VolumeUpIcon.tsx
|
|
3227
|
-
var
|
|
3238
|
+
var import_react24 = require("@phosphor-icons/react");
|
|
3228
3239
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3229
|
-
var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3240
|
+
var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react24.SpeakerHighIcon, { weight: "light", ...props });
|
|
3230
3241
|
|
|
3231
3242
|
// src/components/TrackControls/TrashIcon.tsx
|
|
3232
|
-
var
|
|
3243
|
+
var import_react25 = require("@phosphor-icons/react");
|
|
3233
3244
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3234
|
-
var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3245
|
+
var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react25.TrashIcon, { weight: "light", ...props });
|
|
3235
3246
|
|
|
3236
3247
|
// src/components/TrackControls/DotsIcon.tsx
|
|
3237
|
-
var
|
|
3248
|
+
var import_react26 = require("@phosphor-icons/react");
|
|
3238
3249
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3239
|
-
var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3250
|
+
var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react26.DotsThreeIcon, { weight: "bold", ...props });
|
|
3240
3251
|
|
|
3241
3252
|
// src/components/TrackControls/Slider.tsx
|
|
3242
3253
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
@@ -3304,7 +3315,7 @@ var SliderWrapper = import_styled_components31.default.label`
|
|
|
3304
3315
|
`;
|
|
3305
3316
|
|
|
3306
3317
|
// src/components/TrackMenu.tsx
|
|
3307
|
-
var
|
|
3318
|
+
var import_react27 = __toESM(require("react"));
|
|
3308
3319
|
var import_react_dom = require("react-dom");
|
|
3309
3320
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
3310
3321
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -3346,13 +3357,13 @@ var Divider = import_styled_components32.default.hr`
|
|
|
3346
3357
|
margin: 0.35rem 0;
|
|
3347
3358
|
`;
|
|
3348
3359
|
var TrackMenu = ({ items: itemsProp }) => {
|
|
3349
|
-
const [open, setOpen] = (0,
|
|
3360
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
3350
3361
|
const close = () => setOpen(false);
|
|
3351
3362
|
const items = typeof itemsProp === "function" ? itemsProp(close) : itemsProp;
|
|
3352
|
-
const [dropdownPos, setDropdownPos] = (0,
|
|
3353
|
-
const buttonRef = (0,
|
|
3354
|
-
const dropdownRef = (0,
|
|
3355
|
-
(0,
|
|
3363
|
+
const [dropdownPos, setDropdownPos] = (0, import_react27.useState)({ top: 0, left: 0 });
|
|
3364
|
+
const buttonRef = (0, import_react27.useRef)(null);
|
|
3365
|
+
const dropdownRef = (0, import_react27.useRef)(null);
|
|
3366
|
+
(0, import_react27.useEffect)(() => {
|
|
3356
3367
|
if (open && buttonRef.current) {
|
|
3357
3368
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
3358
3369
|
setDropdownPos({
|
|
@@ -3361,7 +3372,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3361
3372
|
});
|
|
3362
3373
|
}
|
|
3363
3374
|
}, [open]);
|
|
3364
|
-
(0,
|
|
3375
|
+
(0, import_react27.useEffect)(() => {
|
|
3365
3376
|
if (!open) return;
|
|
3366
3377
|
const handleClick = (e) => {
|
|
3367
3378
|
const target = e.target;
|
|
@@ -3395,7 +3406,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3395
3406
|
$top: dropdownPos.top,
|
|
3396
3407
|
$left: dropdownPos.left,
|
|
3397
3408
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3398
|
-
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3409
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react27.default.Fragment, { children: [
|
|
3399
3410
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Divider, {}),
|
|
3400
3411
|
item.content
|
|
3401
3412
|
] }, item.id))
|