@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
|
@@ -6,48 +6,73 @@ const client_1 = require("@remotion/renderer/client");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const get_default_out_name_1 = require("../../get-default-out-name");
|
|
9
|
+
const Button_1 = require("../../preview-server/error-overlay/remotion-overlay/Button");
|
|
9
10
|
const get_default_video_contexts_1 = require("../../preview-server/render-queue/get-default-video-contexts");
|
|
11
|
+
const client_id_1 = require("../helpers/client-id");
|
|
12
|
+
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
10
13
|
const render_1 = require("../icons/render");
|
|
14
|
+
const in_out_1 = require("../state/in-out");
|
|
11
15
|
const modals_1 = require("../state/modals");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
16
|
+
const layout_1 = require("./layout");
|
|
17
|
+
const button = {
|
|
18
|
+
paddingLeft: 7,
|
|
19
|
+
paddingRight: 7,
|
|
20
|
+
paddingTop: 7,
|
|
21
|
+
paddingBottom: 7,
|
|
22
|
+
};
|
|
23
|
+
const label = {
|
|
24
|
+
fontSize: 14,
|
|
25
|
+
};
|
|
26
|
+
const RenderButton = () => {
|
|
27
|
+
const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
|
|
14
28
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
29
|
+
const { type } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
30
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx).type;
|
|
31
|
+
const shortcut = (0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? '' : '(R)';
|
|
32
|
+
const tooltip = type === 'connected'
|
|
33
|
+
? 'Export the current composition ' + shortcut
|
|
34
|
+
: 'Connect to the preview server to render';
|
|
15
35
|
const iconStyle = (0, react_1.useMemo)(() => {
|
|
16
36
|
return {
|
|
17
37
|
style: {
|
|
18
|
-
height:
|
|
38
|
+
height: 16,
|
|
39
|
+
color: 'currentColor',
|
|
19
40
|
},
|
|
20
41
|
};
|
|
21
42
|
}, []);
|
|
43
|
+
const video = remotion_1.Internals.useVideo();
|
|
44
|
+
const frame = (0, remotion_1.useCurrentFrame)();
|
|
22
45
|
const { props } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
if (!video) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const isVideo = video.durationInFrames > 1;
|
|
26
52
|
const defaults = window.remotion_renderDefaults;
|
|
27
53
|
if (!defaults) {
|
|
28
|
-
throw new
|
|
54
|
+
throw new TypeError('Expected defaults');
|
|
29
55
|
}
|
|
30
|
-
e.stopPropagation();
|
|
31
56
|
const { initialAudioCodec, initialRenderType, initialVideoCodec } = (0, get_default_video_contexts_1.getDefaultCodecs)({
|
|
32
57
|
defaultCodec: defaults.codec,
|
|
33
58
|
isStill: !isVideo,
|
|
34
59
|
});
|
|
35
60
|
setSelectedModal({
|
|
36
61
|
type: 'render',
|
|
37
|
-
compositionId:
|
|
38
|
-
initialFrame:
|
|
39
|
-
initialVideoImageFormat: defaults.videoImageFormat,
|
|
62
|
+
compositionId: video.id,
|
|
63
|
+
initialFrame: frame,
|
|
40
64
|
initialStillImageFormat: defaults.stillImageFormat,
|
|
41
|
-
|
|
42
|
-
initialScale: defaults.scale,
|
|
43
|
-
initialVerbose: defaults.logLevel === 'verbose',
|
|
65
|
+
initialVideoImageFormat: defaults.videoImageFormat,
|
|
44
66
|
initialOutName: (0, get_default_out_name_1.getDefaultOutLocation)({
|
|
45
|
-
compositionName:
|
|
67
|
+
compositionName: video.id,
|
|
46
68
|
defaultExtension: isVideo
|
|
47
|
-
? defaults.
|
|
48
|
-
:
|
|
69
|
+
? client_1.BrowserSafeApis.getFileExtensionFromCodec(initialVideoCodec, defaults.audioCodec)
|
|
70
|
+
: defaults.stillImageFormat,
|
|
49
71
|
type: 'asset',
|
|
50
72
|
}),
|
|
73
|
+
initialJpegQuality: defaults.jpegQuality,
|
|
74
|
+
initialScale: (_b = (_a = window.remotion_renderDefaults) === null || _a === void 0 ? void 0 : _a.scale) !== null && _b !== void 0 ? _b : 1,
|
|
75
|
+
initialVerbose: defaults.logLevel === 'verbose',
|
|
51
76
|
initialVideoCodecForAudioTab: initialAudioCodec,
|
|
52
77
|
initialRenderType,
|
|
53
78
|
initialVideoCodecForVideoTab: initialVideoCodec,
|
|
@@ -69,12 +94,14 @@ const RenderButton = ({ composition, visible }) => {
|
|
|
69
94
|
initialOpenGlRenderer: defaults.openGlRenderer,
|
|
70
95
|
initialHeadless: defaults.headless,
|
|
71
96
|
initialIgnoreCertificateErrors: defaults.ignoreCertificateErrors,
|
|
72
|
-
defaultProps: (
|
|
97
|
+
defaultProps: (_c = props[video.id]) !== null && _c !== void 0 ? _c : video.defaultProps,
|
|
98
|
+
inFrameMark: inFrame,
|
|
99
|
+
outFrameMark: outFrame,
|
|
73
100
|
});
|
|
74
|
-
}, [
|
|
75
|
-
if (!
|
|
101
|
+
}, [video, setSelectedModal, frame, props, inFrame, outFrame]);
|
|
102
|
+
if (!video) {
|
|
76
103
|
return null;
|
|
77
104
|
}
|
|
78
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(Button_1.Button, { id: "render-modal-button", title: tooltip, onClick: onClick, buttonContainerStyle: button, disabled: connectionStatus !== 'connected', children: (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)(render_1.RenderIcon, { svgProps: iconStyle }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("span", { style: label, children: "Render" })] }) }));
|
|
79
106
|
};
|
|
80
107
|
exports.RenderButton = RenderButton;
|
|
@@ -2,21 +2,58 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CliCopyButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../../helpers/colors");
|
|
7
|
+
const svgStyle = {
|
|
8
|
+
width: 16,
|
|
9
|
+
height: 16,
|
|
10
|
+
verticalAlign: 'sub',
|
|
11
|
+
};
|
|
12
|
+
const copiedStyle = {
|
|
13
|
+
fontSize: '14px',
|
|
14
|
+
minHeight: '30px',
|
|
15
|
+
minWidth: '30px',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
};
|
|
20
|
+
const buttonStyle = {
|
|
21
|
+
width: '30px',
|
|
22
|
+
height: '30px',
|
|
23
|
+
border: 'none',
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
};
|
|
5
29
|
const CliCopyButton = ({ valueToCopy, }) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
31
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
32
|
+
const fillColor = (0, react_1.useMemo)(() => {
|
|
33
|
+
return hovered ? 'white' : colors_1.LIGHT_TEXT;
|
|
34
|
+
}, [hovered]);
|
|
35
|
+
const clipboardIcon = ((0, jsx_runtime_1.jsx)("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "far", "data-icon": "clipboard", className: "svg-inline--fa fa-clipboard fa-w-12", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", style: svgStyle, children: (0, jsx_runtime_1.jsx)("path", { fill: fillColor, d: "M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm144 418c0 3.3-2.7 6-6 6H54c-3.3 0-6-2.7-6-6V118c0-3.3 2.7-6 6-6h42v36c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-36h42c3.3 0 6 2.7 6 6z" }) }));
|
|
36
|
+
const checkSvg = ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", style: svgStyle, children: (0, jsx_runtime_1.jsx)("path", { fill: fillColor, d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" }) }));
|
|
37
|
+
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
38
|
+
setHovered(true);
|
|
39
|
+
}, []);
|
|
40
|
+
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
41
|
+
setHovered(false);
|
|
42
|
+
}, []);
|
|
43
|
+
(0, react_1.useEffect)(() => {
|
|
44
|
+
if (!copied) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const handleClear = () => {
|
|
48
|
+
setCopied(false);
|
|
49
|
+
setHovered(false);
|
|
50
|
+
};
|
|
51
|
+
const to = setTimeout(() => handleClear(), 2000);
|
|
52
|
+
return () => clearTimeout(to);
|
|
53
|
+
}, [copied]);
|
|
54
|
+
return copied ? ((0, jsx_runtime_1.jsx)("span", { style: copiedStyle, children: checkSvg })) : ((0, jsx_runtime_1.jsx)("button", { type: "button", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: buttonStyle, onClick: () => {
|
|
19
55
|
navigator.clipboard.writeText(valueToCopy);
|
|
20
|
-
|
|
56
|
+
setCopied(true);
|
|
57
|
+
}, children: clipboardIcon }));
|
|
21
58
|
};
|
|
22
59
|
exports.CliCopyButton = CliCopyButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AnyComposition } from 'remotion';
|
|
3
|
+
export declare type State = {
|
|
4
|
+
str: string;
|
|
5
|
+
value: Record<string, unknown>;
|
|
6
|
+
validJSON: true;
|
|
7
|
+
zodValidation: Zod.SafeParseReturnType<unknown, unknown>;
|
|
8
|
+
} | {
|
|
9
|
+
str: string;
|
|
10
|
+
validJSON: false;
|
|
11
|
+
error: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type PropsEditType = 'input-props' | 'default-props';
|
|
14
|
+
export declare const DataEditor: React.FC<{
|
|
15
|
+
unresolvedComposition: AnyComposition;
|
|
16
|
+
inputProps: Record<string, unknown>;
|
|
17
|
+
setInputProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
18
|
+
compact: boolean;
|
|
19
|
+
mayShowSaveButton: boolean;
|
|
20
|
+
propsEditType: PropsEditType;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,287 @@
|
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DataEditor = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const remotion_1 = require("remotion");
|
|
30
|
+
const event_source_1 = require("../../../event-source");
|
|
31
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
32
|
+
const colors_1 = require("../../helpers/colors");
|
|
33
|
+
const get_zod_if_possible_1 = require("../get-zod-if-possible");
|
|
34
|
+
const layout_1 = require("../layout");
|
|
35
|
+
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
36
|
+
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
37
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
38
|
+
const SegmentedControl_1 = require("../SegmentedControl");
|
|
39
|
+
const get_render_modal_warnings_1 = require("./get-render-modal-warnings");
|
|
40
|
+
const RenderModalJSONPropsEditor_1 = require("./RenderModalJSONPropsEditor");
|
|
41
|
+
const extract_enum_json_paths_1 = require("./SchemaEditor/extract-enum-json-paths");
|
|
42
|
+
const input_props_serialization_1 = require("./SchemaEditor/input-props-serialization");
|
|
43
|
+
const SchemaEditor_1 = require("./SchemaEditor/SchemaEditor");
|
|
44
|
+
const SchemaErrorMessages_1 = require("./SchemaEditor/SchemaErrorMessages");
|
|
45
|
+
const WarningIndicatorButton_1 = require("./WarningIndicatorButton");
|
|
46
|
+
const errorExplanation = {
|
|
47
|
+
fontSize: 14,
|
|
48
|
+
color: colors_1.LIGHT_TEXT,
|
|
49
|
+
fontFamily: 'sans-serif',
|
|
50
|
+
lineHeight: 1.5,
|
|
51
|
+
};
|
|
52
|
+
const explainer = {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flex: 1,
|
|
55
|
+
flexDirection: 'column',
|
|
56
|
+
padding: '0 12px',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
textAlign: 'center',
|
|
60
|
+
};
|
|
61
|
+
const outer = {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
flex: 1,
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
backgroundColor: colors_1.BACKGROUND,
|
|
67
|
+
};
|
|
68
|
+
const controlContainer = {
|
|
69
|
+
flexDirection: 'column',
|
|
70
|
+
display: 'flex',
|
|
71
|
+
padding: 12,
|
|
72
|
+
borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
|
|
73
|
+
};
|
|
74
|
+
const tabWrapper = {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
marginBottom: '4px',
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
};
|
|
80
|
+
const persistanceKey = 'remotion.show-render-modalwarning';
|
|
81
|
+
const getPersistedShowWarningState = () => {
|
|
82
|
+
const val = localStorage.getItem(persistanceKey);
|
|
83
|
+
if (!val) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return val === 'true';
|
|
87
|
+
};
|
|
88
|
+
const setPersistedShowWarningState = (val) => {
|
|
89
|
+
localStorage.setItem(persistanceKey, String(Boolean(val)));
|
|
90
|
+
};
|
|
91
|
+
const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact, mayShowSaveButton, propsEditType, }) => {
|
|
92
|
+
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
93
|
+
const [valBeforeSafe, setValBeforeSafe] = (0, react_1.useState)(inputProps);
|
|
94
|
+
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
95
|
+
const [showWarning, setShowWarningWithoutPersistance] = (0, react_1.useState)(() => getPersistedShowWarningState());
|
|
96
|
+
const inJSONEditor = mode === 'json';
|
|
97
|
+
const serializedJSON = (0, react_1.useMemo)(() => {
|
|
98
|
+
if (!inJSONEditor) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const value = inputProps;
|
|
102
|
+
return (0, input_props_serialization_1.serializeJSONWithDate)({
|
|
103
|
+
data: value,
|
|
104
|
+
indent: 2,
|
|
105
|
+
staticBase: window.remotion_staticBase,
|
|
106
|
+
});
|
|
107
|
+
}, [inJSONEditor, inputProps]);
|
|
108
|
+
const cliProps = (0, remotion_1.getInputProps)();
|
|
109
|
+
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({
|
|
110
|
+
[unresolvedComposition.id]: get_render_modal_warnings_1.defaultTypeCanSaveState,
|
|
111
|
+
});
|
|
112
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
113
|
+
const schema = (0, react_1.useMemo)(() => {
|
|
114
|
+
if (!z) {
|
|
115
|
+
return 'no-zod';
|
|
116
|
+
}
|
|
117
|
+
if (!unresolvedComposition.schema) {
|
|
118
|
+
return z.object({});
|
|
119
|
+
}
|
|
120
|
+
if (!(typeof unresolvedComposition.schema.safeParse === 'function')) {
|
|
121
|
+
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
122
|
+
}
|
|
123
|
+
return unresolvedComposition.schema;
|
|
124
|
+
}, [unresolvedComposition.schema, z]);
|
|
125
|
+
const zodValidationResult = (0, react_1.useMemo)(() => {
|
|
126
|
+
if (schema === 'no-zod') {
|
|
127
|
+
return 'no-zod';
|
|
128
|
+
}
|
|
129
|
+
return schema.safeParse(inputProps);
|
|
130
|
+
}, [inputProps, schema]);
|
|
131
|
+
const setShowWarning = (0, react_1.useCallback)((val) => {
|
|
132
|
+
setShowWarningWithoutPersistance((prevVal) => {
|
|
133
|
+
if (typeof val === 'boolean') {
|
|
134
|
+
setPersistedShowWarningState(val);
|
|
135
|
+
return val;
|
|
136
|
+
}
|
|
137
|
+
setPersistedShowWarningState(val(prevVal));
|
|
138
|
+
return val(prevVal);
|
|
139
|
+
});
|
|
140
|
+
}, []);
|
|
141
|
+
const canSaveDefaultProps = (0, react_1.useMemo)(() => {
|
|
142
|
+
return canSaveDefaultPropsObjectState[unresolvedComposition.id]
|
|
143
|
+
? canSaveDefaultPropsObjectState[unresolvedComposition.id]
|
|
144
|
+
: get_render_modal_warnings_1.defaultTypeCanSaveState;
|
|
145
|
+
}, [canSaveDefaultPropsObjectState, unresolvedComposition.id]);
|
|
146
|
+
const showSaveButton = mayShowSaveButton && canSaveDefaultProps.canUpdate;
|
|
147
|
+
const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
|
|
148
|
+
const checkIfCanSaveDefaultProps = (0, react_1.useCallback)(async () => {
|
|
149
|
+
try {
|
|
150
|
+
const can = await (0, actions_1.canUpdateDefaultProps)(unresolvedComposition.id);
|
|
151
|
+
if (can.canUpdate) {
|
|
152
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
153
|
+
...prevState,
|
|
154
|
+
[unresolvedComposition.id]: {
|
|
155
|
+
canUpdate: true,
|
|
156
|
+
},
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
161
|
+
...prevState,
|
|
162
|
+
[unresolvedComposition.id]: {
|
|
163
|
+
canUpdate: false,
|
|
164
|
+
reason: can.reason,
|
|
165
|
+
determined: true,
|
|
166
|
+
},
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
172
|
+
...prevState,
|
|
173
|
+
[unresolvedComposition.id]: {
|
|
174
|
+
canUpdate: false,
|
|
175
|
+
reason: err.message,
|
|
176
|
+
determined: true,
|
|
177
|
+
},
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
}, [unresolvedComposition.id]);
|
|
181
|
+
(0, react_1.useEffect)(() => {
|
|
182
|
+
checkIfCanSaveDefaultProps();
|
|
183
|
+
}, [checkIfCanSaveDefaultProps]);
|
|
184
|
+
(0, react_1.useEffect)(() => {
|
|
185
|
+
const unsub = (0, event_source_1.subscribeToEvent)('root-file-changed', checkIfCanSaveDefaultProps);
|
|
186
|
+
return () => {
|
|
187
|
+
unsub();
|
|
188
|
+
};
|
|
189
|
+
}, [checkIfCanSaveDefaultProps]);
|
|
190
|
+
const modeItems = (0, react_1.useMemo)(() => {
|
|
191
|
+
return [
|
|
192
|
+
{
|
|
193
|
+
key: 'schema',
|
|
194
|
+
label: 'Schema',
|
|
195
|
+
onClick: () => {
|
|
196
|
+
setMode('schema');
|
|
197
|
+
},
|
|
198
|
+
selected: mode === 'schema',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
key: 'json',
|
|
202
|
+
label: 'JSON',
|
|
203
|
+
onClick: () => {
|
|
204
|
+
setMode('json');
|
|
205
|
+
},
|
|
206
|
+
selected: mode === 'json',
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
}, [mode]);
|
|
210
|
+
const onUpdate = (0, react_1.useCallback)(() => {
|
|
211
|
+
if (schema === 'no-zod' || z === null) {
|
|
212
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
setValBeforeSafe(inputProps);
|
|
216
|
+
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
217
|
+
if (!response.success) {
|
|
218
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}, [unresolvedComposition.id, inputProps, schema, z]);
|
|
222
|
+
(0, react_1.useEffect)(() => {
|
|
223
|
+
setSaving(false);
|
|
224
|
+
}, [fastRefreshes]);
|
|
225
|
+
const onSave = (0, react_1.useCallback)((updater) => {
|
|
226
|
+
if (schema === 'no-zod' || z === null) {
|
|
227
|
+
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
setSaving(true);
|
|
231
|
+
(0, actions_1.updateDefaultProps)(unresolvedComposition.id, updater(unresolvedComposition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
232
|
+
.then((response) => {
|
|
233
|
+
if (!response.success) {
|
|
234
|
+
console.log(response.stack);
|
|
235
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${response.reason}. See console for more information.`);
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
.catch((err) => {
|
|
239
|
+
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
|
|
240
|
+
setSaving(false);
|
|
241
|
+
});
|
|
242
|
+
}, [unresolvedComposition.defaultProps, unresolvedComposition.id, schema, z]);
|
|
243
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx).type;
|
|
244
|
+
const warnings = (0, react_1.useMemo)(() => {
|
|
245
|
+
return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
|
|
246
|
+
canSaveDefaultProps,
|
|
247
|
+
cliProps,
|
|
248
|
+
isCustomDateUsed: serializedJSON ? serializedJSON.customDateUsed : false,
|
|
249
|
+
customFileUsed: serializedJSON ? serializedJSON.customFileUsed : false,
|
|
250
|
+
inJSONEditor,
|
|
251
|
+
propsEditType,
|
|
252
|
+
jsMapUsed: serializedJSON ? serializedJSON.mapUsed : false,
|
|
253
|
+
jsSetUsed: serializedJSON ? serializedJSON.setUsed : false,
|
|
254
|
+
});
|
|
255
|
+
}, [
|
|
256
|
+
cliProps,
|
|
257
|
+
canSaveDefaultProps,
|
|
258
|
+
inJSONEditor,
|
|
259
|
+
propsEditType,
|
|
260
|
+
serializedJSON,
|
|
261
|
+
]);
|
|
262
|
+
if (connectionStatus === 'disconnected') {
|
|
263
|
+
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 })] }));
|
|
264
|
+
}
|
|
265
|
+
if (schema === 'no-zod') {
|
|
266
|
+
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.ZodNotInstalled, {});
|
|
267
|
+
}
|
|
268
|
+
if (!z) {
|
|
269
|
+
throw new Error('expected zod');
|
|
270
|
+
}
|
|
271
|
+
if (zodValidationResult === 'no-zod') {
|
|
272
|
+
throw new Error('expected zod');
|
|
273
|
+
}
|
|
274
|
+
const def = schema._def;
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
|
+
const typeName = def.typeName;
|
|
277
|
+
if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
|
|
278
|
+
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoSchemaDefined, {});
|
|
279
|
+
}
|
|
280
|
+
if (!unresolvedComposition.defaultProps) {
|
|
281
|
+
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoDefaultProps, {});
|
|
282
|
+
}
|
|
283
|
+
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
|
|
284
|
+
? 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)))
|
|
285
|
+
: 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 }))] }));
|
|
286
|
+
};
|
|
287
|
+
exports.DataEditor = DataEditor;
|
|
@@ -4,13 +4,14 @@ exports.EnforceAudioTrackSetting = 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");
|
|
7
8
|
const InfoBubble_1 = require("./InfoBubble");
|
|
8
|
-
const
|
|
9
|
+
const layout_2 = require("./layout");
|
|
9
10
|
const OptionExplainer_1 = require("./OptionExplainer");
|
|
10
11
|
const EnforceAudioTrackSetting = ({ enforceAudioTrack, muted, setEnforceAudioTrack, option }) => {
|
|
11
12
|
const onEnforceAudioTrackChanged = (0, react_1.useCallback)((e) => {
|
|
12
13
|
setEnforceAudioTrack(e.target.checked);
|
|
13
14
|
}, [setEnforceAudioTrack]);
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style:
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: layout_2.optionRow, children: [(0, jsx_runtime_1.jsxs)("div", { style: layout_2.label, children: ["Enforce Audio Track", (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(InfoBubble_1.InfoBubble, { title: "Learn more about this option", children: (0, jsx_runtime_1.jsx)(OptionExplainer_1.OptionExplainer, { option: option }) })] }), (0, jsx_runtime_1.jsx)("div", { style: layout_2.rightRow, children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { disabled: muted && !enforceAudioTrack, checked: enforceAudioTrack, onChange: onEnforceAudioTrackChanged }) })] }));
|
|
15
16
|
};
|
|
16
17
|
exports.EnforceAudioTrackSetting = EnforceAudioTrackSetting;
|
|
@@ -106,10 +106,11 @@ const InfoBubble = ({ title, children }) => {
|
|
|
106
106
|
display: 'inline-flex',
|
|
107
107
|
flexDirection: 'row',
|
|
108
108
|
alignItems: 'center',
|
|
109
|
+
padding: 6,
|
|
109
110
|
};
|
|
110
111
|
}, []);
|
|
111
112
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { ref: ref, tabIndex: tabIndex, style: style, title: title, type: "button", children: (0, jsx_runtime_1.jsx)("svg", { style: icon, viewBox: "0 0 512 512", children: (0, jsx_runtime_1.jsx)("path", { fill: hovered ? 'white' : colors_1.LIGHT_TEXT, d: "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24h-8V248c0-13.3-10.7-24-24-24H216c-13.3 0-24 10.7-24 24s10.7 24 24 24h24v64H216zm40-144a32 32 0 1 0 0-64 32 32 0 1 0 0 64z" }) }) }), portalStyle
|
|
112
|
-
? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(InfoTooltip_1.InfoTooltip, { arrowDirection: layout, children: children }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
|
|
113
|
+
? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(InfoTooltip_1.InfoTooltip, { backgroundColor: colors_1.INPUT_BACKGROUND, arrowDirection: layout, children: children }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
|
|
113
114
|
: null] }));
|
|
114
115
|
};
|
|
115
116
|
exports.InfoBubble = InfoBubble;
|
|
@@ -18,23 +18,24 @@ const arrowUp = {
|
|
|
18
18
|
};
|
|
19
19
|
const arrowDown = {
|
|
20
20
|
...arrow,
|
|
21
|
-
marginTop: -
|
|
21
|
+
marginTop: -1,
|
|
22
22
|
};
|
|
23
|
-
const InfoTooltip = ({ children, arrowDirection }) => {
|
|
23
|
+
const InfoTooltip = ({ children, arrowDirection, backgroundColor }) => {
|
|
24
24
|
const container = (0, react_1.useMemo)(() => {
|
|
25
25
|
return {
|
|
26
26
|
boxShadow: arrowDirection === 'down' ? styles_1.SHADOW_TOWARDS_TOP : styles_1.SHADOW_TOWARDS_BOTTOM,
|
|
27
|
-
background:
|
|
27
|
+
background: backgroundColor,
|
|
28
28
|
color: 'white',
|
|
29
29
|
border: '0.5px solid ' + colors_1.BORDER_COLOR,
|
|
30
30
|
maxHeight: 200,
|
|
31
31
|
overflow: 'auto',
|
|
32
|
+
borderRadius: '4px',
|
|
32
33
|
};
|
|
33
|
-
}, [arrowDirection]);
|
|
34
|
+
}, [arrowDirection, backgroundColor]);
|
|
34
35
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
35
36
|
display: 'flex',
|
|
36
37
|
flexDirection: arrowDirection === 'up' ? 'column-reverse' : 'column',
|
|
37
38
|
alignItems: 'flex-start',
|
|
38
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: children }), arrowDirection === 'down' ? ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 14 7", style: arrowDown, children: (0, jsx_runtime_1.jsx)("path", { d: `M 14 0 L 7 7 L 0 0`, fill:
|
|
39
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: container, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: children }), arrowDirection === 'down' ? ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 14 7", style: arrowDown, children: (0, jsx_runtime_1.jsx)("path", { d: `M 14 0 L 7 7 L 0 0`, fill: backgroundColor, strokeLinecap: "butt", stroke: colors_1.BORDER_COLOR, strokeWidth: 0.5 }) })) : null, arrowDirection === 'up' ? ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 14 7", style: arrowUp, children: (0, jsx_runtime_1.jsx)("path", { d: `M 0 7 L 7 0 L 14 7`, fill: backgroundColor, strokeLinecap: "butt", stroke: colors_1.BORDER_COLOR, strokeWidth: 0.5 }) })) : null] }));
|
|
39
40
|
};
|
|
40
41
|
exports.InfoTooltip = InfoTooltip;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InlineEyeButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const react_1 = require("react");
|
|
6
6
|
const InlineAction_1 = require("../InlineAction");
|
|
7
7
|
const clearIcon = {
|
|
8
8
|
height: 14,
|
|
9
|
-
color:
|
|
9
|
+
color: 'currentColor',
|
|
10
10
|
};
|
|
11
11
|
const InlineEyeButton = ({ onClick, enabled }) => {
|
|
12
|
-
|
|
12
|
+
const renderAction = (0, react_1.useCallback)((color) => {
|
|
13
|
+
return enabled ? ((0, jsx_runtime_1.jsx)("svg", { style: clearIcon, viewBox: "0 0 640 512", children: (0, jsx_runtime_1.jsx)("path", { fill: color, d: "M25.9 3.4C19-2 8.9-.8 3.4 6.1S-.8 23.1 6.1 28.6l608 480c6.9 5.5 17 4.3 22.5-2.6s4.3-17-2.6-22.5L25.9 3.4zM605.5 268.3c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-51.2 0-96 14.8-133.9 36.8l27.3 21.5C244.6 74.2 280.2 64 320 64c70.4 0 127.7 32 170.8 72c43.1 40 71.9 88 85.2 120c-9.2 22.1-25.9 52-49.5 81.5l25.1 19.8c25.6-32 43.7-64.4 53.9-89zM88.4 154.7c-25.6 32-43.7 64.4-53.9 89c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c51.2 0 96-14.8 133.9-36.8l-27.3-21.5C395.4 437.8 359.8 448 320 448c-70.4 0-127.7-32-170.8-72C106.1 336 77.3 288 64 256c9.2-22.1 25.9-52 49.5-81.5L88.4 154.7zM320 384c16.7 0 32.7-3.2 47.4-9.1l-30.9-24.4c-5.4 .9-10.9 1.4-16.5 1.4c-51 0-92.8-39.8-95.8-90.1l-30.9-24.4c-.9 6-1.3 12.2-1.3 18.5c0 70.7 57.3 128 128 128zM448 256c0-70.7-57.3-128-128-128c-16.7 0-32.7 3.2-47.4 9.1l30.9 24.4c5.4-.9 10.9-1.4 16.5-1.4c51 0 92.8 39.8 95.8 90.1l30.9 24.4c.9-6 1.3-12.2 1.3-18.5z" }) })) : ((0, jsx_runtime_1.jsx)("svg", { style: clearIcon, viewBox: "0 0 576 512", children: (0, jsx_runtime_1.jsx)("path", { fill: color, d: "M117.2 136C160.3 96 217.6 64 288 64s127.7 32 170.8 72c43.1 40 71.9 88 85.2 120c-13.3 32-42.1 80-85.2 120c-43.1 40-100.4 72-170.8 72s-127.7-32-170.8-72C74.1 336 45.3 288 32 256c13.3-32 42.1-80 85.2-120zM288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM192 256a96 96 0 1 1 192 0 96 96 0 1 1 -192 0zm224 0a128 128 0 1 0 -256 0 128 128 0 1 0 256 0z" }) }));
|
|
14
|
+
}, [enabled]);
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick });
|
|
13
16
|
};
|
|
14
17
|
exports.InlineEyeButton = InlineEyeButton;
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InlineRemoveButton = 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 clearIcon = {
|
|
7
8
|
height: 14,
|
|
9
|
+
color: 'currentColor',
|
|
8
10
|
};
|
|
9
11
|
const InlineRemoveButton = ({ onClick }) => {
|
|
10
|
-
|
|
12
|
+
const renderAction = (0, react_1.useCallback)((color) => {
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 320 512", style: clearIcon, children: (0, jsx_runtime_1.jsx)("path", { d: "M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z", fill: color }) }));
|
|
14
|
+
}, []);
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick });
|
|
11
16
|
};
|
|
12
17
|
exports.InlineRemoveButton = InlineRemoveButton;
|