@remotion/cli 4.0.15 → 4.0.17

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 (27) 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/CurrentCompositionSideEffects.js +9 -5
  5. package/dist/editor/components/FullscreenToggle.js +23 -1
  6. package/dist/editor/components/KeyboardShortcutsExplainer.js +1 -1
  7. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  8. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  9. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  10. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.js +4 -0
  11. package/dist/editor/components/RenderModal/SchemaEditor/SchemaEditor.js +5 -1
  12. package/dist/editor/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +17 -0
  13. package/dist/editor/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +83 -0
  14. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +5 -0
  15. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.js +5 -1
  16. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +1 -1
  17. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +5 -1
  18. package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
  19. package/dist/editor/helpers/document-title.d.ts +4 -0
  20. package/dist/editor/helpers/document-title.js +60 -0
  21. package/dist/get-cli-options.d.ts +1 -1
  22. package/dist/get-input-props.js +2 -1
  23. package/dist/index.d.ts +5 -5
  24. package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
  25. package/package.json +8 -8
  26. package/dist/cloudrun-command.d.ts +0 -1
  27. package/dist/cloudrun-command.js +0 -27
@@ -56,6 +56,11 @@ const findEndPosition = (input, currentPosition) => {
56
56
  const nextEnd = input.indexOf('}', asConstVersion + currentPosition + 1);
57
57
  return nextEnd - 1;
58
58
  }
59
+ // When updating e.g. `defaultProps={{union: {type: 'car' as const, color: ''}}}`
60
+ const nextTriple = input.indexOf('}}}', currentPosition + 1);
61
+ if (nextTriple !== -1) {
62
+ return nextTriple + 1;
63
+ }
59
64
  const next = input.indexOf('}}', currentPosition + 1);
