@remotion/studio 4.0.499 → 4.0.501

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 (204) 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 +11 -7
  8. package/dist/components/AssetSelectorItem.d.ts +25 -0
  9. package/dist/components/AssetSelectorItem.js +116 -80
  10. package/dist/components/Canvas.js +6 -1
  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 +2 -32
  16. package/dist/components/ControlButton.js +1 -0
  17. package/dist/components/CurrentAsset.js +3 -2
  18. package/dist/components/EditorContexts.d.ts +0 -1
  19. package/dist/components/EditorContexts.js +2 -2
  20. package/dist/components/ExplorerPanel.js +2 -1
  21. package/dist/components/ExplorerPanelRef.d.ts +2 -0
  22. package/dist/components/FpsCounter.js +3 -3
  23. package/dist/components/FullscreenToggle.js +2 -1
  24. package/dist/components/GlobalKeybindings.js +9 -1
  25. package/dist/components/InitialCompositionLoader.d.ts +1 -1
  26. package/dist/components/InlineAction.d.ts +2 -1
  27. package/dist/components/InlineAction.js +3 -2
  28. package/dist/components/InlineCaptionInspector.d.ts +11 -0
  29. package/dist/components/InlineCaptionInspector.js +108 -0
  30. package/dist/components/InlineDropdown.d.ts +1 -1
  31. package/dist/components/InlineDropdown.js +3 -2
  32. package/dist/components/InspectorPanel/AlignmentControls.d.ts +2 -2
  33. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  34. package/dist/components/InspectorPanel/CompositionInspector.js +12 -9
  35. package/dist/components/InspectorPanel/CompositionMetadata.js +170 -57
  36. package/dist/components/InspectorPanel/ConnectedCompositionsSection.d.ts +2 -2
  37. package/dist/components/InspectorPanel/SelectedInspector.d.ts +1 -0
  38. package/dist/components/InspectorPanel/SelectedInspector.js +2 -2
  39. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -3
  40. package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +1 -0
  41. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +10 -10
  42. package/dist/components/InspectorPanel/common.d.ts +17 -4
  43. package/dist/components/InspectorPanel/common.js +60 -6
  44. package/dist/components/InspectorPanel/inspector-section-collapse.d.ts +22 -0
  45. package/dist/components/InspectorPanel/inspector-section-collapse.js +165 -0
  46. package/dist/components/InspectorPanel/styles.js +7 -1
  47. package/dist/components/InspectorPanel/use-composition-actions.d.ts +3 -0
  48. package/dist/components/InspectorPanel/use-composition-actions.js +91 -5
  49. package/dist/components/InspectorPanel/use-track-for-selection.d.ts +1 -1
  50. package/dist/components/InspectorPanel.js +2 -2
  51. package/dist/components/InspectorSequenceSection.d.ts +2 -1
  52. package/dist/components/InspectorSequenceSection.js +279 -25
  53. package/dist/components/KeyboardShortcutsExplainer.js +4 -2
  54. package/dist/components/Menu/MenuItem.js +2 -1
  55. package/dist/components/MenuCompositionName.js +30 -7
  56. package/dist/components/MenuToolbar.d.ts +0 -1
  57. package/dist/components/MenuToolbar.js +15 -7
  58. package/dist/components/MobilePanel.d.ts +2 -1
  59. package/dist/components/MobilePanel.js +29 -25
  60. package/dist/components/ModalContainer.d.ts +1 -0
  61. package/dist/components/ModalContainer.js +2 -2
  62. package/dist/components/Modals.js +1 -1
  63. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  64. package/dist/components/NewComposition/DismissableModal.js +2 -2
  65. package/dist/components/NewComposition/InputDragger.d.ts +7 -0
  66. package/dist/components/NewComposition/InputDragger.js +119 -8
  67. package/dist/components/OutlineToggle.d.ts +1 -3
  68. package/dist/components/OutlineToggle.js +2 -2
  69. package/dist/components/PreviewToolbar.js +10 -4
  70. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +7 -0
  71. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +45 -0
  72. package/dist/components/QuickSwitcher/NoResults.d.ts +1 -1
  73. package/dist/components/QuickSwitcher/NoResults.js +1 -0
  74. package/dist/components/QuickSwitcher/QuickSwitcher.d.ts +10 -0
  75. package/dist/components/QuickSwitcher/QuickSwitcher.js +6 -2
  76. package/dist/components/QuickSwitcher/QuickSwitcherContent.d.ts +10 -0
  77. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +95 -13
  78. package/dist/components/QuickSwitcher/QuickSwitcherResult.d.ts +4 -0
  79. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +11 -8
  80. package/dist/components/QuickSwitcher/asset-search.d.ts +9 -0
  81. package/dist/components/QuickSwitcher/asset-search.js +42 -0
  82. package/dist/components/RenderQueue/ClientRenderQueueProcessor.d.ts +0 -1
  83. package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -14
  84. package/dist/components/RenderQueue/RenderQueueDownloadItem.js +2 -2
  85. package/dist/components/SelectedOutlineCropControls.d.ts +8 -0
  86. package/dist/components/SelectedOutlineCropControls.js +299 -0
  87. package/dist/components/SelectedOutlineElement.js +84 -47
  88. package/dist/components/SelectedOutlineOverlay.d.ts +2 -2
  89. package/dist/components/SelectedOutlineOverlay.js +147 -16
  90. package/dist/components/SequencePropsSubscriptionProvider.d.ts +2 -0
  91. package/dist/components/SequencePropsSubscriptionProvider.js +31 -3
  92. package/dist/components/ShowOutlinesProvider.js +4 -1
  93. package/dist/components/SidebarCollapserControls.d.ts +3 -1
  94. package/dist/components/SidebarCollapserControls.js +34 -29
  95. package/dist/components/SnappingToggle.d.ts +1 -3
  96. package/dist/components/SnappingToggle.js +2 -2
  97. package/dist/components/Timeline/Timeline.js +19 -5
  98. package/dist/components/Timeline/TimelineAssetField.d.ts +9 -1
  99. package/dist/components/Timeline/TimelineAssetField.js +53 -100
  100. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -3
  101. package/dist/components/Timeline/TimelineClipboardKeybindings.js +65 -38
  102. package/dist/components/Timeline/TimelineColorField.js +20 -1
  103. package/dist/components/Timeline/TimelineEffectPropItem.js +8 -77
  104. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +8 -1
  105. package/dist/components/Timeline/TimelineHeightContainer.d.ts +2 -2
  106. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +3 -3
  107. package/dist/components/Timeline/TimelineList.d.ts +2 -2
  108. package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +7 -2
  109. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +10 -2
  110. package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
  111. package/dist/components/Timeline/TimelineRowChrome.js +4 -3
  112. package/dist/components/Timeline/TimelineSelection.d.ts +9 -7
  113. package/dist/components/Timeline/TimelineSelection.js +17 -12
  114. package/dist/components/Timeline/TimelineSequence.js +2 -9
  115. package/dist/components/Timeline/TimelineSequenceItem.js +61 -15
  116. package/dist/components/Timeline/TimelineSequencePropItem.js +36 -85
  117. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +0 -1
  118. package/dist/components/Timeline/TimelineTrack.d.ts +2 -2
  119. package/dist/components/Timeline/TimelineTrack.js +4 -2
  120. package/dist/components/Timeline/TimelineTracks.d.ts +2 -2
  121. package/dist/components/Timeline/border-radius-representation.d.ts +16 -0
  122. package/dist/components/Timeline/border-radius-representation.js +60 -0
  123. package/dist/components/Timeline/delete-selected-timeline-item.js +1 -6
  124. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +1 -1
  125. package/dist/components/Timeline/get-sequence-context-menu-items.js +14 -12
  126. package/dist/components/Timeline/get-sequence-prop-reset-changes.d.ts +10 -0
  127. package/dist/components/Timeline/get-sequence-prop-reset-changes.js +33 -0
  128. package/dist/components/Timeline/reset-selected-timeline-props.js +20 -18
  129. package/dist/components/Timeline/save-effect-prop.d.ts +10 -0
  130. package/dist/components/Timeline/save-effect-prop.js +52 -1
  131. package/dist/components/Timeline/save-sequence-prop.d.ts +12 -1
  132. package/dist/components/Timeline/save-sequence-prop.js +25 -1
  133. package/dist/components/Timeline/should-show-track-in-timeline.d.ts +2 -2
  134. package/dist/components/Timeline/timeline-asset-link.js +17 -1
  135. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  136. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +4 -0
  137. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +9 -3
  138. package/dist/components/Timeline/use-timeline-asset-drop.js +4 -0
  139. package/dist/components/Timeline/use-timeline-height.d.ts +2 -2
  140. package/dist/components/TopPanel.js +2 -2
  141. package/dist/components/UndoRedoButtons.js +42 -11
  142. package/dist/components/composition-drop-preview.js +1 -0
  143. package/dist/components/handle-drop.d.ts +3 -2
  144. package/dist/components/handle-drop.js +2 -1
  145. package/dist/components/import-assets.d.ts +4 -2
  146. package/dist/components/import-assets.js +20 -7
  147. package/dist/components/menu-toolbar-height.d.ts +1 -0
  148. package/dist/components/menu-toolbar-height.js +4 -0
  149. package/dist/components/selected-outline-drag.d.ts +41 -4
  150. package/dist/components/selected-outline-drag.js +179 -2
  151. package/dist/components/selected-outline-geometry.d.ts +1 -0
  152. package/dist/components/selected-outline-measurement.d.ts +11 -0
  153. package/dist/components/selected-outline-measurement.js +64 -3
  154. package/dist/components/selected-outline-types.d.ts +44 -1
  155. package/dist/components/selected-outline-types.js +21 -1
  156. package/dist/components/use-element-overwrite-confirmation.d.ts +2 -0
  157. package/dist/components/use-element-overwrite-confirmation.js +73 -0
  158. package/dist/components/use-static-files.js +7 -2
  159. package/dist/error-overlay/react-overlay/effects/resolve-file-source.js +13 -2
  160. package/dist/error-overlay/remotion-overlay/Overlay.js +3 -3
  161. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -3
  162. package/dist/esm/{chunk-pk1zwsn1.js → chunk-n1kj09yv.js} +10618 -8002
  163. package/dist/esm/index.mjs +24 -8
  164. package/dist/esm/internals.mjs +10618 -8002
  165. package/dist/esm/previewEntry.mjs +40002 -37388
  166. package/dist/esm/renderEntry.mjs +1 -1
  167. package/dist/helpers/browser-studio-operations.d.ts +3 -0
  168. package/dist/helpers/browser-studio-operations.js +14 -0
  169. package/dist/helpers/calculate-timeline.d.ts +2 -2
  170. package/dist/helpers/calculate-timeline.js +8 -28
  171. package/dist/helpers/client-id.d.ts +0 -1
  172. package/dist/helpers/client-id.js +15 -10
  173. package/dist/helpers/download-blob.d.ts +1 -0
  174. package/dist/helpers/download-blob.js +15 -0
  175. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +3 -10
  176. package/dist/helpers/get-timeline-sequence-sort-key.js +5 -13
  177. package/dist/helpers/inject-css.js +5 -3
  178. package/dist/helpers/interactivity-enabled.d.ts +1 -0
  179. package/dist/helpers/interactivity-enabled.js +7 -2
  180. package/dist/helpers/is-mac.d.ts +1 -0
  181. package/dist/helpers/is-mac.js +4 -0
  182. package/dist/helpers/open-in-editor.d.ts +5 -1
  183. package/dist/helpers/open-in-editor.js +39 -4
  184. package/dist/helpers/preview-server-events.js +46 -9
  185. package/dist/helpers/sort-by-nonce-history.js +97 -19
  186. package/dist/helpers/use-create-composition.js +8 -6
  187. package/dist/helpers/use-keybinding.js +2 -3
  188. package/dist/helpers/use-menu-structure.js +39 -1
  189. package/dist/hot-middleware-client/client.js +3 -3
  190. package/dist/icons/border-radius.d.ts +4 -0
  191. package/dist/icons/border-radius.js +8 -0
  192. package/dist/icons/caret.d.ts +1 -0
  193. package/dist/icons/caret.js +2 -2
  194. package/dist/icons/fullscreen.d.ts +4 -0
  195. package/dist/icons/fullscreen.js +6 -0
  196. package/dist/icons/pen.d.ts +5 -0
  197. package/dist/icons/pen.js +8 -0
  198. package/dist/previewEntry.js +1 -1
  199. package/dist/state/modals.d.ts +9 -0
  200. package/dist/state/timeline-sequence-hover.d.ts +17 -0
  201. package/dist/state/timeline-sequence-hover.js +33 -0
  202. package/package.json +13 -12
  203. package/dist/helpers/get-timeline-sequence-hash.d.ts +0 -6
  204. package/dist/helpers/get-timeline-sequence-hash.js +0 -33
