@remotion/studio 4.0.498 → 4.0.500

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 (167) hide show
  1. package/dist/components/AssetSelector.js +8 -6
  2. package/dist/components/AssetSelectorItem.d.ts +24 -0
  3. package/dist/components/AssetSelectorItem.js +144 -83
  4. package/dist/components/Canvas.js +162 -7
  5. package/dist/components/CompositionSelector.js +15 -42
  6. package/dist/components/CompositionSelectorItem.js +21 -13
  7. package/dist/components/ControlButton.js +1 -0
  8. package/dist/components/EditorContent.js +1 -1
  9. package/dist/components/EditorRuler/Ruler.js +5 -3
  10. package/dist/components/ExplorerPanel.js +2 -1
  11. package/dist/components/ExplorerPanelRef.d.ts +2 -0
  12. package/dist/components/ForceSpecificCursor.js +13 -1
  13. package/dist/components/GlobalKeybindings.js +7 -1
  14. package/dist/components/InlineAction.d.ts +2 -1
  15. package/dist/components/InlineAction.js +2 -2
  16. package/dist/components/InlineDropdown.d.ts +1 -1
  17. package/dist/components/InlineDropdown.js +3 -2
  18. package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
  19. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  20. package/dist/components/InspectorPanel/CompositionInspector.js +8 -7
  21. package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
  22. package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
  23. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
  24. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +7 -7
  25. package/dist/components/InspectorPanel/common.d.ts +17 -4
  26. package/dist/components/InspectorPanel/common.js +60 -6
  27. package/dist/components/InspectorPanel/use-composition-actions.js +1 -0
  28. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
  29. package/dist/components/InspectorSequenceSection.js +43 -19
  30. package/dist/components/KeyboardShortcutsExplainer.js +4 -2
  31. package/dist/components/Menu/MenuItem.js +2 -1
  32. package/dist/components/MenuCompositionName.js +30 -7
  33. package/dist/components/MenuToolbar.d.ts +0 -1
  34. package/dist/components/MenuToolbar.js +8 -7
  35. package/dist/components/MobilePanel.d.ts +2 -1
  36. package/dist/components/MobilePanel.js +29 -25
  37. package/dist/components/ModalContainer.d.ts +1 -0
  38. package/dist/components/ModalContainer.js +2 -2
  39. package/dist/components/Modals.js +1 -1
  40. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  41. package/dist/components/NewComposition/DismissableModal.js +2 -2
  42. package/dist/components/NewComposition/InputDragger.d.ts +34 -0
  43. package/dist/components/NewComposition/InputDragger.js +262 -23
  44. package/dist/components/OutlineToggle.d.ts +1 -3
  45. package/dist/components/OutlineToggle.js +2 -2
  46. package/dist/components/PreviewToolbar.js +10 -4
  47. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
  48. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +44 -0
  49. package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
  50. package/dist/components/QuickSwitcher/NoResults.js +1 -0
  51. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +5 -0
  52. package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
  53. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +5 -0
  54. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +76 -12
  55. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
  56. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
  57. package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
  58. package/dist/components/QuickSwitcher/asset-search.js +42 -0
  59. package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
  60. package/dist/components/SelectedOutlineCropControls.js +299 -0
  61. package/dist/components/SelectedOutlineElement.js +83 -43
  62. package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
  63. package/dist/components/SelectedOutlineOverlay.js +130 -8
  64. package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
  65. package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
  66. package/dist/components/SidebarCollapserControls.d.ts +3 -1
  67. package/dist/components/SidebarCollapserControls.js +34 -29
  68. package/dist/components/SnappingToggle.d.ts +1 -3
  69. package/dist/components/SnappingToggle.js +2 -2
  70. package/dist/components/Splitter/SplitterContainer.d.ts +2 -0
  71. package/dist/components/Splitter/SplitterContainer.js +5 -1
  72. package/dist/components/Splitter/SplitterContext.d.ts +2 -0
  73. package/dist/components/Splitter/SplitterContext.js +2 -0
  74. package/dist/components/Splitter/SplitterElement.js +6 -1
  75. package/dist/components/Splitter/SplitterHandle.js +27 -2
  76. package/dist/components/Timeline/Timeline.js +1 -1
  77. package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
  78. package/dist/components/Timeline/TimelineAssetField.js +52 -100
  79. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
  80. package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
  81. package/dist/components/Timeline/TimelineColorField.js +20 -1
  82. package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
  83. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  84. package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
  85. package/dist/components/Timeline/TimelineInOutDragHandler.js +25 -1
  86. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
  87. package/dist/components/Timeline/TimelineLayerEye.js +4 -1
  88. package/dist/components/Timeline/TimelineList.d.ts +2 -2
  89. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +7 -1
  90. package/dist/components/Timeline/TimelineSelection.d.ts +5 -5
  91. package/dist/components/Timeline/TimelineSelection.js +8 -6
  92. package/dist/components/Timeline/TimelineSequence.js +7 -6
  93. package/dist/components/Timeline/TimelineSequenceItem.js +57 -10
  94. package/dist/components/Timeline/TimelineSequenceName.js +1 -0
  95. package/dist/components/Timeline/TimelineSequencePropItem.js +27 -75
  96. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -1
  97. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +29 -12
  98. package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
  99. package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
  100. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
  101. package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
  102. package/dist/components/Timeline/reset-selected-timeline-props.js +18 -10
  103. package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
  104. package/dist/components/Timeline/save-effect-prop.js +52 -1
  105. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
  106. package/dist/components/Timeline/timeline-asset-link.js +17 -1
  107. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
  108. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
  109. package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
  110. package/dist/components/Timeline/use-timeline-keyframe-drag.js +6 -4
  111. package/dist/components/TopPanel.js +3 -2
  112. package/dist/components/UndoRedoButtons.js +27 -5
  113. package/dist/components/composition-drop-preview.d.ts +33 -0
  114. package/dist/components/composition-drop-preview.js +68 -0
  115. package/dist/components/drop-handler-data.d.ts +1 -1
  116. package/dist/components/drop-handler-data.js +27 -60
  117. package/dist/components/effect-drag-and-drop.d.ts +1 -1
  118. package/dist/components/effect-drag-and-drop.js +7 -55
  119. package/dist/components/element-drag-and-drop.d.ts +1 -1
  120. package/dist/components/element-drag-and-drop.js +5 -17
  121. package/dist/components/handle-drop.js +0 -1
  122. package/dist/components/import-assets.d.ts +7 -8
  123. package/dist/components/import-assets.js +2 -9
  124. package/dist/components/menu-toolbar-height.d.ts +1 -0
  125. package/dist/components/menu-toolbar-height.js +4 -0
  126. package/dist/components/selected-outline-drag.d.ts +41 -4
  127. package/dist/components/selected-outline-drag.js +179 -2
  128. package/dist/components/selected-outline-geometry.d.ts +1 -0
  129. package/dist/components/selected-outline-measurement.d.ts +11 -0
  130. package/dist/components/selected-outline-measurement.js +64 -3
  131. package/dist/components/selected-outline-types.d.ts +44 -1
  132. package/dist/components/selected-outline-types.js +21 -1
  133. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
  134. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
  135. package/dist/esm/{chunk-7a6q9hk2.js → chunk-dr1y1vm3.js} +11851 -9494
  136. package/dist/esm/internals.mjs +11851 -9494
  137. package/dist/esm/previewEntry.mjs +55150 -52795
  138. package/dist/esm/renderEntry.mjs +1 -1
  139. package/dist/helpers/calculate-timeline.d.ts +2 -2
  140. package/dist/helpers/calculate-timeline.js +8 -28
  141. package/dist/helpers/get-effective-translation.d.ts +13 -1
  142. package/dist/helpers/get-effective-translation.js +12 -6
  143. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
  144. package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
  145. package/dist/helpers/interactivity-enabled.d.ts +1 -0
  146. package/dist/helpers/interactivity-enabled.js +7 -2
  147. package/dist/helpers/is-mac.d.ts +1 -0
  148. package/dist/helpers/is-mac.js +4 -0
  149. package/dist/helpers/open-in-editor.d.ts +5 -1
  150. package/dist/helpers/open-in-editor.js +15 -1
  151. package/dist/helpers/ruler-canvas-size.d.ts +7 -0
  152. package/dist/helpers/ruler-canvas-size.js +14 -1
  153. package/dist/helpers/sort-by-nonce-history.js +97 -19
  154. package/dist/helpers/use-image-metadata.d.ts +1 -0
  155. package/dist/helpers/use-image-metadata.js +8 -5
  156. package/dist/helpers/use-keybinding.js +2 -3
  157. package/dist/helpers/use-media-metadata.d.ts +1 -0
  158. package/dist/helpers/use-media-metadata.js +8 -5
  159. package/dist/helpers/use-menu-structure.js +10 -1
  160. package/dist/icons/caret.d.ts +1 -0
  161. package/dist/icons/caret.js +2 -2
  162. package/dist/icons/pen.d.ts +5 -0
  163. package/dist/icons/pen.js +8 -0
  164. package/dist/state/modals.d.ts +5 -0
  165. package/package.json +13 -12
  166. package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
  167. package/dist/helpers/get-timeline-sequence-hash.js +0 -33
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SidebarCollapserControls = void 0;
3
+ exports.SidebarCollapserControl = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
@@ -18,7 +18,7 @@ const style = {
18
18
  color: colors_1.CURRENT_COLOR,
19
19
  position: 'relative',
20
20
  };
