@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodErrorMessages = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../../../helpers/colors");
|
|
6
|
+
const label = {
|
|
7
|
+
fontSize: 14,
|
|
8
|
+
color: colors_1.LIGHT_TEXT,
|
|
9
|
+
fontFamily: 'sans-serif',
|
|
10
|
+
};
|
|
11
|
+
const code = {
|
|
12
|
+
...label,
|
|
13
|
+
fontFamily: 'monospace',
|
|
14
|
+
};
|
|
15
|
+
const ZodErrorMessages = ({ zodValidationResult }) => {
|
|
16
|
+
if (zodValidationResult.success) {
|
|
17
|
+
throw new Error('Expected error');
|
|
18
|
+
}
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: zodValidationResult.error.errors.map((error) => {
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: label, children: ["- ", (0, jsx_runtime_1.jsx)("code", { style: code, children: error.path.join('.') }), ": ", error.message] }, error.path.join('.')));
|
|
21
|
+
}) }));
|
|
22
|
+
};
|
|
23
|
+
exports.ZodErrorMessages = ZodErrorMessages;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZonNonEditableValue = 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 layout_1 = require("../layout");
|
|
8
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
9
|
+
const fullWidth = {
|
|
10
|
+
width: '100%',
|
|
11
|
+
};
|
|
12
|
+
const emptyLabel = {
|
|
13
|
+
width: '100%',
|
|
14
|
+
color: colors_1.LIGHT_TEXT,
|
|
15
|
+
fontFamily: 'sans-serif',
|
|
16
|
+
fontSize: 14,
|
|
17
|
+
};
|
|
18
|
+
const ZonNonEditableValue = ({ jsonPath, label, compact, showSaveButton }) => {
|
|
19
|
+
const save = (0, react_1.useCallback)(() => undefined, []);
|
|
20
|
+
const reset = (0, react_1.useCallback)(() => undefined, []);
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_1.narrowOption : layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: true, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: null }), (0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)("em", { style: emptyLabel, children: label }) })] }));
|
|
22
|
+
};
|
|
23
|
+
exports.ZonNonEditableValue = ZonNonEditableValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { z } from 'remotion';
|
|
3
|
+
import type { JSONPath } from './zod-types';
|
|
4
|
+
export declare const ZodNumberEditor: React.FC<{
|
|
5
|
+
schema: z.ZodTypeAny;
|
|
6
|
+
jsonPath: JSONPath;
|
|
7
|
+
value: number;
|
|
8
|
+
setValue: React.Dispatch<React.SetStateAction<number>>;
|
|
9
|
+
compact: boolean;
|
|
10
|
+
defaultValue: number;
|
|
11
|
+
onSave: (updater: (oldNum: unknown) => number) => void;
|
|
12
|
+
onRemove: null | (() => void);
|
|
13
|
+
showSaveButton: boolean;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodNumberEditor = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const layout_1 = require("../../layout");
|
|
7
|
+
const InputDragger_1 = require("../../NewComposition/InputDragger");
|
|
8
|
+
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
9
|
+
const layout_2 = require("../layout");
|
|
10
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
11
|
+
const fullWidth = {
|
|
12
|
+
width: '100%',
|
|
13
|
+
};
|
|
14
|
+
const getMinValue = (schema) => {
|
|
15
|
+
const minCheck = schema._def.checks.find((c) => c.kind === 'min');
|
|
16
|
+
if (!minCheck) {
|
|
17
|
+
return -Infinity;
|
|
18
|
+
}
|
|
19
|
+
if (minCheck.kind !== 'min') {
|
|
20
|
+
throw new Error('Expected min check');
|
|
21
|
+
}
|
|
22
|
+
if (!minCheck.inclusive) {
|
|
23
|
+
return -Infinity;
|
|
24
|
+
}
|
|
25
|
+
return minCheck.value;
|
|
26
|
+
};
|
|
27
|
+
const getMaxValue = (schema) => {
|
|
28
|
+
const maxCheck = schema._def.checks.find((c) => c.kind === 'max');
|
|
29
|
+
if (!maxCheck) {
|
|
30
|
+
return Infinity;
|
|
31
|
+
}
|
|
32
|
+
if (maxCheck.kind !== 'max') {
|
|
33
|
+
throw new Error('Expected max check');
|
|
34
|
+
}
|
|
35
|
+
if (!maxCheck.inclusive) {
|
|
36
|
+
return Infinity;
|
|
37
|
+
}
|
|
38
|
+
return maxCheck.value;
|
|
39
|
+
};
|
|
40
|
+
const getStep = (schema) => {
|
|
41
|
+
const multipleStep = schema._def.checks.find((c) => c.kind === 'multipleOf');
|
|
42
|
+
if (!multipleStep) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
if (multipleStep.kind !== 'multipleOf') {
|
|
46
|
+
throw new Error('Expected multipleOf check');
|
|
47
|
+
}
|
|
48
|
+
return multipleStep.value;
|
|
49
|
+
};
|
|
50
|
+
const ZodNumberEditor = ({ jsonPath, value, schema, setValue, onSave, compact, defaultValue, onRemove, showSaveButton, }) => {
|
|
51
|
+
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
52
|
+
return {
|
|
53
|
+
value: String(value),
|
|
54
|
+
zodValidation: schema.safeParse(value),
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
const onChange = (0, react_1.useCallback)((newValue) => {
|
|
58
|
+
const safeParse = schema.safeParse(Number(newValue));
|
|
59
|
+
const newLocalState = {
|
|
60
|
+
value: newValue,
|
|
61
|
+
zodValidation: safeParse,
|
|
62
|
+
};
|
|
63
|
+
setLocalValue(newLocalState);
|
|
64
|
+
if (safeParse.success) {
|
|
65
|
+
setValue(Number(newValue));
|
|
66
|
+
}
|
|
67
|
+
}, [schema, setValue]);
|
|
68
|
+
const onValueChange = (0, react_1.useCallback)((newValue) => {
|
|
69
|
+
const safeParse = schema.safeParse(newValue);
|
|
70
|
+
const newLocalState = {
|
|
71
|
+
value: String(newValue),
|
|
72
|
+
zodValidation: safeParse,
|
|
73
|
+
};
|
|
74
|
+
setLocalValue(newLocalState);
|
|
75
|
+
if (safeParse.success) {
|
|
76
|
+
setValue(newValue);
|
|
77
|
+
}
|
|
78
|
+
}, [schema, setValue]);
|
|
79
|
+
// TODO: Error message does not align well
|
|
80
|
+
const isDefault = value === defaultValue;
|
|
81
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
82
|
+
onValueChange(defaultValue);
|
|
83
|
+
}, [defaultValue, onValueChange]);
|
|
84
|
+
const save = (0, react_1.useCallback)(() => {
|
|
85
|
+
onSave(() => value);
|
|
86
|
+
}, [onSave, value]);
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: isDefault, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { type: 'number', value: localValue.value, style: fullWidth, status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onTextChange: onChange, onValueChange: onValueChange, min: getMinValue(schema), max: getMaxValue(schema), step: getStep(schema) }), !localValue.zodValidation.success && ((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: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
|
|
88
|
+
};
|
|
89
|
+
exports.ZodNumberEditor = ZodNumberEditor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'remotion';
|
|
3
|
+
import type { JSONPath } from './zod-types';
|
|
4
|
+
export declare const ZodObjectEditor: React.FC<{
|
|
5
|
+
schema: z.ZodTypeAny;
|
|
6
|
+
jsonPath: JSONPath;
|
|
7
|
+
value: unknown;
|
|
8
|
+
defaultValue: unknown;
|
|
9
|
+
setValue: React.Dispatch<React.SetStateAction<unknown>>;
|
|
10
|
+
compact: boolean;
|
|
11
|
+
onSave: (updater: (oldVal: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
12
|
+
showSaveButton: boolean;
|
|
13
|
+
onRemove: null | (() => void);
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodObjectEditor = 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 colors_1 = require("../../../helpers/colors");
|
|
8
|
+
const layout_1 = require("../layout");
|
|
9
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
10
|
+
const ZodSwitch_1 = require("./ZodSwitch");
|
|
11
|
+
const container = {
|
|
12
|
+
width: '100%',
|
|
13
|
+
};
|
|
14
|
+
const fullWidth = {
|
|
15
|
+
width: '100%',
|
|
16
|
+
};
|
|
17
|
+
const fieldset = {
|
|
18
|
+
borderRadius: 4,
|
|
19
|
+
borderColor: colors_1.INPUT_BORDER_COLOR_UNHOVERED,
|
|
20
|
+
};
|
|
21
|
+
// TODO: First validate locally
|
|
22
|
+
const ZodObjectEditor = ({ schema, jsonPath, setValue, value, compact, defaultValue, onSave, showSaveButton, onRemove, }) => {
|
|
23
|
+
const def = schema._def;
|
|
24
|
+
const typeName = def.typeName;
|
|
25
|
+
if (typeName !== remotion_1.z.ZodFirstPartyTypeKind.ZodObject) {
|
|
26
|
+
throw new Error('expected object');
|
|
27
|
+
}
|
|
28
|
+
const shape = def.shape();
|
|
29
|
+
const keys = Object.keys(shape);
|
|
30
|
+
const isRoot = jsonPath.length === 0;
|
|
31
|
+
const Element = isRoot ? 'div' : 'fieldset';
|
|
32
|
+
const { paddingTop } = layout_1.optionRow;
|
|
33
|
+
const style = (0, react_1.useMemo)(() => {
|
|
34
|
+
if (isRoot) {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
return { paddingTop };
|
|
38
|
+
}, [isRoot, paddingTop]);
|
|
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
|
+
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { jsonPath: [...jsonPath, key], schema: shape[key], value: value[key], defaultValue: defaultValue[key], setValue: (val) => {
|
|
41
|
+
setValue((oldVal) => {
|
|
42
|
+
return {
|
|
43
|
+
...oldVal,
|
|
44
|
+
[key]: typeof val === 'function' ? val(oldVal[key]) : val,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}, onSave: (val) => {
|
|
48
|
+
onSave((oldVal) => {
|
|
49
|
+
return {
|
|
50
|
+
...oldVal,
|
|
51
|
+
[key]: typeof val === 'function' ? val(oldVal[key]) : val,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}, onRemove: null, compact: compact, showSaveButton: showSaveButton }, key));
|
|
55
|
+
}) })] }) }) }));
|
|
56
|
+
};
|
|
57
|
+
exports.ZodObjectEditor = ZodObjectEditor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { z } from 'remotion';
|
|
3
|
+
import type { JSONPath } from './zod-types';
|
|
4
|
+
export declare const ZodStringEditor: React.FC<{
|
|
5
|
+
schema: z.ZodTypeAny;
|
|
6
|
+
jsonPath: JSONPath;
|
|
7
|
+
value: string;
|
|
8
|
+
defaultValue: string;
|
|
9
|
+
setValue: React.Dispatch<React.SetStateAction<string>>;
|
|
10
|
+
onSave: (updater: (oldNum: unknown) => string) => void;
|
|
11
|
+
onRemove: null | (() => void);
|
|
12
|
+
compact: boolean;
|
|
13
|
+
showSaveButton: boolean;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodStringEditor = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const layout_1 = require("../../layout");
|
|
7
|
+
const RemInput_1 = require("../../NewComposition/RemInput");
|
|
8
|
+
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
9
|
+
const layout_2 = require("../layout");
|
|
10
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
11
|
+
const fullWidth = {
|
|
12
|
+
width: '100%',
|
|
13
|
+
};
|
|
14
|
+
const ZodStringEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema, compact, onSave, onRemove, }) => {
|
|
15
|
+
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
16
|
+
return {
|
|
17
|
+
value,
|
|
18
|
+
zodValidation: schema.safeParse(value),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
const onValueChange = (0, react_1.useCallback)((newValue) => {
|
|
22
|
+
const safeParse = schema.safeParse(newValue);
|
|
23
|
+
const newLocalState = {
|
|
24
|
+
value: newValue,
|
|
25
|
+
zodValidation: safeParse,
|
|
26
|
+
};
|
|
27
|
+
setLocalValue(newLocalState);
|
|
28
|
+
if (safeParse.success) {
|
|
29
|
+
setValue(newValue);
|
|
30
|
+
}
|
|
31
|
+
}, [schema, setValue]);
|
|
32
|
+
const onChange = (0, react_1.useCallback)((e) => {
|
|
33
|
+
onValueChange(e.target.value);
|
|
34
|
+
}, [onValueChange]);
|
|
35
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
36
|
+
onValueChange(defaultValue);
|
|
37
|
+
}, [defaultValue, onValueChange]);
|
|
38
|
+
const save = (0, react_1.useCallback)(() => {
|
|
39
|
+
onSave(() => value);
|
|
40
|
+
}, [onSave, value]);
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { compact: compact, isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange }), !localValue.zodValidation.success && ((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: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
|
|
42
|
+
};
|
|
43
|
+
exports.ZodStringEditor = ZodStringEditor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'remotion';
|
|
3
|
+
import type { JSONPath } from './zod-types';
|
|
4
|
+
export declare const ZodSwitch: React.FC<{
|
|
5
|
+
schema: z.ZodTypeAny;
|
|
6
|
+
jsonPath: JSONPath;
|
|
7
|
+
value: unknown;
|
|
8
|
+
defaultValue: unknown;
|
|
9
|
+
setValue: React.Dispatch<React.SetStateAction<unknown>>;
|
|
10
|
+
onSave: (newValue: (oldVal: unknown) => unknown) => void;
|
|
11
|
+
compact: boolean;
|
|
12
|
+
showSaveButton: boolean;
|
|
13
|
+
onRemove: null | (() => void);
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodSwitch = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const ZodArrayEditor_1 = require("./ZodArrayEditor");
|
|
7
|
+
const ZodBooleanEditor_1 = require("./ZodBooleanEditor");
|
|
8
|
+
const ZodDateEditor_1 = require("./ZodDateEditor");
|
|
9
|
+
const ZodEffectEditor_1 = require("./ZodEffectEditor");
|
|
10
|
+
const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
|
|
11
|
+
const ZodNumberEditor_1 = require("./ZodNumberEditor");
|
|
12
|
+
const ZodObjectEditor_1 = require("./ZodObjectEditor");
|
|
13
|
+
const ZodStringEditor_1 = require("./ZodStringEditor");
|
|
14
|
+
const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, }) => {
|
|
15
|
+
const def = schema._def;
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
const typeName = def.typeName;
|
|
18
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodObject) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
20
|
+
}
|
|
21
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodString) {
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(ZodStringEditor_1.ZodStringEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
23
|
+
}
|
|
24
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodDate) {
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(ZodDateEditor_1.ZodDateEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
26
|
+
}
|
|
27
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodNumber) {
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(ZodNumberEditor_1.ZodNumberEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
29
|
+
}
|
|
30
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodBoolean) {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(ZodBooleanEditor_1.ZodBooleanEditor, { value: value, setValue: setValue, jsonPath: jsonPath, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
32
|
+
}
|
|
33
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodUndefined) {
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'undefined' }));
|
|
35
|
+
}
|
|
36
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodNull) {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'null' }));
|
|
38
|
+
}
|
|
39
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodAny) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'any (not editable)' }));
|
|
41
|
+
}
|
|
42
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodBigInt) {
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'BigInt (not editable)' }));
|
|
44
|
+
}
|
|
45
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodUnknown) {
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'unknown (not editable)' }));
|
|
47
|
+
}
|
|
48
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodArray) {
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(ZodArrayEditor_1.ZodArrayEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
50
|
+
}
|
|
51
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodEffects) {
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(ZodEffectEditor_1.ZodEffectEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }));
|
|
53
|
+
}
|
|
54
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "unknown" });
|
|
55
|
+
};
|
|
56
|
+
exports.ZodSwitch = ZodSwitch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeJSONWithDate = exports.serializeJSONWithDate = void 0;
|
|
4
|
+
const serializeJSONWithDate = (data, indent) => {
|
|
5
|
+
return JSON.stringify(data, function (key, value) {
|
|
6
|
+
if (this[key] instanceof Date) {
|
|
7
|
+
return `remotion-date:${this[key].toISOString()}`;
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}, indent);
|
|
11
|
+
};
|
|
12
|
+
exports.serializeJSONWithDate = serializeJSONWithDate;
|
|
13
|
+
const deserializeJSONWithDate = (data) => {
|
|
14
|
+
return JSON.parse(data, (_, value) => {
|
|
15
|
+
if (typeof value === 'string' && value.startsWith('remotion-date:')) {
|
|
16
|
+
return new Date(value.replace('remotion-date:', ''));
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
exports.deserializeJSONWithDate = deserializeJSONWithDate;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSchemaLabel = void 0;
|
|
4
|
+
const getSchemaLabel = (jsonPath) => {
|
|
5
|
+
const lastKey = jsonPath[jsonPath.length - 1];
|
|
6
|
+
if (typeof lastKey === 'number') {
|
|
7
|
+
const secondLastKey = jsonPath[jsonPath.length - 2];
|
|
8
|
+
if (typeof secondLastKey === 'undefined') {
|
|
9
|
+
return `[${lastKey}]`;
|
|
10
|
+
}
|
|
11
|
+
return `${(0, exports.getSchemaLabel)(jsonPath.slice(0, jsonPath.length - 1))}[${lastKey}]`;
|
|
12
|
+
}
|
|
13
|
+
return lastKey;
|
|
14
|
+
};
|
|
15
|
+
exports.getSchemaLabel = getSchemaLabel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type JSONPath = (string | number)[];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
export declare const optionRow: React.CSSProperties;
|
|
3
|
+
export declare const narrowOption: React.CSSProperties;
|
|
3
4
|
export declare const label: React.CSSProperties;
|
|
4
5
|
export declare const rightRow: React.CSSProperties;
|
|
5
6
|
export declare const input: React.CSSProperties;
|
|
7
|
+
export declare const fieldsetLabel: React.CSSProperties;
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.input = exports.rightRow = exports.label = exports.optionRow = void 0;
|
|
3
|
+
exports.fieldsetLabel = exports.input = exports.rightRow = exports.label = exports.narrowOption = exports.optionRow = void 0;
|
|
4
4
|
const colors_1 = require("../../helpers/colors");
|
|
5
5
|
exports.optionRow = {
|
|
6
6
|
display: 'flex',
|
|
7
7
|
flexDirection: 'row',
|
|
8
|
-
alignItems: '
|
|
8
|
+
alignItems: 'center',
|
|
9
9
|
minHeight: 40,
|
|
10
10
|
paddingLeft: 16,
|
|
11
11
|
paddingRight: 16,
|
|
12
12
|
paddingTop: 8,
|
|
13
13
|
paddingBottom: 8,
|
|
14
14
|
};
|
|
15
|
+
exports.narrowOption = {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
};
|
|
15
19
|
exports.label = {
|
|
16
|
-
width:
|
|
20
|
+
width: 170,
|
|
17
21
|
fontSize: 15,
|
|
18
22
|
lineHeight: '40px',
|
|
19
23
|
color: colors_1.LIGHT_TEXT,
|
|
24
|
+
fontFamily: 'sans-serif',
|
|
20
25
|
};
|
|
21
26
|
exports.rightRow = {
|
|
22
27
|
display: 'flex',
|
|
@@ -29,3 +34,14 @@ exports.input = {
|
|
|
29
34
|
minWidth: 250,
|
|
30
35
|
textAlign: 'right',
|
|
31
36
|
};
|
|
37
|
+
exports.fieldsetLabel = {
|
|
38
|
+
color: colors_1.LIGHT_TEXT,
|
|
39
|
+
fontSize: 14,
|
|
40
|
+
paddingLeft: 5,
|
|
41
|
+
paddingRight: 5,
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
fontFamily: 'monospace',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
width: '100%',
|
|
47
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AudioCodec, Codec, StillImageFormat } from '@remotion/renderer';
|
|
2
|
+
import type { RenderType } from './RenderModalAdvanced';
|
|
3
|
+
export declare const invalidCharacters: string[];
|
|
4
|
+
export declare const validateOutnameGui: ({ outName, codec, audioCodec, renderMode, stillImageFormat, }: {
|
|
5
|
+
outName: string;
|
|
6
|
+
codec: Codec;
|
|
7
|
+
audioCodec: AudioCodec;
|
|
8
|
+
renderMode: RenderType;
|
|
9
|
+
stillImageFormat: StillImageFormat | null;
|
|
10
|
+
}) => {
|
|
11
|
+
valid: true;
|
|
12
|
+
} | {
|
|
13
|
+
valid: false;
|
|
14
|
+
error: Error;
|
|
15
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateOutnameGui = exports.invalidCharacters = void 0;
|
|
4
|
+
const client_1 = require("@remotion/renderer/client");
|
|
5
|
+
exports.invalidCharacters = ['?', '*', '+', ':', '%'];
|
|
6
|
+
const isValidStillExtension = (extension, stillImageFormat) => {
|
|
7
|
+
if (stillImageFormat === 'jpeg' && extension === 'jpg') {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return extension === stillImageFormat;
|
|
11
|
+
};
|
|
12
|
+
const validateOutnameGui = ({ outName, codec, audioCodec, renderMode, stillImageFormat, }) => {
|
|
13
|
+
try {
|
|
14
|
+
isValidOutName({
|
|
15
|
+
audioCodec,
|
|
16
|
+
codec,
|
|
17
|
+
outName,
|
|
18
|
+
renderMode,
|
|
19
|
+
stillImageFormat,
|
|
20
|
+
});
|
|
21
|
+
return { valid: true };
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
return { valid: false, error: err };
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.validateOutnameGui = validateOutnameGui;
|
|
28
|
+
const isValidOutName = ({ outName, codec, audioCodec, renderMode, stillImageFormat, }) => {
|
|
29
|
+
const extension = outName.substring(outName.lastIndexOf('.') + 1);
|
|
30
|
+
const prefix = outName.substring(0, outName.lastIndexOf('.'));
|
|
31
|
+
const map = client_1.BrowserSafeApis.defaultFileExtensionMap[codec];
|
|
32
|
+
if (!(audioCodec in map.forAudioCodec)) {
|
|
33
|
+
throw new Error(`Audio codec ${audioCodec} is not supported for codec ${codec}`);
|
|
34
|
+
}
|
|
35
|
+
const hasDotAfterSlash = () => {
|
|
36
|
+
const substrings = prefix.split('/');
|
|
37
|
+
for (const str of substrings) {
|
|
38
|
+
if (str[0] === '.') {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
};
|
|
44
|
+
const hasInvalidChar = () => {
|
|
45
|
+
return prefix.split('').some((char) => exports.invalidCharacters.includes(char));
|
|
46
|
+
};
|
|
47
|
+
if (renderMode === 'video') {
|
|
48
|
+
client_1.BrowserSafeApis.validateOutputFilename({
|
|
49
|
+
codec,
|
|
50
|
+
audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
|
|
51
|
+
extension,
|
|
52
|
+
preferLossless: false,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (prefix.length < 1) {
|
|
56
|
+
throw new Error('The prefix must be at least 1 character long');
|
|
57
|
+
}
|
|
58
|
+
if (prefix[0] === '.' || hasDotAfterSlash()) {
|
|
59
|
+
throw new Error('The output name must not start with a dot');
|
|
60
|
+
}
|
|
61
|
+
if (hasInvalidChar()) {
|
|
62
|
+
throw new Error("Filename can't contain the following characters: ?, *, +, %, :");
|
|
63
|
+
}
|
|
64
|
+
if (renderMode === 'still' &&
|
|
65
|
+
stillImageFormat &&
|
|
66
|
+
!isValidStillExtension(extension, stillImageFormat)) {
|
|
67
|
+
throw new Error(`The extension ${extension} is not supported for still image format ${stillImageFormat}`);
|
|
68
|
+
}
|
|
69
|
+
if (renderMode === 'audio') {
|
|
70
|
+
if (audioCodec === 'pcm-16') {
|
|
71
|
+
if (extension !== 'wav' && extension !== 'wave') {
|
|
72
|
+
throw new Error(`The extension ${extension} is not supported for audio codec ${audioCodec}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (audioCodec !== extension) {
|
|
76
|
+
throw new Error(`The extension ${extension} is not supported for audio codec ${audioCodec}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
@@ -14,10 +14,10 @@ const RenderQueueError = ({ job }) => {
|
|
|
14
14
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
15
15
|
const onClick = (0, react_1.useCallback)(() => {
|
|
16
16
|
setSelectedModal({
|
|
17
|
-
type: 'render-
|
|
18
|
-
job,
|
|
17
|
+
type: 'render-progress',
|
|
18
|
+
jobId: job.id,
|
|
19
19
|
});
|
|
20
|
-
}, [job, setSelectedModal]);
|
|
20
|
+
}, [job.id, setSelectedModal]);
|
|
21
21
|
if (job.status !== 'failed') {
|
|
22
22
|
throw new Error('should not have rendered this component');
|
|
23
23
|
}
|
|
@@ -2,13 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RenderQueueItemStatus = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const colors_1 = require("../../helpers/colors");
|
|
7
|
+
const modals_1 = require("../../state/modals");
|
|
6
8
|
const CircularProgress_1 = require("./CircularProgress");
|
|
7
9
|
const iconStyle = {
|
|
8
10
|
height: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
|
|
9
11
|
width: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
|
|
10
12
|
};
|
|
13
|
+
const invisibleStyle = {
|
|
14
|
+
appearance: 'none',
|
|
15
|
+
border: 'none',
|
|
16
|
+
padding: 0,
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
};
|
|
11
20
|
const RenderQueueItemStatus = ({ job }) => {
|
|
21
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
22
|
+
const openProgress = (0, react_1.useCallback)(() => {
|
|
23
|
+
setSelectedModal({
|
|
24
|
+
type: 'render-progress',
|
|
25
|
+
jobId: job.id,
|
|
26
|
+
});
|
|
27
|
+
}, [job.id, setSelectedModal]);
|
|
12
28
|
if (job.status === 'failed') {
|
|
13
29
|
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.FAIL_COLOR, d: "M0 160V352L160 512H352L512 352V160L352 0H160L0 160zm353.9 32l-17 17-47 47 47 47 17 17L320 353.9l-17-17-47-47-47 47-17 17L158.1 320l17-17 47-47-47-47-17-17L192 158.1l17 17 47 47 47-47 17-17L353.9 192z" }) }) }));
|
|
14
30
|
}
|
|
@@ -16,11 +32,11 @@ const RenderQueueItemStatus = ({ job }) => {
|
|
|
16
32
|
return ((0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256zM232 120V256c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2V120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }) }));
|
|
17
33
|
}
|
|
18
34
|
if (job.status === 'done') {
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM369 209L241 337l-17 17-17-17-64-64-17-17L160 222.1l17 17 47 47L335 175l17-17L385.9 192l-17 17z" }) }));
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: invisibleStyle, onClick: openProgress, children: (0, jsx_runtime_1.jsx)("svg", { style: iconStyle, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM369 209L241 337l-17 17-17-17-64-64-17-17L160 222.1l17 17 47 47L335 175l17-17L385.9 192l-17 17z" }) }) }));
|
|
20
36
|
}
|
|
21
37
|
if (job.status === 'running') {
|
|
22
38
|
// Add a minimum progress to avoid the progress bar from disappearing
|
|
23
|
-
return (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress) });
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", style: invisibleStyle, onClick: openProgress, children: (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress.value) }) }));
|
|
24
40
|
}
|
|
25
41
|
throw new Error('Unknown job status');
|
|
26
42
|
};
|