@remotion/cli 3.3.82 → 3.3.83

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 (45) hide show
  1. package/dist/codemods/update-default-props.js +7 -8
  2. package/dist/color-math.d.ts +1 -0
  3. package/dist/color-math.js +12 -0
  4. package/dist/config/index.d.ts +1 -0
  5. package/dist/config/index.js +3 -0
  6. package/dist/config/user-agent.d.ts +4 -0
  7. package/dist/config/user-agent.js +12 -0
  8. package/dist/editor/components/Canvas.js +1 -4
  9. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +8 -0
  10. package/dist/editor/components/NewComposition/RemInputTypeColor.js +53 -0
  11. package/dist/editor/components/RenderModal/RenderModal.js +8 -7
  12. package/dist/editor/components/RenderModal/RenderModalAdvanced.js +2 -0
  13. package/dist/editor/components/RenderModal/RenderModalData.js +42 -12
  14. package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.d.ts +1 -0
  15. package/dist/editor/components/RenderModal/RenderModalJSONInputPropsEditor.js +22 -2
  16. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +14 -0
  17. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +108 -0
  18. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
  19. package/dist/editor/components/RenderModal/SchemaEditor/create-zod-values.js +3 -0
  20. package/dist/editor/components/RenderToolbarIcon.js +3 -1
  21. package/dist/editor/components/RendersTab.js +3 -3
  22. package/dist/editor/components/RightPanel.js +2 -7
  23. package/dist/editor/components/SidebarCollapserControls.js +81 -10
  24. package/dist/editor/components/SizeSelector.js +1 -1
  25. package/dist/editor/components/Tabs/index.d.ts +1 -0
  26. package/dist/editor/components/Tabs/index.js +12 -5
  27. package/dist/editor/components/Tabs/vertical.d.ts +12 -0
  28. package/dist/editor/components/Tabs/vertical.js +57 -0
  29. package/dist/ffmpeg.js +2 -2
  30. package/dist/get-cli-options.js +1 -0
  31. package/dist/parse-command-line.d.ts +1 -0
  32. package/dist/parse-command-line.js +3 -0
  33. package/dist/preview-server/routes/can-update-default-props.d.ts +4 -0
  34. package/dist/preview-server/routes/can-update-default-props.js +38 -0
  35. package/package.json +6 -6
  36. package/dist/editor/components/CheckerboardContext.d.ts +0 -0
  37. package/dist/editor/components/CheckerboardContext.js +0 -1
  38. package/dist/editor/components/CollapsedSidebarExpander.d.ts +0 -5
  39. package/dist/editor/components/CollapsedSidebarExpander.js +0 -40
  40. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullEditor.d.ts +0 -15
  41. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullEditor.js +0 -45
  42. package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.d.ts +0 -2
  43. package/dist/editor/components/RenderModal/SchemaEditor/schema-serialization.js +0 -21
  44. package/dist/editor/components/SidebarContent.d.ts +0 -5
  45. package/dist/editor/components/SidebarContent.js +0 -53
@@ -11,14 +11,14 @@ const row = {
11
11
  display: 'flex',
12
12
  flexDirection: 'row',
13
13
  fontSize: 14,
14
- justifyContent: 'center',
15
14
  color: 'inherit',
16
15
  alignItems: 'center',
16
+ flex: 1,
17
17
  };
18
18
  const badge = {
19
19
  height: 16,
20
20
  width: 16,
21
- borderRadius: 8,
21
+ borderRadius: 3,
22
22
  fontSize: 10,
23
23
  display: 'inline-flex',
24
24
  justifyContent: 'center',
@@ -38,6 +38,6 @@ const RendersTab = ({ selected, onClick }) => {
38
38
  borderColor: colors_1.LIGHT_TEXT,
39
39
  };
40
40
  }, [failedJobs]);
41
- return ((0, jsx_runtime_1.jsx)(Tabs_1.Tab, { selected: selected, onClick: onClick, children: (0, jsx_runtime_1.jsxs)("div", { style: row, children: ["Renders", jobCount > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)("div", { style: badgeStyle, children: jobCount })] })) : null] }) }));
41
+ return ((0, jsx_runtime_1.jsx)(Tabs_1.Tab, { selected: selected, onClick: onClick, children: (0, jsx_runtime_1.jsxs)("div", { style: row, children: ["Renders", jobCount > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Flex, {}), (0, jsx_runtime_1.jsx)("div", { style: badgeStyle, children: jobCount })] })) : null] }) }));
42
42
  };