21
- const SidebarCollapserControls = () => {
21
+ const SidebarCollapserControl = ({ side }) => {
22
22
  const { setSidebarCollapsedState, sidebarCollapsedStateRight } = (0, react_1.useContext)(sidebar_1.SidebarContext);
23
23
  const keybindings = (0, use_keybinding_1.useKeybinding)();
24
24
  const leftSidebarStatus = (0, TopPanel_1.useResponsiveSidebarStatus)();
@@ -83,15 +83,30 @@ const SidebarCollapserControls = () => {
83
83
  toggleRight,
84
84
  ]);
85
85
  (0, react_1.useEffect)(() => {
86
- const left = keybindings.registerKeybinding({
87
- event: 'keydown',
88
- key: 'b',
89
- commandCtrlKey: true,
90
- callback: toggleLeft,
91
- preventDefault: true,
92
- triggerIfInputFieldFocused: false,
93
- keepRegisteredWhenNotHighestContext: false,
94
- });
86
+ if (side === 'left') {
87
+ const left = keybindings.registerKeybinding({
88
+ event: 'keydown',
89
+ key: 'b',
90
+ commandCtrlKey: true,
91
+ callback: toggleLeft,
92
+ preventDefault: true,
93
+ triggerIfInputFieldFocused: false,
94
+ keepRegisteredWhenNotHighestContext: false,
95
+ });
96
+ const zen = keybindings.registerKeybinding({
97
+ event: 'keydown',
98
+ key: 'g',
99
+ commandCtrlKey: true,
100
+ callback: toggleBoth,
101
+ preventDefault: true,
102
+ triggerIfInputFieldFocused: false,
103
+ keepRegisteredWhenNotHighestContext: false,
104
+ });
105
+ return () => {
106
+ left.unregister();
107
+ zen.unregister();
108
+ };
109
+ }
95
110
  const right = keybindings.registerKeybinding({
96
111
  event: 'keydown',
97
112
  key: 'j',
@@ -101,21 +116,10 @@ const SidebarCollapserControls = () => {
101
116
  triggerIfInputFieldFocused: false,
102
117
  keepRegisteredWhenNotHighestContext: false,
103
118
  });
104
- const zen = keybindings.registerKeybinding({
105
- event: 'keydown',
106
- key: 'g',
107
- commandCtrlKey: true,
108
- callback: toggleBoth,
109
- preventDefault: true,
110
- triggerIfInputFieldFocused: false,
111
- keepRegisteredWhenNotHighestContext: false,
112
- });
113
119
  return () => {
114
- left.unregister();
115
120
  right.unregister();
116
- zen.unregister();
117
121
  };
118
- }, [keybindings, toggleBoth, toggleLeft, toggleRight]);
122
+ }, [keybindings, side, toggleBoth, toggleLeft, toggleRight]);
119
123
  const toggleLeftTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
