@remotion/studio 4.0.518 → 4.0.520

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 (196) hide show
  1. package/dist/api/visual-control.js +2 -2
  2. package/dist/components/AppLaunchButton.d.ts +16 -0
  3. package/dist/components/AppLaunchButton.js +90 -0
  4. package/dist/components/AssetSelector.js +7 -6
  5. package/dist/components/AssetSelectorItem.d.ts +12 -0
  6. package/dist/components/AssetSelectorItem.js +180 -62
  7. package/dist/components/AudioWaveform.js +6 -1
  8. package/dist/components/Button.js +20 -7
  9. package/dist/components/Canvas.js +117 -92
  10. package/dist/components/CanvasOrLoading.js +7 -7
  11. package/dist/components/CodingAgentButton.d.ts +7 -0
  12. package/dist/components/CodingAgentButton.js +59 -0
  13. package/dist/components/CompositionContextButton.d.ts +1 -0
  14. package/dist/components/CompositionContextButton.js +6 -3
  15. package/dist/components/CompositionSelector.js +21 -20
  16. package/dist/components/CompositionSelectorItem.js +23 -35
  17. package/dist/components/ConfigureLicenseModal.js +4 -48
  18. package/dist/components/CurrentAsset.js +1 -1
  19. package/dist/components/CurrentCompositionSideEffects.js +5 -0
  20. package/dist/components/ElementInstallConfirmation.d.ts +2 -10
  21. package/dist/components/ElementInstallConfirmation.js +339 -32
  22. package/dist/components/FixComputedValueModal.js +5 -131
  23. package/dist/components/FpsCounter.js +1 -1
  24. package/dist/components/FramePersistor.js +1 -1
  25. package/dist/components/InitialCompositionLoader.js +3 -2
  26. package/dist/components/InspectorOpenInEditor.js +48 -33
  27. package/dist/components/InspectorPanel/CompositionInspector.js +35 -3
  28. package/dist/components/InspectorPanel/CompositionInspectorHeader.js +22 -14
  29. package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +3 -1
  30. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +1 -1
  31. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +10 -5
  32. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +5 -4
  33. package/dist/components/InspectorPanel/common.js +1 -0
  34. package/dist/components/InspectorPanel/styles.js +1 -0
  35. package/dist/components/InspectorPanel/use-composition-actions.js +5 -8
  36. package/dist/components/InspectorSequenceSection.js +8 -3
  37. package/dist/components/InspectorSourceLocation.js +5 -1
  38. package/dist/components/KnownBugs.d.ts +1 -1
  39. package/dist/components/KnownBugs.js +1 -1
  40. package/dist/components/LicenseExplanation.d.ts +2 -0
  41. package/dist/components/LicenseExplanation.js +63 -0
  42. package/dist/components/MenuToolbar.js +7 -1
  43. package/dist/components/Modals.js +1 -2
  44. package/dist/components/NewComposition/InputDragger.js +29 -2
  45. package/dist/components/NewComposition/NewCompDuration.js +1 -1
  46. package/dist/components/NewComposition/NewComposition.d.ts +23 -0
  47. package/dist/components/NewComposition/NewComposition.js +217 -80
  48. package/dist/components/{UpdateModal/OpenIssueButton.js → OpenIssueButton.js} +1 -1
  49. package/dist/components/PlayPause.js +2 -13
  50. package/dist/components/PreviewToolbar.js +1 -1
  51. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +2 -1
  52. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +50 -28
  53. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +14 -1
  54. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +64 -9
  55. package/dist/components/QuickSwitcher/composition-search.d.ts +16 -0
  56. package/dist/components/QuickSwitcher/composition-search.js +136 -0
  57. package/dist/components/RenderQueue/actions.d.ts +1 -0
  58. package/dist/components/RenderQueue/actions.js +5 -1
  59. package/dist/components/ResetZoomButton.js +17 -2
  60. package/dist/components/SelectedOutlineCanvasRotation.js +27 -1
  61. package/dist/components/SelectedOutlineElement.js +12 -31
  62. package/dist/components/SelectedOutlineKeyboardControls.d.ts +2 -2
  63. package/dist/components/SelectedOutlineOverlay.d.ts +3 -1
  64. package/dist/components/SelectedOutlineOverlay.js +21 -26
  65. package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
  66. package/dist/components/SelectedOutlinePolygon.js +12 -4
  67. package/dist/components/SelectedOutlineRenderer.js +88 -21
  68. package/dist/components/SettingsContext.js +2 -1
  69. package/dist/components/SettingsModal.d.ts +1 -1
  70. package/dist/components/SettingsModal.js +19 -3
  71. package/dist/components/SidebarRenderButton.d.ts +1 -0
  72. package/dist/components/SidebarRenderButton.js +14 -5
  73. package/dist/components/Timeline/SequencePropsObserver.js +29 -14
  74. package/dist/components/Timeline/Timeline.js +2 -1
  75. package/dist/components/Timeline/TimelineAssetField.js +1 -0
  76. package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -90
  77. package/dist/components/Timeline/TimelineDragHandler.js +18 -8
  78. package/dist/components/Timeline/TimelineInOutDragHandler.js +2 -3
  79. package/dist/components/Timeline/TimelineKeyframeControls.js +3 -1
  80. package/dist/components/Timeline/TimelinePinchZoom.js +14 -4
  81. package/dist/components/Timeline/TimelinePlayCursorSyncer.js +8 -4
  82. package/dist/components/Timeline/TimelineRowChrome.js +4 -2
  83. package/dist/components/Timeline/TimelineSequence.js +52 -45
  84. package/dist/components/Timeline/TimelineSequenceItem.js +44 -32
  85. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +3 -3
  86. package/dist/components/Timeline/TimelineSlider.js +2 -2
  87. package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -0
  88. package/dist/components/Timeline/TimelineStack/get-stack.js +35 -3
  89. package/dist/components/Timeline/TimelineWidthProvider.js +15 -8
  90. package/dist/components/Timeline/TimelineZoomControls.js +25 -8
  91. package/dist/components/Timeline/delete-selected-timeline-item.js +2 -2
  92. package/dist/components/Timeline/duplicate-selected-timeline-item.js +23 -25
  93. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -0
  94. package/dist/components/Timeline/get-sequence-context-menu-items.js +34 -1
  95. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -0
  96. package/dist/components/Timeline/sequence-props-subscription-store.js +22 -1
  97. package/dist/components/Timeline/timeline-scroll-logic.d.ts +1 -0
  98. package/dist/components/Timeline/timeline-scroll-logic.js +21 -17
  99. package/dist/components/Timeline/use-delete-timeline-items.d.ts +1 -0
  100. package/dist/components/Timeline/use-delete-timeline-items.js +118 -0
  101. package/dist/components/Timeline/use-sequence-props-subscription.js +7 -0
  102. package/dist/components/Timeline/use-timeline-asset-drop.js +8 -14
  103. package/dist/components/TimelineCombobox.js +1 -0
  104. package/dist/components/UpdateCheck.d.ts +0 -8
  105. package/dist/components/UpdateCheck.js +7 -54
  106. package/dist/components/UpdateStatusContext.d.ts +18 -0
  107. package/dist/components/UpdateStatusContext.js +74 -0
  108. package/dist/components/UpdatesSettings.d.ts +2 -0
  109. package/dist/components/UpdatesSettings.js +251 -0
  110. package/dist/components/WebMcp.js +64 -11
  111. package/dist/components/ZoomPersistor.js +2 -2
  112. package/dist/components/composition-drag-data.d.ts +36 -0
  113. package/dist/components/composition-drag-data.js +232 -0
  114. package/dist/components/drop-handler-data.d.ts +2 -1
  115. package/dist/components/drop-handler-data.js +6 -4
  116. package/dist/components/effect-drag-and-drop.d.ts +2 -5
  117. package/dist/components/get-open-in-menu-items.d.ts +4 -0
  118. package/dist/components/get-open-in-menu-items.js +28 -24
  119. package/dist/components/handle-drop.js +6 -2
  120. package/dist/components/import-assets.d.ts +5 -13
  121. package/dist/components/root-composition-menu-items.d.ts +4 -1
  122. package/dist/components/root-composition-menu-items.js +38 -1
  123. package/dist/components/selected-outline-geometry.d.ts +21 -2
  124. package/dist/components/selected-outline-geometry.js +16 -5
  125. package/dist/components/selected-outline-measurement.d.ts +40 -1
  126. package/dist/components/selected-outline-measurement.js +239 -1
  127. package/dist/components/selected-outline-order.d.ts +12 -0
  128. package/dist/components/selected-outline-order.js +251 -0
  129. package/dist/components/selected-outline-types.d.ts +15 -2
  130. package/dist/components/selected-outline-uv.js +106 -3
  131. package/dist/components/use-configure-default-apps.d.ts +1 -0
  132. package/dist/components/use-configure-default-apps.js +24 -0
  133. package/dist/error-overlay/current-error.d.ts +13 -0
  134. package/dist/error-overlay/current-error.js +21 -0
  135. package/dist/error-overlay/remotion-overlay/CodeFrame.js +5 -6
  136. package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +1 -1
  137. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +47 -18
  138. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +6 -2
  139. package/dist/error-overlay/remotion-overlay/ErrorTitle.js +5 -4
  140. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +48 -76
  141. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +1 -1
  142. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -2
  143. package/dist/error-overlay/remotion-overlay/StackFrame.js +13 -8
  144. package/dist/error-overlay/remotion-overlay/Symbolicating.js +1 -1
  145. package/dist/esm/chunk-6jf1natv.js +25 -0
  146. package/dist/esm/{chunk-4bxz1d3g.js → chunk-je0h1bgt.js} +1 -28
  147. package/dist/esm/chunk-m0jqdbkr.js +14571 -0
  148. package/dist/esm/{chunk-7prjt5n5.js → chunk-np6q13k5.js} +18637 -12189
  149. package/dist/esm/index.mjs +4 -3
  150. package/dist/esm/internals.mjs +35826 -14822
  151. package/dist/esm/previewEntry.mjs +40028 -18935
  152. package/dist/esm/renderEntry.mjs +6 -3
  153. package/dist/helpers/can-show-updates.d.ts +5 -0
  154. package/dist/helpers/can-show-updates.js +7 -0
  155. package/dist/helpers/colors.d.ts +0 -3
  156. package/dist/helpers/colors.js +2 -5
  157. package/dist/helpers/create-folder-tree.d.ts +5 -0
  158. package/dist/helpers/create-folder-tree.js +26 -6
  159. package/dist/helpers/document-title.d.ts +2 -0
  160. package/dist/helpers/document-title.js +14 -3
  161. package/dist/helpers/get-asset-metadata.js +1 -1
  162. package/dist/helpers/get-box-quads-polyfill-internals.d.ts +82 -0
  163. package/dist/helpers/get-box-quads-polyfill-internals.js +2403 -0
  164. package/dist/helpers/get-box-quads-ponyfill.d.ts +10 -0
  165. package/dist/helpers/get-box-quads-ponyfill.js +23 -0
  166. package/dist/helpers/get-git-menu-item.d.ts +5 -0
  167. package/dist/helpers/get-git-menu-item.js +15 -1
  168. package/dist/helpers/get-timeline-max-zoom.d.ts +34 -28
  169. package/dist/helpers/get-timeline-max-zoom.js +46 -29
  170. package/dist/helpers/hoverable.js +10 -5
  171. package/dist/helpers/install-fiber-sequence-order-observer.d.ts +37 -0
  172. package/dist/helpers/install-fiber-sequence-order-observer.js +109 -0
  173. package/dist/helpers/open-in-editor.js +53 -2
  174. package/dist/helpers/preview-server-events.js +3 -0
  175. package/dist/helpers/timeline-layout.d.ts +0 -1
  176. package/dist/helpers/timeline-layout.js +1 -5
  177. package/dist/helpers/url-state.d.ts +1 -0
  178. package/dist/helpers/url-state.js +12 -5
  179. package/dist/helpers/use-runtime-values.d.ts +1 -1
  180. package/dist/helpers/use-runtime-values.js +5 -4
  181. package/dist/helpers/use-sync-external-store.d.ts +3 -0
  182. package/dist/helpers/use-sync-external-store.js +5 -0
  183. package/dist/previewEntry.js +2 -0
  184. package/dist/renderEntry.js +2 -0
  185. package/dist/state/folders.d.ts +3 -0
  186. package/dist/state/folders.js +40 -1
  187. package/dist/state/modals.d.ts +19 -8
  188. package/dist/state/timeline-sequence-hover.js +3 -2
  189. package/dist/state/timeline-zoom.d.ts +0 -1
  190. package/dist/state/timeline-zoom.js +13 -6
  191. package/package.json +18 -15
  192. package/dist/components/UpdateModal/UpdateModal.d.ts +0 -6
  193. package/dist/components/UpdateModal/UpdateModal.js +0 -104
  194. package/dist/helpers/sort-by-nonce-history.d.ts +0 -1
  195. package/dist/helpers/sort-by-nonce-history.js +0 -6
  196. /package/dist/components/{UpdateModal/OpenIssueButton.d.ts → OpenIssueButton.d.ts} +0 -0