43
43
  exports.RendersTab = RendersTab;
@@ -4,7 +4,6 @@ exports.RightPanel = exports.rightSidebarTabs = exports.persistSelectedPanel = v
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
- const colors_1 = require("../helpers/colors");
8
7
  const RenderModalData_1 = require("./RenderModal/RenderModalData");
9
8
  const RenderQueue_1 = require("./RenderQueue");
10
9
  const RendersTab_1 = require("./RendersTab");
@@ -19,8 +18,6 @@ const container = {
19
18
  const PropsEditor = ({ composition }) => {
20
19
  var _a;
21
20
  const { props, updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
22
- // TODO: Warn if inputProps were specified to the CLI, then
23
- // they take priority over defaultProps
24
21
  const setInputProps = (0, react_1.useCallback)((newProps) => {
25
22
  updateProps({
26
23
  id: composition.id,
@@ -38,9 +35,7 @@ const getSelectedPanel = () => {
38
35
  }
39
36
  return 'input-props';
40
37
  };
41
- const tabsContainer = {
42
- borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
43
- };
38
+ const tabsContainer = {};
44
39
  const persistSelectedPanel = (panel) => {
45
40
  localStorage.setItem(localStorageKey, panel);
46
41
  };
@@ -76,6 +71,6 @@ const RightPanel = () => {
76
71
  if (composition === null) {
77
72
  return null;
78
73
  }
79
- 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.jsx)(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onCompositionsSelected, children: "Default Props" }), (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)(PropsEditor, { composition: composition }))] }));
74
+ 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.jsx)(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onCompositionsSelected, children: "Props" }), (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)(PropsEditor, { composition: composition }))] }));
80
75
  };
81
76
  exports.RightPanel = RightPanel;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SidebarCollapserControls = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const ShortcutHint_1 = require("../../preview-server/error-overlay/remotion-overlay/ShortcutHint");
7
+ const use_keybinding_1 = require("../helpers/use-keybinding");
6
8
  const sidebar_1 = require("../state/sidebar");
7
9
  const InlineAction_1 = require("./InlineAction");
8
10
  const layout_1 = require("./layout");
@@ -15,7 +17,8 @@ const style = {
15
17
  position: 'relative',
16
18
  };
