@remotion/studio 4.0.499 → 4.0.500

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 (132) hide show
  1. package/dist/components/AssetSelector.js +8 -6
  2. package/dist/components/AssetSelectorItem.d.ts +24 -0
  3. package/dist/components/AssetSelectorItem.js +113 -80
  4. package/dist/components/CompositionSelector.js +2 -32
  5. package/dist/components/ControlButton.js +1 -0
  6. package/dist/components/ExplorerPanel.js +2 -1
  7. package/dist/components/ExplorerPanelRef.d.ts +2 -0
  8. package/dist/components/GlobalKeybindings.js +7 -1
  9. package/dist/components/InlineAction.d.ts +2 -1
  10. package/dist/components/InlineAction.js +2 -2
  11. package/dist/components/InlineDropdown.d.ts +1 -1
  12. package/dist/components/InlineDropdown.js +3 -2
  13. package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
  14. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  15. package/dist/components/InspectorPanel/CompositionInspector.js +8 -7
  16. package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
  17. package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
  18. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
  19. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +7 -7
  20. package/dist/components/InspectorPanel/common.d.ts +17 -4
  21. package/dist/components/InspectorPanel/common.js +60 -6
  22. package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
  23. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
  24. package/dist/components/InspectorSequenceSection.js +43 -19
  25. package/dist/components/KeyboardShortcutsExplainer.js +4 -2
  26. package/dist/components/Menu/MenuItem.js +2 -1
  27. package/dist/components/MenuCompositionName.js +30 -7
  28. package/dist/components/MenuToolbar.d.ts +0 -1
  29. package/dist/components/MenuToolbar.js +8 -7
  30. package/dist/components/MobilePanel.d.ts +2 -1
  31. package/dist/components/MobilePanel.js +29 -25
  32. package/dist/components/ModalContainer.d.ts +1 -0
  33. package/dist/components/ModalContainer.js +2 -2
  34. package/dist/components/Modals.js +1 -1
  35. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  36. package/dist/components/NewComposition/DismissableModal.js +2 -2
  37. package/dist/components/NewComposition/InputDragger.d.ts +7 -0
  38. package/dist/components/NewComposition/InputDragger.js +119 -8
  39. package/dist/components/OutlineToggle.d.ts +1 -3
  40. package/dist/components/OutlineToggle.js +2 -2
  41. package/dist/components/PreviewToolbar.js +10 -4
  42. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
  43. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +44 -0
  44. package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
  45. package/dist/components/QuickSwitcher/NoResults.js +1 -0
  46. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +5 -0
  47. package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
  48. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +5 -0
  49. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +76 -12
  50. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
  51. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
  52. package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
  53. package/dist/components/QuickSwitcher/asset-search.js +42 -0
  54. package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
  55. package/dist/components/SelectedOutlineCropControls.js +299 -0
  56. package/dist/components/SelectedOutlineElement.js +83 -43
  57. package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
  58. package/dist/components/SelectedOutlineOverlay.js +130 -8
  59. package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
  60. package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
  61. package/dist/components/SidebarCollapserControls.d.ts +3 -1
  62. package/dist/components/SidebarCollapserControls.js +34 -29
  63. package/dist/components/SnappingToggle.d.ts +1 -3
  64. package/dist/components/SnappingToggle.js +2 -2
  65. package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
  66. package/dist/components/Timeline/TimelineAssetField.js +52 -100
  67. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
  68. package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
  69. package/dist/components/Timeline/TimelineColorField.js +20 -1
  70. package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
  71. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  72. package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
  73. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
  74. package/dist/components/Timeline/TimelineList.d.ts +2 -2
  75. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +7 -1
  76. package/dist/components/Timeline/TimelineSelection.d.ts +5 -5
  77. package/dist/components/Timeline/TimelineSelection.js +8 -6
  78. package/dist/components/Timeline/TimelineSequence.js +1 -5
  79. package/dist/components/Timeline/TimelineSequenceItem.js +57 -10
  80. package/dist/components/Timeline/TimelineSequencePropItem.js +27 -75
  81. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +0 -1
  82. package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
  83. package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
  84. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
  85. package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
  86. package/dist/components/Timeline/reset-selected-timeline-props.js +18 -10
  87. package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
  88. package/dist/components/Timeline/save-effect-prop.js +52 -1
  89. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
  90. package/dist/components/Timeline/timeline-asset-link.js +17 -1
  91. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
  92. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
  93. package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
  94. package/dist/components/TopPanel.js +2 -2
  95. package/dist/components/UndoRedoButtons.js +27 -5
  96. package/dist/components/composition-drop-preview.js +1 -0
  97. package/dist/components/menu-toolbar-height.d.ts +1 -0
  98. package/dist/components/menu-toolbar-height.js +4 -0
  99. package/dist/components/selected-outline-drag.d.ts +41 -4
  100. package/dist/components/selected-outline-drag.js +179 -2
  101. package/dist/components/selected-outline-geometry.d.ts +1 -0
  102. package/dist/components/selected-outline-measurement.d.ts +11 -0
  103. package/dist/components/selected-outline-measurement.js +64 -3
  104. package/dist/components/selected-outline-types.d.ts +44 -1
  105. package/dist/components/selected-outline-types.js +21 -1
  106. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
  107. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
  108. package/dist/esm/{chunk-pk1zwsn1.js → chunk-dr1y1vm3.js} +8417 -7127
  109. package/dist/esm/internals.mjs +8417 -7127
  110. package/dist/esm/previewEntry.mjs +51241 -49953
  111. package/dist/esm/renderEntry.mjs +1 -1
  112. package/dist/helpers/calculate-timeline.d.ts +2 -2
  113. package/dist/helpers/calculate-timeline.js +8 -28
  114. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
  115. package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
  116. package/dist/helpers/interactivity-enabled.d.ts +1 -0
  117. package/dist/helpers/interactivity-enabled.js +7 -2
  118. package/dist/helpers/is-mac.d.ts +1 -0
  119. package/dist/helpers/is-mac.js +4 -0
  120. package/dist/helpers/open-in-editor.d.ts +5 -1
  121. package/dist/helpers/open-in-editor.js +15 -1
  122. package/dist/helpers/sort-by-nonce-history.js +97 -19
  123. package/dist/helpers/use-keybinding.js +2 -3
  124. package/dist/helpers/use-menu-structure.js +10 -1
  125. package/dist/icons/caret.d.ts +1 -0
  126. package/dist/icons/caret.js +2 -2
  127. package/dist/icons/pen.d.ts +5 -0
  128. package/dist/icons/pen.js +8 -0
  129. package/dist/state/modals.d.ts +5 -0
  130. package/package.json +12 -12
  131. package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
  132. package/dist/helpers/get-timeline-sequence-hash.js +0 -33
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.openTimelineAssetLink = exports.getTimelineAssetLinkInfo = exports.getTimelineAssetSrcFromSchema = exports.splitRemoteSourceForMiddleEllipsis = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
+ const no_react_1 = require("remotion/no-react");
5
6
  const url_state_1 = require("../../helpers/url-state");