120
124
  ? 'Toggle Left Sidebar'
121
125
  : `Toggle Left Sidebar (${ShortcutHint_1.cmdOrCtrlCharacter}+B)`;
@@ -129,13 +133,14 @@ const SidebarCollapserControls = () => {
129
133
  };
130
134
  }, []);
131
135
  const toggleLeftAction = (0, react_1.useCallback)((color) => {
132
- return (jsx_runtime_1.jsx("div", { style: colorStyle(color), title: toggleLeftTooltip, children: jsx_runtime_1.jsx("div", { style: leftIcon(color) }) }));
136
+ return (jsx_runtime_1.jsx("div", { "data-sidebar-toggle": "left", style: colorStyle(color), title: toggleLeftTooltip, children: jsx_runtime_1.jsx("div", { style: leftIcon(color) }) }));
133
137
  }, [colorStyle, leftIcon, toggleLeftTooltip]);
134
138
  const toggleRightAction = (0, react_1.useCallback)((color) => {
135
- return (jsx_runtime_1.jsx("div", { style: colorStyle(color), title: toggleRightTooltip, children: jsx_runtime_1.jsx("div", { style: rightIcon(color) }) }));
139
+ return (jsx_runtime_1.jsx("div", { "data-sidebar-toggle": "right", style: colorStyle(color), title: toggleRightTooltip, children: jsx_runtime_1.jsx("div", { style: rightIcon(color) }) }));
136
140
  }, [colorStyle, rightIcon, toggleRightTooltip]);
