@remotion/studio 4.0.502 → 4.0.504

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 (217) hide show
  1. package/dist/api/install-package.d.ts +2 -1
  2. package/dist/api/install-package.js +6 -2
  3. package/dist/components/AssetSelectorItem.js +4 -16
  4. package/dist/components/Canvas.js +41 -54
  5. package/dist/components/CheckboardToggle.js +3 -1
  6. package/dist/components/ColorPicker/AlphaSlider.js +14 -10
  7. package/dist/components/ColorPicker/HueSlider.js +14 -10
  8. package/dist/components/ColorPicker/SaturationValueArea.js +14 -12
  9. package/dist/components/CompositionContextButton.js +1 -1
  10. package/dist/components/CompositionSelectorItem.js +2 -3
  11. package/dist/components/ConfigureDefaultEditorModal.d.ts +2 -0
  12. package/dist/components/ConfigureDefaultEditorModal.js +151 -0
  13. package/dist/components/ConfirmationDialog.js +6 -3
  14. package/dist/components/ContextMenu.js +0 -2
  15. package/dist/components/ControlButton.d.ts +4 -2
  16. package/dist/components/ControlButton.js +6 -20
  17. package/dist/components/Editor.js +1 -4
  18. package/dist/components/EditorContent.js +1 -1
  19. package/dist/components/EditorGuides/Guide.js +48 -74
  20. package/dist/components/EditorRuler/Ruler.d.ts +1 -0
  21. package/dist/components/EditorRuler/Ruler.js +3 -1
  22. package/dist/components/EditorRuler/index.js +26 -23
  23. package/dist/components/EffectPickerModal.js +68 -7
  24. package/dist/components/ElementInstallConfirmation.d.ts +12 -0
  25. package/dist/components/ElementInstallConfirmation.js +205 -0
  26. package/dist/components/ForceSpecificCursor.js +14 -0
  27. package/dist/components/FullscreenToggle.js +1 -2
  28. package/dist/components/InitialCompositionLoader.js +1 -14
  29. package/dist/components/InlineAction.d.ts +4 -4
  30. package/dist/components/InlineAction.js +6 -4
  31. package/dist/components/InspectorLocationCopy.d.ts +1 -0
  32. package/dist/components/InspectorLocationCopy.js +7 -3
  33. package/dist/components/InspectorOpenInEditor.d.ts +5 -0
  34. package/dist/components/InspectorOpenInEditor.js +135 -0
  35. package/dist/components/InspectorPanel/AlignmentControls.js +1 -1
  36. package/dist/components/InspectorPanel/CompositionInspectorHeader.js +3 -3
  37. package/dist/components/InspectorPanel/CompositionMetadata.js +8 -7
  38. package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +2 -2
  39. package/dist/components/InspectorPanel/KeyframeInspector.js +2 -3
  40. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +2 -2
  41. package/dist/components/InspectorPanel/styles.js +4 -0
  42. package/dist/components/InspectorSequenceSection.js +2 -2
  43. package/dist/components/LoopToggle.js +1 -1
  44. package/dist/components/Menu/MenuItem.js +13 -6
  45. package/dist/components/Menu/MenuSubItem.js +3 -1
  46. package/dist/components/MenuBuildIndicator.d.ts +3 -1
  47. package/dist/components/MenuBuildIndicator.js +6 -4
  48. package/dist/components/MenuCompositionName.js +1 -1
  49. package/dist/components/MenuToolbar.js +1 -1
  50. package/dist/components/MobilePanel.d.ts +1 -2
  51. package/dist/components/MobilePanel.js +6 -6
  52. package/dist/components/ModalContainer.js +1 -1
  53. package/dist/components/ModalFooter.d.ts +1 -0
  54. package/dist/components/ModalFooter.js +2 -2
  55. package/dist/components/Modals.js +11 -2
  56. package/dist/components/MuteToggle.js +2 -1
  57. package/dist/components/NewComposition/ComboBox.d.ts +1 -0
  58. package/dist/components/NewComposition/ComboBox.js +2 -2
  59. package/dist/components/NewComposition/InputDragger.d.ts +4 -0
  60. package/dist/components/NewComposition/InputDragger.js +26 -32
  61. package/dist/components/Notifications/NotificationCenter.js +12 -2
  62. package/dist/components/OutlineToggle.js +10 -2
  63. package/dist/components/PlayPause.js +1 -5
  64. package/dist/components/PlaybackRateSelector.js +2 -1
  65. package/dist/components/PreviewToolbar.js +8 -7
  66. package/dist/components/PreviewToolbarOverflowButton.d.ts +0 -1
  67. package/dist/components/PreviewToolbarOverflowButton.js +2 -75
  68. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -2
  69. package/dist/components/RenderButton.d.ts +0 -1
  70. package/dist/components/RenderButton.js +10 -9
  71. package/dist/components/RenderModal/FrameRangeSetting.js +6 -1
  72. package/dist/components/RenderModal/InlineEyeIcon.js +1 -1
  73. package/dist/components/RenderModal/InlineRemoveButton.js +1 -1
  74. package/dist/components/RenderModal/MultiRangeSlider.js +8 -8
  75. package/dist/components/RenderModal/RenderModalEnvironmentVariables.js +1 -9
  76. package/dist/components/RenderModal/RenderModalOutputName.js +12 -3
  77. package/dist/components/RenderModal/SchemaEditor/SchemaResetButton.js +1 -1
  78. package/dist/components/RenderModal/ServerRenderModal.js +2 -17
  79. package/dist/components/RenderModal/WebRenderModal.js +3 -17
  80. package/dist/components/RenderModal/layout.js +7 -5
  81. package/dist/components/RenderModal/render-modals.js +18 -15
  82. package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +1 -1
  83. package/dist/components/RenderQueue/RenderQueueDownloadItem.js +1 -1
  84. package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +1 -1
  85. package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +1 -1
  86. package/dist/components/RenderQueue/RenderQueueRemoveItem.js +1 -1
  87. package/dist/components/RenderQueue/RenderQueueRepeat.js +2 -15
  88. package/dist/components/SelectedOutlineCropControls.js +7 -6
  89. package/dist/components/SelectedOutlineElement.js +32 -38
  90. package/dist/components/SelectedOutlineUvControls.js +25 -24
  91. package/dist/components/ShowGuidesProvider.js +2 -0
  92. package/dist/components/SidebarCollapserControls.js +2 -2
  93. package/dist/components/SidebarRenderButton.js +2 -16
  94. package/dist/components/SizeSelector.js +2 -1
  95. package/dist/components/SnappingToggle.js +1 -2
  96. package/dist/components/Spinner.d.ts +1 -0
  97. package/dist/components/Spinner.js +2 -2
  98. package/dist/components/Splitter/SplitterContainer.d.ts +1 -0
  99. package/dist/components/Splitter/SplitterContainer.js +4 -1
  100. package/dist/components/Splitter/SplitterContext.d.ts +4 -3
  101. package/dist/components/Splitter/SplitterContext.js +3 -2
  102. package/dist/components/Splitter/SplitterElement.js +6 -1
  103. package/dist/components/Splitter/SplitterHandle.js +18 -68
  104. package/dist/components/Tabs/vertical.d.ts +1 -0
  105. package/dist/components/Tabs/vertical.js +8 -10
  106. package/dist/components/TimeValue.js +26 -8
  107. package/dist/components/Timeline/EasingEditorModal.js +27 -19
  108. package/dist/components/Timeline/Timeline.js +1 -1
  109. package/dist/components/Timeline/TimelineAssetField.js +1 -1
  110. package/dist/components/Timeline/TimelineClipboardKeybindings.js +3 -6
  111. package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -7
  112. package/dist/components/Timeline/TimelineDragHandler.js +38 -7
  113. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +2 -1
  114. package/dist/components/Timeline/TimelineInOutDragHandler.js +26 -11
  115. package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +1 -1
  116. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +2 -2
  117. package/dist/components/Timeline/TimelineLayerEye.js +36 -4
  118. package/dist/components/Timeline/TimelineSelection.js +16 -24
  119. package/dist/components/Timeline/TimelineSequence.js +7 -3
  120. package/dist/components/Timeline/TimelineSequenceItem.js +24 -18
  121. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +1 -1
  122. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +76 -43
  123. package/dist/components/Timeline/TimelineStack/get-stack.js +7 -2
  124. package/dist/components/Timeline/TimelineZoomControls.d.ts +3 -1
  125. package/dist/components/Timeline/TimelineZoomControls.js +24 -12
  126. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +4 -2
  127. package/dist/components/Timeline/get-sequence-context-menu-items.js +38 -2
  128. package/dist/components/Timeline/should-subscribe-to-source-file.d.ts +1 -0
  129. package/dist/components/Timeline/should-subscribe-to-source-file.js +11 -0
  130. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +2 -3
  131. package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +3 -1
  132. package/dist/components/Timeline/use-open-sequence-in-editor.js +5 -2
  133. package/dist/components/Timeline/use-sequence-props-subscription.js +2 -0
  134. package/dist/components/Timeline/use-timeline-asset-drop.js +3 -7
  135. package/dist/components/Timeline/use-timeline-keyframe-drag.js +31 -16
  136. package/dist/components/TimelineInOutToggle.js +3 -3
  137. package/dist/components/TopPanel.js +3 -2
  138. package/dist/components/UndoRedoButtons.js +6 -5
  139. package/dist/components/UpdateCheck.d.ts +2 -0
  140. package/dist/components/UpdateCheck.js +29 -11
  141. package/dist/components/UpdateModal/UpdateModal.js +58 -19
  142. package/dist/components/VisualControls/ClickableFileName.js +5 -2
  143. package/dist/components/composition-menu-items.d.ts +2 -4
  144. package/dist/components/composition-menu-items.js +32 -55
  145. package/dist/components/element-install-request.d.ts +3 -0
  146. package/dist/components/element-install-request.js +17 -0
  147. package/dist/components/folder-menu-items.js +1 -1
  148. package/dist/components/handle-drop.d.ts +2 -3
  149. package/dist/components/handle-drop.js +11 -4
  150. package/dist/components/import-assets.d.ts +7 -6
  151. package/dist/components/import-assets.js +5 -16
  152. package/dist/components/use-default-editor-info.d.ts +4 -0
  153. package/dist/components/use-default-editor-info.js +47 -0
  154. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +1 -1
  155. package/dist/error-overlay/remotion-overlay/StackFrame.js +1 -1
  156. package/dist/esm/{chunk-fjv75ty4.js → chunk-43m68z1k.js} +8689 -7374
  157. package/dist/esm/internals.mjs +8689 -7374
  158. package/dist/esm/previewEntry.mjs +8668 -7353
  159. package/dist/esm/renderEntry.mjs +1 -1
  160. package/dist/helpers/inject-css.js +58 -67
  161. package/dist/helpers/install-required-package.d.ts +3 -2
  162. package/dist/helpers/install-required-package.js +20 -15
  163. package/dist/helpers/open-in-editor.d.ts +3 -3
  164. package/dist/helpers/open-in-editor.js +10 -6
  165. package/dist/helpers/pointer-session.d.ts +9 -0
  166. package/dist/helpers/pointer-session.js +94 -0
  167. package/dist/helpers/use-menu-structure.js +109 -51
  168. package/dist/icons/audio.d.ts +1 -1
  169. package/dist/icons/audio.js +1 -1
  170. package/dist/icons/caret.js +1 -1
  171. package/dist/icons/certificate.d.ts +1 -1
  172. package/dist/icons/certificate.js +1 -1
  173. package/dist/icons/custom-editor.d.ts +4 -0
  174. package/dist/icons/custom-editor.js +11 -0
  175. package/dist/icons/data.d.ts +1 -1
  176. package/dist/icons/data.js +2 -2
  177. package/dist/icons/editor.d.ts +6 -0
  178. package/dist/icons/editor.js +52 -0
  179. package/dist/icons/effects.d.ts +5 -0
  180. package/dist/icons/effects.js +8 -0
  181. package/dist/icons/ellipsis.js +1 -1
  182. package/dist/icons/external-link.d.ts +5 -0
  183. package/dist/icons/external-link.js +10 -0
  184. package/dist/icons/fullscreen.js +1 -1
  185. package/dist/icons/gear.d.ts +1 -1
  186. package/dist/icons/gear.js +1 -1
  187. package/dist/icons/gif.d.ts +1 -1
  188. package/dist/icons/gif.js +1 -1
  189. package/dist/icons/input-props.d.ts +2 -0
  190. package/dist/icons/input-props.js +9 -0
  191. package/dist/icons/jump-to-start.js +2 -2
  192. package/dist/icons/magnet.d.ts +3 -1
  193. package/dist/icons/magnet.js +2 -2
  194. package/dist/icons/media-volume.d.ts +6 -2
  195. package/dist/icons/media-volume.js +8 -6
  196. package/dist/icons/minus.d.ts +3 -1
  197. package/dist/icons/minus.js +2 -2
  198. package/dist/icons/pause.js +1 -1
  199. package/dist/icons/play.js +1 -1
  200. package/dist/icons/plus.js +1 -1
  201. package/dist/icons/redo.js +2 -2
  202. package/dist/icons/step-back.js +2 -2
  203. package/dist/icons/step-forward.js +2 -2
  204. package/dist/icons/timelineInOutPointer.js +2 -2
  205. package/dist/icons/undo.js +2 -2
  206. package/dist/state/editor-guides.d.ts +1 -0
  207. package/dist/state/editor-guides.js +1 -0
  208. package/dist/state/modals.d.ts +2 -0
  209. package/dist/state/z-index.d.ts +1 -0
  210. package/dist/state/z-index.js +34 -18
  211. package/package.json +12 -13
  212. package/dist/components/StudioCanvasCapture.d.ts +0 -5
  213. package/dist/components/StudioCanvasCapture.js +0 -40
  214. package/dist/components/canvas-capture-enabled.d.ts +0 -1
  215. package/dist/components/canvas-capture-enabled.js +0 -4
  216. package/dist/components/use-element-overwrite-confirmation.d.ts +0 -2
  217. package/dist/components/use-element-overwrite-confirmation.js +0 -73
