@remotion/cli 3.3.81 → 3.3.82
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/cloudrun-command.d.ts +1 -0
- package/dist/cloudrun-command.js +27 -0
- package/dist/config/jpeg-quality.d.ts +2 -0
- package/dist/config/jpeg-quality.js +17 -0
- package/dist/editor/components/CheckerboardContext.d.ts +0 -0
- package/dist/editor/components/CheckerboardContext.js +1 -0
- package/dist/editor/components/CheckerboardProvider.d.ts +4 -0
- package/dist/editor/components/CheckerboardProvider.js +24 -0
- package/dist/editor/components/CollapsedSidebarExpander.js +0 -1
- package/dist/editor/components/MediaVolumeProvider.d.ts +4 -0
- package/dist/editor/components/MediaVolumeProvider.js +25 -0
- package/dist/editor/components/Modals.js +1 -1
- package/dist/editor/components/ModalsProvider.d.ts +4 -0
- package/dist/editor/components/ModalsProvider.js +17 -0
- package/dist/editor/components/PlayerEmitterContext.d.ts +4 -0
- package/dist/editor/components/PlayerEmitterContext.js +11 -0
- package/dist/editor/components/RenderButton.js +1 -1
- package/dist/editor/components/RenderModal/JpegQualitySetting.d.ts +2 -2
- package/dist/editor/components/RenderModal/JpegQualitySetting.js +4 -4
- package/dist/editor/components/RenderModal/RenderModal.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModal.js +7 -7
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModalData.js +15 -1
- package/dist/editor/components/RenderModal/RenderModalPicture.d.ts +2 -2
- package/dist/editor/components/RenderModal/RenderModalPicture.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +1 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +12 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +0 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullEditor.d.ts +15 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullEditor.js +45 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +15 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +45 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.js +45 -0
- package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.js +150 -0
- package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
- package/dist/editor/components/RenderQueue/actions.d.ts +5 -4
- package/dist/editor/components/RenderQueue/actions.js +11 -5
- package/dist/editor/components/RenderToolbarIcon.js +1 -1
- package/dist/editor/components/RightPanel.js +1 -1
- package/dist/editor/components/SetTimelineInOutProvider.d.ts +4 -0
- package/dist/editor/components/SetTimelineInOutProvider.js +19 -0
- package/dist/editor/components/SidebarCollapserControls.d.ts +2 -0
- package/dist/editor/components/SidebarCollapserControls.js +51 -0
- package/dist/editor/components/SidebarContent.d.ts +5 -0
- package/dist/editor/components/SidebarContent.js +53 -0
- package/dist/editor/components/ZoomGesturesProvider.d.ts +4 -0
- package/dist/editor/components/ZoomGesturesProvider.js +24 -0
- package/dist/editor/helpers/render-modal-sections.d.ts +1 -0
- package/dist/preview-server/api-routes.js +2 -0
- package/dist/preview-server/api-types.d.ts +2 -1
- package/dist/preview-server/render-queue/job.d.ts +13 -4
- package/dist/preview-server/render-queue/make-retry-payload.js +2 -2
- package/dist/preview-server/render-queue/process-still.js +1 -1
- package/dist/preview-server/render-queue/process-video.js +1 -1
- package/dist/preview-server/routes/add-render.js +2 -2
- package/dist/preview-server/routes/can-update-default-props.d.ts +0 -0
- package/dist/preview-server/routes/can-update-default-props.js +1 -0
- package/dist/preview-server/routes/update-default-props.js +3 -1
- package/dist/render-flows/render.d.ts +2 -2
- package/dist/render-flows/render.js +3 -3
- package/dist/render-flows/still.d.ts +2 -2
- package/dist/render-flows/still.js +2 -2
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cloudrunCommand: (remotionRoot: string, args: string[]) => Promise<never>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloudrunCommand = void 0;
|
|
4
|
+
const log_1 = require("./log");
|
|
5
|
+
const get_package_manager_1 = require("./preview-server/get-package-manager");
|
|
6
|
+
const update_available_1 = require("./preview-server/update-available");
|
|
7
|
+
const cloudrunCommand = async (remotionRoot, args) => {
|
|
8
|
+
try {
|
|
9
|
+
const path = require.resolve('@remotion/cloudrun', {
|
|
10
|
+
paths: [remotionRoot],
|
|
11
|
+
});
|
|
12
|
+
const { CloudrunInternals } = require(path);
|
|
13
|
+
await CloudrunInternals.executeCommand(args, remotionRoot);
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
const manager = (0, get_package_manager_1.getPackageManager)(remotionRoot, undefined);
|
|
18
|
+
const installCommand = manager === 'unknown' ? 'npm i' : manager.installCommand;
|
|
19
|
+
log_1.Log.error(err);
|
|
20
|
+
log_1.Log.error('Remotion CloudRun is not installed.');
|
|
21
|
+
log_1.Log.info('');
|
|
22
|
+
log_1.Log.info('You can install it using:');
|
|
23
|
+
log_1.Log.info(`${installCommand} @remotion/cloudrun@${(0, update_available_1.getRemotionVersion)()}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.cloudrunCommand = cloudrunCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getJpegQuality = exports.setJpegQuality = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const defaultValue = undefined;
|
|
6
|
+
let quality = defaultValue;
|
|
7
|
+
const setJpegQuality = (q) => {
|
|
8
|
+
renderer_1.RenderInternals.validateJpegQuality(q);
|
|
9
|
+
if (q === 0 || q === undefined) {
|
|
10
|
+
quality = defaultValue;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
quality = q;
|
|
14
|
+
};
|
|
15
|
+
exports.setJpegQuality = setJpegQuality;
|
|
16
|
+
const getJpegQuality = () => quality;
|
|
17
|
+
exports.getJpegQuality = getJpegQuality;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckerboardProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const checkerboard_1 = require("../state/checkerboard");
|
|
7
|
+
const CheckerboardProvider = ({ children }) => {
|
|
8
|
+
const [checkerboard, setCheckerboardState] = (0, react_1.useState)(() => (0, checkerboard_1.loadCheckerboardOption)());
|
|
9
|
+
const setCheckerboard = (0, react_1.useCallback)((newValue) => {
|
|
10
|
+
setCheckerboardState((prevState) => {
|
|
11
|
+
const newVal = newValue(prevState);
|
|
12
|
+
(0, checkerboard_1.persistCheckerboardOption)(newVal);
|
|
13
|
+
return newVal;
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
const checkerboardCtx = (0, react_1.useMemo)(() => {
|
|
17
|
+
return {
|
|
18
|
+
checkerboard,
|
|
19
|
+
setCheckerboard,
|
|
20
|
+
};
|
|
21
|
+
}, [checkerboard, setCheckerboard]);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(checkerboard_1.CheckerboardContext.Provider, { value: checkerboardCtx, children: children }));
|
|
23
|
+
};
|
|
24
|
+
exports.CheckerboardProvider = CheckerboardProvider;
|
|
@@ -6,7 +6,6 @@ const react_1 = require("react");
|
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
7
7
|
const caret_1 = require("../icons/caret");
|
|
8
8
|
const z_index_1 = require("../state/z-index");
|
|
9
|
-
// TODO: Add shortcut to toggle both sidebars (similar to zen mode in vs code)
|
|
10
9
|
const CollapsedSidebarExpander = ({ onExpand, direction }) => {
|
|
11
10
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
12
11
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaVolumeProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const mute_1 = require("../state/mute");
|
|
8
|
+
const MediaVolumeProvider = ({ children }) => {
|
|
9
|
+
const [mediaMuted, setMediaMuted] = (0, react_1.useState)(() => (0, mute_1.loadMuteOption)());
|
|
10
|
+
const [mediaVolume, setMediaVolume] = (0, react_1.useState)(1);
|
|
11
|
+
const mediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
12
|
+
return {
|
|
13
|
+
mediaMuted,
|
|
14
|
+
mediaVolume,
|
|
15
|
+
};
|
|
16
|
+
}, [mediaMuted, mediaVolume]);
|
|
17
|
+
const setMediaVolumeContextValue = (0, react_1.useMemo)(() => {
|
|
18
|
+
return {
|
|
19
|
+
setMediaMuted,
|
|
20
|
+
setMediaVolume,
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: children }) }));
|
|
24
|
+
};
|
|
25
|
+
exports.MediaVolumeProvider = MediaVolumeProvider;
|
|
@@ -16,7 +16,7 @@ const UpdateModal_1 = require("./UpdateModal/UpdateModal");
|
|
|
16
16
|
const Modals = () => {
|
|
17
17
|
const { selectedModal: modalContextType } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
18
18
|
const canRender = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx).type === 'connected';
|
|
19
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [modalContextType && modalContextType.type === 'new-comp' && ((0, jsx_runtime_1.jsx)(NewComposition_1.default, { initialCompType: modalContextType.compType })), modalContextType && canRender && modalContextType.type === 'render' && ((0, jsx_runtime_1.jsx)(RenderModal_1.RenderModal, { initialFrame: modalContextType.initialFrame, compositionId: modalContextType.compositionId, initialVideoImageFormat: modalContextType.initialVideoImageFormat,
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [modalContextType && modalContextType.type === 'new-comp' && ((0, jsx_runtime_1.jsx)(NewComposition_1.default, { initialCompType: modalContextType.compType })), modalContextType && canRender && modalContextType.type === 'render' && ((0, jsx_runtime_1.jsx)(RenderModal_1.RenderModal, { initialFrame: modalContextType.initialFrame, compositionId: modalContextType.compositionId, initialVideoImageFormat: modalContextType.initialVideoImageFormat, initialJpegQuality: modalContextType.initialJpegQuality, initialOutName: modalContextType.initialOutName, initialScale: modalContextType.initialScale, initialVerbose: modalContextType.initialVerbose, initialRenderType: modalContextType.initialRenderType, initialVideoCodecForAudioTab: modalContextType.initialVideoCodecForAudioTab, initialVideoCodecForVideoTab: modalContextType.initialVideoCodecForVideoTab, initialConcurrency: modalContextType.initialConcurrency, maxConcurrency: modalContextType.maxConcurrency, minConcurrency: modalContextType.minConcurrency, initialStillImageFormat: modalContextType.initialStillImageFormat, initialMuted: modalContextType.initialMuted, initialEnforceAudioTrack: modalContextType.initialEnforceAudioTrack, initialProResProfile: modalContextType.initialProResProfile, initialPixelFormat: modalContextType.initialPixelFormat, initialAudioBitrate: modalContextType.initialAudioBitrate, initialVideoBitrate: modalContextType.initialVideoBitrate, initialEveryNthFrame: modalContextType.initialEveryNthFrame, initialNumberOfGifLoops: modalContextType.initialNumberOfGifLoops, initialDelayRenderTimeout: modalContextType.initialDelayRenderTimeout, initialAudioCodec: modalContextType.initialAudioCodec, initialEnvVariables: modalContextType.initialEnvVariables, initialDisableWebSecurity: modalContextType.initialDisableWebSecurity, initialGl: modalContextType.initialOpenGlRenderer, initialHeadless: modalContextType.initialHeadless, initialIgnoreCertificateErrors: modalContextType.initialIgnoreCertificateErrors })), modalContextType &&
|
|
20
20
|
canRender &&
|
|
21
21
|
modalContextType.type === 'render-progress' && ((0, jsx_runtime_1.jsx)(RenderStatusModal_1.RenderStatusModal, { jobId: modalContextType.jobId })), modalContextType && modalContextType.type === 'update' && ((0, jsx_runtime_1.jsx)(UpdateModal_1.UpdateModal, { info: modalContextType.info })), modalContextType && modalContextType.type === 'quick-switcher' && ((0, jsx_runtime_1.jsx)(QuickSwitcher_1.default, { invocationTimestamp: modalContextType.invocationTimestamp, initialMode: modalContextType.mode }))] }));
|
|
22
22
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModalsProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const modals_1 = require("../state/modals");
|
|
7
|
+
const ModalsProvider = ({ children }) => {
|
|
8
|
+
const [modalContextType, setModalContextType] = (0, react_1.useState)(null);
|
|
9
|
+
const modalsContext = (0, react_1.useMemo)(() => {
|
|
10
|
+
return {
|
|
11
|
+
selectedModal: modalContextType,
|
|
12
|
+
setSelectedModal: setModalContextType,
|
|
13
|
+
};
|
|
14
|
+
}, [modalContextType]);
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(modals_1.ModalsContext.Provider, { value: modalsContext, children: children }));
|
|
16
|
+
};
|
|
17
|
+
exports.ModalsProvider = ModalsProvider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlayerEmitterContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const player_1 = require("@remotion/player");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const PlayerEmitterContext = ({ children }) => {
|
|
8
|
+
const [emitter] = (0, react_1.useState)(() => new player_1.PlayerInternals.PlayerEmitter());
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(player_1.PlayerInternals.PlayerEventEmitterContext.Provider, { value: emitter, children: children }));
|
|
10
|
+
};
|
|
11
|
+
exports.PlayerEmitterContext = PlayerEmitterContext;
|
|
@@ -34,7 +34,7 @@ const RenderButton = ({ composition, visible }) => {
|
|
|
34
34
|
initialFrame: 0,
|
|
35
35
|
initialVideoImageFormat: defaults.videoImageFormat,
|
|
36
36
|
initialStillImageFormat: defaults.stillImageFormat,
|
|
37
|
-
|
|
37
|
+
initialJpegQuality: defaults.jpegQuality,
|
|
38
38
|
initialScale: defaults.scale,
|
|
39
39
|
initialVerbose: defaults.logLevel === 'verbose',
|
|
40
40
|
initialOutName: (0, get_default_out_name_1.getDefaultOutLocation)({
|
|
@@ -4,9 +4,9 @@ exports.JpegQualitySetting = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const client_1 = require("@remotion/renderer/client");
|
|
6
6
|
const NumberSetting_1 = require("./NumberSetting");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const JpegQualitySetting = ({
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting, { min:
|
|
7
|
+
const MIN_JPEG_QUALITY = 1;
|
|
8
|
+
const MAX_JPEG_QUALITY = 100;
|
|
9
|
+
const JpegQualitySetting = ({ jpegQuality, setJpegQuality }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting, { min: MIN_JPEG_QUALITY, max: MAX_JPEG_QUALITY, step: 1, name: "JPEG Quality", onValueChanged: setJpegQuality, value: jpegQuality, hint: client_1.BrowserSafeApis.options.jpegQualityOption }));
|
|
11
11
|
};
|
|
12
12
|
exports.JpegQualitySetting = JpegQualitySetting;
|
|
@@ -6,7 +6,7 @@ export declare const RenderModal: React.FC<{
|
|
|
6
6
|
initialFrame: number;
|
|
7
7
|
initialVideoImageFormat: VideoImageFormat;
|
|
8
8
|
initialStillImageFormat: StillImageFormat;
|
|
9
|
-
|
|
9
|
+
initialJpegQuality: number;
|
|
10
10
|
initialScale: number;
|
|
11
11
|
initialVerbose: boolean;
|
|
12
12
|
initialOutName: string;
|
|
@@ -103,7 +103,7 @@ const buttonStyle = {
|
|
|
103
103
|
const flexer = {
|
|
104
104
|
flex: 1,
|
|
105
105
|
};
|
|
106
|
-
const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, initialStillImageFormat,
|
|
106
|
+
const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, initialStillImageFormat, initialJpegQuality, initialScale, initialVerbose, initialOutName, initialRenderType, initialVideoCodecForAudioTab, initialVideoCodecForVideoTab, initialConcurrency, maxConcurrency, minConcurrency, initialMuted, initialEnforceAudioTrack, initialProResProfile, initialPixelFormat, initialVideoBitrate, initialAudioBitrate, initialEveryNthFrame, initialNumberOfGifLoops, initialDelayRenderTimeout, initialAudioCodec, initialEnvVariables, initialDisableWebSecurity, initialGl, initialHeadless, initialIgnoreCertificateErrors, }) => {
|
|
107
107
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
108
108
|
const onQuit = (0, react_1.useCallback)(() => {
|
|
109
109
|
setSelectedModal(null);
|
|
@@ -121,7 +121,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
121
121
|
const [mutedState, setMuted] = (0, react_1.useState)(() => initialMuted);
|
|
122
122
|
const [enforceAudioTrackState, setEnforceAudioTrackState] = (0, react_1.useState)(() => initialEnforceAudioTrack);
|
|
123
123
|
const [renderMode, setRenderModeState] = (0, react_1.useState)(initialRenderType);
|
|
124
|
-
const [
|
|
124
|
+
const [jpegQuality, setJpegQuality] = (0, react_1.useState)(() => initialJpegQuality);
|
|
125
125
|
const [scale, setScale] = (0, react_1.useState)(() => initialScale);
|
|
126
126
|
const [verbose, setVerboseLogging] = (0, react_1.useState)(() => initialVerbose);
|
|
127
127
|
const [disallowParallelEncoding, setDisallowParallelEncoding] = (0, react_1.useState)(false);
|
|
@@ -295,7 +295,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
295
295
|
compositionId,
|
|
296
296
|
outName,
|
|
297
297
|
imageFormat: stillImageFormat,
|
|
298
|
-
|
|
298
|
+
jpegQuality: stillImageFormat === 'jpeg' ? jpegQuality : null,
|
|
299
299
|
frame,
|
|
300
300
|
scale,
|
|
301
301
|
verbose,
|
|
@@ -317,7 +317,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
317
317
|
compositionId,
|
|
318
318
|
outName,
|
|
319
319
|
stillImageFormat,
|
|
320
|
-
|
|
320
|
+
jpegQuality,
|
|
321
321
|
frame,
|
|
322
322
|
scale,
|
|
323
323
|
verbose,
|
|
@@ -345,7 +345,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
345
345
|
compositionId,
|
|
346
346
|
outName,
|
|
347
347
|
imageFormat: videoImageFormat,
|
|
348
|
-
|
|
348
|
+
jpegQuality: stillImageFormat === 'jpeg' ? jpegQuality : null,
|
|
349
349
|
scale,
|
|
350
350
|
verbose,
|
|
351
351
|
codec,
|
|
@@ -382,7 +382,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
382
382
|
outName,
|
|
383
383
|
videoImageFormat,
|
|
384
384
|
stillImageFormat,
|
|
385
|
-
|
|
385
|
+
jpegQuality,
|
|
386
386
|
scale,
|
|
387
387
|
verbose,
|
|
388
388
|
codec,
|
|
@@ -561,6 +561,6 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
561
561
|
backgroundColor: outnameValidation.valid
|
|
562
562
|
? 'var(--blue)'
|
|
563
563
|
: 'var(--blue-disabled)',
|
|
564
|
-
}, 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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: rightPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, currentComposition: currentComposition, 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, setPixelFormat: setPixelFormat, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf,
|
|
564
|
+
}, 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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)(Tabs_1.Tab, { 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: rightPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, currentComposition: currentComposition, 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, setPixelFormat: setPixelFormat, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf, jpegQuality: jpegQuality, qualityControlType: qualityControlType, setJpegQuality: setJpegQuality, setCustomTargetVideoBitrateValue: setCustomTargetVideoBitrateValue, setQualityControl: setQualityControl, shouldDisplayCrfOption: shouldDisplayCrfOption, videoImageFormat: videoImageFormat, stillImageFormat: stillImageFormat })) : 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 })) : 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)(RenderModalData_1.RenderModalData, { inputProps: inputProps, setInputProps: setInputProps, composition: currentComposition, compact: false, mayShowSaveButton: false })) : ((0, jsx_runtime_1.jsx)(RenderModalAdvanced_1.RenderModalAdvanced, { concurrency: concurrency, maxConcurrency: maxConcurrency, minConcurrency: minConcurrency, renderMode: renderMode, setConcurrency: setConcurrency, setVerboseLogging: setVerboseLogging, verbose: verbose, 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 })) })] })] }));
|
|
565
565
|
};
|
|
566
566
|
exports.RenderModal = RenderModal;
|
|
@@ -22,12 +22,26 @@ const controlContainer = {
|
|
|
22
22
|
paddingBottom: 12,
|
|
23
23
|
borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
|
|
24
24
|
};
|
|
25
|
-
const RenderModalData = ({ composition, inputProps, setInputProps, compact,
|
|
25
|
+
const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayShowSaveButton }) => {
|
|
26
26
|
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
27
27
|
const [valBeforeSafe, setValBeforeSafe] = (0, react_1.useState)(inputProps);
|
|
28
28
|
const zodValidationResult = (0, react_1.useMemo)(() => {
|
|
29
29
|
return composition.schema.safeParse(inputProps);
|
|
30
30
|
}, [composition.schema, inputProps]);
|
|
31
|
+
const [canSaveDefaultProps, setCanSaveDefaultProps] = (0, react_1.useState)(false);
|
|
32
|
+
const showSaveButton = mayShowSaveButton && canSaveDefaultProps;
|
|
33
|
+
// TODO: Show reason
|
|
34
|
+
// TODO: Update if root file is updated
|
|
35
|
+
(0, react_1.useEffect)(() => {
|
|
36
|
+
(0, actions_1.canUpdateDefaultProps)(composition.id)
|
|
37
|
+
.then((can) => {
|
|
38
|
+
setCanSaveDefaultProps(can.canUpdate);
|
|
39
|
+
})
|
|
40
|
+
.catch(() => {
|
|
41
|
+
// TODO: Use error as reason
|
|
42
|
+
setCanSaveDefaultProps(false);
|
|
43
|
+
});
|
|
44
|
+
}, [composition.id]);
|
|
31
45
|
const modeItems = (0, react_1.useMemo)(() => {
|
|
32
46
|
return [
|
|
33
47
|
{
|
|
@@ -15,8 +15,8 @@ export declare const RenderModalPicture: React.FC<{
|
|
|
15
15
|
qualityControlType: QualityControl;
|
|
16
16
|
videoImageFormat: VideoImageFormat;
|
|
17
17
|
stillImageFormat: StillImageFormat;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
setJpegQuality: React.Dispatch<React.SetStateAction<number>>;
|
|
19
|
+
jpegQuality: number;
|
|
20
20
|
maxCrf: number;
|
|
21
21
|
minCrf: number;
|
|
22
22
|
setCrf: React.Dispatch<React.SetStateAction<number>>;
|
|
@@ -19,7 +19,7 @@ const qualityControlModes = ['crf', 'bitrate'];
|
|
|
19
19
|
const container = {
|
|
20
20
|
flex: 1,
|
|
21
21
|
};
|
|
22
|
-
const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixelFormat, imageFormatOptions, setQualityControl, qualityControlType, videoImageFormat,
|
|
22
|
+
const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixelFormat, imageFormatOptions, setQualityControl, qualityControlType, videoImageFormat, setJpegQuality, jpegQuality, maxCrf, minCrf, setCrf, shouldDisplayCrfOption, setCustomTargetVideoBitrateValue, crf, customTargetVideoBitrate, stillImageFormat, }) => {
|
|
23
23
|
const pixelFormatOptions = (0, react_1.useMemo)(() => {
|
|
24
24
|
return client_1.BrowserSafeApis.validPixelFormats.map((option) => {
|
|
25
25
|
return {
|
|
@@ -49,7 +49,7 @@ const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixel
|
|
|
49
49
|
const onTargetVideoBitrateChanged = (0, react_1.useCallback)((e) => {
|
|
50
50
|
setCustomTargetVideoBitrateValue(e.target.value);
|
|
51
51
|
}, [setCustomTargetVideoBitrateValue]);
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: false }) })] })) : null, renderMode === 'video' && videoImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, {
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: false }) })] })) : null, renderMode === 'video' && videoImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'still' && stillImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Quality control" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: qualityControlOptions, needsWrapping: true }) })] })) : null, shouldDisplayCrfOption &&
|
|
53
53
|
qualityControlType === 'crf' &&
|
|
54
54
|
renderMode !== 'still' ? ((0, jsx_runtime_1.jsx)(CrfSetting_1.CrfSetting, { crf: crf, min: minCrf, max: maxCrf, setCrf: setCrf, option: client_1.BrowserSafeApis.options.crfOption })) : null, qualityControlType === 'bitrate' && renderMode !== 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Target video bitrate" }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: client_1.BrowserSafeApis.options.videoBitrate }) }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { style: layout_1.input, value: customTargetVideoBitrate, onChange: onTargetVideoBitrateChanged, status: "ok" }) }) })] })) : null, renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, (0, jsx_runtime_1.jsx)(ScaleSetting_1.ScaleSetting, { scale: scale, setScale: setScale }), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Pixel format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: pixelFormatOptions, selectedId: pixelFormat, title: "Pixel Format" }) })] })) : null] }));
|
|
55
55
|
};
|
|
@@ -58,6 +58,8 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, d
|
|
|
58
58
|
}
|
|
59
59
|
const defaultPropsValid = schema.safeParse(defaultProps);
|
|
60
60
|
if (!defaultPropsValid.success) {
|
|
61
|
+
// TODO: Layout is not nice
|
|
62
|
+
// TODO: Does not react to when schema is updated
|
|
61
63
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: '<Composition>' }), " is not valid:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by changing the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " prop in your composition so it does not give a type error."] })] }));
|
|
62
64
|
}
|
|
63
65
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the ", (0, jsx_runtime_1.jsx)("code", { children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
|
|
@@ -13,7 +13,6 @@ const commonStyles = {
|
|
|
13
13
|
fontSize: 15,
|
|
14
14
|
color: colors_1.LIGHT_TEXT,
|
|
15
15
|
fontFamily: 'sans-serif',
|
|
16
|
-
lineHeight: '40px',
|
|
17
16
|
};
|
|
18
17
|
const compactStyles = {
|
|
19
18
|
...commonStyles,
|
|
@@ -24,12 +23,12 @@ const compactStyles = {
|
|
|
24
23
|
const wideStyles = {
|
|
25
24
|
...commonStyles,
|
|
26
25
|
width: layout_2.label.width,
|
|
27
|
-
lineHeight: '36px',
|
|
28
26
|
};
|
|
29
27
|
const labelStyle = {
|
|
30
28
|
fontFamily: 'monospace',
|
|
31
29
|
fontSize: 14,
|
|
32
30
|
color: colors_1.LIGHT_TEXT,
|
|
31
|
+
lineHeight: '40px',
|
|
33
32
|
};
|
|
34
33
|
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, }) => {
|
|
35
34
|
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? compactStyles : wideStyles, children: [(0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: (0, get_schema_label_1.getSchemaLabel)(jsonPath) }), compact ? (0, jsx_runtime_1.jsx)(layout_1.Flex, {}) : (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), 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 })) : null, onRemove ? (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
|
|
@@ -4,10 +4,12 @@ exports.ZodArrayEditor = void 0;
|
|
|
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 Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
7
8
|
const colors_1 = require("../../../helpers/colors");
|
|
8
9
|
const layout_1 = require("../../layout");
|
|
9
10
|
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
10
11
|
const layout_2 = require("../layout");
|
|
12
|
+
const create_zod_values_1 = require("./create-zod-values");
|
|
11
13
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
12
14
|
const ZodArrayItemEditor_1 = require("./ZodArrayItemEditor");
|
|
13
15
|
const container = {
|
|
@@ -16,8 +18,7 @@ const container = {
|
|
|
16
18
|
const fullWidth = {
|
|
17
19
|
width: '100%',
|
|
18
20
|
};
|
|
19
|
-
// TODO: Ability to
|
|
20
|
-
// TODO: Ability to revert a chagne (e.g entry deletion )
|
|
21
|
+
// TODO: Ability to revert a change (e.g entry deletion )
|
|
21
22
|
const ZodArrayEditor = ({ schema, jsonPath, compact, setValue: updateValue, defaultValue, value, onSave, showSaveButton, onRemove, }) => {
|
|
22
23
|
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
23
24
|
return {
|
|
@@ -46,6 +47,7 @@ const ZodArrayEditor = ({ schema, jsonPath, compact, setValue: updateValue, defa
|
|
|
46
47
|
setLocalValue((oldLocalState) => {
|
|
47
48
|
const newValue = updater(oldLocalState.value);
|
|
48
49
|
const safeParse = schema.safeParse(newValue);
|
|
50
|
+
// TODO: This logs an error to the console
|
|
49
51
|
if (safeParse.success) {
|
|
50
52
|
updateValue(updater);
|
|
51
53
|
}
|
|
@@ -62,10 +64,16 @@ const ZodArrayEditor = ({ schema, jsonPath, compact, setValue: updateValue, defa
|
|
|
62
64
|
}
|
|
63
65
|
return { paddingTop };
|
|
64
66
|
}, [isRoot, paddingTop]);
|
|
67
|
+
const onAdd = (0, react_1.useCallback)(() => {
|
|
68
|
+
onChange((oldV) => {
|
|
69
|
+
return [...oldV, (0, create_zod_values_1.createZodValues)(def.type)];
|
|
70
|
+
}, true);
|
|
71
|
+
}, [def.type, onChange]);
|
|
65
72
|
return ((0, jsx_runtime_1.jsx)("div", { style: style, children: (0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsxs)(Element, { style: fieldset, children: [isRoot ? null : ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaFieldsetLabel, { jsonPath: jsonPath, onRemove: onRemove })), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: localValue.value.map((child, i) => {
|
|
73
|
+
var _a;
|
|
66
74
|
return ((0, jsx_runtime_1.jsx)(ZodArrayItemEditor_1.ZodArrayItemEditor
|
|
67
75
|
// eslint-disable-next-line react/no-array-index-key
|
|
68
|
-
, { onChange: onChange, value: child, def: def, index: i, jsonPath: jsonPath, compact: compact, defaultValue: defaultValue[i], onSave: onSave, showSaveButton: showSaveButton }, `${i}${localValue.revision}`));
|
|
69
|
-
}) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] }) }) }));
|
|
76
|
+
, { onChange: onChange, value: child, def: def, index: i, jsonPath: jsonPath, compact: compact, defaultValue: (_a = defaultValue[i]) !== null && _a !== void 0 ? _a : child, onSave: onSave, showSaveButton: showSaveButton }, `${i}${localValue.revision}`));
|
|
77
|
+
}) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] })), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onAdd, children: "+ Add item" })] }) }) }));
|
|
70
78
|
};
|
|
71
79
|
exports.ZodArrayEditor = ZodArrayEditor;
|
|
@@ -13,7 +13,6 @@ const SchemaLabel_1 = require("./SchemaLabel");
|
|
|
13
13
|
const container = {
|
|
14
14
|
width: '100%',
|
|
15
15
|
};
|
|
16
|
-
// TODO: Long values break the layout
|
|
17
16
|
const ZodEnumEditor = ({ schema, jsonPath, compact, setValue: updateValue, defaultValue, value, onSave, showSaveButton, onRemove, }) => {
|
|
18
17
|
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
19
18
|
return {
|
|
@@ -37,7 +37,10 @@ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, compact, defaultVa
|
|
|
37
37
|
return { paddingTop };
|
|
38
38
|
}, [isRoot, paddingTop]);
|
|
39
39
|
return ((0, jsx_runtime_1.jsx)("div", { style: style, children: (0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsxs)(Element, { style: fieldset, children: [isRoot ? null : ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaFieldsetLabel, { jsonPath: jsonPath, onRemove: onRemove })), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: keys.map((key) => {
|
|
40
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { jsonPath: [...jsonPath, key], schema: shape[key], value: value[key],
|
|
42
|
+
// In case of null | {a: string, b: string} type, we need to fallback to the default value
|
|
43
|
+
defaultValue: ((_a = defaultValue) !== null && _a !== void 0 ? _a : value)[key], setValue: (val) => {
|
|
41
44
|
setValue((oldVal) => {
|
|
42
45
|
return {
|
|
43
46
|
...oldVal,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { z } from 'remotion';
|
|
3
|
+
import type { JSONPath } from './zod-types';
|
|
4
|
+
export declare const ZodOrNullEditor: React.FC<{
|
|
5
|
+
showSaveButton: boolean;
|
|
6
|
+
jsonPath: JSONPath;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
value: unknown;
|
|
9
|
+
defaultValue: unknown;
|
|
10
|
+
schema: z.ZodTypeAny;
|
|
11
|
+
setValue: React.Dispatch<React.SetStateAction<unknown>>;
|
|
12
|
+
onSave: (updater: (oldNum: unknown) => unknown) => void;
|
|
13
|
+
onRemove: null | (() => void);
|
|
14
|
+
nullishValue: null | undefined;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { z } from 'remotion';
|
|
3
|
+
import type { JSONPath } from './zod-types';
|
|
4
|
+
export declare const ZodOrNullishEditor: React.FC<{
|
|
5
|
+
showSaveButton: boolean;
|
|
6
|
+
jsonPath: JSONPath;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
value: unknown;
|
|
9
|
+
defaultValue: unknown;
|
|
10
|
+
schema: z.ZodTypeAny;
|
|
11
|
+
setValue: React.Dispatch<React.SetStateAction<unknown>>;
|
|
12
|
+
onSave: (updater: (oldNum: unknown) => unknown) => void;
|
|
13
|
+
onRemove: null | (() => void);
|
|
14
|
+
nullishValue: null | undefined;
|
|
15
|
+
}>;
|