137
- return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
138
- jsx_runtime_1.jsx(InlineAction_1.InlineAction, { onClick: toggleLeft, renderAction: toggleLeftAction }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { onClick: toggleRight, renderAction: toggleRightAction })
139
- ] }));
141
+ if (side === 'left') {
142
+ return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { onClick: toggleLeft, renderAction: toggleLeftAction, unhoveredColor: colors_1.WHITE_ALPHA_80 }));
143
+ }
144
+ return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { onClick: toggleRight, renderAction: toggleRightAction, unhoveredColor: colors_1.WHITE_ALPHA_80 }));
140
145
  };
141
- exports.SidebarCollapserControls = SidebarCollapserControls;
146
+ exports.SidebarCollapserControl = SidebarCollapserControl;
@@ -1,4 +1,2 @@
1
1
  import React from 'react';
2
- export declare const SnappingToggle: React.FC<{
3
- readonly disabled: boolean;
4
- }>;
2
+ export declare const SnappingToggle: React.FC;
@@ -9,7 +9,7 @@ const use_keybinding_1 = require("../helpers/use-keybinding");
9
9
  const magnet_1 = require("../icons/magnet");
10
10
  const editor_snapping_1 = require("../state/editor-snapping");
11
11
  const ControlButton_1 = require("./ControlButton");
12
- const SnappingToggle = ({ disabled }) => {
12
+ const SnappingToggle = () => {
13
13
  const { editorSnapping, setEditorSnapping } = (0, react_1.useContext)(editor_snapping_1.EditorSnappingContext);
14
14
  const onClick = (0, react_1.useCallback)(() => {
15
15
  setEditorSnapping((current) => !current);
@@ -21,6 +21,6 @@ const SnappingToggle = ({ disabled }) => {
21
21
  ]
22
22
  .filter(no_react_1.NoReactInternals.truthy)
23
23
  .join(' ');
24
- return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, "aria-pressed": editorSnapping, "aria-keyshortcuts": "Shift+M", disabled: disabled, onClick: onClick, children: jsx_runtime_1.jsx(magnet_1.MagnetIcon, { style: { width: 17, height: 17 }, fill: color, "aria-hidden": "true", focusable: "false" }) }));
24
+ return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, "aria-pressed": editorSnapping, "aria-keyshortcuts": "Shift+M", onClick: onClick, children: jsx_runtime_1.jsx(magnet_1.MagnetIcon, { style: { width: 17, height: 17 }, fill: color, "aria-hidden": "true", focusable: "false" }) }));
25
25
  };
26
26
  exports.SnappingToggle = SnappingToggle;
@@ -5,6 +5,8 @@ export declare const SplitterContainer: React.FC<{
5
5
  readonly orientation: SplitterOrientation;
6
6
  readonly maxFlex: number;
7
7
  readonly minFlex: number;
8
+ readonly maxFlexerSize: number | null;
9
+ readonly maxAntiFlexerSize: number | null;
8
10
  readonly id: string;
9
11
  readonly defaultFlex: number;
10
12
  readonly children: React.ReactNode;
@@ -19,7 +19,7 @@ exports.containerColumn = {
19
19
  flex: 1,
20
20
  height: 0,
21
21
  };
22
- const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFlex, id }) => {
22
+ const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFlex, maxFlexerSize, maxAntiFlexerSize, id, }) => {
23
23
  const [initialTimelineFlex, persistFlex] = (0, timeline_1.useTimelineFlex)(id);
24
24
  const [flexValue, setFlexValue] = (0, react_1.useState)(initialTimelineFlex !== null && initialTimelineFlex !== void 0 ? initialTimelineFlex : defaultFlex);
25
25
  const ref = (0, react_1.useRef)(null);
@@ -34,6 +34,8 @@ const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFle
34
34
  id,
35
35
  maxFlex,
36
36
  minFlex,
37
+ maxFlexerSize,
38
+ maxAntiFlexerSize,
37
39
  defaultFlex,
38
40
  persistFlex,
39
41
  };
@@ -42,6 +44,8 @@ const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFle
42
44
  flexValue,
43
45
  id,
44
46
  maxFlex,
47
+ maxFlexerSize,
48
+ maxAntiFlexerSize,
45
49
  minFlex,
46
50
  orientation,
47
51
  persistFlex,
