@remotion/studio 4.0.478 → 4.0.479
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/components/AssetSelector.js +8 -14
- package/dist/components/Button.d.ts +1 -0
- package/dist/components/Button.js +8 -5
- package/dist/components/CompactExplanation.d.ts +12 -0
- package/dist/components/CompactExplanation.js +52 -0
- package/dist/components/CompositionSelector.js +2 -4
- package/dist/components/CurrentAsset.d.ts +3 -1
- package/dist/components/CurrentAsset.js +42 -34
- package/dist/components/CurrentComposition.d.ts +1 -1
- package/dist/components/CurrentComposition.js +38 -31
- package/dist/components/DefaultPropsEditor.d.ts +12 -2
- package/dist/components/DefaultPropsEditor.js +2 -2
- package/dist/components/EffectPickerModal.d.ts +5 -0
- package/dist/components/EffectPickerModal.js +179 -0
- package/dist/components/InspectorInfoHeader.d.ts +11 -0
- package/dist/components/InspectorInfoHeader.js +55 -0
- package/dist/components/InspectorPanel/DefaultInspector.d.ts +8 -0
- package/dist/components/InspectorPanel/DefaultInspector.js +93 -0
- package/dist/components/InspectorPanel/EasingInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/EasingInspector.js +41 -0
- package/dist/components/InspectorPanel/GuideInspector.d.ts +7 -0
- package/dist/components/InspectorPanel/GuideInspector.js +55 -0
- package/dist/components/InspectorPanel/KeyframeInspector.d.ts +7 -0
- package/dist/components/InspectorPanel/KeyframeInspector.js +109 -0
- package/dist/components/InspectorPanel/SelectedInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/SelectedInspector.js +26 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.d.ts +5 -0
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +116 -0
- package/dist/components/InspectorPanel/common.d.ts +15 -0
- package/dist/components/InspectorPanel/common.js +18 -0
- package/dist/components/InspectorPanel/inspector-selection.d.ts +10 -0
- package/dist/components/InspectorPanel/inspector-selection.js +34 -0
- package/dist/components/InspectorPanel/styles.d.ts +27 -0
- package/dist/components/InspectorPanel/styles.js +178 -0
- package/dist/components/InspectorPanel/use-track-for-selection.d.ts +2 -0
- package/dist/components/InspectorPanel/use-track-for-selection.js +22 -0
- package/dist/components/InspectorPanel.d.ts +8 -0
- package/dist/components/InspectorPanel.js +26 -0
- package/dist/components/InspectorPanelLayout.d.ts +1 -0
- package/dist/components/InspectorPanelLayout.js +4 -0
- package/dist/components/InspectorSequenceSection.d.ts +16 -0
- package/dist/components/InspectorSequenceSection.js +147 -0
- package/dist/components/InspectorSourceLocation.d.ts +7 -0
- package/dist/components/InspectorSourceLocation.js +71 -0
- package/dist/components/Modals.js +3 -3
- package/dist/components/NewComposition/InputDragger.js +1 -1
- package/dist/components/NewComposition/RemInput.d.ts +1 -0
- package/dist/components/NewComposition/RemInput.js +8 -2
- package/dist/components/NewComposition/RemTextarea.d.ts +1 -0
- package/dist/components/NewComposition/RemTextarea.js +8 -2
- package/dist/components/NewComposition/ValidationMessage.d.ts +3 -0
- package/dist/components/NewComposition/ValidationMessage.js +16 -5
- package/dist/components/OptionsPanel.d.ts +1 -1
- package/dist/components/OptionsPanel.js +8 -17
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +2 -7
- package/dist/components/QuickSwitcher/QuickSwitcherResult.js +3 -10
- package/dist/components/QuickSwitcher/shared.d.ts +4 -0
- package/dist/components/QuickSwitcher/shared.js +24 -0
- package/dist/components/RenderModal/DataEditor.d.ts +29 -2
- package/dist/components/RenderModal/DataEditor.js +107 -56
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -0
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +25 -7
- package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/Fieldset.js +10 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +4 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +27 -4
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +12 -4
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +23 -9
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +8 -1
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +23 -6
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +9 -11
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/WarningIndicatorButton.d.ts +1 -0
- package/dist/components/RenderModal/WarningIndicatorButton.js +17 -4
- package/dist/components/RenderModal/get-render-modal-warnings.d.ts +2 -1
- package/dist/components/RenderModal/get-render-modal-warnings.js +6 -3
- package/dist/components/RendersTab.js +1 -1
- package/dist/components/SegmentedControl.d.ts +3 -0
- package/dist/components/SegmentedControl.js +11 -5
- package/dist/components/SelectedOutlineElement.js +57 -24
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +41 -29
- package/dist/components/SelectedOutlineUvControls.d.ts +9 -0
- package/dist/components/SelectedOutlineUvControls.js +64 -10
- package/dist/components/Tabs/index.js +4 -4
- package/dist/components/Timeline/EasingEditorModal.d.ts +5 -4
- package/dist/components/Timeline/EasingEditorModal.js +597 -124
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +2 -2
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +15 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +85 -1
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +10 -3
- package/dist/components/Timeline/TimelineEffectItem.d.ts +2 -2
- package/dist/components/Timeline/TimelineEffectPropItem.d.ts +8 -0
- package/dist/components/Timeline/TimelineEffectPropItem.js +24 -20
- package/dist/components/Timeline/TimelineExpandedRow.d.ts +5 -2
- package/dist/components/Timeline/TimelineExpandedRow.js +4 -4
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +5 -19
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +8 -2
- package/dist/components/Timeline/TimelineKeyframeControls.js +24 -3
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +2 -47
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +1 -1
- package/dist/components/Timeline/TimelineKeyframedValue.js +8 -10
- package/dist/components/Timeline/TimelineNumberField.js +5 -11
- package/dist/components/Timeline/TimelineRotationField.js +5 -6
- package/dist/components/Timeline/TimelineScaleField.js +4 -8
- package/dist/components/Timeline/TimelineSelection.d.ts +6 -0
- package/dist/components/Timeline/TimelineSelection.js +109 -14
- package/dist/components/Timeline/TimelineSequence.js +19 -3
- package/dist/components/Timeline/TimelineSequenceItem.js +12 -67
- package/dist/components/Timeline/TimelineSequencePropItem.d.ts +12 -2
- package/dist/components/Timeline/TimelineSequencePropItem.js +56 -52
- package/dist/components/Timeline/TimelineTransformOriginField.js +4 -5
- package/dist/components/Timeline/TimelineTranslateField.js +4 -5
- package/dist/components/Timeline/TimelineUvCoordinateField.js +4 -4
- package/dist/components/Timeline/call-add-keyframe.d.ts +4 -4
- package/dist/components/Timeline/call-delete-keyframe.d.ts +4 -4
- package/dist/components/Timeline/call-move-keyframe.d.ts +2 -2
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +3 -3
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +2 -1
- package/dist/components/Timeline/delete-selected-timeline-item.js +27 -1
- package/dist/components/Timeline/parse-keyframe-field-from-node-path.js +2 -2
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +3 -3
- package/dist/components/Timeline/reset-selected-timeline-props.js +19 -5
- package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
- package/dist/components/Timeline/save-sequence-prop.d.ts +2 -2
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -3
- package/dist/components/Timeline/timeline-field-display-utils.d.ts +5 -0
- package/dist/components/Timeline/timeline-field-display-utils.js +244 -0
- package/dist/components/Timeline/update-selected-easing.d.ts +47 -4
- package/dist/components/Timeline/update-selected-easing.js +40 -9
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +13 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +73 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -3
- package/dist/components/Timeline/use-timeline-expanded-tree.d.ts +11 -0
- package/dist/components/Timeline/use-timeline-expanded-tree.js +33 -0
- package/dist/components/VisualControls/VisualControlsContent.d.ts +1 -1
- package/dist/components/VisualControls/VisualControlsContent.js +4 -5
- package/dist/components/effect-drag-and-drop.d.ts +10 -0
- package/dist/components/effect-drag-and-drop.js +17 -8
- package/dist/components/effect-picker-search.d.ts +5 -0
- package/dist/components/effect-picker-search.js +77 -0
- package/dist/components/selected-outline-drag.d.ts +21 -2
- package/dist/components/selected-outline-drag.js +31 -6
- package/dist/components/selected-outline-types.d.ts +7 -7
- package/dist/components/selected-outline-uv.d.ts +4 -3
- package/dist/components/selected-outline-uv.js +6 -2
- package/dist/esm/{chunk-hrw9799x.js → chunk-fge2mq5p.js} +16535 -13311
- package/dist/esm/internals.mjs +16535 -13311
- package/dist/esm/previewEntry.mjs +17141 -13917
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/render-codec-label.d.ts +2 -0
- package/dist/helpers/render-codec-label.js +49 -0
- package/dist/helpers/timeline-layout.d.ts +4 -4
- package/dist/helpers/use-media-metadata.d.ts +8 -2
- package/dist/helpers/use-media-metadata.js +17 -4
- package/dist/state/modals.d.ts +9 -4
- package/package.json +12 -12
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Fieldset = exports.SCHEMA_EDITOR_FIELDSET_PADDING = void 0;
|
|
3
|
+
exports.Fieldset = exports.getSchemaEditorFieldsetPadding = exports.SCHEMA_EDITOR_FIELDSET_PADDING = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
exports.SCHEMA_EDITOR_FIELDSET_PADDING =
|
|
6
|
+
exports.SCHEMA_EDITOR_FIELDSET_PADDING = 6;
|
|
7
|
+
const getSchemaEditorFieldsetPadding = () => {
|
|
8
|
+
return exports.SCHEMA_EDITOR_FIELDSET_PADDING;
|
|
9
|
+
};
|
|
10
|
+
exports.getSchemaEditorFieldsetPadding = getSchemaEditorFieldsetPadding;
|
|
7
11
|
const AlreadyPaddedRightContext = (0, react_1.createContext)(false);
|
|
8
12
|
const Fieldset = ({ children, shouldPad }) => {
|
|
9
13
|
const alreadyPadded = (0, react_1.useContext)(AlreadyPaddedRightContext);
|
|
10
14
|
const style = (0, react_1.useMemo)(() => {
|
|
11
15
|
if (shouldPad) {
|
|
16
|
+
const padding = (0, exports.getSchemaEditorFieldsetPadding)();
|
|
12
17
|
return {
|
|
13
|
-
padding
|
|
14
|
-
paddingTop:
|
|
15
|
-
paddingRight: alreadyPadded ? 0 :
|
|
18
|
+
padding,
|
|
19
|
+
paddingTop: padding / 2,
|
|
20
|
+
paddingRight: alreadyPadded ? 0 : padding,
|
|
16
21
|
};
|
|
17
22
|
}
|
|
18
23
|
return {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type SchemaErrorMode } from './SchemaErrorMessages';
|
|
2
3
|
import type { AnyZodSchema } from './zod-schema-type';
|
|
3
4
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
5
|
export declare const SchemaEditor: React.FC<{
|
|
5
6
|
readonly schema: AnyZodSchema;
|
|
6
7
|
readonly value: Record<string, unknown>;
|
|
7
8
|
readonly setValue: UpdaterFunction<Record<string, unknown>>;
|
|
9
|
+
readonly scrollableContainer?: boolean;
|
|
10
|
+
readonly contentInset?: number;
|
|
11
|
+
readonly errorMode?: SchemaErrorMode;
|
|
8
12
|
}>;
|
|
@@ -4,6 +4,7 @@ exports.SchemaEditor = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
6
6
|
const is_menu_item_1 = require("../../Menu/is-menu-item");
|
|
7
|
+
const Fieldset_1 = require("./Fieldset");
|
|
7
8
|
const SchemaErrorMessages_1 = require("./SchemaErrorMessages");
|
|
8
9
|
const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
|
|
9
10
|
const zod_schema_type_1 = require("./zod-schema-type");
|
|
@@ -14,18 +15,40 @@ const scrollable = {
|
|
|
14
15
|
flexDirection: 'column',
|
|
15
16
|
overflowY: 'auto',
|
|
16
17
|
};
|
|
17
|
-
const
|
|
18
|
+
const notScrollable = {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
};
|
|
22
|
+
const getContainerStyle = ({ contentInset, scrollableContainer, }) => {
|
|
23
|
+
const base = scrollableContainer ? scrollable : notScrollable;
|
|
24
|
+
if (contentInset === undefined) {
|
|
25
|
+
return base;
|
|
26
|
+
}
|
|
27
|
+
const fieldsetPadding = (0, Fieldset_1.getSchemaEditorFieldsetPadding)();
|
|
28
|
+
const rootInset = Math.max(0, contentInset - fieldsetPadding);
|
|
29
|
+
return {
|
|
30
|
+
...base,
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
paddingLeft: rootInset,
|
|
33
|
+
paddingRight: rootInset,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const SchemaEditor = ({ schema, value, setValue, scrollableContainer = true, contentInset, errorMode = 'full', }) => {
|
|
18
37
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
19
38
|
if (!z) {
|
|
20
39
|
throw new Error('expected zod');
|
|
21
40
|
}
|
|
22
41
|
const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
|
|
23
42
|
if (typeName !== 'object' && typeName !== 'discriminatedUnion') {
|
|
24
|
-
return jsx_runtime_1.jsx(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
43
|
+
return jsx_runtime_1.jsx(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName, mode: errorMode });
|
|
25
44
|
}
|
|
45
|
+
const containerStyle = getContainerStyle({
|
|
46
|
+
contentInset,
|
|
47
|
+
scrollableContainer,
|
|
48
|
+
});
|
|
26
49
|
if (typeName === 'discriminatedUnion') {
|
|
27
|
-
return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style:
|
|
50
|
+
return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: containerStyle, className: scrollableContainer ? is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME : undefined, children: jsx_runtime_1.jsx(ZodDiscriminatedUnionEditor_1.ZodDiscriminatedUnionEditor, { schema: schema, setValue: setValue, value: value, mayPad: true, jsonPath: [], onRemove: null }) }));
|
|
28
51
|
}
|
|
29
|
-
return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style:
|
|
52
|
+
return (jsx_runtime_1.jsx("div", { ref: scroll_to_default_props_path_1.defaultPropsEditorScrollableAreaRef, style: containerStyle, className: scrollableContainer ? is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME : undefined, children: jsx_runtime_1.jsx(ZodObjectEditor_1.ZodObjectEditor, { discriminatedUnionReplacement: null, value: value, setValue: setValue, jsonPath: [], schema: schema, onRemove: null, mayPad: true }) }));
|
|
30
53
|
};
|
|
31
54
|
exports.SchemaEditor = SchemaEditor;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { ZodSafeParseResult } from './zod-schema-type';
|
|
2
|
-
export
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
2
|
+
export type SchemaErrorMode = 'full' | 'compact';
|
|
3
|
+
export declare const ZodNotInstalled: React.FC<{
|
|
4
|
+
readonly mode?: SchemaErrorMode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const NoSchemaDefined: React.FC<{
|
|
7
|
+
readonly mode?: SchemaErrorMode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const NoDefaultProps: React.FC<{
|
|
10
|
+
readonly mode?: SchemaErrorMode;
|
|
11
|
+
}>;
|
|
5
12
|
export declare const InvalidDefaultProps: React.FC<{
|
|
6
13
|
zodValidationResult: ZodSafeParseResult;
|
|
7
14
|
}>;
|
|
@@ -9,5 +16,6 @@ export declare const InvalidSchema: React.FC<{
|
|
|
9
16
|
zodValidationResult: ZodSafeParseResult;
|
|
10
17
|
}>;
|
|
11
18
|
export declare const TopLevelZodValue: React.FC<{
|
|
12
|
-
typeReceived: string;
|
|
19
|
+
readonly typeReceived: string;
|
|
20
|
+
readonly mode?: SchemaErrorMode;
|
|
13
21
|
}>;
|
|
@@ -2,9 +2,9 @@
|
|
|
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
|
|
6
5
|
const colors_1 = require("../../../helpers/colors");
|
|
7
6
|
const Button_1 = require("../../Button");
|
|
7
|
+
const CompactExplanation_1 = require("../../CompactExplanation");
|
|
8
8
|
const layout_1 = require("../../layout");
|
|
9
9
|
const styles_1 = require("../../Menu/styles");
|
|
10
10
|
const ZodErrorMessages_1 = require("./ZodErrorMessages");
|
|
@@ -12,10 +12,9 @@ const explainer = {
|
|
|
12
12
|
display: 'flex',
|
|
13
13
|
flex: 1,
|
|
14
14
|
flexDirection: 'column',
|
|
15
|
-
padding:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
textAlign: 'center',
|
|
15
|
+
padding: 12,
|
|
16
|
+
alignItems: 'flex-start',
|
|
17
|
+
textAlign: 'left',
|
|
19
18
|
background: colors_1.BACKGROUND,
|
|
20
19
|
};
|
|
21
20
|
const errorExplanation = {
|
|
@@ -36,7 +35,13 @@ const errorContainer = {
|
|
|
36
35
|
const openDocs = () => {
|
|
37
36
|
window.open('https://www.remotion.dev/docs/schemas');
|
|
38
37
|
};
|
|
39
|
-
const
|
|
38
|
+
const CompactSchemaError = ({ children }) => {
|
|
39
|
+
return (jsx_runtime_1.jsx(CompactExplanation_1.CompactExplanation, { learnMoreHref: "https://www.remotion.dev/docs/schemas", learnMoreAriaLabel: "Learn more about schemas", children: children }));
|
|
40
|
+
};
|
|
41
|
+
const ZodNotInstalled = ({ mode = 'full' }) => {
|
|
42
|
+
if (mode === 'compact') {
|
|
43
|
+
return jsx_runtime_1.jsx(CompactSchemaError, { children: "Install zod to edit props." });
|
|
44
|
+
}
|
|
40
45
|
return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
|
|
41
46
|
jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["Install ",
|
|
42
47
|
jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "zod" }),
|
|
@@ -44,7 +49,10 @@ const ZodNotInstalled = () => {
|
|
|
44
49
|
] }));
|
|
45
50
|
};
|
|
46
51
|
exports.ZodNotInstalled = ZodNotInstalled;
|
|
47
|
-
const NoSchemaDefined = () => {
|
|
52
|
+
const NoSchemaDefined = ({ mode = 'full' }) => {
|
|
53
|
+
if (mode === 'compact') {
|
|
54
|
+
return (jsx_runtime_1.jsx(CompactSchemaError, { children: "Add a schema prop to edit props." }));
|
|
55
|
+
}
|
|
48
56
|
return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
|
|
49
57
|
jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["Make the props of this composition interactively editable by adding a", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "schema" }),
|
|
50
58
|
" prop to the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }),
|
|
@@ -52,7 +60,10 @@ const NoSchemaDefined = () => {
|
|
|
52
60
|
] }));
|
|
53
61
|
};
|
|
54
62
|
exports.NoSchemaDefined = NoSchemaDefined;
|
|
55
|
-
const NoDefaultProps = () => {
|
|
63
|
+
const NoDefaultProps = ({ mode = 'full' }) => {
|
|
64
|
+
if (mode === 'compact') {
|
|
65
|
+
return (jsx_runtime_1.jsx(CompactSchemaError, { children: "Add defaultProps to edit the schema." }));
|
|
66
|
+
}
|
|
56
67
|
return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
|
|
57
68
|
jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }),
|
|
58
69
|
" prop in the", ' ', jsx_runtime_1.jsx("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }),
|
|
@@ -76,7 +87,10 @@ const InvalidSchema = ({ zodValidationResult }) => {
|
|
|
76
87
|
] }));
|
|
77
88
|
};
|
|
78
89
|
exports.InvalidSchema = InvalidSchema;
|
|
79
|
-
const TopLevelZodValue = ({ typeReceived }) => {
|
|
90
|
+
const TopLevelZodValue = ({ typeReceived, mode = 'full' }) => {
|
|
91
|
+
if (mode === 'compact') {
|
|
92
|
+
return (jsx_runtime_1.jsx(CompactSchemaError, { children: "Use z.object() or z.discriminatedUnion() for the top-level schema." }));
|
|
93
|
+
}
|
|
80
94
|
return (jsx_runtime_1.jsxs("div", { style: explainer, children: [
|
|
81
95
|
jsx_runtime_1.jsxs("div", { style: errorExplanation, children: ["The top-level type of the schema must be", ' ', jsx_runtime_1.jsx("code", { style: codeSnippet, children: "z.object()" }),
|
|
82
96
|
" or", ' ', jsx_runtime_1.jsx("code", { style: codeSnippet, children: "z.discriminatedUnion()" }),
|
|
@@ -9,7 +9,7 @@ const InlineRemoveButton_1 = require("../InlineRemoveButton");
|
|
|
9
9
|
const get_schema_label_1 = require("./get-schema-label");
|
|
10
10
|
const scroll_to_default_props_path_1 = require("./scroll-to-default-props-path");
|
|
11
11
|
const compactStyles = {
|
|
12
|
-
fontSize:
|
|
12
|
+
fontSize: 12,
|
|
13
13
|
color: colors_1.LIGHT_TEXT,
|
|
14
14
|
fontFamily: 'sans-serif',
|
|
15
15
|
display: 'flex',
|
|
@@ -22,13 +22,13 @@ const SchemaLabel = ({ jsonPath, onRemove, valid, suffix, handleClick }) => {
|
|
|
22
22
|
const labelStyle = (0, react_1.useMemo)(() => {
|
|
23
23
|
return {
|
|
24
24
|
fontFamily: 'monospace',
|
|
25
|
-
fontSize:
|
|
25
|
+
fontSize: 12,
|
|
26
26
|
color: valid
|
|
27
27
|
? clickableButtonHovered
|
|
28
28
|
? 'white'
|
|
29
29
|
: colors_1.LIGHT_TEXT
|
|
30
30
|
: colors_1.FAIL_COLOR,
|
|
31
|
-
lineHeight: '
|
|
31
|
+
lineHeight: '20px',
|
|
32
32
|
};
|
|
33
33
|
}, [clickableButtonHovered, valid]);
|
|
34
34
|
const onClickablePointerEnter = (0, react_1.useCallback)(() => {
|
|
@@ -57,7 +57,11 @@ const SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAd
|
|
|
57
57
|
}, [isLast, outerHovered]);
|
|
58
58
|
const inner = (0, react_1.useMemo)(() => {
|
|
59
59
|
return {
|
|
60
|
+
alignItems: 'center',
|
|
60
61
|
background: colors_1.BACKGROUND,
|
|
62
|
+
display: 'flex',
|
|
63
|
+
height: exports.VERTICAL_GUIDE_HEIGHT,
|
|
64
|
+
justifyContent: 'center',
|
|
61
65
|
paddingLeft: 10,
|
|
62
66
|
paddingRight: 10,
|
|
63
67
|
};
|
|
@@ -85,7 +89,10 @@ const SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAd
|
|
|
85
89
|
display: 'flex',
|
|
86
90
|
flexDirection: 'column',
|
|
87
91
|
alignItems: 'flex-end',
|
|
88
|
-
}, children: [showAddButton && (jsx_runtime_1.jsx("div", { style: dynamicAddButtonStyle, onPointerEnter: onOuterMouseEnter, onPointerLeave: onOuterMouseLeave, children: jsx_runtime_1.jsx("div", { onClick: onAdd, style: inner, onPointerEnter: onInnerMouseEnter, onPointerLeave: onInnerMouseLeave, children: jsx_runtime_1.jsx(plus_1.Plus, { color: innerHovered ? 'white' : colors_1.LIGHT_TEXT, style: {
|
|
92
|
+
}, children: [showAddButton && (jsx_runtime_1.jsx("div", { style: dynamicAddButtonStyle, onPointerEnter: onOuterMouseEnter, onPointerLeave: onOuterMouseLeave, children: jsx_runtime_1.jsx("div", { onClick: onAdd, style: inner, onPointerEnter: onInnerMouseEnter, onPointerLeave: onInnerMouseLeave, children: jsx_runtime_1.jsx(plus_1.Plus, { color: innerHovered ? 'white' : colors_1.LIGHT_TEXT, style: {
|
|
93
|
+
display: 'block',
|
|
94
|
+
height: exports.VERTICAL_GUIDE_HEIGHT / 2,
|
|
95
|
+
} }) }) })), jsx_runtime_1.jsx("div", { style: arraySeparationLine })
|
|
89
96
|
] }), isLast ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
90
97
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: {
|
|
91
98
|
...layout_2.fieldSetText,
|
|
@@ -32,7 +32,7 @@ const ZodColorEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad })
|
|
|
32
32
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
33
33
|
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: localValue.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
34
34
|
jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
35
|
-
jsx_runtime_1.jsx(ColorPicker_1.ColorPicker, { value: value, status: status, onChange: onPickerChange, onChangeComplete: onPickerComplete, width: 45, height: 39, name: jsonPath.join('.') }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1, block: true }), jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: value, status: status, placeholder: jsonPath.join('.'), onChange: onTextChange, onBlur: onTextBlur, rightAlign: false })
|
|
35
|
+
jsx_runtime_1.jsx(ColorPicker_1.ColorPicker, { value: value, status: status, onChange: onPickerChange, onChangeComplete: onPickerComplete, width: 45, height: 39, name: jsonPath.join('.') }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1, block: true }), jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: value, status: status, placeholder: jsonPath.join('.'), onChange: onTextChange, onBlur: onTextBlur, rightAlign: false, small: true })
|
|
36
36
|
] }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: localValue })
|
|
37
37
|
] })
|
|
38
38
|
] }));
|
|
@@ -55,7 +55,7 @@ const ZodDateEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad })
|
|
|
55
55
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
56
56
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
57
57
|
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
58
|
-
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: formatDate(value), type: "datetime-local", status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, onBlur: onBlur, style: inputStyle, rightAlign: false }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx("div", { style: explainer, children: "Date is in local format" }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
58
|
+
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: formatDate(value), type: "datetime-local", status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, onBlur: onBlur, style: inputStyle, rightAlign: false, small: true }), jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx("div", { style: explainer, children: "Date is in local format" }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
59
59
|
] })
|
|
60
60
|
] }));
|
|
61
61
|
};
|
|
@@ -47,7 +47,7 @@ const ZodDiscriminatedUnionEditor = ({ schema, setValue, value, mayPad, jsonPath
|
|
|
47
47
|
return {
|
|
48
48
|
discriminator,
|
|
49
49
|
markup: (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
50
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: [...jsonPath, discriminator], onRemove: onRemove, suffix: null, valid: zodValidation.success }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { title: "Select type", values: comboBoxValues, selectedId: value[discriminator] })
|
|
50
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: [...jsonPath, discriminator], onRemove: onRemove, suffix: null, valid: zodValidation.success }), jsx_runtime_1.jsx(ComboBox_1.Combobox, { title: "Select type", values: comboBoxValues, selectedId: value[discriminator], small: true })
|
|
51
51
|
] }, 'replacement')),
|
|
52
52
|
};
|
|
53
53
|
}, [
|
|
@@ -39,7 +39,7 @@ const ZodEnumEditor = ({ schema, jsonPath, setValue, value, onRemove }) => {
|
|
|
39
39
|
}, [enumValues, onChange, value]);
|
|
40
40
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
41
41
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: true, children: [
|
|
42
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
42
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, small: true }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
43
43
|
] }));
|
|
44
44
|
};
|
|
45
45
|
exports.ZodEnumEditor = ZodEnumEditor;
|
|
@@ -10,6 +10,10 @@ const schemaLabel = {
|
|
|
10
10
|
fontSize: 14,
|
|
11
11
|
color: colors_1.LIGHT_TEXT,
|
|
12
12
|
};
|
|
13
|
+
const compactSchemaLabel = {
|
|
14
|
+
...schemaLabel,
|
|
15
|
+
fontSize: 12,
|
|
16
|
+
};
|
|
13
17
|
const jsonLabel = {
|
|
14
18
|
color: 'white',
|
|
15
19
|
fontSize: 13,
|
|
@@ -17,29 +21,42 @@ const jsonLabel = {
|
|
|
17
21
|
display: 'flex',
|
|
18
22
|
alignItems: 'center',
|
|
19
23
|
};
|
|
24
|
+
const compactJsonLabel = {
|
|
25
|
+
...jsonLabel,
|
|
26
|
+
fontSize: 12,
|
|
27
|
+
};
|
|
20
28
|
const triangleStyle = {
|
|
21
29
|
width: 12,
|
|
22
30
|
height: 12,
|
|
23
31
|
flexShrink: 0,
|
|
24
32
|
fill: colors_1.FAIL_COLOR,
|
|
25
33
|
};
|
|
26
|
-
const
|
|
34
|
+
const compactTriangleStyle = {
|
|
35
|
+
...triangleStyle,
|
|
36
|
+
width: 10,
|
|
37
|
+
height: 10,
|
|
38
|
+
};
|
|
39
|
+
const ZodErrorMessages = ({ zodValidationResult, viewTab, size = 'default' }) => {
|
|
27
40
|
if (zodValidationResult.success) {
|
|
28
41
|
throw new Error('Expected error');
|
|
29
42
|
}
|
|
30
43
|
const style = (0, react_1.useMemo)(() => {
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
if (viewTab === 'json') {
|
|
45
|
+
return size === 'compact' ? compactJsonLabel : jsonLabel;
|
|
46
|
+
}
|
|
47
|
+
return size === 'compact' ? compactSchemaLabel : schemaLabel;
|
|
48
|
+
}, [size, viewTab]);
|
|
33
49
|
const code = (0, react_1.useMemo)(() => {
|
|
34
50
|
return {
|
|
35
|
-
...schemaLabel,
|
|
51
|
+
...(size === 'compact' ? compactSchemaLabel : schemaLabel),
|
|
36
52
|
fontFamily: 'monospace',
|
|
37
53
|
};
|
|
38
|
-
}, []);
|
|
54
|
+
}, [size]);
|
|
55
|
+
const finalTriangleStyle = size === 'compact' ? compactTriangleStyle : triangleStyle;
|
|
39
56
|
if (viewTab === 'json') {
|
|
40
57
|
return (jsx_runtime_1.jsx("div", { children: zodValidationResult.error.issues.map((error) => {
|
|
41
58
|
return (jsx_runtime_1.jsxs("div", { style: style, children: [
|
|
42
|
-
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style:
|
|
59
|
+
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style: finalTriangleStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: size === 'compact' ? 0.75 : 1 }), error.path.length === 0 ? 'Root' : error.path.join('.'), ":", ' ', error.message] }, error.path.join('.')));
|
|
43
60
|
}) }));
|
|
44
61
|
}
|
|
45
62
|
return (jsx_runtime_1.jsx("div", { children: zodValidationResult.error.issues.map((error) => {
|
|
@@ -14,14 +14,14 @@ const stackTrace = {
|
|
|
14
14
|
padding: 10,
|
|
15
15
|
};
|
|
16
16
|
const stackTraceLabel = {
|
|
17
|
-
fontSize:
|
|
17
|
+
fontSize: 12,
|
|
18
18
|
};
|
|
19
19
|
const ZodFieldValidation = ({ zodValidation, path }) => {
|
|
20
20
|
if (zodValidation.success) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
return (jsx_runtime_1.jsxs("div", { style: legend, children: [
|
|
24
|
-
jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: zodValidation.error.format()._errors[0], type: "error" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InfoBubble_1.InfoBubble, { title: "Zod validation failure", children: jsx_runtime_1.jsxs("div", { style: stackTrace, children: [
|
|
24
|
+
jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: zodValidation.error.format()._errors[0], type: "error", size: "compact" }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InfoBubble_1.InfoBubble, { title: "Zod validation failure", children: jsx_runtime_1.jsxs("div", { style: stackTrace, children: [
|
|
25
25
|
jsx_runtime_1.jsx("div", { style: stackTraceLabel, children: "Zod Validation has failed:" }), zodValidation.error.issues.map((error, index) => (
|
|
26
26
|
// eslint-disable-next-line react/no-array-index-key
|
|
27
27
|
jsx_runtime_1.jsxs("div", { style: stackTraceLabel, children: ["Type: ", error.code, " ",
|
|
@@ -16,7 +16,8 @@ const emptyLabel = {
|
|
|
16
16
|
};
|
|
17
17
|
const wideEmptyLabel = {
|
|
18
18
|
...emptyLabel,
|
|
19
|
-
|
|
19
|
+
fontSize: 12,
|
|
20
|
+
lineHeight: '28px',
|
|
20
21
|
};
|
|
21
22
|
const ZonNonEditableValue = ({ jsonPath, label, mayPad }) => {
|
|
22
23
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
@@ -26,7 +26,7 @@ const ZodNumberEditor = ({ jsonPath, value, schema, setValue, onRemove, mayPad }
|
|
|
26
26
|
const zodValidation = (0, react_1.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
27
27
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
28
28
|
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
29
|
-
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: 'number', value: value, style: fullWidth, status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onTextChange: onTextChange, onValueChange: onNumberChange, onValueChangeEnd: onNumberChangeEnd, min: (0, zod_number_constraints_1.getZodNumberMinimum)(schema), max: (0, zod_number_constraints_1.getZodNumberMaximum)(schema), step: (0, zod_number_constraints_1.getZodNumberStep)(schema), rightAlign: false }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
29
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: 'number', value: value, style: fullWidth, status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onTextChange: onTextChange, onValueChange: onNumberChange, onValueChangeEnd: onNumberChangeEnd, min: (0, zod_number_constraints_1.getZodNumberMinimum)(schema), max: (0, zod_number_constraints_1.getZodNumberMaximum)(schema), step: (0, zod_number_constraints_1.getZodNumberStep)(schema), rightAlign: false, small: true }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
30
30
|
] })
|
|
31
31
|
] }));
|
|
32
32
|
};
|
|
@@ -40,7 +40,6 @@ const react_2 = __importStar(require("react"));
|
|
|
40
40
|
const layout_1 = require("../layout");
|
|
41
41
|
const Fieldset_1 = require("./Fieldset");
|
|
42
42
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
43
|
-
const SchemaSeparationLine_1 = require("./SchemaSeparationLine");
|
|
44
43
|
const SchemaVerticalGuide_1 = require("./SchemaVerticalGuide");
|
|
45
44
|
const zod_schema_type_1 = require("./zod-schema-type");
|
|
46
45
|
const zod_schema_type_2 = require("./zod-schema-type");
|
|
@@ -61,20 +60,19 @@ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, onRemove, mayPad,
|
|
|
61
60
|
return expanded ? ' {' : ' {...}';
|
|
62
61
|
}, [expanded]);
|
|
63
62
|
const zodValidation = (0, react_2.useMemo)(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
64
|
-
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: !isRoot && mayPad, children: [isRoot ? null : (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, valid: zodValidation.success, handleClick: () => setExpanded(!expanded) })), expanded ? (jsx_runtime_1.jsx(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: isRoot, children: keys.map((key
|
|
63
|
+
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: !isRoot && mayPad, children: [isRoot ? null : (jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { jsonPath: jsonPath, onRemove: onRemove, suffix: suffix, valid: zodValidation.success, handleClick: () => setExpanded(!expanded) })), expanded ? (jsx_runtime_1.jsx(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: isRoot, children: keys.map((key) => {
|
|
65
64
|
if (discriminatedUnionReplacement &&
|
|
66
65
|
key === discriminatedUnionReplacement.discriminator) {
|
|
67
66
|
return discriminatedUnionReplacement.markup;
|
|
68
67
|
}
|
|
69
|
-
return (jsx_runtime_1.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}, onRemove: null }), i === keys.length - 1 ? null : jsx_runtime_1.jsx(SchemaSeparationLine_1.SchemaSeparationLine, {})] }, key));
|
|
68
|
+
return (jsx_runtime_1.jsx(react_2.default.Fragment, { children: jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { mayPad: true, jsonPath: [...jsonPath, key], schema: shape[key], value: value[key], setValue: (val, { shouldSave }) => {
|
|
69
|
+
onChange((oldVal) => {
|
|
70
|
+
return {
|
|
71
|
+
...oldVal,
|
|
72
|
+
[key]: typeof val === 'function' ? val(oldVal[key]) : val,
|
|
73
|
+
};
|
|
74
|
+
}, { shouldSave });
|
|
75
|
+
}, onRemove: null }) }, key));
|
|
78
76
|
}) })) : null, isRoot || !expanded ? null : jsx_runtime_1.jsx("div", { style: layout_1.fieldsetLabel, children: '}' })] }));
|
|
79
77
|
};
|
|
80
78
|
exports.ZodObjectEditor = ZodObjectEditor;
|
|
@@ -38,7 +38,7 @@ const ZodStaticFileEditor = ({ schema, jsonPath, setValue, value, onRemove, mayP
|
|
|
38
38
|
});
|
|
39
39
|
}, [onChange, staticFiles, value]);
|
|
40
40
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
41
|
-
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
41
|
+
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsx("div", { style: isRoot ? undefined : container, children: jsx_runtime_1.jsx(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value, small: true }) }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
42
42
|
] }));
|
|
43
43
|
};
|
|
44
44
|
exports.ZodStaticFileEditor = ZodStaticFileEditor;
|
|
@@ -27,7 +27,7 @@ const ZodStringEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad }
|
|
|
27
27
|
}, [setValue, value]);
|
|
28
28
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
29
29
|
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
30
|
-
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: value, status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, onBlur: onBlur, rightAlign: false, name: jsonPath.join('.') }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
30
|
+
jsx_runtime_1.jsx(RemInput_1.RemotionInput, { value: value, status: zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, onBlur: onBlur, rightAlign: false, name: jsonPath.join('.'), small: true }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
31
31
|
] })
|
|
32
32
|
] }));
|
|
33
33
|
};
|
|
@@ -67,7 +67,7 @@ const ZodTextareaEditor = ({ jsonPath, value, setValue, schema, onRemove, mayPad
|
|
|
67
67
|
const zodValidation = react_1.default.useMemo(() => (0, zod_schema_type_1.zodSafeParse)(schema, value), [schema, value]);
|
|
68
68
|
return (jsx_runtime_1.jsxs(Fieldset_1.Fieldset, { shouldPad: mayPad, children: [
|
|
69
69
|
jsx_runtime_1.jsx(SchemaLabel_1.SchemaLabel, { handleClick: null, jsonPath: jsonPath, onRemove: onRemove, valid: zodValidation.success, suffix: null }), jsx_runtime_1.jsxs("div", { style: fullWidth, children: [
|
|
70
|
-
jsx_runtime_1.jsx(RemTextarea_1.RemTextarea, { onChange: onChange, onBlur: onBlur, value: value, status: zodValidation ? 'ok' : 'error', placeholder: jsonPath.join('.'), name: jsonPath.join('.'), style: textareaStyle }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
70
|
+
jsx_runtime_1.jsx(RemTextarea_1.RemTextarea, { onChange: onChange, onBlur: onBlur, value: value, status: zodValidation ? 'ok' : 'error', placeholder: jsonPath.join('.'), name: jsonPath.join('.'), style: textareaStyle, small: true }), jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, zodValidation: zodValidation })
|
|
71
71
|
] })
|
|
72
72
|
] }));
|
|
73
73
|
};
|
|
@@ -21,31 +21,44 @@ const style = {
|
|
|
21
21
|
paddingTop: 4,
|
|
22
22
|
paddingBottom: 4,
|
|
23
23
|
};
|
|
24
|
+
const compactStyle = {
|
|
25
|
+
...style,
|
|
26
|
+
fontSize: 11,
|
|
27
|
+
paddingBottom: 2,
|
|
28
|
+
paddingLeft: 6,
|
|
29
|
+
paddingRight: 6,
|
|
30
|
+
paddingTop: 2,
|
|
31
|
+
};
|
|
24
32
|
const triangleStyle = {
|
|
25
33
|
width: 12,
|
|
26
34
|
height: 12,
|
|
27
35
|
flexShrink: 0,
|
|
28
36
|
fill: colors_1.WARNING_COLOR,
|
|
29
37
|
};
|
|
38
|
+
const compactTriangleStyle = {
|
|
39
|
+
...triangleStyle,
|
|
40
|
+
height: 10,
|
|
41
|
+
width: 10,
|
|
42
|
+
};
|
|
30
43
|
const WarningTriangle = (props) => {
|
|
31
44
|
return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 576 512", ...props, children: jsx_runtime_1.jsx("path", { d: "M248.747 204.705l6.588 112c.373 6.343 5.626 11.295 11.979 11.295h41.37a12 12 0 0 0 11.979-11.295l6.588-112c.405-6.893-5.075-12.705-11.979-12.705h-54.547c-6.903 0-12.383 5.812-11.978 12.705zM330 384c0 23.196-18.804 42-42 42s-42-18.804-42-42 18.804-42 42-42 42 18.804 42 42zm-.423-360.015c-18.433-31.951-64.687-32.009-83.154 0L6.477 440.013C-11.945 471.946 11.118 512 48.054 512H527.94c36.865 0 60.035-39.993 41.577-71.987L329.577 23.985zM53.191 455.002L282.803 57.008c2.309-4.002 8.085-4.002 10.394 0l229.612 397.993c2.308 4-.579 8.998-5.197 8.998H58.388c-4.617.001-7.504-4.997-5.197-8.997z" }) }));
|
|
32
45
|
};
|
|
33
|
-
const WarningIndicatorButton = ({ setShowWarning, showWarning, warningCount }) => {
|
|
46
|
+
const WarningIndicatorButton = ({ setShowWarning, showWarning, warningCount, size = 'default' }) => {
|
|
34
47
|
const onClick = (0, react_1.useCallback)(() => {
|
|
35
48
|
setShowWarning((s) => !s);
|
|
36
49
|
}, [setShowWarning]);
|
|
37
50
|
const buttonStyle = (0, react_1.useMemo)(() => {
|
|
38
51
|
return {
|
|
39
|
-
...style,
|
|
52
|
+
...(size === 'compact' ? compactStyle : style),
|
|
40
53
|
backgroundColor: showWarning ? colors_1.INPUT_BACKGROUND : 'transparent',
|
|
41
54
|
borderColor: showWarning
|
|
42
55
|
? colors_1.INPUT_BORDER_COLOR_HOVERED
|
|
43
56
|
: colors_1.INPUT_BORDER_COLOR_UNHOVERED,
|
|
44
57
|
color: showWarning ? 'white' : colors_1.LIGHT_TEXT,
|
|
45
58
|
};
|
|
46
|
-
}, [showWarning]);
|
|
59
|
+
}, [showWarning, size]);
|
|
47
60
|
return (jsx_runtime_1.jsxs("button", { type: "button", style: buttonStyle, onClick: onClick, children: [
|
|
48
|
-
jsx_runtime_1.jsx(WarningTriangle, { style: triangleStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), warningCount, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx(caret_1.AngleDown, { down: showWarning })
|
|
61
|
+
jsx_runtime_1.jsx(WarningTriangle, { style: size === 'compact' ? compactTriangleStyle : triangleStyle }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), warningCount, jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx(caret_1.AngleDown, { down: showWarning })
|
|
49
62
|
] }));
|
|
50
63
|
};
|
|
51
64
|
exports.WarningIndicatorButton = WarningIndicatorButton;
|
|
@@ -12,7 +12,7 @@ export type TypeCanSaveState = {
|
|
|
12
12
|
reason: string;
|
|
13
13
|
determined: boolean;
|
|
14
14
|
};
|
|
15
|
-
export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }: {
|
|
15
|
+
export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, showCannotSaveDefaultPropsWarning, }: {
|
|
16
16
|
cliProps: unknown;
|
|
17
17
|
canSaveDefaultProps: TypeCanSaveState | null;
|
|
18
18
|
isCustomDateUsed: boolean;
|
|
@@ -21,4 +21,5 @@ export declare const getRenderModalWarnings: ({ cliProps, canSaveDefaultProps, i
|
|
|
21
21
|
jsSetUsed: boolean;
|
|
22
22
|
inJSONEditor: boolean;
|
|
23
23
|
propsEditType: PropsEditType;
|
|
24
|
+
showCannotSaveDefaultPropsWarning: boolean;
|
|
24
25
|
}) => RenderModalWarning[];
|
|
@@ -19,7 +19,10 @@ const getInputPropsWarning = ({ cliProps, propsEditType, }) => {
|
|
|
19
19
|
}
|
|
20
20
|
return null;
|
|
21
21
|
};
|
|
22
|
-
const getCannotSaveDefaultProps = (canSaveDefaultProps) => {
|
|
22
|
+
const getCannotSaveDefaultProps = (canSaveDefaultProps, showCannotSaveDefaultPropsWarning) => {
|
|
23
|
+
if (!showCannotSaveDefaultPropsWarning) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
23
26
|
if (canSaveDefaultProps === null) {
|
|
24
27
|
return null;
|
|
25
28
|
}
|
|
@@ -59,10 +62,10 @@ const setUsed = (used, inJSONEditor) => {
|
|
|
59
62
|
}
|
|
60
63
|
return null;
|
|
61
64
|
};
|
|
62
|
-
const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, }) => {
|
|
65
|
+
const getRenderModalWarnings = ({ cliProps, canSaveDefaultProps, isCustomDateUsed, customFileUsed, jsMapUsed, jsSetUsed, inJSONEditor, propsEditType, showCannotSaveDefaultPropsWarning, }) => {
|
|
63
66
|
return [
|
|
64
67
|
warningOrNull('input-props-override', getInputPropsWarning({ cliProps, propsEditType })),
|
|
65
|
-
getCannotSaveDefaultProps(canSaveDefaultProps),
|
|
68
|
+
getCannotSaveDefaultProps(canSaveDefaultProps, showCannotSaveDefaultPropsWarning),
|
|
66
69
|
warningOrNull('custom-date-used', customDateUsed(isCustomDateUsed, inJSONEditor)),
|
|
67
70
|
warningOrNull('static-file-used', staticFileUsed(customFileUsed, inJSONEditor)),
|
|
68
71
|
warningOrNull('map-used', mapUsed(jsMapUsed, inJSONEditor)),
|
|
@@ -5,7 +5,10 @@ export type SegmentedControlItem = {
|
|
|
5
5
|
key: string;
|
|
6
6
|
selected: boolean;
|
|
7
7
|
};
|
|
8
|
+
type SegmentedControlSize = 'default' | 'compact';
|
|
8
9
|
export declare const SegmentedControl: React.FC<{
|
|
9
10
|
readonly items: SegmentedControlItem[];
|
|
10
11
|
readonly needsWrapping: boolean;
|
|
12
|
+
readonly size?: SegmentedControlSize;
|
|
11
13
|
}>;
|
|
14
|
+
export {};
|