@remotion/studio 4.0.500 → 4.0.502

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 (156) hide show
  1. package/dist/Studio.js +1 -1
  2. package/dist/api/delete-static-file.js +8 -3
  3. package/dist/api/rename-static-file.js +8 -0
  4. package/dist/api/watch-public-folder.js +2 -1
  5. package/dist/api/watch-static-file.js +2 -1
  6. package/dist/api/write-static-file.js +8 -3
  7. package/dist/components/AssetSelector.js +3 -1
  8. package/dist/components/AssetSelectorItem.d.ts +2 -1
  9. package/dist/components/AssetSelectorItem.js +7 -4
  10. package/dist/components/Canvas.js +9 -4
  11. package/dist/components/CaptionInspector.d.ts +10 -0
  12. package/dist/components/CaptionInspector.js +24 -0
  13. package/dist/components/CaptionTextEditor.d.ts +9 -0
  14. package/dist/components/CaptionTextEditor.js +132 -0
  15. package/dist/components/CompositionSelector.js +4 -4
  16. package/dist/components/CompositionSelectorItem.js +5 -5
  17. package/dist/components/CurrentAsset.js +3 -2
  18. package/dist/components/EditorContent.js +1 -1
  19. package/dist/components/EditorContexts.d.ts +0 -1
  20. package/dist/components/EditorContexts.js +2 -2
  21. package/dist/components/FpsCounter.js +3 -3
  22. package/dist/components/FullscreenToggle.d.ts +3 -1
  23. package/dist/components/FullscreenToggle.js +3 -2
  24. package/dist/components/GlobalKeybindings.js +2 -0
  25. package/dist/components/InitialCompositionLoader.d.ts +1 -1
  26. package/dist/components/InlineAction.js +2 -1
  27. package/dist/components/InlineCaptionInspector.d.ts +11 -0
  28. package/dist/components/InlineCaptionInspector.js +108 -0
  29. package/dist/components/InspectorPanel/CompositionInspector.js +5 -3
  30. package/dist/components/InspectorPanel/SelectedInspector.d.ts +1 -0
  31. package/dist/components/InspectorPanel/SelectedInspector.js +2 -2
  32. package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +1 -0
  33. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -4
  34. package/dist/components/InspectorPanel/inspector-section-collapse.d.ts +22 -0
  35. package/dist/components/InspectorPanel/inspector-section-collapse.js +165 -0
  36. package/dist/components/InspectorPanel/styles.js +7 -1
  37. package/dist/components/InspectorPanel/use-composition-actions.d.ts +4 -1
  38. package/dist/components/InspectorPanel/use-composition-actions.js +135 -7
  39. package/dist/components/InspectorPanel.js +2 -2
  40. package/dist/components/InspectorSequenceSection.d.ts +2 -1
  41. package/dist/components/InspectorSequenceSection.js +238 -8
  42. package/dist/components/LoopToggle.d.ts +1 -0
  43. package/dist/components/LoopToggle.js +9 -5
  44. package/dist/components/Menu/MenuSubItem.js +9 -1
  45. package/dist/components/MenuToolbar.js +8 -1
  46. package/dist/components/Modals.js +1 -1
  47. package/dist/components/ObserveDefaultPropsContext.js +7 -4
  48. package/dist/components/PlayPause.d.ts +1 -0
  49. package/dist/components/PlayPause.js +2 -4
  50. package/dist/components/PlaybackRateSelector.d.ts +9 -2
  51. package/dist/components/PlaybackRateSelector.js +21 -10
  52. package/dist/components/PreviewToolbar.js +19 -109
  53. package/dist/components/PreviewToolbarOverflowButton.d.ts +12 -0
  54. package/dist/components/PreviewToolbarOverflowButton.js +217 -0
  55. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -0
  56. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +6 -0
  57. package/dist/components/QuickSwitcher/QuickSwitcher.js +2 -2
  58. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +6 -0
  59. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +42 -9
  60. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +2 -0
  61. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +7 -1
  62. package/dist/components/RenderButton.d.ts +1 -0
  63. package/dist/components/RenderButton.js +6 -4
  64. package/dist/components/RenderQueue/ClientRenderQueueProcessor.d.ts +0 -1
  65. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -14
  66. package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -2
  67. package/dist/components/SelectedOutlineElement.js +1 -4
  68. package/dist/components/SelectedOutlineOverlay.js +17 -8
  69. package/dist/components/ShowOutlinesProvider.js +4 -1
  70. package/dist/components/SizeSelector.d.ts +6 -0
  71. package/dist/components/SizeSelector.js +17 -8
  72. package/dist/components/Splitter/SplitterContainer.d.ts +1 -0
  73. package/dist/components/Splitter/SplitterContainer.js +23 -3
  74. package/dist/components/Splitter/SplitterContext.d.ts +14 -0
  75. package/dist/components/Splitter/SplitterContext.js +16 -1
  76. package/dist/components/Splitter/SplitterHandle.js +8 -6
  77. package/dist/components/Timeline/Timeline.js +21 -6
  78. package/dist/components/Timeline/TimelineAssetField.d.ts +1 -1
  79. package/dist/components/Timeline/TimelineAssetField.js +37 -1
  80. package/dist/components/Timeline/TimelineDragHandler.js +1 -1
  81. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +8 -2
  82. package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +7 -2
  83. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +3 -1
  84. package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
  85. package/dist/components/Timeline/TimelineRowChrome.js +4 -3
  86. package/dist/components/Timeline/TimelineSelection.d.ts +4 -2
  87. package/dist/components/Timeline/TimelineSelection.js +9 -6
  88. package/dist/components/Timeline/TimelineSequence.js +1 -4
  89. package/dist/components/Timeline/TimelineSequenceItem.js +4 -5
  90. package/dist/components/Timeline/TimelineSequencePropItem.js +9 -10
  91. package/dist/components/Timeline/TimelineStack/get-stack.js +8 -0
  92. package/dist/components/Timeline/TimelineTrack.js +4 -2
  93. package/dist/components/Timeline/border-radius-representation.d.ts +16 -0
  94. package/dist/components/Timeline/border-radius-representation.js +60 -0
  95. package/dist/components/Timeline/delete-selected-timeline-item.js +1 -6
  96. package/dist/components/Timeline/get-sequence-prop-reset-changes.d.ts +10 -0
  97. package/dist/components/Timeline/get-sequence-prop-reset-changes.js +33 -0
  98. package/dist/components/Timeline/reset-selected-timeline-props.js +2 -8
  99. package/dist/components/Timeline/save-sequence-prop.d.ts +12 -1
  100. package/dist/components/Timeline/save-sequence-prop.js +28 -4
  101. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -2
  102. package/dist/components/Timeline/sequence-props-subscription-store.js +3 -3
  103. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  104. package/dist/components/Timeline/use-timeline-asset-drop.js +4 -0
  105. package/dist/components/TopPanel.js +1 -1
  106. package/dist/components/UndoRedoButtons.js +15 -6
  107. package/dist/components/UpdateCheck.js +11 -4
  108. package/dist/components/default-props-api.d.ts +3 -0
  109. package/dist/components/default-props-api.js +19 -0
  110. package/dist/components/drop-handler-data.d.ts +1 -1
  111. package/dist/components/drop-handler-data.js +6 -6
  112. package/dist/components/effect-drag-and-drop.d.ts +1 -1
  113. package/dist/components/effect-drag-and-drop.js +3 -3
  114. package/dist/components/element-drag-and-drop.d.ts +1 -1
  115. package/dist/components/element-drag-and-drop.js +3 -3
  116. package/dist/components/handle-drop.d.ts +3 -2
  117. package/dist/components/handle-drop.js +2 -1
  118. package/dist/components/import-assets.d.ts +8 -6
  119. package/dist/components/import-assets.js +20 -7
  120. package/dist/components/sequence-props-api.d.ts +4 -0
  121. package/dist/components/sequence-props-api.js +26 -0
  122. package/dist/components/use-element-overwrite-confirmation.d.ts +2 -0
  123. package/dist/components/use-element-overwrite-confirmation.js +73 -0
  124. package/dist/components/use-static-files.js +7 -2
  125. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +13 -2
  126. package/dist/error-overlay/remotion-overlay/ErrorDisplay.d.ts +1 -0
  127. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +29 -5
  128. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +4 -20
  129. package/dist/esm/{chunk-dr1y1vm3.js → chunk-fjv75ty4.js} +8478 -6609
  130. package/dist/esm/index.mjs +24 -8
  131. package/dist/esm/internals.mjs +8478 -6609
  132. package/dist/esm/previewEntry.mjs +8535 -6666
  133. package/dist/esm/renderEntry.mjs +1 -1
  134. package/dist/helpers/browser-studio-operations.d.ts +3 -0
  135. package/dist/helpers/browser-studio-operations.js +14 -0
  136. package/dist/helpers/client-id.d.ts +0 -1
  137. package/dist/helpers/client-id.js +15 -10
  138. package/dist/helpers/download-blob.d.ts +1 -0
  139. package/dist/helpers/download-blob.js +15 -0
  140. package/dist/helpers/inject-css.js +5 -3
  141. package/dist/helpers/open-in-editor.js +26 -5
  142. package/dist/helpers/preview-server-events.js +46 -9
  143. package/dist/helpers/use-create-composition.js +8 -6
  144. package/dist/helpers/use-menu-structure.js +29 -0
  145. package/dist/hot-middleware-client/client.js +3 -3
  146. package/dist/icons/border-radius.d.ts +4 -0
  147. package/dist/icons/border-radius.js +8 -0
  148. package/dist/icons/fullscreen.d.ts +4 -0
  149. package/dist/icons/fullscreen.js +6 -0
  150. package/dist/icons/upload.d.ts +4 -0
  151. package/dist/icons/upload.js +8 -0
  152. package/dist/previewEntry.js +1 -1
  153. package/dist/state/modals.d.ts +5 -0
  154. package/dist/state/timeline-sequence-hover.d.ts +17 -0
  155. package/dist/state/timeline-sequence-hover.js +33 -0
  156. package/package.json +13 -12
