@remotion/cli 3.3.82 → 3.3.84
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/codemods/update-default-props.js +7 -8
- package/dist/color-math.d.ts +1 -0
- package/dist/color-math.js +12 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/user-agent.d.ts +4 -0
- package/dist/config/user-agent.js +12 -0
- package/dist/editor/components/Canvas.js +1 -4
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +7 -0
- package/dist/editor/components/NewComposition/RemInputTypeColor.js +53 -0
- package/dist/editor/components/RenderButton.js +4 -1
- package/dist/editor/components/RenderModal/CrfSetting.js +1 -1
- package/dist/editor/components/RenderModal/EnvInput.js +1 -1
- package/dist/editor/components/RenderModal/FrameRangeSetting.js +1 -1
- package/dist/editor/components/RenderModal/NumberOfLoopsSetting.js +1 -1
- package/dist/editor/components/RenderModal/NumberSetting.js +1 -1
- package/dist/editor/components/RenderModal/RenderModal.js +25 -15
- package/dist/editor/components/RenderModal/RenderModalAdvanced.js +2 -0
- package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalBasic.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalData.js +71 -12
- package/dist/editor/components/RenderModal/RenderModalInput.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.d.ts +1 -0
- package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.js +22 -2
- package/dist/editor/components/RenderModal/RenderModalPicture.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +3 -40
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +11 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +55 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +108 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/{ZodOrNullEditor.d.ts → ZodNullableEditor.d.ts} +1 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +10 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +10 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.js +3 -0
- package/dist/editor/components/RenderModal/layout.js +0 -1
- package/dist/editor/components/RenderModal/out-name-checker.d.ts +0 -1
- package/dist/editor/components/RenderModal/out-name-checker.js +3 -3
- package/dist/editor/components/RenderQueue/actions.d.ts +0 -2
- package/dist/editor/components/RenderQueue/actions.js +10 -11
- package/dist/editor/components/RenderQueue/index.js +25 -1
- package/dist/editor/components/RenderToolbarIcon.js +22 -7
- package/dist/editor/components/RendersTab.js +3 -3
- package/dist/editor/components/RightPanel.js +2 -7
- package/dist/editor/components/SegmentedControl.d.ts +0 -5
- package/dist/editor/components/SegmentedControl.js +2 -3
- package/dist/editor/components/SidebarCollapserControls.js +81 -10
- package/dist/editor/components/SizeSelector.js +1 -1
- package/dist/editor/components/Splitter/SplitterElement.js +1 -0
- package/dist/editor/components/Tabs/index.js +9 -2
- package/dist/editor/components/Tabs/vertical.d.ts +7 -0
- package/dist/editor/components/Tabs/vertical.js +43 -0
- package/dist/editor/components/TimeValue.js +3 -4
- package/dist/editor/components/Timeline/TimelineListItem.js +9 -1
- package/dist/ffmpeg.js +2 -2
- package/dist/get-cli-options.js +1 -0
- package/dist/parse-command-line.d.ts +1 -0
- package/dist/parse-command-line.js +3 -0
- package/dist/preview-server/api-types.d.ts +0 -4
- package/dist/preview-server/render-queue/job.d.ts +1 -1
- package/dist/preview-server/render-queue/queue.d.ts +1 -13
- package/dist/preview-server/render-queue/queue.js +6 -9
- package/dist/preview-server/routes/can-update-default-props.d.ts +4 -0
- package/dist/preview-server/routes/can-update-default-props.js +38 -0
- package/package.json +6 -6
- package/dist/editor/components/CheckerboardContext.d.ts +0 -0
- package/dist/editor/components/CheckerboardContext.js +0 -1
- package/dist/editor/components/CollapsedSidebarExpander.d.ts +0 -5
- package/dist/editor/components/CollapsedSidebarExpander.js +0 -40
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullEditor.js +0 -45
- package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.d.ts +0 -2
- package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.js +0 -21
- package/dist/editor/components/SidebarContent.d.ts +0 -5
- package/dist/editor/components/SidebarContent.js +0 -53
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderJob, RenderJobWithCleanup } from './job';
|
|
2
2
|
export declare const getRenderQueue: () => RenderJob[];
|
|
3
|
-
export declare const notifyClientsOfJobUpdate: () => void;
|
|
4
|
-
export declare const processJob: ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }: {
|
|
5
|
-
job: RenderJob;
|
|
6
|
-
remotionRoot: string;
|
|
7
|
-
entryPoint: string;
|
|
8
|
-
onProgress: JobProgressCallback;
|
|
9
|
-
addCleanupCallback: (cb: () => void) => void;
|
|
10
|
-
}) => Promise<void>;
|
|
11
3
|
export declare const addJob: ({ job, entryPoint, remotionRoot, }: {
|
|
12
4
|
job: RenderJobWithCleanup;
|
|
13
5
|
entryPoint: string;
|
|
@@ -15,7 +7,3 @@ export declare const addJob: ({ job, entryPoint, remotionRoot, }: {
|
|
|
15
7
|
}) => void;
|
|
16
8
|
export declare const removeJob: (jobId: string) => void;
|
|
17
9
|
export declare const cancelJob: (jobId: string) => void;
|
|
18
|
-
export declare const processJobIfPossible: ({ remotionRoot, entryPoint, }: {
|
|
19
|
-
remotionRoot: string;
|
|
20
|
-
entryPoint: string;
|
|
21
|
-
}) => Promise<void>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.cancelJob = exports.removeJob = exports.addJob = exports.getRenderQueue = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const chalk_1 = require("../../chalk");
|
|
9
9
|
const file_watcher_1 = require("../../file-watcher");
|
|
@@ -21,7 +21,7 @@ const updateJob = (id, updater) => {
|
|
|
21
21
|
}
|
|
22
22
|
return j;
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
notifyClientsOfJobUpdate();
|
|
25
25
|
};
|
|
26
26
|
const getRenderQueue = () => {
|
|
27
27
|
return jobQueue.map((j) => {
|
|
@@ -38,7 +38,6 @@ const notifyClientsOfJobUpdate = () => {
|
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
exports.notifyClientsOfJobUpdate = notifyClientsOfJobUpdate;
|
|
42
41
|
const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanupCallback, }) => {
|
|
43
42
|
if (job.type === 'still') {
|
|
44
43
|
await (0, process_still_1.processStill)({
|
|
@@ -62,11 +61,10 @@ const processJob = async ({ job, remotionRoot, entryPoint, onProgress, addCleanu
|
|
|
62
61
|
}
|
|
63
62
|
throw new Error(`Unknown job ${JSON.stringify(job)}`);
|
|
64
63
|
};
|
|
65
|
-
exports.processJob = processJob;
|
|
66
64
|
const addJob = ({ job, entryPoint, remotionRoot, }) => {
|
|
67
65
|
jobQueue.push(job);
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
processJobIfPossible({ entryPoint, remotionRoot });
|
|
67
|
+
notifyClientsOfJobUpdate();
|
|
70
68
|
};
|
|
71
69
|
exports.addJob = addJob;
|
|
72
70
|
const removeJob = (jobId) => {
|
|
@@ -79,7 +77,7 @@ const removeJob = (jobId) => {
|
|
|
79
77
|
}
|
|
80
78
|
return true;
|
|
81
79
|
});
|
|
82
|
-
|
|
80
|
+
notifyClientsOfJobUpdate();
|
|
83
81
|
};
|
|
84
82
|
exports.removeJob = removeJob;
|
|
85
83
|
const cancelJob = (jobId) => {
|
|
@@ -118,7 +116,7 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
|
118
116
|
const startTime = Date.now();
|
|
119
117
|
log_1.Log.info(chalk_1.chalk.gray('╭─ Starting render '));
|
|
120
118
|
let lastProgress = null;
|
|
121
|
-
await
|
|
119
|
+
await processJob({
|
|
122
120
|
job: nextJob,
|
|
123
121
|
entryPoint,
|
|
124
122
|
remotionRoot,
|
|
@@ -205,4 +203,3 @@ const processJobIfPossible = async ({ remotionRoot, entryPoint, }) => {
|
|
|
205
203
|
await Promise.all(jobCleanups.map((c) => c()));
|
|
206
204
|
}
|
|
207
205
|
};
|
|
208
|
-
exports.processJobIfPossible = processJobIfPossible;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiHandler } from '../api-types';
|
|
2
|
+
import type { CanUpdateDefaultPropsRequest, CanUpdateDefaultPropsResponse } from '../render-queue/job';
|
|
3
|
+
export declare const checkIfTypeScriptFile: (file: string) => void;
|
|
4
|
+
export declare const canUpdateDefaultPropsHandler: ApiHandler<CanUpdateDefaultPropsRequest, CanUpdateDefaultPropsResponse>;
|
|
@@ -1 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canUpdateDefaultPropsHandler = exports.checkIfTypeScriptFile = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const update_default_props_1 = require("../../codemods/update-default-props");
|
|
6
|
+
const project_info_1 = require("../project-info");
|
|
7
|
+
const checkIfTypeScriptFile = (file) => {
|
|
8
|
+
if (!file.endsWith('.tsx') &&
|
|
9
|
+
!file.endsWith('.ts') &&
|
|
10
|
+
!file.endsWith('.mtsx') &&
|
|
11
|
+
!file.endsWith('.mts')) {
|
|
12
|
+
throw new Error('Cannot update default props for non-TypeScript files');
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.checkIfTypeScriptFile = checkIfTypeScriptFile;
|
|
16
|
+
const canUpdateDefaultPropsHandler = async ({ input: { compositionId }, remotionRoot }) => {
|
|
17
|
+
try {
|
|
18
|
+
const projectInfo = await (0, project_info_1.getProjectInfo)(remotionRoot);
|
|
19
|
+
if (!projectInfo.videoFile) {
|
|
20
|
+
throw new Error('Cannot find root file in project');
|
|
21
|
+
}
|
|
22
|
+
(0, exports.checkIfTypeScriptFile)(projectInfo.videoFile);
|
|
23
|
+
await (0, update_default_props_1.updateDefaultProps)({
|
|
24
|
+
compositionId,
|
|
25
|
+
input: (0, fs_1.readFileSync)(projectInfo.videoFile, 'utf-8'),
|
|
26
|
+
newDefaultProps: {},
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
canUpdate: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
return {
|
|
34
|
+
canUpdate: false,
|
|
35
|
+
reason: err.message,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.canUpdateDefaultPropsHandler = canUpdateDefaultPropsHandler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cli",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.84",
|
|
4
4
|
"description": "CLI for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
17
17
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@remotion/bundler": "3.3.
|
|
20
|
-
"@remotion/media-utils": "3.3.
|
|
21
|
-
"@remotion/player": "3.3.
|
|
22
|
-
"@remotion/renderer": "3.3.
|
|
19
|
+
"@remotion/bundler": "3.3.84",
|
|
20
|
+
"@remotion/media-utils": "3.3.84",
|
|
21
|
+
"@remotion/player": "3.3.84",
|
|
22
|
+
"@remotion/renderer": "3.3.84",
|
|
23
23
|
"dotenv": "9.0.2",
|
|
24
24
|
"memfs": "3.4.3",
|
|
25
25
|
"minimist": "1.2.6",
|
|
26
26
|
"open": "^8.4.2",
|
|
27
27
|
"prompts": "2.4.1",
|
|
28
|
-
"remotion": "3.3.
|
|
28
|
+
"remotion": "3.3.84",
|
|
29
29
|
"semver": "7.3.5",
|
|
30
30
|
"source-map": "0.6.1"
|
|
31
31
|
},
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CollapsedSidebarExpander = 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 caret_1 = require("../icons/caret");
|
|
8
|
-
const z_index_1 = require("../state/z-index");
|
|
9
|
-
const CollapsedSidebarExpander = ({ onExpand, direction }) => {
|
|
10
|
-
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
11
|
-
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
12
|
-
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
13
|
-
setHovered(true);
|
|
14
|
-
}, []);
|
|
15
|
-
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
16
|
-
setHovered(false);
|
|
17
|
-
}, []);
|
|
18
|
-
const style = (0, react_1.useMemo)(() => {
|
|
19
|
-
return {
|
|
20
|
-
border: 'none',
|
|
21
|
-
borderRight: `${direction === 'right' ? 1 : 0}px solid black`,
|
|
22
|
-
borderLeft: `${direction === 'left' ? 1 : 0}px solid black`,
|
|
23
|
-
cursor: 'pointer',
|
|
24
|
-
color: 'white',
|
|
25
|
-
display: 'flex',
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
paddingLeft: direction === 'right' ? 7 : 5,
|
|
29
|
-
paddingRight: direction === 'right' ? 4 : 5,
|
|
30
|
-
backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
|
|
31
|
-
hovered,
|
|
32
|
-
selected: false,
|
|
33
|
-
}),
|
|
34
|
-
appearance: 'none',
|
|
35
|
-
WebkitAppearance: 'none',
|
|
36
|
-
};
|
|
37
|
-
}, [direction, hovered]);
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)("button", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, type: "button", role: "button", tabIndex: tabIndex, onClick: onExpand, children: direction === 'right' ? (0, jsx_runtime_1.jsx)(caret_1.CaretRight, {}) : (0, jsx_runtime_1.jsx)(caret_1.CaretLeft, {}) }));
|
|
39
|
-
};
|
|
40
|
-
exports.CollapsedSidebarExpander = CollapsedSidebarExpander;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZodOrNullEditor = 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 Checkbox_1 = require("../../Checkbox");
|
|
8
|
-
const layout_1 = require("../../layout");
|
|
9
|
-
const create_zod_values_1 = require("./create-zod-values");
|
|
10
|
-
const SchemaLabel_1 = require("./SchemaLabel");
|
|
11
|
-
const ZodSwitch_1 = require("./ZodSwitch");
|
|
12
|
-
const fullWidth = {
|
|
13
|
-
width: '100%',
|
|
14
|
-
};
|
|
15
|
-
const labelStyle = {
|
|
16
|
-
fontFamily: 'sans-serif',
|
|
17
|
-
fontSize: 14,
|
|
18
|
-
color: colors_1.LIGHT_TEXT,
|
|
19
|
-
};
|
|
20
|
-
const checkBoxWrapper = {
|
|
21
|
-
margin: '2px',
|
|
22
|
-
display: 'flex',
|
|
23
|
-
flexDirection: 'row',
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
marginTop: '5px',
|
|
26
|
-
};
|
|
27
|
-
const ZodOrNullEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, nullishValue, }) => {
|
|
28
|
-
const isChecked = value === nullishValue;
|
|
29
|
-
const onValueChange = (0, react_1.useCallback)((newValue) => {
|
|
30
|
-
setValue(newValue);
|
|
31
|
-
}, [setValue]);
|
|
32
|
-
const onCheckBoxChange = (0, react_1.useCallback)((e) => {
|
|
33
|
-
console.log({ schema, newVal: (0, create_zod_values_1.createZodValues)(schema) });
|
|
34
|
-
const val = e.target.checked ? nullishValue : (0, create_zod_values_1.createZodValues)(schema);
|
|
35
|
-
onValueChange(val);
|
|
36
|
-
}, [nullishValue, onValueChange, schema]);
|
|
37
|
-
const reset = (0, react_1.useCallback)(() => {
|
|
38
|
-
onValueChange(defaultValue);
|
|
39
|
-
}, [defaultValue, onValueChange]);
|
|
40
|
-
const save = (0, react_1.useCallback)(() => {
|
|
41
|
-
onSave(() => value);
|
|
42
|
-
}, [onSave, value]);
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [value === null ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove })) : ((0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onValueChange, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }) })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
|
|
44
|
-
};
|
|
45
|
-
exports.ZodOrNullEditor = ZodOrNullEditor;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeJSONWithSchema = exports.serializeJSONWithSchema = void 0;
|
|
4
|
-
const serializeJSONWithSchema = (data, indent) => {
|
|
5
|
-
return JSON.stringify(data, function (key, value) {
|
|
6
|
-
if (this[key] instanceof Date) {
|
|
7
|
-
return `remotion-date:${this[key].toISOString()}`;
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
10
|
-
}, indent);
|
|
11
|
-
};
|
|
12
|
-
exports.serializeJSONWithSchema = serializeJSONWithSchema;
|
|
13
|
-
const deserializeJSONWithSchema = (data) => {
|
|
14
|
-
return JSON.parse(data, (_, value) => {
|
|
15
|
-
if (typeof value === 'string' && value.startsWith('remotion-date:')) {
|
|
16
|
-
return new Date(value.replace('remotion-date:', ''));
|
|
17
|
-
}
|
|
18
|
-
return value;
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.deserializeJSONWithSchema = deserializeJSONWithSchema;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SidebarContent = exports.leftSidebarTabs = 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 CompositionSelector_1 = require("./CompositionSelector");
|
|
8
|
-
const CurrentCompositionSideEffects_1 = require("./CurrentCompositionSideEffects");
|
|
9
|
-
const RenderQueue_1 = require("./RenderQueue");
|
|
10
|
-
const context_1 = require("./RenderQueue/context");
|
|
11
|
-
const RendersTab_1 = require("./RendersTab");
|
|
12
|
-
const Tabs_1 = require("./Tabs");
|
|
13
|
-
const container = {
|
|
14
|
-
width: '100%',
|
|
15
|
-
};
|
|
16
|
-
const tabsContainer = {
|
|
17
|
-
borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
|
|
18
|
-
};
|
|
19
|
-
exports.leftSidebarTabs = (0, react_1.createRef)();
|
|
20
|
-
const localStorageKey = 'remotion.sidebarPanel';
|
|
21
|
-
const persistSelectedPanel = (panel) => {
|
|
22
|
-
localStorage.setItem(localStorageKey, panel);
|
|
23
|
-
};
|
|
24
|
-
const getSelectedPanel = (shouldRender) => {
|
|
25
|
-
const panel = localStorage.getItem(localStorageKey);
|
|
26
|
-
if (panel === 'renders' && shouldRender) {
|
|
27
|
-
return 'renders';
|
|
28
|
-
}
|
|
29
|
-
return 'compositions';
|
|
30
|
-
};
|
|
31
|
-
const SidebarContent = () => {
|
|
32
|
-
const shouldRender = (0, context_1.useShouldRenderLeftSidebarTabs)();
|
|
33
|
-
const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel(shouldRender));
|
|
34
|
-
const onCompositionsSelected = (0, react_1.useCallback)(() => {
|
|
35
|
-
setPanel('compositions');
|
|
36
|
-
persistSelectedPanel('compositions');
|
|
37
|
-
}, []);
|
|
38
|
-
const onRendersSelected = (0, react_1.useCallback)(() => {
|
|
39
|
-
setPanel('renders');
|
|
40
|
-
persistSelectedPanel('renders');
|
|
41
|
-
}, []);
|
|
42
|
-
(0, react_1.useImperativeHandle)(exports.leftSidebarTabs, () => {
|
|
43
|
-
return {
|
|
44
|
-
selectRendersPanel: () => {
|
|
45
|
-
setPanel('renders');
|
|
46
|
-
persistSelectedPanel('renders');
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}, []);
|
|
50
|
-
// TODO: It is not perfectly aligned in example
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [shouldRender ? ((0, jsx_runtime_1.jsx)("div", { style: tabsContainer, children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tab, { selected: panel === 'compositions', onClick: onCompositionsSelected, children: "Compositions" }), (0, jsx_runtime_1.jsx)(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' })] }) })) : null, panel === 'renders' && shouldRender ? ((0, jsx_runtime_1.jsx)(RenderQueue_1.RenderQueue, {})) : ((0, jsx_runtime_1.jsx)(CompositionSelector_1.CompositionSelector, {})), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.CurrentCompositionKeybindings, {}), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.TitleUpdater, {})] }));
|
|
52
|
-
};
|
|
53
|
-
exports.SidebarContent = SidebarContent;
|