@remotion/studio 4.0.517 → 4.0.519

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 (146) hide show
  1. package/dist/components/AppLaunchButton.d.ts +16 -0
  2. package/dist/components/AppLaunchButton.js +90 -0
  3. package/dist/components/AssetSelector.js +64 -22
  4. package/dist/components/AssetSelectorItem.d.ts +14 -1
  5. package/dist/components/AssetSelectorItem.js +219 -70
  6. package/dist/components/Button.js +20 -7
  7. package/dist/components/Canvas.js +109 -78
  8. package/dist/components/CanvasOrLoading.js +7 -7
  9. package/dist/components/CaptionTextEditor.js +32 -8
  10. package/dist/components/CodingAgentButton.d.ts +7 -0
  11. package/dist/components/CodingAgentButton.js +59 -0
  12. package/dist/components/CompositionContextButton.d.ts +1 -0
  13. package/dist/components/CompositionContextButton.js +7 -3
  14. package/dist/components/CompositionSelector.js +16 -11
  15. package/dist/components/CompositionSelectorItem.js +16 -23
  16. package/dist/components/ConfigureLicenseModal.js +4 -48
  17. package/dist/components/CurrentAsset.js +1 -1
  18. package/dist/components/EditorContent.js +6 -3
  19. package/dist/components/ElementInstallConfirmation.d.ts +25 -7
  20. package/dist/components/ElementInstallConfirmation.js +347 -30
  21. package/dist/components/ElementLibraryModal.js +3 -1
  22. package/dist/components/FixComputedValueModal.js +5 -131
  23. package/dist/components/InitialCompositionLoader.js +3 -2
  24. package/dist/components/InlineCaptionInspector.js +13 -2
  25. package/dist/components/InspectorOpenInEditor.js +48 -33
  26. package/dist/components/InspectorPanel/CompositionInspector.js +35 -3
  27. package/dist/components/InspectorPanel/CompositionInspectorHeader.js +22 -14
  28. package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +3 -1
  29. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +1 -1
  30. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +10 -5
  31. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
  32. package/dist/components/InspectorPanel/common.js +1 -0
  33. package/dist/components/InspectorPanel/styles.js +1 -0
  34. package/dist/components/InspectorSequenceSection.js +8 -3
  35. package/dist/components/InspectorSourceLocation.js +5 -1
  36. package/dist/components/KnownBugs.d.ts +1 -1
  37. package/dist/components/KnownBugs.js +1 -1
  38. package/dist/components/LicenseExplanation.d.ts +2 -0
  39. package/dist/components/LicenseExplanation.js +63 -0
  40. package/dist/components/MenuToolbar.js +7 -1
  41. package/dist/components/Modals.js +50 -2
  42. package/dist/components/NewComposition/InputDragger.js +29 -2
  43. package/dist/components/NewComposition/NewCompDuration.js +1 -1
  44. package/dist/components/NewComposition/NewComposition.d.ts +23 -0
  45. package/dist/components/NewComposition/NewComposition.js +217 -80
  46. package/dist/components/{UpdateModal/OpenIssueButton.js → OpenIssueButton.js} +1 -1
  47. package/dist/components/PlaybackRateSelector.js +2 -5
  48. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.d.ts +2 -0
  49. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +28 -7
  50. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +21 -13
  51. package/dist/components/RenderQueue/actions.d.ts +1 -0
  52. package/dist/components/RenderQueue/actions.js +5 -1
  53. package/dist/components/SelectedOutlineCanvasRotation.js +27 -1
  54. package/dist/components/SelectedOutlineElement.js +2 -1
  55. package/dist/components/SelectedOutlineOverlay.js +9 -10
  56. package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
  57. package/dist/components/SelectedOutlinePolygon.js +12 -4
  58. package/dist/components/SelectedOutlineRenderer.d.ts +1 -1
  59. package/dist/components/SelectedOutlineRenderer.js +33 -35
  60. package/dist/components/SettingsContext.js +2 -1
  61. package/dist/components/SettingsModal.d.ts +1 -1
  62. package/dist/components/SettingsModal.js +19 -3
  63. package/dist/components/SidebarRenderButton.d.ts +1 -0
  64. package/dist/components/SidebarRenderButton.js +15 -5
  65. package/dist/components/Timeline/SequencePropsObserver.js +29 -14
  66. package/dist/components/Timeline/TimelineKeyframeControls.js +3 -1
  67. package/dist/components/Timeline/TimelineRowChrome.js +4 -2
  68. package/dist/components/Timeline/TimelineSequence.js +40 -8
  69. package/dist/components/Timeline/TimelineSequenceItem.js +34 -1
  70. package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -0
  71. package/dist/components/Timeline/TimelineStack/get-stack.js +35 -3
  72. package/dist/components/Timeline/duplicate-selected-timeline-item.js +23 -25
  73. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -0
  74. package/dist/components/Timeline/get-sequence-context-menu-items.js +34 -1
  75. package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -0
  76. package/dist/components/Timeline/sequence-props-subscription-store.js +22 -1
  77. package/dist/components/Timeline/use-sequence-props-subscription.js +7 -0
  78. package/dist/components/TimelineCombobox.js +1 -0
  79. package/dist/components/UpdateCheck.d.ts +0 -8
  80. package/dist/components/UpdateCheck.js +7 -54
  81. package/dist/components/UpdateStatusContext.d.ts +18 -0
  82. package/dist/components/UpdateStatusContext.js +74 -0
  83. package/dist/components/UpdatesSettings.d.ts +2 -0
  84. package/dist/components/UpdatesSettings.js +251 -0
  85. package/dist/components/WebMcp.d.ts +2 -0
  86. package/dist/components/WebMcp.js +945 -0
  87. package/dist/components/composition-menu-items.js +26 -0
  88. package/dist/components/get-open-in-menu-items.d.ts +4 -0
  89. package/dist/components/get-open-in-menu-items.js +28 -24
  90. package/dist/components/root-composition-menu-items.d.ts +4 -1
  91. package/dist/components/root-composition-menu-items.js +38 -1
  92. package/dist/components/selected-outline-measurement.d.ts +11 -0
  93. package/dist/components/selected-outline-measurement.js +13 -5
  94. package/dist/components/use-configure-default-apps.d.ts +1 -0
  95. package/dist/components/use-configure-default-apps.js +24 -0
  96. package/dist/error-overlay/remotion-overlay/CodeFrame.js +5 -6
  97. package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +1 -1
  98. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +47 -18
  99. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +1 -1
  100. package/dist/error-overlay/remotion-overlay/ErrorTitle.js +5 -4
  101. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +48 -76
  102. package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +1 -1
  103. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -2
  104. package/dist/error-overlay/remotion-overlay/StackFrame.js +13 -8
  105. package/dist/error-overlay/remotion-overlay/Symbolicating.js +1 -1
  106. package/dist/esm/{chunk-gzqm3g2m.js → chunk-1fkq5bfq.js} +24093 -21093
  107. package/dist/esm/chunk-6jf1natv.js +25 -0
  108. package/dist/esm/{chunk-4bxz1d3g.js → chunk-je0h1bgt.js} +1 -28
  109. package/dist/esm/chunk-m0jqdbkr.js +14571 -0
  110. package/dist/esm/index.mjs +0 -2
  111. package/dist/esm/internals.mjs +43231 -25675
  112. package/dist/esm/previewEntry.mjs +46334 -28776
  113. package/dist/esm/renderEntry.mjs +6 -3
  114. package/dist/helpers/can-show-updates.d.ts +5 -0
  115. package/dist/helpers/can-show-updates.js +7 -0
  116. package/dist/helpers/colors.d.ts +0 -3
  117. package/dist/helpers/colors.js +2 -5
  118. package/dist/helpers/create-folder-tree.d.ts +5 -0
  119. package/dist/helpers/create-folder-tree.js +40 -2
  120. package/dist/helpers/format-file-location.d.ts +8 -0
  121. package/dist/helpers/format-file-location.js +14 -3
  122. package/dist/helpers/get-asset-metadata.js +1 -1
  123. package/dist/helpers/get-git-menu-item.d.ts +5 -0
  124. package/dist/helpers/get-git-menu-item.js +15 -1
  125. package/dist/helpers/get-timeline-max-zoom.d.ts +8 -0
  126. package/dist/helpers/get-timeline-max-zoom.js +17 -6
  127. package/dist/helpers/hoverable.d.ts +1 -0
  128. package/dist/helpers/hoverable.js +14 -6
  129. package/dist/helpers/open-in-editor.js +51 -1
  130. package/dist/helpers/preview-server-events.js +3 -0
  131. package/dist/helpers/timeline-layout.d.ts +0 -1
  132. package/dist/helpers/timeline-layout.js +1 -5
  133. package/dist/helpers/url-state.d.ts +1 -0
  134. package/dist/helpers/url-state.js +12 -5
  135. package/dist/icons/enter.d.ts +4 -0
  136. package/dist/icons/enter.js +10 -0
  137. package/dist/renderEntry.js +2 -0
  138. package/dist/state/folders.d.ts +3 -0
  139. package/dist/state/folders.js +40 -1
  140. package/dist/state/modals.d.ts +1 -6
  141. package/dist/state/playbackrate.d.ts +1 -0
  142. package/dist/state/playbackrate.js +4 -1
  143. package/package.json +17 -14
  144. package/dist/components/UpdateModal/UpdateModal.d.ts +0 -6
  145. package/dist/components/UpdateModal/UpdateModal.js +0 -104
  146. /package/dist/components/{UpdateModal/OpenIssueButton.d.ts → OpenIssueButton.d.ts} +0 -0
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.AssetFolderTree = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
36
+ exports.AssetFolderTree = exports.getAssetFolderContextMenuItems = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const studio_protocol_1 = require("@remotion/studio-protocol");
39
39
  const react_1 = require("react");
