@remotion/studio 4.0.502 → 4.0.504
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.
- package/dist/api/install-package.d.ts +2 -1
- package/dist/api/install-package.js +6 -2
- package/dist/components/AssetSelectorItem.js +4 -16
- package/dist/components/Canvas.js +41 -54
- package/dist/components/CheckboardToggle.js +3 -1
- package/dist/components/ColorPicker/AlphaSlider.js +14 -10
- package/dist/components/ColorPicker/HueSlider.js +14 -10
- package/dist/components/ColorPicker/SaturationValueArea.js +14 -12
- package/dist/components/CompositionContextButton.js +1 -1
- package/dist/components/CompositionSelectorItem.js +2 -3
- package/dist/components/ConfigureDefaultEditorModal.d.ts +2 -0
- package/dist/components/ConfigureDefaultEditorModal.js +151 -0
- package/dist/components/ConfirmationDialog.js +6 -3
- package/dist/components/ContextMenu.js +0 -2
- package/dist/components/ControlButton.d.ts +4 -2
- package/dist/components/ControlButton.js +6 -20
- package/dist/components/Editor.js +1 -4
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/EditorGuides/Guide.js +48 -74
- package/dist/components/EditorRuler/Ruler.d.ts +1 -0
- package/dist/components/EditorRuler/Ruler.js +3 -1
- package/dist/components/EditorRuler/index.js +26 -23
- package/dist/components/EffectPickerModal.js +68 -7
- package/dist/components/ElementInstallConfirmation.d.ts +12 -0
- package/dist/components/ElementInstallConfirmation.js +205 -0
- package/dist/components/ForceSpecificCursor.js +14 -0
- package/dist/components/FullscreenToggle.js +1 -2
- package/dist/components/InitialCompositionLoader.js +1 -14
- package/dist/components/InlineAction.d.ts +4 -4
- package/dist/components/InlineAction.js +6 -4
- package/dist/components/InspectorLocationCopy.d.ts +1 -0
- package/dist/components/InspectorLocationCopy.js +7 -3
- package/dist/components/InspectorOpenInEditor.d.ts +5 -0
- package/dist/components/InspectorOpenInEditor.js +135 -0
- package/dist/components/InspectorPanel/AlignmentControls.js +1 -1
- package/dist/components/InspectorPanel/CompositionInspectorHeader.js +3 -3
- package/dist/components/InspectorPanel/CompositionMetadata.js +8 -7
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +2 -2
- package/dist/components/InspectorPanel/KeyframeInspector.js +2 -3
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +2 -2
- package/dist/components/InspectorPanel/styles.js +4 -0
- package/dist/components/InspectorSequenceSection.js +2 -2
- package/dist/components/LoopToggle.js +1 -1
- package/dist/components/Menu/MenuItem.js +13 -6
- package/dist/components/Menu/MenuSubItem.js +3 -1
- package/dist/components/MenuBuildIndicator.d.ts +3 -1
- package/dist/components/MenuBuildIndicator.js +6 -4
- package/dist/components/MenuCompositionName.js +1 -1
- package/dist/components/MenuToolbar.js +1 -1
- package/dist/components/MobilePanel.d.ts +1 -2
- package/dist/components/MobilePanel.js +6 -6
- package/dist/components/ModalContainer.js +1 -1
- package/dist/components/ModalFooter.d.ts +1 -0
- package/dist/components/ModalFooter.js +2 -2
- package/dist/components/Modals.js +11 -2
- package/dist/components/MuteToggle.js +2 -1
- package/dist/components/NewComposition/ComboBox.d.ts +1 -0
- package/dist/components/NewComposition/ComboBox.js +2 -2
- package/dist/components/NewComposition/InputDragger.d.ts +4 -0
- package/dist/components/NewComposition/InputDragger.js +26 -32
- package/dist/components/Notifications/NotificationCenter.js +12 -2
- package/dist/components/OutlineToggle.js +10 -2
- package/dist/components/PlayPause.js +1 -5
- package/dist/components/PlaybackRateSelector.js +2 -1
- package/dist/components/PreviewToolbar.js +8 -7
- package/dist/components/PreviewToolbarOverflowButton.d.ts +0 -1
- package/dist/components/PreviewToolbarOverflowButton.js +2 -75
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +1 -2
- package/dist/components/RenderButton.d.ts +0 -1
- package/dist/components/RenderButton.js +10 -9
- package/dist/components/RenderModal/FrameRangeSetting.js +6 -1
- package/dist/components/RenderModal/InlineEyeIcon.js +1 -1
- package/dist/components/RenderModal/InlineRemoveButton.js +1 -1
- package/dist/components/RenderModal/MultiRangeSlider.js +8 -8
- package/dist/components/RenderModal/RenderModalEnvironmentVariables.js +1 -9
- package/dist/components/RenderModal/RenderModalOutputName.js +12 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaResetButton.js +1 -1
- package/dist/components/RenderModal/ServerRenderModal.js +2 -17
- package/dist/components/RenderModal/WebRenderModal.js +3 -17
- package/dist/components/RenderModal/layout.js +7 -5
- package/dist/components/RenderModal/render-modals.js +18 -15
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +1 -1
- package/dist/components/RenderQueue/RenderQueueDownloadItem.js +1 -1
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +1 -1
- package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +2 -15
- package/dist/components/SelectedOutlineCropControls.js +7 -6
- package/dist/components/SelectedOutlineElement.js +32 -38
- package/dist/components/SelectedOutlineUvControls.js +25 -24
- package/dist/components/ShowGuidesProvider.js +2 -0
- package/dist/components/SidebarCollapserControls.js +2 -2
- package/dist/components/SidebarRenderButton.js +2 -16
- package/dist/components/SizeSelector.js +2 -1
- package/dist/components/SnappingToggle.js +1 -2
- package/dist/components/Spinner.d.ts +1 -0
- package/dist/components/Spinner.js +2 -2
- package/dist/components/Splitter/SplitterContainer.d.ts +1 -0
- package/dist/components/Splitter/SplitterContainer.js +4 -1
- package/dist/components/Splitter/SplitterContext.d.ts +4 -3
- package/dist/components/Splitter/SplitterContext.js +3 -2
- package/dist/components/Splitter/SplitterElement.js +6 -1
- package/dist/components/Splitter/SplitterHandle.js +18 -68
- package/dist/components/Tabs/vertical.d.ts +1 -0
- package/dist/components/Tabs/vertical.js +8 -10
- package/dist/components/TimeValue.js +26 -8
- package/dist/components/Timeline/EasingEditorModal.js +27 -19
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Timeline/TimelineAssetField.js +1 -1
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +3 -6
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +5 -7
- package/dist/components/Timeline/TimelineDragHandler.js +38 -7
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +2 -1
- package/dist/components/Timeline/TimelineInOutDragHandler.js +26 -11
- package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +1 -1
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +2 -2
- package/dist/components/Timeline/TimelineLayerEye.js +36 -4
- package/dist/components/Timeline/TimelineSelection.js +16 -24
- package/dist/components/Timeline/TimelineSequence.js +7 -3
- package/dist/components/Timeline/TimelineSequenceItem.js +24 -18
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +1 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +76 -43
- package/dist/components/Timeline/TimelineStack/get-stack.js +7 -2
- package/dist/components/Timeline/TimelineZoomControls.d.ts +3 -1
- package/dist/components/Timeline/TimelineZoomControls.js +24 -12
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +4 -2
- package/dist/components/Timeline/get-sequence-context-menu-items.js +38 -2
- package/dist/components/Timeline/should-subscribe-to-source-file.d.ts +1 -0
- package/dist/components/Timeline/should-subscribe-to-source-file.js +11 -0
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +2 -3
- package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +3 -1
- package/dist/components/Timeline/use-open-sequence-in-editor.js +5 -2
- package/dist/components/Timeline/use-sequence-props-subscription.js +2 -0
- package/dist/components/Timeline/use-timeline-asset-drop.js +3 -7
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +31 -16
- package/dist/components/TimelineInOutToggle.js +3 -3
- package/dist/components/TopPanel.js +3 -2
- package/dist/components/UndoRedoButtons.js +6 -5
- package/dist/components/UpdateCheck.d.ts +2 -0
- package/dist/components/UpdateCheck.js +29 -11
- package/dist/components/UpdateModal/UpdateModal.js +58 -19
- package/dist/components/VisualControls/ClickableFileName.js +5 -2
- package/dist/components/composition-menu-items.d.ts +2 -4
- package/dist/components/composition-menu-items.js +32 -55
- package/dist/components/element-install-request.d.ts +3 -0
- package/dist/components/element-install-request.js +17 -0
- package/dist/components/folder-menu-items.js +1 -1
- package/dist/components/handle-drop.d.ts +2 -3
- package/dist/components/handle-drop.js +11 -4
- package/dist/components/import-assets.d.ts +7 -6
- package/dist/components/import-assets.js +5 -16
- package/dist/components/use-default-editor-info.d.ts +4 -0
- package/dist/components/use-default-editor-info.js +47 -0
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +1 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.js +1 -1
- package/dist/esm/{chunk-fjv75ty4.js → chunk-43m68z1k.js} +8689 -7374
- package/dist/esm/internals.mjs +8689 -7374
- package/dist/esm/previewEntry.mjs +8668 -7353
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +58 -67
- package/dist/helpers/install-required-package.d.ts +3 -2
- package/dist/helpers/install-required-package.js +20 -15
- package/dist/helpers/open-in-editor.d.ts +3 -3
- package/dist/helpers/open-in-editor.js +10 -6
- package/dist/helpers/pointer-session.d.ts +9 -0
- package/dist/helpers/pointer-session.js +94 -0
- package/dist/helpers/use-menu-structure.js +109 -51
- package/dist/icons/audio.d.ts +1 -1
- package/dist/icons/audio.js +1 -1
- package/dist/icons/caret.js +1 -1
- package/dist/icons/certificate.d.ts +1 -1
- package/dist/icons/certificate.js +1 -1
- package/dist/icons/custom-editor.d.ts +4 -0
- package/dist/icons/custom-editor.js +11 -0
- package/dist/icons/data.d.ts +1 -1
- package/dist/icons/data.js +2 -2
- package/dist/icons/editor.d.ts +6 -0
- package/dist/icons/editor.js +52 -0
- package/dist/icons/effects.d.ts +5 -0
- package/dist/icons/effects.js +8 -0
- package/dist/icons/ellipsis.js +1 -1
- package/dist/icons/external-link.d.ts +5 -0
- package/dist/icons/external-link.js +10 -0
- package/dist/icons/fullscreen.js +1 -1
- package/dist/icons/gear.d.ts +1 -1
- package/dist/icons/gear.js +1 -1
- package/dist/icons/gif.d.ts +1 -1
- package/dist/icons/gif.js +1 -1
- package/dist/icons/input-props.d.ts +2 -0
- package/dist/icons/input-props.js +9 -0
- package/dist/icons/jump-to-start.js +2 -2
- package/dist/icons/magnet.d.ts +3 -1
- package/dist/icons/magnet.js +2 -2
- package/dist/icons/media-volume.d.ts +6 -2
- package/dist/icons/media-volume.js +8 -6
- package/dist/icons/minus.d.ts +3 -1
- package/dist/icons/minus.js +2 -2
- package/dist/icons/pause.js +1 -1
- package/dist/icons/play.js +1 -1
- package/dist/icons/plus.js +1 -1
- package/dist/icons/redo.js +2 -2
- package/dist/icons/step-back.js +2 -2
- package/dist/icons/step-forward.js +2 -2
- package/dist/icons/timelineInOutPointer.js +2 -2
- package/dist/icons/undo.js +2 -2
- package/dist/state/editor-guides.d.ts +1 -0
- package/dist/state/editor-guides.js +1 -0
- package/dist/state/modals.d.ts +2 -0
- package/dist/state/z-index.d.ts +1 -0
- package/dist/state/z-index.js +34 -18
- package/package.json +12 -13
- package/dist/components/StudioCanvasCapture.d.ts +0 -5
- package/dist/components/StudioCanvasCapture.js +0 -40
- package/dist/components/canvas-capture-enabled.d.ts +0 -1
- package/dist/components/canvas-capture-enabled.js +0 -4
- package/dist/components/use-element-overwrite-confirmation.d.ts +0 -2
- package/dist/components/use-element-overwrite-confirmation.js +0 -73
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { ElementDependency } from '@remotion/studio-protocol';
|
|
1
2
|
import type { InstallPackageResponse } from '@remotion/studio-shared';
|
|
2
|
-
export declare const installPackages: (
|
|
3
|
+
export declare const installPackages: (dependencies: (string | ElementDependency)[]) => Promise<InstallPackageResponse>;
|
|
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.installPackages = void 0;
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
5
|
const call_api_1 = require("../components/call-api");
|
|
6
|
-
const installPackages = (
|
|
6
|
+
const installPackages = (dependencies) => {
|
|
7
7
|
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
8
8
|
throw new Error('installPackages() is only available in the Studio');
|
|
9
9
|
}
|
|
10
10
|
if (window.remotion_isReadOnlyStudio) {
|
|
11
11
|
throw new Error('installPackages() is not available in Read-Only Studio');
|
|
12
12
|
}
|
|
13
|
-
return (0, call_api_1.callApi)('/api/install-package', {
|
|
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),
|
|
17
|
+
});
|
|
14
18
|
};
|
|
15
19
|
exports.installPackages = installPackages;
|
|
@@ -46,7 +46,6 @@ const colors_1 = require("../helpers/colors");
|
|
|
46
46
|
const copy_text_1 = require("../helpers/copy-text");
|
|
47
47
|
const get_file_manager_name_1 = require("../helpers/get-file-manager-name");
|
|
48
48
|
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
49
|
-
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
50
49
|
const sidebar_scroll_into_view_1 = require("../helpers/sidebar-scroll-into-view");
|
|
51
50
|
const url_state_1 = require("../helpers/url-state");
|
|
52
51
|
const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-events"));
|
|
@@ -55,7 +54,6 @@ const use_media_metadata_1 = require("../helpers/use-media-metadata");
|
|
|
55
54
|
const clipboard_1 = require("../icons/clipboard");
|
|
56
55
|
const folder_1 = require("../icons/folder");
|
|
57
56
|
const modals_1 = require("../state/modals");
|
|
58
|
-
const sidebar_1 = require("../state/sidebar");
|
|
59
57
|
const AssetFileIcon_1 = require("./AssetFileIcon");
|
|
60
58
|
const ConfirmationDialog_1 = require("./ConfirmationDialog");
|
|
61
59
|
const ContextMenu_1 = require("./ContextMenu");
|
|
@@ -260,10 +258,8 @@ const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabInd
|
|
|
260
258
|
exports.AssetFolderTree = AssetFolderTree;
|
|
261
259
|
const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
|
|
262
260
|
const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
|
|
263
|
-
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
264
261
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
265
262
|
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
266
|
-
const { setSidebarCollapsedState } = (0, react_1.useContext)(sidebar_1.SidebarContext);
|
|
267
263
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
268
264
|
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
269
265
|
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
@@ -303,15 +299,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
303
299
|
(0, sidebar_scroll_into_view_1.markAssetSidebarScrollFromRowClick)(relativePath);
|
|
304
300
|
setCanvasContent({ type: 'asset', asset: relativePath });
|
|
305
301
|
(0, url_state_1.pushUrl)(`/assets/${relativePath}`);
|
|
306
|
-
|
|
307
|
-
setSidebarCollapsedState({ left: 'collapsed', right: 'collapsed' });
|
|
308
|
-
}
|
|
309
|
-
}, [
|
|
310
|
-
isMobileLayout,
|
|
311
|
-
relativePath,
|
|
312
|
-
setCanvasContent,
|
|
313
|
-
setSidebarCollapsedState,
|
|
314
|
-
]);
|
|
302
|
+
}, [relativePath, setCanvasContent]);
|
|
315
303
|
const onDragStart = (0, react_1.useCallback)((e) => {
|
|
316
304
|
var _a, _b, _c, _d;
|
|
317
305
|
if (!canDragAsset) {
|
|
@@ -468,8 +456,8 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
468
456
|
copyStaticFilePath();
|
|
469
457
|
}, [copyStaticFilePath]);
|
|
470
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: [
|
|
471
|
-
jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name }), hovered && !isDragging ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
472
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() path", renderAction: renderCopyAction, onClick: copyToClipboard }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
473
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer })
|
|
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
|
+
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
|
+
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 })
|
|
474
462
|
] }))] })) : null] }) }) }));
|
|
475
463
|
};
|
|
@@ -33,6 +33,8 @@ const EditorGuides_1 = __importDefault(require("./EditorGuides"));
|
|
|
33
33
|
const EditorRuler_1 = require("./EditorRuler");
|
|
34
34
|
const use_is_ruler_visible_1 = require("./EditorRuler/use-is-ruler-visible");
|
|
35
35
|
const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
|
|
36
|
+
const element_install_request_1 = require("./element-install-request");
|
|
37
|
+
const ElementInstallConfirmation_1 = require("./ElementInstallConfirmation");
|
|
36
38
|
const handle_drop_1 = require("./handle-drop");
|
|
37
39
|
const import_assets_1 = require("./import-assets");
|
|
38
40
|
const layout_1 = require("./layout");
|
|
@@ -42,44 +44,7 @@ const ResetZoomButton_1 = require("./ResetZoomButton");
|
|
|
42
44
|
const SvgImportDialog_1 = require("./SvgImportDialog");
|
|
43
45
|
const imperative_state_1 = require("./Timeline/imperative-state");
|
|
44
46
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
45
|
-
const
|
|
46
|
-
const elementInstallCompositionIdStyle = {
|
|
47
|
-
fontFamily: 'monospace',
|
|
48
|
-
fontSize: 13,
|
|
49
|
-
};
|
|
50
|
-
const elementInstallDependencyListStyle = {
|
|
51
|
-
marginTop: 8,
|
|
52
|
-
marginBottom: 0,
|
|
53
|
-
paddingLeft: 24,
|
|
54
|
-
listStyleType: 'disc',
|
|
55
|
-
};
|
|
56
|
-
const elementInstallDependencyStyle = {
|
|
57
|
-
color: 'inherit',
|
|
58
|
-
fontFamily: 'monospace',
|
|
59
|
-
fontSize: 13,
|
|
60
|
-
lineHeight: 1.5,
|
|
61
|
-
};
|
|
62
|
-
const elementInstallCodeDetailsStyle = {
|
|
63
|
-
marginTop: 12,
|
|
64
|
-
fontSize: 13,
|
|
65
|
-
};
|
|
66
|
-
const elementInstallCodeSummaryStyle = {
|
|
67
|
-
cursor: 'pointer',
|
|
68
|
-
fontSize: 13,
|
|
69
|
-
fontWeight: 500,
|
|
70
|
-
};
|
|
71
|
-
const elementInstallCodeBlockStyle = {
|
|
72
|
-
marginTop: 8,
|
|
73
|
-
marginBottom: 0,
|
|
74
|
-
maxHeight: 240,
|
|
75
|
-
overflow: 'auto',
|
|
76
|
-
padding: 12,
|
|
77
|
-
borderRadius: 6,
|
|
78
|
-
backgroundColor: 'rgba(255, 255, 255, 0.06)',
|
|
79
|
-
fontSize: 12,
|
|
80
|
-
lineHeight: 1.5,
|
|
81
|
-
whiteSpace: 'pre',
|
|
82
|
-
};
|
|
47
|
+
const elementInstallDependencyIgnoreList = ['react', 'react-dom', 'remotion'];
|
|
83
48
|
const getContainerStyle = (editorZoomGestures) => ({
|
|
84
49
|
flex: 1,
|
|
85
50
|
display: 'flex',
|
|
@@ -159,7 +124,6 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
159
124
|
const touchPinchRef = (0, react_1.useRef)(null);
|
|
160
125
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
161
126
|
const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
|
|
162
|
-
const confirmElementOverwrite = (0, use_element_overwrite_confirmation_1.useElementOverwriteConfirmation)();
|
|
163
127
|
const chooseSvgImportMode = (0, SvgImportDialog_1.useSvgImportDialog)();
|
|
164
128
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
165
129
|
const areRulersVisible = (0, use_is_ruler_visible_1.useIsRulerVisible)();
|
|
@@ -646,6 +610,11 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
646
610
|
]);
|
|
647
611
|
});
|
|
648
612
|
}, [previewServerClientId, subscribeToEvent]);
|
|
613
|
+
(0, react_1.useEffect)(() => {
|
|
614
|
+
return (0, element_install_request_1.subscribeToElementInstallRequests)((request) => {
|
|
615
|
+
setPendingElementInstallRequests((requests) => [...requests, request]);
|
|
616
|
+
});
|
|
617
|
+
}, []);
|
|
649
618
|
(0, react_1.useEffect)(() => {
|
|
650
619
|
if (activeElementInstallRequest !== null ||
|
|
651
620
|
pendingElementInstallRequests.length === 0) {
|
|
@@ -665,17 +634,36 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
665
634
|
let canceled = false;
|
|
666
635
|
const handleInstallRequest = async () => {
|
|
667
636
|
setInstallingElementName(activeElementInstallRequest.element.displayName);
|
|
668
|
-
const
|
|
637
|
+
const preflight = await (0, call_api_1.callApi)('/api/prepare-element-install', {
|
|
638
|
+
compositionFile: activeElementInstallRequest.compositionFile,
|
|
639
|
+
compositionId: activeElementInstallRequest.compositionId,
|
|
640
|
+
element: activeElementInstallRequest.element,
|
|
641
|
+
});
|
|
642
|
+
if (!preflight.success) {
|
|
643
|
+
(0, NotificationCenter_1.showNotification)(`Could not review Element installation: ${preflight.reason}`, 4000);
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (canceled) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
const declaredDependencies = Array.from(new Map(activeElementInstallRequest.element.dependencies.map((dependency) => [
|
|
650
|
+
dependency.name,
|
|
651
|
+
dependency,
|
|
652
|
+
])).values());
|
|
653
|
+
const missingPackages = (0, install_required_package_1.getMissingPackages)(declaredDependencies).map((dependency) => dependency.name);
|
|
654
|
+
const ignoredDependencies = declaredDependencies.filter((dependency) => elementInstallDependencyIgnoreList.includes(dependency.name) &&
|
|
655
|
+
!missingPackages.includes(dependency.name));
|
|
656
|
+
const dependenciesToReview = declaredDependencies
|
|
657
|
+
.filter((dependency) => !ignoredDependencies.includes(dependency))
|
|
658
|
+
.map((dependency) => dependency.version === null
|
|
659
|
+
? dependency.name
|
|
660
|
+
: `${dependency.name}@${dependency.version}`);
|
|
661
|
+
const sourceLabel = activeElementInstallRequest.source.type === 'studio-protocol'
|
|
662
|
+
? activeElementInstallRequest.source.origin
|
|
663
|
+
: 'Unverified drag-and-drop payload';
|
|
669
664
|
const accepted = await confirm({
|
|
670
665
|
title: 'Install Element',
|
|
671
|
-
message: (jsx_runtime_1.
|
|
672
|
-
jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("br", {}),
|
|
673
|
-
"The following dependencies will also be installed:",
|
|
674
|
-
jsx_runtime_1.jsx("ul", { style: elementInstallDependencyListStyle, children: missingPackages.map((packageName) => (jsx_runtime_1.jsx("li", { style: elementInstallDependencyStyle, children: packageName }, packageName))) })
|
|
675
|
-
] })) : null, jsx_runtime_1.jsxs("details", { style: elementInstallCodeDetailsStyle, children: [
|
|
676
|
-
jsx_runtime_1.jsx("summary", { style: elementInstallCodeSummaryStyle, children: "Preview Element source" }), jsx_runtime_1.jsx("pre", { style: elementInstallCodeBlockStyle, children: jsx_runtime_1.jsx("code", { children: activeElementInstallRequest.element.sourceCode }) })
|
|
677
|
-
] })
|
|
678
|
-
] })),
|
|
666
|
+
message: (jsx_runtime_1.jsx(ElementInstallConfirmation_1.ElementInstallConfirmation, { displayName: activeElementInstallRequest.element.displayName, sourceLabel: sourceLabel, sourceIsUnverified: activeElementInstallRequest.source.type === 'drag-and-drop', compositionId: activeElementInstallRequest.compositionId, filePath: preflight.plan.filePath, overwritesExistingFile: preflight.plan.expectedFileState.exists, dependenciesToReview: dependenciesToReview, missingPackages: missingPackages, sourceCode: activeElementInstallRequest.element.sourceCode })),
|
|
679
667
|
confirmLabel: 'Install',
|
|
680
668
|
cancelLabel: 'Cancel',
|
|
681
669
|
});
|
|
@@ -684,9 +672,10 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
684
672
|
element: activeElementInstallRequest.element,
|
|
685
673
|
compositionFile: activeElementInstallRequest.compositionFile,
|
|
686
674
|
compositionId: activeElementInstallRequest.compositionId,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
675
|
+
expectedFileState: preflight.plan.expectedFileState,
|
|
676
|
+
from: activeElementInstallRequest.from,
|
|
677
|
+
position: activeElementInstallRequest.position,
|
|
678
|
+
overwriteExisting: preflight.plan.expectedFileState.exists,
|
|
690
679
|
});
|
|
691
680
|
}
|
|
692
681
|
};
|
|
@@ -706,7 +695,7 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
706
695
|
return () => {
|
|
707
696
|
canceled = true;
|
|
708
697
|
};
|
|
709
|
-
}, [activeElementInstallRequest, confirm
|
|
698
|
+
}, [activeElementInstallRequest, confirm]);
|
|
710
699
|
const onDragOver = (0, react_1.useCallback)((event) => {
|
|
711
700
|
var _a;
|
|
712
701
|
var _b;
|
|
@@ -874,7 +863,6 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
874
863
|
await (0, handle_drop_1.handleDrop)({
|
|
875
864
|
chooseSvgImportMode,
|
|
876
865
|
compositionFile,
|
|
877
|
-
confirmElementOverwrite,
|
|
878
866
|
compositionId: currentCompositionId,
|
|
879
867
|
destinationDimensions: contentDimensions === 'none' ? null : contentDimensions,
|
|
880
868
|
dropPosition,
|
|
@@ -892,7 +880,6 @@ const Canvas = ({ canvasContent, size }) => {
|
|
|
892
880
|
cannotAddSequence,
|
|
893
881
|
chooseSvgImportMode,
|
|
894
882
|
compositionFile,
|
|
895
|
-
confirmElementOverwrite,
|
|
896
883
|
config,
|
|
897
884
|
contentDimensions,
|
|
898
885
|
currentCompositionId,
|
|
@@ -21,6 +21,8 @@ const CheckboardToggle = () => {
|
|
|
21
21
|
return !c;
|
|
22
22
|
});
|
|
23
23
|
}, [setCheckerboard]);
|
|
24
|
-
return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: jsx_runtime_1.
|
|
24
|
+
return (jsx_runtime_1.jsx(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (color) => (jsx_runtime_1.jsxs("svg", { "aria-hidden": "true", focusable: "false", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", style: { width: 18, height: 18 }, fill: "none", children: [
|
|
25
|
+
jsx_runtime_1.jsx("path", { fill: checkerboard ? colors_1.BLUE : color, d: "M256 48h184c13.3 0 24 10.7 24 24v184H256V48zM48 256h208v208H72c-13.3 0-24-10.7-24-24V256z" }), jsx_runtime_1.jsx("rect", { x: "48", y: "48", width: "416", height: "416", rx: "24", stroke: checkerboard ? colors_1.BLUE : color, strokeWidth: "32" }), jsx_runtime_1.jsx("path", { d: "M256 48v416M48 256h416", stroke: checkerboard ? colors_1.BLUE : color, strokeWidth: "32" })
|
|
26
|
+
] })) }));
|
|
25
27
|
};
|
|
26
28
|
exports.CheckboardToggle = CheckboardToggle;
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const color_conversion_1 = require("../../helpers/color-conversion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
9
|
const checker_1 = require("./checker");
|
|
9
10
|
const SLIDER_HEIGHT = 12;
|
|
10
11
|
const HANDLE_WIDTH = 8;
|
|
@@ -57,16 +58,19 @@ const AlphaSlider = ({ hue, saturation, value, alpha, onChange, onChangeComplete
|
|
|
57
58
|
}
|
|
58
59
|
e.preventDefault();
|
|
59
60
|
updateFromEvent(e.clientX, false);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
let lastClientX = e.clientX;
|
|
62
|
+
(0, pointer_session_1.startPointerSession)({
|
|
63
|
+
event: e.nativeEvent,
|
|
64
|
+
target: e.currentTarget,
|
|
65
|
+
onMove: (ev) => {
|
|
66
|
+
lastClientX = ev.clientX;
|
|
67
|
+
updateFromEvent(ev.clientX, false);
|
|
68
|
+
},
|
|
69
|
+
onEnd: (reason, ev) => {
|
|
70
|
+
const shouldUseEndEvent = reason === 'pointerup' || reason === 'buttons-released';
|
|
71
|
+
updateFromEvent(shouldUseEndEvent && ev ? ev.clientX : lastClientX, true);
|
|
72
|
+
},
|
|
73
|
+
});
|
|
70
74
|
}, [updateFromEvent]);
|
|
71
75
|
const handleStyle = (0, react_1.useMemo)(() => {
|
|
72
76
|
return {
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const color_conversion_1 = require("../../helpers/color-conversion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
9
|
const SLIDER_HEIGHT = 12;
|
|
9
10
|
const HANDLE_WIDTH = 8;
|
|
10
11
|
const containerStyle = {
|
|
@@ -39,16 +40,19 @@ const HueSlider = ({ hue, onChange, onChangeComplete }) => {
|
|
|
39
40
|
}
|
|
40
41
|
e.preventDefault();
|
|
41
42
|
updateFromEvent(e.clientX, false);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
let lastClientX = e.clientX;
|
|
44
|
+
(0, pointer_session_1.startPointerSession)({
|
|
45
|
+
event: e.nativeEvent,
|
|
46
|
+
target: e.currentTarget,
|
|
47
|
+
onMove: (ev) => {
|
|
48
|
+
lastClientX = ev.clientX;
|
|
49
|
+
updateFromEvent(ev.clientX, false);
|
|
50
|
+
},
|
|
51
|
+
onEnd: (reason, ev) => {
|
|
52
|
+
const shouldUseEndEvent = reason === 'pointerup' || reason === 'buttons-released';
|
|
53
|
+
updateFromEvent(shouldUseEndEvent && ev ? ev.clientX : lastClientX, true);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
52
56
|
}, [updateFromEvent]);
|
|
53
57
|
const handleStyle = (0, react_1.useMemo)(() => {
|
|
54
58
|
return {
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const color_conversion_1 = require("../../helpers/color-conversion");
|
|
7
7
|
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
9
|
const AREA_HEIGHT = 140;
|
|
9
10
|
const containerStyle = {
|
|
10
11
|
position: 'relative',
|
|
@@ -48,23 +49,24 @@ const SaturationValueArea = ({ hue, saturation, value, onChange, onChangeComplet
|
|
|
48
49
|
}
|
|
49
50
|
}, [onChange, onChangeComplete]);
|
|
50
51
|
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
51
|
-
var _a, _b;
|
|
52
52
|
if (e.button !== 0) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
e.preventDefault();
|
|
56
|
-
(_b = (_a = e.target).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, e.pointerId);
|
|
57
56
|
updateFromEvent(e.clientX, e.clientY, false);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
let lastPosition = { clientX: e.clientX, clientY: e.clientY };
|
|
58
|
+
(0, pointer_session_1.startPointerSession)({
|
|
59
|
+
event: e.nativeEvent,
|
|
60
|
+
target: e.currentTarget,
|
|
61
|
+
onMove: (ev) => {
|
|
62
|
+
lastPosition = { clientX: ev.clientX, clientY: ev.clientY };
|
|
63
|
+
updateFromEvent(ev.clientX, ev.clientY, false);
|
|
64
|
+
},
|
|
65
|
+
onEnd: (reason, ev) => {
|
|
66
|
+
const shouldUseEndEvent = reason === 'pointerup' || reason === 'buttons-released';
|
|
67
|
+
updateFromEvent(shouldUseEndEvent && ev ? ev.clientX : lastPosition.clientX, shouldUseEndEvent && ev ? ev.clientY : lastPosition.clientY, true);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
68
70
|
}, [updateFromEvent]);
|
|
69
71
|
const containerWithBg = (0, react_1.useMemo)(() => {
|
|
70
72
|
return {
|
|
@@ -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 });
|
|
25
|
+
return (jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: renderAction, values: values, variant: null }));
|
|
26
26
|
};
|
|
27
27
|
exports.CompositionContextButton = CompositionContextButton;
|
|
@@ -23,7 +23,7 @@ const actions_1 = require("./RenderQueue/actions");
|
|
|
23
23
|
const SidebarRenderButton_1 = require("./SidebarRenderButton");
|
|
24
24
|
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
25
25
|
const itemStyle = {
|
|
26
|
-
paddingRight:
|
|
26
|
+
paddingRight: 2,
|
|
27
27
|
paddingTop: 5,
|
|
28
28
|
paddingBottom: 5,
|
|
29
29
|
fontSize: 13,
|
|
@@ -33,11 +33,10 @@ const itemStyle = {
|
|
|
33
33
|
alignItems: 'center',
|
|
34
34
|
marginBottom: 1,
|
|
35
35
|
marginLeft: 4,
|
|
36
|
-
marginRight: 4,
|
|
37
36
|
appearance: 'none',
|
|
38
37
|
border: 'none',
|
|
39
38
|
borderRadius: 4,
|
|
40
|
-
width: 'calc(100% -
|
|
39
|
+
width: 'calc(100% - 4px)',
|
|
41
40
|
textAlign: 'left',
|
|
42
41
|
backgroundColor: colors_1.BACKGROUND,
|
|
43
42
|
height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigureDefaultEditorModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../helpers/colors");
|
|
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");
|
|
11
|
+
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
|
+
const ComboBox_1 = require("./NewComposition/ComboBox");
|
|
17
|
+
const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
|
|
18
|
+
const content = {
|
|
19
|
+
padding: 16,
|
|
20
|
+
width: 440,
|
|
21
|
+
maxWidth: 'calc(100vw - 40px)',
|
|
22
|
+
};
|
|
23
|
+
const description = {
|
|
24
|
+
color: colors_1.LIGHT_TEXT,
|
|
25
|
+
fontFamily: 'sans-serif',
|
|
26
|
+
fontSize: 14,
|
|
27
|
+
lineHeight: 1.5,
|
|
28
|
+
margin: 0,
|
|
29
|
+
};
|
|
30
|
+
const comboBoxStyle = {
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
width: '100%',
|
|
33
|
+
};
|
|
34
|
+
const customEditorLabel = {
|
|
35
|
+
display: 'inline-flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
gap: 8,
|
|
38
|
+
maxWidth: '100%',
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
color: 'inherit',
|
|
41
|
+
fontFamily: 'inherit',
|
|
42
|
+
fontSize: 'inherit',
|
|
43
|
+
lineHeight: 'inherit',
|
|
44
|
+
};
|
|
45
|
+
const customEditorName = {
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
textOverflow: 'ellipsis',
|
|
49
|
+
whiteSpace: 'nowrap',
|
|
50
|
+
color: 'inherit',
|
|
51
|
+
fontFamily: 'inherit',
|
|
52
|
+
fontSize: 'inherit',
|
|
53
|
+
lineHeight: 'inherit',
|
|
54
|
+
};
|
|
55
|
+
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);
|
|
59
|
+
const [selectedEditor, setSelectedEditor] = (0, react_1.useState)(null);
|
|
60
|
+
const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
|
|
61
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
62
|
+
const editorValues = (0, react_1.useMemo)(() => {
|
|
63
|
+
var _a;
|
|
64
|
+
const noPreference = {
|
|
65
|
+
id: NO_PREFERENCE_ID,
|
|
66
|
+
keyHint: null,
|
|
67
|
+
label: 'No preference',
|
|
68
|
+
leftItem: selectedEditor === null ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
|
|
69
|
+
onClick: () => {
|
|
70
|
+
setSelectedEditor(null);
|
|
71
|
+
setError(null);
|
|
72
|
+
},
|
|
73
|
+
quickSwitcherLabel: null,
|
|
74
|
+
subMenu: null,
|
|
75
|
+
type: 'item',
|
|
76
|
+
value: NO_PREFERENCE_ID,
|
|
77
|
+
};
|
|
78
|
+
const installedEditors = ((_a = editorInfo === null || editorInfo === void 0 ? void 0 : editorInfo.installedEditors) !== null && _a !== void 0 ? _a : []).map((editor) => {
|
|
79
|
+
return {
|
|
80
|
+
id: editor.id,
|
|
81
|
+
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),
|
|
85
|
+
leftItem: selectedEditor === editor.id ? jsx_runtime_1.jsx(Checkmark_1.Checkmark, {}) : null,
|
|
86
|
+
onClick: () => {
|
|
87
|
+
setSelectedEditor(editor.id);
|
|
88
|
+
setError(null);
|
|
89
|
+
},
|
|
90
|
+
quickSwitcherLabel: null,
|
|
91
|
+
subMenu: null,
|
|
92
|
+
type: 'item',
|
|
93
|
+
value: editor.id,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
return [noPreference, ...installedEditors];
|
|
97
|
+
}, [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);
|
|
116
|
+
});
|
|
117
|
+
return () => controller.abort();
|
|
118
|
+
}, []);
|
|
119
|
+
const submit = (0, react_1.useCallback)(async () => {
|
|
120
|
+
if (editorInfo === null) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
setIsSubmitting(true);
|
|
124
|
+
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
|
+
] }));
|
|
150
|
+
};
|
|
151
|
+
exports.ConfigureDefaultEditorModal = ConfigureDefaultEditorModal;
|
|
@@ -15,10 +15,13 @@ const content = {
|
|
|
15
15
|
padding: 16,
|
|
16
16
|
fontSize: 14,
|
|
17
17
|
flex: 1,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
width: 'min(600px, calc(100vw - 40px))',
|
|
19
|
+
minWidth: 0,
|
|
20
20
|
lineHeight: 1.4,
|
|
21
21
|
};
|
|
22
|
+
const footerStyle = {
|
|
23
|
+
minWidth: 0,
|
|
24
|
+
};
|
|
22
25
|
const useConfirmationDialog = () => {
|
|
23
26
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
24
27
|
return (0, react_1.useCallback)((options) => {
|
|
@@ -93,7 +96,7 @@ const ConfirmationDialog = ({ state }) => {
|
|
|
93
96
|
}, []);
|
|
94
97
|
return (jsx_runtime_1.jsxs(ModalContainer_1.ModalContainer, { onOutsideClick: onCancel, onEscape: onCancel, children: [
|
|
95
98
|
jsx_runtime_1.jsx(ModalHeader_1.ModalHeader, { title: state.title, onClose: onCancel }), jsx_runtime_1.jsxs("form", { onSubmit: onSubmit, children: [
|
|
96
|
-
jsx_runtime_1.jsx("div", { style: content, children: state.message }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
99
|
+
jsx_runtime_1.jsx("div", { style: content, children: state.message }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { style: footerStyle, children: jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
97
100
|
jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(Button_1.Button, { onClick: onCancel, style: cancelStyle, children: state.cancelLabel }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs(ModalButton_1.ModalButton, { onClick: onConfirm, autoFocus: true, children: [state.confirmLabel, jsx_runtime_1.jsx(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: false })
|
|
98
101
|
] })
|
|
99
102
|
] }) })
|
|
@@ -47,11 +47,9 @@ const z_index_1 = require("../state/z-index");
|
|
|
47
47
|
const portals_1 = require("./Menu/portals");
|
|
48
48
|
const styles_1 = require("./Menu/styles");
|
|
49
49
|
const MenuContent_1 = require("./NewComposition/MenuContent");
|
|
50
|
-
const CONTEXT_MENU_Z_INDEX = 1001;
|
|
51
50
|
const contextMenuFullScreenOverlay = {
|
|
52
51
|
...styles_1.fullScreenOverlay,
|
|
53
52
|
pointerEvents: 'none',
|
|
54
|
-
zIndex: CONTEXT_MENU_Z_INDEX,
|
|
55
53
|
};
|
|
56
54
|
const contextMenuOuterPortal = {
|
|
57
55
|
...styles_1.outerPortal,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { RenderInlineAction } from './InlineAction';
|
|
2
3
|
export declare const CONTROL_BUTTON_PADDING = 6;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const ControlButton: (props: React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
|
+
export declare const ControlButton: (props: Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onClick" | "title"> & {
|
|
5
5
|
readonly title: string;
|
|
6
|
+
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
readonly children: RenderInlineAction | React.ReactNode;
|
|
6
8
|
}) => import("react/jsx-runtime").JSX.Element;
|