@remotion/studio 4.0.525 → 4.0.526

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 (141) hide show
  1. package/dist/api/focus-default-props-path.js +7 -1
  2. package/dist/api/restart-studio.d.ts +1 -1
  3. package/dist/api/restart-studio.js +1 -1
  4. package/dist/components/AgentPrompt.d.ts +6 -0
  5. package/dist/components/AgentPrompt.js +107 -0
  6. package/dist/components/AssetFileIcon.js +2 -0
  7. package/dist/components/AssetSelectorItem.d.ts +1 -23
  8. package/dist/components/AssetSelectorItem.js +10 -200
  9. package/dist/components/Canvas.js +21 -18
  10. package/dist/components/CaptionInspector.js +9 -3
  11. package/dist/{error-overlay/remotion-overlay → components}/CodeFrame.d.ts +2 -0
  12. package/dist/components/CodeFrame.js +77 -0
  13. package/dist/components/CompositionSelectorItem.js +6 -17
  14. package/dist/components/CurrentAsset.js +5 -4
  15. package/dist/components/ElementInstallConfirmation.js +69 -38
  16. package/dist/components/FilePreview.js +4 -0
  17. package/dist/components/FixComputedValueModal.js +64 -96
  18. package/dist/components/GenerateWithAgentModal.d.ts +9 -0
  19. package/dist/components/GenerateWithAgentModal.js +39 -0
  20. package/dist/components/InlineEditableTitle.js +2 -0
  21. package/dist/components/InspectorOpenInEditor.js +8 -4
  22. package/dist/components/InspectorPanel/CollapsibleInspectorSection.d.ts +7 -0
  23. package/dist/components/InspectorPanel/CollapsibleInspectorSection.js +14 -0
  24. package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.d.ts +1 -1
  25. package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.js +19 -8
  26. package/dist/components/InspectorPanel/CompositionInspector.js +30 -13
  27. package/dist/components/InspectorPanel/CompositionMetadata.js +3 -0
  28. package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +6 -12
  29. package/dist/components/InspectorPanel/ElementLibraryButton.js +1 -0
  30. package/dist/components/InspectorPanel/GuideInspector.js +2 -3
  31. package/dist/components/InspectorPanel/KeyframeSettings.js +5 -6
  32. package/dist/components/InspectorPanel/MultiSequenceInspector.js +2 -1
  33. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -3
  34. package/dist/components/InspectorPanel/common.d.ts +4 -0
  35. package/dist/components/InspectorPanel/common.js +14 -2
  36. package/dist/components/InspectorPanel/styles.d.ts +0 -3
  37. package/dist/components/InspectorPanel/styles.js +1 -27
  38. package/dist/components/InspectorPanel/use-composition-actions.d.ts +2 -0
  39. package/dist/components/InspectorPanel/use-composition-actions.js +15 -0
  40. package/dist/components/InspectorPanel/use-inspector-section-expanded.d.ts +1 -0
  41. package/dist/components/InspectorPanel/use-inspector-section-expanded.js +21 -0
  42. package/dist/components/InspectorSequenceSection.js +44 -35
  43. package/dist/components/InspectorSourceLocation.js +1 -0
  44. package/dist/components/KeyboardShortcutsSettings.js +12 -4
  45. package/dist/components/LutPreview.d.ts +4 -0
  46. package/dist/components/LutPreview.js +192 -0
  47. package/dist/components/MenuCompositionName.js +4 -9
  48. package/dist/components/Modals.js +3 -6
  49. package/dist/components/ModelsSettings.js +15 -4
  50. package/dist/components/Notifications/NotificationCenter.d.ts +0 -1
  51. package/dist/components/Notifications/NotificationCenter.js +1 -22
  52. package/dist/components/QuickSwitcher/QuickSwitcherResult.js +4 -9
  53. package/dist/components/RenderModal/SchemaEditor/scroll-to-default-props-path.d.ts +1 -0
  54. package/dist/components/RenderModal/SchemaEditor/scroll-to-default-props-path.js +2 -1
  55. package/dist/components/RenderModal/WebRenderModal.js +10 -2
  56. package/dist/components/RendersTab.js +2 -0
  57. package/dist/components/SelectedOutlineElement.js +6 -0
  58. package/dist/components/SettingsButton.js +11 -2
  59. package/dist/components/SettingsModal.d.ts +1 -2
  60. package/dist/components/SettingsModal.js +24 -6
  61. package/dist/components/SettingsModalFooter.js +17 -3
  62. package/dist/components/SkillsSettings.d.ts +5 -0
  63. package/dist/components/SkillsSettings.js +29 -26
  64. package/dist/components/Timeline/Timeline.js +10 -11
  65. package/dist/components/Timeline/TimelineAssetField.js +81 -51
  66. package/dist/components/Timeline/TimelineHeightContainer.js +11 -1
  67. package/dist/components/Timeline/TimelineKeyframeControls.js +15 -1
  68. package/dist/components/Timeline/TimelineLayerChildren.d.ts +3 -3
  69. package/dist/components/Timeline/TimelineLayerChildren.js +11 -9
  70. package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -1
  71. package/dist/components/Timeline/TimelineLayerEye.js +6 -3
  72. package/dist/components/Timeline/TimelineList.js +9 -3
  73. package/dist/components/Timeline/TimelineSchemaField.js +2 -6
  74. package/dist/components/Timeline/TimelineSelection.d.ts +14 -3
  75. package/dist/components/Timeline/TimelineSelection.js +91 -49
  76. package/dist/components/Timeline/TimelineSequence.js +2 -2
  77. package/dist/components/Timeline/TimelineSequenceItem.d.ts +2 -0
  78. package/dist/components/Timeline/TimelineSequenceItem.js +17 -13
  79. package/dist/components/Timeline/TimelineVirtualization.d.ts +3 -3
  80. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +3 -1
  81. package/dist/components/Timeline/get-sequence-context-menu-items.js +130 -45
  82. package/dist/components/Timeline/normalize-font-weight-for-keyframe.d.ts +1 -0
  83. package/dist/components/Timeline/normalize-font-weight-for-keyframe.js +19 -0
  84. package/dist/components/Timeline/timeline-display-groups.d.ts +9 -0
  85. package/dist/components/Timeline/timeline-display-groups.js +66 -0
  86. package/dist/components/Timeline/use-timeline-asset-drop.js +21 -21
  87. package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +2 -1
  88. package/dist/components/Timeline/use-timeline-expanded-tree.js +1 -2
  89. package/dist/components/UpdateStatusContext.d.ts +2 -2
  90. package/dist/components/UpdateStatusContext.js +6 -7
  91. package/dist/components/UpdatesSettings.js +6 -6
  92. package/dist/components/WebMcp.js +40 -41
  93. package/dist/components/asset-context-menu.d.ts +32 -0
  94. package/dist/components/asset-context-menu.js +242 -0
  95. package/dist/components/composition-menu-items.d.ts +4 -6
  96. package/dist/components/composition-menu-items.js +191 -75
  97. package/dist/components/get-open-in-menu-items.d.ts +6 -5
  98. package/dist/components/get-open-in-menu-items.js +15 -9
  99. package/dist/components/selected-outline-order.js +18 -12
  100. package/dist/components/use-open-in-menu-apps.d.ts +14 -0
  101. package/dist/components/use-open-in-menu-apps.js +33 -0
  102. package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +2 -2
  103. package/dist/error-overlay/remotion-overlay/OpenInEditor.d.ts +1 -0
  104. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +3 -3
  105. package/dist/error-overlay/remotion-overlay/StackFrame.d.ts +5 -1
  106. package/dist/error-overlay/remotion-overlay/StackFrame.js +26 -19
  107. package/dist/esm/{LazyModels-gfmpcy4h.mjs → LazyModels-mtggyjye.mjs} +3 -3
  108. package/dist/esm/{LazyModels-m1rf06wh.mjs → LazyModels-nk7py0zt.mjs} +3 -3
  109. package/dist/esm/{TranscriptionModal-8pvrehg4.mjs → TranscriptionModal-ymnx1c7m.mjs} +6 -6
  110. package/dist/esm/{VideoMattingModal-fefbzgka.mjs → VideoMattingModal-05vpczks.mjs} +6 -6
  111. package/dist/esm/{index-s848rffx.mjs → index-0gewwxse.mjs} +5330 -4668
  112. package/dist/esm/{index-tzxb8808.mjs → index-4dsz9035.mjs} +8 -8
  113. package/dist/esm/{index-hbezgbbq.mjs → index-5bfxbpca.mjs} +1 -1
  114. package/dist/esm/{index-vsxrxfpj.mjs → index-5gd8k9yv.mjs} +1 -1
  115. package/dist/esm/{index-ggqpre9v.mjs → index-bs39wngg.mjs} +4216 -3571
  116. package/dist/esm/{index-0x13f28h.mjs → index-cdy8v54v.mjs} +1 -1
  117. package/dist/esm/{index-41kqns5c.mjs → index-eb5txqp6.mjs} +8 -7
  118. package/dist/esm/{index-1089795y.mjs → index-f97r9e2g.mjs} +4 -21
  119. package/dist/esm/{index-jrw61pkj.mjs → index-g7k2dvar.mjs} +1 -1
  120. package/dist/esm/{index-mww32xc8.mjs → index-x40wwfmt.mjs} +3 -3
  121. package/dist/esm/index.mjs +12 -6
  122. package/dist/esm/internals.mjs +7 -7
  123. package/dist/esm/previewEntry.mjs +7 -7
  124. package/dist/helpers/client-id.d.ts +1 -0
  125. package/dist/helpers/client-id.js +8 -4
  126. package/dist/helpers/cube-lut.d.ts +12 -0
  127. package/dist/helpers/cube-lut.js +160 -0
  128. package/dist/helpers/get-preview-file-type.d.ts +1 -1
  129. package/dist/helpers/get-preview-file-type.js +3 -0
  130. package/dist/helpers/open-in-editor.d.ts +5 -2
  131. package/dist/helpers/open-in-editor.js +12 -4
  132. package/dist/helpers/settings-tab-availability.d.ts +14 -0
  133. package/dist/helpers/settings-tab-availability.js +35 -0
  134. package/dist/helpers/use-menu-structure.js +16 -12
  135. package/dist/icons/lut.d.ts +4 -0
  136. package/dist/icons/lut.js +6 -0
  137. package/dist/icons/sparkles.d.ts +4 -0
  138. package/dist/icons/sparkles.js +6 -0
  139. package/dist/state/modals.d.ts +12 -2
  140. package/package.json +19 -19
  141. package/dist/error-overlay/remotion-overlay/CodeFrame.js +0 -62
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAssetContextMenuItems = exports.getAssetContextMenuItems = exports.getAssetActionAvailability = void 0;
4
+ const react_1 = require("react");
5
+ const no_react_1 = require("remotion/no-react");
6
+ const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
7
+ const client_id_1 = require("../helpers/client-id");
8
+ const copy_text_1 = require("../helpers/copy-text");
9
+ const get_file_manager_name_1 = require("../helpers/get-file-manager-name");
10
+ const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
11
+ const open_in_remotion_convert_1 = require("../helpers/open-in-remotion-convert");
12
+ const modals_1 = require("../state/modals");
13
+ const NotificationCenter_1 = require("./Notifications/NotificationCenter");
14
+ const open_in_new_window_1 = require("./open-in-new-window");
15
+ const actions_1 = require("./RenderQueue/actions");
16
+ const use_delete_asset_1 = require("./use-delete-asset");
17
+ const getAssetActionAvailability = ({ browserStudioCanMutateAssets, readOnlyStudio, connectionStatus, publicFolderExists, }) => {
18
+ return {
19
+ mutationsDisabled: browserStudioCanMutateAssets !== true &&
20
+ (readOnlyStudio || connectionStatus !== 'connected'),
21
+ fileExplorerDisabled: browserStudioCanMutateAssets !== null ||
22
+ publicFolderExists === null ||
23
+ readOnlyStudio ||
24
+ connectionStatus !== 'connected',
25
+ };
26
+ };
27
+ exports.getAssetActionAvailability = getAssetActionAvailability;
28
+ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName, copyStaticFilePath, copyAbsolutePath, openAssetInConvert, openAssetInExplorer, renameAsset, deleteAsset, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }) => {
29
+ const previewFileType = (0, get_preview_file_type_1.getPreviewFileType)(relativePath);
30
+ const canOpenInConvert = previewFileType === 'audio' || previewFileType === 'video';
31
+ const items = [
32
+ (0, open_in_new_window_1.getOpenInNewWindowMenuItem)(`/assets/${relativePath}`),
33
+ canOpenInConvert
34
+ ? {
35
+ id: 'open-asset-in-convert',
36
+ keyHint: null,
37
+ label: 'Open in Remotion Convert',
38
+ leftItem: null,
39
+ onClick: openAssetInConvert,
40
+ quickSwitcherLabel: 'Open asset in Remotion Convert',
41
+ subMenu: null,
42
+ type: 'item',
43
+ value: 'open-asset-in-convert',
44
+ }
45
+ : null,
46
+ {
47
+ type: 'divider',
48
+ id: 'open-in-new-window-divider',
49
+ },
50
+ {
51
+ id: 'copy-asset-file-name',
52
+ keyHint: null,
53
+ label: 'Copy file name',
54
+ leftItem: null,
55
+ onClick: copyFileName,
56
+ quickSwitcherLabel: 'Copy asset file name',
57
+ subMenu: null,
58
+ type: 'item',
59
+ value: 'copy-asset-file-name',
60
+ },
61
+ {
62
+ id: 'copy-asset-static-file-path',
63
+ keyHint: null,
64
+ label: 'Copy staticFile() path',
65
+ leftItem: null,
66
+ onClick: copyStaticFilePath,
67
+ quickSwitcherLabel: 'Copy staticFile() path',
68
+ subMenu: null,
69
+ type: 'item',
70
+ value: 'copy-asset-static-file-path',
71
+ },
72
+ copyAbsolutePath
73
+ ? {
74
+ id: 'copy-asset-absolute-path',
75
+ keyHint: null,
76
+ label: 'Copy absolute path',
77
+ leftItem: null,
78
+ onClick: copyAbsolutePath,
79
+ quickSwitcherLabel: 'Copy asset absolute path',
80
+ subMenu: null,
81
+ type: 'item',
82
+ value: 'copy-asset-absolute-path',
83
+ }
84
+ : null,
85
+ {
86
+ type: 'divider',
87
+ id: 'asset-file-actions-divider',
88
+ },
89
+ fileExplorerAvailable
90
+ ? {
91
+ id: 'open-asset-in-explorer',
92
+ keyHint: null,
93
+ label: `Show in ${fileManagerName}`,
94
+ leftItem: null,
95
+ onClick: openAssetInExplorer,
96
+ quickSwitcherLabel: `Show asset in ${fileManagerName}`,
97
+ subMenu: null,
98
+ type: 'item',
99
+ value: 'open-asset-in-explorer',
100
+ disabled: fileExplorerDisabled,
101
+ }
102
+ : null,
103
+ {
104
+ id: 'rename-asset',
105
+ keyHint: null,
106
+ label: 'Rename...',
107
+ leftItem: null,
108
+ onClick: renameAsset,
109
+ quickSwitcherLabel: 'Rename asset...',
110
+ subMenu: null,
111
+ type: 'item',
112
+ value: 'rename-asset',
113
+ disabled: mutationsDisabled,
114
+ },
115
+ {
116
+ id: 'delete-asset',
117
+ keyHint: null,
118
+ label: 'Delete...',
119
+ leftItem: null,
120
+ onClick: deleteAsset,
121
+ quickSwitcherLabel: 'Delete asset...',
122
+ subMenu: null,
123
+ type: 'item',
124
+ value: 'delete-asset',
125
+ disabled: mutationsDisabled,
126
+ },
127
+ ];
128
+ return items.filter(no_react_1.NoReactInternals.truthy);
129
+ };
130
+ exports.getAssetContextMenuItems = getAssetContextMenuItems;
131
+ const useAssetContextMenuItems = ({ relativePath, readOnlyStudio, }) => {
132
+ var _a;
133
+ const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
134
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
135
+ const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
136
+ .previewServerState.type;
137
+ const fileName = (_a = relativePath === null || relativePath === void 0 ? void 0 : relativePath.split('/').pop()) !== null && _a !== void 0 ? _a : null;
138
+ const copyFileName = (0, react_1.useCallback)(() => {
139
+ if (fileName === null) {
140
+ return;
141
+ }
142
+ (0, copy_text_1.copyText)(fileName)
143
+ .then(() => {
144
+ (0, NotificationCenter_1.showNotification)(`Copied '${fileName}' to clipboard`, 1000);
145
+ })
146
+ .catch((err) => {
147
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
148
+ });
149
+ }, [fileName]);
150
+ const copyStaticFilePath = (0, react_1.useCallback)(() => {
151
+ if (relativePath === null) {
152
+ return;
153
+ }
154
+ const content = `staticFile("${relativePath}")`;
155
+ (0, copy_text_1.copyText)(content)
156
+ .then(() => {
157
+ (0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
158
+ })
159
+ .catch((err) => {
160
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
161
+ });
162
+ }, [relativePath]);
163
+ const copyAbsolutePath = (0, react_1.useCallback)(() => {
164
+ if (relativePath === null || window.remotion_publicFolderExists === null) {
165
+ return;
166
+ }
167
+ const content = `${window.remotion_publicFolderExists}/${relativePath}`;
168
+ (0, copy_text_1.copyText)(content)
169
+ .then(() => {
170
+ (0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
171
+ })
172
+ .catch((err) => {
173
+ (0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
174
+ });
175
+ }, [relativePath]);
176
+ const openAssetInConvert = (0, react_1.useCallback)(() => {
177
+ if (relativePath === null) {
178
+ return;
179
+ }
180
+ (0, open_in_remotion_convert_1.openInRemotionConvert)({ relativePath });
181
+ }, [relativePath]);
182
+ const openAssetInExplorer = (0, react_1.useCallback)(() => {
183
+ if (relativePath === null || !window.remotion_publicFolderExists) {
184
+ (0, NotificationCenter_1.showNotification)('Could not find the public folder', 2000);
185
+ return;
186
+ }
187
+ (0, actions_1.openInFileExplorer)({
188
+ directory: window.remotion_publicFolderExists + '/' + relativePath,
189
+ }).catch((err) => {
190
+ (0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
191
+ });
192
+ }, [relativePath]);
193
+ const { mutationsDisabled, fileExplorerDisabled } = (0, exports.getAssetActionAvailability)({
194
+ browserStudioCanMutateAssets: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null ? null : true,
195
+ readOnlyStudio,
196
+ connectionStatus,
197
+ publicFolderExists: window.remotion_publicFolderExists,
198
+ });
199
+ const deleteAsset = (0, use_delete_asset_1.useDeleteAsset)(relativePath);
200
+ const renameAsset = (0, react_1.useCallback)(() => {
201
+ if (relativePath === null) {
202
+ return;
203
+ }
204
+ setSelectedModal({
205
+ type: 'rename-static-file',
206
+ relativePath,
207
+ });
208
+ }, [relativePath, setSelectedModal]);
209
+ const getContextMenuItems = (0, react_1.useCallback)(() => {
210
+ if (relativePath === null) {
211
+ return [];
212
+ }
213
+ return (0, exports.getAssetContextMenuItems)({
214
+ relativePath,
215
+ fileManagerName,
216
+ copyFileName,
217
+ copyStaticFilePath,
218
+ copyAbsolutePath: window.remotion_publicFolderExists === null ? null : copyAbsolutePath,
219
+ openAssetInConvert,
220
+ openAssetInExplorer,
221
+ renameAsset,
222
+ deleteAsset,
223
+ fileExplorerAvailable: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null,
224
+ fileExplorerDisabled,
225
+ mutationsDisabled,
226
+ });
227
+ }, [
228
+ copyFileName,
229
+ copyStaticFilePath,
230
+ copyAbsolutePath,
231
+ deleteAsset,
232
+ fileExplorerDisabled,
233
+ fileManagerName,
234
+ mutationsDisabled,
235
+ openAssetInConvert,
236
+ openAssetInExplorer,
237
+ renameAsset,
238
+ relativePath,
239
+ ]);
240
+ return { fileExplorerDisabled, fileManagerName, getContextMenuItems };
241
+ };
242
+ exports.useAssetContextMenuItems = useAssetContextMenuItems;
@@ -1,9 +1,9 @@
1
- import type { EditorPickerId } from '@remotion/studio-shared';
2
1
  import type { SetStateAction } from 'react';
3
2
  import type { ResolvedStackLocation } from 'remotion';
4
3
  import type { ModalState } from '../state/modals';
5
4
  import type { ComboboxValue } from './NewComposition/ComboBox';
6
- export declare const getCompositionMenuItems: ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeCompositionManagementItems, editorId, editorName, }: {
5
+ import type { OpenInMenuApps } from './use-open-in-menu-apps';
6
+ export declare const getCompositionMenuItems: ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeCompositionManagementItems, openInApps, }: {
7
7
  composition: import("remotion").AnyComposition | null;
8
8
  connectionStatus: "connected" | "disconnected" | "init";
9
9
  resolvedLocation: ResolvedStackLocation | null;
@@ -11,8 +11,7 @@ export declare const getCompositionMenuItems: ({ composition, connectionStatus,
11
11
  closeMenu: () => void;
12
12
  readOnlyStudio: boolean;
13
13
  includeCompositionManagementItems: boolean;
14
- editorId: EditorPickerId | null;
15
- editorName: string | null;
14
+ openInApps: OpenInMenuApps;
16
15
  }) => ComboboxValue[];
17
16
  export declare const getCompositionContextMenuItems: (args: Omit<{
18
17
  composition: import("remotion").AnyComposition | null;
@@ -22,8 +21,7 @@ export declare const getCompositionContextMenuItems: (args: Omit<{
22
21
  closeMenu: () => void;
23
22
  readOnlyStudio: boolean;
24
23
  includeCompositionManagementItems: boolean;
25
- editorId: EditorPickerId | null;
26
- editorName: string | null;
24
+ openInApps: OpenInMenuApps;
27
25
  }, "includeCompositionManagementItems"> & {
28
26
  readonly includeCompositionManagementItems: boolean;
29
27
  }) => ComboboxValue[];
@@ -5,10 +5,13 @@ const no_react_1 = require("remotion/no-react");
5
5
  const format_file_location_1 = require("../helpers/format-file-location");
6
6
  const get_git_menu_item_1 = require("../helpers/get-git-menu-item");
7
7
  const open_in_editor_1 = require("../helpers/open-in-editor");
8
+ const get_open_in_menu_items_1 = require("./get-open-in-menu-items");
8
9
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
9
10
  const open_in_new_window_1 = require("./open-in-new-window");
10
- const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeCompositionManagementItems, editorId, editorName, }) => {
11
+ const actions_1 = require("./RenderQueue/actions");
12
+ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocation, setSelectedModal, closeMenu, readOnlyStudio, includeCompositionManagementItems, openInApps, }) => {
11
13
  var _a;
14
+ const { canOpenDesktopApps, canOpenInEditor, codingAgentInfo, defaultEditorId, defaultEditorName, editorInfo, onConfigureApps, } = openInApps;
12
15
  const fileLocation = (0, format_file_location_1.formatFileLocation)({
13
16
  location: resolvedLocation,
14
17
  root: window.remotion_cwd,
@@ -18,121 +21,234 @@ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocati
18
21
  name: (_a = composition === null || composition === void 0 ? void 0 : composition.id) !== null && _a !== void 0 ? _a : null,
19
22
  root: window.remotion_cwd,
20
23
  });
21
- const showInEditorDisabled = !editorId ||
22
- !composition ||
23
- connectionStatus !== 'connected' ||
24
- !resolvedLocation;
25
- const openComponentInEditorDisabled = showInEditorDisabled || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source);
24
+ const openCompositionInEditorDisabled = !defaultEditorId || !composition || !canOpenInEditor || !resolvedLocation;
25
+ const openComponentInEditorDisabled = openCompositionInEditorDisabled || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source);
26
26
  const gitSourceName = window.remotion_gitSource
27
27
  ? (0, get_git_menu_item_1.getGitSourceName)(window.remotion_gitSource)
28
28
  : null;
29
+ const defaultOpenInTarget = (0, get_git_menu_item_1.getDefaultOpenInTarget)({ canOpenInEditor });
30
+ const defaultOpenInName = defaultOpenInTarget === 'editor' ? defaultEditorName : gitSourceName;
29
31
  const openCompositionInGitSourceDisabled = !composition || !resolvedLocation;
30
32
  const openComponentInGitSourceDisabled = openCompositionInGitSourceDisabled ||
31
33
  !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) ||
32
34
  (!readOnlyStudio && connectionStatus !== 'connected');
33
35
  const copyFileLocationDisabled = !composition || !fileLocation;
36
+ const openWithCodingAgent = async (codingAgentId, codingAgentName) => {
37
+ try {
38
+ const response = await (0, open_in_editor_1.openInCodingAgent)(codingAgentId, codingAgentId === 'copilot' ? null : contextForAgents);
39
+ if (!response.success) {
40
+ (0, NotificationCenter_1.showNotification)(`Could not open ${codingAgentName}`, 2000);
41
+ }
42
+ }
43
+ catch (err) {
44
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
45
+ }
46
+ };
47
+ const openCompositionWithEditor = async (editorId) => {
48
+ closeMenu();
49
+ if (!composition || !resolvedLocation) {
50
+ return;
51
+ }
52
+ try {
53
+ await (0, open_in_editor_1.openOriginalPositionInEditor)(resolvedLocation, editorId);
54
+ }
55
+ catch (err) {
56
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
57
+ }
58
+ };
59
+ const openComponentWithEditor = async (editorId) => {
60
+ closeMenu();
61
+ if (!composition || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source)) {
62
+ return;
63
+ }
64
+ try {
65
+ await (0, open_in_editor_1.openCompositionComponentInEditor)({
66
+ compositionFile: resolvedLocation.source,
67
+ compositionId: composition.id,
68
+ editorId,
69
+ });
70
+ }
71
+ catch (err) {
72
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
73
+ }
74
+ };
75
+ const openComponentInGitSource = async () => {
76
+ closeMenu();
77
+ if (!composition || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source)) {
78
+ return;
79
+ }
80
+ try {
81
+ const info = await (0, open_in_editor_1.loadCompositionComponentInfo)({
82
+ compositionFile: resolvedLocation.source,
83
+ compositionId: composition.id,
84
+ });
85
+ (0, get_git_menu_item_1.openGitSource)({ folder: false, location: info.location });
86
+ }
87
+ catch (err) {
88
+ (0, NotificationCenter_1.showNotification)(err.message, 2000);
89
+ }
90
+ };
91
+ const openCompositionInFileExplorer = () => {
92
+ if (!(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source)) {
93
+ return;
94
+ }
95
+ (0, actions_1.openInFileExplorer)({ directory: resolvedLocation.source }).catch((err) => {
96
+ (0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
97
+ });
98
+ };
99
+ const openComponentInFileExplorer = async () => {
100
+ if (!composition || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source)) {
101
+ return;
102
+ }
103
+ try {
104
+ const info = await (0, open_in_editor_1.loadCompositionComponentInfo)({
105
+ compositionFile: resolvedLocation.source,
106
+ compositionId: composition.id,
107
+ });
108
+ await (0, actions_1.openInFileExplorer)({ directory: info.location.source });
109
+ }
110
+ catch (err) {
111
+ (0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
112
+ }
113
+ };
114
+ const commonOpenInMenuItems = {
115
+ canOpenDesktopApps,
116
+ codingAgentInfo,
117
+ editorInfo,
118
+ excludeCodingAgentId: null,
119
+ excludeEditorId: defaultOpenInTarget === 'editor' ? defaultEditorId : null,
120
+ excludeGitSource: defaultOpenInTarget === 'git-source',
121
+ folder: false,
122
+ onConfigureApps,
123
+ onOpenInCodingAgent: (codingAgentId, name) => {
124
+ openWithCodingAgent(codingAgentId, name).catch(() => undefined);
125
+ },
126
+ onOpenInGitClient: () => undefined,
127
+ onOpenInTerminal: null,
128
+ };
129
+ const compositionOpenInMenuItems = (0, get_open_in_menu_items_1.getOpenInMenuItems)({
130
+ ...commonOpenInMenuItems,
131
+ editorDisabled: openCompositionInEditorDisabled,
132
+ fileManagerDisabled: !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) || connectionStatus !== 'connected',
133
+ gitSourceDisabled: openCompositionInGitSourceDisabled,
134
+ onOpenInEditor: (editorId) => {
135
+ openCompositionWithEditor(editorId).catch(() => undefined);
136
+ },
137
+ onOpenInFileExplorer: openCompositionInFileExplorer,
138
+ onOpenInGitSource: () => {
139
+ closeMenu();
140
+ (0, get_git_menu_item_1.openGitSource)({ folder: false, location: resolvedLocation });
141
+ },
142
+ });
143
+ const componentOpenInMenuItems = (0, get_open_in_menu_items_1.getOpenInMenuItems)({
144
+ ...commonOpenInMenuItems,
145
+ editorDisabled: openComponentInEditorDisabled,
146
+ fileManagerDisabled: !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) || connectionStatus !== 'connected',
147
+ gitSourceDisabled: openComponentInGitSourceDisabled,
148
+ onOpenInEditor: (editorId) => {
149
+ openComponentWithEditor(editorId).catch(() => undefined);
150
+ },
151
+ onOpenInFileExplorer: () => {
152
+ openComponentInFileExplorer().catch(() => undefined);
153
+ },
154
+ onOpenInGitSource: () => {
155
+ openComponentInGitSource().catch(() => undefined);
156
+ },
157
+ });
158
+ const hasOpenInItems = defaultOpenInName !== null ||
159
+ compositionOpenInMenuItems.length > 0 ||
160
+ componentOpenInMenuItems.length > 0;
34
161
  return [
35
- editorName
162
+ defaultOpenInTarget && defaultOpenInName
36
163
  ? {
37
- id: 'show-in-editor',
164
+ id: defaultOpenInTarget === 'editor'
165
+ ? 'show-in-editor'
166
+ : 'open-composition-in-git-source',
38
167
  keyHint: null,
39
- label: `Open composition in ${editorName}`,
168
+ label: `Open composition in ${defaultOpenInName}`,
40
169
  leftItem: null,
41
- onClick: async () => {
42
- closeMenu();
43
- if (!composition || !resolvedLocation || !editorId) {
44
- return;
45
- }
46
- try {
47
- await (0, open_in_editor_1.openOriginalPositionInEditor)(resolvedLocation, editorId);
170
+ onClick: () => {
171
+ if (defaultOpenInTarget === 'editor' && defaultEditorId !== null) {
172
+ openCompositionWithEditor(defaultEditorId).catch(() => undefined);
48
173
  }
49
- catch (err) {
50
- (0, NotificationCenter_1.showNotification)(err.message, 2000);
174
+ else if (defaultOpenInTarget === 'git-source') {
175
+ closeMenu();
176
+ (0, get_git_menu_item_1.openGitSource)({ folder: false, location: resolvedLocation });
51
177
  }
52
178
  },
53
- quickSwitcherLabel: `Open composition in ${editorName}`,
179
+ quickSwitcherLabel: `Open composition in ${defaultOpenInName}`,
54
180
  subMenu: null,
55
181
  type: 'item',
56
- value: 'show-in-editor',
57
- disabled: showInEditorDisabled,
182
+ value: defaultOpenInTarget === 'editor'
183
+ ? 'show-in-editor'
184
+ : 'open-composition-in-git-source',
185
+ disabled: defaultOpenInTarget === 'editor'
186
+ ? openCompositionInEditorDisabled
187
+ : openCompositionInGitSourceDisabled,
58
188
  }
59
189
  : null,
60
- editorName
190
+ compositionOpenInMenuItems.length > 0
61
191
  ? {
62
- id: 'open-component-in-editor',
192
+ id: 'open-composition-in-another-app',
63
193
  keyHint: null,
64
- label: `Open component in ${editorName}`,
194
+ label: 'Open composition in...',
65
195
  leftItem: null,
66
- onClick: async () => {
67
- closeMenu();
68
- if (!composition || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source) || !editorId) {
69
- return;
70
- }
71
- try {
72
- await (0, open_in_editor_1.openCompositionComponentInEditor)({
73
- compositionFile: resolvedLocation.source,
74
- compositionId: composition.id,
75
- editorId,
76
- });
77
- }
78
- catch (err) {
79
- (0, NotificationCenter_1.showNotification)(err.message, 2000);
80
- }
196
+ onClick: () => undefined,
197
+ quickSwitcherLabel: null,
198
+ subMenu: {
199
+ items: compositionOpenInMenuItems,
200
+ leaveLeftSpace: true,
201
+ preselectIndex: false,
81
202
  },
82
- quickSwitcherLabel: `Open composition component in ${editorName}`,
83
- subMenu: null,
84
203
  type: 'item',
85
- value: 'open-component-in-editor',
86
- disabled: openComponentInEditorDisabled,
204
+ value: 'open-composition-in-another-app',
87
205
  }
88
206
  : null,
89
- gitSourceName
207
+ defaultOpenInTarget && defaultOpenInName
90
208
  ? {
91
- id: 'open-composition-in-git-source',
209
+ id: defaultOpenInTarget === 'editor'
210
+ ? 'open-component-in-editor'
211
+ : 'open-component-in-git-source',
92
212
  keyHint: null,
93
- label: `Open composition in ${gitSourceName}`,
213
+ label: `Open component in ${defaultOpenInName}`,
94
214
  leftItem: null,
95
215
  onClick: () => {
96
- closeMenu();
97
- (0, get_git_menu_item_1.openGitSource)({ folder: false, location: resolvedLocation });
216
+ if (defaultOpenInTarget === 'editor' && defaultEditorId !== null) {
217
+ openComponentWithEditor(defaultEditorId).catch(() => undefined);
218
+ }
219
+ else if (defaultOpenInTarget === 'git-source') {
220
+ openComponentInGitSource().catch(() => undefined);
221
+ }
98
222
  },
99
- quickSwitcherLabel: `Open composition in ${gitSourceName}`,
223
+ quickSwitcherLabel: `Open composition component in ${defaultOpenInName}`,
100
224
  subMenu: null,
101
225
  type: 'item',
102
- value: 'open-composition-in-git-source',
103
- disabled: openCompositionInGitSourceDisabled,
226
+ value: defaultOpenInTarget === 'editor'
227
+ ? 'open-component-in-editor'
228
+ : 'open-component-in-git-source',
229
+ disabled: defaultOpenInTarget === 'editor'
230
+ ? openComponentInEditorDisabled
231
+ : openComponentInGitSourceDisabled,
104
232
  }
105
233
  : null,
106
- gitSourceName
234
+ componentOpenInMenuItems.length > 0
107
235
  ? {
108
- id: 'open-component-in-git-source',
236
+ id: 'open-component-in-another-app',
109
237
  keyHint: null,
110
- label: `Open component in ${gitSourceName}`,
238
+ label: 'Open component in...',
111
239
  leftItem: null,
112
- onClick: async () => {
113
- closeMenu();
114
- if (!composition || !(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source)) {
115
- return;
116
- }
117
- try {
118
- const info = await (0, open_in_editor_1.loadCompositionComponentInfo)({
119
- compositionFile: resolvedLocation.source,
120
- compositionId: composition.id,
121
- });
122
- (0, get_git_menu_item_1.openGitSource)({ folder: false, location: info.location });
123
- }
124
- catch (err) {
125
- (0, NotificationCenter_1.showNotification)(err.message, 2000);
126
- }
240
+ onClick: () => undefined,
241
+ quickSwitcherLabel: null,
242
+ subMenu: {
243
+ items: componentOpenInMenuItems,
244
+ leaveLeftSpace: true,
245
+ preselectIndex: false,
127
246
  },
128
- quickSwitcherLabel: `Open composition component in ${gitSourceName}`,
129
- subMenu: null,
130
247
  type: 'item',
131
- value: 'open-component-in-git-source',
132
- disabled: openComponentInGitSourceDisabled,
248
+ value: 'open-component-in-another-app',
133
249
  }
134
250
  : null,
135
- (editorName || gitSourceName) && includeCompositionManagementItems
251
+ hasOpenInItems && includeCompositionManagementItems
136
252
  ? {
137
253
  type: 'divider',
138
254
  id: 'show-in-editor-divider',
@@ -208,7 +324,7 @@ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocati
208
324
  disabled: !composition || readOnlyStudio,
209
325
  }
210
326
  : null,
211
- editorName || gitSourceName || includeCompositionManagementItems
327
+ hasOpenInItems || includeCompositionManagementItems
212
328
  ? {
213
329
  type: 'divider',
214
330
  id: 'copy-actions-divider',
@@ -1,24 +1,25 @@
1
- import type { TerminalId } from '@remotion/studio-shared';
2
- import type { EditorPickerId, GetDefaultCodingAgentInfoResponse, GetDefaultEditorInfoResponse } from '@remotion/studio-shared';
3
- import type { OriginalPosition } from '../error-overlay/react-overlay/utils/get-source-map';
1
+ import type { EditorPickerId, GetDefaultCodingAgentInfoResponse, GetDefaultEditorInfoResponse, TerminalId } from '@remotion/studio-shared';
4
2
  import type { ComboboxValue } from './NewComposition/ComboBox';
5
3
  export declare const getConfigureDefaultAppsMenuItems: ({ hasPreviousItems, onConfigureApps, }: {
6
4
  readonly hasPreviousItems: boolean;
7
5
  readonly onConfigureApps: (() => void) | null;
8
6
  }) => ComboboxValue[];
9
- export declare const getOpenInMenuItems: ({ codingAgentInfo, editorDisabled, editorInfo, excludeCodingAgentId, excludeEditorId, fileManagerDisabled, folder, location, onConfigureApps, onOpenInCodingAgent, onOpenInEditor, onOpenInFileExplorer, onOpenInGitClient, onOpenInTerminal, }: {
7
+ export declare const getOpenInMenuItems: ({ canOpenDesktopApps, codingAgentInfo, editorDisabled, editorInfo, excludeCodingAgentId, excludeEditorId, excludeGitSource, fileManagerDisabled, folder, gitSourceDisabled, onConfigureApps, onOpenInCodingAgent, onOpenInEditor, onOpenInFileExplorer, onOpenInGitClient, onOpenInGitSource, onOpenInTerminal, }: {
8
+ readonly canOpenDesktopApps: boolean;
10
9
  readonly codingAgentInfo: GetDefaultCodingAgentInfoResponse | null;
11
10
  readonly editorDisabled: boolean;
12
11
  readonly editorInfo: GetDefaultEditorInfoResponse | null;
13
12
  readonly excludeCodingAgentId: "claude-code" | "codex" | "copilot" | "cursor" | null;
14
13
  readonly excludeEditorId: EditorPickerId | null;
14
+ readonly excludeGitSource: boolean;
15
15
  readonly fileManagerDisabled: boolean;
16
16
  readonly folder: boolean;
17
- readonly location: OriginalPosition | null;
17
+ readonly gitSourceDisabled: boolean;
18
18
  readonly onConfigureApps: (() => void) | null;
19
19
  readonly onOpenInCodingAgent: (codingAgentId: "claude-code" | "codex" | "copilot" | "cursor", codingAgentName: string) => void;
20
20
  readonly onOpenInEditor: (editorId: EditorPickerId) => void;
21
21
  readonly onOpenInFileExplorer: () => void;
22
22
  readonly onOpenInGitClient: (gitClientId: "github-desktop") => void;
23
+ readonly onOpenInGitSource: () => void;
23
24
  readonly onOpenInTerminal: ((terminalId: TerminalId) => void) | null;
24
25
  }) => ComboboxValue[];