@remotion/studio 4.0.504 → 4.0.506

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 (172) hide show
  1. package/dist/api/install-package.d.ts +2 -3
  2. package/dist/api/install-package.js +1 -3
  3. package/dist/api/visual-control.d.ts +3 -0
  4. package/dist/api/visual-control.js +3 -0
  5. package/dist/components/AssetSelectorItem.js +3 -3
  6. package/dist/components/AudioWaveform.d.ts +1 -1
  7. package/dist/components/AudioWaveform.js +36 -3
  8. package/dist/components/Canvas.js +2 -0
  9. package/dist/components/CompositionContextButton.d.ts +1 -1
  10. package/dist/components/CompositionContextButton.js +2 -2
  11. package/dist/components/CompositionSelector.js +3 -3
  12. package/dist/components/CompositionSelectorItem.js +5 -5
  13. package/dist/components/ConfigureDefaultEditorModal.d.ts +3 -1
  14. package/dist/components/ConfigureDefaultEditorModal.js +90 -32
  15. package/dist/components/ConfigureLicenseModal.d.ts +2 -1
  16. package/dist/components/ConfigureLicenseModal.js +40 -32
  17. package/dist/components/ConfirmationDialog.js +2 -2
  18. package/dist/components/ContextMenu.d.ts +5 -7
  19. package/dist/components/ContextMenu.js +54 -21
  20. package/dist/components/Editor.js +2 -0
  21. package/dist/components/EditorGuides/Guide.js +2 -2
  22. package/dist/components/EffectPickerModal.js +3 -3
  23. package/dist/components/GlobalKeybindings.js +3 -2
  24. package/dist/components/InlineAction.d.ts +1 -1
  25. package/dist/components/InlineAction.js +14 -13
  26. package/dist/components/InlineCaptionInspector.d.ts +2 -2
  27. package/dist/components/InlineDropdown.d.ts +4 -2
  28. package/dist/components/InlineDropdown.js +23 -6
  29. package/dist/components/InspectorOpenInEditor.d.ts +1 -0
  30. package/dist/components/InspectorOpenInEditor.js +33 -9
  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 +3 -3
  34. package/dist/components/InspectorPanel/EasingInspector.js +7 -4
  35. package/dist/components/InspectorPanel/KeyframeInspector.js +5 -1
  36. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
  37. package/dist/components/InspectorPanel/common.d.ts +1 -0
  38. package/dist/components/InspectorPanel/common.js +25 -35
  39. package/dist/components/InspectorPanel/use-composition-actions.js +4 -1
  40. package/dist/components/InspectorSequenceSection.js +5 -5
  41. package/dist/components/InstallPackage.js +1 -1
  42. package/dist/components/Menu/MenuItem.js +16 -12
  43. package/dist/components/MenuBuildIndicator.js +12 -58
  44. package/dist/components/MenuCompositionName.js +3 -63
  45. package/dist/components/MenuToolbar.js +22 -2
  46. package/dist/components/ModalFooter.d.ts +1 -0
  47. package/dist/components/ModalFooter.js +6 -2
  48. package/dist/components/ModalHeader.js +1 -1
  49. package/dist/components/Modals.js +18 -7
  50. package/dist/components/ModalsProvider.js +5 -6
  51. package/dist/components/NewComposition/CodemodFooter.js +1 -1
  52. package/dist/components/NewComposition/DismissableModal.js +1 -1
  53. package/dist/components/NewComposition/InputDragger.d.ts +1 -0
  54. package/dist/components/NewComposition/InputDragger.js +5 -4
  55. package/dist/components/NewComposition/MenuContent.d.ts +1 -1
  56. package/dist/components/NewComposition/RenameStaticFile.js +1 -1
  57. package/dist/components/NewComposition/menu-typeahead.d.ts +1 -1
  58. package/dist/components/OverrideInputProps.js +1 -1
  59. package/dist/components/PlayPause.js +3 -2
  60. package/dist/components/PlaybackKeyboardShortcutsManager.js +7 -5
  61. package/dist/components/PlaybackRateSelector.js +3 -9
  62. package/dist/components/PreviewToolbar.js +7 -4
  63. package/dist/components/PreviewToolbarOverflowButton.js +4 -2
  64. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +1 -1
  65. package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -1
  66. package/dist/components/RenderButton.d.ts +3 -2
  67. package/dist/components/RenderButton.js +95 -43
  68. package/dist/components/RenderModal/RenderStatusModal.js +1 -1
  69. package/dist/components/RenderModal/ServerRenderModal.js +1 -1
  70. package/dist/components/RenderModal/WebRenderModal.js +3 -2
  71. package/dist/components/RenderQueue/RenderQueueError.js +1 -1
  72. package/dist/components/RenderQueue/RenderQueueItemStatus.js +1 -1
  73. package/dist/components/RenderQueue/RenderQueueProgressMessage.js +1 -1
  74. package/dist/components/RenderQueue/RenderQueueRepeat.js +1 -1
  75. package/dist/components/SelectedOutlineElement.js +10 -11
  76. package/dist/components/SelectedOutlineOverlay.js +67 -20
  77. package/dist/components/SettingsModal.d.ts +7 -0
  78. package/dist/components/SettingsModal.js +50 -0
  79. package/dist/components/SettingsModalFooter.d.ts +4 -0
  80. package/dist/components/SettingsModalFooter.js +46 -0
  81. package/dist/components/SidebarRenderButton.js +1 -1
  82. package/dist/components/SizeSelector.js +3 -9
  83. package/dist/components/SvgImportDialog.js +2 -2
  84. package/dist/components/TimeValue.js +1 -1
  85. package/dist/components/Timeline/Timeline.js +5 -4
  86. package/dist/components/Timeline/TimelineAssetField.js +1 -1
  87. package/dist/components/Timeline/TimelineDragHandler.js +6 -3
  88. package/dist/components/Timeline/TimelineEffectItem.js +6 -2
  89. package/dist/components/Timeline/TimelineEffectPropItem.js +11 -6
  90. package/dist/components/Timeline/TimelineExpandedKeyframeRow.d.ts +6 -6
  91. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +32 -1
  92. package/dist/components/Timeline/TimelineExpandedRow.d.ts +4 -2
  93. package/dist/components/Timeline/TimelineExpandedRow.js +2 -2
  94. package/dist/components/Timeline/TimelineFontFamilyField.js +3 -1
  95. package/dist/components/Timeline/TimelineHeightContainer.d.ts +1 -0
  96. package/dist/components/Timeline/TimelineHeightContainer.js +2 -2
  97. package/dist/components/Timeline/TimelineInOutDragHandler.js +3 -3
  98. package/dist/components/Timeline/TimelineKeyframeControls.js +1 -0
  99. package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +4 -2
  100. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +30 -28
  101. package/dist/components/Timeline/TimelineList.d.ts +1 -0
  102. package/dist/components/Timeline/TimelineList.js +2 -3
  103. package/dist/components/Timeline/TimelineScaleField.js +1 -1
  104. package/dist/components/Timeline/TimelineSelection.js +1 -0
  105. package/dist/components/Timeline/TimelineSequence.js +34 -28
  106. package/dist/components/Timeline/TimelineSequenceItem.d.ts +3 -3
  107. package/dist/components/Timeline/TimelineSequenceItem.js +61 -56
  108. package/dist/components/Timeline/TimelineSequencePropItem.d.ts +10 -2
  109. package/dist/components/Timeline/TimelineSequencePropItem.js +64 -12
  110. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +2 -2
  111. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +39 -6
  112. package/dist/components/Timeline/TimelineTimeIndicators.js +36 -3
  113. package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -1
  114. package/dist/components/Timeline/TimelineVideoInfo.js +36 -3
  115. package/dist/components/Timeline/TimelineZoomControls.d.ts +2 -2
  116. package/dist/components/Timeline/TimelineZoomControls.js +39 -12
  117. package/dist/components/Timeline/reset-selected-timeline-props.js +1 -1
  118. package/dist/components/Timeline/should-subscribe-to-sequence-props.d.ts +1 -1
  119. package/dist/components/Timeline/timeline-asset-link.d.ts +2 -2
  120. package/dist/components/Timeline/timeline-asset-link.js +2 -2
  121. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +4 -0
  122. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +1 -1
  123. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +7 -18
  124. package/dist/components/Timeline/use-timeline-asset-drop.js +1 -0
  125. package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +1 -0
  126. package/dist/components/Timeline/use-timeline-expanded-tree.js +5 -0
  127. package/dist/components/Timeline/use-timeline-height.d.ts +2 -1
  128. package/dist/components/Timeline/use-timeline-height.js +23 -2
  129. package/dist/components/TimelineCombobox.d.ts +11 -0
  130. package/dist/components/TimelineCombobox.js +181 -0
  131. package/dist/components/TimelineInOutToggle.js +5 -1
  132. package/dist/components/TopPanel.js +22 -7
  133. package/dist/components/UpdateCheck.js +1 -1
  134. package/dist/components/effect-drag-and-drop.js +1 -1
  135. package/dist/components/handle-drop.d.ts +2 -1
  136. package/dist/components/handle-drop.js +12 -2
  137. package/dist/components/import-assets.d.ts +18 -6
  138. package/dist/components/import-assets.js +76 -32
  139. package/dist/components/selected-outline-types.d.ts +1 -1
  140. package/dist/esm/{chunk-43m68z1k.js → chunk-b49ec3nz.js} +12436 -11482
  141. package/dist/esm/internals.mjs +12436 -11482
  142. package/dist/esm/previewEntry.mjs +9671 -8717
  143. package/dist/esm/renderEntry.mjs +1 -1
  144. package/dist/helpers/client-id.d.ts +3 -1
  145. package/dist/helpers/client-id.js +21 -4
  146. package/dist/helpers/hoverable.d.ts +11 -0
  147. package/dist/helpers/hoverable.js +70 -0
  148. package/dist/helpers/inject-css.js +3 -0
  149. package/dist/helpers/install-required-package.d.ts +3 -3
  150. package/dist/helpers/install-required-package.js +1 -6
  151. package/dist/helpers/studio-fit-padding.d.ts +1 -1
  152. package/dist/helpers/studio-fit-padding.js +1 -1
  153. package/dist/helpers/timeline-layout.d.ts +2 -1
  154. package/dist/helpers/timeline-layout.js +5 -2
  155. package/dist/helpers/use-is-fullscreen.d.ts +1 -0
  156. package/dist/helpers/use-is-fullscreen.js +25 -0
  157. package/dist/helpers/use-menu-structure.js +26 -43
  158. package/dist/helpers/use-runtime-values.d.ts +11 -0
  159. package/dist/helpers/use-runtime-values.js +76 -0
  160. package/dist/icons/apps.d.ts +2 -0
  161. package/dist/icons/apps.js +7 -0
  162. package/dist/icons/browse-elements.d.ts +4 -0
  163. package/dist/icons/browse-elements.js +10 -0
  164. package/dist/icons/canvas-zoom.d.ts +10 -0
  165. package/dist/icons/canvas-zoom.js +21 -0
  166. package/dist/icons/playback-rate.d.ts +5 -0
  167. package/dist/icons/playback-rate.js +31 -0
  168. package/dist/icons/search.d.ts +5 -0
  169. package/dist/icons/search.js +10 -0
  170. package/dist/state/modals.d.ts +5 -6
  171. package/dist/state/modals.js +5 -3
  172. package/package.json +12 -12
