@remotion/studio 4.0.505 → 4.0.507

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 (208) hide show
  1. package/dist/api/copy-render-output-to-asset.d.ts +4 -0
  2. package/dist/api/copy-render-output-to-asset.js +11 -0
  3. package/dist/api/install-package.d.ts +2 -3
  4. package/dist/api/install-package.js +1 -3
  5. package/dist/api/visual-control.d.ts +3 -0
  6. package/dist/api/visual-control.js +3 -0
  7. package/dist/components/AssetSelector.js +19 -4
  8. package/dist/components/AssetSelectorItem.js +3 -3
  9. package/dist/components/Canvas.js +2 -0
  10. package/dist/components/CodingAgentIcon.d.ts +4 -0
  11. package/dist/components/CodingAgentIcon.js +17 -0
  12. package/dist/components/CompositionSelector.js +1 -1
  13. package/dist/components/CompositionSelectorItem.js +1 -1
  14. package/dist/components/ConfigureDefaultEditorModal.d.ts +1 -1
  15. package/dist/components/ConfigureDefaultEditorModal.js +117 -69
  16. package/dist/components/ConfigureLicenseModal.d.ts +1 -3
  17. package/dist/components/ConfigureLicenseModal.js +105 -89
  18. package/dist/components/ConfirmationDialog.js +2 -2
  19. package/dist/components/ContextMenu.js +10 -8
  20. package/dist/components/Editor.js +2 -0
  21. package/dist/components/EditorContexts.js +6 -5
  22. package/dist/components/EffectPickerModal.js +1 -1
  23. package/dist/components/ExpandedTracksProvider.js +10 -53
  24. package/dist/components/GlobalKeybindings.js +3 -2
  25. package/dist/components/InlineCaptionInspector.d.ts +2 -2
  26. package/dist/components/InlineDropdown.d.ts +2 -1
  27. package/dist/components/InlineDropdown.js +10 -4
  28. package/dist/components/InspectorLocationCopy.js +8 -8
  29. package/dist/components/InspectorOpenInEditor.d.ts +2 -0
  30. package/dist/components/InspectorOpenInEditor.js +63 -49
  31. package/dist/components/InspectorPanel/AlignmentControls.js +5 -2
  32. package/dist/components/InspectorPanel/CompositionInspector.js +15 -1
  33. package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +1 -1
  34. package/dist/components/InspectorPanel/EasingInspector.js +7 -4
  35. package/dist/components/InspectorPanel/KeyframeInspector.js +5 -1
  36. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -0
  37. package/dist/components/InspectorPanel/SequenceInspectorHeader.js +22 -4
  38. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
  39. package/dist/components/InspectorPanel/common.d.ts +1 -0
  40. package/dist/components/InspectorPanel/common.js +2 -2
  41. package/dist/components/InspectorPanel/use-composition-actions.js +4 -1
  42. package/dist/components/InspectorSequenceSection.js +4 -4
  43. package/dist/components/InstallPackage.js +1 -1
  44. package/dist/components/Menu/MenuSectionHeader.d.ts +4 -0
  45. package/dist/components/Menu/MenuSectionHeader.js +20 -0
  46. package/dist/components/Menu/SubMenu.js +13 -2
  47. package/dist/components/Menu/menu-tree-context.d.ts +3 -0
  48. package/dist/components/Menu/menu-tree-context.js +13 -0
  49. package/dist/components/MenuBuildIndicator.js +1 -0
  50. package/dist/components/MenuToolbar.js +1 -1
  51. package/dist/components/ModalFooter.d.ts +1 -0
  52. package/dist/components/ModalFooter.js +6 -2
  53. package/dist/components/ModalHeader.js +1 -1
  54. package/dist/components/Modals.js +18 -7
  55. package/dist/components/ModalsProvider.js +5 -6
  56. package/dist/components/NewComposition/CodemodFooter.js +1 -1
  57. package/dist/components/NewComposition/ComboBox.d.ts +6 -1
  58. package/dist/components/NewComposition/DismissableModal.js +1 -1
  59. package/dist/components/NewComposition/MenuContent.js +27 -19
  60. package/dist/components/NewComposition/RenameStaticFile.js +1 -1
  61. package/dist/components/NewComposition/menu-typeahead.js +2 -2
  62. package/dist/components/OverrideInputProps.js +1 -1
  63. package/dist/components/PlayPause.js +2 -1
  64. package/dist/components/PlaybackKeyboardShortcutsManager.js +7 -5
  65. package/dist/components/Preview.js +29 -4
  66. package/dist/components/PreviewToolbarOverflowButton.js +4 -2
  67. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -1
  68. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -1
  69. package/dist/components/RenderButton.d.ts +3 -3
  70. package/dist/components/RenderButton.js +42 -7
  71. package/dist/components/RenderModal/RenderStatusModal.js +1 -1
  72. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +1 -0
  73. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +2 -2
  74. package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +3 -3
  75. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
  76. package/dist/components/RenderModal/ServerRenderModal.js +5 -1
  77. package/dist/components/RenderModal/WebRenderModal.js +3 -2
  78. package/dist/components/RenderQueue/RenderQueueError.js +1 -1
  79. package/dist/components/RenderQueue/RenderQueueItem.js +8 -2
  80. package/dist/components/RenderQueue/RenderQueueItemStatus.js +1 -1
  81. package/dist/components/RenderQueue/RenderQueueProgressMessage.js +1 -1
  82. package/dist/components/RenderQueue/RenderQueueRepeat.js +1 -1
  83. package/dist/components/RenderQueue/actions.d.ts +4 -2
  84. package/dist/components/RenderQueue/actions.js +4 -2
  85. package/dist/components/RenderQueue/index.js +3 -4
  86. package/dist/components/RenderQueue/use-render-output-file-drag.d.ts +8 -0
  87. package/dist/components/RenderQueue/use-render-output-file-drag.js +121 -0
  88. package/dist/components/SegmentedControl.js +0 -1
  89. package/dist/components/SelectedOutlineElement.d.ts +14 -17
  90. package/dist/components/SelectedOutlineElement.js +113 -931
  91. package/dist/components/SelectedOutlineKeyboardControls.d.ts +7 -0
  92. package/dist/components/SelectedOutlineKeyboardControls.js +261 -0
  93. package/dist/components/SelectedOutlineOverlay.d.ts +6 -13
  94. package/dist/components/SelectedOutlineOverlay.js +360 -832
  95. package/dist/components/SelectedOutlinePolygon.d.ts +25 -0
  96. package/dist/components/SelectedOutlinePolygon.js +359 -0
  97. package/dist/components/SelectedOutlineRenderer.d.ts +18 -0
  98. package/dist/components/SelectedOutlineRenderer.js +208 -0
  99. package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +16 -0
  100. package/dist/components/SelectedOutlineRotationCornerHandle.js +269 -0
  101. package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +16 -0
  102. package/dist/components/SelectedOutlineScaleEdgeLine.js +211 -0
  103. package/dist/components/SelectedOutlineSnapIndicators.d.ts +9 -0
  104. package/dist/components/SelectedOutlineSnapIndicators.js +29 -0
  105. package/dist/components/SelectedOutlineTransformOriginHandle.d.ts +9 -0
  106. package/dist/components/SelectedOutlineTransformOriginHandle.js +286 -0
  107. package/dist/components/SelectedOutlineUvControls.d.ts +3 -9
  108. package/dist/components/SelectedOutlineUvControls.js +57 -12
  109. package/dist/components/SettingsContext.d.ts +15 -0
  110. package/dist/components/SettingsContext.js +116 -0
  111. package/dist/components/SettingsModal.d.ts +7 -0
  112. package/dist/components/SettingsModal.js +56 -0
  113. package/dist/components/SettingsModalFooter.d.ts +2 -0
  114. package/dist/components/SettingsModalFooter.js +44 -0
  115. package/dist/components/ShowOutlinesProvider.js +2 -3
  116. package/dist/components/SidebarRenderButton.js +1 -1
  117. package/dist/components/SvgImportDialog.js +2 -2
  118. package/dist/components/TimeValue.js +1 -1
  119. package/dist/components/Timeline/EasingEditorModal.js +66 -22
  120. package/dist/components/Timeline/Timeline.js +23 -5
  121. package/dist/components/Timeline/TimelineAssetField.js +1 -1
  122. package/dist/components/Timeline/TimelineDragHandler.js +3 -3
  123. package/dist/components/Timeline/TimelineDuplicateCount.d.ts +4 -0
  124. package/dist/components/Timeline/TimelineDuplicateCount.js +28 -0
  125. package/dist/components/Timeline/TimelineEffectPropItem.js +5 -3
  126. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +3 -23
  127. package/dist/components/Timeline/TimelineExpandedRow.d.ts +4 -2
  128. package/dist/components/Timeline/TimelineExpandedRow.js +2 -2
  129. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +4 -2
  130. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +11 -1
  131. package/dist/components/Timeline/TimelineFontFamilyField.js +3 -1
  132. package/dist/components/Timeline/TimelineKeyframeControls.js +1 -0
  133. package/dist/components/Timeline/TimelineSelection.js +1 -0
  134. package/dist/components/Timeline/TimelineSequence.js +28 -25
  135. package/dist/components/Timeline/TimelineSequenceItem.js +74 -58
  136. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +1 -1
  137. package/dist/components/Timeline/TimelineTrack.js +2 -1
  138. package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -3
  139. package/dist/components/Timeline/get-sequence-context-menu-items.js +58 -53
  140. package/dist/components/Timeline/reset-selected-timeline-props.js +1 -1
  141. package/dist/components/Timeline/should-subscribe-to-sequence-props.d.ts +1 -1
  142. package/dist/components/Timeline/timeline-asset-link.d.ts +2 -2
  143. package/dist/components/Timeline/timeline-asset-link.js +2 -2
  144. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +38 -2
  145. package/dist/components/Timeline/{use-open-sequence-in-editor.d.ts → use-open-sequence-in-apps.d.ts} +4 -1
  146. package/dist/components/Timeline/{use-open-sequence-in-editor.js → use-open-sequence-in-apps.js} +20 -4
  147. package/dist/components/Timeline/use-timeline-asset-drop.js +1 -0
  148. package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +5 -0
  149. package/dist/components/Timeline/use-timeline-expanded-tree.js +50 -1
  150. package/dist/components/Timeline/use-timeline-height.js +20 -0
  151. package/dist/components/TimelineInOutToggle.js +5 -1
  152. package/dist/components/TopPanel.js +16 -0
  153. package/dist/components/UpdateCheck.js +1 -1
  154. package/dist/components/effect-drag-and-drop.js +1 -1
  155. package/dist/components/get-open-in-menu-items.d.ts +12 -0
  156. package/dist/components/get-open-in-menu-items.js +83 -0
  157. package/dist/components/handle-drop.d.ts +2 -1
  158. package/dist/components/handle-drop.js +12 -2
  159. package/dist/components/import-assets.d.ts +18 -6
  160. package/dist/components/import-assets.js +76 -32
  161. package/dist/components/selected-outline-measurement.d.ts +2 -2
  162. package/dist/components/selected-outline-order.d.ts +12 -0
  163. package/dist/components/selected-outline-order.js +251 -0
  164. package/dist/components/selected-outline-types.d.ts +9 -10
  165. package/dist/components/svg-point-to-client-point.d.ts +2 -0
  166. package/dist/components/svg-point-to-client-point.js +10 -0
  167. package/dist/components/use-auto-save-config.d.ts +8 -0
  168. package/dist/components/use-auto-save-config.js +74 -0
  169. package/dist/components/use-default-editor-info.d.ts +1 -0
  170. package/dist/components/use-default-editor-info.js +10 -30
  171. package/dist/esm/{chunk-jefhcs5z.js → chunk-fgedsvhb.js} +1 -2
  172. package/dist/esm/{chunk-7pgk8h5m.js → chunk-ptnd65a9.js} +14596 -12725
  173. package/dist/esm/internals.mjs +14595 -12724
  174. package/dist/esm/previewEntry.mjs +12726 -10855
  175. package/dist/esm/renderEntry.mjs +2 -2
  176. package/dist/helpers/are-sequence-node-path-infos-equal.d.ts +2 -0
  177. package/dist/helpers/are-sequence-node-path-infos-equal.js +27 -0
  178. package/dist/helpers/calculate-timeline.js +3 -3
  179. package/dist/helpers/client-id.d.ts +3 -1
  180. package/dist/helpers/client-id.js +28 -4
  181. package/dist/helpers/format-file-location.d.ts +1 -1
  182. package/dist/helpers/format-file-location.js +3 -3
  183. package/dist/helpers/install-required-package.d.ts +3 -3
  184. package/dist/helpers/install-required-package.js +1 -6
  185. package/dist/helpers/migrate-expanded-tracks-for-subscription-key.js +3 -3
  186. package/dist/helpers/open-in-editor.d.ts +1 -0
  187. package/dist/helpers/open-in-editor.js +5 -1
  188. package/dist/helpers/studio-fit-padding.d.ts +1 -1
  189. package/dist/helpers/studio-fit-padding.js +1 -1
  190. package/dist/helpers/studio-runtime-config.js +3 -0
  191. package/dist/helpers/timeline-layout.d.ts +2 -1
  192. package/dist/helpers/timeline-layout.js +5 -2
  193. package/dist/helpers/timeline-node-path-key.d.ts +2 -0
  194. package/dist/helpers/timeline-node-path-key.js +3 -1
  195. package/dist/helpers/use-asset-drag-events.d.ts +2 -1
  196. package/dist/helpers/use-asset-drag-events.js +14 -6
  197. package/dist/helpers/use-menu-structure.js +25 -35
  198. package/dist/helpers/use-runtime-values.d.ts +9 -0
  199. package/dist/helpers/use-runtime-values.js +76 -0
  200. package/dist/icons/apps.d.ts +2 -0
  201. package/dist/icons/apps.js +7 -0
  202. package/dist/icons/browse-elements.d.ts +4 -0
  203. package/dist/icons/browse-elements.js +10 -0
  204. package/dist/state/modals.d.ts +5 -6
  205. package/dist/state/modals.js +5 -3
  206. package/dist/state/timeline-sequence-hover.d.ts +9 -3
  207. package/dist/state/timeline-sequence-hover.js +63 -12
  208. package/package.json +12 -12
