@hyperframes/studio 0.9.15 → 0.9.16

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.
Files changed (33) hide show
  1. package/dist/assets/{hyperframes-player-bkb0-LEY.js → hyperframes-player-Bb-Fbf5k.js} +1 -1
  2. package/dist/assets/{index-DfsIam9M.js → index-BZuKog_A.js} +137 -137
  3. package/dist/assets/{index-RUPGNyct.css → index-CNZk2EFC.css} +1 -1
  4. package/dist/assets/{index-D5zessN9.js → index-Cap2SGKw.js} +1 -1
  5. package/dist/index.d.ts +17 -7
  6. package/dist/index.html +2 -2
  7. package/dist/index.js +112 -55
  8. package/dist/styles.css +1 -1
  9. package/package.json +8 -8
  10. package/src/components/editor/DomEditOverlay.tsx +3 -1
  11. package/src/components/editor/MarqueeOverlay.tsx +12 -4
  12. package/src/components/editor/marqueeCommit.test.tsx +137 -4
  13. package/src/components/editor/marqueeCommit.ts +30 -16
  14. package/src/components/editor/previewReadOnly.overlay.test.tsx +1 -1
  15. package/src/editorGesturesExports.test.tsx +10 -4
  16. package/src/hooks/useDomSelection.test.ts +90 -9
  17. package/src/hooks/useDomSelection.ts +21 -9
  18. package/src/hooks/useDomSelectionTypes.ts +5 -1
  19. package/src/hooks/useStudioUrlState.ts +3 -2
  20. package/src/hooks/useTimelineSelectionPreviewSync.test.tsx +6 -2
  21. package/src/hooks/useTimelineSelectionPreviewSync.ts +3 -2
  22. package/src/index.ts +6 -1
  23. package/src/player/components/TimelineCanvas.tsx +11 -3
  24. package/src/player/components/TimelineProvider.tsx +2 -2
  25. package/src/player/components/timelineMarquee.test.ts +68 -0
  26. package/src/player/components/timelineMarquee.ts +17 -5
  27. package/src/player/components/timelineMarqueeCommit.ts +74 -0
  28. package/src/player/components/useTimelineRangeSelection.test.tsx +98 -4
  29. package/src/player/components/useTimelineRangeSelection.ts +53 -103
  30. package/src/styles/theme.css +1 -0
  31. package/src/utils/marqueeGeometry.test.ts +18 -1
  32. package/src/utils/marqueeGeometry.ts +20 -0
  33. package/src/utils/studioUrlState.test.ts +1 -1
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-DfsIam9M.js";/*!
1
+ import{n as Qi}from"./index-BZuKog_A.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public
package/dist/index.d.ts CHANGED
@@ -1538,6 +1538,15 @@ interface Rect$1 {
1538
1538
  width: number;
1539
1539
  height: number;
1540
1540
  }
1541
+ type MarqueeSelectionMode = "replace" | "add" | "subtract";
1542
+ interface MarqueeBand extends Rect$1 {
1543
+ mode: MarqueeSelectionMode;
1544
+ }
1545
+ interface MarqueeModifiers {
1546
+ shiftKey: boolean;
1547
+ altKey: boolean;
1548
+ }
1549
+ declare function resolveMarqueeMode(modifiers: MarqueeModifiers, base?: MarqueeSelectionMode): MarqueeSelectionMode;
1541
1550
 
1542
1551
  type TimelineSnapType = "beat" | "playhead" | "clip-edge" | "grid";