60
65
  if (next !== -1) {
61
66
  return next;
@@ -2,4 +2,4 @@ import type { StillImageFormat, VideoImageFormat } from '@remotion/renderer';
2
2
  export declare const setStillImageFormat: (format: StillImageFormat) => void;
3
3
  export declare const setVideoImageFormat: (format: VideoImageFormat) => void;
4
4
  export declare const getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
5
- export declare const getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
5
+ export declare const getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
@@ -297,7 +297,7 @@ export declare const ConfigInternals: {
297
297
  getShouldOutputImageSequence: (frameRange: FrameRange | null) => boolean;
298
298
  getDotEnvLocation: () => string | null;
299
299
  getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
300
- getUserPreferredVideoImageFormat: () => "png" | "jpeg" | "none" | undefined;
300
+ getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
301
301
  getWebpackOverrideFn: () => WebpackOverrideFn;
302
302
  getWebpackCaching: () => boolean;
303
303
  getOutputLocation: () => string | null;
@@ -4,17 +4,21 @@ exports.CurrentCompositionKeybindings = exports.TitleUpdater = void 0;
4
4
  const react_1 = require("react");
5
5
  const remotion_1 = require("remotion");
6
6
  const client_id_1 = require("../helpers/client-id");
7
+ const document_title_1 = require("../helpers/document-title");
7
8
  const use_keybinding_1 = require("../helpers/use-keybinding");
8
9
  const NotificationCenter_1 = require("./Notifications/NotificationCenter");
10
+ const context_1 = require("./RenderQueue/context");
9
11
  const TitleUpdater = () => {
10
12
  const video = remotion_1.Internals.useVideo();
13
+ const renderQueue = (0, react_1.useContext)(context_1.RenderQueueContext);
14
+ const { jobs } = renderQueue;
11
15
  (0, react_1.useEffect)(() => {
12
- if (!video) {
13
- document.title = 'Remotion Studio';
14
- return;
15
- }
16
- document.title = `${video.id} / ${window.remotion_projectName} - Remotion Studio`;
16
+ var _a;
17
+ (0, document_title_1.setCurrentVideoId)((_a = video === null || video === void 0 ? void 0 : video.id) !== null && _a !== void 0 ? _a : null);
17
18
  }, [video]);
19
+ (0, react_1.useEffect)(() => {
20
+ (0, document_title_1.setRenderJobs)(jobs);
21
+ }, [jobs]);
18
22
  return null;
19
23
  };
20
24
  exports.TitleUpdater = TitleUpdater;
@@ -3,10 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FullScreenToggle = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const truthy_1 = require("../../truthy");
7
+ const use_keybinding_1 = require("../helpers/use-keybinding");
6
8
  const canvas_ref_1 = require("../state/canvas-ref");
7
9
  const preview_size_1 = require("../state/preview-size");
8
10
  const ControlButton_1 = require("./ControlButton");
11
+ const accessibilityLabel = [
12
+ 'Enter fullscreen preview',
13
+ (0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? null : '(F)',
14
+ ]
15
+ .filter(truthy_1.truthy)
16
+ .join(' ');
9
17
  const FullScreenToggle = () => {
18
+ const keybindings = (0, use_keybinding_1.useKeybinding)();
10
19
  const { setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
11
20
  const onClick = (0, react_1.useCallback)(() => {
12
21
  var _a;
@@ -20,6 +29,19 @@ const FullScreenToggle = () => {
20
29
  },
21
30
  }));
22
31
  }, [setSize]);
23
- return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: "Enter fullscreen preview", "aria-label": "Enter fullscreen preview", onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 448 512", fill: "#fff", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z" }) }) }));
32
+ (0, react_1.useEffect)(() => {
33
+ const f = keybindings.registerKeybinding({
34
+ event: 'keydown',
35
+ key: 'f',
36
+ callback: onClick,
37
+ commandCtrlKey: false,
38
+ preventDefault: true,
39
+ triggerIfInputFieldFocused: false,
40
+ });
41
+ return () => {
42
+ f.unregister();
43
+ };
44
+ }, [keybindings, onClick]);
45
+ return ((0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { title: accessibilityLabel, "aria-label": accessibilityLabel, onClick: onClick, children: (0, jsx_runtime_1.jsx)("svg", { style: { width: 18, height: 18 }, viewBox: "0 0 448 512", fill: "#fff", children: (0, jsx_runtime_1.jsx)("path", { d: "M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z" }) }) }));
24
46
  };
25
47
  exports.FullScreenToggle = FullScreenToggle;
@@ -52,6 +52,6 @@ const li = {
52
52
  fontSize: 14,
53
53
  };
54
54
  const KeyboardShortcutsExplainer = () => {
55
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? ((0, jsx_runtime_1.jsxs)("div", { style: keyboardShortcutsDisabled, children: ["Keyboard shortcuts disabled either due to:", (0, jsx_runtime_1.jsxs)("ul", { style: ul, children: [(0, jsx_runtime_1.jsx)("li", { style: li, children: "a) --disable-keyboard-shortcuts being passed" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: "b) Config.setKeyboardShortcutsEnabled(false) being set or" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: " c) a Remotion version mismatch." })] })] })) : null, (0, jsx_runtime_1.jsxs)(layout_1.Row, { style: container, children: [(0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second back" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Previous frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Space" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Next frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second forward" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "A" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to beginning" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "E" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to end" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reverse playback" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "L" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Speed up" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Enter" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause & return to playback start" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Sidebar" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "B" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle left sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle right sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "G" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle both sidebars" })] }), (0, jsx_runtime_1.jsx)("br", {})] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 8 }), (0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Navigation" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "N" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "New composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "R" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Render composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "T" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle checkerboard transparency" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "?" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Show keyboard shortcuts" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Quick Switcher" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback range" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "I" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set In Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "O" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set Out Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "X" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Clear In/Out Points" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Zoom" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "+" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom in" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "-" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom out" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "0" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reset zoom" })] }), ' ', (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Props Editor" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "S" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Save" })] })] })] })] }));
55
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, use_keybinding_1.areKeyboardShortcutsDisabled)() ? ((0, jsx_runtime_1.jsxs)("div", { style: keyboardShortcutsDisabled, children: ["Keyboard shortcuts disabled either due to:", (0, jsx_runtime_1.jsxs)("ul", { style: ul, children: [(0, jsx_runtime_1.jsx)("li", { style: li, children: "a) --disable-keyboard-shortcuts being passed" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: "b) Config.setKeyboardShortcutsEnabled(false) being set or" }), (0, jsx_runtime_1.jsx)("li", { style: li, children: " c) a Remotion version mismatch." })] })] })) : null, (0, jsx_runtime_1.jsxs)(layout_1.Row, { style: container, children: [(0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second back" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowLeft, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Previous frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Space" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Next frame" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ShiftIcon, {}) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: (0, jsx_runtime_1.jsx)(keys_1.ArrowRight, {}) })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "1 second forward" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "A" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to beginning" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "E" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Jump to end" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reverse playback" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "L" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Play / Speed up" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "Enter" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Pause & return to playback start" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Sidebar" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "B" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle left sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "J" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle right sidebar" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "G" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle both sidebars" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "View" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "F" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Enter fullscreen" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "esc" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Exit fullscreen" })] })] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 8 }), (0, jsx_runtime_1.jsxs)(layout_1.Column, { children: [(0, jsx_runtime_1.jsx)("div", { style: title, children: "Navigation" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "N" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "New composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "R" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Render composition" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "T" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Toggle checkerboard transparency" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "?" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Show keyboard shortcuts" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "K" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Quick Switcher" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Playback range" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "I" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set In Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "O" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Set Out Point" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "X" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Clear In/Out Points" })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Zoom" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "+" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom in" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "-" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Zoom out" })] }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsx)("div", { style: left, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "0" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reset zoom" })] }), ' ', (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("div", { style: title, children: "Props Editor" }), (0, jsx_runtime_1.jsxs)(layout_1.Row, { align: "center", children: [(0, jsx_runtime_1.jsxs)("div", { style: left, children: [(0, jsx_runtime_1.jsx)("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.3 }), (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "S" })] }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Save" })] })] })] })] }));
56
56
  };
