@waveform-playlist/browser 15.3.3 → 15.4.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 +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +763 -385
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +745 -367
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js +14 -6
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs +14 -9
- package/dist/tone.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -107,6 +107,7 @@ __export(index_exports, {
|
|
|
107
107
|
SkipBackwardButton: () => SkipBackwardButton,
|
|
108
108
|
SkipForwardButton: () => SkipForwardButton,
|
|
109
109
|
SnapToGridModifier: () => SnapToGridModifier,
|
|
110
|
+
SortableTrackControls: () => SortableTrackControls,
|
|
110
111
|
SpectrogramIntegrationProvider: () => SpectrogramIntegrationProvider,
|
|
111
112
|
StopButton: () => StopButton,
|
|
112
113
|
TimeFormatSelect: () => TimeFormatSelect,
|
|
@@ -670,7 +671,7 @@ function useClipDragHandlers({
|
|
|
670
671
|
(event) => {
|
|
671
672
|
var _a;
|
|
672
673
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
673
|
-
if (!data) return;
|
|
674
|
+
if (!data || data.kind === "track-reorder") return;
|
|
674
675
|
if (!data.boundary) {
|
|
675
676
|
originalClipStateRef.current = null;
|
|
676
677
|
if (engineRef.current) {
|
|
@@ -706,7 +707,7 @@ function useClipDragHandlers({
|
|
|
706
707
|
(event) => {
|
|
707
708
|
var _a, _b, _c;
|
|
708
709
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
709
|
-
if (!data) return;
|
|
710
|
+
if (!data || data.kind === "track-reorder") return;
|
|
710
711
|
if (!data.boundary) return;
|
|
711
712
|
if (!originalClipStateRef.current) return;
|
|
712
713
|
const { boundary, trackIndex, clipIndex } = data;
|
|
@@ -766,10 +767,12 @@ function useClipDragHandlers({
|
|
|
766
767
|
);
|
|
767
768
|
const onDragEnd = import_react8.default.useCallback(
|
|
768
769
|
(event) => {
|
|
769
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
770
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
771
|
+
const kindData = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
772
|
+
if ((kindData == null ? void 0 : kindData.kind) === "track-reorder") return;
|
|
770
773
|
if (event.canceled) {
|
|
771
774
|
if (originalClipStateRef.current) {
|
|
772
|
-
const cancelData = (
|
|
775
|
+
const cancelData = (_b = event.operation.source) == null ? void 0 : _b.data;
|
|
773
776
|
if (cancelData) {
|
|
774
777
|
const { trackIndex: trackIndex2, clipIndex } = cancelData;
|
|
775
778
|
const original = originalClipStateRef.current;
|
|
@@ -791,25 +794,25 @@ function useClipDragHandlers({
|
|
|
791
794
|
isDraggingRef.current = false;
|
|
792
795
|
originalClipStateRef.current = null;
|
|
793
796
|
lastBoundaryDeltaRef.current = 0;
|
|
794
|
-
(
|
|
797
|
+
(_c = engineRef.current) == null ? void 0 : _c.abortTransaction();
|
|
795
798
|
return;
|
|
796
799
|
}
|
|
797
|
-
const data = (
|
|
800
|
+
const data = (_d = event.operation.source) == null ? void 0 : _d.data;
|
|
798
801
|
if (!data) {
|
|
799
802
|
isDraggingRef.current = false;
|
|
800
|
-
(
|
|
803
|
+
(_e = engineRef.current) == null ? void 0 : _e.abortTransaction();
|
|
801
804
|
return;
|
|
802
805
|
}
|
|
803
806
|
const { trackIndex, clipId, boundary } = data;
|
|
804
807
|
const sampleDelta = boundary ? lastBoundaryDeltaRef.current : event.operation.transform.x * samplesPerPixel;
|
|
805
|
-
const trackId = (
|
|
808
|
+
const trackId = (_f = tracks[trackIndex]) == null ? void 0 : _f.id;
|
|
806
809
|
if (boundary) {
|
|
807
810
|
isDraggingRef.current = false;
|
|
808
811
|
if (!trackId) {
|
|
809
812
|
console.warn(
|
|
810
813
|
`[waveform-playlist] onDragEnd: track at index ${trackIndex} not found \u2014 trim not synced to adapter`
|
|
811
814
|
);
|
|
812
|
-
(
|
|
815
|
+
(_g = engineRef.current) == null ? void 0 : _g.abortTransaction();
|
|
813
816
|
} else if (!engineRef.current) {
|
|
814
817
|
console.warn("[waveform-playlist] engineRef is null \u2014 trim not synced to adapter");
|
|
815
818
|
} else {
|
|
@@ -824,7 +827,7 @@ function useClipDragHandlers({
|
|
|
824
827
|
console.warn(
|
|
825
828
|
`[waveform-playlist] onDragEnd: track at index ${trackIndex} not found \u2014 move not synced to adapter`
|
|
826
829
|
);
|
|
827
|
-
(
|
|
830
|
+
(_h = engineRef.current) == null ? void 0 : _h.abortTransaction();
|
|
828
831
|
} else if (!engineRef.current) {
|
|
829
832
|
console.warn("[waveform-playlist] engineRef is null \u2014 move not synced to adapter");
|
|
830
833
|
} else {
|
|
@@ -1931,6 +1934,8 @@ var WaveformPlaylistProvider = ({
|
|
|
1931
1934
|
const [linkEndpoints, setLinkEndpoints] = (0, import_react17.useState)((_b = annotationList == null ? void 0 : annotationList.linkEndpoints) != null ? _b : false);
|
|
1932
1935
|
const [annotationsEditable, setAnnotationsEditable] = (0, import_react17.useState)((_c = annotationList == null ? void 0 : annotationList.editable) != null ? _c : false);
|
|
1933
1936
|
const [isReady, setIsReady] = (0, import_react17.useState)(false);
|
|
1937
|
+
const [trackReorderEpoch, setTrackReorderEpoch] = (0, import_react17.useState)(0);
|
|
1938
|
+
const [trackDragPreview, setTrackDragPreview] = (0, import_react17.useState)(null);
|
|
1934
1939
|
const engineRef = (0, import_react17.useRef)(null);
|
|
1935
1940
|
const adapterRef = (0, import_react17.useRef)(null);
|
|
1936
1941
|
const audioInitializedRef = (0, import_react17.useRef)(false);
|
|
@@ -1968,6 +1973,7 @@ var WaveformPlaylistProvider = ({
|
|
|
1968
1973
|
const playbackStartTimeRef = (0, import_react17.useRef)(0);
|
|
1969
1974
|
const audioStartPositionRef = (0, import_react17.useRef)(0);
|
|
1970
1975
|
const playbackEndTimeRef = (0, import_react17.useRef)(null);
|
|
1976
|
+
const suppressEngineStopMirrorRef = (0, import_react17.useRef)(false);
|
|
1971
1977
|
const scrollContainerRef = (0, import_react17.useRef)(null);
|
|
1972
1978
|
const isAutomaticScrollRef = (0, import_react17.useRef)(false);
|
|
1973
1979
|
const frameCallbacksRef = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
@@ -2176,7 +2182,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2176
2182
|
const wasPlaying = isPlayingRef.current;
|
|
2177
2183
|
const resumePosition = currentTimeRef.current;
|
|
2178
2184
|
if (engineRef.current && wasPlaying) {
|
|
2185
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2179
2186
|
engineRef.current.stop();
|
|
2187
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2180
2188
|
stopAnimationFrameLoop();
|
|
2181
2189
|
pendingResumeRef.current = { position: resumePosition };
|
|
2182
2190
|
}
|
|
@@ -2267,6 +2275,19 @@ var WaveformPlaylistProvider = ({
|
|
|
2267
2275
|
if (!suppressTracksMirroring && state.tracksVersion !== lastTracksVersionRef.current) {
|
|
2268
2276
|
lastTracksVersionRef.current = state.tracksVersion;
|
|
2269
2277
|
engineTracksRef.current = state.tracks;
|
|
2278
|
+
const oldTracks = tracksRef.current;
|
|
2279
|
+
const oldStates = trackStatesRef.current;
|
|
2280
|
+
if (oldTracks.length === oldStates.length && oldTracks.length === state.tracks.length) {
|
|
2281
|
+
const idToState = new Map(oldTracks.map((t, i) => [t.id, oldStates[i]]));
|
|
2282
|
+
const reordered = state.tracks.map((t, i) => {
|
|
2283
|
+
var _a4;
|
|
2284
|
+
return (_a4 = idToState.get(t.id)) != null ? _a4 : oldStates[i];
|
|
2285
|
+
});
|
|
2286
|
+
const orderChanged = reordered.some((s, i) => s !== oldStates[i]);
|
|
2287
|
+
if (orderChanged) {
|
|
2288
|
+
setTrackStates(reordered);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2270
2291
|
if (onTracksChange) {
|
|
2271
2292
|
onTracksChange(state.tracks);
|
|
2272
2293
|
} else {
|
|
@@ -2276,6 +2297,14 @@ var WaveformPlaylistProvider = ({
|
|
|
2276
2297
|
}
|
|
2277
2298
|
}
|
|
2278
2299
|
});
|
|
2300
|
+
engine.on("stop", () => {
|
|
2301
|
+
if (suppressEngineStopMirrorRef.current) return;
|
|
2302
|
+
setIsPlaying(false);
|
|
2303
|
+
stopAnimationFrameLoop();
|
|
2304
|
+
const stoppedAt = engine.getCurrentTime();
|
|
2305
|
+
setCurrentTimeRefs(stoppedAt);
|
|
2306
|
+
setCurrentTime(stoppedAt);
|
|
2307
|
+
});
|
|
2279
2308
|
engine.setTracks(tracksWithState);
|
|
2280
2309
|
suppressTracksMirroring = false;
|
|
2281
2310
|
lastTracksVersionRef.current = engine.getState().tracksVersion;
|
|
@@ -2573,7 +2602,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2573
2602
|
if (isPlaying && animationFrameRef.current && engineRef.current) {
|
|
2574
2603
|
if (continuousPlay) {
|
|
2575
2604
|
const currentPos = currentTimeRef.current;
|
|
2605
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2576
2606
|
engineRef.current.stop();
|
|
2607
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2577
2608
|
stopAnimationLoop();
|
|
2578
2609
|
const timeNow = getAudioContextTime();
|
|
2579
2610
|
playbackStartTimeRef.current = timeNow;
|
|
@@ -2628,7 +2659,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2628
2659
|
const actualStartTime = startTime != null ? startTime : currentTimeRef.current;
|
|
2629
2660
|
playStartPositionRef.current = actualStartTime;
|
|
2630
2661
|
setCurrentTimeRefs(actualStartTime);
|
|
2662
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2631
2663
|
engineRef.current.stop();
|
|
2664
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2632
2665
|
engineRef.current.seek(actualStartTime);
|
|
2633
2666
|
stopAnimationLoop();
|
|
2634
2667
|
const startTimeNow = getAudioContextTime();
|
|
@@ -2737,13 +2770,28 @@ var WaveformPlaylistProvider = ({
|
|
|
2737
2770
|
},
|
|
2738
2771
|
[trackStates]
|
|
2739
2772
|
);
|
|
2773
|
+
const reorderTrack = (0, import_react17.useCallback)(
|
|
2774
|
+
(trackId, toIndex) => {
|
|
2775
|
+
if (!engineRef.current) {
|
|
2776
|
+
console.warn("[waveform-playlist] reorderTrack: engine not ready, call ignored");
|
|
2777
|
+
return;
|
|
2778
|
+
}
|
|
2779
|
+
engineRef.current.reorderTrack(trackId, toIndex);
|
|
2780
|
+
},
|
|
2781
|
+
[engineRef]
|
|
2782
|
+
);
|
|
2783
|
+
const bumpTrackReorderEpoch = (0, import_react17.useCallback)(() => {
|
|
2784
|
+
setTrackReorderEpoch((epoch) => epoch + 1);
|
|
2785
|
+
}, []);
|
|
2740
2786
|
const setSelection = (0, import_react17.useCallback)(
|
|
2741
2787
|
(start, end) => {
|
|
2742
2788
|
setSelectionEngine(start, end);
|
|
2743
2789
|
setCurrentTimeRefs(start);
|
|
2744
2790
|
setCurrentTime(start);
|
|
2745
2791
|
if (isPlaying && engineRef.current) {
|
|
2792
|
+
suppressEngineStopMirrorRef.current = true;
|
|
2746
2793
|
engineRef.current.stop();
|
|
2794
|
+
suppressEngineStopMirrorRef.current = false;
|
|
2747
2795
|
engineRef.current.seek(start);
|
|
2748
2796
|
engineRef.current.play(start);
|
|
2749
2797
|
}
|
|
@@ -2864,6 +2912,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2864
2912
|
setTrackSolo,
|
|
2865
2913
|
setTrackVolume,
|
|
2866
2914
|
setTrackPan,
|
|
2915
|
+
reorderTrack,
|
|
2916
|
+
bumpTrackReorderEpoch,
|
|
2917
|
+
setTrackDragPreview,
|
|
2867
2918
|
// Selection
|
|
2868
2919
|
setSelection,
|
|
2869
2920
|
setSelectedTrackId: setSelectedTrackIdControl,
|
|
@@ -2906,6 +2957,9 @@ var WaveformPlaylistProvider = ({
|
|
|
2906
2957
|
setTrackSolo,
|
|
2907
2958
|
setTrackVolume,
|
|
2908
2959
|
setTrackPan,
|
|
2960
|
+
reorderTrack,
|
|
2961
|
+
bumpTrackReorderEpoch,
|
|
2962
|
+
setTrackDragPreview,
|
|
2909
2963
|
setSelection,
|
|
2910
2964
|
setSelectedTrackIdControl,
|
|
2911
2965
|
setTimeFormat,
|
|
@@ -2953,6 +3007,8 @@ var WaveformPlaylistProvider = ({
|
|
|
2953
3007
|
roundedBars,
|
|
2954
3008
|
progressBarWidth,
|
|
2955
3009
|
isReady,
|
|
3010
|
+
trackReorderEpoch,
|
|
3011
|
+
trackDragPreview,
|
|
2956
3012
|
mono,
|
|
2957
3013
|
isDraggingRef,
|
|
2958
3014
|
onTracksChange
|
|
@@ -2979,6 +3035,8 @@ var WaveformPlaylistProvider = ({
|
|
|
2979
3035
|
roundedBars,
|
|
2980
3036
|
progressBarWidth,
|
|
2981
3037
|
isReady,
|
|
3038
|
+
trackReorderEpoch,
|
|
3039
|
+
trackDragPreview,
|
|
2982
3040
|
mono,
|
|
2983
3041
|
isDraggingRef,
|
|
2984
3042
|
onTracksChange
|
|
@@ -3738,16 +3796,147 @@ function useClipInteractionEnabled() {
|
|
|
3738
3796
|
}
|
|
3739
3797
|
|
|
3740
3798
|
// src/components/PlaylistVisualization.tsx
|
|
3741
|
-
var
|
|
3799
|
+
var import_react28 = require("react");
|
|
3742
3800
|
var import_react_dom = require("react-dom");
|
|
3743
3801
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
3744
3802
|
var import_ui_components8 = require("@waveform-playlist/ui-components");
|
|
3803
|
+
|
|
3804
|
+
// src/components/SortableTrackControls.tsx
|
|
3805
|
+
var import_react23 = require("react");
|
|
3806
|
+
var import_sortable = require("@dnd-kit/react/sortable");
|
|
3807
|
+
var import_modifiers = require("@dnd-kit/abstract/modifiers");
|
|
3808
|
+
|
|
3809
|
+
// src/utils/dragPopoverHealer.ts
|
|
3810
|
+
function createDragPopoverHealer(element) {
|
|
3811
|
+
if (typeof element.showPopover !== "function") {
|
|
3812
|
+
return () => {
|
|
3813
|
+
};
|
|
3814
|
+
}
|
|
3815
|
+
const heal = () => {
|
|
3816
|
+
if (!element.isConnected || !element.hasAttribute("popover")) return;
|
|
3817
|
+
let open = false;
|
|
3818
|
+
try {
|
|
3819
|
+
open = element.matches(":popover-open");
|
|
3820
|
+
} catch (e) {
|
|
3821
|
+
}
|
|
3822
|
+
if (open) return;
|
|
3823
|
+
try {
|
|
3824
|
+
element.showPopover();
|
|
3825
|
+
} catch (e) {
|
|
3826
|
+
}
|
|
3827
|
+
};
|
|
3828
|
+
const observer = new MutationObserver(heal);
|
|
3829
|
+
observer.observe(element.ownerDocument.body, {
|
|
3830
|
+
childList: true,
|
|
3831
|
+
subtree: true
|
|
3832
|
+
});
|
|
3833
|
+
return () => observer.disconnect();
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
// src/components/SortableTrackControls.tsx
|
|
3837
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3838
|
+
var SortableTrackControls = ({
|
|
3839
|
+
trackId,
|
|
3840
|
+
index,
|
|
3841
|
+
disabled = false,
|
|
3842
|
+
children
|
|
3843
|
+
}) => {
|
|
3844
|
+
const { ref, handleRef, isDragSource } = (0, import_sortable.useSortable)({
|
|
3845
|
+
id: `track-reorder-${trackId}`,
|
|
3846
|
+
index,
|
|
3847
|
+
group: "playlist-tracks",
|
|
3848
|
+
type: "track",
|
|
3849
|
+
accept: ["track"],
|
|
3850
|
+
data: { kind: "track-reorder", trackId },
|
|
3851
|
+
modifiers: [import_modifiers.RestrictToVerticalAxis],
|
|
3852
|
+
disabled,
|
|
3853
|
+
// feedback: 'move' (NOT 'none' — see below) disables the Feedback
|
|
3854
|
+
// plugin's placeholder/clone splicing for this sortable while KEEPING its
|
|
3855
|
+
// dragOperation.shape computation alive. That plugin does raw,
|
|
3856
|
+
// React-bypassing DOM surgery on ANY pointer movement during an activated
|
|
3857
|
+
// drag (insertAdjacentElement to splice in a placeholder, then
|
|
3858
|
+
// `placeholder.replaceWith(element)` on drop) — confirmed via
|
|
3859
|
+
// MutationObserver instrumentation to relocate the React-owned row 6
|
|
3860
|
+
// times during a single one-slot drag, leaving its final parent/sibling
|
|
3861
|
+
// different from what React's fiber tree still believes. That desync is
|
|
3862
|
+
// permanent for the session: every later React-driven reorder (button OR
|
|
3863
|
+
// drag) computes the correct data but silently fails to update the DOM
|
|
3864
|
+
// for these rows. The placeholder splice is created only when
|
|
3865
|
+
// `feedback !== 'move'` (@dnd-kit/dom Feedback.ts) — 'move' keeps the
|
|
3866
|
+
// dragged element in the live DOM (no clone/placeholder) while still
|
|
3867
|
+
// running the *unconditional* `dragOperation.shape = ...` assignment.
|
|
3868
|
+
// `feedback: 'none'` looked like the boundary-trim precedent (Clip.tsx /
|
|
3869
|
+
// AnnotationBox.tsx) but is wrong here: 'none' bails out of Feedback's
|
|
3870
|
+
// render function BEFORE dragOperation.shape is ever set, and shape is
|
|
3871
|
+
// the ONLY input CollisionObserver.computeCollisions() checks — with
|
|
3872
|
+
// 'none', collision (and therefore sortable.index) never updates, so
|
|
3873
|
+
// drag-based reordering silently never commits. Boundary trims don't hit
|
|
3874
|
+
// this because they're plain useDraggable (no collision-based commit) —
|
|
3875
|
+
// sortables need shape. `isDragSource` (box-shadow lift feedback below)
|
|
3876
|
+
// is a reactive signal, unaffected either way. See browser/CLAUDE.md
|
|
3877
|
+
// "Track Reordering".
|
|
3878
|
+
feedback: "move"
|
|
3879
|
+
});
|
|
3880
|
+
const elementRef = (0, import_react23.useRef)(null);
|
|
3881
|
+
const composedRef = (0, import_react23.useCallback)(
|
|
3882
|
+
(element) => {
|
|
3883
|
+
elementRef.current = element instanceof HTMLElement ? element : null;
|
|
3884
|
+
ref(element);
|
|
3885
|
+
},
|
|
3886
|
+
[ref]
|
|
3887
|
+
);
|
|
3888
|
+
(0, import_react23.useEffect)(() => {
|
|
3889
|
+
if (!isDragSource || !elementRef.current) return void 0;
|
|
3890
|
+
return createDragPopoverHealer(elementRef.current);
|
|
3891
|
+
}, [isDragSource]);
|
|
3892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: children({ ref: composedRef, handleRef, isDragSource }) });
|
|
3893
|
+
};
|
|
3894
|
+
|
|
3895
|
+
// src/utils/trackOrderPreview.ts
|
|
3896
|
+
function applyTrackOrderPreview(tracks, preview) {
|
|
3897
|
+
if (!preview) return tracks;
|
|
3898
|
+
const fromIndex = tracks.findIndex((t) => t.id === preview.trackId);
|
|
3899
|
+
if (fromIndex === -1) return tracks;
|
|
3900
|
+
const toIndex = Math.max(0, Math.min(tracks.length - 1, preview.toIndex));
|
|
3901
|
+
if (toIndex === fromIndex) return tracks;
|
|
3902
|
+
const next = tracks.slice();
|
|
3903
|
+
const [moved] = next.splice(fromIndex, 1);
|
|
3904
|
+
next.splice(toIndex, 0, moved);
|
|
3905
|
+
return next;
|
|
3906
|
+
}
|
|
3907
|
+
function computeTrackLayout(orderedIds, heightById) {
|
|
3908
|
+
var _a;
|
|
3909
|
+
const topById = /* @__PURE__ */ new Map();
|
|
3910
|
+
let top = 0;
|
|
3911
|
+
for (const id of orderedIds) {
|
|
3912
|
+
topById.set(id, top);
|
|
3913
|
+
top += (_a = heightById.get(id)) != null ? _a : 0;
|
|
3914
|
+
}
|
|
3915
|
+
return { topById, totalHeight: top };
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
// src/hooks/useTrailingActive.ts
|
|
3919
|
+
var import_react24 = require("react");
|
|
3920
|
+
function useTrailingActive(active, trailingMs) {
|
|
3921
|
+
const [trailing, setTrailing] = (0, import_react24.useState)(active);
|
|
3922
|
+
(0, import_react24.useEffect)(() => {
|
|
3923
|
+
if (active) {
|
|
3924
|
+
setTrailing(true);
|
|
3925
|
+
return void 0;
|
|
3926
|
+
}
|
|
3927
|
+
const timer = setTimeout(() => setTrailing(false), trailingMs);
|
|
3928
|
+
return () => clearTimeout(timer);
|
|
3929
|
+
}, [active, trailingMs]);
|
|
3930
|
+
return trailing || active;
|
|
3931
|
+
}
|
|
3932
|
+
|
|
3933
|
+
// src/components/PlaylistVisualization.tsx
|
|
3745
3934
|
var import_core4 = require("@waveform-playlist/core");
|
|
3746
3935
|
|
|
3747
3936
|
// src/components/AnimatedPlayhead.tsx
|
|
3748
|
-
var
|
|
3937
|
+
var import_react25 = require("react");
|
|
3749
3938
|
var import_styled_components4 = __toESM(require("styled-components"));
|
|
3750
|
-
var
|
|
3939
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3751
3940
|
var PlayheadLine = import_styled_components4.default.div.attrs((props) => ({
|
|
3752
3941
|
style: {
|
|
3753
3942
|
width: `${props.$width}px`,
|
|
@@ -3763,7 +3952,7 @@ var PlayheadLine = import_styled_components4.default.div.attrs((props) => ({
|
|
|
3763
3952
|
will-change: transform;
|
|
3764
3953
|
`;
|
|
3765
3954
|
var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
3766
|
-
const playheadRef = (0,
|
|
3955
|
+
const playheadRef = (0, import_react25.useRef)(null);
|
|
3767
3956
|
const {
|
|
3768
3957
|
isPlaying,
|
|
3769
3958
|
currentTimeRef,
|
|
@@ -3772,7 +3961,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
3772
3961
|
unregisterFrameCallback
|
|
3773
3962
|
} = usePlaybackAnimation();
|
|
3774
3963
|
const { samplesPerPixel, sampleRate, progressBarWidth } = usePlaylistData();
|
|
3775
|
-
(0,
|
|
3964
|
+
(0, import_react25.useEffect)(() => {
|
|
3776
3965
|
const id = "playhead";
|
|
3777
3966
|
if (isPlaying) {
|
|
3778
3967
|
registerFrameCallback(id, ({ visualTime, sampleRate: sr, samplesPerPixel: spp }) => {
|
|
@@ -3784,7 +3973,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
3784
3973
|
}
|
|
3785
3974
|
return () => unregisterFrameCallback(id);
|
|
3786
3975
|
}, [isPlaying, registerFrameCallback, unregisterFrameCallback]);
|
|
3787
|
-
(0,
|
|
3976
|
+
(0, import_react25.useEffect)(() => {
|
|
3788
3977
|
var _a, _b;
|
|
3789
3978
|
if (!isPlaying && playheadRef.current) {
|
|
3790
3979
|
const time = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
|
|
@@ -3792,15 +3981,15 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
3792
3981
|
playheadRef.current.style.transform = `translate3d(${position}px, 0, 0)`;
|
|
3793
3982
|
}
|
|
3794
3983
|
});
|
|
3795
|
-
return /* @__PURE__ */ (0,
|
|
3984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PlayheadLine, { ref: playheadRef, $color: color, $width: progressBarWidth, "data-playhead": true });
|
|
3796
3985
|
};
|
|
3797
3986
|
|
|
3798
3987
|
// src/components/ChannelWithProgress.tsx
|
|
3799
|
-
var
|
|
3988
|
+
var import_react26 = require("react");
|
|
3800
3989
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
3801
3990
|
var import_core3 = require("@waveform-playlist/core");
|
|
3802
3991
|
var import_ui_components7 = require("@waveform-playlist/ui-components");
|
|
3803
|
-
var
|
|
3992
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3804
3993
|
var ChannelWrapper = import_styled_components5.default.div`
|
|
3805
3994
|
position: relative;
|
|
3806
3995
|
`;
|
|
@@ -3854,8 +4043,8 @@ var ChannelWithProgress = (_a) => {
|
|
|
3854
4043
|
"clipSampleRate",
|
|
3855
4044
|
"clipOffsetSeconds"
|
|
3856
4045
|
]);
|
|
3857
|
-
const progressRef = (0,
|
|
3858
|
-
const callbackId = (0,
|
|
4046
|
+
const progressRef = (0, import_react26.useRef)(null);
|
|
4047
|
+
const callbackId = (0, import_react26.useId)();
|
|
3859
4048
|
const theme = (0, import_ui_components7.useTheme)();
|
|
3860
4049
|
const { waveHeight } = (0, import_ui_components7.usePlaylistInfo)();
|
|
3861
4050
|
const {
|
|
@@ -3872,7 +4061,7 @@ var ChannelWithProgress = (_a) => {
|
|
|
3872
4061
|
clipDurationSamples,
|
|
3873
4062
|
samplesPerPixel
|
|
3874
4063
|
);
|
|
3875
|
-
(0,
|
|
4064
|
+
(0, import_react26.useEffect)(() => {
|
|
3876
4065
|
if (isPlaying) {
|
|
3877
4066
|
registerFrameCallback(callbackId, ({ visualTime, sampleRate: sr }) => {
|
|
3878
4067
|
if (progressRef.current) {
|
|
@@ -3900,7 +4089,7 @@ var ChannelWithProgress = (_a) => {
|
|
|
3900
4089
|
registerFrameCallback,
|
|
3901
4090
|
unregisterFrameCallback
|
|
3902
4091
|
]);
|
|
3903
|
-
(0,
|
|
4092
|
+
(0, import_react26.useEffect)(() => {
|
|
3904
4093
|
var _a2, _b2;
|
|
3905
4094
|
if (!isPlaying && progressRef.current) {
|
|
3906
4095
|
const currentTime = (_b2 = (_a2 = visualTimeRef.current) != null ? _a2 : currentTimeRef.current) != null ? _b2 : 0;
|
|
@@ -3933,9 +4122,9 @@ var ChannelWithProgress = (_a) => {
|
|
|
3933
4122
|
const effectiveHeight = waveHeight;
|
|
3934
4123
|
const effectiveTop = isBothMode ? smartChannelProps.index * waveHeight : smartChannelProps.index * waveHeight;
|
|
3935
4124
|
const waveformBackgroundCss = (0, import_ui_components7.waveformColorToCss)(backgroundColor);
|
|
3936
|
-
return /* @__PURE__ */ (0,
|
|
3937
|
-
isBothMode ? /* @__PURE__ */ (0,
|
|
3938
|
-
/* @__PURE__ */ (0,
|
|
4125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ChannelWrapper, { children: [
|
|
4126
|
+
isBothMode ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3939
4128
|
Background,
|
|
3940
4129
|
{
|
|
3941
4130
|
$color: "#000",
|
|
@@ -3944,7 +4133,7 @@ var ChannelWithProgress = (_a) => {
|
|
|
3944
4133
|
$width: smartChannelProps.length
|
|
3945
4134
|
}
|
|
3946
4135
|
),
|
|
3947
|
-
/* @__PURE__ */ (0,
|
|
4136
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3948
4137
|
Background,
|
|
3949
4138
|
{
|
|
3950
4139
|
$color: waveformBackgroundCss,
|
|
@@ -3953,7 +4142,7 @@ var ChannelWithProgress = (_a) => {
|
|
|
3953
4142
|
$width: smartChannelProps.length
|
|
3954
4143
|
}
|
|
3955
4144
|
)
|
|
3956
|
-
] }) : /* @__PURE__ */ (0,
|
|
4145
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3957
4146
|
Background,
|
|
3958
4147
|
{
|
|
3959
4148
|
$color: backgroundCss,
|
|
@@ -3962,7 +4151,7 @@ var ChannelWithProgress = (_a) => {
|
|
|
3962
4151
|
$width: smartChannelProps.length
|
|
3963
4152
|
}
|
|
3964
4153
|
),
|
|
3965
|
-
!isPianoRollMode && /* @__PURE__ */ (0,
|
|
4154
|
+
!isPianoRollMode && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3966
4155
|
ProgressOverlay,
|
|
3967
4156
|
{
|
|
3968
4157
|
ref: progressRef,
|
|
@@ -3972,7 +4161,7 @@ var ChannelWithProgress = (_a) => {
|
|
|
3972
4161
|
$width: clipPixelWidth
|
|
3973
4162
|
}
|
|
3974
4163
|
),
|
|
3975
|
-
/* @__PURE__ */ (0,
|
|
4164
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChannelContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3976
4165
|
import_ui_components7.SmartChannel,
|
|
3977
4166
|
__spreadProps(__spreadValues({}, smartChannelProps), {
|
|
3978
4167
|
transparentBackground: true,
|
|
@@ -3985,11 +4174,11 @@ var ChannelWithProgress = (_a) => {
|
|
|
3985
4174
|
};
|
|
3986
4175
|
|
|
3987
4176
|
// src/SpectrogramIntegrationContext.tsx
|
|
3988
|
-
var
|
|
3989
|
-
var SpectrogramIntegrationContext = (0,
|
|
4177
|
+
var import_react27 = require("react");
|
|
4178
|
+
var SpectrogramIntegrationContext = (0, import_react27.createContext)(null);
|
|
3990
4179
|
var SpectrogramIntegrationProvider = SpectrogramIntegrationContext.Provider;
|
|
3991
4180
|
function useSpectrogramIntegration() {
|
|
3992
|
-
const context = (0,
|
|
4181
|
+
const context = (0, import_react27.useContext)(SpectrogramIntegrationContext);
|
|
3993
4182
|
if (!context) {
|
|
3994
4183
|
throw new Error(
|
|
3995
4184
|
"useSpectrogramIntegration must be used within <SpectrogramProvider>. Install @waveform-playlist/spectrogram and wrap your app with <SpectrogramProvider>."
|
|
@@ -3999,15 +4188,42 @@ function useSpectrogramIntegration() {
|
|
|
3999
4188
|
}
|
|
4000
4189
|
|
|
4001
4190
|
// src/components/PlaylistVisualization.tsx
|
|
4002
|
-
var
|
|
4191
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4003
4192
|
var DEFAULT_EMPTY_TRACK_DURATION = 60;
|
|
4004
|
-
var
|
|
4193
|
+
var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
|
|
4194
|
+
var TracksLayout = import_styled_components6.default.div.attrs((props) => ({
|
|
4005
4195
|
style: { height: `${props.$height}px` }
|
|
4006
4196
|
}))`
|
|
4197
|
+
position: relative;
|
|
4198
|
+
`;
|
|
4199
|
+
var TrackRowPositioner = import_styled_components6.default.div.attrs((props) => ({
|
|
4200
|
+
style: { top: `${props.$top}px` }
|
|
4201
|
+
}))`
|
|
4202
|
+
position: absolute;
|
|
4203
|
+
left: 0;
|
|
4204
|
+
right: 0;
|
|
4205
|
+
${(props) => props.$animate && "transition: top 150ms ease;"}
|
|
4206
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4207
|
+
transition: none;
|
|
4208
|
+
}
|
|
4209
|
+
`;
|
|
4210
|
+
var ControlSlot = import_styled_components6.default.div.attrs((props) => ({
|
|
4211
|
+
style: {
|
|
4212
|
+
height: `${props.$height}px`,
|
|
4213
|
+
top: `${props.$top}px`
|
|
4214
|
+
}
|
|
4215
|
+
}))`
|
|
4216
|
+
position: absolute;
|
|
4217
|
+
left: 0;
|
|
4218
|
+
right: 0;
|
|
4007
4219
|
overflow: hidden;
|
|
4008
4220
|
pointer-events: auto;
|
|
4009
4221
|
background: ${(props) => props.theme.surfaceColor};
|
|
4010
4222
|
transition: background 0.15s ease-in-out;
|
|
4223
|
+
${(props) => props.$animate && "transition: top 150ms ease, background 0.15s ease-in-out;"}
|
|
4224
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4225
|
+
transition: background 0.15s ease-in-out;
|
|
4226
|
+
}
|
|
4011
4227
|
${(props) => props.$isSelected && `background: ${props.theme.selectedTrackControlsBackground};`}
|
|
4012
4228
|
`;
|
|
4013
4229
|
var CustomPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) => {
|
|
@@ -4042,6 +4258,133 @@ function getTrackChannelCount(trackClipPeaks, recordingState, trackId, mono) {
|
|
|
4042
4258
|
const recordingChannels = (recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === trackId ? mono ? 1 : recordingState.peaks.length : 0;
|
|
4043
4259
|
return Math.max(clipChannels, recordingChannels);
|
|
4044
4260
|
}
|
|
4261
|
+
function DefaultTrackControls({
|
|
4262
|
+
trackIndex,
|
|
4263
|
+
track,
|
|
4264
|
+
trackState,
|
|
4265
|
+
effectiveRenderMode,
|
|
4266
|
+
selectTrack,
|
|
4267
|
+
onRemoveTrack,
|
|
4268
|
+
setTrackMute,
|
|
4269
|
+
setTrackSolo,
|
|
4270
|
+
setTrackVolume,
|
|
4271
|
+
setTrackPan,
|
|
4272
|
+
spectrogram,
|
|
4273
|
+
setSettingsModalTrackId,
|
|
4274
|
+
trackReordering,
|
|
4275
|
+
reorderTrack,
|
|
4276
|
+
trackCount,
|
|
4277
|
+
gripRef
|
|
4278
|
+
}) {
|
|
4279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
4280
|
+
import_ui_components8.Controls,
|
|
4281
|
+
{
|
|
4282
|
+
onClick: () => selectTrack(trackIndex),
|
|
4283
|
+
style: trackReordering ? { position: "relative", paddingLeft: 18, paddingRight: 18 } : void 0,
|
|
4284
|
+
children: [
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ui_components8.Header, { style: { justifyContent: "center", position: "relative" }, children: [
|
|
4286
|
+
onRemoveTrack && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4287
|
+
import_ui_components8.CloseButton,
|
|
4288
|
+
{
|
|
4289
|
+
onClick: (e) => {
|
|
4290
|
+
e.stopPropagation();
|
|
4291
|
+
onRemoveTrack(trackIndex);
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
),
|
|
4295
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4296
|
+
"span",
|
|
4297
|
+
{
|
|
4298
|
+
style: {
|
|
4299
|
+
overflow: "hidden",
|
|
4300
|
+
textOverflow: "ellipsis",
|
|
4301
|
+
whiteSpace: "nowrap",
|
|
4302
|
+
padding: "0 24px",
|
|
4303
|
+
display: "block"
|
|
4304
|
+
},
|
|
4305
|
+
children: trackState.name || `Track ${trackIndex + 1}`
|
|
4306
|
+
}
|
|
4307
|
+
),
|
|
4308
|
+
(spectrogram == null ? void 0 : spectrogram.renderMenuItems) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { position: "absolute", right: 0, top: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4309
|
+
import_ui_components8.TrackMenu,
|
|
4310
|
+
{
|
|
4311
|
+
items: (onClose) => spectrogram.renderMenuItems({
|
|
4312
|
+
renderMode: effectiveRenderMode,
|
|
4313
|
+
onRenderModeChange: (mode) => spectrogram.setTrackRenderMode(track.id, mode),
|
|
4314
|
+
onOpenSettings: () => setSettingsModalTrackId(track.id),
|
|
4315
|
+
onClose
|
|
4316
|
+
})
|
|
4317
|
+
}
|
|
4318
|
+
) })
|
|
4319
|
+
] }),
|
|
4320
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ui_components8.ButtonGroup, { children: [
|
|
4321
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4322
|
+
import_ui_components8.Button,
|
|
4323
|
+
{
|
|
4324
|
+
$variant: trackState.muted ? "danger" : "outline",
|
|
4325
|
+
onClick: () => setTrackMute(trackIndex, !trackState.muted),
|
|
4326
|
+
children: "Mute"
|
|
4327
|
+
}
|
|
4328
|
+
),
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4330
|
+
import_ui_components8.Button,
|
|
4331
|
+
{
|
|
4332
|
+
$variant: trackState.soloed ? "info" : "outline",
|
|
4333
|
+
onClick: () => setTrackSolo(trackIndex, !trackState.soloed),
|
|
4334
|
+
children: "Solo"
|
|
4335
|
+
}
|
|
4336
|
+
)
|
|
4337
|
+
] }),
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ui_components8.VolumeDownIcon, {}),
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4341
|
+
import_ui_components8.Slider,
|
|
4342
|
+
{
|
|
4343
|
+
min: "0",
|
|
4344
|
+
max: "1",
|
|
4345
|
+
step: "0.01",
|
|
4346
|
+
value: trackState.volume,
|
|
4347
|
+
onChange: (e) => setTrackVolume(trackIndex, parseFloat(e.target.value))
|
|
4348
|
+
}
|
|
4349
|
+
),
|
|
4350
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ui_components8.VolumeUpIcon, {})
|
|
4351
|
+
] }),
|
|
4352
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
4353
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "L" }),
|
|
4354
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4355
|
+
import_ui_components8.Slider,
|
|
4356
|
+
{
|
|
4357
|
+
min: "-1",
|
|
4358
|
+
max: "1",
|
|
4359
|
+
step: "0.01",
|
|
4360
|
+
value: trackState.pan,
|
|
4361
|
+
onChange: (e) => setTrackPan(trackIndex, parseFloat(e.target.value))
|
|
4362
|
+
}
|
|
4363
|
+
),
|
|
4364
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "R" })
|
|
4365
|
+
] }),
|
|
4366
|
+
trackReordering && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4367
|
+
import_ui_components8.ReorderRail,
|
|
4368
|
+
{
|
|
4369
|
+
style: { position: "absolute", right: 2, top: "50%", transform: "translateY(-50%)" },
|
|
4370
|
+
gripRef,
|
|
4371
|
+
onGripClick: (e) => e.stopPropagation(),
|
|
4372
|
+
upDisabled: trackIndex === 0,
|
|
4373
|
+
downDisabled: trackIndex === trackCount - 1,
|
|
4374
|
+
onMoveUp: (e) => {
|
|
4375
|
+
e.stopPropagation();
|
|
4376
|
+
reorderTrack(track.id, trackIndex - 1);
|
|
4377
|
+
},
|
|
4378
|
+
onMoveDown: (e) => {
|
|
4379
|
+
e.stopPropagation();
|
|
4380
|
+
reorderTrack(track.id, trackIndex + 1);
|
|
4381
|
+
}
|
|
4382
|
+
}
|
|
4383
|
+
)
|
|
4384
|
+
]
|
|
4385
|
+
}
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4045
4388
|
var PlaylistVisualization = ({
|
|
4046
4389
|
renderTrackControls,
|
|
4047
4390
|
renderTick,
|
|
@@ -4054,7 +4397,8 @@ var PlaylistVisualization = ({
|
|
|
4054
4397
|
showFades = false,
|
|
4055
4398
|
touchOptimized = false,
|
|
4056
4399
|
onRemoveTrack,
|
|
4057
|
-
recordingState
|
|
4400
|
+
recordingState,
|
|
4401
|
+
trackReordering = false
|
|
4058
4402
|
}) => {
|
|
4059
4403
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4060
4404
|
const theme = (0, import_ui_components8.useTheme)();
|
|
@@ -4074,7 +4418,7 @@ var PlaylistVisualization = ({
|
|
|
4074
4418
|
indefinitePlayback,
|
|
4075
4419
|
fillViewport
|
|
4076
4420
|
} = usePlaylistState();
|
|
4077
|
-
const annotationIntegration = (0,
|
|
4421
|
+
const annotationIntegration = (0, import_react28.useContext)(AnnotationIntegrationContext);
|
|
4078
4422
|
const {
|
|
4079
4423
|
setAnnotations: _setAnnotations,
|
|
4080
4424
|
setActiveAnnotationId,
|
|
@@ -4088,7 +4432,8 @@ var PlaylistVisualization = ({
|
|
|
4088
4432
|
setSelectedTrackId,
|
|
4089
4433
|
setCurrentTime,
|
|
4090
4434
|
setLoopRegion,
|
|
4091
|
-
setRecordingActive
|
|
4435
|
+
setRecordingActive,
|
|
4436
|
+
reorderTrack
|
|
4092
4437
|
} = usePlaylistControls();
|
|
4093
4438
|
const {
|
|
4094
4439
|
peaksDataArray,
|
|
@@ -4104,17 +4449,19 @@ var PlaylistVisualization = ({
|
|
|
4104
4449
|
barGap,
|
|
4105
4450
|
roundedBars,
|
|
4106
4451
|
isReady,
|
|
4107
|
-
|
|
4452
|
+
trackReorderEpoch,
|
|
4453
|
+
mono,
|
|
4454
|
+
trackDragPreview
|
|
4108
4455
|
} = usePlaylistData();
|
|
4109
|
-
const spectrogram = (0,
|
|
4456
|
+
const spectrogram = (0, import_react28.useContext)(SpectrogramIntegrationContext);
|
|
4110
4457
|
const recordingActive = !!(recordingState == null ? void 0 : recordingState.isRecording);
|
|
4111
4458
|
const armedTrackId = (_a = recordingState == null ? void 0 : recordingState.trackId) != null ? _a : null;
|
|
4112
|
-
(0,
|
|
4459
|
+
(0, import_react28.useEffect)(() => {
|
|
4113
4460
|
if (!recordingActive) return void 0;
|
|
4114
4461
|
setRecordingActive(true, armedTrackId);
|
|
4115
4462
|
return () => setRecordingActive(false);
|
|
4116
4463
|
}, [recordingActive, armedTrackId, setRecordingActive]);
|
|
4117
|
-
const perTrackSpectrogramHelpers = (0,
|
|
4464
|
+
const perTrackSpectrogramHelpers = (0, import_react28.useMemo)(() => {
|
|
4118
4465
|
if (!spectrogram)
|
|
4119
4466
|
return /* @__PURE__ */ new Map();
|
|
4120
4467
|
const helpers = /* @__PURE__ */ new Map();
|
|
@@ -4133,11 +4480,11 @@ var PlaylistVisualization = ({
|
|
|
4133
4480
|
});
|
|
4134
4481
|
return helpers;
|
|
4135
4482
|
}, [tracks, spectrogram]);
|
|
4136
|
-
const [settingsModalTrackId, setSettingsModalTrackId] = (0,
|
|
4137
|
-
const [isSelecting, setIsSelecting] = (0,
|
|
4138
|
-
const mouseDownTimeRef = (0,
|
|
4139
|
-
const scrollContainerRef = (0,
|
|
4140
|
-
const handleScrollContainerRef = (0,
|
|
4483
|
+
const [settingsModalTrackId, setSettingsModalTrackId] = (0, import_react28.useState)(null);
|
|
4484
|
+
const [isSelecting, setIsSelecting] = (0, import_react28.useState)(false);
|
|
4485
|
+
const mouseDownTimeRef = (0, import_react28.useRef)(0);
|
|
4486
|
+
const scrollContainerRef = (0, import_react28.useRef)(null);
|
|
4487
|
+
const handleScrollContainerRef = (0, import_react28.useCallback)(
|
|
4141
4488
|
(element) => {
|
|
4142
4489
|
scrollContainerRef.current = element;
|
|
4143
4490
|
setScrollContainer(element);
|
|
@@ -4175,7 +4522,7 @@ var PlaylistVisualization = ({
|
|
|
4175
4522
|
);
|
|
4176
4523
|
}
|
|
4177
4524
|
});
|
|
4178
|
-
const selectTrack = (0,
|
|
4525
|
+
const selectTrack = (0, import_react28.useCallback)(
|
|
4179
4526
|
(trackIndex) => {
|
|
4180
4527
|
if (trackIndex >= 0 && trackIndex < tracks.length) {
|
|
4181
4528
|
const track = tracks[trackIndex];
|
|
@@ -4243,120 +4590,99 @@ var PlaylistVisualization = ({
|
|
|
4243
4590
|
setSelection(start, end);
|
|
4244
4591
|
}
|
|
4245
4592
|
};
|
|
4593
|
+
const trackHeightById = (0, import_react28.useMemo)(() => {
|
|
4594
|
+
const m = /* @__PURE__ */ new Map();
|
|
4595
|
+
peaksDataArray.forEach((trackClipPeaks, trackIndex) => {
|
|
4596
|
+
const track = tracks[trackIndex];
|
|
4597
|
+
if (!track) return;
|
|
4598
|
+
const maxChannels = getTrackChannelCount(trackClipPeaks, recordingState, track.id, mono);
|
|
4599
|
+
m.set(track.id, waveHeight * maxChannels + (showClipHeaders ? import_ui_components8.CLIP_HEADER_HEIGHT : 0));
|
|
4600
|
+
});
|
|
4601
|
+
return m;
|
|
4602
|
+
}, [peaksDataArray, tracks, recordingState, mono, waveHeight, showClipHeaders]);
|
|
4603
|
+
const displayOrderIds = (0, import_react28.useMemo)(
|
|
4604
|
+
() => applyTrackOrderPreview(tracks, trackDragPreview).map((t) => t.id),
|
|
4605
|
+
[tracks, trackDragPreview]
|
|
4606
|
+
);
|
|
4607
|
+
const trackLayout = (0, import_react28.useMemo)(
|
|
4608
|
+
() => computeTrackLayout(displayOrderIds, trackHeightById),
|
|
4609
|
+
[displayOrderIds, trackHeightById]
|
|
4610
|
+
);
|
|
4611
|
+
const animateTrackLayout = useTrailingActive(trackDragPreview !== null, 200);
|
|
4246
4612
|
const hasClips = tracks.some((track) => track.clips.length > 0);
|
|
4247
4613
|
if (hasClips && peaksDataArray.length === 0) {
|
|
4248
|
-
return /* @__PURE__ */ (0,
|
|
4614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, children: "Loading waveform..." });
|
|
4249
4615
|
}
|
|
4250
|
-
const trackControlsSlots = controls.show ?
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
onClick: () => setTrackMute(trackIndex, !trackState.muted),
|
|
4307
|
-
children: "Mute"
|
|
4308
|
-
}
|
|
4309
|
-
),
|
|
4310
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
4311
|
-
import_ui_components8.Button,
|
|
4616
|
+
const trackControlsSlots = controls.show ? [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TracksLayout, { $height: trackLayout.totalHeight, children: peaksDataArray.map((trackClipPeaks, trackIndex) => {
|
|
4618
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
4619
|
+
const track = tracks[trackIndex];
|
|
4620
|
+
if (!track) return null;
|
|
4621
|
+
const trackState = trackStates[trackIndex] || {
|
|
4622
|
+
name: `Track ${trackIndex + 1}`,
|
|
4623
|
+
muted: false,
|
|
4624
|
+
soloed: false,
|
|
4625
|
+
volume: 1,
|
|
4626
|
+
pan: 0
|
|
4627
|
+
};
|
|
4628
|
+
const hasMidiNotes = track.clips.some((c) => c.midiNotes && c.midiNotes.length > 0);
|
|
4629
|
+
const effectiveRenderMode = (_c2 = (_b2 = (_a2 = spectrogram == null ? void 0 : spectrogram.trackSpectrogramOverrides.get(track.id)) == null ? void 0 : _a2.renderMode) != null ? _b2 : track.renderMode) != null ? _c2 : hasMidiNotes ? "piano-roll" : "waveform";
|
|
4630
|
+
const slotHeight = (_d2 = trackHeightById.get(track.id)) != null ? _d2 : 0;
|
|
4631
|
+
const defaultControlProps = {
|
|
4632
|
+
trackIndex,
|
|
4633
|
+
track,
|
|
4634
|
+
trackState,
|
|
4635
|
+
effectiveRenderMode,
|
|
4636
|
+
selectTrack,
|
|
4637
|
+
onRemoveTrack,
|
|
4638
|
+
setTrackMute,
|
|
4639
|
+
setTrackSolo,
|
|
4640
|
+
setTrackVolume,
|
|
4641
|
+
setTrackPan,
|
|
4642
|
+
spectrogram,
|
|
4643
|
+
setSettingsModalTrackId,
|
|
4644
|
+
trackReordering,
|
|
4645
|
+
reorderTrack,
|
|
4646
|
+
trackCount: peaksDataArray.length
|
|
4647
|
+
};
|
|
4648
|
+
const trackControlContent = renderTrackControls ? renderTrackControls(trackIndex) : trackReordering ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SortableTrackControls, { trackId: track.id, index: trackIndex, children: ({ ref, handleRef, isDragSource }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4649
|
+
"div",
|
|
4650
|
+
{
|
|
4651
|
+
ref,
|
|
4652
|
+
style: {
|
|
4653
|
+
height: "100%",
|
|
4654
|
+
boxShadow: isDragSource ? DRAG_SOURCE_SHADOW : void 0,
|
|
4655
|
+
// Opaque background for the floating (top-layer, popover-based)
|
|
4656
|
+
// drag-source row — without it the row underneath shows through.
|
|
4657
|
+
// onDragStart selects the dragged track, so its slot always shows
|
|
4658
|
+
// the selected-track background while lifted.
|
|
4659
|
+
background: isDragSource ? theme.selectedTrackControlsBackground : void 0
|
|
4660
|
+
},
|
|
4661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DefaultTrackControls, __spreadProps(__spreadValues({}, defaultControlProps), { gripRef: handleRef }))
|
|
4662
|
+
}
|
|
4663
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DefaultTrackControls, __spreadValues({}, defaultControlProps));
|
|
4664
|
+
return (
|
|
4665
|
+
// key includes trackReorderEpoch: forces a remount after every
|
|
4666
|
+
// track-reorder drag, discarding @dnd-kit sortable-plugin DOM
|
|
4667
|
+
// corruption (see bumpTrackReorderEpoch's doc comment in
|
|
4668
|
+
// WaveformPlaylistContext). Stays at `-0` — a no-op suffix — for
|
|
4669
|
+
// consumers that never enable trackReordering.
|
|
4670
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4671
|
+
ControlSlot,
|
|
4312
4672
|
{
|
|
4313
|
-
$
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4673
|
+
$height: slotHeight,
|
|
4674
|
+
$top: (_e2 = trackLayout.topById.get(track.id)) != null ? _e2 : 0,
|
|
4675
|
+
$animate: animateTrackLayout,
|
|
4676
|
+
$isSelected: track.id === selectedTrackId,
|
|
4677
|
+
children: trackControlContent
|
|
4678
|
+
},
|
|
4679
|
+
`${track.id}-${trackReorderEpoch}`
|
|
4317
4680
|
)
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
{
|
|
4324
|
-
min: "0",
|
|
4325
|
-
max: "1",
|
|
4326
|
-
step: "0.01",
|
|
4327
|
-
value: trackState.volume,
|
|
4328
|
-
onChange: (e) => setTrackVolume(trackIndex, parseFloat(e.target.value))
|
|
4329
|
-
}
|
|
4330
|
-
),
|
|
4331
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components8.VolumeUpIcon, {})
|
|
4332
|
-
] }),
|
|
4333
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
4334
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "L" }),
|
|
4335
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
4336
|
-
import_ui_components8.Slider,
|
|
4337
|
-
{
|
|
4338
|
-
min: "-1",
|
|
4339
|
-
max: "1",
|
|
4340
|
-
step: "0.01",
|
|
4341
|
-
value: trackState.pan,
|
|
4342
|
-
onChange: (e) => setTrackPan(trackIndex, parseFloat(e.target.value))
|
|
4343
|
-
}
|
|
4344
|
-
),
|
|
4345
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "R" })
|
|
4346
|
-
] })
|
|
4347
|
-
] });
|
|
4348
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
4349
|
-
ControlSlot,
|
|
4350
|
-
{
|
|
4351
|
-
$height: slotHeight,
|
|
4352
|
-
$isSelected: track.id === selectedTrackId,
|
|
4353
|
-
children: trackControlContent
|
|
4354
|
-
},
|
|
4355
|
-
track.id
|
|
4356
|
-
);
|
|
4357
|
-
}) : void 0;
|
|
4358
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui_components8.DevicePixelRatioProvider, { children: [
|
|
4359
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
4681
|
+
);
|
|
4682
|
+
}) }, "control-slots-layout")
|
|
4683
|
+
] : void 0;
|
|
4684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_ui_components8.DevicePixelRatioProvider, { children: [
|
|
4685
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4360
4686
|
import_ui_components8.PlaylistInfoContext.Provider,
|
|
4361
4687
|
{
|
|
4362
4688
|
value: {
|
|
@@ -4371,7 +4697,7 @@ var PlaylistVisualization = ({
|
|
|
4371
4697
|
barGap,
|
|
4372
4698
|
roundedBars
|
|
4373
4699
|
},
|
|
4374
|
-
children: /* @__PURE__ */ (0,
|
|
4700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4375
4701
|
import_ui_components8.Playlist,
|
|
4376
4702
|
{
|
|
4377
4703
|
theme,
|
|
@@ -4388,9 +4714,9 @@ var PlaylistVisualization = ({
|
|
|
4388
4714
|
"data-playlist-state": isReady ? "ready" : "loading",
|
|
4389
4715
|
trackControlsSlots,
|
|
4390
4716
|
timescaleGapHeight: timeScaleHeight > 0 ? timeScaleHeight + 1 : 0,
|
|
4391
|
-
timescale: timeScaleHeight > 0 ? /* @__PURE__ */ (0,
|
|
4392
|
-
/* @__PURE__ */ (0,
|
|
4393
|
-
isLoopEnabled && /* @__PURE__ */ (0,
|
|
4717
|
+
timescale: timeScaleHeight > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
4718
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ui_components8.SmartScale, { renderTick }),
|
|
4719
|
+
isLoopEnabled && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4394
4720
|
import_ui_components8.TimescaleLoopRegion,
|
|
4395
4721
|
{
|
|
4396
4722
|
startPosition: Math.min(loopStart, loopEnd) * sampleRate / samplesPerPixel,
|
|
@@ -4407,9 +4733,9 @@ var PlaylistVisualization = ({
|
|
|
4407
4733
|
}
|
|
4408
4734
|
)
|
|
4409
4735
|
] }) : void 0,
|
|
4410
|
-
children: /* @__PURE__ */ (0,
|
|
4411
|
-
peaksDataArray.map((trackClipPeaks, trackIndex) => {
|
|
4412
|
-
var _a2, _b2, _c2, _d2;
|
|
4736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
4737
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TracksLayout, { $height: trackLayout.totalHeight, children: peaksDataArray.map((trackClipPeaks, trackIndex) => {
|
|
4738
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
4413
4739
|
const track = tracks[trackIndex];
|
|
4414
4740
|
if (!track) return null;
|
|
4415
4741
|
const hasMidiNotes = track.clips.some((c) => c.midiNotes && c.midiNotes.length > 0);
|
|
@@ -4420,153 +4746,163 @@ var PlaylistVisualization = ({
|
|
|
4420
4746
|
track.id,
|
|
4421
4747
|
mono
|
|
4422
4748
|
);
|
|
4423
|
-
return /* @__PURE__ */ (0,
|
|
4424
|
-
|
|
4749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4750
|
+
TrackRowPositioner,
|
|
4425
4751
|
{
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
{
|
|
4460
|
-
clipId: clip.clipId,
|
|
4461
|
-
trackIndex,
|
|
4462
|
-
clipIndex,
|
|
4463
|
-
trackName: clip.trackName,
|
|
4464
|
-
startSample: clip.startSample,
|
|
4465
|
-
durationSamples: clip.durationSamples,
|
|
4466
|
-
samplesPerPixel,
|
|
4467
|
-
showHeader: showClipHeaders,
|
|
4468
|
-
disableHeaderDrag: !interactiveClips,
|
|
4469
|
-
isSelected: track.id === selectedTrackId,
|
|
4470
|
-
trackId: track.id,
|
|
4471
|
-
fadeIn: clip.fadeIn,
|
|
4472
|
-
fadeOut: clip.fadeOut,
|
|
4473
|
-
sampleRate,
|
|
4474
|
-
showFades,
|
|
4475
|
-
touchOptimized,
|
|
4476
|
-
onMouseDown: (e) => {
|
|
4477
|
-
const target = e.target;
|
|
4478
|
-
const isDraggable = target.closest(
|
|
4479
|
-
'[role="button"][aria-roledescription="draggable"]'
|
|
4480
|
-
);
|
|
4481
|
-
if (isDraggable) {
|
|
4482
|
-
return;
|
|
4752
|
+
$top: (_d2 = trackLayout.topById.get(track.id)) != null ? _d2 : 0,
|
|
4753
|
+
$animate: animateTrackLayout,
|
|
4754
|
+
"data-track-row": "",
|
|
4755
|
+
"data-track-id": track.id,
|
|
4756
|
+
"data-track-drag-source": (trackDragPreview == null ? void 0 : trackDragPreview.trackId) === track.id ? "true" : void 0,
|
|
4757
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
4758
|
+
import_ui_components8.Track,
|
|
4759
|
+
{
|
|
4760
|
+
numChannels: maxChannels,
|
|
4761
|
+
backgroundColor: effectiveRenderMode === "piano-roll" ? theme.pianoRollBackgroundColor || "#1a1a2e" : (0, import_ui_components8.waveformColorToCss)(theme.waveOutlineColor),
|
|
4762
|
+
offset: 0,
|
|
4763
|
+
width: tracksFullWidth,
|
|
4764
|
+
hasClipHeaders: showClipHeaders,
|
|
4765
|
+
trackId: track.id,
|
|
4766
|
+
isSelected: track.id === selectedTrackId,
|
|
4767
|
+
children: [
|
|
4768
|
+
effectiveRenderMode !== "waveform" && (() => {
|
|
4769
|
+
var _a3, _b3;
|
|
4770
|
+
const helpers = perTrackSpectrogramHelpers.get(track.id);
|
|
4771
|
+
const trackCfg = helpers == null ? void 0 : helpers.config;
|
|
4772
|
+
if (!(trackCfg == null ? void 0 : trackCfg.labels) || !helpers) return null;
|
|
4773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4774
|
+
import_ui_components8.SpectrogramLabels,
|
|
4775
|
+
{
|
|
4776
|
+
waveHeight,
|
|
4777
|
+
numChannels: maxChannels,
|
|
4778
|
+
frequencyScaleFn: helpers.frequencyScaleFn,
|
|
4779
|
+
minFrequency: (_a3 = trackCfg.minFrequency) != null ? _a3 : 0,
|
|
4780
|
+
maxFrequency: (_b3 = trackCfg.maxFrequency) != null ? _b3 : sampleRate / 2,
|
|
4781
|
+
labelsColor: trackCfg.labelsColor,
|
|
4782
|
+
labelsBackground: trackCfg.labelsBackground,
|
|
4783
|
+
renderMode: effectiveRenderMode,
|
|
4784
|
+
hasClipHeaders: showClipHeaders
|
|
4483
4785
|
}
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4786
|
+
);
|
|
4787
|
+
})(),
|
|
4788
|
+
trackClipPeaks.map((clip, clipIndex) => {
|
|
4789
|
+
const peaksData = clip.peaks;
|
|
4790
|
+
const width = peaksData.length;
|
|
4791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4792
|
+
import_ui_components8.Clip,
|
|
4793
|
+
{
|
|
4794
|
+
clipId: clip.clipId,
|
|
4795
|
+
trackIndex,
|
|
4796
|
+
clipIndex,
|
|
4797
|
+
trackName: clip.trackName,
|
|
4798
|
+
startSample: clip.startSample,
|
|
4799
|
+
durationSamples: clip.durationSamples,
|
|
4800
|
+
samplesPerPixel,
|
|
4801
|
+
showHeader: showClipHeaders,
|
|
4802
|
+
disableHeaderDrag: !interactiveClips,
|
|
4803
|
+
isSelected: track.id === selectedTrackId,
|
|
4804
|
+
trackId: track.id,
|
|
4805
|
+
fadeIn: clip.fadeIn,
|
|
4806
|
+
fadeOut: clip.fadeOut,
|
|
4807
|
+
sampleRate,
|
|
4808
|
+
showFades,
|
|
4809
|
+
touchOptimized,
|
|
4810
|
+
onMouseDown: (e) => {
|
|
4811
|
+
const target = e.target;
|
|
4812
|
+
const isDraggable = target.closest(
|
|
4813
|
+
'[role="button"][aria-roledescription="draggable"]'
|
|
4814
|
+
);
|
|
4815
|
+
if (isDraggable) {
|
|
4816
|
+
return;
|
|
4817
|
+
}
|
|
4818
|
+
selectTrack(trackIndex);
|
|
4505
4819
|
},
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4820
|
+
children: peaksData.data.map((channelPeaks, channelIndex) => {
|
|
4821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4822
|
+
ChannelWithProgress,
|
|
4823
|
+
{
|
|
4824
|
+
index: channelIndex,
|
|
4825
|
+
data: channelPeaks,
|
|
4826
|
+
bits: peaksData.bits,
|
|
4827
|
+
length: width,
|
|
4828
|
+
isSelected: track.id === selectedTrackId,
|
|
4829
|
+
clipStartSample: clip.startSample,
|
|
4830
|
+
clipDurationSamples: clip.durationSamples,
|
|
4831
|
+
renderMode: clip.midiNotes ? "piano-roll" : effectiveRenderMode,
|
|
4832
|
+
midiNotes: clip.midiNotes,
|
|
4833
|
+
clipSampleRate: clip.sampleRate,
|
|
4834
|
+
clipOffsetSeconds: clip.offsetSamples != null ? clip.offsetSamples / (clip.sampleRate || sampleRate) : 0,
|
|
4835
|
+
samplesPerPixel,
|
|
4836
|
+
spectrogramClipId: clip.clipId,
|
|
4837
|
+
spectrogramOnCanvasRegister: spectrogram ? spectrogram.registerSpectrogramCanvas : void 0,
|
|
4838
|
+
spectrogramOnCanvasUnregister: spectrogram ? spectrogram.unregisterSpectrogramCanvas : void 0
|
|
4839
|
+
},
|
|
4840
|
+
`${clip.clipId}-${channelIndex}`
|
|
4841
|
+
);
|
|
4842
|
+
})
|
|
4843
|
+
},
|
|
4844
|
+
clip.clipId
|
|
4845
|
+
);
|
|
4846
|
+
}),
|
|
4847
|
+
(recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === track.id && ((_e2 = recordingState.peaks[0]) == null ? void 0 : _e2.length) > 0 && (() => {
|
|
4848
|
+
const latencyOffsetSamples = (0, import_core4.resolveRecordingOffsetSamples)({
|
|
4849
|
+
overrideSeconds: recordingState.latencyOffset,
|
|
4850
|
+
outputLatency: getOutputLatency(),
|
|
4851
|
+
lookAhead: getLookAhead(),
|
|
4852
|
+
sampleRate
|
|
4853
|
+
});
|
|
4854
|
+
const latencyPixels = Math.floor(latencyOffsetSamples / samplesPerPixel);
|
|
4855
|
+
const skipPeakElements = latencyPixels * 2;
|
|
4856
|
+
const previewDuration = Math.max(
|
|
4857
|
+
0,
|
|
4858
|
+
recordingState.durationSamples - latencyOffsetSamples
|
|
4859
|
+
);
|
|
4860
|
+
const previewChannels = (mono ? recordingState.peaks.slice(0, 1) : recordingState.peaks).map(
|
|
4861
|
+
(channelPeaks) => skipPeakElements > 0 && skipPeakElements < channelPeaks.length ? channelPeaks.subarray(skipPeakElements) : channelPeaks
|
|
4862
|
+
);
|
|
4863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4864
|
+
import_ui_components8.Clip,
|
|
4545
4865
|
{
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4866
|
+
clipId: "recording-preview",
|
|
4867
|
+
trackIndex,
|
|
4868
|
+
clipIndex: trackClipPeaks.length,
|
|
4869
|
+
trackName: "Recording...",
|
|
4870
|
+
startSample: recordingState.startSample,
|
|
4871
|
+
durationSamples: previewDuration,
|
|
4872
|
+
samplesPerPixel,
|
|
4873
|
+
showHeader: showClipHeaders,
|
|
4874
|
+
disableHeaderDrag: true,
|
|
4550
4875
|
isSelected: track.id === selectedTrackId,
|
|
4551
|
-
|
|
4552
|
-
|
|
4876
|
+
trackId: track.id,
|
|
4877
|
+
children: previewChannels.map((channelPeaks, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4878
|
+
ChannelWithProgress,
|
|
4879
|
+
{
|
|
4880
|
+
index: chIdx,
|
|
4881
|
+
data: channelPeaks,
|
|
4882
|
+
bits: recordingState.bits,
|
|
4883
|
+
length: Math.floor(channelPeaks.length / 2),
|
|
4884
|
+
isSelected: track.id === selectedTrackId,
|
|
4885
|
+
clipStartSample: recordingState.startSample,
|
|
4886
|
+
clipDurationSamples: previewDuration
|
|
4887
|
+
},
|
|
4888
|
+
`${track.id}-recording-${chIdx}`
|
|
4889
|
+
))
|
|
4553
4890
|
},
|
|
4554
|
-
`${track.id}-recording
|
|
4555
|
-
)
|
|
4556
|
-
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
]
|
|
4891
|
+
`${track.id}-recording`
|
|
4892
|
+
);
|
|
4893
|
+
})()
|
|
4894
|
+
]
|
|
4895
|
+
}
|
|
4896
|
+
)
|
|
4561
4897
|
},
|
|
4562
4898
|
track.id
|
|
4563
4899
|
);
|
|
4564
|
-
}),
|
|
4565
|
-
annotations.length > 0 && annotationIntegration && /* @__PURE__ */ (0,
|
|
4900
|
+
}) }),
|
|
4901
|
+
annotations.length > 0 && annotationIntegration && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(annotationIntegration.AnnotationBoxesWrapper, { height: 30, width: tracksFullWidth, children: annotations.map((annotation, index) => {
|
|
4566
4902
|
const startPosition = annotation.start * sampleRate / samplesPerPixel;
|
|
4567
4903
|
const endPosition = annotation.end * sampleRate / samplesPerPixel;
|
|
4568
4904
|
const label = getAnnotationBoxLabel ? getAnnotationBoxLabel(annotation, index) : annotation.id;
|
|
4569
|
-
return /* @__PURE__ */ (0,
|
|
4905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4570
4906
|
annotationIntegration.AnnotationBox,
|
|
4571
4907
|
{
|
|
4572
4908
|
annotationId: annotation.id,
|
|
@@ -4582,7 +4918,7 @@ var PlaylistVisualization = ({
|
|
|
4582
4918
|
annotation.id
|
|
4583
4919
|
);
|
|
4584
4920
|
}) }),
|
|
4585
|
-
selectionStart !== selectionEnd && /* @__PURE__ */ (0,
|
|
4921
|
+
selectionStart !== selectionEnd && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4586
4922
|
import_ui_components8.Selection,
|
|
4587
4923
|
{
|
|
4588
4924
|
startPosition: Math.min(selectionStart, selectionEnd) * sampleRate / samplesPerPixel,
|
|
@@ -4590,7 +4926,7 @@ var PlaylistVisualization = ({
|
|
|
4590
4926
|
color: theme.selectionColor
|
|
4591
4927
|
}
|
|
4592
4928
|
),
|
|
4593
|
-
(isPlaying || selectionStart === selectionEnd) && (renderPlayhead ? /* @__PURE__ */ (0,
|
|
4929
|
+
(isPlaying || selectionStart === selectionEnd) && (renderPlayhead ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4594
4930
|
CustomPlayhead,
|
|
4595
4931
|
{
|
|
4596
4932
|
renderPlayhead,
|
|
@@ -4598,14 +4934,14 @@ var PlaylistVisualization = ({
|
|
|
4598
4934
|
samplesPerPixel,
|
|
4599
4935
|
sampleRate
|
|
4600
4936
|
}
|
|
4601
|
-
) : /* @__PURE__ */ (0,
|
|
4937
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AnimatedPlayhead, { color: theme.playheadColor }))
|
|
4602
4938
|
] })
|
|
4603
4939
|
}
|
|
4604
4940
|
)
|
|
4605
4941
|
}
|
|
4606
4942
|
),
|
|
4607
4943
|
(spectrogram == null ? void 0 : spectrogram.SettingsModal) && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
4608
|
-
/* @__PURE__ */ (0,
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4609
4945
|
spectrogram.SettingsModal,
|
|
4610
4946
|
{
|
|
4611
4947
|
open: settingsModalTrackId !== null,
|
|
@@ -4625,8 +4961,8 @@ var PlaylistVisualization = ({
|
|
|
4625
4961
|
};
|
|
4626
4962
|
|
|
4627
4963
|
// src/components/PlaylistAnnotationList.tsx
|
|
4628
|
-
var
|
|
4629
|
-
var
|
|
4964
|
+
var import_react29 = require("react");
|
|
4965
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
4630
4966
|
var PlaylistAnnotationList = ({
|
|
4631
4967
|
height,
|
|
4632
4968
|
renderAnnotationItem,
|
|
@@ -4640,7 +4976,7 @@ var PlaylistAnnotationList = ({
|
|
|
4640
4976
|
const integration = useAnnotationIntegration();
|
|
4641
4977
|
const { setAnnotations } = usePlaylistControls();
|
|
4642
4978
|
const resolvedConfig = annotationListConfig != null ? annotationListConfig : { linkEndpoints, continuousPlay };
|
|
4643
|
-
const handleAnnotationUpdate = (0,
|
|
4979
|
+
const handleAnnotationUpdate = (0, import_react29.useCallback)(
|
|
4644
4980
|
(updatedAnnotations) => {
|
|
4645
4981
|
setAnnotations(updatedAnnotations);
|
|
4646
4982
|
onAnnotationUpdate == null ? void 0 : onAnnotationUpdate(updatedAnnotations);
|
|
@@ -4648,7 +4984,7 @@ var PlaylistAnnotationList = ({
|
|
|
4648
4984
|
[setAnnotations, onAnnotationUpdate]
|
|
4649
4985
|
);
|
|
4650
4986
|
const { AnnotationText } = integration;
|
|
4651
|
-
return /* @__PURE__ */ (0,
|
|
4987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
4652
4988
|
AnnotationText,
|
|
4653
4989
|
{
|
|
4654
4990
|
annotations,
|
|
@@ -4667,7 +5003,7 @@ var PlaylistAnnotationList = ({
|
|
|
4667
5003
|
};
|
|
4668
5004
|
|
|
4669
5005
|
// src/components/Waveform.tsx
|
|
4670
|
-
var
|
|
5006
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
4671
5007
|
var Waveform = ({
|
|
4672
5008
|
renderTrackControls,
|
|
4673
5009
|
renderTick,
|
|
@@ -4686,13 +5022,14 @@ var Waveform = ({
|
|
|
4686
5022
|
showFades = false,
|
|
4687
5023
|
touchOptimized = false,
|
|
4688
5024
|
onRemoveTrack,
|
|
5025
|
+
trackReordering = false,
|
|
4689
5026
|
recordingState
|
|
4690
5027
|
}) => {
|
|
4691
5028
|
const { annotations } = usePlaylistState();
|
|
4692
5029
|
const clipInteractionEnabled = useClipInteractionEnabled();
|
|
4693
5030
|
const effectiveInteractiveClips = interactiveClips || clipInteractionEnabled;
|
|
4694
|
-
return /* @__PURE__ */ (0,
|
|
4695
|
-
/* @__PURE__ */ (0,
|
|
5031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4696
5033
|
PlaylistVisualization,
|
|
4697
5034
|
{
|
|
4698
5035
|
renderTrackControls,
|
|
@@ -4706,10 +5043,11 @@ var Waveform = ({
|
|
|
4706
5043
|
showFades,
|
|
4707
5044
|
touchOptimized,
|
|
4708
5045
|
onRemoveTrack,
|
|
5046
|
+
trackReordering,
|
|
4709
5047
|
recordingState
|
|
4710
5048
|
}
|
|
4711
5049
|
),
|
|
4712
|
-
annotations.length > 0 && /* @__PURE__ */ (0,
|
|
5050
|
+
annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4713
5051
|
PlaylistAnnotationList,
|
|
4714
5052
|
{
|
|
4715
5053
|
height: annotationTextHeight,
|
|
@@ -4724,9 +5062,9 @@ var Waveform = ({
|
|
|
4724
5062
|
};
|
|
4725
5063
|
|
|
4726
5064
|
// src/components/MediaElementPlaylist.tsx
|
|
4727
|
-
var
|
|
4728
|
-
var
|
|
4729
|
-
var
|
|
5065
|
+
var import_react32 = require("react");
|
|
5066
|
+
var import_react33 = require("@dnd-kit/react");
|
|
5067
|
+
var import_modifiers2 = require("@dnd-kit/abstract/modifiers");
|
|
4730
5068
|
var import_ui_components10 = require("@waveform-playlist/ui-components");
|
|
4731
5069
|
|
|
4732
5070
|
// src/plugins/noDropAnimationPlugins.ts
|
|
@@ -4749,9 +5087,9 @@ var noDropAnimationPlugins = (defaults) => {
|
|
|
4749
5087
|
};
|
|
4750
5088
|
|
|
4751
5089
|
// src/components/AnimatedMediaElementPlayhead.tsx
|
|
4752
|
-
var
|
|
5090
|
+
var import_react30 = require("react");
|
|
4753
5091
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
4754
|
-
var
|
|
5092
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4755
5093
|
var PlayheadLine2 = import_styled_components7.default.div`
|
|
4756
5094
|
position: absolute;
|
|
4757
5095
|
top: 0;
|
|
@@ -4766,11 +5104,11 @@ var PlayheadLine2 = import_styled_components7.default.div`
|
|
|
4766
5104
|
var AnimatedMediaElementPlayhead = ({
|
|
4767
5105
|
color = "#ff0000"
|
|
4768
5106
|
}) => {
|
|
4769
|
-
const playheadRef = (0,
|
|
4770
|
-
const animationFrameRef = (0,
|
|
5107
|
+
const playheadRef = (0, import_react30.useRef)(null);
|
|
5108
|
+
const animationFrameRef = (0, import_react30.useRef)(null);
|
|
4771
5109
|
const { isPlaying, currentTimeRef } = useMediaElementAnimation();
|
|
4772
5110
|
const { samplesPerPixel, sampleRate, progressBarWidth } = useMediaElementData();
|
|
4773
|
-
(0,
|
|
5111
|
+
(0, import_react30.useEffect)(() => {
|
|
4774
5112
|
const updatePosition = () => {
|
|
4775
5113
|
var _a;
|
|
4776
5114
|
if (playheadRef.current) {
|
|
@@ -4794,7 +5132,7 @@ var AnimatedMediaElementPlayhead = ({
|
|
|
4794
5132
|
}
|
|
4795
5133
|
};
|
|
4796
5134
|
}, [isPlaying, sampleRate, samplesPerPixel, currentTimeRef]);
|
|
4797
|
-
(0,
|
|
5135
|
+
(0, import_react30.useEffect)(() => {
|
|
4798
5136
|
var _a;
|
|
4799
5137
|
if (!isPlaying && playheadRef.current) {
|
|
4800
5138
|
const time = (_a = currentTimeRef.current) != null ? _a : 0;
|
|
@@ -4802,14 +5140,14 @@ var AnimatedMediaElementPlayhead = ({
|
|
|
4802
5140
|
playheadRef.current.style.transform = `translate3d(${position}px, 0, 0)`;
|
|
4803
5141
|
}
|
|
4804
5142
|
});
|
|
4805
|
-
return /* @__PURE__ */ (0,
|
|
5143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlayheadLine2, { ref: playheadRef, $color: color, $width: progressBarWidth, "data-playhead": true });
|
|
4806
5144
|
};
|
|
4807
5145
|
|
|
4808
5146
|
// src/components/ChannelWithMediaElementProgress.tsx
|
|
4809
|
-
var
|
|
5147
|
+
var import_react31 = require("react");
|
|
4810
5148
|
var import_styled_components8 = __toESM(require("styled-components"));
|
|
4811
5149
|
var import_ui_components9 = require("@waveform-playlist/ui-components");
|
|
4812
|
-
var
|
|
5150
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4813
5151
|
var ChannelWrapper2 = import_styled_components8.default.div`
|
|
4814
5152
|
position: relative;
|
|
4815
5153
|
`;
|
|
@@ -4846,14 +5184,14 @@ var ChannelWithMediaElementProgress = (_a) => {
|
|
|
4846
5184
|
"clipStartSample",
|
|
4847
5185
|
"clipDurationSamples"
|
|
4848
5186
|
]);
|
|
4849
|
-
const progressRef = (0,
|
|
4850
|
-
const animationFrameRef = (0,
|
|
5187
|
+
const progressRef = (0, import_react31.useRef)(null);
|
|
5188
|
+
const animationFrameRef = (0, import_react31.useRef)(null);
|
|
4851
5189
|
const theme = (0, import_ui_components9.useTheme)();
|
|
4852
5190
|
const { waveHeight } = (0, import_ui_components9.usePlaylistInfo)();
|
|
4853
5191
|
const { isPlaying, currentTimeRef } = useMediaElementAnimation();
|
|
4854
5192
|
const { samplesPerPixel, sampleRate } = useMediaElementData();
|
|
4855
5193
|
const progressColor = (theme == null ? void 0 : theme.waveProgressColor) || "rgba(0, 0, 0, 0.1)";
|
|
4856
|
-
(0,
|
|
5194
|
+
(0, import_react31.useEffect)(() => {
|
|
4857
5195
|
const updateProgress = () => {
|
|
4858
5196
|
var _a2;
|
|
4859
5197
|
if (progressRef.current) {
|
|
@@ -4895,7 +5233,7 @@ var ChannelWithMediaElementProgress = (_a) => {
|
|
|
4895
5233
|
smartChannelProps.length,
|
|
4896
5234
|
currentTimeRef
|
|
4897
5235
|
]);
|
|
4898
|
-
(0,
|
|
5236
|
+
(0, import_react31.useEffect)(() => {
|
|
4899
5237
|
var _a2;
|
|
4900
5238
|
if (!isPlaying && progressRef.current) {
|
|
4901
5239
|
const currentTime = (_a2 = currentTimeRef.current) != null ? _a2 : 0;
|
|
@@ -4921,8 +5259,8 @@ var ChannelWithMediaElementProgress = (_a) => {
|
|
|
4921
5259
|
backgroundColor = (theme == null ? void 0 : theme.selectedWaveOutlineColor) || (theme == null ? void 0 : theme.waveOutlineColor) || "grey";
|
|
4922
5260
|
}
|
|
4923
5261
|
const backgroundCss = (0, import_ui_components9.waveformColorToCss)(backgroundColor);
|
|
4924
|
-
return /* @__PURE__ */ (0,
|
|
4925
|
-
/* @__PURE__ */ (0,
|
|
5262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ChannelWrapper2, { children: [
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4926
5264
|
Background2,
|
|
4927
5265
|
{
|
|
4928
5266
|
$color: backgroundCss,
|
|
@@ -4931,7 +5269,7 @@ var ChannelWithMediaElementProgress = (_a) => {
|
|
|
4931
5269
|
$width: smartChannelProps.length
|
|
4932
5270
|
}
|
|
4933
5271
|
),
|
|
4934
|
-
/* @__PURE__ */ (0,
|
|
5272
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4935
5273
|
ProgressOverlay2,
|
|
4936
5274
|
{
|
|
4937
5275
|
ref: progressRef,
|
|
@@ -4940,12 +5278,12 @@ var ChannelWithMediaElementProgress = (_a) => {
|
|
|
4940
5278
|
$top: smartChannelProps.index * waveHeight
|
|
4941
5279
|
}
|
|
4942
5280
|
),
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
5281
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChannelContainer2, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui_components9.SmartChannel, __spreadProps(__spreadValues({}, smartChannelProps), { isSelected: true, transparentBackground: true })) })
|
|
4944
5282
|
] });
|
|
4945
5283
|
};
|
|
4946
5284
|
|
|
4947
5285
|
// src/components/MediaElementPlaylist.tsx
|
|
4948
|
-
var
|
|
5286
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4949
5287
|
var ZERO_REF = { current: 0 };
|
|
4950
5288
|
var CustomMediaElementPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) => {
|
|
4951
5289
|
var _a;
|
|
@@ -4974,7 +5312,7 @@ var MediaElementPlaylist = ({
|
|
|
4974
5312
|
const theme = (0, import_ui_components10.useTheme)();
|
|
4975
5313
|
const { isPlaying } = useMediaElementAnimation();
|
|
4976
5314
|
const { annotations, activeAnnotationId } = useMediaElementState();
|
|
4977
|
-
const annotationIntegration = (0,
|
|
5315
|
+
const annotationIntegration = (0, import_react32.useContext)(AnnotationIntegrationContext);
|
|
4978
5316
|
const { play, seekTo, setActiveAnnotationId, setAnnotations, setScrollContainer } = useMediaElementControls();
|
|
4979
5317
|
const {
|
|
4980
5318
|
duration,
|
|
@@ -4991,11 +5329,11 @@ var MediaElementPlaylist = ({
|
|
|
4991
5329
|
fadeIn,
|
|
4992
5330
|
fadeOut
|
|
4993
5331
|
} = useMediaElementData();
|
|
4994
|
-
const [selectionStart, setSelectionStart] = (0,
|
|
4995
|
-
const [selectionEnd, setSelectionEnd] = (0,
|
|
4996
|
-
const [isSelecting, setIsSelecting] = (0,
|
|
4997
|
-
const scrollContainerRef = (0,
|
|
4998
|
-
const handleScrollContainerRef = (0,
|
|
5332
|
+
const [selectionStart, setSelectionStart] = (0, import_react32.useState)(0);
|
|
5333
|
+
const [selectionEnd, setSelectionEnd] = (0, import_react32.useState)(0);
|
|
5334
|
+
const [isSelecting, setIsSelecting] = (0, import_react32.useState)(false);
|
|
5335
|
+
const scrollContainerRef = (0, import_react32.useRef)(null);
|
|
5336
|
+
const handleScrollContainerRef = (0, import_react32.useCallback)(
|
|
4999
5337
|
(el) => {
|
|
5000
5338
|
scrollContainerRef.current = el;
|
|
5001
5339
|
setScrollContainer(el);
|
|
@@ -5003,7 +5341,7 @@ var MediaElementPlaylist = ({
|
|
|
5003
5341
|
[setScrollContainer]
|
|
5004
5342
|
);
|
|
5005
5343
|
const tracksFullWidth = Math.floor(duration * sampleRate / samplesPerPixel);
|
|
5006
|
-
const handleAnnotationClick = (0,
|
|
5344
|
+
const handleAnnotationClick = (0, import_react32.useCallback)(
|
|
5007
5345
|
(annotation) => __async(null, null, function* () {
|
|
5008
5346
|
setActiveAnnotationId(annotation.id);
|
|
5009
5347
|
try {
|
|
@@ -5018,7 +5356,7 @@ var MediaElementPlaylist = ({
|
|
|
5018
5356
|
}),
|
|
5019
5357
|
[setActiveAnnotationId, play]
|
|
5020
5358
|
);
|
|
5021
|
-
const handleAnnotationUpdate = (0,
|
|
5359
|
+
const handleAnnotationUpdate = (0, import_react32.useCallback)(
|
|
5022
5360
|
(updatedAnnotations) => {
|
|
5023
5361
|
setAnnotations(updatedAnnotations);
|
|
5024
5362
|
onAnnotationUpdate == null ? void 0 : onAnnotationUpdate(updatedAnnotations);
|
|
@@ -5032,8 +5370,8 @@ var MediaElementPlaylist = ({
|
|
|
5032
5370
|
duration,
|
|
5033
5371
|
linkEndpoints: linkEndpointsProp
|
|
5034
5372
|
});
|
|
5035
|
-
const mouseDownTimeRef = (0,
|
|
5036
|
-
const handleMouseDown = (0,
|
|
5373
|
+
const mouseDownTimeRef = (0, import_react32.useRef)(0);
|
|
5374
|
+
const handleMouseDown = (0, import_react32.useCallback)(
|
|
5037
5375
|
(e) => {
|
|
5038
5376
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
5039
5377
|
const x = e.clientX - rect.left;
|
|
@@ -5045,7 +5383,7 @@ var MediaElementPlaylist = ({
|
|
|
5045
5383
|
},
|
|
5046
5384
|
[samplesPerPixel, sampleRate]
|
|
5047
5385
|
);
|
|
5048
|
-
const handleMouseMove = (0,
|
|
5386
|
+
const handleMouseMove = (0, import_react32.useCallback)(
|
|
5049
5387
|
(e) => {
|
|
5050
5388
|
if (!isSelecting) return;
|
|
5051
5389
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -5055,7 +5393,7 @@ var MediaElementPlaylist = ({
|
|
|
5055
5393
|
},
|
|
5056
5394
|
[isSelecting, samplesPerPixel, sampleRate]
|
|
5057
5395
|
);
|
|
5058
|
-
const handleMouseUp = (0,
|
|
5396
|
+
const handleMouseUp = (0, import_react32.useCallback)(
|
|
5059
5397
|
(e) => {
|
|
5060
5398
|
if (!isSelecting) return;
|
|
5061
5399
|
setIsSelecting(false);
|
|
@@ -5085,9 +5423,9 @@ var MediaElementPlaylist = ({
|
|
|
5085
5423
|
[isSelecting, selectionStart, samplesPerPixel, sampleRate, seekTo, isPlaying, playoutRef, play]
|
|
5086
5424
|
);
|
|
5087
5425
|
if (peaksDataArray.length === 0) {
|
|
5088
|
-
return /* @__PURE__ */ (0,
|
|
5426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className, children: "Loading waveform..." });
|
|
5089
5427
|
}
|
|
5090
|
-
return /* @__PURE__ */ (0,
|
|
5428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui_components10.DevicePixelRatioProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5091
5429
|
import_ui_components10.PlaylistInfoContext.Provider,
|
|
5092
5430
|
{
|
|
5093
5431
|
value: {
|
|
@@ -5102,7 +5440,7 @@ var MediaElementPlaylist = ({
|
|
|
5102
5440
|
barGap,
|
|
5103
5441
|
roundedBars
|
|
5104
5442
|
},
|
|
5105
|
-
children: /* @__PURE__ */ (0,
|
|
5443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5106
5444
|
import_ui_components10.Playlist,
|
|
5107
5445
|
{
|
|
5108
5446
|
theme,
|
|
@@ -5116,11 +5454,11 @@ var MediaElementPlaylist = ({
|
|
|
5116
5454
|
onTracksMouseUp: handleMouseUp,
|
|
5117
5455
|
scrollContainerRef: handleScrollContainerRef,
|
|
5118
5456
|
isSelecting,
|
|
5119
|
-
timescale: timeScaleHeight > 0 ? /* @__PURE__ */ (0,
|
|
5120
|
-
children: /* @__PURE__ */ (0,
|
|
5457
|
+
timescale: timeScaleHeight > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui_components10.SmartScale, {}) : void 0,
|
|
5458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
5121
5459
|
peaksDataArray.map((trackClipPeaks, trackIndex) => {
|
|
5122
5460
|
const maxChannels = trackClipPeaks.length > 0 ? Math.max(...trackClipPeaks.map((clip) => clip.peaks.data.length)) : 1;
|
|
5123
|
-
return /* @__PURE__ */ (0,
|
|
5461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5124
5462
|
import_ui_components10.Track,
|
|
5125
5463
|
{
|
|
5126
5464
|
numChannels: maxChannels,
|
|
@@ -5133,7 +5471,7 @@ var MediaElementPlaylist = ({
|
|
|
5133
5471
|
children: trackClipPeaks.map((clip, clipIndex) => {
|
|
5134
5472
|
const peaksData = clip.peaks;
|
|
5135
5473
|
const width = peaksData.length;
|
|
5136
|
-
return /* @__PURE__ */ (0,
|
|
5474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5137
5475
|
import_ui_components10.Clip,
|
|
5138
5476
|
{
|
|
5139
5477
|
clipId: clip.clipId,
|
|
@@ -5148,7 +5486,7 @@ var MediaElementPlaylist = ({
|
|
|
5148
5486
|
isSelected: true,
|
|
5149
5487
|
trackId: `media-element-track-${trackIndex}`,
|
|
5150
5488
|
children: [
|
|
5151
|
-
peaksData.data.map((channelPeaks, channelIndex) => /* @__PURE__ */ (0,
|
|
5489
|
+
peaksData.data.map((channelPeaks, channelIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5152
5490
|
ChannelWithMediaElementProgress,
|
|
5153
5491
|
{
|
|
5154
5492
|
index: channelIndex,
|
|
@@ -5160,7 +5498,7 @@ var MediaElementPlaylist = ({
|
|
|
5160
5498
|
},
|
|
5161
5499
|
`${trackIndex}-${clipIndex}-${channelIndex}`
|
|
5162
5500
|
)),
|
|
5163
|
-
showFades && fadeIn && fadeIn.duration > 0 && /* @__PURE__ */ (0,
|
|
5501
|
+
showFades && fadeIn && fadeIn.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5164
5502
|
import_ui_components10.FadeOverlay,
|
|
5165
5503
|
{
|
|
5166
5504
|
left: 0,
|
|
@@ -5169,7 +5507,7 @@ var MediaElementPlaylist = ({
|
|
|
5169
5507
|
curveType: fadeIn.type
|
|
5170
5508
|
}
|
|
5171
5509
|
),
|
|
5172
|
-
showFades && fadeOut && fadeOut.duration > 0 && /* @__PURE__ */ (0,
|
|
5510
|
+
showFades && fadeOut && fadeOut.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5173
5511
|
import_ui_components10.FadeOverlay,
|
|
5174
5512
|
{
|
|
5175
5513
|
left: width - Math.floor(fadeOut.duration * sampleRate / samplesPerPixel),
|
|
@@ -5187,19 +5525,19 @@ var MediaElementPlaylist = ({
|
|
|
5187
5525
|
trackIndex
|
|
5188
5526
|
);
|
|
5189
5527
|
}),
|
|
5190
|
-
annotations.length > 0 && annotationIntegration && /* @__PURE__ */ (0,
|
|
5191
|
-
|
|
5528
|
+
annotations.length > 0 && annotationIntegration && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5529
|
+
import_react33.DragDropProvider,
|
|
5192
5530
|
{
|
|
5193
5531
|
onDragStart,
|
|
5194
5532
|
onDragMove,
|
|
5195
5533
|
onDragEnd,
|
|
5196
|
-
modifiers: editable ? [
|
|
5534
|
+
modifiers: editable ? [import_modifiers2.RestrictToHorizontalAxis] : [],
|
|
5197
5535
|
plugins: noDropAnimationPlugins,
|
|
5198
|
-
children: /* @__PURE__ */ (0,
|
|
5536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(annotationIntegration.AnnotationBoxesWrapper, { height: 30, width: tracksFullWidth, children: annotations.map((annotation, index) => {
|
|
5199
5537
|
const startPosition = annotation.start * sampleRate / samplesPerPixel;
|
|
5200
5538
|
const endPosition = annotation.end * sampleRate / samplesPerPixel;
|
|
5201
5539
|
const label = getAnnotationBoxLabel ? getAnnotationBoxLabel(annotation, index) : annotation.id;
|
|
5202
|
-
return /* @__PURE__ */ (0,
|
|
5540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5203
5541
|
annotationIntegration.AnnotationBox,
|
|
5204
5542
|
{
|
|
5205
5543
|
annotationId: annotation.id,
|
|
@@ -5217,7 +5555,7 @@ var MediaElementPlaylist = ({
|
|
|
5217
5555
|
}) })
|
|
5218
5556
|
}
|
|
5219
5557
|
),
|
|
5220
|
-
selectionStart !== selectionEnd && /* @__PURE__ */ (0,
|
|
5558
|
+
selectionStart !== selectionEnd && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5221
5559
|
import_ui_components10.Selection,
|
|
5222
5560
|
{
|
|
5223
5561
|
startPosition: Math.min(selectionStart, selectionEnd) * sampleRate / samplesPerPixel,
|
|
@@ -5225,7 +5563,7 @@ var MediaElementPlaylist = ({
|
|
|
5225
5563
|
color: theme.selectionColor
|
|
5226
5564
|
}
|
|
5227
5565
|
),
|
|
5228
|
-
renderPlayhead ? /* @__PURE__ */ (0,
|
|
5566
|
+
renderPlayhead ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5229
5567
|
CustomMediaElementPlayhead,
|
|
5230
5568
|
{
|
|
5231
5569
|
renderPlayhead,
|
|
@@ -5233,7 +5571,7 @@ var MediaElementPlaylist = ({
|
|
|
5233
5571
|
samplesPerPixel,
|
|
5234
5572
|
sampleRate
|
|
5235
5573
|
}
|
|
5236
|
-
) : /* @__PURE__ */ (0,
|
|
5574
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AnimatedMediaElementPlayhead, { color: theme.playheadColor })
|
|
5237
5575
|
] })
|
|
5238
5576
|
}
|
|
5239
5577
|
)
|
|
@@ -5242,8 +5580,8 @@ var MediaElementPlaylist = ({
|
|
|
5242
5580
|
};
|
|
5243
5581
|
|
|
5244
5582
|
// src/components/MediaElementAnnotationList.tsx
|
|
5245
|
-
var
|
|
5246
|
-
var
|
|
5583
|
+
var import_react34 = require("react");
|
|
5584
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5247
5585
|
var MediaElementAnnotationList = ({
|
|
5248
5586
|
height,
|
|
5249
5587
|
renderAnnotationItem,
|
|
@@ -5258,7 +5596,7 @@ var MediaElementAnnotationList = ({
|
|
|
5258
5596
|
const integration = useAnnotationIntegration();
|
|
5259
5597
|
const { setAnnotations } = useMediaElementControls();
|
|
5260
5598
|
const resolvedConfig = annotationListConfig != null ? annotationListConfig : { linkEndpoints: false, continuousPlay };
|
|
5261
|
-
const handleAnnotationUpdate = (0,
|
|
5599
|
+
const handleAnnotationUpdate = (0, import_react34.useCallback)(
|
|
5262
5600
|
(updatedAnnotations) => {
|
|
5263
5601
|
setAnnotations(updatedAnnotations);
|
|
5264
5602
|
onAnnotationUpdate == null ? void 0 : onAnnotationUpdate(updatedAnnotations);
|
|
@@ -5266,7 +5604,7 @@ var MediaElementAnnotationList = ({
|
|
|
5266
5604
|
[setAnnotations, onAnnotationUpdate]
|
|
5267
5605
|
);
|
|
5268
5606
|
const { AnnotationText } = integration;
|
|
5269
|
-
return /* @__PURE__ */ (0,
|
|
5607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5270
5608
|
AnnotationText,
|
|
5271
5609
|
{
|
|
5272
5610
|
annotations,
|
|
@@ -5285,7 +5623,7 @@ var MediaElementAnnotationList = ({
|
|
|
5285
5623
|
};
|
|
5286
5624
|
|
|
5287
5625
|
// src/components/MediaElementWaveform.tsx
|
|
5288
|
-
var
|
|
5626
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5289
5627
|
var MediaElementWaveform = ({
|
|
5290
5628
|
annotationTextHeight,
|
|
5291
5629
|
getAnnotationBoxLabel,
|
|
@@ -5300,8 +5638,8 @@ var MediaElementWaveform = ({
|
|
|
5300
5638
|
className
|
|
5301
5639
|
}) => {
|
|
5302
5640
|
const { annotations } = useMediaElementState();
|
|
5303
|
-
return /* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5305
5643
|
MediaElementPlaylist,
|
|
5306
5644
|
{
|
|
5307
5645
|
getAnnotationBoxLabel,
|
|
@@ -5313,7 +5651,7 @@ var MediaElementWaveform = ({
|
|
|
5313
5651
|
className
|
|
5314
5652
|
}
|
|
5315
5653
|
),
|
|
5316
|
-
annotations.length > 0 && /* @__PURE__ */ (0,
|
|
5654
|
+
annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5317
5655
|
MediaElementAnnotationList,
|
|
5318
5656
|
{
|
|
5319
5657
|
height: annotationTextHeight,
|
|
@@ -5388,9 +5726,9 @@ var KeyboardShortcuts = ({
|
|
|
5388
5726
|
};
|
|
5389
5727
|
|
|
5390
5728
|
// src/components/ClipInteractionProvider.tsx
|
|
5391
|
-
var
|
|
5392
|
-
var
|
|
5393
|
-
var
|
|
5729
|
+
var import_react35 = __toESM(require("react"));
|
|
5730
|
+
var import_react36 = require("@dnd-kit/react");
|
|
5731
|
+
var import_modifiers3 = require("@dnd-kit/abstract/modifiers");
|
|
5394
5732
|
var import_core6 = require("@waveform-playlist/core");
|
|
5395
5733
|
var import_ui_components11 = require("@waveform-playlist/ui-components");
|
|
5396
5734
|
|
|
@@ -5460,7 +5798,7 @@ _SnapToGridModifier.configure = (0, import_abstract2.configurator)(_SnapToGridMo
|
|
|
5460
5798
|
var SnapToGridModifier = _SnapToGridModifier;
|
|
5461
5799
|
|
|
5462
5800
|
// src/components/ClipInteractionProvider.tsx
|
|
5463
|
-
var
|
|
5801
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5464
5802
|
var NOOP_TRACKS_CHANGE = () => {
|
|
5465
5803
|
};
|
|
5466
5804
|
var ClipInteractionProvider = ({
|
|
@@ -5469,18 +5807,18 @@ var ClipInteractionProvider = ({
|
|
|
5469
5807
|
children
|
|
5470
5808
|
}) => {
|
|
5471
5809
|
const { tracks, samplesPerPixel, sampleRate, playoutRef, isDraggingRef, onTracksChange } = usePlaylistData();
|
|
5472
|
-
const { setSelectedTrackId } = usePlaylistControls();
|
|
5810
|
+
const { setSelectedTrackId, reorderTrack, bumpTrackReorderEpoch, setTrackDragPreview } = usePlaylistControls();
|
|
5473
5811
|
const beatsAndBars = (0, import_ui_components11.useBeatsAndBars)();
|
|
5474
5812
|
const useBeatsSnap = snap && beatsAndBars != null && beatsAndBars.scaleMode === "beats" && beatsAndBars.snapTo !== "off";
|
|
5475
5813
|
const useTimescaleSnap = snap && !useBeatsSnap;
|
|
5476
|
-
(0,
|
|
5814
|
+
(0, import_react35.useEffect)(() => {
|
|
5477
5815
|
if (onTracksChange == null) {
|
|
5478
5816
|
console.warn(
|
|
5479
5817
|
"[waveform-playlist] ClipInteractionProvider: onTracksChange is not set on WaveformPlaylistProvider. Drag and trim edits will not be persisted."
|
|
5480
5818
|
);
|
|
5481
5819
|
}
|
|
5482
5820
|
}, [onTracksChange]);
|
|
5483
|
-
const snapSamplePosition = (0,
|
|
5821
|
+
const snapSamplePosition = (0, import_react35.useMemo)(() => {
|
|
5484
5822
|
if (useBeatsSnap && beatsAndBars) {
|
|
5485
5823
|
const { bpm, timeSignature, snapTo } = beatsAndBars;
|
|
5486
5824
|
const gridTicks = snapTo === "bar" ? (0, import_core6.ticksPerBar)(timeSignature) : (0, import_core6.ticksPerBeat)(timeSignature);
|
|
@@ -5509,10 +5847,15 @@ var ClipInteractionProvider = ({
|
|
|
5509
5847
|
isDraggingRef,
|
|
5510
5848
|
snapSamplePosition
|
|
5511
5849
|
});
|
|
5512
|
-
const onDragStart =
|
|
5850
|
+
const onDragStart = import_react35.default.useCallback(
|
|
5513
5851
|
(event) => {
|
|
5514
|
-
var _a, _b
|
|
5515
|
-
const
|
|
5852
|
+
var _a, _b;
|
|
5853
|
+
const data = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data;
|
|
5854
|
+
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
5855
|
+
if (data.trackId) setSelectedTrackId(data.trackId);
|
|
5856
|
+
return;
|
|
5857
|
+
}
|
|
5858
|
+
const trackIndex = data == null ? void 0 : data.trackIndex;
|
|
5516
5859
|
if (trackIndex !== void 0 && tracks[trackIndex]) {
|
|
5517
5860
|
setSelectedTrackId(tracks[trackIndex].id);
|
|
5518
5861
|
}
|
|
@@ -5520,8 +5863,41 @@ var ClipInteractionProvider = ({
|
|
|
5520
5863
|
},
|
|
5521
5864
|
[handleDragStart, tracks, setSelectedTrackId]
|
|
5522
5865
|
);
|
|
5523
|
-
const
|
|
5524
|
-
|
|
5866
|
+
const handleDragOver = import_react35.default.useCallback(
|
|
5867
|
+
(event) => {
|
|
5868
|
+
var _a;
|
|
5869
|
+
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
5870
|
+
if ((data == null ? void 0 : data.kind) !== "track-reorder" || !data.trackId) return;
|
|
5871
|
+
const sortable = event.operation.source.sortable;
|
|
5872
|
+
if (!sortable) return;
|
|
5873
|
+
const trackId = data.trackId;
|
|
5874
|
+
const toIndex = sortable.index;
|
|
5875
|
+
setTrackDragPreview(
|
|
5876
|
+
(prev) => prev && prev.trackId === trackId && prev.toIndex === toIndex ? prev : { trackId, toIndex }
|
|
5877
|
+
);
|
|
5878
|
+
},
|
|
5879
|
+
[setTrackDragPreview]
|
|
5880
|
+
);
|
|
5881
|
+
const handleDragEnd = import_react35.default.useCallback(
|
|
5882
|
+
(event) => {
|
|
5883
|
+
var _a;
|
|
5884
|
+
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
5885
|
+
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
5886
|
+
bumpTrackReorderEpoch();
|
|
5887
|
+
setTrackDragPreview(null);
|
|
5888
|
+
if (event.canceled || !data.trackId) return;
|
|
5889
|
+
const sortable = event.operation.source.sortable;
|
|
5890
|
+
if (sortable && sortable.index !== sortable.initialIndex) {
|
|
5891
|
+
reorderTrack(data.trackId, sortable.index);
|
|
5892
|
+
}
|
|
5893
|
+
return;
|
|
5894
|
+
}
|
|
5895
|
+
onDragEnd(event);
|
|
5896
|
+
},
|
|
5897
|
+
[onDragEnd, reorderTrack, bumpTrackReorderEpoch, setTrackDragPreview]
|
|
5898
|
+
);
|
|
5899
|
+
const modifiers = (0, import_react35.useMemo)(() => {
|
|
5900
|
+
const mods = [import_modifiers3.RestrictToHorizontalAxis];
|
|
5525
5901
|
if (useBeatsSnap && beatsAndBars) {
|
|
5526
5902
|
mods.push(
|
|
5527
5903
|
SnapToGridModifier.configure({
|
|
@@ -5545,13 +5921,14 @@ var ClipInteractionProvider = ({
|
|
|
5545
5921
|
mods.push(ClipCollisionModifier.configure({ tracks, samplesPerPixel }));
|
|
5546
5922
|
return mods;
|
|
5547
5923
|
}, [useBeatsSnap, useTimescaleSnap, beatsAndBars, tracks, samplesPerPixel, sampleRate]);
|
|
5548
|
-
return /* @__PURE__ */ (0,
|
|
5549
|
-
|
|
5924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ClipInteractionContextProvider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5925
|
+
import_react36.DragDropProvider,
|
|
5550
5926
|
{
|
|
5551
5927
|
sensors,
|
|
5552
5928
|
onDragStart,
|
|
5553
5929
|
onDragMove,
|
|
5554
|
-
|
|
5930
|
+
onDragOver: handleDragOver,
|
|
5931
|
+
onDragEnd: handleDragEnd,
|
|
5555
5932
|
modifiers,
|
|
5556
5933
|
plugins: noDropAnimationPlugins,
|
|
5557
5934
|
children
|
|
@@ -5588,6 +5965,7 @@ var ClipInteractionProvider = ({
|
|
|
5588
5965
|
SkipBackwardButton,
|
|
5589
5966
|
SkipForwardButton,
|
|
5590
5967
|
SnapToGridModifier,
|
|
5968
|
+
SortableTrackControls,
|
|
5591
5969
|
SpectrogramIntegrationProvider,
|
|
5592
5970
|
StopButton,
|
|
5593
5971
|
TimeFormatSelect,
|