@remotion/cli 3.3.79 → 3.3.81
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 +5 -0
- package/dist/codemods/update-default-props.js +144 -0
- package/dist/convert-entry-point-to-serve-url.d.ts +1 -0
- package/dist/convert-entry-point-to-serve-url.js +15 -0
- package/dist/editor/components/Checkbox.d.ts +6 -0
- package/dist/editor/components/Checkbox.js +42 -0
- package/dist/editor/components/CollapsableOptions.d.ts +6 -0
- package/dist/editor/components/CollapsableOptions.js +35 -0
- package/dist/editor/components/CollapsedSidebarExpander.d.ts +5 -0
- package/dist/editor/components/CollapsedSidebarExpander.js +41 -0
- package/dist/editor/components/CurrentCompositionSideEffects.d.ts +3 -0
- package/dist/editor/components/CurrentCompositionSideEffects.js +51 -0
- package/dist/editor/components/InlineAction.d.ts +5 -0
- package/dist/editor/components/InlineAction.js +35 -0
- package/dist/editor/components/Modals.d.ts +2 -0
- package/dist/editor/components/Modals.js +23 -0
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +7 -0
- package/dist/editor/components/NewComposition/RemTextarea.js +92 -0
- package/dist/editor/components/RenderButton.d.ts +6 -0
- package/dist/editor/components/RenderButton.js +73 -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 +16 -0
- package/dist/editor/components/RenderModal/CrfSetting.js +43 -0
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.d.ts +8 -0
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +16 -0
- package/dist/editor/components/RenderModal/EnvInput.d.ts +11 -0
- package/dist/editor/components/RenderModal/EnvInput.js +74 -0
- package/dist/editor/components/RenderModal/FrameRangeSetting.d.ts +8 -0
- package/dist/editor/components/RenderModal/FrameRangeSetting.js +42 -0
- package/dist/editor/components/RenderModal/GuiRenderStatus.d.ts +5 -0
- package/dist/editor/components/RenderModal/GuiRenderStatus.js +78 -0
- package/dist/editor/components/RenderModal/InfoBubble.d.ts +5 -0
- package/dist/editor/components/RenderModal/InfoBubble.js +115 -0
- package/dist/editor/components/RenderModal/InfoTooltip.d.ts +5 -0
- package/dist/editor/components/RenderModal/InfoTooltip.js +40 -0
- package/dist/editor/components/RenderModal/InlineEyeIcon.d.ts +5 -0
- package/dist/editor/components/RenderModal/InlineEyeIcon.js +14 -0
- package/dist/editor/components/RenderModal/InlineRemoveButton.d.ts +4 -0
- package/dist/editor/components/RenderModal/InlineRemoveButton.js +12 -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 +8 -0
- package/dist/editor/components/RenderModal/MutedSetting.js +16 -0
- package/dist/editor/components/RenderModal/NumberOfLoopsSetting.d.ts +5 -0
- package/dist/editor/components/RenderModal/NumberOfLoopsSetting.js +26 -0
- package/dist/editor/components/RenderModal/NumberSetting.d.ts +12 -0
- package/dist/editor/components/RenderModal/NumberSetting.js +29 -0
- package/dist/editor/components/RenderModal/OptionExplainer.d.ts +5 -0
- package/dist/editor/components/RenderModal/OptionExplainer.js +45 -0
- package/dist/editor/components/RenderModal/RenderModal.d.ts +34 -0
- package/dist/editor/components/RenderModal/RenderModal.js +566 -0
- package/dist/editor/components/RenderModal/RenderModalAdvanced.d.ts +26 -0
- package/dist/editor/components/RenderModal/RenderModalAdvanced.js +59 -0
- package/dist/editor/components/RenderModal/RenderModalAudio.d.ts +17 -0
- package/dist/editor/components/RenderModal/RenderModalAudio.js +46 -0
- package/dist/editor/components/RenderModal/RenderModalBasic.d.ts +23 -0
- package/dist/editor/components/RenderModal/RenderModalBasic.js +79 -0
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +9 -0
- package/dist/editor/components/RenderModal/RenderModalData.js +63 -0
- package/dist/editor/components/RenderModal/RenderModalEnvironmentVariables.d.ts +5 -0
- package/dist/editor/components/RenderModal/RenderModalEnvironmentVariables.js +55 -0
- package/dist/editor/components/RenderModal/RenderModalGif.d.ts +9 -0
- package/dist/editor/components/RenderModal/RenderModalGif.js +19 -0
- package/dist/editor/components/RenderModal/RenderModalHr.d.ts +2 -0
- package/dist/editor/components/RenderModal/RenderModalHr.js +18 -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 +10 -0
- package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.js +98 -0
- package/dist/editor/components/RenderModal/RenderModalPicture.d.ts +28 -0
- package/dist/editor/components/RenderModal/RenderModalPicture.js +56 -0
- package/dist/editor/components/RenderModal/RenderStatusModal.d.ts +4 -0
- package/dist/editor/components/RenderModal/RenderStatusModal.js +72 -0
- package/dist/editor/components/RenderModal/ScaleSetting.d.ts +5 -0
- package/dist/editor/components/RenderModal/ScaleSetting.js +17 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +12 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +70 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEmptyStateGraphic.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEmptyStateGraphic.js +15 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +15 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +41 -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 +71 -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 +76 -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/ZodEnumEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +69 -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 +27 -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 +61 -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/schema-serialization.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.js +21 -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/human-readable-audio-codecs.d.ts +2 -0
- package/dist/editor/components/RenderModal/human-readable-audio-codecs.js +18 -0
- package/dist/editor/components/RenderModal/human-readable-codec.d.ts +2 -0
- package/dist/editor/components/RenderModal/human-readable-codec.js +36 -0
- package/dist/editor/components/RenderModal/layout.d.ts +7 -0
- package/dist/editor/components/RenderModal/layout.js +46 -0
- package/dist/editor/components/RenderModal/out-name-checker.d.ts +15 -0
- package/dist/editor/components/RenderModal/out-name-checker.js +80 -0
- package/dist/editor/components/RenderQueue/CircularProgress.d.ts +5 -0
- package/dist/editor/components/RenderQueue/CircularProgress.js +18 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueError.js +26 -0
- package/dist/editor/components/RenderQueue/RenderQueueItem.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueItem.js +40 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.js +22 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemStatus.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueItemStatus.js +43 -0
- package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.js +22 -0
- package/dist/editor/components/RenderQueue/RenderQueueOutputName.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueOutputName.js +26 -0
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueProgressMessage.js +26 -0
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +33 -0
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.d.ts +5 -0
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.js +22 -0
- 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 +59 -0
- package/dist/editor/components/RenderQueue/actions.js +114 -0
- package/dist/editor/components/RenderQueue/context.d.ts +18 -0
- package/dist/editor/components/RenderQueue/context.js +49 -0
- package/dist/editor/components/RenderQueue/index.d.ts +2 -0
- package/dist/editor/components/RenderQueue/index.js +19 -0
- package/dist/editor/components/RenderQueue/item-style.d.ts +2 -0
- package/dist/editor/components/RenderQueue/item-style.js +21 -0
- package/dist/editor/components/RenderToolbarIcon.d.ts +2 -0
- package/dist/editor/components/RenderToolbarIcon.js +84 -0
- package/dist/editor/components/RendersTab.d.ts +6 -0
- package/dist/editor/components/RendersTab.js +43 -0
- package/dist/editor/components/RightPanel.d.ts +8 -0
- package/dist/editor/components/RightPanel.js +81 -0
- package/dist/editor/components/SegmentedControl.d.ts +16 -0
- package/dist/editor/components/SegmentedControl.js +63 -0
- package/dist/editor/components/Tabs/index.d.ts +11 -0
- package/dist/editor/components/Tabs/index.js +51 -0
- package/dist/editor/helpers/client-id.d.ts +17 -0
- package/dist/editor/helpers/client-id.js +46 -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/prores-labels.d.ts +2 -0
- package/dist/editor/helpers/prores-labels.js +25 -0
- package/dist/editor/helpers/render-modal-sections.d.ts +9 -0
- package/dist/editor/helpers/render-modal-sections.js +32 -0
- package/dist/editor/helpers/use-breakpoint.d.ts +1 -0
- package/dist/editor/helpers/use-breakpoint.js +17 -0
- package/dist/editor/helpers/use-file-existence.d.ts +1 -0
- package/dist/editor/helpers/use-file-existence.js +66 -0
- package/dist/editor/icons/RenderStillIcon.d.ts +3 -0
- package/dist/editor/icons/RenderStillIcon.js +8 -0
- package/dist/editor/icons/audio.d.ts +2 -0
- package/dist/editor/icons/audio.js +6 -0
- package/dist/editor/icons/data.d.ts +2 -0
- package/dist/editor/icons/data.js +8 -0
- package/dist/editor/icons/file.d.ts +2 -0
- package/dist/editor/icons/file.js +6 -0
- package/dist/editor/icons/frame.d.ts +2 -0
- package/dist/editor/icons/frame.js +6 -0
- package/dist/editor/icons/gear.d.ts +2 -0
- package/dist/editor/icons/gear.js +6 -0
- package/dist/editor/icons/gif.d.ts +2 -0
- package/dist/editor/icons/gif.js +6 -0
- package/dist/editor/icons/render.d.ts +8 -0
- package/dist/editor/icons/render.js +12 -0
- package/dist/editor/icons/video.d.ts +5 -0
- package/dist/editor/icons/video.js +8 -0
- package/dist/ffmpeg.d.ts +2 -0
- package/dist/ffmpeg.js +21 -0
- package/dist/file-watcher.d.ts +9 -0
- package/dist/file-watcher.js +35 -0
- package/dist/get-default-out-name.d.ts +5 -0
- package/dist/get-default-out-name.js +10 -0
- package/dist/preview-server/api-routes.d.ts +4 -0
- package/dist/preview-server/api-routes.js +19 -0
- package/dist/preview-server/api-types.d.ts +28 -0
- package/dist/preview-server/api-types.js +2 -0
- package/dist/preview-server/file-existence-watchers.d.ts +13 -0
- package/dist/preview-server/file-existence-watchers.js +62 -0
- package/dist/preview-server/handler.d.ts +9 -0
- package/dist/preview-server/handler.js +34 -0
- package/dist/preview-server/parse-body.d.ts +2 -0
- package/dist/preview-server/parse-body.js +16 -0
- package/dist/preview-server/render-queue/get-default-video-contexts.d.ts +10 -0
- package/dist/preview-server/render-queue/get-default-video-contexts.js +13 -0
- package/dist/preview-server/render-queue/job.d.ts +129 -0
- package/dist/preview-server/render-queue/job.js +2 -0
- package/dist/preview-server/render-queue/make-retry-payload.d.ts +3 -0
- package/dist/preview-server/render-queue/make-retry-payload.js +89 -0
- package/dist/preview-server/render-queue/open-directory-in-finder.d.ts +1 -0
- package/dist/preview-server/render-queue/open-directory-in-finder.js +43 -0
- package/dist/preview-server/render-queue/process-still.d.ts +8 -0
- package/dist/preview-server/render-queue/process-still.js +46 -0
- package/dist/preview-server/render-queue/process-video.d.ts +8 -0
- package/dist/preview-server/render-queue/process-video.js +63 -0
- package/dist/preview-server/render-queue/queue.d.ts +21 -0
- package/dist/preview-server/render-queue/queue.js +208 -0
- package/dist/preview-server/routes/add-render.d.ts +3 -0
- package/dist/preview-server/routes/add-render.js +76 -0
- package/dist/preview-server/routes/cancel-render.d.ts +3 -0
- package/dist/preview-server/routes/cancel-render.js +9 -0
- package/dist/preview-server/routes/open-in-file-explorer.d.ts +3 -0
- package/dist/preview-server/routes/open-in-file-explorer.js +8 -0
- package/dist/preview-server/routes/remove-render.d.ts +3 -0
- package/dist/preview-server/routes/remove-render.js +9 -0
- package/dist/preview-server/routes/subscribe-to-file-existence.d.ts +3 -0
- package/dist/preview-server/routes/subscribe-to-file-existence.js +13 -0
- package/dist/preview-server/routes/unsubscribe-from-file-existence.d.ts +3 -0
- package/dist/preview-server/routes/unsubscribe-from-file-existence.js +13 -0
- 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/progress-types.d.ts +32 -0
- package/dist/progress-types.js +17 -0
- package/dist/render-flows/render.d.ts +47 -0
- package/dist/render-flows/render.js +290 -0
- package/dist/render-flows/still.d.ts +29 -0
- package/dist/render-flows/still.js +168 -0
- package/dist/required-chromium-options.d.ts +3 -0
- package/dist/required-chromium-options.js +2 -0
- package/package.json +6 -6
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodEffectEditor = 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 ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
9
|
+
const ZodSwitch_1 = require("./ZodSwitch");
|
|
10
|
+
const fullWidth = {
|
|
11
|
+
width: '100%',
|
|
12
|
+
};
|
|
13
|
+
const ZodEffectEditor = ({ schema, jsonPath, value, setValue: updateValue, compact, defaultValue, onSave, onRemove, showSaveButton, }) => {
|
|
14
|
+
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
15
|
+
return {
|
|
16
|
+
value,
|
|
17
|
+
zodValidation: schema.safeParse(value),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const def = schema._def;
|
|
21
|
+
const typeName = def.typeName;
|
|
22
|
+
if (typeName !== remotion_1.z.ZodFirstPartyTypeKind.ZodEffects) {
|
|
23
|
+
throw new Error('expected effect');
|
|
24
|
+
}
|
|
25
|
+
const onChange = (0, react_1.useCallback)((newValue) => {
|
|
26
|
+
setLocalValue(() => {
|
|
27
|
+
const safeParse = schema.safeParse(newValue);
|
|
28
|
+
if (safeParse.success) {
|
|
29
|
+
updateValue(() => newValue);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
value: newValue,
|
|
33
|
+
zodValidation: safeParse,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}, [schema, updateValue]);
|
|
37
|
+
const container = (0, react_1.useMemo)(() => {
|
|
38
|
+
if (!localValue.zodValidation.success) {
|
|
39
|
+
return {
|
|
40
|
+
border: `1px solid ${colors_1.FAIL_COLOR}`,
|
|
41
|
+
borderRadius: 4,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
border: 'none',
|
|
46
|
+
padding: 0,
|
|
47
|
+
};
|
|
48
|
+
}, [localValue.zodValidation.success]);
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("fieldset", { style: container, children: [(0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onChange, jsonPath: jsonPath, schema: def.schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsx)("legend", { children: (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" }) }))] }));
|
|
50
|
+
};
|
|
51
|
+
exports.ZodEffectEditor = ZodEffectEditor;
|
|
@@ -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 ZodEnumEditor: 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: (oldState: string) => string) => void;
|
|
11
|
+
compact: boolean;
|
|
12
|
+
showSaveButton: boolean;
|
|
13
|
+
onRemove: null | (() => void);
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZodEnumEditor = 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 Checkmark_1 = require("../../../icons/Checkmark");
|
|
8
|
+
const layout_1 = require("../../layout");
|
|
9
|
+
const ComboBox_1 = require("../../NewComposition/ComboBox");
|
|
10
|
+
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
11
|
+
const layout_2 = require("../layout");
|
|
12
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
13
|
+
const container = {
|
|
14
|
+
width: '100%',
|
|
15
|
+
};
|
|
16
|
+
// TODO: Long values break the layout
|
|
17
|
+
const ZodEnumEditor = ({ schema, jsonPath, compact, setValue: updateValue, defaultValue, value, onSave, showSaveButton, onRemove, }) => {
|
|
18
|
+
const [localValue, setLocalValue] = (0, react_1.useState)(() => {
|
|
19
|
+
return {
|
|
20
|
+
value,
|
|
21
|
+
zodValidation: schema.safeParse(value),
|
|
22
|
+
revision: 0,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
const def = schema._def;
|
|
26
|
+
const typeName = def.typeName;
|
|
27
|
+
if (typeName !== remotion_1.z.ZodFirstPartyTypeKind.ZodEnum) {
|
|
28
|
+
throw new Error('expected enum');
|
|
29
|
+
}
|
|
30
|
+
const isRoot = jsonPath.length === 0;
|
|
31
|
+
const onChange = (0, react_1.useCallback)((updater) => {
|
|
32
|
+
setLocalValue((oldLocalState) => {
|
|
33
|
+
const newValue = updater(oldLocalState.value);
|
|
34
|
+
const safeParse = schema.safeParse(newValue);
|
|
35
|
+
if (safeParse.success) {
|
|
36
|
+
updateValue(updater);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
value: newValue,
|
|
40
|
+
zodValidation: safeParse,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}, [schema, updateValue]);
|
|
44
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
45
|
+
onChange(() => defaultValue);
|
|
46
|
+
}, [defaultValue, onChange]);
|
|
47
|
+
const comboBoxValues = (0, react_1.useMemo)(() => {
|
|
48
|
+
return def.values.map((option) => {
|
|
49
|
+
return {
|
|
50
|
+
value: option,
|
|
51
|
+
label: option,
|
|
52
|
+
id: option,
|
|
53
|
+
keyHint: null,
|
|
54
|
+
leftItem: option === value ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
55
|
+
onClick: (id) => {
|
|
56
|
+
onChange(() => id);
|
|
57
|
+
},
|
|
58
|
+
quickSwitcherLabel: null,
|
|
59
|
+
subMenu: null,
|
|
60
|
+
type: 'item',
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}, [def.values, onChange, value]);
|
|
64
|
+
const save = (0, react_1.useCallback)(() => {
|
|
65
|
+
onSave(() => value);
|
|
66
|
+
}, [onSave, value]);
|
|
67
|
+
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 }), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: 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-end", message: localValue.zodValidation.error.format()._errors[0], type: "error" })] }))] }));
|
|
68
|
+
};
|
|
69
|
+
exports.ZodEnumEditor = ZodEnumEditor;
|
|
@@ -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.length === 0 ? 'Root' : error.path.join('.') }), ": ", error.message] }, error.path.join('.')));
|
|
21
|
+
}) }));
|
|
22
|
+
};
|
|
23
|
+
exports.ZodErrorMessages = ZodErrorMessages;
|
|
@@ -0,0 +1,27 @@
|
|
|
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.VERY_LIGHT_TEXT,
|
|
15
|
+
fontFamily: 'sans-serif',
|
|
16
|
+
fontSize: 14,
|
|
17
|
+
};
|
|
18
|
+
const wideEmptyLabel = {
|
|
19
|
+
...emptyLabel,
|
|
20
|
+
lineHeight: '37px',
|
|
21
|
+
};
|
|
22
|
+
const ZonNonEditableValue = ({ jsonPath, label, compact, showSaveButton }) => {
|
|
23
|
+
const save = (0, react_1.useCallback)(() => undefined, []);
|
|
24
|
+
const reset = (0, react_1.useCallback)(() => undefined, []);
|
|
25
|
+
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: compact ? emptyLabel : wideEmptyLabel, children: label }) })] }));
|
|
26
|
+
};
|
|
27
|
+
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,61 @@
|
|
|
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 ZodEnumEditor_1 = require("./ZodEnumEditor");
|
|
11
|
+
const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
|
|
12
|
+
const ZodNumberEditor_1 = require("./ZodNumberEditor");
|
|
13
|
+
const ZodObjectEditor_1 = require("./ZodObjectEditor");
|
|
14
|
+
const ZodStringEditor_1 = require("./ZodStringEditor");
|
|
15
|
+
const ZodSwitch = ({ schema, jsonPath, compact, value, setValue, defaultValue, onSave, showSaveButton, onRemove, }) => {
|
|
16
|
+
const def = schema._def;
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
const typeName = def.typeName;
|
|
19
|
+
// TODO: (Maybe?) enable saving of inserted input props by cmd+s /ctrl + s (also for JSON view)
|
|
20
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodObject) {
|
|
21
|
+
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 }));
|
|
22
|
+
}
|
|
23
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodString) {
|
|
24
|
+
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 }));
|
|
25
|
+
}
|
|
26
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodDate) {
|
|
27
|
+
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 }));
|
|
28
|
+
}
|
|
29
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodNumber) {
|
|
30
|
+
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 }));
|
|
31
|
+
}
|
|
32
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodBoolean) {
|
|
33
|
+
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 }));
|
|
34
|
+
}
|
|
35
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodUndefined) {
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'undefined' }));
|
|
37
|
+
}
|
|
38
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodNull) {
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'null' }));
|
|
40
|
+
}
|
|
41
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodAny) {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'any (not editable)' }));
|
|
43
|
+
}
|
|
44
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodBigInt) {
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'BigInt (not editable)' }));
|
|
46
|
+
}
|
|
47
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodUnknown) {
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'unknown (not editable)' }));
|
|
49
|
+
}
|
|
50
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodArray) {
|
|
51
|
+
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 }));
|
|
52
|
+
}
|
|
53
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodEnum) {
|
|
54
|
+
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 }));
|
|
55
|
+
}
|
|
56
|
+
if (typeName === remotion_1.z.ZodFirstPartyTypeKind.ZodEffects) {
|
|
57
|
+
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 }));
|
|
58
|
+
}
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { compact: compact, jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)` }));
|
|
60
|
+
};
|
|
61
|
+
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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeJSONWithSchema = exports.serializeJSONWithSchema = void 0;
|
|
4
|
+
const serializeJSONWithSchema = (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.serializeJSONWithSchema = serializeJSONWithSchema;
|
|
13
|
+
const deserializeJSONWithSchema = (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.deserializeJSONWithSchema = deserializeJSONWithSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type JSONPath = (string | number)[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.humanReadableAudioCodec = void 0;
|
|
4
|
+
const humanReadableAudioCodec = (audioCodec) => {
|
|
5
|
+
if (audioCodec === 'aac') {
|
|
6
|
+
return 'AAC';
|
|
7
|
+
}
|
|
8
|
+
if (audioCodec === 'mp3') {
|
|
9
|
+
return 'MP3';
|
|
10
|
+
}
|
|
11
|
+
if (audioCodec === 'pcm-16') {
|
|
12
|
+
return 'Lossless';
|
|
13
|
+
}
|
|
14
|
+
if (audioCodec === 'opus') {
|
|
15
|
+
return 'Opus';
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.humanReadableAudioCodec = humanReadableAudioCodec;
|