@@ -5,36 +5,62 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
7
  const copy_text_1 = require("../../helpers/copy-text");
8
- const CopyButton_1 = require("../CopyButton");
8
+ const clipboard_1 = require("../../icons/clipboard");
9
+ const InlineAction_1 = require("../InlineAction");
9
10
  const KnownBugs_1 = require("../KnownBugs");
10
- const layout_1 = require("../layout");
11
11
  const ModalHeader_1 = require("../ModalHeader");
12
12
  const DismissableModal_1 = require("../NewComposition/DismissableModal");
13
13
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
14
14
  const container = {
15
- padding: 20,
16
- paddingTop: 0,
15
+ padding: '0 16px 8px',
16
+ };
17
+ const panelStyle = {
18
+ borderRadius: 6,
19
+ overflow: 'hidden',
17
20
  };
18
21
  const text = {
22
+ color: colors_1.LIGHT_TEXT,
23
+ fontFamily: 'sans-serif',
19
24
  fontSize: 14,
25
+ lineHeight: 1.5,
20
26
  };
21
27
  const title = {
22
28
  paddingTop: 12,
23
29
  paddingBottom: 8,
24
30
  ...text,
25
31
  };
26
- const code = {
32
+ const commandField = {
33
+ alignItems: 'center',
27
34
  background: colors_1.SELECTED_BACKGROUND,
28
- padding: '12px 10px',
29
- fontSize: 14,
30
- marginTop: 10,
35
+ borderRadius: 6,
36
+ boxSizing: 'border-box',
37
+ display: 'flex',
31
38
  marginBottom: 10,
39
+ marginTop: 10,
40
+ padding: '8px 8px 8px 10px',
41
+ width: '100%',
42
+ };
43
+ const code = {
44
+ color: colors_1.WHITE,
45
+ flex: 1,
46
+ fontFamily: 'monospace',
47
+ fontSize: 14,
48
+ lineHeight: 1.5,
49
+ margin: 0,
50
+ minWidth: 0,
51
+ overflowX: 'auto',
52
+ whiteSpace: 'pre',
53
+ };
54
+ const copyIcon = {
55
+ flexShrink: 0,
56
+ height: 12,
57
+ width: 12,
32
58
  };
33
59
  const link = {
60
+ ...text,
34
61
  fontWeight: 'bold',
35
62
  color: colors_1.BLUE,
36
63
  textDecoration: 'none',
37
- ...text,
38
64
  };
39
65
  const commands = {
40
66
  npm: 'npx remotion upgrade',
@@ -43,23 +69,36 @@ const commands = {
43
69
  bun: 'bun remotion upgrade',
44
70
  unknown: 'npx remotion upgrade',
45
71
  };
72
+ const skillsUpdateCommand = 'npx remotion skills update';
73
+ const remotionUpgradeSkill = '/remotion-upgrade';
46
74
  const UpdateModal = ({ info, knownBugs }) => {
47
75
  const hasKnownBugs = (0, react_1.useMemo)(() => {
48
76
  return knownBugs && (knownBugs === null || knownBugs === void 0 ? void 0 : knownBugs.length) > 0;
49
77
  }, [knownBugs]);
50
- const command = commands[info.packageManager];
78
+ const updateAction = info.remotionUpgradeSkillAvailable
79
+ ? remotionUpgradeSkill
80
+ : info.updateAvailable
81
+ ? commands[info.packageManager]
82
+ : skillsUpdateCommand;
83
+ const updateActionType = info.remotionUpgradeSkillAvailable
84
+ ? 'skill'
85
+ : 'command';
51
86
  const onClick = (0, react_1.useCallback)(() => {
52
- (0, copy_text_1.copyText)(command).catch((err) => {
87
+ (0, copy_text_1.copyText)(updateAction).catch((err) => {
53
88
  (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
54
89
  });
55
- }, [command]);
56
- return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { children: [
57
- jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Update available" }), jsx_runtime_1.jsxs("div", { style: container, children: [hasKnownBugs ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
58
- jsx_runtime_1.jsxs("div", { style: title, children: ["The currently installed version ", info.currentVersion, " has the following known bugs:"] }), jsx_runtime_1.jsx(KnownBugs_1.KnownBugs, { bugs: knownBugs }), jsx_runtime_1.jsx("div", { style: { height: '20px' } }), jsx_runtime_1.jsx("div", { style: text, children: "To upgrade, run the following command:" })
59
- ] })) : (jsx_runtime_1.jsx("div", { style: title, children: "A new update for Remotion is available! Run the following command:" })), jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
60
- jsx_runtime_1.jsx(layout_1.Flex, { children: jsx_runtime_1.jsx("pre", { onClick: onClick, style: code, children: command }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx(CopyButton_1.CopyButton, { textToCopy: command, label: "Copy", labelWhenCopied: "Copied!" })
61
- ] }), jsx_runtime_1.jsxs("div", { style: text, children: ["This will upgrade Remotion from ", info.currentVersion, " to", ' ', info.latestVersion, "."] }), jsx_runtime_1.jsxs("div", { style: text, children: ["Read the", ' ', jsx_runtime_1.jsx("a", { style: link, target: "_blank", href: "https://github.com/remotion-dev/remotion/releases", children: "Release notes" }), ' ', "to know what", "'s", " new in Remotion."] })
62
- ] })
90
+ }, [updateAction]);
91
+ const renderCopyAction = (0, react_1.useCallback)((color) => {
92
+ return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { color: color, style: copyIcon });
93
+ }, []);
94
+ return (jsx_runtime_1.jsxs(DismissableModal_1.DismissableModal, { panelStyle: panelStyle, children: [
95
+ jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Update available" }), jsx_runtime_1.jsxs("div", { style: container, children: [hasKnownBugs && info.updateAvailable ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
96
+ jsx_runtime_1.jsxs("div", { style: title, children: ["The currently installed version ", info.currentVersion, " has the following known bugs:"] }), jsx_runtime_1.jsx(KnownBugs_1.KnownBugs, { bugs: knownBugs }), jsx_runtime_1.jsx("div", { style: { height: '20px' } }), jsx_runtime_1.jsxs("div", { style: text, children: ["To upgrade, run the following ", updateActionType, ":"] })
97
+ ] })) : info.updateAvailable ? (jsx_runtime_1.jsxs("div", { style: title, children: ["A new update for Remotion is available! Run the following", ' ', updateActionType, ":"] })) : (jsx_runtime_1.jsxs("div", { style: title, children: ["Your Remotion Agent Skills are out of date. Run the following", ' ', updateActionType, ":"] })), jsx_runtime_1.jsxs("div", { style: commandField, children: [
98
+ jsx_runtime_1.jsx("pre", { style: code, children: updateAction }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, onClick: onClick, renderAction: renderCopyAction, title: "Copy command" })
99
+ ] }), info.updateAvailable ? (jsx_runtime_1.jsxs("div", { style: text, children: ["This will upgrade Remotion from ", info.currentVersion, " to", ' ', info.latestVersion, info.skillsUpdateAvailable
100
+ ? ' and update your project Remotion Agent Skills.'
101
+ : '.'] })) : null, info.updateAvailable ? (jsx_runtime_1.jsxs("div", { style: text, children: ["Read the", ' ', jsx_runtime_1.jsx("a", { style: link, target: "_blank", href: "https://github.com/remotion-dev/remotion/releases", children: "Release notes" }), ' ', "to know what", "'s", " new in Remotion."] })) : null] })
63
102
  ] }));