@@ -45,19 +45,21 @@ const colors_1 = require("../helpers/colors");
45
45
  const copy_text_1 = require("../helpers/copy-text");
46
46
  const get_file_manager_name_1 = require("../helpers/get-file-manager-name");
47
47
  const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
48
+ const hoverable_1 = require("../helpers/hoverable");
48
49
  const open_in_remotion_convert_1 = require("../helpers/open-in-remotion-convert");
49
50
  const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
50
51
  const url_state_1 = require("../helpers/url-state");
51
52
  const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-events"));
52
53
  const use_image_metadata_1 = require("../helpers/use-image-metadata");
53
54
  const use_media_metadata_1 = require("../helpers/use-media-metadata");
54
- const clipboard_1 = require("../icons/clipboard");
55
+ const ellipsis_1 = require("../icons/ellipsis");
55
56
  const folder_1 = require("../icons/folder");
56
57
  const modals_1 = require("../state/modals");
57
58
  const AssetFileIcon_1 = require("./AssetFileIcon");
58
59
  const ContextMenu_1 = require("./ContextMenu");
59
60
  const import_assets_1 = require("./import-assets");
60
61
  const InlineAction_1 = require("./InlineAction");
62
+ const InlineDropdown_1 = require("./InlineDropdown");
61
63
  const layout_1 = require("./layout");
