@remotion/studio 4.0.512 → 4.0.514

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 (208) hide show
  1. package/dist/Studio.js +2 -1
  2. package/dist/components/AskAiModal.js +1 -1
  3. package/dist/components/AssetSelector.js +2 -0
  4. package/dist/components/AssetSelectorItem.js +1 -2
  5. package/dist/components/AudioWaveform.d.ts +3 -0
  6. package/dist/components/AudioWaveform.js +55 -67
  7. package/dist/components/Canvas.js +40 -5
  8. package/dist/components/CanvasOrLoading.js +5 -0
  9. package/dist/components/CompositionSelector.js +2 -0
  10. package/dist/components/CompositionSelectorItem.js +14 -1
  11. package/dist/components/ConfigureDefaultEditorModal.js +17 -11
  12. package/dist/components/Editor.js +16 -1
  13. package/dist/components/ElementInstallConfirmation.d.ts +1 -0
  14. package/dist/components/ElementInstallConfirmation.js +4 -2
  15. package/dist/components/FixComputedValueModal.d.ts +9 -0
  16. package/dist/components/FixComputedValueModal.js +217 -0
  17. package/dist/components/InitialCompositionLoader.js +19 -0
  18. package/dist/components/InlineDropdown.js +4 -4
  19. package/dist/components/InspectorInfoHeader.js +3 -3
  20. package/dist/components/InspectorOpenInEditor.js +26 -24
  21. package/dist/components/InspectorPanel/AlignmentControls.js +13 -2
  22. package/dist/components/InspectorPanel/CompositionInspector.js +11 -1
  23. package/dist/components/InspectorPanel/CompositionInspectorHeader.js +12 -8
  24. package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +13 -2
  25. package/dist/components/InspectorPanel/EasingInspector.js +12 -3
  26. package/dist/components/InspectorPanel/KeyframeInspector.js +21 -7
  27. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +1 -1
  28. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +35 -6
  29. package/dist/components/InspectorPanel/common.d.ts +5 -5
  30. package/dist/components/InspectorPanel/common.js +8 -8
  31. package/dist/components/InspectorPanel/easing-inspector-selection.js +7 -2
  32. package/dist/components/InspectorPanel/inspector-section-collapse.d.ts +1 -0
  33. package/dist/components/InspectorPanel/styles.d.ts +1 -1
  34. package/dist/components/InspectorPanel/styles.js +4 -2
  35. package/dist/components/InspectorSourceLocation.d.ts +1 -1
  36. package/dist/components/InspectorSourceLocation.js +2 -2
  37. package/dist/components/LicenseKeyValidation.js +2 -2
  38. package/dist/components/Modals.js +2 -1
  39. package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
  40. package/dist/components/NewComposition/CodemodFooter.js +10 -8
  41. package/dist/components/NewComposition/DeleteComposition.js +1 -1
  42. package/dist/components/NewComposition/DeleteFolder.js +1 -1
  43. package/dist/components/NewComposition/DuplicateComposition.js +7 -2
  44. package/dist/components/NewComposition/NewComposition.js +1 -1
  45. package/dist/components/NewComposition/NewFolder.js +1 -1
  46. package/dist/components/NewComposition/RenameComposition.js +1 -1
  47. package/dist/components/NewComposition/RenameFolder.js +1 -1
  48. package/dist/components/NewComposition/duplicate-composition-api.d.ts +16 -0
  49. package/dist/components/NewComposition/duplicate-composition-api.js +16 -0
  50. package/dist/components/NoRegisterRoot.js +1 -1
  51. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +4 -3
  52. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -0
  53. package/dist/components/QuickSwitcher/fuzzy-search.js +1 -1
  54. package/dist/components/RefreshCompositionOverlay.js +1 -1
  55. package/dist/components/RenderButton.js +6 -3
  56. package/dist/components/RenderModal/WebRenderModal.js +6 -2
  57. package/dist/components/RenderModal/WebRenderModalAdvanced.d.ts +2 -0
  58. package/dist/components/RenderModal/WebRenderModalAdvanced.js +9 -2
  59. package/dist/components/RenderModal/render-modals.js +5 -1
  60. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +5 -1
  61. package/dist/components/RenderQueue/actions.js +12 -2
  62. package/dist/components/RenderQueue/client-side-render-types.d.ts +1 -0
  63. package/dist/components/RenderingSettings.d.ts +2 -0
  64. package/dist/components/RenderingSettings.js +355 -0
  65. package/dist/components/SelectedOutlineElement.js +15 -13
  66. package/dist/components/SelectedOutlineOverlay.js +30 -8
  67. package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
  68. package/dist/components/SelectedOutlinePolygon.js +53 -9
  69. package/dist/components/SettingsContext.d.ts +4 -1
  70. package/dist/components/SettingsContext.js +9 -2
  71. package/dist/components/SettingsModal.d.ts +1 -1
  72. package/dist/components/SettingsModal.js +10 -1
  73. package/dist/components/SettingsModalFooter.js +1 -1
  74. package/dist/components/StudioSettings.d.ts +2 -0
  75. package/dist/components/StudioSettings.js +185 -0
  76. package/dist/components/Timeline/LoopedIndicator.js +1 -1
  77. package/dist/components/Timeline/LoopedTimelineIndicators.d.ts +3 -0
  78. package/dist/components/Timeline/LoopedTimelineIndicators.js +22 -14
  79. package/dist/components/Timeline/Timeline.js +11 -9
  80. package/dist/components/Timeline/TimelineArrayField.js +1 -0
  81. package/dist/components/Timeline/TimelineAssetField.d.ts +2 -2
  82. package/dist/components/Timeline/TimelineAssetField.js +1 -1
  83. package/dist/components/Timeline/TimelineDragHandler.js +62 -76
  84. package/dist/components/Timeline/TimelineEffectItem.js +1 -1
  85. package/dist/components/Timeline/TimelineEffectPropItem.d.ts +4 -2
  86. package/dist/components/Timeline/TimelineEffectPropItem.js +25 -14
  87. package/dist/components/Timeline/TimelineExpandedRow.d.ts +1 -1
  88. package/dist/components/Timeline/TimelineExpandedRow.js +4 -4
  89. package/dist/components/Timeline/TimelineExpandedSection.js +1 -1
  90. package/dist/components/Timeline/TimelineHeightContainer.d.ts +0 -4
  91. package/dist/components/Timeline/TimelineHeightContainer.js +4 -4
  92. package/dist/components/Timeline/TimelineImageInfo.d.ts +1 -0
  93. package/dist/components/Timeline/TimelineImageInfo.js +3 -2
  94. package/dist/components/Timeline/TimelineKeyframeControls.js +31 -8
  95. package/dist/components/Timeline/TimelineKeyframedValue.js +1 -0
  96. package/dist/components/Timeline/TimelineList.d.ts +1 -5
  97. package/dist/components/Timeline/TimelineList.js +14 -9
  98. package/dist/components/Timeline/TimelinePinchZoom.js +5 -5
  99. package/dist/components/Timeline/TimelineRowChrome.d.ts +0 -2
  100. package/dist/components/Timeline/TimelineRowChrome.js +12 -5
  101. package/dist/components/Timeline/TimelineSchemaField.d.ts +7 -3
  102. package/dist/components/Timeline/TimelineSchemaField.js +71 -13
  103. package/dist/components/Timeline/TimelineScrollable.js +3 -1
  104. package/dist/components/Timeline/TimelineSelection.d.ts +5 -2
  105. package/dist/components/Timeline/TimelineSelection.js +90 -103
  106. package/dist/components/Timeline/TimelineSequence.js +59 -25
  107. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -1
  108. package/dist/components/Timeline/TimelineSequenceItem.js +15 -9
  109. package/dist/components/Timeline/TimelineSequencePropItem.d.ts +2 -1
  110. package/dist/components/Timeline/TimelineSequencePropItem.js +14 -7
  111. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +3 -0
  112. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +128 -27
  113. package/dist/components/Timeline/TimelineSlider.js +42 -33
  114. package/dist/components/Timeline/TimelineTimeIndicators.js +90 -98
  115. package/dist/components/Timeline/TimelineTracks.d.ts +0 -2
  116. package/dist/components/Timeline/TimelineTracks.js +11 -4
  117. package/dist/components/Timeline/TimelineTransformOriginField.js +1 -1
  118. package/dist/components/Timeline/TimelineVideoInfo.d.ts +4 -4
  119. package/dist/components/Timeline/TimelineVideoInfo.js +151 -61
  120. package/dist/components/Timeline/TimelineViewport.d.ts +12 -0
  121. package/dist/components/Timeline/TimelineViewport.js +62 -0
  122. package/dist/components/Timeline/TimelineVirtualization.d.ts +22 -0
  123. package/dist/components/Timeline/TimelineVirtualization.js +144 -0
  124. package/dist/components/Timeline/TimelineZoomControls.js +16 -8
  125. package/dist/components/Timeline/call-add-keyframe.js +31 -3
  126. package/dist/components/Timeline/call-delete-keyframe.js +13 -3
  127. package/dist/components/Timeline/call-move-keyframe.d.ts +2 -1
  128. package/dist/components/Timeline/call-move-keyframe.js +81 -18
  129. package/dist/components/Timeline/call-update-keyframe-settings.js +31 -3
  130. package/dist/components/Timeline/delete-selected-keyframe.d.ts +0 -8
  131. package/dist/components/Timeline/delete-selected-keyframe.js +23 -44
  132. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +0 -8
  133. package/dist/components/Timeline/delete-selected-timeline-item.js +18 -44
  134. package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.js +8 -3
  135. package/dist/components/Timeline/get-sequence-context-menu-items.js +10 -8
  136. package/dist/components/Timeline/get-timeline-keyframes.d.ts +5 -2
  137. package/dist/components/Timeline/get-timeline-keyframes.js +16 -10
  138. package/dist/components/Timeline/get-timeline-sequence-visible-layout.d.ts +30 -0
  139. package/dist/components/Timeline/get-timeline-sequence-visible-layout.js +61 -0
  140. package/dist/components/Timeline/keyframe-clipboard.js +9 -2
  141. package/dist/components/Timeline/split-selected-timeline-item.js +2 -2
  142. package/dist/components/Timeline/timeline-scroll-logic.d.ts +24 -0
  143. package/dist/components/Timeline/timeline-scroll-logic.js +127 -4
  144. package/dist/components/Timeline/use-open-sequence-in-apps.js +8 -8
  145. package/dist/components/Timeline/use-timeline-height.d.ts +3 -5
  146. package/dist/components/Timeline/use-timeline-height.js +16 -18
  147. package/dist/components/Timeline/use-timeline-keyframe-drag.js +14 -4
  148. package/dist/components/UpdateCheck.d.ts +2 -10
  149. package/dist/components/UpdateCheck.js +8 -2
  150. package/dist/components/VisualControls/ClickableFileName.js +13 -6
  151. package/dist/components/VisualControls/VisualControlHandle.js +8 -0
  152. package/dist/components/composition-menu-items.d.ts +6 -1
  153. package/dist/components/composition-menu-items.js +9 -6
  154. package/dist/components/delete-jsx-node-api.d.ts +2 -0
  155. package/dist/components/delete-jsx-node-api.js +12 -0
  156. package/dist/components/element-install-api.d.ts +3 -0
  157. package/dist/components/element-install-api.js +19 -0
  158. package/dist/components/folder-menu-items.d.ts +4 -1
  159. package/dist/components/folder-menu-items.js +4 -5
  160. package/dist/components/get-open-in-menu-items.d.ts +1 -1
  161. package/dist/components/get-open-in-menu-items.js +15 -13
  162. package/dist/components/import-assets.js +20 -9
  163. package/dist/components/reorder-sequence-api.d.ts +2 -0
  164. package/dist/components/reorder-sequence-api.js +12 -0
  165. package/dist/components/sequence-props-api.js +44 -3
  166. package/dist/components/split-jsx-sequence-api.d.ts +2 -0
  167. package/dist/components/split-jsx-sequence-api.js +12 -0
  168. package/dist/components/split-video-from-audio-api.d.ts +2 -0
  169. package/dist/components/split-video-from-audio-api.js +12 -0
  170. package/dist/components/use-default-editor-info.d.ts +8 -0
  171. package/dist/components/use-default-editor-info.js +25 -9
  172. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +10 -3
  173. package/dist/error-overlay/remotion-overlay/OpenInEditor.d.ts +3 -1
  174. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +6 -6
  175. package/dist/error-overlay/remotion-overlay/Overlay.js +14 -12
  176. package/dist/error-overlay/remotion-overlay/StackFrame.d.ts +2 -1
  177. package/dist/error-overlay/remotion-overlay/StackFrame.js +7 -4
  178. package/dist/esm/{chunk-s8gwjng0.js → chunk-xn2q7eem.js} +11983 -8035
  179. package/dist/esm/index.mjs +7 -5
  180. package/dist/esm/internals.mjs +11983 -8035
  181. package/dist/esm/previewEntry.mjs +13059 -9107
  182. package/dist/esm/renderEntry.mjs +2 -3
  183. package/dist/helpers/browser-studio-operations.d.ts +2 -0
  184. package/dist/helpers/browser-studio-operations.js +10 -1
  185. package/dist/helpers/get-timeline-max-zoom.d.ts +26 -0
  186. package/dist/helpers/get-timeline-max-zoom.js +45 -0
  187. package/dist/helpers/inject-css.js +2 -2
  188. package/dist/helpers/open-in-editor.d.ts +6 -4
  189. package/dist/helpers/open-in-editor.js +4 -4
  190. package/dist/helpers/render-codec-label.d.ts +1 -1
  191. package/dist/helpers/retry-payload.js +1 -0
  192. package/dist/helpers/studio-runtime-config.d.ts +1 -1
  193. package/dist/helpers/studio-runtime-config.js +2 -3
  194. package/dist/helpers/timeline-layout.d.ts +3 -1
  195. package/dist/helpers/timeline-layout.js +6 -1
  196. package/dist/helpers/url-state.js +3 -2
  197. package/dist/helpers/use-menu-structure.js +12 -11
  198. package/dist/helpers/use-runtime-values.d.ts +2 -1
  199. package/dist/helpers/use-runtime-values.js +7 -3
  200. package/dist/icons/remotion-triangle.d.ts +2 -0
  201. package/dist/icons/remotion-triangle.js +7 -0
  202. package/dist/renderEntry.js +1 -1
  203. package/dist/state/composition-list.d.ts +13 -0
  204. package/dist/state/composition-list.js +21 -0
  205. package/dist/state/modals.d.ts +7 -1
  206. package/dist/state/timeline-zoom.d.ts +1 -2
  207. package/dist/state/timeline-zoom.js +9 -5
  208. package/package.json +14 -13