1543
1552
  interface TimelineSnapTarget {
@@ -1835,7 +1844,7 @@ type TimelineCanvasState = Omit<TimelineLaneBaseProps, "setRangeSelection" | "se
1835
1844
  majorTickInterval: number;
1836
1845
  tickFrameRate: number | undefined;
1837
1846
  rangeSelection: TimelineRangeSelection | null;
1838
- marqueeRect: Rect$1 | null;
1847
+ marqueeRect: MarqueeBand | null;
1839
1848
  resizingClip: ResizingClipState | null;
1840
1849
  isScrubbing: boolean;
1841
1850
  playheadRef: React.RefObject<HTMLDivElement | null>;
@@ -3681,7 +3690,7 @@ declare function useDomEditSession({ projectId, activeCompPath, compIdToSrc, cap
3681
3690
  buildDomSelectionFromTarget: (target: HTMLElement, options?: ResolveDomSelectionOptions) => Promise<DomEditSelection | null>;
3682
3691
  buildDomSelectionForTimelineElement: (element: TimelineElement) => Promise<DomEditSelection | null>;
3683
3692
  updateDomEditHoverSelection: (selection: DomEditSelection | null) => void;
3684
- applyMarqueeSelection: (selections: DomEditSelection[], additive: boolean) => DomSelectionResult;
3693
+ applyMarqueeSelection: (selections: DomEditSelection[], mode: MarqueeSelectionMode) => DomSelectionResult;
3685
3694
  resolveImportedFontAsset: (fontFamilyValue: string) => ImportedFontAsset | null;
3686
3695
  setAgentModalOpen: react.Dispatch<react.SetStateAction<boolean>>;
3687
3696
  setAgentPromptSelectionContext: react.Dispatch<react.SetStateAction<string | undefined>>;
@@ -3923,7 +3932,7 @@ interface DomEditOverlayProps {
3923
3932
  onStyleCommit?: (property: string, value: string) => Promise<unknown> | void;
3924
3933
  recordingState?: GestureRecordingState;
3925
3934
  onToggleRecording?: () => void;
3926
- onMarqueeSelect?: (selections: DomEditSelection[], additive: boolean) => DomSelectionResult | void;
3935
+ onMarqueeSelect?: (selections: DomEditSelection[], mode: MarqueeSelectionMode) => DomSelectionResult | void;
3927
3936
  /**
3928
3937
  * Delete the selected canvas element.
3929
3938
  * Wire to handleDomEditElementDelete from useDomEditActionsContext —
@@ -4095,10 +4104,11 @@ interface MarqueeGesturesDeps<T = DomEditSelection> {
4095
4104
  iframeRef: React.RefObject<HTMLIFrameElement | null>;
4096
4105
  overlayRef: React.RefObject<HTMLDivElement | null>;
4097
4106
  activeCompositionPathRef: React.RefObject<string | null>;
4098
- onMarqueeSelectRef: React.RefObject<((selections: T[], additive: boolean) => DomSelectionResult | void) | undefined>;
4107
+ onMarqueeSelectRef: React.RefObject<((selections: T[], mode: MarqueeSelectionMode) => DomSelectionResult | void) | undefined>;
4099
4108
  /** Turns the elements a drag touched into picks; without it, Studio's edit selections. */
4100
4109
  resolveHits?: (elements: HTMLElement[]) => T[] | Promise<T[]>;
4101
4110
  selectionRef?: React.RefObject<DomEditSelection | null>;
4111
+ groupSelectionsRef?: React.RefObject<DomEditSelection[]>;
4102
4112
  /** Studio's pointer handling, for the events that are not part of a marquee. */
4103
4113
  gestures?: {
4104
4114
  onPointerMove: (event: React.PointerEvent<HTMLDivElement>) => void;
@@ -4107,7 +4117,7 @@ interface MarqueeGesturesDeps<T = DomEditSelection> {
4107
4117
  };
4108
4118
  }
4109
4119
  interface MarqueeGestures {
4110
- marqueeRect: Rect$1 | null;
4120
+ marqueeRect: MarqueeBand | null;
4111
4121
  candidateRects: Rect$1[];
4112
4122
  /** Starts a marquee at this press; the host has decided it landed on empty canvas. */
4113
4123
  begin: (event: React.PointerEvent<HTMLElement>) => void;
@@ -4124,7 +4134,7 @@ interface MarqueeOverlayProps {
4124
4134
  /** Elements the marquee currently intersects — outlined live before mouse-up. */
4125
4135
  candidateRects: Rect$1[];
4126
4136
  /** The marquee drag rectangle itself, or null when not marquee-selecting. */
4127
- marqueeRect: Rect$1 | null;
4137
+ marqueeRect: MarqueeBand | null;
4128
4138
  }
4129
4139
  /**
4130
4140
  * The marquee selection visuals: a live "candidate" outline on each element the
@@ -4468,4 +4478,4 @@ declare function buildStudioTools(depsRef: {
4468
4478
  readonly current: StudioAgentToolsDeps;
4469
4479
  }): ModelContextTool[];
4470
4480
 
4471
- export { type AgentModalAnchorPoint, type AgentPromptElementInfo, AskAgentModal, type AskAgentModalProps, AudioMeterStrip, type AudioMeterStripProps, AudioWaveform, type AudioWaveformProps, type BlockedTimelineEditIntent, type CanEditTimelineElement, ColorField, type Combo, CompositionBreadcrumb, type CompositionDimensions, type CompositionLevel, CompositionThumbnail, ConnectedDomEditOverlay, type ConnectedDomEditOverlayProps, DEFAULT_SHORTCUT_SECTIONS, DEFAULT_STUDIO_KEYS, Dock, type DockController, type DomEditCapabilities, type DomEditCommitDeclineReason, type DomEditCommitOutcome, type DomEditGroupPathOffsetCommit, DomEditOverlay, type DomEditOverlayProps, DomEditProvider, type DomEditSelection, type DomEditZOrder, type DomGeometryCommits, type EditHistoryHandle, EditorShell, type EditorShellProps, type ExternalFileChangeBlockedState, type ExternalFileChangeCoordinatorHandle, ExternalFileConflictBanner, type FadeEdge, type FadeHandleBox, type FadeHandleClipBox, type FfmpegStatus, FileTree, GradientField, GridOverlay, ImageThumbnail, type ImageThumbnailProps, LayersPanel, type LayersPanelHost, type LinkShortcutCallbacks, type MarqueeGestures, type MarqueeGesturesDeps, MarqueeOverlay, type MarqueeOverlayProps, type Rect$1 as MarqueeRect, type ModelContextTool, NLEPreview, type PanelId, type PatchOperation, type PersistedRenderSettings, type PickedElement, type PlaybackHealth, PlayerControls, type PlayerHandle, type PlayerHandleElement, type PlayerHandleListener, type PlayerHandleTimeListener, type DomEditCompositionRect as PreviewCompositionRect, type PreviewCopies, type PreviewFacts, PreviewGuides, PreviewOverlayProvider, type PreviewOverlayProviderProps, type PreviewPromotion, type PreviewQualityChosenBy, PreviewReadOnlyProvider, type PreviewSnapPreferences, PropertyPanel, type RenderJob, RenderQueue, type RenderQueueProps, type ResolutionPreset, SNAP_THRESHOLD_PX, type ShortcutHint, type ShortcutSection, ShortcutsButton, type ShortcutsButtonProps, type SnapContext, type SnapEdge, type SnapGuide, SnapGuideOverlay, type SnapGuideOverlayProps, type SnapGuidesState, type Rect as SnapRect, type SnapResult, type SnapTarget, SnapToolbar, SourceEditor, type SpacingGuide, type StartRenderOptions, type StudioAgentToolsDeps, StudioApp, StudioFileConflictError, type StudioKeyAction, type StudioKeys, type StudioLookSnapshot, type StudioPendingEditsDrainResult, TRACK_H, type ThumbnailPriority, type ThumbnailStill, Timeline, TimelineClipMenu, type TimelineClipMenuItem, type TimelineClipRenderContext, type TimelineEditCallbacks, type TimelineEditOutcome, type TimelineEditPermission, TimelineEditPopover, TimelineEditProvider, type TimelineElement, TimelineEmptyStatePart, TimelineFrame, TimelineGapMenu, TimelineHistoryButtons, type TimelineHistoryButtonsProps, TimelineKeyframeMenu, TimelineLanes, TimelineOverlays, TimelinePane, type TimelinePaneProps, TimelinePlayhead, TimelineProvider, TimelineRazorGuide, TimelineRuler, TimelineShortcutHint, type TimelineTheme, type TimelineTimeRange$1 as TimelineTimeRange, TimelineToolbar, type TimelineToolbarProps, type TimelineTrackPadding, type TimelineZIndexReorderCommit, type ToolResult, type UseClipboardOptions, type UseDomEditSessionParams, type UseDomGeometryCommitOptions, type UseDomStyleCommitOptions, type UseEditHistoryActionsOptions, type UsePersistentEditHistoryOptions, type UsePreviewPersistenceParams, type UseProjectFileWriterOptions, type UseRenderClipContentOptions, type UseThumbnailStillOptions, type UseTimelineEditingOptions, VideoThumbnail, type ZOrderAction, announcePreviewDocumentLoaded, applyPatch, buildCompositionSnapTarget, buildGridSnapEdges, buildPickerAgentContextPreview, buildPickerAgentPrompt, buildShortcutSections, buildStudioTools, cancelNewestStudioWaitingPress, collectSnapContext, collectStudioLookScene, currentTimelineRange, dispatchLinkShortcut, displayTrackOrder, extractSnapTargets, fadeHandleBoxes, findElementBlock, flushStudioPendingEdits, formatCombo, formatTime, getPersistedRenderSettings, getStudioKeys, liveTime, matchCombo, mergeStyleIntoTag, openAudioGainDialog, parseCombo, parseStyleString, persistRenderSettings, resolveDomEditSelection, resolveEquidistanceGuides, resolveGuideLineRect, resolveIframe, resolveSnapAdjustment, resolveSourceFile, revertNewestStudioPendingEdit, setStudioKeys, snapEngagedForTravel, studioKeyClash, useAudioGainDialogStore, useAudioMetersVisible, useClipboard, useCompositionStack, useDockLayoutStore, useDomEditSelectionContext, useDomEditSession, useDomEditZOrder, useDomGeometryCommit, useDomStyleCommit, useEditHistoryActions, useElementPicker, useLivePreviewIframe, useMarqueeGestures, usePersistentEditHistory, usePlayerHandle, usePlayerStore, usePreviewCompositionRect, usePreviewGuidesStore, usePreviewIframeStore, usePreviewOverlayContext, usePreviewPersistence, useProjectFileWriter, useRenderClipContent, useRenderQueue, useStudioKeys, useThumbnailStill, useTimelineContext, useTimelineEditing, useTimelinePlayer, zoomTimelineToRange };
4481
+ export { type AgentModalAnchorPoint, type AgentPromptElementInfo, AskAgentModal, type AskAgentModalProps, AudioMeterStrip, type AudioMeterStripProps, AudioWaveform, type AudioWaveformProps, type BlockedTimelineEditIntent, type CanEditTimelineElement, ColorField, type Combo, CompositionBreadcrumb, type CompositionDimensions, type CompositionLevel, CompositionThumbnail, ConnectedDomEditOverlay, type ConnectedDomEditOverlayProps, DEFAULT_SHORTCUT_SECTIONS, DEFAULT_STUDIO_KEYS, Dock, type DockController, type DomEditCapabilities, type DomEditCommitDeclineReason, type DomEditCommitOutcome, type DomEditGroupPathOffsetCommit, DomEditOverlay, type DomEditOverlayProps, DomEditProvider, type DomEditSelection, type DomEditZOrder, type DomGeometryCommits, type EditHistoryHandle, EditorShell, type EditorShellProps, type ExternalFileChangeBlockedState, type ExternalFileChangeCoordinatorHandle, ExternalFileConflictBanner, type FadeEdge, type FadeHandleBox, type FadeHandleClipBox, type FfmpegStatus, FileTree, GradientField, GridOverlay, ImageThumbnail, type ImageThumbnailProps, LayersPanel, type LayersPanelHost, type LinkShortcutCallbacks, type MarqueeBand, type MarqueeGestures, type MarqueeGesturesDeps, MarqueeOverlay, type MarqueeOverlayProps, type Rect$1 as MarqueeRect, type MarqueeSelectionMode, type ModelContextTool, NLEPreview, type PanelId, type PatchOperation, type PersistedRenderSettings, type PickedElement, type PlaybackHealth, PlayerControls, type PlayerHandle, type PlayerHandleElement, type PlayerHandleListener, type PlayerHandleTimeListener, type DomEditCompositionRect as PreviewCompositionRect, type PreviewCopies, type PreviewFacts, PreviewGuides, PreviewOverlayProvider, type PreviewOverlayProviderProps, type PreviewPromotion, type PreviewQualityChosenBy, PreviewReadOnlyProvider, type PreviewSnapPreferences, PropertyPanel, type RenderJob, RenderQueue, type RenderQueueProps, type ResolutionPreset, SNAP_THRESHOLD_PX, type ShortcutHint, type ShortcutSection, ShortcutsButton, type ShortcutsButtonProps, type SnapContext, type SnapEdge, type SnapGuide, SnapGuideOverlay, type SnapGuideOverlayProps, type SnapGuidesState, type Rect as SnapRect, type SnapResult, type SnapTarget, SnapToolbar, SourceEditor, type SpacingGuide, type StartRenderOptions, type StudioAgentToolsDeps, StudioApp, StudioFileConflictError, type StudioKeyAction, type StudioKeys, type StudioLookSnapshot, type StudioPendingEditsDrainResult, TRACK_H, type ThumbnailPriority, type ThumbnailStill, Timeline, TimelineClipMenu, type TimelineClipMenuItem, type TimelineClipRenderContext, type TimelineEditCallbacks, type TimelineEditOutcome, type TimelineEditPermission, TimelineEditPopover, TimelineEditProvider, type TimelineElement, TimelineEmptyStatePart, TimelineFrame, TimelineGapMenu, TimelineHistoryButtons, type TimelineHistoryButtonsProps, TimelineKeyframeMenu, TimelineLanes, TimelineOverlays, TimelinePane, type TimelinePaneProps, TimelinePlayhead, TimelineProvider, TimelineRazorGuide, TimelineRuler, TimelineShortcutHint, type TimelineTheme, type TimelineTimeRange$1 as TimelineTimeRange, TimelineToolbar, type TimelineToolbarProps, type TimelineTrackPadding, type TimelineZIndexReorderCommit, type ToolResult, type UseClipboardOptions, type UseDomEditSessionParams, type UseDomGeometryCommitOptions, type UseDomStyleCommitOptions, type UseEditHistoryActionsOptions, type UsePersistentEditHistoryOptions, type UsePreviewPersistenceParams, type UseProjectFileWriterOptions, type UseRenderClipContentOptions, type UseThumbnailStillOptions, type UseTimelineEditingOptions, VideoThumbnail, type ZOrderAction, announcePreviewDocumentLoaded, applyPatch, buildCompositionSnapTarget, buildGridSnapEdges, buildPickerAgentContextPreview, buildPickerAgentPrompt, buildShortcutSections, buildStudioTools, cancelNewestStudioWaitingPress, collectSnapContext, collectStudioLookScene, currentTimelineRange, dispatchLinkShortcut, displayTrackOrder, extractSnapTargets, fadeHandleBoxes, findElementBlock, flushStudioPendingEdits, formatCombo, formatTime, getPersistedRenderSettings, getStudioKeys, liveTime, matchCombo, mergeStyleIntoTag, openAudioGainDialog, parseCombo, parseStyleString, persistRenderSettings, resolveDomEditSelection, resolveEquidistanceGuides, resolveGuideLineRect, resolveIframe, resolveMarqueeMode, resolveSnapAdjustment, resolveSourceFile, revertNewestStudioPendingEdit, setStudioKeys, snapEngagedForTravel, studioKeyClash, useAudioGainDialogStore, useAudioMetersVisible, useClipboard, useCompositionStack, useDockLayoutStore, useDomEditSelectionContext, useDomEditSession, useDomEditZOrder, useDomGeometryCommit, useDomStyleCommit, useEditHistoryActions, useElementPicker, useLivePreviewIframe, useMarqueeGestures, usePersistentEditHistory, usePlayerHandle, usePlayerStore, usePreviewCompositionRect, usePreviewGuidesStore, usePreviewIframeStore, usePreviewOverlayContext, usePreviewPersistence, useProjectFileWriter, useRenderClipContent, useRenderQueue, useStudioKeys, useThumbnailStill, useTimelineContext, useTimelineEditing, useTimelinePlayer, zoomTimelineToRange };
package/dist/index.html CHANGED
@@ -14,8 +14,8 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-DfsIam9M.js"></script>
18
- <link rel="stylesheet" crossorigin href="/assets/index-RUPGNyct.css">
17
+ <script type="module" crossorigin src="/assets/index-BZuKog_A.js"></script>
18
+ <link rel="stylesheet" crossorigin href="/assets/index-CNZk2EFC.css">
19
19
  </head>
20
20
  <body>
21
21
  <div data-hf-id="hf-aph5" id="root"></div>
package/dist/index.js CHANGED
@@ -11736,6 +11736,11 @@ import { useRef as useRef14, useState as useState10, useCallback as useCallback1
11736
11736
  function rectsOverlap(a, b) {
11737
11737
  return a.left < b.left + b.width && a.left + a.width > b.left && a.top < b.top + b.height && a.top + a.height > b.top;
11738
11738
  }
11739
+ function resolveMarqueeMode(modifiers, base2 = "replace") {
11740
+ if (modifiers.altKey) return "subtract";
11741
+ if (modifiers.shiftKey) return "add";
11742
+ return base2;
11743
+ }
11739
11744
 
11740
11745
  // src/player/lib/timelineClipIndex.ts
11741
11746
  function clipInterval(element, ordinal) {
@@ -11916,12 +11921,21 @@ function getMarqueeClipCandidates(input) {
11916
11921
  }
11917
11922
  return candidates;
11918
11923
  }
11924
+ function survivingPrimary(ids, basePrimary) {
11925
+ if (basePrimary && ids.has(basePrimary)) return basePrimary;
11926
+ for (const id of ids) return id;
11927
+ return null;
11928
+ }
11919
11929
  function computeMarqueeSelection(input) {
11930
+ const subtract = input.mode === "subtract";
11920
11931
  const ids = new Set(input.baseSelection ?? []);
11921
11932
  let primaryId = null;
11922
11933
  for (const clip of input.clips) {
11923
11934
  const rect = getTimelineClipRect(clip, input.rowGeometry, input.pps, input.contentOrigin);
11924
- if (rect && rectsOverlap(rect, input.marquee)) {
11935
+ if (!rect || !rectsOverlap(rect, input.marquee)) continue;
11936
+ if (subtract) {
11937
+ ids.delete(clip.id);
11938
+ } else {
11925
11939
  ids.add(clip.id);
11926
11940
  primaryId = clip.id;
11927
11941
  }
@@ -11929,7 +11943,7 @@ function computeMarqueeSelection(input) {
11929
11943
  return { ids, primaryId };
11930
11944
  }
11931
11945
 
11932
- // src/player/components/useTimelineRangeSelection.ts
11946
+ // src/player/components/timelineMarqueeCommit.ts
11933
11947
  function snapshotSelection() {
11934
11948
  const s = usePlayerStore.getState();
11935
11949
  const ids = new Set(s.selectedElementIds);
@@ -11944,7 +11958,7 @@ function toMarqueeClips(elements) {
11944
11958
  track: el.track
11945
11959
  }));
11946
11960
  }
11947
- function commitMarqueeSelection(rect, additive, marquee, clipIndex, rowGeometry, pps, contentOrigin) {
11961
+ function commitMarqueeSelection(rect, mode, marquee, clipIndex, rowGeometry, pps, contentOrigin) {
11948
11962
  const candidates = getMarqueeClipCandidates({
11949
11963
  clipIndex,
11950
11964
  rowGeometry,
@@ -11958,12 +11972,18 @@ function commitMarqueeSelection(rect, additive, marquee, clipIndex, rowGeometry,
11958
11972
  pps,
11959
11973
  contentOrigin,
11960
11974
  marquee: rect,
11961
- baseSelection: additive ? marquee.baseIds : void 0
11975
+ baseSelection: mode === "replace" ? void 0 : marquee.baseIds,
11976
+ mode
11962
11977
  });
11963
11978
  const store = usePlayerStore.getState();
11964
- store.setSelectedElementId(primaryId ?? (additive ? marquee.basePrimary : null));
11979
+ let primary = primaryId;
11980
+ if (mode === "add") primary ??= marquee.basePrimary;
11981
+ if (mode === "subtract") primary = survivingPrimary(ids, marquee.basePrimary);
11982
+ store.setSelectedElementId(primary);
11965
11983
  store.setSelectedElementIds(ids);
11966
11984
  }
11985
+
11986
+ // src/player/components/useTimelineRangeSelection.ts
11967
11987
  function canStartPointerGesture(event, activePointerId, sessionEpoch) {
11968
11988
  return event.button === 0 && activePointerId === null && sessionEpoch === usePlayerStore.getState().timelineSessionEpoch;
11969
11989
  }
@@ -12004,9 +12024,7 @@ function useTimelineRangeSelection({
12004
12024
  );
12005
12025
  const marqueeRef = useRef14(null);
12006
12026
  const [marqueeRect, setMarqueeRect] = useState10(null);
12007
- const marqueePointerRef = useRef14(
12008
- null
12009
- );
12027
+ const marqueePointerRef = useRef14(null);
12010
12028
  const marqueeScrollRaf = useRef14(0);
12011
12029
  const toContentPoint = useCallback12(
12012
12030
  (clientX, clientY) => {
@@ -12021,7 +12039,7 @@ function useTimelineRangeSelection({
12021
12039
  [scrollRef]
12022
12040
  );
12023
12041
  const applyMarqueeAtClient = useCallback12(
12024
- (clientX, clientY, shiftKey) => {
12042
+ (clientX, clientY, modifiers) => {
12025
12043
  const marquee = marqueeRef.current;
12026
12044
  if (!marquee || !isGestureSessionCurrent()) return;
12027
12045
  const point = toContentPoint(clientX, clientY);
@@ -12031,11 +12049,11 @@ function useTimelineRangeSelection({
12031
12049
  }
12032
12050
  marquee.active = true;
12033
12051
  const rect = getMarqueeRect(marquee.originX, marquee.originY, point.x, point.y);
12034
- setMarqueeRect(rect);
12035
- const additive = marquee.additive || shiftKey;
12052
+ const mode = resolveMarqueeMode(modifiers, marquee.mode);
12053
+ setMarqueeRect({ ...rect, mode });
12036
12054
  commitMarqueeSelection(
12037
12055
  rect,
12038
- additive,
12056
+ mode,
12039
12057
  marquee,
12040
12058
  clipIndex,
12041
12059
  rowGeometryRef.current,
@@ -12061,12 +12079,12 @@ function useTimelineRangeSelection({
12061
12079
  return;
12062
12080
  }
12063
12081
  if (!applyTimelineAutoScrollStep(scroll, pointer.clientX, pointer.clientY)) return;
12064
- applyMarqueeAtClient(pointer.clientX, pointer.clientY, pointer.shiftKey);
12082
+ applyMarqueeAtClient(pointer.clientX, pointer.clientY, pointer);
12065
12083
  marqueeScrollRaf.current = requestAnimationFrame(stepMarqueeAutoScroll);
12066
12084
  }, [scrollRef, applyMarqueeAtClient, isGestureSessionCurrent]);
12067
12085
  const syncMarqueeAutoScroll = useCallback12(
12068
- (clientX, clientY, shiftKey) => {
12069
- marqueePointerRef.current = { clientX, clientY, shiftKey };
12086
+ (clientX, clientY, modifiers) => {
12087
+ marqueePointerRef.current = { clientX, clientY, ...modifiers };
12070
12088
  const action = resolveTimelineAutoScrollLoopAction(
12071
12089
  scrollRef.current,
12072
12090
  clientX,
@@ -12108,17 +12126,20 @@ function useTimelineRangeSelection({
12108
12126
  },
12109
12127
  [isDragging, seekFromX]
12110
12128
  );
12111
- const beginMarquee = useCallback12((point, additive) => {
12112
- const base2 = snapshotSelection();
12113
- marqueeRef.current = {
12114
- originX: point.x,
12115
- originY: point.y,
12116
- baseIds: base2.ids,
12117
- basePrimary: base2.primary,
12118
- additive,
12119
- active: false
12120
- };
12121
- }, []);
12129
+ const beginMarquee = useCallback12(
12130
+ (point, mode) => {
12131
+ const base2 = snapshotSelection();
12132
+ marqueeRef.current = {
12133
+ originX: point.x,
12134
+ originY: point.y,
12135
+ baseIds: base2.ids,
12136
+ basePrimary: base2.primary,
12137
+ mode,
12138
+ active: false
12139
+ };
12140
+ },
12141
+ []
12142
+ );
12122
12143
  const handlePointerDown = useCallback12(
12123
12144
  (e) => {
12124
12145
  if (!canStartPointerGesture(e, activePointerIdRef.current, sessionEpochRef.current)) return;
@@ -12138,7 +12159,7 @@ function useTimelineRangeSelection({
12138
12159
  beginScrub(e.clientX);
12139
12160
  return;
12140
12161
  }
12141
- beginMarquee(point, e.metaKey || e.ctrlKey);
12162
+ beginMarquee(point, e.metaKey || e.ctrlKey ? "add" : "replace");
12142
12163
  },
12143
12164
  [beginRangeSelection, beginScrub, beginMarquee, scrollRef, setShowPopover, toContentPoint]
12144
12165
  );
@@ -12193,8 +12214,8 @@ function useTimelineRangeSelection({
12193
12214
  }
12194
12215
  const marquee = marqueeRef.current;
12195
12216
  if (marquee) {
12196
- applyMarqueeAtClient(e.clientX, e.clientY, e.shiftKey);
12197
- if (marquee.active) syncMarqueeAutoScroll(e.clientX, e.clientY, e.shiftKey);
12217
+ applyMarqueeAtClient(e.clientX, e.clientY, e);
12218
+ if (marquee.active) syncMarqueeAutoScroll(e.clientX, e.clientY, e);
12198
12219
  return;
12199
12220
  }
12200
12221
  if (!isDragging.current) return;
@@ -12257,20 +12278,28 @@ function useTimelineRangeSelection({
12257
12278
  const handlePointerUp = useCallback12(
12258
12279
  (e) => {
12259
12280
  if (!canFinishPointerGesture(e)) return;
12281
+ const marquee = marqueeRef.current;
12282
+ if (e && marquee?.active) applyMarqueeAtClient(e.clientX, e.clientY, e);
12260
12283
  activePointerIdRef.current = null;
12261
12284
  gestureEpochRef.current = null;
12262
12285
  if (isRangeSelecting.current) {
12263
12286
  finishRangeSelection();
12264
12287
  return;
12265
12288
  }
12266
- const marquee = marqueeRef.current;
12267
12289
  if (marquee) {
12268
12290
  finishMarquee(marquee);
12269
12291
  return;
12270
12292
  }
12271
12293
  if (isDragging.current) finishScrub();
12272
12294
  },
12273
- [canFinishPointerGesture, finishRangeSelection, finishMarquee, finishScrub, isDragging]
12295
+ [
12296
+ canFinishPointerGesture,
12297
+ finishRangeSelection,
12298
+ finishMarquee,
12299
+ finishScrub,
12300
+ isDragging,
12301
+ applyMarqueeAtClient
12302
+ ]
12274
12303
  );
12275
12304
  const cancelActiveGesture = useCallback12(
12276
12305
  (updateUi, restoreSelection) => {
@@ -25005,14 +25034,20 @@ var TimelineCanvas = memo18(function TimelineCanvas2() {
25005
25034
  "div",
25006
25035
  {
25007
25036
  "aria-hidden": "true",
25037
+ "data-marquee-mode": props.marqueeRect.mode,
25008
25038
  className: "absolute pointer-events-none",
25009
25039
  style: {
25010
25040
  left: props.marqueeRect.left,
25011
25041
  top: props.marqueeRect.top,
25012
25042
  width: props.marqueeRect.width,
25013
25043
  height: props.marqueeRect.height,
25014
- background: "var(--timeline-accent-fill)",
25015
- border: "1px dashed var(--timeline-accent-border)",
25044
+ ...props.marqueeRect.mode === "subtract" ? {
25045
+ background: "var(--timeline-danger-fill)",
25046
+ border: "1px dashed var(--timeline-danger)"
25047
+ } : {
25048
+ background: "var(--timeline-accent-fill)",
25049
+ border: "1px dashed var(--timeline-accent-border)"
25050
+ },
25016
25051
  borderRadius: 2,
25017
25052
  zIndex: 70
25018
25053
  }
@@ -37539,7 +37574,7 @@ function useMarqueeGestures(deps) {
37539
37574
  const [candidateRects, setCandidateRects] = useState45([]);
37540
37575
  const candidatesRef = useRef64(null);
37541
37576
  const commitMarquee = useCallback55(
37542
- async (rect, additive) => {
37577
+ async (rect, mode) => {
37543
37578
  const iframe = deps.iframeRef.current;
37544
37579
  const overlay = deps.overlayRef.current;
37545
37580
  if (!iframe || !overlay || !deps.onMarqueeSelectRef.current) return;
@@ -37550,7 +37585,7 @@ function useMarqueeGestures(deps) {
37550
37585
  const picks = resolveHits ? await resolveHits(elements) : await resolveDomEditSelections(elements, acp);
37551
37586
  const applySelection = deps.onMarqueeSelectRef.current;
37552
37587
  if (!applySelection) return;
37553
- const result = applySelection(picks, additive);
37588
+ const result = applySelection(picks, mode);
37554
37589
  trackMarqueeSelection(result);
37555
37590
  },
37556
37591
  [
@@ -37601,16 +37636,22 @@ function useMarqueeGestures(deps) {
37601
37636
  window.addEventListener("keydown", cancelBandBeforeHostEscape, { capture: true });
37602
37637
  return () => window.removeEventListener("keydown", cancelBandBeforeHostEscape, { capture: true });
37603
37638
  }, [cancel]);
37639
+ const isSelectedElement = useCallback55(
37640
+ (element) => deps.selectionRef?.current?.element === element || (deps.groupSelectionsRef?.current ?? []).some((s) => s.element === element),
37641
+ [deps.selectionRef, deps.groupSelectionsRef]
37642
+ );
37604
37643
  const showCandidates = useCallback55(
37605
- (rect) => {
37644
+ (rect, mode) => {
37606
37645
  const iframe = deps.iframeRef.current;
37607
37646
  const overlay = deps.overlayRef.current;
37608
37647
  if (!iframe || !overlay) return;
37609
37648
  const acp = deps.activeCompositionPathRef.current ?? "index.html";
37610
37649
  candidatesRef.current ??= collectMarqueeCandidates(iframe, overlay, acp);
37611
- setCandidateRects(hitsWithin(rect, candidatesRef.current).map((h) => h.rect));
37650
+ let hits = hitsWithin(rect, candidatesRef.current);
37651
+ if (mode === "subtract") hits = hits.filter((h) => isSelectedElement(h.element));
37652
+ setCandidateRects(hits.map((h) => h.rect));
37612
37653
  },
37613
- [deps.overlayRef, deps.iframeRef, deps.activeCompositionPathRef]
37654
+ [deps.overlayRef, deps.iframeRef, deps.activeCompositionPathRef, isSelectedElement]
37614
37655
  );
37615
37656
  const onPointerMove = useCallback55(
37616
37657
  (event) => {
@@ -37634,8 +37675,9 @@ function useMarqueeGestures(deps) {
37634
37675
  width: Math.abs(m.currentX - m.startX),
37635
37676
  height: Math.abs(m.currentY - m.startY)
37636
37677
  };
37637
- setMarqueeRect(rect);
37638
- showCandidates(rect);
37678
+ const mode = resolveMarqueeMode(event);
37679
+ setMarqueeRect({ ...rect, mode });
37680
+ showCandidates(rect, mode);
37639
37681
  return;
37640
37682
  }
37641
37683
  deps.gestures?.onPointerMove(event);
@@ -37655,10 +37697,10 @@ function useMarqueeGestures(deps) {
37655
37697
  width: Math.abs(m.currentX - m.startX),
37656
37698
  height: Math.abs(m.currentY - m.startY)
37657
37699
  },
37658
- event.shiftKey
37700
+ resolveMarqueeMode(event)
37659
37701
  );
37660
37702
  } else {
37661
- deps.onMarqueeSelectRef.current?.([], false);
37703
+ deps.onMarqueeSelectRef.current?.([], "replace");
37662
37704
  }
37663
37705
  reset();
37664
37706
  return;
@@ -37685,12 +37727,15 @@ function useMarqueeGestures(deps) {
37685
37727
  // src/components/editor/MarqueeOverlay.tsx
37686
37728
  import { Fragment as Fragment27, jsx as jsx93, jsxs as jsxs64 } from "react/jsx-runtime";
37687
37729
  function MarqueeOverlay({ candidateRects, marqueeRect }) {
37730
+ const subtracting = marqueeRect?.mode === "subtract";
37731
+ const candidateClass = subtracting ? "border-danger bg-danger/5" : "border-studio-accent bg-studio-accent/5";
37732
+ const bandClass = subtracting ? "border-danger bg-danger/10" : "border-studio-accent bg-studio-accent/10";
37688
37733
  return /* @__PURE__ */ jsxs64(Fragment27, { children: [
37689
37734
  candidateRects.map((r, i) => /* @__PURE__ */ jsx93(
37690
37735
  "div",
37691
37736
  {
37692
37737
  "aria-hidden": "true",
37693
- className: "pointer-events-none absolute rounded-xs border border-studio-accent bg-studio-accent/5",
37738
+ className: `pointer-events-none absolute rounded-xs border ${candidateClass}`,
37694
37739
  style: { left: r.left, top: r.top, width: r.width, height: r.height }
37695
37740
  },
37696
37741
  i
@@ -37699,7 +37744,8 @@ function MarqueeOverlay({ candidateRects, marqueeRect }) {
37699
37744
  "div",
37700
37745
  {
37701
37746
  "aria-hidden": "true",
37702
- className: "pointer-events-none absolute border border-dashed border-studio-accent bg-studio-accent/10",
37747
+ "data-marquee-mode": marqueeRect.mode,
37748
+ className: `pointer-events-none absolute border border-dashed ${bandClass}`,
37703
37749
  style: {
37704
37750
  left: marqueeRect.left,
37705
37751
  top: marqueeRect.top,
@@ -43603,6 +43649,7 @@ var DomEditOverlay = memo30(function DomEditOverlay2({
43603
43649
  activeCompositionPathRef,
43604
43650
  onMarqueeSelectRef,
43605
43651
  selectionRef,
43652
+ groupSelectionsRef,
43606
43653
  gestures
43607
43654
  });
43608
43655
  const selectionKey = useMemo43(() => {
@@ -50609,7 +50656,7 @@ function applyResolvedSelections(selections, applyDomSelection, applyMarqueeSele
50609
50656
  } else if (selections.length === 1) {
50610
50657
  applyDomSelection(selections[0]);
50611
50658
  } else {
50612
- applyMarqueeSelection(selections, false);
50659
+ applyMarqueeSelection(selections, "replace");
50613
50660
  }
50614
50661
  }
50615
50662
  function useTimelineSelectionPreviewSync({
@@ -80614,29 +80661,38 @@ function useDomSelection({
80614
80661
  useStudioTestHooks({ previewIframeRef, buildDomSelectionFromTarget, applyDomSelection });
80615
80662
  const applyMarqueeSelection = useCallback126(
80616
80663
  // fallow-ignore-next-line complexity
80617
- (selections, additive) => {
80618
- logSelect("marquee", { hits: selections.length, additive });
80664
+ (selections, mode) => {
80665
+ logSelect("marquee", { hits: selections.length, mode });
80619
80666
  const current2 = domEditSelectionRef.current;
80620
80667
  const currentGroup = domEditGroupSelectionsRef.current;
80668
+ const previous = seedDomEditGroupWithSelection(currentGroup, current2);
80669
+ const replace = mode === "replace";
80621
80670
  if (selections.length === 0) {
80622
- const count = seedDomEditGroupWithSelection(currentGroup, current2).length;
80623
- if (!additive) applyDomSelection(null, { revealPanel: false });
80624
- return { changed: !additive && count > 0, count: additive ? count : 0 };
80671
+ if (replace) applyDomSelection(null, { revealPanel: false });
80672
+ return { changed: replace && previous.length > 0, count: replace ? 0 : previous.length };
80625
80673
  }
80626
80674
  let nextGroup;
80627
- if (additive) {
80628
- nextGroup = seedDomEditGroupWithSelection(currentGroup, current2);
80675
+ let nextSelection;
80676
+ if (mode === "add") {
80677
+ nextGroup = previous;
80629
80678
  for (const s of selections) {
80630
80679
  if (!domEditSelectionInGroup(nextGroup, s)) nextGroup = [...nextGroup, s];
80631
80680
  }
80681
+ nextSelection = current2 ?? selections[0];
80682
+ } else if (mode === "subtract") {
80683
+ nextGroup = previous.filter((entry3) => !domEditSelectionInGroup(selections, entry3));
80684
+ if (nextGroup.length === 0) {
80685
+ applyDomSelection(null, { revealPanel: false });
80686
+ return { changed: previous.length > 0, count: 0 };
80687
+ }
80688
+ nextSelection = current2 && domEditSelectionInGroup(nextGroup, current2) ? current2 : nextGroup[0];
80632
80689
  } else {
80633
80690
  nextGroup = [];
80634
80691
  for (const s of selections) {
80635
80692
  if (!domEditSelectionInGroup(nextGroup, s)) nextGroup.push(s);
80636
80693
  }
80694
+ nextSelection = selections[0];
80637
80695
  }
80638
- const nextSelection = additive && current2 ? current2 : selections[0];
80639
- const previous = seedDomEditGroupWithSelection(currentGroup, current2);
80640
80696
  const changed = previous.length !== nextGroup.length || nextGroup.some((selection) => !domEditSelectionInGroup(previous, selection)) || !domEditSelectionsTargetSame(current2, nextSelection);
80641
80697
  domEditSelectionRef.current = nextSelection;
80642
80698
  domEditGroupSelectionsRef.current = nextGroup;
@@ -90356,7 +90412,7 @@ function useStudioUrlState({
90356
90412
  const primary = members[0];
90357
90413
  if (!primary) return applyDomSelection(null, { revealPanel: false });
90358
90414
  if (group.length === 0) return applyDomSelection(primary, { revealPanel: false });
90359
- applyMarqueeSelection(members, false);
90415
+ applyMarqueeSelection(members, "replace");
90360
90416
  });
90361
90417
  return true;
90362
90418
  },
@@ -102299,6 +102355,7 @@ export {
102299
102355
  resolveEquidistanceGuides,
102300
102356
  resolveGuideLineRect,
102301
102357
  resolveIframe,
102358
+ resolveMarqueeMode,
102302
102359
  resolveSnapAdjustment,
102303
102360
  resolveSourceFile,
102304
102361
  revertNewestStudioPendingEdit,