@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
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEasingSelectionAfterKeyframeDelete = void 0;
4
+ const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
4
5
  const getEasingSelectionAfterKeyframeDelete = ({ deletedSourceFrames, keyframeDisplayOffset, nodePathInfo, propStatus, timelinePosition, }) => {
6
+ const resolvedKeyframeDisplayOffset = (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
7
+ propStatus,
8
+ keyframeDisplayOffset,
9
+ });
5
10
  const deletedSourceFrameSet = new Set(deletedSourceFrames);
6
11
  const remainingKeyframes = propStatus.keyframes.filter((keyframe) => !deletedSourceFrameSet.has(keyframe.frame));
7
- const sourceFrame = timelinePosition - keyframeDisplayOffset;
12
+ const sourceFrame = timelinePosition - resolvedKeyframeDisplayOffset;
8
13
  for (let i = 0; i < remainingKeyframes.length - 1; i++) {
9
14
  const keyframe = remainingKeyframes[i];
10
15
  const nextKeyframe = remainingKeyframes[i + 1];
@@ -15,8 +20,8 @@ const getEasingSelectionAfterKeyframeDelete = ({ deletedSourceFrames, keyframeDi
15
20
  return {
16
21
  type: 'easing',
17
22
  nodePathInfo,
18
- fromFrame: keyframe.frame + keyframeDisplayOffset,
19
- toFrame: nextKeyframe.frame + keyframeDisplayOffset,
23
+ fromFrame: keyframe.frame + resolvedKeyframeDisplayOffset,
24
+ toFrame: nextKeyframe.frame + resolvedKeyframeDisplayOffset,
20
25
  segmentIndex: i,
21
26
  };
22
27
  }
@@ -6,6 +6,7 @@ const format_file_location_1 = require("../../helpers/format-file-location");
6
6
  const get_open_in_menu_items_1 = require("../get-open-in-menu-items");
7
7
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
8
8
  const actions_1 = require("../RenderQueue/actions");
9
+ const use_default_editor_info_1 = require("../use-default-editor-info");
9
10
  const timeline_asset_link_1 = require("./timeline-asset-link");
10
11
  const normalizeMenuDividers = (items) => {
11
12
  var _a;
@@ -26,16 +27,17 @@ const normalizeMenuDividers = (items) => {
26
27
  };
27
28
  const interactiveSvgComponentIdentity = 'dev.remotion.remotion.Interactive.Svg';
28
29
  const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDisabled, disableInteractivityDisabled, duplicateDisabled, isProgrammaticallyDuplicated, includeSourceEditItems, codingAgentInfo, editorInfo, onConfigureApps, onDeleteSequenceFromSource, onDisableSequenceInteractivity, onDuplicateSequenceFromSource, openInCodingAgent, openInEditor, originalLocation, selectAsset, sequence, sourceActions = [], }) => {
29
- var _a, _b, _c, _d;
30
- var _e, _f, _g;
31
- const editorName = window.remotion_editorName;
30
+ var _a, _b, _c;
31
+ var _d, _e, _f;
32
32
  const isInteractiveSvg = ((_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.componentIdentity) === interactiveSvgComponentIdentity;
33
- const installedEditors = (_e = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors) !== null && _e !== void 0 ? _e : [];
34
- const defaultEditorId = (_f = (_b = installedEditors.find((editor) => editor.nameWithType === editorName)) === null || _b === void 0 ? void 0 : _b.id) !== null && _f !== void 0 ? _f : null;
33
+ const installedEditors = (_d = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors) !== null && _d !== void 0 ? _d : [];
34
+ const defaultEditorId = (0, use_default_editor_info_1.getPreferredEditorId)(editorInfo);
35
+ const defaultEditor = installedEditors.find((editor) => editor.id === defaultEditorId);
36
+ const editorName = (_e = defaultEditor === null || defaultEditor === void 0 ? void 0 : defaultEditor.nameWithType) !== null && _e !== void 0 ? _e : null;
35
37
  const defaultCodingAgent = codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents.find((codingAgent) => codingAgent.id === codingAgentInfo.defaultCodingAgent);
36
38
  const contextForAgents = (0, format_file_location_1.formatContextForAgents)({
37
39
  location: originalLocation,
38
- name: sequence.displayName || ((_c = sequence.controls) === null || _c === void 0 ? void 0 : _c.componentName) || null,
40
+ name: sequence.displayName || ((_b = sequence.controls) === null || _b === void 0 ? void 0 : _b.componentName) || null,
39
41
  root: window.remotion_cwd,
40
42
  });
41
43
  const openInCodingAgentWithContext = (codingAgentId, codingAgentName) => {
@@ -46,7 +48,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
46
48
  codingAgentInfo,
47
49
  editorDisabled: !canOpenInEditor || !originalLocation,
48
50
  editorInfo,
49
- excludeCodingAgentId: (_g = defaultCodingAgent === null || defaultCodingAgent === void 0 ? void 0 : defaultCodingAgent.id) !== null && _g !== void 0 ? _g : null,
51
+ excludeCodingAgentId: (_f = defaultCodingAgent === null || defaultCodingAgent === void 0 ? void 0 : defaultCodingAgent.id) !== null && _f !== void 0 ? _f : null,
50
52
  excludeEditorId: defaultEditorId,
51
53
  fileManagerDisabled: !(originalLocation === null || originalLocation === void 0 ? void 0 : originalLocation.source),
52
54
  folder: false,
@@ -161,7 +163,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
161
163
  keyHint: null,
162
164
  label: 'Copy SVG',
163
165
  leftItem: null,
164
- disabled: !((_d = sequence.refForOutline) === null || _d === void 0 ? void 0 : _d.current),
166
+ disabled: !((_c = sequence.refForOutline) === null || _c === void 0 ? void 0 : _c.current),
165
167
  onClick: () => {
166
168
  var _a;
167
169
  const svg = (_a = sequence.refForOutline) === null || _a === void 0 ? void 0 : _a.current;
@@ -1,6 +1,9 @@
1
- import type { CanUpdateSequencePropStatus, CanUpdateSequencePropStatusFalse } from 'remotion';
2
- export declare const getComputedStatusLabel: (propStatus: CanUpdateSequencePropStatusFalse) => string;
1
+ import type { CanUpdateSequencePropStatus } from 'remotion';
3
2
  export declare const getTimelineKeyframes: (propStatus: CanUpdateSequencePropStatus | null | undefined, keyframeDisplayOffset?: number) => {
4
3
  frame: number;
5
4
  value: unknown;
6
5
  }[];
6
+ export declare const getKeyframeDisplayOffset: ({ propStatus, keyframeDisplayOffset, }: {
7
+ propStatus: CanUpdateSequencePropStatus | null | undefined;
8
+ keyframeDisplayOffset: number;
9
+ }) => number;
@@ -1,13 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimelineKeyframes = exports.getComputedStatusLabel = void 0;
4
- const getComputedStatusLabel = (propStatus) => {
5
- if (propStatus.status === 'computed') {
6
- return 'computed';
7
- }
8
- throw new Error(`Unsupported prop status: ${propStatus.status}`);
9
- };
10
- exports.getComputedStatusLabel = getComputedStatusLabel;
3
+ exports.getKeyframeDisplayOffset = exports.getTimelineKeyframes = void 0;
11
4
  const getTimelineKeyframes = (propStatus, keyframeDisplayOffset = 0) => {
12
5
  if (!propStatus) {
13
6
  return [];
@@ -16,12 +9,25 @@ const getTimelineKeyframes = (propStatus, keyframeDisplayOffset = 0) => {
16
9
  return [];
17
10
  }
18
11
  const { keyframes } = propStatus;
19
- if (keyframeDisplayOffset === 0) {
12
+ const resolvedKeyframeDisplayOffset = (0, exports.getKeyframeDisplayOffset)({
13
+ propStatus,
14
+ keyframeDisplayOffset,
15
+ });
16
+ if (resolvedKeyframeDisplayOffset === 0) {
20
17
  return keyframes;
21
18
  }
22
19
  return keyframes.map((keyframe) => ({
23
20
  ...keyframe,
24
- frame: keyframe.frame + keyframeDisplayOffset,
21
+ frame: keyframe.frame + resolvedKeyframeDisplayOffset,
25
22
  }));
26
23
  };
27
24
  exports.getTimelineKeyframes = getTimelineKeyframes;
25
+ const getKeyframeDisplayOffset = ({ propStatus, keyframeDisplayOffset, }) => {
26
+ return (keyframeDisplayOffset +
27
+ ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed' || (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static'
28
+ ? propStatus.keyframeDisplayOffsetAdjustment === null
29
+ ? 0
30
+ : propStatus.keyframeDisplayOffsetAdjustment
31
+ : 0));
32
+ };
33
+ exports.getKeyframeDisplayOffset = getKeyframeDisplayOffset;
@@ -0,0 +1,30 @@
1
+ type TimelineSequenceVisibleLayout = {
2
+ readonly marginLeft: number;
3
+ readonly width: number;
4
+ readonly cropLeft: number;
5
+ readonly leftEdgeVisible: boolean;
6
+ readonly rightEdgeVisible: boolean;
7
+ readonly premount: {
8
+ readonly left: number;
9
+ readonly width: number;
10
+ } | null;
11
+ readonly postmount: {
12
+ readonly left: number;
13
+ readonly width: number;
14
+ } | null;
15
+ readonly media: {
16
+ readonly left: number;
17
+ readonly width: number;
18
+ readonly offset: number;
19
+ readonly fullWidth: number;
20
+ } | null;
21
+ };
22
+ export declare const getTimelineSequenceVisibleLayout: ({ marginLeft, width, premountWidth, postmountWidth, renderWindowLeft, renderWindowWidth, }: {
23
+ readonly marginLeft: number;
24
+ readonly width: number;
25
+ readonly premountWidth: number;
26
+ readonly postmountWidth: number;
27
+ readonly renderWindowLeft: number;
28
+ readonly renderWindowWidth: number;
29
+ }) => TimelineSequenceVisibleLayout | null;
30
+ export {};
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimelineSequenceVisibleLayout = void 0;
4
+ const getVisibleSection = ({ sectionStart, sectionEnd, cropStart, cropEnd, }) => {
5
+ const start = Math.max(sectionStart, cropStart);
6
+ const end = Math.min(sectionEnd, cropEnd);
7
+ if (end <= start) {
8
+ return null;
9
+ }
10
+ return {
11
+ left: start - cropStart,
12
+ width: end - start,
13
+ };
14
+ };
15
+ const getTimelineSequenceVisibleLayout = ({ marginLeft, width, premountWidth, postmountWidth, renderWindowLeft, renderWindowWidth, }) => {
16
+ const itemStart = marginLeft;
17
+ const itemEnd = marginLeft + width;
18
+ const renderWindowEnd = renderWindowLeft + renderWindowWidth;
19
+ const visibleStart = Math.max(itemStart, renderWindowLeft);
20
+ const visibleEnd = Math.min(itemEnd, renderWindowEnd);
21
+ if (visibleEnd <= visibleStart) {
22
+ return null;
23
+ }
24
+ const cropStart = visibleStart - itemStart;
25
+ const cropEnd = visibleEnd - itemStart;
26
+ const mediaStart = premountWidth;
27
+ const mediaEnd = Math.max(mediaStart, width - postmountWidth);
28
+ const media = getVisibleSection({
29
+ sectionStart: mediaStart,
30
+ sectionEnd: mediaEnd,
31
+ cropStart,
32
+ cropEnd,
33
+ });
34
+ return {
35
+ marginLeft: visibleStart,
36
+ width: visibleEnd - visibleStart,
37
+ cropLeft: cropStart,
38
+ leftEdgeVisible: visibleStart === itemStart,
39
+ rightEdgeVisible: visibleEnd === itemEnd,
40
+ premount: getVisibleSection({
41
+ sectionStart: 0,
42
+ sectionEnd: premountWidth,
43
+ cropStart,
44
+ cropEnd,
45
+ }),
46
+ postmount: getVisibleSection({
47
+ sectionStart: Math.max(0, width - postmountWidth),
48
+ sectionEnd: width,
49
+ cropStart,
50
+ cropEnd,
51
+ }),
52
+ media: media
53
+ ? {
54
+ ...media,
55
+ offset: Math.max(0, cropStart - mediaStart),
56
+ fullWidth: Math.max(0, mediaEnd - mediaStart),
57
+ }
58
+ : null,
59
+ };
60
+ };
61
+ exports.getTimelineSequenceVisibleLayout = getTimelineSequenceVisibleLayout;
@@ -4,6 +4,7 @@ exports.getPasteKeyframeTarget = exports.isKeyframeValueCompatible = exports.get
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const remotion_1 = require("remotion");
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 getKeyframeClipboardFieldType = ({ schema, fieldKey, }) => {
9
10
  const field = remotion_1.Internals.getFlatSchemaWithAllKeys(schema)[fieldKey];
@@ -68,7 +69,10 @@ const resolveKeyframeField = ({ selection, sequences, overrideIdsToNodePaths, pr
68
69
  fieldKey: identity.fieldKey,
69
70
  }),
70
71
  propStatus: sequencePropStatus,
71
- keyframeDisplayOffset: track.keyframeDisplayOffset,
72
+ keyframeDisplayOffset: (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
73
+ propStatus: sequencePropStatus,
74
+ keyframeDisplayOffset: track.keyframeDisplayOffset,
75
+ }),
72
76
  };
73
77
  }
74
78
  const effect = track.sequence.effects[identity.effectIndex];
@@ -93,7 +97,10 @@ const resolveKeyframeField = ({ selection, sequences, overrideIdsToNodePaths, pr
93
97
  fieldKey: identity.fieldKey,
94
98
  }),
95
99
  propStatus: effectPropStatus,
96
- keyframeDisplayOffset: track.keyframeDisplayOffset,
100
+ keyframeDisplayOffset: (0, get_timeline_keyframes_1.getKeyframeDisplayOffset)({
101
+ propStatus: effectPropStatus,
102
+ keyframeDisplayOffset: track.keyframeDisplayOffset,
103
+ }),
97
104
  };
98
105
  };
99
106
  const areResolvedFieldsEqual = (first, second) => {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.splitSelectedTimelineItems = exports.shouldHandleTimelineSplitShortcut = exports.shouldHandleTimelineDuplicateShortcut = exports.splitTimelineSequenceFromSource = exports.getTimelineSequenceSplitEligibility = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const remotion_1 = require("remotion");
6
- const call_api_1 = require("../call-api");
7
6
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
7
+ const split_jsx_sequence_api_1 = require("../split-jsx-sequence-api");
8
8
  const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
9
9
  const staticNumberish = (status) => {
10
10
  if (!status) {
@@ -89,7 +89,7 @@ const getTimelineSequenceSplitEligibility = ({ selection, sequence, splitFrame,
89
89
  exports.getTimelineSequenceSplitEligibility = getTimelineSequenceSplitEligibility;
90
90
  const splitTimelineSequenceFromSource = ({ nodePathInfo, splitFrame, }) => {
91
91
  const nodePath = nodePathInfo.sequenceSubscriptionKey;
92
- return (0, call_api_1.callApi)('/api/split-jsx-sequence', {
92
+ return (0, split_jsx_sequence_api_1.splitJsxSequence)({
93
93
  fileName: nodePath.absolutePath,
94
94
  nodePath: nodePath.nodePath,
95
95
  sequenceKeys: nodePath.sequenceKeys,
@@ -2,6 +2,30 @@ export declare const canScrollTimelineIntoDirection: () => {
2
2
  canScrollRight: boolean;
3
3
  canScrollLeft: boolean;
4
4
  };
5
+ export declare const SCROLL_INCREMENT = 200;
6
+ export declare const EDGE_SCROLL_VERTICAL_INCREMENT = 60;
7
+ export type TimelineEdgeScrollDirections = {
8
+ x: 'left' | 'right' | null;
9
+ y: 'up' | 'down' | null;
10
+ };
11
+ export type TimelineEdgeAutoScroller = {
12
+ update: (e: {
13
+ clientX: number;
14
+ clientY: number;
15
+ }) => TimelineEdgeScrollDirections;
16
+ stop: () => void;
17
+ };
18
+ /**
19
+ * Shared edge auto-scroll loop for drag gestures on the timeline (playhead
20
+ * scrubbing, marquee selection). Detects when the pointer is in an edge zone
21
+ * and repeatedly invokes `onTick` while it stays there. The consumer performs
22
+ * the actual scrolling (and any dependent updates) inside `onTick`, so it can
23
+ * read a settled scroll position afterwards.
24
+ */
25
+ export declare const startTimelineEdgeAutoScroll: ({ includeVertical, onTick, }: {
26
+ includeVertical: boolean;
27
+ onTick: (directions: TimelineEdgeScrollDirections) => void;
28
+ }) => TimelineEdgeAutoScroller;
5
29
  export declare const getFrameWhileScrollingLeft: ({ durationInFrames, width, }: {
6
30
  durationInFrames: number;
7
31
  width: number;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareToPreserveTimelineCursor = exports.getScrollLeftToKeepCursorInPlace = exports.viewportClientXToScrollContentX = exports.getFrameFromTimelineDrop = exports.getFrameFromX = exports.getFrameWhileScrollingRight = exports.getFrameIncrementFromWidth = exports.getScrollPositionForCursorOnRightEdge = exports.getScrollPositionForCursorOnLeftEdge = exports.scrollToTimelineXOffset = exports.ensureFrameIsInViewport = exports.isCursorInViewport = exports.getFrameWhileScrollingLeft = exports.canScrollTimelineIntoDirection = void 0;
3
+ exports.prepareToPreserveTimelineCursor = exports.getScrollLeftToKeepCursorInPlace = exports.viewportClientXToScrollContentX = exports.getFrameFromTimelineDrop = exports.getFrameFromX = exports.getFrameWhileScrollingRight = exports.getFrameIncrementFromWidth = exports.getScrollPositionForCursorOnRightEdge = exports.getScrollPositionForCursorOnLeftEdge = exports.scrollToTimelineXOffset = exports.ensureFrameIsInViewport = exports.isCursorInViewport = exports.getFrameWhileScrollingLeft = exports.startTimelineEdgeAutoScroll = exports.EDGE_SCROLL_VERTICAL_INCREMENT = exports.SCROLL_INCREMENT = exports.canScrollTimelineIntoDirection = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const timeline_layout_1 = require("../../helpers/timeline-layout");
6
+ const imperative_state_1 = require("./imperative-state");
6
7
  const timeline_refs_1 = require("./timeline-refs");
7
8
  const TimelineSlider_1 = require("./TimelineSlider");
8
9
  const canScrollTimelineIntoDirection = () => {
@@ -13,7 +14,126 @@ const canScrollTimelineIntoDirection = () => {
13
14
  return { canScrollRight, canScrollLeft };
14
15
  };
15
16
  exports.canScrollTimelineIntoDirection = canScrollTimelineIntoDirection;
16
- const SCROLL_INCREMENT = 200;
17
+ exports.SCROLL_INCREMENT = 200;
18
+ exports.EDGE_SCROLL_VERTICAL_INCREMENT = 60;
19
+ const EDGE_SCROLL_INTERVAL_MS = 100;
20
+ // Once edge-scrolling has started, the pointer must move this many pixels
21
+ // back inside the timeline to stop it. Prevents pixel jitter around the edge
22
+ // threshold from rapidly cancelling and restarting the auto-scroll.
23
+ const EDGE_SCROLL_EXIT_HYSTERESIS = 8;
24
+ // The vertical edge zones extend this many pixels into the viewport, so the
25
+ // auto-scroll already engages when dragging close to (not exactly onto) the
26
+ // top or bottom edge.
27
+ const EDGE_SCROLL_VERTICAL_INSET = 8;
28
+ const canScrollTimelineVerticallyIntoDirection = () => {
29
+ const { current } = timeline_refs_1.timelineVerticalScroll;
30
+ if (!current) {
31
+ return { canScrollUp: false, canScrollDown: false };
32
+ }
33
+ const { scrollTop, scrollHeight, clientHeight } = current;
34
+ return {
35
+ canScrollUp: scrollTop > 0,
36
+ canScrollDown: scrollHeight - scrollTop - clientHeight > 0,
37
+ };
38
+ };
39
+ const getEdgeScrollDirections = ({ clientX, clientY, includeVertical, active, }) => {
40
+ let x = null;
41
+ const scrollable = timeline_refs_1.scrollableRef.current;
42
+ if (scrollable) {
43
+ const rect = scrollable.getBoundingClientRect();
44
+ const leftThreshold = rect.left + (active.x === 'left' ? EDGE_SCROLL_EXIT_HYSTERESIS : 0);
45
+ const rightThreshold = rect.left +
46
+ scrollable.clientWidth -
47
+ timeline_layout_1.TIMELINE_PADDING -
48
+ (active.x === 'right' ? EDGE_SCROLL_EXIT_HYSTERESIS : 0);
49
+ const { canScrollLeft, canScrollRight } = (0, exports.canScrollTimelineIntoDirection)();
50
+ if (clientX <= leftThreshold && canScrollLeft) {
51
+ x = 'left';
52
+ }
53
+ else if (clientX >= rightThreshold && canScrollRight) {
54
+ x = 'right';
55
+ }
56
+ }
57
+ let y = null;
58
+ const vertical = timeline_refs_1.timelineVerticalScroll.current;
59
+ if (includeVertical && vertical) {
60
+ const rect = vertical.getBoundingClientRect();
61
+ const topThreshold = rect.top +
62
+ EDGE_SCROLL_VERTICAL_INSET +
63
+ (active.y === 'up' ? EDGE_SCROLL_EXIT_HYSTERESIS : 0);
64
+ const bottomThreshold = rect.bottom -
65
+ EDGE_SCROLL_VERTICAL_INSET -
66
+ (active.y === 'down' ? EDGE_SCROLL_EXIT_HYSTERESIS : 0);
67
+ const { canScrollUp, canScrollDown } = canScrollTimelineVerticallyIntoDirection();
68
+ if (clientY <= topThreshold && canScrollUp) {
69
+ y = 'up';
70
+ }
71
+ else if (clientY >= bottomThreshold && canScrollDown) {
72
+ y = 'down';
73
+ }
74
+ }
75
+ return { x, y };
76
+ };
77
+ /**
78
+ * Shared edge auto-scroll loop for drag gestures on the timeline (playhead
79
+ * scrubbing, marquee selection). Detects when the pointer is in an edge zone
80
+ * and repeatedly invokes `onTick` while it stays there. The consumer performs
81
+ * the actual scrolling (and any dependent updates) inside `onTick`, so it can
82
+ * read a settled scroll position afterwards.
83
+ */
84
+ const startTimelineEdgeAutoScroll = ({ includeVertical, onTick, }) => {
85
+ let active = { x: null, y: null };
86
+ let lastPointer = null;
87
+ let interval = null;
88
+ const stopInterval = () => {
89
+ if (interval !== null) {
90
+ clearInterval(interval);
91
+ interval = null;
92
+ }
93
+ };
94
+ const tick = () => {
95
+ if (lastPointer === null) {
96
+ return;
97
+ }
98
+ active = getEdgeScrollDirections({
99
+ clientX: lastPointer.clientX,
100
+ clientY: lastPointer.clientY,
101
+ includeVertical,
102
+ active,
103
+ });
104
+ if (active.x === null && active.y === null) {
105
+ stopInterval();
106
+ return;
107
+ }
108
+ onTick(active);
109
+ };
110
+ const update = (e) => {
111
+ lastPointer = { clientX: e.clientX, clientY: e.clientY };
112
+ active = getEdgeScrollDirections({
113
+ clientX: e.clientX,
114
+ clientY: e.clientY,
115
+ includeVertical,
116
+ active,
117
+ });
118
+ if (active.x !== null || active.y !== null) {
119
+ if (interval === null) {
120
+ onTick(active);
121
+ interval = setInterval(tick, EDGE_SCROLL_INTERVAL_MS);
122
+ }
123
+ }
124
+ else {
125
+ stopInterval();
126
+ }
127
+ return active;
128
+ };
129
+ const stop = () => {
130
+ stopInterval();
131
+ lastPointer = null;
132
+ active = { x: null, y: null };
133
+ };
134
+ return { update, stop };
135
+ };
136
+ exports.startTimelineEdgeAutoScroll = startTimelineEdgeAutoScroll;
17
137
  const calculateFrameWhileScrollingRight = ({ durationInFrames, width, scrollLeft, }) => {
18
138
  var _a;
19
139
  return ((0, exports.getFrameFromX)({
@@ -28,7 +148,7 @@ const calculateFrameWhileScrollingRight = ({ durationInFrames, width, scrollLeft
28
148
  const getFrameWhileScrollingLeft = ({ durationInFrames, width, }) => {
29
149
  var _a, _b;
30
150
  const nextFrame = (0, exports.getFrameFromX)({
31
- clientX: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) - SCROLL_INCREMENT,
151
+ clientX: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) - exports.SCROLL_INCREMENT,
32
152
  durationInFrames,
33
153
  width,
34
154
  extrapolate: 'clamp',
@@ -71,6 +191,9 @@ exports.isCursorInViewport = isCursorInViewport;
71
191
  const ensureFrameIsInViewport = ({ direction, durationInFrames, frame, }) => {
72
192
  var _a, _b, _c;
73
193
  var _d, _e;
194
+ // Sync the imperative frame first: scrolling below triggers the scroll
195
+ // listener in TimelineSlider, which reads the frame imperatively.
196
+ (0, imperative_state_1.setCurrentFrame)(frame);
74
197
  (_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(frame);
75
198
  const width = (_d = (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollWidth) !== null && _d !== void 0 ? _d : 0;
76
199
  const scrollLeft = (_e = (_c = timeline_refs_1.scrollableRef.current) === null || _c === void 0 ? void 0 : _c.scrollLeft) !== null && _e !== void 0 ? _e : 0;
@@ -183,7 +306,7 @@ const getFrameWhileScrollingRight = ({ durationInFrames, width, }) => {
183
306
  const nextFrame = calculateFrameWhileScrollingRight({
184
307
  durationInFrames,
185
308
  width,
186
- scrollLeft: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) + SCROLL_INCREMENT,
309
+ scrollLeft: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) + exports.SCROLL_INCREMENT,
187
310
  });
188
311
  const currentFrame = calculateFrameWhileScrollingRight({
189
312
  durationInFrames,
@@ -13,21 +13,21 @@ const useOpenSequenceInApps = (sequence) => {
13
13
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
14
14
  const previewConnected = previewServerState.type === 'connected';
15
15
  const { resolvedLocation: originalLocation } = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(sequence.getStack, (_b = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.overrideId) !== null && _b !== void 0 ? _b : sequence.id);
16
- const editorPickerAvailable = (0, use_default_editor_info_1.canUseEditorPicker)(previewConnected);
17
- const editorInfo = (0, use_default_editor_info_1.useDefaultEditorInfo)(editorPickerAvailable);
18
- const codingAgentInfo = (0, use_default_editor_info_1.useDefaultCodingAgentInfo)(editorPickerAvailable);
19
- const canOpenInEditor = (0, react_1.useMemo)(() => Boolean(window.remotion_editorName && previewConnected && originalLocation), [originalLocation, previewConnected]);
16
+ const { canConfigureApps, canOpenInEditor: editorAvailable, defaultEditorId, editorInfo, } = (0, use_default_editor_info_1.useEditorOpening)(previewConnected);
17
+ const codingAgentInfo = (0, use_default_editor_info_1.useDefaultCodingAgentInfo)(canConfigureApps);
18
+ const canOpenInEditor = (0, react_1.useMemo)(() => Boolean(editorAvailable && originalLocation), [editorAvailable, originalLocation]);
20
19
  const openInEditor = (0, react_1.useCallback)(async (editorId) => {
21
- if (!canOpenInEditor || !originalLocation) {
20
+ const resolvedEditorId = editorId !== null && editorId !== void 0 ? editorId : defaultEditorId;
21
+ if (!canOpenInEditor || !originalLocation || !resolvedEditorId) {
22
22
  return;
23
23
  }
24
24
  try {
25
- await (0, open_in_editor_1.openOriginalPositionInEditor)(originalLocation, editorId);
25
+ await (0, open_in_editor_1.openOriginalPositionInEditor)(originalLocation, resolvedEditorId);
26
26
  }
27
27
  catch (err) {
28
28
  (0, NotificationCenter_1.showNotification)(err.message, 2000);
29
29
  }
30
- }, [canOpenInEditor, originalLocation]);
30
+ }, [canOpenInEditor, defaultEditorId, originalLocation]);
31
31
  const openInCodingAgent = (0, react_1.useCallback)(async (codingAgentId, codingAgentName, contextForAgents) => {
32
32
  try {
33
33
  const response = await (0, open_in_editor_1.openInCodingAgent)(codingAgentId, contextForAgents);
@@ -41,7 +41,7 @@ const useOpenSequenceInApps = (sequence) => {
41
41
  }, []);
42
42
  return {
43
43
  canOpenInEditor,
44
- canConfigureApps: editorPickerAvailable,
44
+ canConfigureApps,
45
45
  codingAgentInfo,
46
46
  editorInfo,
47
47
  openInCodingAgent,
@@ -1,6 +1,4 @@
1
1
  import type { TimelineTrackData } from '../../helpers/get-timeline-sequence-sort-key';
2
- export declare const useTimelineHeight: ({ shown, hasBeenCut, isStill, }: {
3
- shown: TimelineTrackData[];
4
- hasBeenCut: boolean;
5
- isStill: boolean;
6
- }) => number;
2
+ export declare const useTimelineTrackHeights: ({ timeline, }: {
3
+ timeline: readonly TimelineTrackData[];
4
+ }) => readonly number[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTimelineHeight = void 0;
3
+ exports.useTimelineTrackHeights = void 0;
4
4
  const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const client_id_1 = require("../../helpers/client-id");
@@ -8,11 +8,9 @@ const timeline_layout_1 = require("../../helpers/timeline-layout");
8
8
  const use_runtime_values_1 = require("../../helpers/use-runtime-values");
9
9
  const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
10
10
  const get_node_keyframes_1 = require("./get-node-keyframes");
11
- const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
12
11
  const timeline_expanded_filter_1 = require("./timeline-expanded-filter");
13
12
  const TimelineSelection_1 = require("./TimelineSelection");
14
- const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
15
- const useTimelineHeight = ({ shown, hasBeenCut, isStill, }) => {
13
+ const useTimelineTrackHeights = ({ timeline, }) => {
16
14
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
17
15
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
18
16
  const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
@@ -20,7 +18,7 @@ const useTimelineHeight = ({ shown, hasBeenCut, isStill, }) => {
20
18
  const { selectedItems } = (0, TimelineSelection_1.useTimelineSelection)();
21
19
  const previewServerConnected = previewServerState.type === 'connected';
22
20
  const selectedRowKeys = (0, react_1.useMemo)(() => (0, timeline_expanded_filter_1.getSelectedTimelineExpandedRowKeys)(selectedItems), [selectedItems]);
23
- const expandedControls = (0, react_1.useMemo)(() => shown.flatMap((track) => {
21
+ const expandedControls = (0, react_1.useMemo)(() => timeline.flatMap((track) => {
24
22
  if (!previewServerConnected ||
25
23
  track.nodePathInfo === null ||
26
24
  !getIsExpanded(track.nodePathInfo) ||
@@ -28,14 +26,14 @@ const useTimelineHeight = ({ shown, hasBeenCut, isStill, }) => {
28
26
  return [];
29
27
  }
30
28
  return [track.sequence.controls];
31
- }), [getIsExpanded, previewServerConnected, shown]);
29
+ }), [getIsExpanded, previewServerConnected, timeline]);
32
30
  const runtimeValueSnapshots = (0, use_runtime_values_1.useRuntimeValueSnapshots)(expandedControls);
33
31
  const runtimeValuesByStore = (0, react_1.useMemo)(() => new Map(expandedControls.map((controls, index) => [
34
32
  controls.runtimeValues,
35
33
  runtimeValueSnapshots[index],
36
34
  ])), [expandedControls, runtimeValueSnapshots]);
37
- return (0, react_1.useMemo)(() => {
38
- const tracksHeight = shown.reduce((acc, track) => {
35
+ const heights = (0, react_1.useMemo)(() => {
36
+ return timeline.map((track) => {
39
37
  const isExpanded = previewServerConnected &&
40
38
  track.nodePathInfo !== null &&
41
39
  getIsExpanded(track.nodePathInfo);
@@ -84,16 +82,10 @@ const useTimelineHeight = ({ shown, hasBeenCut, isStill, }) => {
84
82
  const separators = Math.max(0, flat.length - 1);
85
83
  return totalRowsHeight + separators + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM;
86
84
  })();
87
- return acc + layerHeight + expandedHeight;
88
- }, 0);
89
- return (tracksHeight +
90
- timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM +
91
- (hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
92
- (isStill ? 0 : TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT));
85
+ return layerHeight + expandedHeight;
86
+ });
93
87
  }, [
94
- shown,
95
- hasBeenCut,
96
- isStill,
88
+ timeline,
97
89
  previewServerConnected,
98
90
  getIsExpanded,
99
91
  propStatuses,
@@ -102,5 +94,11 @@ const useTimelineHeight = ({ shown, hasBeenCut, isStill, }) => {
102
94
  selectedRowKeys,
103
95
  runtimeValuesByStore,
104
96
  ]);
97
+ const stableHeights = (0, react_1.useRef)(heights);
98
+ if (stableHeights.current.length !== heights.length ||
99
+ heights.some((height, index) => stableHeights.current[index] !== height)) {
100
+ stableHeights.current = heights;
101
+ }
102
+ return stableHeights.current;
105
103
  };
106
- exports.useTimelineHeight = useTimelineHeight;
104
+ exports.useTimelineTrackHeights = useTimelineTrackHeights;