@remotion/studio 4.0.424 → 4.0.426
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/api/create-composition.d.ts +1 -2
- package/dist/api/helpers/calc-new-props.d.ts +1 -2
- package/dist/components/AssetSelector.js +1 -1
- package/dist/components/AssetSelectorItem.d.ts +1 -0
- package/dist/components/AssetSelectorItem.js +9 -8
- package/dist/components/InitialCompositionLoader.js +13 -1
- package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
- package/dist/components/NewComposition/CodemodFooter.js +3 -1
- package/dist/components/NewComposition/DeleteComposition.js +1 -1
- package/dist/components/NewComposition/DuplicateComposition.js +5 -1
- package/dist/components/NewComposition/RenameComposition.js +1 -1
- package/dist/components/RenderModal/DataEditor.d.ts +2 -1
- package/dist/components/RenderModal/DataEditor.js +6 -6
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/vertical.js +2 -0
- package/dist/components/TimeValue.js +0 -2
- package/dist/components/Timeline/TimelineDragHandler.js +6 -0
- package/dist/components/get-zod-if-possible.d.ts +3 -0
- package/dist/components/get-zod-if-possible.js +23 -2
- package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
- package/dist/esm/index.mjs +170 -81
- package/dist/esm/internals.mjs +589 -373
- package/dist/esm/previewEntry.mjs +598 -375
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/previewEntry.d.ts +5 -0
- package/dist/previewEntry.js +11 -2
- package/dist/visual-controls/VisualControls.d.ts +4 -4
- package/dist/visual-controls/VisualControls.js +1 -1
- package/package.json +11 -11
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CompositionProps, StillProps } from 'remotion';
|
|
2
|
-
import type { AnyZodObject } from 'zod';
|
|
1
|
+
import type { AnyZodObject, CompositionProps, StillProps } from 'remotion';
|
|
3
2
|
export declare const createComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>({ ...other }: CompositionProps<Schema, Props>) => () => import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export declare const createStill: <Schema extends AnyZodObject, Props extends Record<string, unknown>>({ ...other }: StillProps<Schema, Props>) => () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AnyComposition } from 'remotion';
|
|
2
|
-
import type { AnyZodObject } from 'zod';
|
|
1
|
+
import type { AnyComposition, AnyZodObject } from 'remotion';
|
|
3
2
|
export type UpdateDefaultPropsFunction = (currentValues: {
|
|
4
3
|
schema: AnyZodObject | null;
|
|
5
4
|
savedDefaultProps: Record<string, unknown>;
|
|
@@ -123,6 +123,6 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
123
123
|
" in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
|
|
124
124
|
...list,
|
|
125
125
|
backgroundColor: isDropDiv ? colors_1.CLEAR_HOVER : colors_1.BACKGROUND,
|
|
126
|
-
}, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation }) }))] }));
|
|
126
|
+
}, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }) }))] }));
|
|
127
127
|
};
|
|
128
128
|
exports.AssetSelector = AssetSelector;
|
|
@@ -9,4 +9,5 @@ export declare const AssetFolderTree: React.FC<{
|
|
|
9
9
|
readonly toggleFolder: (folderName: string, parentName: string | null) => void;
|
|
10
10
|
readonly dropLocation: string | null;
|
|
11
11
|
readonly setDropLocation: React.Dispatch<React.SetStateAction<string | null>>;
|
|
12
|
+
readonly readOnlyStudio: boolean;
|
|
12
13
|
}>;
|
|
@@ -92,7 +92,7 @@ const revealIconStyle = {
|
|
|
92
92
|
height: 12,
|
|
93
93
|
color: 'currentColor',
|
|
94
94
|
};
|
|
95
|
-
const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, }) => {
|
|
95
|
+
const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, }) => {
|
|
96
96
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
97
97
|
const openFolderTimerRef = (0, react_1.useRef)(null);
|
|
98
98
|
const { isDropDiv, onDragEnter, onDragLeave } = (0, use_asset_drag_events_1.default)({
|
|
@@ -139,20 +139,20 @@ const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dr
|
|
|
139
139
|
}
|
|
140
140
|
}, children: jsx_runtime_1.jsxs(layout_1.Row, { children: [
|
|
141
141
|
jsx_runtime_1.jsx(Icon, { style: iconStyle, color: hovered ? 'white' : colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name })
|
|
142
|
-
] }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation }, item.name)) : null] }));
|
|
142
|
+
] }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, item.name)) : null] }));
|
|
143
143
|
};
|
|
144
|
-
const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, }) => {
|
|
144
|
+
const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, }) => {
|
|
145
145
|
const combinedParents = (0, react_1.useMemo)(() => {
|
|
146
146
|
return [parentFolder, name].filter(no_react_1.NoReactInternals.truthy).join('/');
|
|
147
147
|
}, [name, parentFolder]);
|
|
148
148
|
return (jsx_runtime_1.jsxs("div", { children: [item.folders.map((folder) => {
|
|
149
|
-
return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation }, folder.name));
|
|
149
|
+
return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, folder.name));
|
|
150
150
|
}), item.files.map((file) => {
|
|
151
|
-
return (jsx_runtime_1.jsx(AssetSelectorItem, { item: file, tabIndex: tabIndex, level: level, parentFolder: combinedParents }, file.src));
|
|
151
|
+
return (jsx_runtime_1.jsx(AssetSelectorItem, { item: file, tabIndex: tabIndex, level: level, parentFolder: combinedParents, readOnlyStudio: readOnlyStudio }, file.src));
|
|
152
152
|
})] }));
|
|
153
153
|
};
|
|
154
154
|
exports.AssetFolderTree = AssetFolderTree;
|
|
155
|
-
const AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
|
|
155
|
+
const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
|
|
156
156
|
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
157
157
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
158
158
|
const { setSidebarCollapsedState } = (0, react_1.useContext)(sidebar_1.SidebarContext);
|
|
@@ -238,6 +238,7 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
|
|
|
238
238
|
}, [item.name, parentFolder]);
|
|
239
239
|
return (jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, tabIndex: tabIndex, title: item.name, children: [
|
|
240
240
|
jsx_runtime_1.jsx(file_1.FileIcon, { style: iconStyle, color: colors_1.LIGHT_TEXT }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: label, children: item.name }), hovered ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
241
|
-
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() name", renderAction: renderCopyAction, onClick: copyToClipboard }),
|
|
242
|
-
|
|
241
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Copy staticFile() name", renderAction: renderCopyAction, onClick: copyToClipboard }), readOnlyStudio ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
242
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { title: "Open in Explorer", renderAction: renderFileExplorerAction, onClick: revealInExplorer })
|
|
243
|
+
] }))] })) : null] }) }));
|
|
243
244
|
};
|
|
@@ -77,10 +77,22 @@ const InitialCompositionLoader = () => {
|
|
|
77
77
|
const selectAsset = (0, exports.useSelectAsset)();
|
|
78
78
|
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
79
79
|
(0, react_1.useEffect)(() => {
|
|
80
|
+
const canvasContentFromUrl = (0, load_canvas_content_from_url_1.deriveCanvasContentFromUrl)();
|
|
80
81
|
if (canvasContent) {
|
|
82
|
+
// If the URL points to a different composition than the one currently
|
|
83
|
+
// displayed, switch to it. This handles the case where the URL is
|
|
84
|
+
// updated externally (e.g. after duplicating a composition).
|
|
85
|
+
if (canvasContentFromUrl &&
|
|
86
|
+
canvasContentFromUrl.type === 'composition' &&
|
|
87
|
+
canvasContent.type === 'composition' &&
|
|
88
|
+
canvasContentFromUrl.compositionId !== canvasContent.compositionId) {
|
|
89
|
+
const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
|
|
90
|
+
if (exists) {
|
|
91
|
+
selectComposition(exists, false);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
81
94
|
return;
|
|
82
95
|
}
|
|
83
|
-
const canvasContentFromUrl = (0, load_canvas_content_from_url_1.deriveCanvasContentFromUrl)();
|
|
84
96
|
if (canvasContentFromUrl && canvasContentFromUrl.type === 'composition') {
|
|
85
97
|
const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
|
|
86
98
|
if (exists) {
|
|
@@ -11,7 +11,7 @@ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
|
11
11
|
const actions_1 = require("../RenderQueue/actions");
|
|
12
12
|
const layout_1 = require("../layout");
|
|
13
13
|
const DiffPreview_1 = require("./DiffPreview");
|
|
14
|
-
const CodemodFooter = ({ codemod, valid, loadingNotification, successNotification, errorNotification, genericSubmitLabel, submitLabel, }) => {
|
|
14
|
+
const CodemodFooter = ({ codemod, valid, loadingNotification, successNotification, errorNotification, genericSubmitLabel, submitLabel, onSuccess, }) => {
|
|
15
15
|
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
16
16
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
17
17
|
const [codemodStatus, setCanApplyCodemod] = (0, react_1.useState)({
|
|
@@ -42,6 +42,7 @@ const CodemodFooter = ({ codemod, valid, loadingNotification, successNotificatio
|
|
|
42
42
|
})
|
|
43
43
|
.then(() => {
|
|
44
44
|
notification.replaceContent(successNotification, 2000);
|
|
45
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
45
46
|
})
|
|
46
47
|
.catch((err) => {
|
|
47
48
|
notification.replaceContent(`${errorNotification}: ${err.message}`, 2000);
|
|
@@ -50,6 +51,7 @@ const CodemodFooter = ({ codemod, valid, loadingNotification, successNotificatio
|
|
|
50
51
|
codemod,
|
|
51
52
|
errorNotification,
|
|
52
53
|
loadingNotification,
|
|
54
|
+
onSuccess,
|
|
53
55
|
setSelectedModal,
|
|
54
56
|
successNotification,
|
|
55
57
|
]);
|
|
@@ -36,7 +36,7 @@ const DeleteCompositionLoaded = ({ compositionId }) => {
|
|
|
36
36
|
jsx_runtime_1.jsx("br", {}),
|
|
37
37
|
"The associated ",
|
|
38
38
|
jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "component" }),
|
|
39
|
-
" will remain in your code."] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { errorNotification: `Could not delete composition`, loadingNotification: 'Deleting', successNotification: `Deleted ${unresolved.id}`, genericSubmitLabel: `Delete`, submitLabel: ({ relativeRootPath }) => `Delete from ${relativeRootPath}`, codemod: codemod, valid: true }) })
|
|
39
|
+
" will remain in your code."] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { errorNotification: `Could not delete composition`, loadingNotification: 'Deleting', successNotification: `Deleted ${unresolved.id}`, genericSubmitLabel: `Delete`, submitLabel: ({ relativeRootPath }) => `Delete from ${relativeRootPath}`, codemod: codemod, valid: true, onSuccess: null }) })
|
|
40
40
|
] })
|
|
41
41
|
] }));
|
|
42
42
|
};
|
|
@@ -4,6 +4,7 @@ exports.DuplicateComposition = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const url_state_1 = require("../../helpers/url-state");
|
|
7
8
|
const validate_new_comp_data_1 = require("../../helpers/validate-new-comp-data");
|
|
8
9
|
const ModalFooter_1 = require("../ModalFooter");
|
|
9
10
|
const ModalHeader_1 = require("../ModalHeader");
|
|
@@ -166,6 +167,9 @@ const DuplicateCompositionLoaded = ({ initialType }) => {
|
|
|
166
167
|
size.width,
|
|
167
168
|
type,
|
|
168
169
|
]);
|
|
170
|
+
const onDuplicateSuccess = (0, react_1.useCallback)(() => {
|
|
171
|
+
(0, url_state_1.pushUrl)(`/${newId}`);
|
|
172
|
+
}, [newId]);
|
|
169
173
|
const onSubmit = (0, react_1.useCallback)((e) => {
|
|
170
174
|
e.preventDefault();
|
|
171
175
|
}, []);
|
|
@@ -195,7 +199,7 @@ const DuplicateCompositionLoaded = ({ initialType }) => {
|
|
|
195
199
|
] })
|
|
196
200
|
] })) : null, type === 'composition' && hadDurationDefined ? (jsx_runtime_1.jsx(NewCompDuration_1.NewCompDuration, { durationInFrames: durationInFrames, setDurationInFrames: setDurationInFrames })) : null, type === 'composition' && hadFpsDefined ? (jsx_runtime_1.jsxs("div", { style: layout_1.optionRow, children: [
|
|
197
201
|
jsx_runtime_1.jsx("div", { style: layout_1.label, children: "FPS" }), jsx_runtime_1.jsx("div", { style: layout_1.rightRow, children: jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: selectedFrameRate, onTextChange: onTextFpsChange, placeholder: "Frame rate (fps)", name: "fps", min: 1, required: true, status: "ok", max: 240, step: 0.01, onValueChange: onFpsChange, rightAlign: false }) })
|
|
198
|
-
] })) : null] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Duplicating...', errorNotification: 'Could not duplicate composition', successNotification: `Duplicated ${unresolved.id} as ${newId}`, genericSubmitLabel: 'Duplicate', submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, valid: valid }) })
|
|
202
|
+
] })) : null] }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Duplicating...', errorNotification: 'Could not duplicate composition', successNotification: `Duplicated ${unresolved.id} as ${newId}`, genericSubmitLabel: 'Duplicate', submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`, codemod: codemod, valid: valid, onSuccess: onDuplicateSuccess }) })
|
|
199
203
|
] })
|
|
200
204
|
] }));
|
|
201
205
|
};
|
|
@@ -55,7 +55,7 @@ const RenameCompositionLoaded = () => {
|
|
|
55
55
|
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: newId, onChange: onNameChange, type: "text", autoFocus: true, placeholder: "Composition ID", status: "ok", rightAlign: true }), compNameErrMessage ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
56
56
|
jsx_runtime_1.jsx(layout_2.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: compNameErrMessage, type: "error" })
|
|
57
57
|
] })) : null] }) })
|
|
58
|
-
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming...', errorNotification: 'Could not rename composition', successNotification: `Renamed to ${newId}`, genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, valid: valid }) })
|
|
58
|
+
] }) }), jsx_runtime_1.jsx(ModalFooter_1.ModalFooterContainer, { children: jsx_runtime_1.jsx(CodemodFooter_1.CodemodFooter, { loadingNotification: 'Renaming...', errorNotification: 'Could not rename composition', successNotification: `Renamed to ${newId}`, genericSubmitLabel: 'Rename', submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`, codemod: codemod, valid: valid, onSuccess: null }) })
|
|
59
59
|
] })
|
|
60
60
|
] }));
|
|
61
61
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { _InternalTypes } from 'remotion';
|
|
3
|
+
import type { ZodSafeParseResult } from './SchemaEditor/zod-schema-type';
|
|
3
4
|
export type State = {
|
|
4
5
|
str: string;
|
|
5
6
|
value: Record<string, unknown>;
|
|
6
7
|
validJSON: true;
|
|
7
|
-
zodValidation:
|
|
8
|
+
zodValidation: ZodSafeParseResult;
|
|
8
9
|
} | {
|
|
9
10
|
str: string;
|
|
10
11
|
validJSON: false;
|
|
@@ -51,6 +51,7 @@ const RenderModalJSONPropsEditor_1 = require("./RenderModalJSONPropsEditor");
|
|
|
51
51
|
const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
|
|
52
52
|
const SchemaErrorMessages_1 = require("./SchemaEditor/SchemaErrorMessages");
|
|
53
53
|
const extract_enum_json_paths_1 = require("./SchemaEditor/extract-enum-json-paths");
|
|
54
|
+
const zod_schema_type_1 = require("./SchemaEditor/zod-schema-type");
|
|
54
55
|
const WarningIndicatorButton_1 = require("./WarningIndicatorButton");
|
|
55
56
|
const get_render_modal_warnings_1 = require("./get-render-modal-warnings");
|
|
56
57
|
const errorExplanation = {
|
|
@@ -127,7 +128,8 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, mayS
|
|
|
127
128
|
if (!unresolvedComposition.schema) {
|
|
128
129
|
return 'no-schema';
|
|
129
130
|
}
|
|
130
|
-
if (!(typeof unresolvedComposition.schema
|
|
131
|
+
if (!(typeof unresolvedComposition.schema
|
|
132
|
+
.safeParse === 'function')) {
|
|
131
133
|
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
132
134
|
}
|
|
133
135
|
return unresolvedComposition.schema;
|
|
@@ -139,7 +141,7 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, mayS
|
|
|
139
141
|
if (schema === 'no-schema') {
|
|
140
142
|
return 'no-schema';
|
|
141
143
|
}
|
|
142
|
-
return
|
|
144
|
+
return (0, zod_schema_type_1.zodSafeParse)(schema, defaultProps);
|
|
143
145
|
}, [defaultProps, schema]);
|
|
144
146
|
const setShowWarning = (0, react_1.useCallback)((val) => {
|
|
145
147
|
setShowWarningWithoutPersistance((prevVal) => {
|
|
@@ -310,10 +312,8 @@ const DataEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, mayS
|
|
|
310
312
|
if (zodValidationResult === 'no-schema') {
|
|
311
313
|
throw new Error('expected schema');
|
|
312
314
|
}
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const typeName = def.typeName;
|
|
316
|
-
if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
|
|
315
|
+
const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
|
|
316
|
+
if (typeName === 'any') {
|
|
317
317
|
return jsx_runtime_1.jsx(SchemaErrorMessages_1.NoSchemaDefined, {});
|
|
318
318
|
}
|
|
319
319
|
if (!unresolvedComposition.defaultProps) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SerializedJSONWithCustomFields } from 'remotion';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnyZodSchema } from './SchemaEditor/zod-schema-type';
|
|
4
4
|
export declare const RenderModalJSONPropsEditor: React.FC<{
|
|
5
5
|
readonly value: unknown;
|
|
6
6
|
readonly setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
@@ -8,5 +8,5 @@ export declare const RenderModalJSONPropsEditor: React.FC<{
|
|
|
8
8
|
readonly showSaveButton: boolean;
|
|
9
9
|
readonly serializedJSON: SerializedJSONWithCustomFields | null;
|
|
10
10
|
readonly defaultProps: Record<string, unknown>;
|
|
11
|
-
readonly schema:
|
|
11
|
+
readonly schema: AnyZodSchema;
|
|
12
12
|
}>;
|
|
@@ -46,6 +46,7 @@ const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
|
46
46
|
const layout_1 = require("../layout");
|
|
47
47
|
const ZodErrorMessages_1 = require("./SchemaEditor/ZodErrorMessages");
|
|
48
48
|
const deep_equal_1 = require("./SchemaEditor/deep-equal");
|
|
49
|
+
const zod_schema_type_1 = require("./SchemaEditor/zod-schema-type");
|
|
49
50
|
const style = {
|
|
50
51
|
fontFamily: 'monospace',
|
|
51
52
|
flex: 1,
|
|
@@ -59,7 +60,7 @@ const scrollable = {
|
|
|
59
60
|
const parseJSON = (str, schema) => {
|
|
60
61
|
try {
|
|
61
62
|
const value = no_react_1.NoReactInternals.deserializeJSONWithSpecialTypes(str);
|
|
62
|
-
const zodValidation =
|
|
63
|
+
const zodValidation = (0, zod_schema_type_1.zodSafeParse)(schema, value);
|
|
63
64
|
return { str, value, validJSON: true, zodValidation };
|
|
64
65
|
}
|
|
65
66
|
catch (e) {
|
|
@@ -84,7 +85,7 @@ const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, sho
|
|
|
84
85
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
85
86
|
const parsed = parseJSON(e.target.value, schema);
|
|
86
87
|
if (parsed.validJSON) {
|
|
87
|
-
const validationResult =
|
|
88
|
+
const validationResult = (0, zod_schema_type_1.zodSafeParse)(schema, parsed.value);
|
|
88
89
|
setLocalValue({
|
|
89
90
|
str: e.target.value,
|
|
90
91
|
value: parsed.value,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnyZodSchema, ZodSafeParseResult } from './zod-schema-type';
|
|
3
3
|
export declare const SchemaEditor: React.FC<{
|
|
4
|
-
readonly schema:
|
|
4
|
+
readonly schema: AnyZodSchema;
|
|
5
5
|
readonly unsavedDefaultProps: Record<string, unknown>;
|
|
6
6
|
readonly setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
|
-
readonly zodValidationResult:
|
|
7
|
+
readonly zodValidationResult: ZodSafeParseResult;
|
|
8
8
|
readonly savedDefaultProps: Record<string, unknown>;
|
|
9
9
|
readonly onSave: (updater: (oldState: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
10
10
|
readonly showSaveButton: boolean;
|
|
@@ -13,6 +13,7 @@ const ZodObjectEditor_1 = require("./ZodObjectEditor");
|
|
|
13
13
|
const deep_equal_1 = require("./deep-equal");
|
|
14
14
|
const local_state_1 = require("./local-state");
|
|
15
15
|
const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
|
|
16
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
16
17
|
const scrollable = {
|
|
17
18
|
display: 'flex',
|
|
18
19
|
flexDirection: 'column',
|
|
@@ -66,20 +67,18 @@ const SchemaEditor = ({ schema, unsavedDefaultProps, setValue, zodValidationResu
|
|
|
66
67
|
save.unregister();
|
|
67
68
|
};
|
|
68
69
|
}, [keybindings, onQuickSave, onSave]);
|
|
69
|
-
const
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
-
const typeName = def.typeName;
|
|
70
|
+
const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
|
|
72
71
|
const reset = (0, react_1.useCallback)(() => {
|
|
73
72
|
setValue(savedDefaultProps);
|
|
74
73
|
}, [savedDefaultProps, setValue]);
|
|
75
74
|
if (!zodValidationResult.success) {
|
|
76
|
-
const defaultPropsValid =
|
|
75
|
+
const defaultPropsValid = (0, zod_schema_type_1.zodSafeParse)(schema, savedDefaultProps);
|
|
77
76
|
if (!defaultPropsValid.success) {
|
|
78
77
|
return jsx_runtime_1.jsx(SchemaErrorMessages_1.InvalidDefaultProps, { zodValidationResult: zodValidationResult });
|
|
79
78
|
}
|
|
80
79
|
return (jsx_runtime_1.jsx(SchemaErrorMessages_1.InvalidSchema, { reset: reset, zodValidationResult: zodValidationResult }));
|
|
81
80
|
}
|
|
82
|
-
if (typeName !==
|
|
81
|
+
if (typeName !== 'object') {
|
|
83
82
|
return jsx_runtime_1.jsx(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
84
83
|
}
|
|
85
84
|
return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: jsx_runtime_1.jsx(local_state_1.RevisionContext.Provider, { value: revisionState, children: jsx_runtime_1.jsx(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, unsavedValue: unsavedDefaultProps, setValue: setValue, jsonPath: [], schema: schema, savedValue: savedDefaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }) }));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZodSafeParseResult } from './zod-schema-type';
|
|
2
2
|
export declare const ZodNotInstalled: () => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare const NoSchemaDefined: () => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const NoDefaultProps: () => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const InvalidDefaultProps: React.FC<{
|
|
6
|
-
zodValidationResult:
|
|
6
|
+
zodValidationResult: ZodSafeParseResult;
|
|
7
7
|
}>;
|
|
8
8
|
export declare const InvalidSchema: React.FC<{
|
|
9
|
-
zodValidationResult:
|
|
9
|
+
zodValidationResult: ZodSafeParseResult;
|
|
10
10
|
reset: () => void;
|
|
11
11
|
}>;
|
|
12
12
|
export declare const TopLevelZodValue: React.FC<{
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TopLevelZodValue = exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = exports.ZodNotInstalled = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// Schema error messages for studio editor
|
|
5
6
|
const colors_1 = require("../../../helpers/colors");
|
|
6
7
|
const Button_1 = require("../../Button");
|
|
7
8
|
const styles_1 = require("../../Menu/styles");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
3
3
|
export declare const VERTICAL_GUIDE_HEIGHT = 24;
|
|
4
4
|
export declare const SchemaSeparationLine: React.FC;
|
|
5
5
|
export declare const SchemaArrayItemSeparationLine: React.FC<{
|
|
6
6
|
readonly onChange: (updater: (oldV: unknown[]) => unknown[], forceApply: boolean, increment: boolean) => void;
|
|
7
7
|
readonly index: number;
|
|
8
|
-
readonly schema:
|
|
8
|
+
readonly schema: AnyZodSchema;
|
|
9
9
|
readonly showAddButton: boolean;
|
|
10
10
|
readonly isLast: boolean;
|
|
11
11
|
}>;
|
|
@@ -9,6 +9,7 @@ const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
|
9
9
|
const layout_1 = require("../../layout");
|
|
10
10
|
const layout_2 = require("../layout");
|
|
11
11
|
const create_zod_values_1 = require("./create-zod-values");
|
|
12
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
12
13
|
exports.VERTICAL_GUIDE_HEIGHT = 24;
|
|
13
14
|
const line = {
|
|
14
15
|
borderBottom: '1px solid ' + colors_1.LINE_COLOR,
|
|
@@ -32,16 +33,16 @@ const SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAd
|
|
|
32
33
|
if (!z) {
|
|
33
34
|
throw new Error('expected zod');
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
+
const arrayElement = (0, zod_schema_type_1.getArrayElement)(schema);
|
|
36
37
|
const onAdd = (0, react_1.useCallback)(() => {
|
|
37
38
|
onChange((oldV) => {
|
|
38
39
|
return [
|
|
39
40
|
...oldV.slice(0, index + 1),
|
|
40
|
-
(0, create_zod_values_1.createZodValues)(
|
|
41
|
+
(0, create_zod_values_1.createZodValues)(arrayElement, z, zodTypes),
|
|
41
42
|
...oldV.slice(index + 1),
|
|
42
43
|
];
|
|
43
44
|
}, false, true);
|
|
44
|
-
}, [
|
|
45
|
+
}, [arrayElement, index, onChange, z, zodTypes]);
|
|
45
46
|
const dynamicAddButtonStyle = (0, react_1.useMemo)(() => {
|
|
46
47
|
return {
|
|
47
48
|
display: 'flex',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
2
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
3
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodArrayEditor: React.FC<{
|
|
6
|
-
readonly schema:
|
|
6
|
+
readonly schema: AnyZodSchema;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: unknown[];
|
|
9
9
|
readonly defaultValue: unknown[];
|
|
@@ -46,6 +46,7 @@ const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
|
46
46
|
const create_zod_values_1 = require("./create-zod-values");
|
|
47
47
|
const deep_equal_1 = require("./deep-equal");
|
|
48
48
|
const local_state_1 = require("./local-state");
|
|
49
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
49
50
|
const ZodArrayEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
50
51
|
const { localValue, onChange, RevisionContextProvider, reset } = (0, local_state_1.useLocalState)({
|
|
51
52
|
unsavedValue: value,
|
|
@@ -54,7 +55,7 @@ const ZodArrayEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSav
|
|
|
54
55
|
savedValue: defaultValue,
|
|
55
56
|
});
|
|
56
57
|
const [expanded, setExpanded] = (0, react_1.useState)(true);
|
|
57
|
-
const
|
|
58
|
+
const arrayElement = (0, zod_schema_type_1.getArrayElement)(schema);
|
|
58
59
|
const suffix = (0, react_1.useMemo)(() => {
|
|
59
60
|
return expanded ? ' [' : ' [...] ';
|
|
60
61
|
}, [expanded]);
|
|
@@ -63,10 +64,6 @@ const ZodArrayEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSav
|
|
|
63
64
|
throw new Error('expected zod');
|
|
64
65
|
}
|
|
65
66
|
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
66
|
-
const typeName = def.typeName;
|
|
67
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodArray) {
|
|
68
|
-
throw new Error('expected object');
|
|
69
|
-
}
|
|
70
67
|
const isDefaultValue = (0, react_1.useMemo)(() => {
|
|
71
68
|
return (0, deep_equal_1.deepEqual)(localValue.value, defaultValue);
|
|
72
69
|
}, [defaultValue, localValue]);
|
|
@@ -81,7 +78,7 @@ const ZodArrayEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSav
|
|
|
81
78
|
return (
|
|
82
79
|
// eslint-disable-next-line react/no-array-index-key
|
|
83
80
|
jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
|
|
84
|
-
jsx_runtime_1.jsx(ZodArrayItemEditor_1.ZodArrayItemEditor, { onChange: onChange, value: child,
|
|
81
|
+
jsx_runtime_1.jsx(ZodArrayItemEditor_1.ZodArrayItemEditor, { onChange: onChange, value: child, elementSchema: arrayElement, index: i, jsonPath: jsonPath, defaultValue: (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue[i]) !== null && _a !== void 0 ? _a : (0, create_zod_values_1.createZodValues)(arrayElement, z, zodTypes), onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad, mayRemove: true }), jsx_runtime_1.jsx(SchemaSeparationLine_1.SchemaArrayItemSeparationLine, { schema: schema, index: i, onChange: onChange, isLast: i === localValue.value.length - 1, showAddButton: true })
|
|
85
82
|
] }, `${i}${localValue.keyStabilityRevision}`));
|
|
86
83
|
}), value.length === 0 ? (jsx_runtime_1.jsx(SchemaSeparationLine_1.SchemaArrayItemSeparationLine, { schema: schema, index: 0, onChange: onChange, isLast: true, showAddButton: true })) : null] }) })) : null, jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })
|
|
87
84
|
] }));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
2
3
|
import type { JSONPath } from './zod-types';
|
|
3
4
|
export declare const ZodArrayItemEditor: React.FC<{
|
|
4
5
|
jsonPath: JSONPath;
|
|
5
6
|
onChange: UpdaterFunction<unknown[]>;
|
|
6
|
-
|
|
7
|
+
elementSchema: AnyZodSchema;
|
|
7
8
|
index: number;
|
|
8
9
|
value: unknown;
|
|
9
10
|
defaultValue: unknown;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
7
7
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
8
|
-
const ZodArrayItemEditor = ({
|
|
8
|
+
const ZodArrayItemEditor = ({ elementSchema, onChange, jsonPath, index, value, defaultValue, onSave: onSaveObject, showSaveButton, saving, saveDisabledByParent, mayPad, mayRemove, }) => {
|
|
9
9
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
10
10
|
if (!z) {
|
|
11
11
|
throw new Error('expected zod');
|
|
@@ -28,6 +28,6 @@ const ZodArrayItemEditor = ({ def, onChange, jsonPath, index, value, defaultValu
|
|
|
28
28
|
...oldV.slice(index + 1),
|
|
29
29
|
], false, false);
|
|
30
30
|
}, [index, onSaveObject]);
|
|
31
|
-
return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema:
|
|
31
|
+
return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema: elementSchema, value: value, setValue: setValue, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: mayRemove ? onRemove : null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }) }));
|
|
32
32
|
};
|
|
33
33
|
exports.ZodArrayItemEditor = ZodArrayItemEditor;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
2
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
3
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodBooleanEditor: React.FC<{
|
|
6
|
-
readonly schema:
|
|
6
|
+
readonly schema: AnyZodSchema;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: boolean;
|
|
9
9
|
readonly setValue: UpdaterFunction<boolean>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
2
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
3
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodColorEditor: React.FC<{
|
|
6
|
-
readonly schema:
|
|
6
|
+
readonly schema: AnyZodSchema;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: string;
|
|
9
9
|
readonly defaultValue: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
2
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
3
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodDateEditor: React.FC<{
|
|
6
|
-
readonly schema:
|
|
6
|
+
readonly schema: AnyZodSchema;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: Date;
|
|
9
9
|
readonly defaultValue: Date;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type { UpdaterFunction } from './ZodSwitch';
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
4
3
|
import type { JSONPath } from './zod-types';
|
|
4
|
+
import type { UpdaterFunction } from './ZodSwitch';
|
|
5
5
|
export declare const ZodDefaultEditor: React.FC<{
|
|
6
6
|
readonly showSaveButton: boolean;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: unknown;
|
|
9
9
|
readonly defaultValue: unknown;
|
|
10
|
-
readonly schema:
|
|
10
|
+
readonly schema: AnyZodSchema;
|
|
11
11
|
readonly setValue: UpdaterFunction<unknown>;
|
|
12
12
|
readonly onSave: UpdaterFunction<unknown>;
|
|
13
13
|
readonly onRemove: null | (() => void);
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZodDefaultEditor = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
5
6
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
6
7
|
const ZodDefaultEditor = ({ jsonPath, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
7
|
-
const
|
|
8
|
+
const innerType = (0, zod_schema_type_1.getInnerType)(schema);
|
|
8
9
|
return (jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { defaultValue: defaultValue, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, schema: innerType, setValue: setValue, showSaveButton: showSaveButton, value: value, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
9
10
|
};
|
|
10
11
|
exports.ZodDefaultEditor = ZodDefaultEditor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
1
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
3
3
|
import type { JSONPath } from './zod-types';
|
|
4
4
|
export declare const ZodDiscriminatedUnionEditor: React.FC<{
|
|
5
|
-
schema:
|
|
5
|
+
schema: AnyZodSchema;
|
|
6
6
|
setValue: UpdaterFunction<Record<string, unknown>>;
|
|
7
7
|
value: Record<string, unknown>;
|
|
8
8
|
defaultValue: Record<string, unknown>;
|