@@ -0,0 +1,4 @@
1
+ export declare const copyRenderOutputToAsset: ({ outputPath, assetPath, }: {
2
+ outputPath: string;
3
+ assetPath: string;
4
+ }) => Promise<import("@remotion/studio-shared").CopyRenderOutputToAssetResponse>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.copyRenderOutputToAsset = void 0;
4
+ const call_api_1 = require("../components/call-api");
5
+ const copyRenderOutputToAsset = ({ outputPath, assetPath, }) => {
6
+ return (0, call_api_1.callApi)('/api/copy-render-output-to-asset', {
7
+ outputPath,
8
+ assetPath,
9
+ });
10
+ };
11
+ exports.copyRenderOutputToAsset = copyRenderOutputToAsset;
@@ -1,3 +1,2 @@
1
- import type { ElementDependency } from '@remotion/studio-protocol';
2
- import type { InstallPackageResponse } from '@remotion/studio-shared';
3
- export declare const installPackages: (dependencies: (string | ElementDependency)[]) => Promise<InstallPackageResponse>;
1
+ import type { InstallPackageResponse, PackageInstallSpec } from '@remotion/studio-shared';
2
+ export declare const installPackages: (dependencies: readonly PackageInstallSpec[]) => Promise<InstallPackageResponse>;
@@ -11,9 +11,7 @@ const installPackages = (dependencies) => {
11
11
  throw new Error('installPackages() is not available in Read-Only Studio');
12
12
  }
