@waveform-playlist/browser 17.0.0-next.7 → 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/dist/index.mjs CHANGED
@@ -51,11 +51,11 @@ var __async = (__this, __arguments, generator) => {
51
51
  };
52
52
 
53
53
  // <define:__INSTALL_SPECS__>
54
- var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@dnd-kit/abstract": "@dnd-kit/abstract@^0.5.0", "@dnd-kit/dom": "@dnd-kit/dom@^0.5.0", "@dnd-kit/react": "@dnd-kit/react@^0.5.0", "@waveform-playlist/annotations": "@waveform-playlist/annotations@^14.0.0-next.4", "@waveform-playlist/media-element-playout": "@waveform-playlist/media-element-playout@^12.4.0-next.2", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.2", "@waveform-playlist/recording": "@waveform-playlist/recording@^14.0.0-next.4", 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.2" };
54
+ var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@dnd-kit/abstract": "@dnd-kit/abstract@^0.5.0", "@dnd-kit/dom": "@dnd-kit/dom@^0.5.0", "@dnd-kit/react": "@dnd-kit/react@^0.5.0", "@waveform-playlist/annotations": "@waveform-playlist/annotations@^14.0.0-next.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" };
55
55
 
56
56
  // src/WaveformPlaylistContext.tsx
57
57
  import {
58
- useState as useState16,
58
+ useState as useState15,
59
59
  useEffect as useEffect8,
60
60
  useLayoutEffect as useLayoutEffect5,
61
61
  useRef as useRef21,
@@ -418,7 +418,7 @@ var PlaylistMixerContext = slot();
418
418
  var TrackReorderPreviewContext = slot();
419
419
  var TrimPreviewContext = slot();
420
420
  var TrimPreviewPeaksContext = slot();
421
- var RecordingArmContext = slot();
421
+ var RecordingTrackContext = slot();
422
422
  var PlaybackRateContext = slot();
423
423
  var MediaElementTrackContext = slot();
424
424
  function useSlot(context, hookName, needs) {
@@ -456,7 +456,7 @@ var useUndoRedo = () => useSlot(UndoRedoContext, "useUndoRedo", WEB_AUDIO);
456
456
  var usePlaylistTimeline = () => useSlot(PlaylistTimelineContext, "usePlaylistTimeline", WEB_AUDIO);
457
457
  var usePlaylistMixer = () => useSlot(PlaylistMixerContext, "usePlaylistMixer", WEB_AUDIO);
458
458
  var useTrackReorderPreview = () => useSlot(TrackReorderPreviewContext, "useTrackReorderPreview", WEB_AUDIO);
459
- var useRecordingArm = () => useSlot(RecordingArmContext, "useRecordingArm", WEB_AUDIO);
459
+ var useRecordingTrack = () => useSlot(RecordingTrackContext, "useRecordingTrack", WEB_AUDIO);
460
460
  var usePlaybackRate = () => useSlot(PlaybackRateContext, "usePlaybackRate", MEDIA_ELEMENT);
461
461
  var useMediaElementTrack = () => useSlot(MediaElementTrackContext, "useMediaElementTrack", MEDIA_ELEMENT);
462
462
  var useWebAudioProviderOnly = (hookName) => {
@@ -2710,19 +2710,20 @@ function deriveRows(tracks, inputs, previous) {
2710
2710
  });
2711
2711
  return { byTrackId, result: sameItems(previous.result, rows) ? previous.result : rows };
2712
2712
  }
2713
- function sameState(a, name, mix) {
2714
- return a.name === name && a.volume === mix.volume && a.muted === mix.muted && a.soloed === mix.soloed && a.pan === mix.pan;
2713
+ function sameState(a, name, mix, muted) {
2714
+ return a.name === name && a.volume === mix.volume && a.muted === muted && a.soloed === mix.soloed && a.pan === mix.pan;
2715
2715
  }
2716
- function deriveTrackStates(tracks, mixer, previous) {
2716
+ function deriveTrackStates(tracks, mixer, recordingTrackIds, previous) {
2717
2717
  const byTrackId = /* @__PURE__ */ new Map();
2718
2718
  const states = tracks.map((track) => {
2719
2719
  var _a;
2720
2720
  const mix = (_a = mixer.get(track.id)) != null ? _a : DEFAULT_MIX;
2721
+ const muted = mix.muted || recordingTrackIds.has(track.id);
2721
2722
  const before = previous.byTrackId.get(track.id);
2722
- const state = before && sameState(before, track.name, mix) ? before : {
2723
+ const state = before && sameState(before, track.name, mix, muted) ? before : {
2723
2724
  name: track.name,
2724
2725
  volume: mix.volume,
2725
- muted: mix.muted,
2726
+ muted,
2726
2727
  soloed: mix.soloed,
2727
2728
  pan: mix.pan
2728
2729
  };
@@ -2742,12 +2743,14 @@ function useArrangementValue(arrangement, read) {
2742
2743
  return useSyncExternalStore7(store.subscribe, store.getSnapshot, store.getSnapshot);
2743
2744
  }
2744
2745
  var readMixer = (arrangement) => arrangement.getMixer();
2746
+ var readRecordingTrackIds = (arrangement) => arrangement.recordingTrackIds;
2745
2747
  var readCanUndo = (arrangement) => arrangement.canUndo;
2746
2748
  var readCanRedo = (arrangement) => arrangement.canRedo;
2747
2749
  function useArrangementView(arrangement, options) {
2748
2750
  const { samplesPerPixel, mono, baseScale, placeholderSampleRate } = options;
2749
2751
  const arrangementTracks = useArrangementTracks(arrangement);
2750
2752
  const mixer = useArrangementValue(arrangement, readMixer);
2753
+ const recordingTrackIds = useArrangementValue(arrangement, readRecordingTrackIds);
2751
2754
  const canUndo = useArrangementValue(arrangement, readCanUndo);
2752
2755
  const canRedo = useArrangementValue(arrangement, readCanRedo);
2753
2756
  const loadedCacheRef = useRef17(EMPTY_LOADED_TRACKS);
@@ -2777,10 +2780,15 @@ function useArrangementView(arrangement, options) {
2777
2780
  const duration = useMemo9(() => timelineDuration(tracks), [tracks]);
2778
2781
  const statesCacheRef = useRef17(EMPTY_STATES);
2779
2782
  const trackStates = useMemo9(() => {
2780
- const next = deriveTrackStates(arrangementTracks, mixer, statesCacheRef.current);
2783
+ const next = deriveTrackStates(
2784
+ arrangementTracks,
2785
+ mixer,
2786
+ recordingTrackIds,
2787
+ statesCacheRef.current
2788
+ );
2781
2789
  statesCacheRef.current = next;
2782
2790
  return next.result;
2783
- }, [arrangementTracks, mixer]);
2791
+ }, [arrangementTracks, mixer, recordingTrackIds]);
2784
2792
  return {
2785
2793
  tracks,
2786
2794
  peaksDataArray,
@@ -2852,8 +2860,7 @@ function useReadyOnce(options) {
2852
2860
  }
2853
2861
 
2854
2862
  // src/providerInternals/useArrangementEditing.ts
2855
- import { useCallback as useCallback18, useEffect as useEffect6, useMemo as useMemo10, useRef as useRef19, useState as useState15, useSyncExternalStore as useSyncExternalStore8 } from "react";
2856
- import { createValueSource as createValueSource3 } from "@waveform-playlist/core";
2863
+ import { useCallback as useCallback18, useEffect as useEffect6, useMemo as useMemo10, useRef as useRef19, useSyncExternalStore as useSyncExternalStore8 } from "react";
2857
2864
 
2858
2865
  // src/components/partWarnings.ts
2859
2866
  var warned = /* @__PURE__ */ new Set();
@@ -2873,63 +2880,71 @@ function isTrackId(setter, trackId) {
2873
2880
  );
2874
2881
  return false;
2875
2882
  }
2883
+ var readRecordingTrackId = (arrangement) => {
2884
+ for (const id of arrangement.recordingTrackIds) return id;
2885
+ return null;
2886
+ };
2887
+ function clearRecordingTracks(arrangement, keep = null) {
2888
+ for (const id of [...arrangement.recordingTrackIds]) {
2889
+ if (id !== keep) arrangement.setTrackRecording(id, false);
2890
+ }
2891
+ }
2876
2892
  function useRecordingActive(arrangement) {
2877
2893
  const recordingActiveRef = useRef19(false);
2878
- const [armed] = useState15(() => createValueSource3(null));
2879
2894
  const setRecordingActive = useCallback18(
2880
- (active, armedTrackId2) => {
2881
- var _a, _b;
2895
+ (active, recordingTrackId2) => {
2882
2896
  recordingActiveRef.current = active;
2883
- const current = armed.source.getSnapshot();
2884
- if (active && armedTrackId2) {
2885
- if ((current == null ? void 0 : current.trackId) === armedTrackId2) return;
2886
- if (current) arrangement.setTrackMute(current.trackId, current.prevMuted);
2887
- const prevMuted = (_b = (_a = arrangement.getMixer().get(armedTrackId2)) == null ? void 0 : _a.muted) != null ? _b : false;
2888
- armed.publish({ trackId: armedTrackId2, prevMuted });
2889
- arrangement.setTrackMute(armedTrackId2, true);
2890
- } else if (!active && current) {
2891
- arrangement.setTrackMute(current.trackId, current.prevMuted);
2892
- armed.publish(null);
2897
+ if (active && recordingTrackId2) {
2898
+ clearRecordingTracks(arrangement, recordingTrackId2);
2899
+ arrangement.setTrackRecording(recordingTrackId2, true);
2900
+ } else if (!active) {
2901
+ clearRecordingTracks(arrangement);
2893
2902
  }
2894
2903
  },
2895
- [arrangement, armed]
2904
+ [arrangement]
2896
2905
  );
2897
2906
  useEffect6(
2898
2907
  () => () => {
2899
- if (armed.source.getSnapshot()) setRecordingActive(false);
2908
+ if (arrangement.recordingTrackIds.size > 0) setRecordingActive(false);
2900
2909
  },
2901
- [armed, setRecordingActive]
2910
+ [arrangement, setRecordingActive]
2902
2911
  );
2903
- const getArmedTrackId = useCallback18(() => {
2904
- var _a, _b;
2905
- return (_b = (_a = armed.source.getSnapshot()) == null ? void 0 : _a.trackId) != null ? _b : null;
2906
- }, [armed]);
2907
- const armedTrackId = useSyncExternalStore8(armed.source.subscribe, getArmedTrackId);
2908
- const recordingArm = useMemo10(() => ({ armedTrackId }), [armedTrackId]);
2909
- return { setRecordingActive, recordingActiveRef, recordingArm };
2912
+ const subscribe = useCallback18(
2913
+ (listener) => arrangement.subscribe(listener),
2914
+ [arrangement]
2915
+ );
2916
+ const getRecordingTrackId = useCallback18(() => readRecordingTrackId(arrangement), [arrangement]);
2917
+ const recordingTrackId = useSyncExternalStore8(
2918
+ subscribe,
2919
+ getRecordingTrackId,
2920
+ getRecordingTrackId
2921
+ );
2922
+ const recordingTrack = useMemo10(() => ({ recordingTrackId }), [recordingTrackId]);
2923
+ return { setRecordingActive, recordingActiveRef, recordingTrack };
2910
2924
  }
2911
2925
  function useArrangementEditing(arrangement) {
2912
2926
  const setTrackMute = useCallback18(
2913
- (trackId, muted) => {
2914
- if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted);
2927
+ (trackId, muted, options) => {
2928
+ if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted, options);
2915
2929
  },
2916
2930
  [arrangement]
2917
2931
  );
2918
2932
  const setTrackSolo = useCallback18(
2919
- (trackId, soloed) => {
2920
- if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed);
2933
+ (trackId, soloed, options) => {
2934
+ if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed, options);
2921
2935
  },
2922
2936
  [arrangement]
2923
2937
  );
2924
2938
  const setTrackVolume = useCallback18(
2925
- (trackId, volume) => {
2926
- if (isTrackId("setTrackVolume", trackId)) arrangement.setTrackVolume(trackId, volume);
2939
+ (trackId, volume, options) => {
2940
+ if (isTrackId("setTrackVolume", trackId))
2941
+ arrangement.setTrackVolume(trackId, volume, options);
2927
2942
  },
2928
2943
  [arrangement]
2929
2944
  );
2930
2945
  const setTrackPan = useCallback18(
2931
- (trackId, pan) => {
2932
- if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan);
2946
+ (trackId, pan, options) => {
2947
+ if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan, options);
2933
2948
  },
2934
2949
  [arrangement]
2935
2950
  );
@@ -2939,7 +2954,7 @@ function useArrangementEditing(arrangement) {
2939
2954
  );
2940
2955
  const undo = useCallback18(() => arrangement.undo(), [arrangement]);
2941
2956
  const redo = useCallback18(() => arrangement.redo(), [arrangement]);
2942
- const { setRecordingActive, recordingActiveRef, recordingArm } = useRecordingActive(arrangement);
2957
+ const { setRecordingActive, recordingActiveRef, recordingTrack } = useRecordingActive(arrangement);
2943
2958
  return {
2944
2959
  setTrackMute,
2945
2960
  setTrackSolo,
@@ -2950,7 +2965,7 @@ function useArrangementEditing(arrangement) {
2950
2965
  redo,
2951
2966
  setRecordingActive,
2952
2967
  recordingActiveRef,
2953
- recordingArm
2968
+ recordingTrack
2954
2969
  };
2955
2970
  }
2956
2971
 
@@ -3044,9 +3059,9 @@ var ProviderOnArrangement = ({
3044
3059
  setAutomaticScroll
3045
3060
  } = useScrollFollow(automaticScroll);
3046
3061
  const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
3047
- const [isPlaying, setIsPlaying] = useState16(false);
3048
- const [currentTime, setCurrentTime] = useState16(0);
3049
- const [trackDragPreview, setTrackDragPreview] = useState16(null);
3062
+ const [isPlaying, setIsPlaying] = useState15(false);
3063
+ const [currentTime, setCurrentTime] = useState15(0);
3064
+ const [trackDragPreview, setTrackDragPreview] = useState15(null);
3050
3065
  const indefinitePlaybackRef = useRef21(indefinitePlayback);
3051
3066
  indefinitePlaybackRef.current = indefinitePlayback;
3052
3067
  const isPlayingRef = useRef21(false);
@@ -3827,9 +3842,9 @@ var ProviderOnArrangement = ({
3827
3842
  {
3828
3843
  value: timelineValue,
3829
3844
  children: /* @__PURE__ */ jsx(
3830
- RecordingArmContext,
3845
+ RecordingTrackContext,
3831
3846
  {
3832
- value: editing.recordingArm,
3847
+ value: editing.recordingTrack,
3833
3848
  children
3834
3849
  }
3835
3850
  )
@@ -3841,7 +3856,7 @@ var ProviderOnArrangement = ({
3841
3856
 
3842
3857
  // src/MediaElementPlaylistContext.tsx
3843
3858
  import {
3844
- useState as useState17,
3859
+ useState as useState16,
3845
3860
  useEffect as useEffect9,
3846
3861
  useLayoutEffect as useLayoutEffect6,
3847
3862
  useRef as useRef22,
@@ -3892,16 +3907,16 @@ var MediaElementPlaylistProvider = ({
3892
3907
  children
3893
3908
  }) => {
3894
3909
  const mergedTheme = useMergedTheme(userThemeProp);
3895
- const [isPlaying, setIsPlayingState] = useState17(false);
3910
+ const [isPlaying, setIsPlayingState] = useState16(false);
3896
3911
  const isPlayingRef = useRef22(false);
3897
3912
  const setIsPlaying = useCallback20((playing) => {
3898
3913
  isPlayingRef.current = playing;
3899
3914
  setIsPlayingState(playing);
3900
3915
  }, []);
3901
- const [currentTime, setCurrentTime] = useState17(0);
3902
- const [isReady, setIsReady] = useState17(false);
3903
- const [playbackRate, setPlaybackRateState] = useState17(initialPlaybackRate);
3904
- const [ratePropSeen, setRatePropSeen] = useState17(initialPlaybackRate);
3916
+ const [currentTime, setCurrentTime] = useState16(0);
3917
+ const [isReady, setIsReady] = useState16(false);
3918
+ const [playbackRate, setPlaybackRateState] = useState16(initialPlaybackRate);
3919
+ const [ratePropSeen, setRatePropSeen] = useState16(initialPlaybackRate);
3905
3920
  if (!Object.is(ratePropSeen, initialPlaybackRate)) {
3906
3921
  setRatePropSeen(initialPlaybackRate);
3907
3922
  setPlaybackRateState(initialPlaybackRate);
@@ -3938,12 +3953,12 @@ var MediaElementPlaylistProvider = ({
3938
3953
  setAutomaticScroll
3939
3954
  } = useScrollFollow(automaticScroll);
3940
3955
  const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
3941
- const [selection, setSelectionState] = useState17({
3956
+ const [selection, setSelectionState] = useState16({
3942
3957
  selectionStart: 0,
3943
3958
  selectionEnd: 0
3944
3959
  });
3945
3960
  const selectionRef = useRef22(selection);
3946
- const [samplesPerPixel] = useState17(initialSamplesPerPixel);
3961
+ const [samplesPerPixel] = useState16(initialSamplesPerPixel);
3947
3962
  const { timeFormat, setTimeFormat } = useTimeFormat();
3948
3963
  const playoutRef = useRef22(null);
3949
3964
  const currentTimeRef = useRef22(0);
@@ -4420,7 +4435,7 @@ var MediaElementPlaylistProvider = ({
4420
4435
  ActiveAnnotationContext,
4421
4436
  {
4422
4437
  value: activeAnnotationValue,
4423
- children: /* @__PURE__ */ jsx2(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ jsx2(SelectionContext, { value: selection, children: /* @__PURE__ */ jsx2(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ jsx2(RecordingArmContext, { value: BLOCKED, children }) }) }) })
4438
+ children: /* @__PURE__ */ jsx2(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ jsx2(SelectionContext, { value: selection, children: /* @__PURE__ */ jsx2(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ jsx2(RecordingTrackContext, { value: BLOCKED, children }) }) }) })
4424
4439
  }
4425
4440
  ) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
4426
4441
  };
@@ -4670,7 +4685,7 @@ var AutomaticScrollCheckbox = ({ className }) => {
4670
4685
  import {
4671
4686
  use as use13,
4672
4687
  useLayoutEffect as useLayoutEffect9,
4673
- useRef as useRef30,
4688
+ useRef as useRef31,
4674
4689
  useState as useState21,
4675
4690
  useMemo as useMemo20,
4676
4691
  useCallback as useCallback26
@@ -4712,9 +4727,9 @@ function trackIdAtOffset(orderedIds, layout, heightById, y) {
4712
4727
  }
4713
4728
 
4714
4729
  // src/hooks/useTrailingActive.ts
4715
- import { useEffect as useEffect11, useState as useState18 } from "react";
4730
+ import { useEffect as useEffect11, useState as useState17 } from "react";
4716
4731
  function useTrailingActive(active, trailingMs) {
4717
- const [trailing, setTrailing] = useState18(active);
4732
+ const [trailing, setTrailing] = useState17(active);
4718
4733
  useEffect11(() => {
4719
4734
  if (active) {
4720
4735
  setTrailing(true);
@@ -4884,8 +4899,8 @@ import {
4884
4899
  } from "@waveform-playlist/ui-components";
4885
4900
 
4886
4901
  // src/hooks/useSelectionDrag.ts
4887
- import { createContext as createContext3, memo as memo2, useLayoutEffect as useLayoutEffect8, useMemo as useMemo14, useRef as useRef25, useState as useState19 } from "react";
4888
- import { createValueSource as createValueSource4 } from "@waveform-playlist/core";
4902
+ import { createContext as createContext3, memo as memo2, useLayoutEffect as useLayoutEffect8, useMemo as useMemo14, useRef as useRef25, useState as useState18 } from "react";
4903
+ import { createValueSource as createValueSource3 } from "@waveform-playlist/core";
4889
4904
 
4890
4905
  // src/hooks/useWindowDrag.ts
4891
4906
  import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect7, useRef as useRef24 } from "react";
@@ -4968,9 +4983,9 @@ function useSelectionDrag({
4968
4983
  }) {
4969
4984
  const { isPlaying } = useIsPlaying();
4970
4985
  const { setSelection } = usePlaybackControls();
4971
- const [isSelecting, setIsSelecting] = useState19(false);
4986
+ const [isSelecting, setIsSelecting] = useState18(false);
4972
4987
  const automaticScrollRef = useRef25(false);
4973
- const previewHandle = useMemo14(() => createValueSource4(null), []);
4988
+ const previewHandle = useMemo14(() => createValueSource3(null), []);
4974
4989
  const pressTimeRef = useRef25(0);
4975
4990
  const wroteSelectionRef = useRef25(false);
4976
4991
  const dragElementRef = useRef25(null);
@@ -5628,8 +5643,8 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
5628
5643
  var _a, _b;
5629
5644
  const track = rowList[trackIndex];
5630
5645
  if (!track) return null;
5631
- const isArmed = (recordingState == null ? void 0 : recordingState.isRecording) === true && recordingState.trackId === track.id;
5632
- const recordingChannels = isArmed ? recordingChannelCount : 0;
5646
+ const isRecordingTrack = (recordingState == null ? void 0 : recordingState.isRecording) === true && recordingState.trackId === track.id;
5647
+ const recordingChannels = isRecordingTrack ? recordingChannelCount : 0;
5633
5648
  const helpers = spectrogramHelpersById.get(track.id);
5634
5649
  return /* @__PURE__ */ jsx8(
5635
5650
  TrackRow,
@@ -5647,7 +5662,7 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
5647
5662
  numChannels: getTrackChannelCount(trackClipPeaks, recordingChannels),
5648
5663
  waveHeight,
5649
5664
  mono,
5650
- recordingState: isArmed ? recordingState : void 0,
5665
+ recordingState: isRecordingTrack ? recordingState : void 0,
5651
5666
  spectrogramConfig: helpers == null ? void 0 : helpers.config,
5652
5667
  frequencyScaleFn: helpers == null ? void 0 : helpers.frequencyScaleFn,
5653
5668
  samplesPerPixel,
@@ -5660,7 +5675,7 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
5660
5675
  };
5661
5676
 
5662
5677
  // src/components/TrackControlsColumn.tsx
5663
- import React12, { use as use9, useMemo as useMemo17, useRef as useRef28, useState as useState20 } from "react";
5678
+ import React12, { use as use9, useMemo as useMemo17, useRef as useRef29, useState as useState20 } from "react";
5664
5679
 
5665
5680
  // src/components/DefaultTrackControls.tsx
5666
5681
  import React11 from "react";
@@ -5668,7 +5683,8 @@ import styled4 from "styled-components";
5668
5683
  import { ButtonGroup, Controls, Header } from "@waveform-playlist/ui-components";
5669
5684
 
5670
5685
  // src/components/TrackControlPieces.tsx
5671
- import { use as use8 } from "react";
5686
+ import { use as use8, useEffect as useEffect15, useRef as useRef27, useState as useState19 } from "react";
5687
+ import { createMixerGesture } from "@waveform-playlist/core";
5672
5688
  import {
5673
5689
  Button,
5674
5690
  CloseButton,
@@ -5822,13 +5838,13 @@ var TrackName = () => {
5822
5838
  return /* @__PURE__ */ jsx9("span", { "data-track-name": "", style: NAME_STYLE, children: name });
5823
5839
  };
5824
5840
  var TrackMuteButton = () => {
5825
- const { muted, setMuted, isRecordingArmed } = useTrack();
5841
+ const { muted, setMuted, isRecording } = useTrack();
5826
5842
  return /* @__PURE__ */ jsx9(
5827
5843
  Button,
5828
5844
  {
5829
5845
  $variant: muted ? "danger" : "outline",
5830
5846
  "aria-pressed": muted,
5831
- disabled: isRecordingArmed,
5847
+ disabled: isRecording,
5832
5848
  onClick: () => setMuted(!muted),
5833
5849
  children: "Mute"
5834
5850
  }
@@ -5846,8 +5862,18 @@ var TrackSoloButton = () => {
5846
5862
  }
5847
5863
  );
5848
5864
  };
5865
+ function useSliderGesture() {
5866
+ const [gesture] = useState19(createMixerGesture);
5867
+ const ref = useRef27(null);
5868
+ useEffect15(() => {
5869
+ const input = ref.current;
5870
+ return input ? gesture.attach(input) : void 0;
5871
+ }, [gesture]);
5872
+ return { gesture, ref };
5873
+ }
5849
5874
  var TrackVolumeSlider = () => {
5850
5875
  const { volume, setVolume } = useTrack();
5876
+ const { gesture, ref } = useSliderGesture();
5851
5877
  return /* @__PURE__ */ jsxs3(SliderWrapper, { children: [
5852
5878
  /* @__PURE__ */ jsx9(VolumeDownIcon, {}),
5853
5879
  /* @__PURE__ */ jsx9(
@@ -5856,9 +5882,10 @@ var TrackVolumeSlider = () => {
5856
5882
  min: "0",
5857
5883
  max: "1",
5858
5884
  step: "0.01",
5885
+ ref,
5859
5886
  value: volume,
5860
5887
  "aria-label": "Volume",
5861
- onChange: (e) => setVolume(parseFloat(e.target.value))
5888
+ onChange: (e) => setVolume(parseFloat(e.target.value), { gesture: gesture.id })
5862
5889
  }
5863
5890
  ),
5864
5891
  /* @__PURE__ */ jsx9(VolumeUpIcon, {})
@@ -5866,6 +5893,7 @@ var TrackVolumeSlider = () => {
5866
5893
  };
5867
5894
  var TrackPanSlider = () => {
5868
5895
  const { pan, setPan } = useTrack();
5896
+ const { gesture, ref } = useSliderGesture();
5869
5897
  return /* @__PURE__ */ jsxs3(SliderWrapper, { children: [
5870
5898
  /* @__PURE__ */ jsx9("span", { children: "L" }),
5871
5899
  /* @__PURE__ */ jsx9(
@@ -5874,9 +5902,10 @@ var TrackPanSlider = () => {
5874
5902
  min: "-1",
5875
5903
  max: "1",
5876
5904
  step: "0.01",
5905
+ ref,
5877
5906
  value: pan,
5878
5907
  "aria-label": "Pan",
5879
- onChange: (e) => setPan(parseFloat(e.target.value))
5908
+ onChange: (e) => setPan(parseFloat(e.target.value), { gesture: gesture.id })
5880
5909
  }
5881
5910
  ),
5882
5911
  /* @__PURE__ */ jsx9("span", { children: "R" })
@@ -5967,7 +5996,7 @@ function DefaultTrackControlsImpl({ children }) {
5967
5996
  var DefaultTrackControls = React11.memo(DefaultTrackControlsImpl);
5968
5997
 
5969
5998
  // src/utils/stableTemplate.ts
5970
- import { isValidElement, useRef as useRef27 } from "react";
5999
+ import { isValidElement, useRef as useRef28 } from "react";
5971
6000
  function sameStyle(a, b) {
5972
6001
  if (Object.is(a, b)) return true;
5973
6002
  if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
@@ -5997,7 +6026,7 @@ function sameTemplate(a, b) {
5997
6026
  return false;
5998
6027
  }
5999
6028
  function useStableTemplate(template) {
6000
- const kept = useRef27(template);
6029
+ const kept = useRef28(template);
6001
6030
  if (!sameTemplate(kept.current, template)) {
6002
6031
  kept.current = template;
6003
6032
  }
@@ -6023,7 +6052,7 @@ function TrackControlsSlotImpl({
6023
6052
  isLast,
6024
6053
  renderMode,
6025
6054
  hasSpectrogram,
6026
- isRecordingArmed,
6055
+ isRecording,
6027
6056
  height,
6028
6057
  top,
6029
6058
  animate,
@@ -6038,14 +6067,14 @@ function TrackControlsSlotImpl({
6038
6067
  setSelectedTrackId
6039
6068
  } = useEditorControls();
6040
6069
  const shared = use9(TrackControlsSharedContext);
6041
- const indexRef = useRef28(index);
6070
+ const indexRef = useRef29(index);
6042
6071
  indexRef.current = index;
6043
6072
  const actions = useMemo17(
6044
6073
  () => ({
6045
- setMuted: (value2) => setTrackMute(trackId, value2),
6046
- setSoloed: (value2) => setTrackSolo(trackId, value2),
6047
- setVolume: (value2) => setTrackVolume(trackId, value2),
6048
- setPan: (value2) => setTrackPan(trackId, value2),
6074
+ setMuted: (value2, options) => setTrackMute(trackId, value2, options),
6075
+ setSoloed: (value2, options) => setTrackSolo(trackId, value2, options),
6076
+ setVolume: (value2, options) => setTrackVolume(trackId, value2, options),
6077
+ setPan: (value2, options) => setTrackPan(trackId, value2, options),
6049
6078
  select: () => setSelectedTrackId(trackId),
6050
6079
  // The engine clamps the target and ignores a move to the same place.
6051
6080
  moveUp: () => reorderTrack(trackId, indexRef.current - 1),
@@ -6079,7 +6108,7 @@ function TrackControlsSlotImpl({
6079
6108
  isFirst,
6080
6109
  isLast,
6081
6110
  hasSpectrogram,
6082
- isRecordingArmed
6111
+ isRecording
6083
6112
  }, actions),
6084
6113
  [
6085
6114
  trackId,
@@ -6095,11 +6124,11 @@ function TrackControlsSlotImpl({
6095
6124
  isFirst,
6096
6125
  isLast,
6097
6126
  hasSpectrogram,
6098
- isRecordingArmed,
6127
+ isRecording,
6099
6128
  actions
6100
6129
  ]
6101
6130
  );
6102
- const elementRef = useRef28(null);
6131
+ const elementRef = useRef29(null);
6103
6132
  const [isDragSource, setDragSource] = useState20(false);
6104
6133
  const wiring = useMemo17(
6105
6134
  () => ({ elementRef, setDragSource, handleCount: { current: 0 } }),
@@ -6136,11 +6165,11 @@ function WaveformTrackControlsImpl({ children }) {
6136
6165
  );
6137
6166
  }
6138
6167
  const { selectedTrackId } = useSelectedTrackId();
6139
- const { armedTrackId } = useRecordingArm();
6168
+ const { recordingTrackId } = useRecordingTrack();
6140
6169
  const spectrogram = use9(SpectrogramIntegrationContext);
6141
6170
  const { trackStates } = usePlaylistMixer();
6142
6171
  const template = useStableTemplate(children != null ? children : DEFAULT_TEMPLATE);
6143
- const spectrogramRef = useRef28(spectrogram);
6172
+ const spectrogramRef = useRef29(spectrogram);
6144
6173
  spectrogramRef.current = spectrogram;
6145
6174
  const menuAvailable = Boolean(spectrogram == null ? void 0 : spectrogram.renderMenuItems);
6146
6175
  const shared = useMemo17(
@@ -6179,7 +6208,7 @@ function WaveformTrackControlsImpl({ children }) {
6179
6208
  isLast: trackIndex === tracks.length - 1,
6180
6209
  renderMode: (_a = renderModeById.get(track.id)) != null ? _a : "waveform",
6181
6210
  hasSpectrogram: spectrogram !== null && track.kind !== "midi",
6182
- isRecordingArmed: track.id === armedTrackId,
6211
+ isRecording: track.id === recordingTrackId,
6183
6212
  height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
6184
6213
  top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
6185
6214
  animate: animateTrackLayout && dragSourceTrackId !== null,
@@ -6200,7 +6229,7 @@ import {
6200
6229
  } from "@waveform-playlist/ui-components";
6201
6230
 
6202
6231
  // src/components/AnimatedPlayhead.tsx
6203
- import { useRef as useRef29, useEffect as useEffect15, useId as useId3 } from "react";
6232
+ import { useRef as useRef30, useEffect as useEffect16, useId as useId3 } from "react";
6204
6233
  import styled5 from "styled-components";
6205
6234
  import { usePlaylistInfo as usePlaylistInfo3 } from "@waveform-playlist/ui-components";
6206
6235
  import { jsx as jsx12 } from "react/jsx-runtime";
@@ -6219,7 +6248,7 @@ var PlayheadLine = styled5.div.attrs((props) => ({
6219
6248
  will-change: transform;
6220
6249
  `;
6221
6250
  var AnimatedPlayhead = ({ color = "#ff0000" }) => {
6222
- const playheadRef = useRef29(null);
6251
+ const playheadRef = useRef30(null);
6223
6252
  const frameCallbackId = useId3();
6224
6253
  const { currentTimeRef, visualTimeRef, registerFrameCallback, unregisterFrameCallback } = usePlaybackRefs();
6225
6254
  const { isPlaying } = useIsPlaying();
@@ -6227,7 +6256,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
6227
6256
  const { sampleRate } = usePlaylistView();
6228
6257
  const { progressBarWidth } = usePlaylistInfo3();
6229
6258
  const { samplesPerPixel } = usePlaylistZoom();
6230
- useEffect15(() => {
6259
+ useEffect16(() => {
6231
6260
  if (isPlaying) {
6232
6261
  registerFrameCallback(
6233
6262
  frameCallbackId,
@@ -6241,7 +6270,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
6241
6270
  }
6242
6271
  return () => unregisterFrameCallback(frameCallbackId);
6243
6272
  }, [isPlaying, frameCallbackId, registerFrameCallback, unregisterFrameCallback]);
6244
- useEffect15(() => {
6273
+ useEffect16(() => {
6245
6274
  var _a, _b;
6246
6275
  if (!isPlaying && playheadRef.current) {
6247
6276
  const time = (_b = (_a = visualTimeRef.current) != null ? _a : currentTimeRef.current) != null ? _b : 0;
@@ -6715,7 +6744,7 @@ var WaveformRoot = ({ className, children }) => {
6715
6744
  displayDuration = Math.max(displayDuration, recordingLayout.displayEndSeconds);
6716
6745
  }
6717
6746
  displayDuration = Math.max(displayDuration, trimPreviewEnd);
6718
- const tracksRef = useRef30(tracks);
6747
+ const tracksRef = useRef31(tracks);
6719
6748
  tracksRef.current = tracks;
6720
6749
  const selectTrack = useCallback26(
6721
6750
  (trackIndex) => {
@@ -7197,19 +7226,19 @@ var KeyboardShortcuts = ({
7197
7226
  };
7198
7227
 
7199
7228
  // src/hooks/useRecordingSession.ts
7200
- import { useEffect as useEffect16 } from "react";
7229
+ import { useEffect as useEffect17 } from "react";
7201
7230
  function useRecordingSession({ isRecording, trackId }) {
7202
7231
  const { setRecordingActive } = useEditorControls();
7203
- const armedTrackId = trackId != null ? trackId : null;
7204
- useEffect16(() => {
7232
+ const recordingTrackId = trackId != null ? trackId : null;
7233
+ useEffect17(() => {
7205
7234
  if (!isRecording) return void 0;
7206
- setRecordingActive(true, armedTrackId);
7235
+ setRecordingActive(true, recordingTrackId);
7207
7236
  return () => setRecordingActive(false);
7208
- }, [isRecording, armedTrackId, setRecordingActive]);
7237
+ }, [isRecording, recordingTrackId, setRecordingActive]);
7209
7238
  }
7210
7239
 
7211
7240
  // src/components/ClipInteractionProvider.tsx
7212
- import React23, { useCallback as useCallback28, useMemo as useMemo23, useRef as useRef31 } from "react";
7241
+ import React23, { useCallback as useCallback28, useMemo as useMemo23, useRef as useRef32 } from "react";
7213
7242
  import { flushSync as flushSync2 } from "react-dom";
7214
7243
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
7215
7244
  import { RestrictToHorizontalAxis as RestrictToHorizontalAxis2 } from "@dnd-kit/abstract/modifiers";
@@ -7332,7 +7361,7 @@ var ClipInteractionProvider = ({
7332
7361
  }
7333
7362
  return void 0;
7334
7363
  }, [useBeatsSnap, useTimescaleSnap, beatsAndBars, sampleRate, samplesPerPixel]);
7335
- const tracksRef = useRef31(tracks);
7364
+ const tracksRef = useRef32(tracks);
7336
7365
  tracksRef.current = tracks;
7337
7366
  const getTracks = useCallback28(() => tracksRef.current, []);
7338
7367
  const sensors = useDragSensors({ touchOptimized });