6
7
  const splitRemoteSourceForMiddleEllipsis = (src) => {
7
8
  const protocolEnd = src.indexOf('://');
@@ -29,6 +30,21 @@ const getTimelineAssetSrcFromSchema = (controls) => {
29
30
  };
30
31
  exports.getTimelineAssetSrcFromSchema = getTimelineAssetSrcFromSchema;
31
32
  const getTimelineAssetLinkInfo = (src) => {
33
+ if (src.startsWith(no_react_1.NoReactInternals.FILE_TOKEN)) {
34
+ const encodedAssetPath = src.slice(no_react_1.NoReactInternals.FILE_TOKEN.length);
35
+ let assetPath = encodedAssetPath;
36
+ try {
37
+ assetPath = encodedAssetPath.split('/').map(decodeURIComponent).join('/');
38
+ }
39
+ catch (_a) {
40
+ // Keep the encoded path if it contains an invalid escape sequence.
41
+ }
42
+ return {
43
+ kind: 'local',
44
+ assetPath,
45
+ title: assetPath,
46
+ };
47
+ }
32
48
  const staticBase = typeof window === 'undefined' ? null : window.remotion_staticBase;
33
49
  if (staticBase && src.startsWith(staticBase + '/')) {
34
50
  const assetPath = src.slice(staticBase.length + 1);
@@ -45,7 +61,7 @@ const getTimelineAssetLinkInfo = (src) => {
45
61
  const url = new URL(src.startsWith('//') ? 'https:' + src : src);
46
62
  return { kind: 'remote', href: src, title: url.hostname };
47
63
  }
48
- catch (_a) {
64
+ catch (_b) {
49
65
  return { kind: 'remote', href: src, title: src };
50
66
  }
51
67
  }
@@ -2,6 +2,10 @@ import type { CanUpdateSequencePropStatus, SequencePropsSubscriptionKey, TSequen
2
2
  import type { ComboboxValue } from '../NewComposition/ComboBox';
3
3
  import { type SetPropStatuses } from './save-sequence-prop';
4
4
  export declare const shouldShowFreezeFrameMenuItem: (sequence: TSequence) => boolean;
5
+ export declare const isSequenceVisibleAtTimelinePosition: ({ sequence, timelinePosition, }: {
6
+ readonly sequence: TSequence;
7
+ readonly timelinePosition: number;
8
+ }) => boolean;
5
9
  export declare const calculateSequenceFreezeFrame: ({ sequence, sequenceFrameOffset, timelinePosition, }: {
6
10
  readonly sequence: TSequence;
7
11
  readonly sequenceFrameOffset: number;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSequenceFreezeFrameMenuItem = exports.calculateSequenceFreezeFrame = exports.shouldShowFreezeFrameMenuItem = void 0;
3
+ exports.useSequenceFreezeFrameMenuItem = exports.calculateSequenceFreezeFrame = exports.isSequenceVisibleAtTimelinePosition = exports.shouldShowFreezeFrameMenuItem = void 0;
4
4
  const react_1 = require("react");
5
5
  const save_sequence_prop_1 = require("./save-sequence-prop");
6
6
  const shouldShowFreezeFrameMenuItem = (sequence) => {
7
7
  return sequence.type !== 'audio';
8
8
  };
9
9
  exports.shouldShowFreezeFrameMenuItem = shouldShowFreezeFrameMenuItem;
10
+ const isSequenceVisibleAtTimelinePosition = ({ sequence, timelinePosition, }) => {
11
+ return (timelinePosition >= sequence.from &&
12
+ timelinePosition < sequence.from + sequence.duration);
13
+ };
14
+ exports.isSequenceVisibleAtTimelinePosition = isSequenceVisibleAtTimelinePosition;
10
15
  const calculateSequenceFreezeFrame = ({ sequence, sequenceFrameOffset, timelinePosition, }) => {
11
16
  const rawFreezeFrame = Math.round(timelinePosition - sequence.from + sequenceFrameOffset);
12
17
  const minFrame = sequenceFrameOffset;
@@ -20,7 +25,8 @@ const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOve
20
25
  const freezeStatus = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.freeze;
21
26
  const isFrozen = (freezeStatus === null || freezeStatus === void 0 ? void 0 : freezeStatus.status) === 'static' &&
22
27
  typeof freezeStatus.codeValue === 'number';
23
- const canToggleFreeze = clientId !== null &&
28
+ const canToggleFreeze = (0, exports.isSequenceVisibleAtTimelinePosition)({ sequence, timelinePosition }) &&
29
+ clientId !== null &&
24
30
  Boolean(sequence.controls) &&
25
31
  nodePath !== null &&
26
32
  validatedSource !== null &&
@@ -49,7 +55,7 @@ const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOve
49
55
  fileName: validatedSource,
50
56
  nodePath,
51
57
  fieldKey: 'freeze',
52
- value: remove ? null : freezeFrame,
58
+ value: remove ? undefined : freezeFrame,
53
59
  defaultValue: null,
54
60
  schema: sequence.controls.schema,
55
61
  },
@@ -1,5 +1,5 @@
1
- import type { TrackWithHash } from '../../helpers/get-timeline-sequence-sort-key';
1
+ import type { TimelineTrackData } from '../../helpers/get-timeline-sequence-sort-key';
2
2
  export declare const useTimelineHeight: ({ shown, hasBeenCut, }: {
3
- shown: TrackWithHash[];
3
+ shown: TimelineTrackData[];
4
4
  hasBeenCut: boolean;
5
5
  }) => number;
@@ -114,8 +114,8 @@ const TopPanelInner = ({ readOnlyStudio, onMounted, drawRef, bufferStateDelayInM
114
114
  return (jsx_runtime_1.jsx(ObserveDefaultPropsContext_1.ObserveDefaultProps, { compositionId: (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition'
115
115
  ? canvasContent.compositionId
116
116
  : null, readOnlyStudio: readOnlyStudio, children: jsx_runtime_1.jsxs("div", { style: container, children: [
117
- jsx_runtime_1.jsx("div", { style: row, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, maxFlexerSize: MAX_SIDEBAR_WIDTH, maxAntiFlexerSize: null, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseLeft, children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) }))) : null, actualStateLeft === 'expanded' ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, maxFlexerSize: null, maxAntiFlexerSize: MAX_SIDEBAR_WIDTH, id: "canvas-to-right-sidebar", orientation: "vertical", children: [
118
- jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx("div", { ref: drawRef, style: canvasContainerStyle, children: jsx_runtime_1.jsx(CanvasIfSizeIsAvailable_1.CanvasIfSizeIsAvailable, {}) }) }), actualStateRight === 'expanded' ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseRight, children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) }))) : null] }) })
117
+ jsx_runtime_1.jsx("div", { style: row, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, maxFlexerSize: MAX_SIDEBAR_WIDTH, maxAntiFlexerSize: null, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseLeft, side: "left", children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx(ExplorerPanel_1.ExplorerPanel, { readOnlyStudio: readOnlyStudio }) }))) : null, actualStateLeft === 'expanded' && !isMobileLayout ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, maxFlexerSize: null, maxAntiFlexerSize: MAX_SIDEBAR_WIDTH, id: "canvas-to-right-sidebar", orientation: "vertical", children: [
118
+ jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "flexer", children: jsx_runtime_1.jsx("div", { ref: drawRef, style: canvasContainerStyle, children: jsx_runtime_1.jsx(CanvasIfSizeIsAvailable_1.CanvasIfSizeIsAvailable, {}) }) }), actualStateRight === 'expanded' && !isMobileLayout ? (jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? (isMobileLayout ? (jsx_runtime_1.jsx(MobilePanel_1.default, { onClose: onCollapseRight, side: "right", children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) })) : (jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { sticky: null, type: "anti-flexer", children: jsx_runtime_1.jsx(OptionsPanel_1.OptionsPanel, { readOnlyStudio: readOnlyStudio }) }))) : null] }) })
119
119
  ] }) }), jsx_runtime_1.jsx(PreviewToolbar_1.PreviewToolbar, { bufferStateDelayInMilliseconds: bufferStateDelayInMilliseconds, readOnlyStudio: readOnlyStudio }), jsx_runtime_1.jsx(CurrentCompositionSideEffects_1.TitleUpdater, {})