@@ -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.
@@ -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;
@@ -424,7 +424,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
424
424
  relativePath,
425
425
  });
426
426
  }, [relativePath, setSelectedModal]);
427
- const contextMenu = (0, react_1.useMemo)(() => {
427
+ const getContextMenuItems = (0, react_1.useCallback)(() => {
428
428
  return (0, exports.getAssetContextMenuItems)({
429
429
  relativePath,
430
430
  fileManagerName,
@@ -455,7 +455,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
455
455
  e.stopPropagation();
456
456
  copyStaticFilePath();
457
457
  }, [copyStaticFilePath]);
458
- return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
458
+ 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: [
459
459
  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: [
460
460
  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: [
461
461
  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 })
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { LoopDisplay } from 'remotion';
3
- export declare const AudioWaveform: React.FC<{
3
+ export declare const AudioWaveform: React.NamedExoticComponent<{
4
4
  readonly src: string;
5
5
  readonly height: number;
6
6
  readonly visualizationWidth: number;
@@ -1,9 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.AudioWaveform = void 0;
4
37
  const jsx_runtime_1 = require("react/jsx-runtime");
5
38
  const timeline_utils_1 = require("@remotion/timeline-utils");
6
- const react_1 = require("react");
39
+ const react_1 = __importStar(require("react"));
7
40
  const remotion_1 = require("remotion");
8
41
  const colors_1 = require("../helpers/colors");
9
42
  const timeline_layout_1 = require("../helpers/timeline-layout");
@@ -76,7 +109,7 @@ const drawLoopedWaveform = ({ canvas, peaks, volume, visualizationWidth, loopWid
76
109
  ctx.fillStyle = pattern;
77
110
  ctx.fillRect(0, 0, w, h);
78
111
  };
79
- const AudioWaveform = ({ src, height, startFrom, durationInFrames, visualizationWidth, volume, doesVolumeChange, playbackRate, loopDisplay, }) => {
112
+ const AudioWaveformInner = ({ src, height, startFrom, durationInFrames, visualizationWidth, volume, doesVolumeChange, playbackRate, loopDisplay, }) => {
80
113
  const [peaks, setPeaks] = (0, react_1.useState)(null);
81
114
  const [error, setError] = (0, react_1.useState)(null);
82
115
  const [waveformCanvasKey, setWaveformCanvasKey] = (0, react_1.useState)(0);
@@ -300,4 +333,4 @@ const AudioWaveform = ({ src, height, startFrom, durationInFrames, visualization
300
333
  return (jsx_runtime_1.jsxs("div", { style: getContainerStyle(height), children: [
301
334
  jsx_runtime_1.jsx("canvas", { ref: waveformCanvas, style: waveformCanvasStyle }, waveformCanvasKey), shouldRenderVolumeOverlay ? (jsx_runtime_1.jsx("canvas", { ref: volumeCanvas, style: volumeCanvasStyle })) : null] }));
302
335
  };
303
- exports.AudioWaveform = AudioWaveform;
336
+ exports.AudioWaveform = react_1.default.memo(AudioWaveformInner);
@@ -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
  }
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import type { ComboboxValue } from './NewComposition/ComboBox';
3
3
  export declare const CompositionContextButton: React.FC<{
4
4
  readonly visible: boolean;
5
- readonly values: ComboboxValue[];
5
+ readonly getItems: () => ComboboxValue[];
6
6
  }>;
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const client_id_1 = require("../helpers/client-id");
7
7
  const ellipsis_1 = require("../icons/ellipsis");
8
8
  const InlineDropdown_1 = require("./InlineDropdown");
9
- const CompositionContextButton = ({ visible, values }) => {
9
+ const CompositionContextButton = ({ visible, getItems }) => {
10
10
  const iconStyle = (0, react_1.useMemo)(() => {
11
11
  return {
12
12
  style: {
@@ -22,6 +22,6 @@ const CompositionContextButton = ({ visible, values }) => {
22
22
  if (!visible || connectionStatus !== 'connected') {
23
23
  return null;
24
24
  }
25
- return (jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: renderAction, values: values, variant: null }));
25
+ return (jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: renderAction, getItems: getItems, variant: null }));
26
26
  };
27
27
  exports.CompositionContextButton = CompositionContextButton;
@@ -87,10 +87,10 @@ 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
- const rootContextMenuItems = (0, react_1.useMemo)(() => {
93
+ const getRootContextMenuItems = (0, react_1.useCallback)(() => {
94
94
  return (0, root_composition_menu_items_1.getRootCompositionMenuItems)({
95
95
  connectionStatus,
96
96
  readOnlyStudio: window.remotion_isReadOnlyStudio,
@@ -234,7 +234,7 @@ const CompositionSelector = () => {
234
234
  }
235
235
  }, [compositions, stopCompositionListAutoScroll]);
236
236
  return (jsx_runtime_1.jsxs("div", { style: container, children: [
237
- jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: listRef, values: rootContextMenuItems, onOpen: null }), jsx_runtime_1.jsx(ExplorerQuickSwitcherTrigger_1.ExplorerQuickSwitcherTrigger, { mode: "compositions", showShortcut: true, tabIndex: tabIndex }), jsx_runtime_1.jsx("div", { ref: listRef, className: "__remotion-vertical-scrollbar", style: list, onDragOverCapture: onCompositionListDragOverCapture, onDragEndCapture: stopCompositionListAutoScroll, onDragOver: onRootDragOver, onDragLeave: onRootDragLeave, onDropCapture: stopCompositionListAutoScroll, onDrop: onRootDrop, children: items.map((c) => {
237
+ jsx_runtime_1.jsx(ContextMenu_1.ContextMenuForTarget, { triggerRef: listRef, getItems: getRootContextMenuItems }), jsx_runtime_1.jsx(ExplorerQuickSwitcherTrigger_1.ExplorerQuickSwitcherTrigger, { mode: "compositions", showShortcut: true, tabIndex: tabIndex }), jsx_runtime_1.jsx("div", { ref: listRef, className: "__remotion-vertical-scrollbar", style: list, onDragOverCapture: onCompositionListDragOverCapture, onDragEndCapture: stopCompositionListAutoScroll, onDragOver: onRootDragOver, onDragLeave: onRootDragLeave, onDropCapture: stopCompositionListAutoScroll, onDrop: onRootDrop, children: items.map((c) => {
238
238
  return (jsx_runtime_1.jsx(CompositionSelectorItem_1.CompositionSelectorItem, { level: 0, currentComposition: canvasContent && canvasContent.type === 'composition'
239
239
  ? canvasContent.compositionId
240
240
  : null, selectComposition: selectComposition, toggleFolder: toggleFolder, clearRootDragHover: clearRootDragHover, tabIndex: tabIndex, item: c }, c.key + c.type));
@@ -116,11 +116,11 @@ 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);
123
- const contextMenu = (0, react_1.useMemo)(() => {
123
+ const getContextMenuItems = (0, react_1.useCallback)(() => {
124
124
  if (item.type === 'composition') {
125
125
  return (0, composition_menu_items_1.getCompositionContextMenuItems)({
126
126
  closeMenu: noop_1.noop,
@@ -241,13 +241,13 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
241
241
  }, [clearRootDragHover, item, toggleFolder]);
242
242
  if (item.type === 'folder') {
243
243
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
244
- jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: style, className: "__remotion-composition-selector-item", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, onDragOver: onFolderDragOver, onDragLeave: onFolderDragLeave, onDrop: onFolderDrop, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.folderName }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered })
244
+ 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: style, className: "__remotion-composition-selector-item", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, onDragOver: onFolderDragOver, onDragLeave: onFolderDragLeave, onDrop: onFolderDrop, title: item.folderName, role: "button", children: [item.expanded ? (jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: iconStyle, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT })) : (jsx_runtime_1.jsx(folder_1.CollapsedFolderIcon, { color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.folderName }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { getItems: getContextMenuItems, visible: hovered })
245
245
  ] }) }) }), item.expanded ? (jsx_runtime_1.jsx("div", { onDragOver: onFolderChildListDragOver, onDrop: onFolderDrop, children: item.items.map((childItem) => {
246
246
  return (jsx_runtime_1.jsx(exports.CompositionSelectorItem, { currentComposition: currentComposition, selectComposition: selectComposition, item: childItem, tabIndex: tabIndex, level: level + 1, toggleFolder: toggleFolder, clearRootDragHover: clearRootDragHover }, childItem.key + childItem.type));
247
247
  }) })) : null] }));
248
248
  }
249
- return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenu, onOpen: null, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("a", { ref: compositionRowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, draggable: !window.remotion_isReadOnlyStudio, onDragStart: onCompositionDragStart, onDragEnd: onCompositionDragEnd, type: "button", title: item.composition.id, className: "__remotion-composition __remotion-composition-selector-item", "data-compname": item.composition.id, children: [
250
- jsx_runtime_1.jsx(CompositionOrStillIcon_1.CompositionOrStillIcon, { composition: item.composition, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.composition.id }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered && !isDragging }), jsx_runtime_1.jsx(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered && !isDragging, composition: item.composition })
249
+ 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("a", { ref: compositionRowRef, style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyDown: onKeyDown, draggable: !window.remotion_isReadOnlyStudio, onDragStart: onCompositionDragStart, onDragEnd: onCompositionDragEnd, type: "button", title: item.composition.id, className: "__remotion-composition __remotion-composition-selector-item", "data-compname": item.composition.id, children: [
250
+ jsx_runtime_1.jsx(CompositionOrStillIcon_1.CompositionOrStillIcon, { composition: item.composition, color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT, style: iconStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.composition.id }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(CompositionContextButton_1.CompositionContextButton, { getItems: getContextMenuItems, visible: hovered && !isDragging }), jsx_runtime_1.jsx(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered && !isDragging, composition: item.composition })
251
251
  ] }) }) }));
252
252
  };
253
253
  exports.CompositionSelectorItem = CompositionSelectorItem;
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export declare const ConfigureDefaultEditorModal: React.FC;
2
+ export declare const DefaultEditorSettings: React.FC<{
3
+ readonly onSaved: () => void;
4
+ }>;
@@ -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
8
  const custom_editor_1 = require("../icons/custom-editor");
9
- const modals_1 = require("../state/modals");
10
9
  const call_api_1 = require("./call-api");
11
10
  const layout_1 = require("./layout");
12
11
  const ModalButton_1 = require("./ModalButton");
13
- const ModalContainer_1 = require("./ModalContainer");
14
- const ModalFooter_1 = require("./ModalFooter");
15
- const ModalHeader_1 = require("./ModalHeader");
16
12
  const ComboBox_1 = require("./NewComposition/ComboBox");
17
13
  const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
14
+ const SettingsModalFooter_1 = require("./SettingsModalFooter");
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,6 +29,13 @@ const description = {
27
29
  lineHeight: 1.5,
28
30
  margin: 0,
29
31
  };
32
+ const title = {
33
+ color: colors_1.WHITE,
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%',
@@ -53,10 +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);
65
+ const DefaultEditorSettings = ({ onSaved }) => {
58
66
  const [editorInfo, setEditorInfo] = (0, react_1.useState)(null);
67
+ const [codingAgentInfo, setCodingAgentInfo] = (0, react_1.useState)(null);
59
68
  const [selectedEditor, setSelectedEditor] = (0, react_1.useState)(null);
69
+ const [selectedCodingAgent, setSelectedCodingAgent] = (0, react_1.useState)(null);
60
70
  const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
61
71
  const [error, setError] = (0, react_1.useState)(null);
62
72
  const editorValues = (0, react_1.useMemo)(() => {
@@ -95,17 +105,56 @@ const ConfigureDefaultEditorModal = () => {
95
105
  });
96
106
  return [noPreference, ...installedEditors];
97
107
  }, [editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors, selectedEditor]);
98
- const dismiss = (0, react_1.useCallback)(() => {
99
- setSelectedModal(null);
100
- }, [setSelectedModal]);
108
+ const codingAgentValues = (0, react_1.useMemo)(() => {
109
+ var _a;
110
+ const noPreference = {
111
+ id: NO_PREFERENCE_ID,
112
+ keyHint: null,
113
+ label: 'No preference',
114
+ leftItem: selectedCodingAgent === null ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
115
+ onClick: () => {
116
+ setSelectedCodingAgent(null);
117
+ setError(null);
118
+ },
119
+ quickSwitcherLabel: null,
120
+ subMenu: null,
121
+ type: 'item',
122
+ value: NO_PREFERENCE_ID,
123
+ };
124
+ const installedCodingAgents = ((_a = codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents) !== null && _a !== void 0 ? _a : []).map((codingAgent) => {
125
+ return {
126
+ id: codingAgent.id,
127
+ keyHint: null,
128
+ label: codingAgent.name,
129
+ leftItem: selectedCodingAgent === codingAgent.id ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
130
+ onClick: () => {
131
+ setSelectedCodingAgent(codingAgent.id);
132
+ setError(null);
133
+ },
134
+ quickSwitcherLabel: null,
135
+ subMenu: null,
136
+ type: 'item',
137
+ value: codingAgent.id,
138
+ };
139
+ });
140
+ return [noPreference, ...installedCodingAgents];
141
+ }, [codingAgentInfo === null || codingAgentInfo === void 0 ? void 0 : codingAgentInfo.installedCodingAgents, selectedCodingAgent]);
101
142
  (0, react_1.useEffect)(() => {
102
143
  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
144
+ Promise.all([
145
+ (0, call_api_1.callApi)('/api/default-editor-info', {}, controller.signal),
146
+ (0, call_api_1.callApi)('/api/default-coding-agent-info', {}, controller.signal),
147
+ ])
148
+ .then(([editorResponse, codingAgentResponse]) => {
149
+ setEditorInfo(editorResponse);
150
+ setSelectedEditor(editorResponse.defaultEditor !== null &&
151
+ editorResponse.installedEditors.some(({ id }) => id === editorResponse.defaultEditor)
152
+ ? editorResponse.defaultEditor
153
+ : null);
154
+ setCodingAgentInfo(codingAgentResponse);
155
+ setSelectedCodingAgent(codingAgentResponse.defaultCodingAgent !== null &&
156
+ codingAgentResponse.installedCodingAgents.some(({ id }) => id === codingAgentResponse.defaultCodingAgent)
157
+ ? codingAgentResponse.defaultCodingAgent
109
158
  : null);
110
159
  })
111
160
  .catch((err) => {
@@ -117,35 +166,44 @@ const ConfigureDefaultEditorModal = () => {
117
166
  return () => controller.abort();
118
167
  }, []);
119
168
  const submit = (0, react_1.useCallback)(async () => {
120
- if (editorInfo === null) {
169
+ if (editorInfo === null || codingAgentInfo === null) {
121
170
  return;
122
171
  }
123
172
  setIsSubmitting(true);
124
173
  setError(null);
125
174
  try {
126
- const response = await (0, call_api_1.callApi)('/api/update-default-editor', {
175
+ const editorResponse = await (0, call_api_1.callApi)('/api/update-default-editor', {
127
176
  defaultEditor: selectedEditor,
128
177
  });
129
- if (!response.success) {
130
- setError(response.reason);
178
+ if (!editorResponse.success) {
179
+ setError(editorResponse.reason);
180
+ setIsSubmitting(false);
181
+ return;
182
+ }
183
+ const codingAgentResponse = await (0, call_api_1.callApi)('/api/update-default-coding-agent', { defaultCodingAgent: selectedCodingAgent });
184
+ if (!codingAgentResponse.success) {
185
+ setError(codingAgentResponse.reason);
131
186
  setIsSubmitting(false);
132
187
  return;
133
188
  }
134
- dismiss();
189
+ onSaved();
135
190
  }
136
191
  catch (err) {
137
192
  setError(err.message);
138
193
  setIsSubmitting(false);
139
194
  }
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: [
195
+ }, [
196
+ codingAgentInfo,
197
+ editorInfo,
198
+ onSaved,
199
+ selectedCodingAgent,
200
+ selectedEditor,
201
+ ]);
202
+ return (jsx_runtime_1.jsxs("div", { style: container, children: [
203
+ jsx_runtime_1.jsxs("div", { style: content, children: [
204
+ jsx_runtime_1.jsx("p", { style: title, children: "Default editor" }), jsx_runtime_1.jsx("p", { style: description, children: "Used when Remotion Studio opens source files." }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), editorInfo === null && error === 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("p", { style: description, children: "Used when Remotion Studio hands a project to a coding agent." }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), codingAgentInfo === null && error === 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" })), error ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
147
205
  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' }) }) })
206
+ ] })) : null] }), jsx_runtime_1.jsx(SettingsModalFooter_1.SettingsModalFooter, { children: jsx_runtime_1.jsx(ModalButton_1.ModalButton, { onClick: submit, disabled: isSubmitting || editorInfo === null || codingAgentInfo === null, children: isSubmitting ? 'Saving...' : 'Save and reload' }) })
149
207
  ] }));
150
208
  };
151
- exports.ConfigureDefaultEditorModal = ConfigureDefaultEditorModal;
209
+ exports.DefaultEditorSettings = DefaultEditorSettings;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
- export declare const ConfigureLicenseModal: React.FC<{
2
+ export declare const LicenseSettings: React.FC<{
3
3
  readonly initialPublicLicenseKey: string | null;
4
+ readonly onSaved: () => void;
4
5
  }>;
@@ -1,24 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigureLicenseModal = void 0;
3
+ exports.LicenseSettings = 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 modals_1 = require("../state/modals");
8
7
  const call_api_1 = require("./call-api");
9
8
  const Checkbox_1 = require("./Checkbox");
10
9
  const layout_1 = require("./layout");
11
10
  const LicenseKeyValidation_1 = require("./LicenseKeyValidation");
12
11
  const ModalButton_1 = require("./ModalButton");
13
- const ModalContainer_1 = require("./ModalContainer");
14
- const ModalFooter_1 = require("./ModalFooter");
15
- const ModalHeader_1 = require("./ModalHeader");
16
12
  const RemInput_1 = require("./NewComposition/RemInput");
17
13
  const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
14
+ const SettingsModalFooter_1 = require("./SettingsModalFooter");
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: 540,
21
- maxWidth: 'calc(100vw - 40px)',
22
24
  };
23
25
  const description = {
24
26
  color: colors_1.LIGHT_TEXT,
@@ -26,7 +28,6 @@ const description = {
26
28
  fontSize: 14,
27
29
  lineHeight: 1.5,
28
30
  margin: 0,
29
- marginTop: 10,
30
31
  };
31
32
  const descriptionLink = {
32
33
  color: colors_1.WHITE,
@@ -59,8 +60,7 @@ const inputLabel = {
59
60
  marginBottom: 6,
60
61
  marginTop: 10,
61
62
  };
62
- const ConfigureLicenseModal = ({ initialPublicLicenseKey }) => {
63
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
63
+ const LicenseSettings = ({ initialPublicLicenseKey, onSaved }) => {
64
64
  const initialLicenseType = initialPublicLicenseKey === 'free-license'
65
65
  ? 'free'
66
66
  : initialPublicLicenseKey === null
@@ -73,17 +73,16 @@ const ConfigureLicenseModal = ({ initialPublicLicenseKey }) => {
73
73
  const [isValidatingLicenseKey, setIsValidatingLicenseKey] = (0, react_1.useState)(false);
74
74
  const [remoteValidationMessage, setRemoteValidationMessage] = (0, react_1.useState)(null);
75
75
  const [licenseKeyDetails, setLicenseKeyDetails] = (0, react_1.useState)(null);
76
- const dismiss = (0, react_1.useCallback)(() => {
77
- setSelectedModal(null);
78
- }, [setSelectedModal]);
79
- const chooseFreeLicense = (0, react_1.useCallback)(() => {
80
- setLicenseType('free');
81
- setError(null);
82
- }, []);
83
- const chooseCompanyLicense = (0, react_1.useCallback)(() => {
84
- setLicenseType('company');
76
+ const toggleLicenseType = (0, react_1.useCallback)((newLicenseType) => {
77
+ setLicenseType((currentLicenseType) => currentLicenseType === newLicenseType ? null : newLicenseType);
85
78
  setError(null);
86
79
  }, []);
80
+ const toggleFreeLicense = (0, react_1.useCallback)(() => {
81
+ toggleLicenseType('free');
82
+ }, [toggleLicenseType]);
83
+ const toggleCompanyLicense = (0, react_1.useCallback)(() => {
84
+ toggleLicenseType('company');
85
+ }, [toggleLicenseType]);
87
86
  const publicLicenseKey = (0, react_1.useMemo)(() => {
88
87
  if (licenseType === 'free') {
89
88
  return 'free-license';
@@ -153,20 +152,29 @@ const ConfigureLicenseModal = ({ initialPublicLicenseKey }) => {
153
152
  setIsSubmitting(false);
154
153
  return;
155
154
  }
156
- dismiss();
155
+ onSaved();
157
156
  }
158
157
  catch (err) {
159
158
  setError(err.message);
160
159
  setIsSubmitting(false);
161
160
  }
162
- }, [companyLicenseKeyIsValid, dismiss, licenseType, publicLicenseKey]);
163
- return (jsx_runtime_1.jsxs(ModalContainer_1.ModalContainer, { onEscape: dismiss, onOutsideClick: dismiss, children: [
164
- jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: "Configure License", onClose: dismiss }), jsx_runtime_1.jsxs("div", { style: content, children: [
165
- jsx_runtime_1.jsxs("p", { style: description, children: ["Remotion is free if you are an individual or company with a headcount of 3 or less. See", ' ', jsx_runtime_1.jsx("a", { style: descriptionLink, href: "https://remotion.dev/license", children: "LICENSE.md" }),
166
- "."] }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2 }), jsx_runtime_1.jsxs("div", { style: checkboxRow, onClick: chooseFreeLicense, children: [
167
- jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: licenseType === 'free', onChange: chooseFreeLicense, name: "free-license", rounded: true }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: checkboxLabel, children: "I am eligible for the Free License" })
168
- ] }), jsx_runtime_1.jsxs("div", { style: checkboxRow, onClick: chooseCompanyLicense, children: [
169
- jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: licenseType === 'company', onChange: chooseCompanyLicense, name: "company-license", rounded: true }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: checkboxLabel, children: "I need a Company License" })
161
+ }, [companyLicenseKeyIsValid, licenseType, onSaved, publicLicenseKey]);
162
+ return (jsx_runtime_1.jsxs("div", { style: container, children: [
163
+ jsx_runtime_1.jsxs("div", { style: content, children: [
164
+ jsx_runtime_1.jsxs("p", { style: description, children: ["Remotion is free to use if you are an individual or company with a headcount of 3 or less.",
165
+ jsx_runtime_1.jsx("br", {}),
166
+ "If used in an organization with 4 people or more, a", ' ', jsx_runtime_1.jsx("a", { style: descriptionLink, href: "https://remotion.pro/license", children: "Company License" }), ' needs to be obtained.'] }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 2 }), jsx_runtime_1.jsxs("div", { style: checkboxRow, onClick: (event) => {
167
+ if (!(event.target instanceof HTMLInputElement)) {
168
+ toggleFreeLicense();
169
+ }
170
+ }, children: [
171
+ jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: licenseType === 'free', onChange: toggleFreeLicense, name: "free-license", rounded: true }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: checkboxLabel, children: "I am eligible for the Free License" })
172
+ ] }), jsx_runtime_1.jsxs("div", { style: checkboxRow, onClick: (event) => {
173
+ if (!(event.target instanceof HTMLInputElement)) {
174
+ toggleCompanyLicense();
175
+ }
176
+ }, children: [
177
+ jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: licenseType === 'company', onChange: toggleCompanyLicense, name: "company-license", rounded: true }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: checkboxLabel, children: "I need a Company License" })
170
178
  ] }), licenseType === 'company' ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
171
179
  jsx_runtime_1.jsxs("p", { style: description, children: ["Visit", ' ', jsx_runtime_1.jsx("a", { style: descriptionLink, href: "https://remotion.pro/license", children: "remotion.pro/license" }), ' ', "to obtain a license key. Enter the public license key from", ' "License Keys".'] }), jsx_runtime_1.jsxs("label", { style: inputLabel, children: ["Public license key",
172
180
  jsx_runtime_1.jsx(RemInput_1.RemotionInput, { status: localLicenseKeyValidation.message ||
@@ -186,9 +194,9 @@ const ConfigureLicenseModal = ({ initialPublicLicenseKey }) => {
186
194
  jsx_runtime_1.jsx(layout_1.Spacing, { y: 1 }), jsx_runtime_1.jsx("p", { style: description, children: "Loading license key details..." })
187
195
  ] })) : null, licenseKeyDetails ? (jsx_runtime_1.jsx(LicenseKeyValidation_1.LicenseKeyDetailsDisplay, { details: licenseKeyDetails })) : null] })) : null, error ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
188
196
  jsx_runtime_1.jsx(layout_1.Spacing, { y: 1.5 }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: error, align: "flex-start", type: "error" })
189
- ] })) : 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 ||
190
- publicLicenseKey.length === 0 ||
191
- (licenseType === 'company' && !companyLicenseKeyIsValid), autoFocus: licenseType !== 'company', children: isSubmitting ? 'Submitting...' : 'Submit and reload' }) }) })
197
+ ] })) : null] }), jsx_runtime_1.jsx(SettingsModalFooter_1.SettingsModalFooter, { children: jsx_runtime_1.jsx(ModalButton_1.ModalButton, { onClick: submit, disabled: isSubmitting ||
198
+ publicLicenseKey.length === 0 ||
199
+ (licenseType === 'company' && !companyLicenseKeyIsValid), autoFocus: licenseType !== 'company', children: isSubmitting ? 'Submitting...' : 'Submit and reload' }) })
192
200
  ] }));
