@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
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { AnyComposition } from 'remotion';
|
|
3
3
|
export declare type State = {
|
|
4
4
|
str: string;
|
|
5
|
-
value: unknown
|
|
5
|
+
value: Record<string, unknown>;
|
|
6
6
|
validJSON: true;
|
|
7
7
|
} | {
|
|
8
8
|
str: string;
|
|
@@ -12,8 +12,8 @@ export declare type State = {
|
|
|
12
12
|
export declare type PropsEditType = 'input-props' | 'default-props';
|
|
13
13
|
export declare const RenderModalData: React.FC<{
|
|
14
14
|
composition: AnyComposition;
|
|
15
|
-
inputProps: unknown
|
|
16
|
-
setInputProps: React.Dispatch<React.SetStateAction<unknown
|
|
15
|
+
inputProps: Record<string, unknown>;
|
|
16
|
+
setInputProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
17
17
|
compact: boolean;
|
|
18
18
|
mayShowSaveButton: boolean;
|
|
19
19
|
propsEditType: PropsEditType;
|
|
@@ -27,11 +27,11 @@ exports.RenderModalData = void 0;
|
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const remotion_1 = require("remotion");
|
|
30
|
-
const colors_1 = require("../../helpers/colors");
|
|
31
|
-
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
32
30
|
const client_id_1 = require("../../helpers/client-id");
|
|
31
|
+
const colors_1 = require("../../helpers/colors");
|
|
33
32
|
const get_zod_if_possible_1 = require("../get-zod-if-possible");
|
|
34
33
|
const layout_1 = require("../layout");
|
|
34
|
+
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
35
35
|
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
36
36
|
const actions_1 = require("../RenderQueue/actions");
|
|
37
37
|
const SegmentedControl_1 = require("../SegmentedControl");
|
|
@@ -105,7 +105,7 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
105
105
|
if (!inJSONEditor) {
|
|
106
106
|
return null;
|
|
107
107
|
}
|
|
108
|
-
const value = inputProps
|
|
108
|
+
const value = inputProps;
|
|
109
109
|
return (0, input_props_serialization_1.serializeJSONWithDate)({
|
|
110
110
|
data: value,
|
|
111
111
|
indent: 2,
|
|
@@ -113,10 +113,8 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
113
113
|
});
|
|
114
114
|
}, [inJSONEditor, inputProps]);
|
|
115
115
|
const cliProps = (0, remotion_1.getInputProps)();
|
|
116
|
-
const [
|
|
117
|
-
|
|
118
|
-
reason: 'Loading...',
|
|
119
|
-
determined: false,
|
|
116
|
+
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({
|
|
117
|
+
[composition.id]: get_render_modal_warnings_1.defaultTypeCanSaveState,
|
|
120
118
|
});
|
|
121
119
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
122
120
|
const schema = (0, react_1.useMemo)(() => {
|
|
@@ -124,7 +122,7 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
124
122
|
return 'no-zod';
|
|
125
123
|
}
|
|
126
124
|
if (!composition.schema) {
|
|
127
|
-
return z.
|
|
125
|
+
return z.object({});
|
|
128
126
|
}
|
|
129
127
|
if (!(typeof composition.schema.safeParse === 'function')) {
|
|
130
128
|
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
@@ -147,30 +145,44 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
147
145
|
return val(prevVal);
|
|
148
146
|
});
|
|
149
147
|
}, []);
|
|
148
|
+
const canSaveDefaultProps = (0, react_1.useMemo)(() => {
|
|
149
|
+
return canSaveDefaultPropsObjectState[composition.id]
|
|
150
|
+
? canSaveDefaultPropsObjectState[composition.id]
|
|
151
|
+
: get_render_modal_warnings_1.defaultTypeCanSaveState;
|
|
152
|
+
}, [canSaveDefaultPropsObjectState, composition.id]);
|
|
150
153
|
const showSaveButton = mayShowSaveButton && canSaveDefaultProps.canUpdate;
|
|
151
154
|
const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
|
|
152
155
|
(0, react_1.useEffect)(() => {
|
|
153
156
|
(0, actions_1.canUpdateDefaultProps)(composition.id)
|
|
154
157
|
.then((can) => {
|
|
155
158
|
if (can.canUpdate) {
|
|
156
|
-
setCanSaveDefaultProps({
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
160
|
+
...prevState,
|
|
161
|
+
[composition.id]: {
|
|
162
|
+
canUpdate: true,
|
|
163
|
+
},
|
|
164
|
+
}));
|
|
159
165
|
}
|
|
160
166
|
else {
|
|
161
|
-
setCanSaveDefaultProps({
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
168
|
+
...prevState,
|
|
169
|
+
[composition.id]: {
|
|
170
|
+
canUpdate: false,
|
|
171
|
+
reason: can.reason,
|
|
172
|
+
determined: true,
|
|
173
|
+
},
|
|
174
|
+
}));
|
|
166
175
|
}
|
|
167
176
|
})
|
|
168
177
|
.catch((err) => {
|
|
169
|
-
setCanSaveDefaultProps({
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
179
|
+
...prevState,
|
|
180
|
+
[composition.id]: {
|
|
181
|
+
canUpdate: false,
|
|
182
|
+
reason: err.message,
|
|
183
|
+
determined: true,
|
|
184
|
+
},
|
|
185
|
+
}));
|
|
174
186
|
});
|
|
175
187
|
}, [composition.id]);
|
|
176
188
|
const modeItems = (0, react_1.useMemo)(() => {
|
|
@@ -202,7 +214,11 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
202
214
|
return;
|
|
203
215
|
}
|
|
204
216
|
setValBeforeSafe(inputProps);
|
|
205
|
-
(0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
217
|
+
(0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
218
|
+
if (!response.success) {
|
|
219
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
206
222
|
}, [composition.id, inputProps, schema, z]);
|
|
207
223
|
(0, react_1.useEffect)(() => {
|
|
208
224
|
setSaving(false);
|
|
@@ -213,7 +229,14 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
213
229
|
return;
|
|
214
230
|
}
|
|
215
231
|
setSaving(true);
|
|
216
|
-
(0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
232
|
+
(0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
233
|
+
.then((response) => {
|
|
234
|
+
if (!response.success) {
|
|
235
|
+
console.log(response.stack);
|
|
236
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${response.reason}. See console for more information.`);
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
.catch((err) => {
|
|
217
240
|
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
|
|
218
241
|
setSaving(false);
|
|
219
242
|
});
|
|
@@ -227,10 +250,12 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
227
250
|
customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
|
|
228
251
|
inJSONEditor,
|
|
229
252
|
propsEditType,
|
|
253
|
+
jsMapUsed: serializedJSON ? serializedJSON.mapUsed : false,
|
|
254
|
+
jsSetUsed: serializedJSON ? serializedJSON.setUsed : false,
|
|
230
255
|
});
|
|
231
256
|
}, [
|
|
232
|
-
canSaveDefaultProps,
|
|
233
257
|
cliProps,
|
|
258
|
+
canSaveDefaultProps,
|
|
234
259
|
inJSONEditor,
|
|
235
260
|
propsEditType,
|
|
236
261
|
serializedJSON,
|
|
@@ -258,6 +283,6 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
258
283
|
}
|
|
259
284
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
260
285
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
261
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, parseJSON: parseJSON }))] }));
|
|
286
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, parseJSON: parseJSON }))] }));
|
|
262
287
|
};
|
|
263
288
|
exports.RenderModalData = RenderModalData;
|
|
@@ -4,7 +4,7 @@ import type { SerializedJSONWithCustomFields } from './SchemaEditor/input-props-
|
|
|
4
4
|
export declare type EditType = 'inputProps' | 'defaultProps';
|
|
5
5
|
export declare const RenderModalJSONPropsEditor: React.FC<{
|
|
6
6
|
value: unknown;
|
|
7
|
-
setValue: React.Dispatch<React.SetStateAction<unknown
|
|
7
|
+
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
8
8
|
zodValidationResult: Zod.SafeParseReturnType<unknown, unknown>;
|
|
9
9
|
switchToSchema: () => void;
|
|
10
10
|
onSave: () => void;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { z } from 'zod';
|
|
2
|
+
import type { AnyZodObject, z } from 'zod';
|
|
3
3
|
export declare const SchemaEditor: React.FC<{
|
|
4
|
-
schema:
|
|
4
|
+
schema: AnyZodObject;
|
|
5
5
|
value: unknown;
|
|
6
|
-
setValue: React.Dispatch<React.SetStateAction<unknown
|
|
6
|
+
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
7
|
zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
8
8
|
compact: boolean;
|
|
9
|
-
defaultProps: unknown
|
|
9
|
+
defaultProps: Record<string, unknown>;
|
|
10
10
|
onSave: (updater: (oldState: unknown) => unknown) => void;
|
|
11
11
|
showSaveButton: boolean;
|
|
12
12
|
saving: boolean;
|
|
13
|
+
saveDisabledByParent: boolean;
|
|
13
14
|
}>;
|
|
@@ -13,7 +13,7 @@ const scrollable = {
|
|
|
13
13
|
flexDirection: 'column',
|
|
14
14
|
overflowY: 'auto',
|
|
15
15
|
};
|
|
16
|
-
const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, saving, }) => {
|
|
16
|
+
const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, saving, saveDisabledByParent, }) => {
|
|
17
17
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
18
18
|
if (!z) {
|
|
19
19
|
throw new Error('expected zod');
|
|
@@ -31,9 +31,9 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, d
|
|
|
31
31
|
}
|
|
32
32
|
return ((0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.InvalidSchema, { reset: reset, zodValidationResult: zodValidationResult }));
|
|
33
33
|
}
|
|
34
|
-
if (typeName
|
|
35
|
-
return (
|
|
34
|
+
if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
|
|
35
|
+
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
36
36
|
}
|
|
37
|
-
return null;
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { value: value, setValue: setValue, jsonPath: [], schema: schema, compact: compact, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent }) }));
|
|
38
38
|
};
|
|
39
39
|
exports.SchemaEditor = SchemaEditor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = exports.ZodNotInstalled = void 0;
|
|
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
5
|
const Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
6
6
|
const colors_1 = require("../../../helpers/colors");
|
|
@@ -24,7 +24,7 @@ const errorExplanation = {
|
|
|
24
24
|
};
|
|
25
25
|
const codeSnippet = {
|
|
26
26
|
fontSize: 14,
|
|
27
|
-
color:
|
|
27
|
+
color: colors_1.BLUE,
|
|
28
28
|
fontFamily: 'monospace',
|
|
29
29
|
};
|
|
30
30
|
const errorContainer = {
|
|
@@ -57,3 +57,7 @@ const InvalidSchema = ({ zodValidationResult, reset }) => {
|
|
|
57
57
|
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
|
|
58
58
|
};
|
|
59
59
|
exports.InvalidSchema = InvalidSchema;
|
|
60
|
+
const TopLevelZodValue = ({ typeReceived }) => {
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The top-level type of the schema must be a pure", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "z.object" }), ". Instead got a schema of type", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: typeReceived })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema by changing the top-level Zod type to an object." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn more" })] }));
|
|
62
|
+
};
|
|
63
|
+
exports.TopLevelZodValue = TopLevelZodValue;
|
|
@@ -9,8 +9,12 @@ export declare const SchemaLabel: React.FC<{
|
|
|
9
9
|
showSaveButton: boolean;
|
|
10
10
|
compact: boolean;
|
|
11
11
|
saving: boolean;
|
|
12
|
+
valid: boolean;
|
|
13
|
+
saveDisabledByParent: boolean;
|
|
12
14
|
}>;
|
|
13
15
|
export declare const SchemaFieldsetLabel: React.FC<{
|
|
14
16
|
jsonPath: JSONPath;
|
|
15
17
|
onRemove: null | (() => void);
|
|
18
|
+
isDefaultValue: boolean;
|
|
19
|
+
onReset: () => void;
|
|
16
20
|
}>;
|
|
@@ -30,11 +30,12 @@ const labelStyle = {
|
|
|
30
30
|
color: colors_1.LIGHT_TEXT,
|
|
31
31
|
lineHeight: '40px',
|
|
32
32
|
};
|
|
33
|
-
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, saving, }) => {
|
|
34
|
-
|
|
33
|
+
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, saving, valid, saveDisabledByParent, }) => {
|
|
34
|
+
const disableSave = saving || !valid || saveDisabledByParent;
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? compactStyles : wideStyles, children: [(0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: (0, get_schema_label_1.getSchemaLabel)(jsonPath) }), compact ? (0, jsx_runtime_1.jsx)(layout_1.Flex, {}) : (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), isDefaultValue ? null : showSaveButton ? ((0, jsx_runtime_1.jsx)(SchemaSaveButton_1.SchemaSaveButton, { onClick: onSave, disabled: disableSave })) : null, onRemove ? (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
|
|
35
36
|
};
|
|
36
37
|
exports.SchemaLabel = SchemaLabel;
|
|
37
|
-
const SchemaFieldsetLabel = ({ jsonPath, onRemove }) => {
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)("legend", { style: layout_2.fieldsetLabel, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), onRemove ? ((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)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove })] })) : null] }));
|
|
38
|
+
const SchemaFieldsetLabel = ({ jsonPath, onRemove, isDefaultValue, onReset }) => {
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("legend", { style: layout_2.fieldsetLabel, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), onRemove ? ((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)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove })] })) : null] }));
|
|
39
40
|
};
|
|
40
41
|
exports.SchemaFieldsetLabel = SchemaFieldsetLabel;
|
|
@@ -8,10 +8,10 @@ const icon = {
|
|
|
8
8
|
height: 14,
|
|
9
9
|
color: 'currentColor',
|
|
10
10
|
};
|
|
11
|
-
const SchemaSaveButton = ({ onClick,
|
|
11
|
+
const SchemaSaveButton = ({ onClick, disabled }) => {
|
|
12
12
|
const renderAction = (0, react_1.useCallback)((color) => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)("svg", { style: icon, viewBox: "0 0 448 512", children: (0, jsx_runtime_1.jsx)("path", { fill:
|
|
14
|
-
}, [
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, disabled:
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("svg", { style: icon, viewBox: "0 0 448 512", children: (0, jsx_runtime_1.jsx)("path", { fill: disabled ? 'grey' : color, d: "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V173.3c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32H64zm0 96c0-17.7 14.3-32 32-32H288c17.7 0 32 14.3 32 32v64c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V128zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z" }) }));
|
|
14
|
+
}, [disabled]);
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, disabled: disabled }));
|
|
16
16
|
};
|
|
17
17
|
exports.SchemaSaveButton = SchemaSaveButton;
|
|
@@ -10,6 +10,7 @@ const layout_1 = require("../../layout");
|
|
|
10
10
|
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
11
11
|
const layout_2 = require("../layout");
|
|
12
12
|
const create_zod_values_1 = require("./create-zod-values");
|
|
13
|
+
const local_state_1 = require("./local-state");
|
|
13
14
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
14
15
|
const ZodArrayItemEditor_1 = require("./ZodArrayItemEditor");
|
|
15
16
|
const container = {
|
|
@@ -18,14 +19,11 @@ const container = {
|
|
|
18
19
|
const fullWidth = {
|
|
19
20
|
width: '100%',
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
zodValidation: schema.safeParse(value),
|
|
27
|
-
revision: 0,
|
|
28
|
-
};
|
|
22
|
+
const ZodArrayEditor = ({ schema, jsonPath, compact, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, }) => {
|
|
23
|
+
const { localValue, onChange } = (0, local_state_1.useLocalState)({
|
|
24
|
+
value,
|
|
25
|
+
schema,
|
|
26
|
+
setValue,
|
|
29
27
|
});
|
|
30
28
|
const def = schema._def;
|
|
31
29
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
@@ -48,21 +46,6 @@ const ZodArrayEditor = ({ schema, jsonPath, compact, setValue: updateValue, defa
|
|
|
48
46
|
: colors_1.FAIL_COLOR,
|
|
49
47
|
};
|
|
50
48
|
}, [localValue.zodValidation.success]);
|
|
51
|
-
const onChange = (0, react_1.useCallback)((updater, incrementRevision) => {
|
|
52
|
-
setLocalValue((oldLocalState) => {
|
|
53
|
-
const newValue = updater(oldLocalState.value);
|
|
54
|
-
const safeParse = schema.safeParse(newValue);
|
|
55
|
-
// TODO: This logs an error to the console
|
|
56
|
-
if (safeParse.success) {
|
|
57
|
-
updateValue(updater);
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
revision: oldLocalState.revision + (incrementRevision ? 1 : 0),
|
|
61
|
-
value: newValue,
|
|
62
|
-
zodValidation: safeParse,
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
}, [schema, updateValue]);
|
|
66
49
|
const style = (0, react_1.useMemo)(() => {
|
|
67
50
|
if (isRoot) {
|
|
68
51
|
return undefined;
|
|
@@ -72,13 +55,42 @@ const ZodArrayEditor = ({ schema, jsonPath, compact, setValue: updateValue, defa
|
|
|
72
55
|
const onAdd = (0, react_1.useCallback)(() => {
|
|
73
56
|
onChange((oldV) => {
|
|
74
57
|
return [...oldV, (0, create_zod_values_1.createZodValues)(def.type, z, zodTypes)];
|
|
75
|
-
},
|
|
58
|
+
}, false);
|
|
76
59
|
}, [def.type, onChange, z, zodTypes]);
|
|
77
|
-
|
|
60
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
61
|
+
onChange(() => defaultValue, true);
|
|
62
|
+
}, [defaultValue, onChange]);
|
|
63
|
+
const isDefaultValue = (0, react_1.useMemo)(() => {
|
|
64
|
+
return deepEqual(localValue.value, defaultValue);
|
|
65
|
+
}, [defaultValue, localValue]);
|
|
66
|
+
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, { onReset: reset, isDefaultValue: isDefaultValue, jsonPath: jsonPath, onRemove: onRemove })), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: localValue.value.map((child, i) => {
|
|
78
67
|
var _a;
|
|
79
68
|
return ((0, jsx_runtime_1.jsx)(ZodArrayItemEditor_1.ZodArrayItemEditor
|
|
80
69
|
// eslint-disable-next-line react/no-array-index-key
|
|
81
|
-
, { onChange: onChange, value: child, def: def, index: i, jsonPath: jsonPath, compact: compact, defaultValue: (_a = defaultValue[i]) !== null && _a !== void 0 ? _a : child, onSave: onSave, showSaveButton: showSaveButton, saving: saving }, `${i}${localValue.revision}`));
|
|
70
|
+
, { onChange: onChange, value: child, def: def, index: i, jsonPath: jsonPath, compact: compact, defaultValue: (_a = defaultValue[i]) !== null && _a !== void 0 ? _a : child, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: saveDisabledByParent }, `${i}${localValue.revision}`));
|
|
82
71
|
}) }), !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" })] })), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onAdd, children: "+ Add item" })] }) }) }));
|
|
83
72
|
};
|
|
84
73
|
exports.ZodArrayEditor = ZodArrayEditor;
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
function deepEqual(a, b) {
|
|
76
|
+
if (a === b) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (typeof a !== 'object' ||
|
|
80
|
+
a === null ||
|
|
81
|
+
typeof b !== 'object' ||
|
|
82
|
+
b === null) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const keysA = Object.keys(a);
|
|
86
|
+
const keysB = Object.keys(b);
|
|
87
|
+
if (keysA.length !== keysB.length) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
for (const key of keysA) {
|
|
91
|
+
if (!keysB.includes(key) || !deepEqual(a[key], b[key])) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { JSONPath } from './zod-types';
|
|
3
|
+
import type { UpdaterFunction } from './ZodSwitch';
|
|
3
4
|
export declare const ZodArrayItemEditor: React.FC<{
|
|
4
5
|
jsonPath: JSONPath;
|
|
5
|
-
onChange:
|
|
6
|
+
onChange: UpdaterFunction<unknown[]>;
|
|
6
7
|
def: any;
|
|
7
8
|
index: number;
|
|
8
9
|
value: unknown;
|
|
9
10
|
compact: boolean;
|
|
10
11
|
defaultValue: unknown;
|
|
11
|
-
onSave:
|
|
12
|
+
onSave: UpdaterFunction<unknown[]>;
|
|
12
13
|
showSaveButton: boolean;
|
|
13
14
|
saving: boolean;
|
|
15
|
+
saveDisabledByParent: boolean;
|
|
14
16
|
}>;
|
|
@@ -4,9 +4,9 @@ exports.ZodArrayItemEditor = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
7
|
-
const ZodArrayItemEditor = ({ def, onChange, jsonPath, index, value, compact, defaultValue, onSave: onSaveObject, showSaveButton, saving, }) => {
|
|
7
|
+
const ZodArrayItemEditor = ({ def, onChange, jsonPath, index, value, compact, defaultValue, onSave: onSaveObject, showSaveButton, saving, saveDisabledByParent, }) => {
|
|
8
8
|
const onRemove = (0, react_1.useCallback)(() => {
|
|
9
|
-
onChange((oldV) => [...oldV.slice(0, index), ...oldV.slice(index + 1)],
|
|
9
|
+
onChange((oldV) => [...oldV.slice(0, index), ...oldV.slice(index + 1)], false);
|
|
10
10
|
}, [index, onChange]);
|
|
11
11
|
const setValue = (0, react_1.useCallback)((val) => {
|
|
12
12
|
onChange((oldV) => [
|
|
@@ -21,8 +21,8 @@ const ZodArrayItemEditor = ({ def, onChange, jsonPath, index, value, compact, de
|
|
|
21
21
|
...oldV.slice(0, index),
|
|
22
22
|
updater(oldV[index]),
|
|
23
23
|
...oldV.slice(index + 1),
|
|
24
|
-
]);
|
|
24
|
+
], false);
|
|
25
25
|
}, [index, onSaveObject]);
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema: def.type, value: value, setValue: setValue, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema: def.type, value: value, setValue: setValue, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent }));
|
|
27
27
|
};
|
|
28
28
|
exports.ZodArrayItemEditor = ZodArrayItemEditor;
|
|
@@ -7,8 +7,9 @@ export declare const ZodBooleanEditor: React.FC<{
|
|
|
7
7
|
setValue: UpdaterFunction<boolean>;
|
|
8
8
|
compact: boolean;
|
|
9
9
|
defaultValue: boolean;
|
|
10
|
-
onSave:
|
|
10
|
+
onSave: UpdaterFunction<boolean>;
|
|
11
11
|
onRemove: null | (() => void);
|
|
12
12
|
showSaveButton: boolean;
|
|
13
13
|
saving: boolean;
|
|
14
|
+
saveDisabledByParent: boolean;
|
|
14
15
|
}>;
|
|
@@ -9,19 +9,19 @@ const SchemaLabel_1 = require("./SchemaLabel");
|
|
|
9
9
|
const fullWidth = {
|
|
10
10
|
width: '100%',
|
|
11
11
|
};
|
|
12
|
-
const ZodBooleanEditor = ({ jsonPath, value, setValue, onSave, compact, defaultValue, onRemove, showSaveButton, saving, }) => {
|
|
13
|
-
const onValueChange = (0, react_1.useCallback)((newValue) => {
|
|
14
|
-
setValue(() => newValue);
|
|
12
|
+
const ZodBooleanEditor = ({ jsonPath, value, setValue, onSave, compact, defaultValue, onRemove, showSaveButton, saving, saveDisabledByParent, }) => {
|
|
13
|
+
const onValueChange = (0, react_1.useCallback)((newValue, forceApply) => {
|
|
14
|
+
setValue(() => newValue, forceApply);
|
|
15
15
|
}, [setValue]);
|
|
16
16
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
17
|
-
onValueChange(e.target.checked);
|
|
17
|
+
onValueChange(e.target.checked, false);
|
|
18
18
|
}, [onValueChange]);
|
|
19
19
|
const reset = (0, react_1.useCallback)(() => {
|
|
20
|
-
onValueChange(defaultValue);
|
|
20
|
+
onValueChange(defaultValue, true);
|
|
21
21
|
}, [defaultValue, onValueChange]);
|
|
22
22
|
const save = (0, react_1.useCallback)(() => {
|
|
23
|
-
onSave(() => value);
|
|
23
|
+
onSave(() => value, false);
|
|
24
24
|
}, [onSave, value]);
|
|
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: 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)(Checkbox_1.Checkbox, { checked: value, onChange: onChange, disabled: false }) })] }));
|
|
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: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove, saving: saving, valid: true, saveDisabledByParent: saveDisabledByParent }), (0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: value, onChange: onChange, disabled: false }) })] }));
|
|
26
26
|
};
|
|
27
27
|
exports.ZodBooleanEditor = ZodBooleanEditor;
|
|
@@ -8,9 +8,10 @@ export declare const ZodColorEditor: 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
|
}>;
|