@remotion/cli 4.0.0-alpha7 → 4.0.0-alpha9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codemods/update-default-props.d.ts +1 -1
- package/dist/codemods/update-default-props.js +0 -1
- package/dist/editor/components/CheckboardToggle.js +2 -1
- package/dist/editor/components/InlineAction.d.ts +1 -1
- package/dist/editor/components/InlineAction.js +6 -3
- package/dist/editor/components/LoopToggle.js +2 -1
- package/dist/editor/components/Menu/MenuItem.js +1 -1
- package/dist/editor/components/Menu/SubMenu.js +1 -1
- package/dist/editor/components/MenuBuildIndicator.js +20 -1
- package/dist/editor/components/Modals.js +1 -1
- package/dist/editor/components/NewComposition/ComboBox.js +19 -4
- package/dist/editor/components/NewComposition/InputDragger.js +3 -2
- package/dist/editor/components/NewComposition/MenuContent.d.ts +1 -0
- package/dist/editor/components/NewComposition/MenuContent.js +11 -3
- package/dist/editor/components/OpenEditorButton.d.ts +2 -0
- package/dist/editor/components/OpenEditorButton.js +52 -0
- package/dist/editor/components/RenderButton.js +5 -1
- package/dist/editor/components/RenderModal/CliCopyButton.js +7 -6
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +3 -2
- package/dist/editor/components/RenderModal/MutedSetting.js +3 -2
- package/dist/editor/components/RenderModal/OptionExplainer.js +1 -0
- package/dist/editor/components/RenderModal/RenderModal.d.ts +3 -1
- package/dist/editor/components/RenderModal/RenderModal.js +9 -7
- package/dist/editor/components/RenderModal/RenderModalAdvanced.js +0 -2
- package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalBasic.js +3 -2
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +3 -3
- package/dist/editor/components/RenderModal/RenderModalData.js +50 -25
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +5 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +6 -2
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +5 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +4 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +38 -26
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +4 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +7 -7
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +17 -60
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +10 -18
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +3 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -19
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +12 -26
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +15 -34
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +6 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +17 -10
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +6 -6
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +11 -25
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +12 -23
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +3 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +12 -12
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +11 -1
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.d.ts +16 -0
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +44 -0
- package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +4 -1
- package/dist/editor/components/RenderModal/get-render-modal-warnings.js +21 -2
- package/dist/editor/components/RenderModal/out-name-checker.js +1 -11
- package/dist/editor/components/RenderQueue/actions.d.ts +3 -3
- package/dist/editor/components/RightPanel.js +3 -3
- package/dist/editor/components/SidebarRenderButton.js +2 -0
- package/dist/editor/components/Spinner.d.ts +4 -0
- package/dist/editor/components/Spinner.js +42 -0
- package/dist/editor/components/Tabs/index.js +12 -14
- package/dist/editor/components/Timeline/TimelineSequence.js +2 -2
- package/dist/editor/components/TimelineInOutToggle.js +2 -1
- package/dist/editor/components/UpdateCheck.js +2 -1
- package/dist/editor/helpers/colors.d.ts +2 -0
- package/dist/editor/helpers/colors.js +3 -1
- package/dist/editor/icons/media-volume.js +2 -1
- package/dist/editor/state/modals.d.ts +3 -1
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/get-input-props.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/list-of-remotion-packages.js +1 -0
- package/dist/preview-server/api-types.d.ts +2 -2
- package/dist/preview-server/error-overlay/remotion-overlay/HelpLink.js +2 -1
- package/dist/preview-server/render-queue/job.d.ts +9 -2
- package/dist/preview-server/render-queue/make-retry-payload.js +5 -1
- package/dist/preview-server/render-queue/queue.js +0 -1
- package/dist/preview-server/routes/update-default-props.d.ts +2 -2
- package/dist/preview-server/routes/update-default-props.js +23 -13
- package/dist/preview-server/routes.d.ts +2 -1
- package/dist/preview-server/start-server.js +1 -1
- package/dist/render-flows/render.d.ts +1 -1
- package/dist/render-flows/still.d.ts +1 -1
- package/package.json +13 -11
- package/styles/styles.css +4 -5
|
@@ -25,7 +25,7 @@ const checkBoxWrapper = {
|
|
|
25
25
|
alignItems: 'center',
|
|
26
26
|
marginTop: '5px',
|
|
27
27
|
};
|
|
28
|
-
const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, nullishValue, saving, }) => {
|
|
28
|
+
const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, nullishValue, saving, saveDisabledByParent, }) => {
|
|
29
29
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
30
30
|
if (!z) {
|
|
31
31
|
throw new Error('expected zod');
|
|
@@ -51,7 +51,7 @@ const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defau
|
|
|
51
51
|
zodValidation: schema.safeParse(newValue),
|
|
52
52
|
};
|
|
53
53
|
});
|
|
54
|
-
setValue(updater);
|
|
54
|
+
setValue(updater, false);
|
|
55
55
|
}, [nullishValue, schema, setValue]);
|
|
56
56
|
const onCheckBoxChange = (0, react_1.useCallback)((e) => {
|
|
57
57
|
const val = e.target.checked
|
|
@@ -65,7 +65,7 @@ const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defau
|
|
|
65
65
|
zodValidation: schema.safeParse(val),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
onValueChange(() => val);
|
|
68
|
+
onValueChange(() => val, false);
|
|
69
69
|
}, [
|
|
70
70
|
localNonNullishValueValue,
|
|
71
71
|
nullishValue,
|
|
@@ -75,11 +75,11 @@ const ZodOrNullishEditor = ({ jsonPath, compact, schema, setValue, onSave, defau
|
|
|
75
75
|
zodTypes,
|
|
76
76
|
]);
|
|
77
77
|
const reset = (0, react_1.useCallback)(() => {
|
|
78
|
-
onValueChange(() => defaultValue);
|
|
78
|
+
onValueChange(() => defaultValue, true);
|
|
79
79
|
}, [defaultValue, onValueChange]);
|
|
80
80
|
const save = (0, react_1.useCallback)(() => {
|
|
81
|
-
onSave(() => value);
|
|
81
|
+
onSave(() => value, false);
|
|
82
82
|
}, [onSave, value]);
|
|
83
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove, saving: saving })) : ((0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onValueChange, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }) })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove, saving: saving, valid: localNonNullishValueValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent })) : ((0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onValueChange, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }) })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
|
|
84
84
|
};
|
|
85
85
|
exports.ZodOrNullishEditor = ZodOrNullishEditor;
|
|
@@ -10,21 +10,20 @@ const layout_1 = require("../../layout");
|
|
|
10
10
|
const ComboBox_1 = require("../../NewComposition/ComboBox");
|
|
11
11
|
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
12
12
|
const layout_2 = require("../layout");
|
|
13
|
+
const local_state_1 = require("./local-state");
|
|
13
14
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
14
15
|
const container = {
|
|
15
16
|
width: '100%',
|
|
16
17
|
};
|
|
17
|
-
const ZodStaticFileEditor = ({ schema, jsonPath, compact, setValue
|
|
18
|
+
const ZodStaticFileEditor = ({ schema, jsonPath, compact, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, }) => {
|
|
18
19
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
19
20
|
if (!z) {
|
|
20
21
|
throw new Error('expected zod');
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
revision: 0,
|
|
27
|
-
};
|
|
23
|
+
const { localValue, onChange: setLocalValue } = (0, local_state_1.useLocalState)({
|
|
24
|
+
schema,
|
|
25
|
+
setValue,
|
|
26
|
+
value,
|
|
28
27
|
});
|
|
29
28
|
const def = schema._def;
|
|
30
29
|
const typeName = def.typeName;
|
|
@@ -32,22 +31,9 @@ const ZodStaticFileEditor = ({ schema, jsonPath, compact, setValue: updateValue,
|
|
|
32
31
|
throw new Error('expected enum');
|
|
33
32
|
}
|
|
34
33
|
const isRoot = jsonPath.length === 0;
|
|
35
|
-
const onChange = (0, react_1.useCallback)((updater, forceApply) => {
|
|
36
|
-
setLocalValue((oldLocalState) => {
|
|
37
|
-
const newValue = updater(oldLocalState.value);
|
|
38
|
-
const safeParse = schema.safeParse(newValue);
|
|
39
|
-
if (safeParse.success || forceApply) {
|
|
40
|
-
updateValue(updater);
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
value: newValue,
|
|
44
|
-
zodValidation: safeParse,
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
}, [schema, updateValue]);
|
|
48
34
|
const reset = (0, react_1.useCallback)(() => {
|
|
49
|
-
|
|
50
|
-
}, [defaultValue,
|
|
35
|
+
setLocalValue(() => defaultValue, true);
|
|
36
|
+
}, [defaultValue, setLocalValue]);
|
|
51
37
|
const comboBoxValues = (0, react_1.useMemo)(() => {
|
|
52
38
|
return (0, remotion_1.getStaticFiles)().map((option) => {
|
|
53
39
|
return {
|
|
@@ -57,17 +43,17 @@ const ZodStaticFileEditor = ({ schema, jsonPath, compact, setValue: updateValue,
|
|
|
57
43
|
keyHint: null,
|
|
58
44
|
leftItem: option.src === value ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
59
45
|
onClick: (id) => {
|
|
60
|
-
|
|
46
|
+
setLocalValue(() => id, false);
|
|
61
47
|
},
|
|
62
48
|
quickSwitcherLabel: null,
|
|
63
49
|
subMenu: null,
|
|
64
50
|
type: 'item',
|
|
65
51
|
};
|
|
66
52
|
});
|
|
67
|
-
}, [
|
|
53
|
+
}, [setLocalValue, value]);
|
|
68
54
|
const save = (0, react_1.useCallback)(() => {
|
|
69
55
|
onSave(() => value);
|
|
70
56
|
}, [onSave, value]);
|
|
71
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { onSave: save, showSaveButton: showSaveButton, isDefaultValue: value === defaultValue, compact: compact, onReset: reset, jsonPath: jsonPath, onRemove: onRemove, saving: saving }), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: localValue.value, title: value }) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] }));
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? layout_2.narrowOption : layout_2.optionRow, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { onSave: save, showSaveButton: showSaveButton, isDefaultValue: localValue.value === defaultValue, compact: compact, onReset: reset, jsonPath: jsonPath, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent }), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: localValue.value, title: value }) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] }));
|
|
72
58
|
};
|
|
73
59
|
exports.ZodStaticFileEditor = ZodStaticFileEditor;
|
|
@@ -8,9 +8,10 @@ export declare const ZodStringEditor: React.FC<{
|
|
|
8
8
|
value: string;
|
|
9
9
|
defaultValue: string;
|
|
10
10
|
setValue: UpdaterFunction<string>;
|
|
11
|
-
onSave:
|
|
11
|
+
onSave: UpdaterFunction<string>;
|
|
12
12
|
onRemove: null | (() => void);
|
|
13
13
|
compact: boolean;
|
|
14
14
|
showSaveButton: boolean;
|
|
15
15
|
saving: boolean;
|
|
16
|
+
saveDisabledByParent: boolean;
|
|
16
17
|
}>;
|
|
@@ -8,41 +8,30 @@ const layout_1 = require("../../layout");
|
|
|
8
8
|
const RemInput_1 = require("../../NewComposition/RemInput");
|
|
9
9
|
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
10
10
|
const layout_2 = require("../layout");
|
|
11
|
+
const local_state_1 = require("./local-state");
|
|
11
12
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
12
13
|
const fullWidth = {
|
|
13
14
|
width: '100%',
|
|
14
15
|
};
|
|
15
|
-
const ZodStringEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema, compact, onSave, onRemove, saving, }) => {
|
|
16
|
+
const ZodStringEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema, compact, onSave, onRemove, saving, saveDisabledByParent, }) => {
|
|
16
17
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
17
18
|
if (!z) {
|
|
18
19
|
throw new Error('expected zod');
|
|
19
20
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
21
|
+
const { localValue, onChange: setLocalValue } = (0, local_state_1.useLocalState)({
|
|
22
|
+
schema,
|
|
23
|
+
setValue,
|
|
24
|
+
value,
|
|
25
25
|
});
|
|
26
|
-
const onValueChange = (0, react_1.useCallback)((newValue, forceApply) => {
|
|
27
|
-
const safeParse = schema.safeParse(newValue);
|
|
28
|
-
const newLocalState = {
|
|
29
|
-
value: newValue,
|
|
30
|
-
zodValidation: safeParse,
|
|
31
|
-
};
|
|
32
|
-
setLocalValue(newLocalState);
|
|
33
|
-
if (safeParse.success || forceApply) {
|
|
34
|
-
setValue(() => newValue);
|
|
35
|
-
}
|
|
36
|
-
}, [schema, setValue]);
|
|
37
26
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
38
|
-
|
|
39
|
-
}, [
|
|
27
|
+
setLocalValue(() => e.target.value, false);
|
|
28
|
+
}, [setLocalValue]);
|
|
40
29
|
const reset = (0, react_1.useCallback)(() => {
|
|
41
|
-
|
|
42
|
-
}, [defaultValue,
|
|
30
|
+
setLocalValue(() => defaultValue, true);
|
|
31
|
+
}, [defaultValue, setLocalValue]);
|
|
43
32
|
const save = (0, react_1.useCallback)(() => {
|
|
44
|
-
onSave(() => value);
|
|
33
|
+
onSave(() => value, false);
|
|
45
34
|
}, [onSave, value]);
|
|
46
|
-
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, saving: saving }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: localValue.zodValidation
|
|
35
|
+
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: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: localValue.zodValidation ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, rightAlign: false }), !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-start", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] })] }));
|
|
47
36
|
};
|
|
48
37
|
exports.ZodStringEditor = ZodStringEditor;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import type { JSONPath } from './zod-types';
|
|
4
|
-
export declare type UpdaterFunction<T> = (updater: (oldValue: T) => T) => void;
|
|
4
|
+
export declare type UpdaterFunction<T> = (updater: (oldValue: T) => T, forceApply: boolean) => void;
|
|
5
5
|
export declare const ZodSwitch: React.FC<{
|
|
6
6
|
schema: z.ZodTypeAny;
|
|
7
7
|
jsonPath: JSONPath;
|
|
8
8
|
value: unknown;
|
|
9
9
|
defaultValue: unknown;
|
|
10
10
|
setValue: UpdaterFunction<unknown>;
|
|
11
|
-
onSave:
|
|
11
|
+
onSave: UpdaterFunction<unknown>;
|
|
12
12
|
compact: boolean;
|
|
13
13
|
showSaveButton: boolean;
|
|
14
14
|
onRemove: null | (() => void);
|
|
15
15
|
saving: boolean;
|
|
16
|
+
saveDisabledByParent: boolean;
|
|
16
17
|
}>;
|
|
@@ -17,7 +17,7 @@ const ZodOptionalEditor_1 = require("./ZodOptionalEditor");
|
|
|
17
17
|
const ZodStaticFileEditor_1 = require("./ZodStaticFileEditor");
|
|
18
18
|
const ZodStringEditor_1 = require("./ZodStringEditor");
|
|
19
19
|
const ZodUnionEditor_1 = require("./ZodUnionEditor");
|
|
20
|
-
const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, saving, }) => {
|
|
20
|
+
const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, }) => {
|
|
21
21
|
const def = schema._def;
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
23
|
const typeName = def.typeName;
|
|
@@ -28,22 +28,22 @@ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, o
|
|
|
28
28
|
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
29
29
|
// TODO: (Maybe?) enable saving of inserted input props by cmd+s /ctrl + s (also for JSON view)
|
|
30
30
|
if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
|
|
31
|
-
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, saving: saving }));
|
|
31
|
+
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, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
32
32
|
}
|
|
33
33
|
if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
|
|
34
34
|
if (value.startsWith(window.remotion_staticBase)) {
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(ZodStaticFileEditor_1.ZodStaticFileEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(ZodStaticFileEditor_1.ZodStaticFileEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
36
36
|
}
|
|
37
|
-
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, saving: saving }));
|
|
37
|
+
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, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
38
38
|
}
|
|
39
39
|
if (typeName === z.ZodFirstPartyTypeKind.ZodDate) {
|
|
40
|
-
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, saving: saving }));
|
|
40
|
+
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, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
41
41
|
}
|
|
42
42
|
if (typeName === z.ZodFirstPartyTypeKind.ZodNumber) {
|
|
43
|
-
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, saving: saving }));
|
|
43
|
+
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, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
44
44
|
}
|
|
45
45
|
if (typeName === z.ZodFirstPartyTypeKind.ZodBoolean) {
|
|
46
|
-
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, saving: saving }));
|
|
46
|
+
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, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
47
47
|
}
|
|
48
48
|
if (typeName === z.ZodFirstPartyTypeKind.ZodUndefined) {
|
|
49
49
|
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'undefined', saving: saving }));
|
|
@@ -61,7 +61,7 @@ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, o
|
|
|
61
61
|
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'unknown (not editable)', saving: saving }));
|
|
62
62
|
}
|
|
63
63
|
if (typeName === z.ZodFirstPartyTypeKind.ZodArray) {
|
|
64
|
-
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, saving: saving }));
|
|
64
|
+
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, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
65
65
|
}
|
|
66
66
|
if (typeName === z.ZodFirstPartyTypeKind.ZodEnum) {
|
|
67
67
|
return ((0, jsx_runtime_1.jsx)(ZodEnumEditor_1.ZodEnumEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
|
|
@@ -70,18 +70,18 @@ const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, o
|
|
|
70
70
|
if (zodTypes &&
|
|
71
71
|
schema._def.description ===
|
|
72
72
|
zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(ZodColorEditor_1.ZodColorEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(ZodColorEditor_1.ZodColorEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, compact: compact, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
74
74
|
}
|
|
75
75
|
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, saving: saving }));
|
|
76
76
|
}
|
|
77
77
|
if (typeName === z.ZodFirstPartyTypeKind.ZodUnion) {
|
|
78
|
-
return ((0, jsx_runtime_1.jsx)(ZodUnionEditor_1.ZodUnionEditor, { schema: schema, showSaveButton: showSaveButton, jsonPath: jsonPath, compact: compact, value: value, defaultValue: defaultValue, setValue: setValue, onSave: onSave, onRemove: onRemove, saving: saving }));
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(ZodUnionEditor_1.ZodUnionEditor, { schema: schema, showSaveButton: showSaveButton, jsonPath: jsonPath, compact: compact, value: value, defaultValue: defaultValue, setValue: setValue, onSave: onSave, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
79
79
|
}
|
|
80
80
|
if (typeName === z.ZodFirstPartyTypeKind.ZodOptional) {
|
|
81
|
-
return ((0, jsx_runtime_1.jsx)(ZodOptionalEditor_1.ZodOptionalEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving }));
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(ZodOptionalEditor_1.ZodOptionalEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
82
82
|
}
|
|
83
83
|
if (typeName === z.ZodFirstPartyTypeKind.ZodNullable) {
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)(ZodNullableEditor_1.ZodNullableEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving }));
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(ZodNullableEditor_1.ZodNullableEditor, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
85
85
|
}
|
|
86
86
|
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)`, saving: saving }));
|
|
87
87
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import type { JSONPath } from './zod-types';
|
|
4
|
+
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
5
|
export declare const ZodUnionEditor: React.FC<{
|
|
5
6
|
showSaveButton: boolean;
|
|
6
7
|
jsonPath: JSONPath;
|
|
@@ -8,8 +9,9 @@ export declare const ZodUnionEditor: React.FC<{
|
|
|
8
9
|
value: unknown;
|
|
9
10
|
defaultValue: unknown;
|
|
10
11
|
schema: z.ZodTypeAny;
|
|
11
|
-
setValue:
|
|
12
|
-
onSave:
|
|
12
|
+
setValue: UpdaterFunction<unknown>;
|
|
13
|
+
onSave: UpdaterFunction<unknown>;
|
|
13
14
|
onRemove: null | (() => void);
|
|
14
15
|
saving: boolean;
|
|
16
|
+
saveDisabledByParent: boolean;
|
|
15
17
|
}>;
|
|
@@ -24,7 +24,7 @@ const findNull = (value, zodType) => {
|
|
|
24
24
|
otherSchemaIsAlsoNullish,
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
const ZodUnionEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, saving, }) => {
|
|
27
|
+
const ZodUnionEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, saving, saveDisabledByParent, }) => {
|
|
28
28
|
const { options } = schema._def;
|
|
29
29
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
30
30
|
if (!z) {
|
|
@@ -44,6 +44,6 @@ const ZodUnionEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultVa
|
|
|
44
44
|
if (otherSchemaIsAlsoNullish) {
|
|
45
45
|
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Not editable - both union values are nullish', compact: compact, showSaveButton: showSaveButton, saving: saving }));
|
|
46
46
|
}
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)(ZodOrNullishEditor_1.ZodOrNullishEditor, { compact: compact, defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: otherSchema, setValue: setValue, showSaveButton: showSaveButton, value: value, nullishValue: nullishValue, saving: saving }));
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(ZodOrNullishEditor_1.ZodOrNullishEditor, { compact: compact, defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: otherSchema, setValue: setValue, showSaveButton: showSaveButton, value: value, nullishValue: nullishValue, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
48
48
|
};
|
|
49
49
|
exports.ZodUnionEditor = ZodUnionEditor;
|
|
@@ -2,6 +2,8 @@ export declare type SerializedJSONWithCustomFields = {
|
|
|
2
2
|
serializedString: string;
|
|
3
3
|
customDateUsed: boolean;
|
|
4
4
|
customFileUsed: boolean;
|
|
5
|
+
mapUsed: boolean;
|
|
6
|
+
setUsed: boolean;
|
|
5
7
|
};
|
|
6
8
|
export declare const FILE_TOKEN = "remotion-file:";
|
|
7
9
|
export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
|
|
@@ -6,19 +6,29 @@ exports.FILE_TOKEN = 'remotion-file:';
|
|
|
6
6
|
const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
|
|
7
7
|
let customDateUsed = false;
|
|
8
8
|
let customFileUsed = false;
|
|
9
|
+
let mapUsed = false;
|
|
10
|
+
let setUsed = false;
|
|
9
11
|
const serializedString = JSON.stringify(data, function (key, value) {
|
|
10
12
|
const item = this[key];
|
|
11
13
|
if (item instanceof Date) {
|
|
12
14
|
customDateUsed = true;
|
|
13
15
|
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
14
16
|
}
|
|
17
|
+
if (item instanceof Map) {
|
|
18
|
+
mapUsed = true;
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if (item instanceof Set) {
|
|
22
|
+
setUsed = true;
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
15
25
|
if (typeof item === 'string' && item.startsWith(staticBase)) {
|
|
16
26
|
customFileUsed = true;
|
|
17
27
|
return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
|
|
18
28
|
}
|
|
19
29
|
return value;
|
|
20
30
|
}, indent);
|
|
21
|
-
return { serializedString, customDateUsed, customFileUsed };
|
|
31
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
22
32
|
};
|
|
23
33
|
exports.serializeJSONWithDate = serializeJSONWithDate;
|
|
24
34
|
const deserializeJSONWithCustomFields = (data) => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { UpdaterFunction } from './ZodSwitch';
|
|
3
|
+
declare type LocalState<T> = {
|
|
4
|
+
value: T;
|
|
5
|
+
zodValidation: z.SafeParseReturnType<unknown, unknown>;
|
|
6
|
+
revision: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const useLocalState: <T>({ value, schema, setValue, }: {
|
|
9
|
+
value: T;
|
|
10
|
+
schema: z.ZodTypeAny;
|
|
11
|
+
setValue: UpdaterFunction<T>;
|
|
12
|
+
}) => {
|
|
13
|
+
localValue: LocalState<T>;
|
|
14
|
+
onChange: (updater: (oldV: T) => T, forceApply: boolean) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLocalState = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useLocalState = ({ value, schema, setValue, }) => {
|
|
6
|
+
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
7
|
+
return {
|
|
8
|
+
value,
|
|
9
|
+
zodValidation: schema.safeParse(value),
|
|
10
|
+
revision: 0,
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
const stateRef = (0, react_1.useRef)(localValue);
|
|
14
|
+
stateRef.current = localValue;
|
|
15
|
+
const onChange = (0, react_1.useCallback)((updater, forceApply) => {
|
|
16
|
+
const newValue = updater(stateRef.current.value);
|
|
17
|
+
const safeParse = schema.safeParse(newValue);
|
|
18
|
+
if (safeParse.success || forceApply) {
|
|
19
|
+
setValue(updater, forceApply);
|
|
20
|
+
setLocalValue((oldLocalState) => {
|
|
21
|
+
const newState = {
|
|
22
|
+
revision: oldLocalState.revision + 1,
|
|
23
|
+
value: newValue,
|
|
24
|
+
zodValidation: safeParse,
|
|
25
|
+
};
|
|
26
|
+
stateRef.current = newState;
|
|
27
|
+
return newState;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
setLocalValue((oldLocalState) => {
|
|
32
|
+
const newState = {
|
|
33
|
+
revision: oldLocalState.revision + 1,
|
|
34
|
+
value: newValue,
|
|
35
|
+
zodValidation: safeParse,
|
|
36
|
+
};
|
|
37
|
+
stateRef.current = newState;
|
|
38
|
+
return newState;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}, [schema, setValue]);
|
|
42
|
+
return { localValue, onChange };
|
|
43
|
+
};
|
|
44
|
+
exports.useLocalState = useLocalState;
|
|
@@ -6,11 +6,14 @@ export declare type TypeCanSaveState = {
|
|
|
6
6
|
reason: string;
|
|
7
7
|
determined: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const defaultTypeCanSaveState: TypeCanSaveState;
|
|
10
|
+
export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }: {
|
|
10
11
|
cliProps: unknown;
|
|
11
12
|
canSaveDefaultProps: TypeCanSaveState;
|
|
12
13
|
isCustomDateUsed: boolean;
|
|
13
14
|
customFileUsed: boolean;
|
|
15
|
+
jsMapUsed: boolean;
|
|
16
|
+
jsSetUsed: boolean;
|
|
14
17
|
inJSONEditor: boolean;
|
|
15
18
|
propsEditType: PropsEditType;
|
|
16
19
|
}) => string[];
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRenderModalWarnings = void 0;
|
|
3
|
+
exports.getRenderModalWarnings = exports.defaultTypeCanSaveState = void 0;
|
|
4
4
|
const truthy_1 = require("../../../truthy");
|
|
5
|
+
exports.defaultTypeCanSaveState = {
|
|
6
|
+
canUpdate: false,
|
|
7
|
+
reason: 'Loading...',
|
|
8
|
+
determined: false,
|
|
9
|
+
};
|
|
5
10
|
const getInputPropsWarning = ({ cliProps, propsEditType, }) => {
|
|
6
11
|
if (Object.keys(cliProps).length > 0 &&
|
|
7
12
|
propsEditType === 'default-props') {
|
|
@@ -30,12 +35,26 @@ const staticFileUsed = (used, inJSONEditor) => {
|
|
|
30
35
|
}
|
|
31
36
|
return null;
|
|
32
37
|
};
|
|
33
|
-
const
|
|
38
|
+
const mapUsed = (used, inJSONEditor) => {
|
|
39
|
+
if (used && inJSONEditor) {
|
|
40
|
+
return 'A `Map` was used in the schema which can not be serialized to JSON.';
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
const setUsed = (used, inJSONEditor) => {
|
|
45
|
+
if (used && inJSONEditor) {
|
|
46
|
+
return 'A `Set` was used in the schema which can not be serialized to JSON.';
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }) => {
|
|
34
51
|
return [
|
|
35
52
|
getInputPropsWarning({ cliProps, propsEditType }),
|
|
36
53
|
getCannotSaveDefaultProps(canSaveDefaultProps),
|
|
37
54
|
customDateUsed(isCustomDateUsed, inJSONEditor),
|
|
38
55
|
staticFileUsed(customFileUsed, inJSONEditor),
|
|
56
|
+
mapUsed(jsMapUsed, inJSONEditor),
|
|
57
|
+
setUsed(jsSetUsed, inJSONEditor),
|
|
39
58
|
].filter(truthy_1.truthy);
|
|
40
59
|
};
|
|
41
60
|
exports.getRenderModalWarnings = getRenderModalWarnings;
|
|
@@ -45,7 +45,7 @@ const isValidOutName = ({ outName, codec, audioCodec, renderMode, stillImageForm
|
|
|
45
45
|
const hasInvalidChar = () => {
|
|
46
46
|
return prefix.split('').some((char) => invalidCharacters.includes(char));
|
|
47
47
|
};
|
|
48
|
-
if (renderMode === 'video') {
|
|
48
|
+
if (renderMode === 'video' || renderMode === 'audio') {
|
|
49
49
|
client_1.BrowserSafeApis.validateOutputFilename({
|
|
50
50
|
codec,
|
|
51
51
|
audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
|
|
@@ -67,14 +67,4 @@ const isValidOutName = ({ outName, codec, audioCodec, renderMode, stillImageForm
|
|
|
67
67
|
!isValidStillExtension(extension, stillImageFormat)) {
|
|
68
68
|
throw new Error(`The extension ${extension} is not supported for still image format ${stillImageFormat}`);
|
|
69
69
|
}
|
|
70
|
-
if (renderMode === 'audio') {
|
|
71
|
-
if (audioCodec === 'pcm-16') {
|
|
72
|
-
if (extension !== 'wav' && extension !== 'wave') {
|
|
73
|
-
throw new Error(`The extension ${extension} is not supported for audio codec ${audioCodec}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (audioCodec !== extension) {
|
|
77
|
-
throw new Error(`The extension ${extension} is not supported for audio codec ${audioCodec}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
70
|
};
|
|
@@ -13,7 +13,7 @@ export declare const addStillRenderJob: ({ compositionId, outName, imageFormat,
|
|
|
13
13
|
chromiumOptions: RequiredChromiumOptions;
|
|
14
14
|
delayRenderTimeout: number;
|
|
15
15
|
envVariables: Record<string, string>;
|
|
16
|
-
inputProps: unknown
|
|
16
|
+
inputProps: Record<string, unknown>;
|
|
17
17
|
}) => Promise<undefined>;
|
|
18
18
|
export declare const addVideoRenderJob: ({ compositionId, outName, imageFormat, jpegQuality, scale, verbose, codec, concurrency, crf, startFrame, endFrame, muted, enforceAudioTrack, proResProfile, pixelFormat, audioBitrate, videoBitrate, everyNthFrame, numberOfGifLoops, delayRenderTimeout, audioCodec, disallowParallelEncoding, chromiumOptions, envVariables, inputProps, }: {
|
|
19
19
|
compositionId: string;
|
|
@@ -40,7 +40,7 @@ export declare const addVideoRenderJob: ({ compositionId, outName, imageFormat,
|
|
|
40
40
|
disallowParallelEncoding: boolean;
|
|
41
41
|
chromiumOptions: RequiredChromiumOptions;
|
|
42
42
|
envVariables: Record<string, string>;
|
|
43
|
-
inputProps: unknown
|
|
43
|
+
inputProps: Record<string, unknown>;
|
|
44
44
|
}) => Promise<undefined>;
|
|
45
45
|
export declare const unsubscribeFromFileExistenceWatcher: ({ file, clientId, }: {
|
|
46
46
|
file: string;
|
|
@@ -55,5 +55,5 @@ export declare const openInFileExplorer: ({ directory }: {
|
|
|
55
55
|
}) => Promise<void>;
|
|
56
56
|
export declare const removeRenderJob: (job: RenderJob) => Promise<undefined>;
|
|
57
57
|
export declare const cancelRenderJob: (job: RenderJob) => Promise<import("../../../preview-server/render-queue/job").CancelRenderResponse>;
|
|
58
|
-
export declare const updateDefaultProps: (compositionId: string, defaultProps: unknown, enumPaths: EnumPath[]) => Promise<
|
|
58
|
+
export declare const updateDefaultProps: (compositionId: string, defaultProps: unknown, enumPaths: EnumPath[]) => Promise<import("../../../preview-server/render-queue/job").UpdateDefaultPropsResponse>;
|
|
59
59
|
export declare const canUpdateDefaultProps: (compositionId: string) => Promise<import("../../../preview-server/render-queue/job").CanUpdateDefaultPropsResponse>;
|
|
@@ -16,16 +16,16 @@ const container = {
|
|
|
16
16
|
flexDirection: 'column',
|
|
17
17
|
};
|
|
18
18
|
const PropsEditor = ({ composition }) => {
|
|
19
|
-
var _a;
|
|
20
19
|
const { props, updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
21
20
|
const setInputProps = (0, react_1.useCallback)((newProps) => {
|
|
22
21
|
updateProps({
|
|
23
22
|
id: composition.id,
|
|
24
23
|
defaultProps: composition.defaultProps,
|
|
25
|
-
newProps
|
|
24
|
+
newProps,
|
|
26
25
|
});
|
|
27
26
|
}, [composition.defaultProps, composition.id, updateProps]);
|
|
28
|
-
|
|
27
|
+
const actualProps = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = props[composition.id]) !== null && _a !== void 0 ? _a : composition.defaultProps) !== null && _b !== void 0 ? _b : {}; }, [composition.defaultProps, composition.id, props]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(RenderModalData_1.RenderModalData, { composition: composition, inputProps: actualProps, setInputProps: setInputProps, compact: true, mayShowSaveButton: true, propsEditType: "default-props" }));
|
|
29
29
|
};
|
|
30
30
|
const localStorageKey = 'remotion.sidebarPanel';
|
|
31
31
|
const getSelectedPanel = () => {
|
|
@@ -72,6 +72,8 @@ const SidebarRenderButton = ({ composition, visible }) => {
|
|
|
72
72
|
initialHeadless: defaults.headless,
|
|
73
73
|
initialIgnoreCertificateErrors: defaults.ignoreCertificateErrors,
|
|
74
74
|
defaultProps: (_a = props[composition.id]) !== null && _a !== void 0 ? _a : composition.defaultProps,
|
|
75
|
+
inFrameMark: null,
|
|
76
|
+
outFrameMark: null,
|
|
75
77
|
});
|
|
76
78
|
}, [composition.defaultProps, composition.id, isVideo, props, setSelectedModal]);
|
|
77
79
|
const renderAction = (0, react_1.useCallback)((color) => {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Spinner = 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 viewBox = 100;
|
|
8
|
+
const lines = 6;
|
|
9
|
+
const className = '__remotion_spinner_line';
|
|
10
|
+
const remotionSpinnerAnimation = '__remotion_spinner_animation';
|
|
11
|
+
// Generated from https://github.com/remotion-dev/template-next/commit/9282c93f7c51ada31a42e18a94680fa09a14eee3
|
|
12
|
+
const translated = 'M 44 0 L 50 0 a 6 6 0 0 1 6 6 L 56 26 a 6 6 0 0 1 -6 6 L 50 32 a 6 6 0 0 1 -6 -6 L 44 6 a 6 6 0 0 1 6 -6 Z';
|
|
13
|
+
const totalDuration = 0.5;
|
|
14
|
+
const Spinner = ({ size }) => {
|
|
15
|
+
const style = (0, react_1.useMemo)(() => {
|
|
16
|
+
return {
|
|
17
|
+
width: size,
|
|
18
|
+
height: size,
|
|
19
|
+
};
|
|
20
|
+
}, [size]);
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { type: "text/css", children: `
|
|
22
|
+
@keyframes ${remotionSpinnerAnimation} {
|
|
23
|
+
0% {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
100% {
|
|
27
|
+
opacity: 0.15;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${className} {
|
|
32
|
+
animation: ${remotionSpinnerAnimation} ${totalDuration}s linear infinite;
|
|
33
|
+
}
|
|
34
|
+
` }), (0, jsx_runtime_1.jsx)("svg", { style: style, viewBox: `0 0 ${viewBox} ${viewBox}`, children: new Array(lines).fill(true).map((_, index) => {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("path", { className: className, style: {
|
|
36
|
+
rotate: `${(index * Math.PI * 2) / lines}rad`,
|
|
37
|
+
transformOrigin: 'center center',
|
|
38
|
+
animationDelay: `${index * (totalDuration / lines) - totalDuration}s`,
|
|
39
|
+
}, d: translated, fill: colors_1.LIGHT_TEXT }, index));
|
|
40
|
+
}) })] }));
|
|
41
|
+
};
|
|
42
|
+
exports.Spinner = Spinner;
|