@waveform-playlist/browser 17.0.0-next.5 → 17.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
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);
|
|
@@ -3069,7 +3068,7 @@ var ProviderOnArrangement = ({
|
|
|
3069
3068
|
);
|
|
3070
3069
|
const onReadyRef = useRef21(onReady);
|
|
3071
3070
|
const onErrorRef = useRef21(onError);
|
|
3072
|
-
|
|
3071
|
+
useLayoutEffect5(() => {
|
|
3073
3072
|
onReadyRef.current = onReady;
|
|
3074
3073
|
onErrorRef.current = onError;
|
|
3075
3074
|
});
|
|
@@ -3212,7 +3211,7 @@ var ProviderOnArrangement = ({
|
|
|
3212
3211
|
setLoopRegion(start, end);
|
|
3213
3212
|
}
|
|
3214
3213
|
}, [setLoopRegion, selectionStartRef, selectionEndRef]);
|
|
3215
|
-
|
|
3214
|
+
useEffect8(() => {
|
|
3216
3215
|
if (!scrollContainerRef.current || duration === 0) return;
|
|
3217
3216
|
const container = scrollContainerRef.current;
|
|
3218
3217
|
const oldSamplesPerPixel = samplesPerPixelRef.current;
|
|
@@ -3228,10 +3227,10 @@ var ProviderOnArrangement = ({
|
|
|
3228
3227
|
container.scrollLeft = newScrollLeft;
|
|
3229
3228
|
samplesPerPixelRef.current = newSamplesPerPixel;
|
|
3230
3229
|
}, [samplesPerPixel, duration, scrollContainerRef]);
|
|
3231
|
-
|
|
3230
|
+
useEffect8(() => {
|
|
3232
3231
|
syncSoundFontCacheToAdapter(adapterRef.current, soundFontCache);
|
|
3233
3232
|
}, [soundFontCache, adapterRef]);
|
|
3234
|
-
|
|
3233
|
+
useEffect8(() => {
|
|
3235
3234
|
for (const track of tracks) {
|
|
3236
3235
|
for (const clip of track.clips) {
|
|
3237
3236
|
if (!clip.audioBuffer && !clip.waveformData && !clip.midiNotes) {
|
|
@@ -3290,7 +3289,7 @@ var ProviderOnArrangement = ({
|
|
|
3290
3289
|
},
|
|
3291
3290
|
[stopAnimationFrameLoop, setCurrentTimeRefs]
|
|
3292
3291
|
);
|
|
3293
|
-
|
|
3292
|
+
useLayoutEffect5(() => {
|
|
3294
3293
|
const mirror = (state) => {
|
|
3295
3294
|
onSelectionEngineState(state);
|
|
3296
3295
|
onLoopEngineState(state);
|
|
@@ -3394,7 +3393,7 @@ var ProviderOnArrangement = ({
|
|
|
3394
3393
|
]);
|
|
3395
3394
|
const stopAnimationLoop = stopAnimationFrameLoop;
|
|
3396
3395
|
const prevContinuousPlayRef = useRef21(continuousPlay);
|
|
3397
|
-
|
|
3396
|
+
useEffect8(() => {
|
|
3398
3397
|
const continuousPlayTurnedOn = continuousPlay && !prevContinuousPlayRef.current && !isSelectionPlayRef.current;
|
|
3399
3398
|
prevContinuousPlayRef.current = continuousPlay;
|
|
3400
3399
|
const reschedulePlayback = () => __async(null, null, function* () {
|
|
@@ -3439,7 +3438,7 @@ var ProviderOnArrangement = ({
|
|
|
3439
3438
|
activeAnnotationIdRef,
|
|
3440
3439
|
engineRef
|
|
3441
3440
|
]);
|
|
3442
|
-
|
|
3441
|
+
useEffect8(() => {
|
|
3443
3442
|
const resumePlayback = () => __async(null, null, function* () {
|
|
3444
3443
|
const engine = engineRef.current;
|
|
3445
3444
|
const request = pendingResumeRef.current;
|
|
@@ -3849,8 +3848,8 @@ var ProviderOnArrangement = ({
|
|
|
3849
3848
|
// src/MediaElementPlaylistContext.tsx
|
|
3850
3849
|
import {
|
|
3851
3850
|
useState as useState17,
|
|
3852
|
-
useEffect as
|
|
3853
|
-
useLayoutEffect as
|
|
3851
|
+
useEffect as useEffect9,
|
|
3852
|
+
useLayoutEffect as useLayoutEffect6,
|
|
3854
3853
|
useRef as useRef22,
|
|
3855
3854
|
useCallback as useCallback20,
|
|
3856
3855
|
useMemo as useMemo12
|
|
@@ -3915,7 +3914,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
3915
3914
|
}
|
|
3916
3915
|
const playbackRateRef = useRef22(initialPlaybackRate);
|
|
3917
3916
|
const ratePropAppliedRef = useRef22(initialPlaybackRate);
|
|
3918
|
-
|
|
3917
|
+
useLayoutEffect6(() => {
|
|
3919
3918
|
if (Object.is(ratePropAppliedRef.current, initialPlaybackRate)) return;
|
|
3920
3919
|
ratePropAppliedRef.current = initialPlaybackRate;
|
|
3921
3920
|
playbackRateRef.current = initialPlaybackRate;
|
|
@@ -4009,7 +4008,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4009
4008
|
return [[clipPeaks]];
|
|
4010
4009
|
}, [trackPeaks, trackName, trackFadeIn, trackFadeOut]);
|
|
4011
4010
|
const latestAudioRef = useRef22({ source: track.source, waveformData: track.waveformData });
|
|
4012
|
-
|
|
4011
|
+
useLayoutEffect6(() => {
|
|
4013
4012
|
latestAudioRef.current = { source: track.source, waveformData: track.waveformData };
|
|
4014
4013
|
}, [track.source, track.waveformData]);
|
|
4015
4014
|
const restAt = useCallback20(
|
|
@@ -4031,7 +4030,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4031
4030
|
const startAnimationLoopRef = useRef22(() => {
|
|
4032
4031
|
});
|
|
4033
4032
|
const endPlaybackIfDueRef = useRef22(() => false);
|
|
4034
|
-
|
|
4033
|
+
useEffect9(() => {
|
|
4035
4034
|
let cancelled = false;
|
|
4036
4035
|
let createdPlayout = null;
|
|
4037
4036
|
const source = track.source;
|
|
@@ -4217,7 +4216,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4217
4216
|
runFrameCallbacks,
|
|
4218
4217
|
endPlaybackIfDue
|
|
4219
4218
|
]);
|
|
4220
|
-
|
|
4219
|
+
useLayoutEffect6(() => {
|
|
4221
4220
|
startAnimationLoopRef.current = startAnimationLoop;
|
|
4222
4221
|
endPlaybackIfDueRef.current = endPlaybackIfDue;
|
|
4223
4222
|
}, [startAnimationLoop, endPlaybackIfDue]);
|
|
@@ -4566,7 +4565,7 @@ var ZoomOutButton = ({
|
|
|
4566
4565
|
};
|
|
4567
4566
|
|
|
4568
4567
|
// src/components/ContextualControls.tsx
|
|
4569
|
-
import { useRef as useRef23, useEffect as
|
|
4568
|
+
import { useRef as useRef23, useEffect as useEffect10, useId } from "react";
|
|
4570
4569
|
import {
|
|
4571
4570
|
MasterVolumeControl as BaseMasterVolumeControl,
|
|
4572
4571
|
TimeFormatSelect as BaseTimeFormatSelect,
|
|
@@ -4612,7 +4611,7 @@ var AudioPosition = ({ className }) => {
|
|
|
4612
4611
|
useCurrentTime();
|
|
4613
4612
|
const { timeFormat: format } = usePlaylistSettings();
|
|
4614
4613
|
const id = useId();
|
|
4615
|
-
|
|
4614
|
+
useEffect10(() => {
|
|
4616
4615
|
if (isPlaying) {
|
|
4617
4616
|
registerFrameCallback(id, ({ time }) => {
|
|
4618
4617
|
if (timeRef.current) {
|
|
@@ -4622,7 +4621,7 @@ var AudioPosition = ({ className }) => {
|
|
|
4622
4621
|
}
|
|
4623
4622
|
return () => unregisterFrameCallback(id);
|
|
4624
4623
|
}, [id, isPlaying, format, registerFrameCallback, unregisterFrameCallback]);
|
|
4625
|
-
|
|
4624
|
+
useEffect10(() => {
|
|
4626
4625
|
var _a2;
|
|
4627
4626
|
if (!isPlaying && timeRef.current) {
|
|
4628
4627
|
timeRef.current.textContent = formatTime((_a2 = currentTimeRef.current) != null ? _a2 : 0, format);
|
|
@@ -4676,7 +4675,7 @@ var AutomaticScrollCheckbox = ({ className }) => {
|
|
|
4676
4675
|
// src/components/WaveformRoot.tsx
|
|
4677
4676
|
import {
|
|
4678
4677
|
use as use13,
|
|
4679
|
-
useLayoutEffect as
|
|
4678
|
+
useLayoutEffect as useLayoutEffect9,
|
|
4680
4679
|
useRef as useRef30,
|
|
4681
4680
|
useState as useState21,
|
|
4682
4681
|
useMemo as useMemo20,
|
|
@@ -4719,10 +4718,10 @@ function trackIdAtOffset(orderedIds, layout, heightById, y) {
|
|
|
4719
4718
|
}
|
|
4720
4719
|
|
|
4721
4720
|
// src/hooks/useTrailingActive.ts
|
|
4722
|
-
import { useEffect as
|
|
4721
|
+
import { useEffect as useEffect11, useState as useState18 } from "react";
|
|
4723
4722
|
function useTrailingActive(active, trailingMs) {
|
|
4724
4723
|
const [trailing, setTrailing] = useState18(active);
|
|
4725
|
-
|
|
4724
|
+
useEffect11(() => {
|
|
4726
4725
|
if (active) {
|
|
4727
4726
|
setTrailing(true);
|
|
4728
4727
|
return void 0;
|
|
@@ -4889,11 +4888,11 @@ import {
|
|
|
4889
4888
|
} from "@waveform-playlist/ui-components";
|
|
4890
4889
|
|
|
4891
4890
|
// src/hooks/useSelectionDrag.ts
|
|
4892
|
-
import { createContext as createContext3, memo as memo2, useLayoutEffect as
|
|
4891
|
+
import { createContext as createContext3, memo as memo2, useLayoutEffect as useLayoutEffect8, useMemo as useMemo14, useRef as useRef25, useState as useState19 } from "react";
|
|
4893
4892
|
import { createValueSource as createValueSource4 } from "@waveform-playlist/core";
|
|
4894
4893
|
|
|
4895
4894
|
// src/hooks/useWindowDrag.ts
|
|
4896
|
-
import { useEffect as
|
|
4895
|
+
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect7, useRef as useRef24 } from "react";
|
|
4897
4896
|
var activeDrags = 0;
|
|
4898
4897
|
var userSelectBeforeDrags = "";
|
|
4899
4898
|
var webkitUserSelectBeforeDrags = "";
|
|
@@ -4916,10 +4915,10 @@ function suspendTextSelection() {
|
|
|
4916
4915
|
}
|
|
4917
4916
|
function useWindowDrag(active, onMove, onEnd) {
|
|
4918
4917
|
const callbacksRef = useRef24({ onMove, onEnd });
|
|
4919
|
-
|
|
4918
|
+
useLayoutEffect7(() => {
|
|
4920
4919
|
callbacksRef.current = { onMove, onEnd };
|
|
4921
4920
|
});
|
|
4922
|
-
|
|
4921
|
+
useEffect12(() => {
|
|
4923
4922
|
if (!active) return;
|
|
4924
4923
|
const move = (event) => {
|
|
4925
4924
|
if ((event.buttons & 1) === 0) {
|
|
@@ -4960,7 +4959,7 @@ var AutomaticScrollFlag = memo2(function AutomaticScrollFlag2({
|
|
|
4960
4959
|
flagRef
|
|
4961
4960
|
}) {
|
|
4962
4961
|
const { isAutomaticScroll } = usePlaylistSettings();
|
|
4963
|
-
|
|
4962
|
+
useLayoutEffect8(() => {
|
|
4964
4963
|
flagRef.current = isAutomaticScroll;
|
|
4965
4964
|
});
|
|
4966
4965
|
return null;
|
|
@@ -5109,7 +5108,7 @@ function useClipInteractionEnabled() {
|
|
|
5109
5108
|
}
|
|
5110
5109
|
|
|
5111
5110
|
// src/components/ChannelWithProgress.tsx
|
|
5112
|
-
import { useId as useId2, useRef as useRef26, useEffect as
|
|
5111
|
+
import { useId as useId2, useRef as useRef26, useEffect as useEffect13 } from "react";
|
|
5113
5112
|
import styled3 from "styled-components";
|
|
5114
5113
|
import {
|
|
5115
5114
|
clipPixelWidth as computeClipPixelWidth
|
|
@@ -5185,7 +5184,7 @@ var ClipProgress = ({
|
|
|
5185
5184
|
clipDurationSamples,
|
|
5186
5185
|
samplesPerPixel
|
|
5187
5186
|
);
|
|
5188
|
-
|
|
5187
|
+
useEffect13(() => {
|
|
5189
5188
|
if (isPlaying) {
|
|
5190
5189
|
registerFrameCallback(callbackId, ({ visualTime, sampleRate: sr }) => {
|
|
5191
5190
|
if (progressRef.current) {
|
|
@@ -5203,7 +5202,7 @@ var ClipProgress = ({
|
|
|
5203
5202
|
registerFrameCallback,
|
|
5204
5203
|
unregisterFrameCallback
|
|
5205
5204
|
]);
|
|
5206
|
-
|
|
5205
|
+
useEffect13(() => {
|
|
5207
5206
|
var _a, _b;
|
|
5208
5207
|
if (!isPlaying && progressRef.current) {
|
|
5209
5208
|
const currentTime = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
|
|
@@ -5702,7 +5701,7 @@ var TrackControlsSharedContext = createContext7(null);
|
|
|
5702
5701
|
var TrackSlotWiringContext = createContext7(null);
|
|
5703
5702
|
|
|
5704
5703
|
// src/hooks/useTrackReorderHandle.ts
|
|
5705
|
-
import { use as use7, useEffect as
|
|
5704
|
+
import { use as use7, useEffect as useEffect14 } from "react";
|
|
5706
5705
|
import { useSortable } from "@dnd-kit/react/sortable";
|
|
5707
5706
|
import { RestrictToVerticalAxis } from "@dnd-kit/abstract/modifiers";
|
|
5708
5707
|
import { Feedback } from "@dnd-kit/dom";
|
|
@@ -5780,12 +5779,12 @@ function useTrackReorderHandle() {
|
|
|
5780
5779
|
// either way. See browser/CLAUDE.md "Track Reordering".
|
|
5781
5780
|
plugins: withMoveFeedback
|
|
5782
5781
|
});
|
|
5783
|
-
|
|
5782
|
+
useEffect14(() => {
|
|
5784
5783
|
if (!wiring) return void 0;
|
|
5785
5784
|
ref(wiring.elementRef.current);
|
|
5786
5785
|
return () => ref(null);
|
|
5787
5786
|
}, [ref, wiring]);
|
|
5788
|
-
|
|
5787
|
+
useEffect14(() => {
|
|
5789
5788
|
if (!wiring) return void 0;
|
|
5790
5789
|
const { handleCount } = wiring;
|
|
5791
5790
|
handleCount.current += 1;
|
|
@@ -5798,12 +5797,12 @@ function useTrackReorderHandle() {
|
|
|
5798
5797
|
handleCount.current -= 1;
|
|
5799
5798
|
};
|
|
5800
5799
|
}, [wiring]);
|
|
5801
|
-
|
|
5800
|
+
useEffect14(() => {
|
|
5802
5801
|
if (!wiring) return void 0;
|
|
5803
5802
|
wiring.setDragSource(isDragSource);
|
|
5804
5803
|
return () => wiring.setDragSource(false);
|
|
5805
5804
|
}, [isDragSource, wiring]);
|
|
5806
|
-
|
|
5805
|
+
useEffect14(() => {
|
|
5807
5806
|
const element = wiring == null ? void 0 : wiring.elementRef.current;
|
|
5808
5807
|
if (!isDragSource || !element) return void 0;
|
|
5809
5808
|
return createDragPopoverHealer(element);
|
|
@@ -6226,7 +6225,7 @@ import {
|
|
|
6226
6225
|
} from "@waveform-playlist/ui-components";
|
|
6227
6226
|
|
|
6228
6227
|
// src/components/AnimatedPlayhead.tsx
|
|
6229
|
-
import { useRef as useRef29, useEffect as
|
|
6228
|
+
import { useRef as useRef29, useEffect as useEffect15, useId as useId3 } from "react";
|
|
6230
6229
|
import styled5 from "styled-components";
|
|
6231
6230
|
import { usePlaylistInfo as usePlaylistInfo3 } from "@waveform-playlist/ui-components";
|
|
6232
6231
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
@@ -6253,7 +6252,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6253
6252
|
const { sampleRate } = usePlaylistView();
|
|
6254
6253
|
const { progressBarWidth } = usePlaylistInfo3();
|
|
6255
6254
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6256
|
-
|
|
6255
|
+
useEffect15(() => {
|
|
6257
6256
|
if (isPlaying) {
|
|
6258
6257
|
registerFrameCallback(
|
|
6259
6258
|
frameCallbackId,
|
|
@@ -6267,7 +6266,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6267
6266
|
}
|
|
6268
6267
|
return () => unregisterFrameCallback(frameCallbackId);
|
|
6269
6268
|
}, [isPlaying, frameCallbackId, registerFrameCallback, unregisterFrameCallback]);
|
|
6270
|
-
|
|
6269
|
+
useEffect15(() => {
|
|
6271
6270
|
var _a, _b;
|
|
6272
6271
|
if (!isPlaying && playheadRef.current) {
|
|
6273
6272
|
const time = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
|
|
@@ -6719,7 +6718,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6719
6718
|
const [scrollContainerElement, setScrollContainerElement] = useState21(null);
|
|
6720
6719
|
const fillsContainer = indefinitePlayback || fillViewport;
|
|
6721
6720
|
const [scrollContainerWidth, setScrollContainerWidth] = useState21(0);
|
|
6722
|
-
|
|
6721
|
+
useLayoutEffect9(() => {
|
|
6723
6722
|
if (!fillsContainer || !scrollContainerElement) return;
|
|
6724
6723
|
const measure = () => setScrollContainerWidth(scrollContainerElement.clientWidth);
|
|
6725
6724
|
measure();
|
|
@@ -7223,11 +7222,11 @@ var KeyboardShortcuts = ({
|
|
|
7223
7222
|
};
|
|
7224
7223
|
|
|
7225
7224
|
// src/hooks/useRecordingSession.ts
|
|
7226
|
-
import { useEffect as
|
|
7225
|
+
import { useEffect as useEffect16 } from "react";
|
|
7227
7226
|
function useRecordingSession({ isRecording, trackId }) {
|
|
7228
7227
|
const { setRecordingActive } = useEditorControls();
|
|
7229
7228
|
const armedTrackId = trackId != null ? trackId : null;
|
|
7230
|
-
|
|
7229
|
+
useEffect16(() => {
|
|
7231
7230
|
if (!isRecording) return void 0;
|
|
7232
7231
|
setRecordingActive(true, armedTrackId);
|
|
7233
7232
|
return () => setRecordingActive(false);
|