@remotion/cli 4.0.0-alpha13 → 4.0.0-alpha14
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/ansi/ansi-diff.d.ts +1 -1
- package/dist/ansi/ansi-regex.d.ts +2 -0
- package/dist/ansi/ansi-regex.js +18 -0
- package/dist/benchmark.js +29 -14
- package/dist/cleanup-before-quit.js +3 -0
- package/dist/composition-prompts.d.ts +2 -2
- package/dist/compositions.js +8 -7
- package/dist/config/concurrency.d.ts +1 -1
- package/dist/config/ffmpeg-executable.d.ts +5 -0
- package/dist/config/ffmpeg-executable.js +21 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/jpeg-quality.d.ts +1 -1
- package/dist/config/jpeg-quality.js +1 -1
- package/dist/config/number-of-gif-loops.d.ts +1 -1
- package/dist/config/override-webpack.d.ts +1 -1
- package/dist/config/quality.d.ts +2 -0
- package/dist/config/quality.js +17 -0
- package/dist/config/scale.d.ts +1 -1
- package/dist/config/user-agent.d.ts +1 -1
- package/dist/editor/components/CanvasOrLoading.js +3 -0
- package/dist/editor/components/Checkbox.d.ts +1 -0
- package/dist/editor/components/Checkbox.js +2 -2
- package/dist/editor/components/ClipboardIcon.d.ts +2 -0
- package/dist/editor/components/ClipboardIcon.js +12 -0
- package/dist/editor/components/CollapsedCompositionSelector.d.ts +4 -0
- package/dist/editor/components/CollapsedCompositionSelector.js +39 -0
- package/dist/editor/components/CompositionSelectorItem.d.ts +1 -1
- package/dist/editor/components/InlineAction.d.ts +1 -1
- package/dist/editor/components/Menu/MenuItem.d.ts +2 -2
- package/dist/editor/components/Menu/MenuSubItem.d.ts +1 -1
- package/dist/editor/components/NewComposition/ComboBox.d.ts +4 -4
- package/dist/editor/components/NewComposition/CopyHint.js +1 -1
- package/dist/editor/components/NewComposition/InputDragger.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemInput.d.ts +2 -2
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +2 -1
- package/dist/editor/components/NewComposition/RemInputTypeColor.js +1 -1
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
- package/dist/editor/components/Notifications/NotificationCenter.d.ts +2 -2
- package/dist/editor/components/QuickSwitcher/NoResults.d.ts +1 -1
- package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.d.ts +2 -2
- package/dist/editor/components/RenderModal/DataEditor.d.ts +2 -3
- package/dist/editor/components/RenderModal/DataEditor.js +14 -5
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +1 -1
- package/dist/editor/components/RenderModal/MutedSetting.js +1 -1
- package/dist/editor/components/RenderModal/RenderModal.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModal.js +2 -2
- package/dist/editor/components/RenderModal/RenderModalAdvanced.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModalAdvanced.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +3 -2
- package/dist/editor/components/RenderModal/RenderModalData.js +23 -34
- package/dist/editor/components/RenderModal/RenderModalGif.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalInput.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModalPicture.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/Fieldset.d.ts +7 -0
- package/dist/editor/components/RenderModal/SchemaEditor/Fieldset.js +26 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +0 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +2 -3
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -3
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +1 -7
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +14 -22
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +11 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaVerticalGuide.d.ts +5 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaVerticalGuide.js +13 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +51 -42
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +5 -5
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +3 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +14 -13
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +12 -14
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +9 -15
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +5 -30
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +0 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +8 -11
- package/dist/editor/components/RenderModal/SchemaEditor/ZodFieldValidation.d.ts +7 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodFieldValidation.js +27 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +3 -3
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +10 -13
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +39 -45
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +2 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +13 -48
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +7 -10
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +8 -11
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +21 -21
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.js +6 -6
- package/dist/editor/components/RenderModal/SchemaEditor/deep-equal.js +3 -0
- package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/get-schema-label.js +3 -3
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +1 -1
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.d.ts +10 -5
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +56 -15
- package/dist/editor/components/RenderModal/SchemaEditor/zod-types.d.ts +1 -1
- package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +1 -1
- package/dist/editor/components/RenderModal/layout.d.ts +0 -1
- package/dist/editor/components/RenderModal/layout.js +1 -7
- package/dist/editor/components/RenderQueue/actions.d.ts +2 -1
- package/dist/editor/components/RenderQueue/actions.js +7 -2
- package/dist/editor/components/RenderQueue/context.d.ts +1 -1
- package/dist/editor/components/RichTimelineToggle.d.ts +2 -0
- package/dist/editor/components/RichTimelineToggle.js +29 -0
- package/dist/editor/components/RightPanel.d.ts +1 -1
- package/dist/editor/components/RightPanel.js +1 -1
- package/dist/editor/components/SegmentedControl.d.ts +1 -1
- package/dist/editor/components/SegmentedControl.js +2 -0
- package/dist/editor/components/Splitter/SplitterContext.d.ts +3 -3
- package/dist/editor/components/Thumbnail.d.ts +8 -0
- package/dist/editor/components/Thumbnail.js +76 -0
- package/dist/editor/components/Timeline/LoopedIndicator.js +6 -6
- package/dist/editor/components/Timeline/TimelineWidthProvider.d.ts +1 -1
- package/dist/editor/components/Timeline/TimelineZoomControls.js +1 -1
- package/dist/editor/components/Timeline/timeline-state-reducer.d.ts +2 -2
- package/dist/editor/components/UpdateCheck.d.ts +1 -1
- package/dist/editor/components/UpdateCheck.js +2 -4
- package/dist/editor/components/get-zod-if-possible.d.ts +2 -2
- package/dist/editor/helpers/client-id.d.ts +1 -1
- package/dist/editor/helpers/get-timeline-sequence-sort-key.d.ts +3 -3
- package/dist/editor/helpers/persist-open-folders.d.ts +1 -1
- package/dist/editor/helpers/render-modal-sections.d.ts +1 -2
- package/dist/editor/helpers/use-compact-ui.d.ts +1 -0
- package/dist/editor/helpers/use-compact-ui.js +18 -0
- package/dist/editor/helpers/use-menu-structure.d.ts +1 -1
- package/dist/editor/icons/film.d.ts +3 -0
- package/dist/editor/icons/film.js +8 -0
- package/dist/editor/icons/plus.d.ts +3 -1
- package/dist/editor/icons/plus.js +2 -2
- package/dist/editor/icons/timeline.d.ts +3 -0
- package/dist/editor/icons/timeline.js +9 -0
- package/dist/editor/state/checkerboard.d.ts +1 -1
- package/dist/editor/state/editor-zoom-gestures.d.ts +1 -1
- package/dist/editor/state/folders.d.ts +1 -1
- package/dist/editor/state/highest-z-index.d.ts +1 -1
- package/dist/editor/state/in-out.d.ts +2 -2
- package/dist/editor/state/keybindings.d.ts +4 -4
- package/dist/editor/state/modals.d.ts +4 -4
- package/dist/editor/state/preview-size.d.ts +1 -1
- package/dist/editor/state/rich-timeline.d.ts +9 -0
- package/dist/editor/state/rich-timeline.js +17 -0
- package/dist/editor/state/sidebar.d.ts +3 -3
- package/dist/editor/state/timeline-ref.d.ts +1 -1
- package/dist/event-source-events.d.ts +1 -1
- package/dist/file-watcher.d.ts +1 -1
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/get-composition-id.d.ts +10 -11
- package/dist/get-composition-id.js +9 -6
- package/dist/get-composition-with-dimension-override.d.ts +4 -4
- package/dist/get-composition-with-dimension-override.js +2 -2
- package/dist/get-render-media-options.d.ts +8 -0
- package/dist/get-render-media-options.js +55 -0
- package/dist/index.d.ts +5 -4
- package/dist/install.d.ts +2 -0
- package/dist/install.js +36 -0
- package/dist/is-javascript.d.ts +2 -0
- package/dist/is-javascript.js +9 -0
- package/dist/log.d.ts +1 -0
- package/dist/parse-command-line.d.ts +1 -1
- package/dist/preview-server/api-routes.js +2 -0
- package/dist/preview-server/api-types.d.ts +5 -4
- package/dist/preview-server/dev-middleware/get-paths.d.ts +1 -1
- package/dist/preview-server/dev-middleware/is-color-supported.d.ts +1 -0
- package/dist/preview-server/dev-middleware/is-color-supported.js +37 -0
- package/dist/preview-server/dev-middleware/middleware.d.ts +1 -1
- package/dist/preview-server/dev-middleware/range-parser.d.ts +2 -2
- package/dist/preview-server/dev-middleware/types.d.ts +1 -1
- package/dist/preview-server/error-overlay/react-overlay/effects/map-error-to-react-stack.d.ts +1 -1
- package/dist/preview-server/error-overlay/react-overlay/effects/proxy-console.d.ts +3 -3
- package/dist/preview-server/error-overlay/react-overlay/effects/unhandled-error.d.ts +1 -1
- package/dist/preview-server/error-overlay/react-overlay/effects/unhandled-rejection.d.ts +1 -1
- package/dist/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.d.ts +1 -1
- package/dist/preview-server/error-overlay/react-overlay/utils/get-source-map.js +1 -0
- package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.d.ts +2 -2
- package/dist/preview-server/error-overlay/react-overlay/utils/stack-frame.d.ts +4 -4
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorDisplay.d.ts +1 -1
- package/dist/preview-server/error-overlay/remotion-overlay/Overlay.d.ts +2 -2
- package/dist/preview-server/error-overlay/remotion-overlay/get-help-link.d.ts +1 -1
- package/dist/preview-server/get-package-manager.d.ts +2 -2
- package/dist/preview-server/hot-middleware/client.d.ts +1 -1
- package/dist/preview-server/hot-middleware/strip-ansi.d.ts +1 -0
- package/dist/preview-server/hot-middleware/strip-ansi.js +21 -0
- package/dist/preview-server/hot-middleware/types.d.ts +4 -4
- package/dist/preview-server/live-events.d.ts +1 -1
- package/dist/preview-server/live-events.js +10 -1
- package/dist/preview-server/project-info.d.ts +1 -1
- package/dist/preview-server/render-queue/job.d.ts +30 -21
- package/dist/preview-server/render-queue/process-still.js +1 -2
- package/dist/preview-server/routes/update-available.d.ts +3 -0
- package/dist/preview-server/routes/update-available.js +9 -0
- package/dist/preview-server/routes.d.ts +0 -1
- package/dist/preview-server/routes.js +1 -11
- package/dist/preview-server/update-available.d.ts +2 -10
- package/dist/preview.js +2 -0
- package/dist/progress-bar.d.ts +4 -4
- package/dist/progress-bar.js +3 -2
- package/dist/progress-types.d.ts +4 -4
- package/dist/render-flows/render.js +35 -28
- package/dist/render-flows/still.d.ts +1 -1
- package/dist/render-flows/still.js +23 -10
- package/dist/required-chromium-options.d.ts +2 -2
- package/dist/server-ready-comment.d.ts +1 -1
- package/dist/server-ready-comment.js +2 -2
- package/dist/setup-cache.js +10 -0
- package/dist/show-compositions-picker.d.ts +1 -1
- package/dist/step.d.ts +1 -1
- package/dist/studio.js +3 -3
- package/dist/truthy.d.ts +1 -1
- package/package.json +10 -12
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaSeparationLine = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const line = {
|
|
6
|
+
borderBottom: '1px solid rgba(255, 255, 255, 0.1)',
|
|
7
|
+
};
|
|
8
|
+
const SchemaSeparationLine = () => {
|
|
9
|
+
return (0, jsx_runtime_1.jsx)("div", { style: line });
|
|
10
|
+
};
|
|
11
|
+
exports.SchemaSeparationLine = SchemaSeparationLine;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaVerticalGuide = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const SchemaVerticalGuide = ({ isRoot, children }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: isRoot
|
|
7
|
+
? undefined
|
|
8
|
+
: {
|
|
9
|
+
borderLeft: '1px solid rgba(255, 255, 255, 0.1)',
|
|
10
|
+
marginLeft: 4,
|
|
11
|
+
}, children: children }));
|
|
12
|
+
};
|
|
13
|
+
exports.SchemaVerticalGuide = SchemaVerticalGuide;
|
|
@@ -9,9 +9,9 @@ export declare const ZodArrayEditor: React.FC<{
|
|
|
9
9
|
defaultValue: unknown[];
|
|
10
10
|
setValue: UpdaterFunction<unknown[]>;
|
|
11
11
|
onSave: UpdaterFunction<unknown[]>;
|
|
12
|
-
compact: boolean;
|
|
13
12
|
showSaveButton: boolean;
|
|
14
13
|
onRemove: null | (() => void);
|
|
15
14
|
saving: boolean;
|
|
16
15
|
saveDisabledByParent: boolean;
|
|
16
|
+
mayPad: boolean;
|
|
17
17
|
}>;
|
|
@@ -1,30 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.ZodArrayEditor = void 0;
|
|
4
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
7
|
-
const colors_1 = require("../../../helpers/colors");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
8
29
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
9
|
-
const layout_1 = require("../../layout");
|
|
10
|
-
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
11
|
-
const layout_2 = require("../layout");
|
|
12
30
|
const create_zod_values_1 = require("./create-zod-values");
|
|
13
31
|
const deep_equal_1 = require("./deep-equal");
|
|
14
32
|
const local_state_1 = require("./local-state");
|
|
15
|
-
const SchemaLabel_1 = require("./SchemaLabel");
|
|
16
33
|
const ZodArrayItemEditor_1 = require("./ZodArrayItemEditor");
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
34
|
+
const Fieldset_1 = require("./Fieldset");
|
|
35
|
+
const SchemaVerticalGuide_1 = require("./SchemaVerticalGuide");
|
|
36
|
+
const layout_1 = require("../layout");
|
|
37
|
+
const SchemaSeparationLine_1 = require("./SchemaSeparationLine");
|
|
38
|
+
const InlineAction_1 = require("../../InlineAction");
|
|
39
|
+
const plus_1 = require("../../../icons/plus");
|
|
40
|
+
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
41
|
+
const SchemaLabel_1 = require("./SchemaLabel");
|
|
42
|
+
const ZodArrayEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
43
|
+
const { localValue, onChange, RevisionContextProvider, reset } = (0, local_state_1.useLocalState)({
|
|
25
44
|
value,
|
|
26
45
|
schema,
|
|
27
46
|
setValue,
|
|
47
|
+
defaultValue,
|
|
28
48
|
});
|
|
29
49
|
const def = schema._def;
|
|
30
50
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
@@ -36,39 +56,28 @@ const ZodArrayEditor = ({ schema, jsonPath, compact, setValue, defaultValue, val
|
|
|
36
56
|
if (typeName !== z.ZodFirstPartyTypeKind.ZodArray) {
|
|
37
57
|
throw new Error('expected object');
|
|
38
58
|
}
|
|
39
|
-
const isRoot = jsonPath.length === 0;
|
|
40
|
-
const Element = isRoot ? 'div' : 'fieldset';
|
|
41
|
-
const { paddingTop } = layout_2.optionRow;
|
|
42
|
-
const fieldset = (0, react_1.useMemo)(() => {
|
|
43
|
-
return {
|
|
44
|
-
borderRadius: 4,
|
|
45
|
-
borderColor: localValue.zodValidation.success
|
|
46
|
-
? colors_1.INPUT_BORDER_COLOR_UNHOVERED
|
|
47
|
-
: colors_1.FAIL_COLOR,
|
|
48
|
-
};
|
|
49
|
-
}, [localValue.zodValidation.success]);
|
|
50
|
-
const style = (0, react_1.useMemo)(() => {
|
|
51
|
-
if (isRoot) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
return { paddingTop };
|
|
55
|
-
}, [isRoot, paddingTop]);
|
|
56
59
|
const onAdd = (0, react_1.useCallback)(() => {
|
|
57
60
|
onChange((oldV) => {
|
|
58
61
|
return [...oldV, (0, create_zod_values_1.createZodValues)(def.type, z, zodTypes)];
|
|
59
|
-
}, false);
|
|
62
|
+
}, false, true);
|
|
60
63
|
}, [def.type, onChange, z, zodTypes]);
|
|
61
|
-
const reset = (0, react_1.useCallback)(() => {
|
|
62
|
-
onChange(() => defaultValue, true);
|
|
63
|
-
}, [defaultValue, onChange]);
|
|
64
64
|
const isDefaultValue = (0, react_1.useMemo)(() => {
|
|
65
65
|
return (0, deep_equal_1.deepEqual)(localValue.value, defaultValue);
|
|
66
66
|
}, [defaultValue, localValue]);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
const renderAddButton = (0, react_1.useCallback)((color) => {
|
|
68
|
+
return (0, jsx_runtime_1.jsx)(plus_1.Plus, { color: color, style: { height: 12 } });
|
|
69
|
+
}, []);
|
|
70
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { onReset: reset, isDefaultValue: isDefaultValue, jsonPath: jsonPath, onRemove: onRemove, suffix: ' [', onSave: () => {
|
|
71
|
+
onSave(() => localValue.value, false, false);
|
|
72
|
+
}, saveDisabledByParent: saveDisabledByParent, saving: saving, showSaveButton: showSaveButton, valid: localValue.zodValidation.success }), (0, jsx_runtime_1.jsx)(RevisionContextProvider, { children: (0, jsx_runtime_1.jsx)(SchemaVerticalGuide_1.SchemaVerticalGuide, { isRoot: false, children: localValue.value.map((child, i) => {
|
|
73
|
+
var _a;
|
|
74
|
+
return (
|
|
75
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
76
|
+
(0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(ZodArrayItemEditor_1.ZodArrayItemEditor, { onChange: onChange, value: child, def: def, index: i, jsonPath: jsonPath, defaultValue: (_a = defaultValue[i]) !== null && _a !== void 0 ? _a : child, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }), i === localValue.value.length - 1 ? null : ((0, jsx_runtime_1.jsx)(SchemaSeparationLine_1.SchemaSeparationLine, {}))] }, `${i}${localValue.keyStabilityRevision}`));
|
|
77
|
+
}) }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
78
|
+
...layout_1.fieldsetLabel,
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
display: 'flex',
|
|
81
|
+
}, children: [']', (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: onAdd, renderAction: renderAddButton })] }), (0, jsx_runtime_1.jsx)(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })] }));
|
|
73
82
|
};
|
|
74
83
|
exports.ZodArrayEditor = ZodArrayEditor;
|
|
@@ -7,10 +7,10 @@ export declare const ZodArrayItemEditor: React.FC<{
|
|
|
7
7
|
def: any;
|
|
8
8
|
index: number;
|
|
9
9
|
value: unknown;
|
|
10
|
-
compact: boolean;
|
|
11
10
|
defaultValue: unknown;
|
|
12
11
|
onSave: UpdaterFunction<unknown[]>;
|
|
13
12
|
showSaveButton: boolean;
|
|
14
13
|
saving: boolean;
|
|
15
14
|
saveDisabledByParent: boolean;
|
|
15
|
+
mayPad: boolean;
|
|
16
16
|
}>;
|
|
@@ -4,16 +4,16 @@ 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,
|
|
7
|
+
const ZodArrayItemEditor = ({ def, onChange, jsonPath, index, value, defaultValue, onSave: onSaveObject, showSaveButton, saving, saveDisabledByParent, mayPad, }) => {
|
|
8
8
|
const onRemove = (0, react_1.useCallback)(() => {
|
|
9
|
-
onChange((oldV) => [...oldV.slice(0, index), ...oldV.slice(index + 1)], false);
|
|
9
|
+
onChange((oldV) => [...oldV.slice(0, index), ...oldV.slice(index + 1)], false, true);
|
|
10
10
|
}, [index, onChange]);
|
|
11
11
|
const setValue = (0, react_1.useCallback)((val) => {
|
|
12
12
|
onChange((oldV) => [
|
|
13
13
|
...oldV.slice(0, index),
|
|
14
14
|
typeof val === 'function' ? val(oldV[index]) : val,
|
|
15
15
|
...oldV.slice(index + 1),
|
|
16
|
-
], false);
|
|
16
|
+
], false, false);
|
|
17
17
|
}, [index, onChange]);
|
|
18
18
|
const newJsonPath = (0, react_1.useMemo)(() => [...jsonPath, index], [index, jsonPath]);
|
|
19
19
|
const onSave = (0, react_1.useCallback)((updater) => {
|
|
@@ -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
|
-
], false);
|
|
24
|
+
], false, false);
|
|
25
25
|
}, [index, onSaveObject]);
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema: def.type, value: value, setValue: setValue,
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema: def.type, value: value, setValue: setValue, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
27
27
|
};
|
|
28
28
|
exports.ZodArrayItemEditor = ZodArrayItemEditor;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSONPath } from './zod-types';
|
|
3
3
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
4
|
+
import type { z } from 'zod';
|
|
4
5
|
export declare const ZodBooleanEditor: React.FC<{
|
|
6
|
+
schema: z.ZodTypeAny;
|
|
5
7
|
jsonPath: JSONPath;
|
|
6
8
|
value: boolean;
|
|
7
9
|
setValue: UpdaterFunction<boolean>;
|
|
8
|
-
compact: boolean;
|
|
9
10
|
defaultValue: boolean;
|
|
10
11
|
onSave: UpdaterFunction<boolean>;
|
|
11
12
|
onRemove: null | (() => void);
|
|
12
13
|
showSaveButton: boolean;
|
|
13
14
|
saving: boolean;
|
|
14
15
|
saveDisabledByParent: boolean;
|
|
16
|
+
mayPad: boolean;
|
|
15
17
|
}>;
|
|
@@ -4,24 +4,25 @@ exports.ZodBooleanEditor = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Checkbox_1 = require("../../Checkbox");
|
|
7
|
-
const layout_1 = require("../layout");
|
|
8
7
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
8
|
+
const Fieldset_1 = require("./Fieldset");
|
|
9
|
+
const local_state_1 = require("./local-state");
|
|
9
10
|
const fullWidth = {
|
|
10
11
|
width: '100%',
|
|
11
12
|
};
|
|
12
|
-
const ZodBooleanEditor = ({ jsonPath, value, setValue, onSave,
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}, [
|
|
13
|
+
const ZodBooleanEditor = ({ schema, jsonPath, value, setValue, onSave, defaultValue, onRemove, showSaveButton, saving, saveDisabledByParent, mayPad, }) => {
|
|
14
|
+
const { localValue, onChange, reset } = (0, local_state_1.useLocalState)({
|
|
15
|
+
schema,
|
|
16
|
+
setValue,
|
|
17
|
+
value,
|
|
18
|
+
defaultValue,
|
|
19
|
+
});
|
|
20
|
+
const onToggle = (0, react_1.useCallback)((e) => {
|
|
21
|
+
onChange(() => e.target.checked, false, false);
|
|
22
|
+
}, [onChange]);
|
|
22
23
|
const save = (0, react_1.useCallback)(() => {
|
|
23
|
-
onSave(() => value, false);
|
|
24
|
+
onSave(() => value, false, false);
|
|
24
25
|
}, [onSave, value]);
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: true, saveDisabledByParent: saveDisabledByParent, suffix: null }), (0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { name: jsonPath.join('.'), checked: localValue.value, onChange: onToggle, disabled: false }) })] }));
|
|
26
27
|
};
|
|
27
28
|
exports.ZodBooleanEditor = ZodBooleanEditor;
|
|
@@ -10,8 +10,8 @@ export declare const ZodColorEditor: React.FC<{
|
|
|
10
10
|
setValue: UpdaterFunction<string>;
|
|
11
11
|
onSave: UpdaterFunction<string>;
|
|
12
12
|
onRemove: null | (() => void);
|
|
13
|
-
compact: boolean;
|
|
14
13
|
showSaveButton: boolean;
|
|
15
14
|
saving: boolean;
|
|
16
15
|
saveDisabledByParent: boolean;
|
|
16
|
+
mayPad: boolean;
|
|
17
17
|
}>;
|
|
@@ -9,14 +9,14 @@ const layout_1 = require("../../layout");
|
|
|
9
9
|
const InputDragger_1 = require("../../NewComposition/InputDragger");
|
|
10
10
|
const RemInput_1 = require("../../NewComposition/RemInput");
|
|
11
11
|
const RemInputTypeColor_1 = require("../../NewComposition/RemInputTypeColor");
|
|
12
|
-
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
13
|
-
const layout_2 = require("../layout");
|
|
14
12
|
const local_state_1 = require("./local-state");
|
|
15
13
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
14
|
+
const Fieldset_1 = require("./Fieldset");
|
|
15
|
+
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
16
16
|
const fullWidth = {
|
|
17
17
|
width: '100%',
|
|
18
18
|
};
|
|
19
|
-
const ZodColorEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema,
|
|
19
|
+
const ZodColorEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema, onSave, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
20
20
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
21
21
|
if (!z) {
|
|
22
22
|
throw new Error('expected zod');
|
|
@@ -25,27 +25,25 @@ const ZodColorEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValu
|
|
|
25
25
|
if (!zodTypes) {
|
|
26
26
|
throw new Error('expected zod color');
|
|
27
27
|
}
|
|
28
|
-
const { localValue, onChange: onValueChange } = (0, local_state_1.useLocalState)({
|
|
28
|
+
const { localValue, onChange: onValueChange, reset, } = (0, local_state_1.useLocalState)({
|
|
29
29
|
schema,
|
|
30
30
|
setValue,
|
|
31
31
|
value,
|
|
32
|
+
defaultValue,
|
|
32
33
|
});
|
|
33
34
|
const { a, b, g, r } = localValue.zodValidation.success
|
|
34
35
|
? zodTypes.ZodZypesInternals.parseColor(localValue.value)
|
|
35
36
|
: { a: 1, b: 0, g: 0, r: 0 };
|
|
36
37
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
37
38
|
const newColor = (0, color_math_1.colorWithNewOpacity)(e.target.value, Math.round(a), zodTypes);
|
|
38
|
-
onValueChange(() => newColor, false);
|
|
39
|
+
onValueChange(() => newColor, false, false);
|
|
39
40
|
}, [a, onValueChange, zodTypes]);
|
|
40
41
|
const onTextChange = (0, react_1.useCallback)((e) => {
|
|
41
42
|
const newValue = e.target.value;
|
|
42
|
-
onValueChange(() => newValue, false);
|
|
43
|
+
onValueChange(() => newValue, false, false);
|
|
43
44
|
}, [onValueChange]);
|
|
44
|
-
const reset = (0, react_1.useCallback)(() => {
|
|
45
|
-
onValueChange(() => defaultValue, true);
|
|
46
|
-
}, [defaultValue, onValueChange]);
|
|
47
45
|
const save = (0, react_1.useCallback)(() => {
|
|
48
|
-
onSave(() => value, false);
|
|
46
|
+
onSave(() => value, false, false);
|
|
49
47
|
}, [onSave, value]);
|
|
50
48
|
const rgb = `#${r.toString(16).padStart(2, '0')}${g
|
|
51
49
|
.toString(16)
|
|
@@ -60,14 +58,14 @@ const ZodColorEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValu
|
|
|
60
58
|
}, []);
|
|
61
59
|
const onOpacityChange = (0, react_1.useCallback)((newValue) => {
|
|
62
60
|
const newColor = (0, color_math_1.colorWithNewOpacity)(localValue.value, Math.round((Number(newValue) / 100) * 255), zodTypes);
|
|
63
|
-
onValueChange(() => newColor, false);
|
|
61
|
+
onValueChange(() => newColor, false, false);
|
|
64
62
|
}, [localValue.value, onValueChange, zodTypes]);
|
|
65
63
|
const onOpacityValueChange = (0, react_1.useCallback)((newValue) => {
|
|
66
64
|
const newColor = (0, color_math_1.colorWithNewOpacity)(localValue.value, Math.round((Number(newValue) / 100) * 255), zodTypes);
|
|
67
|
-
onValueChange(() => newColor, false);
|
|
65
|
+
onValueChange(() => newColor, false, false);
|
|
68
66
|
}, [localValue.value, onValueChange, zodTypes]);
|
|
69
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent, suffix: null }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: colorPicker, children: (0, jsx_runtime_1.jsx)(RemInputTypeColor_1.RemInputTypeColor, { type: "color", style: {
|
|
70
68
|
height: 39,
|
|
71
|
-
}, value: rgb, onChange: onChange, className: "__remotion_color_picker", status: status }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1, block: true }), (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: status, placeholder: jsonPath.join('.'), onChange: onTextChange, rightAlign: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { onTextChange: onOpacityChange, onValueChange: onOpacityValueChange, status: status, value: (a / 255) * 100, min: 0, max: 100, step: 1, formatter: (v) => `${Math.round(Number(v))}%`, rightAlign: false })] }),
|
|
69
|
+
}, value: rgb, onChange: onChange, className: "__remotion_color_picker", status: status, name: jsonPath.join('.') }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1, block: true }), (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: localValue.value, status: status, placeholder: jsonPath.join('.'), onChange: onTextChange, rightAlign: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { onTextChange: onOpacityChange, onValueChange: onOpacityValueChange, status: status, value: (a / 255) * 100, min: 0, max: 100, step: 1, formatter: (v) => `${Math.round(Number(v))}%`, rightAlign: false })] }), (0, jsx_runtime_1.jsx)(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })] })] }));
|
|
72
70
|
};
|
|
73
71
|
exports.ZodColorEditor = ZodColorEditor;
|
|
@@ -10,8 +10,8 @@ export declare const ZodDateEditor: React.FC<{
|
|
|
10
10
|
setValue: UpdaterFunction<Date>;
|
|
11
11
|
onSave: UpdaterFunction<Date>;
|
|
12
12
|
onRemove: null | (() => void);
|
|
13
|
-
compact: boolean;
|
|
14
13
|
showSaveButton: boolean;
|
|
15
14
|
saving: boolean;
|
|
16
15
|
saveDisabledByParent: boolean;
|
|
16
|
+
mayPad: boolean;
|
|
17
17
|
}>;
|
|
@@ -6,10 +6,10 @@ const react_1 = require("react");
|
|
|
6
6
|
const colors_1 = require("../../../helpers/colors");
|
|
7
7
|
const layout_1 = require("../../layout");
|
|
8
8
|
const RemInput_1 = require("../../NewComposition/RemInput");
|
|
9
|
-
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
10
|
-
const layout_2 = require("../layout");
|
|
11
9
|
const local_state_1 = require("./local-state");
|
|
12
10
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
11
|
+
const Fieldset_1 = require("./Fieldset");
|
|
12
|
+
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
13
13
|
const fullWidth = {
|
|
14
14
|
width: '100%',
|
|
15
15
|
};
|
|
@@ -17,7 +17,6 @@ const explainer = {
|
|
|
17
17
|
fontFamily: 'sans-serif',
|
|
18
18
|
fontSize: 12,
|
|
19
19
|
color: colors_1.VERY_LIGHT_TEXT,
|
|
20
|
-
marginBottom: layout_1.SPACING_UNIT,
|
|
21
20
|
};
|
|
22
21
|
// This will do 2 things:
|
|
23
22
|
// - Make the calendar icon white
|
|
@@ -44,25 +43,20 @@ const formatDate = (date) => {
|
|
|
44
43
|
.padStart(3, '0')}`;
|
|
45
44
|
return formattedDate;
|
|
46
45
|
};
|
|
47
|
-
const ZodDateEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema,
|
|
48
|
-
const { localValue, onChange: setLocalValue } = (0, local_state_1.useLocalState)({
|
|
46
|
+
const ZodDateEditor = ({ jsonPath, value, setValue, showSaveButton, defaultValue, schema, onSave, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
47
|
+
const { localValue, onChange: setLocalValue, reset, } = (0, local_state_1.useLocalState)({
|
|
49
48
|
schema,
|
|
50
49
|
setValue,
|
|
51
50
|
value,
|
|
51
|
+
defaultValue,
|
|
52
52
|
});
|
|
53
|
-
const onValueChange = (0, react_1.useCallback)((newValue, forceApply) => {
|
|
54
|
-
setLocalValue(() => newValue, forceApply);
|
|
55
|
-
}, [setLocalValue]);
|
|
56
53
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
57
54
|
// React does not support e.target.valueAsDate :(
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
const reset = (0, react_1.useCallback)(() => {
|
|
61
|
-
onValueChange(defaultValue, true);
|
|
62
|
-
}, [defaultValue, onValueChange]);
|
|
55
|
+
setLocalValue(() => new Date(e.target.value), false, false);
|
|
56
|
+
}, [setLocalValue]);
|
|
63
57
|
const save = (0, react_1.useCallback)(() => {
|
|
64
|
-
onSave(() => value, false);
|
|
58
|
+
onSave(() => value, false, false);
|
|
65
59
|
}, [onSave, value]);
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value.getTime() === defaultValue.getTime(), jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent, suffix: null }), (0, jsx_runtime_1.jsxs)("div", { style: fullWidth, children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: formatDate(localValue.value), type: "datetime-local", status: localValue.zodValidation.success ? 'ok' : 'error', placeholder: jsonPath.join('.'), onChange: onChange, style: inputStyle, rightAlign: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: explainer, children: "Date is in local format" }), (0, jsx_runtime_1.jsx)(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })] })] }));
|
|
67
61
|
};
|
|
68
62
|
exports.ZodDateEditor = ZodDateEditor;
|
|
@@ -5,7 +5,6 @@ import type { UpdaterFunction } from './ZodSwitch';
|
|
|
5
5
|
export declare const ZodDefaultEditor: React.FC<{
|
|
6
6
|
showSaveButton: boolean;
|
|
7
7
|
jsonPath: JSONPath;
|
|
8
|
-
compact: boolean;
|
|
9
8
|
value: unknown;
|
|
10
9
|
defaultValue: unknown;
|
|
11
10
|
schema: z.ZodTypeAny;
|
|
@@ -14,4 +13,5 @@ export declare const ZodDefaultEditor: React.FC<{
|
|
|
14
13
|
onRemove: null | (() => void);
|
|
15
14
|
saving: boolean;
|
|
16
15
|
saveDisabledByParent: boolean;
|
|
16
|
+
mayPad: boolean;
|
|
17
17
|
}>;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZodDefaultEditor = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
6
|
-
const ZodDefaultEditor = ({ jsonPath,
|
|
6
|
+
const ZodDefaultEditor = ({ jsonPath, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
7
7
|
const { innerType } = schema._def;
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, {
|
|
8
|
+
return ((0, 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
9
|
};
|
|
10
10
|
exports.ZodDefaultEditor = ZodDefaultEditor;
|
|
@@ -7,10 +7,10 @@ export declare const ZodEffectEditor: React.FC<{
|
|
|
7
7
|
jsonPath: JSONPath;
|
|
8
8
|
value: unknown;
|
|
9
9
|
setValue: UpdaterFunction<unknown>;
|
|
10
|
-
compact: boolean;
|
|
11
10
|
defaultValue: unknown;
|
|
12
11
|
onSave: UpdaterFunction<unknown>;
|
|
13
12
|
showSaveButton: boolean;
|
|
14
13
|
onRemove: null | (() => void);
|
|
15
14
|
saving: boolean;
|
|
15
|
+
mayPad: boolean;
|
|
16
16
|
}>;
|
|
@@ -2,27 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZodEffectEditor = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const colors_1 = require("../../../helpers/colors");
|
|
7
5
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
8
|
-
const layout_1 = require("../../layout");
|
|
9
|
-
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
10
|
-
const InfoBubble_1 = require("../InfoBubble");
|
|
11
6
|
const local_state_1 = require("./local-state");
|
|
12
7
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
8
|
+
const Fieldset_1 = require("./Fieldset");
|
|
9
|
+
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
13
10
|
const fullWidth = {
|
|
14
11
|
width: '100%',
|
|
15
12
|
};
|
|
16
|
-
const
|
|
17
|
-
padding: 10,
|
|
18
|
-
};
|
|
19
|
-
const stackTraceLabel = {
|
|
20
|
-
fontSize: 14,
|
|
21
|
-
};
|
|
22
|
-
const legend = {
|
|
23
|
-
display: 'flex',
|
|
24
|
-
};
|
|
25
|
-
const ZodEffectEditor = ({ schema, jsonPath, value, setValue: updateValue, compact, defaultValue, onSave, onRemove, showSaveButton, saving, }) => {
|
|
13
|
+
const ZodEffectEditor = ({ schema, jsonPath, value, setValue: updateValue, defaultValue, onSave, onRemove, showSaveButton, saving, mayPad, }) => {
|
|
26
14
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
27
15
|
if (!z) {
|
|
28
16
|
throw new Error('expected zod');
|
|
@@ -31,26 +19,13 @@ const ZodEffectEditor = ({ schema, jsonPath, value, setValue: updateValue, compa
|
|
|
31
19
|
value,
|
|
32
20
|
schema,
|
|
33
21
|
setValue: updateValue,
|
|
22
|
+
defaultValue,
|
|
34
23
|
});
|
|
35
24
|
const def = schema._def;
|
|
36
25
|
const typeName = def.typeName;
|
|
37
26
|
if (typeName !== z.ZodFirstPartyTypeKind.ZodEffects) {
|
|
38
27
|
throw new Error('expected effect');
|
|
39
28
|
}
|
|
40
|
-
|
|
41
|
-
if (!localValue.zodValidation.success) {
|
|
42
|
-
return {
|
|
43
|
-
border: `1px solid ${colors_1.FAIL_COLOR}`,
|
|
44
|
-
borderRadius: 4,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
border: 'none',
|
|
49
|
-
padding: 0,
|
|
50
|
-
};
|
|
51
|
-
}, [localValue.zodValidation.success]);
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)("fieldset", { style: container, children: [(0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onChange, jsonPath: jsonPath, schema: def.schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: !localValue.zodValidation.success }) }), !localValue.zodValidation.success && ((0, jsx_runtime_1.jsxs)("legend", { style: legend, children: [(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, { x: 0.5 }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Zod validation failure", children: (0, jsx_runtime_1.jsxs)("div", { style: stackTrace, children: [(0, jsx_runtime_1.jsx)("div", { style: stackTraceLabel, children: "Zod Validation has failed:" }), localValue.zodValidation.error.errors.map((error, index) => (
|
|
53
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
54
|
-
(0, jsx_runtime_1.jsxs)("div", { style: stackTraceLabel, children: ["Type: ", error.code, " ", (0, jsx_runtime_1.jsx)("br", {}), "Message: ", error.message] }, index)))] }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 })] }))] }));
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onChange, jsonPath: jsonPath, schema: def.schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: !localValue.zodValidation.success, mayPad: false }) }), (0, jsx_runtime_1.jsx)(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })] }));
|
|
55
30
|
};
|
|
56
31
|
exports.ZodEffectEditor = ZodEffectEditor;
|
|
@@ -5,24 +5,24 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Checkmark_1 = require("../../../icons/Checkmark");
|
|
7
7
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
8
|
-
const layout_1 = require("../../layout");
|
|
9
8
|
const ComboBox_1 = require("../../NewComposition/ComboBox");
|
|
10
|
-
const ValidationMessage_1 = require("../../NewComposition/ValidationMessage");
|
|
11
|
-
const layout_2 = require("../layout");
|
|
12
9
|
const local_state_1 = require("./local-state");
|
|
13
10
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
11
|
+
const Fieldset_1 = require("./Fieldset");
|
|
12
|
+
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
14
13
|
const container = {
|
|
15
14
|
width: '100%',
|
|
16
15
|
};
|
|
17
|
-
const ZodEnumEditor = ({ schema, jsonPath,
|
|
16
|
+
const ZodEnumEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, }) => {
|
|
18
17
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
19
18
|
if (!z) {
|
|
20
19
|
throw new Error('expected zod');
|
|
21
20
|
}
|
|
22
|
-
const { localValue, onChange: setLocalValue } = (0, local_state_1.useLocalState)({
|
|
21
|
+
const { localValue, onChange: setLocalValue, reset, } = (0, local_state_1.useLocalState)({
|
|
23
22
|
schema,
|
|
24
23
|
setValue,
|
|
25
24
|
value,
|
|
25
|
+
defaultValue,
|
|
26
26
|
});
|
|
27
27
|
const def = schema._def;
|
|
28
28
|
const typeName = def.typeName;
|
|
@@ -30,9 +30,6 @@ const ZodEnumEditor = ({ schema, jsonPath, compact, setValue, defaultValue, valu
|
|
|
30
30
|
throw new Error('expected enum');
|
|
31
31
|
}
|
|
32
32
|
const isRoot = jsonPath.length === 0;
|
|
33
|
-
const reset = (0, react_1.useCallback)(() => {
|
|
34
|
-
setLocalValue(() => defaultValue, true);
|
|
35
|
-
}, [defaultValue, setLocalValue]);
|
|
36
33
|
const comboBoxValues = (0, react_1.useMemo)(() => {
|
|
37
34
|
return def.values.map((option) => {
|
|
38
35
|
return {
|
|
@@ -42,7 +39,7 @@ const ZodEnumEditor = ({ schema, jsonPath, compact, setValue, defaultValue, valu
|
|
|
42
39
|
keyHint: null,
|
|
43
40
|
leftItem: option === value ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
44
41
|
onClick: (id) => {
|
|
45
|
-
setLocalValue(() => id, false);
|
|
42
|
+
setLocalValue(() => id, false, false);
|
|
46
43
|
},
|
|
47
44
|
quickSwitcherLabel: null,
|
|
48
45
|
subMenu: null,
|
|
@@ -51,8 +48,8 @@ const ZodEnumEditor = ({ schema, jsonPath, compact, setValue, defaultValue, valu
|
|
|
51
48
|
});
|
|
52
49
|
}, [def.values, setLocalValue, value]);
|
|
53
50
|
const save = (0, react_1.useCallback)(() => {
|
|
54
|
-
onSave(() => value, false);
|
|
51
|
+
onSave(() => value, false, false);
|
|
55
52
|
}, [onSave, value]);
|
|
56
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: true, success: localValue.zodValidation.success, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { onSave: save, showSaveButton: showSaveButton, isDefaultValue: localValue.value === defaultValue, onReset: reset, jsonPath: jsonPath, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: !localValue.zodValidation.success, suffix: null }), (0, jsx_runtime_1.jsx)("div", { style: isRoot ? undefined : container, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: comboBoxValues, selectedId: value, title: value }) }), (0, jsx_runtime_1.jsx)(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })] }));
|
|
57
54
|
};
|
|
58
55
|
exports.ZodEnumEditor = ZodEnumEditor;
|