@@ -38,12 +38,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = __importStar(require("react"));
39
39
  const remotion_1 = require("remotion");
40
40
  const colors_1 = require("../../helpers/colors");
41
+ const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
41
42
  const is_current_selected_still_1 = require("../../helpers/is-current-selected-still");
42
43
  const canvas_zoom_1 = require("../../icons/canvas-zoom");
43
44
  const timeline_zoom_1 = require("../../state/timeline-zoom");
44
45
  const z_index_1 = require("../../state/z-index");
45
46
  const ControlButton_1 = require("../ControlButton");
46
47
  const layout_1 = require("../layout");
48
+ const TIMELINE_ZOOM_BUTTON_FACTOR = 1.2;
47
49
  const container = {
48
50
  color: colors_1.BLACK,
49
51
  flexDirection: 'row',
@@ -53,7 +55,7 @@ const container = {
53
55
  const buttonStyle = {
54
56
  fontSize: 24,
55
57
  };
56
- const TimelineZoomSlider = ({ maxWidth }) => {
58
+ const TimelineZoomSlider = ({ maxWidth, maxZoom }) => {
57
59
  var _a;
58
60
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
59
61
  const { setZoom, zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
@@ -63,33 +65,39 @@ const TimelineZoomSlider = ({ maxWidth }) => {
63
65
  if (canvasContent === null || canvasContent.type !== 'composition') {
64
66
  return;
65
67
  }
66
- setZoom(canvasContent.compositionId, () => Number(e.target.value), {
68
+ setZoom(canvasContent.compositionId, () => (0, get_timeline_max_zoom_1.sliderValueToTimelineZoom)({
69
+ sliderValue: Number(e.target.value),
70
+ maxZoom,
71
+ }), {
67
72
  anchorFrame: null,
68
73
  anchorContentX: null,
69
74
  });
70
- }, [canvasContent, setZoom]);
75
+ }, [canvasContent, maxZoom, setZoom]);
71
76
  if (isStill ||
72
77
  canvasContent === null ||
73
78
  canvasContent.type !== 'composition') {
74
79
  return null;
75
80
  }
76
- const zoom = (_a = zoomMap[canvasContent.compositionId]) !== null && _a !== void 0 ? _a : timeline_zoom_1.TIMELINE_MIN_ZOOM;
77
- return (jsx_runtime_1.jsx("input", { style: maxWidth === undefined ? undefined : { maxWidth }, title: `Timeline zoom (${zoom}x)`, alt: `Timeline zoom (${zoom}x)`, type: "range", min: timeline_zoom_1.TIMELINE_MIN_ZOOM, step: 0.1, value: zoom, max: timeline_zoom_1.TIMELINE_MAX_ZOOM, onChange: onChange, className: "__remotion-timeline-slider", tabIndex: tabIndex }));
81
+ const zoom = (_a = zoomMap[canvasContent.compositionId]) !== null && _a !== void 0 ? _a : get_timeline_max_zoom_1.TIMELINE_MIN_ZOOM;
82
+ return (jsx_runtime_1.jsx("input", { style: maxWidth === undefined ? undefined : { maxWidth }, title: `Timeline zoom (${zoom}x)`, alt: `Timeline zoom (${zoom}x)`, type: "range", min: get_timeline_max_zoom_1.TIMELINE_ZOOM_SLIDER_PROPS.min, max: get_timeline_max_zoom_1.TIMELINE_ZOOM_SLIDER_PROPS.max, step: get_timeline_max_zoom_1.TIMELINE_ZOOM_SLIDER_PROPS.step, value: (0, get_timeline_max_zoom_1.timelineZoomToSliderValue)({ zoom, maxZoom }), onChange: onChange, className: "__remotion-timeline-slider", tabIndex: tabIndex }));
78
83
  };
79
84
  const TimelineZoomControlsInner = ({ sliderMaxWidth }) => {
85
+ var _a;
80
86
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
81
87
  const { setZoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
88
+ const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
89
+ const maxZoom = (0, get_timeline_max_zoom_1.getTimelineMaxZoom)((_a = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _a !== void 0 ? _a : 1);
82
90
  const onMinusClicked = (0, react_1.useCallback)(() => {
83
91
  if (canvasContent === null || canvasContent.type !== 'composition') {
84
92
  return;
85
93
  }
86
- setZoom(canvasContent.compositionId, (z) => Math.max(timeline_zoom_1.TIMELINE_MIN_ZOOM, z - 0.2), { anchorFrame: null, anchorContentX: null });
94
+ setZoom(canvasContent.compositionId, (z) => z / TIMELINE_ZOOM_BUTTON_FACTOR, { anchorFrame: null, anchorContentX: null });
87
95
  }, [canvasContent, setZoom]);
88
96
  const onPlusClicked = (0, react_1.useCallback)(() => {
89
97
  if (canvasContent === null || canvasContent.type !== 'composition') {
90
98
  return;
91
99
  }
92
- setZoom(canvasContent.compositionId, (z) => Math.min(timeline_zoom_1.TIMELINE_MAX_ZOOM, z + 0.2), { anchorFrame: null, anchorContentX: null });
100
+ setZoom(canvasContent.compositionId, (z) => z * TIMELINE_ZOOM_BUTTON_FACTOR, { anchorFrame: null, anchorContentX: null });
93
101
  }, [canvasContent, setZoom]);
94
102
  const isStill = (0, is_current_selected_still_1.useIsStill)();
95
103
  if (isStill ||
@@ -98,7 +106,7 @@ const TimelineZoomControlsInner = ({ sliderMaxWidth }) => {
98
106
  return null;
99
107
  }
100
108
  return (jsx_runtime_1.jsxs("div", { style: container, children: [
101
- jsx_runtime_1.jsx(ControlButton_1.ControlButton, { onClick: onMinusClicked, style: buttonStyle, title: "Zoom out timeline", role: 'ControlButton', type: "button", children: (color) => jsx_runtime_1.jsx(canvas_zoom_1.CanvasZoomOutIcon, { color: color }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(TimelineZoomSlider, { maxWidth: sliderMaxWidth }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(ControlButton_1.ControlButton, { onClick: onPlusClicked, style: buttonStyle, title: "Zoom in timeline", role: 'button', type: "button", children: (color) => jsx_runtime_1.jsx(canvas_zoom_1.CanvasZoomIcon, { color: color }) })
109
+ jsx_runtime_1.jsx(ControlButton_1.ControlButton, { onClick: onMinusClicked, style: buttonStyle, title: "Zoom out timeline", role: 'ControlButton', type: "button", children: (color) => jsx_runtime_1.jsx(canvas_zoom_1.CanvasZoomOutIcon, { color: color }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(TimelineZoomSlider, { maxWidth: sliderMaxWidth, maxZoom: maxZoom }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(ControlButton_1.ControlButton, { onClick: onPlusClicked, style: buttonStyle, title: "Zoom in timeline", role: 'button', type: "button", children: (color) => jsx_runtime_1.jsx(canvas_zoom_1.CanvasZoomIcon, { color: color }) })
102
110
  ] }));
103
111
  };
104
112
  exports.TimelineZoomControls = react_1.default.memo(TimelineZoomControlsInner);
@@ -2,9 +2,37 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callAddEffectKeyframe = exports.callAddKeyframes = exports.callAddSequenceKeyframe = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
+ const browser_studio_operations_1 = require("../../helpers/browser-studio-operations");
5
6
  const call_api_1 = require("../call-api");
6
7
  const apply_effect_response_to_prop_statuses_1 = require("./apply-effect-response-to-prop-statuses");
7
8
  const save_prop_queue_1 = require("./save-prop-queue");
9
+ const addSequenceKeyframe = (request) => {
10
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
11
+ if (!browserStudioOperations) {
12
+ return (0, call_api_1.callApi)('/api/add-sequence-keyframe', request);
13
+ }
14
+ return browserStudioOperations.keyframes
15
+ ? browserStudioOperations.keyframes.addSequenceKeyframe(request)
16
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
17
+ };
18
+ const addEffectKeyframe = (request) => {
19
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
20
+ if (!browserStudioOperations) {
21
+ return (0, call_api_1.callApi)('/api/add-effect-keyframe', request);
22
+ }
23
+ return browserStudioOperations.keyframes
24
+ ? browserStudioOperations.keyframes.addEffectKeyframe(request)
25
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
26
+ };
27
+ const addKeyframes = (request) => {
28
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
29
+ if (!browserStudioOperations) {
30
+ return (0, call_api_1.callApi)('/api/add-keyframes', request);
31
+ }
32
+ return browserStudioOperations.keyframes
33
+ ? browserStudioOperations.keyframes.addKeyframes(request)
34
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
35
+ };
8
36
  const groupByNodePath = (keyframes) => {
9
37
  var _a;
10
38
  const groups = new Map();
@@ -27,7 +55,7 @@ const callAddSequenceKeyframe = ({ fileName, nodePath, fieldKey, sourceFrame, va
27
55
  value,
28
56
  schema,
29
57
  }),
30
- apiCall: () => (0, call_api_1.callApi)('/api/add-sequence-keyframe', {
58
+ apiCall: () => addSequenceKeyframe({
31
59
  fileName,
32
60
  nodePath,
33
61
  key: fieldKey,
@@ -71,7 +99,7 @@ const callAddKeyframes = ({ sequenceKeyframes, effectKeyframes, setPropStatuses,
71
99
  schema: keyframe.schema,
72
100
  }), prev));
73
101
  }
74
- return (0, call_api_1.callApi)('/api/add-keyframes', {
102
+ return addKeyframes({
75
103
  sequenceKeyframes: sequenceKeyframes.map((keyframe) => ({
76
104
  fileName: keyframe.fileName,
77
105
  nodePath: keyframe.nodePath,
@@ -106,7 +134,7 @@ const callAddEffectKeyframe = ({ fileName, nodePath, effectIndex, fieldKey, sour
106
134
  schema,
107
135
  }),
108
136
  applyServerResponse: (prev, response) => (0, apply_effect_response_to_prop_statuses_1.applyEffectResponseToPropStatuses)({ previous: prev, response }),
109
- apiCall: () => (0, call_api_1.callApi)('/api/add-effect-keyframe', {
137
+ apiCall: () => addEffectKeyframe({
110
138
  fileName,
111
139
  sequenceNodePath: nodePath,
112
140
  effectIndex,
@@ -2,8 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callDeleteKeyframes = exports.callDeleteEffectKeyframe = exports.callDeleteSequenceKeyframe = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
+ const browser_studio_operations_1 = require("../../helpers/browser-studio-operations");
5
6
  const call_api_1 = require("../call-api");
6
7
  const save_prop_queue_1 = require("./save-prop-queue");
8
+ const deleteKeyframes = (request) => {
9
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
10
+ if (!browserStudioOperations) {
11
+ return (0, call_api_1.callApi)('/api/delete-keyframes', request);
12
+ }
13
+ return browserStudioOperations.keyframes
14
+ ? browserStudioOperations.keyframes.deleteKeyframes(request)
15
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
16
+ };
7
17
  const groupByNodePath = (keyframes) => {
8
18
  var _a;
9
19
  const groups = new Map();
@@ -24,7 +34,7 @@ const callDeleteSequenceKeyframe = ({ fileName, nodePath, fieldKey, sourceFrame,
24
34
  fieldKey,
25
35
  frame: sourceFrame,
26
36
  }),
27
- apiCall: () => (0, call_api_1.callApi)('/api/delete-keyframes', {
37
+ apiCall: () => deleteKeyframes({
28
38
  sequenceKeyframes: [
29
39
  {
30
40
  fileName,
@@ -51,7 +61,7 @@ const callDeleteEffectKeyframe = ({ fileName, nodePath, effectIndex, fieldKey, s
51
61
  fieldKey,
52
62
  frame: sourceFrame,
53
63
  }),
54
- apiCall: () => (0, call_api_1.callApi)('/api/delete-keyframes', {
64
+ apiCall: () => deleteKeyframes({
55
65
  sequenceKeyframes: [],
56
66
  effectKeyframes: [
57
67
  {
@@ -102,7 +112,7 @@ const callDeleteKeyframes = ({ sequenceKeyframes, effectKeyframes, setPropStatus
102
112
  })),
103
113
  }));
104
114
  }
105
- return (0, call_api_1.callApi)('/api/delete-keyframes', {
115
+ return deleteKeyframes({
106
116
  sequenceKeyframes: sequenceKeyframes.map((keyframe) => ({
107
117
  fileName: keyframe.fileName,
108
118
  nodePath: keyframe.nodePath,
@@ -1,4 +1,4 @@
1
- import type { SequencePropsSubscriptionKey, InteractivitySchema } from 'remotion';
1
+ import type { InteractivitySchema, SequencePropsSubscriptionKey } from 'remotion';
2
2
  import type { SetPropStatuses } from './save-sequence-prop';
3
3
  export type MoveSequenceKeyframeChange = {
4
4
  fileName: string;
@@ -7,6 +7,7 @@ export type MoveSequenceKeyframeChange = {
7
7
  fromFrame: number;
8
8
  toFrame: number;
9
9
  schema: InteractivitySchema;
10
+ keyframeDisplayOffsetAdjustmentDelta?: number;
10
11
  };
11
12
  export type MoveEffectKeyframeChange = MoveSequenceKeyframeChange & {
12
13
  effectIndex: number;
@@ -2,7 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callMoveKeyframes = exports.applyOptimisticKeyframeMoves = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
+ const browser_studio_operations_1 = require("../../helpers/browser-studio-operations");
5
6
  const call_api_1 = require("../call-api");
7
+ const moveKeyframes = (request) => {
8
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
9
+ if (!browserStudioOperations) {
10
+ return (0, call_api_1.callApi)('/api/move-keyframes', request);
11
+ }
12
+ return browserStudioOperations.keyframes
13
+ ? browserStudioOperations.keyframes.moveKeyframes(request)
14
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
15
+ };
6
16
  const groupByNodePath = (keyframes) => {
7
17
  var _a;
8
18
  const groups = new Map();
@@ -14,6 +24,27 @@ const groupByNodePath = (keyframes) => {
14
24
  }
15
25
  return [...groups.values()];
16
26
  };
27
+ const applyKeyframeDisplayOffsetAdjustmentDeltas = ({ props, keyframes, }) => {
28
+ const nextProps = { ...props };
29
+ const deltas = new Map();
30
+ for (const keyframe of keyframes) {
31
+ if (keyframe.keyframeDisplayOffsetAdjustmentDelta !== undefined) {
32
+ deltas.set(keyframe.fieldKey, keyframe.keyframeDisplayOffsetAdjustmentDelta);
33
+ }
34
+ }
35
+ for (const [fieldKey, delta] of deltas) {
36
+ const status = nextProps[fieldKey];
37
+ if ((status === null || status === void 0 ? void 0 : status.status) !== 'keyframed' ||
38
+ status.keyframeDisplayOffsetAdjustment === null) {
39
+ continue;
40
+ }
41
+ nextProps[fieldKey] = {
42
+ ...status,
43
+ keyframeDisplayOffsetAdjustment: status.keyframeDisplayOffsetAdjustment + delta,
44
+ };
45
+ }
46
+ return nextProps;
47
+ };
17
48
  const applyOptimisticKeyframeMoves = ({ sequenceKeyframes, effectKeyframes, setPropStatuses, }) => {
18
49
  if (sequenceKeyframes.length === 0 && effectKeyframes.length === 0) {
19
50
  return;
@@ -23,29 +54,61 @@ const applyOptimisticKeyframeMoves = ({ sequenceKeyframes, effectKeyframes, setP
23
54
  if (!firstKeyframe) {
24
55
  continue;
25
56
  }
26
- setPropStatuses(firstKeyframe.nodePath, (prev) => (0, studio_shared_1.optimisticMoveSequenceKeyframes)({
27
- previous: prev,
28
- keyframes: keyframes.map((keyframe) => ({
29
- fieldKey: keyframe.fieldKey,
30
- fromFrame: keyframe.fromFrame,
31
- toFrame: keyframe.toFrame,
32
- })),
33
- }));
57
+ setPropStatuses(firstKeyframe.nodePath, (prev) => {
58
+ const moved = (0, studio_shared_1.optimisticMoveSequenceKeyframes)({
59
+ previous: prev,
60
+ keyframes: keyframes.map((keyframe) => ({
61
+ fieldKey: keyframe.fieldKey,
62
+ fromFrame: keyframe.fromFrame,
63
+ toFrame: keyframe.toFrame,
64
+ })),
65
+ });
66
+ if (!moved.canUpdate) {
67
+ return moved;
68
+ }
69
+ return {
70
+ ...moved,
71
+ props: applyKeyframeDisplayOffsetAdjustmentDeltas({
72
+ props: moved.props,
73
+ keyframes,
74
+ }),
75
+ };
76
+ });
34
77
  }
35
78
  for (const keyframes of groupByNodePath(effectKeyframes)) {
36
79
  const [firstKeyframe] = keyframes;
37
80
  if (!firstKeyframe) {
38
81
  continue;
39
82
  }
40
- setPropStatuses(firstKeyframe.nodePath, (prev) => (0, studio_shared_1.optimisticMoveEffectKeyframes)({
41
- previous: prev,
42
- keyframes: keyframes.map((keyframe) => ({
43
- effectIndex: keyframe.effectIndex,
44
- fieldKey: keyframe.fieldKey,
45
- fromFrame: keyframe.fromFrame,
46
- toFrame: keyframe.toFrame,
47
- })),
48
- }));
83
+ setPropStatuses(firstKeyframe.nodePath, (prev) => {
84
+ const moved = (0, studio_shared_1.optimisticMoveEffectKeyframes)({
85
+ previous: prev,
86
+ keyframes: keyframes.map((keyframe) => ({
87
+ effectIndex: keyframe.effectIndex,
88
+ fieldKey: keyframe.fieldKey,
89
+ fromFrame: keyframe.fromFrame,
90
+ toFrame: keyframe.toFrame,
91
+ })),
92
+ });
93
+ if (!moved.canUpdate) {
94
+ return moved;
95
+ }
96
+ return {
97
+ ...moved,
98
+ effects: moved.effects.map((effect) => {
99
+ if (!effect.canUpdate) {
100
+ return effect;
101
+ }
102
+ return {
103
+ ...effect,
104
+ props: applyKeyframeDisplayOffsetAdjustmentDeltas({
105
+ props: effect.props,
106
+ keyframes: keyframes.filter((keyframe) => keyframe.effectIndex === effect.effectIndex),
107
+ }),
108
+ };
109
+ }),
110
+ };
111
+ });
49
112
  }
50
113
  };
51
114
  exports.applyOptimisticKeyframeMoves = applyOptimisticKeyframeMoves;
@@ -58,7 +121,7 @@ const callMoveKeyframes = ({ sequenceKeyframes, effectKeyframes, setPropStatuses
58
121
  effectKeyframes,
59
122
  setPropStatuses,
60
123
  });
61
- return (0, call_api_1.callApi)('/api/move-keyframes', {
124
+ return moveKeyframes({
62
125
  sequenceKeyframes: sequenceKeyframes.map((keyframe) => ({
63
126
  fileName: keyframe.fileName,
64
127
  nodePath: keyframe.nodePath,
@@ -2,10 +2,38 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callBatchUpdateKeyframeSettings = exports.callUpdateEffectKeyframeSettings = exports.callUpdateSequenceKeyframeSettings = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
+ const browser_studio_operations_1 = require("../../helpers/browser-studio-operations");
5
6
  const call_api_1 = require("../call-api");
6
7
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
7
8
  const apply_effect_response_to_prop_statuses_1 = require("./apply-effect-response-to-prop-statuses");
8
9
  const save_prop_queue_1 = require("./save-prop-queue");
10
+ const updateSequenceKeyframeSettings = (request) => {
11
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
12
+ if (!browserStudioOperations) {
13
+ return (0, call_api_1.callApi)('/api/update-sequence-keyframe-settings', request);
14
+ }
15
+ return browserStudioOperations.keyframes
16
+ ? browserStudioOperations.keyframes.updateSequenceKeyframeSettings(request)
17
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
18
+ };
19
+ const updateEffectKeyframeSettings = (request) => {
20
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
21
+ if (!browserStudioOperations) {
22
+ return (0, call_api_1.callApi)('/api/update-effect-keyframe-settings', request);
23
+ }
24
+ return browserStudioOperations.keyframes
25
+ ? browserStudioOperations.keyframes.updateEffectKeyframeSettings(request)
26
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
27
+ };
28
+ const batchUpdateKeyframeSettings = (request) => {
29
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
30
+ if (!browserStudioOperations) {
31
+ return (0, call_api_1.callApi)('/api/batch-update-keyframe-settings', request);
32
+ }
33
+ return browserStudioOperations.keyframes
34
+ ? browserStudioOperations.keyframes.batchUpdateKeyframeSettings(request)
35
+ : Promise.reject(new Error('Keyframe editing is unavailable'));
36
+ };
9
37
  const callUpdateSequenceKeyframeSettings = ({ fileName, nodePath, fieldKey, settings, schema, setPropStatuses, clientId, }) => {
10
38
  return (0, save_prop_queue_1.enqueueSavePropChange)({
11
39
  nodePath,
@@ -15,7 +43,7 @@ const callUpdateSequenceKeyframeSettings = ({ fileName, nodePath, fieldKey, sett
15
43
  fieldKey,
16
44
  settings,
17
45
  }),
18
- apiCall: () => (0, call_api_1.callApi)('/api/update-sequence-keyframe-settings', {
46
+ apiCall: () => updateSequenceKeyframeSettings({
19
47
  fileName,
20
48
  nodePath,
21
49
  key: fieldKey,
@@ -38,7 +66,7 @@ const callUpdateEffectKeyframeSettings = ({ fileName, nodePath, effectIndex, fie
38
66
  settings,
39
67
  }),
40
68
  applyServerResponse: (prev, response) => (0, apply_effect_response_to_prop_statuses_1.applyEffectResponseToPropStatuses)({ previous: prev, response }),
41
- apiCall: () => (0, call_api_1.callApi)('/api/update-effect-keyframe-settings', {
69
+ apiCall: () => updateEffectKeyframeSettings({
42
70
  fileName,
43
71
  sequenceNodePath: nodePath,
44
72
  effectIndex,
@@ -67,7 +95,7 @@ const callBatchUpdateKeyframeSettings = ({ sequenceKeyframes, effectKeyframes, s
67
95
  settings: update.settings,
68
96
  }));
69
97
  }
70
- return (0, call_api_1.callApi)('/api/batch-update-keyframe-settings', {
98
+ return batchUpdateKeyframeSettings({
71
99
  sequenceKeyframes: sequenceKeyframes.map((update) => ({
72
100
  fileName: update.fileName,
73
101
  nodePath: update.nodePath,
@@ -1,14 +1,6 @@
1
1
  import type { OverrideIdToNodePaths, PropStatuses, TSequence } from 'remotion';
2
2
  import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
3
3
  import type { SetPropStatuses } from './save-sequence-prop';
4
- export declare const deleteSelectedKeyframe: ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, }: {
5
- nodePathInfo: SequenceNodePathInfo;
6
- frame: number;
7
- sequences: TSequence[];
8
- overrideIdsToNodePaths: OverrideIdToNodePaths;
9
- setPropStatuses: SetPropStatuses;
10
- clientId: string;
11
- }) => Promise<void> | null;
12
4
  export declare const deleteSelectedKeyframes: ({ keyframes, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, propStatuses, timelinePosition, }: {
13
5
  keyframes: {
14
6
  nodePathInfo: SequenceNodePathInfo;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteSelectedKeyframes = exports.deleteSelectedKeyframe = void 0;
3
+ exports.deleteSelectedKeyframes = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const call_delete_keyframe_1 = require("./call-delete-keyframe");
6
6
  const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
7
+ const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
7
8
  const parse_keyframe_field_from_node_path_1 = require("./parse-keyframe-field-from-node-path");
8
9
  const getValueWhenLastKeyframeDeleted = ({ propStatus, playheadSourceFrame, }) => {
9
10
  var _a;
10
- if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) !== 'keyframed' || playheadSourceFrame === null) {
11
+ if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) !== 'keyframed') {
11
12
  return null;
12
13
  }
13
14
  return ((_a = remotion_1.Internals.interpolateKeyframedStatus({
@@ -32,10 +33,6 @@ const getSelectedKeyframeDeletion = ({ nodePathInfo, frame, sequences, overrideI
32
33
  if (!(sequence === null || sequence === void 0 ? void 0 : sequence.controls)) {
33
34
  return null;
34
35
  }
35
- const sourceFrame = frame - ((_c = track === null || track === void 0 ? void 0 : track.keyframeDisplayOffset) !== null && _c !== void 0 ? _c : 0);
36
- const playheadSourceFrame = timelinePosition === null
37
- ? null
38
- : timelinePosition - ((_d = track === null || track === void 0 ? void 0 : track.keyframeDisplayOffset) !== null && _d !== void 0 ? _d : 0);
39
36
  const nodePath = nodePathInfo.sequenceSubscriptionKey;
40
37
  const fileName = nodePath.absolutePath;
41
38
  if (field.type === 'effect') {
@@ -43,19 +40,23 @@ const getSelectedKeyframeDeletion = ({ nodePathInfo, frame, sequences, overrideI
43
40
  if (!effect) {
44
41
  return null;
45
42
  }
46
- const effectStatus = propStatuses !== null
47
- ? remotion_1.Internals.getEffectPropStatusesCtx({
48
- propStatuses,
49
- nodePath,
50
- effectIndex: field.effectIndex,
51
- })
52
- : null;
43
+ const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
44
+ propStatuses,
45
+ nodePath,
46
+ effectIndex: field.effectIndex,
47
+ });
53
48
  const effectPropStatus = (effectStatus === null || effectStatus === void 0 ? void 0 : effectStatus.type) === 'can-update-effect'
54
49
  ? effectStatus.props[field.fieldKey]
55
50
  : null;
51
+ const effectKeyframeDisplayOffset = (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
52
+ propStatus: effectPropStatus,
53
+ keyframeDisplayOffset: (_c = track === null || track === void 0 ? void 0 : track.keyframeDisplayOffset) !== null && _c !== void 0 ? _c : 0,
54
+ });
55
+ const effectSourceFrame = frame - effectKeyframeDisplayOffset;
56
+ const effectPlayheadSourceFrame = timelinePosition - effectKeyframeDisplayOffset;
56
57
  const effectValueWhenLastKeyframeDeleted = getValueWhenLastKeyframeDeleted({
57
58
  propStatus: effectPropStatus,
58
- playheadSourceFrame,
59
+ playheadSourceFrame: effectPlayheadSourceFrame,
59
60
  });
60
61
  return {
61
62
  type: 'effect',
@@ -63,14 +64,18 @@ const getSelectedKeyframeDeletion = ({ nodePathInfo, frame, sequences, overrideI
63
64
  nodePath,
64
65
  effectIndex: field.effectIndex,
65
66
  fieldKey: field.fieldKey,
66
- sourceFrame,
67
+ sourceFrame: effectSourceFrame,
67
68
  schema: effect.schema,
68
69
  valueWhenLastKeyframeDeleted: effectValueWhenLastKeyframeDeleted,
69
70
  };
70
71
  }
71
- const sequencePropStatus = propStatuses !== null
72
- ? (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[field.fieldKey]
73
- : null;
72
+ const sequencePropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[field.fieldKey];
73
+ const keyframeDisplayOffset = (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
74
+ propStatus: sequencePropStatus,
75
+ keyframeDisplayOffset: (_d = track === null || track === void 0 ? void 0 : track.keyframeDisplayOffset) !== null && _d !== void 0 ? _d : 0,
76
+ });
77
+ const sourceFrame = frame - keyframeDisplayOffset;
78
+ const playheadSourceFrame = timelinePosition - keyframeDisplayOffset;
74
79
  const sequenceValueWhenLastKeyframeDeleted = getValueWhenLastKeyframeDeleted({
75
80
  propStatus: sequencePropStatus,
76
81
  playheadSourceFrame,
@@ -85,32 +90,6 @@ const getSelectedKeyframeDeletion = ({ nodePathInfo, frame, sequences, overrideI
85
90
  valueWhenLastKeyframeDeleted: sequenceValueWhenLastKeyframeDeleted,
86
91
  };
87
92
  };
88
- const deleteSelectedKeyframe = ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, }) => {
89
- const deletion = getSelectedKeyframeDeletion({
90
- nodePathInfo,
91
- frame,
92
- sequences,
93
- overrideIdsToNodePaths,
94
- propStatuses: null,
95
- timelinePosition: null,
96
- });
97
- if (deletion === null) {
98
- return null;
99
- }
100
- if (deletion.type === 'effect') {
101
- return (0, call_delete_keyframe_1.callDeleteEffectKeyframe)({
102
- ...deletion,
103
- setPropStatuses,
104
- clientId,
105
- });
106
- }
107
- return (0, call_delete_keyframe_1.callDeleteSequenceKeyframe)({
108
- ...deletion,
109
- setPropStatuses,
110
- clientId,
111
- });
112
- };
113
- exports.deleteSelectedKeyframe = deleteSelectedKeyframe;
114
93
  const deleteSelectedKeyframes = ({ keyframes, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, propStatuses, timelinePosition, }) => {
115
94
  const deletions = keyframes
116
95
  .map((keyframe) => getSelectedKeyframeDeletion({
@@ -4,14 +4,6 @@ import type { ConfirmationDialogFunction } from '../ConfirmationDialog-types';
4
4
  import type { SetPropStatuses } from './save-sequence-prop';
5
5
  import { type TimelineSelection } from './TimelineSelection';
6
6
  export declare const deleteSequencesFromSource: (nodePathInfos: SequenceNodePathInfo[], confirm: ConfirmationDialogFunction) => Promise<boolean>;
7
- export declare const deleteSelectedTimelineItem: ({ selection, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, confirm, }: {
8
- selection: TimelineSelection;
9
- sequences: TSequence[];
10
- overrideIdsToNodePaths: OverrideIdToNodePaths;
11
- setPropStatuses: SetPropStatuses;
12
- clientId: string;
13
- confirm: ConfirmationDialogFunction;
14
- }) => Promise<boolean> | null;
15
7
  export declare const getTimelineSelectionAfterDeletingItems: ({ selections, sequences, overrideIdsToNodePaths, propStatuses, timelinePosition, }: {
16
8
  readonly selections: readonly TimelineSelection[];
17
9
  readonly sequences?: TSequence[] | undefined;
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteSelectedTimelineItems = exports.getTimelineSelectionAfterDeletingItems = exports.deleteSelectedTimelineItem = exports.deleteSequencesFromSource = void 0;
3
+ exports.deleteSelectedTimelineItems = exports.getTimelineSelectionAfterDeletingItems = exports.deleteSequencesFromSource = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const call_api_1 = require("../call-api");
6
+ const delete_jsx_node_api_1 = require("../delete-jsx-node-api");
6
7
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
7
8
  const delete_selected_keyframe_1 = require("./delete-selected-keyframe");
8
9
  const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
9
10
  const get_easing_selection_after_keyframe_delete_1 = require("./get-easing-selection-after-keyframe-delete");
11
+ const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
10
12
  const parse_keyframe_field_from_node_path_1 = require("./parse-keyframe-field-from-node-path");
11
13
  const TimelineSelection_1 = require("./TimelineSelection");
12
14
  const update_selected_easing_1 = require("./update-selected-easing");
@@ -36,7 +38,7 @@ const deleteSequencesFromSource = async (nodePathInfos, confirm) => {
36
38
  if (!(await confirmDeletingDuplicatedSequences(nodePathInfos, confirm))) {
37
39
  return false;
38
40
  }
39
- return (0, call_api_1.callApi)('/api/delete-jsx-node', {
41
+ return (0, delete_jsx_node_api_1.deleteJsxNode)({
40
42
  nodes: nodePathInfos.map((nodePathInfo) => {
41
43
  const nodePath = nodePathInfo.sequenceSubscriptionKey;
42
44
  return {
@@ -88,45 +90,6 @@ const deleteEffects = (effects) => {
88
90
  return false;
89
91
  });
90
92
  };
91
- const deleteSelectedTimelineItem = ({ selection, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, confirm, }) => {
92
- var _a;
93
- if (selection.type === 'keyframe') {
94
- const promise = (0, delete_selected_keyframe_1.deleteSelectedKeyframe)({
95
- nodePathInfo: selection.nodePathInfo,
96
- frame: selection.frame,
97
- sequences,
98
- overrideIdsToNodePaths,
99
- setPropStatuses,
100
- clientId,
101
- });
102
- return (_a = promise === null || promise === void 0 ? void 0 : promise.then(() => true)) !== null && _a !== void 0 ? _a : null;
103
- }
104
- switch (selection.type) {
105
- case 'guide':
106
- return null;
107
- case 'sequence':
108
- return (0, exports.deleteSequencesFromSource)([selection.nodePathInfo], confirm);
109
- case 'sequence-effect':
110
- return deleteEffects([
111
- {
112
- type: 'single-effect',
113
- nodePathInfo: selection.nodePathInfo,
114
- effectIndex: selection.i,
115
- },
116
- ]);
117
- case 'sequence-prop':
118
- case 'sequence-effect-prop':
119
- case 'easing':
120
- return null;
121
- case 'sequence-all-effects':
122
- return deleteEffects([
123
- { type: 'all-effects', nodePathInfo: selection.nodePathInfo },
124
- ]);
125
- default:
126
- throw new Error(`Unexpected timeline selection type: ${selection}`);
127
- }
128
- };
129
- exports.deleteSelectedTimelineItem = deleteSelectedTimelineItem;
130
93
  const isSequenceRowSelection = (selection) => selection.type === 'sequence';
131
94
  const isSequenceEffectSelection = (selection) => selection.type === 'sequence-effect';
132
95
  const isSequenceAllEffectsSelection = (selection) => selection.type === 'sequence-all-effects';
@@ -173,7 +136,6 @@ const getEasingSelectionAfterDeletingKeyframes = ({ selections, sequences, overr
173
136
  return null;
174
137
  }
175
138
  const nodePath = selection.nodePathInfo.sequenceSubscriptionKey;
176
- const sourceFrame = selection.frame - track.keyframeDisplayOffset;
177
139
  if (field.type === 'sequence') {
178
140
  const sequencePropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[field.fieldKey];
179
141
  if ((sequencePropStatus === null || sequencePropStatus === void 0 ? void 0 : sequencePropStatus.status) !== 'keyframed' ||
@@ -181,7 +143,13 @@ const getEasingSelectionAfterDeletingKeyframes = ({ selections, sequences, overr
181
143
  return null;
182
144
  }
183
145
  return (0, get_easing_selection_after_keyframe_delete_1.getEasingSelectionAfterKeyframeDelete)({
184
- deletedSourceFrames: [sourceFrame],
146
+ deletedSourceFrames: [
147
+ selection.frame -
148
+ (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
149
+ propStatus: sequencePropStatus,
150
+ keyframeDisplayOffset: track.keyframeDisplayOffset,
151
+ }),
152
+ ],
185
153
  keyframeDisplayOffset: track.keyframeDisplayOffset,
186
154
  nodePathInfo: selection.nodePathInfo,
187
155
  propStatus: sequencePropStatus,
@@ -201,7 +169,13 @@ const getEasingSelectionAfterDeletingKeyframes = ({ selections, sequences, overr
201
169
  return null;
202
170
  }
203
171
  return (0, get_easing_selection_after_keyframe_delete_1.getEasingSelectionAfterKeyframeDelete)({
204
- deletedSourceFrames: [sourceFrame],
172
+ deletedSourceFrames: [
173
+ selection.frame -
174
+ (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
175
+ propStatus: effectPropStatus,
176
+ keyframeDisplayOffset: track.keyframeDisplayOffset,
177
+ }),
178
+ ],
205
179
  keyframeDisplayOffset: track.keyframeDisplayOffset,
206
180
  nodePathInfo: selection.nodePathInfo,
207
181
  propStatus: effectPropStatus,