@waveform-playlist/browser 17.0.0-next.7 → 17.0.0-next.9
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/README.md +4 -4
- package/dist/index.d.mts +48 -39
- package/dist/index.d.ts +48 -39
- package/dist/index.js +178 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -123
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js +3 -2
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs +3 -2
- package/dist/tone.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -51,11 +51,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// <define:__INSTALL_SPECS__>
|
|
54
|
-
var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@dnd-kit/abstract": "@dnd-kit/abstract@^0.5.0", "@dnd-kit/dom": "@dnd-kit/dom@^0.5.0", "@dnd-kit/react": "@dnd-kit/react@^0.5.0", "@waveform-playlist/annotations": "@waveform-playlist/annotations@^14.0.0-next.
|
|
54
|
+
var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@dnd-kit/abstract": "@dnd-kit/abstract@^0.5.0", "@dnd-kit/dom": "@dnd-kit/dom@^0.5.0", "@dnd-kit/react": "@dnd-kit/react@^0.5.0", "@waveform-playlist/annotations": "@waveform-playlist/annotations@^14.0.0-next.6", "@waveform-playlist/media-element-playout": "@waveform-playlist/media-element-playout@^12.4.0-next.4", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.4", "@waveform-playlist/recording": "@waveform-playlist/recording@^14.0.0-next.6", react: "react@^19.0.0", "react-dom": "react-dom@^19.0.0", "styled-components": "styled-components@^6.0.0", tone: "tone@^15.0.0", "@waveform-playlist/spectrogram": "@waveform-playlist/spectrogram@^15.0.0-next.4" };
|
|
55
55
|
|
|
56
56
|
// src/WaveformPlaylistContext.tsx
|
|
57
57
|
import {
|
|
58
|
-
useState as
|
|
58
|
+
useState as useState15,
|
|
59
59
|
useEffect as useEffect8,
|
|
60
60
|
useLayoutEffect as useLayoutEffect5,
|
|
61
61
|
useRef as useRef21,
|
|
@@ -418,7 +418,8 @@ var PlaylistMixerContext = slot();
|
|
|
418
418
|
var TrackReorderPreviewContext = slot();
|
|
419
419
|
var TrimPreviewContext = slot();
|
|
420
420
|
var TrimPreviewPeaksContext = slot();
|
|
421
|
-
var
|
|
421
|
+
var DragGuardContext = slot();
|
|
422
|
+
var RecordingTrackContext = slot();
|
|
422
423
|
var PlaybackRateContext = slot();
|
|
423
424
|
var MediaElementTrackContext = slot();
|
|
424
425
|
function useSlot(context, hookName, needs) {
|
|
@@ -456,7 +457,7 @@ var useUndoRedo = () => useSlot(UndoRedoContext, "useUndoRedo", WEB_AUDIO);
|
|
|
456
457
|
var usePlaylistTimeline = () => useSlot(PlaylistTimelineContext, "usePlaylistTimeline", WEB_AUDIO);
|
|
457
458
|
var usePlaylistMixer = () => useSlot(PlaylistMixerContext, "usePlaylistMixer", WEB_AUDIO);
|
|
458
459
|
var useTrackReorderPreview = () => useSlot(TrackReorderPreviewContext, "useTrackReorderPreview", WEB_AUDIO);
|
|
459
|
-
var
|
|
460
|
+
var useRecordingTrack = () => useSlot(RecordingTrackContext, "useRecordingTrack", WEB_AUDIO);
|
|
460
461
|
var usePlaybackRate = () => useSlot(PlaybackRateContext, "usePlaybackRate", MEDIA_ELEMENT);
|
|
461
462
|
var useMediaElementTrack = () => useSlot(MediaElementTrackContext, "useMediaElementTrack", MEDIA_ELEMENT);
|
|
462
463
|
var useWebAudioProviderOnly = (hookName) => {
|
|
@@ -471,6 +472,7 @@ var usePlaylistViewOptional = () => orNull(use(PlaylistViewContext));
|
|
|
471
472
|
var usePlaylistZoomOptional = () => orNull(use(PlaylistZoomContext));
|
|
472
473
|
var useTrimPreviewOptional = () => orNull(use(TrimPreviewContext));
|
|
473
474
|
var useTrimPreviewPeaksOptional = () => orNull(use(TrimPreviewPeaksContext));
|
|
475
|
+
var useDragGuardOptional = () => orNull(use(DragGuardContext));
|
|
474
476
|
|
|
475
477
|
// src/hooks/useClipDragHandlers.ts
|
|
476
478
|
function trimOrderFor(clips, clip) {
|
|
@@ -533,6 +535,14 @@ function useClipDragHandlers({
|
|
|
533
535
|
const trimDragRef = React.useRef(null);
|
|
534
536
|
const lastBoundaryDeltaRef = React.useRef(0);
|
|
535
537
|
const moveDragRef = React.useRef(null);
|
|
538
|
+
const dragGuard = useDragGuardOptional();
|
|
539
|
+
const endGuardRef = React.useRef(null);
|
|
540
|
+
const endGuard = React.useCallback(() => {
|
|
541
|
+
var _a;
|
|
542
|
+
(_a = endGuardRef.current) == null ? void 0 : _a.call(endGuardRef);
|
|
543
|
+
endGuardRef.current = null;
|
|
544
|
+
}, []);
|
|
545
|
+
React.useEffect(() => endGuard, [endGuard]);
|
|
536
546
|
React.useEffect(() => {
|
|
537
547
|
if (!preview) return;
|
|
538
548
|
return () => {
|
|
@@ -544,9 +554,11 @@ function useClipDragHandlers({
|
|
|
544
554
|
}, [preview]);
|
|
545
555
|
const onDragStart = React.useCallback(
|
|
546
556
|
(event) => {
|
|
547
|
-
var _a;
|
|
557
|
+
var _a, _b;
|
|
548
558
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
549
559
|
if (!data || data.kind === "track-reorder") return;
|
|
560
|
+
endGuard();
|
|
561
|
+
endGuardRef.current = (_b = dragGuard == null ? void 0 : dragGuard.begin()) != null ? _b : null;
|
|
550
562
|
trimDragRef.current = null;
|
|
551
563
|
trimOrderRef.current = null;
|
|
552
564
|
moveDragRef.current = null;
|
|
@@ -572,7 +584,7 @@ function useClipDragHandlers({
|
|
|
572
584
|
};
|
|
573
585
|
trimOrderRef.current = trimOrderFor(clips, clip);
|
|
574
586
|
},
|
|
575
|
-
[arrangement]
|
|
587
|
+
[arrangement, dragGuard, endGuard]
|
|
576
588
|
);
|
|
577
589
|
const onDragMove = React.useCallback(
|
|
578
590
|
(event) => {
|
|
@@ -624,6 +636,7 @@ function useClipDragHandlers({
|
|
|
624
636
|
var _a, _b;
|
|
625
637
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
626
638
|
if ((data == null ? void 0 : data.kind) === "track-reorder") return;
|
|
639
|
+
endGuard();
|
|
627
640
|
const drag = trimDragRef.current;
|
|
628
641
|
const move = moveDragRef.current;
|
|
629
642
|
const delta = lastBoundaryDeltaRef.current;
|
|
@@ -656,7 +669,7 @@ function useClipDragHandlers({
|
|
|
656
669
|
arrangement.moveClip(track.id, clipId, Math.floor(sampleDelta));
|
|
657
670
|
}
|
|
658
671
|
},
|
|
659
|
-
[samplesPerPixel, arrangement, preview, commitTrim]
|
|
672
|
+
[samplesPerPixel, arrangement, preview, commitTrim, endGuard]
|
|
660
673
|
);
|
|
661
674
|
return {
|
|
662
675
|
onDragStart,
|
|
@@ -2710,19 +2723,20 @@ function deriveRows(tracks, inputs, previous) {
|
|
|
2710
2723
|
});
|
|
2711
2724
|
return { byTrackId, result: sameItems(previous.result, rows) ? previous.result : rows };
|
|
2712
2725
|
}
|
|
2713
|
-
function sameState(a, name, mix) {
|
|
2714
|
-
return a.name === name && a.volume === mix.volume && a.muted ===
|
|
2726
|
+
function sameState(a, name, mix, muted) {
|
|
2727
|
+
return a.name === name && a.volume === mix.volume && a.muted === muted && a.soloed === mix.soloed && a.pan === mix.pan;
|
|
2715
2728
|
}
|
|
2716
|
-
function deriveTrackStates(tracks, mixer, previous) {
|
|
2729
|
+
function deriveTrackStates(tracks, mixer, recordingTrackIds, previous) {
|
|
2717
2730
|
const byTrackId = /* @__PURE__ */ new Map();
|
|
2718
2731
|
const states = tracks.map((track) => {
|
|
2719
2732
|
var _a;
|
|
2720
2733
|
const mix = (_a = mixer.get(track.id)) != null ? _a : DEFAULT_MIX;
|
|
2734
|
+
const muted = mix.muted || recordingTrackIds.has(track.id);
|
|
2721
2735
|
const before = previous.byTrackId.get(track.id);
|
|
2722
|
-
const state = before && sameState(before, track.name, mix) ? before : {
|
|
2736
|
+
const state = before && sameState(before, track.name, mix, muted) ? before : {
|
|
2723
2737
|
name: track.name,
|
|
2724
2738
|
volume: mix.volume,
|
|
2725
|
-
muted
|
|
2739
|
+
muted,
|
|
2726
2740
|
soloed: mix.soloed,
|
|
2727
2741
|
pan: mix.pan
|
|
2728
2742
|
};
|
|
@@ -2742,12 +2756,14 @@ function useArrangementValue(arrangement, read) {
|
|
|
2742
2756
|
return useSyncExternalStore7(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
2743
2757
|
}
|
|
2744
2758
|
var readMixer = (arrangement) => arrangement.getMixer();
|
|
2759
|
+
var readRecordingTrackIds = (arrangement) => arrangement.recordingTrackIds;
|
|
2745
2760
|
var readCanUndo = (arrangement) => arrangement.canUndo;
|
|
2746
2761
|
var readCanRedo = (arrangement) => arrangement.canRedo;
|
|
2747
2762
|
function useArrangementView(arrangement, options) {
|
|
2748
2763
|
const { samplesPerPixel, mono, baseScale, placeholderSampleRate } = options;
|
|
2749
2764
|
const arrangementTracks = useArrangementTracks(arrangement);
|
|
2750
2765
|
const mixer = useArrangementValue(arrangement, readMixer);
|
|
2766
|
+
const recordingTrackIds = useArrangementValue(arrangement, readRecordingTrackIds);
|
|
2751
2767
|
const canUndo = useArrangementValue(arrangement, readCanUndo);
|
|
2752
2768
|
const canRedo = useArrangementValue(arrangement, readCanRedo);
|
|
2753
2769
|
const loadedCacheRef = useRef17(EMPTY_LOADED_TRACKS);
|
|
@@ -2777,10 +2793,15 @@ function useArrangementView(arrangement, options) {
|
|
|
2777
2793
|
const duration = useMemo9(() => timelineDuration(tracks), [tracks]);
|
|
2778
2794
|
const statesCacheRef = useRef17(EMPTY_STATES);
|
|
2779
2795
|
const trackStates = useMemo9(() => {
|
|
2780
|
-
const next = deriveTrackStates(
|
|
2796
|
+
const next = deriveTrackStates(
|
|
2797
|
+
arrangementTracks,
|
|
2798
|
+
mixer,
|
|
2799
|
+
recordingTrackIds,
|
|
2800
|
+
statesCacheRef.current
|
|
2801
|
+
);
|
|
2781
2802
|
statesCacheRef.current = next;
|
|
2782
2803
|
return next.result;
|
|
2783
|
-
}, [arrangementTracks, mixer]);
|
|
2804
|
+
}, [arrangementTracks, mixer, recordingTrackIds]);
|
|
2784
2805
|
return {
|
|
2785
2806
|
tracks,
|
|
2786
2807
|
peaksDataArray,
|
|
@@ -2852,8 +2873,7 @@ function useReadyOnce(options) {
|
|
|
2852
2873
|
}
|
|
2853
2874
|
|
|
2854
2875
|
// src/providerInternals/useArrangementEditing.ts
|
|
2855
|
-
import { useCallback as useCallback18, useEffect as useEffect6, useMemo as useMemo10, useRef as useRef19,
|
|
2856
|
-
import { createValueSource as createValueSource3 } from "@waveform-playlist/core";
|
|
2876
|
+
import { useCallback as useCallback18, useEffect as useEffect6, useMemo as useMemo10, useRef as useRef19, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
2857
2877
|
|
|
2858
2878
|
// src/components/partWarnings.ts
|
|
2859
2879
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -2873,63 +2893,71 @@ function isTrackId(setter, trackId) {
|
|
|
2873
2893
|
);
|
|
2874
2894
|
return false;
|
|
2875
2895
|
}
|
|
2896
|
+
var readRecordingTrackId = (arrangement) => {
|
|
2897
|
+
for (const id of arrangement.recordingTrackIds) return id;
|
|
2898
|
+
return null;
|
|
2899
|
+
};
|
|
2900
|
+
function clearRecordingTracks(arrangement, keep = null) {
|
|
2901
|
+
for (const id of [...arrangement.recordingTrackIds]) {
|
|
2902
|
+
if (id !== keep) arrangement.setTrackRecording(id, false);
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2876
2905
|
function useRecordingActive(arrangement) {
|
|
2877
2906
|
const recordingActiveRef = useRef19(false);
|
|
2878
|
-
const [armed] = useState15(() => createValueSource3(null));
|
|
2879
2907
|
const setRecordingActive = useCallback18(
|
|
2880
|
-
(active,
|
|
2881
|
-
var _a, _b;
|
|
2908
|
+
(active, recordingTrackId2) => {
|
|
2882
2909
|
recordingActiveRef.current = active;
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
armed.publish({ trackId: armedTrackId2, prevMuted });
|
|
2889
|
-
arrangement.setTrackMute(armedTrackId2, true);
|
|
2890
|
-
} else if (!active && current) {
|
|
2891
|
-
arrangement.setTrackMute(current.trackId, current.prevMuted);
|
|
2892
|
-
armed.publish(null);
|
|
2910
|
+
if (active && recordingTrackId2) {
|
|
2911
|
+
clearRecordingTracks(arrangement, recordingTrackId2);
|
|
2912
|
+
arrangement.setTrackRecording(recordingTrackId2, true);
|
|
2913
|
+
} else if (!active) {
|
|
2914
|
+
clearRecordingTracks(arrangement);
|
|
2893
2915
|
}
|
|
2894
2916
|
},
|
|
2895
|
-
[arrangement
|
|
2917
|
+
[arrangement]
|
|
2896
2918
|
);
|
|
2897
2919
|
useEffect6(
|
|
2898
2920
|
() => () => {
|
|
2899
|
-
if (
|
|
2921
|
+
if (arrangement.recordingTrackIds.size > 0) setRecordingActive(false);
|
|
2900
2922
|
},
|
|
2901
|
-
[
|
|
2923
|
+
[arrangement, setRecordingActive]
|
|
2902
2924
|
);
|
|
2903
|
-
const
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
const
|
|
2908
|
-
const
|
|
2909
|
-
|
|
2925
|
+
const subscribe = useCallback18(
|
|
2926
|
+
(listener) => arrangement.subscribe(listener),
|
|
2927
|
+
[arrangement]
|
|
2928
|
+
);
|
|
2929
|
+
const getRecordingTrackId = useCallback18(() => readRecordingTrackId(arrangement), [arrangement]);
|
|
2930
|
+
const recordingTrackId = useSyncExternalStore8(
|
|
2931
|
+
subscribe,
|
|
2932
|
+
getRecordingTrackId,
|
|
2933
|
+
getRecordingTrackId
|
|
2934
|
+
);
|
|
2935
|
+
const recordingTrack = useMemo10(() => ({ recordingTrackId }), [recordingTrackId]);
|
|
2936
|
+
return { setRecordingActive, recordingActiveRef, recordingTrack };
|
|
2910
2937
|
}
|
|
2911
|
-
function useArrangementEditing(arrangement) {
|
|
2938
|
+
function useArrangementEditing(arrangement, dragGuard) {
|
|
2912
2939
|
const setTrackMute = useCallback18(
|
|
2913
|
-
(trackId, muted) => {
|
|
2914
|
-
if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted);
|
|
2940
|
+
(trackId, muted, options) => {
|
|
2941
|
+
if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted, options);
|
|
2915
2942
|
},
|
|
2916
2943
|
[arrangement]
|
|
2917
2944
|
);
|
|
2918
2945
|
const setTrackSolo = useCallback18(
|
|
2919
|
-
(trackId, soloed) => {
|
|
2920
|
-
if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed);
|
|
2946
|
+
(trackId, soloed, options) => {
|
|
2947
|
+
if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed, options);
|
|
2921
2948
|
},
|
|
2922
2949
|
[arrangement]
|
|
2923
2950
|
);
|
|
2924
2951
|
const setTrackVolume = useCallback18(
|
|
2925
|
-
(trackId, volume) => {
|
|
2926
|
-
if (isTrackId("setTrackVolume", trackId))
|
|
2952
|
+
(trackId, volume, options) => {
|
|
2953
|
+
if (isTrackId("setTrackVolume", trackId))
|
|
2954
|
+
arrangement.setTrackVolume(trackId, volume, options);
|
|
2927
2955
|
},
|
|
2928
2956
|
[arrangement]
|
|
2929
2957
|
);
|
|
2930
2958
|
const setTrackPan = useCallback18(
|
|
2931
|
-
(trackId, pan) => {
|
|
2932
|
-
if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan);
|
|
2959
|
+
(trackId, pan, options) => {
|
|
2960
|
+
if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan, options);
|
|
2933
2961
|
},
|
|
2934
2962
|
[arrangement]
|
|
2935
2963
|
);
|
|
@@ -2937,9 +2965,13 @@ function useArrangementEditing(arrangement) {
|
|
|
2937
2965
|
(trackId, toIndex) => arrangement.reorderTrack(trackId, toIndex),
|
|
2938
2966
|
[arrangement]
|
|
2939
2967
|
);
|
|
2940
|
-
const undo = useCallback18(() =>
|
|
2941
|
-
|
|
2942
|
-
|
|
2968
|
+
const undo = useCallback18(() => {
|
|
2969
|
+
if (!dragGuard.active) arrangement.undo();
|
|
2970
|
+
}, [arrangement, dragGuard]);
|
|
2971
|
+
const redo = useCallback18(() => {
|
|
2972
|
+
if (!dragGuard.active) arrangement.redo();
|
|
2973
|
+
}, [arrangement, dragGuard]);
|
|
2974
|
+
const { setRecordingActive, recordingActiveRef, recordingTrack } = useRecordingActive(arrangement);
|
|
2943
2975
|
return {
|
|
2944
2976
|
setTrackMute,
|
|
2945
2977
|
setTrackSolo,
|
|
@@ -2950,7 +2982,26 @@ function useArrangementEditing(arrangement) {
|
|
|
2950
2982
|
redo,
|
|
2951
2983
|
setRecordingActive,
|
|
2952
2984
|
recordingActiveRef,
|
|
2953
|
-
|
|
2985
|
+
recordingTrack
|
|
2986
|
+
};
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// src/providerInternals/dragGuard.ts
|
|
2990
|
+
function createDragGuard() {
|
|
2991
|
+
let count = 0;
|
|
2992
|
+
return {
|
|
2993
|
+
begin() {
|
|
2994
|
+
count++;
|
|
2995
|
+
let ended = false;
|
|
2996
|
+
return () => {
|
|
2997
|
+
if (ended) return;
|
|
2998
|
+
ended = true;
|
|
2999
|
+
count--;
|
|
3000
|
+
};
|
|
3001
|
+
},
|
|
3002
|
+
get active() {
|
|
3003
|
+
return count > 0;
|
|
3004
|
+
}
|
|
2954
3005
|
};
|
|
2955
3006
|
}
|
|
2956
3007
|
|
|
@@ -3044,9 +3095,9 @@ var ProviderOnArrangement = ({
|
|
|
3044
3095
|
setAutomaticScroll
|
|
3045
3096
|
} = useScrollFollow(automaticScroll);
|
|
3046
3097
|
const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
|
|
3047
|
-
const [isPlaying, setIsPlaying] =
|
|
3048
|
-
const [currentTime, setCurrentTime] =
|
|
3049
|
-
const [trackDragPreview, setTrackDragPreview] =
|
|
3098
|
+
const [isPlaying, setIsPlaying] = useState15(false);
|
|
3099
|
+
const [currentTime, setCurrentTime] = useState15(0);
|
|
3100
|
+
const [trackDragPreview, setTrackDragPreview] = useState15(null);
|
|
3050
3101
|
const indefinitePlaybackRef = useRef21(indefinitePlayback);
|
|
3051
3102
|
indefinitePlaybackRef.current = indefinitePlayback;
|
|
3052
3103
|
const isPlayingRef = useRef21(false);
|
|
@@ -3200,7 +3251,8 @@ var ProviderOnArrangement = ({
|
|
|
3200
3251
|
peaksOptions: view.peaksOptions,
|
|
3201
3252
|
peaksCacheRef: view.peaksCacheRef
|
|
3202
3253
|
});
|
|
3203
|
-
const
|
|
3254
|
+
const [dragGuard] = useState15(createDragGuard);
|
|
3255
|
+
const editing = useArrangementEditing(arrangement, dragGuard);
|
|
3204
3256
|
const { recordingActiveRef } = editing;
|
|
3205
3257
|
const setLoopRegionFromSelection = useCallback19(() => {
|
|
3206
3258
|
var _a, _b;
|
|
@@ -3818,30 +3870,36 @@ var ProviderOnArrangement = ({
|
|
|
3818
3870
|
() => ({ trackDragPreview }),
|
|
3819
3871
|
[trackDragPreview]
|
|
3820
3872
|
);
|
|
3821
|
-
return /* @__PURE__ */ jsx(ThemeProvider, { theme: mergedTheme, children: /* @__PURE__ */ jsx(PlaybackRateContext, { value: BLOCKED, children: /* @__PURE__ */ jsx(MediaElementTrackContext, { value: BLOCKED, children: /* @__PURE__ */ jsx(ArrangementContext, { value: arrangement, children: /* @__PURE__ */ jsx(PlaybackRefsContext, { value: refsValue, children: /* @__PURE__ */ jsx(EngineRefsContext, { value: engineRefsValue, children: /* @__PURE__ */ jsx(TrimPreviewContext, { value: trimPreview, children: /* @__PURE__ */ jsx(TrimPreviewPeaksContext, { value: trimPreviewPeaks, children: /* @__PURE__ */ jsx(PlaybackControlsContext, { value: controlsValue, children: /* @__PURE__ */ jsx(EditorControlsContext, { value: editorControlsValue, children: /* @__PURE__ */ jsx(PlaylistViewContext, { value: viewValue, children: /* @__PURE__ */ jsx(PlaylistSettingsContext, { value: settingsValue, children: /* @__PURE__ */ jsx(PlaylistZoomContext, { value: zoomValue, children: /* @__PURE__ */ jsx(UndoRedoContext, { value: undoRedoValue, children: /* @__PURE__ */ jsx(SelectedTrackIdContext, { value: selectedTrackIdValue, children: /* @__PURE__ */ jsx(SelectedRowContext, { value: selectedTrackIdValue, children: /* @__PURE__ */ jsx(LoopContext, { value: loopValue, children: /* @__PURE__ */ jsx(AnnotationOptionsContext, { value: annotationOptionsValue, children: /* @__PURE__ */ jsx(AnnotationsContext, { value: annotationsValue, children: /* @__PURE__ */ jsx(IsPlayingContext, { value: isPlayingValue, children: /* @__PURE__ */ jsx(
|
|
3822
|
-
|
|
3873
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { theme: mergedTheme, children: /* @__PURE__ */ jsx(PlaybackRateContext, { value: BLOCKED, children: /* @__PURE__ */ jsx(MediaElementTrackContext, { value: BLOCKED, children: /* @__PURE__ */ jsx(ArrangementContext, { value: arrangement, children: /* @__PURE__ */ jsx(PlaybackRefsContext, { value: refsValue, children: /* @__PURE__ */ jsx(EngineRefsContext, { value: engineRefsValue, children: /* @__PURE__ */ jsx(DragGuardContext, { value: dragGuard, children: /* @__PURE__ */ jsx(TrimPreviewContext, { value: trimPreview, children: /* @__PURE__ */ jsx(TrimPreviewPeaksContext, { value: trimPreviewPeaks, children: /* @__PURE__ */ jsx(PlaybackControlsContext, { value: controlsValue, children: /* @__PURE__ */ jsx(EditorControlsContext, { value: editorControlsValue, children: /* @__PURE__ */ jsx(PlaylistViewContext, { value: viewValue, children: /* @__PURE__ */ jsx(PlaylistSettingsContext, { value: settingsValue, children: /* @__PURE__ */ jsx(PlaylistZoomContext, { value: zoomValue, children: /* @__PURE__ */ jsx(UndoRedoContext, { value: undoRedoValue, children: /* @__PURE__ */ jsx(SelectedTrackIdContext, { value: selectedTrackIdValue, children: /* @__PURE__ */ jsx(SelectedRowContext, { value: selectedTrackIdValue, children: /* @__PURE__ */ jsx(LoopContext, { value: loopValue, children: /* @__PURE__ */ jsx(AnnotationOptionsContext, { value: annotationOptionsValue, children: /* @__PURE__ */ jsx(AnnotationsContext, { value: annotationsValue, children: /* @__PURE__ */ jsx(IsPlayingContext, { value: isPlayingValue, children: /* @__PURE__ */ jsx(
|
|
3874
|
+
ActiveAnnotationContext,
|
|
3823
3875
|
{
|
|
3824
|
-
value:
|
|
3825
|
-
children: /* @__PURE__ */ jsx(
|
|
3826
|
-
|
|
3876
|
+
value: activeAnnotationValue,
|
|
3877
|
+
children: /* @__PURE__ */ jsx(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ jsx(SelectionContext, { value: selectionValue, children: /* @__PURE__ */ jsx(
|
|
3878
|
+
TrackReorderPreviewContext,
|
|
3827
3879
|
{
|
|
3828
|
-
value:
|
|
3829
|
-
children: /* @__PURE__ */ jsx(
|
|
3830
|
-
|
|
3880
|
+
value: reorderPreviewValue,
|
|
3881
|
+
children: /* @__PURE__ */ jsx(PlaylistMixerContext, { value: mixerValue, children: /* @__PURE__ */ jsx(
|
|
3882
|
+
PlaylistTimelineContext,
|
|
3831
3883
|
{
|
|
3832
|
-
value:
|
|
3833
|
-
children
|
|
3884
|
+
value: timelineValue,
|
|
3885
|
+
children: /* @__PURE__ */ jsx(
|
|
3886
|
+
RecordingTrackContext,
|
|
3887
|
+
{
|
|
3888
|
+
value: editing.recordingTrack,
|
|
3889
|
+
children
|
|
3890
|
+
}
|
|
3891
|
+
)
|
|
3834
3892
|
}
|
|
3835
|
-
)
|
|
3893
|
+
) })
|
|
3836
3894
|
}
|
|
3837
|
-
) })
|
|
3895
|
+
) }) })
|
|
3838
3896
|
}
|
|
3839
|
-
) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) })
|
|
3897
|
+
) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
3840
3898
|
};
|
|
3841
3899
|
|
|
3842
3900
|
// src/MediaElementPlaylistContext.tsx
|
|
3843
3901
|
import {
|
|
3844
|
-
useState as
|
|
3902
|
+
useState as useState16,
|
|
3845
3903
|
useEffect as useEffect9,
|
|
3846
3904
|
useLayoutEffect as useLayoutEffect6,
|
|
3847
3905
|
useRef as useRef22,
|
|
@@ -3892,16 +3950,16 @@ var MediaElementPlaylistProvider = ({
|
|
|
3892
3950
|
children
|
|
3893
3951
|
}) => {
|
|
3894
3952
|
const mergedTheme = useMergedTheme(userThemeProp);
|
|
3895
|
-
const [isPlaying, setIsPlayingState] =
|
|
3953
|
+
const [isPlaying, setIsPlayingState] = useState16(false);
|
|
3896
3954
|
const isPlayingRef = useRef22(false);
|
|
3897
3955
|
const setIsPlaying = useCallback20((playing) => {
|
|
3898
3956
|
isPlayingRef.current = playing;
|
|
3899
3957
|
setIsPlayingState(playing);
|
|
3900
3958
|
}, []);
|
|
3901
|
-
const [currentTime, setCurrentTime] =
|
|
3902
|
-
const [isReady, setIsReady] =
|
|
3903
|
-
const [playbackRate, setPlaybackRateState] =
|
|
3904
|
-
const [ratePropSeen, setRatePropSeen] =
|
|
3959
|
+
const [currentTime, setCurrentTime] = useState16(0);
|
|
3960
|
+
const [isReady, setIsReady] = useState16(false);
|
|
3961
|
+
const [playbackRate, setPlaybackRateState] = useState16(initialPlaybackRate);
|
|
3962
|
+
const [ratePropSeen, setRatePropSeen] = useState16(initialPlaybackRate);
|
|
3905
3963
|
if (!Object.is(ratePropSeen, initialPlaybackRate)) {
|
|
3906
3964
|
setRatePropSeen(initialPlaybackRate);
|
|
3907
3965
|
setPlaybackRateState(initialPlaybackRate);
|
|
@@ -3938,12 +3996,12 @@ var MediaElementPlaylistProvider = ({
|
|
|
3938
3996
|
setAutomaticScroll
|
|
3939
3997
|
} = useScrollFollow(automaticScroll);
|
|
3940
3998
|
const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
|
|
3941
|
-
const [selection, setSelectionState] =
|
|
3999
|
+
const [selection, setSelectionState] = useState16({
|
|
3942
4000
|
selectionStart: 0,
|
|
3943
4001
|
selectionEnd: 0
|
|
3944
4002
|
});
|
|
3945
4003
|
const selectionRef = useRef22(selection);
|
|
3946
|
-
const [samplesPerPixel] =
|
|
4004
|
+
const [samplesPerPixel] = useState16(initialSamplesPerPixel);
|
|
3947
4005
|
const { timeFormat, setTimeFormat } = useTimeFormat();
|
|
3948
4006
|
const playoutRef = useRef22(null);
|
|
3949
4007
|
const currentTimeRef = useRef22(0);
|
|
@@ -4420,7 +4478,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4420
4478
|
ActiveAnnotationContext,
|
|
4421
4479
|
{
|
|
4422
4480
|
value: activeAnnotationValue,
|
|
4423
|
-
children: /* @__PURE__ */ jsx2(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ jsx2(SelectionContext, { value: selection, children: /* @__PURE__ */ jsx2(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ jsx2(
|
|
4481
|
+
children: /* @__PURE__ */ jsx2(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ jsx2(SelectionContext, { value: selection, children: /* @__PURE__ */ jsx2(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ jsx2(RecordingTrackContext, { value: BLOCKED, children }) }) }) })
|
|
4424
4482
|
}
|
|
4425
4483
|
) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
4426
4484
|
};
|
|
@@ -4670,7 +4728,7 @@ var AutomaticScrollCheckbox = ({ className }) => {
|
|
|
4670
4728
|
import {
|
|
4671
4729
|
use as use13,
|
|
4672
4730
|
useLayoutEffect as useLayoutEffect9,
|
|
4673
|
-
useRef as
|
|
4731
|
+
useRef as useRef31,
|
|
4674
4732
|
useState as useState21,
|
|
4675
4733
|
useMemo as useMemo20,
|
|
4676
4734
|
useCallback as useCallback26
|
|
@@ -4712,9 +4770,9 @@ function trackIdAtOffset(orderedIds, layout, heightById, y) {
|
|
|
4712
4770
|
}
|
|
4713
4771
|
|
|
4714
4772
|
// src/hooks/useTrailingActive.ts
|
|
4715
|
-
import { useEffect as useEffect11, useState as
|
|
4773
|
+
import { useEffect as useEffect11, useState as useState17 } from "react";
|
|
4716
4774
|
function useTrailingActive(active, trailingMs) {
|
|
4717
|
-
const [trailing, setTrailing] =
|
|
4775
|
+
const [trailing, setTrailing] = useState17(active);
|
|
4718
4776
|
useEffect11(() => {
|
|
4719
4777
|
if (active) {
|
|
4720
4778
|
setTrailing(true);
|
|
@@ -4884,8 +4942,8 @@ import {
|
|
|
4884
4942
|
} from "@waveform-playlist/ui-components";
|
|
4885
4943
|
|
|
4886
4944
|
// src/hooks/useSelectionDrag.ts
|
|
4887
|
-
import { createContext as createContext3, memo as memo2, useLayoutEffect as useLayoutEffect8, useMemo as useMemo14, useRef as useRef25, useState as
|
|
4888
|
-
import { createValueSource as
|
|
4945
|
+
import { createContext as createContext3, memo as memo2, useLayoutEffect as useLayoutEffect8, useMemo as useMemo14, useRef as useRef25, useState as useState18 } from "react";
|
|
4946
|
+
import { createValueSource as createValueSource3 } from "@waveform-playlist/core";
|
|
4889
4947
|
|
|
4890
4948
|
// src/hooks/useWindowDrag.ts
|
|
4891
4949
|
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect7, useRef as useRef24 } from "react";
|
|
@@ -4968,9 +5026,9 @@ function useSelectionDrag({
|
|
|
4968
5026
|
}) {
|
|
4969
5027
|
const { isPlaying } = useIsPlaying();
|
|
4970
5028
|
const { setSelection } = usePlaybackControls();
|
|
4971
|
-
const [isSelecting, setIsSelecting] =
|
|
5029
|
+
const [isSelecting, setIsSelecting] = useState18(false);
|
|
4972
5030
|
const automaticScrollRef = useRef25(false);
|
|
4973
|
-
const previewHandle = useMemo14(() =>
|
|
5031
|
+
const previewHandle = useMemo14(() => createValueSource3(null), []);
|
|
4974
5032
|
const pressTimeRef = useRef25(0);
|
|
4975
5033
|
const wroteSelectionRef = useRef25(false);
|
|
4976
5034
|
const dragElementRef = useRef25(null);
|
|
@@ -5628,8 +5686,8 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5628
5686
|
var _a, _b;
|
|
5629
5687
|
const track = rowList[trackIndex];
|
|
5630
5688
|
if (!track) return null;
|
|
5631
|
-
const
|
|
5632
|
-
const recordingChannels =
|
|
5689
|
+
const isRecordingTrack = (recordingState == null ? void 0 : recordingState.isRecording) === true && recordingState.trackId === track.id;
|
|
5690
|
+
const recordingChannels = isRecordingTrack ? recordingChannelCount : 0;
|
|
5633
5691
|
const helpers = spectrogramHelpersById.get(track.id);
|
|
5634
5692
|
return /* @__PURE__ */ jsx8(
|
|
5635
5693
|
TrackRow,
|
|
@@ -5647,7 +5705,7 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5647
5705
|
numChannels: getTrackChannelCount(trackClipPeaks, recordingChannels),
|
|
5648
5706
|
waveHeight,
|
|
5649
5707
|
mono,
|
|
5650
|
-
recordingState:
|
|
5708
|
+
recordingState: isRecordingTrack ? recordingState : void 0,
|
|
5651
5709
|
spectrogramConfig: helpers == null ? void 0 : helpers.config,
|
|
5652
5710
|
frequencyScaleFn: helpers == null ? void 0 : helpers.frequencyScaleFn,
|
|
5653
5711
|
samplesPerPixel,
|
|
@@ -5660,7 +5718,7 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5660
5718
|
};
|
|
5661
5719
|
|
|
5662
5720
|
// src/components/TrackControlsColumn.tsx
|
|
5663
|
-
import React12, { use as use9, useMemo as useMemo17, useRef as
|
|
5721
|
+
import React12, { use as use9, useMemo as useMemo17, useRef as useRef29, useState as useState20 } from "react";
|
|
5664
5722
|
|
|
5665
5723
|
// src/components/DefaultTrackControls.tsx
|
|
5666
5724
|
import React11 from "react";
|
|
@@ -5668,7 +5726,8 @@ import styled4 from "styled-components";
|
|
|
5668
5726
|
import { ButtonGroup, Controls, Header } from "@waveform-playlist/ui-components";
|
|
5669
5727
|
|
|
5670
5728
|
// src/components/TrackControlPieces.tsx
|
|
5671
|
-
import { use as use8 } from "react";
|
|
5729
|
+
import { use as use8, useEffect as useEffect15, useRef as useRef27, useState as useState19 } from "react";
|
|
5730
|
+
import { createMixerGesture } from "@waveform-playlist/core";
|
|
5672
5731
|
import {
|
|
5673
5732
|
Button,
|
|
5674
5733
|
CloseButton,
|
|
@@ -5822,13 +5881,13 @@ var TrackName = () => {
|
|
|
5822
5881
|
return /* @__PURE__ */ jsx9("span", { "data-track-name": "", style: NAME_STYLE, children: name });
|
|
5823
5882
|
};
|
|
5824
5883
|
var TrackMuteButton = () => {
|
|
5825
|
-
const { muted, setMuted,
|
|
5884
|
+
const { muted, setMuted, isRecording } = useTrack();
|
|
5826
5885
|
return /* @__PURE__ */ jsx9(
|
|
5827
5886
|
Button,
|
|
5828
5887
|
{
|
|
5829
5888
|
$variant: muted ? "danger" : "outline",
|
|
5830
5889
|
"aria-pressed": muted,
|
|
5831
|
-
disabled:
|
|
5890
|
+
disabled: isRecording,
|
|
5832
5891
|
onClick: () => setMuted(!muted),
|
|
5833
5892
|
children: "Mute"
|
|
5834
5893
|
}
|
|
@@ -5846,8 +5905,18 @@ var TrackSoloButton = () => {
|
|
|
5846
5905
|
}
|
|
5847
5906
|
);
|
|
5848
5907
|
};
|
|
5908
|
+
function useSliderGesture() {
|
|
5909
|
+
const [gesture] = useState19(createMixerGesture);
|
|
5910
|
+
const ref = useRef27(null);
|
|
5911
|
+
useEffect15(() => {
|
|
5912
|
+
const input = ref.current;
|
|
5913
|
+
return input ? gesture.attach(input) : void 0;
|
|
5914
|
+
}, [gesture]);
|
|
5915
|
+
return { gesture, ref };
|
|
5916
|
+
}
|
|
5849
5917
|
var TrackVolumeSlider = () => {
|
|
5850
5918
|
const { volume, setVolume } = useTrack();
|
|
5919
|
+
const { gesture, ref } = useSliderGesture();
|
|
5851
5920
|
return /* @__PURE__ */ jsxs3(SliderWrapper, { children: [
|
|
5852
5921
|
/* @__PURE__ */ jsx9(VolumeDownIcon, {}),
|
|
5853
5922
|
/* @__PURE__ */ jsx9(
|
|
@@ -5856,9 +5925,10 @@ var TrackVolumeSlider = () => {
|
|
|
5856
5925
|
min: "0",
|
|
5857
5926
|
max: "1",
|
|
5858
5927
|
step: "0.01",
|
|
5928
|
+
ref,
|
|
5859
5929
|
value: volume,
|
|
5860
5930
|
"aria-label": "Volume",
|
|
5861
|
-
onChange: (e) => setVolume(parseFloat(e.target.value))
|
|
5931
|
+
onChange: (e) => setVolume(parseFloat(e.target.value), { gesture: gesture.id })
|
|
5862
5932
|
}
|
|
5863
5933
|
),
|
|
5864
5934
|
/* @__PURE__ */ jsx9(VolumeUpIcon, {})
|
|
@@ -5866,6 +5936,7 @@ var TrackVolumeSlider = () => {
|
|
|
5866
5936
|
};
|
|
5867
5937
|
var TrackPanSlider = () => {
|
|
5868
5938
|
const { pan, setPan } = useTrack();
|
|
5939
|
+
const { gesture, ref } = useSliderGesture();
|
|
5869
5940
|
return /* @__PURE__ */ jsxs3(SliderWrapper, { children: [
|
|
5870
5941
|
/* @__PURE__ */ jsx9("span", { children: "L" }),
|
|
5871
5942
|
/* @__PURE__ */ jsx9(
|
|
@@ -5874,9 +5945,10 @@ var TrackPanSlider = () => {
|
|
|
5874
5945
|
min: "-1",
|
|
5875
5946
|
max: "1",
|
|
5876
5947
|
step: "0.01",
|
|
5948
|
+
ref,
|
|
5877
5949
|
value: pan,
|
|
5878
5950
|
"aria-label": "Pan",
|
|
5879
|
-
onChange: (e) => setPan(parseFloat(e.target.value))
|
|
5951
|
+
onChange: (e) => setPan(parseFloat(e.target.value), { gesture: gesture.id })
|
|
5880
5952
|
}
|
|
5881
5953
|
),
|
|
5882
5954
|
/* @__PURE__ */ jsx9("span", { children: "R" })
|
|
@@ -5967,7 +6039,7 @@ function DefaultTrackControlsImpl({ children }) {
|
|
|
5967
6039
|
var DefaultTrackControls = React11.memo(DefaultTrackControlsImpl);
|
|
5968
6040
|
|
|
5969
6041
|
// src/utils/stableTemplate.ts
|
|
5970
|
-
import { isValidElement, useRef as
|
|
6042
|
+
import { isValidElement, useRef as useRef28 } from "react";
|
|
5971
6043
|
function sameStyle(a, b) {
|
|
5972
6044
|
if (Object.is(a, b)) return true;
|
|
5973
6045
|
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
|
|
@@ -5997,7 +6069,7 @@ function sameTemplate(a, b) {
|
|
|
5997
6069
|
return false;
|
|
5998
6070
|
}
|
|
5999
6071
|
function useStableTemplate(template) {
|
|
6000
|
-
const kept =
|
|
6072
|
+
const kept = useRef28(template);
|
|
6001
6073
|
if (!sameTemplate(kept.current, template)) {
|
|
6002
6074
|
kept.current = template;
|
|
6003
6075
|
}
|
|
@@ -6023,7 +6095,7 @@ function TrackControlsSlotImpl({
|
|
|
6023
6095
|
isLast,
|
|
6024
6096
|
renderMode,
|
|
6025
6097
|
hasSpectrogram,
|
|
6026
|
-
|
|
6098
|
+
isRecording,
|
|
6027
6099
|
height,
|
|
6028
6100
|
top,
|
|
6029
6101
|
animate,
|
|
@@ -6038,14 +6110,14 @@ function TrackControlsSlotImpl({
|
|
|
6038
6110
|
setSelectedTrackId
|
|
6039
6111
|
} = useEditorControls();
|
|
6040
6112
|
const shared = use9(TrackControlsSharedContext);
|
|
6041
|
-
const indexRef =
|
|
6113
|
+
const indexRef = useRef29(index);
|
|
6042
6114
|
indexRef.current = index;
|
|
6043
6115
|
const actions = useMemo17(
|
|
6044
6116
|
() => ({
|
|
6045
|
-
setMuted: (value2) => setTrackMute(trackId, value2),
|
|
6046
|
-
setSoloed: (value2) => setTrackSolo(trackId, value2),
|
|
6047
|
-
setVolume: (value2) => setTrackVolume(trackId, value2),
|
|
6048
|
-
setPan: (value2) => setTrackPan(trackId, value2),
|
|
6117
|
+
setMuted: (value2, options) => setTrackMute(trackId, value2, options),
|
|
6118
|
+
setSoloed: (value2, options) => setTrackSolo(trackId, value2, options),
|
|
6119
|
+
setVolume: (value2, options) => setTrackVolume(trackId, value2, options),
|
|
6120
|
+
setPan: (value2, options) => setTrackPan(trackId, value2, options),
|
|
6049
6121
|
select: () => setSelectedTrackId(trackId),
|
|
6050
6122
|
// The engine clamps the target and ignores a move to the same place.
|
|
6051
6123
|
moveUp: () => reorderTrack(trackId, indexRef.current - 1),
|
|
@@ -6079,7 +6151,7 @@ function TrackControlsSlotImpl({
|
|
|
6079
6151
|
isFirst,
|
|
6080
6152
|
isLast,
|
|
6081
6153
|
hasSpectrogram,
|
|
6082
|
-
|
|
6154
|
+
isRecording
|
|
6083
6155
|
}, actions),
|
|
6084
6156
|
[
|
|
6085
6157
|
trackId,
|
|
@@ -6095,11 +6167,11 @@ function TrackControlsSlotImpl({
|
|
|
6095
6167
|
isFirst,
|
|
6096
6168
|
isLast,
|
|
6097
6169
|
hasSpectrogram,
|
|
6098
|
-
|
|
6170
|
+
isRecording,
|
|
6099
6171
|
actions
|
|
6100
6172
|
]
|
|
6101
6173
|
);
|
|
6102
|
-
const elementRef =
|
|
6174
|
+
const elementRef = useRef29(null);
|
|
6103
6175
|
const [isDragSource, setDragSource] = useState20(false);
|
|
6104
6176
|
const wiring = useMemo17(
|
|
6105
6177
|
() => ({ elementRef, setDragSource, handleCount: { current: 0 } }),
|
|
@@ -6136,11 +6208,11 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6136
6208
|
);
|
|
6137
6209
|
}
|
|
6138
6210
|
const { selectedTrackId } = useSelectedTrackId();
|
|
6139
|
-
const {
|
|
6211
|
+
const { recordingTrackId } = useRecordingTrack();
|
|
6140
6212
|
const spectrogram = use9(SpectrogramIntegrationContext);
|
|
6141
6213
|
const { trackStates } = usePlaylistMixer();
|
|
6142
6214
|
const template = useStableTemplate(children != null ? children : DEFAULT_TEMPLATE);
|
|
6143
|
-
const spectrogramRef =
|
|
6215
|
+
const spectrogramRef = useRef29(spectrogram);
|
|
6144
6216
|
spectrogramRef.current = spectrogram;
|
|
6145
6217
|
const menuAvailable = Boolean(spectrogram == null ? void 0 : spectrogram.renderMenuItems);
|
|
6146
6218
|
const shared = useMemo17(
|
|
@@ -6179,7 +6251,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6179
6251
|
isLast: trackIndex === tracks.length - 1,
|
|
6180
6252
|
renderMode: (_a = renderModeById.get(track.id)) != null ? _a : "waveform",
|
|
6181
6253
|
hasSpectrogram: spectrogram !== null && track.kind !== "midi",
|
|
6182
|
-
|
|
6254
|
+
isRecording: track.id === recordingTrackId,
|
|
6183
6255
|
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6184
6256
|
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6185
6257
|
animate: animateTrackLayout && dragSourceTrackId !== null,
|
|
@@ -6200,7 +6272,7 @@ import {
|
|
|
6200
6272
|
} from "@waveform-playlist/ui-components";
|
|
6201
6273
|
|
|
6202
6274
|
// src/components/AnimatedPlayhead.tsx
|
|
6203
|
-
import { useRef as
|
|
6275
|
+
import { useRef as useRef30, useEffect as useEffect16, useId as useId3 } from "react";
|
|
6204
6276
|
import styled5 from "styled-components";
|
|
6205
6277
|
import { usePlaylistInfo as usePlaylistInfo3 } from "@waveform-playlist/ui-components";
|
|
6206
6278
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
@@ -6219,7 +6291,7 @@ var PlayheadLine = styled5.div.attrs((props) => ({
|
|
|
6219
6291
|
will-change: transform;
|
|
6220
6292
|
`;
|
|
6221
6293
|
var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
6222
|
-
const playheadRef =
|
|
6294
|
+
const playheadRef = useRef30(null);
|
|
6223
6295
|
const frameCallbackId = useId3();
|
|
6224
6296
|
const { currentTimeRef, visualTimeRef, registerFrameCallback, unregisterFrameCallback } = usePlaybackRefs();
|
|
6225
6297
|
const { isPlaying } = useIsPlaying();
|
|
@@ -6227,7 +6299,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6227
6299
|
const { sampleRate } = usePlaylistView();
|
|
6228
6300
|
const { progressBarWidth } = usePlaylistInfo3();
|
|
6229
6301
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6230
|
-
|
|
6302
|
+
useEffect16(() => {
|
|
6231
6303
|
if (isPlaying) {
|
|
6232
6304
|
registerFrameCallback(
|
|
6233
6305
|
frameCallbackId,
|
|
@@ -6241,7 +6313,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6241
6313
|
}
|
|
6242
6314
|
return () => unregisterFrameCallback(frameCallbackId);
|
|
6243
6315
|
}, [isPlaying, frameCallbackId, registerFrameCallback, unregisterFrameCallback]);
|
|
6244
|
-
|
|
6316
|
+
useEffect16(() => {
|
|
6245
6317
|
var _a, _b;
|
|
6246
6318
|
if (!isPlaying && playheadRef.current) {
|
|
6247
6319
|
const time = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
|
|
@@ -6715,7 +6787,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6715
6787
|
displayDuration = Math.max(displayDuration, recordingLayout.displayEndSeconds);
|
|
6716
6788
|
}
|
|
6717
6789
|
displayDuration = Math.max(displayDuration, trimPreviewEnd);
|
|
6718
|
-
const tracksRef =
|
|
6790
|
+
const tracksRef = useRef31(tracks);
|
|
6719
6791
|
tracksRef.current = tracks;
|
|
6720
6792
|
const selectTrack = useCallback26(
|
|
6721
6793
|
(trackIndex) => {
|
|
@@ -7197,19 +7269,19 @@ var KeyboardShortcuts = ({
|
|
|
7197
7269
|
};
|
|
7198
7270
|
|
|
7199
7271
|
// src/hooks/useRecordingSession.ts
|
|
7200
|
-
import { useEffect as
|
|
7272
|
+
import { useEffect as useEffect17 } from "react";
|
|
7201
7273
|
function useRecordingSession({ isRecording, trackId }) {
|
|
7202
7274
|
const { setRecordingActive } = useEditorControls();
|
|
7203
|
-
const
|
|
7204
|
-
|
|
7275
|
+
const recordingTrackId = trackId != null ? trackId : null;
|
|
7276
|
+
useEffect17(() => {
|
|
7205
7277
|
if (!isRecording) return void 0;
|
|
7206
|
-
setRecordingActive(true,
|
|
7278
|
+
setRecordingActive(true, recordingTrackId);
|
|
7207
7279
|
return () => setRecordingActive(false);
|
|
7208
|
-
}, [isRecording,
|
|
7280
|
+
}, [isRecording, recordingTrackId, setRecordingActive]);
|
|
7209
7281
|
}
|
|
7210
7282
|
|
|
7211
7283
|
// src/components/ClipInteractionProvider.tsx
|
|
7212
|
-
import React23, { useCallback as useCallback28, useMemo as useMemo23, useRef as
|
|
7284
|
+
import React23, { useCallback as useCallback28, useMemo as useMemo23, useRef as useRef32 } from "react";
|
|
7213
7285
|
import { flushSync as flushSync2 } from "react-dom";
|
|
7214
7286
|
import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
|
|
7215
7287
|
import { RestrictToHorizontalAxis as RestrictToHorizontalAxis2 } from "@dnd-kit/abstract/modifiers";
|
|
@@ -7332,7 +7404,7 @@ var ClipInteractionProvider = ({
|
|
|
7332
7404
|
}
|
|
7333
7405
|
return void 0;
|
|
7334
7406
|
}, [useBeatsSnap, useTimescaleSnap, beatsAndBars, sampleRate, samplesPerPixel]);
|
|
7335
|
-
const tracksRef =
|
|
7407
|
+
const tracksRef = useRef32(tracks);
|
|
7336
7408
|
tracksRef.current = tracks;
|
|
7337
7409
|
const getTracks = useCallback28(() => tracksRef.current, []);
|
|
7338
7410
|
const sensors = useDragSensors({ touchOptimized });
|
|
@@ -7341,11 +7413,21 @@ var ClipInteractionProvider = ({
|
|
|
7341
7413
|
onDragMove,
|
|
7342
7414
|
onDragEnd
|
|
7343
7415
|
} = useClipDragHandlers({ samplesPerPixel, snapSamplePosition });
|
|
7416
|
+
const dragGuard = useDragGuardOptional();
|
|
7417
|
+
const endReorderGuardRef = useRef32(null);
|
|
7418
|
+
const endReorderGuard = useCallback28(() => {
|
|
7419
|
+
var _a;
|
|
7420
|
+
(_a = endReorderGuardRef.current) == null ? void 0 : _a.call(endReorderGuardRef);
|
|
7421
|
+
endReorderGuardRef.current = null;
|
|
7422
|
+
}, []);
|
|
7423
|
+
React23.useEffect(() => endReorderGuard, [endReorderGuard]);
|
|
7344
7424
|
const onDragStart = React23.useCallback(
|
|
7345
7425
|
(event) => {
|
|
7346
|
-
var _a, _b;
|
|
7426
|
+
var _a, _b, _c;
|
|
7347
7427
|
const data = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data;
|
|
7348
7428
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7429
|
+
endReorderGuard();
|
|
7430
|
+
endReorderGuardRef.current = (_c = dragGuard == null ? void 0 : dragGuard.begin()) != null ? _c : null;
|
|
7349
7431
|
if (data.trackId) setSelectedTrackId(data.trackId);
|
|
7350
7432
|
return;
|
|
7351
7433
|
}
|
|
@@ -7356,7 +7438,7 @@ var ClipInteractionProvider = ({
|
|
|
7356
7438
|
}
|
|
7357
7439
|
handleDragStart(event);
|
|
7358
7440
|
},
|
|
7359
|
-
[handleDragStart, setSelectedTrackId]
|
|
7441
|
+
[handleDragStart, setSelectedTrackId, dragGuard, endReorderGuard]
|
|
7360
7442
|
);
|
|
7361
7443
|
const handleDragOver = React23.useCallback(
|
|
7362
7444
|
(event) => {
|
|
@@ -7378,6 +7460,7 @@ var ClipInteractionProvider = ({
|
|
|
7378
7460
|
var _a;
|
|
7379
7461
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7380
7462
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7463
|
+
endReorderGuard();
|
|
7381
7464
|
const sortable = event.operation.source.sortable;
|
|
7382
7465
|
const trackId = data.trackId;
|
|
7383
7466
|
const moves = !event.canceled && trackId && sortable && sortable.index !== sortable.initialIndex;
|
|
@@ -7389,7 +7472,7 @@ var ClipInteractionProvider = ({
|
|
|
7389
7472
|
}
|
|
7390
7473
|
onDragEnd(event);
|
|
7391
7474
|
},
|
|
7392
|
-
[onDragEnd, reorderTrack, setTrackDragPreview]
|
|
7475
|
+
[onDragEnd, reorderTrack, setTrackDragPreview, endReorderGuard]
|
|
7393
7476
|
);
|
|
7394
7477
|
const modifiers = useMemo23(() => {
|
|
7395
7478
|
const mods = [RestrictToHorizontalAxis2];
|