@remotion/cli 3.2.14 → 3.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +0 -0
- package/dist/bundle.js +1 -1
- package/dist/config/bundle-out-dir.d.ts +1 -1
- package/dist/config/bundle-out-dir.js +3 -3
- package/dist/config/get-public-path.d.ts +0 -0
- package/dist/config/get-public-path.js +0 -0
- package/dist/config/public-dir.d.ts +0 -0
- package/dist/config/public-dir.js +0 -0
- package/dist/editor/components/Button.d.ts +4 -0
- package/dist/editor/components/Button.js +24 -0
- package/dist/editor/components/Canvas.js +190 -1
- package/dist/editor/components/CopyButton.js +3 -16
- package/dist/editor/components/EditorContexts.d.ts +0 -0
- package/dist/editor/components/EditorContexts.js +1 -15
- package/dist/editor/components/KeyboardShortcutsModal.js +1 -1
- package/dist/editor/components/MenuToolbar.js +9 -7
- package/dist/editor/components/PlaybackRateSelector.js +5 -0
- package/dist/editor/components/Preview.d.ts +1 -0
- package/dist/editor/components/Preview.js +16 -8
- package/dist/editor/components/PreviewZoomControls.d.ts +2 -0
- package/dist/editor/components/PreviewZoomControls.js +49 -0
- package/dist/editor/components/ResetZoomButton.d.ts +4 -0
- package/dist/editor/components/ResetZoomButton.js +9 -0
- package/dist/editor/components/SizeSelector.d.ts +2 -1
- package/dist/editor/components/SizeSelector.js +58 -18
- package/dist/editor/helpers/get-effective-translation.d.ts +26 -0
- package/dist/editor/helpers/get-effective-translation.js +45 -0
- package/dist/editor/helpers/is-current-selected-still.d.ts +4 -0
- package/dist/editor/helpers/is-current-selected-still.js +15 -1
- package/dist/editor/helpers/normalize-wheel.d.ts +5 -0
- package/dist/editor/helpers/normalize-wheel.js +20 -0
- package/dist/editor/state/preview-size.d.ts +5 -2
- package/dist/editor/state/preview-size.js +39 -5
- package/dist/list-of-remotion-packages.d.ts +0 -0
- package/dist/list-of-remotion-packages.js +0 -0
- package/dist/prepare-entry-point.d.ts +0 -0
- package/dist/prepare-entry-point.js +0 -0
- package/dist/smooth-zoom.d.ts +4 -0
- package/dist/smooth-zoom.js +20 -0
- package/dist/webpack-cache.d.ts +12 -0
- package/dist/webpack-cache.js +66 -0
- package/package.json +7 -7
package/dist/bundle.d.ts
CHANGED
|
File without changes
|
package/dist/bundle.js
CHANGED
|
@@ -11,7 +11,7 @@ const bundleCommand = async (remotionRoot) => {
|
|
|
11
11
|
if (!file) {
|
|
12
12
|
log_1.Log.error('No entry point specified. Pass more arguments:');
|
|
13
13
|
log_1.Log.error(' npx remotion bundle [entry-point]');
|
|
14
|
-
log_1.Log.error('Documentation: https://www.remotion.dev/docs/
|
|
14
|
+
log_1.Log.error('Documentation: https://www.remotion.dev/docs/cli/bundle');
|
|
15
15
|
process.exit(1);
|
|
16
16
|
}
|
|
17
17
|
await (0, initialize_render_cli_1.initializeRenderCli)(remotionRoot, 'bundle');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getBundleOutDir: () => string | null;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const setBundleDir: (path: string) => void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setBundleDir = exports.getBundleOutDir = void 0;
|
|
4
4
|
let bundleOutDir = null;
|
|
5
5
|
const getBundleOutDir = () => {
|
|
6
6
|
return bundleOutDir;
|
|
7
7
|
};
|
|
8
8
|
exports.getBundleOutDir = getBundleOutDir;
|
|
9
|
-
const
|
|
9
|
+
const setBundleDir = (path) => {
|
|
10
10
|
bundleOutDir = path;
|
|
11
11
|
};
|
|
12
|
-
exports.
|
|
12
|
+
exports.setBundleDir = setBundleDir;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../helpers/colors");
|
|
6
|
+
const layout_1 = require("./layout");
|
|
7
|
+
const container = {
|
|
8
|
+
padding: 10,
|
|
9
|
+
cursor: 'pointer',
|
|
10
|
+
fontSize: 14,
|
|
11
|
+
};
|
|
12
|
+
const button = {
|
|
13
|
+
border: `1px solid ${colors_1.INPUT_BORDER_COLOR_UNHOVERED}`,
|
|
14
|
+
borderRadius: 4,
|
|
15
|
+
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
16
|
+
appearance: 'none',
|
|
17
|
+
fontFamily: 'inherit',
|
|
18
|
+
fontSize: 14,
|
|
19
|
+
color: 'white',
|
|
20
|
+
};
|
|
21
|
+
const Button = ({ children, ...props }) => {
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("button", { ...props, style: button, type: "button", children: (0, jsx_runtime_1.jsx)(layout_1.Row, { style: container, children: children }) }));
|
|
23
|
+
};
|
|
24
|
+
exports.Button = Button;
|
|
@@ -3,9 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Canvas = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const player_1 = require("@remotion/player");
|
|
6
|
+
const calculate_scale_1 = require("@remotion/player/src/calculate-scale");
|
|
6
7
|
const react_1 = require("react");
|
|
8
|
+
const smooth_zoom_1 = require("../../smooth-zoom");
|
|
7
9
|
const colors_1 = require("../helpers/colors");
|
|
10
|
+
const get_effective_translation_1 = require("../helpers/get-effective-translation");
|
|
11
|
+
const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
|
|
12
|
+
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
13
|
+
const preview_size_1 = require("../state/preview-size");
|
|
14
|
+
const layout_1 = require("./layout");
|
|
8
15
|
const Preview_1 = require("./Preview");
|
|
16
|
+
const ResetZoomButton_1 = require("./ResetZoomButton");
|
|
9
17
|
const container = {
|
|
10
18
|
flex: 1,
|
|
11
19
|
display: 'flex',
|
|
@@ -13,12 +21,193 @@ const container = {
|
|
|
13
21
|
position: 'relative',
|
|
14
22
|
backgroundColor: colors_1.BACKGROUND,
|
|
15
23
|
};
|
|
24
|
+
const resetZoom = {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: layout_1.SPACING_UNIT * 2,
|
|
27
|
+
right: layout_1.SPACING_UNIT * 2,
|
|
28
|
+
};
|
|
29
|
+
const ZOOM_PX_FACTOR = 0.003;
|
|
16
30
|
const Canvas = () => {
|
|
31
|
+
const dimensions = (0, is_current_selected_still_1.useDimensions)();
|
|
17
32
|
const ref = (0, react_1.useRef)(null);
|
|
33
|
+
const { setSize, size: previewSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
|
|
34
|
+
const keybindings = (0, use_keybinding_1.useKeybinding)();
|
|
18
35
|
const size = player_1.PlayerInternals.useElementSize(ref, {
|
|
19
36
|
triggerOnWindowResize: false,
|
|
20
37
|
shouldApplyCssTransforms: true,
|
|
21
38
|
});
|
|
22
|
-
|
|
39
|
+
const isFit = previewSize.size === 'auto' ||
|
|
40
|
+
(previewSize.size === 1 &&
|
|
41
|
+
previewSize.translation.x === 0 &&
|
|
42
|
+
previewSize.translation.y === 0);
|
|
43
|
+
const onWheel = (0, react_1.useCallback)((e) => {
|
|
44
|
+
if (!size) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!dimensions) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const wantsToZoom = e.ctrlKey || e.metaKey;
|
|
51
|
+
if (!wantsToZoom && isFit) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
setSize((prevSize) => {
|
|
56
|
+
const scale = (0, calculate_scale_1.calculateScale)({
|
|
57
|
+
canvasSize: size,
|
|
58
|
+
compositionHeight: dimensions.height,
|
|
59
|
+
compositionWidth: dimensions.width,
|
|
60
|
+
previewSize: prevSize.size,
|
|
61
|
+
});
|
|
62
|
+
// Zoom in/out
|
|
63
|
+
if (wantsToZoom) {
|
|
64
|
+
const oldSize = prevSize.size === 'auto' ? scale : prevSize.size;
|
|
65
|
+
const smoothened = (0, smooth_zoom_1.smoothenZoom)(oldSize);
|
|
66
|
+
const added = smoothened + e.deltaY * ZOOM_PX_FACTOR;
|
|
67
|
+
const unsmoothened = (0, smooth_zoom_1.unsmoothenZoom)(added);
|
|
68
|
+
const { centerX, centerY } = (0, get_effective_translation_1.getCenterPointWhileScrolling)({
|
|
69
|
+
size,
|
|
70
|
+
clientX: e.clientX,
|
|
71
|
+
clientY: e.clientY,
|
|
72
|
+
compositionWidth: dimensions.width,
|
|
73
|
+
compositionHeight: dimensions.height,
|
|
74
|
+
scale,
|
|
75
|
+
translation: prevSize.translation,
|
|
76
|
+
});
|
|
77
|
+
const zoomDifference = unsmoothened - oldSize;
|
|
78
|
+
const uvCoordinatesX = centerX / dimensions.width;
|
|
79
|
+
const uvCoordinatesY = centerY / dimensions.height;
|
|
80
|
+
const correctionLeft = -uvCoordinatesX * (zoomDifference * dimensions.width) +
|
|
81
|
+
(1 - uvCoordinatesX) * zoomDifference * dimensions.width;
|
|
82
|
+
const correctionTop = -uvCoordinatesY * (zoomDifference * dimensions.height) +
|
|
83
|
+
(1 - uvCoordinatesY) * zoomDifference * dimensions.height;
|
|
84
|
+
return {
|
|
85
|
+
translation: (0, get_effective_translation_1.getEffectiveTranslation)({
|
|
86
|
+
translation: {
|
|
87
|
+
x: prevSize.translation.x - correctionLeft / 2,
|
|
88
|
+
y: prevSize.translation.y - correctionTop / 2,
|
|
89
|
+
},
|
|
90
|
+
canvasSize: size,
|
|
91
|
+
compositionHeight: dimensions.height,
|
|
92
|
+
compositionWidth: dimensions.width,
|
|
93
|
+
scale,
|
|
94
|
+
}),
|
|
95
|
+
size: unsmoothened,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const effectiveTranslation = (0, get_effective_translation_1.getEffectiveTranslation)({
|
|
99
|
+
translation: prevSize.translation,
|
|
100
|
+
canvasSize: size,
|
|
101
|
+
compositionHeight: dimensions.height,
|
|
102
|
+
compositionWidth: dimensions.width,
|
|
103
|
+
scale,
|
|
104
|
+
});
|
|
105
|
+
// Pan
|
|
106
|
+
return {
|
|
107
|
+
...prevSize,
|
|
108
|
+
translation: (0, get_effective_translation_1.getEffectiveTranslation)({
|
|
109
|
+
translation: {
|
|
110
|
+
x: effectiveTranslation.x + e.deltaX,
|
|
111
|
+
y: effectiveTranslation.y + e.deltaY,
|
|
112
|
+
},
|
|
113
|
+
canvasSize: size,
|
|
114
|
+
compositionHeight: dimensions.height,
|
|
115
|
+
compositionWidth: dimensions.width,
|
|
116
|
+
scale,
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}, [dimensions, isFit, setSize, size]);
|
|
121
|
+
(0, react_1.useEffect)(() => {
|
|
122
|
+
const { current } = ref;
|
|
123
|
+
if (!current) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
current.addEventListener('wheel', onWheel);
|
|
127
|
+
return () => current.removeEventListener('wheel', onWheel);
|
|
128
|
+
}, [onWheel]);
|
|
129
|
+
const onReset = (0, react_1.useCallback)(() => {
|
|
130
|
+
setSize(() => {
|
|
131
|
+
return {
|
|
132
|
+
translation: {
|
|
133
|
+
x: 0,
|
|
134
|
+
y: 0,
|
|
135
|
+
},
|
|
136
|
+
size: 'auto',
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}, [setSize]);
|
|
140
|
+
const onZoomIn = (0, react_1.useCallback)(() => {
|
|
141
|
+
if (!dimensions) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (!size) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
setSize((prevSize) => {
|
|
148
|
+
const scale = (0, calculate_scale_1.calculateScale)({
|
|
149
|
+
canvasSize: size,
|
|
150
|
+
compositionHeight: dimensions.height,
|
|
151
|
+
compositionWidth: dimensions.width,
|
|
152
|
+
previewSize: prevSize.size,
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
translation: {
|
|
156
|
+
x: 0,
|
|
157
|
+
y: 0,
|
|
158
|
+
},
|
|
159
|
+
size: Math.min(smooth_zoom_1.MAX_ZOOM, scale * 2),
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}, [dimensions, setSize, size]);
|
|
163
|
+
const onZoomOut = (0, react_1.useCallback)(() => {
|
|
164
|
+
if (!dimensions) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!size) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
setSize((prevSize) => {
|
|
171
|
+
const scale = (0, calculate_scale_1.calculateScale)({
|
|
172
|
+
canvasSize: size,
|
|
173
|
+
compositionHeight: dimensions.height,
|
|
174
|
+
compositionWidth: dimensions.width,
|
|
175
|
+
previewSize: prevSize.size,
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
translation: {
|
|
179
|
+
x: 0,
|
|
180
|
+
y: 0,
|
|
181
|
+
},
|
|
182
|
+
size: Math.max(smooth_zoom_1.MIN_ZOOM, scale / 2),
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
}, [dimensions, setSize, size]);
|
|
186
|
+
(0, react_1.useEffect)(() => {
|
|
187
|
+
const resetBinding = keybindings.registerKeybinding({
|
|
188
|
+
event: 'keydown',
|
|
189
|
+
key: '0',
|
|
190
|
+
commandCtrlKey: false,
|
|
191
|
+
callback: onReset,
|
|
192
|
+
});
|
|
193
|
+
const zoomIn = keybindings.registerKeybinding({
|
|
194
|
+
event: 'keydown',
|
|
195
|
+
key: '+',
|
|
196
|
+
commandCtrlKey: false,
|
|
197
|
+
callback: onZoomIn,
|
|
198
|
+
});
|
|
199
|
+
const zoomOut = keybindings.registerKeybinding({
|
|
200
|
+
event: 'keydown',
|
|
201
|
+
key: '-',
|
|
202
|
+
commandCtrlKey: false,
|
|
203
|
+
callback: onZoomOut,
|
|
204
|
+
});
|
|
205
|
+
return () => {
|
|
206
|
+
resetBinding.unregister();
|
|
207
|
+
zoomIn.unregister();
|
|
208
|
+
zoomOut.unregister();
|
|
209
|
+
};
|
|
210
|
+
}, [keybindings, onReset, onZoomIn, onZoomOut]);
|
|
211
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: container, children: [size ? (0, jsx_runtime_1.jsx)(Preview_1.VideoPreview, { canvasSize: size }) : null, isFit ? null : ((0, jsx_runtime_1.jsx)("div", { style: resetZoom, children: (0, jsx_runtime_1.jsx)(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) }))] }));
|
|
23
212
|
};
|
|
24
213
|
exports.Canvas = Canvas;
|
|
@@ -3,29 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CopyButton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const Button_1 = require("../../preview-server/error-overlay/remotion-overlay/Button");
|
|
7
7
|
const copy_text_1 = require("../helpers/copy-text");
|
|
8
8
|
const layout_1 = require("./layout");
|
|
9
9
|
const iconStyle = {
|
|
10
10
|
width: 16,
|
|
11
11
|
height: 16,
|
|
12
12
|
color: 'white',
|
|
13
|
+
verticalAlign: 'sub',
|
|
13
14
|
};
|
|
14
15
|
const copyIcon = ((0, jsx_runtime_1.jsx)("svg", { "aria-hidden": "true", focusable: "false", "data-prefix": "far", "data-icon": "clipboard", className: "svg-inline--fa fa-clipboard fa-w-12", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 384 512", style: iconStyle, children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm144 418c0 3.3-2.7 6-6 6H54c-3.3 0-6-2.7-6-6V118c0-3.3 2.7-6 6-6h42v36c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-36h42c3.3 0 6 2.7 6 6z" }) }));
|
|
15
|
-
const container = {
|
|
16
|
-
padding: 10,
|
|
17
|
-
cursor: 'pointer',
|
|
18
|
-
fontSize: 14,
|
|
19
|
-
};
|
|
20
|
-
const button = {
|
|
21
|
-
border: `1px solid ${colors_1.INPUT_BORDER_COLOR_UNHOVERED}`,
|
|
22
|
-
borderRadius: 4,
|
|
23
|
-
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
24
|
-
appearance: 'none',
|
|
25
|
-
fontFamily: 'inherit',
|
|
26
|
-
fontSize: 14,
|
|
27
|
-
color: 'white',
|
|
28
|
-
};
|
|
29
16
|
const labelStyle = {
|
|
30
17
|
fontSize: 14,
|
|
31
18
|
};
|
|
@@ -42,6 +29,6 @@ const CopyButton = ({ textToCopy, label, labelWhenCopied }) => {
|
|
|
42
29
|
const to = setTimeout(() => setCopied(false), 2000);
|
|
43
30
|
return () => clearTimeout(to);
|
|
44
31
|
}, [copied]);
|
|
45
|
-
return ((0, jsx_runtime_1.
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(Button_1.Button, { onClick: onClick, children: [copyIcon, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1.5 }), ' ', (0, jsx_runtime_1.jsx)("span", { style: labelStyle, children: copied ? labelWhenCopied : label })] }));
|
|
46
33
|
};
|
|
47
34
|
exports.CopyButton = CopyButton;
|
|
File without changes
|
|
@@ -24,7 +24,6 @@ const EditorContexts = ({ children }) => {
|
|
|
24
24
|
return inAndOutFrames;
|
|
25
25
|
}, [inAndOutFrames]);
|
|
26
26
|
const [emitter] = (0, react_1.useState)(() => new player_1.PlayerInternals.PlayerEmitter());
|
|
27
|
-
const [size, setSizeState] = (0, react_1.useState)(() => (0, preview_size_1.loadPreviewSizeOption)());
|
|
28
27
|
const setTimelineInOutContextValue = (0, react_1.useMemo)(() => {
|
|
29
28
|
return {
|
|
30
29
|
setInAndOutFrames,
|
|
@@ -46,22 +45,9 @@ const EditorContexts = ({ children }) => {
|
|
|
46
45
|
return newVal;
|
|
47
46
|
});
|
|
48
47
|
}, []);
|
|
49
|
-
const setSize = (0, react_1.useCallback)((newValue) => {
|
|
50
|
-
setSizeState((prevState) => {
|
|
51
|
-
const newVal = newValue(prevState);
|
|
52
|
-
(0, preview_size_1.persistPreviewSizeOption)(newVal);
|
|
53
|
-
return newVal;
|
|
54
|
-
});
|
|
55
|
-
}, []);
|
|
56
48
|
const [mediaMuted, setMediaMuted] = (0, react_1.useState)(() => (0, mute_1.loadMuteOption)());
|
|
57
49
|
const [mediaVolume, setMediaVolume] = (0, react_1.useState)(1);
|
|
58
50
|
const [modalContextType, setModalContextType] = (0, react_1.useState)(null);
|
|
59
|
-
const previewSizeCtx = (0, react_1.useMemo)(() => {
|
|
60
|
-
return {
|
|
61
|
-
size,
|
|
62
|
-
setSize,
|
|
63
|
-
};
|
|
64
|
-
}, [setSize, size]);
|
|
65
51
|
const checkerboardCtx = (0, react_1.useMemo)(() => {
|
|
66
52
|
return {
|
|
67
53
|
checkerboard,
|
|
@@ -92,6 +78,6 @@ const EditorContexts = ({ children }) => {
|
|
|
92
78
|
setSelectedModal: setModalContextType,
|
|
93
79
|
};
|
|
94
80
|
}, [modalContextType]);
|
|
95
|
-
return ((0, jsx_runtime_1.jsx)(keybindings_1.KeybindingContextProvider, { children: (0, jsx_runtime_1.jsx)(rich_timeline_1.RichTimelineContext.Provider, { value: richTimelineCtx, children: (0, jsx_runtime_1.jsx)(checkerboard_1.CheckerboardContext.Provider, { value: checkerboardCtx, children: (0, jsx_runtime_1.jsx)(preview_size_1.
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(keybindings_1.KeybindingContextProvider, { children: (0, jsx_runtime_1.jsx)(rich_timeline_1.RichTimelineContext.Provider, { value: richTimelineCtx, children: (0, jsx_runtime_1.jsx)(checkerboard_1.CheckerboardContext.Provider, { value: checkerboardCtx, children: (0, jsx_runtime_1.jsx)(preview_size_1.PreviewSizeProvider, { children: (0, jsx_runtime_1.jsx)(modals_1.ModalsContext.Provider, { value: modalsContext, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.MediaVolumeContext.Provider, { value: mediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.SetMediaVolumeContext.Provider, { value: setMediaVolumeContextValue, children: (0, jsx_runtime_1.jsx)(player_1.PlayerInternals.PlayerEventEmitterContext.Provider, { value: emitter, children: (0, jsx_runtime_1.jsx)(sidebar_1.SidebarContextProvider, { children: (0, jsx_runtime_1.jsx)(folders_1.FolderContextProvider, { children: (0, jsx_runtime_1.jsx)(highest_z_index_1.HighestZIndexProvider, { children: (0, jsx_runtime_1.jsx)(in_out_1.TimelineInOutContext.Provider, { value: timelineInOutContextValue, children: (0, jsx_runtime_1.jsx)(in_out_1.SetTimelineInOutContext.Provider, { value: setTimelineInOutContextValue, children: children }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
96
82
|
};
|
|
97
83
|
exports.EditorContexts = EditorContexts;
|
|
@@ -62,6 +62,6 @@ const KeyboardShortcuts = () => {
|
|
|
62
62
|
const onQuit = (0, react_1.useCallback)(() => {
|
|
63
63
|
setSelectedModal(null);
|
|
64
64
|
}, [setSelectedModal]);
|
|
65
|
-
return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onEscape: onQuit, onOutsideClick: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: "Keyboard shortcuts" }), (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.Preview.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.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (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.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (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)(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: shortLeft, 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: shortLeft, 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: shortLeft, 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.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: shortLeft, 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: shortLeft, 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: shortLeft, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "X" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Clear In/Out Points" })] })] })] })] }));
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onEscape: onQuit, onOutsideClick: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: "Keyboard shortcuts" }), (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.Preview.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.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (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.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (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)(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: shortLeft, 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: shortLeft, 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: shortLeft, 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.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: shortLeft, 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: shortLeft, 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: shortLeft, 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: shortLeft, 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: shortLeft, 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: shortLeft, children: (0, jsx_runtime_1.jsx)("kbd", { style: key, children: "0" }) }), (0, jsx_runtime_1.jsx)("div", { style: right, children: "Reset zoom" })] })] })] })] }));
|
|
66
66
|
};
|
|
67
67
|
exports.KeyboardShortcuts = KeyboardShortcuts;
|
|
@@ -59,6 +59,7 @@ const MenuToolbar = () => {
|
|
|
59
59
|
const close = (0, react_1.useCallback)(() => {
|
|
60
60
|
setSelected(null);
|
|
61
61
|
}, []);
|
|
62
|
+
const sizes = (0, SizeSelector_1.getUniqueSizes)(size);
|
|
62
63
|
const structure = (0, react_1.useMemo)(() => {
|
|
63
64
|
const struct = [
|
|
64
65
|
{
|
|
@@ -161,19 +162,19 @@ const MenuToolbar = () => {
|
|
|
161
162
|
leftItem: null,
|
|
162
163
|
subMenu: {
|
|
163
164
|
leaveLeftSpace: true,
|
|
164
|
-
preselectIndex:
|
|
165
|
-
items:
|
|
166
|
-
id: String(newSize),
|
|
167
|
-
keyHint: null,
|
|
165
|
+
preselectIndex: sizes.findIndex((s) => String(size.size) === String(s.size)),
|
|
166
|
+
items: sizes.map((newSize) => ({
|
|
167
|
+
id: String(newSize.size),
|
|
168
|
+
keyHint: newSize.size === 1 ? '0' : null,
|
|
168
169
|
label: (0, SizeSelector_1.getPreviewSizeLabel)(newSize),
|
|
169
|
-
leftItem: String(newSize) === String(size) ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
170
|
+
leftItem: String(newSize.size) === String(size.size) ? ((0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {})) : null,
|
|
170
171
|
onClick: () => {
|
|
171
172
|
close();
|
|
172
173
|
setSize(() => newSize);
|
|
173
174
|
},
|
|
174
175
|
subMenu: null,
|
|
175
176
|
type: 'item',
|
|
176
|
-
value: newSize,
|
|
177
|
+
value: newSize.size,
|
|
177
178
|
})),
|
|
178
179
|
},
|
|
179
180
|
},
|
|
@@ -479,7 +480,8 @@ const MenuToolbar = () => {
|
|
|
479
480
|
setSidebarCollapsedState,
|
|
480
481
|
setSize,
|
|
481
482
|
sidebarCollapsedState,
|
|
482
|
-
size,
|
|
483
|
+
size.size,
|
|
484
|
+
sizes,
|
|
483
485
|
]);
|
|
484
486
|
const menus = (0, react_1.useMemo)(() => {
|
|
485
487
|
return structure.map((s) => s.id);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PlaybackRateSelector = exports.getPlaybackRateLabel = exports.commonPlaybackRates = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
|
|
6
7
|
const Checkmark_1 = require("../icons/Checkmark");
|
|
7
8
|
const playbackrate_1 = require("../state/playbackrate");
|
|
8
9
|
const ControlButton_1 = require("./ControlButton");
|
|
@@ -17,6 +18,7 @@ exports.getPlaybackRateLabel = getPlaybackRateLabel;
|
|
|
17
18
|
const accessibilityLabel = 'Change the playback rate';
|
|
18
19
|
const comboStyle = { width: 80 };
|
|
19
20
|
const PlaybackRateSelector = ({ playbackRate, setPlaybackRate }) => {
|
|
21
|
+
const isStill = (0, is_current_selected_still_1.useIsStill)();
|
|
20
22
|
const style = (0, react_1.useMemo)(() => {
|
|
21
23
|
return {
|
|
22
24
|
padding: ControlButton_1.CONTROL_BUTTON_PADDING,
|
|
@@ -47,6 +49,9 @@ const PlaybackRateSelector = ({ playbackRate, setPlaybackRate }) => {
|
|
|
47
49
|
const middle = Math.floor(exports.commonPlaybackRates.length / 2);
|
|
48
50
|
return [...values.slice(0, middle), divider, ...values.slice(middle)];
|
|
49
51
|
}, [playbackRate, setPlaybackRate]);
|
|
52
|
+
if (isStill) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
50
55
|
return ((0, jsx_runtime_1.jsx)("div", { style: style, "aria-label": accessibilityLabel, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: accessibilityLabel, style: comboStyle, selectedId: String(playbackRate), values: items }) }));
|
|
51
56
|
};
|
|
52
57
|
exports.PlaybackRateSelector = PlaybackRateSelector;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VideoPreview = void 0;
|
|
3
|
+
exports.VideoPreview = exports.checkerboardSize = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const player_1 = require("@remotion/player");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -8,7 +8,7 @@ const remotion_1 = require("remotion");
|
|
|
8
8
|
const checkerboard_background_1 = require("../helpers/checkerboard-background");
|
|
9
9
|
const checkerboard_1 = require("../state/checkerboard");
|
|
10
10
|
const preview_size_1 = require("../state/preview-size");
|
|
11
|
-
|
|
11
|
+
exports.checkerboardSize = 49;
|
|
12
12
|
const containerStyle = (options) => {
|
|
13
13
|
return {
|
|
14
14
|
transform: `scale(${options.scale})`,
|
|
@@ -20,8 +20,8 @@ const containerStyle = (options) => {
|
|
|
20
20
|
position: 'absolute',
|
|
21
21
|
backgroundColor: (0, checkerboard_background_1.checkerboardBackgroundColor)(options.checkerboard),
|
|
22
22
|
backgroundImage: (0, checkerboard_background_1.checkerboardBackgroundImage)(options.checkerboard),
|
|
23
|
-
backgroundSize: (0, checkerboard_background_1.getCheckerboardBackgroundSize)(checkerboardSize) /* Must be a square */,
|
|
24
|
-
backgroundPosition: (0, checkerboard_background_1.getCheckerboardBackgroundPos)(checkerboardSize) /* Must be half of one side of the square */,
|
|
23
|
+
backgroundSize: (0, checkerboard_background_1.getCheckerboardBackgroundSize)(exports.checkerboardSize) /* Must be a square */,
|
|
24
|
+
backgroundPosition: (0, checkerboard_background_1.getCheckerboardBackgroundPos)(exports.checkerboardSize) /* Must be half of one side of the square */,
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
const Inner = ({ canvasSize }) => {
|
|
@@ -29,7 +29,7 @@ const Inner = ({ canvasSize }) => {
|
|
|
29
29
|
const portalContainer = (0, react_1.useRef)(null);
|
|
30
30
|
const config = (0, remotion_1.useVideoConfig)();
|
|
31
31
|
const { checkerboard } = (0, react_1.useContext)(checkerboard_1.CheckerboardContext);
|
|
32
|
-
const { centerX, centerY, yCorrection, xCorrection, scale } = player_1.PlayerInternals.
|
|
32
|
+
const { centerX, centerY, yCorrection, xCorrection, scale } = player_1.PlayerInternals.calculateCanvasTransformation({
|
|
33
33
|
canvasSize,
|
|
34
34
|
compositionHeight: config.height,
|
|
35
35
|
compositionWidth: config.width,
|
|
@@ -42,11 +42,19 @@ const Inner = ({ canvasSize }) => {
|
|
|
42
42
|
display: 'flex',
|
|
43
43
|
flexDirection: 'column',
|
|
44
44
|
position: 'absolute',
|
|
45
|
-
left: centerX,
|
|
46
|
-
top: centerY,
|
|
45
|
+
left: centerX - previewSize.translation.x,
|
|
46
|
+
top: centerY - previewSize.translation.y,
|
|
47
47
|
overflow: 'hidden',
|
|
48
48
|
};
|
|
49
|
-
}, [
|
|
49
|
+
}, [
|
|
50
|
+
centerX,
|
|
51
|
+
centerY,
|
|
52
|
+
config.height,
|
|
53
|
+
config.width,
|
|
54
|
+
previewSize.translation.x,
|
|
55
|
+
previewSize.translation.y,
|
|
56
|
+
scale,
|
|
57
|
+
]);
|
|
50
58
|
const style = (0, react_1.useMemo)(() => {
|
|
51
59
|
return containerStyle({
|
|
52
60
|
checkerboard,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreviewZoomControls = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const minus_1 = require("../icons/minus");
|
|
7
|
+
const plus_1 = require("../icons/plus");
|
|
8
|
+
const preview_size_1 = require("../state/preview-size");
|
|
9
|
+
const ControlButton_1 = require("./ControlButton");
|
|
10
|
+
const layout_1 = require("./layout");
|
|
11
|
+
const container = {
|
|
12
|
+
color: 'black',
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
};
|
|
16
|
+
const buttonStyle = {
|
|
17
|
+
fontSize: 24,
|
|
18
|
+
};
|
|
19
|
+
const iconStyle = {
|
|
20
|
+
color: 'white',
|
|
21
|
+
width: 14,
|
|
22
|
+
};
|
|
23
|
+
const PreviewZoomControls = () => {
|
|
24
|
+
const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
|
|
25
|
+
const onZoomOutClicked = (0, react_1.useCallback)(() => {
|
|
26
|
+
setSize((z) => {
|
|
27
|
+
// TODO: Don't assume 1
|
|
28
|
+
const newSize = Number((z.size === 'auto' ? 1 : z.size - preview_size_1.ZOOM_BUTTON_STEP).toFixed(2));
|
|
29
|
+
return { ...z, size: Math.max(preview_size_1.PREVIEW_MIN_ZOOM, newSize) };
|
|
30
|
+
});
|
|
31
|
+
}, [setSize]);
|
|
32
|
+
const onZoomInClicked = (0, react_1.useCallback)(() => {
|
|
33
|
+
setSize((z) => {
|
|
34
|
+
// TODO: Don't assume 1
|
|
35
|
+
if (z.size === 'auto')
|
|
36
|
+
return {
|
|
37
|
+
size: 1 + preview_size_1.ZOOM_BUTTON_STEP,
|
|
38
|
+
translation: {
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const newSize = Number((Number(z) + preview_size_1.ZOOM_BUTTON_STEP).toFixed(2));
|
|
44
|
+
return { ...z, size: Math.min(preview_size_1.PREVIEW_MAX_ZOOM, newSize) };
|
|
45
|
+
});
|
|
46
|
+
}, [setSize]);
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onZoomOutClicked, style: buttonStyle, title: "Zoom out preview", role: 'ControlButton', type: "button", disabled: size.size !== 'auto' && preview_size_1.PREVIEW_MIN_ZOOM === size.size, children: (0, jsx_runtime_1.jsx)(minus_1.Minus, { style: iconStyle }) }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onZoomInClicked, style: buttonStyle, title: "Zoom in preview", role: 'button', type: "button", disabled: size.size !== 'auto' && preview_size_1.PREVIEW_MAX_ZOOM === size.size, children: (0, jsx_runtime_1.jsx)(plus_1.Plus, { style: iconStyle }) })] }));
|
|
48
|
+
};
|
|
49
|
+
exports.PreviewZoomControls = PreviewZoomControls;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResetZoomButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Button_1 = require("../../preview-server/error-overlay/remotion-overlay/Button");
|
|
6
|
+
const ResetZoomButton = ({ onClick }) => {
|
|
7
|
+
return (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onClick, children: "Reset zoom" });
|
|
8
|
+
};
|
|
9
|
+
exports.ResetZoomButton = ResetZoomButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PreviewSize } from '@remotion/player';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const commonPreviewSizes: PreviewSize[];
|
|
4
|
-
export declare const getPreviewSizeLabel: (previewSize: PreviewSize) =>
|
|
4
|
+
export declare const getPreviewSizeLabel: (previewSize: PreviewSize) => string;
|
|
5
|
+
export declare const getUniqueSizes: (size: PreviewSize) => PreviewSize[];
|
|
5
6
|
export declare const SizeSelector: React.FC;
|
|
@@ -1,30 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SizeSelector = exports.getPreviewSizeLabel = exports.commonPreviewSizes = void 0;
|
|
3
|
+
exports.SizeSelector = exports.getUniqueSizes = exports.getPreviewSizeLabel = exports.commonPreviewSizes = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const Checkmark_1 = require("../icons/Checkmark");
|
|
7
7
|
const preview_size_1 = require("../state/preview-size");
|
|
8
8
|
const ControlButton_1 = require("./ControlButton");
|
|
9
9
|
const ComboBox_1 = require("./NewComposition/ComboBox");
|
|
10
|
-
exports.commonPreviewSizes = [
|
|
10
|
+
exports.commonPreviewSizes = [
|
|
11
|
+
{
|
|
12
|
+
size: 'auto',
|
|
13
|
+
translation: {
|
|
14
|
+
x: 0,
|
|
15
|
+
y: 0,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
size: 0.25,
|
|
20
|
+
translation: {
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
size: 0.5,
|
|
27
|
+
translation: {
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
size: 1,
|
|
34
|
+
translation: {
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 0,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
];
|
|
11
40
|
const getPreviewSizeLabel = (previewSize) => {
|
|
12
|
-
if (previewSize ===
|
|
13
|
-
return '100%';
|
|
14
|
-
}
|
|
15
|
-
if (previewSize === 0.5) {
|
|
16
|
-
return '50%';
|
|
17
|
-
}
|
|
18
|
-
if (previewSize === 0.25) {
|
|
19
|
-
return '25%';
|
|
20
|
-
}
|
|
21
|
-
if (previewSize === 'auto') {
|
|
41
|
+
if (previewSize.size === 'auto') {
|
|
22
42
|
return 'Fit';
|
|
23
43
|
}
|
|
44
|
+
return `${(previewSize.size * 100).toFixed(0)}%`;
|
|
24
45
|
};
|
|
25
46
|
exports.getPreviewSizeLabel = getPreviewSizeLabel;
|
|
26
47
|
const accessibilityLabel = 'Preview Size';
|
|
27
48
|
const comboStyle = { width: 80 };
|
|
49
|
+
const getUniqueSizes = (size) => {
|
|
50
|
+
const customPreviewSizes = [size, ...exports.commonPreviewSizes];
|
|
51
|
+
const uniqueSizes = [];
|
|
52
|
+
customPreviewSizes.forEach((p) => {
|
|
53
|
+
if (!uniqueSizes.find((s) => s.size === p.size)) {
|
|
54
|
+
uniqueSizes.push(p);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return uniqueSizes.sort((a, b) => {
|
|
58
|
+
if (a.size === 'auto') {
|
|
59
|
+
return -1;
|
|
60
|
+
}
|
|
61
|
+
if (b.size === 'auto') {
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
return a.size - b.size;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.getUniqueSizes = getUniqueSizes;
|
|
28
68
|
const SizeSelector = () => {
|
|
29
69
|
const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
|
|
30
70
|
const style = (0, react_1.useMemo)(() => {
|
|
@@ -33,9 +73,9 @@ const SizeSelector = () => {
|
|
|
33
73
|
};
|
|
34
74
|
}, []);
|
|
35
75
|
const items = (0, react_1.useMemo)(() => {
|
|
36
|
-
return exports.
|
|
76
|
+
return (0, exports.getUniqueSizes)(size).map((newSize) => {
|
|
37
77
|
return {
|
|
38
|
-
id: String(newSize),
|
|
78
|
+
id: String(newSize.size),
|
|
39
79
|
label: (0, exports.getPreviewSizeLabel)(newSize),
|
|
40
80
|
onClick: () => {
|
|
41
81
|
return setSize(() => {
|
|
@@ -43,13 +83,13 @@ const SizeSelector = () => {
|
|
|
43
83
|
});
|
|
44
84
|
},
|
|
45
85
|
type: 'item',
|
|
46
|
-
value: newSize,
|
|
47
|
-
keyHint: null,
|
|
48
|
-
leftItem: String(size) === String(newSize) ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
86
|
+
value: newSize.size,
|
|
87
|
+
keyHint: newSize.size ? '0' : null,
|
|
88
|
+
leftItem: String(size.size) === String(newSize.size) ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
|
|
49
89
|
subMenu: null,
|
|
50
90
|
};
|
|
51
91
|
});
|
|
52
92
|
}, [setSize, size]);
|
|
53
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: style, "aria-label": accessibilityLabel, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: accessibilityLabel, style: comboStyle, selectedId: String(size), values: items }) }));
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: style, "aria-label": accessibilityLabel, children: (0, jsx_runtime_1.jsx)(ComboBox_1.Combobox, { title: accessibilityLabel, style: comboStyle, selectedId: String(size.size), values: items }) }));
|
|
54
94
|
};
|
|
55
95
|
exports.SizeSelector = SizeSelector;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Size, Translation } from '@remotion/player';
|
|
2
|
+
export declare const getEffectiveTranslation: ({ canvasSize, scale, compositionHeight, compositionWidth, translation, }: {
|
|
3
|
+
canvasSize: Size;
|
|
4
|
+
scale: number;
|
|
5
|
+
compositionWidth: number;
|
|
6
|
+
compositionHeight: number;
|
|
7
|
+
translation: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
}) => {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const getCenterPointWhileScrolling: ({ size, clientX, clientY, compositionWidth, compositionHeight, scale, translation, }: {
|
|
16
|
+
size: Size;
|
|
17
|
+
clientX: number;
|
|
18
|
+
clientY: number;
|
|
19
|
+
compositionWidth: number;
|
|
20
|
+
compositionHeight: number;
|
|
21
|
+
scale: number;
|
|
22
|
+
translation: Translation;
|
|
23
|
+
}) => {
|
|
24
|
+
centerX: number;
|
|
25
|
+
centerY: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCenterPointWhileScrolling = exports.getEffectiveTranslation = void 0;
|
|
4
|
+
const getEffectiveXTranslation = ({ canvasSize, scale, compositionWidth, translation, }) => {
|
|
5
|
+
const maxTranslation = Math.abs(canvasSize.width / 2 +
|
|
6
|
+
(scale * compositionWidth) / 2 -
|
|
7
|
+
MUST_BE_INSIDE_CANVAS);
|
|
8
|
+
return Math.max(-maxTranslation, Math.min(translation.x, maxTranslation));
|
|
9
|
+
};
|
|
10
|
+
const MUST_BE_INSIDE_CANVAS = 50;
|
|
11
|
+
const getEffectiveYTranslation = ({ canvasSize, scale, compositionHeight, translation, }) => {
|
|
12
|
+
const maxTranslation = Math.abs(canvasSize.height / 2 + (scale * compositionHeight) / 2) -
|
|
13
|
+
MUST_BE_INSIDE_CANVAS;
|
|
14
|
+
return Math.max(-maxTranslation, Math.min(translation.y, maxTranslation));
|
|
15
|
+
};
|
|
16
|
+
const getEffectiveTranslation = ({ canvasSize, scale, compositionHeight, compositionWidth, translation, }) => {
|
|
17
|
+
return {
|
|
18
|
+
x: getEffectiveXTranslation({
|
|
19
|
+
canvasSize,
|
|
20
|
+
compositionWidth,
|
|
21
|
+
scale,
|
|
22
|
+
translation,
|
|
23
|
+
}),
|
|
24
|
+
y: getEffectiveYTranslation({
|
|
25
|
+
canvasSize,
|
|
26
|
+
compositionHeight,
|
|
27
|
+
scale,
|
|
28
|
+
translation,
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.getEffectiveTranslation = getEffectiveTranslation;
|
|
33
|
+
const getCenterPointWhileScrolling = ({ size, clientX, clientY, compositionWidth, compositionHeight, scale, translation, }) => {
|
|
34
|
+
const mouseLeft = clientX - size.left;
|
|
35
|
+
const mouseTop = clientY - size.top;
|
|
36
|
+
const contentLeftPoint = size.width / 2 - (compositionWidth * scale) / 2 - translation.x;
|
|
37
|
+
const contentTopPoint = size.height / 2 - (compositionHeight * scale) / 2 - translation.y;
|
|
38
|
+
const offsetFromVideoLeft = Math.min(compositionWidth, Math.max(0, (mouseLeft - contentLeftPoint) / scale));
|
|
39
|
+
const offsetFromVideoTop = Math.min(compositionHeight, Math.max(0, (mouseTop - contentTopPoint) / scale));
|
|
40
|
+
return {
|
|
41
|
+
centerX: offsetFromVideoLeft,
|
|
42
|
+
centerY: offsetFromVideoTop,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.getCenterPointWhileScrolling = getCenterPointWhileScrolling;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsStill = void 0;
|
|
3
|
+
exports.useDimensions = exports.useIsStill = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const is_composition_still_1 = require("./is-composition-still");
|
|
@@ -13,3 +13,17 @@ const useIsStill = () => {
|
|
|
13
13
|
return (0, is_composition_still_1.isCompositionStill)(selected);
|
|
14
14
|
};
|
|
15
15
|
exports.useIsStill = useIsStill;
|
|
16
|
+
const useDimensions = () => {
|
|
17
|
+
const { compositions, currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
18
|
+
const selected = (0, react_1.useMemo)(() => compositions.find((c) => c.id === currentComposition), [compositions, currentComposition]);
|
|
19
|
+
return (0, react_1.useMemo)(() => {
|
|
20
|
+
if (!selected) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
width: selected.width,
|
|
25
|
+
height: selected.height,
|
|
26
|
+
};
|
|
27
|
+
}, [selected]);
|
|
28
|
+
};
|
|
29
|
+
exports.useDimensions = useDimensions;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeWheel = void 0;
|
|
4
|
+
// Taken from https://github.com/tldraw/tldraw/blob/254dfdfd77c4abde53240f7d8ca3558e08688493/packages/core/src/hooks/useZoomEvents.ts which is adapted from https://stackoverflow.com/a/13650579
|
|
5
|
+
const MAX_ZOOM_STEP = 10;
|
|
6
|
+
function normalizeWheel(event) {
|
|
7
|
+
const { deltaY, deltaX } = event;
|
|
8
|
+
let deltaZ = 0;
|
|
9
|
+
if (event.ctrlKey || event.metaKey) {
|
|
10
|
+
const signY = Math.sign(event.deltaY);
|
|
11
|
+
const absDeltaY = Math.abs(event.deltaY);
|
|
12
|
+
let dy = deltaY;
|
|
13
|
+
if (absDeltaY > MAX_ZOOM_STEP) {
|
|
14
|
+
dy = MAX_ZOOM_STEP * signY;
|
|
15
|
+
}
|
|
16
|
+
deltaZ = dy;
|
|
17
|
+
}
|
|
18
|
+
return { deltaX, deltaY, deltaZ };
|
|
19
|
+
}
|
|
20
|
+
exports.normalizeWheel = normalizeWheel;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { PreviewSize } from '@remotion/player';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
declare type PreviewSizeCtx = {
|
|
4
4
|
size: PreviewSize;
|
|
5
5
|
setSize: (cb: (oldSize: PreviewSize) => PreviewSize) => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const persistPreviewSizeOption: (option: PreviewSize) => void;
|
|
8
8
|
export declare const loadPreviewSizeOption: () => PreviewSize;
|
|
9
|
-
export declare const PreviewSizeContext:
|
|
9
|
+
export declare const PreviewSizeContext: React.Context<PreviewSizeCtx>;
|
|
10
|
+
export declare const PreviewSizeProvider: React.FC<{
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}>;
|
|
10
13
|
export {};
|
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PreviewSizeContext = exports.loadPreviewSizeOption = exports.persistPreviewSizeOption = void 0;
|
|
3
|
+
exports.PreviewSizeProvider = exports.PreviewSizeContext = exports.loadPreviewSizeOption = exports.persistPreviewSizeOption = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const react_1 = require("react");
|
|
6
|
+
const key = 'remotion.previewSize';
|
|
5
7
|
const persistPreviewSizeOption = (option) => {
|
|
6
|
-
localStorage.setItem(
|
|
8
|
+
localStorage.setItem(key, JSON.stringify(option));
|
|
7
9
|
};
|
|
8
10
|
exports.persistPreviewSizeOption = persistPreviewSizeOption;
|
|
9
11
|
const loadPreviewSizeOption = () => {
|
|
10
|
-
const item = localStorage.getItem(
|
|
12
|
+
const item = localStorage.getItem(key);
|
|
11
13
|
if (item === null) {
|
|
12
|
-
return
|
|
14
|
+
return {
|
|
15
|
+
size: 'auto',
|
|
16
|
+
translation: {
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
13
21
|
}
|
|
14
|
-
return item;
|
|
22
|
+
return JSON.parse(item);
|
|
15
23
|
};
|
|
16
24
|
exports.loadPreviewSizeOption = loadPreviewSizeOption;
|
|
17
25
|
exports.PreviewSizeContext = (0, react_1.createContext)({
|
|
18
26
|
setSize: () => undefined,
|
|
19
27
|
size: (0, exports.loadPreviewSizeOption)(),
|
|
20
28
|
});
|
|
29
|
+
const PreviewSizeProvider = ({ children }) => {
|
|
30
|
+
const [size, setSizeState] = (0, react_1.useState)(() => (0, exports.loadPreviewSizeOption)());
|
|
31
|
+
const [translation, setTranslation] = (0, react_1.useState)(() => {
|
|
32
|
+
return {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
const setSize = (0, react_1.useCallback)((newValue) => {
|
|
38
|
+
setSizeState((prevState) => {
|
|
39
|
+
const newVal = newValue(prevState);
|
|
40
|
+
(0, exports.persistPreviewSizeOption)(newVal);
|
|
41
|
+
return newVal;
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
const previewSizeCtx = (0, react_1.useMemo)(() => {
|
|
45
|
+
return {
|
|
46
|
+
size,
|
|
47
|
+
setSize,
|
|
48
|
+
translation,
|
|
49
|
+
setTranslation,
|
|
50
|
+
};
|
|
51
|
+
}, [setSize, size, translation, setTranslation]);
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(exports.PreviewSizeContext.Provider, { value: previewSizeCtx, children: children }));
|
|
53
|
+
};
|
|
54
|
+
exports.PreviewSizeProvider = PreviewSizeProvider;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unsmoothenZoom = exports.smoothenZoom = exports.MAX_ZOOM = exports.MIN_ZOOM = void 0;
|
|
4
|
+
const BASE = Math.E / 4;
|
|
5
|
+
exports.MIN_ZOOM = 0.05;
|
|
6
|
+
exports.MAX_ZOOM = 10;
|
|
7
|
+
function logN(val) {
|
|
8
|
+
return Math.log(val) / Math.log(BASE);
|
|
9
|
+
}
|
|
10
|
+
const smoothenZoom = (input) => {
|
|
11
|
+
return BASE ** (input - 1);
|
|
12
|
+
};
|
|
13
|
+
exports.smoothenZoom = smoothenZoom;
|
|
14
|
+
const unsmoothenZoom = (input) => {
|
|
15
|
+
if (input < 0) {
|
|
16
|
+
return exports.MAX_ZOOM;
|
|
17
|
+
}
|
|
18
|
+
return Math.min(exports.MAX_ZOOM, Math.max(exports.MIN_ZOOM, logN(input) + 1));
|
|
19
|
+
};
|
|
20
|
+
exports.unsmoothenZoom = unsmoothenZoom;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare type Environment = 'development' | 'production';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace NodeJS {
|
|
4
|
+
interface ProcessVersions {
|
|
5
|
+
pnp?: string;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const clearCache: (environment: Environment, inputProps: object | null) => Promise<void>;
|
|
10
|
+
export declare const getWebpackCacheName: (environment: Environment, inputProps: object | null) => string;
|
|
11
|
+
export declare const cacheExists: (environment: Environment, inputProps: object | null) => boolean;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const remotion_1 = require("remotion");
|
|
10
|
+
// Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
|
|
11
|
+
// An algorithm to determine where Webpack will cache the depencies
|
|
12
|
+
const getWebpackCacheDir = () => {
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
let dir = cwd;
|
|
15
|
+
for (;;) {
|
|
16
|
+
try {
|
|
17
|
+
if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
// eslint-disable-next-line no-empty
|
|
21
|
+
}
|
|
22
|
+
catch (e) { }
|
|
23
|
+
const parent = path_1.default.dirname(dir);
|
|
24
|
+
if (dir === parent) {
|
|
25
|
+
dir = undefined;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
dir = parent;
|
|
29
|
+
}
|
|
30
|
+
if (!dir) {
|
|
31
|
+
return path_1.default.resolve(cwd, '.cache/webpack');
|
|
32
|
+
}
|
|
33
|
+
if (process.versions.pnp === '1') {
|
|
34
|
+
return path_1.default.resolve(dir, '.pnp/.cache/webpack');
|
|
35
|
+
}
|
|
36
|
+
if (process.versions.pnp === '3') {
|
|
37
|
+
return path_1.default.resolve(dir, '.yarn/.cache/webpack');
|
|
38
|
+
}
|
|
39
|
+
return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
|
|
40
|
+
};
|
|
41
|
+
const remotionCacheLocation = (environment, inputProps) => {
|
|
42
|
+
return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, inputProps));
|
|
43
|
+
};
|
|
44
|
+
const clearCache = (environment, inputProps) => {
|
|
45
|
+
var _a;
|
|
46
|
+
return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment, inputProps), {
|
|
47
|
+
recursive: true,
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
exports.clearCache = clearCache;
|
|
51
|
+
const getWebpackCacheName = (environment, inputProps) => {
|
|
52
|
+
// In development, let's reset the cache when input props
|
|
53
|
+
// are changing, because they are injected using Webpack and if changed,
|
|
54
|
+
// it will get the cached version
|
|
55
|
+
if (environment === 'development') {
|
|
56
|
+
return `remotion-v3-${environment}-${(0, remotion_1.random)(JSON.stringify(inputProps))}`;
|
|
57
|
+
}
|
|
58
|
+
// In production, the cache is independent from input props because
|
|
59
|
+
// they are passed over URL params. Speed is mostly important in production.
|
|
60
|
+
return `remotion-v3-${environment}`;
|
|
61
|
+
};
|
|
62
|
+
exports.getWebpackCacheName = getWebpackCacheName;
|
|
63
|
+
const cacheExists = (environment, inputProps) => {
|
|
64
|
+
return fs_1.default.existsSync(remotionCacheLocation(environment, inputProps));
|
|
65
|
+
};
|
|
66
|
+
exports.cacheExists = cacheExists;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cli",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.15",
|
|
4
4
|
"description": "CLI for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
24
24
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@remotion/bundler": "3.2.
|
|
27
|
-
"@remotion/media-utils": "3.2.
|
|
28
|
-
"@remotion/player": "3.2.
|
|
29
|
-
"@remotion/renderer": "3.2.
|
|
26
|
+
"@remotion/bundler": "3.2.15",
|
|
27
|
+
"@remotion/media-utils": "3.2.15",
|
|
28
|
+
"@remotion/player": "3.2.15",
|
|
29
|
+
"@remotion/renderer": "3.2.15",
|
|
30
30
|
"better-opn": "2.1.1",
|
|
31
31
|
"dotenv": "9.0.2",
|
|
32
32
|
"memfs": "3.4.3",
|
|
33
33
|
"minimist": "1.2.6",
|
|
34
|
-
"remotion": "3.2.
|
|
34
|
+
"remotion": "3.2.15",
|
|
35
35
|
"semver": "7.3.5",
|
|
36
36
|
"source-map": "0.6.1"
|
|
37
37
|
},
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "7346704683815d274733cb3d280157b9ff570773"
|
|
75
75
|
}
|