@remotion/cli 3.2.34 → 3.2.35

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 (34) hide show
  1. package/LICENSE.md +7 -7
  2. package/dist/check-version.d.ts +1 -0
  3. package/dist/check-version.js +14 -0
  4. package/dist/editor/components/Editor.js +4 -1
  5. package/dist/editor/components/GlobalKeybindings.js +11 -0
  6. package/dist/editor/components/MenuToolbar.js +3 -449
  7. package/dist/editor/components/NewComposition/ComboBox.d.ts +2 -1
  8. package/dist/editor/components/NewComposition/NewComposition.js +3 -0
  9. package/dist/editor/components/PlayPause.js +2 -1
  10. package/dist/editor/components/PlaybackRateSelector.js +1 -0
  11. package/dist/editor/components/QuickSwitcher/NoResults.d.ts +6 -0
  12. package/dist/editor/components/QuickSwitcher/NoResults.js +15 -0
  13. package/dist/editor/components/QuickSwitcher/QuickSwitcher.d.ts +3 -0
  14. package/dist/editor/components/QuickSwitcher/QuickSwitcher.js +16 -0
  15. package/dist/editor/components/QuickSwitcher/QuickSwitcherContent.d.ts +2 -0
  16. package/dist/editor/components/QuickSwitcher/QuickSwitcherContent.js +179 -0
  17. package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.d.ts +17 -0
  18. package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.js +90 -0
  19. package/dist/editor/components/QuickSwitcher/fuzzy-search.d.ts +2 -0
  20. package/dist/editor/components/QuickSwitcher/fuzzy-search.js +26 -0
  21. package/dist/editor/components/QuickSwitcher.d.ts +3 -0
  22. package/dist/editor/components/QuickSwitcher.js +32 -0
  23. package/dist/editor/components/SizeSelector.js +1 -0
  24. package/dist/editor/helpers/use-menu-structure.d.ts +7 -0
  25. package/dist/editor/helpers/use-menu-structure.js +547 -0
  26. package/dist/editor/helpers/use-menu-toolbar.d.ts +0 -0
  27. package/dist/editor/helpers/use-menu-toolbar.js +1 -0
  28. package/dist/editor/state/modals.d.ts +2 -0
  29. package/dist/preview-server/start-server.js +9 -5
  30. package/dist/validate-ffmpeg-version.d.ts +3 -0
  31. package/dist/validate-ffmpeg-version.js +17 -0
  32. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  33. package/dist/warn-about-ffmpeg-version.js +38 -0
  34. package/package.json +7 -7
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuickSwitcherNoResults = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const colors_1 = require("../../helpers/colors");
6
+ const container = {
7
+ padding: 80,
8
+ color: colors_1.LIGHT_TEXT,
9
+ textAlign: 'center',
10
+ fontSize: 14,
11
+ };
12
+ const QuickSwitcherNoResults = ({ query, mode }) => {
13
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: ["No ", mode === 'commands' ? 'commands' : 'compositions', " matching ", '"', query, '"'] }));
14
+ };
15
+ exports.QuickSwitcherNoResults = QuickSwitcherNoResults;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const QuickSwitcher: React.FC;
3
+ export default QuickSwitcher;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const modals_1 = require("../../state/modals");
6
+ const ModalContainer_1 = require("../ModalContainer");
7
+ const QuickSwitcherContent_1 = require("./QuickSwitcherContent");
8
+ const QuickSwitcher = () => {
9
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
10
+ const onQuit = (0, react_1.useCallback)(() => {
11
+ setSelectedModal(null);
12
+ }, [setSelectedModal]);
13
+ // Separate child component to correctly capture keybindings
14
+ return ((0, jsx_runtime_1.jsx)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: (0, jsx_runtime_1.jsx)(QuickSwitcherContent_1.QuickSwitcherContent, {}) }));
15
+ };
16
+ exports.default = QuickSwitcher;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const QuickSwitcherContent: React.FC;
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuickSwitcherContent = 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 colors_1 = require("../../helpers/colors");
8
+ const is_composition_still_1 = require("../../helpers/is-composition-still");
9
+ const use_keybinding_1 = require("../../helpers/use-keybinding");
10
+ const use_menu_structure_1 = require("../../helpers/use-menu-structure");
11
+ const modals_1 = require("../../state/modals");
12
+ const InitialCompositionLoader_1 = require("../InitialCompositionLoader");
13
+ const layout_1 = require("../layout");
14
+ const fuzzy_search_1 = require("./fuzzy-search");
15
+ const NoResults_1 = require("./NoResults");
16
+ const QuickSwitcherResult_1 = require("./QuickSwitcherResult");
17
+ const input = {
18
+ padding: 4,
19
+ border: '2px solid ' + colors_1.INPUT_BORDER_COLOR_UNHOVERED,
20
+ width: '100%',
21
+ };
22
+ const container = {
23
+ width: 500,
24
+ };
25
+ const modeSelector = {
26
+ paddingLeft: 16,
27
+ paddingRight: 16,
28
+ display: 'flex',
29
+ flexDirection: 'row',
30
+ paddingTop: 8,
31
+ paddingBottom: 5,
32
+ };
33
+ const modeItem = {
34
+ appearance: 'none',
35
+ border: 'none',
36
+ fontFamily: 'inherit',
37
+ padding: 0,
38
+ fontSize: 13,
39
+ cursor: 'pointer',
40
+ };
41
+ const modeInactive = {
42
+ ...modeItem,
43
+ color: colors_1.LIGHT_TEXT,
44
+ };
45
+ const modeActive = {
46
+ ...modeItem,
47
+ color: 'white',
48
+ fontWeight: 'bold',
49
+ };
50
+ const content = {
51
+ paddingLeft: 16,
52
+ paddingRight: 16,
53
+ paddingTop: 4,
54
+ paddingBottom: 10,
55
+ };
56
+ const results = {
57
+ overflowY: 'auto',
58
+ height: 300,
59
+ };
60
+ const loopIndex = (index, length) => {
61
+ if (index < 0) {
62
+ index += length;
63
+ }
64
+ return index % length;
65
+ };
66
+ const QuickSwitcherContent = () => {
67
+ const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
68
+ const [state, setState] = (0, react_1.useState)({
69
+ query: '',
70
+ selectedIndex: 0,
71
+ });
72
+ const inputRef = (0, react_1.useRef)(null);
73
+ const selectComposition = (0, InitialCompositionLoader_1.useSelectComposition)();
74
+ const closeMenu = (0, react_1.useCallback)(() => undefined, []);
75
+ const actions = (0, use_menu_structure_1.useMenuStructure)(closeMenu);
76
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
77
+ const keybindings = (0, use_keybinding_1.useKeybinding)();
78
+ const mode = state.query.startsWith('>') ? 'commands' : 'compositions';
79
+ const actualQuery = (0, react_1.useMemo)(() => {
80
+ if (mode === 'commands') {
81
+ return state.query.substring(1).trim();
82
+ }
83
+ return state.query.trim();
84
+ }, [mode, state.query]);
85
+ const menuActions = (0, react_1.useMemo)(() => {
86
+ if (mode !== 'commands') {
87
+ return [];
88
+ }
89
+ return (0, use_menu_structure_1.makeSearchResults)(actions, setSelectedModal);
90
+ }, [actions, mode, setSelectedModal]);
91
+ const resultsArray = (0, react_1.useMemo)(() => {
92
+ if (mode === 'commands') {
93
+ return (0, fuzzy_search_1.fuzzySearch)(actualQuery, menuActions);
94
+ }
95
+ return (0, fuzzy_search_1.fuzzySearch)(actualQuery, compositions.map((c) => {
96
+ return {
97
+ id: 'composition-' + c.id,
98
+ title: c.id,
99
+ type: 'composition',
100
+ onSelected: () => {
101
+ selectComposition(c, true);
102
+ setSelectedModal(null);
103
+ },
104
+ compositionType: (0, is_composition_still_1.isCompositionStill)(c) ? 'still' : 'composition',
105
+ };
106
+ }));
107
+ }, [
108
+ mode,
109
+ compositions,
110
+ actualQuery,
111
+ menuActions,
112
+ selectComposition,
113
+ setSelectedModal,
114
+ ]);
115
+ const onArrowDown = (0, react_1.useCallback)(() => {
116
+ setState((s) => {
117
+ return {
118
+ ...s,
119
+ selectedIndex: s.selectedIndex + 1,
120
+ };
121
+ });
122
+ }, []);
123
+ const onArrowUp = (0, react_1.useCallback)(() => {
124
+ setState((s) => {
125
+ return {
126
+ ...s,
127
+ selectedIndex: s.selectedIndex - 1,
128
+ };
129
+ });
130
+ }, []);
131
+ // Arrow up
132
+ (0, react_1.useEffect)(() => {
133
+ const binding = keybindings.registerKeybinding({
134
+ key: 'ArrowUp',
135
+ callback: onArrowUp,
136
+ commandCtrlKey: false,
137
+ event: 'keydown',
138
+ });
139
+ return () => {
140
+ binding.unregister();
141
+ };
142
+ }, [keybindings, onArrowDown, onArrowUp]);
143
+ // Arrow down
144
+ (0, react_1.useEffect)(() => {
145
+ const binding = keybindings.registerKeybinding({
146
+ key: 'ArrowDown',
147
+ callback: onArrowDown,
148
+ commandCtrlKey: false,
149
+ event: 'keydown',
150
+ });
151
+ return () => {
152
+ binding.unregister();
153
+ };
154
+ }, [keybindings, onArrowDown]);
155
+ const onTextChange = (0, react_1.useCallback)((e) => {
156
+ setState({ query: e.target.value, selectedIndex: 0 });
157
+ }, []);
158
+ const selectedIndexRounded = loopIndex(state.selectedIndex, resultsArray.length);
159
+ const onActionsSelected = (0, react_1.useCallback)(() => {
160
+ var _a;
161
+ setState({
162
+ query: '> ',
163
+ selectedIndex: 0,
164
+ });
165
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
166
+ }, []);
167
+ const onCompositionsSelected = (0, react_1.useCallback)(() => {
168
+ var _a;
169
+ setState({
170
+ query: '',
171
+ selectedIndex: 0,
172
+ });
173
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
174
+ }, []);
175
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsxs)("div", { style: modeSelector, children: [(0, jsx_runtime_1.jsx)("button", { onClick: onCompositionsSelected, style: mode === 'compositions' ? modeActive : modeInactive, type: "button", children: "Compositions" }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("button", { onClick: onActionsSelected, style: mode === 'commands' ? modeActive : modeInactive, type: "button", children: "Actions" })] }), (0, jsx_runtime_1.jsx)("div", { style: content, children: (0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "text", style: input, autoFocus: true, value: state.query, onChange: onTextChange, placeholder: "Search compositions..." }) }), (0, jsx_runtime_1.jsxs)("div", { style: results, children: [resultsArray.map((result, i) => {
176
+ return ((0, jsx_runtime_1.jsx)(QuickSwitcherResult_1.QuickSwitcherResult, { selected: selectedIndexRounded === i, result: result }, result.id));
177
+ }), resultsArray.length === 0 ? ((0, jsx_runtime_1.jsx)(NoResults_1.QuickSwitcherNoResults, { mode: mode, query: actualQuery })) : null] })] }));
178
+ };
179
+ exports.QuickSwitcherContent = QuickSwitcherContent;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ declare type QuickSwitcherResultDetail = {
3
+ type: 'composition';
4
+ compositionType: 'composition' | 'still';
5
+ } | {
6
+ type: 'menu-item';
7
+ };
8
+ export declare type TQuickSwitcherResult = {
9
+ title: string;
10
+ id: string;
11
+ onSelected: () => void;
12
+ } & QuickSwitcherResultDetail;
13
+ export declare const QuickSwitcherResult: React.FC<{
14
+ result: TQuickSwitcherResult;
15
+ selected: boolean;
16
+ }>;
17
+ export {};
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuickSwitcherResult = 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 use_keybinding_1 = require("../../helpers/use-keybinding");
8
+ const film_1 = require("../../icons/film");
9
+ const still_1 = require("../../icons/still");
10
+ const layout_1 = require("../layout");
11
+ const container = {
12
+ paddingLeft: 16,
13
+ paddingRight: 16,
14
+ paddingTop: 3,
15
+ paddingBottom: 3,
16
+ display: 'flex',
17
+ flexDirection: 'row',
18
+ alignItems: 'center',
19
+ cursor: 'pointer',
20
+ };
21
+ const label = {
22
+ flex: 1,
23
+ whiteSpace: 'nowrap',
24
+ textOverflow: 'ellipsis',
25
+ overflow: 'hidden',
26
+ };
27
+ const iconStyle = {
28
+ width: 14,
29
+ height: 14,
30
+ };
31
+ const QuickSwitcherResult = ({ result, selected }) => {
32
+ const [hovered, setIsHovered] = (0, react_1.useState)(false);
33
+ const ref = (0, react_1.useRef)(null);
34
+ const keybindings = (0, use_keybinding_1.useKeybinding)();
35
+ (0, react_1.useEffect)(() => {
36
+ const { current } = ref;
37
+ if (!current) {
38
+ return;
39
+ }
40
+ const onMouseEnter = () => setIsHovered(true);
41
+ const onMouseLeave = () => setIsHovered(false);
42
+ current.addEventListener('mouseenter', onMouseEnter);
43
+ current.addEventListener('mouseleave', onMouseLeave);
44
+ return () => {
45
+ current.removeEventListener('mouseenter', onMouseEnter);
46
+ current.removeEventListener('mouseleave', onMouseLeave);
47
+ };
48
+ }, []);
49
+ (0, react_1.useEffect)(() => {
50
+ if (!selected) {
51
+ return;
52
+ }
53
+ const binding = keybindings.registerKeybinding({
54
+ key: 'Enter',
55
+ callback: result.onSelected,
56
+ commandCtrlKey: false,
57
+ event: 'keydown',
58
+ });
59
+ return () => {
60
+ binding.unregister();
61
+ };
62
+ }, [keybindings, result.onSelected, selected]);
63
+ (0, react_1.useEffect)(() => {
64
+ var _a;
65
+ if (selected) {
66
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
67
+ block: 'nearest',
68
+ inline: 'center',
69
+ });
70
+ }
71
+ }, [selected]);
72
+ const style = (0, react_1.useMemo)(() => {
73
+ return {
74
+ ...container,
75
+ backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
76
+ hovered,
77
+ selected,
78
+ }),
79
+ };
80
+ }, [hovered, selected]);
81
+ const labelStyle = (0, react_1.useMemo)(() => {
82
+ return {
83
+ ...label,
84
+ color: selected || hovered ? 'white' : colors_1.LIGHT_TEXT,
85
+ fontSize: 15,
86
+ };
87
+ }, [hovered, selected]);
88
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: style, onClick: result.onSelected, children: [result.type === 'composition' ? (result.compositionType === 'still' ? ((0, jsx_runtime_1.jsx)(still_1.StillIcon, { style: iconStyle })) : ((0, jsx_runtime_1.jsx)(film_1.FilmIcon, { style: iconStyle }))) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), (0, jsx_runtime_1.jsx)("div", { style: labelStyle, children: result.title })] }, result.id));
89
+ };
90
+ exports.QuickSwitcherResult = QuickSwitcherResult;
@@ -0,0 +1,2 @@
1
+ import type { TQuickSwitcherResult } from './QuickSwitcherResult';
2
+ export declare function fuzzySearch(query: string, dataset: TQuickSwitcherResult[]): TQuickSwitcherResult[];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fuzzySearch = void 0;
4
+ function fuzzySearch(query, dataset) {
5
+ const q = query ? query.trim().toLowerCase() : '';
6
+ const matchingIndices = [];
7
+ if (q.length === 0) {
8
+ for (let i = 0; i < dataset.length; i++) {
9
+ matchingIndices.push(i);
10
+ }
11
+ return dataset.filter((_, i) => matchingIndices.includes(i));
12
+ }
13
+ dataset.forEach((d, index) => {
14
+ const s = d.title.trim().toLowerCase();
15
+ let i = 0;
16
+ let n = -1;
17
+ let l;
18
+ // eslint-disable-next-line no-bitwise
19
+ for (; (l = q[i++]);)
20
+ if (!~(n = s.indexOf(l, n + 1)))
21
+ return;
22
+ matchingIndices.push(index);
23
+ });
24
+ return dataset.filter((_, i) => matchingIndices.includes(i));
25
+ }
26
+ exports.fuzzySearch = fuzzySearch;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const QuickSwitcher: React.FC<{}>;
3
+ export default QuickSwitcher;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const remotion_1 = require("remotion");
6
+ const colors_1 = require("../helpers/colors");
7
+ const modals_1 = require("../state/modals");
8
+ const ModalContainer_1 = require("./ModalContainer");
9
+ const input = {
10
+ padding: 4,
11
+ border: '2px solid ' + colors_1.INPUT_BORDER_COLOR_UNHOVERED,
12
+ width: '100%',
13
+ };
14
+ const content = {
15
+ padding: 16,
16
+ minWidth: 500,
17
+ };
18
+ const results = {
19
+ overflowY: 'auto',
20
+ maxHeight: 300,
21
+ };
22
+ const QuickSwitcher = (props) => {
23
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
24
+ const { compositions } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
25
+ const onQuit = (0, react_1.useCallback)(() => {
26
+ setSelectedModal(null);
27
+ }, [setSelectedModal]);
28
+ return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)("div", { style: content, children: (0, jsx_runtime_1.jsx)("input", { type: "text", style: input, autoFocus: true, placeholder: "Search compositions and commands" }) }), (0, jsx_runtime_1.jsx)("div", { style: results, children: compositions.map((c) => {
29
+ return (0, jsx_runtime_1.jsx)("div", { children: c.id }, c.id);
30
+ }) })] }));
31
+ };
32
+ exports.default = QuickSwitcher;
@@ -87,6 +87,7 @@ const SizeSelector = () => {
87
87
  keyHint: newSize.size === 1 ? '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
+ quickSwitcherLabel: null,
90
91
  };
91
92
  });
92
93
  }, [setSize, size]);
@@ -0,0 +1,7 @@
1
+ import type { Menu } from '../components/Menu/MenuItem';
2
+ import type { TQuickSwitcherResult } from '../components/QuickSwitcher/QuickSwitcherResult';
3
+ import type { ModalState } from '../state/modals';
4
+ declare type Structure = Menu[];
5
+ export declare const useMenuStructure: (closeMenu: () => void) => Structure;
6
+ export declare const makeSearchResults: (actions: Structure, setSelectedModal: (value: React.SetStateAction<ModalState | null>) => void) => TQuickSwitcherResult[];
7
+ export {};