@remotion/studio 4.0.165 → 4.0.167
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/.turbo/turbo-build.log +1 -1
- package/dist/api/focus-default-props-path.d.ts +7 -0
- package/dist/api/focus-default-props-path.js +22 -0
- package/dist/api/reevaluate-composition.d.ts +1 -0
- package/dist/api/reevaluate-composition.js +9 -0
- package/dist/api/trigger-calculate-metadata.d.ts +1 -0
- package/dist/api/trigger-calculate-metadata.js +9 -0
- package/dist/components/CompositionContextButton.d.ts +6 -0
- package/dist/components/CompositionContextButton.js +27 -0
- package/dist/components/CompositionSelector.js +21 -18
- package/dist/components/CompositionSelectorItem.d.ts +6 -6
- package/dist/components/CompositionSelectorItem.js +2 -1
- package/dist/components/ContextMenu.d.ts +2 -2
- package/dist/components/GlobalPropsEditorUpdateButton.d.ts +5 -0
- package/dist/components/GlobalPropsEditorUpdateButton.js +59 -0
- package/dist/components/InlineAction.d.ts +7 -6
- package/dist/components/InlineAction.js +1 -1
- package/dist/components/InlineDropdown.d.ts +5 -0
- package/dist/components/InlineDropdown.js +85 -0
- package/dist/components/NewComposition/RemInput.d.ts +1 -1
- package/dist/components/OptionsPanel.js +3 -20
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/scroll-to-default-props-path.d.ts +4 -0
- package/dist/components/RenderModal/SchemaEditor/scroll-to-default-props-path.js +10 -0
- package/dist/components/RenderModal/SchemaEditor/scroll-to-path-editor.d.ts +0 -0
- package/dist/components/RenderModal/SchemaEditor/scroll-to-path-editor.js +1 -0
- package/dist/components/RendersTab.d.ts +2 -2
- package/dist/components/Tabs/index.d.ts +6 -6
- package/dist/components/Tabs/index.js +1 -1
- package/dist/esm/index.mjs +39 -3
- package/dist/esm/internals.mjs +4506 -4239
- package/dist/helpers/create-folder-tree.js +8 -2
- package/dist/helpers/inject-css.js +6 -0
- package/dist/helpers/persist-open-folders.d.ts +4 -1
- package/dist/helpers/persist-open-folders.js +1 -1
- package/dist/icons/ellipsis.d.ts +5 -0
- package/dist/icons/ellipsis.js +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.focusDefaultPropsPath = void 0;
|
|
4
|
+
const scroll_to_default_props_path_1 = require("../components/RenderModal/SchemaEditor/scroll-to-default-props-path");
|
|
5
|
+
const focusDefaultPropsPath = ({ path, scrollBehavior, }) => {
|
|
6
|
+
const currentlyActive = document.querySelector(`.${scroll_to_default_props_path_1.DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME}`);
|
|
7
|
+
if (currentlyActive !== null) {
|
|
8
|
+
currentlyActive.classList.remove(scroll_to_default_props_path_1.DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME);
|
|
9
|
+
}
|
|
10
|
+
const query = document.querySelector(`.${scroll_to_default_props_path_1.DEFAULT_PROPS_PATH_CLASSNAME}[data-json-path="${path.join('.')}"]`);
|
|
11
|
+
if (query === null) {
|
|
12
|
+
return {
|
|
13
|
+
success: false,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
query.scrollIntoView({ behavior: scrollBehavior });
|
|
17
|
+
query.classList.add(scroll_to_default_props_path_1.DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME);
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.focusDefaultPropsPath = focusDefaultPropsPath;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reevaluateComposition: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reevaluateComposition = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const reevaluateComposition = () => {
|
|
6
|
+
var _a;
|
|
7
|
+
(_a = remotion_1.Internals.resolveCompositionsRef.current) === null || _a === void 0 ? void 0 : _a.reloadCurrentlySelectedComposition();
|
|
8
|
+
};
|
|
9
|
+
exports.reevaluateComposition = reevaluateComposition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reevaluateComposition: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reevaluateComposition = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const reevaluateComposition = () => {
|
|
6
|
+
var _a;
|
|
7
|
+
(_a = remotion_1.Internals.resolveCompositionsRef.current) === null || _a === void 0 ? void 0 : _a.reloadCurrentlySelectedComposition();
|
|
8
|
+
};
|
|
9
|
+
exports.reevaluateComposition = reevaluateComposition;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompositionContextButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const client_id_1 = require("../helpers/client-id");
|
|
7
|
+
const ellipsis_1 = require("../icons/ellipsis");
|
|
8
|
+
const InlineDropdown_1 = require("./InlineDropdown");
|
|
9
|
+
const CompositionContextButton = ({ visible, values }) => {
|
|
10
|
+
const iconStyle = (0, react_1.useMemo)(() => {
|
|
11
|
+
return {
|
|
12
|
+
style: {
|
|
13
|
+
height: 12,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
18
|
+
.previewServerState.type;
|
|
19
|
+
const renderAction = (0, react_1.useCallback)((color) => {
|
|
20
|
+
return (0, jsx_runtime_1.jsx)(ellipsis_1.EllipsisIcon, { fill: color, svgProps: iconStyle });
|
|
21
|
+
}, [iconStyle]);
|
|
22
|
+
if (!visible || connectionStatus !== 'connected') {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(InlineDropdown_1.InlineDropdown, { renderAction: renderAction, values: values });
|
|
26
|
+
};
|
|
27
|
+
exports.CompositionContextButton = CompositionContextButton;
|
|
@@ -19,7 +19,10 @@ const container = {
|
|
|
19
19
|
backgroundColor: colors_1.BACKGROUND,
|
|
20
20
|
};
|
|
21
21
|
const getKeysToExpand = (initialFolderName, parentFolderName, initial = []) => {
|
|
22
|
-
initial.push((0, persist_open_folders_1.openFolderKey)(
|
|
22
|
+
initial.push((0, persist_open_folders_1.openFolderKey)({
|
|
23
|
+
folderName: initialFolderName,
|
|
24
|
+
parentName: parentFolderName,
|
|
25
|
+
}));
|
|
23
26
|
const { name, parent } = (0, create_folder_tree_1.splitParentIntoNameAndParent)(parentFolderName);
|
|
24
27
|
if (!name) {
|
|
25
28
|
return initial;
|
|
@@ -36,7 +39,7 @@ const CompositionSelector = () => {
|
|
|
36
39
|
const toggleFolder = (0, react_1.useCallback)((folderName, parentName) => {
|
|
37
40
|
setFoldersExpanded((p) => {
|
|
38
41
|
var _a;
|
|
39
|
-
const key = (0, persist_open_folders_1.openFolderKey)(folderName, parentName);
|
|
42
|
+
const key = (0, persist_open_folders_1.openFolderKey)({ folderName, parentName });
|
|
40
43
|
const prev = (_a = p[key]) !== null && _a !== void 0 ? _a : false;
|
|
41
44
|
const foldersExpandedState = {
|
|
42
45
|
...p,
|
|
@@ -58,31 +61,31 @@ const CompositionSelector = () => {
|
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
63
|
setFoldersExpanded((previousState) => {
|
|
61
|
-
var _a, _b, _c;
|
|
62
64
|
const foldersExpandedState = {
|
|
63
65
|
...previousState,
|
|
64
66
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
const currentFolder = folderName;
|
|
68
|
+
const currentParentName = parentFolderName;
|
|
69
|
+
const key = (0, persist_open_folders_1.openFolderKey)({
|
|
70
|
+
folderName: currentFolder,
|
|
71
|
+
parentName: currentParentName,
|
|
72
|
+
});
|
|
73
|
+
const splitted = key.split('/');
|
|
74
|
+
for (let i = 0; i < splitted.length - 1; i++) {
|
|
75
|
+
const allExceptLast = i === 0
|
|
76
|
+
? (0, persist_open_folders_1.openFolderKey)({
|
|
77
|
+
folderName: splitted.filter((s) => s !== 'no-parent')[0],
|
|
78
|
+
parentName: null,
|
|
79
|
+
})
|
|
80
|
+
: splitted.slice(0, i + 1).join('/');
|
|
81
|
+
foldersExpandedState[allExceptLast] = true;
|
|
79
82
|
}
|
|
80
83
|
(0, persist_open_folders_1.persistExpandedFolders)('compositions', foldersExpandedState);
|
|
81
84
|
return foldersExpandedState;
|
|
82
85
|
});
|
|
83
86
|
},
|
|
84
87
|
};
|
|
85
|
-
}, [compositions
|
|
88
|
+
}, [compositions]);
|
|
86
89
|
const items = (0, react_1.useMemo)(() => {
|
|
87
90
|
return (0, create_folder_tree_1.createFolderTree)(compositions, folders, foldersExpanded);
|
|
88
91
|
}, [compositions, folders, foldersExpanded]);
|
|
@@ -13,10 +13,10 @@ export type CompositionSelectorItemType = {
|
|
|
13
13
|
expanded: boolean;
|
|
14
14
|
};
|
|
15
15
|
export declare const CompositionSelectorItem: React.FC<{
|
|
16
|
-
item: CompositionSelectorItemType;
|
|
17
|
-
currentComposition: string | null;
|
|
18
|
-
tabIndex: number;
|
|
19
|
-
selectComposition: (c: AnyComposition, push: boolean) => void;
|
|
20
|
-
toggleFolder: (folderName: string, parentName: string | null) => void;
|
|
21
|
-
level: number;
|
|
16
|
+
readonly item: CompositionSelectorItemType;
|
|
17
|
+
readonly currentComposition: string | null;
|
|
18
|
+
readonly tabIndex: number;
|
|
19
|
+
readonly selectComposition: (c: AnyComposition, push: boolean) => void;
|
|
20
|
+
readonly toggleFolder: (folderName: string, parentName: string | null) => void;
|
|
21
|
+
readonly level: number;
|
|
22
22
|
}>;
|
|
@@ -9,6 +9,7 @@ const folder_1 = require("../icons/folder");
|
|
|
9
9
|
const still_1 = require("../icons/still");
|
|
10
10
|
const video_1 = require("../icons/video");
|
|
11
11
|
const modals_1 = require("../state/modals");
|
|
12
|
+
const CompositionContextButton_1 = require("./CompositionContextButton");
|
|
12
13
|
const ContextMenu_1 = require("./ContextMenu");
|
|
13
14
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
14
15
|
const SidebarRenderButton_1 = require("./SidebarRenderButton");
|
|
@@ -176,6 +177,6 @@ const CompositionSelectorItem = ({ item, level, currentComposition, tabIndex, se
|
|
|
176
177
|
})
|
|
177
178
|
: null] }));
|
|
178
179
|
}
|
|
179
|
-
return ((0, jsx_runtime_1.jsx)(ContextMenu_1.ContextMenu, { values: contextMenu, children: (0, jsx_runtime_1.jsx)(layout_1.Row, { align: "center", children: (0, jsx_runtime_1.jsxs)("a", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyPress: onKeyPress, type: "button", title: item.composition.id, className: "__remotion-composition", "data-compname": item.composition.id, children: [(0, is_composition_still_1.isCompositionStill)(item.composition) ? ((0, jsx_runtime_1.jsx)(still_1.StillIcon, { color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })) : ((0, jsx_runtime_1.jsx)(video_1.FilmIcon, { color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: label, children: item.composition.id }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(
|
|
180
|
+
return ((0, jsx_runtime_1.jsx)(ContextMenu_1.ContextMenu, { values: contextMenu, children: (0, jsx_runtime_1.jsx)(layout_1.Row, { align: "center", children: (0, jsx_runtime_1.jsxs)("a", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, tabIndex: tabIndex, onClick: onClick, onKeyPress: onKeyPress, type: "button", title: item.composition.id, className: "__remotion-composition", "data-compname": item.composition.id, children: [(0, is_composition_still_1.isCompositionStill)(item.composition) ? ((0, jsx_runtime_1.jsx)(still_1.StillIcon, { color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })) : ((0, jsx_runtime_1.jsx)(video_1.FilmIcon, { color: hovered || selected ? 'white' : colors_1.LIGHT_TEXT, style: iconStyle })), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: label, children: item.composition.id }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(CompositionContextButton_1.CompositionContextButton, { values: contextMenu, visible: hovered }), (0, jsx_runtime_1.jsx)(SidebarRenderButton_1.SidebarRenderButton, { visible: hovered, composition: item.composition })] }) }) }));
|
|
180
181
|
};
|
|
181
182
|
exports.CompositionSelectorItem = CompositionSelectorItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComboboxValue } from './NewComposition/ComboBox';
|
|
3
3
|
export declare const ContextMenu: React.FC<{
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
values: ComboboxValue[];
|
|
4
|
+
readonly children: React.ReactNode;
|
|
5
|
+
readonly values: ComboboxValue[];
|
|
6
6
|
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.GlobalPropsEditorUpdateButton = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const remotion_1 = require("remotion");
|
|
30
|
+
const save_default_props_1 = require("../api/save-default-props");
|
|
31
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
32
|
+
const SchemaResetButton_1 = require("./RenderModal/SchemaEditor/SchemaResetButton");
|
|
33
|
+
const SchemaSaveButton_1 = require("./RenderModal/SchemaEditor/SchemaSaveButton");
|
|
34
|
+
const container = {
|
|
35
|
+
display: 'inline-block',
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
};
|
|
38
|
+
const GlobalPropsEditorUpdateButton = ({ compositionId, currentDefaultProps }) => {
|
|
39
|
+
const [disabled, setDisabled] = react_1.default.useState(false);
|
|
40
|
+
const onClicked = (0, react_1.useCallback)(() => {
|
|
41
|
+
setDisabled(true);
|
|
42
|
+
(0, save_default_props_1.saveDefaultProps)({
|
|
43
|
+
compositionId,
|
|
44
|
+
defaultProps: () => currentDefaultProps,
|
|
45
|
+
})
|
|
46
|
+
.catch((err) => {
|
|
47
|
+
(0, NotificationCenter_1.showNotification)(`Cannot update default props: ${err.stack}`, 2000);
|
|
48
|
+
})
|
|
49
|
+
.finally(() => {
|
|
50
|
+
setDisabled(true);
|
|
51
|
+
});
|
|
52
|
+
}, [compositionId, currentDefaultProps]);
|
|
53
|
+
const onReset = (0, react_1.useCallback)(() => {
|
|
54
|
+
window.remotion_ignoreFastRefreshUpdate = null;
|
|
55
|
+
window.dispatchEvent(new CustomEvent(remotion_1.Internals.PROPS_UPDATED_EXTERNALLY));
|
|
56
|
+
}, []);
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), (0, jsx_runtime_1.jsx)(SchemaSaveButton_1.SchemaSaveButton, { disabled: disabled, onClick: onClicked })] }));
|
|
58
|
+
};
|
|
59
|
+
exports.GlobalPropsEditorUpdateButton = GlobalPropsEditorUpdateButton;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type RenderInlineAction = (color: string) => React.ReactNode;
|
|
3
|
-
export
|
|
4
|
-
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
renderAction: RenderInlineAction;
|
|
7
|
-
title?: string;
|
|
8
|
-
}
|
|
3
|
+
export type InlineActionProps = {
|
|
4
|
+
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
5
|
+
readonly disabled?: boolean;
|
|
6
|
+
readonly renderAction: RenderInlineAction;
|
|
7
|
+
readonly title?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const InlineAction: ({ renderAction, onClick, disabled, title, }: InlineActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
7
7
|
const z_index_1 = require("../state/z-index");
|
|
8
|
-
const InlineAction = ({ renderAction, onClick, disabled, title }) => {
|
|
8
|
+
const InlineAction = ({ renderAction, onClick, disabled, title, }) => {
|
|
9
9
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
10
10
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
11
11
|
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type InlineActionProps } from './InlineAction';
|
|
2
|
+
import type { ComboboxValue } from './NewComposition/ComboBox';
|
|
3
|
+
export declare const InlineDropdown: ({ values, ...props }: Omit<InlineActionProps, "onClick"> & {
|
|
4
|
+
readonly values: ComboboxValue[];
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InlineDropdown = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const player_1 = require("@remotion/player");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_dom_1 = __importDefault(require("react-dom"));
|
|
11
|
+
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
12
|
+
const noop_1 = require("../helpers/noop");
|
|
13
|
+
const z_index_1 = require("../state/z-index");
|
|
14
|
+
const InlineAction_1 = require("./InlineAction");
|
|
15
|
+
const portals_1 = require("./Menu/portals");
|
|
16
|
+
const styles_1 = require("./Menu/styles");
|
|
17
|
+
const MenuContent_1 = require("./NewComposition/MenuContent");
|
|
18
|
+
const InlineDropdown = ({ values, ...props }) => {
|
|
19
|
+
const ref = (0, react_1.useRef)(null);
|
|
20
|
+
const [opened, setOpened] = (0, react_1.useState)({ type: 'not-open' });
|
|
21
|
+
const { currentZIndex } = (0, z_index_1.useZIndex)();
|
|
22
|
+
const size = player_1.PlayerInternals.useElementSize(ref, {
|
|
23
|
+
triggerOnWindowResize: true,
|
|
24
|
+
shouldApplyCssTransforms: true,
|
|
25
|
+
});
|
|
26
|
+
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
27
|
+
const onClick = (0, react_1.useCallback)((e) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
setOpened({ type: 'open', left: e.clientX, top: e.clientY });
|
|
31
|
+
}, []);
|
|
32
|
+
const spaceToBottom = (0, react_1.useMemo)(() => {
|
|
33
|
+
if (size && opened.type === 'open') {
|
|
34
|
+
return size.windowSize.height - opened.top;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
37
|
+
}, [opened, size]);
|
|
38
|
+
const spaceToTop = (0, react_1.useMemo)(() => {
|
|
39
|
+
if (size && opened.type === 'open') {
|
|
40
|
+
return opened.top;
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}, [opened, size]);
|
|
44
|
+
const portalStyle = (0, react_1.useMemo)(() => {
|
|
45
|
+
if (opened.type === 'not-open') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!size) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const spaceToRight = size.windowSize.width - size.left;
|
|
52
|
+
const spaceToLeft = size.left + size.width;
|
|
53
|
+
const minSpaceRequired = isMobileLayout
|
|
54
|
+
? styles_1.MAX_MOBILE_MENU_WIDTH
|
|
55
|
+
: styles_1.MAX_MENU_WIDTH;
|
|
56
|
+
const verticalLayout = spaceToTop > spaceToBottom ? 'bottom' : 'top';
|
|
57
|
+
const canOpenOnLeft = spaceToLeft >= minSpaceRequired;
|
|
58
|
+
const canOpenOnRight = spaceToRight >= minSpaceRequired;
|
|
59
|
+
const horizontalLayout = canOpenOnRight ? 'left' : 'right';
|
|
60
|
+
return {
|
|
61
|
+
...styles_1.menuContainerTowardsTop,
|
|
62
|
+
...(verticalLayout === 'top'
|
|
63
|
+
? {
|
|
64
|
+
top: opened.top,
|
|
65
|
+
}
|
|
66
|
+
: {
|
|
67
|
+
bottom: size.windowSize.height - opened.top,
|
|
68
|
+
}),
|
|
69
|
+
...(horizontalLayout === 'left'
|
|
70
|
+
? {
|
|
71
|
+
left: opened.left,
|
|
72
|
+
}
|
|
73
|
+
: {
|
|
74
|
+
right: canOpenOnLeft ? size.windowSize.width - opened.left : 0,
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
}, [opened, size, isMobileLayout, spaceToTop, spaceToBottom]);
|
|
78
|
+
const onHide = (0, react_1.useCallback)(() => {
|
|
79
|
+
setOpened({ type: 'not-open' });
|
|
80
|
+
}, []);
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { ref: ref, children: (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: onClick, ...props }) }), portalStyle
|
|
82
|
+
? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: false, topItemCanBeUnselected: false, fixedHeight: null }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
|
|
83
|
+
: null] }));
|
|
84
|
+
};
|
|
85
|
+
exports.InlineDropdown = InlineDropdown;
|
|
@@ -12,6 +12,6 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
|
|
|
12
12
|
status: 'error' | 'warning' | 'ok';
|
|
13
13
|
isFocused: boolean;
|
|
14
14
|
isHovered: boolean;
|
|
15
|
-
}) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#
|
|
15
|
+
}) => "#ff3232" | "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#f1c40f";
|
|
16
16
|
export declare const RemotionInput: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
17
17
|
export {};
|
|
@@ -4,19 +4,14 @@ exports.OptionsPanel = exports.optionsSidebarTabs = exports.persistSelectedOptio
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
-
const ShortcutHint_1 = require("../error-overlay/remotion-overlay/ShortcutHint");
|
|
8
7
|
const colors_1 = require("../helpers/colors");
|
|
9
8
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
9
|
+
const GlobalPropsEditorUpdateButton_1 = require("./GlobalPropsEditorUpdateButton");
|
|
10
10
|
const DataEditor_1 = require("./RenderModal/DataEditor");
|
|
11
11
|
const deep_equal_1 = require("./RenderModal/SchemaEditor/deep-equal");
|
|
12
12
|
const RenderQueue_1 = require("./RenderQueue");
|
|
13
13
|
const RendersTab_1 = require("./RendersTab");
|
|
14
14
|
const Tabs_1 = require("./Tabs");
|
|
15
|
-
const circle = {
|
|
16
|
-
width: 8,
|
|
17
|
-
height: 8,
|
|
18
|
-
borderRadius: 4,
|
|
19
|
-
};
|
|
20
15
|
const localStorageKey = 'remotion.sidebarPanel';
|
|
21
16
|
const getSelectedPanel = (readOnlyStudio) => {
|
|
22
17
|
if (readOnlyStudio) {
|
|
@@ -66,14 +61,6 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
66
61
|
};
|
|
67
62
|
}, []);
|
|
68
63
|
const { compositions, canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
69
|
-
const circleStyle = (0, react_1.useMemo)(() => {
|
|
70
|
-
const onTabColor = saving ? colors_1.LIGHT_TEXT : 'white';
|
|
71
|
-
return {
|
|
72
|
-
...circle,
|
|
73
|
-
backgroundColor: panel === 'input-props' ? onTabColor : colors_1.LIGHT_TEXT,
|
|
74
|
-
cursor: 'help',
|
|
75
|
-
};
|
|
76
|
-
}, [panel, saving]);
|
|
77
64
|
const composition = (0, react_1.useMemo)(() => {
|
|
78
65
|
if (canvasContent === null || canvasContent.type !== 'composition') {
|
|
79
66
|
return null;
|
|
@@ -85,15 +72,11 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
85
72
|
}
|
|
86
73
|
return null;
|
|
87
74
|
}, [canvasContent, compositions]);
|
|
88
|
-
const saveToolTip = (0, react_1.useMemo)(() => {
|
|
89
|
-
return process.env.KEYBOARD_SHORTCUTS_ENABLED
|
|
90
|
-
? `Save using ${ShortcutHint_1.cmdOrCtrlCharacter}+S`
|
|
91
|
-
: 'There are unsaved changes';
|
|
92
|
-
}, []);
|
|
93
75
|
const setDefaultProps = (0, react_1.useCallback)((newProps) => {
|
|
94
76
|
if (composition === null) {
|
|
95
77
|
return;
|
|
96
78
|
}
|
|
79
|
+
window.remotion_ignoreFastRefreshUpdate = null;
|
|
97
80
|
updateProps({
|
|
98
81
|
id: composition.id,
|
|
99
82
|
defaultProps: composition.defaultProps,
|
|
@@ -122,6 +105,6 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
122
105
|
window.removeEventListener(remotion_1.Internals.PROPS_UPDATED_EXTERNALLY, reset);
|
|
123
106
|
};
|
|
124
107
|
}, [reset]);
|
|
125
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsx)("div", { style: tabsContainer, children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [composition ? ((0, jsx_runtime_1.jsxs)(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onPropsSelected, style: { justifyContent: 'space-between' }, children: ["Props", unsavedChangesExist ? ((0, jsx_runtime_1.jsx)(
|
|
108
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsx)("div", { style: tabsContainer, children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [composition ? ((0, jsx_runtime_1.jsxs)(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onPropsSelected, style: { justifyContent: 'space-between' }, children: ["Props", unsavedChangesExist ? ((0, jsx_runtime_1.jsx)(GlobalPropsEditorUpdateButton_1.GlobalPropsEditorUpdateButton, { compositionId: composition.id, currentDefaultProps: currentDefaultProps })) : null] })) : null, readOnlyStudio ? null : ((0, jsx_runtime_1.jsx)(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' }))] }) }), panel === `input-props` && composition ? ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, { unresolvedComposition: composition, defaultProps: currentDefaultProps, setDefaultProps: setDefaultProps, mayShowSaveButton: true, propsEditType: "default-props", saving: saving, setSaving: setSaving, readOnlyStudio: readOnlyStudio }, composition.id)) : readOnlyStudio ? null : ((0, jsx_runtime_1.jsx)(RenderQueue_1.RenderQueue, {}))] }));
|
|
126
109
|
};
|
|
127
110
|
exports.OptionsPanel = OptionsPanel;
|
|
@@ -12,6 +12,7 @@ const SchemaErrorMessages_1 = require("./SchemaErrorMessages");
|
|
|
12
12
|
const ZodObjectEditor_1 = require("./ZodObjectEditor");
|
|
13
13
|
const deep_equal_1 = require("./deep-equal");
|
|
14
14
|
const local_state_1 = require("./local-state");
|
|
15
|
+
const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
|
|
15
16
|
const scrollable = {
|
|
16
17
|
display: 'flex',
|
|
17
18
|
flexDirection: 'column',
|
|
@@ -81,6 +82,6 @@ const SchemaEditor = ({ schema, unsavedDefaultProps, setValue, zodValidationResu
|
|
|
81
82
|
if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
|
|
82
83
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
83
84
|
}
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(local_state_1.RevisionContext.Provider, { value: revisionState, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, unsavedValue: unsavedDefaultProps, setValue: setValue, jsonPath: [], schema: schema, savedValue: savedDefaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }) }));
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(local_state_1.RevisionContext.Provider, { value: revisionState, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, unsavedValue: unsavedDefaultProps, setValue: setValue, jsonPath: [], schema: schema, savedValue: savedDefaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }) }));
|
|
85
86
|
};
|
|
86
87
|
exports.SchemaEditor = SchemaEditor;
|
|
@@ -9,6 +9,7 @@ const InlineRemoveButton_1 = require("../InlineRemoveButton");
|
|
|
9
9
|
const SchemaResetButton_1 = require("./SchemaResetButton");
|
|
10
10
|
const SchemaSaveButton_1 = require("./SchemaSaveButton");
|
|
11
11
|
const get_schema_label_1 = require("./get-schema-label");
|
|
12
|
+
const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
|
|
12
13
|
const compactStyles = {
|
|
13
14
|
fontSize: 15,
|
|
14
15
|
color: colors_1.LIGHT_TEXT,
|
|
@@ -40,7 +41,7 @@ const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton
|
|
|
40
41
|
setClickableButtonHovered(false);
|
|
41
42
|
}, []);
|
|
42
43
|
const labelContent = ((0, jsx_runtime_1.jsxs)("span", { style: labelStyle, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), " ", suffix ? suffix : null] }));
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: compactStyles, children: [handleClick ? (
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compactStyles, className: scroll_to_default_props_path_1.DEFAULT_PROPS_PATH_CLASSNAME, "data-json-path": jsonPath.join('.'), children: [handleClick ? (
|
|
44
45
|
// Minus the padding that a button has (user agent padding-line-start)
|
|
45
46
|
(0, jsx_runtime_1.jsx)("button", { onPointerEnter: onClickablePointerEnter, onPointerLeave: onClickablePointerLeave, type: "button", onClick: handleClick, style: { border: 'none', marginLeft: -6 }, children: labelContent })) : (labelContent), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), isDefaultValue ? null : showSaveButton ? ((0, jsx_runtime_1.jsx)(SchemaSaveButton_1.SchemaSaveButton, { onClick: onSave, disabled: disableSave })) : null, onRemove ? (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
|
|
46
47
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const DEFAULT_PROPS_PATH_CLASSNAME = "__remotion-default-props-editor-label";
|
|
3
|
+
export declare const DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME = "__remotion-default-props-editor-label-active";
|
|
4
|
+
export declare const defaultPropsEditorScrollableAreaRef: React.RefObject<HTMLDivElement>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.defaultPropsEditorScrollableAreaRef = exports.DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME = exports.DEFAULT_PROPS_PATH_CLASSNAME = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
exports.DEFAULT_PROPS_PATH_CLASSNAME = '__remotion-default-props-editor-label';
|
|
9
|
+
exports.DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME = '__remotion-default-props-editor-label-active';
|
|
10
|
+
exports.defaultPropsEditorScrollableAreaRef = react_1.default.createRef();
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MouseEventHandler } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const RendersTab: React.FC<{
|
|
4
|
-
selected: boolean;
|
|
5
|
-
onClick: MouseEventHandler<
|
|
4
|
+
readonly selected: boolean;
|
|
5
|
+
readonly onClick: MouseEventHandler<HTMLDivElement>;
|
|
6
6
|
}>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const Tabs: React.FC<{
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
style?: React.CSSProperties;
|
|
3
|
+
readonly children: React.ReactNode;
|
|
4
|
+
readonly style?: React.CSSProperties;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const Tab: React.FC<{
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
onClick: React.MouseEventHandler<
|
|
9
|
-
style?: React.CSSProperties;
|
|
10
|
-
selected: boolean;
|
|
7
|
+
readonly children: React.ReactNode;
|
|
8
|
+
readonly onClick: React.MouseEventHandler<HTMLDivElement>;
|
|
9
|
+
readonly style?: React.CSSProperties;
|
|
10
|
+
readonly selected: boolean;
|
|
11
11
|
}>;
|
|
@@ -51,6 +51,6 @@ const Tab = ({ children, onClick, style, selected }) => {
|
|
|
51
51
|
boxShadow: selected ? 'none' : undefined,
|
|
52
52
|
...style,
|
|
53
53
|
}), [hovered, selected, style]);
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)("
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: definiteStyle, role: "button", onClick: onClick, tabIndex: tabIndex, onPointerLeave: onPointerLeave, onPointerEnter: onPointerEnter, children: children }));
|
|
55
55
|
};
|
|
56
56
|
exports.Tab = Tab;
|