62
64
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
63
65
  const open_in_new_window_1 = require("./open-in-new-window");
@@ -69,7 +71,6 @@ const iconStyle = {
69
71
  flexShrink: 0,
70
72
  };
71
73
  const itemStyle = {
72
- paddingRight: 10,
73
74
  paddingTop: 5,
74
75
  paddingBottom: 5,
75
76
  fontSize: 13,
@@ -84,7 +85,6 @@ const itemStyle = {
84
85
  borderRadius: 4,
85
86
  width: 'calc(100% - 4px)',
86
87
  textAlign: 'left',
87
- backgroundColor: colors_1.BACKGROUND,
88
88
  height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
89
89
  userSelect: 'none',
90
90
  WebkitUserSelect: 'none',
@@ -102,11 +102,24 @@ const revealIconStyle = {
102
102
  height: 12,
103
103
  color: colors_1.CURRENT_COLOR,
104
104
  };
105
+ const ellipsisIconStyle = {
106
+ style: {
107
+ height: 12,
108
+ },
109
+ };
110
+ const inlineActionsStyle = {
111
+ alignItems: 'center',
112
+ display: 'flex',
113
+ };
114
+ const renderContextMenuAction = (color) => {
115
+ return jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { svgProps: ellipsisIconStyle, fill: color });
116
+ };
105
117
  const getAssetActionAvailability = ({ browserStudioCanMutateAssets, readOnlyStudio, connectionStatus, publicFolderExists, }) => {
106
118
  return {
107
119
  mutationsDisabled: browserStudioCanMutateAssets !== true &&
108
120
  (readOnlyStudio || connectionStatus !== 'connected'),
109
- fileExplorerDisabled: publicFolderExists === null ||
121
+ fileExplorerDisabled: browserStudioCanMutateAssets !== null ||
122
+ publicFolderExists === null ||
110
123
  readOnlyStudio ||
111
124
  connectionStatus !== 'connected',
112
125
  };
@@ -116,7 +129,7 @@ const getCanDragAsset = ({ readOnlyStudio, relativePath, }) => {
116
129
  return !readOnlyStudio && (0, import_assets_1.getAssetElementFromPath)(relativePath) !== null;
117
130
  };
118
131
  exports.getCanDragAsset = getCanDragAsset;
119
- const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName, copyStaticFilePath, openAssetInConvert, openAssetInExplorer, renameAsset, deleteAsset, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }) => {
132
+ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName, copyStaticFilePath, copyAbsolutePath, openAssetInConvert, openAssetInExplorer, renameAsset, deleteAsset, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }) => {
120
133
  const previewFileType = (0, get_preview_file_type_1.getPreviewFileType)(relativePath);
121
134
  const canOpenInConvert = previewFileType === 'audio' || previewFileType === 'video';
122
135
  const items = [
@@ -160,6 +173,19 @@ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName,
160
173
  type: 'item',
161
174
  value: 'copy-asset-static-file-path',
162
175
  },
176
+ copyAbsolutePath
177
+ ? {
178
+ id: 'copy-asset-absolute-path',
179
+ keyHint: null,
180
+ label: 'Copy absolute path',
181
+ leftItem: null,
182
+ onClick: copyAbsolutePath,
183
+ quickSwitcherLabel: 'Copy asset absolute path',
184
+ subMenu: null,
185
+ type: 'item',
186
+ value: 'copy-asset-absolute-path',
187
+ }
188
+ : null,
163
189
  {
164
190
  type: 'divider',
165
191
  id: 'asset-file-actions-divider',
@@ -206,67 +232,191 @@ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName,
206
232
  return items.filter(no_react_1.NoReactInternals.truthy);
207
233
  };
208
234
  exports.getAssetContextMenuItems = getAssetContextMenuItems;
209
- const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, }) => {
210
- const [hovered, setHovered] = (0, react_1.useState)(false);
235
+ const getAssetFolderContextMenuItems = ({ folderPath, fileManagerName, copyFolderPath, copyAbsolutePath, openFolderInExplorer, uploadAssets, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }) => {
236
+ const items = [
237
+ fileExplorerAvailable
238
+ ? {
239
+ id: 'open-asset-folder-in-explorer',
240
+ keyHint: null,
241
+ label: `Show in ${fileManagerName}`,
242
+ leftItem: null,
243
+ onClick: openFolderInExplorer,
244
+ quickSwitcherLabel: `Show asset folder in ${fileManagerName}`,
245
+ subMenu: null,
246
+ type: 'item',
247
+ value: 'open-asset-folder-in-explorer',
248
+ disabled: fileExplorerDisabled,
249
+ }
250
+ : null,
251
+ {
252
+ id: 'copy-asset-folder-path',
253
+ keyHint: null,
254
+ label: 'Copy folder path',
255
+ leftItem: null,
256
+ onClick: copyFolderPath,
257
+ quickSwitcherLabel: 'Copy asset folder path',
258
+ subMenu: null,
259
+ type: 'item',
260
+ value: 'copy-asset-folder-path',
261
+ },
262
+ copyAbsolutePath
263
+ ? {
264
+ id: 'copy-asset-folder-absolute-path',
265
+ keyHint: null,
266
+ label: 'Copy absolute path',
267
+ leftItem: null,
268
+ onClick: copyAbsolutePath,
269
+ quickSwitcherLabel: 'Copy asset folder absolute path',
270
+ subMenu: null,
271
+ type: 'item',
272
+ value: 'copy-asset-folder-absolute-path',
273
+ }
274
+ : null,
275
+ {
276
+ type: 'divider',
277
+ id: 'asset-folder-upload-divider',
278
+ },
279
+ {
280
+ id: 'upload-assets-to-folder',
281
+ keyHint: null,
282
+ label: 'Upload...',
283
+ leftItem: null,
284
+ onClick: uploadAssets,
285
+ quickSwitcherLabel: `Upload assets to ${folderPath}...`,
286
+ subMenu: null,
287
+ type: 'item',
288
+ value: 'upload-assets-to-folder',
289
+ disabled: mutationsDisabled,
290
+ },
291
+ ];
292
+ return items.filter(no_react_1.NoReactInternals.truthy);
293
+ };
294
+ exports.getAssetFolderContextMenuItems = getAssetFolderContextMenuItems;
295
+ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, uploadAssets, }) => {
211
296
  const openFolderTimerRef = (0, react_1.useRef)(null);
297
+ const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
298
+ .previewServerState.type;
299
+ const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
300
+ const folderPath = (0, react_1.useMemo)(() => {
301
+ return parentFolder ? `${parentFolder}/${item.name}` : item.name;
302
+ }, [item.name, parentFolder]);
212
303
  const { isDropDiv, onDragEnter, onDragLeave } = (0, use_asset_drag_events_1.default)({
213
304
  name: item.name,
214
305
  parentFolder,
215
306
  dropLocation,
216
307
  setDropLocation,
217
308
  });
218
- const onPointerEnter = (0, react_1.useCallback)(() => {
219
- setHovered(true);
220
- }, []);
221
- const onPointerLeave = (0, react_1.useCallback)(() => {
222
- setHovered(false);
223
- }, []);
224
309
  const folderStyle = (0, react_1.useMemo)(() => {
225
310
  return {
226
311
  ...itemStyle,
227
312
  paddingLeft: 4 + level * 8,
228
- backgroundColor: hovered ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
229
- };
230
- }, [hovered, level]);
231
- const label = (0, react_1.useMemo)(() => {
232
- return {
233
- ...labelStyle,
234
- color: hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT,
313
+ ...(0, hoverable_1.hoverableStyle)({
314
+ idleBackground: colors_1.TRANSPARENT,
315
+ hoverBackground: colors_1.WHITE_ALPHA_06,
316
+ idleColor: colors_1.LIGHT_TEXT,
317
+ hoverColor: colors_1.WHITE,
318
+ }),
235
319
  };
236
- }, [hovered]);
320
+ }, [level]);
237
321
  const onClick = (0, react_1.useCallback)(() => {
238
322
  toggleFolder(item.name, parentFolder);
239
323
  }, [item.name, parentFolder, toggleFolder]);
