@remotion/cli 4.0.0-alpha.217 → 4.0.0-alpha10
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/benchmark.js +11 -6
- package/dist/better-opn/index.js +3 -3
- package/dist/chalk/index.d.ts +45 -54
- package/dist/chalk/index.js +2 -135
- package/dist/codemods/stringify-with-path.d.ts +5 -0
- package/dist/codemods/stringify-with-path.js +44 -0
- package/dist/codemods/update-default-props.d.ts +4 -2
- package/dist/codemods/update-default-props.js +3 -18
- package/dist/color-math.d.ts +2 -2
- package/dist/color-math.js +5 -3
- package/dist/compositions.js +1 -0
- package/dist/config/image-format.d.ts +1 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/log.d.ts +1 -3
- package/dist/config/log.js +2 -9
- package/dist/convert-entry-point-to-serve-url.js +2 -2
- package/dist/download-progress.d.ts +1 -1
- package/dist/download-progress.js +1 -4
- package/dist/editor/components/CanvasOrLoading.d.ts +5 -0
- package/dist/editor/components/CanvasOrLoading.js +66 -0
- package/dist/editor/components/CheckboardToggle.js +2 -1
- package/dist/editor/components/CompositionSelectorItem.js +2 -2
- package/dist/editor/components/CurrentCompositionSideEffects.js +3 -3
- package/dist/editor/components/InitialCompositionLoader.js +1 -1
- package/dist/editor/components/InlineAction.d.ts +6 -4
- package/dist/editor/components/InlineAction.js +7 -8
- package/dist/editor/components/LoopToggle.js +2 -1
- package/dist/editor/components/Menu/MenuItem.js +1 -1
- package/dist/editor/components/Menu/SubMenu.js +1 -1
- package/dist/editor/components/Menu/styles.d.ts +1 -0
- package/dist/editor/components/Menu/styles.js +6 -1
- package/dist/editor/components/MenuBuildIndicator.js +20 -1
- package/dist/editor/components/MenuToolbar.js +15 -3
- package/dist/editor/components/Modals.js +2 -2
- package/dist/editor/components/NewComposition/ComboBox.js +20 -5
- package/dist/editor/components/NewComposition/InputDragger.js +3 -2
- package/dist/editor/components/NewComposition/MenuContent.d.ts +1 -0
- package/dist/editor/components/NewComposition/MenuContent.js +12 -4
- package/dist/editor/components/Notifications/ServerDisconnected.js +2 -2
- package/dist/editor/components/OpenEditorButton.d.ts +2 -0
- package/dist/editor/components/OpenEditorButton.js +52 -0
- package/dist/editor/components/PlayPause.js +4 -2
- package/dist/editor/components/PreviewToolbar.js +2 -2
- package/dist/editor/components/QuickSwitcher/algolia-search.js +1 -1
- package/dist/editor/components/RenderButton.d.ts +1 -5
- package/dist/editor/components/RenderButton.js +48 -21
- package/dist/editor/components/RenderModal/CliCopyButton.js +51 -14
- package/dist/editor/components/RenderModal/CrfSetting.d.ts +0 -1
- package/dist/editor/components/RenderModal/CrfSetting.js +0 -1
- package/dist/editor/components/RenderModal/DataEditor.d.ts +21 -0
- package/dist/editor/components/RenderModal/DataEditor.js +287 -0
- package/dist/editor/components/RenderModal/EnforceAudioTrackSetting.js +3 -2
- package/dist/editor/components/RenderModal/InfoBubble.js +2 -1
- package/dist/editor/components/RenderModal/InfoTooltip.d.ts +1 -0
- package/dist/editor/components/RenderModal/InfoTooltip.js +6 -5
- package/dist/editor/components/RenderModal/InlineEyeIcon.js +6 -3
- package/dist/editor/components/RenderModal/InlineRemoveButton.js +6 -1
- package/dist/editor/components/RenderModal/MutedSetting.js +3 -2
- package/dist/editor/components/RenderModal/OptionExplainer.js +14 -3
- package/dist/editor/components/RenderModal/RenderModal.d.ts +7 -3
- package/dist/editor/components/RenderModal/RenderModal.js +108 -49
- package/dist/editor/components/RenderModal/RenderModalAdvanced.js +0 -2
- package/dist/editor/components/RenderModal/RenderModalAudio.js +1 -1
- package/dist/editor/components/RenderModal/RenderModalBasic.d.ts +3 -2
- package/dist/editor/components/RenderModal/RenderModalBasic.js +4 -3
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +16 -4
- package/dist/editor/components/RenderModal/RenderModalData.js +109 -42
- package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +14 -0
- package/dist/editor/components/RenderModal/{RenderModalJSONInputPropsEditor.js → RenderModalJSONPropsEditor.js} +51 -30
- package/dist/editor/components/RenderModal/RenderModalPicture.d.ts +2 -2
- package/dist/editor/components/RenderModal/RenderModalPicture.js +2 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +6 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +4 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +15 -6
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +5 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaLabel.js +5 -4
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaResetButton.js +6 -1
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/SchemaSaveButton.js +7 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +19 -29
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +4 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +7 -7
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +23 -66
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +13 -21
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +17 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +10 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +20 -19
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +4 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +12 -26
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +16 -32
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +7 -4
- package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +18 -11
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +44 -11
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +17 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +59 -0
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +12 -23
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +32 -21
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +5 -2
- package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.js +6 -6
- package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
- package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.js +22 -22
- package/dist/editor/components/RenderModal/SchemaEditor/deep-equal.d.ts +1 -0
- package/dist/editor/components/RenderModal/SchemaEditor/deep-equal.js +27 -0
- package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
- package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +14 -0
- package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +42 -0
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.d.ts +16 -0
- package/dist/editor/components/RenderModal/SchemaEditor/local-state.js +38 -0
- package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +9 -1
- package/dist/editor/components/RenderModal/get-render-modal-warnings.js +42 -8
- package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
- package/dist/editor/components/RenderModal/layout.js +3 -0
- package/dist/editor/components/RenderModal/out-name-checker.js +1 -11
- package/dist/editor/components/RenderQueue/RenderQueueItemCancelButton.js +5 -1
- package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.js +5 -1
- package/dist/editor/components/RenderQueue/RenderQueueRemoveItem.js +5 -1
- package/dist/editor/components/RenderQueue/RenderQueueRepeat.js +5 -1
- package/dist/editor/components/RenderQueue/actions.d.ts +4 -3
- package/dist/editor/components/RenderQueue/actions.js +8 -3
- package/dist/editor/components/RenderQueue/index.js +9 -2
- package/dist/editor/components/RightPanel.js +8 -5
- package/dist/editor/components/SidebarCollapserControls.js +22 -9
- package/dist/editor/components/SidebarRenderButton.d.ts +6 -0
- package/dist/editor/components/{RenderToolbarIcon.js → SidebarRenderButton.js} +27 -41
- package/dist/editor/components/Spinner.d.ts +5 -0
- package/dist/editor/components/Spinner.js +41 -0
- package/dist/editor/components/Tabs/index.js +12 -14
- package/dist/editor/components/Timeline/Timeline.js +3 -1
- package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.js +4 -3
- package/dist/editor/components/Timeline/TimelineSequence.js +8 -6
- package/dist/editor/components/TimelineInOutToggle.js +2 -4
- package/dist/editor/components/TopPanel.js +2 -2
- package/dist/editor/components/UpdateCheck.js +2 -1
- package/dist/editor/components/get-zod-if-possible.d.ts +3 -3
- package/dist/editor/components/get-zod-if-possible.js +11 -11
- package/dist/editor/helpers/calculate-timeline.js +1 -1
- package/dist/editor/helpers/client-id.d.ts +2 -2
- package/dist/editor/helpers/client-id.js +5 -5
- package/dist/editor/helpers/colors.d.ts +4 -2
- package/dist/editor/helpers/colors.js +4 -2
- package/dist/editor/helpers/get-timeline-sequence-layout.d.ts +2 -2
- package/dist/editor/helpers/is-composition-still.d.ts +3 -2
- package/dist/editor/helpers/is-current-selected-still.js +3 -4
- package/dist/editor/helpers/use-file-existence.js +1 -1
- package/dist/editor/helpers/use-menu-structure.js +1 -1
- package/dist/editor/icons/media-volume.js +2 -1
- package/dist/editor/icons/render.d.ts +1 -0
- package/dist/editor/icons/render.js +1 -1
- package/dist/editor/state/modals.d.ts +3 -1
- package/dist/entry-point.js +17 -17
- package/dist/event-source-events.d.ts +2 -0
- package/dist/event-source.js +2 -2
- package/dist/ffmpeg.js +14 -5
- package/dist/file-watcher.js +5 -5
- package/dist/get-cli-options.d.ts +3 -3
- package/dist/get-cli-options.js +4 -4
- package/dist/get-composition-id.d.ts +14 -2
- package/dist/get-composition-id.js +32 -8
- package/dist/get-composition-with-dimension-override.d.ts +13 -2
- package/dist/get-composition-with-dimension-override.js +12 -2
- package/dist/get-config-file-name.js +6 -6
- package/dist/get-env.js +10 -10
- package/dist/get-filename.js +1 -0
- package/dist/get-input-props.d.ts +1 -1
- package/dist/get-input-props.js +9 -9
- package/dist/get-network-address.js +2 -2
- package/dist/handle-common-errors.d.ts +2 -1
- package/dist/handle-common-errors.js +2 -2
- package/dist/index.d.ts +41 -19
- package/dist/index.js +9 -6
- package/dist/list-of-remotion-packages.js +2 -1
- package/dist/load-config.js +8 -8
- package/dist/log.d.ts +5 -5
- package/dist/log.js +3 -42
- package/dist/parse-command-line.d.ts +1 -0
- package/dist/preview-server/api-types.d.ts +3 -3
- package/dist/preview-server/dev-middleware/compatible-api.d.ts +2 -2
- package/dist/preview-server/dev-middleware/middleware.d.ts +1 -1
- package/dist/preview-server/dev-middleware/middleware.js +7 -7
- package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
- package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
- package/dist/preview-server/error-overlay/react-overlay/utils/get-file-source.js +5 -5
- package/dist/preview-server/error-overlay/react-overlay/utils/open-in-editor.js +17 -17
- package/dist/preview-server/error-overlay/remotion-overlay/CalculateMetadataErrorExplainer.d.ts +2 -0
- package/dist/preview-server/error-overlay/remotion-overlay/CalculateMetadataErrorExplainer.js +18 -0
- package/dist/preview-server/error-overlay/remotion-overlay/CodeFrame.js +30 -12
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorDisplay.d.ts +4 -0
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorDisplay.js +5 -2
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorLoader.d.ts +4 -0
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorLoader.js +5 -5
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorTitle.d.ts +1 -0
- package/dist/preview-server/error-overlay/remotion-overlay/ErrorTitle.js +4 -3
- package/dist/preview-server/error-overlay/remotion-overlay/HelpLink.js +2 -1
- package/dist/preview-server/error-overlay/remotion-overlay/Overlay.js +1 -1
- package/dist/preview-server/error-overlay/remotion-overlay/Retry.d.ts +4 -0
- package/dist/preview-server/error-overlay/remotion-overlay/Retry.js +9 -0
- package/dist/preview-server/file-existence-watchers.js +3 -3
- package/dist/preview-server/get-absolute-public-dir.js +3 -3
- package/dist/preview-server/get-package-manager.js +3 -3
- package/dist/preview-server/handler.d.ts +1 -1
- package/dist/preview-server/hot-middleware/index.d.ts +1 -1
- package/dist/preview-server/hot-middleware/index.js +2 -2
- package/dist/preview-server/live-events.d.ts +1 -1
- package/dist/preview-server/parse-body.d.ts +1 -1
- package/dist/preview-server/project-info.js +5 -5
- package/dist/preview-server/public-folder.js +8 -8
- package/dist/preview-server/render-queue/job.d.ts +11 -2
- package/dist/preview-server/render-queue/make-retry-payload.js +5 -1
- package/dist/preview-server/render-queue/open-directory-in-finder.js +8 -8
- package/dist/preview-server/render-queue/process-still.js +1 -0
- package/dist/preview-server/render-queue/queue.js +4 -4
- package/dist/preview-server/routes/can-update-default-props.js +3 -2
- package/dist/preview-server/routes/update-default-props.d.ts +2 -2
- package/dist/preview-server/routes/update-default-props.js +26 -15
- package/dist/preview-server/routes.d.ts +3 -2
- package/dist/preview-server/routes.js +10 -10
- package/dist/preview-server/serve-static.d.ts +1 -1
- package/dist/preview-server/serve-static.js +7 -7
- package/dist/preview-server/start-server.js +3 -3
- package/dist/preview.js +6 -4
- package/dist/print-error.d.ts +2 -1
- package/dist/print-error.js +8 -5
- package/dist/print-help.js +1 -1
- package/dist/progress-bar.d.ts +5 -4
- package/dist/progress-bar.js +42 -29
- package/dist/render-flows/render.d.ts +1 -1
- package/dist/render-flows/render.js +62 -35
- package/dist/render-flows/still.d.ts +3 -2
- package/dist/render-flows/still.js +34 -28
- package/dist/resolve-from.js +5 -5
- package/dist/setup-cache.d.ts +2 -1
- package/dist/setup-cache.js +10 -6
- package/dist/should-use-non-overlaying-logger.d.ts +4 -0
- package/dist/should-use-non-overlaying-logger.js +12 -0
- package/dist/show-compositions-picker.d.ts +8 -0
- package/dist/show-compositions-picker.js +51 -0
- package/dist/still.js +1 -0
- package/dist/studio.d.ts +1 -0
- package/dist/studio.js +140 -0
- package/dist/upgrade.js +2 -2
- package/dist/user-passed-output-location.d.ts +3 -2
- package/dist/user-passed-output-location.js +10 -5
- package/dist/versions.js +2 -2
- package/dist/watch-root-file.d.ts +1 -0
- package/dist/watch-root-file.js +22 -0
- package/package.json +89 -88
- package/styles/styles.css +4 -5
- package/dist/editor/components/CollapsableOptions.d.ts +0 -6
- package/dist/editor/components/CollapsableOptions.js +0 -35
- package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.d.ts +0 -10
- package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -2
- package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -21
- package/dist/editor/components/RenderToolbarIcon.d.ts +0 -2
- package/dist/editor/icons/RenderStillIcon.d.ts +0 -3
- package/dist/editor/icons/RenderStillIcon.js +0 -8
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.DataEditor = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const remotion_1 = require("remotion");
|
|
@@ -32,10 +32,13 @@ const colors_1 = require("../../helpers/colors");
|
|
|
32
32
|
const get_zod_if_possible_1 = require("../get-zod-if-possible");
|
|
33
33
|
const layout_1 = require("../layout");
|
|
34
34
|
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
35
|
+
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
35
36
|
const actions_1 = require("../RenderQueue/actions");
|
|
36
37
|
const SegmentedControl_1 = require("../SegmentedControl");
|
|
37
38
|
const get_render_modal_warnings_1 = require("./get-render-modal-warnings");
|
|
38
|
-
const
|
|
39
|
+
const RenderModalJSONPropsEditor_1 = require("./RenderModalJSONPropsEditor");
|
|
40
|
+
const extract_enum_json_paths_1 = require("./SchemaEditor/extract-enum-json-paths");
|
|
41
|
+
const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
|
|
39
42
|
const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
|
|
40
43
|
const SchemaErrorMessages_1 = require("./SchemaEditor/SchemaErrorMessages");
|
|
41
44
|
const WarningIndicatorButton_1 = require("./WarningIndicatorButton");
|
|
@@ -59,6 +62,7 @@ const outer = {
|
|
|
59
62
|
flexDirection: 'column',
|
|
60
63
|
flex: 1,
|
|
61
64
|
overflow: 'hidden',
|
|
65
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
62
66
|
};
|
|
63
67
|
const controlContainer = {
|
|
64
68
|
flexDirection: 'column',
|
|
@@ -83,29 +87,40 @@ const getPersistedShowWarningState = () => {
|
|
|
83
87
|
const setPersistedShowWarningState = (val) => {
|
|
84
88
|
localStorage.setItem(persistanceKey, String(Boolean(val)));
|
|
85
89
|
};
|
|
86
|
-
const
|
|
90
|
+
const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact, mayShowSaveButton, propsEditType, }) => {
|
|
87
91
|
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
88
92
|
const [valBeforeSafe, setValBeforeSafe] = (0, react_1.useState)(inputProps);
|
|
93
|
+
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
89
94
|
const [showWarning, setShowWarningWithoutPersistance] = (0, react_1.useState)(() => getPersistedShowWarningState());
|
|
95
|
+
const inJSONEditor = mode === 'json';
|
|
96
|
+
const serializedJSON = (0, react_1.useMemo)(() => {
|
|
97
|
+
if (!inJSONEditor) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const value = inputProps;
|
|
101
|
+
return (0, input_props_serialization_1.serializeJSONWithDate)({
|
|
102
|
+
data: value,
|
|
103
|
+
indent: 2,
|
|
104
|
+
staticBase: window.remotion_staticBase,
|
|
105
|
+
});
|
|
106
|
+
}, [inJSONEditor, inputProps]);
|
|
90
107
|
const cliProps = (0, remotion_1.getInputProps)();
|
|
91
|
-
const [
|
|
92
|
-
|
|
93
|
-
reason: 'Loading...',
|
|
94
|
-
determined: false,
|
|
108
|
+
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({
|
|
109
|
+
[unresolvedComposition.id]: get_render_modal_warnings_1.defaultTypeCanSaveState,
|
|
95
110
|
});
|
|
96
111
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
97
112
|
const schema = (0, react_1.useMemo)(() => {
|
|
98
113
|
if (!z) {
|
|
99
114
|
return 'no-zod';
|
|
100
115
|
}
|
|
101
|
-
if (!
|
|
102
|
-
return z.
|
|
116
|
+
if (!unresolvedComposition.schema) {
|
|
117
|
+
return z.object({});
|
|
103
118
|
}
|
|
104
|
-
if (!(typeof
|
|
119
|
+
if (!(typeof unresolvedComposition.schema.safeParse === 'function')) {
|
|
105
120
|
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
106
121
|
}
|
|
107
|
-
return
|
|
108
|
-
}, [
|
|
122
|
+
return unresolvedComposition.schema;
|
|
123
|
+
}, [unresolvedComposition.schema, z]);
|
|
109
124
|
const zodValidationResult = (0, react_1.useMemo)(() => {
|
|
110
125
|
if (schema === 'no-zod') {
|
|
111
126
|
return 'no-zod';
|
|
@@ -122,30 +137,46 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
122
137
|
return val(prevVal);
|
|
123
138
|
});
|
|
124
139
|
}, []);
|
|
140
|
+
const canSaveDefaultProps = (0, react_1.useMemo)(() => {
|
|
141
|
+
return canSaveDefaultPropsObjectState[unresolvedComposition.id]
|
|
142
|
+
? canSaveDefaultPropsObjectState[unresolvedComposition.id]
|
|
143
|
+
: get_render_modal_warnings_1.defaultTypeCanSaveState;
|
|
144
|
+
}, [canSaveDefaultPropsObjectState, unresolvedComposition.id]);
|
|
145
|
+
const showSaveButton = mayShowSaveButton && canSaveDefaultProps.canUpdate;
|
|
146
|
+
const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
|
|
125
147
|
(0, react_1.useEffect)(() => {
|
|
126
|
-
(0, actions_1.canUpdateDefaultProps)(
|
|
148
|
+
(0, actions_1.canUpdateDefaultProps)(unresolvedComposition.id)
|
|
127
149
|
.then((can) => {
|
|
128
150
|
if (can.canUpdate) {
|
|
129
|
-
setCanSaveDefaultProps({
|
|
130
|
-
|
|
131
|
-
|
|
151
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
152
|
+
...prevState,
|
|
153
|
+
[unresolvedComposition.id]: {
|
|
154
|
+
canUpdate: true,
|
|
155
|
+
},
|
|
156
|
+
}));
|
|
132
157
|
}
|
|
133
158
|
else {
|
|
134
|
-
setCanSaveDefaultProps({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
159
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
160
|
+
...prevState,
|
|
161
|
+
[unresolvedComposition.id]: {
|
|
162
|
+
canUpdate: false,
|
|
163
|
+
reason: can.reason,
|
|
164
|
+
determined: true,
|
|
165
|
+
},
|
|
166
|
+
}));
|
|
139
167
|
}
|
|
140
168
|
})
|
|
141
169
|
.catch((err) => {
|
|
142
|
-
setCanSaveDefaultProps({
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
170
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
171
|
+
...prevState,
|
|
172
|
+
[unresolvedComposition.id]: {
|
|
173
|
+
canUpdate: false,
|
|
174
|
+
reason: err.message,
|
|
175
|
+
determined: true,
|
|
176
|
+
},
|
|
177
|
+
}));
|
|
147
178
|
});
|
|
148
|
-
}, [
|
|
179
|
+
}, [unresolvedComposition.id]);
|
|
149
180
|
const modeItems = (0, react_1.useMemo)(() => {
|
|
150
181
|
return [
|
|
151
182
|
{
|
|
@@ -166,26 +197,63 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
166
197
|
},
|
|
167
198
|
];
|
|
168
199
|
}, [mode]);
|
|
169
|
-
const switchToSchema = (0, react_1.useCallback)(() => {
|
|
170
|
-
setMode('schema');
|
|
171
|
-
}, []);
|
|
172
200
|
const onUpdate = (0, react_1.useCallback)(() => {
|
|
201
|
+
if (schema === 'no-zod' || z === null) {
|
|
202
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
173
205
|
setValBeforeSafe(inputProps);
|
|
174
|
-
(0, actions_1.updateDefaultProps)(
|
|
175
|
-
|
|
206
|
+
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
207
|
+
if (!response.success) {
|
|
208
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}, [unresolvedComposition.id, inputProps, schema, z]);
|
|
212
|
+
(0, react_1.useEffect)(() => {
|
|
213
|
+
setSaving(false);
|
|
214
|
+
}, [fastRefreshes]);
|
|
176
215
|
const onSave = (0, react_1.useCallback)((updater) => {
|
|
177
|
-
(
|
|
178
|
-
|
|
216
|
+
if (schema === 'no-zod' || z === null) {
|
|
217
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
setSaving(true);
|
|
221
|
+
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, updater(unresolvedComposition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
222
|
+
.then((response) => {
|
|
223
|
+
if (!response.success) {
|
|
224
|
+
console.log(response.stack);
|
|
225
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${response.reason}. See console for more information.`);
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
.catch((err) => {
|
|
229
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
|
|
230
|
+
setSaving(false);
|
|
231
|
+
});
|
|
232
|
+
}, [unresolvedComposition.defaultProps, unresolvedComposition.id, schema, z]);
|
|
179
233
|
const connectionStatus = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx).type;
|
|
180
234
|
const warnings = (0, react_1.useMemo)(() => {
|
|
181
|
-
return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
|
|
182
|
-
|
|
235
|
+
return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
|
|
236
|
+
canSaveDefaultProps,
|
|
237
|
+
cliProps,
|
|
238
|
+
isCustomDateUsed: serializedJSON ? serializedJSON.customDateUsed : false,
|
|
239
|
+
customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
|
|
240
|
+
inJSONEditor,
|
|
241
|
+
propsEditType,
|
|
242
|
+
jsMapUsed: serializedJSON ? serializedJSON.mapUsed : false,
|
|
243
|
+
jsSetUsed: serializedJSON ? serializedJSON.setUsed : false,
|
|
244
|
+
});
|
|
245
|
+
}, [
|
|
246
|
+
cliProps,
|
|
247
|
+
canSaveDefaultProps,
|
|
248
|
+
inJSONEditor,
|
|
249
|
+
propsEditType,
|
|
250
|
+
serializedJSON,
|
|
251
|
+
]);
|
|
183
252
|
if (connectionStatus === 'disconnected') {
|
|
184
253
|
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The preview server has disconnected. Reconnect to edit the schema." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true })] }));
|
|
185
254
|
}
|
|
186
255
|
if (schema === 'no-zod') {
|
|
187
|
-
|
|
188
|
-
return (0, jsx_runtime_1.jsx)("div", { children: "Install zod" });
|
|
256
|
+
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.ZodNotInstalled, {});
|
|
189
257
|
}
|
|
190
258
|
if (!z) {
|
|
191
259
|
throw new Error('expected zod');
|
|
@@ -199,12 +267,11 @@ const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayS
|
|
|
199
267
|
if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
|
|
200
268
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoSchemaDefined, {});
|
|
201
269
|
}
|
|
202
|
-
if (!
|
|
270
|
+
if (!unresolvedComposition.defaultProps) {
|
|
203
271
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoDefaultProps, {});
|
|
204
272
|
}
|
|
205
|
-
const showSaveButton = mayShowSaveButton && canSaveDefaultProps.canUpdate;
|
|
206
273
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
207
274
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
208
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps:
|
|
275
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: unresolvedComposition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, defaultProps: unresolvedComposition.defaultProps, schema: schema }))] }));
|
|
209
276
|
};
|
|
210
|
-
exports.
|
|
277
|
+
exports.DataEditor = DataEditor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { SerializedJSONWithCustomFields } from './SchemaEditor/input-props-serialization';
|
|
4
|
+
export declare type EditType = 'inputProps' | 'defaultProps';
|
|
5
|
+
export declare const RenderModalJSONPropsEditor: React.FC<{
|
|
6
|
+
value: unknown;
|
|
7
|
+
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
8
|
+
onSave: () => void;
|
|
9
|
+
valBeforeSafe: unknown;
|
|
10
|
+
showSaveButton: boolean;
|
|
11
|
+
serializedJSON: SerializedJSONWithCustomFields | null;
|
|
12
|
+
defaultProps: Record<string, unknown>;
|
|
13
|
+
schema: z.ZodTypeAny;
|
|
14
|
+
}>;
|
|
@@ -23,46 +23,44 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.RenderModalJSONPropsEditor = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
30
|
+
const colors_1 = require("../../helpers/colors");
|
|
30
31
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
31
32
|
const layout_1 = require("../layout");
|
|
32
33
|
const RemTextarea_1 = require("../NewComposition/RemTextarea");
|
|
33
34
|
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
try {
|
|
37
|
-
const value = (0, date_serialization_1.deserializeJSONWithDate)(str);
|
|
38
|
-
return { str, value, validJSON: true };
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
return { str, validJSON: false, error: e.message };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
35
|
+
const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
|
|
36
|
+
const ZodErrorMessages_1 = require("./SchemaEditor/ZodErrorMessages");
|
|
44
37
|
const style = {
|
|
45
38
|
fontFamily: 'monospace',
|
|
46
39
|
flex: 1,
|
|
47
40
|
};
|
|
48
|
-
const schemaButton = {
|
|
49
|
-
border: 'none',
|
|
50
|
-
padding: 0,
|
|
51
|
-
display: 'inline-block',
|
|
52
|
-
cursor: 'pointer',
|
|
53
|
-
backgroundColor: 'transparent',
|
|
54
|
-
};
|
|
55
41
|
const scrollable = {
|
|
56
42
|
padding: '8px 12px',
|
|
57
43
|
display: 'flex',
|
|
58
44
|
flexDirection: 'column',
|
|
59
45
|
flex: 1,
|
|
60
46
|
};
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
const parseJSON = (str, schema) => {
|
|
48
|
+
try {
|
|
49
|
+
const value = (0, input_props_serialization_1.deserializeJSONWithCustomFields)(str);
|
|
50
|
+
const zodValidation = schema.safeParse(value);
|
|
51
|
+
return { str, value, validJSON: true, zodValidation };
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
return { str, validJSON: false, error: e.message };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, valBeforeSafe, showSaveButton, serializedJSON, schema, }) => {
|
|
58
|
+
if (serializedJSON === null) {
|
|
59
|
+
throw new Error('expecting serializedJSON to be defined');
|
|
60
|
+
}
|
|
63
61
|
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
64
62
|
const [localValue, setLocalValue] = react_1.default.useState(() => {
|
|
65
|
-
return parseJSON(
|
|
63
|
+
return parseJSON(serializedJSON.serializedString, schema);
|
|
66
64
|
});
|
|
67
65
|
const onPretty = (0, react_1.useCallback)(() => {
|
|
68
66
|
if (!localValue.validJSON) {
|
|
@@ -70,15 +68,20 @@ const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult,
|
|
|
70
68
|
}
|
|
71
69
|
const parsed = JSON.parse(localValue.str);
|
|
72
70
|
setLocalValue({ ...localValue, str: JSON.stringify(parsed, null, 2) });
|
|
73
|
-
}, [localValue]);
|
|
71
|
+
}, [localValue, setLocalValue]);
|
|
74
72
|
const onChange = (0, react_1.useCallback)((e) => {
|
|
75
|
-
const parsed = parseJSON(e.target.value);
|
|
73
|
+
const parsed = parseJSON(e.target.value, schema);
|
|
76
74
|
if (parsed.validJSON) {
|
|
75
|
+
const validationResult = schema.safeParse(parsed.value);
|
|
77
76
|
setLocalValue({
|
|
78
77
|
str: e.target.value,
|
|
79
78
|
value: parsed.value,
|
|
80
79
|
validJSON: parsed.validJSON,
|
|
80
|
+
zodValidation: validationResult,
|
|
81
81
|
});
|
|
82
|
+
if (validationResult.success) {
|
|
83
|
+
setValue(parsed.value);
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
86
|
else {
|
|
84
87
|
setLocalValue({
|
|
@@ -87,10 +90,7 @@ const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult,
|
|
|
87
90
|
error: parsed.error,
|
|
88
91
|
});
|
|
89
92
|
}
|
|
90
|
-
|
|
91
|
-
setValue(parsed.value);
|
|
92
|
-
}
|
|
93
|
-
}, [setValue]);
|
|
93
|
+
}, [schema, setValue]);
|
|
94
94
|
const hasChanged = (0, react_1.useMemo)(() => {
|
|
95
95
|
return value && JSON.stringify(value) !== JSON.stringify(valBeforeSafe);
|
|
96
96
|
}, [valBeforeSafe, value]);
|
|
@@ -99,6 +99,10 @@ const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult,
|
|
|
99
99
|
onSave();
|
|
100
100
|
}
|
|
101
101
|
}, [hasChanged, onSave]);
|
|
102
|
+
// If schema is changed in code
|
|
103
|
+
(0, react_1.useEffect)(() => {
|
|
104
|
+
setLocalValue(parseJSON(localValue.str, schema));
|
|
105
|
+
}, [localValue.str, schema]);
|
|
102
106
|
(0, react_1.useEffect)(() => {
|
|
103
107
|
const save = keybindings.registerKeybinding({
|
|
104
108
|
event: 'keydown',
|
|
@@ -112,7 +116,24 @@ const RenderModalJSONInputPropsEditor = ({ setValue, value, zodValidationResult,
|
|
|
112
116
|
save.unregister();
|
|
113
117
|
};
|
|
114
118
|
}, [keybindings, onQuickSave, onSave]);
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
120
|
+
setLocalValue(parseJSON(serializedJSON.serializedString, schema));
|
|
121
|
+
setValue(defaultProps);
|
|
122
|
+
}, [defaultProps, schema, serializedJSON.serializedString, setValue]);
|
|
123
|
+
const textAreaStyle = (0, react_1.useMemo)(() => {
|
|
124
|
+
const fail = !localValue.validJSON || !localValue.zodValidation.success;
|
|
125
|
+
if (!fail) {
|
|
126
|
+
return style;
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
...style,
|
|
130
|
+
borderColor: colors_1.FAIL_COLOR,
|
|
131
|
+
};
|
|
132
|
+
}, [localValue]);
|
|
133
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: scrollable, children: [(0, jsx_runtime_1.jsx)(RemTextarea_1.RemTextarea, { onChange: onChange, value: localValue.str, status: localValue.validJSON ? 'ok' : 'error', style: textAreaStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), localValue.validJSON === false ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-start", message: localValue.error, type: "error" })) : localValue.zodValidation.success === false ? ((0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: localValue.zodValidation })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON ||
|
|
134
|
+
!(localValue.validJSON && !localValue.zodValidation.success), onClick: reset, children: "Reset" }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: !localValue.validJSON, onClick: onPretty, children: "Format" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onSave, disabled: !(localValue.validJSON && localValue.zodValidation.success) ||
|
|
135
|
+
!localValue.validJSON ||
|
|
136
|
+
!hasChanged ||
|
|
137
|
+
!showSaveButton, children: "Save" })] })] }));
|
|
117
138
|
};
|
|
118
|
-
exports.
|
|
139
|
+
exports.RenderModalJSONPropsEditor = RenderModalJSONPropsEditor;
|
|
@@ -12,7 +12,7 @@ export declare const RenderModalPicture: React.FC<{
|
|
|
12
12
|
setPixelFormat: React.Dispatch<React.SetStateAction<PixelFormat>>;
|
|
13
13
|
imageFormatOptions: SegmentedControlItem[];
|
|
14
14
|
setQualityControl: React.Dispatch<React.SetStateAction<QualityControl>>;
|
|
15
|
-
qualityControlType: QualityControl;
|
|
15
|
+
qualityControlType: QualityControl | null;
|
|
16
16
|
videoImageFormat: VideoImageFormat;
|
|
17
17
|
stillImageFormat: StillImageFormat;
|
|
18
18
|
setJpegQuality: React.Dispatch<React.SetStateAction<number>>;
|
|
@@ -20,9 +20,9 @@ export declare const RenderModalPicture: React.FC<{
|
|
|
20
20
|
maxCrf: number;
|
|
21
21
|
minCrf: number;
|
|
22
22
|
setCrf: React.Dispatch<React.SetStateAction<number>>;
|
|
23
|
-
shouldDisplayCrfOption: boolean;
|
|
24
23
|
setCustomTargetVideoBitrateValue: React.Dispatch<React.SetStateAction<string>>;
|
|
25
24
|
crf: number;
|
|
26
25
|
customTargetVideoBitrate: string;
|
|
26
|
+
shouldDisplayQualityControlPicker: boolean;
|
|
27
27
|
}>;
|
|
28
28
|
export {};
|
|
@@ -19,7 +19,7 @@ const qualityControlModes = ['crf', 'bitrate'];
|
|
|
19
19
|
const container = {
|
|
20
20
|
flex: 1,
|
|
21
21
|
};
|
|
22
|
-
const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixelFormat, imageFormatOptions, setQualityControl, qualityControlType, videoImageFormat, setJpegQuality, jpegQuality, maxCrf, minCrf, setCrf,
|
|
22
|
+
const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixelFormat, imageFormatOptions, setQualityControl, qualityControlType, videoImageFormat, setJpegQuality, jpegQuality, maxCrf, minCrf, setCrf, shouldDisplayQualityControlPicker, setCustomTargetVideoBitrateValue, crf, customTargetVideoBitrate, stillImageFormat, }) => {
|
|
23
23
|
const pixelFormatOptions = (0, react_1.useMemo)(() => {
|
|
24
24
|
return client_1.BrowserSafeApis.validPixelFormats.map((option) => {
|
|
25
25
|
return {
|
|
@@ -49,8 +49,6 @@ const RenderModalPicture = ({ renderMode, scale, setScale, pixelFormat, setPixel
|
|
|
49
49
|
const onTargetVideoBitrateChanged = (0, react_1.useCallback)((e) => {
|
|
50
50
|
setCustomTargetVideoBitrateValue(e.target.value);
|
|
51
51
|
}, [setCustomTargetVideoBitrateValue]);
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: false }) })] })) : null, renderMode === 'video' && videoImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'still' && stillImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Quality control" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: qualityControlOptions, needsWrapping: true }) })] })) : null,
|
|
53
|
-
qualityControlType === 'crf' &&
|
|
54
|
-
renderMode !== 'still' ? ((0, jsx_runtime_1.jsx)(CrfSetting_1.CrfSetting, { crf: crf, min: minCrf, max: maxCrf, setCrf: setCrf, option: client_1.BrowserSafeApis.options.crfOption })) : null, qualityControlType === 'bitrate' && renderMode !== 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Target video bitrate" }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: client_1.BrowserSafeApis.options.videoBitrate }) }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { style: layout_1.input, value: customTargetVideoBitrate, onChange: onTargetVideoBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null, renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, (0, jsx_runtime_1.jsx)(ScaleSetting_1.ScaleSetting, { scale: scale, setScale: setScale }), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Pixel format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: pixelFormatOptions, selectedId: pixelFormat, title: "Pixel Format" }) })] })) : null] }));
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions, needsWrapping: false }) })] })) : null, renderMode === 'video' && videoImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'still' && stillImageFormat === 'jpeg' && ((0, jsx_runtime_1.jsx)(JpegQualitySetting_1.JpegQualitySetting, { jpegQuality: jpegQuality, setJpegQuality: setJpegQuality })), renderMode === 'video' && qualityControlType !== null ? ((0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})) : null, shouldDisplayQualityControlPicker && renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Quality control" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: qualityControlOptions, needsWrapping: true }) })] })) : null, qualityControlType === 'crf' && renderMode !== 'still' ? ((0, jsx_runtime_1.jsx)(CrfSetting_1.CrfSetting, { crf: crf, min: minCrf, max: maxCrf, setCrf: setCrf, option: client_1.BrowserSafeApis.options.crfOption })) : null, qualityControlType === 'bitrate' && renderMode !== 'still' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_1.label, children: ["Target video bitrate", (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: client_1.BrowserSafeApis.options.videoBitrate }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { style: layout_1.input, value: customTargetVideoBitrate, onChange: onTargetVideoBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null, renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, (0, jsx_runtime_1.jsx)(ScaleSetting_1.ScaleSetting, { scale: scale, setScale: setScale }), renderMode === 'video' ? (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Pixel format" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: pixelFormatOptions, selectedId: pixelFormat, title: "Pixel Format" }) })] })) : null] }));
|
|
55
53
|
};
|
|
56
54
|
exports.RenderModalPicture = RenderModalPicture;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { z } from 'zod';
|
|
2
|
+
import type { AnyZodObject, z } from 'zod';
|
|
3
3
|
export declare const SchemaEditor: React.FC<{
|
|
4
|
-
schema:
|
|
4
|
+
schema: AnyZodObject;
|
|
5
5
|
value: unknown;
|
|
6
|
-
setValue: React.Dispatch<React.SetStateAction<unknown
|
|
6
|
+
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
7
|
zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
8
8
|
compact: boolean;
|
|
9
|
-
defaultProps: unknown
|
|
9
|
+
defaultProps: Record<string, unknown>;
|
|
10
10
|
onSave: (updater: (oldState: unknown) => unknown) => void;
|
|
11
11
|
showSaveButton: boolean;
|
|
12
|
+
saving: boolean;
|
|
13
|
+
saveDisabledByParent: boolean;
|
|
12
14
|
}>;
|
|
@@ -13,7 +13,7 @@ const scrollable = {
|
|
|
13
13
|
flexDirection: 'column',
|
|
14
14
|
overflowY: 'auto',
|
|
15
15
|
};
|
|
16
|
-
const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, }) => {
|
|
16
|
+
const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, defaultProps, onSave, showSaveButton, saving, saveDisabledByParent, }) => {
|
|
17
17
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
18
18
|
if (!z) {
|
|
19
19
|
throw new Error('expected zod');
|
|
@@ -31,9 +31,9 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, d
|
|
|
31
31
|
}
|
|
32
32
|
return ((0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.InvalidSchema, { reset: reset, zodValidationResult: zodValidationResult }));
|
|
33
33
|
}
|
|
34
|
-
if (typeName
|
|
35
|
-
return (
|
|
34
|
+
if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
|
|
35
|
+
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
36
36
|
}
|
|
37
|
-
return null;
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: scrollable, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { value: value, setValue: setValue, jsonPath: [], schema: schema, compact: compact, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent }) }));
|
|
38
38
|
};
|
|
39
39
|
exports.SchemaEditor = SchemaEditor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { z } from 'zod';
|
|
3
|
+
export declare const ZodNotInstalled: () => JSX.Element;
|
|
3
4
|
export declare const NoSchemaDefined: () => JSX.Element;
|
|
4
5
|
export declare const NoDefaultProps: () => JSX.Element;
|
|
5
6
|
export declare const InvalidDefaultProps: React.FC<{
|
|
@@ -9,3 +10,6 @@ export declare const InvalidSchema: React.FC<{
|
|
|
9
10
|
zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
10
11
|
reset: () => void;
|
|
11
12
|
}>;
|
|
13
|
+
export declare const TopLevelZodValue: React.FC<{
|
|
14
|
+
typeReceived: string;
|
|
15
|
+
}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = void 0;
|
|
3
|
+
exports.TopLevelZodValue = exports.InvalidSchema = exports.InvalidDefaultProps = exports.NoDefaultProps = exports.NoSchemaDefined = exports.ZodNotInstalled = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Button_1 = require("../../../../preview-server/error-overlay/remotion-overlay/Button");
|
|
6
6
|
const colors_1 = require("../../../helpers/colors");
|
|
7
7
|
const layout_1 = require("../../layout");
|
|
8
|
+
const styles_1 = require("../../Menu/styles");
|
|
8
9
|
const SchemaEmptyStateGraphic_1 = require("./SchemaEmptyStateGraphic");
|
|
9
10
|
const ZodErrorMessages_1 = require("./ZodErrorMessages");
|
|
10
11
|
const explainer = {
|
|
@@ -24,7 +25,7 @@ const errorExplanation = {
|
|
|
24
25
|
};
|
|
25
26
|
const codeSnippet = {
|
|
26
27
|
fontSize: 14,
|
|
27
|
-
color:
|
|
28
|
+
color: colors_1.BLUE,
|
|
28
29
|
fontFamily: 'monospace',
|
|
29
30
|
};
|
|
30
31
|
const errorContainer = {
|
|
@@ -36,20 +37,28 @@ const openDocs = () => {
|
|
|
36
37
|
// TODO: Make sure to update this link when we release v4
|
|
37
38
|
'https://v4.remotion.dev/docs/parametrized-rendering#define-a-schema-');
|
|
38
39
|
};
|
|
40
|
+
const ZodNotInstalled = () => {
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Install ", (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "zod" }), " as a dependency to interactively control the props of the composition."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn how" })] }));
|
|
42
|
+
};
|
|
43
|
+
exports.ZodNotInstalled = ZodNotInstalled;
|
|
39
44
|
const NoSchemaDefined = () => {
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(SchemaEmptyStateGraphic_1.SchemaEmptyStateGraphic, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Make the props of this composition interactively editable by adding a", ' ', (0, jsx_runtime_1.jsx)("code", { style:
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsx)(SchemaEmptyStateGraphic_1.SchemaEmptyStateGraphic, {}), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 5 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Make the props of this composition interactively editable by adding a", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "schema" }), " prop to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }), " component."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn how" })] }));
|
|
41
46
|
};
|
|
42
47
|
exports.NoSchemaDefined = NoSchemaDefined;
|
|
43
48
|
const NoDefaultProps = () => {
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style:
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }), " does not exist."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by adding a", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop to your composition."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn more" })] }));
|
|
45
50
|
};
|
|
46
51
|
exports.NoDefaultProps = NoDefaultProps;
|
|
47
52
|
const InvalidDefaultProps = ({ zodValidationResult }) => {
|
|
48
53
|
// TODO: Does not react to when schema is updated
|
|
49
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style:
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The schema can not be edited because the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: '<Composition>' }), " is not valid:"] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Fix the schema by changing the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " prop in your composition so it does not give a type error."] })] }));
|
|
50
55
|
};
|
|
51
56
|
exports.InvalidDefaultProps = InvalidDefaultProps;
|
|
52
57
|
const InvalidSchema = ({ zodValidationResult, reset }) => {
|
|
53
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: errorContainer, children: [(0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "The data does not satisfy the schema:" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ZodErrorMessages_1.ZodErrorMessages, { zodValidationResult: zodValidationResult }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema using the JSON editor." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["Alternatively, reset the data to the", ' ', (0, jsx_runtime_1.jsx)("code", { style: styles_1.inlineCodeSnippet, children: "defaultProps" }), " that you have defined."] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: reset, children: "Reset props" })] }));
|
|
54
59
|
};
|
|
55
60
|
exports.InvalidSchema = InvalidSchema;
|
|
61
|
+
const TopLevelZodValue = ({ typeReceived }) => {
|
|
62
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: errorExplanation, children: ["The top-level type of the schema must be a pure", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: "z.object" }), ". Instead got a schema of type", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeSnippet, children: typeReceived })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)("div", { style: errorExplanation, children: "Fix the schema by changing the top-level Zod type to an object." }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 2, block: true }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: openDocs, children: "Learn more" })] }));
|
|
63
|
+
};
|
|
64
|
+
exports.TopLevelZodValue = TopLevelZodValue;
|
|
@@ -8,8 +8,13 @@ export declare const SchemaLabel: React.FC<{
|
|
|
8
8
|
onRemove: null | (() => void);
|
|
9
9
|
showSaveButton: boolean;
|
|
10
10
|
compact: boolean;
|
|
11
|
+
saving: boolean;
|
|
12
|
+
valid: boolean;
|
|
13
|
+
saveDisabledByParent: boolean;
|
|
11
14
|
}>;
|
|
12
15
|
export declare const SchemaFieldsetLabel: React.FC<{
|
|
13
16
|
jsonPath: JSONPath;
|
|
14
17
|
onRemove: null | (() => void);
|
|
18
|
+
isDefaultValue: boolean;
|
|
19
|
+
onReset: () => void;
|
|
15
20
|
}>;
|
|
@@ -30,11 +30,12 @@ const labelStyle = {
|
|
|
30
30
|
color: colors_1.LIGHT_TEXT,
|
|
31
31
|
lineHeight: '40px',
|
|
32
32
|
};
|
|
33
|
-
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, }) => {
|
|
34
|
-
|
|
33
|
+
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, saving, valid, saveDisabledByParent, }) => {
|
|
34
|
+
const disableSave = saving || !valid || saveDisabledByParent;
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compact ? compactStyles : wideStyles, children: [(0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: (0, get_schema_label_1.getSchemaLabel)(jsonPath) }), compact ? (0, jsx_runtime_1.jsx)(layout_1.Flex, {}) : (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), isDefaultValue ? null : showSaveButton ? ((0, jsx_runtime_1.jsx)(SchemaSaveButton_1.SchemaSaveButton, { onClick: onSave, disabled: disableSave })) : null, onRemove ? (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove }) : null] }));
|
|
35
36
|
};
|
|
36
37
|
exports.SchemaLabel = SchemaLabel;
|
|
37
|
-
const SchemaFieldsetLabel = ({ jsonPath, onRemove }) => {
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)("legend", { style: layout_2.fieldsetLabel, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), onRemove ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove })] })) : null] }));
|
|
38
|
+
const SchemaFieldsetLabel = ({ jsonPath, onRemove, isDefaultValue, onReset }) => {
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("legend", { style: layout_2.fieldsetLabel, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), isDefaultValue ? null : (0, jsx_runtime_1.jsx)(SchemaResetButton_1.SchemaResetButton, { onClick: onReset }), onRemove ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(InlineRemoveButton_1.InlineRemoveButton, { onClick: onRemove })] })) : null] }));
|
|
39
40
|
};
|
|
40
41
|
exports.SchemaFieldsetLabel = SchemaFieldsetLabel;
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SchemaResetButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const InlineAction_1 = require("../../InlineAction");
|
|
6
7
|
const icon = {
|
|
7
8
|
height: 14,
|
|
9
|
+
color: 'currentColor',
|
|
8
10
|
};
|
|
9
11
|
const SchemaResetButton = ({ onClick }) => {
|
|
10
|
-
|
|
12
|
+
const renderAction = (0, react_1.useCallback)((color) => {
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("svg", { style: icon, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: color, d: "M48.5 224H40c-13.3 0-24-10.7-24-24V72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8H48.5z" }) }));
|
|
14
|
+
}, []);
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick });
|
|
11
16
|
};
|
|
12
17
|
exports.SchemaResetButton = SchemaResetButton;
|