@@ -97,13 +97,15 @@ const mapModeToQuery = (mode) => {
97
97
  }
98
98
  throw new Error('no mode' + mode);
99
99
  };
100
- const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio, assetSelection }) => {
100
+ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio, assetSelection, compositionSelection, }) => {
101
101
  const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
102
102
  const staticFiles = (0, use_static_files_1.useStaticFiles)();
103
103
  const [state, setState] = (0, react_1.useState)(() => {
104
104
  return {
105
105
  query: assetSelection === null
106
- ? mapModeToQuery(initialMode)
106
+ ? compositionSelection === null
107
+ ? mapModeToQuery(initialMode)
108
+ : ''
107
109
  : assetSelection.initialQuery,
108
110
  selectedIndex: 0,
109
111
  };
@@ -111,11 +113,13 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
111
113
  (0, react_1.useEffect)(() => {
112
114
  setState({
113
115
  query: assetSelection === null
114
- ? mapModeToQuery(initialMode)
116
+ ? compositionSelection === null
117
+ ? mapModeToQuery(initialMode)
118
+ : ''
115
119
  : assetSelection.initialQuery,
116
120
  selectedIndex: 0,
117
121
  });
118
- }, [assetSelection, initialMode, invocationTimestamp]);
122
+ }, [assetSelection, compositionSelection, initialMode, invocationTimestamp]);
119
123
  const inputRef = (0, react_1.useRef)(null);
120
124
  const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
121
125
  const selectAsset = (0, use_select_asset_1.useSelectAsset)();
@@ -124,7 +128,11 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
124
128
  const [docResults, setDocResults] = (0, react_1.useState)({ type: 'initial' });
125
129
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
126
130
  const keybindings = (0, use_keybinding_1.useKeybinding)();
127
- const mode = assetSelection !== null ? 'assets' : mapQueryToMode(state.query);
131
+ const mode = assetSelection !== null
132
+ ? 'assets'
133
+ : compositionSelection !== null
134
+ ? 'compositions'
135
+ : mapQueryToMode(state.query);
128
136
  const actualQuery = (0, react_1.useMemo)(() => {
129
137
  return stripQuery(state.query);
130
138
  }, [state.query]);
@@ -148,7 +156,7 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
148
156
  return docResults.results;
149
157
  }