324
+ const copyFolderPath = (0, react_1.useCallback)(() => {
325
+ (0, copy_text_1.copyText)(folderPath)
326
+ .then(() => {
327
+ (0, NotificationCenter_1.showNotification)(`Copied '${folderPath}' to clipboard`, 1000);
328
+ })
329
+ .catch((err) => {
330
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
331
+ });
332
+ }, [folderPath]);
333
+ const copyAbsolutePath = (0, react_1.useCallback)(() => {
334
+ if (window.remotion_publicFolderExists === null) {
335
+ return;
336
+ }
337
+ const content = `${window.remotion_publicFolderExists}/${folderPath}`;
338
+ (0, copy_text_1.copyText)(content)
339
+ .then(() => {
340
+ (0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
341
+ })
342
+ .catch((err) => {
343
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
344
+ });
345
+ }, [folderPath]);
346
+ const openFolderInExplorer = (0, react_1.useCallback)(() => {
347
+ if (!window.remotion_publicFolderExists) {
348
+ (0, NotificationCenter_1.showNotification)('Could not find the public folder', 2000);
349
+ return;
350
+ }
351
+ (0, actions_1.openInFileExplorer)({
352
+ directory: `${window.remotion_publicFolderExists}/${folderPath}`,
353
+ }).catch((err) => {
354
+ (0, NotificationCenter_1.showNotification)(`Could not open folder: ${err.message}`, 2000);
355
+ });
356
+ }, [folderPath]);
357
+ const uploadAssetsToFolder = (0, react_1.useCallback)(() => {
358
+ uploadAssets(folderPath);
359
+ }, [folderPath, uploadAssets]);
360
+ const { mutationsDisabled, fileExplorerDisabled } = (0, exports.getAssetActionAvailability)({
361
+ browserStudioCanMutateAssets: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null ? null : true,
362
+ readOnlyStudio,
363
+ connectionStatus,
364
+ publicFolderExists: window.remotion_publicFolderExists,
365
+ });
366
+ const getContextMenuItems = (0, react_1.useCallback)(() => {
367
+ return (0, exports.getAssetFolderContextMenuItems)({
368
+ folderPath,
369
+ fileManagerName,
370
+ copyFolderPath,
371
+ copyAbsolutePath: window.remotion_publicFolderExists === null ? null : copyAbsolutePath,
372
+ openFolderInExplorer,
373
+ uploadAssets: uploadAssetsToFolder,
374
+ fileExplorerAvailable: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null,
375
+ fileExplorerDisabled,
376
+ mutationsDisabled,
377
+ });
378
+ }, [
379
+ copyAbsolutePath,
380
+ copyFolderPath,
381
+ fileExplorerDisabled,
382
+ fileManagerName,
383
+ folderPath,
384
+ mutationsDisabled,
385
+ openFolderInExplorer,
386
+ uploadAssetsToFolder,
387
+ ]);
240
388
  const Icon = item.expanded ? folder_1.ExpandedFolderIcon : folder_1.CollapsedFolderIcon;
241
389
  return (jsx_runtime_1.jsxs("div", { onDragEnter: onDragEnter, onDragLeave: onDragLeave, style: {
242
390
  backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
243
391
  }, children: [
244
- jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
245
- if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
246
- return;
247
- }
248
- if (!item.expanded) {
249
- openFolderTimerRef.current = window.setTimeout(() => {
250
- toggleFolder(item.name, parentFolder);
251
- }, 1000);
252
- }
253
- }, onDragLeave: (event) => {
254
- if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
255
- return;
256
- }
257
- if (openFolderTimerRef.current) {
258
- clearTimeout(openFolderTimerRef.current);
259
- }
260
- }, children: jsx_runtime_1.jsxs(layout_1.Row, { children: [
261
- jsx_runtime_1.jsx(Icon, { style: iconStyle, color: hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name })
262
- ] }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, item.name)) : null] }));
392
+ jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: folderStyle, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.HOVER_GROUP_CLASS_NAME}`, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
393
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
394
+ return;
395
+ }
396
+ if (!item.expanded) {
397
+ openFolderTimerRef.current = window.setTimeout(() => {
398
+ toggleFolder(item.name, parentFolder);
399
+ }, 1000);
400
+ }
401
+ }, onDragLeave: (event) => {
402
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
403
+ return;
404
+ }
405
+ if (openFolderTimerRef.current) {
406
+ clearTimeout(openFolderTimerRef.current);
407
+ }
408
+ }, children: [
409
+ jsx_runtime_1.jsx(Icon, { style: iconStyle, color: colors_1.CURRENT_COLOR }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: item.name }), jsx_runtime_1.jsxs("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: inlineActionsStyle, children: [
410
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { variant: null, title: "More actions", renderAction: renderContextMenuAction, getItems: getContextMenuItems, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME })
411
+ ] })
412
+ ] }) }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }, item.name)) : null] }));
263
413
  };
264
- const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, }) => {
414
+ const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, uploadAssets, }) => {
265
415
  const combinedParents = (0, react_1.useMemo)(() => {
266
416
  return [parentFolder, name].filter(no_react_1.NoReactInternals.truthy).join('/');
267
417
  }, [name, parentFolder]);
268
418
  return (jsx_runtime_1.jsxs("div", { children: [item.folders.map((folder) => {
269
- return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, folder.name));
419
+ return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }, folder.name));
270
420
  }), item.files.map((file) => {
271
421
  return (jsx_runtime_1.jsx(AssetSelectorItem, { item: file, tabIndex: tabIndex, level: level, parentFolder: combinedParents, readOnlyStudio: readOnlyStudio }, file.src));
272
422
  })] }));
@@ -274,14 +424,10 @@ const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabInd
274
424
  exports.AssetFolderTree = AssetFolderTree;
275
425
  const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
276
426
  const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
277
- const [hovered, setHovered] = (0, react_1.useState)(false);
278
427
  const [isDragging, setIsDragging] = (0, react_1.useState)(false);
279
428
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
280
429
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
281
430
  .previewServerState.type;
282
- const onPointerEnter = (0, react_1.useCallback)(() => {
283
- setHovered(true);
284
- }, []);
285
431
  const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
286
432
  const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
287
433
  const relativePath = (0, react_1.useMemo)(() => {
@@ -299,9 +445,6 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
299
445
  const canDragAsset = (0, react_1.useMemo)(() => {
300
446
  return (0, exports.getCanDragAsset)({ readOnlyStudio, relativePath });
301
447
  }, [readOnlyStudio, relativePath]);
302
- const onPointerLeave = (0, react_1.useCallback)(() => {
303
- setHovered(false);
304
- }, []);
305
448
  const rowRef = (0, react_1.useRef)(null);
306
449
  (0, react_1.useLayoutEffect)(() => {
307
450
  (0, sidebar_scroll_into_view_1.maybeScrollAssetSidebarRowIntoView)({
@@ -356,23 +499,18 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
356
499
  const style = (0, react_1.useMemo)(() => {
357
500
  return {
358
501
  ...itemStyle,
359
- color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
360
- backgroundColor: hovered || selected ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
502
+ ...(0, hoverable_1.hoverableStyle)({
503
+ idleBackground: selected ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
504
+ hoverBackground: colors_1.WHITE_ALPHA_06,
505
+ idleColor: selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
506
+ hoverColor: colors_1.WHITE,
507
+ }),
361
508
  paddingLeft: 12 + level * 8,
362
509
  };
363
- }, [hovered, level, selected]);
364
- const label = (0, react_1.useMemo)(() => {
365
- return {
366
- ...labelStyle,
367
- color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
368
- };
369
- }, [hovered, selected]);
510
+ }, [level, selected]);
370
511
  const renderFileExplorerAction = (0, react_1.useCallback)((color) => {
371
512
  return jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: revealIconStyle, color: color });
372
513
  }, []);
373
- const renderCopyAction = (0, react_1.useCallback)((color) => {
374
- return jsx_runtime_1.jsx(clipboard_1.ClipboardIcon, { style: revealIconStyle, color: color });
375
- }, []);
376
514
  const copyFileName = (0, react_1.useCallback)(() => {
377
515
  (0, copy_text_1.copyText)(item.name)
378
516
  .then(() => {
@@ -392,6 +530,19 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
392
530
  (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
393
531
  });
394
532
  }, [relativePath]);
533
+ const copyAbsolutePath = (0, react_1.useCallback)(() => {
534
+ if (window.remotion_publicFolderExists === null) {
535
+ return;
536
+ }
537
+ const content = `${window.remotion_publicFolderExists}/${relativePath}`;
538
+ (0, copy_text_1.copyText)(content)
539
+ .then(() => {
540
+ (0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
541
+ })
542
+ .catch((err) => {
543
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
544
+ });
545
+ }, [relativePath]);
395
546
  const openAssetInConvert = (0, react_1.useCallback)(() => {
396
547
  (0, open_in_remotion_convert_1.openInRemotionConvert)({ relativePath });
397
548
  }, [relativePath]);
@@ -425,6 +576,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
425
576
  fileManagerName,
426
577
  copyFileName,
427
578
  copyStaticFilePath,
579
+ copyAbsolutePath: window.remotion_publicFolderExists === null ? null : copyAbsolutePath,
428
580
  openAssetInConvert,
429
581
  openAssetInExplorer,
430
582
  renameAsset,
@@ -436,6 +588,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
436
588
  }, [
437
589
  copyFileName,
438
590
  copyStaticFilePath,
591
+ copyAbsolutePath,
439
592
  deleteAsset,
440
593
  fileExplorerDisabled,
441
594
  fileManagerName,
@@ -449,13 +602,9 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
449
602
  e.stopPropagation();
450
603
  openAssetInExplorer();
451
604
  }, [openAssetInExplorer]);
452
- const copyToClipboard = (0, react_1.useCallback)((e) => {
453
- e.stopPropagation();
454
- copyStaticFilePath();
455
- }, [copyStaticFilePath]);
456
- return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, 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: [
457
- jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: hovered || selected ? colors_1.WHITE : 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: [
458
- jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
459
- jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer })
605
+ return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.HOVER_GROUP_CLASS_NAME}`, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
606
+ jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: colors_1.CURRENT_COLOR }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: item.name }), !isDragging ? (jsx_runtime_1.jsxs("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: inlineActionsStyle, children: [
607
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { variant: null, title: "More actions", renderAction: renderContextMenuAction, getItems: getContextMenuItems, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
608
+ jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME })
460
609
  ] }))] })) : null] }) }) }));