package/dist/Studio.js CHANGED
@@ -17,7 +17,7 @@ const getServerDisconnectedDomElement = () => {
17
17
  };
18
18
  const StudioInner = ({ rootComponent, readOnly }) => {
19
19
  var _a, _b;
20
- return (jsx_runtime_1.jsx(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: jsx_runtime_1.jsx(remotion_1.Internals.RemotionRootContexts, { frameState: null, audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: (_a = window.remotion_logLevel) !== null && _a !== void 0 ? _a : 'info', numberOfAudioTags: window.remotion_numberOfAudioTags, audioLatencyHint: (_b = window.remotion_audioLatencyHint) !== null && _b !== void 0 ? _b : 'playback', previewSampleRate: window.remotion_previewSampleRate, children: jsx_runtime_1.jsx(use_static_files_1.StaticFilesProvider, { children: jsx_runtime_1.jsx(ResolveCompositionConfigInStudio_1.ResolveCompositionConfigInStudio, { children: jsx_runtime_1.jsxs(EditorContexts_1.EditorContexts, { readOnlyStudio: readOnly, children: [
20
+ return (jsx_runtime_1.jsx(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: jsx_runtime_1.jsx(remotion_1.Internals.RemotionRootContexts, { frameState: null, audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: (_a = window.remotion_logLevel) !== null && _a !== void 0 ? _a : 'info', numberOfAudioTags: window.remotion_numberOfAudioTags, audioLatencyHint: (_b = window.remotion_audioLatencyHint) !== null && _b !== void 0 ? _b : 'playback', previewSampleRate: window.remotion_previewSampleRate, children: jsx_runtime_1.jsx(use_static_files_1.StaticFilesProvider, { children: jsx_runtime_1.jsx(ResolveCompositionConfigInStudio_1.ResolveCompositionConfigInStudio, { children: jsx_runtime_1.jsxs(EditorContexts_1.EditorContexts, { children: [
21
21
  jsx_runtime_1.jsx(Editor_1.Editor, { readOnlyStudio: readOnly, Root: rootComponent }), readOnly
22
22
  ? null
23
23
  : (0, react_dom_1.createPortal)(jsx_runtime_1.jsx(ServerDisconnected_1.ServerDisconnected, {}), getServerDisconnectedDomElement())] }) }) }) }) }));
@@ -3,16 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deleteStaticFile = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const call_api_1 = require("../components/call-api");
6
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
6
7
  const deleteStaticFile = async (relativePath) => {
7
8
  if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
8
9
  throw new Error('deleteStaticFile() is only available in the Studio');
9
10
  }
10
- if (window.remotion_isReadOnlyStudio) {
11
- throw new Error('deleteStaticFile() is not available in Read-Only Studio');
12
- }
13
11
  if (relativePath.startsWith(window.remotion_staticBase)) {
14
12
  relativePath = relativePath.substring(window.remotion_staticBase.length + 1);
15
13
  }
14
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
15
+ if (browserStudioOperations) {
16
+ return browserStudioOperations.deleteStaticFile({ relativePath });
17
+ }
18
+ if (window.remotion_isReadOnlyStudio) {
19
+ throw new Error('deleteStaticFile() is not available in Read-Only Studio');
20
+ }
16
21
  const res = await (0, call_api_1.callApi)('/api/delete-static-file', { relativePath });
17
22
  return res;
18
23
  };
@@ -3,10 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renameStaticFile = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const call_api_1 = require("../components/call-api");
6
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
6
7
  const renameStaticFile = ({ oldRelativePath, newRelativePath, }) => {
7
8
  if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
8
9
  throw new Error('renameStaticFile() is only available in the Studio');
9
10
  }
11
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
12
+ if (browserStudioOperations) {
13
+ return browserStudioOperations.renameStaticFile({
14
+ oldRelativePath,
15
+ newRelativePath,
16
+ });
17
+ }
10
18
  if (window.remotion_isReadOnlyStudio) {
11
19
  throw new Error('renameStaticFile() is not available in Read-Only Studio');
12
20
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.watchPublicFolder = exports.WATCH_REMOTION_STATIC_FILES = void 0;
4
4
  const remotion_1 = require("remotion");
5
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
5
6
  const get_static_files_1 = require("./get-static-files");
6
7
  exports.WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';
7
8
  /*
@@ -14,7 +15,7 @@ const watchPublicFolder = (callback) => {
14
15
  console.warn('The watchPublicFolder() API is only available while using the Remotion Studio.');
15
16
  return { cancel: () => undefined };
16
17
  }
17
- if (window.remotion_isReadOnlyStudio) {
18
+ if (window.remotion_isReadOnlyStudio && !(0, browser_studio_operations_1.getBrowserStudioOperations)()) {
18
19
  throw new Error('watchPublicFolder() is not available in read-only Studio');
19
20
  }
20
21
  const emitUpdate = () => {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.watchStaticFile = void 0;
4
4
  const remotion_1 = require("remotion");
5
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
5
6
  const watch_public_folder_1 = require("./watch-public-folder");
6
7
  /*
7
8
  * @description Watches for changes in a specific static file and invokes a callback function when the file changes, enabling dynamic updates in your Remotion projects.
@@ -13,7 +14,7 @@ const watchStaticFile = (fileName, callback) => {
13
14
  console.warn('watchStaticFile() is only available while using the Remotion Studio.');
14
15
  return { cancel: () => undefined };
15
16
  }
16
- if (window.remotion_isReadOnlyStudio) {
17
+ if (window.remotion_isReadOnlyStudio && !(0, browser_studio_operations_1.getBrowserStudioOperations)()) {
17
18
  // eslint-disable-next-line no-console
18
19
  console.warn('watchStaticFile() is only available in an interactive Studio.');
19
20
  return { cancel: () => undefined };
@@ -1,14 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeStaticFile = void 0;
4
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
4
5
  const writeStaticFile = async ({ contents, filePath, }) => {
6
+ if (filePath.includes('\\')) {
7
+ return Promise.reject(new Error('File path cannot contain backslashes'));
8
+ }
9
+ const browserStudioOperations = (0, browser_studio_operations_1.getBrowserStudioOperations)();
10
+ if (browserStudioOperations) {
11
+ return browserStudioOperations.writeStaticFile({ contents, filePath });
12
+ }
5
13
  if (window.remotion_isReadOnlyStudio) {
6
14
  throw new Error('writeStaticFile() is not available in read-only Studio');
7
15
  }
8
16
  const url = new URL(`${window.remotion_staticBase}/api/add-asset`, window.location.origin);
9
- if (filePath.includes('\\')) {
10
- return Promise.reject(new Error('File path cannot contain backslashes'));
11
- }
12
17
  url.search = new URLSearchParams({
13
18
  filePath,
14
19
  }).toString();
@@ -37,6 +37,7 @@ exports.AssetSelector = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = require("react");
39
39
  const write_static_file_1 = require("../api/write-static-file");
40
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
40
41
  const client_id_1 = require("../helpers/client-id");
41
42
  const colors_1 = require("../helpers/colors");
42
43
  const create_folder_tree_1 = require("../helpers/create-folder-tree");
@@ -48,6 +49,7 @@ const z_index_1 = require("../state/z-index");
48
49
  const AssetSelectorItem_1 = require("./AssetSelectorItem");
49
50
  const styles_1 = require("./Menu/styles");
50
51
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
52
+ const ExplorerQuickSwitcherTrigger_1 = require("./QuickSwitcher/ExplorerQuickSwitcherTrigger");
51
53
  const use_static_files_1 = require("./use-static-files");
52
54
  const container = {
53
55
  display: 'flex',
@@ -79,7 +81,8 @@ const AssetSelector = ({ readOnlyStudio }) => {
79
81
  const [dropLocation, setDropLocation] = (0, react_1.useState)(null);
80
82
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
81
83
  .previewServerState.type;
82
- const shouldAllowUpload = connectionStatus === 'connected' && !readOnlyStudio;
84
+ const shouldAllowUpload = (0, browser_studio_operations_1.getBrowserStudioOperations)() !== null ||
85
+ (connectionStatus === 'connected' && !readOnlyStudio);
83
86
  const list = (0, react_1.useMemo)(() => {
84
87
  return {
85
88
  ...baseList,
@@ -158,11 +161,12 @@ const AssetSelector = ({ readOnlyStudio }) => {
158
161
  setDropLocation(null);
159
162
  }
160
163
  }, [dropLocation, staticFiles]);
161
- return (jsx_runtime_1.jsx("div", { style: container, onDragOver: shouldAllowUpload ? onDragOver : undefined, onDrop: shouldAllowUpload ? onDrop : undefined, children: staticFiles.length === 0 ? (publicFolderExists ? (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, place a file in the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
162
- " folder of your project or drag and drop a file here."] }) })) : (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, create a folder called", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
163
- " in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
164
- ...list,
165
- backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
166
- }, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }) })) }));
164
+ return (jsx_runtime_1.jsxs("div", { style: container, onDragOver: shouldAllowUpload ? onDragOver : undefined, onDrop: shouldAllowUpload ? onDrop : undefined, children: [
165
+ jsx_runtime_1.jsx(ExplorerQuickSwitcherTrigger_1.ExplorerQuickSwitcherTrigger, { mode: "assets", showShortcut: true, tabIndex: tabIndex }), staticFiles.length === 0 ? (publicFolderExists ? (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, place a file in the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
166
+ " folder of your project or drag and drop a file here."] }) })) : (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, create a folder called", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
167
+ " in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
168
+ ...list,
169
+ backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
170
+ }, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }) }))] }));
167
171
  };
168
172
  exports.AssetSelector = AssetSelector;
@@ -1,5 +1,30 @@
1
1
  import React from 'react';
2
2
  import type { AssetStructure } from '../helpers/create-folder-tree';
3
+ import type { ComboboxValue } from './NewComposition/ComboBox';
4
+ export declare const getAssetActionAvailability: ({ browserStudioCanMutateAssets, readOnlyStudio, connectionStatus, publicFolderExists, }: {
5
+ browserStudioCanMutateAssets: boolean | null;
6
+ readOnlyStudio: boolean;
7
+ connectionStatus: "connected" | "disconnected" | "init";
8
+ publicFolderExists: string | null;
9
+ }) => {
10
+ mutationsDisabled: boolean;
11
+ fileExplorerDisabled: boolean;
12
+ };
13
+ export declare const getCanDragAsset: ({ readOnlyStudio, relativePath, }: {
14
+ readOnlyStudio: boolean;
15
+ relativePath: string;
16
+ }) => boolean;
17
+ export declare const getAssetContextMenuItems: ({ relativePath, fileManagerName, copyFileName, copyStaticFilePath, openAssetInExplorer, renameAsset, deleteAsset, fileExplorerDisabled, mutationsDisabled, }: {
18
+ relativePath: string;
19
+ fileManagerName: string;
20
+ copyFileName: () => void;
21
+ copyStaticFilePath: () => void;
22
+ openAssetInExplorer: () => void;
23
+ renameAsset: () => void;
24
+ deleteAsset: () => void;
25
+ fileExplorerDisabled: boolean;
26
+ mutationsDisabled: boolean;
27
+ }) => ComboboxValue[];
3
28
  export declare const AssetFolderTree: React.FC<{
4
29
  readonly item: AssetStructure;
5
30
  readonly name: string | null;
@@ -33,13 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.AssetFolderTree = void 0;
36
+ exports.AssetFolderTree = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const drag_and_drop_1 = require("@remotion/drag-and-drop");
39
39
  const react_1 = require("react");
40
40
  const remotion_1 = require("remotion");
41
41
  const no_react_1 = require("remotion/no-react");
42
42
  const delete_static_file_1 = require("../api/delete-static-file");
43
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
43
44
  const client_id_1 = require("../helpers/client-id");
44
45
  const colors_1 = require("../helpers/colors");
45
46
  const copy_text_1 = require("../helpers/copy-text");
@@ -105,6 +106,92 @@ const revealIconStyle = {
105
106
  height: 12,
106
107
  color: colors_1.CURRENT_COLOR,
107
108
  };
109
+ const getAssetActionAvailability = ({ browserStudioCanMutateAssets, readOnlyStudio, connectionStatus, publicFolderExists, }) => {
110
+ return {
111
+ mutationsDisabled: browserStudioCanMutateAssets !== true &&
112
+ (readOnlyStudio || connectionStatus !== 'connected'),
113
+ fileExplorerDisabled: publicFolderExists === null ||
114
+ readOnlyStudio ||
115
+ connectionStatus !== 'connected',
116
+ };
117
+ };
118
+ exports.getAssetActionAvailability = getAssetActionAvailability;
119
+ const getCanDragAsset = ({ readOnlyStudio, relativePath, }) => {
120
+ return !readOnlyStudio && (0, import_assets_1.getAssetElementFromPath)(relativePath) !== null;
121
+ };
122
+ exports.getCanDragAsset = getCanDragAsset;
123
+ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName, copyStaticFilePath, openAssetInExplorer, renameAsset, deleteAsset, fileExplorerDisabled, mutationsDisabled, }) => {
124
+ return [
125
+ (0, open_in_new_window_1.getOpenInNewWindowMenuItem)(`/assets/${relativePath}`),
126
+ {
127
+ type: 'divider',
128
+ id: 'open-in-new-window-divider',
129
+ },
130
+ {
131
+ id: 'copy-asset-file-name',
132
+ keyHint: null,
133
+ label: 'Copy file name',
134
+ leftItem: null,
135
+ onClick: copyFileName,
136
+ quickSwitcherLabel: 'Copy asset file name',
137
+ subMenu: null,
138
+ type: 'item',
139
+ value: 'copy-asset-file-name',
140
+ },
141
+ {
142
+ id: 'copy-asset-static-file-path',
143
+ keyHint: null,
144
+ label: 'Copy staticFile() path',
145
+ leftItem: null,
146
+ onClick: copyStaticFilePath,
147
+ quickSwitcherLabel: 'Copy staticFile() path',
148
+ subMenu: null,
149
+ type: 'item',
150
+ value: 'copy-asset-static-file-path',
151
+ },
152
+ {
153
+ type: 'divider',
154
+ id: 'asset-file-actions-divider',
155
+ },
156
+ {
157
+ id: 'open-asset-in-explorer',
158
+ keyHint: null,
159
+ label: `Show in ${fileManagerName}`,
160
+ leftItem: null,
161
+ onClick: openAssetInExplorer,
162
+ quickSwitcherLabel: `Show asset in ${fileManagerName}`,
163
+ subMenu: null,
164
+ type: 'item',
165
+ value: 'open-asset-in-explorer',
166
+ disabled: fileExplorerDisabled,
167
+ },
168
+ {
169
+ id: 'rename-asset',
170
+ keyHint: null,
171
+ label: 'Rename...',
172
+ leftItem: null,
173
+ onClick: renameAsset,
174
+ quickSwitcherLabel: 'Rename asset...',
175
+ subMenu: null,
176
+ type: 'item',
177
+ value: 'rename-asset',
178
+ disabled: mutationsDisabled,
179
+ },
180
+ {
181
+ id: 'delete-asset',
182
+ keyHint: null,
183
+ label: 'Delete...',
184
+ leftItem: null,
185
+ onClick: deleteAsset,
186
+ quickSwitcherLabel: 'Delete asset...',
187
+ subMenu: null,
188
+ type: 'item',
189
+ value: 'delete-asset',
190
+ disabled: mutationsDisabled,
191
+ },
192
+ ];
193
+ };
194
+ exports.getAssetContextMenuItems = getAssetContextMenuItems;
108
195
  const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, }) => {
109
196
  const [hovered, setHovered] = (0, react_1.useState)(false);
110
197
  const openFolderTimerRef = (0, react_1.useRef)(null);
@@ -199,7 +286,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
199
286
  return false;
200
287
  }, [canvasContent, relativePath]);
201
288
  const canDragAsset = (0, react_1.useMemo)(() => {
202
- return !readOnlyStudio && (0, import_assets_1.getAssetElementFromPath)(relativePath) !== null;
289
+ return (0, exports.getCanDragAsset)({ readOnlyStudio, relativePath });
203
290
  }, [readOnlyStudio, relativePath]);
204
291
  const onPointerLeave = (0, react_1.useCallback)(() => {
205
292
  setHovered(false);
@@ -313,7 +400,12 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
313
400
  (0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
314
401
  });
315
402
  }, [relativePath]);
316
- const serverActionDisabled = readOnlyStudio || connectionStatus !== 'connected';
403
+ const { mutationsDisabled, fileExplorerDisabled } = (0, exports.getAssetActionAvailability)({
404
+ browserStudioCanMutateAssets: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null ? null : true,
405
+ readOnlyStudio,
406
+ connectionStatus,
407
+ publicFolderExists: window.remotion_publicFolderExists,
408
+ });
317
409
  const deleteAsset = (0, react_1.useCallback)(() => {
318
410
  confirm({
319
411
  title: 'Delete asset',
@@ -338,90 +430,34 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
338
430
  (0, NotificationCenter_1.showNotification)(`Could not delete ${relativePath}: ${err.message}`, 3000);
339
431
  });
340
432
  }, [confirm, relativePath]);
433
+ const renameAsset = (0, react_1.useCallback)(() => {
434
+ setSelectedModal({
435
+ type: 'rename-static-file',
436
+ relativePath,
437
+ });
438
+ }, [relativePath, setSelectedModal]);
341
439
  const contextMenu = (0, react_1.useMemo)(() => {
342
- return [
343
- (0, open_in_new_window_1.getOpenInNewWindowMenuItem)(`/assets/${relativePath}`),
344
- {
345
- type: 'divider',
346
- id: 'open-in-new-window-divider',
347
- },
348
- {
349
- id: 'copy-asset-file-name',
350
- keyHint: null,
351
- label: 'Copy file name',
352
- leftItem: null,
353
- onClick: copyFileName,
354
- quickSwitcherLabel: 'Copy asset file name',
355
- subMenu: null,
356
- type: 'item',
357
- value: 'copy-asset-file-name',
358
- },
359
- {
360
- id: 'copy-asset-static-file-path',
361
- keyHint: null,
362
- label: 'Copy staticFile() path',
363
- leftItem: null,
364
- onClick: copyStaticFilePath,
365
- quickSwitcherLabel: 'Copy staticFile() path',
366
- subMenu: null,
367
- type: 'item',
368
- value: 'copy-asset-static-file-path',
369
- },
370
- {
371
- type: 'divider',
372
- id: 'asset-file-actions-divider',
373
- },
374
- {
375
- id: 'open-asset-in-explorer',
376
- keyHint: null,
377
- label: `Show in ${fileManagerName}`,
378
- leftItem: null,
379
- onClick: openAssetInExplorer,
380
- quickSwitcherLabel: `Show asset in ${fileManagerName}`,
381
- subMenu: null,
382
- type: 'item',
383
- value: 'open-asset-in-explorer',
384
- disabled: serverActionDisabled || window.remotion_publicFolderExists === null,
385
- },
386
- {
387
- id: 'rename-asset',
388
- keyHint: null,
389
- label: 'Rename...',
390
- leftItem: null,
391
- onClick: () => {
392
- setSelectedModal({
393
- type: 'rename-static-file',
394
- relativePath,
395
- });
396
- },
397
- quickSwitcherLabel: 'Rename asset...',
398
- subMenu: null,
399
- type: 'item',
400
- value: 'rename-asset',
401
- disabled: serverActionDisabled,
402
- },
403
- {
404
- id: 'delete-asset',
405
- keyHint: null,
406
- label: 'Delete...',
407
- leftItem: null,
408
- onClick: deleteAsset,
409
- quickSwitcherLabel: 'Delete asset...',
410
- subMenu: null,
411
- type: 'item',
412
- value: 'delete-asset',
413
- disabled: serverActionDisabled,
414
- },
415
- ];
440
+ return (0, exports.getAssetContextMenuItems)({
441
+ relativePath,
442
+ fileManagerName,
443
+ copyFileName,
444
+ copyStaticFilePath,
445
+ openAssetInExplorer,
446
+ renameAsset,
447
+ deleteAsset,
448
+ fileExplorerDisabled,
449
+ mutationsDisabled,
450
+ });
416
451
  }, [
417
452
  copyFileName,
418
453
  copyStaticFilePath,
419
454
  deleteAsset,
455
+ fileExplorerDisabled,
420
456
  fileManagerName,
457
+ mutationsDisabled,
421
458
  openAssetInExplorer,
459
+ renameAsset,
422
460
  relativePath,
423
- serverActionDisabled,
424
- setSelectedModal,
425
461
  ]);
426
462
  const revealInExplorer = (0, react_1.useCallback)((e) => {
427
463
  e.stopPropagation();
@@ -433,7 +469,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
433
469
  }, [copyStaticFilePath]);
434
470
  return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
435
471
  jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name }), hovered && !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
436
- jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), serverActionDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
472
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
437
473
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer })
438
474
  ] }))] })) : null] }) }) }));
439
475
  };
@@ -42,6 +42,7 @@ const ResetZoomButton_1 = require("./ResetZoomButton");
42
42
  const SvgImportDialog_1 = require("./SvgImportDialog");
43
43
  const imperative_state_1 = require("./Timeline/imperative-state");
44
44
  const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
45
+ const use_element_overwrite_confirmation_1 = require("./use-element-overwrite-confirmation");
45
46
  const elementInstallCompositionIdStyle = {
46
47
  fontFamily: 'monospace',
47
48
  fontSize: 13,
@@ -158,6 +159,7 @@ const Canvas = ({ canvasContent, size }) => {
158
159
  const touchPinchRef = (0, react_1.useRef)(null);
159
160
  const keybindings = (0, use_keybinding_1.useKeybinding)();
160
161
  const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
162
+ const confirmElementOverwrite = (0, use_element_overwrite_confirmation_1.useElementOverwriteConfirmation)();
161
163
  const chooseSvgImportMode = (0, SvgImportDialog_1.useSvgImportDialog)();
162
164
  const config = remotion_1.Internals.useUnsafeVideoConfig();
163
165
  const areRulersVisible = (0, use_is_ruler_visible_1.useIsRulerVisible)();
@@ -682,6 +684,7 @@ const Canvas = ({ canvasContent, size }) => {
682
684
  element: activeElementInstallRequest.element,
683
685
  compositionFile: activeElementInstallRequest.compositionFile,
684
686
  compositionId: activeElementInstallRequest.compositionId,
687
+ confirmOverwrite: confirmElementOverwrite,
685
688
  dropPosition: null,
686
689
  from: null,
687
690
  });
@@ -703,7 +706,7 @@ const Canvas = ({ canvasContent, size }) => {
703
706
  return () => {
704
707
  canceled = true;
705
708
  };
706
- }, [activeElementInstallRequest, confirm]);
709
+ }, [activeElementInstallRequest, confirm, confirmElementOverwrite]);
707
710
  const onDragOver = (0, react_1.useCallback)((event) => {
708
711
  var _a;
709
712
  var _b;
@@ -871,6 +874,7 @@ const Canvas = ({ canvasContent, size }) => {
871
874
  await (0, handle_drop_1.handleDrop)({
872
875
  chooseSvgImportMode,
873
876
  compositionFile,
877
+ confirmElementOverwrite,
874
878
  compositionId: currentCompositionId,
875
879
  destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
876
880
  dropPosition,
@@ -888,6 +892,7 @@ const Canvas = ({ canvasContent, size }) => {
888
892
  cannotAddSequence,
889
893
  chooseSvgImportMode,
890
894
  compositionFile,
895
+ confirmElementOverwrite,
891
896
  config,
892
897
  contentDimensions,
893
898
  currentCompositionId,
@@ -0,0 +1,10 @@
1
+ import type { Caption } from '@remotion/captions';
2
+ import React from 'react';
3
+ export declare const CaptionInspector: React.FC<{
4
+ readonly captions: Caption[];
5
+ readonly onTextChange: (captions: Caption[]) => void;
6
+ readonly onTextSave: ((captions: Caption[]) => void) | null;
7
+ readonly onTextCancel: (() => void) | null;
8
+ readonly readOnly: boolean;
9
+ readonly readOnlyTitle: string | null;
10
+ }>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaptionInspector = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const colors_1 = require("../helpers/colors");
6
+ const CaptionTextEditor_1 = require("./CaptionTextEditor");
7
+ const common_1 = require("./InspectorPanel/common");
8
+ const styles_1 = require("./InspectorPanel/styles");
9
+ const readOnlyStatus = {
10
+ color: colors_1.LIGHT_TEXT,
11
+ fontFamily: 'sans-serif',
12
+ fontSize: 12,
13
+ fontWeight: 'normal',
14
+ lineHeight: '16px',
15
+ marginLeft: 12,
16
+ };
17
+ const CaptionInspector = ({ captions, onTextChange, onTextSave, onTextCancel, readOnly, readOnlyTitle, }) => {
18
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
19
+ jsx_runtime_1.jsx(common_1.InspectorSectionDivider, {}), jsx_runtime_1.jsx(common_1.InspectorSectionHeader, { children: jsx_runtime_1.jsxs("div", { style: styles_1.sectionHeaderRow, children: [
20
+ jsx_runtime_1.jsx("div", { style: styles_1.sectionHeaderTitle, children: "Captions" }), jsx_runtime_1.jsx("div", { style: styles_1.sectionHeaderEnd, children: readOnly ? (jsx_runtime_1.jsx("div", { style: readOnlyStatus, title: readOnlyTitle !== null && readOnlyTitle !== void 0 ? readOnlyTitle : undefined, children: "Read only" })) : null })
21
+ ] }) }), jsx_runtime_1.jsx(CaptionTextEditor_1.CaptionTextEditor, { captions: captions, onChange: onTextChange, onSave: onTextSave, onCancel: onTextCancel, readOnly: readOnly })
22
+ ] }));
23
+ };
24
+ exports.CaptionInspector = CaptionInspector;
@@ -0,0 +1,9 @@
1
+ import type { Caption } from '@remotion/captions';
2
+ import React from 'react';
3
+ export declare const CaptionTextEditor: React.FC<{
4
+ readonly captions: Caption[];
5
+ readonly onChange: (captions: Caption[]) => void;
6
+ readonly onSave: ((captions: Caption[]) => void) | null;
7
+ readonly onCancel: (() => void) | null;
8
+ readonly readOnly: boolean;
9
+ }>;