17
19
  const SidebarCollapserControls = () => {
18
- const { setSidebarCollapsedStateLeft, setSidebarCollapsedStateRight, sidebarCollapsedStateRight, } = (0, react_1.useContext)(sidebar_1.SidebarContext);
20
+ const { setSidebarCollapsedState, sidebarCollapsedStateRight } = (0, react_1.useContext)(sidebar_1.SidebarContext);
21
+ const keybindings = (0, use_keybinding_1.useKeybinding)();
19
22
  const leftSidebarStatus = (0, TopPanel_1.useResponsiveSidebarStatus)();
20
23
  const leftIcon = (0, react_1.useMemo)(() => {
21
24
  return {
@@ -36,16 +39,84 @@ const SidebarCollapserControls = () => {
36
39
  };
37
40
  }, [sidebarCollapsedStateRight]);
38
41
  const toggleLeft = (0, react_1.useCallback)(() => {
39
- setSidebarCollapsedStateLeft((s) => {
40
- if (s === 'responsive') {
41
- return leftSidebarStatus === 'collapsed' ? 'expanded' : 'collapsed';
42
- }
43
- return s === 'collapsed' ? 'expanded' : 'collapsed';
42
+ setSidebarCollapsedState({
43
+ left: (s) => {
44
+ if (s === 'responsive') {
45
+ return leftSidebarStatus === 'collapsed' ? 'expanded' : 'collapsed';
46
+ }
47
+ return s === 'collapsed' ? 'expanded' : 'collapsed';
48
+ },
49
+ right: null,
44
50
  });
45
- }, [leftSidebarStatus, setSidebarCollapsedStateLeft]);
51
+ }, [leftSidebarStatus, setSidebarCollapsedState]);
46
52
  const toggleRight = (0, react_1.useCallback)(() => {
47
- setSidebarCollapsedStateRight((s) => s === 'collapsed' ? 'expanded' : 'collapsed');
48
- }, [setSidebarCollapsedStateRight]);
49
- return ((0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleLeft, children: (0, jsx_runtime_1.jsx)("div", { style: style, children: (0, jsx_runtime_1.jsx)("div", { style: leftIcon }) }) }), (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleRight, children: (0, jsx_runtime_1.jsx)("div", { style: style, children: (0, jsx_runtime_1.jsx)("div", { style: rightIcon }) }) })] }));
53
+ setSidebarCollapsedState({
54
+ right: (s) => (s === 'collapsed' ? 'expanded' : 'collapsed'),
55
+ left: null,
56
+ });
57
+ }, [setSidebarCollapsedState]);
58
+ const toggleBoth = (0, react_1.useCallback)(() => {
59
+ if (sidebarCollapsedStateRight === leftSidebarStatus) {
60
+ setSidebarCollapsedState({
61
+ left: (s) => {
62
+ if (s === 'responsive') {
63
+ return leftSidebarStatus === 'collapsed' ? 'expanded' : 'collapsed';
64
+ }
65
+ return s === 'collapsed' ? 'expanded' : 'collapsed';
66
+ },
67
+ right: (s) => (s === 'collapsed' ? 'expanded' : 'collapsed'),
68
+ });
69
+ }
70
+ else if (sidebarCollapsedStateRight === 'expanded') {
71
+ toggleRight();
72
+ }
73
+ else if (leftSidebarStatus === 'expanded') {
74
+ toggleLeft();
75
+ }
76
+ }, [
77
+ leftSidebarStatus,
78
+ setSidebarCollapsedState,
79
+ sidebarCollapsedStateRight,
80
+ toggleLeft,
81
+ toggleRight,
82
+ ]);
83
+ (0, react_1.useEffect)(() => {
84
+ const left = keybindings.registerKeybinding({
85
+ event: 'keydown',
86
+ key: 'b',
87
+ commandCtrlKey: true,
88
+ callback: toggleLeft,
89
+ preventDefault: true,
90
+ triggerIfInputFieldFocused: false,
91
+ });
92
+ const right = keybindings.registerKeybinding({
93
+ event: 'keydown',
94
+ key: 'j',
95
+ commandCtrlKey: true,
96
+ callback: toggleRight,
97
+ preventDefault: true,
98
+ triggerIfInputFieldFocused: false,
99
+ });
100
+ const zen = keybindings.registerKeybinding({
101
+ event: 'keydown',
102
+ key: 'g',
103
+ commandCtrlKey: true,
104
+ callback: toggleBoth,
105
+ preventDefault: true,
106
+ triggerIfInputFieldFocused: false,
107
+ });
108
+ return () => {
109
+ left.unregister();
110
+ right.unregister();
111
+ zen.unregister();
112
+ };
113
+ }, [keybindings, toggleBoth, toggleLeft, toggleRight]);
114
+ const toggleLeftTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
115
+ ? 'Toggle Left Sidebar'
116
+ : `Toggle Left Sidebar (${ShortcutHint_1.cmdOrCtrlCharacter}+B)`;
117
+ const toggleRightTooltip = (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
118
+ ? 'Toggle Right Sidebar'
119
+ : `Toggle Right Sidebar (${ShortcutHint_1.cmdOrCtrlCharacter}+J)`;
120
+ return ((0, jsx_runtime_1.jsxs)(layout_1.Row, { children: [(0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleLeft, children: (0, jsx_runtime_1.jsx)("div", { style: style, title: toggleLeftTooltip, children: (0, jsx_runtime_1.jsx)("div", { style: leftIcon }) }) }), (0, jsx_runtime_1.jsx)(InlineAction_1.InlineAction, { onClick: toggleRight, children: (0, jsx_runtime_1.jsx)("div", { style: style, title: toggleRightTooltip, children: (0, jsx_runtime_1.jsx)("div", { style: rightIcon }) }) })] }));
50
121
  };
51
122
  exports.SidebarCollapserControls = SidebarCollapserControls;
@@ -84,7 +84,7 @@ const SizeSelector = () => {
84
84
  },