13
13
  return (0, call_api_1.callApi)('/api/install-package', {
14
- dependencies: dependencies.map((dependency) => typeof dependency === 'string'
15
- ? { name: dependency, version: null }
16
- : dependency),
14
+ dependencies: [...dependencies],
17
15
  });
18
16
  };
19
17
  exports.installPackages = installPackages;
@@ -1,2 +1,5 @@
1
1
  import { type VisualControlRef } from '../visual-controls/VisualControls';
2
+ /**
3
+ * @deprecated Remotion Studio now has integrated interactivity for most components, and we will further develop this interactivity rather than visual controls.
4
+ */
2
5
  export declare const visualControl: VisualControlRef['globalVisualControl'];
@@ -5,6 +5,9 @@ const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const visual_control_store_1 = require("../visual-controls/visual-control-store");
7
7
  const VisualControls_1 = require("../visual-controls/VisualControls");
8
+ /**
9
+ * @deprecated Remotion Studio now has integrated interactivity for most components, and we will further develop this interactivity rather than visual controls.
10
+ */
8
11
  const visualControl = (key, value, schema) => {
9
12
  // Subscribe to store changes so the calling component
10
13
  // re-renders when a visual control value is edited in the sidebar.
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.AssetSelector = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = require("react");
39
+ const copy_render_output_to_asset_1 = require("../api/copy-render-output-to-asset");
39
40
  const write_static_file_1 = require("../api/write-static-file");
40
41
  const browser_studio_operations_1 = require("../helpers/browser-studio-operations");
41
42
  const client_id_1 = require("../helpers/client-id");
@@ -109,25 +110,39 @@ const AssetSelector = ({ readOnlyStudio }) => {
109
110
  setDropLocation,
110
111
  });
