@waveform-playlist/browser 17.0.0-next.5 → 17.0.0-next.7
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 +1 -1
- package/dist/index.d.mts +3 -13
- package/dist/index.d.ts +3 -13
- package/dist/index.js +85 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -148
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -56,8 +56,8 @@ var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0
|
|
|
56
56
|
// src/WaveformPlaylistContext.tsx
|
|
57
57
|
import {
|
|
58
58
|
useState as useState16,
|
|
59
|
-
useEffect as
|
|
60
|
-
useLayoutEffect as
|
|
59
|
+
useEffect as useEffect8,
|
|
60
|
+
useLayoutEffect as useLayoutEffect5,
|
|
61
61
|
useRef as useRef21,
|
|
62
62
|
useCallback as useCallback19,
|
|
63
63
|
useMemo as useMemo11
|
|
@@ -934,29 +934,28 @@ var useClipSplitting = (options) => {
|
|
|
934
934
|
};
|
|
935
935
|
|
|
936
936
|
// src/hooks/useKeyboardShortcuts.ts
|
|
937
|
-
import {
|
|
937
|
+
import { useLayoutEffect, useRef as useRef6 } from "react";
|
|
938
938
|
import { handleKeyboardEvent } from "@waveform-playlist/core";
|
|
939
939
|
var useKeyboardShortcuts = (options) => {
|
|
940
940
|
const { shortcuts, enabled = true } = options;
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
|
|
941
|
+
const latest = useRef6({ shortcuts, enabled });
|
|
942
|
+
useLayoutEffect(() => {
|
|
943
|
+
latest.current = { shortcuts, enabled };
|
|
944
944
|
});
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
const handleKeyDown = (event) => handleKeyboardEvent(event, shortcutsRef.current, true);
|
|
945
|
+
useLayoutEffect(() => {
|
|
946
|
+
const handleKeyDown = (event) => handleKeyboardEvent(event, latest.current.shortcuts, latest.current.enabled);
|
|
948
947
|
window.addEventListener("keydown", handleKeyDown);
|
|
949
948
|
return () => {
|
|
950
949
|
window.removeEventListener("keydown", handleKeyDown);
|
|
951
950
|
};
|
|
952
|
-
}, [
|
|
951
|
+
}, []);
|
|
953
952
|
};
|
|
954
953
|
|
|
955
954
|
// src/hooks/usePlaybackShortcuts.ts
|
|
956
955
|
import { useCallback as useCallback9 } from "react";
|
|
957
956
|
|
|
958
957
|
// src/hooks/usePlayFromSelectionOrCursor.ts
|
|
959
|
-
import { useCallback as useCallback8,
|
|
958
|
+
import { useCallback as useCallback8, useLayoutEffect as useLayoutEffect2, useRef as useRef7 } from "react";
|
|
960
959
|
function usePlayFromSelectionOrCursor() {
|
|
961
960
|
var _a, _b;
|
|
962
961
|
const { currentTimeRef } = usePlaybackRefs();
|
|
@@ -964,7 +963,7 @@ function usePlayFromSelectionOrCursor() {
|
|
|
964
963
|
const isLoopEnabled = (_b = (_a = useLoopOptional()) == null ? void 0 : _a.isLoopEnabled) != null ? _b : false;
|
|
965
964
|
const { play } = usePlaybackControls();
|
|
966
965
|
const latest = useRef7({ selectionStart, selectionEnd, isLoopEnabled });
|
|
967
|
-
|
|
966
|
+
useLayoutEffect2(() => {
|
|
968
967
|
latest.current = { selectionStart, selectionEnd, isLoopEnabled };
|
|
969
968
|
});
|
|
970
969
|
return useCallback8(() => __async(null, null, function* () {
|
|
@@ -1036,7 +1035,7 @@ var usePlaybackShortcuts = (options = {}) => {
|
|
|
1036
1035
|
};
|
|
1037
1036
|
|
|
1038
1037
|
// src/hooks/useAnnotationKeyboardControls.ts
|
|
1039
|
-
import { useCallback as useCallback10, useMemo as useMemo2, useEffect
|
|
1038
|
+
import { useCallback as useCallback10, useMemo as useMemo2, useEffect, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1040
1039
|
|
|
1041
1040
|
// src/utils/annotationBoundaryKeys.ts
|
|
1042
1041
|
var LINK_THRESHOLD = 0.01;
|
|
@@ -1175,7 +1174,7 @@ function useAnnotationKeyboardControls({
|
|
|
1175
1174
|
},
|
|
1176
1175
|
[annotations, scrollContainerRef, samplesPerPixel, sampleRate]
|
|
1177
1176
|
);
|
|
1178
|
-
|
|
1177
|
+
useEffect(() => {
|
|
1179
1178
|
if (activeAnnotationId && (scrollContainerRef == null ? void 0 : scrollContainerRef.current) && samplesPerPixel && sampleRate) {
|
|
1180
1179
|
scrollToAnnotation(activeAnnotationId);
|
|
1181
1180
|
}
|
|
@@ -1338,7 +1337,7 @@ function useAnnotationKeyboardControls({
|
|
|
1338
1337
|
}
|
|
1339
1338
|
|
|
1340
1339
|
// src/hooks/useAnimationFrameLoop.ts
|
|
1341
|
-
import { useCallback as useCallback11, useEffect as
|
|
1340
|
+
import { useCallback as useCallback11, useEffect as useEffect2, useRef as useRef8 } from "react";
|
|
1342
1341
|
var useAnimationFrameLoop = () => {
|
|
1343
1342
|
const animationFrameRef = useRef8(null);
|
|
1344
1343
|
const stopAnimationFrameLoop = useCallback11(() => {
|
|
@@ -1354,7 +1353,7 @@ var useAnimationFrameLoop = () => {
|
|
|
1354
1353
|
},
|
|
1355
1354
|
[stopAnimationFrameLoop]
|
|
1356
1355
|
);
|
|
1357
|
-
|
|
1356
|
+
useEffect2(() => {
|
|
1358
1357
|
return () => {
|
|
1359
1358
|
stopAnimationFrameLoop();
|
|
1360
1359
|
};
|
|
@@ -1367,7 +1366,7 @@ var useAnimationFrameLoop = () => {
|
|
|
1367
1366
|
};
|
|
1368
1367
|
|
|
1369
1368
|
// src/hooks/useWaveformDataCache.ts
|
|
1370
|
-
import { useState as useState7, useEffect as
|
|
1369
|
+
import { useState as useState7, useEffect as useEffect3, useRef as useRef9, useCallback as useCallback12 } from "react";
|
|
1371
1370
|
|
|
1372
1371
|
// src/workers/peaksWorker.ts
|
|
1373
1372
|
import WaveformData from "waveform-data";
|
|
@@ -1638,7 +1637,7 @@ function useWaveformDataCache(tracks, baseScale) {
|
|
|
1638
1637
|
(audioBuffer) => generatedByBufferRef.current.get(audioBuffer),
|
|
1639
1638
|
[]
|
|
1640
1639
|
);
|
|
1641
|
-
|
|
1640
|
+
useEffect3(() => {
|
|
1642
1641
|
const generatedByBuffer = generatedByBufferRef.current;
|
|
1643
1642
|
const inflightByBuffer = inflightByBufferRef.current;
|
|
1644
1643
|
const session = mountSessionRef.current;
|
|
@@ -1688,7 +1687,7 @@ function useWaveformDataCache(tracks, baseScale) {
|
|
|
1688
1687
|
inflightByBuffer.set(audioBuffer, job);
|
|
1689
1688
|
}
|
|
1690
1689
|
}, [tracks, baseScale, getWorker]);
|
|
1691
|
-
|
|
1690
|
+
useEffect3(() => {
|
|
1692
1691
|
return () => {
|
|
1693
1692
|
var _a;
|
|
1694
1693
|
mountSessionRef.current += 1;
|
|
@@ -1741,12 +1740,12 @@ function useArrangementSources(arrangement) {
|
|
|
1741
1740
|
}
|
|
1742
1741
|
|
|
1743
1742
|
// src/hooks/useCreateAnnotationStore.ts
|
|
1744
|
-
import { useLayoutEffect, useRef as useRef10, useState as useState9 } from "react";
|
|
1743
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef10, useState as useState9 } from "react";
|
|
1745
1744
|
import { createAnnotationStore } from "@waveform-playlist/core";
|
|
1746
1745
|
function useCreateAnnotationStore(init, options) {
|
|
1747
1746
|
const beforeChange = options == null ? void 0 : options.beforeChange;
|
|
1748
1747
|
const ruleRef = useRef10(beforeChange);
|
|
1749
|
-
|
|
1748
|
+
useLayoutEffect3(() => {
|
|
1750
1749
|
ruleRef.current = beforeChange;
|
|
1751
1750
|
}, [beforeChange]);
|
|
1752
1751
|
const [store] = useState9(
|
|
@@ -2331,7 +2330,7 @@ function useTrimPreview(inputs) {
|
|
|
2331
2330
|
}
|
|
2332
2331
|
|
|
2333
2332
|
// src/providerInternals/useEngineLifetime.ts
|
|
2334
|
-
import { useCallback as useCallback16, useEffect as
|
|
2333
|
+
import { useCallback as useCallback16, useEffect as useEffect4, useLayoutEffect as useLayoutEffect4, useMemo as useMemo8, useRef as useRef16, useState as useState13 } from "react";
|
|
2335
2334
|
import {
|
|
2336
2335
|
attachDecodeContext,
|
|
2337
2336
|
PlaylistEngine
|
|
@@ -2476,7 +2475,7 @@ function useDecodeContext(arrangement, adapterRef) {
|
|
|
2476
2475
|
(_a = arrivalRef.current) != null ? _a : arrivalRef.current = deferred();
|
|
2477
2476
|
return arrivalRef.current.promise;
|
|
2478
2477
|
}), [adapterRef]);
|
|
2479
|
-
|
|
2478
|
+
useEffect4(
|
|
2480
2479
|
() => attachDecodeContext(arrangement, getDecodeContext),
|
|
2481
2480
|
[arrangement, getDecodeContext]
|
|
2482
2481
|
);
|
|
@@ -2506,7 +2505,7 @@ function useDisposeKeepingPlayback(refs) {
|
|
|
2506
2505
|
function useEngineLifetime(options) {
|
|
2507
2506
|
const { arrangement, effects, zoomLevels, sampleRateProp } = options;
|
|
2508
2507
|
const latest = useRef16(options);
|
|
2509
|
-
|
|
2508
|
+
useLayoutEffect4(() => {
|
|
2510
2509
|
latest.current = options;
|
|
2511
2510
|
});
|
|
2512
2511
|
const stableZoomLevels = useMemo8(
|
|
@@ -2530,7 +2529,7 @@ function useEngineLifetime(options) {
|
|
|
2530
2529
|
pendingResumeRef,
|
|
2531
2530
|
latest
|
|
2532
2531
|
});
|
|
2533
|
-
|
|
2532
|
+
useEffect4(() => {
|
|
2534
2533
|
const run = { cancelled: false };
|
|
2535
2534
|
engineBuildInFlightRef.current = true;
|
|
2536
2535
|
setIsEngineAttached(false);
|
|
@@ -2795,7 +2794,7 @@ function useArrangementView(arrangement, options) {
|
|
|
2795
2794
|
}
|
|
2796
2795
|
|
|
2797
2796
|
// src/providerInternals/useReadyOnce.ts
|
|
2798
|
-
import { useCallback as useCallback17, useEffect as
|
|
2797
|
+
import { useCallback as useCallback17, useEffect as useEffect5, useInsertionEffect, useRef as useRef18, useState as useState14 } from "react";
|
|
2799
2798
|
|
|
2800
2799
|
// src/utils/isDevelopmentBuild.ts
|
|
2801
2800
|
function isDevelopmentBuild() {
|
|
@@ -2841,7 +2840,7 @@ function useReadyOnce(options) {
|
|
|
2841
2840
|
}
|
|
2842
2841
|
return true;
|
|
2843
2842
|
}, []);
|
|
2844
|
-
|
|
2843
|
+
useEffect5(() => {
|
|
2845
2844
|
if (!isReady || firedRef.current) return;
|
|
2846
2845
|
firedRef.current = true;
|
|
2847
2846
|
setHasBeenReady(true);
|
|
@@ -2853,7 +2852,7 @@ function useReadyOnce(options) {
|
|
|
2853
2852
|
}
|
|
2854
2853
|
|
|
2855
2854
|
// src/providerInternals/useArrangementEditing.ts
|
|
2856
|
-
import { useCallback as useCallback18, useEffect as
|
|
2855
|
+
import { useCallback as useCallback18, useEffect as useEffect6, useMemo as useMemo10, useRef as useRef19, useState as useState15, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
2857
2856
|
import { createValueSource as createValueSource3 } from "@waveform-playlist/core";
|
|
2858
2857
|
|
|
2859
2858
|
// src/components/partWarnings.ts
|
|
@@ -2895,7 +2894,7 @@ function useRecordingActive(arrangement) {
|
|
|
2895
2894
|
},
|
|
2896
2895
|
[arrangement, armed]
|
|
2897
2896
|
);
|
|
2898
|
-
|
|
2897
|
+
useEffect6(
|
|
2899
2898
|
() => () => {
|
|
2900
2899
|
if (armed.source.getSnapshot()) setRecordingActive(false);
|
|
2901
2900
|
},
|
|
@@ -2956,7 +2955,7 @@ function useArrangementEditing(arrangement) {
|
|
|
2956
2955
|
}
|
|
2957
2956
|
|
|
2958
2957
|
// src/providerInternals/arrangementIdentity.ts
|
|
2959
|
-
import { useEffect as
|
|
2958
|
+
import { useEffect as useEffect7, useRef as useRef20 } from "react";
|
|
2960
2959
|
var arrangementKeys = /* @__PURE__ */ new WeakMap();
|
|
2961
2960
|
var lastArrangementKey = 0;
|
|
2962
2961
|
var MISSING_ARRANGEMENT_ERROR = "[waveform-playlist] WaveformPlaylistProvider needs an `arrangement` prop: an arrangement made with `useCreateArrangement`, which owns the tracks. The `tracks` and `onTracksChange` props were removed. See https://naomiaro.github.io/waveform-playlist/docs/react/upgrading";
|
|
@@ -2977,7 +2976,7 @@ function useArrangementKey(arrangement) {
|
|
|
2977
2976
|
const key = keyOf(arrangement);
|
|
2978
2977
|
const firstKeyRef = useRef20(key);
|
|
2979
2978
|
const warnedRef = useRef20(false);
|
|
2980
|
-
|
|
2979
|
+
useEffect7(() => {
|
|
2981
2980
|
if (key === firstKeyRef.current || warnedRef.current) return;
|
|
2982
2981
|
warnedRef.current = true;
|
|
2983
2982
|
if (isDevelopmentBuild()) console.warn(NEW_ARRANGEMENT_WARNING);
|
|
@@ -3047,7 +3046,6 @@ var ProviderOnArrangement = ({
|
|
|
3047
3046
|
const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
|
|
3048
3047
|
const [isPlaying, setIsPlaying] = useState16(false);
|
|
3049
3048
|
const [currentTime, setCurrentTime] = useState16(0);
|
|
3050
|
-
const [trackReorderEpoch, setTrackReorderEpoch] = useState16(0);
|
|
3051
3049
|
const [trackDragPreview, setTrackDragPreview] = useState16(null);
|
|
3052
3050
|
const indefinitePlaybackRef = useRef21(indefinitePlayback);
|
|
3053
3051
|
indefinitePlaybackRef.current = indefinitePlayback;
|
|
@@ -3069,7 +3067,7 @@ var ProviderOnArrangement = ({
|
|
|
3069
3067
|
);
|
|
3070
3068
|
const onReadyRef = useRef21(onReady);
|
|
3071
3069
|
const onErrorRef = useRef21(onError);
|
|
3072
|
-
|
|
3070
|
+
useLayoutEffect5(() => {
|
|
3073
3071
|
onReadyRef.current = onReady;
|
|
3074
3072
|
onErrorRef.current = onError;
|
|
3075
3073
|
});
|
|
@@ -3212,7 +3210,7 @@ var ProviderOnArrangement = ({
|
|
|
3212
3210
|
setLoopRegion(start, end);
|
|
3213
3211
|
}
|
|
3214
3212
|
}, [setLoopRegion, selectionStartRef, selectionEndRef]);
|
|
3215
|
-
|
|
3213
|
+
useEffect8(() => {
|
|
3216
3214
|
if (!scrollContainerRef.current || duration === 0) return;
|
|
3217
3215
|
const container = scrollContainerRef.current;
|
|
3218
3216
|
const oldSamplesPerPixel = samplesPerPixelRef.current;
|
|
@@ -3228,10 +3226,10 @@ var ProviderOnArrangement = ({
|
|
|
3228
3226
|
container.scrollLeft = newScrollLeft;
|
|
3229
3227
|
samplesPerPixelRef.current = newSamplesPerPixel;
|
|
3230
3228
|
}, [samplesPerPixel, duration, scrollContainerRef]);
|
|
3231
|
-
|
|
3229
|
+
useEffect8(() => {
|
|
3232
3230
|
syncSoundFontCacheToAdapter(adapterRef.current, soundFontCache);
|
|
3233
3231
|
}, [soundFontCache, adapterRef]);
|
|
3234
|
-
|
|
3232
|
+
useEffect8(() => {
|
|
3235
3233
|
for (const track of tracks) {
|
|
3236
3234
|
for (const clip of track.clips) {
|
|
3237
3235
|
if (!clip.audioBuffer && !clip.waveformData && !clip.midiNotes) {
|
|
@@ -3290,7 +3288,7 @@ var ProviderOnArrangement = ({
|
|
|
3290
3288
|
},
|
|
3291
3289
|
[stopAnimationFrameLoop, setCurrentTimeRefs]
|
|
3292
3290
|
);
|
|
3293
|
-
|
|
3291
|
+
useLayoutEffect5(() => {
|
|
3294
3292
|
const mirror = (state) => {
|
|
3295
3293
|
onSelectionEngineState(state);
|
|
3296
3294
|
onLoopEngineState(state);
|
|
@@ -3394,7 +3392,7 @@ var ProviderOnArrangement = ({
|
|
|
3394
3392
|
]);
|
|
3395
3393
|
const stopAnimationLoop = stopAnimationFrameLoop;
|
|
3396
3394
|
const prevContinuousPlayRef = useRef21(continuousPlay);
|
|
3397
|
-
|
|
3395
|
+
useEffect8(() => {
|
|
3398
3396
|
const continuousPlayTurnedOn = continuousPlay && !prevContinuousPlayRef.current && !isSelectionPlayRef.current;
|
|
3399
3397
|
prevContinuousPlayRef.current = continuousPlay;
|
|
3400
3398
|
const reschedulePlayback = () => __async(null, null, function* () {
|
|
@@ -3439,7 +3437,7 @@ var ProviderOnArrangement = ({
|
|
|
3439
3437
|
activeAnnotationIdRef,
|
|
3440
3438
|
engineRef
|
|
3441
3439
|
]);
|
|
3442
|
-
|
|
3440
|
+
useEffect8(() => {
|
|
3443
3441
|
const resumePlayback = () => __async(null, null, function* () {
|
|
3444
3442
|
const engine = engineRef.current;
|
|
3445
3443
|
const request = pendingResumeRef.current;
|
|
@@ -3585,9 +3583,6 @@ var ProviderOnArrangement = ({
|
|
|
3585
3583
|
},
|
|
3586
3584
|
[play, setCurrentTimeRefs, recordingActiveRef]
|
|
3587
3585
|
);
|
|
3588
|
-
const bumpTrackReorderEpoch = useCallback19(() => {
|
|
3589
|
-
setTrackReorderEpoch((epoch) => epoch + 1);
|
|
3590
|
-
}, []);
|
|
3591
3586
|
const setSelection = useCallback19(
|
|
3592
3587
|
(start, end) => {
|
|
3593
3588
|
var _a;
|
|
@@ -3755,7 +3750,6 @@ var ProviderOnArrangement = ({
|
|
|
3755
3750
|
setTrackVolume: editing.setTrackVolume,
|
|
3756
3751
|
setTrackPan: editing.setTrackPan,
|
|
3757
3752
|
reorderTrack: editing.reorderTrack,
|
|
3758
|
-
bumpTrackReorderEpoch,
|
|
3759
3753
|
setTrackDragPreview,
|
|
3760
3754
|
setSelectedTrackId: setSelectedTrackIdControl,
|
|
3761
3755
|
// Zoom
|
|
@@ -3781,7 +3775,6 @@ var ProviderOnArrangement = ({
|
|
|
3781
3775
|
editing.setTrackVolume,
|
|
3782
3776
|
editing.setTrackPan,
|
|
3783
3777
|
editing.reorderTrack,
|
|
3784
|
-
bumpTrackReorderEpoch,
|
|
3785
3778
|
setTrackDragPreview,
|
|
3786
3779
|
setSelectedTrackIdControl,
|
|
3787
3780
|
zoom.zoomIn,
|
|
@@ -3822,8 +3815,8 @@ var ProviderOnArrangement = ({
|
|
|
3822
3815
|
[trackStates, masterVolume]
|
|
3823
3816
|
);
|
|
3824
3817
|
const reorderPreviewValue = useMemo11(
|
|
3825
|
-
() => ({ trackDragPreview
|
|
3826
|
-
[trackDragPreview
|
|
3818
|
+
() => ({ trackDragPreview }),
|
|
3819
|
+
[trackDragPreview]
|
|
3827
3820
|
);
|
|
3828
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(ActiveAnnotationContext, { value: activeAnnotationValue, children: /* @__PURE__ */ jsx(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ jsx(SelectionContext, { value: selectionValue, children: /* @__PURE__ */ jsx(
|
|
3829
3822
|
TrackReorderPreviewContext,
|
|
@@ -3849,8 +3842,8 @@ var ProviderOnArrangement = ({
|
|
|
3849
3842
|
// src/MediaElementPlaylistContext.tsx
|
|
3850
3843
|
import {
|
|
3851
3844
|
useState as useState17,
|
|
3852
|
-
useEffect as
|
|
3853
|
-
useLayoutEffect as
|
|
3845
|
+
useEffect as useEffect9,
|
|
3846
|
+
useLayoutEffect as useLayoutEffect6,
|
|
3854
3847
|
useRef as useRef22,
|
|
3855
3848
|
useCallback as useCallback20,
|
|
3856
3849
|
useMemo as useMemo12
|
|
@@ -3915,7 +3908,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
3915
3908
|
}
|
|
3916
3909
|
const playbackRateRef = useRef22(initialPlaybackRate);
|
|
3917
3910
|
const ratePropAppliedRef = useRef22(initialPlaybackRate);
|
|
3918
|
-
|
|
3911
|
+
useLayoutEffect6(() => {
|
|
3919
3912
|
if (Object.is(ratePropAppliedRef.current, initialPlaybackRate)) return;
|
|
3920
3913
|
ratePropAppliedRef.current = initialPlaybackRate;
|
|
3921
3914
|
playbackRateRef.current = initialPlaybackRate;
|
|
@@ -4009,7 +4002,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4009
4002
|
return [[clipPeaks]];
|
|
4010
4003
|
}, [trackPeaks, trackName, trackFadeIn, trackFadeOut]);
|
|
4011
4004
|
const latestAudioRef = useRef22({ source: track.source, waveformData: track.waveformData });
|
|
4012
|
-
|
|
4005
|
+
useLayoutEffect6(() => {
|
|
4013
4006
|
latestAudioRef.current = { source: track.source, waveformData: track.waveformData };
|
|
4014
4007
|
}, [track.source, track.waveformData]);
|
|
4015
4008
|
const restAt = useCallback20(
|
|
@@ -4031,7 +4024,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4031
4024
|
const startAnimationLoopRef = useRef22(() => {
|
|
4032
4025
|
});
|
|
4033
4026
|
const endPlaybackIfDueRef = useRef22(() => false);
|
|
4034
|
-
|
|
4027
|
+
useEffect9(() => {
|
|
4035
4028
|
let cancelled = false;
|
|
4036
4029
|
let createdPlayout = null;
|
|
4037
4030
|
const source = track.source;
|
|
@@ -4217,7 +4210,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4217
4210
|
runFrameCallbacks,
|
|
4218
4211
|
endPlaybackIfDue
|
|
4219
4212
|
]);
|
|
4220
|
-
|
|
4213
|
+
useLayoutEffect6(() => {
|
|
4221
4214
|
startAnimationLoopRef.current = startAnimationLoop;
|
|
4222
4215
|
endPlaybackIfDueRef.current = endPlaybackIfDue;
|
|
4223
4216
|
}, [startAnimationLoop, endPlaybackIfDue]);
|
|
@@ -4566,7 +4559,7 @@ var ZoomOutButton = ({
|
|
|
4566
4559
|
};
|
|
4567
4560
|
|
|
4568
4561
|
// src/components/ContextualControls.tsx
|
|
4569
|
-
import { useRef as useRef23, useEffect as
|
|
4562
|
+
import { useRef as useRef23, useEffect as useEffect10, useId } from "react";
|
|
4570
4563
|
import {
|
|
4571
4564
|
MasterVolumeControl as BaseMasterVolumeControl,
|
|
4572
4565
|
TimeFormatSelect as BaseTimeFormatSelect,
|
|
@@ -4612,7 +4605,7 @@ var AudioPosition = ({ className }) => {
|
|
|
4612
4605
|
useCurrentTime();
|
|
4613
4606
|
const { timeFormat: format } = usePlaylistSettings();
|
|
4614
4607
|
const id = useId();
|
|
4615
|
-
|
|
4608
|
+
useEffect10(() => {
|
|
4616
4609
|
if (isPlaying) {
|
|
4617
4610
|
registerFrameCallback(id, ({ time }) => {
|
|
4618
4611
|
if (timeRef.current) {
|
|
@@ -4622,7 +4615,7 @@ var AudioPosition = ({ className }) => {
|
|
|
4622
4615
|
}
|
|
4623
4616
|
return () => unregisterFrameCallback(id);
|
|
4624
4617
|
}, [id, isPlaying, format, registerFrameCallback, unregisterFrameCallback]);
|
|
4625
|
-
|
|
4618
|
+
useEffect10(() => {
|
|
4626
4619
|
var _a2;
|
|
4627
4620
|
if (!isPlaying && timeRef.current) {
|
|
4628
4621
|
timeRef.current.textContent = formatTime((_a2 = currentTimeRef.current) != null ? _a2 : 0, format);
|
|
@@ -4676,7 +4669,7 @@ var AutomaticScrollCheckbox = ({ className }) => {
|
|
|
4676
4669
|
// src/components/WaveformRoot.tsx
|
|
4677
4670
|
import {
|
|
4678
4671
|
use as use13,
|
|
4679
|
-
useLayoutEffect as
|
|
4672
|
+
useLayoutEffect as useLayoutEffect9,
|
|
4680
4673
|
useRef as useRef30,
|
|
4681
4674
|
useState as useState21,
|
|
4682
4675
|
useMemo as useMemo20,
|
|
@@ -4719,10 +4712,10 @@ function trackIdAtOffset(orderedIds, layout, heightById, y) {
|
|
|
4719
4712
|
}
|
|
4720
4713
|
|
|
4721
4714
|
// src/hooks/useTrailingActive.ts
|
|
4722
|
-
import { useEffect as
|
|
4715
|
+
import { useEffect as useEffect11, useState as useState18 } from "react";
|
|
4723
4716
|
function useTrailingActive(active, trailingMs) {
|
|
4724
4717
|
const [trailing, setTrailing] = useState18(active);
|
|
4725
|
-
|
|
4718
|
+
useEffect11(() => {
|
|
4726
4719
|
if (active) {
|
|
4727
4720
|
setTrailing(true);
|
|
4728
4721
|
return void 0;
|
|
@@ -4850,6 +4843,7 @@ var TrackRowPositioner = styled2.div.attrs((props) => ({
|
|
|
4850
4843
|
transition: none;
|
|
4851
4844
|
}
|
|
4852
4845
|
`;
|
|
4846
|
+
var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
|
|
4853
4847
|
var ControlSlot = styled2.div.attrs((props) => ({
|
|
4854
4848
|
style: {
|
|
4855
4849
|
height: `${props.$height}px`,
|
|
@@ -4868,6 +4862,7 @@ var ControlSlot = styled2.div.attrs((props) => ({
|
|
|
4868
4862
|
transition: background 0.15s ease-in-out;
|
|
4869
4863
|
}
|
|
4870
4864
|
${(props) => props.$isSelected && `background: ${props.theme.selectedTrackControlsBackground};`}
|
|
4865
|
+
${(props) => props.$isDragSource && `background: ${props.theme.selectedTrackControlsBackground}; box-shadow: ${DRAG_SOURCE_SHADOW};`}
|
|
4871
4866
|
`;
|
|
4872
4867
|
function getTrackChannelCount(trackClipPeaks, recordingChannels) {
|
|
4873
4868
|
const clipChannels = trackClipPeaks.length > 0 ? Math.max(1, ...trackClipPeaks.map((clip) => clip.peaks.data.length)) : 1;
|
|
@@ -4884,16 +4879,16 @@ import React17, {
|
|
|
4884
4879
|
import {
|
|
4885
4880
|
Playlist,
|
|
4886
4881
|
PlaylistInfoContext,
|
|
4887
|
-
useTheme as
|
|
4882
|
+
useTheme as useTheme4,
|
|
4888
4883
|
waveformColorToCss as waveformColorToCss3
|
|
4889
4884
|
} from "@waveform-playlist/ui-components";
|
|
4890
4885
|
|
|
4891
4886
|
// src/hooks/useSelectionDrag.ts
|
|
4892
|
-
import { createContext as createContext3, memo as memo2, useLayoutEffect as
|
|
4887
|
+
import { createContext as createContext3, memo as memo2, useLayoutEffect as useLayoutEffect8, useMemo as useMemo14, useRef as useRef25, useState as useState19 } from "react";
|
|
4893
4888
|
import { createValueSource as createValueSource4 } from "@waveform-playlist/core";
|
|
4894
4889
|
|
|
4895
4890
|
// src/hooks/useWindowDrag.ts
|
|
4896
|
-
import { useEffect as
|
|
4891
|
+
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect7, useRef as useRef24 } from "react";
|
|
4897
4892
|
var activeDrags = 0;
|
|
4898
4893
|
var userSelectBeforeDrags = "";
|
|
4899
4894
|
var webkitUserSelectBeforeDrags = "";
|
|
@@ -4916,10 +4911,10 @@ function suspendTextSelection() {
|
|
|
4916
4911
|
}
|
|
4917
4912
|
function useWindowDrag(active, onMove, onEnd) {
|
|
4918
4913
|
const callbacksRef = useRef24({ onMove, onEnd });
|
|
4919
|
-
|
|
4914
|
+
useLayoutEffect7(() => {
|
|
4920
4915
|
callbacksRef.current = { onMove, onEnd };
|
|
4921
4916
|
});
|
|
4922
|
-
|
|
4917
|
+
useEffect12(() => {
|
|
4923
4918
|
if (!active) return;
|
|
4924
4919
|
const move = (event) => {
|
|
4925
4920
|
if ((event.buttons & 1) === 0) {
|
|
@@ -4960,7 +4955,7 @@ var AutomaticScrollFlag = memo2(function AutomaticScrollFlag2({
|
|
|
4960
4955
|
flagRef
|
|
4961
4956
|
}) {
|
|
4962
4957
|
const { isAutomaticScroll } = usePlaylistSettings();
|
|
4963
|
-
|
|
4958
|
+
useLayoutEffect8(() => {
|
|
4964
4959
|
flagRef.current = isAutomaticScroll;
|
|
4965
4960
|
});
|
|
4966
4961
|
return null;
|
|
@@ -5109,7 +5104,7 @@ function useClipInteractionEnabled() {
|
|
|
5109
5104
|
}
|
|
5110
5105
|
|
|
5111
5106
|
// src/components/ChannelWithProgress.tsx
|
|
5112
|
-
import { useId as useId2, useRef as useRef26, useEffect as
|
|
5107
|
+
import { useId as useId2, useRef as useRef26, useEffect as useEffect13 } from "react";
|
|
5113
5108
|
import styled3 from "styled-components";
|
|
5114
5109
|
import {
|
|
5115
5110
|
clipPixelWidth as computeClipPixelWidth
|
|
@@ -5185,7 +5180,7 @@ var ClipProgress = ({
|
|
|
5185
5180
|
clipDurationSamples,
|
|
5186
5181
|
samplesPerPixel
|
|
5187
5182
|
);
|
|
5188
|
-
|
|
5183
|
+
useEffect13(() => {
|
|
5189
5184
|
if (isPlaying) {
|
|
5190
5185
|
registerFrameCallback(callbackId, ({ visualTime, sampleRate: sr }) => {
|
|
5191
5186
|
if (progressRef.current) {
|
|
@@ -5203,7 +5198,7 @@ var ClipProgress = ({
|
|
|
5203
5198
|
registerFrameCallback,
|
|
5204
5199
|
unregisterFrameCallback
|
|
5205
5200
|
]);
|
|
5206
|
-
|
|
5201
|
+
useEffect13(() => {
|
|
5207
5202
|
var _a, _b;
|
|
5208
5203
|
if (!isPlaying && progressRef.current) {
|
|
5209
5204
|
const currentTime = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
|
|
@@ -5666,7 +5661,6 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5666
5661
|
|
|
5667
5662
|
// src/components/TrackControlsColumn.tsx
|
|
5668
5663
|
import React12, { use as use9, useMemo as useMemo17, useRef as useRef28, useState as useState20 } from "react";
|
|
5669
|
-
import { useTheme as useTheme3 } from "@waveform-playlist/ui-components";
|
|
5670
5664
|
|
|
5671
5665
|
// src/components/DefaultTrackControls.tsx
|
|
5672
5666
|
import React11 from "react";
|
|
@@ -5702,7 +5696,7 @@ var TrackControlsSharedContext = createContext7(null);
|
|
|
5702
5696
|
var TrackSlotWiringContext = createContext7(null);
|
|
5703
5697
|
|
|
5704
5698
|
// src/hooks/useTrackReorderHandle.ts
|
|
5705
|
-
import { use as use7, useEffect as
|
|
5699
|
+
import { use as use7, useEffect as useEffect14 } from "react";
|
|
5706
5700
|
import { useSortable } from "@dnd-kit/react/sortable";
|
|
5707
5701
|
import { RestrictToVerticalAxis } from "@dnd-kit/abstract/modifiers";
|
|
5708
5702
|
import { Feedback } from "@dnd-kit/dom";
|
|
@@ -5735,7 +5729,7 @@ function createDragPopoverHealer(element) {
|
|
|
5735
5729
|
}
|
|
5736
5730
|
|
|
5737
5731
|
// src/hooks/useTrackReorderHandle.ts
|
|
5738
|
-
var MOVE_FEEDBACK = Feedback.configure({ feedback: "move" });
|
|
5732
|
+
var MOVE_FEEDBACK = Feedback.configure({ feedback: "move", dropAnimation: null });
|
|
5739
5733
|
var withMoveFeedback = (defaults) => [...defaults, MOVE_FEEDBACK];
|
|
5740
5734
|
function useTrackReorderHandle() {
|
|
5741
5735
|
const { id, index } = useTrack();
|
|
@@ -5762,10 +5756,9 @@ function useTrackReorderHandle() {
|
|
|
5762
5756
|
// `placeholder.replaceWith(element)` on drop) — confirmed via
|
|
5763
5757
|
// MutationObserver instrumentation to relocate the React-owned row 6
|
|
5764
5758
|
// times during a single one-slot drag, leaving its final parent/sibling
|
|
5765
|
-
// different from what React's fiber tree still believes.
|
|
5766
|
-
//
|
|
5767
|
-
//
|
|
5768
|
-
// for these rows. The placeholder splice is created only when
|
|
5759
|
+
// different from what React's fiber tree still believes. (Measured when
|
|
5760
|
+
// the registered element was one level inside the keyed slot, before
|
|
5761
|
+
// #796; not re-run with the slot itself.) The placeholder splice is created only when
|
|
5769
5762
|
// `feedback !== 'move'` (@dnd-kit/dom Feedback.ts) — 'move' keeps the
|
|
5770
5763
|
// dragged element in the live DOM (no clone/placeholder) while still
|
|
5771
5764
|
// running the *unconditional* `dragOperation.shape = ...` assignment.
|
|
@@ -5777,15 +5770,18 @@ function useTrackReorderHandle() {
|
|
|
5777
5770
|
// drag-based reordering silently never commits. Boundary trims don't hit
|
|
5778
5771
|
// this because they're plain useDraggable (no collision-based commit) —
|
|
5779
5772
|
// sortables need shape. `isDragSource` is a reactive signal, unaffected
|
|
5780
|
-
// either way.
|
|
5773
|
+
// either way. OptimisticSortingPlugin still moves the element during the
|
|
5774
|
+
// drag (`insertAdjacentElement` next to the item it is dragged over);
|
|
5775
|
+
// that is safe only because the element is the keyed slot (#796, below).
|
|
5776
|
+
// See browser/notes/track-controls-and-reorder.md "Track Reordering".
|
|
5781
5777
|
plugins: withMoveFeedback
|
|
5782
5778
|
});
|
|
5783
|
-
|
|
5779
|
+
useEffect14(() => {
|
|
5784
5780
|
if (!wiring) return void 0;
|
|
5785
5781
|
ref(wiring.elementRef.current);
|
|
5786
5782
|
return () => ref(null);
|
|
5787
5783
|
}, [ref, wiring]);
|
|
5788
|
-
|
|
5784
|
+
useEffect14(() => {
|
|
5789
5785
|
if (!wiring) return void 0;
|
|
5790
5786
|
const { handleCount } = wiring;
|
|
5791
5787
|
handleCount.current += 1;
|
|
@@ -5798,12 +5794,12 @@ function useTrackReorderHandle() {
|
|
|
5798
5794
|
handleCount.current -= 1;
|
|
5799
5795
|
};
|
|
5800
5796
|
}, [wiring]);
|
|
5801
|
-
|
|
5797
|
+
useEffect14(() => {
|
|
5802
5798
|
if (!wiring) return void 0;
|
|
5803
5799
|
wiring.setDragSource(isDragSource);
|
|
5804
5800
|
return () => wiring.setDragSource(false);
|
|
5805
5801
|
}, [isDragSource, wiring]);
|
|
5806
|
-
|
|
5802
|
+
useEffect14(() => {
|
|
5807
5803
|
const element = wiring == null ? void 0 : wiring.elementRef.current;
|
|
5808
5804
|
if (!isDragSource || !element) return void 0;
|
|
5809
5805
|
return createDragPopoverHealer(element);
|
|
@@ -6012,7 +6008,6 @@ function useStableTemplate(template) {
|
|
|
6012
6008
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
6013
6009
|
var DEFAULT_TRACK_CONTROLS_WIDTH = 200;
|
|
6014
6010
|
var DEFAULT_TEMPLATE = /* @__PURE__ */ jsx11(DefaultTrackControls, {});
|
|
6015
|
-
var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
|
|
6016
6011
|
var SLOT_BODY_STYLE = { height: "100%" };
|
|
6017
6012
|
function TrackControlsSlotImpl({
|
|
6018
6013
|
trackId,
|
|
@@ -6042,7 +6037,6 @@ function TrackControlsSlotImpl({
|
|
|
6042
6037
|
reorderTrack,
|
|
6043
6038
|
setSelectedTrackId
|
|
6044
6039
|
} = useEditorControls();
|
|
6045
|
-
const theme = useTheme3();
|
|
6046
6040
|
const shared = use9(TrackControlsSharedContext);
|
|
6047
6041
|
const indexRef = useRef28(index);
|
|
6048
6042
|
indexRef.current = index;
|
|
@@ -6114,27 +6108,14 @@ function TrackControlsSlotImpl({
|
|
|
6114
6108
|
return /* @__PURE__ */ jsx11(
|
|
6115
6109
|
ControlSlot,
|
|
6116
6110
|
{
|
|
6111
|
+
ref: elementRef,
|
|
6117
6112
|
$height: height,
|
|
6118
6113
|
$top: top,
|
|
6119
6114
|
$animate: animate,
|
|
6120
6115
|
$isSelected: isSelected,
|
|
6116
|
+
$isDragSource: isDragSource,
|
|
6121
6117
|
onClick: actions.select,
|
|
6122
|
-
children: /* @__PURE__ */ jsx11(
|
|
6123
|
-
"div",
|
|
6124
|
-
{
|
|
6125
|
-
ref: elementRef,
|
|
6126
|
-
"data-track-controls": trackId,
|
|
6127
|
-
style: isDragSource ? __spreadProps(__spreadValues({}, SLOT_BODY_STYLE), {
|
|
6128
|
-
boxShadow: DRAG_SOURCE_SHADOW,
|
|
6129
|
-
// Opaque background for the floating (top-layer, popover-based)
|
|
6130
|
-
// drag-source row — without it the row underneath shows through.
|
|
6131
|
-
// onDragStart selects the dragged track, so its slot always shows
|
|
6132
|
-
// the selected-track background while lifted.
|
|
6133
|
-
background: theme.selectedTrackControlsBackground
|
|
6134
|
-
}) : SLOT_BODY_STYLE,
|
|
6135
|
-
children: /* @__PURE__ */ jsx11(TrackSlotWiringContext, { value: wiring, children: /* @__PURE__ */ jsx11(TrackContext, { value, children: template }) })
|
|
6136
|
-
}
|
|
6137
|
-
)
|
|
6118
|
+
children: /* @__PURE__ */ jsx11("div", { "data-track-controls": trackId, style: SLOT_BODY_STYLE, children: /* @__PURE__ */ jsx11(TrackSlotWiringContext, { value: wiring, children: /* @__PURE__ */ jsx11(TrackContext, { value, children: template }) }) })
|
|
6138
6119
|
}
|
|
6139
6120
|
);
|
|
6140
6121
|
}
|
|
@@ -6146,6 +6127,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6146
6127
|
trackLayout,
|
|
6147
6128
|
trackHeightById,
|
|
6148
6129
|
animateTrackLayout,
|
|
6130
|
+
dragSourceTrackId,
|
|
6149
6131
|
setSettingsModalTrackId
|
|
6150
6132
|
} = useWaveformRows("The track controls");
|
|
6151
6133
|
if (use9(WaveformPartPlaceContext) !== "controls") {
|
|
@@ -6155,7 +6137,6 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6155
6137
|
}
|
|
6156
6138
|
const { selectedTrackId } = useSelectedTrackId();
|
|
6157
6139
|
const { armedTrackId } = useRecordingArm();
|
|
6158
|
-
const { trackReorderEpoch } = useTrackReorderPreview();
|
|
6159
6140
|
const spectrogram = use9(SpectrogramIntegrationContext);
|
|
6160
6141
|
const { trackStates } = usePlaylistMixer();
|
|
6161
6142
|
const template = useStableTemplate(children != null ? children : DEFAULT_TEMPLATE);
|
|
@@ -6182,36 +6163,29 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6182
6163
|
return /* @__PURE__ */ jsx11(TrackControlsSharedContext, { value: shared, children: /* @__PURE__ */ jsx11(TracksLayout, { $height: trackLayout.totalHeight, children: tracks.map((track, trackIndex) => {
|
|
6183
6164
|
var _a, _b, _c;
|
|
6184
6165
|
const state = trackStates[trackIndex];
|
|
6185
|
-
return (
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6209
|
-
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6210
|
-
animate: animateTrackLayout,
|
|
6211
|
-
template
|
|
6212
|
-
},
|
|
6213
|
-
`${track.id}-${trackReorderEpoch}`
|
|
6214
|
-
)
|
|
6166
|
+
return /* @__PURE__ */ jsx11(
|
|
6167
|
+
TrackControlsSlot,
|
|
6168
|
+
{
|
|
6169
|
+
trackId: track.id,
|
|
6170
|
+
index: trackIndex,
|
|
6171
|
+
kind: track.kind,
|
|
6172
|
+
name: state.name,
|
|
6173
|
+
muted: state.muted,
|
|
6174
|
+
soloed: state.soloed,
|
|
6175
|
+
volume: state.volume,
|
|
6176
|
+
pan: state.pan,
|
|
6177
|
+
isSelected: track.id === selectedTrackId,
|
|
6178
|
+
isFirst: trackIndex === 0,
|
|
6179
|
+
isLast: trackIndex === tracks.length - 1,
|
|
6180
|
+
renderMode: (_a = renderModeById.get(track.id)) != null ? _a : "waveform",
|
|
6181
|
+
hasSpectrogram: spectrogram !== null && track.kind !== "midi",
|
|
6182
|
+
isRecordingArmed: track.id === armedTrackId,
|
|
6183
|
+
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6184
|
+
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6185
|
+
animate: animateTrackLayout && dragSourceTrackId !== null,
|
|
6186
|
+
template
|
|
6187
|
+
},
|
|
6188
|
+
track.id
|
|
6215
6189
|
);
|
|
6216
6190
|
}) }) });
|
|
6217
6191
|
}
|
|
@@ -6222,11 +6196,11 @@ import React14, { use as use10, useSyncExternalStore as useSyncExternalStore12 }
|
|
|
6222
6196
|
import {
|
|
6223
6197
|
Selection,
|
|
6224
6198
|
TimescaleLoopRegion,
|
|
6225
|
-
useTheme as
|
|
6199
|
+
useTheme as useTheme3
|
|
6226
6200
|
} from "@waveform-playlist/ui-components";
|
|
6227
6201
|
|
|
6228
6202
|
// src/components/AnimatedPlayhead.tsx
|
|
6229
|
-
import { useRef as useRef29, useEffect as
|
|
6203
|
+
import { useRef as useRef29, useEffect as useEffect15, useId as useId3 } from "react";
|
|
6230
6204
|
import styled5 from "styled-components";
|
|
6231
6205
|
import { usePlaylistInfo as usePlaylistInfo3 } from "@waveform-playlist/ui-components";
|
|
6232
6206
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
@@ -6253,7 +6227,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6253
6227
|
const { sampleRate } = usePlaylistView();
|
|
6254
6228
|
const { progressBarWidth } = usePlaylistInfo3();
|
|
6255
6229
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6256
|
-
|
|
6230
|
+
useEffect15(() => {
|
|
6257
6231
|
if (isPlaying) {
|
|
6258
6232
|
registerFrameCallback(
|
|
6259
6233
|
frameCallbackId,
|
|
@@ -6267,7 +6241,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6267
6241
|
}
|
|
6268
6242
|
return () => unregisterFrameCallback(frameCallbackId);
|
|
6269
6243
|
}, [isPlaying, frameCallbackId, registerFrameCallback, unregisterFrameCallback]);
|
|
6270
|
-
|
|
6244
|
+
useEffect15(() => {
|
|
6271
6245
|
var _a, _b;
|
|
6272
6246
|
if (!isPlaying && playheadRef.current) {
|
|
6273
6247
|
const time = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
|
|
@@ -6284,7 +6258,7 @@ var subscribeToNothing3 = () => () => {
|
|
|
6284
6258
|
};
|
|
6285
6259
|
var noPreview = () => null;
|
|
6286
6260
|
var WaveformSelection = React14.memo(function WaveformSelection2() {
|
|
6287
|
-
const theme =
|
|
6261
|
+
const theme = useTheme3();
|
|
6288
6262
|
const { selectionStart, selectionEnd } = useSelection();
|
|
6289
6263
|
const { sampleRate } = usePlaylistView();
|
|
6290
6264
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
@@ -6323,7 +6297,7 @@ var CustomPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) =>
|
|
|
6323
6297
|
});
|
|
6324
6298
|
};
|
|
6325
6299
|
var WaveformPlayhead = ({ renderPlayhead }) => {
|
|
6326
|
-
const theme =
|
|
6300
|
+
const theme = useTheme3();
|
|
6327
6301
|
const { isPlaying } = useIsPlaying();
|
|
6328
6302
|
const { selectionStart, selectionEnd } = useSelection();
|
|
6329
6303
|
const { sampleRate } = usePlaylistView();
|
|
@@ -6346,7 +6320,7 @@ var WaveformLoopRegion = React14.memo(function WaveformLoopRegion2() {
|
|
|
6346
6320
|
"<WaveformLoopRegion> is drawn among the tracks, not in the timescale strip: the root recognises a part by its element type, so it must be a child of the root (a fragment is fine), not wrapped in another component."
|
|
6347
6321
|
);
|
|
6348
6322
|
}
|
|
6349
|
-
const theme =
|
|
6323
|
+
const theme = useTheme3();
|
|
6350
6324
|
const { isLoopEnabled, loopStart, loopEnd } = useLoop();
|
|
6351
6325
|
const { setLoopRegion } = useEditorControls();
|
|
6352
6326
|
const { sampleRate } = usePlaylistView();
|
|
@@ -6580,7 +6554,7 @@ function useWaveformFrame({
|
|
|
6580
6554
|
onClickWhileStopped
|
|
6581
6555
|
}) {
|
|
6582
6556
|
var _a;
|
|
6583
|
-
const theme =
|
|
6557
|
+
const theme = useTheme4();
|
|
6584
6558
|
const { setScrollContainer } = usePlaybackControls();
|
|
6585
6559
|
const { sampleRate } = usePlaylistView();
|
|
6586
6560
|
const { waveHeight, barWidth, barGap, roundedBars, progressBarWidth } = viewOptions;
|
|
@@ -6719,7 +6693,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6719
6693
|
const [scrollContainerElement, setScrollContainerElement] = useState21(null);
|
|
6720
6694
|
const fillsContainer = indefinitePlayback || fillViewport;
|
|
6721
6695
|
const [scrollContainerWidth, setScrollContainerWidth] = useState21(0);
|
|
6722
|
-
|
|
6696
|
+
useLayoutEffect9(() => {
|
|
6723
6697
|
if (!fillsContainer || !scrollContainerElement) return;
|
|
6724
6698
|
const measure = () => setScrollContainerWidth(scrollContainerElement.clientWidth);
|
|
6725
6699
|
measure();
|
|
@@ -6863,7 +6837,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6863
6837
|
import React20, { use as use16 } from "react";
|
|
6864
6838
|
import { DragDropProvider } from "@dnd-kit/react";
|
|
6865
6839
|
import { RestrictToHorizontalAxis } from "@dnd-kit/abstract/modifiers";
|
|
6866
|
-
import { useTheme as
|
|
6840
|
+
import { useTheme as useTheme5 } from "@waveform-playlist/ui-components";
|
|
6867
6841
|
|
|
6868
6842
|
// src/AnnotationIntegrationContext.tsx
|
|
6869
6843
|
import { createContext as createContext9, use as use14 } from "react";
|
|
@@ -6959,7 +6933,7 @@ var WaveformAnnotationBoxes = React20.memo(function WaveformAnnotationBoxes2({
|
|
|
6959
6933
|
const { sampleRate } = usePlaylistView();
|
|
6960
6934
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6961
6935
|
const { touchOptimized } = useClipInteraction();
|
|
6962
|
-
const theme =
|
|
6936
|
+
const theme = useTheme5();
|
|
6963
6937
|
const shownAnnotations = useAnnotationsWithPreview(annotations, annotationPreview);
|
|
6964
6938
|
const sensors = useDragSensors({ touchOptimized });
|
|
6965
6939
|
const { onDragStart, onDragMove, onDragEnd } = useAnnotationDragHandlers({
|
|
@@ -7223,11 +7197,11 @@ var KeyboardShortcuts = ({
|
|
|
7223
7197
|
};
|
|
7224
7198
|
|
|
7225
7199
|
// src/hooks/useRecordingSession.ts
|
|
7226
|
-
import { useEffect as
|
|
7200
|
+
import { useEffect as useEffect16 } from "react";
|
|
7227
7201
|
function useRecordingSession({ isRecording, trackId }) {
|
|
7228
7202
|
const { setRecordingActive } = useEditorControls();
|
|
7229
7203
|
const armedTrackId = trackId != null ? trackId : null;
|
|
7230
|
-
|
|
7204
|
+
useEffect16(() => {
|
|
7231
7205
|
if (!isRecording) return void 0;
|
|
7232
7206
|
setRecordingActive(true, armedTrackId);
|
|
7233
7207
|
return () => setRecordingActive(false);
|
|
@@ -7338,7 +7312,7 @@ var ClipInteractionProvider = ({
|
|
|
7338
7312
|
const { sampleRate } = usePlaylistView();
|
|
7339
7313
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
7340
7314
|
const { tracks } = usePlaylistTimeline();
|
|
7341
|
-
const { setSelectedTrackId, reorderTrack,
|
|
7315
|
+
const { setSelectedTrackId, reorderTrack, setTrackDragPreview } = useEditorControls();
|
|
7342
7316
|
const beatsAndBars = useBeatsAndBars();
|
|
7343
7317
|
const useBeatsSnap = snap && beatsAndBars != null && beatsAndBars.scaleMode === "beats" && beatsAndBars.snapTo !== "off";
|
|
7344
7318
|
const useTimescaleSnap = snap && !useBeatsSnap;
|
|
@@ -7367,13 +7341,11 @@ var ClipInteractionProvider = ({
|
|
|
7367
7341
|
onDragMove,
|
|
7368
7342
|
onDragEnd
|
|
7369
7343
|
} = useClipDragHandlers({ samplesPerPixel, snapSamplePosition });
|
|
7370
|
-
const trackReorderDragActiveRef = React23.useRef(false);
|
|
7371
7344
|
const onDragStart = React23.useCallback(
|
|
7372
7345
|
(event) => {
|
|
7373
7346
|
var _a, _b;
|
|
7374
7347
|
const data = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data;
|
|
7375
7348
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7376
|
-
trackReorderDragActiveRef.current = true;
|
|
7377
7349
|
if (data.trackId) setSelectedTrackId(data.trackId);
|
|
7378
7350
|
return;
|
|
7379
7351
|
}
|
|
@@ -7391,7 +7363,6 @@ var ClipInteractionProvider = ({
|
|
|
7391
7363
|
var _a;
|
|
7392
7364
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7393
7365
|
if ((data == null ? void 0 : data.kind) !== "track-reorder" || !data.trackId) return;
|
|
7394
|
-
if (!trackReorderDragActiveRef.current) return;
|
|
7395
7366
|
const sortable = event.operation.source.sortable;
|
|
7396
7367
|
if (!sortable) return;
|
|
7397
7368
|
const trackId = data.trackId;
|
|
@@ -7407,12 +7378,10 @@ var ClipInteractionProvider = ({
|
|
|
7407
7378
|
var _a;
|
|
7408
7379
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7409
7380
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7410
|
-
trackReorderDragActiveRef.current = false;
|
|
7411
7381
|
const sortable = event.operation.source.sortable;
|
|
7412
7382
|
const trackId = data.trackId;
|
|
7413
7383
|
const moves = !event.canceled && trackId && sortable && sortable.index !== sortable.initialIndex;
|
|
7414
7384
|
flushSync2(() => {
|
|
7415
|
-
bumpTrackReorderEpoch();
|
|
7416
7385
|
setTrackDragPreview(null);
|
|
7417
7386
|
if (moves) reorderTrack(trackId, sortable.index);
|
|
7418
7387
|
});
|
|
@@ -7420,7 +7389,7 @@ var ClipInteractionProvider = ({
|
|
|
7420
7389
|
}
|
|
7421
7390
|
onDragEnd(event);
|
|
7422
7391
|
},
|
|
7423
|
-
[onDragEnd, reorderTrack,
|
|
7392
|
+
[onDragEnd, reorderTrack, setTrackDragPreview]
|
|
7424
7393
|
);
|
|
7425
7394
|
const modifiers = useMemo23(() => {
|
|
7426
7395
|
const mods = [RestrictToHorizontalAxis2];
|