85
85
  type: 'item',
86
86
  value: newSize.size,
87
- keyHint: newSize.size === 1 ? '0' : null,
87
+ keyHint: newSize.size === 'auto' ? '0' : null,
88
88
  leftItem: String(size.size) === String(newSize.size) ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
89
89
  subMenu: null,
90
90
  quickSwitcherLabel: null,
@@ -3,6 +3,7 @@ export declare const Tabs: React.FC<{
3
3
  children: React.ReactNode;
4
4
  style?: React.CSSProperties;
5
5
  }>;
6
+ export declare const selectorButton: React.CSSProperties;
6
7
  export declare const Tab: React.FC<{
7
8
  children: React.ReactNode;
8
9
  onClick: React.MouseEventHandler<HTMLButtonElement>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Tab = exports.Tabs = void 0;
3
+ exports.Tab = exports.selectorButton = exports.Tabs = 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");
@@ -19,11 +19,16 @@ const Tabs = ({ children, style }) => {
19
19
  return (0, jsx_runtime_1.jsx)("div", { style: definiteStyle, children: children });
20
20
  };
21
21
  exports.Tabs = Tabs;
22
- const selectorButton = {
22
+ exports.selectorButton = {
23
23
  border: 'none',
24
24
  flex: 1,
25
25
  padding: 8,
26
+ paddingLeft: 16,
27
+ display: 'flex',
28
+ flexDirection: 'row',
26
29
  fontSize: 14,
30
+ color: 'inherit',
31
+ alignItems: 'center',
27
32
  };
28
33
  const Tab = ({ children, onClick, style, selected }) => {
29
34
  const [hovered, setHovered] = (0, react_1.useState)(false);
@@ -36,13 +41,15 @@ const Tab = ({ children, onClick, style, selected }) => {
36
41
  }, []);
37
42
  const definiteStyle = (0, react_1.useMemo)(() => {
38
43
  return {
39
- ...selectorButton,
44
+ ...exports.selectorButton,
40
45
  backgroundColor: selected
41
- ? colors_1.SELECTED_BACKGROUND
46
+ ? 'transparent'
42
47
  : hovered
43
48
  ? colors_1.CLEAR_HOVER
44
- : 'transparent',
49
+ : colors_1.INPUT_BACKGROUND,
45
50
  color: selected ? 'white' : colors_1.LIGHT_TEXT,
51
+ borderTop: selected ? '2px solid var(--blue)' : '2px solid transparent',
52
+ boxShadow: selected ? 'none' : undefined,
46
53
  ...style,
47
54
  };
48
55
  }, [hovered, selected, style]);
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare const VerticalTabs: React.FC<{
3
+ children: React.ReactNode;
4
+ style?: React.CSSProperties;
5
+ }>;
6
+ export declare const selectorButton: React.CSSProperties;
7
+ export declare const VerticalTab: React.FC<{
8
+ children: React.ReactNode;
9
+ onClick: React.MouseEventHandler<HTMLButtonElement>;
10
+ style?: React.CSSProperties;
11
+ selected: boolean;
12
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerticalTab = exports.selectorButton = exports.VerticalTabs = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../../helpers/colors");
7
+ const z_index_1 = require("../../state/z-index");
8
+ const tabsContainer = {
9
+ display: 'flex',
10
+ flexDirection: 'row',
11
+ };
12
+ const VerticalTabs = ({ children, style }) => {
13
+ const definiteStyle = (0, react_1.useMemo)(() => {
14
+ return {
15
+ ...tabsContainer,
16
+ ...style,
17
+ };
18
+ }, [style]);
19
+ return (0, jsx_runtime_1.jsx)("div", { style: definiteStyle, children: children });
20
+ };
21
+ exports.VerticalTabs = VerticalTabs;
22
+ exports.selectorButton = {
23
+ border: 'none',
24
+ flex: 1,
25
+ padding: 8,
26
+ paddingLeft: 16,
27
+ display: 'flex',
28
+ flexDirection: 'row',
29
+ fontSize: 14,
30
+ color: 'inherit',
31
+ alignItems: 'center',
32
+ };
33
+ const VerticalTab = ({ children, onClick, style, selected }) => {
34
+ const [hovered, setHovered] = (0, react_1.useState)(false);
35
+ const { tabIndex } = (0, z_index_1.useZIndex)();
36
+ const onPointerEnter = (0, react_1.useCallback)(() => {
37
+ setHovered(true);
38
+ }, []);
39
+ const onPointerLeave = (0, react_1.useCallback)(() => {
40
+ setHovered(false);
41
+ }, []);
42
+ const definiteStyle = (0, react_1.useMemo)(() => {
43
+ return {
44
+ ...exports.selectorButton,
45
+ backgroundColor: selected
46
+ ? colors_1.SELECTED_BACKGROUND
47
+ : hovered
48
+ ? colors_1.CLEAR_HOVER
49
+ : 'transparent',
50
+ color: selected ? 'white' : colors_1.LIGHT_TEXT,
51
+ boxShadow: selected ? 'none' : undefined,
52
+ ...style,
53
+ };
54
+ }, [hovered, selected, style]);
55
+ return ((0, jsx_runtime_1.jsx)("button", { style: definiteStyle, type: "button", onClick: onClick, tabIndex: tabIndex, onPointerLeave: onPointerLeave, onPointerEnter: onPointerEnter, children: children }));
56
+ };
57
+ exports.VerticalTab = VerticalTab;
package/dist/ffmpeg.js CHANGED
@@ -5,7 +5,7 @@ const renderer_1 = require("@remotion/renderer");
5
5
  const child_process_1 = require("child_process");
6
6
  const ffmpegCommand = (_root, args) => {
7
7
  const done = (0, child_process_1.spawnSync)(renderer_1.RenderInternals.getExecutablePath('ffmpeg'), args, {
8
- ...renderer_1.RenderInternals.callFfExtraOptions(),
8
+ ...renderer_1.RenderInternals.dynamicLibraryPathOptions(),
9
9
  stdio: 'inherit',
10
10
  });
11
11
  process.exit(done.status);
@@ -13,7 +13,7 @@ const ffmpegCommand = (_root, args) => {
13
13
  exports.ffmpegCommand = ffmpegCommand;
14
14
  const ffprobeCommand = (_root, args) => {
15
15
  const done = (0, child_process_1.spawnSync)(renderer_1.RenderInternals.getExecutablePath('ffprobe'), args, {
16
- ...renderer_1.RenderInternals.callFfExtraOptions(),
16
+ ...renderer_1.RenderInternals.dynamicLibraryPathOptions(),
17
17
  stdio: 'inherit',
18
18
  });
19
19
  process.exit(done.status);
@@ -131,6 +131,7 @@ const getCliOptions = async (options) => {
131
131
  ignoreCertificateErrors: config_1.ConfigInternals.getIgnoreCertificateErrors(),
132
132
  headless: config_1.ConfigInternals.getChromiumHeadlessMode(),
133
133
  gl: (_a = config_1.ConfigInternals.getChromiumOpenGlRenderer()) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.DEFAULT_OPENGL_RENDERER,
134
+ userAgent: config_1.ConfigInternals.getChromiumUserAgent(),
134
135
  };
135
136
  const everyNthFrame = config_1.ConfigInternals.getEveryNthFrame();
136
137
  const numberOfGifLoops = config_1.ConfigInternals.getNumberOfGifLoops();
@@ -50,6 +50,7 @@ export declare type CommandLineOptions = {
50
50
  ['no-open']: boolean;
51
51
  ['browser']: string;
52
52
  ['browser-args']: string;
53
+ ['user-agent']: string;
53
54
  };
54
55
  export declare const BooleanFlags: string[];
55
56
  export declare const parsedCli: CommandLineOptions & {
@@ -66,6 +66,9 @@ const parseCommandLine = () => {
66
66
  if (exports.parsedCli['disable-headless']) {
67
67
  config_1.Config.setChromiumHeadlessMode(false);
68
68
  }
69
+ if (exports.parsedCli['user-agent']) {
70
+ config_1.Config.setChromiumUserAgent(exports.parsedCli['user-agent']);
71
+ }
69
72
  if (exports.parsedCli.log) {
70
73
  if (!renderer_1.RenderInternals.isValidLogLevel(exports.parsedCli.log)) {
71
74
  log_1.Log.error('Invalid `--log` value passed.');
@@ -0,0 +1,4 @@
1
+ import type { ApiHandler } from '../api-types';
2
+ import type { CanUpdateDefaultPropsRequest, CanUpdateDefaultPropsResponse } from '../render-queue/job';
3
+ export declare const checkIfTypeScriptFile: (file: string) => void;
4
+ export declare const canUpdateDefaultPropsHandler: ApiHandler<CanUpdateDefaultPropsRequest, CanUpdateDefaultPropsResponse>;
@@ -1 +1,39 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.canUpdateDefaultPropsHandler = exports.checkIfTypeScriptFile = void 0;
4
+ const fs_1 = require("fs");
5
+ const update_default_props_1 = require("../../codemods/update-default-props");
6
+ const project_info_1 = require("../project-info");
7
+ const checkIfTypeScriptFile = (file) => {
8
+ if (!file.endsWith('.tsx') &&
9
+ !file.endsWith('.ts') &&
10
+ !file.endsWith('.mtsx') &&
11
+ !file.endsWith('.mts')) {
12
+ throw new Error('Cannot update default props for non-TypeScript files');
13
+ }
14
+ };
15
+ exports.checkIfTypeScriptFile = checkIfTypeScriptFile;
16
+ const canUpdateDefaultPropsHandler = async ({ input: { compositionId }, remotionRoot }) => {
17
+ try {
18
+ const projectInfo = await (0, project_info_1.getProjectInfo)(remotionRoot);
19
+ if (!projectInfo.videoFile) {
20
+ throw new Error('Cannot find root file in project');
21
+ }
22
+ (0, exports.checkIfTypeScriptFile)(projectInfo.videoFile);
23
+ await (0, update_default_props_1.updateDefaultProps)({
24
+ compositionId,
25
+ input: (0, fs_1.readFileSync)(projectInfo.videoFile, 'utf-8'),
26
+ newDefaultProps: {},
27
+ });
28
+ return {
29
+ canUpdate: true,
30
+ };
31
+ }
32
+ catch (err) {
33
+ return {
34
+ canUpdate: false,
35
+ reason: err.message,
36
+ };
37
+ }
38
+ };
39
+ exports.canUpdateDefaultPropsHandler = canUpdateDefaultPropsHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.3.82",
3
+ "version": "3.3.83",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -16,16 +16,16 @@
16
16
  "author": "Jonny Burger <jonny@remotion.dev>",
17
17
  "license": "SEE LICENSE IN LICENSE.md",
18
18
  "dependencies": {
19
- "@remotion/bundler": "3.3.82",
20
- "@remotion/media-utils": "3.3.82",
21
- "@remotion/player": "3.3.82",
22
- "@remotion/renderer": "3.3.82",
19
+ "@remotion/bundler": "3.3.83",
20
+ "@remotion/media-utils": "3.3.83",
21
+ "@remotion/player": "3.3.83",
22
+ "@remotion/renderer": "3.3.83",
23
23
  "dotenv": "9.0.2",
24
24
  "memfs": "3.4.3",
25
25
  "minimist": "1.2.6",
26
26
  "open": "^8.4.2",
27
27
  "prompts": "2.4.1",
28
- "remotion": "3.3.82",
28
+ "remotion": "3.3.83",
29
29
  "semver": "7.3.5",
30
30
  "source-map": "0.6.1"
31
31
  },
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const CollapsedSidebarExpander: React.FC<{
3
- onExpand: () => void;
4
- direction: 'left' | 'right';
5
- }>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CollapsedSidebarExpander = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const colors_1 = require("../helpers/colors");
7
- const caret_1 = require("../icons/caret");
8
- const z_index_1 = require("../state/z-index");
9
- const CollapsedSidebarExpander = ({ onExpand, direction }) => {
10
- const [hovered, setHovered] = (0, react_1.useState)(false);
11
- const { tabIndex } = (0, z_index_1.useZIndex)();
12
- const onPointerEnter = (0, react_1.useCallback)(() => {
13
- setHovered(true);
14
- }, []);
15
- const onPointerLeave = (0, react_1.useCallback)(() => {
16
- setHovered(false);
17
- }, []);
18
- const style = (0, react_1.useMemo)(() => {
19
- return {
20
- border: 'none',
21
- borderRight: `${direction === 'right' ? 1 : 0}px solid black`,
22
- borderLeft: `${direction === 'left' ? 1 : 0}px solid black`,
23
- cursor: 'pointer',
24
- color: 'white',
25
- display: 'flex',
26
- justifyContent: 'center',
27
- alignItems: 'center',
28
- paddingLeft: direction === 'right' ? 7 : 5,
29
- paddingRight: direction === 'right' ? 4 : 5,
30
- backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
31
- hovered,
32
- selected: false,
33
- }),
34
- appearance: 'none',
35
- WebkitAppearance: 'none',
36
- };
37
- }, [direction, hovered]);
38
- return ((0, jsx_runtime_1.jsx)("button", { style: style, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, type: "button", role: "button", tabIndex: tabIndex, onClick: onExpand, children: direction === 'right' ? (0, jsx_runtime_1.jsx)(caret_1.CaretRight, {}) : (0, jsx_runtime_1.jsx)(caret_1.CaretLeft, {}) }));
39
- };
40
- exports.CollapsedSidebarExpander = CollapsedSidebarExpander;
@@ -1,15 +0,0 @@
1
- /// <reference types="react" />
2
- import type { z } from 'remotion';
3
- import type { JSONPath } from './zod-types';
4
- export declare const ZodOrNullEditor: React.FC<{
5
- showSaveButton: boolean;
6
- jsonPath: JSONPath;
7
- compact: boolean;
8
- value: unknown;
9
- defaultValue: unknown;
10
- schema: z.ZodTypeAny;
11
- setValue: React.Dispatch<React.SetStateAction<unknown>>;
12
- onSave: (updater: (oldNum: unknown) => unknown) => void;
13
- onRemove: null | (() => void);
14
- nullishValue: null | undefined;
15
- }>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZodOrNullEditor = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const colors_1 = require("../../../helpers/colors");
7
- const Checkbox_1 = require("../../Checkbox");
8
- const layout_1 = require("../../layout");
9
- const create_zod_values_1 = require("./create-zod-values");
10
- const SchemaLabel_1 = require("./SchemaLabel");
11
- const ZodSwitch_1 = require("./ZodSwitch");
12
- const fullWidth = {
13
- width: '100%',
14
- };
15
- const labelStyle = {
16
- fontFamily: 'sans-serif',
17
- fontSize: 14,
18
- color: colors_1.LIGHT_TEXT,
19
- };
20
- const checkBoxWrapper = {
21
- margin: '2px',
22
- display: 'flex',
23
- flexDirection: 'row',
24
- alignItems: 'center',
25
- marginTop: '5px',
26
- };
27
- const ZodOrNullEditor = ({ jsonPath, compact, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, nullishValue, }) => {
28
- const isChecked = value === nullishValue;
29
- const onValueChange = (0, react_1.useCallback)((newValue) => {
30
- setValue(newValue);
31
- }, [setValue]);
32
- const onCheckBoxChange = (0, react_1.useCallback)((e) => {
33
- console.log({ schema, newVal: (0, create_zod_values_1.createZodValues)(schema) });
34
- const val = e.target.checked ? nullishValue : (0, create_zod_values_1.createZodValues)(schema);
35
- onValueChange(val);
36
- }, [nullishValue, onValueChange, schema]);
37
- const reset = (0, react_1.useCallback)(() => {
38
- onValueChange(defaultValue);
39
- }, [defaultValue, onValueChange]);
40
- const save = (0, react_1.useCallback)(() => {
41
- onSave(() => value);
42
- }, [onSave, value]);
43
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [value === null ? ((0, jsx_runtime_1.jsx)(SchemaLabel_1.SchemaLabel, { isDefaultValue: value === defaultValue, jsonPath: jsonPath, onReset: reset, onSave: save, showSaveButton: showSaveButton, compact: compact, onRemove: onRemove })) : ((0, jsx_runtime_1.jsx)("div", { style: fullWidth, children: (0, jsx_runtime_1.jsx)(ZodSwitch_1.ZodSwitch, { value: value, setValue: onValueChange, jsonPath: jsonPath, schema: schema, compact: compact, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove }) })), (0, jsx_runtime_1.jsxs)("div", { style: checkBoxWrapper, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: isChecked, onChange: onCheckBoxChange, disabled: false }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: String(nullishValue) })] })] }));
44
- };
45
- exports.ZodOrNullEditor = ZodOrNullEditor;
@@ -1,2 +0,0 @@
1
- export declare const serializeJSONWithSchema: (data: unknown, indent: number | undefined) => string;
2
- export declare const deserializeJSONWithSchema: (data: string) => any;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeJSONWithSchema = exports.serializeJSONWithSchema = void 0;
4
- const serializeJSONWithSchema = (data, indent) => {
5
- return JSON.stringify(data, function (key, value) {
6
- if (this[key] instanceof Date) {
7
- return `remotion-date:${this[key].toISOString()}`;
8
- }
9
- return value;
10
- }, indent);
11
- };
12
- exports.serializeJSONWithSchema = serializeJSONWithSchema;
13
- const deserializeJSONWithSchema = (data) => {
14
- return JSON.parse(data, (_, value) => {
15
- if (typeof value === 'string' && value.startsWith('remotion-date:')) {
16
- return new Date(value.replace('remotion-date:', ''));
17
- }
18
- return value;
19
- });
20
- };
21
- exports.deserializeJSONWithSchema = deserializeJSONWithSchema;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const leftSidebarTabs: React.RefObject<{
3
- selectRendersPanel: () => void;
4
- }>;
5
- export declare const SidebarContent: React.FC;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SidebarContent = exports.leftSidebarTabs = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const colors_1 = require("../helpers/colors");
7
- const CompositionSelector_1 = require("./CompositionSelector");
8
- const CurrentCompositionSideEffects_1 = require("./CurrentCompositionSideEffects");
9
- const RenderQueue_1 = require("./RenderQueue");
10
- const context_1 = require("./RenderQueue/context");
11
- const RendersTab_1 = require("./RendersTab");
12
- const Tabs_1 = require("./Tabs");
13
- const container = {
14
- width: '100%',
15
- };
16
- const tabsContainer = {
17
- borderBottom: `1px solid ${colors_1.BORDER_COLOR}`,
18
- };
19
- exports.leftSidebarTabs = (0, react_1.createRef)();
20
- const localStorageKey = 'remotion.sidebarPanel';
21
- const persistSelectedPanel = (panel) => {
22
- localStorage.setItem(localStorageKey, panel);
23
- };
24
- const getSelectedPanel = (shouldRender) => {
25
- const panel = localStorage.getItem(localStorageKey);
26
- if (panel === 'renders' && shouldRender) {
27
- return 'renders';
28
- }
29
- return 'compositions';
30
- };
31
- const SidebarContent = () => {
32
- const shouldRender = (0, context_1.useShouldRenderLeftSidebarTabs)();
33
- const [panel, setPanel] = (0, react_1.useState)(() => getSelectedPanel(shouldRender));
34
- const onCompositionsSelected = (0, react_1.useCallback)(() => {
35
- setPanel('compositions');
36
- persistSelectedPanel('compositions');
37
- }, []);
38
- const onRendersSelected = (0, react_1.useCallback)(() => {
39
- setPanel('renders');
40
- persistSelectedPanel('renders');
41
- }, []);
42
- (0, react_1.useImperativeHandle)(exports.leftSidebarTabs, () => {
43
- return {
44
- selectRendersPanel: () => {
45
- setPanel('renders');
46
- persistSelectedPanel('renders');
47
- },
48
- };
49
- }, []);
50
- // TODO: It is not perfectly aligned in example
51
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [shouldRender ? ((0, jsx_runtime_1.jsx)("div", { style: tabsContainer, children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tab, { selected: panel === 'compositions', onClick: onCompositionsSelected, children: "Compositions" }), (0, jsx_runtime_1.jsx)(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' })] }) })) : null, panel === 'renders' && shouldRender ? ((0, jsx_runtime_1.jsx)(RenderQueue_1.RenderQueue, {})) : ((0, jsx_runtime_1.jsx)(CompositionSelector_1.CompositionSelector, {})), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.CurrentCompositionKeybindings, {}), (0, jsx_runtime_1.jsx)(CurrentCompositionSideEffects_1.TitleUpdater, {})] }));
52
- };
53
- exports.SidebarContent = SidebarContent;