@remotion/studio 4.0.146 → 4.0.147
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/save-default-props.d.ts +10 -0
- package/dist/api/save-default-props.js +71 -0
- package/dist/api/update-default-props.d.ts +10 -0
- package/dist/api/update-default-props.js +71 -0
- package/dist/api/write-static-file.d.ts +4 -0
- package/dist/api/write-static-file.js +21 -0
- package/dist/components/AssetSelector.js +6 -2
- package/dist/components/OptionsPanel.d.ts +1 -1
- package/dist/components/OptionsPanel.js +5 -5
- package/dist/components/RenderModal/DataEditor.d.ts +8 -8
- package/dist/components/RenderModal/DataEditor.js +9 -9
- package/dist/components/RenderModal/RenderModal.js +1 -1
- package/dist/components/RenderModal/ResolveCompositionBeforeModal.d.ts +2 -2
- package/dist/components/RenderModal/ResolveCompositionBeforeModal.js +0 -1
- package/dist/components/RenderQueue/actions.d.ts +1 -1
- package/dist/components/RenderQueue/actions.js +3 -3
- package/dist/esm/index.mjs +4434 -2
- package/dist/esm/internals.mjs +49 -40
- 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,10 @@
|
|
|
1
|
+
import type { AnyZodObject } from 'zod';
|
|
2
|
+
export type SafeDefaultPropsFunction = (currentValues: {
|
|
3
|
+
schema: AnyZodObject | null;
|
|
4
|
+
savedDefaultProps: Record<string, unknown>;
|
|
5
|
+
unsavedDefaultProps: Record<string, unknown>;
|
|
6
|
+
}) => Record<string, unknown>;
|
|
7
|
+
export declare const saveDefaultProps: ({ compositionId, defaultProps, }: {
|
|
8
|
+
compositionId: string;
|
|
9
|
+
defaultProps: SafeDefaultPropsFunction;
|
|
10
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.saveDefaultProps = void 0;
|
|
27
|
+
const remotion_1 = require("remotion");
|
|
28
|
+
const extract_enum_json_paths_1 = require("../components/RenderModal/SchemaEditor/extract-enum-json-paths");
|
|
29
|
+
const actions_1 = require("../components/RenderQueue/actions");
|
|
30
|
+
const saveDefaultProps = async ({ compositionId, defaultProps, }) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
33
|
+
throw new Error('saveDefaultProps can only be called in the Remotion Studio.');
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
await Promise.resolve().then(() => __importStar(require('zod')));
|
|
37
|
+
}
|
|
38
|
+
catch (_c) {
|
|
39
|
+
throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
|
|
40
|
+
}
|
|
41
|
+
const z = await Promise.resolve().then(() => __importStar(require('zod')));
|
|
42
|
+
const { compositionsRef, editorPropsProviderRef } = remotion_1.Internals;
|
|
43
|
+
const compositionsStore = compositionsRef.current;
|
|
44
|
+
if (!compositionsStore) {
|
|
45
|
+
throw new Error('No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
46
|
+
}
|
|
47
|
+
const compositions = compositionsStore.getCompositions();
|
|
48
|
+
const composition = compositions.find((c) => c.id === compositionId);
|
|
49
|
+
if (!composition) {
|
|
50
|
+
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(', ')}`);
|
|
51
|
+
}
|
|
52
|
+
const propsStore = editorPropsProviderRef.current;
|
|
53
|
+
if (!propsStore) {
|
|
54
|
+
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
55
|
+
}
|
|
56
|
+
const savedDefaultProps = (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
|
57
|
+
const unsavedDefaultProps = (_b = propsStore.getProps()[compositionId]) !== null && _b !== void 0 ? _b : savedDefaultProps;
|
|
58
|
+
const generatedDefaultProps = defaultProps({
|
|
59
|
+
schema: composition.schema,
|
|
60
|
+
savedDefaultProps,
|
|
61
|
+
unsavedDefaultProps,
|
|
62
|
+
});
|
|
63
|
+
const res = await (0, actions_1.callUpdateDefaultPropsApi)(compositionId, generatedDefaultProps, composition.schema ? (0, extract_enum_json_paths_1.extractEnumJsonPaths)(composition.schema, z, []) : []);
|
|
64
|
+
if (res.success) {
|
|
65
|
+
return Promise.resolve();
|
|
66
|
+
}
|
|
67
|
+
const err = new Error(res.reason);
|
|
68
|
+
err.stack = res.stack;
|
|
69
|
+
return Promise.reject(err);
|
|
70
|
+
};
|
|
71
|
+
exports.saveDefaultProps = saveDefaultProps;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnyZodObject } from 'zod';
|
|
2
|
+
export type SafeDefaultPropsFunction = (currentValues: {
|
|
3
|
+
schema: AnyZodObject | null;
|
|
4
|
+
savedDefaultProps: Record<string, unknown>;
|
|
5
|
+
unsavedDefaultProps: Record<string, unknown>;
|
|
6
|
+
}) => Record<string, unknown>;
|
|
7
|
+
export declare const saveDefaultProps: ({ compositionId, defaultProps, }: {
|
|
8
|
+
compositionId: string;
|
|
9
|
+
defaultProps: SafeDefaultPropsFunction;
|
|
10
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.saveDefaultProps = void 0;
|
|
27
|
+
const remotion_1 = require("remotion");
|
|
28
|
+
const extract_enum_json_paths_1 = require("../components/RenderModal/SchemaEditor/extract-enum-json-paths");
|
|
29
|
+
const actions_1 = require("../components/RenderQueue/actions");
|
|
30
|
+
const saveDefaultProps = async ({ compositionId, defaultProps, }) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
33
|
+
throw new Error('saveDefaultProps can only be called in the Remotion Studio.');
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
await Promise.resolve().then(() => __importStar(require('zod')));
|
|
37
|
+
}
|
|
38
|
+
catch (_c) {
|
|
39
|
+
throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
|
|
40
|
+
}
|
|
41
|
+
const z = await Promise.resolve().then(() => __importStar(require('zod')));
|
|
42
|
+
const { compositionsRef, editorPropsProviderRef } = remotion_1.Internals;
|
|
43
|
+
const compositionsStore = compositionsRef.current;
|
|
44
|
+
if (!compositionsStore) {
|
|
45
|
+
throw new Error('No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
46
|
+
}
|
|
47
|
+
const compositions = compositionsStore.getCompositions();
|
|
48
|
+
const composition = compositions.find((c) => c.id === compositionId);
|
|
49
|
+
if (!composition) {
|
|
50
|
+
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(', ')}`);
|
|
51
|
+
}
|
|
52
|
+
const propsStore = editorPropsProviderRef.current;
|
|
53
|
+
if (!propsStore) {
|
|
54
|
+
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
55
|
+
}
|
|
56
|
+
const savedDefaultProps = (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
|
57
|
+
const unsavedDefaultProps = (_b = propsStore.getProps()[compositionId]) !== null && _b !== void 0 ? _b : savedDefaultProps;
|
|
58
|
+
const generatedDefaultProps = defaultProps({
|
|
59
|
+
schema: composition.schema,
|
|
60
|
+
savedDefaultProps,
|
|
61
|
+
unsavedDefaultProps,
|
|
62
|
+
});
|
|
63
|
+
const res = await (0, actions_1.callUpdateDefaultPropsApi)(compositionId, generatedDefaultProps, composition.schema ? (0, extract_enum_json_paths_1.extractEnumJsonPaths)(composition.schema, z, []) : []);
|
|
64
|
+
if (res.success) {
|
|
65
|
+
return Promise.resolve();
|
|
66
|
+
}
|
|
67
|
+
const err = new Error(res.reason);
|
|
68
|
+
err.stack = res.stack;
|
|
69
|
+
return Promise.reject(err);
|
|
70
|
+
};
|
|
71
|
+
exports.saveDefaultProps = saveDefaultProps;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeStaticFile = void 0;
|
|
4
|
+
const writeStaticFile = async ({ contents, filePath, }) => {
|
|
5
|
+
const url = new URL('/api/add-asset', window.location.origin);
|
|
6
|
+
if (filePath.includes('\\')) {
|
|
7
|
+
return Promise.reject(new Error('File path cannot contain backslashes'));
|
|
8
|
+
}
|
|
9
|
+
url.search = new URLSearchParams({
|
|
10
|
+
filePath,
|
|
11
|
+
}).toString();
|
|
12
|
+
const response = await fetch(url, {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
body: contents,
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
const jsonResponse = await response.json();
|
|
18
|
+
throw new Error(jsonResponse.error);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.writeStaticFile = writeStaticFile;
|
|
@@ -30,6 +30,7 @@ exports.AssetSelector = void 0;
|
|
|
30
30
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
32
|
const get_static_files_1 = require("../api/get-static-files");
|
|
33
|
+
const write_static_file_1 = require("../api/write-static-file");
|
|
33
34
|
const client_id_1 = require("../helpers/client-id");
|
|
34
35
|
const colors_1 = require("../helpers/colors");
|
|
35
36
|
const create_folder_tree_1 = require("../helpers/create-folder-tree");
|
|
@@ -40,7 +41,6 @@ const z_index_1 = require("../state/z-index");
|
|
|
40
41
|
const AssetSelectorItem_1 = require("./AssetSelectorItem");
|
|
41
42
|
const styles_1 = require("./Menu/styles");
|
|
42
43
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
43
|
-
const utils_1 = require("./utils");
|
|
44
44
|
const container = {
|
|
45
45
|
display: 'flex',
|
|
46
46
|
flexDirection: 'column',
|
|
@@ -124,7 +124,11 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
124
124
|
const { files } = e.dataTransfer;
|
|
125
125
|
const assetPath = dropLocation || '/';
|
|
126
126
|
for (const file of files) {
|
|
127
|
-
await
|
|
127
|
+
const body = await file.arrayBuffer();
|
|
128
|
+
await (0, write_static_file_1.writeStaticFile)({
|
|
129
|
+
contents: body,
|
|
130
|
+
filePath: file.name,
|
|
131
|
+
});
|
|
128
132
|
}
|
|
129
133
|
if (files.length === 1) {
|
|
130
134
|
(0, NotificationCenter_1.showNotification)(`Added ${files[0].name} to ${assetPath}`, 3000);
|
|
@@ -90,7 +90,7 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
90
90
|
? `Save using ${ShortcutHint_1.cmdOrCtrlCharacter}+S`
|
|
91
91
|
: 'There are unsaved changes';
|
|
92
92
|
}, []);
|
|
93
|
-
const
|
|
93
|
+
const setDefaultProps = (0, react_1.useCallback)((newProps) => {
|
|
94
94
|
if (composition === null) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -100,7 +100,7 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
100
100
|
newProps,
|
|
101
101
|
});
|
|
102
102
|
}, [composition, updateProps]);
|
|
103
|
-
const
|
|
103
|
+
const currentDefaultProps = (0, react_1.useMemo)(() => {
|
|
104
104
|
var _a, _b;
|
|
105
105
|
if (composition === null) {
|
|
106
106
|
return {};
|
|
@@ -111,8 +111,8 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
111
111
|
if (composition === null || composition.defaultProps === undefined) {
|
|
112
112
|
return false;
|
|
113
113
|
}
|
|
114
|
-
return !(0, deep_equal_1.deepEqual)(composition.defaultProps,
|
|
115
|
-
}, [
|
|
116
|
-
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)("div", { title: saveToolTip, style: circleStyle })) : 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,
|
|
114
|
+
return !(0, deep_equal_1.deepEqual)(composition.defaultProps, currentDefaultProps);
|
|
115
|
+
}, [currentDefaultProps, composition]);
|
|
116
|
+
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)("div", { title: saveToolTip, style: circleStyle })) : 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, {}))] }));
|
|
117
117
|
};
|
|
118
118
|
exports.OptionsPanel = OptionsPanel;
|
|
@@ -12,12 +12,12 @@ export type State = {
|
|
|
12
12
|
};
|
|
13
13
|
export type PropsEditType = 'input-props' | 'default-props';
|
|
14
14
|
export declare const DataEditor: React.FC<{
|
|
15
|
-
unresolvedComposition: AnyComposition;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
mayShowSaveButton: boolean;
|
|
19
|
-
propsEditType: PropsEditType;
|
|
20
|
-
saving: boolean;
|
|
21
|
-
setSaving: React.Dispatch<React.SetStateAction<boolean>>;
|
|
22
|
-
readOnlyStudio: boolean;
|
|
15
|
+
readonly unresolvedComposition: AnyComposition;
|
|
16
|
+
readonly defaultProps: Record<string, unknown>;
|
|
17
|
+
readonly setDefaultProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
18
|
+
readonly mayShowSaveButton: boolean;
|
|
19
|
+
readonly propsEditType: PropsEditType;
|
|
20
|
+
readonly saving: boolean;
|
|
21
|
+
readonly setSaving: React.Dispatch<React.SetStateAction<boolean>>;
|
|
22
|
+
readonly readOnlyStudio: boolean;
|
|
23
23
|
}>;
|
|
@@ -87,7 +87,7 @@ const getPersistedShowWarningState = () => {
|
|
|
87
87
|
const setPersistedShowWarningState = (val) => {
|
|
88
88
|
localStorage.setItem(persistanceKey, String(Boolean(val)));
|
|
89
89
|
};
|
|
90
|
-
const DataEditor = ({ unresolvedComposition,
|
|
90
|
+
const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, mayShowSaveButton, propsEditType, saving, setSaving, readOnlyStudio, }) => {
|
|
91
91
|
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
92
92
|
const [showWarning, setShowWarningWithoutPersistance] = (0, react_1.useState)(() => getPersistedShowWarningState());
|
|
93
93
|
const inJSONEditor = mode === 'json';
|
|
@@ -95,13 +95,13 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
95
95
|
if (!inJSONEditor) {
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
|
-
const value =
|
|
98
|
+
const value = defaultProps;
|
|
99
99
|
return no_react_1.NoReactInternals.serializeJSONWithDate({
|
|
100
100
|
data: value,
|
|
101
101
|
indent: 2,
|
|
102
102
|
staticBase: window.remotion_staticBase,
|
|
103
103
|
});
|
|
104
|
-
}, [inJSONEditor,
|
|
104
|
+
}, [inJSONEditor, defaultProps]);
|
|
105
105
|
const cliProps = (0, remotion_1.getInputProps)();
|
|
106
106
|
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({
|
|
107
107
|
[unresolvedComposition.id]: get_render_modal_warnings_1.defaultTypeCanSaveState,
|
|
@@ -126,8 +126,8 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
126
126
|
if (schema === 'no-schema') {
|
|
127
127
|
return 'no-schema';
|
|
128
128
|
}
|
|
129
|
-
return schema.safeParse(
|
|
130
|
-
}, [
|
|
129
|
+
return schema.safeParse(defaultProps);
|
|
130
|
+
}, [defaultProps, schema]);
|
|
131
131
|
const setShowWarning = (0, react_1.useCallback)((val) => {
|
|
132
132
|
setShowWarningWithoutPersistance((prevVal) => {
|
|
133
133
|
if (typeof val === 'boolean') {
|
|
@@ -213,12 +213,12 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
213
213
|
(0, NotificationCenter_1.showNotification)('Cannot update default props: No Zod schema', 2000);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
(0, actions_1.
|
|
216
|
+
(0, actions_1.callUpdateDefaultPropsApi)(unresolvedComposition.id, defaultProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
217
217
|
if (!response.success) {
|
|
218
218
|
(0, NotificationCenter_1.showNotification)(`Cannot update default props: ${response.reason}`, 2000);
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
|
-
}, [unresolvedComposition.id,
|
|
221
|
+
}, [unresolvedComposition.id, defaultProps, schema, z]);
|
|
222
222
|
(0, react_1.useEffect)(() => {
|
|
223
223
|
setSaving(false);
|
|
224
224
|
}, [fastRefreshes, setSaving]);
|
|
@@ -229,7 +229,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
setSaving(true);
|
|
232
|
-
(0, actions_1.
|
|
232
|
+
(0, actions_1.callUpdateDefaultPropsApi)(unresolvedComposition.id, updater((_a = unresolvedComposition.defaultProps) !== null && _a !== void 0 ? _a : {}), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
233
233
|
.then((response) => {
|
|
234
234
|
if (!response.success) {
|
|
235
235
|
// eslint-disable-next-line no-console
|
|
@@ -296,6 +296,6 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, mayShowS
|
|
|
296
296
|
}
|
|
297
297
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
298
298
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
299
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value:
|
|
299
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: defaultProps, setValue: setDefaultProps, schema: schema, zodValidationResult: zodValidationResult, defaultProps: unresolvedComposition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: defaultProps !== null && defaultProps !== void 0 ? defaultProps : {}, setValue: setDefaultProps, onSave: onUpdate, showSaveButton: showSaveButton, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema }))] }));
|
|
300
300
|
};
|
|
301
301
|
exports.DataEditor = DataEditor;
|
|
@@ -800,7 +800,7 @@ const RenderModal = ({ initialFrame, initialVideoImageFormat, initialStillImageF
|
|
|
800
800
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${resolvedComposition.id}` }), (0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderTabOptions, needsWrapping: false }), (0, jsx_runtime_1.jsx)("div", { style: flexer }), (0, jsx_runtime_1.jsxs)(Button_1.Button, { autoFocus: true, onClick: trigger, disabled: renderDisabled, style: {
|
|
801
801
|
...buttonStyle,
|
|
802
802
|
backgroundColor: outnameValidation.valid ? colors_1.BLUE : colors_1.BLUE_DISABLED,
|
|
803
|
-
}, children: [state.type === 'idle' ? `Render ${renderMode}` : 'Rendering...', (0, jsx_runtime_1.jsx)(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: true })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: horizontalLayout, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftSidebar, children: [shownTabs.includes('general') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'general', onClick: () => setTab('general'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(file_1.FileIcon, { style: icon }) }), "General"] })) : null, shownTabs.includes('data') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'data', onClick: () => setTab('data'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(data_1.DataIcon, { style: icon }) }), "Input Props"] })) : null, shownTabs.includes('picture') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'picture', onClick: () => setTab('picture'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(frame_1.PicIcon, { style: icon }) }), "Picture"] })) : null, shownTabs.includes('audio') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'audio', onClick: () => setTab('audio'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(audio_1.AudioIcon, { style: icon }) }), "Audio"] })) : null, shownTabs.includes('gif') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'gif', onClick: () => setTab('gif'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gif_1.GifIcon, { style: icon }) }), "GIF"] })) : null, shownTabs.includes('advanced') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'advanced', onClick: () => setTab('advanced'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gear_1.GearIcon, { style: icon }) }), "Other"] })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: optionsPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, resolvedComposition: resolvedComposition, frame: frame, imageFormatOptions: imageFormatOptions, outName: outName, proResProfile: proResProfile, renderMode: renderMode, setVideoCodec: setCodec, setFrame: setFrame, setOutName: setOutName, setProResProfile: setProResProfile, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame, validationMessage: outnameValidation.valid ? null : outnameValidation.error.message })) : tab === 'picture' ? ((0, jsx_runtime_1.jsx)(RenderModalPicture_1.RenderModalPicture, { renderMode: renderMode, scale: scale, setScale: setScale, pixelFormat: pixelFormat, pixelFormatOptions: pixelFormatOptions, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf, jpegQuality: jpegQuality, qualityControlType: qualityControlType, setJpegQuality: setJpegQuality, setColorSpace: setColorSpace, colorSpace: colorSpace, setCustomTargetVideoBitrateValue: setCustomTargetVideoBitrateValue, setQualityControl: setQualityControl, videoImageFormat: videoImageFormat, stillImageFormat: stillImageFormat, shouldDisplayQualityControlPicker: supportsBothQualityControls, encodingBufferSize: encodingBufferSize, setEncodingBufferSize: setEncodingBufferSize, encodingMaxRate: encodingMaxRate, setEncodingMaxRate: setEncodingMaxRate })) : tab === 'audio' ? ((0, jsx_runtime_1.jsx)(RenderModalAudio_1.RenderModalAudio, { muted: muted, renderMode: renderMode, setMuted: setMuted, codec: codec, audioCodec: audioCodec, setAudioCodec: setAudioCodec, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrackState: setEnforceAudioTrackState, customTargetAudioBitrate: customTargetAudioBitrate, setCustomTargetAudioBitrateValue: setCustomTargetAudioBitrateValue, setShouldHaveCustomTargetAudioBitrate: setShouldHaveCustomTargetAudioBitrate, shouldHaveCustomTargetAudioBitrate: shouldHaveCustomTargetAudioBitrate, forSeamlessAacConcatenation: forSeamlessAacConcatenation, setForSeamlessAacConcatenation: setForSeamlessAacConcatenation, separateAudioTo: separateAudioTo, setSeparateAudioTo: setSeparateAudioTo, outName: outName })) : tab === 'gif' ? ((0, jsx_runtime_1.jsx)(RenderModalGif_1.RenderModalGif, { everyNthFrame: everyNthFrame, limitNumberOfGifLoops: limitNumberOfGifLoops, numberOfGifLoopsSetting: numberOfGifLoopsSetting, setEveryNthFrameSetting: setEveryNthFrameSetting, setLimitNumberOfGifLoops: setLimitNumberOfGifLoops, setNumberOfGifLoopsSetting: setNumberOfGifLoopsSetting })) : tab === 'data' ? ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, {
|
|
803
|
+
}, children: [state.type === 'idle' ? `Render ${renderMode}` : 'Rendering...', (0, jsx_runtime_1.jsx)(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: true })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: horizontalLayout, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftSidebar, children: [shownTabs.includes('general') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'general', onClick: () => setTab('general'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(file_1.FileIcon, { style: icon }) }), "General"] })) : null, shownTabs.includes('data') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'data', onClick: () => setTab('data'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(data_1.DataIcon, { style: icon }) }), "Input Props"] })) : null, shownTabs.includes('picture') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'picture', onClick: () => setTab('picture'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(frame_1.PicIcon, { style: icon }) }), "Picture"] })) : null, shownTabs.includes('audio') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'audio', onClick: () => setTab('audio'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(audio_1.AudioIcon, { style: icon }) }), "Audio"] })) : null, shownTabs.includes('gif') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'gif', onClick: () => setTab('gif'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gif_1.GifIcon, { style: icon }) }), "GIF"] })) : null, shownTabs.includes('advanced') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'advanced', onClick: () => setTab('advanced'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gear_1.GearIcon, { style: icon }) }), "Other"] })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: optionsPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, resolvedComposition: resolvedComposition, frame: frame, imageFormatOptions: imageFormatOptions, outName: outName, proResProfile: proResProfile, renderMode: renderMode, setVideoCodec: setCodec, setFrame: setFrame, setOutName: setOutName, setProResProfile: setProResProfile, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame, validationMessage: outnameValidation.valid ? null : outnameValidation.error.message })) : tab === 'picture' ? ((0, jsx_runtime_1.jsx)(RenderModalPicture_1.RenderModalPicture, { renderMode: renderMode, scale: scale, setScale: setScale, pixelFormat: pixelFormat, pixelFormatOptions: pixelFormatOptions, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf, jpegQuality: jpegQuality, qualityControlType: qualityControlType, setJpegQuality: setJpegQuality, setColorSpace: setColorSpace, colorSpace: colorSpace, setCustomTargetVideoBitrateValue: setCustomTargetVideoBitrateValue, setQualityControl: setQualityControl, videoImageFormat: videoImageFormat, stillImageFormat: stillImageFormat, shouldDisplayQualityControlPicker: supportsBothQualityControls, encodingBufferSize: encodingBufferSize, setEncodingBufferSize: setEncodingBufferSize, encodingMaxRate: encodingMaxRate, setEncodingMaxRate: setEncodingMaxRate })) : tab === 'audio' ? ((0, jsx_runtime_1.jsx)(RenderModalAudio_1.RenderModalAudio, { muted: muted, renderMode: renderMode, setMuted: setMuted, codec: codec, audioCodec: audioCodec, setAudioCodec: setAudioCodec, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrackState: setEnforceAudioTrackState, customTargetAudioBitrate: customTargetAudioBitrate, setCustomTargetAudioBitrateValue: setCustomTargetAudioBitrateValue, setShouldHaveCustomTargetAudioBitrate: setShouldHaveCustomTargetAudioBitrate, shouldHaveCustomTargetAudioBitrate: shouldHaveCustomTargetAudioBitrate, forSeamlessAacConcatenation: forSeamlessAacConcatenation, setForSeamlessAacConcatenation: setForSeamlessAacConcatenation, separateAudioTo: separateAudioTo, setSeparateAudioTo: setSeparateAudioTo, outName: outName })) : tab === 'gif' ? ((0, jsx_runtime_1.jsx)(RenderModalGif_1.RenderModalGif, { everyNthFrame: everyNthFrame, limitNumberOfGifLoops: limitNumberOfGifLoops, numberOfGifLoopsSetting: numberOfGifLoopsSetting, setEveryNthFrameSetting: setEveryNthFrameSetting, setLimitNumberOfGifLoops: setLimitNumberOfGifLoops, setNumberOfGifLoopsSetting: setNumberOfGifLoopsSetting })) : tab === 'data' ? ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, { defaultProps: inputProps, setDefaultProps: setInputProps, unresolvedComposition: unresolvedComposition, mayShowSaveButton: false, propsEditType: "input-props", saving: saving, setSaving: setSaving, readOnlyStudio: false })) : ((0, jsx_runtime_1.jsx)(RenderModalAdvanced_1.RenderModalAdvanced, { x264Preset: x264Preset, setx264Preset: setx264Preset, concurrency: concurrency, maxConcurrency: maxConcurrency, minConcurrency: minConcurrency, renderMode: renderMode, setConcurrency: setConcurrency, setVerboseLogging: setLogLevel, logLevel: logLevel, delayRenderTimeout: delayRenderTimeout, setDelayRenderTimeout: setDelayRenderTimeout, disallowParallelEncoding: disallowParallelEncoding, setDisallowParallelEncoding: setDisallowParallelEncoding, setDisableWebSecurity: setDisableWebSecurity, setIgnoreCertificateErrors: setIgnoreCertificateErrors, setHeadless: setHeadless, headless: headless, ignoreCertificateErrors: ignoreCertificateErrors, disableWebSecurity: disableWebSecurity, openGlOption: openGlOption, setOpenGlOption: setOpenGlOption, setEnvVariables: setEnvVariables, envVariables: envVariables, offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes, setOffthreadVideoCacheSizeInBytes: setOffthreadVideoCacheSizeInBytes, enableMultiProcessOnLinux: multiProcessOnLinux, setChromiumMultiProcessOnLinux: setChromiumMultiProcessOnLinux, codec: codec, userAgent: userAgent, setUserAgent: setUserAgent, setBeep: setBeepOnFinish, beep: beepOnFinish, repro: repro, setRepro: setRepro })) })] })] }));
|
|
804
804
|
};
|
|
805
805
|
const RenderModalWithLoader = (props) => {
|
|
806
806
|
return ((0, jsx_runtime_1.jsx)(DismissableModal_1.DismissableModal, { children: (0, jsx_runtime_1.jsx)(ResolveCompositionBeforeModal_1.ResolveCompositionBeforeModal, { compositionId: props.compositionId, children: (0, jsx_runtime_1.jsx)(RenderModal, { ...props }) }) }));
|
|
@@ -9,7 +9,7 @@ type TResolvedCompositionContext = {
|
|
|
9
9
|
} | null;
|
|
10
10
|
export declare const ResolvedCompositionContext: React.Context<TResolvedCompositionContext>;
|
|
11
11
|
export declare const ResolveCompositionBeforeModal: React.FC<{
|
|
12
|
-
compositionId: string;
|
|
13
|
-
children: React.ReactNode;
|
|
12
|
+
readonly compositionId: string;
|
|
13
|
+
readonly children: React.ReactNode;
|
|
14
14
|
}>;
|
|
15
15
|
export {};
|
|
@@ -77,7 +77,6 @@ const ResolveCompositionBeforeModal = ({ compositionId, children }) => {
|
|
|
77
77
|
if (resolved.type === 'error') {
|
|
78
78
|
return ((0, jsx_runtime_1.jsxs)("div", { style: loaderContainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2 }), (0, jsx_runtime_1.jsxs)("div", { style: loaderLabel, children: ["Running ", (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "calculateMetadata()" }), ' ', "yielded an error:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)("div", { style: loaderLabel, children: resolved.error.message || 'Unknown error' })] }));
|
|
79
79
|
}
|
|
80
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
81
80
|
return ((0, jsx_runtime_1.jsx)(exports.ResolvedCompositionContext.Provider, { value: value, children: children }));
|
|
82
81
|
};
|
|
83
82
|
exports.ResolveCompositionBeforeModal = ResolveCompositionBeforeModal;
|
|
@@ -97,5 +97,5 @@ export declare const removeRenderJob: (job: RenderJob) => Promise<undefined>;
|
|
|
97
97
|
export declare const cancelRenderJob: (job: RenderJob) => Promise<import("@remotion/studio-shared").CancelRenderResponse>;
|
|
98
98
|
export declare const updateAvailable: (signal: AbortSignal) => Promise<import("@remotion/studio-shared").UpdateAvailableResponse>;
|
|
99
99
|
export declare const getProjectInfo: (signal: AbortSignal) => Promise<import("@remotion/studio-shared").ProjectInfoResponse>;
|
|
100
|
-
export declare const
|
|
100
|
+
export declare const callUpdateDefaultPropsApi: (compositionId: string, defaultProps: Record<string, unknown>, enumPaths: EnumPath[]) => Promise<import("@remotion/studio-shared").UpdateDefaultPropsResponse>;
|
|
101
101
|
export declare const canUpdateDefaultProps: (compositionId: string, readOnlyStudio: boolean) => Promise<CanUpdateDefaultPropsResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.canUpdateDefaultProps = exports.
|
|
3
|
+
exports.canUpdateDefaultProps = exports.callUpdateDefaultPropsApi = exports.getProjectInfo = exports.updateAvailable = exports.cancelRenderJob = exports.removeRenderJob = exports.applyCodemod = exports.copyToClipboard = exports.openInFileExplorer = exports.subscribeToFileExistenceWatcher = exports.unsubscribeFromFileExistenceWatcher = exports.addVideoRenderJob = exports.addSequenceRenderJob = exports.addStillRenderJob = void 0;
|
|
4
4
|
const no_react_1 = require("remotion/no-react");
|
|
5
5
|
const callApi = (endpoint, body, signal) => {
|
|
6
6
|
return new Promise((resolve, reject) => {
|
|
@@ -178,7 +178,7 @@ const getProjectInfo = (signal) => {
|
|
|
178
178
|
return callApi('/api/project-info', {}, signal);
|
|
179
179
|
};
|
|
180
180
|
exports.getProjectInfo = getProjectInfo;
|
|
181
|
-
const
|
|
181
|
+
const callUpdateDefaultPropsApi = (compositionId, defaultProps, enumPaths) => {
|
|
182
182
|
return callApi('/api/update-default-props', {
|
|
183
183
|
compositionId,
|
|
184
184
|
defaultProps: no_react_1.NoReactInternals.serializeJSONWithDate({
|
|
@@ -189,7 +189,7 @@ const updateDefaultProps = (compositionId, defaultProps, enumPaths) => {
|
|
|
189
189
|
enumPaths,
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
|
-
exports.
|
|
192
|
+
exports.callUpdateDefaultPropsApi = callUpdateDefaultPropsApi;
|
|
193
193
|
const canUpdateDefaultProps = (compositionId, readOnlyStudio) => {
|
|
194
194
|
if (readOnlyStudio) {
|
|
195
195
|
return Promise.resolve({
|