@@ -9,7 +9,10 @@ const hoverable_1 = require("../helpers/hoverable");
9
9
  const render_1 = require("../icons/render");
10
10
  const modals_1 = require("../state/modals");
11
11
  const InlineAction_1 = require("./InlineAction");
12
- const SidebarRenderButton = ({ composition, visible }) => {
12
+ const revealStyle = {
13
+ display: 'flex',
14
+ };
15
+ const SidebarRenderButton = ({ composition, visible, readOnlyStudio }) => {
13
16
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
14
17
  const iconStyle = (0, react_1.useMemo)(() => {
15
18
  return {
@@ -79,15 +82,21 @@ const SidebarRenderButton = ({ composition, visible }) => {
79
82
  initialMediaCacheSizeInBytes: defaults.mediaCacheSizeInBytes,
80
83
  renderDefaults: defaults,
81
84
  initialDarkMode: defaults.darkMode,
82
- readOnlyStudio: false,
85
+ readOnlyStudio,
83
86
  });
84
- }, [composition.defaultProps, composition.id, props, setSelectedModal]);
87
+ }, [
88
+ composition.defaultProps,
89
+ composition.id,
90
+ props,
91
+ readOnlyStudio,
92
+ setSelectedModal,
93
+ ]);
85
94
  const renderAction = (0, react_1.useCallback)((color) => {
86
95
  return jsx_runtime_1.jsx(render_1.ThinRenderIcon, { fill: color, svgProps: iconStyle });
87
96
  }, [iconStyle]);
