@remotion/studio 4.0.499 → 4.0.501

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 (204) hide show
  1. package/dist/Studio.js +1 -1
  2. package/dist/api/delete-static-file.js +8 -3
  3. package/dist/api/rename-static-file.js +8 -0
  4. package/dist/api/watch-public-folder.js +2 -1
  5. package/dist/api/watch-static-file.js +2 -1
  6. package/dist/api/write-static-file.js +8 -3
  7. package/dist/components/AssetSelector.js +11 -7
  8. package/dist/components/AssetSelectorItem.d.ts +25 -0
  9. package/dist/components/AssetSelectorItem.js +116 -80
  10. package/dist/components/Canvas.js +6 -1
  11. package/dist/components/CaptionInspector.d.ts +10 -0
  12. package/dist/components/CaptionInspector.js +24 -0
  13. package/dist/components/CaptionTextEditor.d.ts +9 -0
  14. package/dist/components/CaptionTextEditor.js +132 -0
  15. package/dist/components/CompositionSelector.js +2 -32
  16. package/dist/components/ControlButton.js +1 -0
  17. package/dist/components/CurrentAsset.js +3 -2
  18. package/dist/components/EditorContexts.d.ts +0 -1
  19. package/dist/components/EditorContexts.js +2 -2
  20. package/dist/components/ExplorerPanel.js +2 -1
  21. package/dist/components/ExplorerPanelRef.d.ts +2 -0
  22. package/dist/components/FpsCounter.js +3 -3
  23. package/dist/components/FullscreenToggle.js +2 -1
  24. package/dist/components/GlobalKeybindings.js +9 -1
  25. package/dist/components/InitialCompositionLoader.d.ts +1 -1
  26. package/dist/components/InlineAction.d.ts +2 -1
  27. package/dist/components/InlineAction.js +3 -2
  28. package/dist/components/InlineCaptionInspector.d.ts +11 -0
  29. package/dist/components/InlineCaptionInspector.js +108 -0
  30. package/dist/components/InlineDropdown.d.ts +1 -1
  31. package/dist/components/InlineDropdown.js +3 -2
  32. package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
  33. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  34. package/dist/components/InspectorPanel/CompositionInspector.js +12 -9
  35. package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
  36. package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
  37. package/dist/components/InspectorPanel/SelectedInspector.d.ts +1 -0
  38. package/dist/components/InspectorPanel/SelectedInspector.js +2 -2
  39. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
  40. package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +1 -0
  41. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +10 -10
  42. package/dist/components/InspectorPanel/common.d.ts +17 -4
  43. package/dist/components/InspectorPanel/common.js +60 -6
  44. package/dist/components/InspectorPanel/inspector-section-collapse.d.ts +22 -0
  45. package/dist/components/InspectorPanel/inspector-section-collapse.js +165 -0
  46. package/dist/components/InspectorPanel/styles.js +7 -1
  47. package/dist/components/InspectorPanel/use-composition-actions.d.ts +3 -0
  48. package/dist/components/InspectorPanel/use-composition-actions.js +91 -5
  49. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
  50. package/dist/components/InspectorPanel.js +2 -2
  51. package/dist/components/InspectorSequenceSection.d.ts +2 -1
  52. package/dist/components/InspectorSequenceSection.js +279 -25
  53. package/dist/components/KeyboardShortcutsExplainer.js +4 -2
  54. package/dist/components/Menu/MenuItem.js +2 -1
  55. package/dist/components/MenuCompositionName.js +30 -7
  56. package/dist/components/MenuToolbar.d.ts +0 -1
  57. package/dist/components/MenuToolbar.js +15 -7
  58. package/dist/components/MobilePanel.d.ts +2 -1
  59. package/dist/components/MobilePanel.js +29 -25
  60. package/dist/components/ModalContainer.d.ts +1 -0
  61. package/dist/components/ModalContainer.js +2 -2
  62. package/dist/components/Modals.js +1 -1
  63. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  64. package/dist/components/NewComposition/DismissableModal.js +2 -2
  65. package/dist/components/NewComposition/InputDragger.d.ts +7 -0
  66. package/dist/components/NewComposition/InputDragger.js +119 -8
  67. package/dist/components/OutlineToggle.d.ts +1 -3
  68. package/dist/components/OutlineToggle.js +2 -2
  69. package/dist/components/PreviewToolbar.js +10 -4
  70. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
  71. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +45 -0
  72. package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
  73. package/dist/components/QuickSwitcher/NoResults.js +1 -0
  74. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +10 -0
  75. package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
  76. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +10 -0
  77. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +95 -13
  78. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
  79. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
  80. package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
  81. package/dist/components/QuickSwitcher/asset-search.js +42 -0
  82. package/dist/components/RenderQueue/ClientRenderQueueProcessor.d.ts +0 -1
  83. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -14
  84. package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -2
  85. package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
  86. package/dist/components/SelectedOutlineCropControls.js +299 -0
  87. package/dist/components/SelectedOutlineElement.js +84 -47
  88. package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
  89. package/dist/components/SelectedOutlineOverlay.js +147 -16
  90. package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
  91. package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
  92. package/dist/components/ShowOutlinesProvider.js +4 -1
  93. package/dist/components/SidebarCollapserControls.d.ts +3 -1
  94. package/dist/components/SidebarCollapserControls.js +34 -29
  95. package/dist/components/SnappingToggle.d.ts +1 -3
  96. package/dist/components/SnappingToggle.js +2 -2
  97. package/dist/components/Timeline/Timeline.js +19 -5
  98. package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
  99. package/dist/components/Timeline/TimelineAssetField.js +53 -100
  100. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
  101. package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
  102. package/dist/components/Timeline/TimelineColorField.js +20 -1
  103. package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
  104. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +8 -1
  105. package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
  106. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
  107. package/dist/components/Timeline/TimelineList.d.ts +2 -2
  108. package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +7 -2
  109. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +10 -2
  110. package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
  111. package/dist/components/Timeline/TimelineRowChrome.js +4 -3
  112. package/dist/components/Timeline/TimelineSelection.d.ts +9 -7
  113. package/dist/components/Timeline/TimelineSelection.js +17 -12
  114. package/dist/components/Timeline/TimelineSequence.js +2 -9
  115. package/dist/components/Timeline/TimelineSequenceItem.js +61 -15
  116. package/dist/components/Timeline/TimelineSequencePropItem.js +36 -85
  117. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +0 -1
  118. package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
  119. package/dist/components/Timeline/TimelineTrack.js +4 -2
  120. package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
  121. package/dist/components/Timeline/border-radius-representation.d.ts +16 -0
  122. package/dist/components/Timeline/border-radius-representation.js +60 -0
  123. package/dist/components/Timeline/delete-selected-timeline-item.js +1 -6
  124. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
  125. package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
  126. package/dist/components/Timeline/get-sequence-prop-reset-changes.d.ts +10 -0
  127. package/dist/components/Timeline/get-sequence-prop-reset-changes.js +33 -0
  128. package/dist/components/Timeline/reset-selected-timeline-props.js +20 -18
  129. package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
  130. package/dist/components/Timeline/save-effect-prop.js +52 -1
  131. package/dist/components/Timeline/save-sequence-prop.d.ts +12 -1
  132. package/dist/components/Timeline/save-sequence-prop.js +25 -1
  133. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
  134. package/dist/components/Timeline/timeline-asset-link.js +17 -1
  135. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  136. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
  137. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
  138. package/dist/components/Timeline/use-timeline-asset-drop.js +4 -0
  139. package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
  140. package/dist/components/TopPanel.js +2 -2
  141. package/dist/components/UndoRedoButtons.js +42 -11
  142. package/dist/components/composition-drop-preview.js +1 -0
  143. package/dist/components/handle-drop.d.ts +3 -2
  144. package/dist/components/handle-drop.js +2 -1
  145. package/dist/components/import-assets.d.ts +4 -2
  146. package/dist/components/import-assets.js +20 -7
  147. package/dist/components/menu-toolbar-height.d.ts +1 -0
  148. package/dist/components/menu-toolbar-height.js +4 -0
  149. package/dist/components/selected-outline-drag.d.ts +41 -4
  150. package/dist/components/selected-outline-drag.js +179 -2
  151. package/dist/components/selected-outline-geometry.d.ts +1 -0
  152. package/dist/components/selected-outline-measurement.d.ts +11 -0
  153. package/dist/components/selected-outline-measurement.js +64 -3
  154. package/dist/components/selected-outline-types.d.ts +44 -1
  155. package/dist/components/selected-outline-types.js +21 -1
  156. package/dist/components/use-element-overwrite-confirmation.d.ts +2 -0
  157. package/dist/components/use-element-overwrite-confirmation.js +73 -0
  158. package/dist/components/use-static-files.js +7 -2
  159. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +13 -2
  160. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
  161. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
  162. package/dist/esm/{chunk-pk1zwsn1.js → chunk-n1kj09yv.js} +10618 -8002
  163. package/dist/esm/index.mjs +24 -8
  164. package/dist/esm/internals.mjs +10618 -8002
  165. package/dist/esm/previewEntry.mjs +40002 -37388
  166. package/dist/esm/renderEntry.mjs +1 -1
  167. package/dist/helpers/browser-studio-operations.d.ts +3 -0
  168. package/dist/helpers/browser-studio-operations.js +14 -0
  169. package/dist/helpers/calculate-timeline.d.ts +2 -2
  170. package/dist/helpers/calculate-timeline.js +8 -28
  171. package/dist/helpers/client-id.d.ts +0 -1
  172. package/dist/helpers/client-id.js +15 -10
  173. package/dist/helpers/download-blob.d.ts +1 -0
  174. package/dist/helpers/download-blob.js +15 -0
  175. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
  176. package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
  177. package/dist/helpers/inject-css.js +5 -3
  178. package/dist/helpers/interactivity-enabled.d.ts +1 -0
  179. package/dist/helpers/interactivity-enabled.js +7 -2
  180. package/dist/helpers/is-mac.d.ts +1 -0
  181. package/dist/helpers/is-mac.js +4 -0
  182. package/dist/helpers/open-in-editor.d.ts +5 -1
  183. package/dist/helpers/open-in-editor.js +39 -4
  184. package/dist/helpers/preview-server-events.js +46 -9
  185. package/dist/helpers/sort-by-nonce-history.js +97 -19
  186. package/dist/helpers/use-create-composition.js +8 -6
  187. package/dist/helpers/use-keybinding.js +2 -3
  188. package/dist/helpers/use-menu-structure.js +39 -1
  189. package/dist/hot-middleware-client/client.js +3 -3
  190. package/dist/icons/border-radius.d.ts +4 -0
  191. package/dist/icons/border-radius.js +8 -0
  192. package/dist/icons/caret.d.ts +1 -0
  193. package/dist/icons/caret.js +2 -2
  194. package/dist/icons/fullscreen.d.ts +4 -0
  195. package/dist/icons/fullscreen.js +6 -0
  196. package/dist/icons/pen.d.ts +5 -0
  197. package/dist/icons/pen.js +8 -0
  198. package/dist/previewEntry.js +1 -1
  199. package/dist/state/modals.d.ts +9 -0
  200. package/dist/state/timeline-sequence-hover.d.ts +17 -0
  201. package/dist/state/timeline-sequence-hover.js +33 -0
  202. package/package.json +13 -12
  203. package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
  204. package/dist/helpers/get-timeline-sequence-hash.js +0 -33