57
57
  exports.KeyboardShortcutsExplainer = KeyboardShortcutsExplainer;
@@ -13,5 +13,5 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
13
13
  isFocused: boolean;
14
14
  isHovered: boolean;
15
15
  }) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#ff3232" | "#f1c40f";
16
- export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
16
+ export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & React.RefAttributes<HTMLInputElement>>;
17
17
  export {};
@@ -4,5 +4,5 @@ type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>
4
4
  status: RemInputStatus;
5
5
  name: string;
6
6
  };
7
- export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
7
+ export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
8
8
  export {};
@@ -3,5 +3,5 @@ type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextAreaEleme
3
3
  status: 'error' | 'warning' | 'ok';
4
4
  };
5
5
  export declare const inputBaseStyle: React.CSSProperties;
6
- export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
6
+ export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
7
7
  export {};
@@ -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;
@@ -1,2 +1,2 @@
1
1
  import type { Codec } from '@remotion/renderer';
2
- export declare const humanReadableCodec: (codec: Codec) => "GIF" | "AAC" | "MP3" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
2
+ export declare const humanReadableCodec: (codec: Codec) => "AAC" | "MP3" | "GIF" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
@@ -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;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setRenderJobs = exports.setUnsavedProps = exports.setCurrentVideoId = void 0;
4
+ const truthy_1 = require("../../truthy");
5
+ let currentVideoId = null;
6
+ let unsavedProps = false;
7
+ let tabInactive = false;
8
+ let renderJobs = [];
9
+ const setCurrentVideoId = (id) => {
10
+ currentVideoId = id;
11
+ updateTitle();
12
+ };
13
+ exports.setCurrentVideoId = setCurrentVideoId;
14
+ const setUnsavedProps = (unsaved) => {
15
+ unsavedProps = unsaved;
16
+ };
17
+ exports.setUnsavedProps = setUnsavedProps;
18
+ const setRenderJobs = (jobs) => {
19
+ renderJobs = jobs;
20
+ updateTitle();
21
+ };
22
+ exports.setRenderJobs = setRenderJobs;
23
+ document.addEventListener('visibilitychange', () => {
24
+ tabInactive = document.visibilityState === 'hidden';
25
+ updateTitle();
26
+ });
27
+ const productName = 'Remotion Studio';
28
+ const suffix = `- ${productName}`;
29
+ const updateTitle = () => {
30
+ if (!currentVideoId) {
31
+ document.title = productName;
32
+ return;
33
+ }
34
+ const currentCompTitle = `${currentVideoId} / ${window.remotion_projectName}`;
35
+ document.title = [
36
+ getProgressInBrackets(currentVideoId, renderJobs),
37
+ unsavedProps && tabInactive ? '✏️' : null,
38
+ `${currentCompTitle} ${suffix}`,
39
+ ]
40
+ .filter(truthy_1.truthy)
41
+ .join(' ');
42
+ };
43
+ const getProgressInBrackets = (selectedCompositionId, jobs) => {
44
+ const currentRender = jobs.find((job) => job.status === 'running');
45
+ if (!currentRender) {
46
+ return null;
47
+ }
48
+ if (currentRender.status !== 'running') {
49
+ throw new Error('expected running job');
50
+ }
51
+ const progInPercent = Math.ceil(currentRender.progress.value * 100);
52
+ const progressInBrackets = currentRender.compositionId === selectedCompositionId
53
+ ? `[${progInPercent}%]`
54
+ : `[${progInPercent}% ${currentRender.compositionId}]`;
55
+ return progressInBrackets;
56
+ };
57
+ document.addEventListener('visibilitychange', () => {
58
+ tabInactive = document.visibilityState === 'hidden';
59
+ updateTitle();
60
+ });
@@ -33,5 +33,5 @@ export declare const getCliOptions: (options: {
33
33
  videoBitrate: string | null;
34
34
  height: number | null;
35
35
  width: number | null;
36
- configFileImageFormat: "png" | "jpeg" | "none" | undefined;
36
+ configFileImageFormat: "none" | "png" | "jpeg" | undefined;
37
37
  }>;
@@ -33,7 +33,8 @@ const getInputProps = (onUpdate) => {
33
33
  return JSON.parse(parse_command_line_1.parsedCli.props);
34
34
  }
35
35
  catch (err) {
36
- log_1.Log.error('You passed --props but it was neither valid JSON nor a file path to a valid JSON file.');
36
+ log_1.Log.error('You passed --props but it was neither valid JSON nor a file path to a valid JSON file. Provided value: ' +
37
+ parse_command_line_1.parsedCli.props);
37
38
  log_1.Log.info('Got the following value:', parse_command_line_1.parsedCli.props);
38
39
  log_1.Log.error('Check that your input is parseable using `JSON.parse` and try again.');
39
40
  if (node_os_1.default.platform() === 'win32') {
package/dist/index.d.ts CHANGED
@@ -118,7 +118,7 @@ export declare const CliInternals: {
118
118
  videoBitrate: string | null;
119
119
  height: number | null;
120
120
  width: number | null;
121
- configFileImageFormat: "png" | "jpeg" | "none" | undefined;
121
+ configFileImageFormat: "none" | "png" | "jpeg" | undefined;
122
122
  }>;
123
123
  loadConfig: (remotionRoot: string) => Promise<string | null>;
124
124
  initializeCli: (remotionRoot: string) => Promise<void>;
@@ -127,7 +127,7 @@ export declare const CliInternals: {
127
127
  parsedCli: {
128
128
  "browser-executable": import("@remotion/renderer").BrowserExecutable;
129
129
  "pixel-format": "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
130
- "image-format": "png" | "jpeg" | "pdf" | "webp" | "none";
130
+ "image-format": "none" | "png" | "jpeg" | "pdf" | "webp";
131
131
  "prores-profile": "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy";
132
132
  "bundle-cache": string;
133
133
  "env-file": string;
@@ -192,7 +192,7 @@ export declare const CliInternals: {
192
192
  downloadName: string | null;
193
193
  outName: string | null;
194
194
  configImageFormat: "png" | "jpeg" | "pdf" | "webp" | null;
195
- cliFlag: "png" | "jpeg" | "pdf" | "webp" | "none" | null;
195
+ cliFlag: "none" | "png" | "jpeg" | "pdf" | "webp" | null;
196
196
  isLambda: boolean;
197
197
  fromUi: "png" | "jpeg" | "pdf" | "webp" | null;
198
198
  }) => {
@@ -207,8 +207,8 @@ export declare const CliInternals: {
207
207
  };
208
208
  getVideoImageFormat: ({ codec, uiImageFormat, }: {
209
209
  codec: import("@remotion/renderer").CodecOrUndefined;
210
- uiImageFormat: "png" | "jpeg" | "none" | null;
211
- }) => "png" | "jpeg" | "none";
210
+ uiImageFormat: "none" | "png" | "jpeg" | null;
211
+ }) => "none" | "png" | "jpeg";
212
212
  printCompositions: (compositions: import("remotion").VideoConfig[]) => void;
213
213
  getFinalOutputCodec: ({ cliFlag, configFile, downloadName, outName, uiCodec, }: {
214
214
  cliFlag: import("@remotion/renderer").CodecOrUndefined;
@@ -11,5 +11,5 @@ type Range = {
11
11
  type Ranges = Range[] & {
12
12
  type?: string;
13
13
  };
14
- export declare function parseRange(size: number, str: string | string[]): -1 | Ranges | -2;
14
+ export declare function parseRange(size: number, str: string | string[]): -1 | -2 | Ranges;
15
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "4.0.15",
3
+ "version": "4.0.17",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -35,11 +35,11 @@
35
35
  "prompts": "2.4.1",
36
36
  "semver": "7.5.3",
37
37
  "source-map": "0.6.1",
38
- "@remotion/bundler": "4.0.15",
39
- "@remotion/media-utils": "4.0.15",
40
- "remotion": "4.0.15",
41
- "@remotion/renderer": "4.0.15",
42
- "@remotion/player": "4.0.15"
38
+ "@remotion/bundler": "4.0.17",
39
+ "remotion": "4.0.17",
40
+ "@remotion/renderer": "4.0.17",
41
+ "@remotion/media-utils": "4.0.17",
42
+ "@remotion/player": "4.0.17"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",
@@ -65,8 +65,8 @@
65
65
  "typescript": "4.9.5",
66
66
  "vitest": "0.31.1",
67
67
  "zod": "^3.21.4",
68
- "@remotion/zod-types": "4.0.15",
69
- "@remotion/tailwind": "4.0.15"
68
+ "@remotion/zod-types": "4.0.17",
69
+ "@remotion/tailwind": "4.0.17"
70
70
  },
71
71
  "keywords": [
72
72
  "remotion",
@@ -1 +0,0 @@
1
- export declare const cloudrunCommand: (remotionRoot: string, args: string[]) => Promise<never>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cloudrunCommand = void 0;
4
- const log_1 = require("./log");
5
- const get_package_manager_1 = require("./preview-server/get-package-manager");
6
- const update_available_1 = require("./preview-server/update-available");
7
- const cloudrunCommand = async (remotionRoot, args) => {
8
- try {
9
- const path = require.resolve('@remotion/cloudrun', {
10
- paths: [remotionRoot],
11
- });
12
- const { CloudrunInternals } = require(path);
13
- await CloudrunInternals.executeCommand(args, remotionRoot);
14
- process.exit(0);
15
- }
16
- catch (err) {
17
- const manager = (0, get_package_manager_1.getPackageManager)(remotionRoot, undefined);
18
- const installCommand = manager === 'unknown' ? 'npm i' : manager.installCommand;
19
- log_1.Log.error(err);
20
- log_1.Log.error('Remotion CloudRun is not installed.');
21
- log_1.Log.info('');
22
- log_1.Log.info('You can install it using:');
23
- log_1.Log.info(`${installCommand} @remotion/cloudrun@${(0, update_available_1.getRemotionVersion)()}`);
24
- process.exit(1);
25
- }
26
- };
27
- exports.cloudrunCommand = cloudrunCommand;