@remotion/cli 3.1.11 → 3.2.0

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 (77) hide show
  1. package/dist/editor/components/Editor.js +3 -1
  2. package/dist/editor/components/InitialCompositionLoader.js +13 -0
  3. package/dist/editor/components/PlayPause.js +41 -23
  4. package/dist/editor/components/PreviewToolbar.js +2 -2
  5. package/dist/editor/components/Splitter/SplitterElement.js +1 -0
  6. package/dist/editor/components/TimeValue.js +9 -5
  7. package/dist/editor/components/Timeline/MaxTimelineTracks.d.ts +1 -0
  8. package/dist/editor/components/Timeline/MaxTimelineTracks.js +5 -3
  9. package/dist/editor/components/Timeline/Timeline.js +11 -4
  10. package/dist/editor/components/Timeline/TimelineDragHandler.js +120 -23
  11. package/dist/editor/components/Timeline/TimelineList.js +5 -4
  12. package/dist/editor/components/Timeline/TimelineListItem.d.ts +1 -0
  13. package/dist/editor/components/Timeline/TimelineListItem.js +8 -4
  14. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.d.ts +2 -0
  15. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.js +76 -0
  16. package/dist/editor/components/Timeline/TimelineScrollable.js +4 -2
  17. package/dist/editor/components/Timeline/TimelineSlider.d.ts +3 -0
  18. package/dist/editor/components/Timeline/TimelineSlider.js +35 -2
  19. package/dist/editor/components/Timeline/TimelineSliderHandle.js +1 -3
  20. package/dist/editor/components/Timeline/TimelineTimeIndicators.d.ts +5 -0
  21. package/dist/editor/components/Timeline/TimelineTimeIndicators.js +168 -0
  22. package/dist/editor/components/Timeline/TimelineTracks.js +14 -9
  23. package/dist/editor/components/Timeline/TimelineZoomControls.js +18 -2
  24. package/dist/editor/components/Timeline/imperative-state.d.ts +12 -0
  25. package/dist/editor/components/Timeline/imperative-state.js +39 -0
  26. package/dist/editor/components/Timeline/timeline-refs.d.ts +2 -0
  27. package/dist/editor/components/Timeline/timeline-refs.js +3 -1
  28. package/dist/editor/components/Timeline/timeline-scroll-logic.d.ts +40 -0
  29. package/dist/editor/components/Timeline/timeline-scroll-logic.js +206 -1
  30. package/dist/editor/components/ZoomPersistor.d.ts +4 -0
  31. package/dist/editor/components/ZoomPersistor.js +37 -0
  32. package/dist/editor/helpers/colors.d.ts +1 -0
  33. package/dist/editor/helpers/colors.js +2 -1
  34. package/dist/editor/helpers/get-left-of-timeline-slider.d.ts +1 -0
  35. package/dist/editor/helpers/get-left-of-timeline-slider.js +7 -4
  36. package/dist/editor/helpers/get-timeline-sequence-layout.js +29 -9
  37. package/dist/editor/icons/minus.d.ts +3 -0
  38. package/dist/editor/icons/minus.js +8 -0
  39. package/dist/editor/icons/plus.d.ts +3 -0
  40. package/dist/editor/icons/plus.js +8 -0
  41. package/dist/editor/state/timeline-zoom.d.ts +1 -1
  42. package/dist/editor/state/timeline-zoom.js +15 -1
  43. package/dist/handle-common-errors.js +5 -0
  44. package/dist/preview-server/live-events.js +4 -0
  45. package/dist/preview-server/routes.js +16 -2
  46. package/dist/preview-server/start-server.js +1 -1
  47. package/dist/upgrade.js +1 -0
  48. package/dist/versions.js +1 -0
  49. package/package.json +7 -7
  50. package/dist/bundle-on-cli.d.ts +0 -2
  51. package/dist/bundle-on-cli.js +0 -41
  52. package/dist/bundle.d.ts +0 -1
  53. package/dist/bundle.js +0 -31
  54. package/dist/chalk/symbols.d.ts +0 -111
  55. package/dist/chalk/symbols.js +0 -75
  56. package/dist/chalk/utilities.d.ts +0 -2
  57. package/dist/chalk/utilities.js +0 -37
  58. package/dist/editor/components/CompositionManager.d.ts +0 -4
  59. package/dist/editor/components/CompositionManager.js +0 -60
  60. package/dist/editor/components/LoadingIndicator.d.ts +0 -2
  61. package/dist/editor/components/LoadingIndicator.js +0 -35
  62. package/dist/prepare-entry-point.d.ts +0 -11
  63. package/dist/prepare-entry-point.js +0 -36
  64. package/dist/preview-server/fast-refresh/helpers.d.ts +0 -39
  65. package/dist/preview-server/fast-refresh/helpers.js +0 -145
  66. package/dist/preview-server/fast-refresh/index.d.ts +0 -30
  67. package/dist/preview-server/fast-refresh/index.js +0 -86
  68. package/dist/preview-server/fast-refresh/loader.d.ts +0 -35
  69. package/dist/preview-server/fast-refresh/loader.js +0 -81
  70. package/dist/preview-server/fast-refresh/runtime.d.ts +0 -35
  71. package/dist/preview-server/fast-refresh/runtime.js +0 -32
  72. package/dist/preview-server/static-preview.d.ts +0 -1
  73. package/dist/preview-server/static-preview.js +0 -40
  74. package/dist/preview-server/webpack-cache.d.ts +0 -12
  75. package/dist/preview-server/webpack-cache.js +0 -66
  76. package/dist/webpack-cache.d.ts +0 -12
  77. package/dist/webpack-cache.js +0 -66
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.canScrollTimelineIntoDirection = void 0;
3
+ exports.zoomAndPreserveCursor = exports.getFrameFromX = exports.getFrameWhileScrollingRight = exports.getFrameIncrementFromWidth = exports.getFrameIncrement = exports.getScrollPositionForCursorOnRightEdge = exports.getScrollPositionForCursorOnLeftEdge = exports.scrollToTimelineXOffset = exports.ensureFrameIsInViewport = exports.isCursorInViewport = exports.getFrameWhileScrollingLeft = exports.canScrollTimelineIntoDirection = void 0;
4
+ const remotion_1 = require("remotion");
4
5
  const timeline_layout_1 = require("../../helpers/timeline-layout");