@@ -1,9 +1,10 @@
1
1
  import type { Dimensions } from '../helpers/is-current-selected-still';
2
- import { type InsertElementDropPosition } from './import-assets';
2
+ import { type ConfirmElementOverwrite, type InsertElementDropPosition } from './import-assets';
3
3
  import type { SvgImportMode } from './SvgImportDialog';
4
- export declare const handleDrop: ({ chooseSvgImportMode, compositionFile, compositionId, destinationDimensions, dropPosition, event, fps, from, }: {
4
+ export declare const handleDrop: ({ chooseSvgImportMode, compositionFile, confirmElementOverwrite, compositionId, destinationDimensions, dropPosition, event, fps, from, }: {
5
5
  chooseSvgImportMode: () => Promise<SvgImportMode | null>;
6
6
  compositionFile: string;
7
+ confirmElementOverwrite: ConfirmElementOverwrite;
7
8
  compositionId: string;
8
9
  destinationDimensions: Dimensions | null;
9
10
  dropPosition: InsertElementDropPosition | null;
@@ -5,7 +5,7 @@ const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
5
5
  const drop_handler_data_1 = require("./drop-handler-data");
6
6
  const element_drag_and_drop_1 = require("./element-drag-and-drop");
7
7
  const import_assets_1 = require("./import-assets");
8
- const handleDrop = async ({ chooseSvgImportMode, compositionFile, compositionId, destinationDimensions, dropPosition, event, fps, from, }) => {
8
+ const handleDrop = async ({ chooseSvgImportMode, compositionFile, confirmElementOverwrite, compositionId, destinationDimensions, dropPosition, event, fps, from, }) => {
9
9
  var _a;
10
10
  var _b;
11
11
  if ((0, drop_handler_data_1.isFileDragEvent)(event)) {
@@ -80,6 +80,7 @@ const handleDrop = async ({ chooseSvgImportMode, compositionFile, compositionId,
80
80
  await (0, import_assets_1.insertElement)({
81
81
  compositionFile,
82
82
  compositionId,
83
+ confirmOverwrite: confirmElementOverwrite,
83
84
  dropPosition,
84
85
  element: element.element,
85
86
  from,
@@ -1,10 +1,11 @@
1
1
  import { type CompositionDragData, type ComponentProp } from '@remotion/drag-and-drop';
2
- import { type FileType, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
2
+ import { type FileType, type InsertElementFileConflict, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
3
3
  import type { Dimensions } from '../helpers/is-current-selected-still';
4
4
  export type InsertElementDropPosition = {
5
5
  readonly centerX: number;
6
6
  readonly centerY: number;
7
7
  };
8
+ export type ConfirmElementOverwrite = (conflict: InsertElementFileConflict) => Promise<boolean>;
8
9
  export declare const getAssetElement: ({ fileType, src, }: {
9
10
  fileType: FileType;
10
11
  src: string;
@@ -144,9 +145,10 @@ export declare const insertComposition: ({ composition, compositionFile, composi
144
145
  dropPosition: InsertElementDropPosition | null;
145
146
  from: number | null;
146
147
  }) => Promise<void>;
147
- export declare const insertElement: ({ compositionFile, compositionId, dropPosition, element, from, }: {
148
+ export declare const insertElement: ({ compositionFile, compositionId, confirmOverwrite, dropPosition, element, from, }: {
148
149
  compositionFile: string;
149
150
  compositionId: string;
151
+ confirmOverwrite: ConfirmElementOverwrite;
150
152
  dropPosition: InsertElementDropPosition | null;
151
153
  element: {
152
154
  dependencies: string[];
@@ -872,21 +872,34 @@ const insertComposition = async ({ composition, compositionFile, compositionId,
872
872
  }
873
873
  };
874
874
  exports.insertComposition = insertComposition;
875
- const insertElement = async ({ compositionFile, compositionId, dropPosition, element, from, }) => {
875
+ const insertElement = async ({ compositionFile, compositionId, confirmOverwrite, dropPosition, element, from, }) => {
876
876
  try {
877
877
  await (0, install_required_package_1.installRequiredPackages)(element.dependencies);
878
- const response = await (0, call_api_1.callApi)('/api/insert-element', {
878
+ const position = (0, exports.getElementPositionForDrop)({
879
+ dimensions: element.dimensions,
880
+ dropPosition,
881
+ });
882
+ const callInsertElementApi = (overwriteExisting) => (0, call_api_1.callApi)('/api/insert-element', {
879
883
  compositionFile,
880
884
  compositionId,
881
885
  element,
882
886
  from,
883
- position: (0, exports.getElementPositionForDrop)({
884
- dimensions: element.dimensions,
885
- dropPosition,
886
- }),
887
+ overwriteExisting,
888
+ position,
887
889
  });
890
+ let response = await callInsertElementApi(false);
891
+ if (!response.success && response.type === 'file-conflict') {
892
+ const shouldOverwrite = await confirmOverwrite(response.conflict);
893
+ if (!shouldOverwrite) {
894
+ return;
895
+ }
896
+ response = await callInsertElementApi(true);
897
+ }
888
898
  if (!response.success) {
889
- (0, NotificationCenter_1.showNotification)(`Could not add Element: ${response.reason}`, 4000);
899
+ const reason = response.type === 'error'
900
+ ? response.reason
901
+ : `Element file still conflicts: ${response.conflict.filePath}`;
902
+ (0, NotificationCenter_1.showNotification)(`Could not add Element: ${reason}`, 4000);
890
903
  return;
891
904
  }
892
905
  (0, NotificationCenter_1.showNotification)(`Added ${element.displayName} to source file`, 2000);
@@ -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) {
@@ -1,4 +1,4 @@
1
- import type { CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, InteractivitySchema, InteractivitySchemaField, SequencePropsSubscriptionKey, TSequence } from 'remotion';
1
+ import type { CanUpdateSequencePropStatus, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, InteractivitySchema, InteractivitySchemaField, SequencePropsSubscriptionKey, TSequence } from 'remotion';
2
2
  import type { SequenceNodePathInfo } from '../helpers/get-timeline-sequence-sort-key';
3
3
  import type { ComboboxValue } from './NewComposition/ComboBox';
4
4
  import type { SelectedOutlineUvHandle } from './selected-outline-uv';
@@ -7,6 +7,7 @@ export type SelectedOutlineContextMenuOpenResult = false | void | readonly Combo
7
7
  export type SelectedOutlineContextMenuOpenHandler = () => SelectedOutlineContextMenuOpenResult | Promise<SelectedOutlineContextMenuOpenResult>;
8
8
  export type SelectedOutlineTarget = {
9
9
  readonly key: string;
10
+ readonly canCrop: boolean;
10
11
  readonly containsSelection: boolean;
11
12
  readonly effectDrop: SelectedOutlineEffectDropTarget | null;
12
13
  readonly nodePathInfo: SequenceNodePathInfo;
@@ -14,12 +15,53 @@ export type SelectedOutlineTarget = {
14
15
  readonly selected: boolean;
15
16
  readonly selection: TimelineSelection;
16
17
  readonly sequence: TSequence;
18
+ readonly crop: {
19
+ readonly left: number;
20
+ readonly right: number;
21
+ readonly top: number;
22
+ readonly bottom: number;
23
+ };
24
+ readonly cropDrag: SelectedOutlineCropDragTarget | null;
17
25
  readonly drag: SelectedOutlineDragTarget | null;
18
26
  readonly scaleDrag: SelectedOutlineScaleDragTarget | null;
19
27
  readonly rotationDrag: SelectedOutlineRotationDragTarget | null;
20
28
  readonly transformOriginDrag: SelectedOutlineTransformOriginDragTarget | null;
21
29
  readonly uvHandles: readonly SelectedOutlineUvHandle[];
22
30
  };
31
+ export declare const cropFieldKeys: {
32
+ readonly left: "cropLeft";
33
+ readonly right: "cropRight";
34
+ readonly top: "cropTop";
35
+ readonly bottom: "cropBottom";
36
+ };
37
+ export type SelectedOutlineCropEdge = keyof typeof cropFieldKeys;
38
+ export type SelectedOutlineCropFieldKey = (typeof cropFieldKeys)[SelectedOutlineCropEdge];
39
+ export declare const canEditSelectedOutlineCrop: ({ schema, propStatuses, }: {
40
+ readonly schema: InteractivitySchema | null;
41
+ readonly propStatuses: Record<string, CanUpdateSequencePropStatus> | undefined;
42
+ }) => boolean;
43
+ export type SelectedOutlineCropHandle = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top' | 'right' | 'bottom' | 'left';
44
+ type CropNumberFieldSchema = Extract<InteractivitySchemaField, {
45
+ type: 'number';
46
+ }>;
47
+ export type SelectedOutlineCropField = {
48
+ readonly defaultValue: number | null | undefined;
49
+ readonly fieldSchema: CropNumberFieldSchema;
50
+ readonly propStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
51
+ readonly value: number;
52
+ };
53
+ export type SelectedOutlineCropDragTarget = {
54
+ readonly clientId: string;
55
+ readonly fields: Record<SelectedOutlineCropFieldKey, SelectedOutlineCropField>;
56
+ readonly nodePath: SequencePropsSubscriptionKey;
57
+ readonly schema: InteractivitySchema;
58
+ readonly sourceFrame: number;
59
+ readonly transformOrigin: {
60
+ readonly defaultValue: string | undefined;
61
+ readonly propStatus: CanUpdateSequencePropStatus;
62
+ readonly value: string;
63
+ } | null;
64
+ };
23
65
  export type SelectedOutlineEffectDropTarget = {
24
66
  readonly clientId: string;
25
67
  readonly fileName: string;
@@ -119,3 +161,4 @@ export type SelectedOutlineKeyboardNudgeSession = {
119
161
  deltaY: number;
120
162
  lastValues: ReadonlyMap<string, string>;
121
163
  };
164
+ export {};
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emptyContextMenuValues = exports.outlineContainer = exports.selectedOutlineDragThresholdPx = exports.transformOriginFieldKey = exports.rotateFieldKey = exports.scaleFieldKey = exports.translateFieldKey = void 0;
3
+ exports.emptyContextMenuValues = exports.outlineContainer = exports.selectedOutlineDragThresholdPx = exports.transformOriginFieldKey = exports.rotateFieldKey = exports.scaleFieldKey = exports.translateFieldKey = exports.canEditSelectedOutlineCrop = exports.cropFieldKeys = void 0;
4
+ exports.cropFieldKeys = {
5
+ left: 'cropLeft',
6
+ right: 'cropRight',
7
+ top: 'cropTop',
8
+ bottom: 'cropBottom',
9
+ };
10
+ const canEditSelectedOutlineCrop = ({ schema, propStatuses, }) => {
11
+ for (const fieldKey of Object.values(exports.cropFieldKeys)) {
12
+ const fieldSchema = schema === null || schema === void 0 ? void 0 : schema[fieldKey];
13
+ const propStatus = propStatuses === null || propStatuses === void 0 ? void 0 : propStatuses[fieldKey];
14
+ const canEditStatus = (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ||
15
+ ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' &&
16
+ propStatus.interpolationFunction === 'interpolate');
17
+ if ((fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) !== 'number' || !canEditStatus) {
18
+ return false;
19
+ }
20
+ }
21
+ return true;
22
+ };
23
+ exports.canEditSelectedOutlineCrop = canEditSelectedOutlineCrop;
4
24
  exports.translateFieldKey = 'style.translate';
5
25
  exports.scaleFieldKey = 'style.scale';
6
26
  exports.rotateFieldKey = 'style.rotate';
@@ -0,0 +1,2 @@
1
+ import type { InsertElementFileConflict } from '@remotion/studio-shared';
2
+ export declare const useElementOverwriteConfirmation: () => (conflict: InsertElementFileConflict) => Promise<boolean>;