461
610
  };
@@ -4,35 +4,48 @@ exports.Button = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../helpers/colors");
7
+ const hoverable_1 = require("../helpers/hoverable");
7
8
  const button = {
8
- border: `1px solid ${colors_1.BLACK_ALPHA_60}`,
9
- borderRadius: 4,
10
- backgroundColor: colors_1.INPUT_BACKGROUND,
11
9
  appearance: 'none',
10
+ border: 'none',
11
+ borderRadius: 6,
12
+ cursor: 'default',
12
13
  fontFamily: 'inherit',
13
14
  fontSize: 14,
14
- color: colors_1.WHITE,
15
15
  flexDirection: 'row',
16
+ margin: 0,
17
+ padding: 0,
16
18
  };
17
19
  const ButtonRefForwardFunction = ({ children, onClick, title, disabled, size = 'default', style, id, autoFocus, buttonContainerStyle, onPointerDown, }, ref) => {
18
20
  const combined = (0, react_1.useMemo)(() => {
21
+ var _a, _b;
22
+ const idleBackground = (_a = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _a !== void 0 ? _a : colors_1.TRANSPARENT;
23
+ const idleColor = (_b = style === null || style === void 0 ? void 0 : style.color) !== null && _b !== void 0 ? _b : colors_1.LIGHT_TEXT;
19
24
  return {
20
25
  ...button,
26
+ ...(0, hoverable_1.hoverableStyle)({
27
+ idleBackground,
28
+ hoverBackground: disabled || (style === null || style === void 0 ? void 0 : style.backgroundColor)
29
+ ? idleBackground
30
+ : (0, colors_1.getBackgroundFromHoverState)({ hovered: true, selected: false }),
31
+ idleColor,
32
+ hoverColor: disabled || (style === null || style === void 0 ? void 0 : style.color) ? idleColor : colors_1.WHITE,
33
+ }),
21
34
  ...(size === 'compact' ? { fontSize: 12 } : null),
22
35
  ...(size === 'condensed' ? { fontSize: 11 } : null),
23
36
  ...(style !== null && style !== void 0 ? style : {}),
24
37
  };
25
- }, [size, style]);
38
+ }, [disabled, size, style]);
26
39
  const buttonContainer = (0, react_1.useMemo)(() => {
27
40
  return {
28
41
  padding: size === 'condensed' ? '2px 7px' : size === 'compact' ? '5px 8px' : 10,
29
- cursor: disabled ? 'inherit' : 'pointer',
42
+ cursor: 'default',
30
43
  fontSize: size === 'condensed' ? 11 : size === 'compact' ? 12 : 14,
31
44
  lineHeight: size === 'condensed' ? '14px' : size === 'compact' ? '14px' : undefined,
32
45
  opacity: disabled ? 0.7 : 1,
33
46
  ...(buttonContainerStyle !== null && buttonContainerStyle !== void 0 ? buttonContainerStyle : {}),
34
47
  };
35
48
  }, [buttonContainerStyle, disabled, size]);
36
- return (jsx_runtime_1.jsx("button", { ref: ref, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
49
+ return (jsx_runtime_1.jsx("button", { ref: ref, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
37
50
  };
38
51
  exports.Button = (0, react_1.forwardRef)(ButtonRefForwardFunction);