@waveform-playlist/browser 17.0.0-next.6 → 17.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +3 -13
- package/dist/index.d.ts +3 -13
- package/dist/index.js +78 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -79
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ Under either provider:
|
|
|
109
109
|
| `usePlaylistTimeline` | `tracks` (loaded clips only, read-only), `peaksDataArray` (with placeholder records for clips still loading), `duration` (loaded audio), `isReady` | every clip operation (a trim once, on release), a zoom (`peaksDataArray` is computed per zoom level), audio or peaks arriving, `isReady` changing |
|
|
110
110
|
| `usePlaylistMixer` | `trackStates` (one entry per track in the order of `tracks`, also while a track loads), `masterVolume` | every mute, solo, volume or pan change (each step of a slider drag); tracks added, removed, renamed or reordered |
|
|
111
111
|
| `useTrack` | Among the children of `<WaveformTrackControls>` only: the track whose panel is being drawn (id, name, mixer state, `isSelected`, `isRecordingArmed`) and actions bound to it (`setMuted`, `setVolume`, `moveUp`, …) | a change of that track's state, position or selection |
|
|
112
|
-
| `useTrackReorderPreview` | `trackDragPreview
|
|
112
|
+
| `useTrackReorderPreview` | `trackDragPreview` | every drag-over of a track reorder |
|
|
113
113
|
| `useLoop` | `isLoopEnabled`, `loopStart`, `loopEnd` | a loop change |
|
|
114
114
|
| `useSelectedTrackId` | `selectedTrackId` | another track being selected |
|
|
115
115
|
| `useUndoRedo` | `canUndo`, `canRedo` | after an edit |
|
package/dist/index.d.mts
CHANGED
|
@@ -292,12 +292,6 @@ interface EditorControlsContextValue {
|
|
|
292
292
|
* organizational — playback is not interrupted. An undo step of the
|
|
293
293
|
* arrangement (#812). */
|
|
294
294
|
reorderTrack: (trackId: string, toIndex: number) => void;
|
|
295
|
-
/** Internal: call after every track-reorder DRAG interaction ends
|
|
296
|
-
* (committed or canceled) to force the view's track-controls part to remount
|
|
297
|
-
* its slots, discarding any @dnd-kit sortable-plugin DOM
|
|
298
|
-
* corruption. Not needed for button-driven reorderTrack calls (they never
|
|
299
|
-
* touch dnd-kit's DOM). See bumpTrackReorderEpoch in the provider. */
|
|
300
|
-
bumpTrackReorderEpoch: () => void;
|
|
301
295
|
/** INTERNAL wiring for ClipInteractionProvider: publishes/clears the live
|
|
302
296
|
* track-reorder drag preview. Custom drag integrations may call it, but
|
|
303
297
|
* most consumers only ever READ trackDragPreview from useTrackReorderPreview(). */
|
|
@@ -407,11 +401,6 @@ interface TrackReorderPreviewContextValue {
|
|
|
407
401
|
* layout from it; a track's panel can read it to mirror the preview in
|
|
408
402
|
* its own UI. */
|
|
409
403
|
trackDragPreview: TrackDragPreview | null;
|
|
410
|
-
/** Internal: incremented after every track-reorder drag interaction ends.
|
|
411
|
-
* The view's track-controls part folds this into each slot's `key` to
|
|
412
|
-
* force a remount, working around @dnd-kit sortable-plugin DOM corruption
|
|
413
|
-
* (see bumpTrackReorderEpoch in EditorControlsContextValue). */
|
|
414
|
-
trackReorderEpoch: number;
|
|
415
404
|
}
|
|
416
405
|
/** The playback speed and its setter (#688). Changes when the speed does. */
|
|
417
406
|
interface PlaybackRateContextValue {
|
|
@@ -529,7 +518,7 @@ declare const usePlaylistTimeline: () => PlaylistTimelineContextValue;
|
|
|
529
518
|
*/
|
|
530
519
|
declare const usePlaylistMixer: () => PlaylistMixerContextValue;
|
|
531
520
|
/**
|
|
532
|
-
* `{ trackDragPreview
|
|
521
|
+
* `{ trackDragPreview }`. A component that calls this
|
|
533
522
|
* re-renders on every drag-over of a track reorder.
|
|
534
523
|
*/
|
|
535
524
|
declare const useTrackReorderPreview: () => TrackReorderPreviewContextValue;
|
|
@@ -1849,7 +1838,8 @@ interface TrackReorderHandle {
|
|
|
1849
1838
|
* calls for one track register the same sortable id twice.
|
|
1850
1839
|
*
|
|
1851
1840
|
* The item that moves is the slot `<WaveformTrackControls>` draws around the
|
|
1852
|
-
* panel
|
|
1841
|
+
* panel (the keyed element React reorders, #796), not an element of the
|
|
1842
|
+
* caller. The per-source modifiers REPLACE the
|
|
1853
1843
|
* provider's clip modifiers for this operation, so track drags are
|
|
1854
1844
|
* vertical-only and skip clip collision and snap. Data kind 'track-reorder'
|
|
1855
1845
|
* is the discriminator the shared drag handlers branch on.
|
package/dist/index.d.ts
CHANGED
|
@@ -292,12 +292,6 @@ interface EditorControlsContextValue {
|
|
|
292
292
|
* organizational — playback is not interrupted. An undo step of the
|
|
293
293
|
* arrangement (#812). */
|
|
294
294
|
reorderTrack: (trackId: string, toIndex: number) => void;
|
|
295
|
-
/** Internal: call after every track-reorder DRAG interaction ends
|
|
296
|
-
* (committed or canceled) to force the view's track-controls part to remount
|
|
297
|
-
* its slots, discarding any @dnd-kit sortable-plugin DOM
|
|
298
|
-
* corruption. Not needed for button-driven reorderTrack calls (they never
|
|
299
|
-
* touch dnd-kit's DOM). See bumpTrackReorderEpoch in the provider. */
|
|
300
|
-
bumpTrackReorderEpoch: () => void;
|
|
301
295
|
/** INTERNAL wiring for ClipInteractionProvider: publishes/clears the live
|
|
302
296
|
* track-reorder drag preview. Custom drag integrations may call it, but
|
|
303
297
|
* most consumers only ever READ trackDragPreview from useTrackReorderPreview(). */
|
|
@@ -407,11 +401,6 @@ interface TrackReorderPreviewContextValue {
|
|
|
407
401
|
* layout from it; a track's panel can read it to mirror the preview in
|
|
408
402
|
* its own UI. */
|
|
409
403
|
trackDragPreview: TrackDragPreview | null;
|
|
410
|
-
/** Internal: incremented after every track-reorder drag interaction ends.
|
|
411
|
-
* The view's track-controls part folds this into each slot's `key` to
|
|
412
|
-
* force a remount, working around @dnd-kit sortable-plugin DOM corruption
|
|
413
|
-
* (see bumpTrackReorderEpoch in EditorControlsContextValue). */
|
|
414
|
-
trackReorderEpoch: number;
|
|
415
404
|
}
|
|
416
405
|
/** The playback speed and its setter (#688). Changes when the speed does. */
|
|
417
406
|
interface PlaybackRateContextValue {
|
|
@@ -529,7 +518,7 @@ declare const usePlaylistTimeline: () => PlaylistTimelineContextValue;
|
|
|
529
518
|
*/
|
|
530
519
|
declare const usePlaylistMixer: () => PlaylistMixerContextValue;
|
|
531
520
|
/**
|
|
532
|
-
* `{ trackDragPreview
|
|
521
|
+
* `{ trackDragPreview }`. A component that calls this
|
|
533
522
|
* re-renders on every drag-over of a track reorder.
|
|
534
523
|
*/
|
|
535
524
|
declare const useTrackReorderPreview: () => TrackReorderPreviewContextValue;
|
|
@@ -1849,7 +1838,8 @@ interface TrackReorderHandle {
|
|
|
1849
1838
|
* calls for one track register the same sortable id twice.
|
|
1850
1839
|
*
|
|
1851
1840
|
* The item that moves is the slot `<WaveformTrackControls>` draws around the
|
|
1852
|
-
* panel
|
|
1841
|
+
* panel (the keyed element React reorders, #796), not an element of the
|
|
1842
|
+
* caller. The per-source modifiers REPLACE the
|
|
1853
1843
|
* provider's clip modifiers for this operation, so track drags are
|
|
1854
1844
|
* vertical-only and skip clip collision and snap. Data kind 'track-reorder'
|
|
1855
1845
|
* is the discriminator the shared drag handlers branch on.
|
package/dist/index.js
CHANGED
|
@@ -3163,7 +3163,6 @@ var ProviderOnArrangement = ({
|
|
|
3163
3163
|
const { registerFrameCallback, unregisterFrameCallback, runFrameCallbacks } = useFrameCallbacks();
|
|
3164
3164
|
const [isPlaying, setIsPlaying] = (0, import_react35.useState)(false);
|
|
3165
3165
|
const [currentTime, setCurrentTime] = (0, import_react35.useState)(0);
|
|
3166
|
-
const [trackReorderEpoch, setTrackReorderEpoch] = (0, import_react35.useState)(0);
|
|
3167
3166
|
const [trackDragPreview, setTrackDragPreview] = (0, import_react35.useState)(null);
|
|
3168
3167
|
const indefinitePlaybackRef = (0, import_react35.useRef)(indefinitePlayback);
|
|
3169
3168
|
indefinitePlaybackRef.current = indefinitePlayback;
|
|
@@ -3701,9 +3700,6 @@ var ProviderOnArrangement = ({
|
|
|
3701
3700
|
},
|
|
3702
3701
|
[play, setCurrentTimeRefs, recordingActiveRef]
|
|
3703
3702
|
);
|
|
3704
|
-
const bumpTrackReorderEpoch = (0, import_react35.useCallback)(() => {
|
|
3705
|
-
setTrackReorderEpoch((epoch) => epoch + 1);
|
|
3706
|
-
}, []);
|
|
3707
3703
|
const setSelection = (0, import_react35.useCallback)(
|
|
3708
3704
|
(start, end) => {
|
|
3709
3705
|
var _a;
|
|
@@ -3871,7 +3867,6 @@ var ProviderOnArrangement = ({
|
|
|
3871
3867
|
setTrackVolume: editing.setTrackVolume,
|
|
3872
3868
|
setTrackPan: editing.setTrackPan,
|
|
3873
3869
|
reorderTrack: editing.reorderTrack,
|
|
3874
|
-
bumpTrackReorderEpoch,
|
|
3875
3870
|
setTrackDragPreview,
|
|
3876
3871
|
setSelectedTrackId: setSelectedTrackIdControl,
|
|
3877
3872
|
// Zoom
|
|
@@ -3897,7 +3892,6 @@ var ProviderOnArrangement = ({
|
|
|
3897
3892
|
editing.setTrackVolume,
|
|
3898
3893
|
editing.setTrackPan,
|
|
3899
3894
|
editing.reorderTrack,
|
|
3900
|
-
bumpTrackReorderEpoch,
|
|
3901
3895
|
setTrackDragPreview,
|
|
3902
3896
|
setSelectedTrackIdControl,
|
|
3903
3897
|
zoom.zoomIn,
|
|
@@ -3938,8 +3932,8 @@ var ProviderOnArrangement = ({
|
|
|
3938
3932
|
[trackStates, masterVolume]
|
|
3939
3933
|
);
|
|
3940
3934
|
const reorderPreviewValue = (0, import_react35.useMemo)(
|
|
3941
|
-
() => ({ trackDragPreview
|
|
3942
|
-
[trackDragPreview
|
|
3935
|
+
() => ({ trackDragPreview }),
|
|
3936
|
+
[trackDragPreview]
|
|
3943
3937
|
);
|
|
3944
3938
|
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
3939
|
TrackReorderPreviewContext,
|
|
@@ -4778,7 +4772,7 @@ var AutomaticScrollCheckbox = ({ className }) => {
|
|
|
4778
4772
|
// src/components/WaveformRoot.tsx
|
|
4779
4773
|
var import_react60 = require("react");
|
|
4780
4774
|
var import_react_dom2 = require("react-dom");
|
|
4781
|
-
var
|
|
4775
|
+
var import_ui_components15 = require("@waveform-playlist/ui-components");
|
|
4782
4776
|
|
|
4783
4777
|
// src/utils/trackOrderPreview.ts
|
|
4784
4778
|
function applyTrackOrderPreview(tracks, preview) {
|
|
@@ -4945,6 +4939,7 @@ var TrackRowPositioner = import_styled_components4.default.div.attrs((props) =>
|
|
|
4945
4939
|
transition: none;
|
|
4946
4940
|
}
|
|
4947
4941
|
`;
|
|
4942
|
+
var DRAG_SOURCE_SHADOW = "0 4px 12px rgba(0, 0, 0, 0.35)";
|
|
4948
4943
|
var ControlSlot = import_styled_components4.default.div.attrs((props) => ({
|
|
4949
4944
|
style: {
|
|
4950
4945
|
height: `${props.$height}px`,
|
|
@@ -4963,6 +4958,7 @@ var ControlSlot = import_styled_components4.default.div.attrs((props) => ({
|
|
|
4963
4958
|
transition: background 0.15s ease-in-out;
|
|
4964
4959
|
}
|
|
4965
4960
|
${(props) => props.$isSelected && `background: ${props.theme.selectedTrackControlsBackground};`}
|
|
4961
|
+
${(props) => props.$isDragSource && `background: ${props.theme.selectedTrackControlsBackground}; box-shadow: ${DRAG_SOURCE_SHADOW};`}
|
|
4966
4962
|
`;
|
|
4967
4963
|
function getTrackChannelCount(trackClipPeaks, recordingChannels) {
|
|
4968
4964
|
const clipChannels = trackClipPeaks.length > 0 ? Math.max(1, ...trackClipPeaks.map((clip) => clip.peaks.data.length)) : 1;
|
|
@@ -4971,7 +4967,7 @@ function getTrackChannelCount(trackClipPeaks, recordingChannels) {
|
|
|
4971
4967
|
|
|
4972
4968
|
// src/components/waveformFrame.tsx
|
|
4973
4969
|
var import_react59 = __toESM(require("react"));
|
|
4974
|
-
var
|
|
4970
|
+
var import_ui_components14 = require("@waveform-playlist/ui-components");
|
|
4975
4971
|
|
|
4976
4972
|
// src/hooks/useSelectionDrag.ts
|
|
4977
4973
|
var import_react44 = require("react");
|
|
@@ -5147,7 +5143,7 @@ var useWaveformRows = (part) => required((0, import_react45.use)(WaveformRowsCon
|
|
|
5147
5143
|
|
|
5148
5144
|
// src/components/waveformParts.tsx
|
|
5149
5145
|
var import_react58 = __toESM(require("react"));
|
|
5150
|
-
var
|
|
5146
|
+
var import_ui_components13 = require("@waveform-playlist/ui-components");
|
|
5151
5147
|
|
|
5152
5148
|
// src/components/TrackRows.tsx
|
|
5153
5149
|
var import_react48 = __toESM(require("react"));
|
|
@@ -5728,7 +5724,6 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5728
5724
|
|
|
5729
5725
|
// src/components/TrackControlsColumn.tsx
|
|
5730
5726
|
var import_react54 = __toESM(require("react"));
|
|
5731
|
-
var import_ui_components10 = require("@waveform-playlist/ui-components");
|
|
5732
5727
|
|
|
5733
5728
|
// src/components/DefaultTrackControls.tsx
|
|
5734
5729
|
var import_react52 = __toESM(require("react"));
|
|
@@ -5788,7 +5783,7 @@ function createDragPopoverHealer(element) {
|
|
|
5788
5783
|
}
|
|
5789
5784
|
|
|
5790
5785
|
// src/hooks/useTrackReorderHandle.ts
|
|
5791
|
-
var MOVE_FEEDBACK = import_dom2.Feedback.configure({ feedback: "move" });
|
|
5786
|
+
var MOVE_FEEDBACK = import_dom2.Feedback.configure({ feedback: "move", dropAnimation: null });
|
|
5792
5787
|
var withMoveFeedback = (defaults) => [...defaults, MOVE_FEEDBACK];
|
|
5793
5788
|
function useTrackReorderHandle() {
|
|
5794
5789
|
const { id, index } = useTrack();
|
|
@@ -5815,10 +5810,9 @@ function useTrackReorderHandle() {
|
|
|
5815
5810
|
// `placeholder.replaceWith(element)` on drop) — confirmed via
|
|
5816
5811
|
// MutationObserver instrumentation to relocate the React-owned row 6
|
|
5817
5812
|
// 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
|
|
5813
|
+
// different from what React's fiber tree still believes. (Measured when
|
|
5814
|
+
// the registered element was one level inside the keyed slot, before
|
|
5815
|
+
// #796; not re-run with the slot itself.) The placeholder splice is created only when
|
|
5822
5816
|
// `feedback !== 'move'` (@dnd-kit/dom Feedback.ts) — 'move' keeps the
|
|
5823
5817
|
// dragged element in the live DOM (no clone/placeholder) while still
|
|
5824
5818
|
// running the *unconditional* `dragOperation.shape = ...` assignment.
|
|
@@ -5830,7 +5824,10 @@ function useTrackReorderHandle() {
|
|
|
5830
5824
|
// drag-based reordering silently never commits. Boundary trims don't hit
|
|
5831
5825
|
// this because they're plain useDraggable (no collision-based commit) —
|
|
5832
5826
|
// sortables need shape. `isDragSource` is a reactive signal, unaffected
|
|
5833
|
-
// either way.
|
|
5827
|
+
// either way. OptimisticSortingPlugin still moves the element during the
|
|
5828
|
+
// drag (`insertAdjacentElement` next to the item it is dragged over);
|
|
5829
|
+
// that is safe only because the element is the keyed slot (#796, below).
|
|
5830
|
+
// See browser/notes/track-controls-and-reorder.md "Track Reordering".
|
|
5834
5831
|
plugins: withMoveFeedback
|
|
5835
5832
|
});
|
|
5836
5833
|
(0, import_react50.useEffect)(() => {
|
|
@@ -6065,7 +6062,6 @@ function useStableTemplate(template) {
|
|
|
6065
6062
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6066
6063
|
var DEFAULT_TRACK_CONTROLS_WIDTH = 200;
|
|
6067
6064
|
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
6065
|
var SLOT_BODY_STYLE = { height: "100%" };
|
|
6070
6066
|
function TrackControlsSlotImpl({
|
|
6071
6067
|
trackId,
|
|
@@ -6095,7 +6091,6 @@ function TrackControlsSlotImpl({
|
|
|
6095
6091
|
reorderTrack,
|
|
6096
6092
|
setSelectedTrackId
|
|
6097
6093
|
} = useEditorControls();
|
|
6098
|
-
const theme = (0, import_ui_components10.useTheme)();
|
|
6099
6094
|
const shared = (0, import_react54.use)(TrackControlsSharedContext);
|
|
6100
6095
|
const indexRef = (0, import_react54.useRef)(index);
|
|
6101
6096
|
indexRef.current = index;
|
|
@@ -6167,27 +6162,14 @@ function TrackControlsSlotImpl({
|
|
|
6167
6162
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6168
6163
|
ControlSlot,
|
|
6169
6164
|
{
|
|
6165
|
+
ref: elementRef,
|
|
6170
6166
|
$height: height,
|
|
6171
6167
|
$top: top,
|
|
6172
6168
|
$animate: animate,
|
|
6173
6169
|
$isSelected: isSelected,
|
|
6170
|
+
$isDragSource: isDragSource,
|
|
6174
6171
|
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
|
-
)
|
|
6172
|
+
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
6173
|
}
|
|
6192
6174
|
);
|
|
6193
6175
|
}
|
|
@@ -6199,6 +6181,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6199
6181
|
trackLayout,
|
|
6200
6182
|
trackHeightById,
|
|
6201
6183
|
animateTrackLayout,
|
|
6184
|
+
dragSourceTrackId,
|
|
6202
6185
|
setSettingsModalTrackId
|
|
6203
6186
|
} = useWaveformRows("The track controls");
|
|
6204
6187
|
if ((0, import_react54.use)(WaveformPartPlaceContext) !== "controls") {
|
|
@@ -6208,7 +6191,6 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6208
6191
|
}
|
|
6209
6192
|
const { selectedTrackId } = useSelectedTrackId();
|
|
6210
6193
|
const { armedTrackId } = useRecordingArm();
|
|
6211
|
-
const { trackReorderEpoch } = useTrackReorderPreview();
|
|
6212
6194
|
const spectrogram = (0, import_react54.use)(SpectrogramIntegrationContext);
|
|
6213
6195
|
const { trackStates } = usePlaylistMixer();
|
|
6214
6196
|
const template = useStableTemplate(children != null ? children : DEFAULT_TEMPLATE);
|
|
@@ -6235,36 +6217,29 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6235
6217
|
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
6218
|
var _a, _b, _c;
|
|
6237
6219
|
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
|
-
)
|
|
6220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6221
|
+
TrackControlsSlot,
|
|
6222
|
+
{
|
|
6223
|
+
trackId: track.id,
|
|
6224
|
+
index: trackIndex,
|
|
6225
|
+
kind: track.kind,
|
|
6226
|
+
name: state.name,
|
|
6227
|
+
muted: state.muted,
|
|
6228
|
+
soloed: state.soloed,
|
|
6229
|
+
volume: state.volume,
|
|
6230
|
+
pan: state.pan,
|
|
6231
|
+
isSelected: track.id === selectedTrackId,
|
|
6232
|
+
isFirst: trackIndex === 0,
|
|
6233
|
+
isLast: trackIndex === tracks.length - 1,
|
|
6234
|
+
renderMode: (_a = renderModeById.get(track.id)) != null ? _a : "waveform",
|
|
6235
|
+
hasSpectrogram: spectrogram !== null && track.kind !== "midi",
|
|
6236
|
+
isRecordingArmed: track.id === armedTrackId,
|
|
6237
|
+
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6238
|
+
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6239
|
+
animate: animateTrackLayout && dragSourceTrackId !== null,
|
|
6240
|
+
template
|
|
6241
|
+
},
|
|
6242
|
+
track.id
|
|
6268
6243
|
);
|
|
6269
6244
|
}) }) });
|
|
6270
6245
|
}
|
|
@@ -6272,12 +6247,12 @@ var WaveformTrackControls = import_react54.default.memo(WaveformTrackControlsImp
|
|
|
6272
6247
|
|
|
6273
6248
|
// src/components/VisualizationOverlays.tsx
|
|
6274
6249
|
var import_react56 = __toESM(require("react"));
|
|
6275
|
-
var
|
|
6250
|
+
var import_ui_components11 = require("@waveform-playlist/ui-components");
|
|
6276
6251
|
|
|
6277
6252
|
// src/components/AnimatedPlayhead.tsx
|
|
6278
6253
|
var import_react55 = require("react");
|
|
6279
6254
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
6280
|
-
var
|
|
6255
|
+
var import_ui_components10 = require("@waveform-playlist/ui-components");
|
|
6281
6256
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6282
6257
|
var PlayheadLine = import_styled_components7.default.div.attrs((props) => ({
|
|
6283
6258
|
style: {
|
|
@@ -6300,7 +6275,7 @@ var AnimatedPlayhead = ({ color = "#ff0000" }) => {
|
|
|
6300
6275
|
const { isPlaying } = useIsPlaying();
|
|
6301
6276
|
useCurrentTime();
|
|
6302
6277
|
const { sampleRate } = usePlaylistView();
|
|
6303
|
-
const { progressBarWidth } = (0,
|
|
6278
|
+
const { progressBarWidth } = (0, import_ui_components10.usePlaylistInfo)();
|
|
6304
6279
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6305
6280
|
(0, import_react55.useEffect)(() => {
|
|
6306
6281
|
if (isPlaying) {
|
|
@@ -6333,7 +6308,7 @@ var subscribeToNothing3 = () => () => {
|
|
|
6333
6308
|
};
|
|
6334
6309
|
var noPreview = () => null;
|
|
6335
6310
|
var WaveformSelection = import_react56.default.memo(function WaveformSelection2() {
|
|
6336
|
-
const theme = (0,
|
|
6311
|
+
const theme = (0, import_ui_components11.useTheme)();
|
|
6337
6312
|
const { selectionStart, selectionEnd } = useSelection();
|
|
6338
6313
|
const { sampleRate } = usePlaylistView();
|
|
6339
6314
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
@@ -6347,7 +6322,7 @@ var WaveformSelection = import_react56.default.memo(function WaveformSelection2(
|
|
|
6347
6322
|
const end = preview ? preview.end : Math.max(selectionStart, selectionEnd);
|
|
6348
6323
|
if (start === end) return null;
|
|
6349
6324
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6350
|
-
|
|
6325
|
+
import_ui_components11.Selection,
|
|
6351
6326
|
{
|
|
6352
6327
|
startPosition: start * sampleRate / samplesPerPixel,
|
|
6353
6328
|
endPosition: end * sampleRate / samplesPerPixel,
|
|
@@ -6372,7 +6347,7 @@ var CustomPlayhead = ({ renderPlayhead, color, samplesPerPixel, sampleRate }) =>
|
|
|
6372
6347
|
});
|
|
6373
6348
|
};
|
|
6374
6349
|
var WaveformPlayhead = ({ renderPlayhead }) => {
|
|
6375
|
-
const theme = (0,
|
|
6350
|
+
const theme = (0, import_ui_components11.useTheme)();
|
|
6376
6351
|
const { isPlaying } = useIsPlaying();
|
|
6377
6352
|
const { selectionStart, selectionEnd } = useSelection();
|
|
6378
6353
|
const { sampleRate } = usePlaylistView();
|
|
@@ -6395,14 +6370,14 @@ var WaveformLoopRegion = import_react56.default.memo(function WaveformLoopRegion
|
|
|
6395
6370
|
"<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
6371
|
);
|
|
6397
6372
|
}
|
|
6398
|
-
const theme = (0,
|
|
6373
|
+
const theme = (0, import_ui_components11.useTheme)();
|
|
6399
6374
|
const { isLoopEnabled, loopStart, loopEnd } = useLoop();
|
|
6400
6375
|
const { setLoopRegion } = useEditorControls();
|
|
6401
6376
|
const { sampleRate } = usePlaylistView();
|
|
6402
6377
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
6403
6378
|
if (!isLoopEnabled) return null;
|
|
6404
6379
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6405
|
-
|
|
6380
|
+
import_ui_components11.TimescaleLoopRegion,
|
|
6406
6381
|
{
|
|
6407
6382
|
startPosition: Math.min(loopStart, loopEnd) * sampleRate / samplesPerPixel,
|
|
6408
6383
|
endPosition: Math.max(loopStart, loopEnd) * sampleRate / samplesPerPixel,
|
|
@@ -6421,7 +6396,7 @@ var WaveformLoopRegion = import_react56.default.memo(function WaveformLoopRegion
|
|
|
6421
6396
|
|
|
6422
6397
|
// src/components/WaveformViewOptions.tsx
|
|
6423
6398
|
var import_react57 = require("react");
|
|
6424
|
-
var
|
|
6399
|
+
var import_ui_components12 = require("@waveform-playlist/ui-components");
|
|
6425
6400
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6426
6401
|
var NO_OPTIONS = {};
|
|
6427
6402
|
var WaveformViewOptionsContext = (0, import_react57.createContext)(NO_OPTIONS);
|
|
@@ -6451,28 +6426,28 @@ var isPositive = (value) => value > 0;
|
|
|
6451
6426
|
function useResolvedViewOptions() {
|
|
6452
6427
|
var _a, _b, _c, _d, _e, _f;
|
|
6453
6428
|
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 :
|
|
6429
|
+
let waveHeight = (_a = options.waveHeight) != null ? _a : import_ui_components12.DEFAULT_WAVE_HEIGHT;
|
|
6430
|
+
let barWidth = (_b = options.barWidth) != null ? _b : import_ui_components12.DEFAULT_BAR_WIDTH;
|
|
6431
|
+
let barGap = (_c = options.barGap) != null ? _c : import_ui_components12.DEFAULT_BAR_GAP;
|
|
6457
6432
|
const roundedBars = (_d = options.roundedBars) != null ? _d : false;
|
|
6458
6433
|
const fillViewport = (_e = options.fillViewport) != null ? _e : false;
|
|
6459
6434
|
if (!isPositive(waveHeight)) {
|
|
6460
6435
|
warnOnce(
|
|
6461
|
-
`<WaveformViewOptions waveHeight> must be a positive number of pixels: ${String(waveHeight)} is replaced by ${
|
|
6436
|
+
`<WaveformViewOptions waveHeight> must be a positive number of pixels: ${String(waveHeight)} is replaced by ${import_ui_components12.DEFAULT_WAVE_HEIGHT}.`
|
|
6462
6437
|
);
|
|
6463
|
-
waveHeight =
|
|
6438
|
+
waveHeight = import_ui_components12.DEFAULT_WAVE_HEIGHT;
|
|
6464
6439
|
}
|
|
6465
6440
|
if (!isPositive(barWidth)) {
|
|
6466
6441
|
warnOnce(
|
|
6467
|
-
`<WaveformViewOptions barWidth> must be a positive number of pixels: ${String(barWidth)} is replaced by ${
|
|
6442
|
+
`<WaveformViewOptions barWidth> must be a positive number of pixels: ${String(barWidth)} is replaced by ${import_ui_components12.DEFAULT_BAR_WIDTH}.`
|
|
6468
6443
|
);
|
|
6469
|
-
barWidth =
|
|
6444
|
+
barWidth = import_ui_components12.DEFAULT_BAR_WIDTH;
|
|
6470
6445
|
}
|
|
6471
6446
|
if (Number.isNaN(barGap)) {
|
|
6472
6447
|
warnOnce(
|
|
6473
|
-
`<WaveformViewOptions barGap> must be a number of pixels: ${String(barGap)} is replaced by ${
|
|
6448
|
+
`<WaveformViewOptions barGap> must be a number of pixels: ${String(barGap)} is replaced by ${import_ui_components12.DEFAULT_BAR_GAP}.`
|
|
6474
6449
|
);
|
|
6475
|
-
barGap =
|
|
6450
|
+
barGap = import_ui_components12.DEFAULT_BAR_GAP;
|
|
6476
6451
|
}
|
|
6477
6452
|
if (!(barWidth + barGap >= 1)) {
|
|
6478
6453
|
const raised = 1 - barWidth;
|
|
@@ -6503,7 +6478,7 @@ var WaveformTimescale = import_react58.default.memo(function WaveformTimescale2(
|
|
|
6503
6478
|
"<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
6479
|
);
|
|
6505
6480
|
}
|
|
6506
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui_components13.SmartScale, { durationMs: displayDuration * 1e3, renderTick });
|
|
6507
6482
|
});
|
|
6508
6483
|
var TIMESCALE_PARTS = /* @__PURE__ */ new Set([WaveformTimescale, WaveformLoopRegion]);
|
|
6509
6484
|
var CONTROLS_PARTS = /* @__PURE__ */ new Set([WaveformTrackControls]);
|
|
@@ -6625,7 +6600,7 @@ function useWaveformFrame({
|
|
|
6625
6600
|
onClickWhileStopped
|
|
6626
6601
|
}) {
|
|
6627
6602
|
var _a;
|
|
6628
|
-
const theme = (0,
|
|
6603
|
+
const theme = (0, import_ui_components14.useTheme)();
|
|
6629
6604
|
const { setScrollContainer } = usePlaybackControls();
|
|
6630
6605
|
const { sampleRate } = usePlaylistView();
|
|
6631
6606
|
const { waveHeight, barWidth, barGap, roundedBars, progressBarWidth } = viewOptions;
|
|
@@ -6673,16 +6648,16 @@ function useWaveformFrame({
|
|
|
6673
6648
|
);
|
|
6674
6649
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
6675
6650
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AutomaticScrollFlag, { flagRef: automaticScrollRef }),
|
|
6676
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6651
|
+
/* @__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
6652
|
RootSeesRecordingPreviewContext,
|
|
6678
6653
|
{
|
|
6679
6654
|
value: parts.tracksOptions.recordingState !== void 0,
|
|
6680
6655
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectionPreviewContext, { value: selectionPreview, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6681
|
-
|
|
6656
|
+
import_ui_components14.Playlist,
|
|
6682
6657
|
{
|
|
6683
6658
|
className,
|
|
6684
6659
|
theme,
|
|
6685
|
-
backgroundColor: theme.playlistBackgroundColor || (0,
|
|
6660
|
+
backgroundColor: theme.playlistBackgroundColor || (0, import_ui_components14.waveformColorToCss)(theme.waveOutlineColor),
|
|
6686
6661
|
timescaleBackgroundColor: theme.timescaleBackgroundColor,
|
|
6687
6662
|
timescaleWidth: tracksFullWidth,
|
|
6688
6663
|
tracksWidth: tracksFullWidth,
|
|
@@ -6806,7 +6781,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6806
6781
|
trackClipPeaks,
|
|
6807
6782
|
track.id === recordingTrackId ? recordingChannelCount : 0
|
|
6808
6783
|
);
|
|
6809
|
-
m.set(track.id, waveHeight * maxChannels + (showClipHeaders ?
|
|
6784
|
+
m.set(track.id, waveHeight * maxChannels + (showClipHeaders ? import_ui_components15.CLIP_HEADER_HEIGHT : 0));
|
|
6810
6785
|
});
|
|
6811
6786
|
return m;
|
|
6812
6787
|
}, [
|
|
@@ -6882,7 +6857,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6882
6857
|
},
|
|
6883
6858
|
onClickWhileStopped: setCurrentTime
|
|
6884
6859
|
});
|
|
6885
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
6860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_ui_components15.DevicePixelRatioProvider, { children: [
|
|
6886
6861
|
frame,
|
|
6887
6862
|
(spectrogram == null ? void 0 : spectrogram.SettingsModal) && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
|
|
6888
6863
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -6908,7 +6883,7 @@ var WaveformRoot = ({ className, children }) => {
|
|
|
6908
6883
|
var import_react63 = __toESM(require("react"));
|
|
6909
6884
|
var import_react64 = require("@dnd-kit/react");
|
|
6910
6885
|
var import_modifiers2 = require("@dnd-kit/abstract/modifiers");
|
|
6911
|
-
var
|
|
6886
|
+
var import_ui_components16 = require("@waveform-playlist/ui-components");
|
|
6912
6887
|
|
|
6913
6888
|
// src/AnnotationIntegrationContext.tsx
|
|
6914
6889
|
var import_react61 = require("react");
|
|
@@ -7004,7 +6979,7 @@ var WaveformAnnotationBoxes = import_react63.default.memo(function WaveformAnnot
|
|
|
7004
6979
|
const { sampleRate } = usePlaylistView();
|
|
7005
6980
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
7006
6981
|
const { touchOptimized } = useClipInteraction();
|
|
7007
|
-
const theme = (0,
|
|
6982
|
+
const theme = (0, import_ui_components16.useTheme)();
|
|
7008
6983
|
const shownAnnotations = useAnnotationsWithPreview(annotations, annotationPreview);
|
|
7009
6984
|
const sensors = useDragSensors({ touchOptimized });
|
|
7010
6985
|
const { onDragStart, onDragMove, onDragEnd } = useAnnotationDragHandlers({
|
|
@@ -7124,7 +7099,7 @@ var WaveformEditor = (props) => composeWaveform(__spreadProps(__spreadValues({},
|
|
|
7124
7099
|
|
|
7125
7100
|
// src/components/MediaElementWaveformRoot.tsx
|
|
7126
7101
|
var import_react66 = require("react");
|
|
7127
|
-
var
|
|
7102
|
+
var import_ui_components17 = require("@waveform-playlist/ui-components");
|
|
7128
7103
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7129
7104
|
var ONE_ROW = [{ id: MEDIA_ELEMENT_TRACK_ID, kind: "audio" }];
|
|
7130
7105
|
var ONE_EMPTY_ROW = [[]];
|
|
@@ -7155,7 +7130,7 @@ var MediaElementWaveformRoot = ({
|
|
|
7155
7130
|
const channels = getTrackChannelCount(rowPeaks[index], 0);
|
|
7156
7131
|
trackHeightById.set(
|
|
7157
7132
|
row.id,
|
|
7158
|
-
waveHeight * channels + (showClipHeaders ?
|
|
7133
|
+
waveHeight * channels + (showClipHeaders ? import_ui_components17.CLIP_HEADER_HEIGHT : 0)
|
|
7159
7134
|
);
|
|
7160
7135
|
});
|
|
7161
7136
|
return {
|
|
@@ -7192,7 +7167,7 @@ var MediaElementWaveformRoot = ({
|
|
|
7192
7167
|
controlsWidth: 0,
|
|
7193
7168
|
onClickWhileStopped: collapseSelectionAt
|
|
7194
7169
|
});
|
|
7195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui_components17.DevicePixelRatioProvider, { children: frame });
|
|
7196
7171
|
};
|
|
7197
7172
|
|
|
7198
7173
|
// src/components/MediaElementWaveform.tsx
|
|
@@ -7285,7 +7260,7 @@ var import_react_dom3 = require("react-dom");
|
|
|
7285
7260
|
var import_react69 = require("@dnd-kit/react");
|
|
7286
7261
|
var import_modifiers3 = require("@dnd-kit/abstract/modifiers");
|
|
7287
7262
|
var import_core15 = require("@waveform-playlist/core");
|
|
7288
|
-
var
|
|
7263
|
+
var import_ui_components18 = require("@waveform-playlist/ui-components");
|
|
7289
7264
|
|
|
7290
7265
|
// src/modifiers/ClipCollisionModifier.ts
|
|
7291
7266
|
var import_abstract = require("@dnd-kit/abstract");
|
|
@@ -7365,8 +7340,8 @@ var ClipInteractionProvider = ({
|
|
|
7365
7340
|
const { sampleRate } = usePlaylistView();
|
|
7366
7341
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
7367
7342
|
const { tracks } = usePlaylistTimeline();
|
|
7368
|
-
const { setSelectedTrackId, reorderTrack,
|
|
7369
|
-
const beatsAndBars = (0,
|
|
7343
|
+
const { setSelectedTrackId, reorderTrack, setTrackDragPreview } = useEditorControls();
|
|
7344
|
+
const beatsAndBars = (0, import_ui_components18.useBeatsAndBars)();
|
|
7370
7345
|
const useBeatsSnap = snap && beatsAndBars != null && beatsAndBars.scaleMode === "beats" && beatsAndBars.snapTo !== "off";
|
|
7371
7346
|
const useTimescaleSnap = snap && !useBeatsSnap;
|
|
7372
7347
|
const snapSamplePosition = (0, import_react68.useMemo)(() => {
|
|
@@ -7380,7 +7355,7 @@ var ClipInteractionProvider = ({
|
|
|
7380
7355
|
};
|
|
7381
7356
|
}
|
|
7382
7357
|
if (useTimescaleSnap) {
|
|
7383
|
-
const gridSamples = Math.round((0,
|
|
7358
|
+
const gridSamples = Math.round((0, import_ui_components18.getScaleInfo)(samplesPerPixel).smallStep / 1e3 * sampleRate);
|
|
7384
7359
|
return (samplePos) => Math.round(samplePos / gridSamples) * gridSamples;
|
|
7385
7360
|
}
|
|
7386
7361
|
return void 0;
|
|
@@ -7394,13 +7369,11 @@ var ClipInteractionProvider = ({
|
|
|
7394
7369
|
onDragMove,
|
|
7395
7370
|
onDragEnd
|
|
7396
7371
|
} = useClipDragHandlers({ samplesPerPixel, snapSamplePosition });
|
|
7397
|
-
const trackReorderDragActiveRef = import_react68.default.useRef(false);
|
|
7398
7372
|
const onDragStart = import_react68.default.useCallback(
|
|
7399
7373
|
(event) => {
|
|
7400
7374
|
var _a, _b;
|
|
7401
7375
|
const data = (_b = (_a = event.operation) == null ? void 0 : _a.source) == null ? void 0 : _b.data;
|
|
7402
7376
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7403
|
-
trackReorderDragActiveRef.current = true;
|
|
7404
7377
|
if (data.trackId) setSelectedTrackId(data.trackId);
|
|
7405
7378
|
return;
|
|
7406
7379
|
}
|
|
@@ -7418,7 +7391,6 @@ var ClipInteractionProvider = ({
|
|
|
7418
7391
|
var _a;
|
|
7419
7392
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7420
7393
|
if ((data == null ? void 0 : data.kind) !== "track-reorder" || !data.trackId) return;
|
|
7421
|
-
if (!trackReorderDragActiveRef.current) return;
|
|
7422
7394
|
const sortable = event.operation.source.sortable;
|
|
7423
7395
|
if (!sortable) return;
|
|
7424
7396
|
const trackId = data.trackId;
|
|
@@ -7434,12 +7406,10 @@ var ClipInteractionProvider = ({
|
|
|
7434
7406
|
var _a;
|
|
7435
7407
|
const data = (_a = event.operation.source) == null ? void 0 : _a.data;
|
|
7436
7408
|
if ((data == null ? void 0 : data.kind) === "track-reorder") {
|
|
7437
|
-
trackReorderDragActiveRef.current = false;
|
|
7438
7409
|
const sortable = event.operation.source.sortable;
|
|
7439
7410
|
const trackId = data.trackId;
|
|
7440
7411
|
const moves = !event.canceled && trackId && sortable && sortable.index !== sortable.initialIndex;
|
|
7441
7412
|
(0, import_react_dom3.flushSync)(() => {
|
|
7442
|
-
bumpTrackReorderEpoch();
|
|
7443
7413
|
setTrackDragPreview(null);
|
|
7444
7414
|
if (moves) reorderTrack(trackId, sortable.index);
|
|
7445
7415
|
});
|
|
@@ -7447,7 +7417,7 @@ var ClipInteractionProvider = ({
|
|
|
7447
7417
|
}
|
|
7448
7418
|
onDragEnd(event);
|
|
7449
7419
|
},
|
|
7450
|
-
[onDragEnd, reorderTrack,
|
|
7420
|
+
[onDragEnd, reorderTrack, setTrackDragPreview]
|
|
7451
7421
|
);
|
|
7452
7422
|
const modifiers = (0, import_react68.useMemo)(() => {
|
|
7453
7423
|
const mods = [import_modifiers3.RestrictToHorizontalAxis];
|
|
@@ -7466,7 +7436,7 @@ var ClipInteractionProvider = ({
|
|
|
7466
7436
|
mods.push(
|
|
7467
7437
|
SnapToGridModifier.configure({
|
|
7468
7438
|
mode: "timescale",
|
|
7469
|
-
gridSamples: Math.round((0,
|
|
7439
|
+
gridSamples: Math.round((0, import_ui_components18.getScaleInfo)(samplesPerPixel).smallStep / 1e3 * sampleRate),
|
|
7470
7440
|
samplesPerPixel
|
|
7471
7441
|
})
|
|
7472
7442
|
);
|