@remotion/studio 4.0.489 → 4.0.491

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 (109) hide show
  1. package/dist/components/Canvas.js +20 -2
  2. package/dist/components/CurrentComposition.js +4 -1
  3. package/dist/components/EditorContent.js +1 -1
  4. package/dist/components/GlobalKeybindings.d.ts +1 -3
  5. package/dist/components/GlobalKeybindings.js +2 -9
  6. package/dist/components/InspectorLocationCopy.d.ts +7 -0
  7. package/dist/components/InspectorLocationCopy.js +65 -0
  8. package/dist/components/InspectorPanel/AlignmentControls.d.ts +5 -0
  9. package/dist/components/InspectorPanel/AlignmentControls.js +205 -0
  10. package/dist/components/InspectorPanel/EasingInspector.js +8 -2
  11. package/dist/components/InspectorPanel/KeyframeSettings.d.ts +5 -0
  12. package/dist/components/InspectorPanel/KeyframeSettings.js +142 -0
  13. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +4 -3
  14. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +2 -1
  15. package/dist/components/InspectorPanel/alignment-controls.d.ts +12 -0
  16. package/dist/components/InspectorPanel/alignment-controls.js +42 -0
  17. package/dist/components/InspectorSequenceSection.d.ts +1 -0
  18. package/dist/components/InspectorSequenceSection.js +2 -2
  19. package/dist/components/KeyboardShortcutsExplainer.js +4 -0
  20. package/dist/components/MobilePanel.js +9 -3
  21. package/dist/components/Modals.js +1 -2
  22. package/dist/components/NewComposition/CancelButton.d.ts +1 -0
  23. package/dist/components/NewComposition/CancelButton.js +6 -2
  24. package/dist/components/OptionsPanel.js +4 -8
  25. package/dist/components/OutlineToggle.d.ts +3 -1
  26. package/dist/components/OutlineToggle.js +2 -2
  27. package/dist/components/Preview.js +1 -1
  28. package/dist/components/PreviewToolbar.js +1 -1
  29. package/dist/components/RenderButton.js +9 -33
  30. package/dist/components/RenderModal/WebRenderModal.js +3 -8
  31. package/dist/components/RenderModal/WebRenderModalAdvanced.d.ts +0 -2
  32. package/dist/components/RenderModal/WebRenderModalAdvanced.js +2 -9
  33. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +0 -2
  34. package/dist/components/RenderQueue/client-side-render-types.d.ts +0 -1
  35. package/dist/components/RenderQueue/index.js +0 -9
  36. package/dist/components/SelectedOutlineElement.js +40 -38
  37. package/dist/components/SelectedOutlineOverlay.d.ts +7 -2
  38. package/dist/components/SelectedOutlineOverlay.js +249 -22
  39. package/dist/components/SnappingToggle.d.ts +3 -1
  40. package/dist/components/SnappingToggle.js +2 -2
  41. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +20 -1
  42. package/dist/components/Timeline/TimelineClipboardKeybindings.js +304 -155
  43. package/dist/components/Timeline/TimelineEffectPropItem.js +9 -61
  44. package/dist/components/Timeline/TimelineFieldLabel.d.ts +1 -0
  45. package/dist/components/Timeline/TimelineFieldLabel.js +4 -2
  46. package/dist/components/Timeline/TimelineFieldRowContent.d.ts +8 -0
  47. package/dist/components/Timeline/TimelineFieldRowContent.js +16 -0
  48. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +1 -1
  49. package/dist/components/Timeline/TimelineRowChrome.js +2 -0
  50. package/dist/components/Timeline/TimelineSequence.js +2 -4
  51. package/dist/components/Timeline/TimelineSequenceItem.js +6 -9
  52. package/dist/components/Timeline/TimelineSequenceName.js +1 -3
  53. package/dist/components/Timeline/TimelineSequencePropItem.js +10 -59
  54. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +2 -0
  55. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +18 -6
  56. package/dist/components/Timeline/TimelineTextContentField.js +12 -5
  57. package/dist/components/Timeline/TimelineVideoInfo.d.ts +3 -1
  58. package/dist/components/Timeline/TimelineVideoInfo.js +11 -4
  59. package/dist/components/Timeline/delete-selected-timeline-item.js +4 -5
  60. package/dist/components/Timeline/effects-clipboard.d.ts +14 -0
  61. package/dist/components/Timeline/effects-clipboard.js +68 -0
  62. package/dist/components/Timeline/get-sequence-context-menu-items.js +37 -0
  63. package/dist/components/Timeline/get-timeline-media-start-frame.d.ts +6 -0
  64. package/dist/components/Timeline/get-timeline-media-start-frame.js +15 -0
  65. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -2
  66. package/dist/components/Timeline/sequence-props-subscription-store.js +4 -2
  67. package/dist/components/Timeline/timeline-field-row-layout.d.ts +1 -0
  68. package/dist/components/Timeline/timeline-field-row-layout.js +8 -1
  69. package/dist/components/Timeline/timeline-row-layout.d.ts +1 -1
  70. package/dist/components/Timeline/timeline-row-layout.js +1 -1
  71. package/dist/components/Timeline/use-sequence-props-subscription.js +10 -1
  72. package/dist/components/import-assets.d.ts +5 -0
  73. package/dist/components/import-assets.js +10 -2
  74. package/dist/components/selected-outline-measurement.d.ts +4 -0
  75. package/dist/components/selected-outline-measurement.js +3 -1
  76. package/dist/components/selected-outline-types.d.ts +1 -6
  77. package/dist/esm/{chunk-jrta3xaf.js → chunk-9wh9k3jj.js} +10393 -9551
  78. package/dist/esm/index.mjs +0 -1
  79. package/dist/esm/internals.mjs +10393 -9551
  80. package/dist/esm/previewEntry.mjs +7603 -6761
  81. package/dist/esm/renderEntry.mjs +1 -1
  82. package/dist/helpers/format-file-location.d.ts +5 -0
  83. package/dist/helpers/format-file-location.js +9 -1
  84. package/dist/helpers/install-required-package.d.ts +1 -0
  85. package/dist/helpers/install-required-package.js +3 -2
  86. package/dist/helpers/retry-payload.js +0 -1
  87. package/dist/helpers/studio-runtime-config.d.ts +0 -1
  88. package/dist/helpers/studio-runtime-config.js +1 -6
  89. package/dist/helpers/use-menu-structure.js +15 -18
  90. package/dist/icons/align-bottom.d.ts +3 -0
  91. package/dist/icons/align-bottom.js +12 -0
  92. package/dist/icons/align-center-horizontal.d.ts +3 -0
  93. package/dist/icons/align-center-horizontal.js +12 -0
  94. package/dist/icons/align-center-vertical.d.ts +3 -0
  95. package/dist/icons/align-center-vertical.js +12 -0
  96. package/dist/icons/align-left.d.ts +3 -0
  97. package/dist/icons/align-left.js +12 -0
  98. package/dist/icons/align-right.d.ts +3 -0
  99. package/dist/icons/align-right.js +12 -0
  100. package/dist/icons/align-top.d.ts +3 -0
  101. package/dist/icons/align-top.js +12 -0
  102. package/dist/state/modals.d.ts +1 -3
  103. package/package.json +11 -11
  104. package/dist/components/RenderModal/WebRendererExperimentalBadge.d.ts +0 -1
  105. package/dist/components/RenderModal/WebRendererExperimentalBadge.js +0 -35
  106. package/dist/components/Timeline/KeyframeSettingsModal.d.ts +0 -15
  107. package/dist/components/Timeline/KeyframeSettingsModal.js +0 -151
  108. package/dist/helpers/show-browser-rendering.d.ts +0 -1
  109. package/dist/helpers/show-browser-rendering.js +0 -5
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SelectedOutlineElement = exports.SelectedOutlineTransformOriginHandle = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = __importStar(require("react"));
39
- const react_dom_1 = require("react-dom");
40
39
  const remotion_1 = require("remotion");
