@remotion/cli 4.1.0-alpha11 → 4.1.0-alpha12

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.
Files changed (71) hide show
  1. package/dist/codemods/update-default-props.js +5 -0
  2. package/dist/config/image-format.d.ts +1 -1
  3. package/dist/config/index.d.ts +1 -1
  4. package/dist/editor/components/AssetSelector.d.ts +2 -0
  5. package/dist/editor/components/AssetSelector.js +85 -0
  6. package/dist/editor/components/AssetSelectorItem.d.ts +6 -0
  7. package/dist/editor/components/AssetSelectorItem.js +125 -0
  8. package/dist/editor/components/CompositionSelector.js +3 -3
  9. package/dist/editor/components/CopyButton.js +8 -2
  10. package/dist/editor/components/CurrentCompositionSideEffects.js +9 -5
  11. package/dist/editor/components/ExplorerPanel.d.ts +8 -0
  12. package/dist/editor/components/ExplorerPanel.js +67 -0
  13. package/dist/editor/components/FullscreenToggle.js +23 -1
  14. package/dist/editor/components/InlineAction.d.ts +1 -0
  15. package/dist/editor/components/InlineAction.js +2 -2
  16. package/dist/editor/components/KeyboardShortcutsExplainer.js +1 -1
  17. package/dist/editor/components/NewComposition/RemInput.d.ts +2 -2
  18. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  19. package/dist/editor/components/OptionsPanel.d.ts +8 -0
  20. package/dist/editor/components/OptionsPanel.js +112 -0
  21. package/dist/editor/components/RenderModal/CliCopyButton.js +2 -1
  22. package/dist/editor/components/RenderModal/MultiRangeSlider.js +4 -7
  23. package/dist/editor/components/RenderModal/RenderModal.js +7 -7
  24. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +4 -0
  25. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +5 -1
  26. package/dist/editor/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +17 -0
  27. package/dist/editor/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +83 -0
  28. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +5 -0
  29. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +5 -1
  30. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +5 -1
  32. package/dist/editor/components/RenderQueue/RenderQueueOpenInFolder.js +2 -1
  33. package/dist/editor/components/TopPanel.js +4 -8
  34. package/dist/editor/components/UpdateModal/UpdateModal.js +4 -1
  35. package/dist/editor/helpers/colors.d.ts +1 -1
  36. package/dist/editor/helpers/copy-text.d.ts +1 -1
  37. package/dist/editor/helpers/copy-text.js +15 -10
  38. package/dist/editor/helpers/document-title.d.ts +4 -0
  39. package/dist/editor/helpers/document-title.js +60 -0
  40. package/dist/editor/helpers/pick-color.js +12 -7
  41. package/dist/editor/helpers/render-modal-sections.d.ts +0 -1
  42. package/dist/editor/icons/clipboard.d.ts +4 -0
  43. package/dist/editor/icons/clipboard.js +6 -0
  44. package/dist/editor/icons/file.d.ts +3 -1
  45. package/dist/editor/icons/file.js +1 -1
  46. package/dist/editor/icons/folder.d.ts +3 -0
  47. package/dist/editor/icons/folder.js +5 -1
  48. package/dist/event-source-events.d.ts +1 -0
  49. package/dist/event-source.js +1 -0
  50. package/dist/get-cli-options.d.ts +1 -1
  51. package/dist/get-input-props.js +2 -1
  52. package/dist/handle-common-errors.js +2 -2
  53. package/dist/index.d.ts +6 -5
  54. package/dist/index.js +1 -1
  55. package/dist/make-on-download.d.ts +12 -0
  56. package/dist/make-on-download.js +40 -0
  57. package/dist/parse-command-line.d.ts +1 -0
  58. package/dist/preview-server/public-folder.js +3 -0
  59. package/dist/preview-server/render-queue/process-still.js +1 -1
  60. package/dist/preview-server/routes.d.ts +0 -1
  61. package/dist/preview-server/routes.js +1 -0
  62. package/dist/progress-bar.js +2 -7
  63. package/dist/render-flows/render.js +17 -25
  64. package/dist/render-flows/still.d.ts +2 -2
  65. package/dist/render-flows/still.js +30 -40
  66. package/dist/still.js +1 -1
  67. package/dist/studio.js +8 -1
  68. package/dist/upgrade.d.ts +1 -1
  69. package/dist/upgrade.js +11 -4
  70. package/package.json +8 -8
  71. package/styles/styles.css +7 -17
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OptionsPanel = exports.optionsSidebarTabs = exports.persistSelectedOptionsSidebarPanel = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const ShortcutHint_1 = require("../../preview-server/error-overlay/remotion-overlay/ShortcutHint");
8
+ const colors_1 = require("../helpers/colors");
9
+ const DataEditor_1 = require("./RenderModal/DataEditor");
10
+ const deep_equal_1 = require("./RenderModal/SchemaEditor/deep-equal");
11
+ const RenderQueue_1 = require("./RenderQueue");
12
+ const RendersTab_1 = require("./RendersTab");
13
+ const Tabs_1 = require("./Tabs");
14
+ const container = {
15
+ height: '100%',
16
+ width: '100%',
17
+ position: 'absolute',
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ };
21
+ const circle = {
22
+ width: 8,
23
+ height: 8,
24
+ borderRadius: 4,
25
+ };
26
+ const localStorageKey = 'remotion.sidebarPanel';
27
+ const getSelectedPanel = () => {
28
+ const panel = localStorage.getItem(localStorageKey);
29
+ if (panel === 'renders') {
30
+ return 'renders';
31
+ }
32
+ return 'input-props';
33
+ };
34
+ const tabsContainer = {
35
+ backgroundColor: colors_1.BACKGROUND,
36
+ };
37
+ const persistSelectedOptionsSidebarPanel = (panel) => {
38
+ localStorage.setItem(localStorageKey, panel);
39
+ };
40
+ exports.persistSelectedOptionsSidebarPanel = persistSelectedOptionsSidebarPanel;
41
+ exports.optionsSidebarTabs = (0, react_1.createRef)();
42
+ const OptionsPanel = () => {
43
+ const { props, updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
44
+ const [saving, setSaving] = (0, react_1.useState)(false);
45
+ const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel());
46
+ const onPropsSelected = (0, react_1.useCallback)(() => {
47
+ setPanel('input-props');
48
+ (0, exports.persistSelectedOptionsSidebarPanel)('input-props');
49
+ }, []);
50
+ const onRendersSelected = (0, react_1.useCallback)(() => {
51
+ setPanel('renders');
52
+ (0, exports.persistSelectedOptionsSidebarPanel)('renders');
53
+ }, []);
54
+ (0, react_1.useImperativeHandle)(exports.optionsSidebarTabs, () => {
55
+ return {
56
+ selectRendersPanel: () => {
57
+ setPanel('renders');
58
+ (0, exports.persistSelectedOptionsSidebarPanel)('renders');
59
+ },
60
+ };
61
+ }, []);
62
+ const { compositions, currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
63
+ const circleStyle = (0, react_1.useMemo)(() => {
64
+ const onTabColor = saving ? colors_1.LIGHT_TEXT : 'white';
65
+ return {
66
+ ...circle,
67
+ backgroundColor: panel === 'input-props' ? onTabColor : colors_1.LIGHT_TEXT,
68
+ cursor: 'help',
69
+ };
70
+ }, [panel, saving]);
71
+ const composition = (0, react_1.useMemo)(() => {
72
+ for (const comp of compositions) {
73
+ if (comp.id === currentComposition) {
74
+ return comp;
75
+ }
76
+ }
77
+ return null;
78
+ }, [compositions, currentComposition]);
79
+ const saveToolTip = (0, react_1.useMemo)(() => {
80
+ return process.env.KEYBOARD_SHORTCUTS_ENABLED
81
+ ? `Save using ${ShortcutHint_1.cmdOrCtrlCharacter}+S`
82
+ : 'There are unsaved changes';
83
+ }, []);
84
+ const setInputProps = (0, react_1.useCallback)((newProps) => {
85
+ if (composition === null) {
86
+ return;
87
+ }
88
+ updateProps({
89
+ id: composition.id,
90
+ defaultProps: composition.defaultProps,
91
+ newProps,
92
+ });
93
+ }, [composition, updateProps]);
94
+ const actualProps = (0, react_1.useMemo)(() => {
95
+ var _a, _b;
96
+ if (composition === null) {
97
+ return {};
98
+ }
99
+ return (_b = (_a = props[composition.id]) !== null && _a !== void 0 ? _a : composition.defaultProps) !== null && _b !== void 0 ? _b : {};
100
+ }, [composition, props]);
101
+ const unsavedChangesExist = (0, react_1.useMemo)(() => {
102
+ if (composition === null || composition.defaultProps === undefined) {
103
+ return false;
104
+ }
105
+ return !(0, deep_equal_1.deepEqual)(composition.defaultProps, actualProps);
106
+ }, [actualProps, composition]);
107
+ if (composition === null) {
108
+ return null;
109
+ }
110
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, className: "css-reset", children: [(0, jsx_runtime_1.jsx)("div", { style: tabsContainer, children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [(0, jsx_runtime_1.jsxs)(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onPropsSelected, style: { justifyContent: 'space-between' }, children: ["Props", unsavedChangesExist ? ((0, jsx_runtime_1.jsx)("div", { title: saveToolTip, style: circleStyle })) : null] }), (0, jsx_runtime_1.jsx)(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' })] }) }), panel === 'renders' ? ((0, jsx_runtime_1.jsx)(RenderQueue_1.RenderQueue, {})) : ((0, jsx_runtime_1.jsx)(DataEditor_1.DataEditor, { unresolvedComposition: composition, inputProps: actualProps, setInputProps: setInputProps, mayShowSaveButton: true, propsEditType: "default-props", saving: saving, setSaving: setSaving }, composition.id))] }));
111
+ };
112
+ exports.OptionsPanel = OptionsPanel;
@@ -4,6 +4,7 @@ exports.CliCopyButton = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const colors_1 = require("../../helpers/colors");
7
+ const clipboard_1 = require("../../icons/clipboard");
7
8
  const svgStyle = {
8
9
  width: 16,
9
10
  height: 16,
@@ -32,7 +33,7 @@ const CliCopyButton = ({ valueToCopy, }) => {
32
33
  const fillColor = (0, react_1.useMemo)(() => {
33
34
  return hovered ? 'white' : colors_1.LIGHT_TEXT;
34
35
  }, [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 clipboardIcon = (0, jsx_runtime_1.jsx)(clipboard_1.ClipboardIcon, { color: fillColor, style: svgStyle });
36
37
  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
38
  const onPointerEnter = (0, react_1.useCallback)(() => {
38
39
  setHovered(true);
@@ -7,6 +7,7 @@ const colors_1 = require("../../helpers/colors");
7
7
  const container = {
8
8
  borderColor: 'black',
9
9
  borderStyle: 'solid',
10
+ borderWidth: '2px',
10
11
  height: 39,
11
12
  width: 220,
12
13
  position: 'relative',
@@ -15,16 +16,12 @@ const container = {
15
16
  marginRight: 8,
16
17
  borderRadius: 2,
17
18
  };
18
- const slider = {
19
- position: 'relative',
20
- height: 38,
21
- width: 220,
22
- };
19
+ // blue slider
23
20
  const sliderRange = {
24
21
  position: 'absolute',
25
22
  top: 0,
26
23
  backgroundColor: colors_1.BLUE,
27
- height: 39,
24
+ height: 35,
28
25
  };
29
26
  const MultiRangeSlider = ({ min, max, start, end, step, onLeftThumbDrag, onRightThumbDrag, }) => {
30
27
  const getPercent = (0, react_1.useCallback)((value) => Math.round(((value - min) / (max - min)) * 100), [min, max]);
@@ -45,6 +42,6 @@ const MultiRangeSlider = ({ min, max, start, end, step, onLeftThumbDrag, onRight
45
42
  const value = Math.max(Number(event.target.value), start + 1);
46
43
  onRightThumbDrag(value);
47
44
  }, [onRightThumbDrag, start]);
48
- return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsxs)("div", { style: slider, children: [(0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: start, step: step, onChange: onChangeLeft, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: end, step: step, onChange: onChangeRight, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("div", { style: rangeStyle })] }) }));
45
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: start, step: step, onChange: onChangeLeft, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("input", { type: "range", min: min, max: max, value: end, step: step, onChange: onChangeRight, className: "__remotion_thumb" }), (0, jsx_runtime_1.jsx)("div", { style: rangeStyle })] }));
49
46
  };
50
47
  exports.MultiRangeSlider = MultiRangeSlider;
@@ -24,8 +24,8 @@ const is_menu_item_1 = require("../Menu/is-menu-item");
24
24
  const styles_1 = require("../Menu/styles");
25
25
  const ModalContainer_1 = require("../ModalContainer");
26
26
  const ModalHeader_1 = require("../ModalHeader");
27
+ const OptionsPanel_1 = require("../OptionsPanel");
27
28
  const actions_1 = require("../RenderQueue/actions");
28
- const RightPanel_1 = require("../RightPanel");
29
29
  const SegmentedControl_1 = require("../SegmentedControl");
30
30
  const Spinner_1 = require("../Spinner");
31
31
  const vertical_1 = require("../Tabs/vertical");
@@ -63,7 +63,7 @@ const container = {
63
63
  padding: '12px 16px',
64
64
  borderBottom: '1px solid black',
65
65
  };
66
- const rightPanel = {
66
+ const optionsPanel = {
67
67
  display: 'flex',
68
68
  width: '100%',
69
69
  };
@@ -311,8 +311,8 @@ const RenderModal = ({ initialFrame, initialVideoImageFormat, initialStillImageF
311
311
  const onClickStill = (0, react_1.useCallback)(() => {
312
312
  var _a;
313
313
  setSidebarCollapsedState({ left: null, right: 'expanded' });
314
- (0, RightPanel_1.persistSelectedPanel)('renders');
315
- (_a = RightPanel_1.rightSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectRendersPanel();
314
+ (0, OptionsPanel_1.persistSelectedOptionsSidebarPanel)('renders');
315
+ (_a = OptionsPanel_1.optionsSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectRendersPanel();
316
316
  dispatchIfMounted({ type: 'start' });
317
317
  (0, actions_1.addStillRenderJob)({
318
318
  compositionId: resolvedComposition.id,
@@ -361,8 +361,8 @@ const RenderModal = ({ initialFrame, initialVideoImageFormat, initialStillImageF
361
361
  const onClickVideo = (0, react_1.useCallback)(() => {
362
362
  var _a;
363
363
  setSidebarCollapsedState({ left: null, right: 'expanded' });
364
- (0, RightPanel_1.persistSelectedPanel)('renders');
365
- (_a = RightPanel_1.rightSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectRendersPanel();
364
+ (0, OptionsPanel_1.persistSelectedOptionsSidebarPanel)('renders');
365
+ (_a = OptionsPanel_1.optionsSidebarTabs.current) === null || _a === void 0 ? void 0 : _a.selectRendersPanel();
366
366
  dispatchIfMounted({ type: 'start' });
367
367
  (0, actions_1.addVideoRenderJob)({
368
368
  compositionId: resolvedComposition.id,
@@ -585,7 +585,7 @@ const RenderModal = ({ initialFrame, initialVideoImageFormat, initialStillImageF
585
585
  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: {
586
586
  ...buttonStyle,
587
587
  backgroundColor: outnameValidation.valid ? colors_1.BLUE : colors_1.BLUE_DISABLED,
588
- }, 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", saving: saving, setSaving: setSaving })) : ((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 })) })] })] }));
588
+ }, 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: optionsPanel, 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", saving: saving, setSaving: setSaving })) : ((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 })) })] })] }));
589
589
  };
590
590
  const RenderModalWithLoader = (props) => {
591
591
  const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
@@ -29,6 +29,7 @@ const react_1 = __importStar(require("react"));
29
29
  const remotion_1 = require("remotion");
30
30
  const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
31
31
  const colors_1 = require("../../helpers/colors");
32
+ const document_title_1 = require("../../helpers/document-title");
32
33
  const use_keybinding_1 = require("../../helpers/use-keybinding");
33
34
  const layout_1 = require("../layout");
34
35
  const RemTextarea_1 = require("../NewComposition/RemTextarea");
@@ -95,6 +96,9 @@ const RenderModalJSONPropsEditor = ({ setValue, value, defaultProps, onSave, sho
95
96
  const hasChanged = (0, react_1.useMemo)(() => {
96
97
  return !(0, deep_equal_1.deepEqual)(value, defaultProps);
97
98
  }, [defaultProps, value]);
99
+ (0, react_1.useEffect)(() => {
100
+ (0, document_title_1.setUnsavedProps)(hasChanged);
101
+ }, [hasChanged]);
98
102
  const onQuickSave = (0, react_1.useCallback)(() => {
99
103
  if (hasChanged) {
100
104
  onSave();
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SchemaEditor = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const document_title_1 = require("../../../helpers/document-title");
6
7
  const use_keybinding_1 = require("../../../helpers/use-keybinding");
7
8
  const get_zod_if_possible_1 = require("../../get-zod-if-possible");
8
9
  const is_menu_item_1 = require("../../Menu/is-menu-item");
@@ -23,6 +24,9 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, defaultPro
23
24
  const hasChanged = (0, react_1.useMemo)(() => {
24
25
  return !(0, deep_equal_1.deepEqual)(defaultProps, value);
25
26
  }, [defaultProps, value]);
27
+ (0, react_1.useEffect)(() => {
28
+ (0, document_title_1.setUnsavedProps)(hasChanged);
29
+ }, [hasChanged]);
26
30
  const onQuickSave = (0, react_1.useCallback)(() => {
27
31
  if (hasChanged && showSaveButton) {
28
32
  onSave(() => {
@@ -59,6 +63,6 @@ const SchemaEditor = ({ schema, value, setValue, zodValidationResult, defaultPro
59
63
  if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
60
64
  return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.TopLevelZodValue, { typeReceived: typeName });
61
65
  }
62
- 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 }) }));
66
+ 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, { discriminatedUnionReplacement: null, value: value, setValue: setValue, jsonPath: [], schema: schema, defaultValue: defaultProps, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: true }) }));
63
67
  };
64
68
  exports.SchemaEditor = SchemaEditor;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import type { z } from 'zod';
3
+ import type { JSONPath } from './zod-types';
4
+ import type { UpdaterFunction } from './ZodSwitch';
5
+ export declare const ZodDiscriminatedUnionEditor: React.FC<{
6
+ schema: z.ZodTypeAny;
7
+ setValue: UpdaterFunction<Record<string, unknown>>;
8
+ value: Record<string, unknown>;
9
+ defaultValue: Record<string, unknown>;
10
+ mayPad: boolean;
11
+ jsonPath: JSONPath;
12
+ onRemove: null | (() => void);
13
+ onSave: UpdaterFunction<unknown>;
14
+ showSaveButton: boolean;
15
+ saving: boolean;
16
+ saveDisabledByParent: boolean;
17
+ }>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZodDiscriminatedUnionEditor = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const Checkmark_1 = require("../../../icons/Checkmark");
7
+ const get_zod_if_possible_1 = require("../../get-zod-if-possible");
8
+ const ComboBox_1 = require("../../NewComposition/ComboBox");
9
+ const create_zod_values_1 = require("./create-zod-values");
10
+ const Fieldset_1 = require("./Fieldset");
11
+ const local_state_1 = require("./local-state");
12
+ const SchemaLabel_1 = require("./SchemaLabel");
13
+ const ZodObjectEditor_1 = require("./ZodObjectEditor");
14
+ const ZodDiscriminatedUnionEditor = ({ schema, setValue, showSaveButton, saving, value, defaultValue, saveDisabledByParent, onSave, mayPad, jsonPath, onRemove, }) => {
15
+ const z = (0, get_zod_if_possible_1.useZodIfPossible)();
16
+ if (!z) {
17
+ throw new Error('expected zod');
18
+ }
19
+ const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
20
+ const typedSchema = schema._def;
21
+ const options = (0, react_1.useMemo)(() => [...typedSchema.optionsMap.keys()], [typedSchema.optionsMap]);
22
+ const { localValue, onChange: setLocalValue, reset, } = (0, local_state_1.useLocalState)({
23
+ schema,
24
+ setValue,
25
+ value,
26
+ defaultValue,
27
+ });
28
+ const comboBoxValues = (0, react_1.useMemo)(() => {
29
+ return options.map((option) => {
30
+ return {
31
+ value: option,
32
+ label: option,
33
+ id: option,
34
+ keyHint: null,
35
+ leftItem: option === value[typedSchema.discriminator] ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
36
+ onClick: () => {
37
+ const val = (0, create_zod_values_1.createZodValues)(typedSchema.optionsMap.get(option), z, zodTypes);
38
+ setLocalValue(() => val, false, false);
39
+ },
40
+ quickSwitcherLabel: null,
41
+ subMenu: null,
42
+ type: 'item',
43
+ };
44
+ });
45
+ }, [
46
+ options,
47
+ setLocalValue,
48
+ typedSchema.discriminator,
49
+ typedSchema.optionsMap,
50
+ value,
51
+ z,
52
+ zodTypes,
53
+ ]);
54
+ const save = (0, react_1.useCallback)(() => {
55
+ onSave(() => value, false, false);
56
+ }, [onSave, value]);
57
+ const discriminatedUnionReplacement = (0, react_1.useMemo)(() => {
58
+ return {
59
+ discriminator: typedSchema.discriminator,
60
+ markup: ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: true, children: [(0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value[typedSchema.discriminator] ===
61
+ defaultValue[typedSchema.discriminator], jsonPath: [...jsonPath, typedSchema.discriminator], onRemove: onRemove, onReset: reset, onSave: save, saveDisabledByParent: saveDisabledByParent, saving: saving, showSaveButton: showSaveButton, suffix: null, valid: localValue.zodValidation.success }), (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: "Select type", values: comboBoxValues, selectedId: value[typedSchema.discriminator] })] })),
62
+ };
63
+ }, [
64
+ comboBoxValues,
65
+ defaultValue,
66
+ jsonPath,
67
+ localValue.value,
68
+ localValue.zodValidation.success,
69
+ mayPad,
70
+ onRemove,
71
+ reset,
72
+ save,
73
+ saveDisabledByParent,
74
+ saving,
75
+ showSaveButton,
76
+ typedSchema.discriminator,
77
+ value,
78
+ ]);
79
+ return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor
80
+ // Re-render the object editor when the discriminator changes
81
+ , { jsonPath: jsonPath, mayPad: mayPad, defaultValue: defaultValue, onRemove: onRemove, onSave: onSave, saveDisabledByParent: saveDisabledByParent, saving: saving, schema: typedSchema.optionsMap.get(value[typedSchema.discriminator]), setValue: setLocalValue, showSaveButton: showSaveButton, value: value, discriminatedUnionReplacement: discriminatedUnionReplacement }, value[typedSchema.discriminator]));
82
+ };
83
+ exports.ZodDiscriminatedUnionEditor = ZodDiscriminatedUnionEditor;
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import type { z } from 'zod';
3
3
  import type { JSONPath } from './zod-types';
4
4
  import type { UpdaterFunction } from './ZodSwitch';
5
+ export type ObjectDiscrimatedUnionReplacement = {
6
+ discriminator: string;
7
+ markup: React.ReactNode;
8
+ };
5
9
  export declare const ZodObjectEditor: React.FC<{
6
10
  schema: z.ZodTypeAny;
7
11
  jsonPath: JSONPath;
@@ -14,4 +18,5 @@ export declare const ZodObjectEditor: React.FC<{
14
18
  saving: boolean;
15
19
  saveDisabledByParent: boolean;
16
20
  mayPad: boolean;
21
+ discriminatedUnionReplacement: ObjectDiscrimatedUnionReplacement | null;
17
22
  }>;
@@ -35,7 +35,7 @@ const SchemaLabel_1 = require("./SchemaLabel");
35
35
  const SchemaSeparationLine_1 = require("./SchemaSeparationLine");
36
36
  const SchemaVerticalGuide_1 = require("./SchemaVerticalGuide");
37
37
  const ZodSwitch_1 = require("./ZodSwitch");
38
- const ZodObjectEditor = ({ schema, jsonPath, setValue, value, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
38
+ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, discriminatedUnionReplacement, }) => {
39
39
  const z = (0, get_zod_if_possible_1.useZodIfPossible)();
40
40
  if (!z) {
41
41
  throw new Error('expected zod');
@@ -62,6 +62,10 @@ const ZodObjectEditor = ({ schema, jsonPath, setValue, value, defaultValue, onSa
62
62
  return localValue.value;
63
63
  }, false, false);
64
64
  }, 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: isRoot, children: keys.map((key, i) => {
65
+ if (discriminatedUnionReplacement &&
66
+ key === discriminatedUnionReplacement.discriminator) {
67
+ return discriminatedUnionReplacement.markup;
68
+ }
65
69
  return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { mayPad: true, jsonPath: [...jsonPath, key], schema: shape[key], value: localValue.value[key],
66
70
  // In case of null | {a: string, b: string} type, we need to fallback to the default value
67
71
  defaultValue: (defaultValue !== null && defaultValue !== void 0 ? defaultValue : value)[key], setValue: (val, forceApply) => {
@@ -45,6 +45,6 @@ const ZodOrNullishEditor = ({ jsonPath, schema, setValue, onSave, defaultValue,
45
45
  const save = (0, react_1.useCallback)(() => {
46
46
  onSave(() => value, false, false);
47
47
  }, [onSave, value]);
48
- return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [localValue.value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent, suffix: null })) : ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: localValue.value, setValue: setLocalValue, jsonPath: jsonPath, schema: innerSchema, defaultValue: value, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: false })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
48
+ return ((0, jsx_runtime_1.jsxs)(Fieldset_1.Fieldset, { shouldPad: mayPad, success: localValue.zodValidation.success, children: [localValue.value === nullishValue ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: localValue.value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, valid: localValue.zodValidation.success, saveDisabledByParent: saveDisabledByParent, suffix: null })) : ((0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: localValue.value, setValue: setLocalValue, jsonPath: jsonPath, schema: innerSchema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: false })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false, name: jsonPath.join('.') }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
49
49
  };
50
50
  exports.ZodOrNullishEditor = ZodOrNullishEditor;
@@ -8,6 +8,7 @@ const ZodBooleanEditor_1 = require("./ZodBooleanEditor");
8
8
  const ZodColorEditor_1 = require("./ZodColorEditor");
9
9
  const ZodDateEditor_1 = require("./ZodDateEditor");
10
10
  const ZodDefaultEditor_1 = require("./ZodDefaultEditor");
11
+ const ZodDiscriminatedUnionEditor_1 = require("./ZodDiscriminatedUnionEditor");
11
12
  const ZodEffectEditor_1 = require("./ZodEffectEditor");
12
13
  const ZodEnumEditor_1 = require("./ZodEnumEditor");
13
14
  const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
@@ -28,7 +29,7 @@ const ZodSwitch = ({ schema, jsonPath, value, setValue, defaultValue, onSave, sh
28
29
  }
29
30
  const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
30
31
  if (typeName === z.ZodFirstPartyTypeKind.ZodObject) {
31
- return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
32
+ return ((0, jsx_runtime_1.jsx)(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, value: value, defaultValue: defaultValue, jsonPath: jsonPath, schema: schema, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad, discriminatedUnionReplacement: null }));
32
33
  }
33
34
  if (typeName === z.ZodFirstPartyTypeKind.ZodString) {
34
35
  if (value.startsWith(window.remotion_staticBase)) {
@@ -86,6 +87,9 @@ const ZodSwitch = ({ schema, jsonPath, value, setValue, defaultValue, onSave, sh
86
87
  if (typeName === z.ZodFirstPartyTypeKind.ZodDefault) {
87
88
  return ((0, jsx_runtime_1.jsx)(ZodDefaultEditor_1.ZodDefaultEditor, { jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
88
89
  }
90
+ if (typeName === z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion) {
91
+ return ((0, jsx_runtime_1.jsx)(ZodDiscriminatedUnionEditor_1.ZodDiscriminatedUnionEditor, { defaultValue: defaultValue, mayPad: mayPad, schema: schema, setValue: setValue, value: value, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, saving: saving, saveDisabledByParent: saveDisabledByParent, showSaveButton: showSaveButton }));
92
+ }
89
93
  return ((0, jsx_runtime_1.jsx)(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)`, saving: saving, mayPad: mayPad }));
90
94
  };
91
95
  exports.ZodSwitch = ZodSwitch;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RenderQueueOpenInFinderItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const folder_1 = require("../../icons/folder");
6
7
  const InlineAction_1 = require("../InlineAction");
7
8
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
8
9
  const actions_1 = require("./actions");
@@ -19,7 +20,7 @@ const RenderQueueOpenInFinderItem = ({ job, }) => {
19
20
  };
20
21
  }, []);
21
22
  const renderAction = (0, react_1.useCallback)((color) => {
22
- return ((0, jsx_runtime_1.jsx)("svg", { style: icon, viewBox: "0 0 576 512", children: (0, jsx_runtime_1.jsx)("path", { fill: color, d: "M384 480h48c11.4 0 21.9-6 27.6-15.9l112-192c5.8-9.9 5.8-22.1 .1-32.1S555.5 224 544 224H144c-11.4 0-21.9 6-27.6 15.9L48 357.1V96c0-8.8 7.2-16 16-16H181.5c4.2 0 8.3 1.7 11.3 4.7l26.5 26.5c21 21 49.5 32.8 79.2 32.8H416c8.8 0 16 7.2 16 16v32h48V160c0-35.3-28.7-64-64-64H298.5c-17 0-33.3-6.7-45.3-18.7L226.7 50.7c-12-12-28.3-18.7-45.3-18.7H64C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H87.7 384z" }) }));
23
+ return (0, jsx_runtime_1.jsx)(folder_1.ExpandedFolderIconSolid, { style: icon, color: color });
23
24
  }, [icon]);
24
25
  return (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick });
25
26
  };
@@ -6,12 +6,12 @@ const react_1 = require("react");
6
6
  const use_breakpoint_1 = require("../helpers/use-breakpoint");
7
7
  const sidebar_1 = require("../state/sidebar");
8
8
  const CanvasOrLoading_1 = require("./CanvasOrLoading");
9
- const CompositionSelector_1 = require("./CompositionSelector");
10
9
  const CurrentCompositionSideEffects_1 = require("./CurrentCompositionSideEffects");
10
+ const ExplorerPanel_1 = require("./ExplorerPanel");
11
11
  const InitialCompositionLoader_1 = require("./InitialCompositionLoader");
12
12
  const MenuToolbar_1 = require("./MenuToolbar");
13
+ const OptionsPanel_1 = require("./OptionsPanel");
13
14
  const PreviewToolbar_1 = require("./PreviewToolbar");
14
- const RightPanel_1 = require("./RightPanel");
15
15
  const SplitterContainer_1 = require("./Splitter/SplitterContainer");
16
16
  const SplitterElement_1 = require("./Splitter/SplitterElement");
17
17
  const SplitterHandle_1 = require("./Splitter/SplitterHandle");
@@ -26,16 +26,12 @@ const row = {
26
26
  display: 'flex',
27
27
  flexDirection: 'row',
28
28
  flex: 1,
29
+ minHeight: 0,
29
30
  };
30
31
  const canvasContainer = {
31
32
  flex: 1,
32
33
  display: 'flex',
33
34
  };
34
- const leftContainer = {
35
- flex: 1,
36
- display: 'flex',
37
- maxWidth: '100%',
38
- };
39
35
  const useResponsiveSidebarStatus = () => {
40
36
  const { sidebarCollapsedStateLeft } = (0, react_1.useContext)(sidebar_1.SidebarContext);
41
37
  const responsiveLeftStatus = (0, use_breakpoint_1.useBreakpoint)(1200) ? 'collapsed' : 'expanded';
@@ -66,6 +62,6 @@ const TopPanel = () => {
66
62
  const onCollapseRight = (0, react_1.useCallback)(() => {
67
63
  setSidebarCollapsedState({ left: null, right: 'collapsed' });
68
64
  }, [setSidebarCollapsedState]);
69
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(InitialCompositionLoader_1.InitialCompositionLoader, {}), (0, jsx_runtime_1.jsx)(MenuToolbar_1.MenuToolbar, {}), (0, jsx_runtime_1.jsx)("div", { style: row, children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "flexer", children: (0, jsx_runtime_1.jsx)("div", { style: leftContainer, className: "css-reset", children: (0, jsx_runtime_1.jsx)(CompositionSelector_1.CompositionSelector, {}) }) })) : null, actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "anti-flexer", children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, id: "canvas-to-right-sidebar", orientation: "vertical", children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "flexer", children: (0, jsx_runtime_1.jsx)("div", { style: canvasContainer, children: (0, jsx_runtime_1.jsx)(CanvasOrLoading_1.CanvasOrLoading, {}) }) }), actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "anti-flexer", children: (0, jsx_runtime_1.jsx)(RightPanel_1.RightPanel, {}) })) : null] }) })] }) }), (0, jsx_runtime_1.jsx)(PreviewToolbar_1.PreviewToolbar, {}), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.CurrentCompositionKeybindings, {}), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.TitleUpdater, {})] }));
65
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(InitialCompositionLoader_1.InitialCompositionLoader, {}), (0, jsx_runtime_1.jsx)(MenuToolbar_1.MenuToolbar, {}), (0, jsx_runtime_1.jsx)("div", { style: row, children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.15, maxFlex: 0.4, defaultFlex: 0.2, id: "sidebar-to-preview", orientation: "vertical", children: [actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "flexer", children: (0, jsx_runtime_1.jsx)(ExplorerPanel_1.ExplorerPanel, {}) })) : null, actualStateLeft === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "left", onCollapse: onCollapseLeft })) : null, (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "anti-flexer", children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { minFlex: 0.5, maxFlex: 0.8, defaultFlex: 0.7, id: "canvas-to-right-sidebar", orientation: "vertical", children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "flexer", children: (0, jsx_runtime_1.jsx)("div", { style: canvasContainer, children: (0, jsx_runtime_1.jsx)(CanvasOrLoading_1.CanvasOrLoading, {}) }) }), actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { allowToCollapse: "right", onCollapse: onCollapseRight })) : null, actualStateRight === 'expanded' ? ((0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "anti-flexer", children: (0, jsx_runtime_1.jsx)(OptionsPanel_1.OptionsPanel, {}) })) : null] }) })] }) }), (0, jsx_runtime_1.jsx)(PreviewToolbar_1.PreviewToolbar, {}), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.CurrentCompositionKeybindings, {}), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.TitleUpdater, {})] }));
70
66
  };
71
67
  exports.TopPanel = TopPanel;
@@ -10,6 +10,7 @@ const CopyButton_1 = require("../CopyButton");
10
10
  const layout_1 = require("../layout");
11
11
  const ModalContainer_1 = require("../ModalContainer");
12
12
  const ModalHeader_1 = require("../ModalHeader");
13
+ const NotificationCenter_1 = require("../Notifications/NotificationCenter");
13
14
  const container = {
14
15
  padding: 20,
15
16
  paddingTop: 0,
@@ -38,6 +39,8 @@ const UpdateModal = ({ info }) => {
38
39
  setSelectedModal(null);
39
40
  }, [setSelectedModal]);
40
41
  const command = commands[info.packageManager];
41
- return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: "Update available" }), (0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("p", { children: "A new update for Remotion is available! Run the following command:" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)(layout_1.Flex, { children: (0, jsx_runtime_1.jsx)("pre", { onClick: () => (0, copy_text_1.copyText)(command), style: code, children: command }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(CopyButton_1.CopyButton, { textToCopy: command, label: "Copy command", labelWhenCopied: "Copied!" })] }), (0, jsx_runtime_1.jsxs)("p", { children: ["This will upgrade Remotion from ", info.currentVersion, " to", ' ', info.latestVersion, "."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Read the", ' ', (0, jsx_runtime_1.jsx)("a", { style: link, target: "_blank", href: "https://github.com/remotion-dev/remotion/releases", children: "Release notes" }), ' ', "to know what", "'s", " new in Remotion."] })] })] }));
42
+ return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: "Update available" }), (0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)("p", { children: "A new update for Remotion is available! Run the following command:" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)(layout_1.Flex, { children: (0, jsx_runtime_1.jsx)("pre", { onClick: () => (0, copy_text_1.copyText)(command).catch((err) => {
43
+ (0, NotificationCenter_1.sendErrorNotification)(`Could not copy: ${err.message}`);
44
+ }), style: code, children: command }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)(CopyButton_1.CopyButton, { textToCopy: command, label: "Copy command", labelWhenCopied: "Copied!" })] }), (0, jsx_runtime_1.jsxs)("p", { children: ["This will upgrade Remotion from ", info.currentVersion, " to", ' ', info.latestVersion, "."] }), (0, jsx_runtime_1.jsxs)("p", { children: ["Read the", ' ', (0, jsx_runtime_1.jsx)("a", { style: link, target: "_blank", href: "https://github.com/remotion-dev/remotion/releases", children: "Release notes" }), ' ', "to know what", "'s", " new in Remotion."] })] })] }));
42
45
  };
43
46
  exports.UpdateModal = UpdateModal;
@@ -16,4 +16,4 @@ export declare const BLUE_DISABLED = "#284f73";
16
16
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
17
17
  selected: boolean;
18
18
  hovered: boolean;
19
- }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "rgba(255, 255, 255, 0.06)" | "hsla(0, 0%, 100%, 0.25)";
19
+ }) => "transparent" | "hsla(0, 0%, 100%, 0.15)" | "hsla(0, 0%, 100%, 0.25)" | "rgba(255, 255, 255, 0.06)";
@@ -1 +1 @@
1
- export declare const copyText: (cmd: string) => void;
1
+ export declare const copyText: (cmd: string) => Promise<void>;
@@ -3,16 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.copyText = void 0;
4
4
  const copyText = (cmd) => {
5
5
  const permissionName = 'clipboard-write';
6
- navigator.permissions
7
- .query({ name: permissionName })
8
- .then((result) => {
9
- if (result.state === 'granted' || result.state === 'prompt') {
10
- navigator.clipboard.writeText(cmd);
11
- }
12
- })
13
- .catch((err) => {
14
- // eslint-disable-next-line no-alert
15
- alert('Could not copy:' + err);
6
+ return new Promise((resolve, reject) => {
7
+ navigator.permissions
8
+ .query({ name: permissionName })
9
+ .then((result) => {
10
+ if (result.state === 'granted' || result.state === 'prompt') {
11
+ navigator.clipboard.writeText(cmd);
12
+ resolve();
13
+ }
14
+ else {
15
+ reject(new Error('Permission to copy not granted'));
16
+ }
17
+ })
18
+ .catch((err) => {
19
+ reject(err);
20
+ });
16
21
  });
17
22
  };
18
23
  exports.copyText = copyText;
@@ -0,0 +1,4 @@
1
+ import type { RenderJob } from '../../preview-server/render-queue/job';
2
+ export declare const setCurrentVideoId: (id: string | null) => void;
3
+ export declare const setUnsavedProps: (unsaved: boolean) => void;
4
+ export declare const setRenderJobs: (jobs: RenderJob[]) => void;