@@ -11,6 +11,8 @@ export type TSplitterContext = {
11
11
  ref: React.RefObject<HTMLDivElement | null>;
12
12
  maxFlex: number;
13
13
  minFlex: number;
14
+ maxFlexerSize: number | null;
15
+ maxAntiFlexerSize: number | null;
14
16
  defaultFlex: number;
15
17
  id: string;
16
18
  persistFlex: (value: number) => void;
@@ -13,6 +13,8 @@ exports.SplitterContext = react_1.default.createContext({
13
13
  orientation: 'horizontal',
14
14
  maxFlex: 1,
15
15
  minFlex: 1,
16
+ maxFlexerSize: null,
17
+ maxAntiFlexerSize: null,
16
18
  defaultFlex: 1,
17
19
  id: '--',
18
20
  persistFlex: () => undefined,
@@ -8,6 +8,7 @@ const colors_1 = require("../../helpers/colors");
8
8
  const SplitterContext_1 = require("./SplitterContext");
9
9
  const SplitterElement = ({ children, type, sticky }) => {
10
10
  const context = (0, react_1.useContext)(SplitterContext_1.SplitterContext);
11
+ const maxSize = type === 'flexer' ? context.maxFlexerSize : context.maxAntiFlexerSize;
11
12
  const style = (0, react_1.useMemo)(() => {
12
13
  return {
13
14
  flex:
@@ -17,8 +18,12 @@ const SplitterElement = ({ children, type, sticky }) => {
17
18
  position: 'relative',
18
19
  overflow: 'hidden',
19
20
  flexDirection: 'column',
21
+ maxWidth: context.orientation === 'vertical' ? (maxSize !== null && maxSize !== void 0 ? maxSize : undefined) : undefined,
22
+ maxHeight: context.orientation === 'horizontal'
23
+ ? (maxSize !== null && maxSize !== void 0 ? maxSize : undefined)
24
+ : undefined,
20
25
  };
21
- }, [context.flexValue, type]);
26
+ }, [context.flexValue, context.orientation, maxSize, type]);
22
27
  const stickStyle = (0, react_1.useMemo)(() => {
23
28
  return {
24
29
  position: 'absolute',
@@ -31,6 +31,8 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
31
31
  // Cleanup for the listeners that only exist for the duration of a drag.
32
32
  let endDrag = null;
33
33
  const onPointerDown = (e) => {
34
+ var _a;
35
+ var _b;
34
36
  if (e.button !== 0) {
35
37
  return;
36
38
  }
@@ -40,7 +42,20 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
40
42
  // value updates on every pointermove, so it must not be re-read live.
41
43
  const dragContext = latest.current.context;
42
44
  const start = { x: e.clientX, y: e.clientY };
43
- const startFlex = dragContext.flexValue;
45
+ const { width: containerWidth, height: containerHeight } = (_b = (_a = dragContext.ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : {
46
+ width: 0,
47
+ height: 0,
48
+ };
49
+ const availableSize = (dragContext.orientation === 'vertical'
50
+ ? containerWidth
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);
58
+ const startFlex = Math.min(maxFlex, Math.max(minFlex, dragContext.flexValue));
44
59
  dragContext.isDragging.current = start;
45
60
  (0, ForceSpecificCursor_1.forceSpecificCursor)(dragContext.orientation === 'horizontal' ? 'row-resize' : 'col-resize');
46
61
  current.classList.add('remotion-splitter-active');
@@ -54,7 +69,7 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
54
69
  : (ev.clientY - start.y) / (height - exports.SPLITTER_HANDLE_SIZE);
55
70
  const newFlex = startFlex + change;
56
71
  if (clamp) {
57
- return Math.min(dragContext.maxFlex, Math.max(dragContext.minFlex, newFlex));
72
+ return Math.min(maxFlex, Math.max(minFlex, newFlex));
58
73
  }
59
74
  return newFlex;
60
75
  };
@@ -64,6 +79,8 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
64
79
  current.classList.remove('remotion-splitter-active');
65
80
  window.removeEventListener('pointermove', onPointerMove);
66
81
  window.removeEventListener('pointerup', onPointerUp);
82
+ window.removeEventListener('pointercancel', onPointerCancel);
83
+ window.removeEventListener('blur', onWindowBlur);
67
84
  endDrag = null;
68
85
  player_1.PlayerInternals.updateAllElementsSizes();
69
86
  };
@@ -95,8 +112,16 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
95
112
  dragContext.persistFlex(getNewValue(ev, true));
96
113
  endDrag === null || endDrag === void 0 ? void 0 : endDrag();
97
114
  };
115
+ const onPointerCancel = () => {
116
+ endDrag === null || endDrag === void 0 ? void 0 : endDrag();
117
+ };
118
+ const onWindowBlur = () => {
119
+ endDrag === null || endDrag === void 0 ? void 0 : endDrag();
120
+ };
98
121
  window.addEventListener('pointermove', onPointerMove);
99
122
  window.addEventListener('pointerup', onPointerUp);
123
+ window.addEventListener('pointercancel', onPointerCancel);
124
+ window.addEventListener('blur', onWindowBlur);
100
125
  };
101
126
  current.addEventListener('pointerdown', onPointerDown);
102
127
  return () => {
@@ -253,7 +253,7 @@ const TimelineInner = () => {
253
253
  }
254
254
  return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, componentIdentity: sequence.controls.componentIdentity, schema: sequence.controls.schema, getStack: sequence.getStack, effects: sequence.effects }, sequence.id));
255
255
  }), (0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}) : null, jsx_runtime_1.jsx(TimelineKeyframeTracksContext_1.TimelineKeyframeTracksProvider, { tracks: filtered, children: jsx_runtime_1.jsxs(TimelineSelection_1.TimelineSelectableItemsProvider, { timeline: shown, children: [(0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? (jsx_runtime_1.jsx(TimelineSelection_1.TimelineSelectAllKeybindings, { timeline: shown })) : null, jsx_runtime_1.jsx(TimelineHeightContainer_1.TimelineHeightContainer, { shown: shown, hasBeenCut: hasBeenCut, children: isStill ? (jsx_runtime_1.jsx(TimelineList_1.TimelineList, { timeline: shown })) : (jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
256
- jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [
256
+ jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, maxFlexerSize: null, maxAntiFlexerSize: null, children: [
257
257
  jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "flexer", sticky: jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePlaceholders, {}), children: jsx_runtime_1.jsx(TimelineList_1.TimelineList, { timeline: shown }) }), jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { onCollapse: noop, allowToCollapse: "none" }), jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "anti-flexer", sticky: null, children: jsx_runtime_1.jsxs(TimelineScrollable_1.TimelineScrollable, { children: [
258
258
  jsx_runtime_1.jsx(TimelineTracks_1.TimelineTracks, { timeline: shown, hasBeenCut: hasBeenCut }), jsx_runtime_1.jsx(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {}), jsx_runtime_1.jsx(TimelineInOutPointer_1.TimelineInOutPointer, {}), jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimeIndicators, {}), jsx_runtime_1.jsx(TimelineDragHandler_1.TimelineDragHandler, {}), (0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? (jsx_runtime_1.jsx(TimelineInOutDragHandler_1.TimelineInOutDragHandler, {})) : null, jsx_runtime_1.jsx(TimelineSlider_1.TimelineSlider, {})
259
259
  ] }) })
@@ -1,6 +1,15 @@
1
1
  import React from 'react';
2
2
  import type { CanUpdateSequencePropStatusStatic } from 'remotion';
3
3
  import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
4
+ import { type InspectorInlineActionProps } from '../InspectorPanel/common';
5
+ export type InspectorSourceAction = Omit<InspectorInlineActionProps, 'variant'>;
6
+ type AssetSelectionContextValue = {
7
+ readonly initialQuery: string;
8
+ readonly getSourceAction: (src: string) => InspectorSourceAction | null;
9
+ readonly sourceAction: InspectorSourceAction | null;
10
+ };
11
+ export declare const AssetSelectionContext: React.Context<AssetSelectionContextValue>;
12
+ export declare const toFileToken: (name: string) => string;
4
13
  type TimelineAssetFieldProps = {
5
14
  readonly field: SchemaFieldInfo;
6
15
  readonly propStatus: CanUpdateSequencePropStatusStatic;
@@ -9,6 +18,5 @@ type TimelineAssetFieldProps = {
9
18
  readonly onDragValueChange: TimelineFieldOnDragValueChange;
10
19
  readonly onDragEnd: () => void;
11
20
  };
12
- export declare const isStaticFileAssetValue: (value: unknown) => value is string;
13
21
  export declare const TimelineAssetField: React.FC<TimelineAssetFieldProps>;
14
22
  export {};
@@ -1,45 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineAssetField = exports.isStaticFileAssetValue = void 0;
3
+ exports.TimelineAssetField = exports.toFileToken = exports.AssetSelectionContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const no_react_1 = require("remotion/no-react");
7
- const write_static_file_1 = require("../../api/write-static-file");
8
- const Checkmark_1 = require("../../icons/Checkmark");
9
- const import_assets_1 = require("../import-assets");
10
- const ComboBox_1 = require("../NewComposition/ComboBox");
11
- const NotificationCenter_1 = require("../Notifications/NotificationCenter");
12
- const use_static_files_1 = require("../use-static-files");
13
- const comboboxStyle = {
14
- marginLeft: 8,
15
- maxWidth: 180,
16
- };
17
- const remoteAssetStyle = {
18
- display: 'inline-block',
19
- marginLeft: 8,
20
- maxWidth: 180,
21
- overflow: 'hidden',
22
- textOverflow: 'ellipsis',
23
- verticalAlign: 'middle',
24
- whiteSpace: 'nowrap',
7
+ const pen_1 = require("../../icons/pen");
8
+ const modals_1 = require("../../state/modals");
9
+ const InlineAction_1 = require("../InlineAction");
10
+ const common_1 = require("../InspectorPanel/common");
11
+ const penIcon = {
12
+ display: 'block',
13
+ height: 14,
14
+ width: 14,
25
15
  };
16
+ exports.AssetSelectionContext = (0, react_1.createContext)({
17
+ getSourceAction: () => null,
18
+ initialQuery: '',
19
+ sourceAction: null,
20
+ });
26
21
  const toFileToken = (name) => {
27
22
  return `${no_react_1.NoReactInternals.FILE_TOKEN}${name
28
23
  .split('/')
29
24
  .map(encodeURIComponent)
30
25
  .join('/')}`;
31
26
  };
32
- const toStaticFileUrl = (fileToken) => {
33
- return `${window.remotion_staticBase}/${fileToken.slice(no_react_1.NoReactInternals.FILE_TOKEN.length)}`;
34
- };
35
- const isStaticFileAssetValue = (value) => {
36
- return (typeof value === 'string' && value.startsWith(no_react_1.NoReactInternals.FILE_TOKEN));
37
- };
38
- exports.isStaticFileAssetValue = isStaticFileAssetValue;
39
- const TimelineStaticFileAssetField = ({ propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
40
- const staticFiles = (0, use_static_files_1.useStaticFiles)();
41
- const current = String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '');
42
- const onSelect = (0, react_1.useCallback)((sourceValue, previewValue) => {
27
+ exports.toFileToken = toFileToken;
28
+ const TimelineAssetField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
29
+ if (field.fieldSchema.type !== 'asset') {
30
+ throw new Error('TimelineAssetField rendered for non-asset field');
31
+ }
32
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
33
+ const { getSourceAction, initialQuery, sourceAction } = (0, react_1.useContext)(exports.AssetSelectionContext);
34
+ const inlineSourceAction = (0, react_1.useMemo)(() => {
35
+ if (field.key !== 'src') {
36
+ return null;
37
+ }
38
+ return typeof effectiveValue === 'string'
39
+ ? getSourceAction(effectiveValue)
40
+ : sourceAction;
41
+ }, [effectiveValue, field.key, getSourceAction, sourceAction]);
42
+ const onSelect = (0, react_1.useCallback)((assetName, previewValue) => {
43
+ const sourceValue = (0, exports.toFileToken)(assetName);
43
44
  if (sourceValue === propStatus.codeValue) {
44
45
  return;
45
46
  }
@@ -48,78 +49,29 @@ const TimelineStaticFileAssetField = ({ propStatus, effectiveValue, onSave, onDr
48
49
  onDragEnd();
49
50
  });
50
51
  }, [propStatus.codeValue, onDragValueChange, onSave, onDragEnd]);
51
- const upload = (0, react_1.useCallback)(async () => {
52
- const [file] = await (0, import_assets_1.pickFilesToImport)({ multiple: false });
53
- if (!file) {
54
- return;
55
- }
56
- const existing = staticFiles.find((candidate) => candidate.name === file.name);
57
- if (existing && existing.sizeInBytes !== file.size) {
58
- (0, NotificationCenter_1.showNotification)(`File with name ${file.name} already exists and is different`, 4000);
59
- return;
60
- }
61
- try {
62
- if (!existing) {
63
- await (0, write_static_file_1.writeStaticFile)({
64
- contents: await file.arrayBuffer(),
65
- filePath: file.name,
66
- });
67
- }
68
- const fileToken = toFileToken(file.name);
69
- onSelect(fileToken, toStaticFileUrl(fileToken));
70
- if (!existing) {
71
- (0, NotificationCenter_1.showNotification)(`Created ${file.name} in public folder`, 3000);
72
- }
73
- }
74
- catch (error) {
75
- (0, NotificationCenter_1.showNotification)(`Could not upload asset: ${error instanceof Error ? error.message : String(error)}`, 4000);
76
- }
77
- }, [onSelect, staticFiles]);
78
- const items = (0, react_1.useMemo)(() => {
79
- const publicFileItems = staticFiles.map((file) => {
80
- const fileToken = toFileToken(file.name);
81
- return {
82
- type: 'item',
83
- id: fileToken,
84
- value: fileToken,
85
- label: file.name,
86
- onClick: () => onSelect(fileToken, file.src),
87
- keyHint: null,
88
- leftItem: fileToken === current ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
89
- subMenu: null,
90
- quickSwitcherLabel: null,
91
- };
52
+ const openAssetSelection = (0, react_1.useCallback)(() => {
53
+ setSelectedModal({
54
+ type: 'quick-switcher',
55
+ mode: 'assets',
56
+ invocationTimestamp: Date.now(),
57
+ assetSelection: {
58
+ initialQuery,
59
+ onSelected: (asset) => onSelect(asset.name, asset.src),
60
+ },
92
61
  });
93
- return [
94
- ...publicFileItems,
95
- { type: 'divider', id: 'upload-asset-divider' },
96
- {
97
- type: 'item',
98
- id: 'upload-asset',
99
- value: 'upload-asset',
100
- label: 'Upload…',
101
- onClick: () => {
102
- upload().catch(() => undefined);
103
- },
104
- keyHint: null,
105
- leftItem: null,
106
- subMenu: null,
107
- quickSwitcherLabel: null,
62
+ }, [initialQuery, onSelect, setSelectedModal]);
63
+ const action = (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { onClick: openAssetSelection, disabled: window.remotion_isReadOnlyStudio, title: "Change source", renderAction: (color) => jsx_runtime_1.jsx(pen_1.PenIcon, { color: color, style: penIcon }) }));
64
+ if (inlineSourceAction === null) {
65
+ return action;
66
+ }
67
+ return (jsx_runtime_1.jsx(common_1.InspectorInlineAction, { ...inlineSourceAction, size: "compact", variant: {
68
+ type: 'segmented',
69
+ trailing: {
108
70
  disabled: window.remotion_isReadOnlyStudio,
71
+ onClick: openAssetSelection,
72
+ renderIcon: (color) => jsx_runtime_1.jsx(pen_1.PenIcon, { color: color, style: penIcon }),
73
+ title: 'Change source',
109
74
  },
110
- ];
111
- }, [current, onSelect, staticFiles, upload]);
112
- return (jsx_runtime_1.jsx(ComboBox_1.Combobox, { size: "small", title: current, selectedId: current, values: items, style: comboboxStyle }));
113
- };
114
- const TimelineAssetField = (props) => {
115
- var _a;
116
- if (props.field.fieldSchema.type !== 'asset') {
117
- throw new Error('TimelineAssetField rendered for non-asset field');
118
- }
119
- if (!(0, exports.isStaticFileAssetValue)(props.effectiveValue)) {
120
- const remote = String((_a = props.effectiveValue) !== null && _a !== void 0 ? _a : '');
121
- return (jsx_runtime_1.jsx("span", { style: remoteAssetStyle, title: remote, children: remote }));
122
- }
123
- return jsx_runtime_1.jsx(TimelineStaticFileAssetField, { ...props });
75
+ } }));
124
76
  };
125
77
  exports.TimelineAssetField = TimelineAssetField;
@@ -14,16 +14,19 @@ export type PasteEffectsTarget = {
14
14
  } | {
15
15
  readonly type: 'unsupported';
16
16
  };
17
- export type PasteEffectPropTarget = {
18
- readonly type: 'valid';
17
+ type PasteEffectPropEditTarget = {
19
18
  readonly fileName: string;
20
19
  readonly nodePath: SequencePropsSubscriptionKey;
21
20
  readonly effectIndex: number;
22
21
  readonly fieldKey: string;
23
22
  readonly defaultValue: string | null;
24
23
  readonly schema: InteractivitySchema;
24
+ };
25
+ export type PasteEffectPropTarget = {
26
+ readonly type: 'valid';
27
+ readonly targets: PasteEffectPropEditTarget[];
25
28
  } | {
26
- readonly type: 'none' | 'multiple' | 'unsupported' | 'effect-type-mismatch' | 'prop-mismatch' | 'uncopyable';
29
+ readonly type: 'none' | 'unsupported' | 'effect-type-mismatch' | 'prop-mismatch' | 'uncopyable';
27
30
  };
28
31
  export declare const getPasteEffectsTarget: (selectedItems: readonly TimelineSelection[]) => PasteEffectsTarget;
29
32
  export declare const getSnapshotsFromSelection: ({ selection, propStatuses, }: {
@@ -72,3 +75,4 @@ export declare const getPasteEffectPropTarget: ({ selectedItems, payload, propSt
72
75
  readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
73
76
  }) => PasteEffectPropTarget;
74
77
  export declare const TimelineClipboardKeybindings: React.FC;
78
+ export {};