111
112
  const onDragOver = (0, react_1.useCallback)((e) => {
112
- if (!(0, use_asset_drag_events_1.isFileDragEvent)(e)) {
113
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(e)) {
113
114
  return;
114
115
  }
115
116
  e.preventDefault();
116
117
  }, []);
117
118
  const onDrop = (0, react_1.useCallback)(async (e) => {
118
119
  try {
119
- if (!(0, use_asset_drag_events_1.isFileDragEvent)(e)) {
120
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(e)) {
120
121
  setDropLocation(null);
121
122
  return;
122
123
  }
123
124
  e.preventDefault();
124
125
  e.stopPropagation();
126
+ const assetPath = dropLocation !== null && dropLocation !== void 0 ? dropLocation : null;
127
+ const renderOutput = (0, use_asset_drag_events_1.getRenderOutputDragData)(e.dataTransfer);
128
+ if (renderOutput) {
129
+ const destination = [assetPath, renderOutput.fileName]
130
+ .filter(Boolean)
131
+ .join('/');
132
+ const result = await (0, copy_render_output_to_asset_1.copyRenderOutputToAsset)({
133
+ outputPath: renderOutput.outputPath,
134
+ assetPath: destination,
135
+ });
136
+ (0, NotificationCenter_1.showNotification)(result.created
137
+ ? `Created ${destination}`
138
+ : `${destination} already exists`, 3000);
139
+ return;
140
+ }
125
141
  const { files } = e.dataTransfer;
126
142
  if (files.length === 0) {
127
143
  setDropLocation(null);
128
144
  return;
129
145
  }
130
- const assetPath = dropLocation !== null && dropLocation !== void 0 ? dropLocation : null;
131
146
  const makePath = (file) => {
132
147
  return [assetPath, file.name].filter(Boolean).join('/');
133
148
  };
@@ -161,7 +176,7 @@ const AssetSelector = ({ readOnlyStudio }) => {
161
176
  setDropLocation(null);
162
177
  }
163
178
  }, [dropLocation, staticFiles]);
164
- return (jsx_runtime_1.jsxs("div", { style: container, onDragOver: shouldAllowUpload ? onDragOver : undefined, onDrop: shouldAllowUpload ? onDrop : undefined, children: [
179
+ return (jsx_runtime_1.jsxs("div", { "data-asset-selector": true, style: container, onDragOver: shouldAllowUpload ? onDragOver : undefined, onDrop: shouldAllowUpload ? onDrop : undefined, children: [
165
180
  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
181
  " 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
182
  " in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
@@ -226,7 +226,7 @@ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dr
226
226
  backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
227
227
  }, children: [
228
228
  jsx_runtime_1.jsx("div", { style: folderStyle, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
229
- if (!(0, use_asset_drag_events_1.isFileDragEvent)(event)) {
229
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
230
230
  return;
231
231
  }
232
232
  if (!item.expanded) {
@@ -235,7 +235,7 @@ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dr
235
235
  }, 1000);
236
236
  }
237
237
  }, onDragLeave: (event) => {
238
- if (!(0, use_asset_drag_events_1.isFileDragEvent)(event)) {
238
+ if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
239
239
  return;
240
240
  }
241
241
  if (openFolderTimerRef.current) {
@@ -260,7 +260,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
260
260
  const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
261
261
  const [hovered, setHovered] = (0, react_1.useState)(false);
262
262
  const [isDragging, setIsDragging] = (0, react_1.useState)(false);
263
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
263
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
264
264
  const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
265
265
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
266
266
  .previewServerState.type;
@@ -869,6 +869,7 @@ const Canvas = ({ canvasContent, size }) => {
869
869
  event,
870
870
  fps: config.fps,
871
871
  from: (0, imperative_state_1.getCurrentFrame)(),
872
+ preferCompositionStart: true,
872
873
  });
873
874
  }
874
875
  finally {
@@ -966,6 +967,7 @@ const Canvas = ({ canvasContent, size }) => {
966
967
  destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
967
968
  dropPosition,
968
969
  from: null,
970
+ preferCompositionStart: null,
969
971
  svgImportMode,
970
972
  });
971
973
  }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const CodingAgentIcon: React.FC<{
3
+ readonly iconDataUrl: string | null;
4
+ }>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CodingAgentIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const apps_1 = require("../icons/apps");
6
+ const iconStyle = {
7
+ flexShrink: 0,
8
+ height: 18,
9
+ width: 18,
10
+ };
11
+ const CodingAgentIcon = ({ iconDataUrl }) => {
12
+ if (iconDataUrl === null) {
13
+ return jsx_runtime_1.jsx(apps_1.AppsIcon, { height: 18, width: 18 });
14
+ }
15
+ return (jsx_runtime_1.jsx("img", { alt: "", "aria-hidden": true, draggable: false, src: iconDataUrl, style: iconStyle }));
16
+ };
17
+ exports.CodingAgentIcon = CodingAgentIcon;
@@ -87,7 +87,7 @@ const getAutoScrollSpeed = ({ clientY, element, }) => {
87
87
  const CompositionSelector = () => {
88
88
  const { compositions, canvasContent, folders } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
89
89
  const { foldersExpanded } = (0, react_1.useContext)(persist_open_folders_1.ExpandedFoldersContext);
90
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
90
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
91
91
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
92
92
  .previewServerState.type;
93
93
  const getRootContextMenuItems = (0, react_1.useCallback)(() => {
@@ -116,7 +116,7 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
116
116
  onClick(evt);
117
117
  }
118
118
  }, [onClick]);
119
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
119
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
120
120
  const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
121
121
  .previewServerState.type;
122
122
  const resolvedLocation = (0, use_resolved_stack_1.useResolvedStack)(item.type === 'composition' ? item.composition.stack : item.folder.stack);
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare const ConfigureDefaultEditorModal: React.FC;
2
+ export declare const DefaultEditorSettings: React.FC;
@@ -1,24 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigureDefaultEditorModal = void 0;
3
+ exports.DefaultEditorSettings = 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
7
  const Checkmark_1 = require("../icons/Checkmark");
8
- const custom_editor_1 = require("../icons/custom-editor");
9
- const modals_1 = require("../state/modals");
10
- const call_api_1 = require("./call-api");
8
+ const editor_1 = require("../icons/editor");
9
+ const CodingAgentIcon_1 = require("./CodingAgentIcon");
11
10
  const layout_1 = require("./layout");
12
- const ModalButton_1 = require("./ModalButton");
13
- const ModalContainer_1 = require("./ModalContainer");
14
- const ModalFooter_1 = require("./ModalFooter");
15
- const ModalHeader_1 = require("./ModalHeader");
16
11
  const ComboBox_1 = require("./NewComposition/ComboBox");
17
12
  const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
13
+ const SettingsContext_1 = require("./SettingsContext");
14
+ const use_auto_save_config_1 = require("./use-auto-save-config");
15
+ const container = {
16
+ display: 'flex',
17
+ flex: 1,
18
+ flexDirection: 'column',
19
+ minWidth: 0,
20
+ };
18
21
  const content = {
22
+ flex: 1,
19
23
  padding: 16,
20
- width: 440,
21
- maxWidth: 'calc(100vw - 40px)',
22
24
  };
23
25
  const description = {
24
26
  color: colors_1.LIGHT_TEXT,
@@ -27,12 +29,19 @@ const description = {
27
29
  lineHeight: 1.5,
28
30
  margin: 0,
29
31
  };
32
+ const title = {
33
+ color: colors_1.LIGHT_TEXT,
34
+ fontFamily: 'sans-serif',
35
+ fontSize: 14,
36
+ lineHeight: 1.5,
37
+ margin: 0,
38
+ };
30
39
  const comboBoxStyle = {
31
40
  boxSizing: 'border-box',
32
41
  width: '100%',
33
42
  };
34
- const customEditorLabel = {
35
- display: 'inline-flex',
43
+ const appLabel = {
44
+ display: 'flex',
36
45
  alignItems: 'center',
37
46
  gap: 8,
38
47
  maxWidth: '100%',
@@ -42,7 +51,7 @@ const customEditorLabel = {
42
51
  fontSize: 'inherit',
43
52
  lineHeight: 'inherit',
44
53
  };
45
- const customEditorName = {
54
+ const appName = {
46
55
  minWidth: 0,
47
56
  overflow: 'hidden',
48
57
  textOverflow: 'ellipsis',
@@ -53,11 +62,11 @@ const customEditorName = {
53
62
  lineHeight: 'inherit',
54
63
  };
55
64
  const NO_PREFERENCE_ID = 'no-preference';
56
- const ConfigureDefaultEditorModal = () => {
57
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
58
- const [editorInfo, setEditorInfo] = (0, react_1.useState)(null);
65
+ const DefaultEditorSettings = () => {
66
+ const { codingAgentInfo, editorInfo, error: settingsError, revision, } = (0, SettingsContext_1.useSettings)();
59
67
  const [selectedEditor, setSelectedEditor] = (0, react_1.useState)(null);
60
- const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
68
+ const [selectedCodingAgent, setSelectedCodingAgent] = (0, react_1.useState)(null);
69
+ const [syncedRevision, setSyncedRevision] = (0, react_1.useState)(-1);
61
70
  const [error, setError] = (0, react_1.useState)(null);
62
71
  const editorValues = (0, react_1.useMemo)(() => {
63
72
  var _a;
@@ -79,9 +88,9 @@ const ConfigureDefaultEditorModal = () => {
79
88
  return {
80
89
  id: editor.id,
81
90
  keyHint: null,
82
- label: editor.id === 'custom' ? (jsx_runtime_1.jsxs("span", { style: customEditorLabel, children: [
83
- jsx_runtime_1.jsx(custom_editor_1.CustomEditorIcon, { size: null }), jsx_runtime_1.jsx("span", { style: customEditorName, children: editor.name })
84
- ] })) : (editor.name),
91
+ label: (jsx_runtime_1.jsxs("span", { style: appLabel, children: [
92
+ jsx_runtime_1.jsx(editor_1.EditorIcon, { editorId: editor.id, size: 18 }), jsx_runtime_1.jsx("span", { style: appName, children: editor.name })
93
+ ] })),
85
94
  leftItem: selectedEditor === editor.id ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
86
95
  onClick: () => {
87
96
  setSelectedEditor(editor.id);
@@ -95,57 +104,96 @@ const ConfigureDefaultEditorModal = () => {
95
104
  });
96
105
  return [noPreference, ...installedEditors];
97
106
  }, [editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors, selectedEditor]);
98
- const dismiss = (0, react_1.useCallback)(() => {
99
- setSelectedModal(null);
100
- }, [setSelectedModal]);
101
- (0, react_1.useEffect)(() => {
102
- const controller = new AbortController();
103
- (0, call_api_1.callApi)('/api/default-editor-info', {}, controller.signal)
104
- .then((response) => {
105
- setEditorInfo(response);
106
- setSelectedEditor(response.defaultEditor !== null &&
107
- response.installedEditors.some(({ id }) => id === response.defaultEditor)
108
- ? response.defaultEditor
109
- : null);
110
- })
111
- .catch((err) => {
112
- if (controller.signal.aborted) {
113
- return;
114
- }
115
- setError(err.message);
107
+ const codingAgentValues = (0, react_1.useMemo)(() => {
108
+ var _a;
109
+ const noPreference = {
110
+ id: NO_PREFERENCE_ID,
111
+ keyHint: null,
112
+ label: 'No preference',
113
+ leftItem: selectedCodingAgent === null ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
114
+ onClick: () => {
115
+ setSelectedCodingAgent(null);
116
+ setError(null);
117
+ },
118
+ quickSwitcherLabel: null,
119
+ subMenu: null,
120
+ type: 'item',
121
+ value: NO_PREFERENCE_ID,
122
+ };
123
+ const installedCodingAgents = ((_a = codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents) !== null && _a !== void 0 ? _a : []).map((codingAgent) => {
124
+ return {
125
+ id: codingAgent.id,
126
+ keyHint: null,
127
+ label: (jsx_runtime_1.jsxs("span", { style: appLabel, children: [
128
+ jsx_runtime_1.jsx(CodingAgentIcon_1.CodingAgentIcon, { iconDataUrl: codingAgent.iconDataUrl }), jsx_runtime_1.jsx("span", { style: appName, children: codingAgent.name })
129
+ ] })),
130
+ leftItem: selectedCodingAgent === codingAgent.id ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
131
+ onClick: () => {
132
+ setSelectedCodingAgent(codingAgent.id);
133
+ setError(null);
134
+ },
135
+ quickSwitcherLabel: null,
136
+ subMenu: null,
137
+ type: 'item',
138
+ value: codingAgent.id,
139
+ };
116
140
  });
117
- return () => controller.abort();
118
- }, []);
119
- const submit = (0, react_1.useCallback)(async () => {
120
- if (editorInfo === null) {
141
+ return [noPreference, ...installedCodingAgents];
142
+ }, [codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents, selectedCodingAgent]);
143
+ (0, react_1.useEffect)(() => {
144
+ if (editorInfo === null || codingAgentInfo === null) {
121
145
  return;
122
146
  }
123
- setIsSubmitting(true);
147
+ setSelectedEditor(editorInfo.defaultEditor !== null &&
148
+ editorInfo.installedEditors.some(({ id }) => id === editorInfo.defaultEditor)
149
+ ? editorInfo.defaultEditor
150
+ : null);
151
+ setSelectedCodingAgent(codingAgentInfo.defaultCodingAgent !== null &&
152
+ codingAgentInfo.installedCodingAgents.some(({ id }) => id === codingAgentInfo.defaultCodingAgent)
153
+ ? codingAgentInfo.defaultCodingAgent
154
+ : null);
155
+ setSyncedRevision(revision);
124
156
  setError(null);
125
- try {
126
- const response = await (0, call_api_1.callApi)('/api/update-default-editor', {
127
- defaultEditor: selectedEditor,
128
- });
129
- if (!response.success) {
130
- setError(response.reason);
131
- setIsSubmitting(false);
132
- return;
133
- }
134
- dismiss();
135
- }
136
- catch (err) {
137
- setError(err.message);
138
- setIsSubmitting(false);
139
- }
140
- }, [dismiss, editorInfo, selectedEditor]);
141
- if (editorInfo === null && error === null) {
142
- return null;
143
- }
144
- return (jsx_runtime_1.jsxs(ModalContainer_1.ModalContainer, { onEscape: dismiss, onOutsideClick: dismiss, children: [
145
- jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Configure default editor", onClose: dismiss }), jsx_runtime_1.jsxs("div", { style: content, children: [
146
- jsx_runtime_1.jsx("p", { style: description, children: "This setting gets saved to your config file." }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true }), (editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.length) === 0 ? (jsx_runtime_1.jsx("p", { style: description, children: "No supported editors were found on this computer." })) : null, editorInfo === null ? null : (jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: editorValues, selectedId: selectedEditor !== null && selectedEditor !== void 0 ? selectedEditor : NO_PREFERENCE_ID, style: comboBoxStyle, title: "Default editor" })), error ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
147
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1.5 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: error, align: "flex-start", type: "error" })
148
- ] })) : null] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(layout_1.Row, { justify: "flex-end", children: jsx_runtime_1.jsx(ModalButton_1.ModalButton, { onClick: submit, disabled: isSubmitting || editorInfo === null, children: isSubmitting ? 'Saving...' : 'Save and reload' }) }) })
149
- ] }));
157
+ }, [codingAgentInfo, editorInfo, revision]);
158
+ const updates = (0, react_1.useMemo)(() => {
159
+ // The browser only receives an opaque ID for a custom editor. Omitting the
160
+ // update preserves its executable and arguments in the existing config call.
161
+ const editorUpdate = selectedEditor === 'custom'
162
+ ? []
163
+ : [
164
+ selectedEditor === null
165
+ ? { setter: 'setDefaultEditor', type: 'delete' }
166
+ : {
167
+ setter: 'setDefaultEditor',
168
+ type: 'set',
169
+ value: selectedEditor,
170
+ },
171
+ ];
172
+ return [
173
+ ...editorUpdate,
174
+ selectedCodingAgent === null
175
+ ? { setter: 'setDefaultCodingAgent', type: 'delete' }
176
+ : {
177
+ setter: 'setDefaultCodingAgent',
178
+ type: 'set',
179
+ value: selectedCodingAgent,
180
+ },
181
+ ];
182
+ }, [selectedCodingAgent, selectedEditor]);
183
+ const ready = editorInfo !== null &&
184
+ codingAgentInfo !== null &&
185
+ syncedRevision === revision;
186
+ (0, use_auto_save_config_1.useAutoSaveConfig)({
187
+ enabled: ready,
188
+ onError: setError,
189
+ ready,
190
+ syncRevision: syncedRevision,
191
+ updates,
192
+ });
193
+ const displayedError = error !== null && error !== void 0 ? error : settingsError;
194
+ return (jsx_runtime_1.jsx("div", { style: container, children: jsx_runtime_1.jsxs("div", { style: content, children: [
195
+ jsx_runtime_1.jsx("p", { style: title, children: "Default editor" }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), editorInfo === null && displayedError === null ? (jsx_runtime_1.jsx("p", { style: description, children: "Loading installed editors..." })) : null, (editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors.length) === 0 ? (jsx_runtime_1.jsx("p", { style: description, children: "No supported editors were found on this computer." })) : null, editorInfo === null ? null : (jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: editorValues, selectedId: selectedEditor !== null && selectedEditor !== void 0 ? selectedEditor : NO_PREFERENCE_ID, style: comboBoxStyle, title: "Default editor" })), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2, block: true }), jsx_runtime_1.jsx("p", { style: title, children: "Default coding agent" }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), codingAgentInfo === null && displayedError === null ? (jsx_runtime_1.jsx("p", { style: description, children: "Loading installed coding agents..." })) : null, (codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents.length) === 0 ? (jsx_runtime_1.jsx("p", { style: description, children: "No supported coding agents were found on this computer." })) : null, codingAgentInfo === null ? null : (jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: codingAgentValues, selectedId: selectedCodingAgent !== null && selectedCodingAgent !== void 0 ? selectedCodingAgent : NO_PREFERENCE_ID, style: comboBoxStyle, title: "Default coding agent" })), displayedError ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
196
+ jsx_runtime_1.jsx(layout_1.Spacing, { y: 1.5 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: displayedError, align: "flex-start", type: "error" })
197
+ ] })) : null] }) }));
150
198
  };
151
- exports.ConfigureDefaultEditorModal = ConfigureDefaultEditorModal;
199
+ exports.DefaultEditorSettings = DefaultEditorSettings;
@@ -1,4 +1,2 @@
1
1
  import React from 'react';
2
- export declare const ConfigureLicenseModal: React.FC<{
3
- readonly initialPublicLicenseKey: string | null;
4
- }>;
2
+ export declare const LicenseSettings: React.FC;