88
- if (!visible || connectionStatus !== 'connected') {
97
+ if (!visible || (connectionStatus !== 'connected' && !readOnlyStudio)) {
89
98
  return null;
90
99
  }
91
- return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, variant: null, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME }));
100
+ return (jsx_runtime_1.jsx("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: revealStyle, children: jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, variant: null, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME }) }));
92
101
  };
93
102
  exports.SidebarRenderButton = SidebarRenderButton;
@@ -7,6 +7,7 @@ const fast_refresh_context_1 = require("../../fast-refresh-context");
7
7
  const client_id_1 = require("../../helpers/client-id");
8
8
  const sequence_node_path_mutations_1 = require("../../helpers/sequence-node-path-mutations");
9
9
  const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
10
+ const sequence_props_subscription_store_1 = require("./sequence-props-subscription-store");
10
11
  const SequencePropsObserver = () => {
11
12
  const { subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
12
13
  const { remapPropStatuses, setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
@@ -37,11 +38,13 @@ const SequencePropsObserver = () => {
37
38
  }
38
39
  const statusRemappings = [];
39
40
  const overrideUpdates = [];
41
+ const overrideIdsToRefresh = new Set();
40
42
  for (const [overrideId, previousNodePath] of Object.entries(overrideIdToNodePathMappingsRef.current)) {
41
43
  let { nodePath } = previousNodePath;
42
44
  let wasRemapped = false;
43
45
  let wasDeleted = false;
44
46
  let runtimeNodePathExists = true;
47
+ let runtimeNodePathNeedsRefresh = false;
45
48
  const previousNodePathString = JSON.stringify(previousNodePath.nodePath);
46
49
  for (const mutation of mutations) {
47
50
  for (const file of mutation.files) {
@@ -49,29 +52,35 @@ const SequencePropsObserver = () => {
49
52
  continue;
50
53
  }
51
54
  // Prop statuses follow source nodes to their new paths. Override IDs,
52
- // however, follow React's runtime instances. After deleting an unkeyed
53
- // sibling, React reuses the instance already at the destination path.
54
- // Keep that mapping in place and only remove mappings for vacated paths.
55
- const runtimeNodePathIsSource = file.remappings.some((item) => JSON.stringify(item.oldNodePath) === previousNodePathString);
55
+ // however, follow React's runtime instances. Structural edits may reuse
56
+ // the instance already at a path, so only remove mappings from paths
57
+ // which are sources without also being destinations.
58
+ const runtimeNodePathIsSource = file.remappings.some((item) => item.oldNodePath !== null &&
59
+ JSON.stringify(item.oldNodePath) === previousNodePathString);
56
60
  const runtimeNodePathIsDestination = file.remappings.some((item) => item.newNodePath !== null &&
57
61
  JSON.stringify(item.newNodePath) === previousNodePathString);
58
- const runtimeNodePathWasRestored = file.restoredNodePaths.some((item) => JSON.stringify(item) === previousNodePathString);
62
+ const runtimeNodePathWasInserted = file.remappings.some((item) => item.oldNodePath === null &&
63
+ item.newNodePath !== null &&
64
+ JSON.stringify(item.newNodePath) === previousNodePathString);
65
+ const runtimeNodePathWasUpdated = file.remappings.some((item) => item.oldNodePath !== null &&
66
+ item.newNodePath !== null &&
67
+ JSON.stringify(item.oldNodePath) === previousNodePathString &&
68
+ JSON.stringify(item.newNodePath) === previousNodePathString);
59
69
  if (runtimeNodePathIsSource) {
60
- runtimeNodePathExists =
61
- runtimeNodePathIsDestination || runtimeNodePathWasRestored;
70
+ runtimeNodePathExists = runtimeNodePathIsDestination;
71
+ runtimeNodePathNeedsRefresh =
72
+ runtimeNodePathWasInserted || runtimeNodePathWasUpdated;
62
73
  }
63
- else if (runtimeNodePathIsDestination ||
64
- runtimeNodePathWasRestored) {
74
+ else if (runtimeNodePathIsDestination) {
65
75
  runtimeNodePathExists = true;
76
+ runtimeNodePathNeedsRefresh =
77
+ runtimeNodePathWasInserted || runtimeNodePathWasUpdated;
66
78
  }
67
79
  if (wasDeleted) {
68
- const wasRestored = file.restoredNodePaths.some((restoredNodePath) => JSON.stringify(restoredNodePath) === JSON.stringify(nodePath));
69
- if (wasRestored) {
70
- wasDeleted = false;
71
- }
72
80
  continue;
73
81
  }
74
- const remapping = file.remappings.find((item) => JSON.stringify(item.oldNodePath) === JSON.stringify(nodePath));
82
+ const remapping = file.remappings.find((item) => item.oldNodePath !== null &&
83
+ JSON.stringify(item.oldNodePath) === JSON.stringify(nodePath));
75
84
  if (!remapping) {
76
85
  continue;
77
86
  }
@@ -97,11 +106,17 @@ const SequencePropsObserver = () => {
97
106
  overrideId,
98
107
  nodePath: runtimeNodePathExists ? previousNodePath : null,
99
108
  });
109
+ if (runtimeNodePathExists && runtimeNodePathNeedsRefresh) {
110
+ overrideIdsToRefresh.add(overrideId);
111
+ }
100
112
  }
101
113
  remapPropStatuses(statusRemappings);
102
114
  for (const event of overrideUpdates) {
103
115
  setOverrideIdToNodePath(event.overrideId, event.nodePath);
104
116
  }
117
+ for (const overrideId of overrideIdsToRefresh) {
118
+ (0, sequence_props_subscription_store_1.refreshSequencePropsSubscription)(overrideId);
119
+ }
105
120
  for (const event of statusRemappings) {
106
121
  if (event.nodePath === null) {
107
122
  continue;
@@ -48,6 +48,7 @@ const is_current_selected_still_1 = require("../../helpers/is-current-selected-s
48
48
  const open_in_editor_1 = require("../../helpers/open-in-editor");
49
49
  const studio_runtime_config_1 = require("../../helpers/studio-runtime-config");
50
50
  const timeline_node_path_key_1 = require("../../helpers/timeline-node-path-key");
51
+ const use_sync_external_store_1 = require("../../helpers/use-sync-external-store");
51
52
  const call_api_1 = require("../call-api");
52
53
  const ContextMenu_1 = require("../ContextMenu");
53
54
  const import_assets_1 = require("../import-assets");
@@ -296,7 +297,7 @@ const TimelineInner = () => {
296
297
  overrideIdToNodePathMappings,
297
298
  compositions,
298
299
  ]);
299
- const pendingInsertedElementSelection = (0, react_1.useSyncExternalStore)(inserted_element_selection_1.subscribeToInsertedElementSelection, inserted_element_selection_1.getInsertedElementSelection, inserted_element_selection_1.getInsertedElementSelection);
300
+ const pendingInsertedElementSelection = (0, use_sync_external_store_1.useSyncExternalStore)(inserted_element_selection_1.subscribeToInsertedElementSelection, inserted_element_selection_1.getInsertedElementSelection, inserted_element_selection_1.getInsertedElementSelection);
300
301
  const { fastRefreshes } = (0, react_1.useContext)(fast_refresh_context_1.FastRefreshContext);
301
302
  const pendingSelectionStart = (0, react_1.useRef)(null);
302
303
  const { selectItems } = (0, TimelineSelection_1.useTimelineSelection)();
@@ -23,6 +23,7 @@ const sourceActions = {
23
23
  display: 'flex',
24
24
  flex: 1,
25
25
  gap: 4,
26
+ margin: '0 4px',
26
27
  minWidth: 0,
27
28
  };
28
29
  const standaloneSourceActionStyle = {
@@ -1,118 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineDeleteKeybindings = void 0;
4
- const studio_shared_1 = require("@remotion/studio-shared");
5
4
  const react_1 = require("react");
6
5
  const remotion_1 = require("remotion");
7
6
  const client_id_1 = require("../../helpers/client-id");
8
7
  const use_keybinding_1 = require("../../helpers/use-keybinding");
9
- const editor_guides_1 = require("../../state/editor-guides");
10
8
  const ConfirmationDialog_1 = require("../ConfirmationDialog");
11
- const delete_selected_timeline_item_1 = require("./delete-selected-timeline-item");
12
9
  const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
13
10
  const imperative_state_1 = require("./imperative-state");
14
- const reset_selected_timeline_props_1 = require("./reset-selected-timeline-props");
15
11
  const split_selected_timeline_item_1 = require("./split-selected-timeline-item");
16
12
  const TimelineSelection_1 = require("./TimelineSelection");
17
- const update_selected_easing_1 = require("./update-selected-easing");
13
+ const use_delete_timeline_items_1 = require("./use-delete-timeline-items");
18
14
  const TimelineDeleteKeybindings = () => {
19
15
  const keybindings = (0, use_keybinding_1.useKeybinding)();
20
16
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
21
17
  const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
22
18
  const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
23
19
  const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
24
- const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
25
- const { setGuidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
26
20
  const { canSelect } = (0, TimelineSelection_1.useTimelineSelection)();
27
21
  const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
28
22
  const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
23
+ const deleteTimelineItems = (0, use_delete_timeline_items_1.useDeleteTimelineItems)();
29
24
  (0, react_1.useEffect)(() => {
30
25
  if (!canSelect || previewServerState.type !== 'connected') {
31
26
  return;
32
27
  }
33
- const { clientId } = previewServerState;
34
- const handleDelete = () => {
35
- const timelinePosition = (0, imperative_state_1.getCurrentFrame)();
36
- const { selectedItems, clearSelection, selectItems } = currentSelection.current;
37
- const sequences = sequencesRef.current;
38
- const propStatuses = propStatusesRef.current;
39
- if (selectedItems.length === 0) {
40
- return;
41
- }
42
- const selectedGuide = selectedItems.find((item) => item.type === 'guide');
43
- if (selectedGuide) {
44
- setGuidesList((prevGuides) => {
45
- const newGuides = prevGuides.filter((guide) => guide.id !== selectedGuide.guideId);
46
- (0, editor_guides_1.persistGuidesList)(newGuides);
47
- return newGuides;
48
- });
49
- clearSelection();
50
- return;
51
- }
52
- const deletePromise = (0, delete_selected_timeline_item_1.deleteSelectedTimelineItems)({
53
- selections: selectedItems,
54
- sequences,
55
- overrideIdsToNodePaths: overrideIdToNodePathMappings,
56
- setPropStatuses,
57
- clientId,
58
- confirm,
59
- propStatuses,
60
- timelinePosition,
61
- });
62
- if (deletePromise !== null) {
63
- deletePromise
64
- .then((deleted) => {
65
- if (deleted) {
66
- const nextSelection = (0, delete_selected_timeline_item_1.getTimelineSelectionAfterDeletingItems)({
67
- selections: selectedItems,
68
- sequences,
69
- overrideIdsToNodePaths: overrideIdToNodePathMappings,
70
- propStatuses,
71
- timelinePosition,
72
- });
73
- if (nextSelection.length === 0) {
74
- clearSelection();
75
- }
76
- else {
77
- selectItems(nextSelection);
78
- }
79
- }
80
- })
81
- .catch(() => undefined);
82
- return;
83
- }
84
- const easingSelections = (0, update_selected_easing_1.getEasingSelections)(selectedItems);
85
- if (easingSelections.length === selectedItems.length) {
86
- const resetEasingPromise = (0, update_selected_easing_1.updateSelectedTimelineEasings)({
87
- selections: easingSelections,
88
- sequences,
89
- overrideIdsToNodePaths: overrideIdToNodePathMappings,
90
- propStatuses,
91
- setPropStatuses,
92
- clientId,
93
- easing: studio_shared_1.LINEAR_KEYFRAME_EASING,
94
- });
95
- if (resetEasingPromise !== null) {
96
- resetEasingPromise.catch(() => undefined);
97
- return;
98
- }
99
- }
100
- const resetPromise = (0, reset_selected_timeline_props_1.resetSelectedTimelineProps)({
101
- selections: selectedItems,
102
- sequences,
103
- overrideIdsToNodePaths: overrideIdToNodePathMappings,
104
- propStatuses,
105
- setPropStatuses,
106
- clientId,
107
- });
108
- if (resetPromise !== null) {
109
- resetPromise.catch(() => undefined);
110
- }
111
- };
112
28
  const backspace = keybindings.registerKeybinding({
113
29
  event: 'keydown',
114
30
  key: 'Backspace',
115
- callback: handleDelete,
31
+ callback: () => deleteTimelineItems(null),
116
32
  commandCtrlKey: false,
117
33
  preventDefault: true,
118
34
  triggerIfInputFieldFocused: false,
@@ -121,7 +37,7 @@ const TimelineDeleteKeybindings = () => {
121
37
  const deleteKey = keybindings.registerKeybinding({
122
38
  event: 'keydown',
123
39
  key: 'Delete',
124
- callback: handleDelete,
40
+ callback: () => deleteTimelineItems(null),
125
41
  commandCtrlKey: false,
126
42
  preventDefault: true,
127
43
  triggerIfInputFieldFocused: false,
@@ -190,13 +106,12 @@ const TimelineDeleteKeybindings = () => {
190
106
  canSelect,
191
107
  confirm,
192
108
  currentSelection,
109
+ deleteTimelineItems,
193
110
  keybindings,
194
111
  overrideIdToNodePathMappings,
195
112
  propStatusesRef,
196
113
  previewServerState,
197
114
  sequencesRef,
198
- setGuidesList,
199
- setPropStatuses,
200
115
  ]);
201
116
  return null;
202
117
  };
@@ -38,6 +38,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const player_1 = require("@remotion/player");
39
39
  const react_1 = __importStar(require("react"));
40
40
  const remotion_1 = require("remotion");
41
+ const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
41
42
  const interactivity_enabled_1 = require("../../helpers/interactivity-enabled");
42
43
  const pointer_session_1 = require("../../helpers/pointer-session");
43
44
  const timeline_zoom_1 = require("../../state/timeline-zoom");
@@ -73,22 +74,32 @@ const getClientXWithScroll = (x) => {
73
74
  };
74
75
  const TimelineDragHandler = () => {
75
76
  const video = remotion_1.Internals.useUnsafeVideoConfig();
77
+ const timelineSize = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
78
+ triggerOnWindowResize: true,
79
+ shouldApplyCssTransforms: true,
80
+ });
76
81
  const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
77
82
  const { canvasContent, currentAssetMetadata } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
78
83
  const containerStyle = (0, react_1.useMemo)(() => {
79
84
  var _a;
85
+ var _b, _c, _d, _e;
80
86
  if (!canvasContent) {
81
87
  return {};
82
88
  }
83
- const zoom = canvasContent.type === 'composition'
84
- ? ((_a = zoomMap[canvasContent.compositionId]) !== null && _a !== void 0 ? _a : timeline_zoom_1.TIMELINE_MIN_ZOOM)
85
- : timeline_zoom_1.TIMELINE_MIN_ZOOM;
89
+ const durationInFrames = (_b = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _b !== void 0 ? _b : 1;
90
+ const zoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
91
+ durationInFrames,
92
+ timelineViewportWidth: (_d = (_c = timelineSize === null || timelineSize === void 0 ? void 0 : timelineSize.width) !== null && _c !== void 0 ? _c : (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _d !== void 0 ? _d : 0,
93
+ zoom: canvasContent.type === 'composition'
94
+ ? ((_e = zoomMap[canvasContent.compositionId]) !== null && _e !== void 0 ? _e : null)
95
+ : null,
96
+ });
86
97
  return {
87
98
  ...container,
88
- width: 100 * zoom + '%',
99
+ width: (0, get_timeline_max_zoom_1.getTimelineWidth)({ durationInFrames, zoom }),
89
100
  height: TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT,
90
101
  };
91
- }, [canvasContent, zoomMap]);
102
+ }, [canvasContent, timelineSize === null || timelineSize === void 0 ? void 0 : timelineSize.width, video === null || video === void 0 ? void 0 : video.durationInFrames, zoomMap]);
92
103
  const hasPlayableContent = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ||
93
104
  ((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset' &&
94
105
  (currentAssetMetadata === null || currentAssetMetadata === void 0 ? void 0 : currentAssetMetadata.asset) === canvasContent.asset);
@@ -100,7 +111,6 @@ const TimelineDragHandler = () => {
100
111
  exports.TimelineDragHandler = TimelineDragHandler;
101
112
  const TimelineDragHandlerInner = () => {
102
113
  var _a;
103
- var _b, _c;
104
114
  const videoConfig = (0, remotion_1.useVideoConfig)();
105
115
  const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
106
116
  triggerOnWindowResize: true,
@@ -108,8 +118,8 @@ const TimelineDragHandlerInner = () => {
108
118
  });
109
119
  const { isHighestContext } = (0, z_index_1.useZIndex)();
110
120
  const setFrame = remotion_1.Internals.useTimelineSetFrame();
111
- const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
112
- const left = (_c = size === null || size === void 0 ? void 0 : size.left) !== null && _c !== void 0 ? _c : 0;
121
+ const width = (0, timeline_scroll_logic_1.getTimelineContentWidth)();
122
+ const left = (_a = size === null || size === void 0 ? void 0 : size.left) !== null && _a !== void 0 ? _a : 0;
113
123
  const [dragging, setDragging] = (0, react_1.useState)({
114
124
  dragging: false,
115
125
  });
@@ -65,7 +65,6 @@ const TimelineInOutDragHandler = () => {
65
65
  exports.TimelineInOutDragHandler = TimelineInOutDragHandler;
66
66
  const TimelineInOutDragHandlerInner = () => {
67
67
  var _a;
68
- var _b, _c;
69
68
  const videoConfig = (0, remotion_1.useVideoConfig)();
70
69
  const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
71
70
  triggerOnWindowResize: true,
@@ -82,8 +81,8 @@ const TimelineInOutDragHandlerInner = () => {
82
81
  }
83
82
  return (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, timelineWidth);
84
83
  }, [timelineWidth, videoConfig.durationInFrames]);
85
- const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
86
- const left = (_c = size === null || size === void 0 ? void 0 : size.left) !== null && _c !== void 0 ? _c : 0;
84
+ const width = (0, timeline_scroll_logic_1.getTimelineContentWidth)();
85
+ const left = (_a = size === null || size === void 0 ? void 0 : size.left) !== null && _a !== void 0 ? _a : 0;
87
86
  const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
88
87
  const { setInAndOutFrames } = (0, in_out_1.useTimelineSetInOutFramePosition)();
89
88
  const onInPointerDown = (0, react_1.useCallback)((e) => {
@@ -206,6 +206,7 @@ const hasTargetKeyframeAtCurrentFrame = (target) => {
206
206
  return (0, get_keyframe_navigation_1.hasKeyframeAtSourceFrame)(target.propStatus.keyframes, target.sourceFrame);
207
207
  };
208
208
  const getAddChange = (target) => {
209
+ var _a;
209
210
  if (target.propStatus.status === 'computed' ||
210
211
  !(0, studio_shared_1.isSchemaFieldKeyframable)({ schema: target.schema, key: target.fieldKey }) ||
211
212
  hasTargetKeyframeAtCurrentFrame(target)) {
@@ -213,7 +214,8 @@ const getAddChange = (target) => {
213
214
  }
214
215
  const value = getCurrentKeyframeValue({
215
216
  propStatus: target.propStatus,
216
- jsxFrame: target.sourceFrame,
217
+ jsxFrame: target.sourceFrame +
218
+ ((_a = target.propStatus.keyframeDisplayOffsetAdjustment) !== null && _a !== void 0 ? _a : 0),
217
219
  defaultValue: target.defaultValue,
218
220
  dragOverrideValue: target.dragOverrideValue,
219
221
  });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelinePinchZoom = void 0;
4
4
  const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
+ const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
6
7
  const is_current_selected_still_1 = require("../../helpers/is-current-selected-still");
7
8
  const editor_zoom_gestures_1 = require("../../state/editor-zoom-gestures");
8
9
  const timeline_zoom_1 = require("../../state/timeline-zoom");
@@ -22,6 +23,15 @@ const TimelinePinchZoom = () => {
22
23
  const { editorZoomGestures } = (0, react_1.useContext)(editor_zoom_gestures_1.EditorZoomGesturesContext);
23
24
  const zoomRef = (0, react_1.useRef)(zoom);
24
25
  zoomRef.current = zoom;
26
+ const getCurrentTimelineZoom = (0, react_1.useCallback)((compositionId) => {
27
+ var _a;
28
+ var _b, _c, _d;
29
+ return (0, get_timeline_max_zoom_1.getTimelineZoom)({
30
+ durationInFrames: (_b = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _b !== void 0 ? _b : 1,
31
+ timelineViewportWidth: (_c = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _c !== void 0 ? _c : 0,
32
+ zoom: (_d = zoomRef.current[compositionId]) !== null && _d !== void 0 ? _d : null,
33
+ });
34
+ }, [videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames]);
25
35
  const pinchBaseZoomRef = (0, react_1.useRef)(null);
26
36
  const suppressWheelFromWebKitPinchRef = (0, react_1.useRef)(false);
27
37
  const touchPinchRef = (0, react_1.useRef)(null);
@@ -89,7 +99,6 @@ const TimelinePinchZoom = () => {
89
99
  suppressWheelFromWebKitPinchRef.current = false;
90
100
  };
91
101
  const onGestureStart = (event) => {
92
- var _a;
93
102
  const e = event;
94
103
  if (!isVideoComposition) {
95
104
  return;
@@ -106,7 +115,7 @@ const TimelinePinchZoom = () => {
106
115
  }
107
116
  e.preventDefault();
108
117
  suppressWheelFromWebKitPinchRef.current = true;
109
- pinchBaseZoomRef.current = (_a = zoomRef.current[canvasContent.compositionId]) !== null && _a !== void 0 ? _a : timeline_zoom_1.TIMELINE_MIN_ZOOM;
118
+ pinchBaseZoomRef.current = getCurrentTimelineZoom(canvasContent.compositionId);
110
119
  };
111
120
  const onGestureChange = (event) => {
112
121
  const e = event;
@@ -153,6 +162,7 @@ const TimelinePinchZoom = () => {
153
162
  isVideoComposition,
154
163
  videoConfig,
155
164
  canvasContent,
165
+ getCurrentTimelineZoom,
156
166
  setZoom,
157
167
  ]);
158
168
  (0, react_1.useEffect)(() => {
@@ -161,7 +171,6 @@ const TimelinePinchZoom = () => {
161
171
  return;
162
172
  }
163
173
  const onTouchStart = (event) => {
164
- var _a;
165
174
  if (event.touches.length !== 2) {
166
175
  touchPinchRef.current = null;
167
176
  return;
@@ -181,7 +190,7 @@ const TimelinePinchZoom = () => {
181
190
  }
182
191
  touchPinchRef.current = {
183
192
  initialDistance,
184
- initialZoom: (_a = zoomRef.current[canvasContent.compositionId]) !== null && _a !== void 0 ? _a : timeline_zoom_1.TIMELINE_MIN_ZOOM,
193
+ initialZoom: getCurrentTimelineZoom(canvasContent.compositionId),
185
194
  };
186
195
  };
187
196
  const onTouchMove = (event) => {
@@ -233,6 +242,7 @@ const TimelinePinchZoom = () => {
233
242
  isVideoComposition,
234
243
  videoConfig,
235
244
  canvasContent,
245
+ getCurrentTimelineZoom,
236
246
  setZoom,
237
247
  ]);
238
248
  return null;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelinePlayCursorSyncer = void 0;
4
4
  const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
+ const get_timeline_max_zoom_1 = require("../../helpers/get-timeline-max-zoom");
6
7
  const timeline_zoom_1 = require("../../state/timeline-zoom");
7
8
  const imperative_state_1 = require("./imperative-state");
8
9
  const timeline_refs_1 = require("./timeline-refs");
@@ -10,9 +11,10 @@ const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
10
11
  let lastTimelinePositionWhileScrolling = null;
11
12
  const TimelinePlayCursorSyncer = () => {
12
13
  var _a;
14
+ var _b, _c, _d;
13
15
  const video = remotion_1.Internals.useVideo();
14
16
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
15
- const [playing] = remotion_1.Internals.Timeline.usePlayingState();
17
+ const playing = remotion_1.Internals.usePlaying();
16
18
  const { playbackRate } = remotion_1.Internals.usePlaybackRate();
17
19
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
18
20
  const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
@@ -21,9 +23,11 @@ const TimelinePlayCursorSyncer = () => {
21
23
  : null;
22
24
  // Asset previews have a synthetic video config, but no composition ID
23
25
  // with which to look up a persisted timeline zoom.
24
- const zoom = compositionId
25
- ? ((_a = zoomMap[compositionId]) !== null && _a !== void 0 ? _a : timeline_zoom_1.TIMELINE_MIN_ZOOM)
26
- : timeline_zoom_1.TIMELINE_MIN_ZOOM;
26
+ const zoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
27
+ durationInFrames: (_b = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _b !== void 0 ? _b : 1,
28
+ timelineViewportWidth: (_c = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _c !== void 0 ? _c : 0,
29
+ zoom: compositionId ? ((_d = zoomMap[compositionId]) !== null && _d !== void 0 ? _d : null) : null,
30
+ });
27
31
  if (video) {
28
32
  (0, imperative_state_1.setCurrentFrame)(timelinePosition);
29
33
  (0, imperative_state_1.setCurrentZoom)(zoom);
@@ -91,8 +91,10 @@ const TimelineRowChrome = ({ depth, eye, keyframeControls, arrow, children, styl
91
91
  }, [onSelect]);
92
92
  const onContextMenu = (0, react_1.useCallback)((e) => {
93
93
  e.stopPropagation();
94
- onSelect();
95
- }, [onSelect]);
94
+ if (!selected) {
95
+ onSelect();
96
+ }
97
+ }, [onSelect, selected]);
96
98
  const onDoubleClickIfNotInteractive = (0, react_1.useCallback)((e) => {
97
99
  const { target } = e;
98
100
  if (target instanceof Element &&