@waveform-playlist/browser 17.0.0-next.6 → 17.0.0-next.8
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 +5 -5
- package/dist/index.d.mts +51 -52
- package/dist/index.d.ts +51 -52
- package/dist/index.js +180 -181
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -180
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js +2 -2
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs +2 -2
- package/dist/tone.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -184,7 +184,7 @@ __export(index_exports, {
|
|
|
184
184
|
module.exports = __toCommonJS(index_exports);
|
|
185
185
|
|
|
186
186
|
// <define:__INSTALL_SPECS__>
|
|
187
|
-
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.
|
|
187
|
+
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.5", "@waveform-playlist/media-element-playout": "@waveform-playlist/media-element-playout@^12.4.0-next.3", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.3", "@waveform-playlist/recording": "@waveform-playlist/recording@^14.0.0-next.5", 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.3" };
|
|
188
188
|
|
|
189
189
|
// src/WaveformPlaylistContext.tsx
|
|
190
190
|
var import_react35 = require("react");
|
|
@@ -541,7 +541,7 @@ var PlaylistMixerContext = slot();
|
|
|
541
541
|
var TrackReorderPreviewContext = slot();
|
|
542
542
|
var TrimPreviewContext = slot();
|
|
543
543
|
var TrimPreviewPeaksContext = slot();
|
|
544
|
-
var
|
|
544
|
+
var RecordingTrackContext = slot();
|
|
545
545
|
var PlaybackRateContext = slot();
|
|
546
546
|
var MediaElementTrackContext = slot();
|
|
547
547
|
function useSlot(context, hookName, needs) {
|
|
@@ -579,7 +579,7 @@ var useUndoRedo = () => useSlot(UndoRedoContext, "useUndoRedo", WEB_AUDIO);
|
|
|
579
579
|
var usePlaylistTimeline = () => useSlot(PlaylistTimelineContext, "usePlaylistTimeline", WEB_AUDIO);
|
|
580
580
|
var usePlaylistMixer = () => useSlot(PlaylistMixerContext, "usePlaylistMixer", WEB_AUDIO);
|
|
581
581
|
var useTrackReorderPreview = () => useSlot(TrackReorderPreviewContext, "useTrackReorderPreview", WEB_AUDIO);
|
|
582
|
-
var
|
|
582
|
+
var useRecordingTrack = () => useSlot(RecordingTrackContext, "useRecordingTrack", WEB_AUDIO);
|
|
583
583
|
var usePlaybackRate = () => useSlot(PlaybackRateContext, "usePlaybackRate", MEDIA_ELEMENT);
|
|
584
584
|
var useMediaElementTrack = () => useSlot(MediaElementTrackContext, "useMediaElementTrack", MEDIA_ELEMENT);
|
|
585
585
|
var useWebAudioProviderOnly = (hookName) => {
|
|
@@ -2827,19 +2827,20 @@ function deriveRows(tracks, inputs, previous) {
|
|
|
2827
2827
|
});
|
|
2828
2828
|
return { byTrackId, result: sameItems(previous.result, rows) ? previous.result : rows };
|
|
2829
2829
|
}
|
|
2830
|
-
function sameState(a, name, mix) {
|
|
2831
|
-
return a.name === name && a.volume === mix.volume && a.muted ===
|
|
2830
|
+
function sameState(a, name, mix, muted) {
|
|
2831
|
+
return a.name === name && a.volume === mix.volume && a.muted === muted && a.soloed === mix.soloed && a.pan === mix.pan;
|
|
2832
2832
|
}
|
|
2833
|
-
function deriveTrackStates(tracks, mixer, previous) {
|
|
2833
|
+
function deriveTrackStates(tracks, mixer, recordingTrackIds, previous) {
|
|
2834
2834
|
const byTrackId = /* @__PURE__ */ new Map();
|
|
2835
2835
|
const states = tracks.map((track) => {
|
|
2836
2836
|
var _a;
|
|
2837
2837
|
const mix = (_a = mixer.get(track.id)) != null ? _a : DEFAULT_MIX;
|
|
2838
|
+
const muted = mix.muted || recordingTrackIds.has(track.id);
|
|
2838
2839
|
const before = previous.byTrackId.get(track.id);
|
|
2839
|
-
const state = before && sameState(before, track.name, mix) ? before : {
|
|
2840
|
+
const state = before && sameState(before, track.name, mix, muted) ? before : {
|
|
2840
2841
|
name: track.name,
|
|
2841
2842
|
volume: mix.volume,
|
|
2842
|
-
muted
|
|
2843
|
+
muted,
|
|
2843
2844
|
soloed: mix.soloed,
|
|
2844
2845
|
pan: mix.pan
|
|
2845
2846
|
};
|
|
@@ -2859,12 +2860,14 @@ function useArrangementValue(arrangement, read) {
|
|
|
2859
2860
|
return (0, import_react31.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
2860
2861
|
}
|
|
2861
2862
|
var readMixer = (arrangement) => arrangement.getMixer();
|
|
2863
|
+
var readRecordingTrackIds = (arrangement) => arrangement.recordingTrackIds;
|
|
2862
2864
|
var readCanUndo = (arrangement) => arrangement.canUndo;
|
|
2863
2865
|
var readCanRedo = (arrangement) => arrangement.canRedo;
|
|
2864
2866
|
function useArrangementView(arrangement, options) {
|
|
2865
2867
|
const { samplesPerPixel, mono, baseScale, placeholderSampleRate } = options;
|
|
2866
2868
|
const arrangementTracks = useArrangementTracks(arrangement);
|
|
2867
2869
|
const mixer = useArrangementValue(arrangement, readMixer);
|
|
2870
|
+
const recordingTrackIds = useArrangementValue(arrangement, readRecordingTrackIds);
|
|
2868
2871
|
const canUndo = useArrangementValue(arrangement, readCanUndo);
|
|
2869
2872
|
const canRedo = useArrangementValue(arrangement, readCanRedo);
|
|
2870
2873
|
const loadedCacheRef = (0, import_react31.useRef)(EMPTY_LOADED_TRACKS);
|
|
@@ -2894,10 +2897,15 @@ function useArrangementView(arrangement, options) {
|
|
|
2894
2897
|
const duration = (0, import_react31.useMemo)(() => timelineDuration(tracks), [tracks]);
|
|
2895
2898
|
const statesCacheRef = (0, import_react31.useRef)(EMPTY_STATES);
|
|
2896
2899
|
const trackStates = (0, import_react31.useMemo)(() => {
|
|
2897
|
-
const next = deriveTrackStates(
|
|
2900
|
+
const next = deriveTrackStates(
|
|
2901
|
+
arrangementTracks,
|
|
2902
|
+
mixer,
|
|
2903
|
+
recordingTrackIds,
|
|
2904
|
+
statesCacheRef.current
|
|
2905
|
+
);
|
|
2898
2906
|
statesCacheRef.current = next;
|
|
2899
2907
|
return next.result;
|
|
2900
|
-
}, [arrangementTracks, mixer]);
|
|
2908
|
+
}, [arrangementTracks, mixer, recordingTrackIds]);
|
|
2901
2909
|
return {
|
|
2902
2910
|
tracks,
|
|
2903
2911
|
peaksDataArray,
|
|
@@ -2970,7 +2978,6 @@ function useReadyOnce(options) {
|
|
|
2970
2978
|
|
|
2971
2979
|
// src/providerInternals/useArrangementEditing.ts
|
|
2972
2980
|
var import_react33 = require("react");
|
|
2973
|
-
var import_core8 = require("@waveform-playlist/core");
|
|
2974
2981
|
|
|
2975
2982
|
// src/components/partWarnings.ts
|
|
2976
2983
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -2990,63 +2997,71 @@ function isTrackId(setter, trackId) {
|
|
|
2990
2997
|
);
|
|
2991
2998
|
return false;
|
|
2992
2999
|
}
|
|
3000
|
+
var readRecordingTrackId = (arrangement) => {
|
|
3001
|
+
for (const id of arrangement.recordingTrackIds) return id;
|
|
3002
|
+
return null;
|
|
3003
|
+
};
|
|
3004
|
+
function clearRecordingTracks(arrangement, keep = null) {
|
|
3005
|
+
for (const id of [...arrangement.recordingTrackIds]) {
|
|
3006
|
+
if (id !== keep) arrangement.setTrackRecording(id, false);
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
2993
3009
|
function useRecordingActive(arrangement) {
|
|
2994
3010
|
const recordingActiveRef = (0, import_react33.useRef)(false);
|
|
2995
|
-
const [armed] = (0, import_react33.useState)(() => (0, import_core8.createValueSource)(null));
|
|
2996
3011
|
const setRecordingActive = (0, import_react33.useCallback)(
|
|
2997
|
-
(active,
|
|
2998
|
-
var _a, _b;
|
|
3012
|
+
(active, recordingTrackId2) => {
|
|
2999
3013
|
recordingActiveRef.current = active;
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
armed.publish({ trackId: armedTrackId2, prevMuted });
|
|
3006
|
-
arrangement.setTrackMute(armedTrackId2, true);
|
|
3007
|
-
} else if (!active && current) {
|
|
3008
|
-
arrangement.setTrackMute(current.trackId, current.prevMuted);
|
|
3009
|
-
armed.publish(null);
|
|
3014
|
+
if (active && recordingTrackId2) {
|
|
3015
|
+
clearRecordingTracks(arrangement, recordingTrackId2);
|
|
3016
|
+
arrangement.setTrackRecording(recordingTrackId2, true);
|
|
3017
|
+
} else if (!active) {
|
|
3018
|
+
clearRecordingTracks(arrangement);
|
|
3010
3019
|
}
|
|
3011
3020
|
},
|
|
3012
|
-
[arrangement
|
|
3021
|
+
[arrangement]
|
|
3013
3022
|
);
|
|
3014
3023
|
(0, import_react33.useEffect)(
|
|
3015
3024
|
() => () => {
|
|
3016
|
-
if (
|
|
3025
|
+
if (arrangement.recordingTrackIds.size > 0) setRecordingActive(false);
|
|
3017
3026
|
},
|
|
3018
|
-
[
|
|
3027
|
+
[arrangement, setRecordingActive]
|
|
3019
3028
|
);
|
|
3020
|
-
const
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
const
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3029
|
+
const subscribe = (0, import_react33.useCallback)(
|
|
3030
|
+
(listener) => arrangement.subscribe(listener),
|
|
3031
|
+
[arrangement]
|
|
3032
|
+
);
|
|
3033
|
+
const getRecordingTrackId = (0, import_react33.useCallback)(() => readRecordingTrackId(arrangement), [arrangement]);
|
|
3034
|
+
const recordingTrackId = (0, import_react33.useSyncExternalStore)(
|
|
3035
|
+
subscribe,
|
|
3036
|
+
getRecordingTrackId,
|
|
3037
|
+
getRecordingTrackId
|
|
3038
|
+
);
|
|
3039
|
+
const recordingTrack = (0, import_react33.useMemo)(() => ({ recordingTrackId }), [recordingTrackId]);
|
|
3040
|
+
return { setRecordingActive, recordingActiveRef, recordingTrack };
|
|
3027
3041
|
}
|
|
3028
3042
|
function useArrangementEditing(arrangement) {
|
|
3029
3043
|
const setTrackMute = (0, import_react33.useCallback)(
|
|
3030
|
-
(trackId, muted) => {
|
|
3031
|
-
if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted);
|
|
3044
|
+
(trackId, muted, options) => {
|
|
3045
|
+
if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted, options);
|
|
3032
3046
|
},
|
|
3033
3047
|
[arrangement]
|
|
3034
3048
|
);
|
|
3035
3049
|
const setTrackSolo = (0, import_react33.useCallback)(
|
|
3036
|
-
(trackId, soloed) => {
|
|
3037
|
-
if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed);
|
|
3050
|
+
(trackId, soloed, options) => {
|
|
3051
|
+
if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed, options);
|
|
3038
3052
|
},
|
|
3039
3053
|
[arrangement]
|
|
3040
3054
|
);
|
|
3041
3055
|
const setTrackVolume = (0, import_react33.useCallback)(
|
|
3042
|
-
(trackId, volume) => {
|
|
3043
|
-
if (isTrackId("setTrackVolume", trackId))
|
|
3056
|
+
(trackId, volume, options) => {
|
|
3057
|
+
if (isTrackId("setTrackVolume", trackId))
|
|
3058
|
+
arrangement.setTrackVolume(trackId, volume, options);
|
|
3044
3059
|
},
|
|
3045
3060
|
[arrangement]
|
|
3046
3061
|
);
|
|
3047
3062
|
const setTrackPan = (0, import_react33.useCallback)(
|
|
3048
|
-
(trackId, pan) => {
|
|
3049
|
-
if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan);
|
|
3063
|
+
(trackId, pan, options) => {
|
|
3064
|
+
if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan, options);
|
|
3050
3065
|
},
|
|
3051
3066
|
[arrangement]
|
|
3052
3067
|
);
|
|
@@ -3056,7 +3071,7 @@ function useArrangementEditing(arrangement) {
|
|
|
3056
3071
|
);
|
|
3057
3072
|
const undo = (0, import_react33.useCallback)(() => arrangement.undo(), [arrangement]);
|
|
3058
3073
|
const redo = (0, import_react33.useCallback)(() => arrangement.redo(), [arrangement]);
|
|
3059
|
-
const { setRecordingActive, recordingActiveRef,
|
|
3074
|
+
const { setRecordingActive, recordingActiveRef, recordingTrack } = useRecordingActive(arrangement);
|
|
3060
3075
|
return {
|
|
3061
3076
|
setTrackMute,
|
|
3062
3077
|
setTrackSolo,
|
|
@@ -3067,7 +3082,7 @@ function useArrangementEditing(arrangement) {
|
|
|
3067
3082
|
redo,
|
|
3068
3083
|
setRecordingActive,
|
|
3069
3084
|
recordingActiveRef,
|
|
3070
|
-
|
|
3085
|
+
recordingTrack
|
|
3071
3086
|
};
|
|
3072
3087
|
}
|
|
3073
3088
|
|
|
@@ -3163,7 +3178,6 @@ var ProviderOnArrangement = ({
|
|
|
3163
3178
|
const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
|
|
3164
3179
|
const [isPlaying, setIsPlaying] = (0, import_react35.useState)(false);
|
|
3165
3180
|
const [currentTime, setCurrentTime] = (0, import_react35.useState)(0);
|
|
3166
|
-
const [trackReorderEpoch, setTrackReorderEpoch] = (0, import_react35.useState)(0);
|
|
3167
3181
|
const [trackDragPreview, setTrackDragPreview] = (0, import_react35.useState)(null);
|
|
3168
3182
|
const indefinitePlaybackRef = (0, import_react35.useRef)(indefinitePlayback);
|
|
3169
3183
|
indefinitePlaybackRef.current = indefinitePlayback;
|
|
@@ -3701,9 +3715,6 @@ var ProviderOnArrangement = ({
|
|
|
3701
3715
|
},
|
|
3702
3716
|
[play, setCurrentTimeRefs, recordingActiveRef]
|
|
3703
3717
|
);
|
|
3704
|
-
const bumpTrackReorderEpoch = (0, import_react35.useCallback)(() => {
|
|
3705
|
-
setTrackReorderEpoch((epoch) => epoch + 1);
|
|
3706
|
-
}, []);
|
|
3707
3718
|
const setSelection = (0, import_react35.useCallback)(
|
|
3708
3719
|
(start, end) => {
|
|
3709
3720
|
var _a;
|
|
@@ -3871,7 +3882,6 @@ var ProviderOnArrangement = ({
|
|
|
3871
3882
|
setTrackVolume: editing.setTrackVolume,
|
|
3872
3883
|
setTrackPan: editing.setTrackPan,
|
|
3873
3884
|
reorderTrack: editing.reorderTrack,
|
|
3874
|
-
bumpTrackReorderEpoch,
|
|
3875
3885
|
setTrackDragPreview,
|
|
3876
3886
|
setSelectedTrackId: setSelectedTrackIdControl,
|
|
3877
3887
|
// Zoom
|
|
@@ -3897,7 +3907,6 @@ var ProviderOnArrangement = ({
|
|
|
3897
3907
|
editing.setTrackVolume,
|
|
3898
3908
|
editing.setTrackPan,
|
|
3899
3909
|
editing.reorderTrack,
|
|
3900
|
-
bumpTrackReorderEpoch,
|
|
3901
3910
|
setTrackDragPreview,
|
|
3902
3911
|
setSelectedTrackIdControl,
|
|
3903
3912
|
zoom.zoomIn,
|
|
@@ -3938,8 +3947,8 @@ var ProviderOnArrangement = ({
|
|
|
3938
3947
|
[trackStates, masterVolume]
|
|
3939
3948
|
);
|
|
3940
3949
|
const reorderPreviewValue = (0, import_react35.useMemo)(
|
|
3941
|
-
() => ({ trackDragPreview
|
|
3942
|
-
[trackDragPreview
|
|
3950
|
+
() => ({ trackDragPreview }),
|
|
3951
|
+
[trackDragPreview]
|
|
3943
3952
|
);
|
|
3944
3953
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled_components.ThemeProvider, { theme: mergedTheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaybackRateContext, { value: BLOCKED, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaElementTrackContext, { value: BLOCKED, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrangementContext, { value: arrangement, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaybackRefsContext, { value: refsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EngineRefsContext, { value: engineRefsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TrimPreviewContext, { value: trimPreview, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TrimPreviewPeaksContext, { value: trimPreviewPeaks, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaybackControlsContext, { value: controlsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorControlsContext, { value: editorControlsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaylistViewContext, { value: viewValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaylistSettingsContext, { value: settingsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaylistZoomContext, { value: zoomValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UndoRedoContext, { value: undoRedoValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectedTrackIdContext, { value: selectedTrackIdValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectedRowContext, { value: selectedTrackIdValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoopContext, { value: loopValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnnotationOptionsContext, { value: annotationOptionsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnnotationsContext, { value: annotationsValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IsPlayingContext, { value: isPlayingValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActiveAnnotationContext, { value: activeAnnotationValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectionContext, { value: selectionValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3945
3954
|
TrackReorderPreviewContext,
|
|
@@ -3950,9 +3959,9 @@ var ProviderOnArrangement = ({
|
|
|
3950
3959
|
{
|
|
3951
3960
|
value: timelineValue,
|
|
3952
3961
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3953
|
-
|
|
3962
|
+
RecordingTrackContext,
|
|
3954
3963
|
{
|
|
3955
|
-
value: editing.
|
|
3964
|
+
value: editing.recordingTrack,
|
|
3956
3965
|
children
|
|
3957
3966
|
}
|
|
3958
3967
|
)
|
|
@@ -4536,7 +4545,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4536
4545
|
ActiveAnnotationContext,
|
|
4537
4546
|
{
|
|
4538
4547
|
value: activeAnnotationValue,
|
|
4539
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectionContext, { value: selection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectionContext, { value: selection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RecordingTrackContext, { value: BLOCKED, children }) }) }) })
|
|
4540
4549
|
}
|
|
4541
4550
|
) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
4542
4551
|
};
|
|
@@ -4778,7 +4787,7 @@ var AutomaticScrollCheckbox = ({ className }) => {
|
|
|
4778
4787
|
// src/components/WaveformRoot.tsx
|
|
4779
4788
|
var import_react60 = require("react");
|
|
4780
4789
|
var import_react_dom2 = require("react-dom");
|
|
4781
|
-
var
|
|
4790
|
+
var import_ui_components15 = require("@waveform-playlist/ui-components");
|
|
4782
4791
|
|
|
4783
4792
|
// src/utils/trackOrderPreview.ts
|
|
4784
4793
|
function applyTrackOrderPreview(tracks, preview) {
|
|
@@ -4920,10 +4929,10 @@ function useSpectrogramIntegration() {
|
|
|
4920
4929
|
}
|
|
4921
4930
|
|
|
4922
4931
|
// src/utils/trackRenderMode.ts
|
|
4923
|
-
var
|
|
4932
|
+
var import_core8 = require("@waveform-playlist/core");
|
|
4924
4933
|
function trackRenderMode(track, override) {
|
|
4925
4934
|
var _a;
|
|
4926
|
-
if ((0,
|
|
4935
|
+
if ((0, import_core8.trackKind)(track) === "midi") return "waveform";
|
|
4927
4936
|
return (_a = override != null ? override : track.renderMode) != null ? _a : "waveform";
|
|
4928
4937
|
}
|
|
4929
4938
|
|
|
@@ -4945,6 +4954,7 @@ var TrackRowPositioner = import_styled_components4.default.div.attrs((props) =>
|
|
|
4945
4954
|
transition: none;
|
|
4946
4955
|
}
|
|
4947
4956
|
`;
|
|
4957
|
+
var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
|
|
4948
4958
|
var ControlSlot = import_styled_components4.default.div.attrs((props) => ({
|
|
4949
4959
|
style: {
|
|
4950
4960
|
height: `${props.$height}px`,
|
|
@@ -4963,6 +4973,7 @@ var ControlSlot = import_styled_components4.default.div.attrs((props) => ({
|
|
|
4963
4973
|
transition: background 0.15s ease-in-out;
|
|
4964
4974
|
}
|
|
4965
4975
|
${(props) => props.$isSelected && `background: ${props.theme.selectedTrackControlsBackground};`}
|
|
4976
|
+
${(props) => props.$isDragSource && `background: ${props.theme.selectedTrackControlsBackground}; box-shadow: ${DRAG_SOURCE_SHADOW};`}
|
|
4966
4977
|
`;
|
|
4967
4978
|
function getTrackChannelCount(trackClipPeaks, recordingChannels) {
|
|
4968
4979
|
const clipChannels = trackClipPeaks.length > 0 ? Math.max(1, ...trackClipPeaks.map((clip) => clip.peaks.data.length)) : 1;
|
|
@@ -4971,11 +4982,11 @@ function getTrackChannelCount(trackClipPeaks, recordingChannels) {
|
|
|
4971
4982
|
|
|
4972
4983
|
// src/components/waveformFrame.tsx
|
|
4973
4984
|
var import_react59 = __toESM(require("react"));
|
|
4974
|
-
var
|
|
4985
|
+
var import_ui_components14 = require("@waveform-playlist/ui-components");
|
|
4975
4986
|
|
|
4976
4987
|
// src/hooks/useSelectionDrag.ts
|
|
4977
4988
|
var import_react44 = require("react");
|
|
4978
|
-
var
|
|
4989
|
+
var import_core9 = require("@waveform-playlist/core");
|
|
4979
4990
|
|
|
4980
4991
|
// src/hooks/useWindowDrag.ts
|
|
4981
4992
|
var import_react43 = require("react");
|
|
@@ -5060,7 +5071,7 @@ function useSelectionDrag({
|
|
|
5060
5071
|
const { setSelection } = usePlaybackControls();
|
|
5061
5072
|
const [isSelecting, setIsSelecting] = (0, import_react44.useState)(false);
|
|
5062
5073
|
const automaticScrollRef = (0, import_react44.useRef)(false);
|
|
5063
|
-
const previewHandle = (0, import_react44.useMemo)(() => (0,
|
|
5074
|
+
const previewHandle = (0, import_react44.useMemo)(() => (0, import_core9.createValueSource)(null), []);
|
|
5064
5075
|
const pressTimeRef = (0, import_react44.useRef)(0);
|
|
5065
5076
|
const wroteSelectionRef = (0, import_react44.useRef)(false);
|
|
5066
5077
|
const dragElementRef = (0, import_react44.useRef)(null);
|
|
@@ -5147,12 +5158,12 @@ var useWaveformRows = (part) => required((0, import_react45.use)(WaveformRowsCon
|
|
|
5147
5158
|
|
|
5148
5159
|
// src/components/waveformParts.tsx
|
|
5149
5160
|
var import_react58 = __toESM(require("react"));
|
|
5150
|
-
var
|
|
5161
|
+
var import_ui_components13 = require("@waveform-playlist/ui-components");
|
|
5151
5162
|
|
|
5152
5163
|
// src/components/TrackRows.tsx
|
|
5153
5164
|
var import_react48 = __toESM(require("react"));
|
|
5154
5165
|
var import_ui_components7 = require("@waveform-playlist/ui-components");
|
|
5155
|
-
var
|
|
5166
|
+
var import_core11 = require("@waveform-playlist/core");
|
|
5156
5167
|
|
|
5157
5168
|
// src/contexts/ClipInteractionContext.tsx
|
|
5158
5169
|
var import_react46 = require("react");
|
|
@@ -5180,7 +5191,7 @@ function useClipInteractionEnabled() {
|
|
|
5180
5191
|
// src/components/ChannelWithProgress.tsx
|
|
5181
5192
|
var import_react47 = require("react");
|
|
5182
5193
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
5183
|
-
var
|
|
5194
|
+
var import_core10 = require("@waveform-playlist/core");
|
|
5184
5195
|
var import_ui_components6 = require("@waveform-playlist/ui-components");
|
|
5185
5196
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5186
5197
|
var ChannelWrapper = import_styled_components5.default.div`
|
|
@@ -5242,7 +5253,7 @@ var ClipProgress = ({
|
|
|
5242
5253
|
useCurrentTime();
|
|
5243
5254
|
const { sampleRate } = usePlaylistView();
|
|
5244
5255
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
5245
|
-
const clipPixelWidth = (0,
|
|
5256
|
+
const clipPixelWidth = (0, import_core10.clipPixelWidth)(
|
|
5246
5257
|
clipStartSample,
|
|
5247
5258
|
clipDurationSamples,
|
|
5248
5259
|
samplesPerPixel
|
|
@@ -5473,7 +5484,7 @@ var RecordingPreviewClip = ({
|
|
|
5473
5484
|
const getSnapshot = (0, import_react48.useCallback)(() => source.getSnapshot(), [source]);
|
|
5474
5485
|
const progress = (0, import_react48.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
5475
5486
|
const durationSamples = Math.floor(progress.duration * sampleRate);
|
|
5476
|
-
const latencyOffsetSamples = (0,
|
|
5487
|
+
const latencyOffsetSamples = (0, import_core11.resolveRecordingOffsetSamples)({
|
|
5477
5488
|
overrideSeconds: recordingState.latencyOffset,
|
|
5478
5489
|
outputLatency: getOutputLatency(),
|
|
5479
5490
|
lookAhead: getLookAhead(),
|
|
@@ -5695,8 +5706,8 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5695
5706
|
var _a, _b;
|
|
5696
5707
|
const track = rowList[trackIndex];
|
|
5697
5708
|
if (!track) return null;
|
|
5698
|
-
const
|
|
5699
|
-
const recordingChannels =
|
|
5709
|
+
const isRecordingTrack = (recordingState == null ? void 0 : recordingState.isRecording) === true && recordingState.trackId === track.id;
|
|
5710
|
+
const recordingChannels = isRecordingTrack ? recordingChannelCount : 0;
|
|
5700
5711
|
const helpers = spectrogramHelpersById.get(track.id);
|
|
5701
5712
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5702
5713
|
TrackRow,
|
|
@@ -5714,7 +5725,7 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5714
5725
|
numChannels: getTrackChannelCount(trackClipPeaks, recordingChannels),
|
|
5715
5726
|
waveHeight,
|
|
5716
5727
|
mono,
|
|
5717
|
-
recordingState:
|
|
5728
|
+
recordingState: isRecordingTrack ? recordingState : void 0,
|
|
5718
5729
|
spectrogramConfig: helpers == null ? void 0 : helpers.config,
|
|
5719
5730
|
frequencyScaleFn: helpers == null ? void 0 : helpers.frequencyScaleFn,
|
|
5720
5731
|
samplesPerPixel,
|
|
@@ -5728,7 +5739,6 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5728
5739
|
|
|
5729
5740
|
// src/components/TrackControlsColumn.tsx
|
|
5730
5741
|
var import_react54 = __toESM(require("react"));
|
|
5731
|
-
var import_ui_components10 = require("@waveform-playlist/ui-components");
|
|
5732
5742
|
|
|
5733
5743
|
// src/components/DefaultTrackControls.tsx
|
|
5734
5744
|
var import_react52 = __toESM(require("react"));
|
|
@@ -5737,6 +5747,7 @@ var import_ui_components9 = require("@waveform-playlist/ui-components");
|
|
|
5737
5747
|
|
|
5738
5748
|
// src/components/TrackControlPieces.tsx
|
|
5739
5749
|
var import_react51 = require("react");
|
|
5750
|
+
var import_core12 = require("@waveform-playlist/core");
|
|
5740
5751
|
var import_ui_components8 = require("@waveform-playlist/ui-components");
|
|
5741
5752
|
|
|
5742
5753
|
// src/components/trackContext.ts
|
|
@@ -5788,7 +5799,7 @@ function createDragPopoverHealer(element) {
|
|
|
5788
5799
|
}
|
|
5789
5800
|
|
|
5790
5801
|
// src/hooks/useTrackReorderHandle.ts
|
|
5791
|
-
var MOVE_FEEDBACK = import_dom2.Feedback.configure({ feedback: "move" });
|
|
5802
|
+
var MOVE_FEEDBACK = import_dom2.Feedback.configure({ feedback: "move", dropAnimation: null });
|
|
5792
5803
|
var withMoveFeedback = (defaults) => [...defaults, MOVE_FEEDBACK];
|
|
5793
5804
|
function useTrackReorderHandle() {
|
|
5794
5805
|
const { id, index } = useTrack();
|
|
@@ -5815,10 +5826,9 @@ function useTrackReorderHandle() {
|
|
|
5815
5826
|
// `placeholder.replaceWith(element)` on drop) — confirmed via
|
|
5816
5827
|
// MutationObserver instrumentation to relocate the React-owned row 6
|
|
5817
5828
|
// times during a single one-slot drag, leaving its final parent/sibling
|
|
5818
|
-
// different from what React's fiber tree still believes.
|
|
5819
|
-
//
|
|
5820
|
-
//
|
|
5821
|
-
// for these rows. The placeholder splice is created only when
|
|
5829
|
+
// different from what React's fiber tree still believes. (Measured when
|
|
5830
|
+
// the registered element was one level inside the keyed slot, before
|
|
5831
|
+
// #796; not re-run with the slot itself.) The placeholder splice is created only when
|
|
5822
5832
|
// `feedback !== 'move'` (@dnd-kit/dom Feedback.ts) — 'move' keeps the
|
|
5823
5833
|
// dragged element in the live DOM (no clone/placeholder) while still
|
|
5824
5834
|
// running the *unconditional* `dragOperation.shape = ...` assignment.
|
|
@@ -5830,7 +5840,10 @@ function useTrackReorderHandle() {
|
|
|
5830
5840
|
// drag-based reordering silently never commits. Boundary trims don't hit
|
|
5831
5841
|
// this because they're plain useDraggable (no collision-based commit) —
|
|
5832
5842
|
// sortables need shape. `isDragSource` is a reactive signal, unaffected
|
|
5833
|
-
// either way.
|
|
5843
|
+
// either way. OptimisticSortingPlugin still moves the element during the
|
|
5844
|
+
// drag (`insertAdjacentElement` next to the item it is dragged over);
|
|
5845
|
+
// that is safe only because the element is the keyed slot (#796, below).
|
|
5846
|
+
// See browser/notes/track-controls-and-reorder.md "Track Reordering".
|
|
5834
5847
|
plugins: withMoveFeedback
|
|
5835
5848
|
});
|
|
5836
5849
|
(0, import_react50.useEffect)(() => {
|
|
@@ -5879,13 +5892,13 @@ var TrackName = () => {
|
|
|
5879
5892
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "data-track-name": "", style: NAME_STYLE, children: name });
|
|
5880
5893
|
};
|
|
5881
5894
|
var TrackMuteButton = () => {
|
|
5882
|
-
const { muted, setMuted,
|
|
5895
|
+
const { muted, setMuted, isRecording } = useTrack();
|
|
5883
5896
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5884
5897
|
import_ui_components8.Button,
|
|
5885
5898
|
{
|
|
5886
5899
|
$variant: muted ? "danger" : "outline",
|
|
5887
5900
|
"aria-pressed": muted,
|
|
5888
|
-
disabled:
|
|
5901
|
+
disabled: isRecording,
|
|
5889
5902
|
onClick: () => setMuted(!muted),
|
|
5890
5903
|
children: "Mute"
|
|
5891
5904
|
}
|
|
@@ -5903,8 +5916,18 @@ var TrackSoloButton = () => {
|
|
|
5903
5916
|
}
|
|
5904
5917
|
);
|
|
5905
5918
|
};
|
|
5919
|
+
function useSliderGesture() {
|
|
5920
|
+
const [gesture] = (0, import_react51.useState)(import_core12.createMixerGesture);
|
|
5921
|
+
const ref = (0, import_react51.useRef)(null);
|
|
5922
|
+
(0, import_react51.useEffect)(() => {
|
|
5923
|
+
const input = ref.current;
|
|
5924
|
+
return input ? gesture.attach(input) : void 0;
|
|
5925
|
+
}, [gesture]);
|
|
5926
|
+
return { gesture, ref };
|
|
5927
|
+
}
|
|
5906
5928
|
var TrackVolumeSlider = () => {
|
|
5907
5929
|
const { volume, setVolume } = useTrack();
|
|
5930
|
+
const { gesture, ref } = useSliderGesture();
|
|
5908
5931
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
5909
5932
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components8.VolumeDownIcon, {}),
|
|
5910
5933
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5913,9 +5936,10 @@ var TrackVolumeSlider = () => {
|
|
|
5913
5936
|
min: "0",
|
|
5914
5937
|
max: "1",
|
|
5915
5938
|
step: "0.01",
|
|
5939
|
+
ref,
|
|
5916
5940
|
value: volume,
|
|
5917
5941
|
"aria-label": "Volume",
|
|
5918
|
-
onChange: (e) => setVolume(parseFloat(e.target.value))
|
|
5942
|
+
onChange: (e) => setVolume(parseFloat(e.target.value), { gesture: gesture.id })
|
|
5919
5943
|
}
|
|
5920
5944
|
),
|
|
5921
5945
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components8.VolumeUpIcon, {})
|
|
@@ -5923,6 +5947,7 @@ var TrackVolumeSlider = () => {
|
|
|
5923
5947
|
};
|
|
5924
5948
|
var TrackPanSlider = () => {
|
|
5925
5949
|
const { pan, setPan } = useTrack();
|
|
5950
|
+
const { gesture, ref } = useSliderGesture();
|
|
5926
5951
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
5927
5952
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "L" }),
|
|
5928
5953
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5931,9 +5956,10 @@ var TrackPanSlider = () => {
|
|
|
5931
5956
|
min: "-1",
|
|
5932
5957
|
max: "1",
|
|
5933
5958
|
step: "0.01",
|
|
5959
|
+
ref,
|
|
5934
5960
|
value: pan,
|
|
5935
5961
|
"aria-label": "Pan",
|
|
5936
|
-
onChange: (e) => setPan(parseFloat(e.target.value))
|
|
5962
|
+
onChange: (e) => setPan(parseFloat(e.target.value), { gesture: gesture.id })
|
|
5937
5963
|
}
|
|
5938
5964
|
),
|
|
5939
5965
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "R" })
|
|
@@ -6065,7 +6091,6 @@ function useStableTemplate(template) {
|
|
|
6065
6091
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6066
6092
|
var DEFAULT_TRACK_CONTROLS_WIDTH = 200;
|
|
6067
6093
|
var DEFAULT_TEMPLATE = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DefaultTrackControls, {});
|
|
6068
|
-
var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
|
|
6069
6094
|
var SLOT_BODY_STYLE = { height: "100%" };
|
|
6070
6095
|
function TrackControlsSlotImpl({
|
|
6071
6096
|
trackId,
|
|
@@ -6081,7 +6106,7 @@ function TrackControlsSlotImpl({
|
|
|
6081
6106
|
isLast,
|
|
6082
6107
|
renderMode,
|
|
6083
6108
|
hasSpectrogram,
|
|
6084
|
-
|
|
6109
|
+
isRecording,
|
|
6085
6110
|
height,
|
|
6086
6111
|
top,
|
|
6087
6112
|
animate,
|
|
@@ -6095,16 +6120,15 @@ function TrackControlsSlotImpl({
|
|
|
6095
6120
|
reorderTrack,
|
|
6096
6121
|
setSelectedTrackId
|
|
6097
6122
|
} = useEditorControls();
|
|
6098
|
-
const theme = (0, import_ui_components10.useTheme)();
|
|
6099
6123
|
const shared = (0, import_react54.use)(TrackControlsSharedContext);
|
|
6100
6124
|
const indexRef = (0, import_react54.useRef)(index);
|
|
6101
6125
|
indexRef.current = index;
|
|
6102
6126
|
const actions = (0, import_react54.useMemo)(
|
|
6103
6127
|
() => ({
|
|
6104
|
-
setMuted: (value2) => setTrackMute(trackId, value2),
|
|
6105
|
-
setSoloed: (value2) => setTrackSolo(trackId, value2),
|
|
6106
|
-
setVolume: (value2) => setTrackVolume(trackId, value2),
|
|
6107
|
-
setPan: (value2) => setTrackPan(trackId, value2),
|
|
6128
|
+
setMuted: (value2, options) => setTrackMute(trackId, value2, options),
|
|
6129
|
+
setSoloed: (value2, options) => setTrackSolo(trackId, value2, options),
|
|
6130
|
+
setVolume: (value2, options) => setTrackVolume(trackId, value2, options),
|
|
6131
|
+
setPan: (value2, options) => setTrackPan(trackId, value2, options),
|
|
6108
6132
|
select: () => setSelectedTrackId(trackId),
|
|
6109
6133
|
// The engine clamps the target and ignores a move to the same place.
|
|
6110
6134
|
moveUp: () => reorderTrack(trackId, indexRef.current - 1),
|
|
@@ -6138,7 +6162,7 @@ function TrackControlsSlotImpl({
|
|
|
6138
6162
|
isFirst,
|
|
6139
6163
|
isLast,
|
|
6140
6164
|
hasSpectrogram,
|
|
6141
|
-
|
|
6165
|
+
isRecording
|
|
6142
6166
|
}, actions),
|
|
6143
6167
|
[
|
|
6144
6168
|
trackId,
|
|
@@ -6154,7 +6178,7 @@ function TrackControlsSlotImpl({
|
|
|
6154
6178
|
isFirst,
|
|
6155
6179
|
isLast,
|
|
6156
6180
|
hasSpectrogram,
|
|
6157
|
-
|
|
6181
|
+
isRecording,
|
|
6158
6182
|
actions
|
|
6159
6183
|
]
|
|
6160
6184
|
);
|
|
@@ -6167,27 +6191,14 @@ function TrackControlsSlotImpl({
|
|
|
6167
6191
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6168
6192
|
ControlSlot,
|
|
6169
6193
|
{
|
|
6194
|
+
ref: elementRef,
|
|
6170
6195
|
$height: height,
|
|
6171
6196
|
$top: top,
|
|
6172
6197
|
$animate: animate,
|
|
6173
6198
|
$isSelected: isSelected,
|
|
6199
|
+
$isDragSource: isDragSource,
|
|
6174
6200
|
onClick: actions.select,
|
|
6175
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6176
|
-
"div",
|
|
6177
|
-
{
|
|
6178
|
-
ref: elementRef,
|
|
6179
|
-
"data-track-controls": trackId,
|
|
6180
|
-
style: isDragSource ? __spreadProps(__spreadValues({}, SLOT_BODY_STYLE), {
|
|
6181
|
-
boxShadow: DRAG_SOURCE_SHADOW,
|
|
6182
|
-
// Opaque background for the floating (top-layer, popover-based)
|
|
6183
|
-
// drag-source row — without it the row underneath shows through.
|
|
6184
|
-
// onDragStart selects the dragged track, so its slot always shows
|
|
6185
|
-
// the selected-track background while lifted.
|
|
6186
|
-
background: theme.selectedTrackControlsBackground
|
|
6187
|
-
}) : SLOT_BODY_STYLE,
|
|
6188
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TrackSlotWiringContext, { value: wiring, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TrackContext, { value, children: template }) })
|
|
6189
|
-
}
|
|
6190
|
-
)
|
|
6201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { "data-track-controls": trackId, style: SLOT_BODY_STYLE, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TrackSlotWiringContext, { value: wiring, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TrackContext, { value, children: template }) }) })
|
|
6191
6202
|
}
|
|
6192
6203
|
);
|
|
6193
6204
|
}
|
|
@@ -6199,6 +6210,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6199
6210
|
trackLayout,
|
|
6200
6211
|
trackHeightById,
|
|
6201
6212
|
animateTrackLayout,
|
|
6213
|
+
dragSourceTrackId,
|
|
6202
6214
|
setSettingsModalTrackId
|
|
6203
6215
|
} = useWaveformRows("The track controls");
|
|
6204
6216
|
if ((0, import_react54.use)(WaveformPartPlaceContext) !== "controls") {
|
|
@@ -6207,8 +6219,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6207
6219
|
);
|
|
6208
6220
|
}
|
|
6209
6221
|
const { selectedTrackId } = useSelectedTrackId();
|
|
6210
|
-
const {
|
|
6211
|
-
const { trackReorderEpoch } = useTrackReorderPreview();
|
|
6222
|
+
const { recordingTrackId } = useRecordingTrack();
|
|
6212
6223
|
const spectrogram = (0, import_react54.use)(SpectrogramIntegrationContext);
|
|
6213
6224
|
const { trackStates } = usePlaylistMixer();
|
|
6214
6225
|
const template = useStableTemplate(children != null ? children : DEFAULT_TEMPLATE);
|
|
@@ -6235,36 +6246,29 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6235
6246
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TrackControlsSharedContext, { value: shared, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TracksLayout, { $height: trackLayout.totalHeight, children: tracks.map((track, trackIndex) => {
|
|
6236
6247
|
var _a, _b, _c;
|
|
6237
6248
|
const state = trackStates[trackIndex];
|
|
6238
|
-
return (
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6262
|
-
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6263
|
-
animate: animateTrackLayout,
|
|
6264
|
-
template
|
|
6265
|
-
},
|
|
6266
|
-
`${track.id}-${trackReorderEpoch}`
|
|
6267
|
-
)
|
|
6249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6250
|
+
TrackControlsSlot,
|
|
6251
|
+
{
|
|
6252
|
+
trackId: track.id,
|
|
6253
|
+
index: trackIndex,
|
|
6254
|
+
kind: track.kind,
|
|
6255
|
+
name: state.name,
|
|
6256
|
+
muted: state.muted,
|
|
6257
|
+
soloed: state.soloed,
|
|
6258
|
+
volume: state.volume,
|
|
6259
|
+
pan: state.pan,
|
|
6260
|
+
isSelected: track.id === selectedTrackId,
|
|
6261
|
+
isFirst: trackIndex === 0,
|
|
6262
|
+
isLast: trackIndex === tracks.length - 1,
|
|
6263
|
+
renderMode: (_a = renderModeById.get(track.id)) != null ? _a : "waveform",
|
|
6264
|
+
hasSpectrogram: spectrogram !== null && track.kind !== "midi",
|
|
6265
|
+
isRecording: track.id === recordingTrackId,
|
|
6266
|
+
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6267
|
+
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6268
|
+
animate: animateTrackLayout && dragSourceTrackId !== null,
|
|
6269
|
+
template
|
|
6270
|
+
},
|
|
6271
|
+
track.id
|
|
6268
6272
|
);
|
|
6269
6273
|
}) }) });
|
|
6270
6274
|
}
|
|
@@ -6272,12 +6276,12 @@ var WaveformTrackControls = import_react54.default.memo(WaveformTrackControlsImp
|
|
|
6272
6276
|
|
|
6273
6277
|
// src/components/VisualizationOverlays.tsx
|
|
6274
6278
|
var import_react56 = __toESM(require("react"));
|
|
6275
|
-
var
|
|
6279
|
+
var import_ui_components11 = require("@waveform-playlist/ui-components");
|
|
6276
6280
|
|
|
6277
6281
|
// src/components/AnimatedPlayhead.tsx
|
|
6278
6282
|
var import_react55 = require("react");
|
|
6279
6283
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
6280
|
-
var
|
|
6284
|
+
var import_ui_components10 = require("@waveform-playlist/ui-components");
|
|
6281
6285
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6282
6286
|
var PlayheadLine = import_styled_components7.default.div.attrs((props) => ({
|
|
6283
6287
|
style: {
|
|
@@ -6300,7 +6304,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6300
6304
|
const { isPlaying } = useIsPlaying();
|
|
6301
6305
|
useCurrentTime();
|
|
6302
6306
|
const { sampleRate } = usePlaylistView();
|
|
6303
|
-
const { progressBarWidth } = (0,
|
|
6307
|
+
const { progressBarWidth } = (0, import_ui_components10.usePlaylistInfo)();
|
|
6304
6308
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6305
6309
|
(0, import_react55.useEffect)(() => {
|
|
6306
6310
|
if (isPlaying) {
|
|
@@ -6333,7 +6337,7 @@ var subscribeToNothing3 = () => () => {
|
|
|
6333
6337
|
};
|
|
6334
6338
|
var noPreview = () => null;
|
|
6335
6339
|
var WaveformSelection = import_react56.default.memo(function WaveformSelection2() {
|
|
6336
|
-
const theme = (0,
|
|
6340
|
+
const theme = (0, import_ui_components11.useTheme)();
|
|
6337
6341
|
const { selectionStart, selectionEnd } = useSelection();
|
|
6338
6342
|
const { sampleRate } = usePlaylistView();
|
|
6339
6343
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
@@ -6347,7 +6351,7 @@ var WaveformSelection = import_react56.default.memo(function WaveformSelection2(
|
|
|
6347
6351
|
const end = preview ? preview.end : Math.max(selectionStart, selectionEnd);
|
|
6348
6352
|
if (start === end) return null;
|
|
6349
6353
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6350
|
-
|
|
6354
|
+
import_ui_components11.Selection,
|
|
6351
6355
|
{
|
|
6352
6356
|
startPosition: start * sampleRate / samplesPerPixel,
|
|
6353
6357
|
endPosition: end * sampleRate / samplesPerPixel,
|
|
@@ -6372,7 +6376,7 @@ var CustomPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) =>
|
|
|
6372
6376
|
});
|
|
6373
6377
|
};
|
|
6374
6378
|
var WaveformPlayhead = ({ renderPlayhead }) => {
|
|
6375
|
-
const theme = (0,
|
|
6379
|
+
const theme = (0, import_ui_components11.useTheme)();
|
|
6376
6380
|
const { isPlaying } = useIsPlaying();
|
|
6377
6381
|
const { selectionStart, selectionEnd } = useSelection();
|
|
6378
6382
|
const { sampleRate } = usePlaylistView();
|
|
@@ -6395,14 +6399,14 @@ var WaveformLoopRegion = import_react56.default.memo(function WaveformLoopRegion
|
|
|
6395
6399
|
"<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."
|
|
6396
6400
|
);
|
|
6397
6401
|
}
|
|
6398
|
-
const theme = (0,
|
|
6402
|
+
const theme = (0, import_ui_components11.useTheme)();
|
|
6399
6403
|
const { isLoopEnabled, loopStart, loopEnd } = useLoop();
|
|
6400
6404
|
const { setLoopRegion } = useEditorControls();
|
|
6401
6405
|
const { sampleRate } = usePlaylistView();
|
|
6402
6406
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6403
6407
|
if (!isLoopEnabled) return null;
|
|
6404
6408
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6405
|
-
|
|
6409
|
+
import_ui_components11.TimescaleLoopRegion,
|
|
6406
6410
|
{
|
|
6407
6411
|
startPosition: Math.min(loopStart, loopEnd) * sampleRate / samplesPerPixel,
|
|
6408
6412
|
endPosition: Math.max(loopStart, loopEnd) * sampleRate / samplesPerPixel,
|
|
@@ -6421,7 +6425,7 @@ var WaveformLoopRegion = import_react56.default.memo(function WaveformLoopRegion
|
|
|
6421
6425
|
|
|
6422
6426
|
// src/components/WaveformViewOptions.tsx
|
|
6423
6427
|
var import_react57 = require("react");
|
|
6424
|
-
var
|
|
6428
|
+
var import_ui_components12 = require("@waveform-playlist/ui-components");
|
|
6425
6429
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6426
6430
|
var NO_OPTIONS = {};
|
|
6427
6431
|
var WaveformViewOptionsContext = (0, import_react57.createContext)(NO_OPTIONS);
|
|
@@ -6451,28 +6455,28 @@ var isPositive = (value) => value > 0;
|
|
|
6451
6455
|
function useResolvedViewOptions() {
|
|
6452
6456
|
var _a, _b, _c, _d, _e, _f;
|
|
6453
6457
|
const options = (0, import_react57.use)(WaveformViewOptionsContext);
|
|
6454
|
-
let waveHeight = (_a = options.waveHeight) != null ? _a :
|
|
6455
|
-
let barWidth = (_b = options.barWidth) != null ? _b :
|
|
6456
|
-
let barGap = (_c = options.barGap) != null ? _c :
|
|
6458
|
+
let waveHeight = (_a = options.waveHeight) != null ? _a : import_ui_components12.DEFAULT_WAVE_HEIGHT;
|
|
6459
|
+
let barWidth = (_b = options.barWidth) != null ? _b : import_ui_components12.DEFAULT_BAR_WIDTH;
|
|
6460
|
+
let barGap = (_c = options.barGap) != null ? _c : import_ui_components12.DEFAULT_BAR_GAP;
|
|
6457
6461
|
const roundedBars = (_d = options.roundedBars) != null ? _d : false;
|
|
6458
6462
|
const fillViewport = (_e = options.fillViewport) != null ? _e : false;
|
|
6459
6463
|
if (!isPositive(waveHeight)) {
|
|
6460
6464
|
warnOnce(
|
|
6461
|
-
`<WaveformViewOptions waveHeight> must be a positive number of pixels: ${String(waveHeight)} is replaced by ${
|
|
6465
|
+
`<WaveformViewOptions waveHeight> must be a positive number of pixels: ${String(waveHeight)} is replaced by ${import_ui_components12.DEFAULT_WAVE_HEIGHT}.`
|
|
6462
6466
|
);
|
|
6463
|
-
waveHeight =
|
|
6467
|
+
waveHeight = import_ui_components12.DEFAULT_WAVE_HEIGHT;
|
|
6464
6468
|
}
|
|
6465
6469
|
if (!isPositive(barWidth)) {
|
|
6466
6470
|
warnOnce(
|
|
6467
|
-
`<WaveformViewOptions barWidth> must be a positive number of pixels: ${String(barWidth)} is replaced by ${
|
|
6471
|
+
`<WaveformViewOptions barWidth> must be a positive number of pixels: ${String(barWidth)} is replaced by ${import_ui_components12.DEFAULT_BAR_WIDTH}.`
|
|
6468
6472
|
);
|
|
6469
|
-
barWidth =
|
|
6473
|
+
barWidth = import_ui_components12.DEFAULT_BAR_WIDTH;
|
|
6470
6474
|
}
|
|
6471
6475
|
if (Number.isNaN(barGap)) {
|
|
6472
6476
|
warnOnce(
|
|
6473
|
-
`<WaveformViewOptions barGap> must be a number of pixels: ${String(barGap)} is replaced by ${
|
|
6477
|
+
`<WaveformViewOptions barGap> must be a number of pixels: ${String(barGap)} is replaced by ${import_ui_components12.DEFAULT_BAR_GAP}.`
|
|
6474
6478
|
);
|
|
6475
|
-
barGap =
|
|
6479
|
+
barGap = import_ui_components12.DEFAULT_BAR_GAP;
|
|
6476
6480
|
}
|
|
6477
6481
|
if (!(barWidth + barGap >= 1)) {
|
|
6478
6482
|
const raised = 1 - barWidth;
|
|
@@ -6503,7 +6507,7 @@ var WaveformTimescale = import_react58.default.memo(function WaveformTimescale2(
|
|
|
6503
6507
|
"<WaveformTimescale> 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."
|
|
6504
6508
|
);
|
|
6505
6509
|
}
|
|
6506
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui_components13.SmartScale, { durationMs: displayDuration * 1e3, renderTick });
|
|
6507
6511
|
});
|
|
6508
6512
|
var TIMESCALE_PARTS = /* @__PURE__ */ new Set([WaveformTimescale, WaveformLoopRegion]);
|
|
6509
6513
|
var CONTROLS_PARTS = /* @__PURE__ */ new Set([WaveformTrackControls]);
|
|
@@ -6625,7 +6629,7 @@ function useWaveformFrame({
|
|
|
6625
6629
|
onClickWhileStopped
|
|
6626
6630
|
}) {
|
|
6627
6631
|
var _a;
|
|
6628
|
-
const theme = (0,
|
|
6632
|
+
const theme = (0, import_ui_components14.useTheme)();
|
|
6629
6633
|
const { setScrollContainer } = usePlaybackControls();
|
|
6630
6634
|
const { sampleRate } = usePlaylistView();
|
|
6631
6635
|
const { waveHeight, barWidth, barGap, roundedBars, progressBarWidth } = viewOptions;
|
|
@@ -6673,16 +6677,16 @@ function useWaveformFrame({
|
|
|
6673
6677
|
);
|
|
6674
6678
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
6675
6679
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AutomaticScrollFlag, { flagRef: automaticScrollRef }),
|
|
6676
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6680
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui_components14.PlaylistInfoContext, { value: playlistInfo, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WaveformExtentContext, { value: extent, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(WaveformRowsContext, { value: rows, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6677
6681
|
RootSeesRecordingPreviewContext,
|
|
6678
6682
|
{
|
|
6679
6683
|
value: parts.tracksOptions.recordingState !== void 0,
|
|
6680
6684
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectionPreviewContext, { value: selectionPreview, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6681
|
-
|
|
6685
|
+
import_ui_components14.Playlist,
|
|
6682
6686
|
{
|
|
6683
6687
|
className,
|
|
6684
6688
|
theme,
|
|
6685
|
-
backgroundColor: theme.playlistBackgroundColor || (0,
|
|
6689
|
+
backgroundColor: theme.playlistBackgroundColor || (0, import_ui_components14.waveformColorToCss)(theme.waveOutlineColor),
|
|
6686
6690
|
timescaleBackgroundColor: theme.timescaleBackgroundColor,
|
|
6687
6691
|
timescaleWidth: tracksFullWidth,
|
|
6688
6692
|
tracksWidth: tracksFullWidth,
|
|
@@ -6806,7 +6810,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6806
6810
|
trackClipPeaks,
|
|
6807
6811
|
track.id === recordingTrackId ? recordingChannelCount : 0
|
|
6808
6812
|
);
|
|
6809
|
-
m.set(track.id, waveHeight * maxChannels + (showClipHeaders ?
|
|
6813
|
+
m.set(track.id, waveHeight * maxChannels + (showClipHeaders ? import_ui_components15.CLIP_HEADER_HEIGHT : 0));
|
|
6810
6814
|
});
|
|
6811
6815
|
return m;
|
|
6812
6816
|
}, [
|
|
@@ -6882,7 +6886,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6882
6886
|
},
|
|
6883
6887
|
onClickWhileStopped: setCurrentTime
|
|
6884
6888
|
});
|
|
6885
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_ui_components15.DevicePixelRatioProvider, { children: [
|
|
6886
6890
|
frame,
|
|
6887
6891
|
(spectrogram == null ? void 0 : spectrogram.SettingsModal) && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
|
|
6888
6892
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -6908,7 +6912,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6908
6912
|
var import_react63 = __toESM(require("react"));
|
|
6909
6913
|
var import_react64 = require("@dnd-kit/react");
|
|
6910
6914
|
var import_modifiers2 = require("@dnd-kit/abstract/modifiers");
|
|
6911
|
-
var
|
|
6915
|
+
var import_ui_components16 = require("@waveform-playlist/ui-components");
|
|
6912
6916
|
|
|
6913
6917
|
// src/AnnotationIntegrationContext.tsx
|
|
6914
6918
|
var import_react61 = require("react");
|
|
@@ -7004,7 +7008,7 @@ var WaveformAnnotationBoxes = import_react63.default.memo(function WaveformAnnot
|
|
|
7004
7008
|
const { sampleRate } = usePlaylistView();
|
|
7005
7009
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
7006
7010
|
const { touchOptimized } = useClipInteraction();
|
|
7007
|
-
const theme = (0,
|
|
7011
|
+
const theme = (0, import_ui_components16.useTheme)();
|
|
7008
7012
|
const shownAnnotations = useAnnotationsWithPreview(annotations, annotationPreview);
|
|
7009
7013
|
const sensors = useDragSensors({ touchOptimized });
|
|
7010
7014
|
const { onDragStart, onDragMove, onDragEnd } = useAnnotationDragHandlers({
|
|
@@ -7124,7 +7128,7 @@ var WaveformEditor = (props) => composeWaveform(__spreadProps(__spreadValues({},
|
|
|
7124
7128
|
|
|
7125
7129
|
// src/components/MediaElementWaveformRoot.tsx
|
|
7126
7130
|
var import_react66 = require("react");
|
|
7127
|
-
var
|
|
7131
|
+
var import_ui_components17 = require("@waveform-playlist/ui-components");
|
|
7128
7132
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7129
7133
|
var ONE_ROW = [{ id: MEDIA_ELEMENT_TRACK_ID, kind: "audio" }];
|
|
7130
7134
|
var ONE_EMPTY_ROW = [[]];
|
|
@@ -7155,7 +7159,7 @@ var MediaElementWaveformRoot = ({
|
|
|
7155
7159
|
const channels = getTrackChannelCount(rowPeaks[index], 0);
|
|
7156
7160
|
trackHeightById.set(
|
|
7157
7161
|
row.id,
|
|
7158
|
-
waveHeight * channels + (showClipHeaders ?
|
|
7162
|
+
waveHeight * channels + (showClipHeaders ? import_ui_components17.CLIP_HEADER_HEIGHT : 0)
|
|
7159
7163
|
);
|
|
7160
7164
|
});
|
|
7161
7165
|
return {
|
|
@@ -7192,7 +7196,7 @@ var MediaElementWaveformRoot = ({
|
|
|
7192
7196
|
controlsWidth: 0,
|
|
7193
7197
|
onClickWhileStopped: collapseSelectionAt
|
|
7194
7198
|
});
|
|
7195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui_components17.DevicePixelRatioProvider, { children: frame });
|
|
7196
7200
|
};
|
|
7197
7201
|
|
|
7198
7202
|
// src/components/MediaElementWaveform.tsx
|
|
@@ -7271,12 +7275,12 @@ var KeyboardShortcuts = ({
|
|
|
7271
7275
|
var import_react67 = require("react");
|
|
7272
7276
|
function useRecordingSession({ isRecording, trackId }) {
|
|
7273
7277
|
const { setRecordingActive } = useEditorControls();
|
|
7274
|
-
const
|
|
7278
|
+
const recordingTrackId = trackId != null ? trackId : null;
|
|
7275
7279
|
(0, import_react67.useEffect)(() => {
|
|
7276
7280
|
if (!isRecording) return void 0;
|
|
7277
|
-
setRecordingActive(true,
|
|
7281
|
+
setRecordingActive(true, recordingTrackId);
|
|
7278
7282
|
return () => setRecordingActive(false);
|
|
7279
|
-
}, [isRecording,
|
|
7283
|
+
}, [isRecording, recordingTrackId, setRecordingActive]);
|
|
7280
7284
|
}
|
|
7281
7285
|
|
|
7282
7286
|
// src/components/ClipInteractionProvider.tsx
|
|
@@ -7285,7 +7289,7 @@ var import_react_dom3 = require("react-dom");
|
|
|
7285
7289
|
var import_react69 = require("@dnd-kit/react");
|
|
7286
7290
|
var import_modifiers3 = require("@dnd-kit/abstract/modifiers");
|
|
7287
7291
|
var import_core15 = require("@waveform-playlist/core");
|
|
7288
|
-
var
|
|
7292
|
+
var import_ui_components18 = require("@waveform-playlist/ui-components");
|
|
7289
7293
|
|
|
7290
7294
|
// src/modifiers/ClipCollisionModifier.ts
|
|
7291
7295
|
var import_abstract = require("@dnd-kit/abstract");
|
|
@@ -7365,8 +7369,8 @@ var ClipInteractionProvider = ({
|
|
|
7365
7369
|
const { sampleRate } = usePlaylistView();
|
|
7366
7370
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
7367
7371
|
const { tracks } = usePlaylistTimeline();
|
|
7368
|
-
const { setSelectedTrackId, reorderTrack,
|
|
7369
|
-
const beatsAndBars = (0,
|
|
7372
|
+
const { setSelectedTrackId, reorderTrack, setTrackDragPreview } = useEditorControls();
|
|
7373
|
+
const beatsAndBars = (0, import_ui_components18.useBeatsAndBars)();
|
|
7370
7374
|
const useBeatsSnap = snap && beatsAndBars != null && beatsAndBars.scaleMode === "beats" && beatsAndBars.snapTo !== "off";
|
|
7371
7375
|
const useTimescaleSnap = snap && !useBeatsSnap;
|
|
7372
7376
|
const snapSamplePosition = (0, import_react68.useMemo)(() => {
|
|
@@ -7380,7 +7384,7 @@ var ClipInteractionProvider = ({
|
|
|
7380
7384
|
};
|
|
7381
7385
|
}
|
|
7382
7386
|
if (useTimescaleSnap) {
|
|
7383
|
-
const gridSamples = Math.round((0,
|
|
7387
|
+
const gridSamples = Math.round((0, import_ui_components18.getScaleInfo)(samplesPerPixel).smallStep / 1e3 * sampleRate);
|
|
7384
7388
|
return (samplePos) => Math.round(samplePos / gridSamples) * gridSamples;
|
|
7385
7389
|
}
|
|
7386
7390
|
return void 0;
|
|
@@ -7394,13 +7398,11 @@ var ClipInteractionProvider = ({
|
|
|
7394
7398
|
onDragMove,
|
|
7395
7399
|
onDragEnd
|
|
7396
7400
|
} = useClipDragHandlers({ samplesPerPixel, snapSamplePosition });
|
|
7397
|
-
const trackReorderDragActiveRef = import_react68.default.useRef(false);
|
|
7398
7401
|
const onDragStart = import_react68.default.useCallback(
|
|
7399
7402
|
(event) => {
|
|
7400
7403
|
var _a, _b;
|
|
7401
7404
|
const data = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data;
|
|
7402
7405
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7403
|
-
trackReorderDragActiveRef.current = true;
|
|
7404
7406
|
if (data.trackId) setSelectedTrackId(data.trackId);
|
|
7405
7407
|
return;
|
|
7406
7408
|
}
|
|
@@ -7418,7 +7420,6 @@ var ClipInteractionProvider = ({
|
|
|
7418
7420
|
var _a;
|
|
7419
7421
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7420
7422
|
if ((data == null ? void 0 : data.kind) !== "track-reorder" || !data.trackId) return;
|
|
7421
|
-
if (!trackReorderDragActiveRef.current) return;
|
|
7422
7423
|
const sortable = event.operation.source.sortable;
|
|
7423
7424
|
if (!sortable) return;
|
|
7424
7425
|
const trackId = data.trackId;
|
|
@@ -7434,12 +7435,10 @@ var ClipInteractionProvider = ({
|
|
|
7434
7435
|
var _a;
|
|
7435
7436
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7436
7437
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7437
|
-
trackReorderDragActiveRef.current = false;
|
|
7438
7438
|
const sortable = event.operation.source.sortable;
|
|
7439
7439
|
const trackId = data.trackId;
|
|
7440
7440
|
const moves = !event.canceled && trackId && sortable && sortable.index !== sortable.initialIndex;
|
|
7441
7441
|
(0, import_react_dom3.flushSync)(() => {
|
|
7442
|
-
bumpTrackReorderEpoch();
|
|
7443
7442
|
setTrackDragPreview(null);
|
|
7444
7443
|
if (moves) reorderTrack(trackId, sortable.index);
|
|
7445
7444
|
});
|
|
@@ -7447,7 +7446,7 @@ var ClipInteractionProvider = ({
|
|
|
7447
7446
|
}
|
|
7448
7447
|
onDragEnd(event);
|
|
7449
7448
|
},
|
|
7450
|
-
[onDragEnd, reorderTrack,
|
|
7449
|
+
[onDragEnd, reorderTrack, setTrackDragPreview]
|
|
7451
7450
|
);
|
|
7452
7451
|
const modifiers = (0, import_react68.useMemo)(() => {
|
|
7453
7452
|
const mods = [import_modifiers3.RestrictToHorizontalAxis];
|
|
@@ -7466,7 +7465,7 @@ var ClipInteractionProvider = ({
|
|
|
7466
7465
|
mods.push(
|
|
7467
7466
|
SnapToGridModifier.configure({
|
|
7468
7467
|
mode: "timescale",
|
|
7469
|
-
gridSamples: Math.round((0,
|
|
7468
|
+
gridSamples: Math.round((0, import_ui_components18.getScaleInfo)(samplesPerPixel).smallStep / 1e3 * sampleRate),
|
|
7470
7469
|
samplesPerPixel
|
|
7471
7470
|
})
|
|
7472
7471
|
);
|