@remotion/cli 3.3.78 → 3.3.80
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/better-opn/index.d.ts +6 -0
- package/dist/better-opn/index.js +202 -0
- package/dist/codemods/update-default-props.d.ts +5 -0
- package/dist/codemods/update-default-props.js +98 -0
- package/dist/editor/components/Checkbox.js +1 -0
- package/dist/editor/components/CollapsedSidebarExpander.d.ts +5 -0
- package/dist/editor/components/CollapsedSidebarExpander.js +40 -0
- package/dist/editor/components/CurrentCompositionSideEffects.js +11 -2
- package/dist/editor/components/InlineAction.js +1 -1
- package/dist/editor/components/Modals.js +3 -3
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +7 -0
- package/dist/editor/components/NewComposition/RemTextarea.js +90 -0
- package/dist/editor/components/RenderButton.d.ts +2 -2
- package/dist/editor/components/RenderButton.js +5 -0
- package/dist/editor/components/RenderModal/CliCopyButton.d.ts +4 -0
- package/dist/editor/components/RenderModal/CliCopyButton.js +22 -0
- package/dist/editor/components/RenderModal/CrfSetting.d.ts +2 -1
- package/dist/editor/components/RenderModal/CrfSetting.js +2 -2
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.d.ts +2 -0
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +4 -2
- package/dist/editor/components/RenderModal/EnvInput.d.ts +10 -0
- package/dist/editor/components/RenderModal/EnvInput.js +54 -0
- package/dist/editor/components/RenderModal/FrameRangeSetting.js +1 -1
- package/dist/editor/components/RenderModal/{RenderErrorModal.d.ts → GuiRenderStatus.d.ts} +1 -1
- package/dist/editor/components/RenderModal/GuiRenderStatus.js +78 -0
- package/dist/editor/components/RenderModal/InfoBubble.js +16 -12
- package/dist/editor/components/RenderModal/InfoTooltip.d.ts +1 -0
- package/dist/editor/components/RenderModal/InfoTooltip.js +25 -16
- package/dist/editor/components/RenderModal/InlineEyeIcon.d.ts +5 -0
- package/dist/editor/components/RenderModal/InlineEyeIcon.js +38 -0
- package/dist/editor/components/RenderModal/InlineRemoveButton.d.ts +4 -0
- package/dist/editor/components/RenderModal/InlineRemoveButton.js +14 -0
- package/dist/editor/components/RenderModal/JpegQualitySetting.d.ts +5 -0
- package/dist/editor/components/RenderModal/JpegQualitySetting.js +12 -0
- package/dist/editor/components/RenderModal/MutedSetting.d.ts +2 -0
- package/dist/editor/components/RenderModal/MutedSetting.js +4 -2
- package/dist/editor/components/RenderModal/NumberOfLoopsSetting.js +1 -1
- package/dist/editor/components/RenderModal/NumberSetting.js +1 -1
- package/dist/editor/components/RenderModal/OptionExplainer.d.ts +1 -1
- package/dist/editor/components/RenderModal/OptionExplainer.js +26 -2
- package/dist/editor/components/RenderModal/RenderModal.d.ts +6 -1
- package/dist/editor/components/RenderModal/RenderModal.js +52 -9
- package/dist/editor/components/RenderModal/RenderModalAdvanced.d.ts +11 -0
- package/dist/editor/components/RenderModal/RenderModalAdvanced.js +34 -2
- package/dist/editor/components/RenderModal/RenderModalAudio.js +3 -1
- package/dist/editor/components/RenderModal/RenderModalBasic.d.ts +3 -2
- package/dist/editor/components/RenderModal/RenderModalBasic.js +5 -7
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +10 -0
- package/dist/editor/components/RenderModal/RenderModalData.js +55 -0
- package/dist/editor/components/RenderModal/RenderModalEnvironmentVariables.d.ts +5 -0
- package/dist/editor/components/RenderModal/RenderModalEnvironmentVariables.js +52 -0
- package/dist/editor/components/RenderModal/RenderModalInput.d.ts +10 -0
- package/dist/editor/components/RenderModal/RenderModalInput.js +13 -0
- package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.d.ts +8 -0
- package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.js +87 -0
- package/dist/editor/components/RenderModal/RenderModalPicture.js +6 -4
- package/dist/editor/components/RenderModal/RenderStatusModal.d.ts +4 -0
- package/dist/editor/components/RenderModal/{RenderErrorModal.js → RenderStatusModal.js} +21 -14
- package/dist/editor/components/RenderModal/ScaleSetting.js +6 -3
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +36 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +15 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +43 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaResetButton.d.ts +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaResetButton.js +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.d.ts +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +70 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +13 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +28 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +27 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +75 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +51 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +5 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodErrorMessages.js +23 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.d.ts +8 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +23 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +89 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +57 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +43 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +56 -0
- package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +21 -0
- package/dist/editor/components/RenderModal/SchemaEditor/get-schema-label.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/get-schema-label.js +15 -0
- package/dist/editor/components/RenderModal/SchemaEditor/zod-types.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/zod-types.js +2 -0
- package/dist/editor/components/RenderModal/layout.d.ts +3 -1
- package/dist/editor/components/RenderModal/layout.js +19 -3
- package/dist/editor/components/RenderModal/out-name-checker.d.ts +15 -0
- package/dist/editor/components/RenderModal/out-name-checker.js +79 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.js +3 -3
- package/dist/editor/components/RenderQueue/RenderQueueItemStatus.js +18 -2
- package/dist/editor/components/RenderQueue/RenderQueueOutputName.js +4 -2
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.js +3 -4
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +11 -1
- package/dist/editor/components/RenderQueue/SuccessIcon.d.ts +2 -0
- package/dist/editor/components/RenderQueue/SuccessIcon.js +14 -0
- package/dist/editor/components/RenderQueue/actions.d.ts +11 -2
- package/dist/editor/components/RenderQueue/actions.js +18 -3
- package/dist/editor/components/RenderToolbarIcon.js +5 -0
- package/dist/editor/components/RightPanel.d.ts +2 -0
- package/dist/editor/components/RightPanel.js +43 -0
- package/dist/editor/components/SidebarContent.js +1 -0
- package/dist/editor/helpers/convert-env-variables.d.ts +2 -0
- package/dist/editor/helpers/convert-env-variables.js +20 -0
- package/dist/editor/helpers/get-timeline-sequence-layout.js +1 -1
- package/dist/editor/helpers/render-modal-sections.d.ts +1 -1
- package/dist/editor/helpers/render-modal-sections.js +4 -4
- package/dist/editor/icons/data.d.ts +2 -0
- package/dist/editor/icons/data.js +8 -0
- package/dist/editor/icons/save.d.ts +2 -0
- package/dist/editor/icons/save.js +8 -0
- package/dist/handle-common-errors.js +16 -0
- package/dist/parse-command-line.d.ts +2 -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 +25 -12
- package/dist/preview-server/render-queue/make-retry-payload.js +11 -1
- package/dist/preview-server/render-queue/open-directory-in-finder.d.ts +1 -1
- package/dist/preview-server/render-queue/open-directory-in-finder.js +10 -1
- package/dist/preview-server/render-queue/process-still.js +4 -10
- package/dist/preview-server/render-queue/process-video.js +4 -10
- package/dist/preview-server/render-queue/queue.js +38 -16
- package/dist/preview-server/routes/add-render.js +7 -0
- package/dist/preview-server/routes/open-in-file-explorer.js +1 -7
- package/dist/preview-server/routes/update-default-props.d.ts +3 -0
- package/dist/preview-server/routes/update-default-props.js +22 -0
- package/dist/preview.js +8 -3
- package/dist/progress-types.d.ts +32 -0
- package/dist/progress-types.js +17 -0
- package/dist/render-flows/render.js +66 -52
- package/dist/render-flows/still.js +18 -18
- package/dist/required-chromium-options.d.ts +3 -0
- package/dist/required-chromium-options.js +2 -0
- package/package.json +7 -7
- package/dist/editor/components/RenderModal/QualitySetting.d.ts +0 -5
- package/dist/editor/components/RenderModal/QualitySetting.js +0 -27
- package/dist/gcp-command.d.ts +0 -1
- package/dist/gcp-command.js +0 -27
|
@@ -6,8 +6,10 @@ const client_1 = require("@remotion/renderer/client");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
9
|
+
const convert_env_variables_1 = require("../../helpers/convert-env-variables");
|
|
9
10
|
const render_modal_sections_1 = require("../../helpers/render-modal-sections");
|
|
10
11
|
const audio_1 = require("../../icons/audio");
|
|
12
|
+
const data_1 = require("../../icons/data");
|
|
11
13
|
const file_1 = require("../../icons/file");
|
|
12
14
|
const frame_1 = require("../../icons/frame");
|
|
13
15
|
const gear_1 = require("../../icons/gear");
|
|
@@ -21,9 +23,11 @@ const SegmentedControl_1 = require("../SegmentedControl");
|
|
|
21
23
|
const SidebarContent_1 = require("../SidebarContent");
|
|
22
24
|
const Tabs_1 = require("../Tabs");
|
|
23
25
|
const CrfSetting_1 = require("./CrfSetting");
|
|
26
|
+
const out_name_checker_1 = require("./out-name-checker");
|
|
24
27
|
const RenderModalAdvanced_1 = require("./RenderModalAdvanced");
|
|
25
28
|
const RenderModalAudio_1 = require("./RenderModalAudio");
|
|
26
29
|
const RenderModalBasic_1 = require("./RenderModalBasic");
|
|
30
|
+
const RenderModalData_1 = require("./RenderModalData");
|
|
27
31
|
const RenderModalGif_1 = require("./RenderModalGif");
|
|
28
32
|
const RenderModalPicture_1 = require("./RenderModalPicture");
|
|
29
33
|
const initialState = { type: 'idle' };
|
|
@@ -54,8 +58,7 @@ const container = {
|
|
|
54
58
|
borderBottom: '1px solid black',
|
|
55
59
|
};
|
|
56
60
|
const scrollPanel = {
|
|
57
|
-
|
|
58
|
-
maxHeight: '50vh',
|
|
61
|
+
height: 600,
|
|
59
62
|
overflow: 'auto',
|
|
60
63
|
minWidth: 650,
|
|
61
64
|
};
|
|
@@ -97,7 +100,7 @@ const buttonStyle = {
|
|
|
97
100
|
const flexer = {
|
|
98
101
|
flex: 1,
|
|
99
102
|
};
|
|
100
|
-
const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, initialStillImageFormat, initialQuality, initialScale, initialVerbose, initialOutName, initialRenderType, initialVideoCodecForAudioTab, initialVideoCodecForVideoTab, initialConcurrency, maxConcurrency, minConcurrency, initialMuted, initialEnforceAudioTrack, initialProResProfile, initialPixelFormat, initialVideoBitrate, initialAudioBitrate, initialEveryNthFrame, initialNumberOfGifLoops, initialDelayRenderTimeout, initialAudioCodec, }) => {
|
|
103
|
+
const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, initialStillImageFormat, initialQuality, initialScale, initialVerbose, initialOutName, initialRenderType, initialVideoCodecForAudioTab, initialVideoCodecForVideoTab, initialConcurrency, maxConcurrency, minConcurrency, initialMuted, initialEnforceAudioTrack, initialProResProfile, initialPixelFormat, initialVideoBitrate, initialAudioBitrate, initialEveryNthFrame, initialNumberOfGifLoops, initialDelayRenderTimeout, initialAudioCodec, initialEnvVariables, initialDisableWebSecurity, initialGl, initialHeadless, initialIgnoreCertificateErrors, }) => {
|
|
101
104
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
102
105
|
const onQuit = (0, react_1.useCallback)(() => {
|
|
103
106
|
setSelectedModal(null);
|
|
@@ -110,6 +113,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
110
113
|
const [concurrency, setConcurrency] = (0, react_1.useState)(() => initialConcurrency);
|
|
111
114
|
const [videoCodecForVideoTab, setVideoCodecForVideoTab] = (0, react_1.useState)(() => initialVideoCodecForVideoTab);
|
|
112
115
|
const [userSelectedAudioCodec, setUserSelectedAudioCodec] = (0, react_1.useState)(() => initialAudioCodec);
|
|
116
|
+
const [envVariables, setEnvVariables] = (0, react_1.useState)(() => (0, convert_env_variables_1.envVariablesObjectToArray)(initialEnvVariables).filter(([key]) => key !== 'NODE_ENV'));
|
|
113
117
|
const [videoCodecForAudioTab, setVideoCodecForAudioTab] = (0, react_1.useState)(() => initialVideoCodecForAudioTab);
|
|
114
118
|
const [mutedState, setMuted] = (0, react_1.useState)(() => initialMuted);
|
|
115
119
|
const [enforceAudioTrackState, setEnforceAudioTrackState] = (0, react_1.useState)(() => initialEnforceAudioTrack);
|
|
@@ -118,6 +122,18 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
118
122
|
const [scale, setScale] = (0, react_1.useState)(() => initialScale);
|
|
119
123
|
const [verbose, setVerboseLogging] = (0, react_1.useState)(() => initialVerbose);
|
|
120
124
|
const [disallowParallelEncoding, setDisallowParallelEncoding] = (0, react_1.useState)(false);
|
|
125
|
+
const [disableWebSecurity, setDisableWebSecurity] = (0, react_1.useState)(() => initialDisableWebSecurity);
|
|
126
|
+
const [headless, setHeadless] = (0, react_1.useState)(() => initialHeadless);
|
|
127
|
+
const [ignoreCertificateErrors, setIgnoreCertificateErrors] = (0, react_1.useState)(() => initialIgnoreCertificateErrors);
|
|
128
|
+
const [openGlOption, setOpenGlOption] = (0, react_1.useState)(() => initialGl !== null && initialGl !== void 0 ? initialGl : 'default');
|
|
129
|
+
const chromiumOptions = (0, react_1.useMemo)(() => {
|
|
130
|
+
return {
|
|
131
|
+
headless,
|
|
132
|
+
disableWebSecurity,
|
|
133
|
+
ignoreCertificateErrors,
|
|
134
|
+
gl: openGlOption === 'default' ? null : openGlOption,
|
|
135
|
+
};
|
|
136
|
+
}, [headless, disableWebSecurity, ignoreCertificateErrors, openGlOption]);
|
|
121
137
|
const [outName, setOutName] = (0, react_1.useState)(() => initialOutName);
|
|
122
138
|
const [endFrameOrNull, setEndFrame] = (0, react_1.useState)(() => null);
|
|
123
139
|
const [startFrameOrNull, setStartFrame] = (0, react_1.useState)(() => null);
|
|
@@ -125,7 +141,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
125
141
|
const [pixelFormat, setPixelFormat] = (0, react_1.useState)(() => initialPixelFormat);
|
|
126
142
|
const [qualityControlType, setQualityControl] = (0, react_1.useState)(() => initialVideoBitrate === null ? 'crf' : 'bitrate');
|
|
127
143
|
const [shouldHaveCustomTargetAudioBitrate, setShouldHaveCustomTargetAudioBitrate,] = (0, react_1.useState)(() => initialAudioBitrate !== null);
|
|
128
|
-
const [customTargetAudioBitrate, setCustomTargetAudioBitrateValue] = (0, react_1.useState)(() => initialAudioBitrate !== null && initialAudioBitrate !== void 0 ? initialAudioBitrate : '
|
|
144
|
+
const [customTargetAudioBitrate, setCustomTargetAudioBitrateValue] = (0, react_1.useState)(() => initialAudioBitrate !== null && initialAudioBitrate !== void 0 ? initialAudioBitrate : '320K');
|
|
129
145
|
const [customTargetVideoBitrate, setCustomTargetVideoBitrateValue] = (0, react_1.useState)(() => initialVideoBitrate !== null && initialVideoBitrate !== void 0 ? initialVideoBitrate : '1M');
|
|
130
146
|
const [limitNumberOfGifLoops, setLimitNumberOfGifLoops] = (0, react_1.useState)(() => initialNumberOfGifLoops !== null);
|
|
131
147
|
const [numberOfGifLoopsSetting, setNumberOfGifLoopsSetting] = (0, react_1.useState)(() => initialNumberOfGifLoops !== null && initialNumberOfGifLoops !== void 0 ? initialNumberOfGifLoops : 1);
|
|
@@ -190,6 +206,7 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
190
206
|
if (currentComposition === null) {
|
|
191
207
|
throw new Error('This composition does not exist');
|
|
192
208
|
}
|
|
209
|
+
const [inputProps, setInputProps] = (0, react_1.useState)(() => currentComposition.defaultProps);
|
|
193
210
|
const endFrame = (0, react_1.useMemo)(() => {
|
|
194
211
|
if (endFrameOrNull === null) {
|
|
195
212
|
return currentComposition.durationInFrames - 1;
|
|
@@ -276,6 +293,10 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
276
293
|
frame,
|
|
277
294
|
scale,
|
|
278
295
|
verbose,
|
|
296
|
+
chromiumOptions,
|
|
297
|
+
delayRenderTimeout,
|
|
298
|
+
envVariables: (0, convert_env_variables_1.envVariablesArrayToObject)(envVariables),
|
|
299
|
+
inputProps,
|
|
279
300
|
})
|
|
280
301
|
.then(() => {
|
|
281
302
|
dispatchIfMounted({ type: 'succeed' });
|
|
@@ -285,15 +306,19 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
285
306
|
dispatchIfMounted({ type: 'fail' });
|
|
286
307
|
});
|
|
287
308
|
}, [
|
|
288
|
-
compositionId,
|
|
289
309
|
dispatchIfMounted,
|
|
290
|
-
|
|
291
|
-
stillImageFormat,
|
|
310
|
+
compositionId,
|
|
292
311
|
outName,
|
|
312
|
+
stillImageFormat,
|
|
293
313
|
quality,
|
|
314
|
+
frame,
|
|
294
315
|
scale,
|
|
295
|
-
setSelectedModal,
|
|
296
316
|
verbose,
|
|
317
|
+
chromiumOptions,
|
|
318
|
+
delayRenderTimeout,
|
|
319
|
+
envVariables,
|
|
320
|
+
inputProps,
|
|
321
|
+
setSelectedModal,
|
|
297
322
|
]);
|
|
298
323
|
const [everyNthFrameSetting, setEveryNthFrameSetting] = (0, react_1.useState)(() => initialEveryNthFrame);
|
|
299
324
|
const everyNthFrame = (0, react_1.useMemo)(() => {
|
|
@@ -330,6 +355,9 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
330
355
|
delayRenderTimeout,
|
|
331
356
|
audioCodec,
|
|
332
357
|
disallowParallelEncoding,
|
|
358
|
+
chromiumOptions,
|
|
359
|
+
envVariables: (0, convert_env_variables_1.envVariablesArrayToObject)(envVariables),
|
|
360
|
+
inputProps,
|
|
333
361
|
})
|
|
334
362
|
.then(() => {
|
|
335
363
|
dispatchIfMounted({ type: 'succeed' });
|
|
@@ -364,6 +392,9 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
364
392
|
delayRenderTimeout,
|
|
365
393
|
audioCodec,
|
|
366
394
|
disallowParallelEncoding,
|
|
395
|
+
chromiumOptions,
|
|
396
|
+
envVariables,
|
|
397
|
+
inputProps,
|
|
367
398
|
setSelectedModal,
|
|
368
399
|
]);
|
|
369
400
|
(0, react_1.useEffect)(() => {
|
|
@@ -482,7 +513,19 @@ const RenderModal = ({ compositionId, initialFrame, initialVideoImageFormat, ini
|
|
|
482
513
|
},
|
|
483
514
|
];
|
|
484
515
|
}, [currentComposition === null || currentComposition === void 0 ? void 0 : currentComposition.durationInFrames, renderMode, setRenderMode]);
|
|
516
|
+
const outnameValidation = (0, out_name_checker_1.validateOutnameGui)({
|
|
517
|
+
outName,
|
|
518
|
+
codec,
|
|
519
|
+
audioCodec,
|
|
520
|
+
renderMode,
|
|
521
|
+
stillImageFormat,
|
|
522
|
+
});
|
|
485
523
|
const { tab, setTab, shownTabs } = (0, render_modal_sections_1.useRenderModalSections)(renderMode, codec);
|
|
486
|
-
return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (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.jsx)(Button_1.Button, { autoFocus: true, onClick: renderMode === 'still' ? onClickStill : onClickVideo, disabled: state.type === 'load'
|
|
524
|
+
return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (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.jsx)(Button_1.Button, { autoFocus: true, onClick: renderMode === 'still' ? onClickStill : onClickVideo, disabled: state.type === 'load' || !outnameValidation.valid, style: {
|
|
525
|
+
...buttonStyle,
|
|
526
|
+
backgroundColor: outnameValidation.valid
|
|
527
|
+
? 'var(--blue)'
|
|
528
|
+
: 'var(--blue-disabled)',
|
|
529
|
+
}, children: state.type === 'idle' ? `Render ${renderMode}` : 'Rendering...' })] }), (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.jsxs)("div", { style: scrollPanel, className: "__remotion-vertical-scrollbar", children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), 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, quality: quality, qualityControlType: qualityControlType, setQuality: setQuality, 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, updateButton: false, showSaveButton: 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 })), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 })] })] })] }));
|
|
487
530
|
};
|
|
488
531
|
exports.RenderModal = RenderModal;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { UiOpenGlOptions } from '../../../required-chromium-options';
|
|
2
3
|
export declare type RenderType = 'still' | 'video' | 'audio';
|
|
3
4
|
export declare const RenderModalAdvanced: React.FC<{
|
|
4
5
|
renderMode: RenderType;
|
|
@@ -12,4 +13,14 @@ export declare const RenderModalAdvanced: React.FC<{
|
|
|
12
13
|
setDelayRenderTimeout: React.Dispatch<React.SetStateAction<number>>;
|
|
13
14
|
disallowParallelEncoding: boolean;
|
|
14
15
|
setDisallowParallelEncoding: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
|
+
setDisableWebSecurity: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
|
+
setIgnoreCertificateErrors: React.Dispatch<React.SetStateAction<boolean>>;
|
|
18
|
+
setHeadless: React.Dispatch<React.SetStateAction<boolean>>;
|
|
19
|
+
headless: boolean;
|
|
20
|
+
ignoreCertificateErrors: boolean;
|
|
21
|
+
disableWebSecurity: boolean;
|
|
22
|
+
openGlOption: UiOpenGlOptions;
|
|
23
|
+
setOpenGlOption: React.Dispatch<React.SetStateAction<UiOpenGlOptions>>;
|
|
24
|
+
envVariables: [string, string][];
|
|
25
|
+
setEnvVariables: React.Dispatch<React.SetStateAction<[string, string][]>>;
|
|
15
26
|
}>;
|
|
@@ -3,20 +3,52 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RenderModalAdvanced = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const Checkmark_1 = require("../../icons/Checkmark");
|
|
6
7
|
const Checkbox_1 = require("../Checkbox");
|
|
8
|
+
const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
7
9
|
const layout_1 = require("./layout");
|
|
8
10
|
const NumberSetting_1 = require("./NumberSetting");
|
|
9
|
-
const
|
|
11
|
+
const RenderModalEnvironmentVariables_1 = require("./RenderModalEnvironmentVariables");
|
|
12
|
+
const RenderModalHr_1 = require("./RenderModalHr");
|
|
13
|
+
const RenderModalAdvanced = ({ renderMode, maxConcurrency, minConcurrency, setConcurrency, concurrency, setVerboseLogging, verbose, delayRenderTimeout, setDelayRenderTimeout, disallowParallelEncoding, setDisallowParallelEncoding, setDisableWebSecurity, setIgnoreCertificateErrors, setHeadless, headless, ignoreCertificateErrors, disableWebSecurity, openGlOption, setOpenGlOption, setEnvVariables, envVariables, }) => {
|
|
14
|
+
const extendedOpenGlOptions = (0, react_1.useMemo)(() => {
|
|
15
|
+
return ['angle', 'egl', 'swangle', 'swiftshader', 'default'];
|
|
16
|
+
}, []);
|
|
10
17
|
const onVerboseLoggingChanged = (0, react_1.useCallback)((e) => {
|
|
11
18
|
setVerboseLogging(e.target.checked);
|
|
12
19
|
}, [setVerboseLogging]);
|
|
13
20
|
const onDisallowParallelEncodingChanged = (0, react_1.useCallback)((e) => {
|
|
14
21
|
setDisallowParallelEncoding(e.target.checked);
|
|
15
22
|
}, [setDisallowParallelEncoding]);
|
|
23
|
+
const onDisableWebSecurityChanged = (0, react_1.useCallback)((e) => {
|
|
24
|
+
setDisableWebSecurity(e.target.checked);
|
|
25
|
+
}, [setDisableWebSecurity]);
|
|
26
|
+
const onIgnoreCertificatErrors = (0, react_1.useCallback)((e) => {
|
|
27
|
+
setIgnoreCertificateErrors(e.target.checked);
|
|
28
|
+
}, [setIgnoreCertificateErrors]);
|
|
29
|
+
const onHeadless = (0, react_1.useCallback)((e) => {
|
|
30
|
+
setHeadless(e.target.checked);
|
|
31
|
+
}, [setHeadless]);
|
|
32
|
+
const openGlOptions = (0, react_1.useMemo)(() => {
|
|
33
|
+
return extendedOpenGlOptions.map((option) => {
|
|
34
|
+
return {
|
|
35
|
+
label: option === 'default' ? 'Default' : option,
|
|
36
|
+
onClick: () => setOpenGlOption(option),
|
|
37
|
+
key: option,
|
|
38
|
+
leftItem: openGlOption === option ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
39
|
+
id: option,
|
|
40
|
+
keyHint: null,
|
|
41
|
+
quickSwitcherLabel: null,
|
|
42
|
+
subMenu: null,
|
|
43
|
+
type: 'item',
|
|
44
|
+
value: option,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}, [extendedOpenGlOptions, openGlOption, setOpenGlOption]);
|
|
16
48
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [renderMode === 'still' ? null : ((0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting, { min: minConcurrency, max: maxConcurrency, step: 1, name: "Concurrency", formatter: (w) => `${w}x`, onValueChanged: setConcurrency, value: concurrency })), (0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting
|
|
17
49
|
// Also appears in packages/renderer/src/validate-puppeteer-timeout.ts
|
|
18
50
|
, {
|
|
19
51
|
// Also appears in packages/renderer/src/validate-puppeteer-timeout.ts
|
|
20
|
-
min: 7000, max: 900000, name: "delayRender() timeout", onValueChanged: setDelayRenderTimeout, formatter: (w) => `${w}ms`, step: 1000, value: delayRenderTimeout }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "No parallel encoding" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disallowParallelEncoding, onChange: onDisallowParallelEncodingChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: verbose, onChange: onVerboseLoggingChanged }) })] })] }));
|
|
52
|
+
min: 7000, max: 900000, name: "delayRender() timeout", onValueChanged: setDelayRenderTimeout, formatter: (w) => `${w}ms`, step: 1000, value: delayRenderTimeout }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "No parallel encoding" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disallowParallelEncoding, onChange: onDisallowParallelEncodingChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: verbose, onChange: onVerboseLoggingChanged }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Disable web security" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disableWebSecurity, onChange: onDisableWebSecurityChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Ignore certificate errors " }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: ignoreCertificateErrors, onChange: onIgnoreCertificatErrors }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Headless mode" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: headless, onChange: onHeadless }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "OpenGL render backend" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: openGlOptions, selectedId: openGlOption, title: "OpenGl option" }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsx)(RenderModalEnvironmentVariables_1.RenderModalEnvironmentVariables, { envVariables: envVariables, setEnvVariables: setEnvVariables })] }));
|
|
21
53
|
};
|
|
22
54
|
exports.RenderModalAdvanced = RenderModalAdvanced;
|
|
@@ -10,8 +10,10 @@ const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
|
10
10
|
const RemInput_1 = require("../NewComposition/RemInput");
|
|
11
11
|
const EnforceAudioTrackSetting_1 = require("./EnforceAudioTrackSetting");
|
|
12
12
|
const human_readable_audio_codecs_1 = require("./human-readable-audio-codecs");
|
|
13
|
+
const InfoBubble_1 = require("./InfoBubble");
|
|
13
14
|
const layout_1 = require("./layout");
|
|
14
15
|
const MutedSetting_1 = require("./MutedSetting");
|
|
16
|
+
const OptionExplainer_1 = require("./OptionExplainer");
|
|
15
17
|
const RenderModalHr_1 = require("./RenderModalHr");
|
|
16
18
|
const RenderModalAudio = ({ muted, setMuted, renderMode, enforceAudioTrack, setEnforceAudioTrackState, setShouldHaveCustomTargetAudioBitrate, shouldHaveCustomTargetAudioBitrate, setCustomTargetAudioBitrateValue, customTargetAudioBitrate, audioCodec, codec, setAudioCodec, }) => {
|
|
17
19
|
const onShouldHaveTargetAudioBitrateChanged = (0, react_1.useCallback)((e) => {
|
|
@@ -36,6 +38,6 @@ const RenderModalAudio = ({ muted, setMuted, renderMode, enforceAudioTrack, setE
|
|
|
36
38
|
};
|
|
37
39
|
});
|
|
38
40
|
}, [codec, setAudioCodec]);
|
|
39
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [renderMode === 'video' && audioCodecOptions(codec).length >= 2 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Audio Codec" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: audioCodecOptions(codec), selectedId: audioCodec, title: "AudioCodec" }) })] })) : null, renderMode === 'video' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(MutedSetting_1.MutedSetting, { enforceAudioTrack: enforceAudioTrack, muted: muted, setMuted: setMuted }), (0, jsx_runtime_1.jsx)(EnforceAudioTrackSetting_1.EnforceAudioTrackSetting, { muted: muted, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrack: setEnforceAudioTrackState }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})] })), renderMode === 'still' ? null : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Custom audio bitrate" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: shouldHaveCustomTargetAudioBitrate, onChange: onShouldHaveTargetAudioBitrateChanged }) })] })), shouldHaveCustomTargetAudioBitrate && 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 audio bitrate" }), (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: customTargetAudioBitrate, onChange: onTargetAudioBitrateChanged }) }) })] })) : null] }));
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [renderMode === 'video' && audioCodecOptions(codec).length >= 2 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Audio Codec" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: audioCodecOptions(codec), selectedId: audioCodec, title: "AudioCodec" }) })] })) : null, renderMode === 'video' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(MutedSetting_1.MutedSetting, { enforceAudioTrack: enforceAudioTrack, muted: muted, setMuted: setMuted, hint: client_1.BrowserSafeApis.options.muteOption }), (0, jsx_runtime_1.jsx)(EnforceAudioTrackSetting_1.EnforceAudioTrackSetting, { muted: muted, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrack: setEnforceAudioTrackState, option: client_1.BrowserSafeApis.options.enforceAudioOption }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})] })), renderMode === 'still' ? null : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Custom audio bitrate" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: shouldHaveCustomTargetAudioBitrate, onChange: onShouldHaveTargetAudioBitrateChanged }) })] })), shouldHaveCustomTargetAudioBitrate && 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 audio 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.audioBitrateOption }) }), (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: customTargetAudioBitrate, onChange: onTargetAudioBitrateChanged, status: "ok" }) }) })] })) : null] }));
|
|
40
42
|
};
|
|
41
43
|
exports.RenderModalAudio = RenderModalAudio;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Codec, ProResProfile } from '@remotion/renderer';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnyComposition } from 'remotion';
|
|
4
4
|
import type { SegmentedControlItem } from '../SegmentedControl';
|
|
5
5
|
import type { RenderType } from './RenderModalAdvanced';
|
|
6
6
|
export declare const RenderModalBasic: React.FC<{
|
|
@@ -13,10 +13,11 @@ export declare const RenderModalBasic: React.FC<{
|
|
|
13
13
|
setProResProfile: React.Dispatch<React.SetStateAction<ProResProfile>>;
|
|
14
14
|
frame: number;
|
|
15
15
|
setFrame: React.Dispatch<React.SetStateAction<number>>;
|
|
16
|
-
currentComposition:
|
|
16
|
+
currentComposition: AnyComposition;
|
|
17
17
|
setOutName: (value: React.SetStateAction<string>) => void;
|
|
18
18
|
setEndFrame: React.Dispatch<React.SetStateAction<number | null>>;
|
|
19
19
|
startFrame: number;
|
|
20
20
|
endFrame: number;
|
|
21
21
|
setStartFrame: React.Dispatch<React.SetStateAction<number | null>>;
|
|
22
|
+
validationMessage: string | null;
|
|
22
23
|
}>;
|
|
@@ -10,12 +10,14 @@ const Checkmark_1 = require("../../icons/Checkmark");
|
|
|
10
10
|
const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
11
11
|
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
12
12
|
const RemInput_1 = require("../NewComposition/RemInput");
|
|
13
|
-
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
14
13
|
const SegmentedControl_1 = require("../SegmentedControl");
|
|
15
14
|
const FrameRangeSetting_1 = require("./FrameRangeSetting");
|
|
16
15
|
const human_readable_codec_1 = require("./human-readable-codec");
|
|
16
|
+
const InfoBubble_1 = require("./InfoBubble");
|
|
17
17
|
const layout_1 = require("./layout");
|
|
18
|
-
const
|
|
18
|
+
const OptionExplainer_1 = require("./OptionExplainer");
|
|
19
|
+
const RenderModalInput_1 = require("./RenderModalInput");
|
|
20
|
+
const RenderModalBasic = ({ renderMode, imageFormatOptions, outName, codec, setVideoCodec: setCodec, proResProfile, setProResProfile, frame, setFrame, currentComposition, setOutName, setEndFrame, endFrame, setStartFrame, startFrame, validationMessage, }) => {
|
|
19
21
|
const existence = (0, use_file_existence_1.useFileExistence)(outName);
|
|
20
22
|
const videoCodecOptions = (0, react_1.useMemo)(() => {
|
|
21
23
|
return client_1.BrowserSafeApis.validCodecs
|
|
@@ -69,10 +71,6 @@ const RenderModalBasic = ({ renderMode, imageFormatOptions, outName, codec, setV
|
|
|
69
71
|
const onValueChange = (0, react_1.useCallback)((e) => {
|
|
70
72
|
setOutName(e.target.value);
|
|
71
73
|
}, [setOutName]);
|
|
72
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [renderMode === 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: true }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.
|
|
73
|
-
// TODO: Validate and reject folders or weird file names
|
|
74
|
-
, {
|
|
75
|
-
// TODO: Validate and reject folders or weird file names
|
|
76
|
-
warning: existence, style: layout_1.input, type: "text", value: outName, onChange: onValueChange }), existence ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: "Will be overwritten" })) : null] }) })] })] }));
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [renderMode === 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: true }) })] })) : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_1.label, children: ["Codec", (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.videoCodecOption }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: videoCodecOptions, selectedId: codec, title: "Codec" }) })] })), renderMode === 'still' && currentComposition.durationInFrames > 1 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Frame" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(RemInput_1.RightAlignInput, { children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: frame, onTextChange: onFrameChanged, placeholder: `0-${currentComposition.durationInFrames - 1}`, onValueChange: onFrameSetDirectly, name: "frame", step: 1, min: 0, status: "ok", max: currentComposition.durationInFrames - 1 }) }) })] })) : null, renderMode === 'video' && codec === 'prores' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "ProRes profile" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: proResProfile, selectedId: proResProfile, values: proResProfileOptions }) })] })) : null, renderMode === 'still' ? null : ((0, jsx_runtime_1.jsx)(FrameRangeSetting_1.FrameRangeSetting, { durationInFrames: currentComposition.durationInFrames, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame })), (0, jsx_runtime_1.jsx)(RenderModalInput_1.RenderModalInput, { existence: existence, inputStyle: layout_1.input, outName: outName, onValueChange: onValueChange, validationMessage: validationMessage })] }));
|
|
77
75
|
};
|
|
78
76
|
exports.RenderModalBasic = RenderModalBasic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AnyComposition } from 'remotion';
|
|
3
|
+
export declare const RenderModalData: React.FC<{
|
|
4
|
+
composition: AnyComposition;
|
|
5
|
+
inputProps: unknown;
|
|
6
|
+
setInputProps: React.Dispatch<React.SetStateAction<unknown>>;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
updateButton: boolean;
|
|
9
|
+
showSaveButton: boolean;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderModalData = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
7
|
+
const layout_1 = require("../layout");
|
|
8
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
9
|
+
const SegmentedControl_1 = require("../SegmentedControl");
|
|
10
|
+
const RenderModalJSONInputPropsEditor_1 = require("./RenderModalJSONInputPropsEditor");
|
|
11
|
+
const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
|
|
12
|
+
const outer = {
|
|
13
|
+
padding: '8px 16px',
|
|
14
|
+
};
|
|
15
|
+
const controlContainer = {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
};
|
|
19
|
+
const RenderModalData = ({ composition, inputProps, setInputProps, compact, updateButton, showSaveButton, }) => {
|
|
20
|
+
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
21
|
+
const zodValidationResult = (0, react_1.useMemo)(() => {
|
|
22
|
+
return composition.schema.safeParse(inputProps);
|
|
23
|
+
}, [composition.schema, inputProps]);
|
|
24
|
+
const modeItems = (0, react_1.useMemo)(() => {
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
key: 'schema',
|
|
28
|
+
label: 'Schema',
|
|
29
|
+
onClick: () => {
|
|
30
|
+
setMode('schema');
|
|
31
|
+
},
|
|
32
|
+
selected: mode === 'schema',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: 'json',
|
|
36
|
+
label: 'JSON',
|
|
37
|
+
onClick: () => {
|
|
38
|
+
setMode('json');
|
|
39
|
+
},
|
|
40
|
+
selected: mode === 'json',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}, [mode]);
|
|
44
|
+
const switchToSchema = (0, react_1.useCallback)(() => {
|
|
45
|
+
setMode('schema');
|
|
46
|
+
}, []);
|
|
47
|
+
const onUpdate = (0, react_1.useCallback)(() => {
|
|
48
|
+
(0, actions_1.updateDefaultProps)(composition.id, inputProps);
|
|
49
|
+
}, [composition.id, inputProps]);
|
|
50
|
+
const onSave = (0, react_1.useCallback)((updater) => {
|
|
51
|
+
(0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps));
|
|
52
|
+
}, [composition.defaultProps, composition.id]);
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsx)("div", { style: controlContainer, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: composition.schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONInputPropsEditor_1.RenderModalJSONInputPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema })), updateButton && mode === 'json' ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onUpdate, disabled: !zodValidationResult.success, children: "Save" })) : null] }));
|
|
54
|
+
};
|
|
55
|
+
exports.RenderModalData = RenderModalData;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderModalEnvironmentVariables = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
7
|
+
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const layout_1 = require("../layout");
|
|
9
|
+
const EnvInput_1 = require("./EnvInput");
|
|
10
|
+
const title = {
|
|
11
|
+
fontSize: 14,
|
|
12
|
+
fontWeight: 'bold',
|
|
13
|
+
color: colors_1.LIGHT_TEXT,
|
|
14
|
+
marginLeft: 16,
|
|
15
|
+
};
|
|
16
|
+
const container = {
|
|
17
|
+
marginTop: 20,
|
|
18
|
+
};
|
|
19
|
+
const button = {
|
|
20
|
+
marginLeft: 16,
|
|
21
|
+
};
|
|
22
|
+
// TODO: should warn if XOR key XOR value is empty
|
|
23
|
+
// TODO: Should warn if trying to set the same key twice
|
|
24
|
+
// TODO: Should warn if trying to set NODE_ENV
|
|
25
|
+
const RenderModalEnvironmentVariables = ({ envVariables, setEnvVariables }) => {
|
|
26
|
+
const onEnvValChange = (0, react_1.useCallback)((index, value) => {
|
|
27
|
+
setEnvVariables((oldEnv) => {
|
|
28
|
+
const newEnv = [...oldEnv];
|
|
29
|
+
newEnv[index][1] = value;
|
|
30
|
+
return newEnv;
|
|
31
|
+
});
|
|
32
|
+
}, [setEnvVariables]);
|
|
33
|
+
const onEnvKeyChange = (0, react_1.useCallback)((index, value) => {
|
|
34
|
+
setEnvVariables((oldEnv) => {
|
|
35
|
+
const newEnv = [...oldEnv];
|
|
36
|
+
newEnv[index][0] = value;
|
|
37
|
+
return newEnv;
|
|
38
|
+
});
|
|
39
|
+
}, [setEnvVariables]);
|
|
40
|
+
const onDelete = (0, react_1.useCallback)((index) => {
|
|
41
|
+
setEnvVariables((oldEnv) => oldEnv.filter((_, idx) => idx !== index));
|
|
42
|
+
}, [setEnvVariables]);
|
|
43
|
+
const addField = (0, react_1.useCallback)(() => {
|
|
44
|
+
setEnvVariables((oldEnv) => [...oldEnv, ['', '']]);
|
|
45
|
+
}, [setEnvVariables]);
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("strong", { style: title, children: "Environment variables" }), envVariables.map((env, i) => {
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(EnvInput_1.EnvInput
|
|
48
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
49
|
+
, { onEnvKeyChange: onEnvKeyChange, onEnvValChange: onEnvValChange, envKey: env[0], envVal: env[1], onDelete: onDelete, index: i, autoFocus: i === envVariables.length - 1 && env[0] === '' }, i));
|
|
50
|
+
}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { style: button, onClick: addField, children: "+ Add env variable" })] }));
|
|
51
|
+
};
|
|
52
|
+
exports.RenderModalEnvironmentVariables = RenderModalEnvironmentVariables;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
existence: boolean;
|
|
4
|
+
inputStyle: React.CSSProperties;
|
|
5
|
+
outName: string;
|
|
6
|
+
onValueChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
7
|
+
validationMessage: string | null;
|
|
8
|
+
};
|
|
9
|
+
export declare function RenderModalInput({ existence, inputStyle, outName, onValueChange, validationMessage, }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderModalInput = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const layout_1 = require("../layout");
|
|
6
|
+
const RemInput_1 = require("../NewComposition/RemInput");
|
|
7
|
+
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
8
|
+
const layout_2 = require("./layout");
|
|
9
|
+
// eslint-disable-next-line react/function-component-definition
|
|
10
|
+
function RenderModalInput({ existence, inputStyle, outName, onValueChange, validationMessage, }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: { flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_2.label, children: "Output name" }), validationMessage || existence ? ((0, jsx_runtime_1.jsx)("div", { style: { height: '25px' } })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { status: validationMessage ? 'error' : existence ? 'warning' : 'ok', style: inputStyle, type: "text", value: outName, onChange: onValueChange }), validationMessage ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: validationMessage, type: 'error' })] })) : existence ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: "Will be overwritten", type: 'warning' })] })) : null] }) })] }));
|
|
12
|
+
}
|
|
13
|
+
exports.RenderModalInput = RenderModalInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { z } from 'remotion';
|
|
3
|
+
export declare const RenderModalJSONInputPropsEditor: React.FC<{
|
|
4
|
+
value: unknown;
|
|
5
|
+
setValue: React.Dispatch<React.SetStateAction<unknown>>;
|
|
6
|
+
zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
7
|
+
switchToSchema: () => void;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
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.RenderModalJSONInputPropsEditor = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
30
|
+
const RemTextarea_1 = require("../NewComposition/RemTextarea");
|
|
31
|
+
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
32
|
+
const date_serialization_1 = require("./SchemaEditor/date-serialization");
|
|
33
|
+
const parseJSON = (str) => {
|
|
34
|
+
try {
|
|
35
|
+
const value = (0, date_serialization_1.deserializeJSONWithDate)(str);
|
|
36
|
+
return { str, value, validJSON: true };
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return { str, validJSON: false, error: e.message };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const style = {
|
|
43
|
+
fontFamily: 'monospace',
|
|
44
|
+
height: 400,
|
|
45
|
+
};
|
|
46
|
+
const schemaButton = {
|
|
47
|
+
border: 'none',
|
|
48
|
+
padding: 0,
|
|
49
|
+
display: 'inline-block',
|
|
50
|
+
cursor: 'pointer',
|
|
51
|
+
backgroundColor: 'transparent',
|
|
52
|
+
};
|
|
53
|
+
// TODO: Note if custom 'remotion-date:' pattern has been used
|
|
54
|
+
const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult, switchToSchema }) => {
|
|
55
|
+
const [localValue, setLocalValue] = react_1.default.useState(() => {
|
|
56
|
+
return parseJSON((0, date_serialization_1.serializeJSONWithDate)(value, 2));
|
|
57
|
+
});
|
|
58
|
+
const onPretty = (0, react_1.useCallback)(() => {
|
|
59
|
+
if (!localValue.validJSON) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const parsed = JSON.parse(localValue.str);
|
|
63
|
+
setLocalValue({ ...localValue, str: JSON.stringify(parsed, null, 2) });
|
|
64
|
+
}, [localValue]);
|
|
65
|
+
const onChange = (0, react_1.useCallback)((e) => {
|
|
66
|
+
const parsed = parseJSON(e.target.value);
|
|
67
|
+
if (parsed.validJSON) {
|
|
68
|
+
setLocalValue({
|
|
69
|
+
str: e.target.value,
|
|
70
|
+
value: parsed.value,
|
|
71
|
+
validJSON: parsed.validJSON,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
setLocalValue({
|
|
76
|
+
str: e.target.value,
|
|
77
|
+
validJSON: parsed.validJSON,
|
|
78
|
+
error: parsed.error,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (parsed.validJSON) {
|
|
82
|
+
setValue(parsed.value);
|
|
83
|
+
}
|
|
84
|
+
}, [setValue]);
|
|
85
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(RemTextarea_1.RemTextarea, { onChange: onChange, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: style }), localValue.validJSON === false ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : zodValidationResult.success === false ? ((0, jsx_runtime_1.jsx)("button", { type: "button", style: schemaButton, onClick: switchToSchema, children: (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: "Does not match schema", type: "warning" }) })) : null, (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, children: "Format JSON" })] }));
|
|
86
|
+
};
|
|
87
|
+
exports.RenderModalJSONInputPropsEditor = RenderModalJSONInputPropsEditor;
|