64
103
  };
65
104
  exports.UpdateModal = UpdateModal;
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
7
  const open_in_editor_1 = require("../../helpers/open-in-editor");
8
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
8
9
  const Fieldset_1 = require("../RenderModal/SchemaEditor/Fieldset");
9
10
  const source_attribution_1 = require("../Timeline/TimelineStack/source-attribution");
10
11
  const container = {
@@ -28,11 +29,13 @@ const ClickableFileName = ({ originalFileName, }) => {
28
29
  color: hoverEffect ? colors_1.WHITE_HEX : colors_1.LIGHT_COLOR,
29
30
  };
30
31
  }, [originalFileName, hoverEffect]);
31
- const onClick = (0, react_1.useCallback)(async () => {
32
+ const onClick = (0, react_1.useCallback)(() => {
32
33
  if (originalFileName.type !== 'loaded') {
33
34
  return;
34
35
  }
35
- await (0, open_in_editor_1.openOriginalPositionInEditor)(originalFileName.originalFileName);
36
+ (0, open_in_editor_1.openOriginalPositionInEditor)(originalFileName.originalFileName, null).catch((err) => {
37
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
38
+ });
36
39
  }, [originalFileName]);
37
40
  return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsx("span", { style: style, onClick: onClick, onPointerEnter: onTitlePointerEnter, onPointerLeave: onTitlePointerLeave, children: originalFileName.type === 'loaded'
38
41
  ? (0, source_attribution_1.getOriginalSourceAttribution)(originalFileName.originalFileName)
@@ -2,14 +2,13 @@ import type { SetStateAction } from 'react';
2
2
  import type { ResolvedStackLocation } from 'remotion';
3
3
  import type { ModalState } from '../state/modals';
4
4
  import type { ComboboxValue } from './NewComposition/ComboBox';
5
- export declare const getCompositionMenuItems: ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeNewCompositionItem, includeCompositionManagementItems, }: {
5
+ export declare const getCompositionMenuItems: ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeCompositionManagementItems, }: {
6
6
  composition: import("remotion").AnyComposition | null;
7
7
  connectionStatus: "connected" | "disconnected" | "init";
8
8
  resolvedLocation: ResolvedStackLocation | null;
9
9
  setSelectedModal: (value: SetStateAction<ModalState | null>) => void;
10
10
  closeMenu: () => void;
11
11
  readOnlyStudio: boolean;
12
- includeNewCompositionItem: boolean;
13
12
  includeCompositionManagementItems: boolean;
14
13
  }) => ComboboxValue[];
15
14
  export declare const getCompositionContextMenuItems: (args: Omit<{
@@ -19,8 +18,7 @@ export declare const getCompositionContextMenuItems: (args: Omit<{
19
18
  setSelectedModal: (value: SetStateAction<ModalState | null>) => void;
20
19
  closeMenu: () => void;
21
20
  readOnlyStudio: boolean;
22
- includeNewCompositionItem: boolean;
23
21
  includeCompositionManagementItems: boolean;
24
- }, "includeCompositionManagementItems" | "includeNewCompositionItem"> & {
22
+ }, "includeCompositionManagementItems"> & {
25
23
  readonly includeCompositionManagementItems: boolean;
26
24
  }) => ComboboxValue[];
@@ -6,7 +6,7 @@ const format_file_location_1 = require("../helpers/format-file-location");
6
6
  const open_in_editor_1 = require("../helpers/open-in-editor");
7
7
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
8
8
  const open_in_new_window_1 = require("./open-in-new-window");
9
- const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeNewCompositionItem, includeCompositionManagementItems, }) => {
9
+ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeCompositionManagementItems, }) => {
10
10
  const editorName = window.remotion_editorName;
11
11
  const fileLocation = (0, format_file_location_1.formatFileLocation)({
12
12
  location: resolvedLocation,
@@ -28,7 +28,7 @@ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocati
28
28
  return;
29
29
  }
30
30
  try {
31
- await (0, open_in_editor_1.openOriginalPositionInEditor)(resolvedLocation);
31
+ await (0, open_in_editor_1.openOriginalPositionInEditor)(resolvedLocation, null);
32
32
  }
33
33
  catch (err) {
34
34
  (0, NotificationCenter_1.showNotification)(err.message, 2000);
@@ -69,60 +69,12 @@ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocati
69
69
  disabled: openComponentInEditorDisabled,
70
70
  }
71
71
  : null,
72
- {
73
- id: 'copy-file-location',
74
- keyHint: null,
75
- label: `Copy file location`,
76
- leftItem: null,
77
- onClick: () => {
78
- closeMenu();
79
- if (!fileLocation) {
80
- return;
81
- }
82
- navigator.clipboard
83
- .writeText(fileLocation)
84
- .then(() => {
85
- (0, NotificationCenter_1.showNotification)('Copied file location to clipboard', 1000);
86
- })
87
- .catch((err) => {
88
- (0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
89
- });
90
- },
91
- quickSwitcherLabel: 'Copy composition file location',
92
- subMenu: null,
93
- type: 'item',
94
- value: 'copy-file-location',
95
- disabled: copyFileLocationDisabled,
96
- },
97
- (editorName || fileLocation) &&
98
- (includeNewCompositionItem || includeCompositionManagementItems)
72
+ editorName && includeCompositionManagementItems
99
73
  ? {
100
74
  type: 'divider',
101
75
  id: 'show-in-editor-divider',
102
76
  }
103
77
  : null,
104
- includeNewCompositionItem
105
- ? {
106
- id: 'new',
107
- keyHint: null,
108
- label: `New...`,
109
- leftItem: null,
110
- onClick: () => {
111
- closeMenu();
112
- setSelectedModal({
113
- type: 'new-comp',
114
- folderName: null,
115
- parentName: null,
116
- stack: null,
117
- });
118
- },
119
- quickSwitcherLabel: 'New composition...',
120
- subMenu: null,
121
- type: 'item',
122
- value: 'new',
123
- disabled: readOnlyStudio,
124
- }
125
- : null,
126
78
  includeCompositionManagementItems
127
79
  ? {
128
80
  id: 'rename',
@@ -193,9 +145,36 @@ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocati
193
145
  disabled: !composition || readOnlyStudio,
194
146
  }
195
147
  : null,
148
+ editorName || includeCompositionManagementItems
149
+ ? {
150
+ type: 'divider',
151
+ id: 'copy-actions-divider',
152
+ }
153
+ : null,
196
154
  {
197
- type: 'divider',
198
- id: 'copy-id-divider',
155
+ id: 'copy-file-location',
156
+ keyHint: null,
157
+ label: `Copy file location`,
158
+ leftItem: null,
159
+ onClick: () => {
160
+ closeMenu();
161
+ if (!fileLocation) {
162
+ return;
163
+ }
164
+ navigator.clipboard
165
+ .writeText(fileLocation)
166
+ .then(() => {
167
+ (0, NotificationCenter_1.showNotification)('Copied file location to clipboard', 1000);
168
+ })
169
+ .catch((err) => {
170
+ (0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
171
+ });
172
+ },
173
+ quickSwitcherLabel: 'Copy composition file location',
174
+ subMenu: null,
175
+ type: 'item',
176
+ value: 'copy-file-location',
177
+ disabled: copyFileLocationDisabled,
199
178
  },
200
179
  {
201
180
  id: 'copy-id',
@@ -229,7 +208,6 @@ const getCompositionContextMenuItems = (args) => {
229
208
  if (args.composition === null) {
230
209
  return (0, exports.getCompositionMenuItems)({
231
210
  ...args,
232
- includeNewCompositionItem: false,
233
211
  });
234
212
  }
235
213
  return [
@@ -240,7 +218,6 @@ const getCompositionContextMenuItems = (args) => {
240
218
  },
241
219
  ...(0, exports.getCompositionMenuItems)({
242
220
  ...args,
243
- includeNewCompositionItem: false,
244
221
  }),
245
222
  ];
246
223
  };
@@ -0,0 +1,3 @@
1
+ import type { ElementInstallRequest } from '@remotion/studio-shared';
2
+ export declare const enqueueElementInstallRequest: (request: ElementInstallRequest) => void;
3
+ export declare const subscribeToElementInstallRequests: (listener: (request: ElementInstallRequest) => void) => () => void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribeToElementInstallRequests = exports.enqueueElementInstallRequest = void 0;
4
+ const listeners = new Set();
5
+ const enqueueElementInstallRequest = (request) => {
6
+ for (const listener of listeners) {
7
+ listener(request);
8
+ }
9
+ };
10
+ exports.enqueueElementInstallRequest = enqueueElementInstallRequest;
11
+ const subscribeToElementInstallRequests = (listener) => {
12
+ listeners.add(listener);
13
+ return () => {
14
+ listeners.delete(listener);
15
+ };
16
+ };
17
+ exports.subscribeToElementInstallRequests = subscribeToElementInstallRequests;
@@ -32,7 +32,7 @@ const getFolderMenuItems = ({ closeMenu, connectionStatus, folder, readOnlyStudi
32
32
  return;
33
33
  }
34
34
  try {
35
- await (0, open_in_editor_1.openOriginalPositionInEditor)(resolvedLocation);
35
+ await (0, open_in_editor_1.openOriginalPositionInEditor)(resolvedLocation, null);
36
36
  }
37
37
  catch (err) {
38
38
  (0, NotificationCenter_1.showNotification)(err.message, 2000);
@@ -1,10 +1,9 @@
1
1
  import type { Dimensions } from '../helpers/is-current-selected-still';
2
- import { type ConfirmElementOverwrite, type InsertElementDropPosition } from './import-assets';
2
+ import { type InsertElementDropPosition } from './import-assets';
3
3
  import type { SvgImportMode } from './SvgImportDialog';
4
- export declare const handleDrop: ({ chooseSvgImportMode, compositionFile, confirmElementOverwrite, compositionId, destinationDimensions, dropPosition, event, fps, from, }: {
4
+ export declare const handleDrop: ({ chooseSvgImportMode, compositionFile, compositionId, destinationDimensions, dropPosition, event, fps, from, }: {
5
5
  chooseSvgImportMode: () => Promise<SvgImportMode | null>;
6
6
  compositionFile: string;
7
- confirmElementOverwrite: ConfirmElementOverwrite;
8
7
  compositionId: string;
9
8
  destinationDimensions: Dimensions | null;
10
9
  dropPosition: InsertElementDropPosition | null;
@@ -4,8 +4,9 @@ exports.handleDrop = void 0;
4
4
  const remote_asset_drag_1 = require("../helpers/remote-asset-drag");
5
5
  const drop_handler_data_1 = require("./drop-handler-data");
6
6
  const element_drag_and_drop_1 = require("./element-drag-and-drop");
7
+ const element_install_request_1 = require("./element-install-request");
7
8
  const import_assets_1 = require("./import-assets");
8
- const handleDrop = async ({ chooseSvgImportMode, compositionFile, confirmElementOverwrite, compositionId, destinationDimensions, dropPosition, event, fps, from, }) => {
9
+ const handleDrop = async ({ chooseSvgImportMode, compositionFile, compositionId, destinationDimensions, dropPosition, event, fps, from, }) => {
9
10
  var _a;
10
11
  var _b;
11
12
  if ((0, drop_handler_data_1.isFileDragEvent)(event)) {
@@ -77,13 +78,19 @@ const handleDrop = async ({ chooseSvgImportMode, compositionFile, confirmElement
77
78
  }
78
79
  const element = (0, element_drag_and_drop_1.getElementDragData)(event.dataTransfer);
79
80
  if (element !== null) {
80
- await (0, import_assets_1.insertElement)({
81
+ (0, element_install_request_1.enqueueElementInstallRequest)({
82
+ id: crypto.randomUUID(),
83
+ clientId: 'drag-and-drop',
84
+ createdAt: Date.now(),
81
85
  compositionFile,
82
86
  compositionId,
83
- confirmOverwrite: confirmElementOverwrite,
84
- dropPosition,
85
87
  element: element.element,
86
88
  from,
89
+ position: (0, import_assets_1.getElementPositionForDrop)({
90
+ dimensions: element.element.dimensions,
91
+ dropPosition,
92
+ }),
93
+ source: { type: 'drag-and-drop' },
87
94
  });
88
95
  return;
89
96
  }
@@ -1,11 +1,10 @@
1
1
  import { type CompositionDragData, type ComponentProp } from '@remotion/studio-protocol';
2
- import { type FileType, type InsertElementFileConflict, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
2
+ import { type ElementInstallExpectedFileState, type FileType, type InsertableCompositionElementPosition } from '@remotion/studio-shared';
3
3
  import type { Dimensions } from '../helpers/is-current-selected-still';
4
4
  export type InsertElementDropPosition = {
5
5
  readonly centerX: number;
6
6
  readonly centerY: number;
7
7
  };
8
- export type ConfirmElementOverwrite = (conflict: InsertElementFileConflict) => Promise<boolean>;
9
8
  export declare const getAssetElement: ({ fileType, src, }: {
10
9
  fileType: FileType;
11
10
  src: string;
@@ -145,17 +144,19 @@ export declare const insertComposition: ({ composition, compositionFile, composi
145
144
  dropPosition: InsertElementDropPosition | null;
146
145
  from: number | null;
147
146
  }) => Promise<void>;
148
- export declare const insertElement: ({ compositionFile, compositionId, confirmOverwrite, dropPosition, element, from, }: {
147
+ export declare const insertElement: ({ compositionFile, compositionId, element, expectedFileState, position, from, overwriteExisting, }: {
149
148
  compositionFile: string;
150
149
  compositionId: string;
151
- confirmOverwrite: ConfirmElementOverwrite;
152
- dropPosition: InsertElementDropPosition | null;
153
150
  element: {
154
- dependencies: string[];
151
+ dependencies: import("@remotion/studio-protocol").ElementDependency[];
152
+ durationInFrames?: number | undefined;
155
153
  slug: string;
156
154
  displayName: string;
157
155
  sourceCode: string;
158
156
  dimensions: import("@remotion/studio-protocol").ComponentDimensions | null;
159
157
  };
158
+ expectedFileState: ElementInstallExpectedFileState;
159
+ position: InsertableCompositionElementPosition | null;
160
160
  from: number | null;
161
+ overwriteExisting: boolean;
161
162
  }) => Promise<void>;
@@ -480,7 +480,7 @@ const notifyUnsupportedFiles = (unsupportedFiles) => {
480
480
  };
481
481
  const insertCompositionElement = async ({ compositionFile, compositionId, element, from, }) => {
482
482
  const requiredPackage = (0, studio_shared_1.getRequiredPackageForInsertableElement)(element);
483
- await (0, install_required_package_1.installRequiredPackages)(requiredPackage ? [requiredPackage] : []);
483
+ await (0, install_required_package_1.installRequiredPackages)(requiredPackage ? [{ name: requiredPackage, version: null }] : []);
484
484
  const result = await (0, call_api_1.callApi)('/api/insert-jsx-element', {
485
485
  compositionFile,
486
486
  compositionId,
@@ -872,33 +872,22 @@ const insertComposition = async ({ composition, compositionFile, compositionId,
872
872
  }
873
873
  };
874
874
  exports.insertComposition = insertComposition;
875
- const insertElement = async ({ compositionFile, compositionId, confirmOverwrite, dropPosition, element, from, }) => {
875
+ const insertElement = async ({ compositionFile, compositionId, element, expectedFileState, position, from, overwriteExisting, }) => {
876
876
  try {
877
877
  await (0, install_required_package_1.installRequiredPackages)(element.dependencies);
878
- const position = (0, exports.getElementPositionForDrop)({
879
- dimensions: element.dimensions,
880
- dropPosition,
881
- });
882
- const callInsertElementApi = (overwriteExisting) => (0, call_api_1.callApi)('/api/insert-element', {
878
+ const response = await (0, call_api_1.callApi)('/api/insert-element', {
883
879
  compositionFile,
884
880
  compositionId,
885
881
  element,
882
+ expectedFileState,
886
883
  from,
887
884
  overwriteExisting,
888
885
  position,
889
886
  });
890
- let response = await callInsertElementApi(false);
891
- if (!response.success && response.type === 'file-conflict') {
892
- const shouldOverwrite = await confirmOverwrite(response.conflict);
893
- if (!shouldOverwrite) {
894
- return;
895
- }
896
- response = await callInsertElementApi(true);
897
- }
898
887
  if (!response.success) {
899
888
  const reason = response.type === 'error'
900
889
  ? response.reason
901
- : `Element file still conflicts: ${response.conflict.filePath}`;
890
+ : `Element file changed: ${response.conflict.filePath}`;
902
891
  (0, NotificationCenter_1.showNotification)(`Could not add Element: ${reason}`, 4000);
903
892
  return;
904
893
  }
@@ -0,0 +1,4 @@
1
+ import type { EditorPickerId, GetDefaultEditorInfoResponse } from '@remotion/studio-shared';
2
+ export declare const canUseEditorPicker: (previewServerConnected: boolean) => boolean;
3
+ export declare const getPreferredEditorId: (editorInfo: GetDefaultEditorInfoResponse | null) => EditorPickerId | null;
4
+ export declare const useDefaultEditorInfo: (enabled: boolean) => GetDefaultEditorInfoResponse | null;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDefaultEditorInfo = exports.getPreferredEditorId = exports.canUseEditorPicker = void 0;
4
+ const react_1 = require("react");
5
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
6
+ const call_api_1 = require("./call-api");
7
+ let editorInfoPromise = null;
8
+ const loadDefaultEditorInfo = () => {
9
+ editorInfoPromise !== null && editorInfoPromise !== void 0 ? editorInfoPromise : (editorInfoPromise = (0, call_api_1.callApi)('/api/default-editor-info', {}).catch((err) => {
10
+ editorInfoPromise = null;
11
+ throw err;
12
+ }));
13
+ return editorInfoPromise;
14
+ };
15
+ const canUseEditorPicker = (previewServerConnected) => {
16
+ return (previewServerConnected &&
17
+ !window.remotion_isReadOnlyStudio &&
18
+ (0, browser_studio_operations_1.getBrowserStudioOperations)() === null);
19
+ };
20
+ exports.canUseEditorPicker = canUseEditorPicker;
21
+ const getPreferredEditorId = (editorInfo) => {
22
+ var _a;
23
+ var _b;
24
+ return ((_b = (_a = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.find((editor) => editor.name === window.remotion_editorName)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null);
25
+ };
26
+ exports.getPreferredEditorId = getPreferredEditorId;
27
+ const useDefaultEditorInfo = (enabled) => {
28
+ const [editorInfo, setEditorInfo] = (0, react_1.useState)(null);
29
+ (0, react_1.useEffect)(() => {
30
+ if (!enabled) {
31
+ return;
32
+ }
33
+ let cancelled = false;
34
+ loadDefaultEditorInfo()
35
+ .then((response) => {
36
+ if (!cancelled) {
37
+ setEditorInfo(response);
38
+ }
39
+ })
40
+ .catch(() => undefined);
41
+ return () => {
42
+ cancelled = true;
43
+ };
44
+ }, [enabled]);
45
+ return editorInfo;
46
+ };
47
+ exports.useDefaultEditorInfo = useDefaultEditorInfo;
@@ -42,7 +42,7 @@ const OpenInEditor = ({ stack, canHaveKeyboardShortcuts }) => {
42
42
  }, []);
43
43
  const openInBrowser = (0, react_1.useCallback)(() => {
44
44
  dispatch({ type: 'start' });
45
- (0, open_in_editor_1.openInEditor)(stack)
45
+ (0, open_in_editor_1.openInEditor)(stack, null)
46
46
  .then((data) => {
47
47
  if (data.success) {
48
48
  dispatchIfMounted({ type: 'succeed' });
@@ -48,7 +48,7 @@ const StackElement = ({ s, lineNumberWidth, isFirst, defaultFunctionName }) => {
48
48
  if (!canOpenFileLocation) {
49
49
  return;
50
50
  }
51
- (0, open_in_editor_1.openInEditor)(s).catch((err) => {
51
+ (0, open_in_editor_1.openInEditor)(s, null).catch((err) => {
52
52
  // eslint-disable-next-line no-console
53
53
  console.log('Could not open in editor', err);
54
54
  });