41
40
  const no_react_1 = require("remotion/no-react");
42
41
  const client_id_1 = require("../helpers/client-id");
@@ -51,7 +50,6 @@ const ContextMenu_1 = require("./ContextMenu");
51
50
  const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
52
51
  const ForceSpecificCursor_1 = require("./ForceSpecificCursor");
53
52
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
54
- const options_sidebar_tabs_1 = require("./options-sidebar-tabs");
55
53
  const selected_outline_drag_1 = require("./selected-outline-drag");
56
54
  const selected_outline_measurement_1 = require("./selected-outline-measurement");
57
55
  const selected_outline_snap_1 = require("./selected-outline-snap");
@@ -320,7 +318,7 @@ const SelectedOutlineTransformOriginHandle = ({ outline, onDraggingChange, targe
320
318
  ] }));
321
319
  };
322
320
  exports.SelectedOutlineTransformOriginHandle = SelectedOutlineTransformOriginHandle;
323
- const SelectedOutlinePolygon = ({ allDragTargets, allDragOutlines, contextMenuValues, dragging, hovered, onContextMenuOpen, outline, onDraggingChange, onHoverChange, onSnapPointsChange, onSelect, onTextEditStart, scale, snapTargets, target, }) => {
321
+ const SelectedOutlinePolygon = ({ allDragTargets, allDragOutlines, contextMenuValues, dragging, hovered, onContextMenuOpen, outline, onDraggingChange, onHoverChange, onSnapPointsChange, onSelect, onDoubleClickTarget, scale, snapTargets, target, }) => {
324
322
  var _a, _b, _c, _d;
325
323
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
326
324
  const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
@@ -532,10 +530,12 @@ const SelectedOutlinePolygon = ({ allDragTargets, allDragOutlines, contextMenuVa
532
530
  if (target === undefined) {
533
531
  return;
534
532
  }
533
+ if (!onDoubleClickTarget(target, event.button)) {
534
+ return;
535
+ }
535
536
  event.preventDefault();
536
537
  event.stopPropagation();
537
- onTextEditStart(target);
538
- }, [onTextEditStart, target]);
538
+ }, [onDoubleClickTarget, target]);
539
539
  const onEffectDragOver = react_1.default.useCallback((event) => {
540
540
  if (effectDrop === null || !(0, effect_drag_and_drop_1.hasEffectDragType)(event.dataTransfer)) {
541
541
  return;
@@ -982,28 +982,42 @@ const SelectedOutlineElement = ({ allDragTargets, allDragOutlines, allRotationDr
982
982
  const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
983
983
  const selectAsset = (0, use_select_asset_1.useSelectAsset)();
984
984
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
985
- const onTextEditStart = react_1.default.useCallback((editTarget) => {
986
- const { textEdit } = editTarget;
987
- if (textEdit === null) {
988
- return;
985
+ const resolveOriginalLocation = react_1.default.useCallback(async (resolveTarget) => {
986
+ const stack = resolveTarget.sequence.getStack();
987
+ if (!stack) {
988
+ return null;
989
989
  }
990
- if (textEdit.propStatus.status !== 'static' ||
991
- typeof textEdit.propStatus.codeValue !== 'string') {
992
- (0, NotificationCenter_1.showNotification)('This text is computed and cannot be edited visually', 3000);
993
- return;
990
+ let originalLocation = null;
991
+ try {
992
+ originalLocation = await (0, get_stack_1.getOriginalLocationFromStack)(stack, 'sequence');
994
993
  }
995
- (0, react_dom_1.flushSync)(() => {
996
- var _a;
997
- if (!editTarget.selected) {
998
- onSelect(editTarget.selection, { shiftKey: false, toggleKey: false });
999
- }
1000
- (_a = options_sidebar_tabs_1.optionsSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectInspectorPanel();
994
+ catch (err) {
995
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
996
+ }
997
+ updateResolvedStackTrace(stack, originalLocation);
998
+ return originalLocation;
999
+ }, [updateResolvedStackTrace]);
1000
+ const onDoubleClickTarget = react_1.default.useCallback((doubleClickTarget, button) => {
1001
+ const action = (0, selected_outline_measurement_1.getOutlineDoubleClickAction)({
1002
+ button,
1003
+ canOpenInEditor: previewServerState.type === 'connected' &&
1004
+ Boolean(window.remotion_editorName),
1001
1005
  });
1002
- (0, focus_inspector_field_1.requestFocusInspectorField)({
1003
- fieldKey: 'children',
1004
- nodePath: textEdit.nodePath,
1006
+ if (action === null) {
1007
+ return false;
1008
+ }
1009
+ const openTargetInEditor = async () => {
1010
+ const originalLocation = await resolveOriginalLocation(doubleClickTarget);
1011
+ if (originalLocation === null) {
1012
+ return;
1013
+ }
1014
+ await (0, open_in_editor_1.openOriginalPositionInEditor)(originalLocation);
1015
+ };
1016
+ openTargetInEditor().catch((err) => {
1017
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
1005
1018
  });
1006
- }, [onSelect]);
1019
+ return true;
1020
+ }, [previewServerState.type, resolveOriginalLocation]);
1007
1021
  const onContextMenuOpen = react_1.default.useCallback(async () => {
1008
1022
  if (target === undefined || previewServerState.type !== 'connected') {
1009
1023
  return false;
@@ -1011,19 +1025,7 @@ const SelectedOutlineElement = ({ allDragTargets, allDragOutlines, allRotationDr
1011
1025
  if (!target.selected) {
1012
1026
  onSelect(target.selection, { shiftKey: false, toggleKey: false });
1013
1027
  }
1014
- const stack = target.sequence.getStack();
1015
- let originalLocation = null;
1016
- if (stack) {
1017
- try {
1018
- originalLocation = await (0, get_stack_1.getOriginalLocationFromStack)(stack, 'sequence');
1019
- }
1020
- catch (err) {
1021
- (0, NotificationCenter_1.showNotification)(err.message, 2000);
1022
- }
1023
- }
1024
- if (stack) {
1025
- updateResolvedStackTrace(stack, originalLocation);
1026
- }
1028
+ const originalLocation = await resolveOriginalLocation(target);
1027
1029
  const fileLocation = (0, format_file_location_1.formatFileLocation)({
1028
1030
  location: originalLocation,
1029
1031
  root: window.remotion_cwd,
@@ -1152,14 +1154,14 @@ const SelectedOutlineElement = ({ allDragTargets, allDragOutlines, allRotationDr
1152
1154
  confirm,
1153
1155
  onSelect,
1154
1156
  previewServerState,
1157
+ resolveOriginalLocation,
1155
1158
  selectAsset,
1156
1159
  setSelectedModal,
1157
1160
  setPropStatuses,
1158
1161
  target,
1159
- updateResolvedStackTrace,
1160
1162
  ]);
1161
1163
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
1162
- jsx_runtime_1.jsx(SelectedOutlinePolygon, { allDragTargets: allDragTargets, allDragOutlines: allDragOutlines, contextMenuValues: emptyContextMenuValues, dragging: dragging, hovered: hovered, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSnapPointsChange: onSnapPointsChange, onSelect: onSelect, onTextEditStart: onTextEditStart, scale: scale, snapTargets: snapTargets, target: target }), (target === null || target === void 0 ? void 0 : target.containsSelection) || hovered
1164
+ jsx_runtime_1.jsx(SelectedOutlinePolygon, { allDragTargets: allDragTargets, allDragOutlines: allDragOutlines, contextMenuValues: emptyContextMenuValues, dragging: dragging, hovered: hovered, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSnapPointsChange: onSnapPointsChange, onSelect: onSelect, onDoubleClickTarget: onDoubleClickTarget, scale: scale, snapTargets: snapTargets, target: target }), (target === null || target === void 0 ? void 0 : target.containsSelection) || hovered
1163
1165
  ? ['top', 'right', 'bottom', 'left'].map((edge) => (jsx_runtime_1.jsx(SelectedOutlineScaleEdgeLine, { allScaleDragTargets: allScaleDragTargets, contextMenuValues: emptyContextMenuValues, dragging: dragging, edge: edge, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, target: target }, edge)))
1164
1166
  : null, (target === null || target === void 0 ? void 0 : target.containsSelection) || hovered
1165
1167
  ? ['top-left', 'top-right', 'bottom-right', 'bottom-left'].map((corner) => (jsx_runtime_1.jsx(SelectedOutlineRotationCornerHandle, { allRotationDragTargets: allRotationDragTargets, contextMenuValues: emptyContextMenuValues, corner: corner, dragging: dragging, outline: outline, onContextMenuOpen: onContextMenuOpen, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSelect: onSelect, target: target }, corner)))
@@ -2,11 +2,16 @@ import React from 'react';
2
2
  import { type SelectedOutline } from './selected-outline-geometry';
3
3
  import { type SelectedOutlineTarget } from './selected-outline-types';
4
4
  export { applySelectedOutlineDragAxisLock, applySelectedOutlineTransformOriginAxisLock, compensateTranslateForTransformOrigin, getSelectedOutlineActiveSchema, getSelectedOutlineDragChanges, getSelectedOutlineDragValues, getSelectedOutlineKeyboardNudgeDelta, getSelectedOutlineKeyboardNudgeDeltas, getSelectedOutlineRotationDragChanges, getSelectedOutlineRotationDragStates, getSelectedOutlineRotationDragValues, getSelectedOutlineScaleDragChanges, getSelectedOutlineScaleDragStates, getSelectedOutlineScaleDragValues, getSelectedOutlineScaleEdgeInfo, getSelectedOutlineTransformOriginLockedAxis, isSelectedOutlineDragPastThreshold, selectedOutlineTransformOriginSnapThresholdPx, selectedOutlineUvSnapThresholdPx, snapSelectedOutlineRotationDeltaDegrees, snapSelectedOutlineTransformOriginUv, snapSelectedOutlineUv, } from './selected-outline-drag';
5
- export { getOutlineSelectionInteraction, getSelectedEffectFieldsBySequenceKey, getSelectedOutlineRotationCornerInfo, getSelectedOutlineRotationDeltaDegrees, getSelectedOutlineRotationPivot, getSelectedSequenceKeys, getSequencesWithSelectableOutlines, getTransformedSvgViewportPoints, } from './selected-outline-measurement';
5
+ export { getOutlineDoubleClickAction, getOutlineSelectionInteraction, getSelectedEffectFieldsBySequenceKey, getSelectedOutlineRotationCornerInfo, getSelectedOutlineRotationDeltaDegrees, getSelectedOutlineRotationPivot, getSelectedSequenceKeys, getSequencesWithSelectableOutlines, getTransformedSvgViewportPoints, } from './selected-outline-measurement';
6
6
  export { selectedOutlineDragThresholdPx } from './selected-outline-types';
7
7
  export type { SelectedOutlineDragState, SelectedOutlineRotationDragState, SelectedOutlineScaleDragState, } from './selected-outline-types';
8
- export declare const orderOutlinesForRendering: ({ outlines, targetsByKey, }: {
8
+ type OutlineSequenceParent = {
9
+ readonly id: string;
10
+ readonly parent: string | null;
11
+ };
12
+ export declare const orderOutlinesForRendering: ({ outlines, sequences, targetsByKey, }: {
9
13
  readonly outlines: readonly SelectedOutline[];
14
+ readonly sequences: readonly OutlineSequenceParent[];
10
15
  readonly targetsByKey: ReadonlyMap<string, SelectedOutlineTarget>;
11
16
  }) => readonly SelectedOutline[];
12
17
  export declare const SelectedOutlineOverlay: React.FC<{
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.SelectedOutlineOverlay = exports.orderOutlinesForRendering = exports.selectedOutlineDragThresholdPx = exports.getTransformedSvgViewportPoints = exports.getSequencesWithSelectableOutlines = exports.getSelectedSequenceKeys = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationDeltaDegrees = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.snapSelectedOutlineUv = exports.snapSelectedOutlineTransformOriginUv = exports.snapSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineUvSnapThresholdPx = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.isSelectedOutlineDragPastThreshold = exports.getSelectedOutlineTransformOriginLockedAxis = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragChanges = exports.getSelectedOutlineActiveSchema = exports.compensateTranslateForTransformOrigin = exports.applySelectedOutlineTransformOriginAxisLock = exports.applySelectedOutlineDragAxisLock = void 0;
36
+ exports.SelectedOutlineOverlay = exports.orderOutlinesForRendering = exports.selectedOutlineDragThresholdPx = exports.getTransformedSvgViewportPoints = exports.getSequencesWithSelectableOutlines = exports.getSelectedSequenceKeys = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationDeltaDegrees = exports.getSelectedOutlineRotationCornerInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getOutlineDoubleClickAction = exports.snapSelectedOutlineUv = exports.snapSelectedOutlineTransformOriginUv = exports.snapSelectedOutlineRotationDeltaDegrees = exports.selectedOutlineUvSnapThresholdPx = exports.selectedOutlineTransformOriginSnapThresholdPx = exports.isSelectedOutlineDragPastThreshold = exports.getSelectedOutlineTransformOriginLockedAxis = exports.getSelectedOutlineScaleEdgeInfo = exports.getSelectedOutlineScaleDragValues = exports.getSelectedOutlineScaleDragStates = exports.getSelectedOutlineScaleDragChanges = exports.getSelectedOutlineRotationDragValues = exports.getSelectedOutlineRotationDragStates = exports.getSelectedOutlineRotationDragChanges = exports.getSelectedOutlineKeyboardNudgeDeltas = exports.getSelectedOutlineKeyboardNudgeDelta = exports.getSelectedOutlineDragValues = exports.getSelectedOutlineDragChanges = exports.getSelectedOutlineActiveSchema = exports.compensateTranslateForTransformOrigin = exports.applySelectedOutlineTransformOriginAxisLock = exports.applySelectedOutlineDragAxisLock = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const player_1 = require("@remotion/player");
39
39
  const react_1 = __importStar(require("react"));
@@ -82,6 +82,7 @@ Object.defineProperty(exports, "snapSelectedOutlineRotationDeltaDegrees", { enum
82
82
  Object.defineProperty(exports, "snapSelectedOutlineTransformOriginUv", { enumerable: true, get: function () { return selected_outline_drag_2.snapSelectedOutlineTransformOriginUv; } });
83
83
  Object.defineProperty(exports, "snapSelectedOutlineUv", { enumerable: true, get: function () { return selected_outline_drag_2.snapSelectedOutlineUv; } });
84
84
  const selected_outline_measurement_2 = require("./selected-outline-measurement");
85
+ Object.defineProperty(exports, "getOutlineDoubleClickAction", { enumerable: true, get: function () { return selected_outline_measurement_2.getOutlineDoubleClickAction; } });
85
86
  Object.defineProperty(exports, "getOutlineSelectionInteraction", { enumerable: true, get: function () { return selected_outline_measurement_2.getOutlineSelectionInteraction; } });
86
87
  Object.defineProperty(exports, "getSelectedEffectFieldsBySequenceKey", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedEffectFieldsBySequenceKey; } });
87
88
  Object.defineProperty(exports, "getSelectedOutlineRotationCornerInfo", { enumerable: true, get: function () { return selected_outline_measurement_2.getSelectedOutlineRotationCornerInfo; } });
@@ -111,13 +112,251 @@ const SelectedOutlineSnapIndicators = ({ activeSnapPoints, compositionHeight, co
111
112
  return (jsx_runtime_1.jsx("line", { x1: 0, x2: compositionWidth * scale, y1: y, y2: y, stroke: selected_outline_snap_1.selectedOutlineSnapIndicatorColor, strokeWidth: 1, vectorEffect: "non-scaling-stroke" }, `${snapPoint.target.axis}-${snapPoint.target.type}-${snapPoint.target.position}-${snapPoint.edge}`));
112
113
  }) }));
113
114
  };
114
- const orderOutlinesForRendering = ({ outlines, targetsByKey, }) => {
115
- return [...outlines].sort((a, b) => {
116
- var _a, _b;
117
- var _c, _d;
118
- const aSelected = (_c = (_a = targetsByKey.get(a.key)) === null || _a === void 0 ? void 0 : _a.selected) !== null && _c !== void 0 ? _c : false;
119
- const bSelected = (_d = (_b = targetsByKey.get(b.key)) === null || _b === void 0 ? void 0 : _b.selected) !== null && _d !== void 0 ? _d : false;
120
- return Number(aSelected) - Number(bSelected);
115
+ const outlinePointEqualityTolerance = 0.5;
116
+ const outlineAreaEqualityTolerance = 0.5;
117
+ const outlineBoundsOverlapTolerance = 0.5;
118
+ const outlinePointsAreEquivalent = (a, b) => {
119
+ return (Math.abs(a.x - b.x) <= outlinePointEqualityTolerance &&
120
+ Math.abs(a.y - b.y) <= outlinePointEqualityTolerance);
121
+ };
122
+ const outlinesHaveEquivalentHitArea = (a, b) => {
123
+ if (a.points.length !== b.points.length) {
124
+ return false;
125
+ }
126
+ for (let startIndex = 0; startIndex < b.points.length; startIndex++) {
127
+ for (const direction of [1, -1]) {
128
+ const pointsMatch = a.points.every((point, index) => {
129
+ const bIndex = (startIndex + direction * index + b.points.length) % b.points.length;
130
+ return outlinePointsAreEquivalent(point, b.points[bIndex]);
131
+ });
132
+ if (pointsMatch) {
133
+ return true;
134
+ }
135
+ }
136
+ }
137
+ return false;
138
+ };
139
+ const getOutlineHitArea = (outline) => {
140
+ let area = 0;
141
+ for (let i = 0; i < outline.points.length; i++) {
142
+ const current = outline.points[i];
143
+ const next = outline.points[(i + 1) % outline.points.length];
144
+ area += current.x * next.y - next.x * current.y;
145
+ }
146
+ return Math.abs(area) / 2;
147
+ };
148
+ const getOutlineBounds = (outline) => {
149
+ const xs = outline.points.map((point) => point.x);
150
+ const ys = outline.points.map((point) => point.y);
151
+ return {
152
+ maxX: Math.max(...xs),
153
+ maxY: Math.max(...ys),
154
+ minX: Math.min(...xs),
155
+ minY: Math.min(...ys),
156
+ };
157
+ };
158
+ const outlineBoundsOverlap = (a, b) => {
159
+ const aBounds = getOutlineBounds(a);
160
+ const bBounds = getOutlineBounds(b);
161
+ return (aBounds.minX <= bBounds.maxX + outlineBoundsOverlapTolerance &&
162
+ aBounds.maxX + outlineBoundsOverlapTolerance >= bBounds.minX &&
163
+ aBounds.minY <= bBounds.maxY + outlineBoundsOverlapTolerance &&
164
+ aBounds.maxY + outlineBoundsOverlapTolerance >= bBounds.minY);
165
+ };
166
+ const getSequenceId = (target) => {
167
+ var _a;
168
+ var _b;
169
+ return (_b = (_a = target === null || target === void 0 ? void 0 : target.sequence) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
170
+ };
171
+ const getParentBySequenceId = ({ sequences, targetsByKey, }) => {
172
+ const parentBySequenceId = new Map();
173
+ for (const sequence of sequences) {
174
+ parentBySequenceId.set(sequence.id, sequence.parent);
175
+ }
176
+ for (const target of targetsByKey.values()) {
177
+ const sequenceId = getSequenceId(target);
178
+ if (sequenceId !== null && !parentBySequenceId.has(sequenceId)) {
179
+ parentBySequenceId.set(sequenceId, target.sequence.parent);
180
+ }
181
+ }
182
+ return parentBySequenceId;
183
+ };
184
+ const isAncestorTarget = ({ ancestor, descendant, parentBySequenceId, }) => {
185
+ var _a;
186
+ var _b, _c;
187
+ const ancestorId = getSequenceId(ancestor);
188
+ if (ancestorId === null) {
189
+ return false;
190
+ }
191
+ let parentId = (_b = (_a = descendant.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
192
+ while (parentId !== null) {
193
+ if (parentId === ancestorId) {
194
+ return true;
195
+ }
196
+ parentId = (_c = parentBySequenceId.get(parentId)) !== null && _c !== void 0 ? _c : null;
197
+ }
198
+ return false;
199
+ };
200
+ const orderOutlineGroup = ({ outlines, parentBySequenceId, targetsByKey, }) => {
201
+ var _a;
202
+ var _b, _c, _d, _e;
203
+ const incomingEdges = new Map();
204
+ const outgoingEdges = new Map();
205
+ const outlinesByKey = new Map(outlines.map((outline) => [outline.key, outline]));
206
+ for (const outline of outlines) {
207
+ incomingEdges.set(outline.key, new Set());
208
+ outgoingEdges.set(outline.key, new Set());
209
+ }
210
+ const hasPath = ({ fromKey, seen, toKey, }) => {
211
+ var _a;
212
+ if (fromKey === toKey) {
213
+ return true;
214
+ }
215
+ if (seen.has(fromKey)) {
216
+ return false;
217
+ }
218
+ seen.add(fromKey);
219
+ for (const nextKey of (_a = outgoingEdges.get(fromKey)) !== null && _a !== void 0 ? _a : []) {
220
+ if (hasPath({ fromKey: nextKey, seen, toKey })) {
221
+ return true;
222
+ }
223
+ }
224
+ return false;
225
+ };
226
+ const addEdge = (before, after, options) => {
227
+ if (before.key === after.key) {
228
+ return;
229
+ }
230
+ const incoming = incomingEdges.get(after.key);
231
+ const outgoing = outgoingEdges.get(before.key);
232
+ if (incoming === undefined || outgoing === undefined) {
233
+ throw new Error('Expected outline to be registered before adding edge');
234
+ }
235
+ if (outgoing.has(after.key)) {
236
+ return;
237
+ }
238
+ if (hasPath({ fromKey: after.key, seen: new Set(), toKey: before.key })) {
239
+ if (options === null || options === void 0 ? void 0 : options.skipIfCycle) {
240
+ return;
241
+ }
242
+ throw new Error('Could not determine a stable outline rendering order');
243
+ }
244
+ incoming.add(before.key);
245
+ outgoing.add(after.key);
246
+ };
247
+ const addAncestorConstraint = ({ ancestor, descendant, descendantContainsSelection, equivalentHitArea, }) => {
248
+ // Usually, children should be above parents so nested elements are directly
249
+ // selectable. If an unselected child has the same hit area as its parent, put
250
+ // it below the parent so the wrapper can be selected. Once the child or
251
+ // one of its properties is selected, keep it above the parent so it remains
252
+ // directly draggable.
253
+ if (equivalentHitArea && !descendantContainsSelection) {
254
+ addEdge(descendant, ancestor);
255
+ }
256
+ else {
257
+ addEdge(ancestor, descendant);
258
+ }
259
+ };
260
+ const outlineBySequenceId = new Map();
261
+ for (const outline of outlines) {
262
+ const sequenceId = getSequenceId(targetsByKey.get(outline.key));
263
+ if (sequenceId !== null) {
264
+ outlineBySequenceId.set(sequenceId, outline);
265
+ }
266
+ }
267
+ // Only constrain each outline against its nearest rendered ancestor. The
268
+ // resulting graph follows the sequence tree, so pairwise subpixel equivalence
269
+ // cannot introduce contradictory edges across three nested outlines.
270
+ for (const descendant of outlines) {
271
+ const descendantTarget = targetsByKey.get(descendant.key);
272
+ let parentId = (_b = (_a = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
273
+ while (parentId !== null) {
274
+ const ancestor = outlineBySequenceId.get(parentId);
275
+ if (ancestor !== undefined) {
276
+ addAncestorConstraint({
277
+ ancestor,
278
+ descendant,
279
+ descendantContainsSelection: ((_c = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.selected) !== null && _c !== void 0 ? _c : false) ||
280
+ ((_d = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.containsSelection) !== null && _d !== void 0 ? _d : false),
281
+ equivalentHitArea: outlinesHaveEquivalentHitArea(ancestor, descendant),
282
+ });
283
+ break;
284
+ }
285
+ parentId = (_e = parentBySequenceId.get(parentId)) !== null && _e !== void 0 ? _e : null;
286
+ }
287
+ }
288
+ // For unrelated overlapping outlines, put broader hit targets below
289
+ // smaller ones so a large selected sequence cannot swallow clicks on
290
+ // a more specific element in the same canvas area.
291
+ for (let i = 0; i < outlines.length; i++) {
292
+ for (let j = i + 1; j < outlines.length; j++) {
293
+ const a = outlines[i];
294
+ const b = outlines[j];
295
+ const aTarget = targetsByKey.get(a.key);
296
+ const bTarget = targetsByKey.get(b.key);
297
+ if (aTarget === undefined || bTarget === undefined) {
298
+ continue;
299
+ }
300
+ const aAncestorOfB = isAncestorTarget({
301
+ ancestor: aTarget,
302
+ descendant: bTarget,
303
+ parentBySequenceId,
304
+ });
305
+ const bAncestorOfA = isAncestorTarget({
306
+ ancestor: bTarget,
307
+ descendant: aTarget,
308
+ parentBySequenceId,
309
+ });
310
+ if (aAncestorOfB || bAncestorOfA || !outlineBoundsOverlap(a, b)) {
311
+ continue;
312
+ }
313
+ const aArea = getOutlineHitArea(a);
314
+ const bArea = getOutlineHitArea(b);
315
+ if (Math.abs(aArea - bArea) <= outlineAreaEqualityTolerance) {
316
+ continue;
317
+ }
318
+ if (aArea > bArea) {
319
+ addEdge(a, b, { skipIfCycle: true });
320
+ }
321
+ else {
322
+ addEdge(b, a, { skipIfCycle: true });
323
+ }
324
+ }
325
+ }
326
+ const emitted = new Set();
327
+ const visiting = new Set();
328
+ const ordered = [];
329
+ const visit = (outline) => {
330
+ var _a;
331
+ if (emitted.has(outline.key)) {
332
+ return;
333
+ }
334
+ if (visiting.has(outline.key)) {
335
+ throw new Error('Could not determine a stable outline rendering order');
336
+ }
337
+ visiting.add(outline.key);
338
+ for (const dependencyKey of (_a = incomingEdges.get(outline.key)) !== null && _a !== void 0 ? _a : []) {
339
+ const dependency = outlinesByKey.get(dependencyKey);
340
+ if (dependency === undefined) {
341
+ throw new Error('Expected outline dependency to exist');
342
+ }
343
+ visit(dependency);
344
+ }
345
+ visiting.delete(outline.key);
346
+ emitted.add(outline.key);
347
+ ordered.push(outline);
348
+ };
349
+ for (const outline of outlines) {
350
+ visit(outline);
351
+ }
352
+ return ordered;
353
+ };
354
+ const orderOutlinesForRendering = ({ outlines, sequences, targetsByKey, }) => {
355
+ const parentBySequenceId = getParentBySequenceId({ sequences, targetsByKey });
356
+ return orderOutlineGroup({
357
+ outlines,
358
+ parentBySequenceId,
359
+ targetsByKey,
121
360
  });
122
361
  };
123
362
  exports.orderOutlinesForRendering = orderOutlinesForRendering;
@@ -201,8 +440,6 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
201
440
  const rotationPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.rotateFieldKey];
202
441
  const transformOriginFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema[selected_outline_types_1.transformOriginFieldKey];
203
442
  const transformOriginPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses[selected_outline_types_1.transformOriginFieldKey];
204
- const textContentFieldSchema = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema.children;
205
- const textContentPropStatus = nodePropStatuses === null || nodePropStatuses === void 0 ? void 0 : nodePropStatuses.children;
206
443
  const transformOriginValueForRotation = (transformOriginFieldSchema === null || transformOriginFieldSchema === void 0 ? void 0 : transformOriginFieldSchema.type) === 'transform-origin' &&
207
444
  ((transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'static' ||
208
445
  (transformOriginPropStatus === null || transformOriginPropStatus === void 0 ? void 0 : transformOriginPropStatus.status) === 'keyframed')
@@ -255,10 +492,6 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
255
492
  canTransformOriginTranslateStatus;
256
493
  const canDropEffect = previewServerState.type === 'connected' &&
257
494
  (controls === null || controls === void 0 ? void 0 : controls.supportsEffects) === true;
258
- const canTextEdit = previewServerState.type === 'connected' &&
259
- controls !== null &&
260
- (textContentFieldSchema === null || textContentFieldSchema === void 0 ? void 0 : textContentFieldSchema.type) === 'text-content' &&
261
- textContentPropStatus !== undefined;
262
495
  return {
263
496
  key,
264
497
  containsSelection,
@@ -373,12 +606,6 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
373
606
  })) !== null && _f !== void 0 ? _f : fieldSchema.default),
374
607
  }
375
608
  : null,
376
- textEdit: canTextEdit
377
- ? {
378
- nodePath,
379
- propStatus: textContentPropStatus,
380
- }
381
- : null,
382
609
  uvHandles: containsSelection
383
610
  ? (0, selected_outline_uv_1.getSelectedUvHandles)({
384
611
  propStatuses,
@@ -414,8 +641,8 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
414
641
  return new Map(outlineTargets.map((target) => [target.key, target]));
415
642
  }, [outlineTargets]);
416
643
  const outlinesForRendering = (0, react_1.useMemo)(() => {
417
- return (0, exports.orderOutlinesForRendering)({ outlines, targetsByKey });
418
- }, [outlines, targetsByKey]);
644
+ return (0, exports.orderOutlinesForRendering)({ outlines, sequences, targetsByKey });
645
+ }, [outlines, sequences, targetsByKey]);
419
646
  const outlinesByKey = (0, react_1.useMemo)(() => {
420
647
  return new Map(outlines.map((outline) => [outline.key, outline]));
421
648
  }, [outlines]);
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export declare const SnappingToggle: React.FC;
2
+ export declare const SnappingToggle: React.FC<{
3
+ readonly disabled: boolean;
4
+ }>;
@@ -9,7 +9,7 @@ const use_keybinding_1 = require("../helpers/use-keybinding");
9
9
  const magnet_1 = require("../icons/magnet");
10
10
  const editor_snapping_1 = require("../state/editor-snapping");
11
11
  const ControlButton_1 = require("./ControlButton");
12
- const SnappingToggle = () => {
12
+ const SnappingToggle = ({ disabled }) => {
13
13
  const { editorSnapping, setEditorSnapping } = (0, react_1.useContext)(editor_snapping_1.EditorSnappingContext);
14
14
  const onClick = (0, react_1.useCallback)(() => {
15
15
  setEditorSnapping((current) => !current);
@@ -21,6 +21,6 @@ const SnappingToggle = () => {
21
21
  ]
22
22
  .filter(no_react_1.NoReactInternals.truthy)
23
23
  .join(' ');
24
- return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, "aria-pressed": editorSnapping, "aria-keyshortcuts": "Shift+M", onClick: onClick, children: jsx_runtime_1.jsx(magnet_1.MagnetIcon, { style: { width: 17, height: 17 }, fill: color, "aria-hidden": "true", focusable: "false" }) }));
24
+ return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, "aria-pressed": editorSnapping, "aria-keyshortcuts": "Shift+M", disabled: disabled, onClick: onClick, children: jsx_runtime_1.jsx(magnet_1.MagnetIcon, { style: { width: 17, height: 17 }, fill: color, "aria-hidden": "true", focusable: "false" }) }));
25
25
  };
26
26
  exports.SnappingToggle = SnappingToggle;
@@ -1,7 +1,8 @@
1
- import { type EasingClipboardData, type EffectClipboardSnapshot, type EffectPropClipboardData } from '@remotion/studio-shared';
1
+ import { type EasingClipboardData, type EffectClipboardData, type EffectClipboardSnapshot, type EffectPropClipboardData } from '@remotion/studio-shared';
2
2
  import type React from 'react';
3
3
  import { type OverrideIdToNodePaths, type PropStatuses, type SequencePropsSubscriptionKey, type InteractivitySchema, type TSequence } from 'remotion';
4
4
  import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
5
+ import { type EffectsClipboardEnvelope } from './effects-clipboard';
5
6
  import { type TimelineSelection } from './TimelineSelection';
6
7
  export type PasteEffectsTarget = {
7
8
  readonly type: 'valid';
@@ -29,6 +30,24 @@ export declare const getSnapshotsFromSelection: ({ selection, propStatuses, }: {
29
30
  selection: TimelineSelection;
30
31
  propStatuses: PropStatuses;
31
32
  }) => EffectClipboardSnapshot[] | null;
33
+ export type EffectClipboardDataFromSelections = {
34
+ readonly type: 'valid';
35
+ readonly payload: EffectClipboardData;
36
+ } | {
37
+ readonly type: 'none';
38
+ } | {
39
+ readonly type: 'mixed';
40
+ } | {
41
+ readonly type: 'uncopyable';
42
+ };
43
+ export declare const getEffectClipboardDataFromSelections: ({ selectedItems, propStatuses, }: {
44
+ selectedItems: readonly TimelineSelection[];
45
+ propStatuses: PropStatuses;
46
+ }) => EffectClipboardDataFromSelections;
47
+ export declare const getEffectsClipboardEnvelopeFromSelections: ({ selectedItems, payload, }: {
48
+ selectedItems: readonly TimelineSelection[];
49
+ payload: EffectClipboardData;
50
+ }) => EffectsClipboardEnvelope;
32
51
  export declare const getEffectPropClipboardDataFromSelection: ({ selection, propStatuses, }: {
33
52
  selection: TimelineSelection;
34
53
  propStatuses: PropStatuses;