@remotion/cli 4.0.0-alpha13 → 4.0.0-alpha16
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/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/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/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/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 +3 -3
- 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/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/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/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/colors.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 -1
- package/dist/editor/helpers/use-menu-structure.d.ts +1 -1
- package/dist/editor/icons/plus.d.ts +3 -1
- package/dist/editor/icons/plus.js +2 -2
- 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/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/index.d.ts +5 -4
- 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/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/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.js +1 -11
- package/dist/preview-server/update-available.d.ts +2 -10
- 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
|
@@ -317,7 +317,7 @@ const RenderModal = ({ initialFrame, initialVideoImageFormat, initialStillImageF
|
|
|
317
317
|
compositionId: resolvedComposition.id,
|
|
318
318
|
outName,
|
|
319
319
|
imageFormat: stillImageFormat,
|
|
320
|
-
jpegQuality
|
|
320
|
+
jpegQuality,
|
|
321
321
|
frame,
|
|
322
322
|
scale,
|
|
323
323
|
verbose,
|
|
@@ -581,7 +581,7 @@ const RenderModal = ({ initialFrame, initialVideoImageFormat, initialStillImageF
|
|
|
581
581
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${resolvedComposition.id}` }), (0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderTabOptions, needsWrapping: false }), (0, jsx_runtime_1.jsx)("div", { style: flexer }), (0, jsx_runtime_1.jsxs)(Button_1.Button, { autoFocus: true, onClick: trigger, disabled: renderDisabled, style: {
|
|
582
582
|
...buttonStyle,
|
|
583
583
|
backgroundColor: outnameValidation.valid ? colors_1.BLUE : colors_1.BLUE_DISABLED,
|
|
584
|
-
}, children: [state.type === 'idle' ? `Render ${renderMode}` : 'Rendering...', (0, jsx_runtime_1.jsx)(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: true })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: horizontalLayout, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftSidebar, children: [shownTabs.includes('general') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'general', onClick: () => setTab('general'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(file_1.FileIcon, { style: icon }) }), "General"] })) : null, shownTabs.includes('data') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'data', onClick: () => setTab('data'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(data_1.DataIcon, { style: icon }) }), "Input Props"] })) : null, shownTabs.includes('picture') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'picture', onClick: () => setTab('picture'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(frame_1.PicIcon, { style: icon }) }), "Picture"] })) : null, shownTabs.includes('audio') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'audio', onClick: () => setTab('audio'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(audio_1.AudioIcon, { style: icon }) }), "Audio"] })) : null, shownTabs.includes('gif') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'gif', onClick: () => setTab('gif'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gif_1.GifIcon, { style: icon }) }), "GIF"] })) : null, shownTabs.includes('advanced') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'advanced', onClick: () => setTab('advanced'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gear_1.GearIcon, { style: icon }) }), "Other"] })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: rightPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, resolvedComposition: resolvedComposition, frame: frame, imageFormatOptions: imageFormatOptions, outName: outName, proResProfile: proResProfile, renderMode: renderMode, setVideoCodec: setCodec, setFrame: setFrame, setOutName: setOutName, setProResProfile: setProResProfile, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame, validationMessage: outnameValidation.valid ? null : outnameValidation.error.message })) : tab === 'picture' ? ((0, jsx_runtime_1.jsx)(RenderModalPicture_1.RenderModalPicture, { renderMode: renderMode, scale: scale, setScale: setScale, pixelFormat: pixelFormat, setPixelFormat: setPixelFormat, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf, jpegQuality: jpegQuality, qualityControlType: qualityControlType, setJpegQuality: setJpegQuality, setCustomTargetVideoBitrateValue: setCustomTargetVideoBitrateValue, setQualityControl: setQualityControl, videoImageFormat: videoImageFormat, stillImageFormat: stillImageFormat, shouldDisplayQualityControlPicker: supportsBothQualityControls })) : tab === 'audio' ? ((0, jsx_runtime_1.jsx)(RenderModalAudio_1.RenderModalAudio, { muted: muted, renderMode: renderMode, setMuted: setMuted, codec: codec, audioCodec: audioCodec, setAudioCodec: setAudioCodec, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrackState: setEnforceAudioTrackState, customTargetAudioBitrate: customTargetAudioBitrate, setCustomTargetAudioBitrateValue: setCustomTargetAudioBitrateValue, setShouldHaveCustomTargetAudioBitrate: setShouldHaveCustomTargetAudioBitrate, shouldHaveCustomTargetAudioBitrate: shouldHaveCustomTargetAudioBitrate })) : tab === 'gif' ? ((0, jsx_runtime_1.jsx)(RenderModalGif_1.RenderModalGif, { everyNthFrame: everyNthFrame, limitNumberOfGifLoops: limitNumberOfGifLoops, numberOfGifLoopsSetting: numberOfGifLoopsSetting, setEveryNthFrameSetting: setEveryNthFrameSetting, setLimitNumberOfGifLoops: setLimitNumberOfGifLoops, setNumberOfGifLoopsSetting: setNumberOfGifLoopsSetting })) : tab === 'data' ? ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, { inputProps: inputProps, setInputProps: setInputProps, unresolvedComposition: unresolvedComposition,
|
|
584
|
+
}, children: [state.type === 'idle' ? `Render ${renderMode}` : 'Rendering...', (0, jsx_runtime_1.jsx)(ShortcutHint_1.ShortcutHint, { keyToPress: "\u21B5", cmdOrCtrl: true })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: horizontalLayout, children: [(0, jsx_runtime_1.jsxs)("div", { style: leftSidebar, children: [shownTabs.includes('general') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'general', onClick: () => setTab('general'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(file_1.FileIcon, { style: icon }) }), "General"] })) : null, shownTabs.includes('data') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'data', onClick: () => setTab('data'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(data_1.DataIcon, { style: icon }) }), "Input Props"] })) : null, shownTabs.includes('picture') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'picture', onClick: () => setTab('picture'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(frame_1.PicIcon, { style: icon }) }), "Picture"] })) : null, shownTabs.includes('audio') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'audio', onClick: () => setTab('audio'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(audio_1.AudioIcon, { style: icon }) }), "Audio"] })) : null, shownTabs.includes('gif') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'gif', onClick: () => setTab('gif'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gif_1.GifIcon, { style: icon }) }), "GIF"] })) : null, shownTabs.includes('advanced') ? ((0, jsx_runtime_1.jsxs)(vertical_1.VerticalTab, { style: horizontalTab, selected: tab === 'advanced', onClick: () => setTab('advanced'), children: [(0, jsx_runtime_1.jsx)("div", { style: iconContainer, children: (0, jsx_runtime_1.jsx)(gear_1.GearIcon, { style: icon }) }), "Other"] })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: rightPanel, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: tab === 'general' ? ((0, jsx_runtime_1.jsx)(RenderModalBasic_1.RenderModalBasic, { codec: codec, resolvedComposition: resolvedComposition, frame: frame, imageFormatOptions: imageFormatOptions, outName: outName, proResProfile: proResProfile, renderMode: renderMode, setVideoCodec: setCodec, setFrame: setFrame, setOutName: setOutName, setProResProfile: setProResProfile, endFrame: endFrame, setEndFrame: setEndFrame, setStartFrame: setStartFrame, startFrame: startFrame, validationMessage: outnameValidation.valid ? null : outnameValidation.error.message })) : tab === 'picture' ? ((0, jsx_runtime_1.jsx)(RenderModalPicture_1.RenderModalPicture, { renderMode: renderMode, scale: scale, setScale: setScale, pixelFormat: pixelFormat, setPixelFormat: setPixelFormat, imageFormatOptions: imageFormatOptions, crf: crf, setCrf: setCrf, customTargetVideoBitrate: customTargetVideoBitrate, maxCrf: maxCrf, minCrf: minCrf, jpegQuality: jpegQuality, qualityControlType: qualityControlType, setJpegQuality: setJpegQuality, setCustomTargetVideoBitrateValue: setCustomTargetVideoBitrateValue, setQualityControl: setQualityControl, videoImageFormat: videoImageFormat, stillImageFormat: stillImageFormat, shouldDisplayQualityControlPicker: supportsBothQualityControls })) : tab === 'audio' ? ((0, jsx_runtime_1.jsx)(RenderModalAudio_1.RenderModalAudio, { muted: muted, renderMode: renderMode, setMuted: setMuted, codec: codec, audioCodec: audioCodec, setAudioCodec: setAudioCodec, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrackState: setEnforceAudioTrackState, customTargetAudioBitrate: customTargetAudioBitrate, setCustomTargetAudioBitrateValue: setCustomTargetAudioBitrateValue, setShouldHaveCustomTargetAudioBitrate: setShouldHaveCustomTargetAudioBitrate, shouldHaveCustomTargetAudioBitrate: shouldHaveCustomTargetAudioBitrate })) : tab === 'gif' ? ((0, jsx_runtime_1.jsx)(RenderModalGif_1.RenderModalGif, { everyNthFrame: everyNthFrame, limitNumberOfGifLoops: limitNumberOfGifLoops, numberOfGifLoopsSetting: numberOfGifLoopsSetting, setEveryNthFrameSetting: setEveryNthFrameSetting, setLimitNumberOfGifLoops: setLimitNumberOfGifLoops, setNumberOfGifLoopsSetting: setNumberOfGifLoopsSetting })) : tab === 'data' ? ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, { inputProps: inputProps, setInputProps: setInputProps, unresolvedComposition: unresolvedComposition, mayShowSaveButton: false, propsEditType: "input-props" })) : ((0, jsx_runtime_1.jsx)(RenderModalAdvanced_1.RenderModalAdvanced, { concurrency: concurrency, maxConcurrency: maxConcurrency, minConcurrency: minConcurrency, renderMode: renderMode, setConcurrency: setConcurrency, setVerboseLogging: setVerboseLogging, verbose: verbose, delayRenderTimeout: delayRenderTimeout, setDelayRenderTimeout: setDelayRenderTimeout, disallowParallelEncoding: disallowParallelEncoding, setDisallowParallelEncoding: setDisallowParallelEncoding, setDisableWebSecurity: setDisableWebSecurity, setIgnoreCertificateErrors: setIgnoreCertificateErrors, setHeadless: setHeadless, headless: headless, ignoreCertificateErrors: ignoreCertificateErrors, disableWebSecurity: disableWebSecurity, openGlOption: openGlOption, setOpenGlOption: setOpenGlOption, setEnvVariables: setEnvVariables, envVariables: envVariables })) })] })] }));
|
|
585
585
|
};
|
|
586
586
|
const RenderModalWithLoader = (props) => {
|
|
587
587
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { UiOpenGlOptions } from '../../../required-chromium-options';
|
|
3
|
-
export
|
|
3
|
+
export type RenderType = 'still' | 'video' | 'audio';
|
|
4
4
|
export declare const RenderModalAdvanced: React.FC<{
|
|
5
5
|
renderMode: RenderType;
|
|
6
6
|
minConcurrency: number;
|
|
@@ -54,6 +54,6 @@ const RenderModalAdvanced = ({ renderMode, maxConcurrency, minConcurrency, setCo
|
|
|
54
54
|
// Also appears in packages/renderer/src/validate-puppeteer-timeout.ts
|
|
55
55
|
, {
|
|
56
56
|
// Also appears in packages/renderer/src/validate-puppeteer-timeout.ts
|
|
57
|
-
min: 7000, max: 900000, name: "delayRender() timeout", onValueChanged: setDelayRenderTimeout, formatter: (w) => `${w}ms`, step: 1000, value: delayRenderTimeout }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "No parallel encoding" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disallowParallelEncoding, onChange: onDisallowParallelEncodingChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: verbose, onChange: onVerboseLoggingChanged }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Disable web security" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disableWebSecurity, onChange: onDisableWebSecurityChanged }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Ignore certificate errors " }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: ignoreCertificateErrors, onChange: onIgnoreCertificatErrors }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Headless mode" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: headless, onChange: onHeadless }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "OpenGL render backend" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: openGlOptions, selectedId: openGlOption, title: "OpenGl option" }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsx)(RenderModalEnvironmentVariables_1.RenderModalEnvironmentVariables, { envVariables: envVariables, setEnvVariables: setEnvVariables })] }));
|
|
57
|
+
min: 7000, max: 900000, name: "delayRender() timeout", onValueChanged: setDelayRenderTimeout, formatter: (w) => `${w}ms`, step: 1000, value: delayRenderTimeout }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "No parallel encoding" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disallowParallelEncoding, onChange: onDisallowParallelEncodingChanged, name: "disallow-parallel-encoding" }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: verbose, onChange: onVerboseLoggingChanged, name: "verbose-logging" }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Disable web security" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: disableWebSecurity, onChange: onDisableWebSecurityChanged, name: "disable-web-security" }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Ignore certificate errors " }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: ignoreCertificateErrors, onChange: onIgnoreCertificatErrors, name: "ignore-certificate-errors" }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Headless mode" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: headless, onChange: onHeadless, name: "headless" }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "OpenGL render backend" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: openGlOptions, selectedId: openGlOption, title: "OpenGl option" }) })] }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {}), (0, jsx_runtime_1.jsx)(RenderModalEnvironmentVariables_1.RenderModalEnvironmentVariables, { envVariables: envVariables, setEnvVariables: setEnvVariables })] }));
|
|
58
58
|
};
|
|
59
59
|
exports.RenderModalAdvanced = RenderModalAdvanced;
|
|
@@ -41,6 +41,6 @@ const RenderModalAudio = ({ muted, setMuted, renderMode, enforceAudioTrack, setE
|
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
43
|
}, [codec, setAudioCodec]);
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' && audioCodecOptions(codec).length >= 2 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Audio Codec" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: audioCodecOptions(codec), selectedId: audioCodec, title: "AudioCodec" }) })] })) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsx)(MutedSetting_1.MutedSetting, { enforceAudioTrack: enforceAudioTrack, muted: muted, setMuted: setMuted, hint: client_1.BrowserSafeApis.options.muteOption })) : null, (renderMode === 'video' || renderMode === 'audio') && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EnforceAudioTrackSetting_1.EnforceAudioTrackSetting, { muted: muted, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrack: setEnforceAudioTrackState, option: client_1.BrowserSafeApis.options.enforceAudioOption }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})] })), renderMode === 'still' ? null : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Custom audio bitrate" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: shouldHaveCustomTargetAudioBitrate, onChange: onShouldHaveTargetAudioBitrateChanged }) })] })), shouldHaveCustomTargetAudioBitrate && 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 audio 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.audioBitrateOption }) }), (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: customTargetAudioBitrate, onChange: onTargetAudioBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null] }));
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [renderMode === 'video' && audioCodecOptions(codec).length >= 2 ? ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Audio Codec" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { values: audioCodecOptions(codec), selectedId: audioCodec, title: "AudioCodec" }) })] })) : null, renderMode === 'video' ? ((0, jsx_runtime_1.jsx)(MutedSetting_1.MutedSetting, { enforceAudioTrack: enforceAudioTrack, muted: muted, setMuted: setMuted, hint: client_1.BrowserSafeApis.options.muteOption })) : null, (renderMode === 'video' || renderMode === 'audio') && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EnforceAudioTrackSetting_1.EnforceAudioTrackSetting, { muted: muted, enforceAudioTrack: enforceAudioTrack, setEnforceAudioTrack: setEnforceAudioTrackState, option: client_1.BrowserSafeApis.options.enforceAudioOption }), (0, jsx_runtime_1.jsx)(RenderModalHr_1.RenderModalHr, {})] })), renderMode === 'still' ? null : ((0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Custom audio bitrate" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: shouldHaveCustomTargetAudioBitrate, onChange: onShouldHaveTargetAudioBitrateChanged, name: "custom-audio-bitrate" }) })] })), shouldHaveCustomTargetAudioBitrate && 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 audio 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.audioBitrateOption }) }), (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: customTargetAudioBitrate, onChange: onTargetAudioBitrateChanged, status: "ok", rightAlign: true }) }) })] })) : null] }));
|
|
45
45
|
};
|
|
46
46
|
exports.RenderModalAudio = RenderModalAudio;
|
|
@@ -14,6 +14,6 @@ const RenderModalGif = ({ everyNthFrame, limitNumberOfGifLoops, numberOfGifLoops
|
|
|
14
14
|
const onShouldLimitNumberOfGifLoops = (0, react_1.useCallback)((e) => {
|
|
15
15
|
setLimitNumberOfGifLoops(e.target.checked);
|
|
16
16
|
}, [setLimitNumberOfGifLoops]);
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting, { name: "Every nth frame", min: 1, onValueChanged: setEveryNthFrameSetting, value: everyNthFrame, step: 1 }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Limit GIF loops" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: limitNumberOfGifLoops, onChange: onShouldLimitNumberOfGifLoops }) })] }), limitNumberOfGifLoops ? ((0, jsx_runtime_1.jsx)(NumberOfLoopsSetting_1.NumberOfLoopsSetting, { numberOfGifLoops: numberOfGifLoopsSetting, setNumberOfGifLoops: setNumberOfGifLoopsSetting })) : null] }));
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(NumberSetting_1.NumberSetting, { name: "Every nth frame", min: 1, onValueChanged: setEveryNthFrameSetting, value: everyNthFrame, step: 1 }), (0, jsx_runtime_1.jsxs)("div", { style: layout_1.optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: layout_1.label, children: "Limit GIF loops" }), (0, jsx_runtime_1.jsx)("div", { style: layout_1.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: limitNumberOfGifLoops, onChange: onShouldLimitNumberOfGifLoops, name: "limitNumberOfGifLoops" }) })] }), limitNumberOfGifLoops ? ((0, jsx_runtime_1.jsx)(NumberOfLoopsSetting_1.NumberOfLoopsSetting, { numberOfGifLoops: numberOfGifLoopsSetting, setNumberOfGifLoops: setNumberOfGifLoopsSetting })) : null] }));
|
|
18
18
|
};
|
|
19
19
|
exports.RenderModalGif = RenderModalGif;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import type { SerializedJSONWithCustomFields } from './SchemaEditor/input-props-serialization';
|
|
4
|
-
export
|
|
4
|
+
export type EditType = 'inputProps' | 'defaultProps';
|
|
5
5
|
export declare const RenderModalJSONPropsEditor: React.FC<{
|
|
6
6
|
value: unknown;
|
|
7
7
|
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { SegmentedControlItem } from '../SegmentedControl';
|
|
4
4
|
import type { RenderType } from './RenderModalAdvanced';
|
|
5
5
|
declare const qualityControlModes: readonly ["crf", "bitrate"];
|
|
6
|
-
export
|
|
6
|
+
export type QualityControl = typeof qualityControlModes[number];
|
|
7
7
|
export declare const RenderModalPicture: React.FC<{
|
|
8
8
|
renderMode: RenderType;
|
|
9
9
|
scale: number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fieldset = exports.SCHEMA_EDITOR_FIELDSET_PADDING = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.SCHEMA_EDITOR_FIELDSET_PADDING = 10;
|
|
7
|
+
const AlreadyPaddedRightContext = (0, react_1.createContext)(false);
|
|
8
|
+
const Fieldset = ({ children, shouldPad }) => {
|
|
9
|
+
const alreadyPadded = (0, react_1.useContext)(AlreadyPaddedRightContext);
|
|
10
|
+
const style = (0, react_1.useMemo)(() => {
|
|
11
|
+
if (shouldPad) {
|
|
12
|
+
return {
|
|
13
|
+
padding: exports.SCHEMA_EDITOR_FIELDSET_PADDING,
|
|
14
|
+
paddingTop: exports.SCHEMA_EDITOR_FIELDSET_PADDING / 2,
|
|
15
|
+
paddingRight: alreadyPadded ? 0 : exports.SCHEMA_EDITOR_FIELDSET_PADDING,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {};
|
|
19
|
+
}, [alreadyPadded, shouldPad]);
|
|
20
|
+
const content = (0, jsx_runtime_1.jsx)("div", { style: style, children: children });
|
|
21
|
+
if (shouldPad) {
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(AlreadyPaddedRightContext.Provider, { value: true, children: content }));
|
|
23
|
+
}
|
|
24
|
+
return content;
|
|
25
|
+
};
|
|
26
|
+
exports.Fieldset = Fieldset;
|
|
@@ -5,7 +5,6 @@ export declare const SchemaEditor: React.FC<{
|
|
|
5
5
|
value: unknown;
|
|
6
6
|
setValue: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
7
7
|
zodValidationResult: z.SafeParseReturnType<unknown, unknown>;
|
|
8
|
-
compact: boolean;
|
|
9
8
|
defaultProps: Record<string, unknown>;
|
|
10
9
|
onSave: (updater: (oldState: unknown) => unknown) => void;
|
|
11
10
|
showSaveButton: boolean;
|
|
@@ -8,12 +8,11 @@ const is_menu_item_1 = require("../../Menu/is-menu-item");
|
|
|
8
8
|
const SchemaErrorMessages_1 = require("./SchemaErrorMessages");
|
|
9
9
|
const ZodObjectEditor_1 = require("./ZodObjectEditor");
|
|
10
10
|
const scrollable = {
|
|
11
|
-
padding: '8px 12px',
|
|
12
11
|
display: 'flex',
|
|
13
12
|
flexDirection: 'column',
|
|
14
13
|
overflowY: 'auto',
|
|
15
14
|
};
|
|
16
|
-
const SchemaEditor = ({ schema, value, setValue, zodValidationResult,
|
|
15
|
+
const SchemaEditor = ({ schema, value, setValue, zodValidationResult, defaultProps, onSave, showSaveButton, saving, saveDisabledByParent, }) => {
|
|
17
16
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
18
17
|
if (!z) {
|
|
19
18
|
throw new Error('expected zod');
|
|
@@ -34,6 +33,6 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, compact, d
|
|
|
34
33
|
if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
|
|
35
34
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
|
|
36
35
|
}
|
|
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,
|
|
36
|
+
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, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }));
|
|
38
37
|
};
|
|
39
38
|
exports.SchemaEditor = SchemaEditor;
|
|
@@ -6,7 +6,6 @@ const Button_1 = require("../../../../preview-server/error-overlay/remotion-over
|
|
|
6
6
|
const colors_1 = require("../../../helpers/colors");
|
|
7
7
|
const layout_1 = require("../../layout");
|
|
8
8
|
const styles_1 = require("../../Menu/styles");
|
|
9
|
-
const SchemaEmptyStateGraphic_1 = require("./SchemaEmptyStateGraphic");
|
|
10
9
|
const ZodErrorMessages_1 = require("./ZodErrorMessages");
|
|
11
10
|
const explainer = {
|
|
12
11
|
display: 'flex',
|
|
@@ -42,7 +41,7 @@ const ZodNotInstalled = () => {
|
|
|
42
41
|
};
|
|
43
42
|
exports.ZodNotInstalled = ZodNotInstalled;
|
|
44
43
|
const NoSchemaDefined = () => {
|
|
45
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(0, jsx_runtime_1.
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: explainer, children: [(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" })] }));
|
|
46
45
|
};
|
|
47
46
|
exports.NoSchemaDefined = NoSchemaDefined;
|
|
48
47
|
const NoDefaultProps = () => {
|
|
@@ -50,7 +49,6 @@ const NoDefaultProps = () => {
|
|
|
50
49
|
};
|
|
51
50
|
exports.NoDefaultProps = NoDefaultProps;
|
|
52
51
|
const InvalidDefaultProps = ({ zodValidationResult }) => {
|
|
53
|
-
// TODO: Does not react to when schema is updated
|
|
54
52
|
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, viewTab: "schema" }), (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."] })] }));
|
|
55
53
|
};
|
|
56
54
|
exports.InvalidDefaultProps = InvalidDefaultProps;
|
|
@@ -7,14 +7,8 @@ export declare const SchemaLabel: React.FC<{
|
|
|
7
7
|
onSave: () => void;
|
|
8
8
|
onRemove: null | (() => void);
|
|
9
9
|
showSaveButton: boolean;
|
|
10
|
-
compact: boolean;
|
|
11
10
|
saving: boolean;
|
|
12
11
|
valid: boolean;
|
|
13
12
|
saveDisabledByParent: boolean;
|
|
14
|
-
|
|
15
|
-
export declare const SchemaFieldsetLabel: React.FC<{
|
|
16
|
-
jsonPath: JSONPath;
|
|
17
|
-
onRemove: null | (() => void);
|
|
18
|
-
isDefaultValue: boolean;
|
|
19
|
-
onReset: () => void;
|
|
13
|
+
suffix: string | null;
|
|
20
14
|
}>;
|
|
@@ -1,41 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SchemaLabel = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const colors_1 = require("../../../helpers/colors");
|
|
6
7
|
const layout_1 = require("../../layout");
|
|
7
8
|
const InlineRemoveButton_1 = require("../InlineRemoveButton");
|
|
8
|
-
const layout_2 = require("../layout");
|
|
9
9
|
const get_schema_label_1 = require("./get-schema-label");
|
|
10
10
|
const SchemaResetButton_1 = require("./SchemaResetButton");
|
|
11
11
|
const SchemaSaveButton_1 = require("./SchemaSaveButton");
|
|
12
|
-
const
|
|
12
|
+
const colors_2 = require("../../../helpers/colors");
|
|
13
|
+
const compactStyles = {
|
|
13
14
|
fontSize: 15,
|
|
14
15
|
color: colors_1.LIGHT_TEXT,
|
|
15
16
|
fontFamily: 'sans-serif',
|
|
16
|
-
};
|
|
17
|
-
const compactStyles = {
|
|
18
|
-
...commonStyles,
|
|
19
17
|
display: 'flex',
|
|
20
18
|
flexDirection: 'row',
|
|
21
19
|
alignItems: 'center',
|
|
22
20
|
};
|
|
23
|
-
const
|
|
24
|
-
...commonStyles,
|
|
25
|
-
width: layout_2.label.width,
|
|
26
|
-
};
|
|
27
|
-
const labelStyle = {
|
|
28
|
-
fontFamily: 'monospace',
|
|
29
|
-
fontSize: 14,
|
|
30
|
-
color: colors_1.LIGHT_TEXT,
|
|
31
|
-
lineHeight: '40px',
|
|
32
|
-
};
|
|
33
|
-
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, compact, onRemove, saving, valid, saveDisabledByParent, }) => {
|
|
21
|
+
const SchemaLabel = ({ jsonPath, isDefaultValue, onReset, onSave, showSaveButton, onRemove, saving, valid, saveDisabledByParent, suffix, }) => {
|
|
34
22
|
const disableSave = saving || !valid || saveDisabledByParent;
|
|
35
|
-
|
|
23
|
+
const labelStyle = (0, react_1.useMemo)(() => {
|
|
24
|
+
return {
|
|
25
|
+
fontFamily: 'monospace',
|
|
26
|
+
fontSize: 14,
|
|
27
|
+
color: valid ? colors_1.LIGHT_TEXT : colors_2.FAIL_COLOR,
|
|
28
|
+
lineHeight: '24px',
|
|
29
|
+
};
|
|
30
|
+
}, [valid]);
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: compactStyles, children: [(0, jsx_runtime_1.jsxs)("span", { style: labelStyle, children: [(0, get_schema_label_1.getSchemaLabel)(jsonPath), " ", suffix ? suffix : null] }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), 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] }));
|
|
36
32
|
};
|
|
37
33
|
exports.SchemaLabel = SchemaLabel;
|
|
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] }));
|
|
40
|
-
};
|
|
41
|
-
exports.SchemaFieldsetLabel = SchemaFieldsetLabel;
|
|
@@ -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
|
}>;
|