150
158
  if (mode === 'assets') {
151
- return (0, fuzzy_search_1.fuzzySearch)(assetSearch.query, assetSearch.assets.map((asset) => {
159
+ const assetResults = (0, fuzzy_search_1.fuzzySearch)(assetSearch.query, assetSearch.assets.map((asset) => {
152
160
  return {
153
161
  id: 'asset-' + asset.name,
154
162
  title: asset.name,
@@ -166,14 +174,36 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
166
174
  },
167
175
  };
168
176
  }));
177
+ if (assetSelection === null) {
178
+ return assetResults;
179
+ }
180
+ return [
181
+ {
182
+ id: 'select-file',
183
+ title: 'Select file...',
184
+ type: 'select-file',
185
+ onSelected: () => {
186
+ assetSelection.onSelectFile();
187
+ setSelectedModal(null);
188
+ },
189
+ },
190
+ ...assetResults,
191
+ ];
169
192
  }
170
- return (0, fuzzy_search_1.fuzzySearch)(actualQuery, compositions.map((c) => {
193
+ return (0, fuzzy_search_1.fuzzySearch)(actualQuery, compositions
194
+ .filter((c) => c.id !== (compositionSelection === null || compositionSelection === void 0 ? void 0 : compositionSelection.excludeCompositionId))
195
+ .map((c) => {
171
196
  return {
172
197
  id: 'composition-' + c.id,
173
198
  title: c.id,
174
199
  type: 'composition',
175
200
  onSelected: () => {
176
201
  var _a;
202
+ if (compositionSelection !== null) {
203
+ compositionSelection.onSelected(c);
204
+ setSelectedModal(null);
205
+ return;
206
+ }
177
207
  selectComposition(c, true);
178
208
  setSelectedModal(null);
179
209
  const selector = `.__remotion-composition[data-compname="${c.id}"]`;
@@ -195,6 +225,7 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
195
225
  docResults,
196
226
  assetSearch,
197
227
  assetSelection,
228
+ compositionSelection,
198
229
  selectAsset,
199
230
  selectComposition,
200
231
  setSelectedModal,
@@ -337,9 +368,11 @@ const QuickSwitcherContent = ({ initialMode, invocationTimestamp, readOnlyStudio
337
368
  height: 300,
338
369
  };
339
370
  }, [showKeyboardShortcuts]);
340
- return (jsx_runtime_1.jsxs("div", { style: container, children: [assetSelection === null && (jsx_runtime_1.jsxs("div", { style: modeSelector, children: [
371
+ return (jsx_runtime_1.jsxs("div", { style: container, children: [assetSelection === null && compositionSelection === null && (jsx_runtime_1.jsxs("div", { style: modeSelector, children: [
341
372
  jsx_runtime_1.jsx("button", { onClick: onCompositionsSelected, style: mode === 'compositions' ? modeActive : modeInactive, type: "button", children: "Compositions" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("button", { onClick: onAssetsSelected, style: mode === 'assets' ? modeActive : modeInactive, type: "button", children: "Assets" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("button", { onClick: onActionsSelected, style: mode === 'commands' ? modeActive : modeInactive, type: "button", children: "Actions" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("button", { onClick: onDocSearchSelected, style: mode === 'docs' ? modeActive : modeInactive, type: "button", children: "Documentation" })
342
- ] })), jsx_runtime_1.jsxs("div", { style: assetSelection === null ? content : contentWithoutModeSelector, children: [
373
+ ] })), jsx_runtime_1.jsxs("div", { style: assetSelection === null && compositionSelection === null
374
+ ? content
375
+ : contentWithoutModeSelector, children: [
343
376
  jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, type: "text", style: input, autoFocus: true, status: "ok", value: state.query, onChange: onTextChange, placeholder: placeholder, rightAlign: false }), showKeyboardShortcuts ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
344
377
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }),
345
378
  " ",
@@ -8,6 +8,8 @@ type QuickSwitcherResultDetail = {
8
8
  compositionType: 'composition' | 'still';
9
9
  } | {
10
10
  type: 'menu-item';
11
+ } | {
12
+ type: 'select-file';
11
13
  } | {
12
14
  type: 'search-result';
13
15
  titleLine: string;
@@ -6,6 +6,7 @@ const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
7
  const use_keybinding_1 = require("../../helpers/use-keybinding");
8
8
  const still_1 = require("../../icons/still");
9
+ const upload_1 = require("../../icons/upload");
9
10
  const video_1 = require("../../icons/video");
10
11
  const AssetFileIcon_1 = require("../AssetFileIcon");
11
12
  const layout_1 = require("../layout");
@@ -35,6 +36,11 @@ const iconStyle = {
35
36
  height: 18,
36
37
  flexShrink: 0,
37
38
  };
39
+ const selectFileIconStyle = {
40
+ ...iconStyle,
41
+ width: 20,
42
+ height: 20,
43
+ };
38
44
  const labelContainer = {
39
45
  overflow: 'hidden',
40
46
  flex: 1,
@@ -95,7 +101,7 @@ const QuickSwitcherResult = ({ result, selected }) => {
95
101
  fontSize: shared_1.QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,
96
102
  };
97
103
  }, [hovered, result.type, selected]);
98
- return (jsx_runtime_1.jsxs("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }))) : result.type === 'asset' ? (jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: result.fileType, color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelContainer, children: result.type === 'search-result' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
104
+ return (jsx_runtime_1.jsxs("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? (jsx_runtime_1.jsx(still_1.StillIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : (jsx_runtime_1.jsx(video_1.FilmIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }))) : result.type === 'asset' ? (jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: result.fileType, color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })) : result.type === 'select-file' ? (jsx_runtime_1.jsx(upload_1.UploadIcon, { color: selected || hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: selectFileIconStyle })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelContainer, children: result.type === 'search-result' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
99
105
  jsx_runtime_1.jsx("div", {
100
106
  // eslint-disable-next-line react/no-danger
101
107
  dangerouslySetInnerHTML: {
@@ -3,4 +3,5 @@ export type RenderType = 'server-render' | 'client-render' | 'render-command';
3
3
  export declare const RenderButton: React.FC<{
4
4
  readonly readOnlyStudio: boolean;
5
5
  readonly size?: 'default' | 'compact';
6
+ readonly hidden: boolean;
6
7
  }>;
@@ -123,7 +123,7 @@ const getInitialRenderType = (readOnlyStudio) => {
123
123
  }
124
124
  return 'server-render';
125
125
  };
126
- const RenderButton = ({ readOnlyStudio, size: controlSize = 'default' }) => {
126
+ const RenderButton = ({ readOnlyStudio, size: controlSize = 'default', hidden }) => {
127
127
  const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
128
128
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
129
129
  const [preferredRenderType, setPreferredRenderType] = (0, react_1.useState)(() => getInitialRenderType(readOnlyStudio));
@@ -437,15 +437,17 @@ const RenderButton = ({ readOnlyStudio, size: controlSize = 'default' }) => {
437
437
  return null;
438
438
  }
439
439
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
440
- jsx_runtime_1.jsx("button", { style: { display: 'none' }, id: "render-modal-button-server", disabled: !canServerRender, onClick: () => openServerRenderModal(false), type: "button" }), ' ', jsx_runtime_1.jsx("button", { style: { display: 'none' }, id: "render-modal-button-client", onClick: openClientRenderModal, type: "button" }), jsx_runtime_1.jsxs("div", { ref: containerRef, style: containerStyle, title: tooltip, children: [
441
- jsx_runtime_1.jsx("button", { type: "button", style: controlSize === 'compact' ? compactMainButtonStyle : mainButtonStyle, onClick: onClick, id: "render-modal-button", children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", style: controlSize === 'compact'
440
+ jsx_runtime_1.jsx("button", { style: { display: 'none' }, id: "render-modal-button-server", disabled: !canServerRender, onClick: () => openServerRenderModal(false), type: "button" }), ' ', jsx_runtime_1.jsx("button", { style: { display: 'none' }, id: "render-modal-button-client", onClick: openClientRenderModal, type: "button" }), jsx_runtime_1.jsx("button", { style: { display: 'none' }, id: "render-modal-button-command", onClick: () => openServerRenderModal(true), type: "button" }), hidden ? (jsx_runtime_1.jsx("button", { style: { display: 'none' }, onClick: onClick, id: "render-modal-button", type: "button" })) : (jsx_runtime_1.jsxs("div", { ref: containerRef, style: containerStyle, title: tooltip, children: [
441
+ jsx_runtime_1.jsx("button", { type: "button", style: controlSize === 'compact'
442
+ ? compactMainButtonStyle
443
+ : mainButtonStyle, onClick: onClick, id: "render-modal-button", children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", style: controlSize === 'compact'
442
444
  ? compactMainButtonContent
443
445
  : mainButtonContent, children: [
444
446
  jsx_runtime_1.jsx(render_1.ThinRenderIcon, { fill: colors_1.CURRENT_COLOR_LOWERCASE, svgProps: iconStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: controlSize === 'compact' ? 0.75 : 1 }), jsx_runtime_1.jsx("span", { style: controlSize === 'compact' ? compactLabel : label, children: renderLabel })
445
447
  ] }) }), jsx_runtime_1.jsx("div", { style: dividerStyle }), jsx_runtime_1.jsx("button", { ref: dropdownRef, type: "button", style: controlSize === 'compact'
446
448
  ? compactDropdownTriggerStyle
447
449
  : dropdownTriggerStyle, className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, onPointerDown: onPointerDown, onClick: onClickDropdown, children: jsx_runtime_1.jsx(caret_1.CaretDown, {}) })
448
- ] }), portalStyle
450
+ ] })), portalStyle
449
451
  ? react_dom_1.default.createPortal(jsx_runtime_1.jsx("div", { style: styles_1.fullScreenOverlay, children: jsx_runtime_1.jsx("div", { style: styles_1.outerPortal, className: "css-reset", children: jsx_runtime_1.jsx(z_index_1.HigherZIndex, { onOutsideClick: onHideDropdown, onEscape: onHideDropdown, children: jsx_runtime_1.jsx("div", { style: portalStyle, onPointerDown: onMenuPointerDown, children: jsx_runtime_1.jsx(MenuContent_1.MenuContent, { onNextMenu: () => { }, onPreviousMenu: () => { }, values: dropdownValues, onHide: onHideDropdown, leaveLeftSpace: false, preselectIndex: dropdownValues.findIndex((v) => v.id === renderType), topItemCanBeUnselected: false, fixedHeight: derivedMaxHeight }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
450
452
  : null] }));
451
453
  };
@@ -1,2 +1 @@
1
- export declare const downloadBlob: (blob: Blob, filename: string) => void;
2
1
  export declare const ClientRenderQueueProcessor: React.FC;
@@ -1,22 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClientRenderQueueProcessor = exports.downloadBlob = void 0;
3
+ exports.ClientRenderQueueProcessor = void 0;
4
4
  const web_renderer_1 = require("@remotion/web-renderer");
5
5
  const react_1 = require("react");
6
6
  const save_render_output_1 = require("../../api/save-render-output");
7
+ const download_blob_1 = require("../../helpers/download-blob");
7
8
  const context_1 = require("./context");
8
- const downloadBlob = (blob, filename) => {
9
- const url = URL.createObjectURL(blob);
10
- const a = document.createElement('a');
11
- a.href = url;
12
- const cleanFilename = filename.includes('/')
13
- ? filename.substring(filename.lastIndexOf('/') + 1)
14
- : filename;
15
- a.download = cleanFilename;
16
- a.click();
17
- URL.revokeObjectURL(url);
18
- };
19
- exports.downloadBlob = downloadBlob;
20
9
  const ClientRenderQueueProcessor = () => {
21
10
  const { getAbortController, getCompositionForJob, updateClientJobProgress, markClientJobSaving, markClientJobDone, markClientJobFailed, markClientJobCancelled, setProcessJobCallback, } = (0, react_1.useContext)(context_1.RenderQueueContext);
22
11
  const processStillJob = (0, react_1.useCallback)(async (job, signal) => {
@@ -126,7 +115,7 @@ const ClientRenderQueueProcessor = () => {
126
115
  markClientJobSaving(job.id);
127
116
  const getBlob = () => Promise.resolve(blob);
128
117
  const downloadAndFinish = () => {
129
- (0, exports.downloadBlob)(blob, job.outName);
118
+ (0, download_blob_1.downloadBlob)(blob, job.outName);
130
119
  markClientJobDone(job.id, metadata, getBlob);
131
120
  };
132
121
  if (window.remotion_isReadOnlyStudio) {
@@ -4,9 +4,9 @@ exports.RenderQueueDownloadItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
+ const download_blob_1 = require("../../helpers/download-blob");
7
8
  const InlineAction_1 = require("../InlineAction");
8
9
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
9
- const ClientRenderQueueProcessor_1 = require("./ClientRenderQueueProcessor");
10
10
  const RenderQueueDownloadItem = ({ job }) => {
11
11
  const onClick = (0, react_1.useCallback)((e) => {
12
12
  e.stopPropagation();
@@ -16,7 +16,7 @@ const RenderQueueDownloadItem = ({ job }) => {
16
16
  job
17
17
  .getBlob()
18
18
  .then((blob) => {
19
- (0, ClientRenderQueueProcessor_1.downloadBlob)(blob, job.outName);
19
+ (0, download_blob_1.downloadBlob)(blob, job.outName);
20
20
  })
21
21
  .catch((err) => {
22
22
  (0, NotificationCenter_1.showNotification)(`Could not download file: ${err.message}`, 2000);
@@ -1077,10 +1077,7 @@ const SelectedOutlineElement = ({ allDragTargets, allDragOutlines, allRotationDr
1077
1077
  },
1078
1078
  ],
1079
1079
  });
1080
- if (result.success) {
1081
- (0, NotificationCenter_1.showNotification)('Removed sequence from source file', 2000);
1082
- }
1083
- else {
1080
+ if (!result.success) {
1084
1081
  (0, NotificationCenter_1.showNotification)(result.reason, 4000);
1085
1082
  }
1086
1083
  }
@@ -45,6 +45,7 @@ const use_keybinding_1 = require("../helpers/use-keybinding");
45
45
  const editor_guides_1 = require("../state/editor-guides");
46
46
  const editor_outlines_1 = require("../state/editor-outlines");
47
47
  const scale_lock_1 = require("../state/scale-lock");
48
+ const timeline_sequence_hover_1 = require("../state/timeline-sequence-hover");
48
49
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
49
50
  const selected_outline_drag_1 = require("./selected-outline-drag");
50
51
  const selected_outline_measurement_1 = require("./selected-outline-measurement");
@@ -419,12 +420,12 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
419
420
  const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
420
421
  const { getScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
421
422
  const { editorShowOutlines } = (0, react_1.useContext)(editor_outlines_1.EditorShowOutlinesContext);
423
+ const { hoveredSequence, setHoveredSequence } = (0, react_1.useContext)(timeline_sequence_hover_1.TimelineSequenceHoverContext);
422
424
  const { editorShowGuides, guidesList } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
423
425
  const { frameBack, frameForward, getCurrentFrame, seek } = player_1.PlayerInternals.usePlayer();
424
426
  const keybindings = (0, use_keybinding_1.useKeybinding)();
425
427
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
426
428
  const [outlines, setOutlines] = (0, react_1.useState)([]);
427
- const [hoveredOutlineKey, setHoveredOutlineKey] = (0, react_1.useState)(null);
428
429
  const [draggingOutline, setDraggingOutline] = (0, react_1.useState)(false);
429
430
  const [activeSnapPoints, setActiveSnapPoints] = (0, react_1.useState)([]);
430
431
  const overlayRef = (0, react_1.useRef)(null);
@@ -435,12 +436,20 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
435
436
  const onDraggingChange = react_1.default.useCallback((dragging) => {
436
437
  setDraggingOutline(dragging);
437
438
  if (dragging) {
438
- setHoveredOutlineKey(null);
439
+ setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
439
440
  }
440
441
  else {
441
442
  setActiveSnapPoints([]);
442
443
  }
443
- }, []);
444
+ }, [setHoveredSequence]);
445
+ const onHoverChange = (0, react_1.useCallback)((key) => {
446
+ setHoveredSequence((currentHover) => {
447
+ if (key !== null) {
448
+ return { key, source: 'canvas' };
449
+ }
450
+ return (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover;
451
+ });
452
+ }, [setHoveredSequence]);
444
453
  const onSnapPointsChange = (0, react_1.useCallback)((snapPoints) => {
445
454
  setActiveSnapPoints(snapPoints);
446
455
  }, []);
@@ -757,11 +766,11 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
757
766
  timelinePosition,
758
767
  ]);
759
768
  (0, react_1.useEffect)(() => {
760
- if (hoveredOutlineKey !== null &&
761
- !outlineTargets.some((target) => target.key === hoveredOutlineKey)) {
762
- setHoveredOutlineKey(null);
769
+ if ((hoveredSequence === null || hoveredSequence === void 0 ? void 0 : hoveredSequence.source) === 'canvas' &&
770
+ !outlineTargets.some((target) => target.key === hoveredSequence.key)) {
771
+ setHoveredSequence((currentHover) => (currentHover === null || currentHover === void 0 ? void 0 : currentHover.source) === 'canvas' ? null : currentHover);
763
772
  }
764
- }, [hoveredOutlineKey, outlineTargets]);
773
+ }, [hoveredSequence, outlineTargets, setHoveredSequence]);
765
774
  const targetsByKey = (0, react_1.useMemo)(() => {
766
775
  return new Map(outlineTargets.map((target) => [target.key, target]));
767
776
  }, [outlineTargets]);
@@ -1073,6 +1082,6 @@ const SelectedOutlineOverlay = ({ compositionHeight, compositionWidth, scale, tr
1073
1082
  return null;
1074
1083
  }
1075
1084
  return (jsx_runtime_1.jsxs("svg", { ref: overlayRef, style: outlineContainer, width: "100%", height: "100%", "aria-hidden": "true", children: [
1076
- jsx_runtime_1.jsx(SelectedOutlineSnapIndicators, { activeSnapPoints: activeSnapPoints, compositionHeight: compositionHeight, compositionWidth: compositionWidth, scale: scale }), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineElement, { allDragTargets: allDragTargets, allDragOutlines: allDragOutlines, allRotationDragTargets: allRotationDragTargets, allScaleDragTargets: allScaleDragTargets, dragging: draggingOutline, hovered: hoveredOutlineKey === outline.key, outline: outline, onDraggingChange: onDraggingChange, onHoverChange: setHoveredOutlineKey, onSnapPointsChange: onSnapPointsChange, onSelect: selectOutlineItem, scale: scale, snapTargets: snapTargets, target: targetsByKey.get(outline.key) }, outline.key))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineTransformOriginHandle, { outline: outline, onDraggingChange: onDraggingChange, target: targetsByKey.get(outline.key) }, `${outline.key}-transform-origin`))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleConnectionLayer, { outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-connection-lines`))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleCircleLayer, { onDraggingChange: onDraggingChange, onSelect: selectOutlineItem, outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-handles`)))] }));
1085
+ jsx_runtime_1.jsx(SelectedOutlineSnapIndicators, { activeSnapPoints: activeSnapPoints, compositionHeight: compositionHeight, compositionWidth: compositionWidth, scale: scale }), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineElement, { allDragTargets: allDragTargets, allDragOutlines: allDragOutlines, allRotationDragTargets: allRotationDragTargets, allScaleDragTargets: allScaleDragTargets, dragging: draggingOutline, hovered: (hoveredSequence === null || hoveredSequence === void 0 ? void 0 : hoveredSequence.key) === outline.key, outline: outline, onDraggingChange: onDraggingChange, onHoverChange: onHoverChange, onSnapPointsChange: onSnapPointsChange, onSelect: selectOutlineItem, scale: scale, snapTargets: snapTargets, target: targetsByKey.get(outline.key) }, outline.key))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineElement_1.SelectedOutlineTransformOriginHandle, { outline: outline, onDraggingChange: onDraggingChange, target: targetsByKey.get(outline.key) }, `${outline.key}-transform-origin`))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleConnectionLayer, { outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-connection-lines`))), outlinesForRendering.map((outline) => (jsx_runtime_1.jsx(SelectedOutlineUvControls_1.SelectedOutlineUvHandleCircleLayer, { onDraggingChange: onDraggingChange, onSelect: selectOutlineItem, outline: outline, target: targetsByKey.get(outline.key) }, `${outline.key}-uv-handles`)))] }));
1077
1086
  };
1078
1087
  exports.SelectedOutlineOverlay = SelectedOutlineOverlay;
@@ -4,8 +4,10 @@ exports.ShowOutlinesProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const editor_outlines_1 = require("../state/editor-outlines");
7
+ const timeline_sequence_hover_1 = require("../state/timeline-sequence-hover");
7
8
  const ShowOutlinesProvider = ({ children }) => {
8
9
  const [editorShowOutlines, setEditorShowOutlinesState] = (0, react_1.useState)(() => (0, editor_outlines_1.loadEditorShowOutlinesOption)());
10
+ const [hoveredSequence, setHoveredSequence] = (0, react_1.useState)(null);
9
11
  const setEditorShowOutlines = (0, react_1.useCallback)((newValue) => {
10
12
  setEditorShowOutlinesState((prevState) => {
11
13
  const newVal = newValue(prevState);
@@ -19,6 +21,7 @@ const ShowOutlinesProvider = ({ children }) => {
19
21
  setEditorShowOutlines,
20
22
  };
21
23
  }, [editorShowOutlines, setEditorShowOutlines]);
22
- return (jsx_runtime_1.jsx(editor_outlines_1.EditorShowOutlinesContext.Provider, { value: editorShowOutlinesCtx, children: children }));
24
+ const timelineSequenceHoverCtx = (0, react_1.useMemo)(() => ({ hoveredSequence, setHoveredSequence }), [hoveredSequence]);
25
+ return (jsx_runtime_1.jsx(editor_outlines_1.EditorShowOutlinesContext.Provider, { value: editorShowOutlinesCtx, children: jsx_runtime_1.jsx(timeline_sequence_hover_1.TimelineSequenceHoverContext.Provider, { value: timelineSequenceHoverCtx, children: children }) }));
23
26
  };
24
27
  exports.ShowOutlinesProvider = ShowOutlinesProvider;
@@ -1,5 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { PreviewSize } from 'remotion';
3
+ import type { ComboboxValue } from './NewComposition/ComboBox';
3
4
  export declare const getPreviewSizeLabel: (previewSize: PreviewSize) => string;
4
5
  export declare const getUniqueSizes: (size: PreviewSize) => PreviewSize[];
6
+ export declare const usePreviewSizeMenuItems: () => {
7
+ items: ComboboxValue[];
8
+ selectedId: string;
9
+ zoomable: boolean | null;
10
+ };
5
11
  export declare const SizeSelector: React.FC;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SizeSelector = exports.getUniqueSizes = exports.getPreviewSizeLabel = void 0;
3
+ exports.SizeSelector = exports.usePreviewSizeMenuItems = exports.getUniqueSizes = exports.getPreviewSizeLabel = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
@@ -67,14 +67,9 @@ const getUniqueSizes = (size) => {
67
67
  };
68
68
  exports.getUniqueSizes = getUniqueSizes;
69
69
  const zoomableFileTypes = ['video', 'image'];
70
- const SizeSelector = () => {
70
+ const usePreviewSizeMenuItems = () => {
71
71
  const { size, setSize } = (0, react_1.useContext)(remotion_1.Internals.PreviewSizeContext);
72
72
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
73
- const style = (0, react_1.useMemo)(() => {
74
- return {
75
- padding: ControlButton_1.CONTROL_BUTTON_PADDING - 2,
76
- };
77
- }, []);
78
73
  const zoomable = (0, react_1.useMemo)(() => {
79
74
  if (!canvasContent) {
80
75
  return null;
@@ -111,9 +106,23 @@ const SizeSelector = () => {
111
106
  };
112
107
  });
113
108
  }, [setSize, size]);
109
+ return {
110
+ items,
111
+ selectedId: String(size.size),
112
+ zoomable,
113
+ };
114
+ };
115
+ exports.usePreviewSizeMenuItems = usePreviewSizeMenuItems;
116
+ const SizeSelector = () => {
117
+ const { items, selectedId, zoomable } = (0, exports.usePreviewSizeMenuItems)();
118
+ const style = (0, react_1.useMemo)(() => {
119
+ return {
120
+ padding: ControlButton_1.CONTROL_BUTTON_PADDING - 2,
121
+ };
122
+ }, []);
114
123
  if (!zoomable) {
115
124
  return null;
116
125
  }
117
- return (jsx_runtime_1.jsx("div", { style: style, "aria-label": accessibilityLabel, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { size: "compact", title: accessibilityLabel, style: comboStyle, selectedId: String(size.size), values: items }) }));
126
+ return (jsx_runtime_1.jsx("div", { style: style, "aria-label": accessibilityLabel, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { size: "compact", title: accessibilityLabel, style: comboStyle, selectedId: selectedId, values: items }) }));
118
127
  };
119
128
  exports.SizeSelector = SizeSelector;
@@ -6,6 +6,7 @@ export declare const SplitterContainer: React.FC<{
6
6
  readonly maxFlex: number;
7
7
  readonly minFlex: number;
8
8
  readonly maxFlexerSize: number | null;
9
+ readonly minFlexerSize: number | null;
9
10
  readonly maxAntiFlexerSize: number | null;
10
11
  readonly id: string;
11
12
  readonly defaultFlex: number;
@@ -6,6 +6,7 @@ const player_1 = require("@remotion/player");
6
6
  const react_1 = require("react");
7
7
  const timeline_1 = require("../../state/timeline");
8
8
  const SplitterContext_1 = require("./SplitterContext");
9
+ const SplitterHandle_1 = require("./SplitterHandle");
9
10
  const containerRow = {
10
11
  display: 'flex',
11
12
  flexDirection: 'row',
@@ -19,14 +20,31 @@ exports.containerColumn = {
19
20
  flex: 1,
20
21
  height: 0,
21
22
  };
22
- const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFlex, maxFlexerSize, maxAntiFlexerSize, id, }) => {
23
+ const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFlex, maxFlexerSize, minFlexerSize, maxAntiFlexerSize, id, }) => {
23
24
  const [initialTimelineFlex, persistFlex] = (0, timeline_1.useTimelineFlex)(id);
24
25
  const [flexValue, setFlexValue] = (0, react_1.useState)(initialTimelineFlex !== null && initialTimelineFlex !== void 0 ? initialTimelineFlex : defaultFlex);
25
26
  const ref = (0, react_1.useRef)(null);
26
27
  const isDragging = (0, react_1.useRef)(false);
28
+ const size = player_1.PlayerInternals.useElementSize(ref, {
29
+ triggerOnWindowResize: true,
30
+ shouldApplyCssTransforms: true,
31
+ });
32
+ const availableSize = size
33
+ ? (orientation === 'vertical' ? size.width : size.height) -
34
+ SplitterHandle_1.SPLITTER_HANDLE_SIZE
35
+ : null;
36
+ const effectiveFlexValue = (0, SplitterContext_1.getClampedSplitterFlex)({
37
+ availableSize,
38
+ flexValue,
39
+ maxAntiFlexerSize,
40
+ maxFlex,
41
+ maxFlexerSize,
42
+ minFlex,
43
+ minFlexerSize,
44
+ });
27
45
  const value = (0, react_1.useMemo)(() => {
28
46
  return {
29
- flexValue,
47
+ flexValue: effectiveFlexValue,
30
48
  ref,
31
49
  setFlexValue,
32
50
  isDragging,
@@ -35,16 +53,18 @@ const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFle
35
53
  maxFlex,
36
54
  minFlex,
37
55
  maxFlexerSize,
56
+ minFlexerSize,
38
57
  maxAntiFlexerSize,
39
58
  defaultFlex,
40
59
  persistFlex,
41
60
  };
42
61
  }, [
43
62
  defaultFlex,
44
- flexValue,
63
+ effectiveFlexValue,
45
64
  id,
46
65
  maxFlex,
47
66
  maxFlexerSize,
67
+ minFlexerSize,
48
68
  maxAntiFlexerSize,
49
69
  minFlex,
50
70
  orientation,
@@ -12,6 +12,7 @@ export type TSplitterContext = {
12
12
  maxFlex: number;
13
13
  minFlex: number;
14
14
  maxFlexerSize: number | null;
15
+ minFlexerSize: number | null;
15
16
  maxAntiFlexerSize: number | null;
16
17
  defaultFlex: number;
17
18
  id: string;
@@ -21,4 +22,17 @@ export type TSplitterContext = {
21
22
  y: number;
22
23
  }>;
23
24
  };
25
+ type SplitterFlexBounds = Pick<TSplitterContext, 'maxAntiFlexerSize' | 'maxFlex' | 'maxFlexerSize' | 'minFlex' | 'minFlexerSize'> & {
26
+ readonly availableSize: number | null;
27
+ };
28
+ export declare const getSplitterFlexBounds: ({ availableSize, maxAntiFlexerSize, maxFlex, maxFlexerSize, minFlex, minFlexerSize, }: SplitterFlexBounds) => {
29
+ minFlex: number;
30
+ maxFlex: number;
31
+ };
32
+ export declare const getClampedSplitterFlex: ({ flexValue, ...bounds }: Pick<TSplitterContext, "maxAntiFlexerSize" | "maxFlex" | "maxFlexerSize" | "minFlex" | "minFlexerSize"> & {
33
+ readonly availableSize: number | null;
34
+ } & {
35
+ readonly flexValue: number;
36
+ }) => number;
24
37
  export declare const SplitterContext: React.Context<TSplitterContext>;
38
+ export {};
@@ -3,8 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SplitterContext = void 0;
6
+ exports.SplitterContext = exports.getClampedSplitterFlex = exports.getSplitterFlexBounds = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
+ const getSplitterFlexBounds = ({ availableSize, maxAntiFlexerSize, maxFlex, maxFlexerSize, minFlex, minFlexerSize, }) => {
9
+ if (availableSize === null || availableSize <= 0) {
10
+ return { minFlex, maxFlex };
11
+ }
12
+ const minimum = Math.min(1, Math.max(minFlex, minFlexerSize === null ? 0 : minFlexerSize / availableSize, maxAntiFlexerSize === null ? 0 : 1 - maxAntiFlexerSize / availableSize));
13
+ const maximum = Math.max(minimum, Math.min(maxFlex, maxFlexerSize === null ? 1 : maxFlexerSize / availableSize));
14
+ return { minFlex: minimum, maxFlex: maximum };
15
+ };
16
+ exports.getSplitterFlexBounds = getSplitterFlexBounds;
17
+ const getClampedSplitterFlex = ({ flexValue, ...bounds }) => {
18
+ const { minFlex, maxFlex } = (0, exports.getSplitterFlexBounds)(bounds);
19
+ return Math.min(maxFlex, Math.max(minFlex, flexValue));
20
+ };
21
+ exports.getClampedSplitterFlex = getClampedSplitterFlex;
8
22
  exports.SplitterContext = react_1.default.createContext({
9
23
  flexValue: 1,
10
24
  ref: { current: null },
@@ -14,6 +28,7 @@ exports.SplitterContext = react_1.default.createContext({
14
28
  maxFlex: 1,
15
29
  minFlex: 1,
16
30
  maxFlexerSize: null,
31
+ minFlexerSize: null,
17
32
  maxAntiFlexerSize: null,
18
33
  defaultFlex: 1,
19
34
  id: '--',
@@ -49,12 +49,14 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
49
49
  const availableSize = (dragContext.orientation === 'vertical'
50
50
  ? containerWidth
51
51
  : containerHeight) - exports.SPLITTER_HANDLE_SIZE;
52
- const minFlex = dragContext.maxAntiFlexerSize === null || availableSize <= 0
53
- ? dragContext.minFlex
54
- : Math.max(dragContext.minFlex, 1 - dragContext.maxAntiFlexerSize / availableSize);
55
- const maxFlex = dragContext.maxFlexerSize === null || availableSize <= 0
56
- ? dragContext.maxFlex
57
- : Math.min(dragContext.maxFlex, dragContext.maxFlexerSize / availableSize);
52
+ const { minFlex, maxFlex } = (0, SplitterContext_1.getSplitterFlexBounds)({
53
+ availableSize,
54
+ maxAntiFlexerSize: dragContext.maxAntiFlexerSize,
55
+ maxFlex: dragContext.maxFlex,
56
+ maxFlexerSize: dragContext.maxFlexerSize,
57
+ minFlex: dragContext.minFlex,
58
+ minFlexerSize: dragContext.minFlexerSize,
59
+ });
58
60
  const startFlex = Math.min(maxFlex, Math.max(minFlex, dragContext.flexValue));
59
61
  dragContext.isDragging.current = start;
60
62
  (0, ForceSpecificCursor_1.forceSpecificCursor)(dragContext.orientation === 'horizontal' ? 'row-resize' : 'col-resize');