120
120
  ] }) }));
121
121
  };
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
7
7
  const client_id_1 = require("../helpers/client-id");
8
+ const is_mac_1 = require("../helpers/is-mac");
8
9
  const use_keybinding_1 = require("../helpers/use-keybinding");
9
10
  const redo_1 = require("../icons/redo");
10
11
  const undo_1 = require("../icons/undo");
@@ -74,11 +75,14 @@ const UndoRedoButtons = () => {
74
75
  triggerIfInputFieldFocused: false,
75
76
  keepRegisteredWhenNotHighestContext: false,
76
77
  });
77
- const redo = keybindings.registerKeybinding({
78
+ const redoWithShiftZ = keybindings.registerKeybinding({
78
79
  event: 'keydown',
79
- key: 'y',
80
+ key: 'z',
80
81
  commandCtrlKey: true,
81
- callback: () => {
82
+ callback: (e) => {
83
+ if (!e.shiftKey) {
84
+ return;
85
+ }
82
86
  if (redoFile) {
83
87
  onRedo();
84
88
  }
@@ -87,9 +91,25 @@ const UndoRedoButtons = () => {
87
91
  triggerIfInputFieldFocused: false,
88
92
  keepRegisteredWhenNotHighestContext: false,
89
93
  });
94
+ const redoWithY = is_mac_1.isMac
95
+ ? null
96
+ : keybindings.registerKeybinding({
97
+ event: 'keydown',
98
+ key: 'y',
99
+ commandCtrlKey: true,
100
+ callback: () => {
101
+ if (redoFile) {
102
+ onRedo();
103
+ }
104
+ },
105
+ preventDefault: true,
106
+ triggerIfInputFieldFocused: false,
107
+ keepRegisteredWhenNotHighestContext: false,
108
+ });
90
109
  return () => {
91
110
  undo.unregister();
92
- redo.unregister();
111
+ redoWithShiftZ.unregister();
112
+ redoWithY === null || redoWithY === void 0 ? void 0 : redoWithY.unregister();
93
113
  };
94
114
  }, [keybindings, onRedo, onUndo, redoFile, undoFile]);
95
115
  const undoTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
@@ -97,7 +117,9 @@ const UndoRedoButtons = () => {
97
117
  : `Undo (${ShortcutHint_1.cmdOrCtrlCharacter}+Z)`;
98
118
  const redoTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
99
119
  ? 'Redo'
100
- : `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Y)`;
120
+ : is_mac_1.isMac
121
+ ? `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Shift+Z)`
122
+ : `Redo (${ShortcutHint_1.cmdOrCtrlCharacter}+Y)`;
101
123
  const renderUndo = (0, react_1.useCallback)((color) => {
102
124
  return (jsx_runtime_1.jsx(undo_1.UndoIcon, { style: { ...iconStyle, color, opacity: undoFile ? 1 : 0.5 } }));
103
125
  }, [undoFile]);
@@ -13,6 +13,7 @@ const snapCompositionDropPosition = ({ compositionDimensions, destinationDimensi
13
13
  const outline = {
14
14
  key: 'composition-drop-preview',
15
15
  dimensions: compositionDimensions,
16
+ uncroppedPoints: null,
16
17
  points: [
17
18
  { x: left * scale, y: top * scale },
18
19
  { x: right * scale, y: top * scale },
@@ -0,0 +1 @@
1
+ export declare const MENU_TOOLBAR_HEIGHT = 30;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MENU_TOOLBAR_HEIGHT = void 0;
4
+ exports.MENU_TOOLBAR_HEIGHT = 30;
@@ -1,6 +1,6 @@
1
- import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, SequencePropsSubscriptionKey, InteractivitySchema } from 'remotion';
1
+ import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, InteractivitySchema, SequencePropsSubscriptionKey } from 'remotion';
2
2
  import { type OutlinePoint } from './selected-outline-geometry';
3
- import type { SelectedOutlineDragState, SelectedOutlineRotationDragState, SelectedOutlineRotationDragTarget, SelectedOutlineScaleDragState, SelectedOutlineScaleDragTarget, SelectedOutlineDragTarget, SelectedOutlineTransformOriginDragTarget } from './selected-outline-types';
3
+ import type { SelectedOutlineCropDragTarget, SelectedOutlineCropFieldKey, SelectedOutlineCropHandle, SelectedOutlineDragState, SelectedOutlineDragTarget, SelectedOutlineRotationDragState, SelectedOutlineRotationDragTarget, SelectedOutlineScaleDragState, SelectedOutlineScaleDragTarget, SelectedOutlineTransformOriginDragTarget } from './selected-outline-types';
4
4
  import { type UvCoordinate } from './selected-outline-uv';
5
5
  import type { AddSequenceKeyframeChange } from './Timeline/call-add-keyframe';
6
6
  import type { SaveSequencePropChange } from './Timeline/save-sequence-prop';
@@ -51,6 +51,37 @@ export declare const getSelectedOutlineDragChanges: ({ dragStates, lastValues, }
51
51
  readonly dragStates: readonly SelectedOutlineDragState[];
52
52
  readonly lastValues: ReadonlyMap<string, string>;
53
53
  }) => SelectedOutlineDragChange[];
54
+ export type SelectedOutlineCropValues = Record<SelectedOutlineCropFieldKey, number>;
55
+ export declare const getSelectedOutlineCropFollowingTransformOrigin: ({ dimensions, initialCrop, nextCrop, transformOrigin, }: {
56
+ readonly dimensions: {
57
+ readonly width: number;
58
+ readonly height: number;
59
+ } | null;
60
+ readonly initialCrop: SelectedOutlineCropValues;
61
+ readonly nextCrop: SelectedOutlineCropValues;
62
+ readonly transformOrigin: {
63
+ readonly defaultValue: string | undefined;
64
+ readonly propStatus: CanUpdateSequencePropStatus;
65
+ readonly value: string;
66
+ } | null;
67
+ }) => string | null;
68
+ export declare const getSelectedOutlineCropDragValues: ({ crop, dimensions, handle, uv, }: {
69
+ readonly crop: SelectedOutlineCropValues;
70
+ readonly dimensions: {
71
+ readonly width: number;
72
+ readonly height: number;
73
+ } | null;
74
+ readonly handle: SelectedOutlineCropHandle;
75
+ readonly uv: readonly [number, number];
76
+ }) => SelectedOutlineCropValues;
77
+ export declare const getSelectedOutlineCropDragChanges: ({ dimensions, target, values, }: {
78
+ readonly dimensions: {
79
+ readonly width: number;
80
+ readonly height: number;
81
+ } | null;
82
+ readonly target: SelectedOutlineCropDragTarget;
83
+ readonly values: SelectedOutlineCropValues;
84
+ }) => SelectedOutlineDragChange[];
54
85
  export type SelectedOutlineKeyboardNudgeDirection = 'left' | 'right' | 'up' | 'down';
55
86
  export declare const getSelectedOutlineKeyboardNudgeDelta: ({ direction, shiftKey, }: {
56
87
  readonly direction: SelectedOutlineKeyboardNudgeDirection;
@@ -160,10 +191,16 @@ export declare const snapSelectedOutlineUv: ({ point, points, thresholdPx, uv, }
160
191
  readonly uv: UvCoordinate;
161
192
  }) => UvCoordinate;
162
193
  export declare const selectedOutlineTransformOriginSnapThresholdPx = 10;
163
- export declare const snapSelectedOutlineTransformOriginUv: ({ point, points, thresholdPx, uv, }: {
194
+ export declare const snapSelectedOutlineTransformOriginUv: ({ crop, point, points, thresholdPx, uv, }: {
195
+ readonly crop: {
196
+ readonly left: number;
197
+ readonly right: number;
198
+ readonly top: number;
199
+ readonly bottom: number;
200
+ } | null;
164
201
  readonly point: OutlinePoint;
165
202
  readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
166
- readonly thresholdPx?: number | undefined;
203
+ readonly thresholdPx: number | null;
167
204
  readonly uv: UvCoordinate;
168
205
  }) => UvCoordinate;
169
206
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.snapSelectedOutlineTransformOriginUv = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.snapSelectedOutlineUv = exports.selectedOutlineUvSnapThresholdPx = exports.applySelectedOutlineTransformOriginAxisLock = exports.getSelectedOutlineTransformOriginLockedAxis = exports.uvsEqual = exports.getSelectedOutlineTransformOriginDragChanges = exports.compensateTranslateForTransformOrigin = exports.parseCssRotationToRadians = exports.clearSelectedOutlineRotationDragOverrides = exports.clearSelectedOutlineScaleDragOverrides = exports.getSelectedOutlineKeyboardNudgeDirection = exports.clearSelectedOutlineDragOverrides = exports.getSelectedOutlineRotationDragChanges = exports.snapSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineRotationSnapStepDegrees = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragChanges = exports.isSelectedOutlineDragPastThreshold = exports.applySelectedOutlineDragAxisLock = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragStates = exports.getSelectedOutlineActiveSchema = void 0;
3
+ exports.snapSelectedOutlineTransformOriginUv = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.snapSelectedOutlineUv = exports.selectedOutlineUvSnapThresholdPx = exports.applySelectedOutlineTransformOriginAxisLock = exports.getSelectedOutlineTransformOriginLockedAxis = exports.uvsEqual = exports.getSelectedOutlineTransformOriginDragChanges = exports.compensateTranslateForTransformOrigin = exports.parseCssRotationToRadians = exports.clearSelectedOutlineRotationDragOverrides = exports.clearSelectedOutlineScaleDragOverrides = exports.getSelectedOutlineKeyboardNudgeDirection = exports.clearSelectedOutlineDragOverrides = exports.getSelectedOutlineRotationDragChanges = exports.snapSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineRotationSnapStepDegrees = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineCropDragChanges = exports.getSelectedOutlineCropDragValues = exports.getSelectedOutlineCropFollowingTransformOrigin = exports.getSelectedOutlineDragChanges = exports.isSelectedOutlineDragPastThreshold = exports.applySelectedOutlineDragAxisLock = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragStates = exports.getSelectedOutlineActiveSchema = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const no_react_1 = require("remotion/no-react");
6
6
  const selected_outline_geometry_1 = require("./selected-outline-geometry");
@@ -11,6 +11,7 @@ const timeline_field_utils_1 = require("./Timeline/timeline-field-utils");
11
11
  const timeline_rotation_utils_1 = require("./Timeline/timeline-rotation-utils");
12
12
  const timeline_translate_utils_1 = require("./Timeline/timeline-translate-utils");
13
13
  const TimelineScaleField_1 = require("./Timeline/TimelineScaleField");
14
+ const transform_origin_utils_1 = require("./Timeline/transform-origin-utils");
14
15
  const getSelectedOutlineActiveSchema = ({ schema, currentRuntimeValueDotNotation, dragOverrides, propStatus, frame, }) => {
15
16
  const { merged: valuesDotNotation } = remotion_1.Internals.computeEffectiveSchemaValuesDotNotation({
16
17
  schema,
@@ -113,6 +114,141 @@ const getSelectedOutlineDragChanges = ({ dragStates, lastValues, }) => {
113
114
  return changes;
114
115
  };
115
116
  exports.getSelectedOutlineDragChanges = getSelectedOutlineDragChanges;
117
+ const getSelectedOutlineCropCenter = (crop) => [
118
+ (crop.cropLeft + 1 - crop.cropRight) / 2,
119
+ (crop.cropTop + 1 - crop.cropBottom) / 2,
120
+ ];
121
+ const getSelectedOutlineCropFollowingTransformOrigin = ({ dimensions, initialCrop, nextCrop, transformOrigin, }) => {
122
+ if (dimensions === null ||
123
+ transformOrigin === null ||
124
+ transformOrigin.propStatus.status !== 'static') {
125
+ return null;
126
+ }
127
+ const parsed = (0, transform_origin_utils_1.parseTransformOrigin)(transformOrigin.value);
128
+ if (parsed === null) {
129
+ return null;
130
+ }
131
+ const currentOrigin = (0, transform_origin_utils_1.parsedTransformOriginToUv)({
132
+ parsed,
133
+ width: dimensions.width,
134
+ height: dimensions.height,
135
+ });
136
+ if (currentOrigin === null) {
137
+ return null;
138
+ }
139
+ const initialCenter = getSelectedOutlineCropCenter(initialCrop);
140
+ const originIsAbsent = transformOrigin.propStatus.codeValue === undefined;
141
+ const originIsAtCropCenter = Math.abs(currentOrigin[0] - initialCenter[0]) <= 0.0001 &&
142
+ Math.abs(currentOrigin[1] - initialCenter[1]) <= 0.0001;
143
+ if (!originIsAbsent && !originIsAtCropCenter) {
144
+ return null;
145
+ }
146
+ return (0, transform_origin_utils_1.serializeTransformOrigin)({
147
+ uv: getSelectedOutlineCropCenter(nextCrop),
148
+ z: parsed.z,
149
+ });
150
+ };
151
+ exports.getSelectedOutlineCropFollowingTransformOrigin = getSelectedOutlineCropFollowingTransformOrigin;
152
+ const cropHandleIncludes = (handle, edge) => handle === edge || handle.includes(edge);
153
+ const getSelectedOutlineCropDragValues = ({ crop, dimensions, handle, uv, }) => {
154
+ const minimumVisibleX = dimensions === null ? 0.001 : 1 / dimensions.width;
155
+ const minimumVisibleY = dimensions === null ? 0.001 : 1 / dimensions.height;
156
+ const roundCrop = (value, max) => (0, selected_outline_geometry_1.clamp)((0, timeline_field_utils_1.roundToDecimalPlaces)(value, 4), 0, Math.max(0, max));
157
+ const next = { ...crop };
158
+ if (cropHandleIncludes(handle, 'left')) {
159
+ next.cropLeft = roundCrop(uv[0], 1 - crop.cropRight - minimumVisibleX);
160
+ }
161
+ if (cropHandleIncludes(handle, 'right')) {
162
+ next.cropRight = roundCrop(1 - uv[0], 1 - crop.cropLeft - minimumVisibleX);
163
+ }
164
+ if (cropHandleIncludes(handle, 'top')) {
165
+ next.cropTop = roundCrop(uv[1], 1 - crop.cropBottom - minimumVisibleY);
166
+ }
167
+ if (cropHandleIncludes(handle, 'bottom')) {
168
+ next.cropBottom = roundCrop(1 - uv[1], 1 - crop.cropTop - minimumVisibleY);
169
+ }
170
+ return next;
171
+ };
172
+ exports.getSelectedOutlineCropDragValues = getSelectedOutlineCropDragValues;
173
+ const getSelectedOutlineCropDragChanges = ({ dimensions, target, values, }) => {
174
+ const changes = [];
175
+ for (const fieldKey of Object.values(selected_outline_types_1.cropFieldKeys)) {
176
+ const field = target.fields[fieldKey];
177
+ const value = values[fieldKey];
178
+ if (value === field.value) {
179
+ continue;
180
+ }
181
+ if (field.propStatus.status === 'keyframed') {
182
+ changes.push({
183
+ type: 'keyframed',
184
+ fileName: target.nodePath.absolutePath,
185
+ nodePath: target.nodePath,
186
+ fieldKey,
187
+ sourceFrame: target.sourceFrame,
188
+ value,
189
+ schema: target.schema,
190
+ clientId: target.clientId,
191
+ });
192
+ continue;
193
+ }
194
+ const defaultValue = field.defaultValue === undefined
195
+ ? null
196
+ : JSON.stringify(field.defaultValue);
197
+ const stringifiedValue = JSON.stringify(value);
198
+ const shouldSave = value !== field.propStatus.codeValue &&
199
+ !(defaultValue === stringifiedValue &&
200
+ field.propStatus.codeValue === undefined);
201
+ if (shouldSave) {
202
+ changes.push({
203
+ type: 'static',
204
+ fileName: target.nodePath.absolutePath,
205
+ nodePath: target.nodePath,
206
+ fieldKey,
207
+ value,
208
+ defaultValue,
209
+ schema: target.schema,
210
+ });
211
+ }
212
+ }
213
+ if (changes.length === 0 ||
214
+ target.transformOrigin === null ||
215
+ target.transformOrigin.propStatus.status !== 'static') {
216
+ return changes;
217
+ }
218
+ const transformOrigin = (0, exports.getSelectedOutlineCropFollowingTransformOrigin)({
219
+ dimensions,
220
+ initialCrop: {
221
+ cropLeft: target.fields.cropLeft.value,
222
+ cropRight: target.fields.cropRight.value,
223
+ cropTop: target.fields.cropTop.value,
224
+ cropBottom: target.fields.cropBottom.value,
225
+ },
226
+ nextCrop: values,
227
+ transformOrigin: target.transformOrigin,
228
+ });
229
+ if (transformOrigin === null) {
230
+ return changes;
231
+ }
232
+ const transformOriginDefaultValue = target.transformOrigin.defaultValue === undefined
233
+ ? null
234
+ : JSON.stringify(target.transformOrigin.defaultValue);
235
+ const shouldSaveTransformOrigin = transformOrigin !== target.transformOrigin.propStatus.codeValue &&
236
+ !(transformOriginDefaultValue === JSON.stringify(transformOrigin) &&
237
+ target.transformOrigin.propStatus.codeValue === undefined);
238
+ if (shouldSaveTransformOrigin) {
239
+ changes.push({
240
+ type: 'static',
241
+ fileName: target.nodePath.absolutePath,
242
+ nodePath: target.nodePath,
243
+ fieldKey: selected_outline_types_1.transformOriginFieldKey,
244
+ value: transformOrigin,
245
+ defaultValue: transformOriginDefaultValue,
246
+ schema: target.schema,
247
+ });
248
+ }
249
+ return changes;
250
+ };
251
+ exports.getSelectedOutlineCropDragChanges = getSelectedOutlineCropDragChanges;
116
252
  const getSelectedOutlineKeyboardNudgeDelta = ({ direction, shiftKey, }) => {
117
253
  const increment = shiftKey ? 10 : 1;
118
254
  return direction === 'left' || direction === 'up' ? -increment : increment;
@@ -570,4 +706,45 @@ const snapSelectedOutlineUv = ({ point, points, thresholdPx = exports.selectedOu
570
706
  };
571
707
  exports.snapSelectedOutlineUv = snapSelectedOutlineUv;
572
708
  exports.selectedOutlineTransformOriginSnapThresholdPx = exports.selectedOutlineUvSnapThresholdPx;
573
- exports.snapSelectedOutlineTransformOriginUv = exports.snapSelectedOutlineUv;
709
+ const getCroppedOutlineUvSnapTargets = (crop) => {
710
+ const { left, top } = crop;
711
+ const right = 1 - crop.right;
712
+ const bottom = 1 - crop.bottom;
713
+ const centerX = (left + right) / 2;
714
+ const centerY = (top + bottom) / 2;
715
+ return [
716
+ [left, top],
717
+ [centerX, top],
718
+ [right, top],
719
+ [right, centerY],
720
+ [right, bottom],
721
+ [centerX, bottom],
722
+ [left, bottom],
723
+ [left, centerY],
724
+ [centerX, centerY],
725
+ ];
726
+ };
727
+ const snapSelectedOutlineTransformOriginUv = ({ crop, point, points, thresholdPx, uv, }) => {
728
+ var _a;
729
+ const threshold = thresholdPx !== null && thresholdPx !== void 0 ? thresholdPx : exports.selectedOutlineTransformOriginSnapThresholdPx;
730
+ if (crop === null) {
731
+ return (0, exports.snapSelectedOutlineUv)({ point, points, thresholdPx: threshold, uv });
732
+ }
733
+ let best = null;
734
+ const snapTargets = [
735
+ ...selectedOutlineUvSnapTargets,
736
+ ...getCroppedOutlineUvSnapTargets(crop),
737
+ ];
738
+ for (const snapUv of snapTargets) {
739
+ const snapPoint = (0, selected_outline_uv_1.getUvHandlePosition)(points, snapUv);
740
+ const distance = Math.hypot(point.x - snapPoint.x, point.y - snapPoint.y);
741
+ if (distance > threshold) {
742
+ continue;
743
+ }
744
+ if (best === null || distance < best.distance) {
745
+ best = { distance, uv: snapUv };
746
+ }
747
+ }
748
+ return (_a = best === null || best === void 0 ? void 0 : best.uv) !== null && _a !== void 0 ? _a : uv;
749
+ };
750
+ exports.snapSelectedOutlineTransformOriginUv = snapSelectedOutlineTransformOriginUv;
@@ -8,6 +8,7 @@ export type SelectedOutline = {
8
8
  readonly width: number;
9
9
  readonly height: number;
10
10
  } | null;
11
+ readonly uncroppedPoints: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint] | null;
11
12
  readonly points: readonly [
12
13
  OutlinePoint,
13
14
  OutlinePoint,
@@ -41,6 +41,12 @@ export declare const getTransformedSvgViewportPoints: ({ viewport, ctm, containe
41
41
  readonly ctm: SvgScreenCtm;
42
42
  readonly containerRect: Pick<DOMRect, "left" | "top">;
43
43
  }) => readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
44
+ export declare const cropOutlinePoints: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], crop: {
45
+ readonly left: number;
46
+ readonly right: number;
47
+ readonly top: number;
48
+ readonly bottom: number;
49
+ }) => readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
44
50
  export declare const getSelectedSequenceKeys: (selectedItems: readonly TimelineSelection[]) => Set<string>;
45
51
  export declare const getSequenceKeysContainingSelection: (selectedItems: readonly TimelineSelection[]) => Set<string>;
46
52
  export declare const getOutlineSelectionInteraction: ({ shiftKey, metaKey, ctrlKey, }: {
@@ -57,6 +63,11 @@ type SelectedTransformOriginInfo = {
57
63
  readonly sequenceKey: string;
58
64
  readonly displayFrame: number | null;
59
65
  };
66
+ export type SelectedCropInfo = {
67
+ readonly sequenceKey: string;
68
+ readonly displayFrame: number | null;
69
+ };
70
+ export declare const getSelectedCropInfo: (selectedItems: readonly TimelineSelection[]) => SelectedCropInfo | null;
60
71
  export declare const getSelectedTransformOriginInfo: (selectedItems: readonly TimelineSelection[]) => SelectedTransformOriginInfo | null;
61
72
  export declare const getSequencesWithSelectableOutlines: ({ sequences, overrideIdsToNodePaths, compositions, timelinePosition, }: {
62
73
  readonly sequences: readonly TSequence[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.outlinesAreEqual = exports.measureOutlines = exports.getSequencesWithSelectableOutlines = exports.getSelectedTransformOriginInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSequenceKeysContainingSelection = exports.getSelectedSequenceKeys = exports.getTransformedSvgViewportPoints = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getRotationCursor = exports.getSelectedOutlineRotationDeltaDegrees = exports.getAngleDegrees = exports.vectorBetween = exports.vectorLength = exports.dot = exports.getOutlineCenter = exports.midpoint = exports.pointToString = void 0;
3
+ exports.outlinesAreEqual = exports.measureOutlines = exports.getSequencesWithSelectableOutlines = exports.getSelectedTransformOriginInfo = exports.getSelectedCropInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSequenceKeysContainingSelection = exports.getSelectedSequenceKeys = exports.cropOutlinePoints = exports.getTransformedSvgViewportPoints = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getRotationCursor = exports.getSelectedOutlineRotationDeltaDegrees = exports.getAngleDegrees = exports.vectorBetween = exports.vectorLength = exports.dot = exports.getOutlineCenter = exports.midpoint = exports.pointToString = void 0;
4
4
  const calculate_timeline_1 = require("../helpers/calculate-timeline");
5
5
  const colors_1 = require("../helpers/colors");
6
6
  const get_box_quads_ponyfill_1 = require("../helpers/get-box-quads-ponyfill");
@@ -203,6 +203,24 @@ const getElementOutlinePoints = (element, containerRect) => {
203
203
  }
204
204
  return quadToPoints(quad, containerRect);
205
205
  };
206
+ const cropOutlinePoints = (points, crop) => {
207
+ if (crop.left === 0 &&
208
+ crop.right === 0 &&
209
+ crop.top === 0 &&
210
+ crop.bottom === 0) {
211
+ return points;
212
+ }
213
+ const { left, top } = crop;
214
+ const right = 1 - crop.right;
215
+ const bottom = 1 - crop.bottom;
216
+ return [
217
+ (0, selected_outline_uv_1.getUvHandlePosition)(points, [left, top]),
218
+ (0, selected_outline_uv_1.getUvHandlePosition)(points, [right, top]),
219
+ (0, selected_outline_uv_1.getUvHandlePosition)(points, [right, bottom]),
220
+ (0, selected_outline_uv_1.getUvHandlePosition)(points, [left, bottom]),
221
+ ];
222
+ };
223
+ exports.cropOutlinePoints = cropOutlinePoints;
206
224
  const getSelectedSequenceKeys = (selectedItems) => {
207
225
  return new Set(selectedItems
208
226
  .filter((item) => item.type === 'sequence')
@@ -278,6 +296,34 @@ const getSelectedEffectFieldsBySequenceKey = (selectedItems) => {
278
296
  return selectedEffects;
279
297
  };
280
298
  exports.getSelectedEffectFieldsBySequenceKey = getSelectedEffectFieldsBySequenceKey;
299
+ const isCropFieldKey = (key) => Object.values(selected_outline_types_1.cropFieldKeys).some((cropFieldKey) => cropFieldKey === key);
300
+ const getSelectedCropInfo = (selectedItems) => {
301
+ if (selectedItems.length !== 1) {
302
+ return null;
303
+ }
304
+ const [selectedItem] = selectedItems;
305
+ if (selectedItem.type === 'sequence-prop' &&
306
+ isCropFieldKey(selectedItem.key)) {
307
+ return {
308
+ sequenceKey: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(selectedItem.nodePathInfo),
309
+ displayFrame: null,
310
+ };
311
+ }
312
+ if (selectedItem.type !== 'keyframe' && selectedItem.type !== 'easing') {
313
+ return null;
314
+ }
315
+ const field = getKeyframeOrEasingField(selectedItem);
316
+ if ((field === null || field === void 0 ? void 0 : field.type) !== 'sequence' || !isCropFieldKey(field.fieldKey)) {
317
+ return null;
318
+ }
319
+ return {
320
+ sequenceKey: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(selectedItem.nodePathInfo),
321
+ displayFrame: selectedItem.type === 'keyframe'
322
+ ? selectedItem.frame
323
+ : selectedItem.fromFrame,
324
+ };
325
+ };
326
+ exports.getSelectedCropInfo = getSelectedCropInfo;
281
327
  const getSelectedTransformOriginInfo = (selectedItems) => {
282
328
  if (selectedItems.length !== 1) {
283
329
  return null;
@@ -345,10 +391,11 @@ const measureOutlines = (container, targets) => {
345
391
  if (element === null) {
346
392
  continue;
347
393
  }
348
- const points = getElementOutlinePoints(element, containerRect);
349
- if (points === null) {
394
+ const uncroppedPoints = getElementOutlinePoints(element, containerRect);
395
+ if (uncroppedPoints === null) {
350
396
  continue;
351
397
  }
398
+ const points = (0, exports.cropOutlinePoints)(uncroppedPoints, target.crop);
352
399
  outlines.push({
353
400
  key: target.key,
354
401
  dimensions: element instanceof HTMLElement
@@ -362,6 +409,7 @@ const measureOutlines = (container, targets) => {
362
409
  height: element.height.baseVal.value,
363
410
  }
364
411
  : null,
412
+ uncroppedPoints,
365
413
  points,
366
414
  });
367
415
  }
@@ -381,6 +429,19 @@ const outlinesAreEqual = (a, b) => {
381
429
  ((_c = a[i].dimensions) === null || _c === void 0 ? void 0 : _c.height) !== ((_d = b[i].dimensions) === null || _d === void 0 ? void 0 : _d.height)) {
382
430
  return false;
383
431
  }
432
+ const aUncropped = a[i].uncroppedPoints;
433
+ const bUncropped = b[i].uncroppedPoints;
434
+ if ((aUncropped === null) !== (bUncropped === null)) {
435
+ return false;
436
+ }
437
+ if (aUncropped !== null && bUncropped !== null) {
438
+ for (let j = 0; j < aUncropped.length; j++) {
439
+ if (Math.abs(aUncropped[j].x - bUncropped[j].x) > 0.01 ||
440
+ Math.abs(aUncropped[j].y - bUncropped[j].y) > 0.01) {
441
+ return false;
442
+ }
443
+ }
444
+ }
384
445
  for (let j = 0; j < a[i].points.length; j++) {
385
446
  if (Math.abs(a[i].points[j].x - b[i].points[j].x) > 0.01 ||
386
447
  Math.abs(a[i].points[j].y - b[i].points[j].y) > 0.01) {