@waveform-playlist/ui-components 15.0.0-next.2 → 15.0.0-next.4
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.js +42 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -5
package/dist/index.js
CHANGED
|
@@ -3371,7 +3371,7 @@ var ButtonGroup = import_styled_components29.default.div`
|
|
|
3371
3371
|
|
|
3372
3372
|
// src/components/TrackControls/CloseButton.tsx
|
|
3373
3373
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
3374
|
-
var
|
|
3374
|
+
var import_X = require("@phosphor-icons/react/dist/csr/X");
|
|
3375
3375
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3376
3376
|
var StyledCloseButton = import_styled_components30.default.button`
|
|
3377
3377
|
position: absolute;
|
|
@@ -3396,7 +3396,7 @@ var StyledCloseButton = import_styled_components30.default.button`
|
|
|
3396
3396
|
color: #dc3545;
|
|
3397
3397
|
}
|
|
3398
3398
|
`;
|
|
3399
|
-
var CloseButton = ({ onClick, title = "Remove track" }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3399
|
+
var CloseButton = ({ onClick, title = "Remove track" }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StyledCloseButton, { onClick, title, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_X.XIcon, { size: 12, weight: "bold" }) });
|
|
3400
3400
|
|
|
3401
3401
|
// src/components/TrackControls/Controls.tsx
|
|
3402
3402
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
@@ -3431,39 +3431,39 @@ var Header = import_styled_components32.default.header`
|
|
|
3431
3431
|
`;
|
|
3432
3432
|
|
|
3433
3433
|
// src/components/TrackControls/VolumeDownIcon.tsx
|
|
3434
|
-
var
|
|
3434
|
+
var import_SpeakerLow = require("@phosphor-icons/react/dist/csr/SpeakerLow");
|
|
3435
3435
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3436
|
-
var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3436
|
+
var VolumeDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_SpeakerLow.SpeakerLowIcon, { weight: "light", ...props });
|
|
3437
3437
|
|
|
3438
3438
|
// src/components/TrackControls/VolumeUpIcon.tsx
|
|
3439
|
-
var
|
|
3439
|
+
var import_SpeakerHigh = require("@phosphor-icons/react/dist/csr/SpeakerHigh");
|
|
3440
3440
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3441
|
-
var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3441
|
+
var VolumeUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_SpeakerHigh.SpeakerHighIcon, { weight: "light", ...props });
|
|
3442
3442
|
|
|
3443
3443
|
// src/components/TrackControls/TrashIcon.tsx
|
|
3444
|
-
var
|
|
3444
|
+
var import_Trash = require("@phosphor-icons/react/dist/csr/Trash");
|
|
3445
3445
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3446
|
-
var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3446
|
+
var TrashIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_Trash.TrashIcon, { weight: "light", ...props });
|
|
3447
3447
|
|
|
3448
3448
|
// src/components/TrackControls/DotsIcon.tsx
|
|
3449
|
-
var
|
|
3449
|
+
var import_DotsThree = require("@phosphor-icons/react/dist/csr/DotsThree");
|
|
3450
3450
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3451
|
-
var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3451
|
+
var DotsIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_DotsThree.DotsThreeIcon, { weight: "bold", ...props });
|
|
3452
3452
|
|
|
3453
3453
|
// src/components/TrackControls/GripIcon.tsx
|
|
3454
|
-
var
|
|
3454
|
+
var import_DotsSixVertical = require("@phosphor-icons/react/dist/csr/DotsSixVertical");
|
|
3455
3455
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3456
|
-
var GripIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3456
|
+
var GripIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_DotsSixVertical.DotsSixVerticalIcon, { weight: "bold", ...props });
|
|
3457
3457
|
|
|
3458
3458
|
// src/components/TrackControls/MoveUpIcon.tsx
|
|
3459
|
-
var
|
|
3459
|
+
var import_CaretUp = require("@phosphor-icons/react/dist/csr/CaretUp");
|
|
3460
3460
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3461
|
-
var MoveUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3461
|
+
var MoveUpIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_CaretUp.CaretUpIcon, { weight: "bold", ...props });
|
|
3462
3462
|
|
|
3463
3463
|
// src/components/TrackControls/MoveDownIcon.tsx
|
|
3464
|
-
var
|
|
3464
|
+
var import_CaretDown = require("@phosphor-icons/react/dist/csr/CaretDown");
|
|
3465
3465
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3466
|
-
var MoveDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3466
|
+
var MoveDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_CaretDown.CaretDownIcon, { weight: "bold", ...props });
|
|
3467
3467
|
|
|
3468
3468
|
// src/components/TrackControls/ReorderRail.tsx
|
|
3469
3469
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
@@ -3623,7 +3623,7 @@ var SliderWrapper = import_styled_components35.default.label`
|
|
|
3623
3623
|
`;
|
|
3624
3624
|
|
|
3625
3625
|
// src/components/TrackMenu.tsx
|
|
3626
|
-
var
|
|
3626
|
+
var import_react25 = __toESM(require("react"));
|
|
3627
3627
|
var import_react_dom = require("react-dom");
|
|
3628
3628
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
3629
3629
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
@@ -3666,13 +3666,13 @@ var Divider = import_styled_components36.default.hr`
|
|
|
3666
3666
|
margin: 0.35rem 0;
|
|
3667
3667
|
`;
|
|
3668
3668
|
var TrackMenu = ({ items: itemsProp }) => {
|
|
3669
|
-
const [open, setOpen] = (0,
|
|
3670
|
-
const close = (0,
|
|
3669
|
+
const [open, setOpen] = (0, import_react25.useState)(false);
|
|
3670
|
+
const close = (0, import_react25.useCallback)(() => setOpen(false), []);
|
|
3671
3671
|
const items = typeof itemsProp === "function" ? itemsProp(close) : itemsProp;
|
|
3672
|
-
const [dropdownPos, setDropdownPos] = (0,
|
|
3673
|
-
const buttonRef = (0,
|
|
3674
|
-
const dropdownRef = (0,
|
|
3675
|
-
const updatePosition = (0,
|
|
3672
|
+
const [dropdownPos, setDropdownPos] = (0, import_react25.useState)({ top: 0, left: 0 });
|
|
3673
|
+
const buttonRef = (0, import_react25.useRef)(null);
|
|
3674
|
+
const dropdownRef = (0, import_react25.useRef)(null);
|
|
3675
|
+
const updatePosition = (0, import_react25.useCallback)(() => {
|
|
3676
3676
|
if (!buttonRef.current) return;
|
|
3677
3677
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
3678
3678
|
const vw = window.innerWidth;
|
|
@@ -3689,7 +3689,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3689
3689
|
}
|
|
3690
3690
|
setDropdownPos((prev) => prev.top === top && prev.left === left ? prev : { top, left });
|
|
3691
3691
|
}, []);
|
|
3692
|
-
(0,
|
|
3692
|
+
(0, import_react25.useEffect)(() => {
|
|
3693
3693
|
if (!open) return;
|
|
3694
3694
|
updatePosition();
|
|
3695
3695
|
let frameId = null;
|
|
@@ -3710,7 +3710,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3710
3710
|
window.removeEventListener("resize", scheduleUpdate);
|
|
3711
3711
|
};
|
|
3712
3712
|
}, [open, updatePosition]);
|
|
3713
|
-
(0,
|
|
3713
|
+
(0, import_react25.useEffect)(() => {
|
|
3714
3714
|
if (!open) return;
|
|
3715
3715
|
const handleClick = (e) => {
|
|
3716
3716
|
const target = e.target;
|
|
@@ -3753,7 +3753,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3753
3753
|
$top: dropdownPos.top,
|
|
3754
3754
|
$left: dropdownPos.left,
|
|
3755
3755
|
onMouseDown: (e) => e.stopPropagation(),
|
|
3756
|
-
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3756
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react25.default.Fragment, { children: [
|
|
3757
3757
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Divider, {}),
|
|
3758
3758
|
item.content
|
|
3759
3759
|
] }, item.id))
|
|
@@ -3765,7 +3765,7 @@ var TrackMenu = ({ items: itemsProp }) => {
|
|
|
3765
3765
|
};
|
|
3766
3766
|
|
|
3767
3767
|
// src/components/SegmentedVUMeter.tsx
|
|
3768
|
-
var
|
|
3768
|
+
var import_react26 = __toESM(require("react"));
|
|
3769
3769
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
3770
3770
|
var import_core8 = require("@waveform-playlist/core");
|
|
3771
3771
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
@@ -3924,15 +3924,15 @@ var SegmentedVUMeterInner = ({
|
|
|
3924
3924
|
labelColor,
|
|
3925
3925
|
className
|
|
3926
3926
|
}) => {
|
|
3927
|
-
const subscribeToMeter = (0,
|
|
3927
|
+
const subscribeToMeter = (0, import_react26.useCallback)(
|
|
3928
3928
|
(onChange) => meter ? meter.subscribe(onChange) : subscribeToNothing(),
|
|
3929
3929
|
[meter]
|
|
3930
3930
|
);
|
|
3931
|
-
const getMeterChannelCount = (0,
|
|
3931
|
+
const getMeterChannelCount = (0, import_react26.useCallback)(
|
|
3932
3932
|
() => meter ? meter.getSnapshot().levels.length : NO_METER,
|
|
3933
3933
|
[meter]
|
|
3934
3934
|
);
|
|
3935
|
-
const meterChannelCount = (0,
|
|
3935
|
+
const meterChannelCount = (0, import_react26.useSyncExternalStore)(
|
|
3936
3936
|
subscribeToMeter,
|
|
3937
3937
|
getMeterChannelCount,
|
|
3938
3938
|
getMeterChannelCount
|
|
@@ -3940,8 +3940,8 @@ var SegmentedVUMeterInner = ({
|
|
|
3940
3940
|
const meterSnapshot = meter ? meter.getSnapshot() : null;
|
|
3941
3941
|
const levels = meterSnapshot ? meterSnapshot.levels : levelsProp ?? NO_LEVELS;
|
|
3942
3942
|
const peakLevels = meterSnapshot ? meterSnapshot.peakLevels : peakLevelsProp;
|
|
3943
|
-
const containerRef = (0,
|
|
3944
|
-
const redrawRef = (0,
|
|
3943
|
+
const containerRef = (0, import_react26.useRef)(null);
|
|
3944
|
+
const redrawRef = (0, import_react26.useRef)(null);
|
|
3945
3945
|
const sourceKey = meter ? "meter" : "props";
|
|
3946
3946
|
const channelCount = meter ? meterChannelCount : levels.length;
|
|
3947
3947
|
const labels = channelLabels ?? getDefaultLabels(channelCount);
|
|
@@ -3954,11 +3954,11 @@ var SegmentedVUMeterInner = ({
|
|
|
3954
3954
|
const isMultiChannel = channelCount >= 2;
|
|
3955
3955
|
const segmentTotalHeight = segmentHeight + segmentGap;
|
|
3956
3956
|
const [dBMin, dBMax] = dBRange;
|
|
3957
|
-
const thresholds = (0,
|
|
3957
|
+
const thresholds = (0, import_react26.useMemo)(
|
|
3958
3958
|
() => computeThresholds(segmentCount, [dBMin, dBMax]),
|
|
3959
3959
|
[segmentCount, dBMin, dBMax]
|
|
3960
3960
|
);
|
|
3961
|
-
const scaleLabels = (0,
|
|
3961
|
+
const scaleLabels = (0, import_react26.useMemo)(() => {
|
|
3962
3962
|
const totalSize = segmentCount * segmentTotalHeight - segmentGap;
|
|
3963
3963
|
const minDb = dBMin;
|
|
3964
3964
|
const maxDb = dBMax;
|
|
@@ -3978,15 +3978,15 @@ var SegmentedVUMeterInner = ({
|
|
|
3978
3978
|
}
|
|
3979
3979
|
return labels2;
|
|
3980
3980
|
}, [orientation, segmentCount, segmentTotalHeight, segmentGap, dBMin, dBMax]);
|
|
3981
|
-
const renderThresholds = (0,
|
|
3981
|
+
const renderThresholds = (0, import_react26.useMemo)(
|
|
3982
3982
|
() => orientation === "horizontal" ? [...thresholds].reverse() : thresholds,
|
|
3983
3983
|
[thresholds, orientation]
|
|
3984
3984
|
);
|
|
3985
|
-
const segmentColors = (0,
|
|
3985
|
+
const segmentColors = (0, import_react26.useMemo)(
|
|
3986
3986
|
() => renderThresholds.map((threshold) => getColorForDb(threshold, colorStops)),
|
|
3987
3987
|
[renderThresholds, colorStops]
|
|
3988
3988
|
);
|
|
3989
|
-
(0,
|
|
3989
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
3990
3990
|
const container = containerRef.current;
|
|
3991
3991
|
if (!meter || !container) return;
|
|
3992
3992
|
const channels = Array.from(container.querySelectorAll("[data-channel]")).map(
|
|
@@ -4024,7 +4024,7 @@ var SegmentedVUMeterInner = ({
|
|
|
4024
4024
|
redrawRef.current = null;
|
|
4025
4025
|
};
|
|
4026
4026
|
}, [meter, channelCount, renderThresholds, segmentColors, coloredInactive, orientation]);
|
|
4027
|
-
(0,
|
|
4027
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
4028
4028
|
redrawRef.current?.();
|
|
4029
4029
|
});
|
|
4030
4030
|
const renderChannel = (channelIndex) => {
|
|
@@ -4120,18 +4120,18 @@ var SegmentedVUMeterInner = ({
|
|
|
4120
4120
|
sourceKey
|
|
4121
4121
|
);
|
|
4122
4122
|
};
|
|
4123
|
-
var SegmentedVUMeter =
|
|
4123
|
+
var SegmentedVUMeter = import_react26.default.memo(SegmentedVUMeterInner);
|
|
4124
4124
|
|
|
4125
4125
|
// src/hooks/useThrottledValue.ts
|
|
4126
|
-
var
|
|
4126
|
+
var import_react27 = require("react");
|
|
4127
4127
|
var DEFAULT_UPDATE_RATE = 10;
|
|
4128
4128
|
function useThrottledValue(source, options = {}) {
|
|
4129
4129
|
const { updateRate = DEFAULT_UPDATE_RATE } = options;
|
|
4130
|
-
const [state, setState] = (0,
|
|
4130
|
+
const [state, setState] = (0, import_react27.useState)(() => ({
|
|
4131
4131
|
source,
|
|
4132
4132
|
value: source.getSnapshot()
|
|
4133
4133
|
}));
|
|
4134
|
-
(0,
|
|
4134
|
+
(0, import_react27.useEffect)(() => {
|
|
4135
4135
|
const interval = 1e3 / (updateRate > 0 ? updateRate : 1);
|
|
4136
4136
|
let lastUpdate = -Infinity;
|
|
4137
4137
|
let timer = null;
|