5
6
  const timeline_refs_1 = require("./timeline-refs");
7
+ const TimelineSlider_1 = require("./TimelineSlider");
6
8
  const canScrollTimelineIntoDirection = () => {
7
9
  const current = timeline_refs_1.scrollableRef.current;
8
10
  const { scrollWidth, scrollLeft, clientWidth } = current;
@@ -11,3 +13,206 @@ const canScrollTimelineIntoDirection = () => {
11
13
  return { canScrollRight, canScrollLeft };
12
14
  };
13
15
  exports.canScrollTimelineIntoDirection = canScrollTimelineIntoDirection;
16
+ const SCROLL_INCREMENT = 200;
17
+ const calculateFrameWhileScrollingRight = ({ durationInFrames, width, scrollLeft, }) => {
18
+ var _a;
19
+ return ((0, exports.getFrameFromX)({
20
+ clientX: scrollLeft,
21
+ durationInFrames,
22
+ width,
23
+ extrapolate: 'clamp',
24
+ }) +
25
+ Math.ceil((((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) - timeline_layout_1.TIMELINE_PADDING) /
26
+ (0, exports.getFrameIncrement)(durationInFrames)));
27
+ };
28
+ const getFrameWhileScrollingLeft = ({ durationInFrames, width, }) => {
29
+ var _a, _b;
30
+ const nextFrame = (0, exports.getFrameFromX)({
31
+ clientX: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) - SCROLL_INCREMENT,
32
+ durationInFrames,
33
+ width,
34
+ extrapolate: 'clamp',
35
+ });
36
+ const currentFrame = (0, exports.getFrameFromX)({
37
+ clientX: (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollLeft,
38
+ durationInFrames,
39
+ width,
40
+ extrapolate: 'clamp',
41
+ });
42
+ // Should go back at least 1 frame, but not less than 0
43
+ return Math.max(0, Math.min(currentFrame - 1, nextFrame));
44
+ };
45
+ exports.getFrameWhileScrollingLeft = getFrameWhileScrollingLeft;
46
+ const isCursorInViewport = ({ frame, durationInFrames, }) => {
47
+ var _a, _b, _c, _d;
48
+ const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
49
+ const scrollLeft = (_d = (_c = timeline_refs_1.scrollableRef.current) === null || _c === void 0 ? void 0 : _c.scrollLeft) !== null && _d !== void 0 ? _d : 0;
50
+ const scrollPosOnRightEdge = (0, exports.getScrollPositionForCursorOnRightEdge)({
51
+ nextFrame: frame,
52
+ durationInFrames,
53
+ });
54
+ const scrollPosOnLeftEdge = (0, exports.getScrollPositionForCursorOnLeftEdge)({
55
+ nextFrame: frame,
56
+ durationInFrames,
57
+ });
58
+ const currentFrameRight = calculateFrameWhileScrollingRight({
59
+ durationInFrames,
60
+ scrollLeft,
61
+ width,
62
+ });
63
+ return !(scrollPosOnRightEdge >=
64
+ (0, exports.getScrollPositionForCursorOnRightEdge)({
65
+ nextFrame: currentFrameRight,
66
+ durationInFrames,
67
+ }) || scrollPosOnLeftEdge < scrollLeft);
68
+ };
69
+ exports.isCursorInViewport = isCursorInViewport;
70
+ const ensureFrameIsInViewport = ({ direction, durationInFrames, frame, }) => {
71
+ var _a, _b, _c, _d, _e;
72
+ (_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(frame);
73
+ const width = (_c = (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollWidth) !== null && _c !== void 0 ? _c : 0;
74
+ const scrollLeft = (_e = (_d = timeline_refs_1.scrollableRef.current) === null || _d === void 0 ? void 0 : _d.scrollLeft) !== null && _e !== void 0 ? _e : 0;
75
+ if (direction === 'fit-left') {
76
+ const currentFrameLeft = (0, exports.getFrameFromX)({
77
+ clientX: scrollLeft,
78
+ durationInFrames,
79
+ width,
80
+ extrapolate: 'clamp',
81
+ });
82
+ const scrollPos = (0, exports.getScrollPositionForCursorOnLeftEdge)({
83
+ nextFrame: frame,
84
+ durationInFrames,
85
+ });
86
+ const needsToScrollLeft = scrollPos <=
87
+ (0, exports.getScrollPositionForCursorOnLeftEdge)({
88
+ nextFrame: currentFrameLeft,
89
+ durationInFrames,
90
+ });
91
+ if (needsToScrollLeft) {
92
+ (0, exports.scrollToTimelineXOffset)(scrollPos);
93
+ }
94
+ }
95
+ if (direction === 'fit-right') {
96
+ const currentFrameRight = calculateFrameWhileScrollingRight({
97
+ durationInFrames,
98
+ scrollLeft,
99
+ width,
100
+ });
101
+ const scrollPos = (0, exports.getScrollPositionForCursorOnRightEdge)({
102
+ nextFrame: frame,
103
+ durationInFrames,
104
+ });
105
+ const needsToScrollRight = scrollPos >=
106
+ (0, exports.getScrollPositionForCursorOnRightEdge)({
107
+ nextFrame: currentFrameRight,
108
+ durationInFrames,
109
+ });
110
+ if (needsToScrollRight) {
111
+ (0, exports.scrollToTimelineXOffset)(scrollPos);
112
+ }
113
+ }
114
+ if (direction === 'page-right' || direction === 'page-left') {
115
+ if (!(0, exports.isCursorInViewport)({ frame, durationInFrames })) {
116
+ (0, exports.scrollToTimelineXOffset)(direction === 'page-left'
117
+ ? (0, exports.getScrollPositionForCursorOnRightEdge)({
118
+ nextFrame: frame,
119
+ durationInFrames,
120
+ })
121
+ : (0, exports.getScrollPositionForCursorOnLeftEdge)({
122
+ nextFrame: frame,
123
+ durationInFrames,
124
+ }));
125
+ }
126
+ }
127
+ if (direction === 'center') {
128
+ const scrollPosOnRightEdge = (0, exports.getScrollPositionForCursorOnRightEdge)({
129
+ nextFrame: frame,
130
+ durationInFrames,
131
+ });
132
+ const scrollPosOnLeftEdge = (0, exports.getScrollPositionForCursorOnLeftEdge)({
133
+ nextFrame: frame,
134
+ durationInFrames,
135
+ });
136
+ (0, exports.scrollToTimelineXOffset)((scrollPosOnLeftEdge + scrollPosOnRightEdge) / 2);
137
+ }
138
+ };
139
+ exports.ensureFrameIsInViewport = ensureFrameIsInViewport;
140
+ const scrollToTimelineXOffset = (scrollPos) => {
141
+ var _a;
142
+ (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scroll({
143
+ left: scrollPos,
144
+ });
145
+ };
146
+ exports.scrollToTimelineXOffset = scrollToTimelineXOffset;
147
+ const getScrollPositionForCursorOnLeftEdge = ({ nextFrame, durationInFrames, }) => {
148
+ const frameIncrement = (0, exports.getFrameIncrement)(durationInFrames);
149
+ const scrollPos = frameIncrement * nextFrame;
150
+ return scrollPos;
151
+ };
152
+ exports.getScrollPositionForCursorOnLeftEdge = getScrollPositionForCursorOnLeftEdge;
153
+ const getScrollPositionForCursorOnRightEdge = ({ nextFrame, durationInFrames, }) => {
154
+ var _a, _b;
155
+ const frameIncrement = (0, exports.getFrameIncrement)(durationInFrames);
156
+ const framesRemaining = durationInFrames - 1 - nextFrame;
157
+ const fromRight = framesRemaining * frameIncrement + timeline_layout_1.TIMELINE_PADDING;
158
+ const scrollPos = ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) -
159
+ fromRight -
160
+ ((_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) +
161
+ timeline_layout_1.TIMELINE_PADDING +
162
+ 4; // clearfix;
163
+ return scrollPos;
164
+ };
165
+ exports.getScrollPositionForCursorOnRightEdge = getScrollPositionForCursorOnRightEdge;
166
+ const getFrameIncrement = (durationInFrames) => {
167
+ var _a, _b;
168
+ const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
169
+ return (0, exports.getFrameIncrementFromWidth)(durationInFrames, width);
170
+ };
171
+ exports.getFrameIncrement = getFrameIncrement;
172
+ const getFrameIncrementFromWidth = (durationInFrames, width) => {
173
+ return (width - timeline_layout_1.TIMELINE_PADDING * 2) / (durationInFrames - 1);
174
+ };
175
+ exports.getFrameIncrementFromWidth = getFrameIncrementFromWidth;
176
+ const getFrameWhileScrollingRight = ({ durationInFrames, width, }) => {
177
+ var _a, _b;
178
+ const nextFrame = calculateFrameWhileScrollingRight({
179
+ durationInFrames,
180
+ width,
181
+ scrollLeft: ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) + SCROLL_INCREMENT,
182
+ });
183
+ const currentFrame = calculateFrameWhileScrollingRight({
184
+ durationInFrames,
185
+ width,
186
+ scrollLeft: (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.scrollLeft,
187
+ });
188
+ // Should scroll by at least 1 frame, but not overshoot duration
189
+ return Math.min(durationInFrames - 1, Math.max(nextFrame, currentFrame + 1));
190
+ };
191
+ exports.getFrameWhileScrollingRight = getFrameWhileScrollingRight;
192
+ const getFrameFromX = ({ clientX, durationInFrames, width, extrapolate, }) => {
193
+ var _a;
194
+ const pos = clientX - timeline_layout_1.TIMELINE_PADDING;
195
+ const frame = Math.round((0, remotion_1.interpolate)(pos, [0, width - timeline_layout_1.TIMELINE_PADDING * 2], [0, (_a = durationInFrames - 1) !== null && _a !== void 0 ? _a : 0], {
196
+ extrapolateLeft: extrapolate,
197
+ extrapolateRight: extrapolate,
198
+ }));
199
+ return frame;
200
+ };
201
+ exports.getFrameFromX = getFrameFromX;
202
+ const zoomAndPreserveCursor = ({ oldZoom, newZoom, currentFrame, currentDurationInFrames, }) => {
203
+ var _a, _b, _c;
204
+ const ratio = newZoom / oldZoom;
205
+ if (ratio === 1) {
206
+ return;
207
+ }
208
+ const { current } = timeline_refs_1.scrollableRef;
209
+ if (!current) {
210
+ return;
211
+ }
212
+ const frameIncrement = (0, exports.getFrameIncrement)(currentDurationInFrames);
213
+ const prevCursorPosition = frameIncrement * currentFrame + timeline_layout_1.TIMELINE_PADDING;
214
+ const newCursorPosition = ratio * (prevCursorPosition - timeline_layout_1.TIMELINE_PADDING) + timeline_layout_1.TIMELINE_PADDING;
215
+ current.scrollLeft += newCursorPosition - prevCursorPosition;
216
+ (_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(currentFrame, ((_c = (_b = timeline_refs_1.scrollableRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) !== null && _c !== void 0 ? _c : 0) * ratio);
217
+ };
218
+ exports.zoomAndPreserveCursor = zoomAndPreserveCursor;
@@ -0,0 +1,4 @@
1
+ import type React from 'react';
2
+ export declare const persistCurrentZoom: (zoom: number) => void;
3
+ export declare const getZoomForComposition: (composition: string) => number;
4
+ export declare const ZoomPersistor: React.FC;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZoomPersistor = exports.getZoomForComposition = exports.persistCurrentZoom = void 0;
4
+ const react_1 = require("react");
5
+ const remotion_1 = require("remotion");
6
+ const timeline_zoom_1 = require("../state/timeline-zoom");
7
+ const FramePersistor_1 = require("./FramePersistor");
8
+ const makeKey = (composition) => {
9
+ return `remotion.zoom.${composition}`;
10
+ };
11
+ const persistCurrentZoom = (zoom) => {
12
+ const currentComposition = (0, FramePersistor_1.getCurrentCompositionFromUrl)();
13
+ if (!currentComposition) {
14
+ return;
15
+ }
16
+ localStorage.setItem(makeKey(currentComposition), String(zoom));
17
+ };
18
+ exports.persistCurrentZoom = persistCurrentZoom;
19
+ const getZoomForComposition = (composition) => {
20
+ const zoom = localStorage.getItem(makeKey(composition));
21
+ return zoom ? Number(zoom) : 0;
22
+ };
23
+ exports.getZoomForComposition = getZoomForComposition;
24
+ const ZoomPersistor = () => {
25
+ const [playing] = remotion_1.Internals.Timeline.usePlayingState();
26
+ const { zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
27
+ const { currentComposition } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
28
+ const isActive = currentComposition === (0, FramePersistor_1.getCurrentCompositionFromUrl)();
29
+ (0, react_1.useEffect)(() => {
30
+ if (!isActive) {
31
+ return;
32
+ }
33
+ (0, exports.persistCurrentZoom)(zoom);
34
+ }, [zoom, isActive, playing]);
35
+ return null;
36
+ };
37
+ exports.ZoomPersistor = ZoomPersistor;
@@ -8,6 +8,7 @@ export declare const SELECTED_HOVER_BACKGROUND = "hsla(0, 0%, 100%, 0.25)";
8
8
  export declare const CLEAR_HOVER = "rgba(255, 255, 255, 0.06)";
9
9
  export declare const INPUT_BORDER_COLOR_UNHOVERED = "rgba(0, 0, 0, 0.6)";
10
10
  export declare const INPUT_BORDER_COLOR_HOVERED = "rgba(255, 255, 255, 0.05)";
11
+ export declare const TIMELINE_BACKGROUND = "#111";
11
12
  export declare const getBackgroundFromHoverState: ({ selected, hovered, }: {
12
13
  selected: boolean;
13
14
  hovered: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBackgroundFromHoverState = exports.INPUT_BORDER_COLOR_HOVERED = exports.INPUT_BORDER_COLOR_UNHOVERED = exports.CLEAR_HOVER = exports.SELECTED_HOVER_BACKGROUND = exports.LIGHT_TEXT = exports.SELECTED_BACKGROUND = exports.LIGHT_COLOR = exports.BORDER_COLOR = exports.INPUT_BACKGROUND = exports.BACKGROUND = void 0;
3
+ exports.getBackgroundFromHoverState = exports.TIMELINE_BACKGROUND = exports.INPUT_BORDER_COLOR_HOVERED = exports.INPUT_BORDER_COLOR_UNHOVERED = exports.CLEAR_HOVER = exports.SELECTED_HOVER_BACKGROUND = exports.LIGHT_TEXT = exports.SELECTED_BACKGROUND = exports.LIGHT_COLOR = exports.BORDER_COLOR = exports.INPUT_BACKGROUND = exports.BACKGROUND = void 0;
4
4
  exports.BACKGROUND = '#1f2428';
5
5
  exports.INPUT_BACKGROUND = '#2f363d';
6
6
  exports.BORDER_COLOR = '#000';
@@ -11,6 +11,7 @@ exports.SELECTED_HOVER_BACKGROUND = 'hsla(0, 0%, 100%, 0.25)';
11
11
  exports.CLEAR_HOVER = 'rgba(255, 255, 255, 0.06)';
12
12
  exports.INPUT_BORDER_COLOR_UNHOVERED = 'rgba(0, 0, 0, 0.6)';
13
13
  exports.INPUT_BORDER_COLOR_HOVERED = 'rgba(255, 255, 255, 0.05)';
14
+ exports.TIMELINE_BACKGROUND = '#111';
14
15
  const getBackgroundFromHoverState = ({ selected, hovered, }) => {
15
16
  if (selected) {
16
17
  if (hovered) {
@@ -2,3 +2,4 @@ export declare const useGetXPositionOfItemInTimeline: () => {
2
2
  get: (frame: number) => number;
3
3
  width: number;
4
4
  };
5
+ export declare const getXPositionOfItemInTimelineImperatively: (frame: number, duration: number, width: number) => number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useGetXPositionOfItemInTimeline = void 0;
3
+ exports.getXPositionOfItemInTimelineImperatively = exports.useGetXPositionOfItemInTimeline = void 0;
4
4
  const player_1 = require("@remotion/player");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
@@ -18,12 +18,15 @@ const useGetXPositionOfItemInTimeline = () => {
18
18
  if (!videoConfig) {
19
19
  return 0;
20
20
  }
21
- return ((frame / (videoConfig.durationInFrames - 1)) *
22
- (width - timeline_layout_1.TIMELINE_PADDING * 2) +
23
- timeline_layout_1.TIMELINE_PADDING);
21
+ return (0, exports.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, width);
24
22
  }, [videoConfig, width]);
25
23
  return (0, react_1.useMemo)(() => {
26
24
  return { get, width };
27
25
  }, [get, width]);
28
26
  };
29
27
  exports.useGetXPositionOfItemInTimeline = useGetXPositionOfItemInTimeline;
28
+ const getXPositionOfItemInTimelineImperatively = (frame, duration, width) => {
29
+ const proportion = frame / (duration - 1);
30
+ return proportion * (width - timeline_layout_1.TIMELINE_PADDING * 2) + timeline_layout_1.TIMELINE_PADDING;
31
+ };
32
+ exports.getXPositionOfItemInTimelineImperatively = getXPositionOfItemInTimelineImperatively;
@@ -3,23 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTimelineSequenceLayout = exports.SEQUENCE_BORDER_WIDTH = void 0;
4
4
  const timeline_layout_1 = require("./timeline-layout");
5
5
  exports.SEQUENCE_BORDER_WIDTH = 1;
6
+ const getWidthOfTrack = ({ durationInFrames, lastFrame, windowWidth, spatialDuration, nonNegativeMarginLeft, }) => {
7
+ const fullWidth = windowWidth - timeline_layout_1.TIMELINE_PADDING * 2;
8
+ const base = durationInFrames === Infinity || lastFrame === 0
9
+ ? fullWidth
10
+ : (spatialDuration / lastFrame) * fullWidth;
11
+ return base - exports.SEQUENCE_BORDER_WIDTH + nonNegativeMarginLeft;
12
+ };
6
13
  const getTimelineSequenceLayout = ({ durationInFrames, startFrom, maxMediaDuration, startFromMedia, video, windowWidth, }) => {
7
14
  var _a;
8
15
  const maxMediaSequenceDuration = (maxMediaDuration !== null && maxMediaDuration !== void 0 ? maxMediaDuration : Infinity) - startFromMedia;
9
- const spatialDuration = Math.min(maxMediaSequenceDuration, durationInFrames - 1);
16
+ let spatialDuration = Math.min(maxMediaSequenceDuration, durationInFrames - 1);
10
17
  const lastFrame = ((_a = video.durationInFrames) !== null && _a !== void 0 ? _a : 1) - 1;
18
+ const shouldAddHalfAFrameAtEnd = startFrom + durationInFrames < lastFrame;
19
+ const shouldAddHalfAFrameAtStart = startFrom > 0;
20
+ if (shouldAddHalfAFrameAtEnd) {
21
+ spatialDuration += 0.5;
22
+ }
23
+ if (shouldAddHalfAFrameAtStart) {
24
+ spatialDuration += 0.5;
25
+ }
26
+ const startFromWithOffset = shouldAddHalfAFrameAtStart
27
+ ? startFrom - 0.5
28
+ : startFrom;
11
29
  const marginLeft = lastFrame === 0
12
30
  ? 0
13
- : (startFrom / lastFrame) * (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2);
14
- const negativeMarginLeft = Math.min(marginLeft, 0);
15
- const width = (durationInFrames === Infinity || lastFrame === 0
16
- ? windowWidth - timeline_layout_1.TIMELINE_PADDING * 2
17
- : (spatialDuration / lastFrame) * (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2)) -
18
- exports.SEQUENCE_BORDER_WIDTH +
19
- negativeMarginLeft;
31
+ : (startFromWithOffset / lastFrame) *
32
+ (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2);
33
+ const nonNegativeMarginLeft = Math.min(marginLeft, 0);
20
34
  return {
21
35
  marginLeft: Math.round(Math.max(marginLeft, 0)),
22
- width: Math.floor(width),
36
+ width: Math.floor(getWidthOfTrack({
37
+ durationInFrames,
38
+ lastFrame,
39
+ nonNegativeMarginLeft,
40
+ spatialDuration,
41
+ windowWidth,
42
+ })),
23
43
  };
24
44
  };
25
45
  exports.getTimelineSequenceLayout = getTimelineSequenceLayout;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const Minus: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Minus = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Minus = (props) => {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z" }) }));
7
+ };
8
+ exports.Minus = Minus;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ export declare const Plus: React.FC<SVGProps<SVGSVGElement>>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Plus = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Plus = (props) => {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", children: (0, jsx_runtime_1.jsx)("path", { fill: "currentColor", d: "M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z" }) }));
7
+ };
8
+ exports.Plus = Plus;
@@ -3,7 +3,7 @@ export declare const TIMELINE_MIN_ZOOM = 1;
3
3
  export declare const TIMELINE_MAX_ZOOM = 5;
4
4
  export declare const TimelineZoomCtx: React.Context<{
5
5
  zoom: number;
6
- setZoom: React.Dispatch<React.SetStateAction<number>>;
6
+ setZoom: (prev: (prevZoom: number) => number) => void;
7
7
  }>;
8
8
  export declare const TimelineZoomContext: React.FC<{
9
9
  children: React.ReactNode;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineZoomContext = exports.TimelineZoomCtx = exports.TIMELINE_MAX_ZOOM = exports.TIMELINE_MIN_ZOOM = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const imperative_state_1 = require("../components/Timeline/imperative-state");
7
+ const timeline_scroll_logic_1 = require("../components/Timeline/timeline-scroll-logic");
6
8
  exports.TIMELINE_MIN_ZOOM = 1;
7
9
  exports.TIMELINE_MAX_ZOOM = 5;
8
10
  exports.TimelineZoomCtx = (0, react_1.createContext)({
@@ -16,7 +18,19 @@ const TimelineZoomContext = ({ children }) => {
16
18
  const value = (0, react_1.useMemo)(() => {
17
19
  return {
18
20
  zoom,
19
- setZoom,
21
+ setZoom: (callback) => {
22
+ setZoom((prevZoom) => {
23
+ const newZoomWithFloatingPointErrors = Math.min(exports.TIMELINE_MAX_ZOOM, Math.max(exports.TIMELINE_MIN_ZOOM, callback(prevZoom)));
24
+ const newZoom = Math.round(newZoomWithFloatingPointErrors * 10) / 10;
25
+ (0, timeline_scroll_logic_1.zoomAndPreserveCursor)({
26
+ oldZoom: prevZoom,
27
+ newZoom,
28
+ currentDurationInFrames: (0, imperative_state_1.getCurrentDuration)(),
29
+ currentFrame: (0, imperative_state_1.getCurrentFrame)(),
30
+ });
31
+ return newZoom;
32
+ });
33
+ },
20
34
  };
21
35
  }, [zoom]);
22
36
  return ((0, jsx_runtime_1.jsx)(exports.TimelineZoomCtx.Provider, { value: value, children: children }));
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleCommonError = void 0;
4
+ const chalk_1 = require("./chalk");
4
5
  const log_1 = require("./log");
5
6
  const print_error_1 = require("./print-error");
6
7
  const handleCommonError = async (err) => {
@@ -21,5 +22,9 @@ const handleCommonError = async (err) => {
21
22
  log_1.Log.info();
22
23
  log_1.Log.info('💡 Get help for this issue at https://remotion.dev/docs/enametoolong');
23
24
  }
25
+ if (err.message.includes('The bucket does not allow ACLs')) {
26
+ log_1.Log.info();
27
+ log_1.Log.info(chalk_1.chalk.green('💡 Fix this issue https://remotion.dev/docs/lambda/troubleshooting/bucket-disallows-acl'));
28
+ }
24
29
  };
25
30
  exports.handleCommonError = handleCommonError;
@@ -13,6 +13,10 @@ const makeLiveEventsRouter = () => {
13
13
  'cache-control': 'no-cache',
14
14
  };
15
15
  response.writeHead(200, headers);
16
+ if (request.method === 'OPTIONS') {
17
+ response.end();
18
+ return;
19
+ }
16
20
  response.write(serializeMessage({ type: 'init' }));
17
21
  const clientId = String(Math.random());
18
22
  const newClient = {
@@ -43,7 +43,12 @@ const handleProjectInfo = async (remotionRoot, _, response) => {
43
43
  response.writeHead(200);
44
44
  response.end(JSON.stringify(data));
45
45
  };
46
- const handleFileSource = async (remotionRoot, search, _, response) => {
46
+ const handleFileSource = async ({ method, remotionRoot, search, response, }) => {
47
+ if (method === 'OPTIONS') {
48
+ response.writeHead(200);
49
+ response.end();
50
+ return;
51
+ }
47
52
  if (!search.startsWith('?')) {
48
53
  throw new Error('query must start with ?');
49
54
  }
@@ -58,6 +63,10 @@ const handleFileSource = async (remotionRoot, search, _, response) => {
58
63
  return response.end();
59
64
  };
60
65
  const handleOpenInEditor = async (remotionRoot, req, res) => {
66
+ if (req.method === 'OPTIONS') {
67
+ res.statusCode = 200;
68
+ res.end();
69
+ }
61
70
  try {
62
71
  const b = await new Promise((_resolve) => {
63
72
  let data = '';
@@ -114,7 +123,12 @@ const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, g
114
123
  return handleProjectInfo(remotionRoot, request, response);
115
124
  }
116
125
  if (url.pathname === '/api/file-source') {
117
- return handleFileSource(remotionRoot, url.search, request, response);
126
+ return handleFileSource({
127
+ remotionRoot,
128
+ search: url.search,
129
+ method: request.method,
130
+ response,
131
+ });
118
132
  }
119
133
  if (url.pathname === '/api/open-in-editor') {
120
134
  return handleOpenInEditor(remotionRoot, request, response);
@@ -53,7 +53,7 @@ const startServer = async (entry, userDefinedComponent, options) => {
53
53
  });
54
54
  })
55
55
  .then(() => {
56
- (0, routes_1.handleRoutes)({
56
+ return (0, routes_1.handleRoutes)({
57
57
  hash,
58
58
  hashPrefix,
59
59
  request,
package/dist/upgrade.js CHANGED
@@ -37,6 +37,7 @@ const upgrade = async (remotionRoot) => {
37
37
  '@remotion/eslint-config',
38
38
  '@remotion/renderer',
39
39
  '@remotion/skia',
40
+ '@remotion/lottie',
40
41
  '@remotion/media-utils',
41
42
  '@remotion/babel-loader',
42
43
  '@remotion/lambda',
package/dist/versions.js CHANGED
@@ -16,6 +16,7 @@ const packages = [
16
16
  '@remotion/eslint-config',
17
17
  '@remotion/renderer',
18
18
  '@remotion/skia',
19
+ '@remotion/lottie',
19
20
  '@remotion/media-utils',
20
21
  '@remotion/babel-loader',
21
22
  '@remotion/lambda',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.1.11",
3
+ "version": "3.2.0",
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.1.11",
27
- "@remotion/media-utils": "3.1.11",
28
- "@remotion/player": "3.1.11",
29
- "@remotion/renderer": "3.1.11",
26
+ "@remotion/bundler": "3.2.0",
27
+ "@remotion/media-utils": "3.2.0",
28
+ "@remotion/player": "3.2.0",
29
+ "@remotion/renderer": "3.2.0",
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.1.11",
34
+ "remotion": "3.2.0",
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": "bc4184c9faf944a3bac2fd56bdf990cc74e3ec94"
74
+ "gitHead": "47b188161a9e922a247eaa998e72d37af9137707"
75
75
  }
@@ -1,2 +0,0 @@
1
- import { RenderStep } from './step';
2
- export declare const bundleOnCli: (fullPath: string, steps: RenderStep[]) => Promise<string>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bundleOnCli = void 0;
4
- const bundler_1 = require("@remotion/bundler");
5
- const remotion_1 = require("remotion");
6
- const log_1 = require("./log");
7
- const parse_command_line_1 = require("./parse-command-line");
8
- const progress_bar_1 = require("./progress-bar");
9
- const bundleOnCli = async (fullPath, steps) => {
10
- var _a;
11
- const shouldCache = remotion_1.Internals.getWebpackCaching();
12
- const cacheExistedBefore = bundler_1.BundlerInternals.cacheExists('production', null);
13
- if (cacheExistedBefore && !shouldCache) {
14
- log_1.Log.info('🧹 Cache disabled but found. Deleting... ');
15
- await bundler_1.BundlerInternals.clearCache('production', null);
16
- }
17
- const bundleStartTime = Date.now();
18
- const bundlingProgress = (0, progress_bar_1.createOverwriteableCliOutput)((0, parse_command_line_1.quietFlagProvided)());
19
- const bundled = await (0, bundler_1.bundle)(fullPath, (progress) => {
20
- bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
21
- progress: progress / 100,
22
- steps,
23
- doneIn: null,
24
- }));
25
- }, {
26
- enableCaching: shouldCache,
27
- webpackOverride: (_a = remotion_1.Internals.getWebpackOverrideFn()) !== null && _a !== void 0 ? _a : remotion_1.Internals.defaultOverrideFunction,
28
- });
29
- bundlingProgress.update((0, progress_bar_1.makeBundlingProgress)({
30
- progress: 1,
31
- steps,
32
- doneIn: Date.now() - bundleStartTime,
33
- }) + '\n');
34
- log_1.Log.verbose('Bundled under', bundled);
35
- const cacheExistedAfter = bundler_1.BundlerInternals.cacheExists('production', null);
36
- if (cacheExistedAfter && !cacheExistedBefore) {
37
- log_1.Log.info('⚡️ Cached bundle. Subsequent renders will be faster.');
38
- }
39
- return bundled;
40
- };
41
- exports.bundleOnCli = bundleOnCli;
package/dist/bundle.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const bundleCommand: () => Promise<void>;