193
201
  };
194
- exports.ConfigureLicenseModal = ConfigureLicenseModal;
202
+ exports.LicenseSettings = LicenseSettings;
@@ -23,7 +23,7 @@ const footerStyle = {
23
23
  minWidth: 0,
24
24
  };
25
25
  const useConfirmationDialog = () => {
26
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
26
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
27
27
  return (0, react_1.useCallback)((options) => {
28
28
  return new Promise((resolve) => {
29
29
  var _a, _b;
@@ -50,7 +50,7 @@ const useConfirmationDialog = () => {
50
50
  };
51
51
  exports.useConfirmationDialog = useConfirmationDialog;
52
52
  const ConfirmationDialog = ({ state }) => {
53
- const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
53
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
54
54
  const settledRef = (0, react_1.useRef)(false);
55
55
  const closeCurrentModal = (0, react_1.useCallback)(() => {
56
56
  setSelectedModal((modal) => (modal === null || modal === void 0 ? void 0 : modal.type) === 'confirmation-dialog' && modal.id === state.id
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { ComboboxValue } from './NewComposition/ComboBox';
3
- type ContextMenuOpenHandler = () => false | void;
4
- type ContextMenuTargetOpenResult = false | void | readonly ComboboxValue[];
5
- type ContextMenuTargetOpenHandler = (event: MouseEvent) => ContextMenuTargetOpenResult | Promise<ContextMenuTargetOpenResult>;
3
+ type ContextMenuItemsResult = false | readonly ComboboxValue[];
4
+ export type ContextMenuItemsFactory = (event: MouseEvent) => ContextMenuItemsResult | Promise<ContextMenuItemsResult>;
5
+ export declare const resolveContextMenuItems: (getItems: ContextMenuItemsFactory, event: MouseEvent) => Promise<readonly ComboboxValue[] | null>;
6
6
  type ContextMenuProps = {
7
7
  readonly children: React.ReactNode;
8
- readonly values: ComboboxValue[];
9
- readonly onOpen: ContextMenuOpenHandler | null;
8
+ readonly getItems: ContextMenuItemsFactory;
10
9
  readonly style?: React.CSSProperties;
11
10
  readonly className?: string;
12
11
  readonly onPointerDown?: React.PointerEventHandler<HTMLDivElement>;
@@ -14,7 +13,6 @@ type ContextMenuProps = {
14
13
  export declare const ContextMenu: React.ForwardRefExoticComponent<ContextMenuProps & React.RefAttributes<HTMLDivElement>>;
15
14
  export declare const ContextMenuForTarget: React.FC<{
16
15
  readonly triggerRef: React.RefObject<HTMLElement | SVGElement | null>;
17
- readonly values: ComboboxValue[];
18
- readonly onOpen: ContextMenuTargetOpenHandler | null;
16
+ readonly getItems: ContextMenuItemsFactory;
19
17
  }>;
20
18
  export {};