@remotion/studio 4.0.478 → 4.0.479
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/components/AssetSelector.js +8 -14
- package/dist/components/Button.d.ts +1 -0
- package/dist/components/Button.js +8 -5
- package/dist/components/CompactExplanation.d.ts +12 -0
- package/dist/components/CompactExplanation.js +52 -0
- package/dist/components/CompositionSelector.js +2 -4
- package/dist/components/CurrentAsset.d.ts +3 -1
- package/dist/components/CurrentAsset.js +42 -34
- package/dist/components/CurrentComposition.d.ts +1 -1
- package/dist/components/CurrentComposition.js +38 -31
- package/dist/components/DefaultPropsEditor.d.ts +12 -2
- package/dist/components/DefaultPropsEditor.js +2 -2
- package/dist/components/EffectPickerModal.d.ts +5 -0
- package/dist/components/EffectPickerModal.js +179 -0
- package/dist/components/InspectorInfoHeader.d.ts +11 -0
- package/dist/components/InspectorInfoHeader.js +55 -0
- package/dist/components/InspectorPanel/DefaultInspector.d.ts +8 -0
- package/dist/components/InspectorPanel/DefaultInspector.js +93 -0
- package/dist/components/InspectorPanel/EasingInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/EasingInspector.js +41 -0
- package/dist/components/InspectorPanel/GuideInspector.d.ts +7 -0
- package/dist/components/InspectorPanel/GuideInspector.js +55 -0
- package/dist/components/InspectorPanel/KeyframeInspector.d.ts +7 -0
- package/dist/components/InspectorPanel/KeyframeInspector.js +109 -0
- package/dist/components/InspectorPanel/SelectedInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/SelectedInspector.js +26 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +116 -0
- package/dist/components/InspectorPanel/common.d.ts +15 -0
- package/dist/components/InspectorPanel/common.js +18 -0
- package/dist/components/InspectorPanel/inspector-selection.d.ts +10 -0
- package/dist/components/InspectorPanel/inspector-selection.js +34 -0
- package/dist/components/InspectorPanel/styles.d.ts +27 -0
- package/dist/components/InspectorPanel/styles.js +178 -0
- package/dist/components/InspectorPanel/use-track-for-selection.d.ts +2 -0
- package/dist/components/InspectorPanel/use-track-for-selection.js +22 -0
- package/dist/components/InspectorPanel.d.ts +8 -0
- package/dist/components/InspectorPanel.js +26 -0
- package/dist/components/InspectorPanelLayout.d.ts +1 -0
- package/dist/components/InspectorPanelLayout.js +4 -0
- package/dist/components/InspectorSequenceSection.d.ts +16 -0
- package/dist/components/InspectorSequenceSection.js +147 -0
- package/dist/components/InspectorSourceLocation.d.ts +7 -0
- package/dist/components/InspectorSourceLocation.js +71 -0
- package/dist/components/Modals.js +3 -3
- package/dist/components/NewComposition/InputDragger.js +1 -1
- package/dist/components/NewComposition/RemInput.d.ts +1 -0
- package/dist/components/NewComposition/RemInput.js +8 -2
- package/dist/components/NewComposition/RemTextarea.d.ts +1 -0
- package/dist/components/NewComposition/RemTextarea.js +8 -2
- package/dist/components/NewComposition/ValidationMessage.d.ts +3 -0
- package/dist/components/NewComposition/ValidationMessage.js +16 -5
- package/dist/components/OptionsPanel.d.ts +1 -1
- package/dist/components/OptionsPanel.js +8 -17
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +2 -7
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +3 -10
- package/dist/components/QuickSwitcher/shared.d.ts +4 -0
- package/dist/components/QuickSwitcher/shared.js +24 -0
- package/dist/components/RenderModal/DataEditor.d.ts +29 -2
- package/dist/components/RenderModal/DataEditor.js +107 -56
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -0
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +25 -7
- package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/Fieldset.js +10 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +4 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +27 -4
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +12 -4
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +23 -9
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +8 -1
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +23 -6
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +9 -11
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/WarningIndicatorButton.d.ts +1 -0
- package/dist/components/RenderModal/WarningIndicatorButton.js +17 -4
- package/dist/components/RenderModal/get-render-modal-warnings.d.ts +2 -1
- package/dist/components/RenderModal/get-render-modal-warnings.js +6 -3
- package/dist/components/RendersTab.js +1 -1
- package/dist/components/SegmentedControl.d.ts +3 -0
- package/dist/components/SegmentedControl.js +11 -5
- package/dist/components/SelectedOutlineElement.js +57 -24
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +41 -29
- package/dist/components/SelectedOutlineUvControls.d.ts +9 -0
- package/dist/components/SelectedOutlineUvControls.js +64 -10
- package/dist/components/Tabs/index.js +4 -4
- package/dist/components/Timeline/EasingEditorModal.d.ts +5 -4
- package/dist/components/Timeline/EasingEditorModal.js +597 -124
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +2 -2
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +15 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +85 -1
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +10 -3
- package/dist/components/Timeline/TimelineEffectItem.d.ts +2 -2
- package/dist/components/Timeline/TimelineEffectPropItem.d.ts +8 -0
- package/dist/components/Timeline/TimelineEffectPropItem.js +24 -20
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +5 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +4 -4
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +5 -19
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +8 -2
- package/dist/components/Timeline/TimelineKeyframeControls.js +24 -3
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +2 -47
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +1 -1
- package/dist/components/Timeline/TimelineKeyframedValue.js +8 -10
- package/dist/components/Timeline/TimelineNumberField.js +5 -11
- package/dist/components/Timeline/TimelineRotationField.js +5 -6
- package/dist/components/Timeline/TimelineScaleField.js +4 -8
- package/dist/components/Timeline/TimelineSelection.d.ts +6 -0
- package/dist/components/Timeline/TimelineSelection.js +109 -14
- package/dist/components/Timeline/TimelineSequence.js +19 -3
- package/dist/components/Timeline/TimelineSequenceItem.js +12 -67
- package/dist/components/Timeline/TimelineSequencePropItem.d.ts +12 -2
- package/dist/components/Timeline/TimelineSequencePropItem.js +56 -52
- package/dist/components/Timeline/TimelineTransformOriginField.js +4 -5
- package/dist/components/Timeline/TimelineTranslateField.js +4 -5
- package/dist/components/Timeline/TimelineUvCoordinateField.js +4 -4
- package/dist/components/Timeline/call-add-keyframe.d.ts +4 -4
- package/dist/components/Timeline/call-delete-keyframe.d.ts +4 -4
- package/dist/components/Timeline/call-move-keyframe.d.ts +2 -2
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +3 -3
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +2 -1
- package/dist/components/Timeline/delete-selected-timeline-item.js +27 -1
- package/dist/components/Timeline/parse-keyframe-field-from-node-path.js +2 -2
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +3 -3
- package/dist/components/Timeline/reset-selected-timeline-props.js +19 -5
- package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -2
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -3
- package/dist/components/Timeline/timeline-field-display-utils.d.ts +5 -0
- package/dist/components/Timeline/timeline-field-display-utils.js +244 -0
- package/dist/components/Timeline/update-selected-easing.d.ts +47 -4
- package/dist/components/Timeline/update-selected-easing.js +40 -9
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +13 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +73 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -3
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +11 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +33 -0
- package/dist/components/VisualControls/VisualControlsContent.d.ts +1 -1
- package/dist/components/VisualControls/VisualControlsContent.js +4 -5
- package/dist/components/effect-drag-and-drop.d.ts +10 -0
- package/dist/components/effect-drag-and-drop.js +17 -8
- package/dist/components/effect-picker-search.d.ts +5 -0
- package/dist/components/effect-picker-search.js +77 -0
- package/dist/components/selected-outline-drag.d.ts +21 -2
- package/dist/components/selected-outline-drag.js +31 -6
- package/dist/components/selected-outline-types.d.ts +7 -7
- package/dist/components/selected-outline-uv.d.ts +4 -3
- package/dist/components/selected-outline-uv.js +6 -2
- package/dist/esm/{chunk-hrw9799x.js → chunk-fge2mq5p.js} +16535 -13311
- package/dist/esm/internals.mjs +16535 -13311
- package/dist/esm/previewEntry.mjs +17141 -13917
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/render-codec-label.d.ts +2 -0
- package/dist/helpers/render-codec-label.js +49 -0
- package/dist/helpers/timeline-layout.d.ts +4 -4
- package/dist/helpers/use-media-metadata.d.ts +8 -2
- package/dist/helpers/use-media-metadata.js +17 -4
- package/dist/state/modals.d.ts +9 -4
- package/package.json +12 -12
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.AssetSelector = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = require("react");
|
|
39
|
-
const remotion_1 = require("remotion");
|
|
40
39
|
const write_static_file_1 = require("../api/write-static-file");
|
|
41
40
|
const client_id_1 = require("../helpers/client-id");
|
|
42
41
|
const colors_1 = require("../helpers/colors");
|
|
@@ -47,7 +46,6 @@ const use_asset_drag_events_1 = __importStar(require("../helpers/use-asset-drag-
|
|
|
47
46
|
const folders_1 = require("../state/folders");
|
|
48
47
|
const z_index_1 = require("../state/z-index");
|
|
49
48
|
const AssetSelectorItem_1 = require("./AssetSelectorItem");
|
|
50
|
-
const CurrentAsset_1 = require("./CurrentAsset");
|
|
51
49
|
const styles_1 = require("./Menu/styles");
|
|
52
50
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
53
51
|
const use_static_files_1 = require("./use-static-files");
|
|
@@ -77,21 +75,17 @@ const baseList = {
|
|
|
77
75
|
};
|
|
78
76
|
const AssetSelector = ({ readOnlyStudio }) => {
|
|
79
77
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
80
|
-
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
81
78
|
const { assetFoldersExpanded, setAssetFoldersExpanded } = (0, react_1.useContext)(folders_1.FolderContext);
|
|
82
79
|
const [dropLocation, setDropLocation] = (0, react_1.useState)(null);
|
|
83
80
|
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
84
81
|
.previewServerState.type;
|
|
85
82
|
const shouldAllowUpload = connectionStatus === 'connected' && !readOnlyStudio;
|
|
86
|
-
const showCurrentAsset = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset';
|
|
87
83
|
const list = (0, react_1.useMemo)(() => {
|
|
88
84
|
return {
|
|
89
85
|
...baseList,
|
|
90
|
-
height:
|
|
91
|
-
? `calc(100% - ${CurrentAsset_1.CURRENT_ASSET_HEIGHT}px)`
|
|
92
|
-
: '100%',
|
|
86
|
+
height: '100%',
|
|
93
87
|
};
|
|
94
|
-
}, [
|
|
88
|
+
}, []);
|
|
95
89
|
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
96
90
|
const publicFolderExists = window.remotion_publicFolderExists;
|
|
97
91
|
const assetTree = (0, react_1.useMemo)(() => {
|
|
@@ -164,11 +158,11 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
164
158
|
setDropLocation(null);
|
|
165
159
|
}
|
|
166
160
|
}, [dropLocation, staticFiles]);
|
|
167
|
-
return (jsx_runtime_1.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
161
|
+
return (jsx_runtime_1.jsx("div", { style: container, onDragOver: shouldAllowUpload ? onDragOver : undefined, onDrop: shouldAllowUpload ? onDrop : undefined, children: staticFiles.length === 0 ? (publicFolderExists ? (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, place a file in the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
|
|
162
|
+
" folder of your project or drag and drop a file here."] }) })) : (jsx_runtime_1.jsx("div", { style: emptyState, children: jsx_runtime_1.jsxs("div", { style: label, children: ["To add assets, create a folder called", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "public" }),
|
|
163
|
+
" in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
|
|
164
|
+
...list,
|
|
165
|
+
backgroundColor: isDropDiv ? colors_1.CLEAR_HOVER : colors_1.BACKGROUND,
|
|
166
|
+
}, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }) })) }));
|
|
173
167
|
};
|
|
174
168
|
exports.AssetSelector = AssetSelector;
|
|
@@ -3,6 +3,7 @@ export type ButtonProps = {
|
|
|
3
3
|
readonly onClick: () => void;
|
|
4
4
|
readonly disabled?: boolean;
|
|
5
5
|
readonly children: React.ReactNode;
|
|
6
|
+
readonly size?: 'default' | 'compact' | 'condensed';
|
|
6
7
|
readonly style?: React.CSSProperties;
|
|
7
8
|
readonly buttonContainerStyle?: React.CSSProperties;
|
|
8
9
|
readonly autoFocus?: boolean;
|
|
@@ -14,22 +14,25 @@ const button = {
|
|
|
14
14
|
color: 'white',
|
|
15
15
|
flexDirection: 'row',
|
|
16
16
|
};
|
|
17
|
-
const ButtonRefForwardFunction = ({ children, onClick, title, disabled, style, id, autoFocus, buttonContainerStyle, }, ref) => {
|
|
17
|
+
const ButtonRefForwardFunction = ({ children, onClick, title, disabled, size = 'default', style, id, autoFocus, buttonContainerStyle, }, ref) => {
|
|
18
18
|
const combined = (0, react_1.useMemo)(() => {
|
|
19
19
|
return {
|
|
20
20
|
...button,
|
|
21
|
+
...(size === 'compact' ? { fontSize: 12 } : null),
|
|
22
|
+
...(size === 'condensed' ? { fontSize: 11 } : null),
|
|
21
23
|
...(style !== null && style !== void 0 ? style : {}),
|
|
22
24
|
};
|
|
23
|
-
}, [style]);
|
|
25
|
+
}, [size, style]);
|
|
24
26
|
const buttonContainer = (0, react_1.useMemo)(() => {
|
|
25
27
|
return {
|
|
26
|
-
padding: 10,
|
|
28
|
+
padding: size === 'condensed' ? '2px 7px' : size === 'compact' ? '5px 8px' : 10,
|
|
27
29
|
cursor: disabled ? 'inherit' : 'pointer',
|
|
28
|
-
fontSize: 14,
|
|
30
|
+
fontSize: size === 'condensed' ? 11 : size === 'compact' ? 12 : 14,
|
|
31
|
+
lineHeight: size === 'condensed' ? '14px' : size === 'compact' ? '14px' : undefined,
|
|
29
32
|
opacity: disabled ? 0.7 : 1,
|
|
30
33
|
...(buttonContainerStyle !== null && buttonContainerStyle !== void 0 ? buttonContainerStyle : {}),
|
|
31
34
|
};
|
|
32
|
-
}, [buttonContainerStyle, disabled]);
|
|
35
|
+
}, [buttonContainerStyle, disabled, size]);
|
|
33
36
|
return (jsx_runtime_1.jsx("button", { ref: ref, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
|
|
34
37
|
};
|
|
35
38
|
exports.Button = (0, react_1.forwardRef)(ButtonRefForwardFunction);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare const CompactExplanation: ({ children, learnMoreAriaLabel, learnMoreHref, learnMoreTitle, }: {
|
|
3
|
+
readonly children: ReactNode;
|
|
4
|
+
readonly learnMoreAriaLabel?: string | undefined;
|
|
5
|
+
readonly learnMoreHref?: string | undefined;
|
|
6
|
+
readonly learnMoreTitle?: string | undefined;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const CompactNotSetUp: ({ learnMoreAriaLabel, learnMoreHref, learnMoreTitle, }: {
|
|
9
|
+
readonly learnMoreAriaLabel: string;
|
|
10
|
+
readonly learnMoreHref: string;
|
|
11
|
+
readonly learnMoreTitle?: string | undefined;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompactNotSetUp = exports.CompactExplanation = 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 compactExplanation = {
|
|
8
|
+
color: colors_1.LIGHT_TEXT,
|
|
9
|
+
fontFamily: 'sans-serif',
|
|
10
|
+
fontSize: 12,
|
|
11
|
+
lineHeight: 1.4,
|
|
12
|
+
padding: '0 12px 8px',
|
|
13
|
+
};
|
|
14
|
+
const compactHelpLink = {
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
color: 'inherit',
|
|
17
|
+
cursor: 'default',
|
|
18
|
+
display: 'inline-flex',
|
|
19
|
+
height: 13,
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
marginLeft: 8,
|
|
22
|
+
opacity: 1,
|
|
23
|
+
textDecoration: 'none',
|
|
24
|
+
verticalAlign: 'text-bottom',
|
|
25
|
+
width: 13,
|
|
26
|
+
};
|
|
27
|
+
const compactHelpLinkHovered = {
|
|
28
|
+
...compactHelpLink,
|
|
29
|
+
color: 'white',
|
|
30
|
+
};
|
|
31
|
+
const compactHelpIcon = {
|
|
32
|
+
color: 'inherit',
|
|
33
|
+
display: 'block',
|
|
34
|
+
fill: 'currentColor',
|
|
35
|
+
height: 13,
|
|
36
|
+
width: 13,
|
|
37
|
+
};
|
|
38
|
+
const compactHelpIconPath = {
|
|
39
|
+
color: 'inherit',
|
|
40
|
+
};
|
|
41
|
+
const CompactHelpLink = ({ href, ariaLabel, title, }) => {
|
|
42
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
43
|
+
return (jsx_runtime_1.jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", style: hovered ? compactHelpLinkHovered : compactHelpLink, "aria-label": ariaLabel, title: title, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: jsx_runtime_1.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", style: compactHelpIcon, "aria-hidden": "true", children: jsx_runtime_1.jsx("path", { style: compactHelpIconPath, fill: "currentColor", d: "M464 256a208 208 0 1 0 -416 0 208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0 256 256 0 1 1 -512 0zm256-80c-17.7 0-32 14.3-32 32l-48 0c0-44.2 35.8-80 80-80s80 35.8 80 80c0 35.1-20.5 57.5-38.2 70-6.3 4.4-12.5 7.8-17.8 10.4l0 21.9-48 0 0-56.7c1.4-.4 2.7-.7 4.1-1.1 12.2-3.2 23.3-6.1 34.1-13.7 10.4-7.3 17.8-16.9 17.8-30.8 0-17.7-14.3-32-32-32zM232 344l48 0 0 48-48 0 0-48z" }) }) }));
|
|
44
|
+
};
|
|
45
|
+
const CompactExplanation = ({ children, learnMoreAriaLabel, learnMoreHref, learnMoreTitle = 'Learn more', }) => {
|
|
46
|
+
return (jsx_runtime_1.jsxs("div", { style: compactExplanation, children: [children, learnMoreHref ? (jsx_runtime_1.jsx(CompactHelpLink, { href: learnMoreHref, ariaLabel: learnMoreAriaLabel !== null && learnMoreAriaLabel !== void 0 ? learnMoreAriaLabel : learnMoreTitle, title: learnMoreTitle })) : null] }));
|
|
47
|
+
};
|
|
48
|
+
exports.CompactExplanation = CompactExplanation;
|
|
49
|
+
const CompactNotSetUp = ({ learnMoreAriaLabel, learnMoreHref, learnMoreTitle, }) => {
|
|
50
|
+
return (jsx_runtime_1.jsx(exports.CompactExplanation, { learnMoreAriaLabel: learnMoreAriaLabel, learnMoreHref: learnMoreHref, learnMoreTitle: learnMoreTitle !== null && learnMoreTitle !== void 0 ? learnMoreTitle : 'Learn more', children: "Not set up" }));
|
|
51
|
+
};
|
|
52
|
+
exports.CompactNotSetUp = CompactNotSetUp;
|
|
@@ -13,7 +13,6 @@ const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
|
13
13
|
const modals_1 = require("../state/modals");
|
|
14
14
|
const z_index_1 = require("../state/z-index");
|
|
15
15
|
const CompositionSelectorItem_1 = require("./CompositionSelectorItem");
|
|
16
|
-
const CurrentComposition_1 = require("./CurrentComposition");
|
|
17
16
|
const InitialCompositionLoader_1 = require("./InitialCompositionLoader");
|
|
18
17
|
const useCompositionNavigation = () => {
|
|
19
18
|
const { compositions, canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
@@ -59,7 +58,6 @@ const container = {
|
|
|
59
58
|
overflow: 'hidden',
|
|
60
59
|
backgroundColor: colors_1.BACKGROUND,
|
|
61
60
|
};
|
|
62
|
-
const QUICK_SWITCHER_TRIGGER_HEIGHT = 38;
|
|
63
61
|
const quickSwitcherArea = {
|
|
64
62
|
padding: '4px 12px',
|
|
65
63
|
borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
|
|
@@ -99,7 +97,7 @@ const CompositionSelector = () => {
|
|
|
99
97
|
}, [sortedCompositions, sortedFolders, foldersExpanded]);
|
|
100
98
|
const list = (0, react_1.useMemo)(() => {
|
|
101
99
|
return {
|
|
102
|
-
|
|
100
|
+
flex: 1,
|
|
103
101
|
overflowY: 'auto',
|
|
104
102
|
};
|
|
105
103
|
}, []);
|
|
@@ -115,7 +113,7 @@ const CompositionSelector = () => {
|
|
|
115
113
|
});
|
|
116
114
|
}, [setSelectedModal]);
|
|
117
115
|
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
118
|
-
jsx_runtime_1.jsx(
|
|
116
|
+
jsx_runtime_1.jsx("div", { style: quickSwitcherArea, children: jsx_runtime_1.jsxs("button", { type: "button", style: quickSwitcherTrigger, onClick: openQuickSwitcher, tabIndex: tabIndex, children: ["Search...", (0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? null : (jsx_runtime_1.jsxs("span", { style: shortcutLabel, children: [ShortcutHint_1.cmdOrCtrlCharacter, "+K"] }))] }) }), jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: list, children: items.map((c) => {
|
|
119
117
|
return (jsx_runtime_1.jsx(CompositionSelectorItem_1.CompositionSelectorItem, { level: 0, currentComposition: canvasContent && canvasContent.type === 'composition'
|
|
120
118
|
? canvasContent.compositionId
|
|
121
119
|
: null, selectComposition: selectComposition, toggleFolder: toggleFolder, tabIndex: tabIndex, item: c }, c.key + c.type));
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import type { MediaMetadata } from '../helpers/use-media-metadata';
|
|
3
|
+
export declare const CURRENT_ASSET_HEIGHT = 84;
|
|
3
4
|
export declare const getCurrentAssetMetadataSource: (assetName: string | null) => string | null;
|
|
5
|
+
export declare const getCurrentAssetMediaDetailLines: (mediaMetadata: MediaMetadata) => string[];
|
|
4
6
|
export declare const CurrentAsset: React.FC;
|
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CurrentAsset = exports.getCurrentAssetMetadataSource = exports.CURRENT_ASSET_HEIGHT = void 0;
|
|
3
|
+
exports.CurrentAsset = exports.getCurrentAssetMediaDetailLines = exports.getCurrentAssetMetadataSource = exports.CURRENT_ASSET_HEIGHT = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
|
-
const colors_1 = require("../helpers/colors");
|
|
9
8
|
const format_media_duration_1 = require("../helpers/format-media-duration");
|
|
10
9
|
const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
|
|
10
|
+
const render_codec_label_1 = require("../helpers/render-codec-label");
|
|
11
11
|
const use_media_metadata_1 = require("../helpers/use-media-metadata");
|
|
12
|
+
const InspectorInfoHeader_1 = require("./InspectorInfoHeader");
|
|
12
13
|
const use_static_files_1 = require("./use-static-files");
|
|
13
|
-
exports.CURRENT_ASSET_HEIGHT =
|
|
14
|
-
const container = {
|
|
15
|
-
height: exports.CURRENT_ASSET_HEIGHT,
|
|
16
|
-
display: 'block',
|
|
17
|
-
borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
|
|
18
|
-
padding: 12,
|
|
19
|
-
color: 'white',
|
|
20
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
21
|
-
};
|
|
22
|
-
const title = {
|
|
23
|
-
fontWeight: 'bold',
|
|
24
|
-
fontSize: 12,
|
|
25
|
-
whiteSpace: 'nowrap',
|
|
26
|
-
lineHeight: '18px',
|
|
27
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
28
|
-
};
|
|
29
|
-
const subtitle = {
|
|
30
|
-
fontSize: 12,
|
|
31
|
-
opacity: 0.8,
|
|
32
|
-
whiteSpace: 'nowrap',
|
|
33
|
-
lineHeight: '18px',
|
|
34
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
35
|
-
};
|
|
36
|
-
const row = {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
flexDirection: 'row',
|
|
39
|
-
lineHeight: '18px',
|
|
40
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
41
|
-
};
|
|
14
|
+
exports.CURRENT_ASSET_HEIGHT = InspectorInfoHeader_1.INSPECTOR_INFO_HEADER_MIN_HEIGHT;
|
|
42
15
|
const getCurrentAssetMetadataSource = (assetName) => {
|
|
43
16
|
if (!assetName) {
|
|
44
17
|
return null;
|
|
@@ -49,6 +22,36 @@ const getCurrentAssetMetadataSource = (assetName) => {
|
|
|
49
22
|
: null;
|
|
50
23
|
};
|
|
51
24
|
exports.getCurrentAssetMetadataSource = getCurrentAssetMetadataSource;
|
|
25
|
+
const formatFps = (fps) => `${fps.toFixed(2)} FPS`;
|
|
26
|
+
const getCurrentAssetMediaDetailLines = (mediaMetadata) => {
|
|
27
|
+
const detailLines = [];
|
|
28
|
+
if (mediaMetadata.hasVideoTrack === true) {
|
|
29
|
+
const videoParts = [
|
|
30
|
+
(0, render_codec_label_1.renderHumanReadableVideoCodec)(mediaMetadata.videoCodec),
|
|
31
|
+
];
|
|
32
|
+
if (mediaMetadata.fps !== null) {
|
|
33
|
+
videoParts.push(formatFps(mediaMetadata.fps));
|
|
34
|
+
}
|
|
35
|
+
if (mediaMetadata.isHdr !== null) {
|
|
36
|
+
videoParts.push(`HDR: ${mediaMetadata.isHdr ? 'Yes' : 'No'}`);
|
|
37
|
+
}
|
|
38
|
+
detailLines.push(`Video: ${videoParts.join(' · ')}`);
|
|
39
|
+
}
|
|
40
|
+
if (mediaMetadata.hasAudioTrack === true) {
|
|
41
|
+
const audioParts = [
|
|
42
|
+
(0, render_codec_label_1.renderHumanReadableAudioCodec)(mediaMetadata.audioCodec),
|
|
43
|
+
];
|
|
44
|
+
if (mediaMetadata.sampleRate !== null) {
|
|
45
|
+
audioParts.push(`${mediaMetadata.sampleRate} Hz`);
|
|
46
|
+
}
|
|
47
|
+
detailLines.push(`Audio: ${audioParts.join(' · ')}`);
|
|
48
|
+
}
|
|
49
|
+
else if (mediaMetadata.hasAudioTrack === false) {
|
|
50
|
+
detailLines.push('Audio: No audio');
|
|
51
|
+
}
|
|
52
|
+
return detailLines;
|
|
53
|
+
};
|
|
54
|
+
exports.getCurrentAssetMediaDetailLines = getCurrentAssetMediaDetailLines;
|
|
52
55
|
const CurrentAsset = () => {
|
|
53
56
|
var _a;
|
|
54
57
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
@@ -65,7 +68,7 @@ const CurrentAsset = () => {
|
|
|
65
68
|
const src = (0, exports.getCurrentAssetMetadataSource)(assetName);
|
|
66
69
|
const mediaMetadata = (0, use_media_metadata_1.useMediaMetadata)(src);
|
|
67
70
|
if (!assetName) {
|
|
68
|
-
return jsx_runtime_1.jsx(
|
|
71
|
+
return jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoHeader, {});
|
|
69
72
|
}
|
|
70
73
|
const fileName = (_a = assetName.split('/').pop()) !== null && _a !== void 0 ? _a : assetName;
|
|
71
74
|
const subtitleParts = [];
|
|
@@ -80,7 +83,12 @@ const CurrentAsset = () => {
|
|
|
80
83
|
subtitleParts.push(`${mediaMetadata.width}x${mediaMetadata.height}`);
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
const mediaDetailLines = mediaMetadata
|
|
87
|
+
? (0, exports.getCurrentAssetMediaDetailLines)(mediaMetadata)
|
|
88
|
+
: [];
|
|
89
|
+
return (jsx_runtime_1.jsxs(InspectorInfoHeader_1.InspectorInfoHeader, { children: [
|
|
90
|
+
jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoTitle, { children: fileName }), subtitleParts.length > 0 ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: subtitleParts.join(' · ') })) : null, mediaMetadata ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: (0, format_media_duration_1.formatMediaDuration)(mediaMetadata.duration) })) : null, mediaDetailLines.map((line) => {
|
|
91
|
+
return jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: line }, line);
|
|
92
|
+
})] }));
|
|
85
93
|
};
|
|
86
94
|
exports.CurrentAsset = CurrentAsset;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CURRENT_COMPOSITION_HEIGHT =
|
|
1
|
+
export declare const CURRENT_COMPOSITION_HEIGHT = 84;
|
|
2
2
|
export declare const CurrentComposition: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,41 +2,48 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CurrentComposition = exports.CURRENT_COMPOSITION_HEIGHT = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const remotion_1 = require("remotion");
|
|
6
|
-
const colors_1 = require("../helpers/colors");
|
|
7
7
|
const is_composition_still_1 = require("../helpers/is-composition-still");
|
|
8
|
+
const open_in_editor_1 = require("../helpers/open-in-editor");
|
|
8
9
|
const render_frame_1 = require("../state/render-frame");
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
color: 'white',
|
|
15
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
16
|
-
};
|
|
17
|
-
const title = {
|
|
18
|
-
fontWeight: 'bold',
|
|
19
|
-
fontSize: 12,
|
|
20
|
-
whiteSpace: 'nowrap',
|
|
21
|
-
lineHeight: '18px',
|
|
22
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
23
|
-
};
|
|
24
|
-
const subtitle = {
|
|
25
|
-
fontSize: 12,
|
|
26
|
-
opacity: 0.8,
|
|
27
|
-
whiteSpace: 'nowrap',
|
|
28
|
-
lineHeight: '18px',
|
|
29
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
30
|
-
};
|
|
31
|
-
const row = {
|
|
32
|
-
display: 'flex',
|
|
33
|
-
flexDirection: 'row',
|
|
34
|
-
lineHeight: '18px',
|
|
35
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
36
|
-
};
|
|
10
|
+
const InspectorInfoHeader_1 = require("./InspectorInfoHeader");
|
|
11
|
+
const InspectorSourceLocation_1 = require("./InspectorSourceLocation");
|
|
12
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
13
|
+
const use_resolved_stack_1 = require("./Timeline/use-resolved-stack");
|
|
14
|
+
exports.CURRENT_COMPOSITION_HEIGHT = InspectorInfoHeader_1.INSPECTOR_INFO_HEADER_MIN_HEIGHT;
|
|
37
15
|
const CurrentComposition = () => {
|
|
16
|
+
var _a;
|
|
38
17
|
const video = remotion_1.Internals.useVideo();
|
|
39
|
-
|
|
40
|
-
|
|
18
|
+
const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
19
|
+
const currentComposition = (0, react_1.useMemo)(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
if (!video) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return ((_a = compositions.find((composition) => composition.id === video.id)) !== null && _a !== void 0 ? _a : null);
|
|
25
|
+
}, [compositions, video]);
|
|
26
|
+
const resolvedCompositionLocation = (0, use_resolved_stack_1.useResolvedStack)((_a = currentComposition === null || currentComposition === void 0 ? void 0 : currentComposition.stack) !== null && _a !== void 0 ? _a : null);
|
|
27
|
+
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
28
|
+
if (!(resolvedCompositionLocation === null || resolvedCompositionLocation === void 0 ? void 0 : resolvedCompositionLocation.source) ||
|
|
29
|
+
resolvedCompositionLocation.line === null) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
column: resolvedCompositionLocation.column,
|
|
34
|
+
line: resolvedCompositionLocation.line,
|
|
35
|
+
source: resolvedCompositionLocation.source,
|
|
36
|
+
};
|
|
37
|
+
}, [resolvedCompositionLocation]);
|
|
38
|
+
const openFileLocation = (0, react_1.useCallback)(() => {
|
|
39
|
+
if (!validatedLocation) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
(0, open_in_editor_1.openOriginalPositionInEditor)(validatedLocation).catch((err) => {
|
|
43
|
+
(0, NotificationCenter_1.showNotification)(err.message, 2000);
|
|
44
|
+
});
|
|
45
|
+
}, [validatedLocation]);
|
|
46
|
+
return (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoHeader, { children: video ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
47
|
+
jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoTitle, { children: video.id }), jsx_runtime_1.jsx(InspectorSourceLocation_1.InspectorSourceLocation, { location: validatedLocation, canOpen: validatedLocation !== null, onOpen: openFileLocation }), jsx_runtime_1.jsxs(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: [video.width, "x", video.height, (0, is_composition_still_1.isCompositionStill)(video) ? null : `, ${video.fps} FPS`] }), (0, is_composition_still_1.isCompositionStill)(video) ? (jsx_runtime_1.jsx(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: "Still" })) : (jsx_runtime_1.jsxs(InspectorInfoHeader_1.InspectorInfoSubtitle, { children: ["Duration ", (0, render_frame_1.renderFrame)(video.durationInFrames, video.fps)] }))] })) : null }));
|
|
41
48
|
};
|
|
42
49
|
exports.CurrentComposition = CurrentComposition;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import type { PropsEditType } from './RenderModal/DataEditor';
|
|
1
|
+
import type { DataEditorLayout, DataEditorMode, PropsEditType, RenderModalWarning } from './RenderModal/DataEditor';
|
|
2
|
+
import type { SchemaErrorMode } from './RenderModal/SchemaEditor/SchemaErrorMessages';
|
|
2
3
|
import type { UpdaterFunction } from './RenderModal/SchemaEditor/ZodSwitch';
|
|
3
|
-
export declare const DefaultPropsEditor: ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, }: {
|
|
4
|
+
export declare const DefaultPropsEditor: ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, schemaErrorMode, layout, mode, onModeChange, hideModeControls, warnings, showWarning, setShowWarning, hideWarningButton, }: {
|
|
4
5
|
readonly unresolvedComposition: import("remotion").AnyComposition;
|
|
5
6
|
readonly defaultProps: Record<string, unknown>;
|
|
6
7
|
readonly setDefaultProps: UpdaterFunction<Record<string, unknown>>;
|
|
7
8
|
readonly propsEditType: PropsEditType;
|
|
9
|
+
readonly schemaErrorMode?: SchemaErrorMode | undefined;
|
|
10
|
+
readonly layout?: DataEditorLayout | undefined;
|
|
11
|
+
readonly mode?: DataEditorMode | undefined;
|
|
12
|
+
readonly onModeChange?: ((mode: DataEditorMode) => void) | undefined;
|
|
13
|
+
readonly hideModeControls?: boolean | undefined;
|
|
14
|
+
readonly warnings?: RenderModalWarning[] | undefined;
|
|
15
|
+
readonly showWarning?: boolean | undefined;
|
|
16
|
+
readonly setShowWarning?: import("react").Dispatch<import("react").SetStateAction<boolean>> | undefined;
|
|
17
|
+
readonly hideWarningButton?: boolean | undefined;
|
|
8
18
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,11 +5,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const ObserveDefaultPropsContext_1 = require("./ObserveDefaultPropsContext");
|
|
7
7
|
const DataEditor_1 = require("./RenderModal/DataEditor");
|
|
8
|
-
const DefaultPropsEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, }) => {
|
|
8
|
+
const DefaultPropsEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, schemaErrorMode, layout, mode, onModeChange, hideModeControls, warnings, showWarning, setShowWarning, hideWarningButton, }) => {
|
|
9
9
|
const canSaveDefaultProps = (0, react_1.useContext)(ObserveDefaultPropsContext_1.ObserveDefaultPropsContext);
|
|
10
10
|
if (canSaveDefaultProps === null) {
|
|
11
11
|
throw new Error('ObserveDefaultPropsContext is not set');
|
|
12
12
|
}
|
|
13
|
-
return (jsx_runtime_1.jsx(DataEditor_1.DataEditor, { unresolvedComposition: unresolvedComposition, defaultProps: defaultProps, setDefaultProps: setDefaultProps, propsEditType: propsEditType, canSaveDefaultProps: canSaveDefaultProps.canSaveDefaultProps }));
|
|
13
|
+
return (jsx_runtime_1.jsx(DataEditor_1.DataEditor, { unresolvedComposition: unresolvedComposition, defaultProps: defaultProps, setDefaultProps: setDefaultProps, propsEditType: propsEditType, canSaveDefaultProps: canSaveDefaultProps.canSaveDefaultProps, schemaErrorMode: schemaErrorMode, layout: layout, mode: mode, onModeChange: onModeChange, hideModeControls: hideModeControls, warnings: warnings, showWarning: showWarning, setShowWarning: setShowWarning, hideWarningButton: hideWarningButton }));
|
|
14
14
|
};
|
|
15
15
|
exports.DefaultPropsEditor = DefaultPropsEditor;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EffectPickerModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const colors_1 = require("../helpers/colors");
|
|
8
|
+
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
9
|
+
const modals_1 = require("../state/modals");
|
|
10
|
+
const ContextMenu_1 = require("./ContextMenu");
|
|
11
|
+
const effect_drag_and_drop_1 = require("./effect-drag-and-drop");
|
|
12
|
+
const effect_picker_search_1 = require("./effect-picker-search");
|
|
13
|
+
const layout_1 = require("./layout");
|
|
14
|
+
const is_menu_item_1 = require("./Menu/is-menu-item");
|
|
15
|
+
const DismissableModal_1 = require("./NewComposition/DismissableModal");
|
|
16
|
+
const RemInput_1 = require("./NewComposition/RemInput");
|
|
17
|
+
const shared_1 = require("./QuickSwitcher/shared");
|
|
18
|
+
const container = {
|
|
19
|
+
width: 500,
|
|
20
|
+
};
|
|
21
|
+
const content = {
|
|
22
|
+
padding: '12px 16px 10px',
|
|
23
|
+
};
|
|
24
|
+
const inputStyle = {
|
|
25
|
+
width: '100%',
|
|
26
|
+
};
|
|
27
|
+
const resultList = {
|
|
28
|
+
height: 320,
|
|
29
|
+
overflowY: 'auto',
|
|
30
|
+
paddingBottom: 10,
|
|
31
|
+
};
|
|
32
|
+
const noResults = {
|
|
33
|
+
color: colors_1.LIGHT_TEXT,
|
|
34
|
+
fontSize: 13,
|
|
35
|
+
padding: '12px 16px',
|
|
36
|
+
};
|
|
37
|
+
const resultContainer = {
|
|
38
|
+
cursor: 'pointer',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
padding: '7px 16px',
|
|
43
|
+
};
|
|
44
|
+
const labelContainer = {
|
|
45
|
+
flex: 1,
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
};
|
|
48
|
+
const label = {
|
|
49
|
+
fontSize: shared_1.QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
textOverflow: 'ellipsis',
|
|
52
|
+
whiteSpace: 'nowrap',
|
|
53
|
+
};
|
|
54
|
+
const category = {
|
|
55
|
+
color: colors_1.LIGHT_TEXT,
|
|
56
|
+
fontSize: 11,
|
|
57
|
+
flexShrink: 0,
|
|
58
|
+
};
|
|
59
|
+
const EffectPickerResult = ({ item, selected, onSelected }) => {
|
|
60
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
61
|
+
const ref = (0, react_1.useRef)(null);
|
|
62
|
+
(0, shared_1.useScrollIntoViewOnSelected)(ref, selected);
|
|
63
|
+
const style = (0, react_1.useMemo)(() => {
|
|
64
|
+
return {
|
|
65
|
+
...resultContainer,
|
|
66
|
+
backgroundColor: (0, colors_1.getBackgroundFromHoverState)({ hovered, selected }),
|
|
67
|
+
};
|
|
68
|
+
}, [hovered, selected]);
|
|
69
|
+
const labelStyle = (0, react_1.useMemo)(() => {
|
|
70
|
+
return {
|
|
71
|
+
...label,
|
|
72
|
+
color: selected || hovered ? 'white' : colors_1.LIGHT_TEXT,
|
|
73
|
+
};
|
|
74
|
+
}, [hovered, selected]);
|
|
75
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
76
|
+
onSelected(item);
|
|
77
|
+
}, [item, onSelected]);
|
|
78
|
+
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
79
|
+
const documentationLink = (0, studio_shared_1.getEffectDocumentationLink)(item);
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
type: 'item',
|
|
83
|
+
id: `open-${item.id}-docs`,
|
|
84
|
+
keyHint: null,
|
|
85
|
+
label: 'Open effect docs',
|
|
86
|
+
leftItem: null,
|
|
87
|
+
disabled: false,
|
|
88
|
+
onClick: () => {
|
|
89
|
+
window.open(documentationLink, '_blank', 'noopener,noreferrer');
|
|
90
|
+
},
|
|
91
|
+
quickSwitcherLabel: null,
|
|
92
|
+
subMenu: null,
|
|
93
|
+
value: `open-${item.id}-docs`,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
}, [item]);
|
|
97
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: null, children: jsx_runtime_1.jsxs("div", { ref: ref, style: style, onClick: onClick, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [
|
|
98
|
+
jsx_runtime_1.jsx("div", { style: labelContainer, children: jsx_runtime_1.jsx("div", { style: labelStyle, children: item.label }) }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: category, children: item.category })
|
|
99
|
+
] }) }));
|
|
100
|
+
};
|
|
101
|
+
const EffectPickerContent = ({ state }) => {
|
|
102
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
103
|
+
const [query, setQuery] = (0, react_1.useState)('');
|
|
104
|
+
const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(0);
|
|
105
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
106
|
+
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
107
|
+
const results = (0, react_1.useMemo)(() => {
|
|
108
|
+
return (0, effect_picker_search_1.filterEffectCatalog)({ items: studio_shared_1.EFFECT_CATALOG, query });
|
|
109
|
+
}, [query]);
|
|
110
|
+
const selectedIndexRounded = results.length === 0 ? -1 : (0, shared_1.loopIndex)(selectedIndex, results.length);
|
|
111
|
+
const selectItem = (0, react_1.useCallback)((item) => {
|
|
112
|
+
setSelectedModal(null);
|
|
113
|
+
(0, effect_drag_and_drop_1.addEffectToSequence)({
|
|
114
|
+
clientId: state.clientId,
|
|
115
|
+
effect: item.effect,
|
|
116
|
+
fileName: state.fileName,
|
|
117
|
+
nodePath: state.nodePath,
|
|
118
|
+
});
|
|
119
|
+
}, [setSelectedModal, state.clientId, state.fileName, state.nodePath]);
|
|
120
|
+
const onArrowDown = (0, react_1.useCallback)(() => {
|
|
121
|
+
setSelectedIndex((i) => i + 1);
|
|
122
|
+
}, []);
|
|
123
|
+
const onArrowUp = (0, react_1.useCallback)(() => {
|
|
124
|
+
setSelectedIndex((i) => i - 1);
|
|
125
|
+
}, []);
|
|
126
|
+
const onEnter = (0, react_1.useCallback)(() => {
|
|
127
|
+
if (selectedIndexRounded === -1) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
selectItem(results[selectedIndexRounded]);
|
|
131
|
+
}, [results, selectItem, selectedIndexRounded]);
|
|
132
|
+
(0, react_1.useEffect)(() => {
|
|
133
|
+
const downBinding = keybindings.registerKeybinding({
|
|
134
|
+
key: 'ArrowDown',
|
|
135
|
+
callback: onArrowDown,
|
|
136
|
+
commandCtrlKey: false,
|
|
137
|
+
event: 'keydown',
|
|
138
|
+
preventDefault: true,
|
|
139
|
+
triggerIfInputFieldFocused: true,
|
|
140
|
+
keepRegisteredWhenNotHighestContext: false,
|
|
141
|
+
});
|
|
142
|
+
const upBinding = keybindings.registerKeybinding({
|
|
143
|
+
key: 'ArrowUp',
|
|
144
|
+
callback: onArrowUp,
|
|
145
|
+
commandCtrlKey: false,
|
|
146
|
+
event: 'keydown',
|
|
147
|
+
preventDefault: true,
|
|
148
|
+
triggerIfInputFieldFocused: true,
|
|
149
|
+
keepRegisteredWhenNotHighestContext: false,
|
|
150
|
+
});
|
|
151
|
+
const enterBinding = keybindings.registerKeybinding({
|
|
152
|
+
key: 'Enter',
|
|
153
|
+
callback: onEnter,
|
|
154
|
+
commandCtrlKey: false,
|
|
155
|
+
event: 'keydown',
|
|
156
|
+
preventDefault: true,
|
|
157
|
+
triggerIfInputFieldFocused: true,
|
|
158
|
+
keepRegisteredWhenNotHighestContext: false,
|
|
159
|
+
});
|
|
160
|
+
return () => {
|
|
161
|
+
downBinding.unregister();
|
|
162
|
+
upBinding.unregister();
|
|
163
|
+
enterBinding.unregister();
|
|
164
|
+
};
|
|
165
|
+
}, [keybindings, onArrowDown, onArrowUp, onEnter]);
|
|
166
|
+
const onTextChange = (0, react_1.useCallback)((e) => {
|
|
167
|
+
setQuery(e.target.value);
|
|
168
|
+
setSelectedIndex(0);
|
|
169
|
+
}, []);
|
|
170
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
171
|
+
jsx_runtime_1.jsx("div", { style: content, children: jsx_runtime_1.jsx(RemInput_1.RemotionInput, { ref: inputRef, type: "text", style: inputStyle, autoFocus: true, status: "ok", value: query, onChange: onTextChange, placeholder: "Search effects...", rightAlign: false }) }), jsx_runtime_1.jsx("div", { style: resultList, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: results.length === 0 ? (jsx_runtime_1.jsx("div", { style: noResults, children: "No effects found" })) : (results.map((item, i) => {
|
|
172
|
+
return (jsx_runtime_1.jsx(EffectPickerResult, { item: item, selected: selectedIndexRounded === i, onSelected: selectItem }, item.id));
|
|
173
|
+
})) })
|
|
174
|
+
] }));
|
|
175
|
+
};
|
|
176
|
+
const EffectPickerModal = ({ state }) => {
|
|
177
|
+
return (jsx_runtime_1.jsx(DismissableModal_1.DismissableModal, { children: jsx_runtime_1.jsx(EffectPickerContent, { state: state }) }));
|
|
178
|
+
};
|
|
179
|
+
exports.EffectPickerModal = EffectPickerModal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const INSPECTOR_INFO_HEADER_MIN_HEIGHT = 84;
|
|
3
|
+
export declare const InspectorInfoHeader: React.FC<{
|
|
4
|
+
readonly children?: React.ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const InspectorInfoTitle: React.FC<{
|
|
7
|
+
readonly children: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const InspectorInfoSubtitle: React.FC<{
|
|
10
|
+
readonly children: React.ReactNode;
|
|
11
|
+
}>;
|