@remotion/cli 3.1.11 → 3.2.2

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 (106) hide show
  1. package/dist/bundle.d.ts +1 -1
  2. package/dist/bundle.js +3 -2
  3. package/dist/config/bundle-out-dir.d.ts +2 -0
  4. package/dist/config/bundle-out-dir.js +12 -0
  5. package/dist/config/enforce-audio-track.d.ts +2 -0
  6. package/dist/config/enforce-audio-track.js +13 -0
  7. package/dist/config/get-public-path.d.ts +2 -0
  8. package/dist/config/get-public-path.js +12 -0
  9. package/dist/config/index.d.ts +4 -0
  10. package/dist/config/index.js +8 -0
  11. package/dist/config/muted.d.ts +2 -0
  12. package/dist/config/muted.js +13 -0
  13. package/dist/editor/components/Editor.js +3 -1
  14. package/dist/editor/components/InitialCompositionLoader.js +13 -0
  15. package/dist/editor/components/Notifications/ServerDisconnected.d.ts +5 -0
  16. package/dist/editor/components/Notifications/ServerDisconnected.js +56 -0
  17. package/dist/editor/components/PlayPause.js +41 -23
  18. package/dist/editor/components/PreviewToolbar.js +2 -2
  19. package/dist/editor/components/Splitter/SplitterElement.js +1 -0
  20. package/dist/editor/components/TimeValue.js +9 -5
  21. package/dist/editor/components/Timeline/MaxTimelineTracks.d.ts +1 -0
  22. package/dist/editor/components/Timeline/MaxTimelineTracks.js +5 -3
  23. package/dist/editor/components/Timeline/Timeline.js +11 -4
  24. package/dist/editor/components/Timeline/TimelineDragHandler.js +120 -23
  25. package/dist/editor/components/Timeline/TimelineList.js +5 -4
  26. package/dist/editor/components/Timeline/TimelineListItem.d.ts +1 -0
  27. package/dist/editor/components/Timeline/TimelineListItem.js +8 -4
  28. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.d.ts +2 -0
  29. package/dist/editor/components/Timeline/TimelinePlayCursorSyncer.js +76 -0
  30. package/dist/editor/components/Timeline/TimelineScrollable.js +4 -2
  31. package/dist/editor/components/Timeline/TimelineSlider.d.ts +3 -0
  32. package/dist/editor/components/Timeline/TimelineSlider.js +35 -2
  33. package/dist/editor/components/Timeline/TimelineSliderHandle.js +1 -3
  34. package/dist/editor/components/Timeline/TimelineTimeIndicators.d.ts +5 -0
  35. package/dist/editor/components/Timeline/TimelineTimeIndicators.js +168 -0
  36. package/dist/editor/components/Timeline/TimelineTracks.js +14 -9
  37. package/dist/editor/components/Timeline/TimelineZoomControls.js +18 -2
  38. package/dist/editor/components/Timeline/imperative-state.d.ts +12 -0
  39. package/dist/editor/components/Timeline/imperative-state.js +39 -0
  40. package/dist/editor/components/Timeline/timeline-refs.d.ts +2 -0
  41. package/dist/editor/components/Timeline/timeline-refs.js +3 -1
  42. package/dist/editor/components/Timeline/timeline-scroll-logic.d.ts +40 -0
  43. package/dist/editor/components/Timeline/timeline-scroll-logic.js +206 -1
  44. package/dist/editor/components/ZoomPersistor.d.ts +4 -0
  45. package/dist/editor/components/ZoomPersistor.js +37 -0
  46. package/dist/editor/helpers/colors.d.ts +2 -1
  47. package/dist/editor/helpers/colors.js +2 -1
  48. package/dist/editor/helpers/get-left-of-timeline-slider.d.ts +1 -0
  49. package/dist/editor/helpers/get-left-of-timeline-slider.js +7 -4
  50. package/dist/editor/helpers/get-timeline-sequence-layout.js +29 -9
  51. package/dist/editor/icons/minus.d.ts +3 -0
  52. package/dist/editor/icons/minus.js +8 -0
  53. package/dist/editor/icons/plus.d.ts +3 -0
  54. package/dist/editor/icons/plus.js +8 -0
  55. package/dist/editor/state/timeline-zoom.d.ts +1 -1
  56. package/dist/editor/state/timeline-zoom.js +15 -1
  57. package/dist/event-source.js +6 -0
  58. package/dist/get-cli-options.d.ts +2 -0
  59. package/dist/get-cli-options.js +2 -0
  60. package/dist/handle-common-errors.js +5 -0
  61. package/dist/index.d.ts +2 -0
  62. package/dist/parse-command-line.d.ts +2 -0
  63. package/dist/parse-command-line.js +8 -0
  64. package/dist/prepare-entry-point.d.ts +3 -2
  65. package/dist/prepare-entry-point.js +3 -2
  66. package/dist/preview-server/error-overlay/react-overlay/listen-to-runtime-errors.js +9 -1
  67. package/dist/preview-server/error-overlay/remotion-overlay/Button.js +1 -1
  68. package/dist/preview-server/error-overlay/remotion-overlay/CodeFrame.js +2 -0
  69. package/dist/preview-server/error-overlay/remotion-overlay/ErrorMessage.js +4 -2
  70. package/dist/preview-server/error-overlay/remotion-overlay/ErrorTitle.js +1 -1
  71. package/dist/preview-server/error-overlay/remotion-overlay/StackFrame.js +3 -1
  72. package/dist/preview-server/get-package-manager.d.ts +1 -0
  73. package/dist/preview-server/get-package-manager.js +8 -1
  74. package/dist/preview-server/live-events.js +4 -0
  75. package/dist/preview-server/routes.js +19 -2
  76. package/dist/preview-server/start-server.js +1 -1
  77. package/dist/previewEntry.js +6 -0
  78. package/dist/progress-bar.js +7 -2
  79. package/dist/render.js +3 -1
  80. package/dist/upgrade.js +1 -0
  81. package/dist/versions.js +1 -0
  82. package/package.json +7 -7
  83. package/dist/bundle-on-cli.d.ts +0 -2
  84. package/dist/bundle-on-cli.js +0 -41
  85. package/dist/chalk/symbols.d.ts +0 -111
  86. package/dist/chalk/symbols.js +0 -75
  87. package/dist/chalk/utilities.d.ts +0 -2
  88. package/dist/chalk/utilities.js +0 -37
  89. package/dist/editor/components/CompositionManager.d.ts +0 -4
  90. package/dist/editor/components/CompositionManager.js +0 -60
  91. package/dist/editor/components/LoadingIndicator.d.ts +0 -2
  92. package/dist/editor/components/LoadingIndicator.js +0 -35
  93. package/dist/preview-server/fast-refresh/helpers.d.ts +0 -39
  94. package/dist/preview-server/fast-refresh/helpers.js +0 -145
  95. package/dist/preview-server/fast-refresh/index.d.ts +0 -30
  96. package/dist/preview-server/fast-refresh/index.js +0 -86
  97. package/dist/preview-server/fast-refresh/loader.d.ts +0 -35
  98. package/dist/preview-server/fast-refresh/loader.js +0 -81
  99. package/dist/preview-server/fast-refresh/runtime.d.ts +0 -35
  100. package/dist/preview-server/fast-refresh/runtime.js +0 -32
  101. package/dist/preview-server/static-preview.d.ts +0 -1
  102. package/dist/preview-server/static-preview.js +0 -40
  103. package/dist/preview-server/webpack-cache.d.ts +0 -12
  104. package/dist/preview-server/webpack-cache.js +0 -66
  105. package/dist/webpack-cache.d.ts +0 -12
  106. package/dist/webpack-cache.js +0 -66
@@ -8,41 +8,38 @@ const remotion_1 = require("remotion");
8
8
  const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
9
9
  const timeline_layout_1 = require("../../helpers/timeline-layout");
10
10
  const in_out_1 = require("../../state/in-out");
11
+ const timeline_zoom_1 = require("../../state/timeline-zoom");
11
12
  const FramePersistor_1 = require("../FramePersistor");
12
13
  const timeline_refs_1 = require("./timeline-refs");
14
+ const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
13
15
  const TimelineInOutPointer_1 = require("./TimelineInOutPointer");
14
16
  const TimelineInOutPointerHandle_1 = require("./TimelineInOutPointerHandle");
17
+ const TimelineSlider_1 = require("./TimelineSlider");
15
18
  const inner = {
16
19
  overflowY: 'auto',
17
20
  overflowX: 'hidden',
18
21
  };
19
22
  const container = {
20
23
  userSelect: 'none',
21
- overflow: 'hidden',
22
24
  position: 'absolute',
23
- width: '100%',
24
25
  height: '100%',
26
+ top: 0,
25
27
  };
26
- const getFrameFromX = (clientX, durationInFrames, width, extrapolate) => {
28
+ const getClientXWithScroll = (x) => {
27
29
  var _a;
28
- const pos = clientX - timeline_layout_1.TIMELINE_PADDING;
29
- 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], {
30
- extrapolateLeft: extrapolate,
31
- extrapolateRight: extrapolate,
32
- }));
33
- return frame;
30
+ return x + ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft);
34
31
  };
35
32
  const TimelineDragHandler = () => {
36
- var _a, _b;
37
- const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.sliderAreaRef, {
33
+ var _a, _b, _c;
34
+ const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
38
35
  triggerOnWindowResize: true,
39
36
  shouldApplyCssTransforms: true,
40
37
  });
41
38
  const [inOutDragging, setInOutDragging] = (0, react_1.useState)({
42
39
  dragging: false,
43
40
  });
44
- const width = (_a = size === null || size === void 0 ? void 0 : size.width) !== null && _a !== void 0 ? _a : 0;
45
- const left = (_b = size === null || size === void 0 ? void 0 : size.left) !== null && _b !== void 0 ? _b : 0;
41
+ const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
42
+ const left = (_c = size === null || size === void 0 ? void 0 : size.left) !== null && _c !== void 0 ? _c : 0;
46
43
  const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
47
44
  const { setInAndOutFrames } = (0, in_out_1.useTimelineSetInOutFramePosition)();
48
45
  const { get } = (0, get_left_of_timeline_slider_1.useGetXPositionOfItemInTimeline)();
@@ -51,7 +48,15 @@ const TimelineDragHandler = () => {
51
48
  });
52
49
  const { playing, play, pause, seek } = player_1.PlayerInternals.usePlayer();
53
50
  const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
51
+ const scroller = (0, react_1.useRef)(null);
52
+ const stopInterval = () => {
53
+ if (scroller.current) {
54
+ clearInterval(scroller.current);
55
+ scroller.current = null;
56
+ }
57
+ };
54
58
  const onPointerDown = (0, react_1.useCallback)((e) => {
59
+ stopInterval();
55
60
  if (!videoConfig) {
56
61
  return;
57
62
  }
@@ -63,7 +68,7 @@ const TimelineDragHandler = () => {
63
68
  const outMarker = outFrame === null ? Infinity : get(outFrame - 1);
64
69
  setInOutDragging({
65
70
  dragging: 'in',
66
- initialOffset: e.clientX,
71
+ initialOffset: getClientXWithScroll(e.clientX),
67
72
  boundaries: [-Infinity, outMarker - inMarker],
68
73
  });
69
74
  return;
@@ -76,12 +81,17 @@ const TimelineDragHandler = () => {
76
81
  const inMarker = inFrame === null ? -Infinity : get(inFrame + 1);
77
82
  setInOutDragging({
78
83
  dragging: 'out',
79
- initialOffset: e.clientX,
84
+ initialOffset: getClientXWithScroll(e.clientX),
80
85
  boundaries: [inMarker - outMarker, Infinity],
81
86
  });
82
87
  return;
83
88
  }
84
- const frame = getFrameFromX(e.clientX - left, videoConfig.durationInFrames, width, 'clamp');
89
+ const frame = (0, timeline_scroll_logic_1.getFrameFromX)({
90
+ clientX: getClientXWithScroll(e.clientX) - left,
91
+ durationInFrames: videoConfig.durationInFrames,
92
+ width,
93
+ extrapolate: 'clamp',
94
+ });
85
95
  seek(frame);
86
96
  setDragging({
87
97
  dragging: true,
@@ -90,15 +100,84 @@ const TimelineDragHandler = () => {
90
100
  pause();
91
101
  }, [videoConfig, left, width, seek, playing, pause, outFrame, get, inFrame]);
92
102
  const onPointerMoveScrubbing = (0, react_1.useCallback)((e) => {
103
+ var _a;
93
104
  if (!videoConfig) {
94
105
  return;
95
106
  }
96
107
  if (!dragging.dragging) {
97
108
  return;
98
109
  }
99
- const frame = getFrameFromX(e.clientX - left, videoConfig.durationInFrames, width, 'clamp');
100
- seek(frame);
101
- }, [dragging.dragging, seek, left, videoConfig, width]);
110
+ const isRightOfArea = e.clientX >=
111
+ ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) +
112
+ left -
113
+ timeline_layout_1.TIMELINE_PADDING;
114
+ const isLeftOfArea = e.clientX <= left;
115
+ const frame = (0, timeline_scroll_logic_1.getFrameFromX)({
116
+ clientX: getClientXWithScroll(e.clientX) - left,
117
+ durationInFrames: videoConfig.durationInFrames,
118
+ width,
119
+ extrapolate: 'clamp',
120
+ });
121
+ if (isLeftOfArea && (0, timeline_scroll_logic_1.canScrollTimelineIntoDirection)().canScrollLeft) {
122
+ if (scroller.current) {
123
+ return;
124
+ }
125
+ const scrollEvery = () => {
126
+ var _a;
127
+ if (!(0, timeline_scroll_logic_1.canScrollTimelineIntoDirection)().canScrollLeft) {
128
+ stopInterval();
129
+ return;
130
+ }
131
+ const nextFrame = (0, timeline_scroll_logic_1.getFrameWhileScrollingLeft)({
132
+ durationInFrames: videoConfig.durationInFrames,
133
+ width,
134
+ });
135
+ const scrollPos = (0, timeline_scroll_logic_1.getScrollPositionForCursorOnLeftEdge)({
136
+ nextFrame,
137
+ durationInFrames: videoConfig.durationInFrames,
138
+ });
139
+ (_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(nextFrame);
140
+ seek(nextFrame);
141
+ (0, timeline_scroll_logic_1.scrollToTimelineXOffset)(scrollPos);
142
+ };
143
+ scrollEvery();
144
+ scroller.current = setInterval(() => {
145
+ scrollEvery();
146
+ }, 100);
147
+ }
148
+ else if (isRightOfArea &&
149
+ (0, timeline_scroll_logic_1.canScrollTimelineIntoDirection)().canScrollRight) {
150
+ if (scroller.current) {
151
+ return;
152
+ }
153
+ const scrollEvery = () => {
154
+ var _a;
155
+ if (!(0, timeline_scroll_logic_1.canScrollTimelineIntoDirection)().canScrollRight) {
156
+ stopInterval();
157
+ return;
158
+ }
159
+ const nextFrame = (0, timeline_scroll_logic_1.getFrameWhileScrollingRight)({
160
+ durationInFrames: videoConfig.durationInFrames,
161
+ width,
162
+ });
163
+ const scrollPos = (0, timeline_scroll_logic_1.getScrollPositionForCursorOnRightEdge)({
164
+ nextFrame,
165
+ durationInFrames: videoConfig.durationInFrames,
166
+ });
167
+ (_a = TimelineSlider_1.redrawTimelineSliderFast.current) === null || _a === void 0 ? void 0 : _a.draw(nextFrame);
168
+ seek(nextFrame);
169
+ (0, timeline_scroll_logic_1.scrollToTimelineXOffset)(scrollPos);
170
+ };
171
+ scrollEvery();
172
+ scroller.current = setInterval(() => {
173
+ scrollEvery();
174
+ }, 100);
175
+ }
176
+ else {
177
+ stopInterval();
178
+ seek(frame);
179
+ }
180
+ }, [videoConfig, dragging.dragging, left, width, seek]);
102
181
  const onPointerMoveInOut = (0, react_1.useCallback)((e) => {
103
182
  if (!videoConfig) {
104
183
  return;
@@ -106,7 +185,7 @@ const TimelineDragHandler = () => {
106
185
  if (!inOutDragging.dragging) {
107
186
  return;
108
187
  }
109
- const offset = Math.max(inOutDragging.boundaries[0], Math.min(inOutDragging.boundaries[1], e.clientX - inOutDragging.initialOffset));
188
+ const offset = Math.max(inOutDragging.boundaries[0], Math.min(inOutDragging.boundaries[1], getClientXWithScroll(e.clientX) - inOutDragging.initialOffset));
110
189
  if (inOutDragging.dragging === 'in') {
111
190
  if (!TimelineInOutPointerHandle_1.inPointerHandle.current) {
112
191
  throw new Error('in pointer handle');
@@ -139,6 +218,7 @@ const TimelineDragHandler = () => {
139
218
  }
140
219
  }, [get, inFrame, inOutDragging, outFrame, videoConfig, width]);
141
220
  const onPointerUpScrubbing = (0, react_1.useCallback)((e) => {
221
+ stopInterval();
142
222
  if (!videoConfig) {
143
223
  return;
144
224
  }
@@ -148,7 +228,12 @@ const TimelineDragHandler = () => {
148
228
  setDragging({
149
229
  dragging: false,
150
230
  });
151
- const frame = getFrameFromX(e.clientX - left, videoConfig.durationInFrames, width, 'clamp');
231
+ const frame = (0, timeline_scroll_logic_1.getFrameFromX)({
232
+ clientX: getClientXWithScroll(e.clientX) - left,
233
+ durationInFrames: videoConfig.durationInFrames,
234
+ width,
235
+ extrapolate: 'clamp',
236
+ });
152
237
  (0, FramePersistor_1.persistCurrentFrame)(frame);
153
238
  if (dragging.wasPlaying) {
154
239
  play();
@@ -164,7 +249,12 @@ const TimelineDragHandler = () => {
164
249
  setInOutDragging({
165
250
  dragging: false,
166
251
  });
167
- const frame = getFrameFromX(e.clientX - left, videoConfig.durationInFrames, width, 'extend');
252
+ const frame = (0, timeline_scroll_logic_1.getFrameFromX)({
253
+ clientX: getClientXWithScroll(e.clientX) - left,
254
+ durationInFrames: videoConfig.durationInFrames,
255
+ width,
256
+ extrapolate: 'extend',
257
+ });
168
258
  if (inOutDragging.dragging === 'in') {
169
259
  if (frame < 1) {
170
260
  return setInAndOutFrames((prev) => ({
@@ -222,6 +312,13 @@ const TimelineDragHandler = () => {
222
312
  window.removeEventListener('pointerup', onPointerUpInOut);
223
313
  };
224
314
  }, [inOutDragging.dragging, onPointerMoveInOut, onPointerUpInOut]);
225
- return ((0, jsx_runtime_1.jsxs)("div", { ref: timeline_refs_1.sliderAreaRef, style: container, onPointerDown: onPointerDown, children: [(0, jsx_runtime_1.jsx)("div", { style: inner }), inFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "in", atFrame: inFrame, dragging: inOutDragging.dragging === 'in' })), outFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "out", dragging: inOutDragging.dragging === 'out', atFrame: outFrame }))] }));
315
+ const { zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
316
+ const containerStyle = (0, react_1.useMemo)(() => {
317
+ return {
318
+ ...container,
319
+ width: 100 * zoom + '%',
320
+ };
321
+ }, [zoom]);
322
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, onPointerDown: onPointerDown, children: [(0, jsx_runtime_1.jsx)("div", { style: inner }), inFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "in", atFrame: inFrame, dragging: inOutDragging.dragging === 'in' })), outFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "out", dragging: inOutDragging.dragging === 'out', atFrame: outFrame }))] }));
226
323
  };
227
324
  exports.TimelineDragHandler = TimelineDragHandler;
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const colors_1 = require("../../helpers/colors");
6
6
  const is_collapsed_1 = require("./is-collapsed");
7
7
  const TimelineListItem_1 = require("./TimelineListItem");
8
+ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
8
9
  const container = {
9
10
  flex: 1,
10
11
  display: 'flex',
@@ -12,9 +13,9 @@ const container = {
12
13
  background: colors_1.BACKGROUND,
13
14
  };
14
15
  const TimelineList = ({ timeline, viewState, dispatchStateChange }) => {
15
- return ((0, jsx_runtime_1.jsx)("div", { style: container, children: timeline.map((track, i) => {
16
- const beforeDepth = i === 0 ? 0 : timeline[i - 1].depth;
17
- return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(TimelineListItem_1.TimelineListItem, { hash: track.hash, dispatchStateChange: dispatchStateChange, collapsed: (0, is_collapsed_1.isTrackCollapsed)(track.hash, viewState), nestedDepth: track.depth, sequence: track.sequence, beforeDepth: beforeDepth, canCollapse: track.canCollapse }, track.sequence.id) }, track.sequence.id));
18
- }) }));
16
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track, i) => {
17
+ const beforeDepth = i === 0 ? 0 : timeline[i - 1].depth;
18
+ return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(TimelineListItem_1.TimelineListItem, { hash: track.hash, dispatchStateChange: dispatchStateChange, collapsed: (0, is_collapsed_1.isTrackCollapsed)(track.hash, viewState), nestedDepth: track.depth, sequence: track.sequence, beforeDepth: beforeDepth, canCollapse: track.canCollapse }, track.sequence.id) }, track.sequence.id));
19
+ }), (0, jsx_runtime_1.jsx)(TimelineTimeIndicators_1.TimelineTimePlaceholders, {})] }));
19
20
  };
20
21
  exports.TimelineList = TimelineList;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { TSequence } from 'remotion';
3
3
  import type { TimelineActionState } from './timeline-state-reducer';
4
+ export declare const TOTAL_TIMELINE_LAYER_LEFT_PADDING: number;
4
5
  export declare const TimelineListItem: React.FC<{
5
6
  sequence: TSequence;
6
7
  nestedDepth: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineListItem = void 0;
3
+ exports.TimelineListItem = exports.TOTAL_TIMELINE_LAYER_LEFT_PADDING = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const timeline_layout_1 = require("../../helpers/timeline-layout");
@@ -10,6 +10,10 @@ const TimelineSequenceFrame_1 = require("./TimelineSequenceFrame");
10
10
  const HOOK_WIDTH = 7;
11
11
  const BORDER_BOTTOM_LEFT_RADIUS = 2;
12
12
  const SPACING = 5;
13
+ const TIMELINE_LAYER_PADDING = HOOK_WIDTH + SPACING * 1.5;
14
+ const TIMELINE_COLLAPSER_WIDTH = 8;
15
+ const TIMELINE_COLLAPSER_MARGIN_RIGHT = 10;
16
+ exports.TOTAL_TIMELINE_LAYER_LEFT_PADDING = TIMELINE_COLLAPSER_WIDTH + TIMELINE_COLLAPSER_MARGIN_RIGHT + timeline_layout_1.TIMELINE_PADDING;
13
17
  const textStyle = {
14
18
  fontSize: 13,
15
19
  };
@@ -44,9 +48,9 @@ const smallSpace = {
44
48
  width: SPACING * 0.5,
45
49
  };
46
50
  const collapser = {
47
- width: 8,
51
+ width: TIMELINE_COLLAPSER_WIDTH,
48
52
  userSelect: 'none',
49
- marginRight: 10,
53
+ marginRight: TIMELINE_COLLAPSER_MARGIN_RIGHT,
50
54
  };
51
55
  const collapserButton = {
52
56
  ...collapser,
@@ -55,7 +59,7 @@ const collapserButton = {
55
59
  };
56
60
  const TimelineListItem = ({ nestedDepth, sequence, collapsed, beforeDepth, dispatchStateChange, hash, canCollapse, }) => {
57
61
  const { tabIndex } = (0, z_index_1.useZIndex)();
58
- const leftOffset = HOOK_WIDTH + SPACING * 1.5;
62
+ const leftOffset = TIMELINE_LAYER_PADDING;
59
63
  const hookStyle = (0, react_1.useMemo)(() => {
60
64
  return {
61
65
  ...hook,
@@ -0,0 +1,2 @@
1
+ import type React from 'react';
2
+ export declare const TimelinePlayCursorSyncer: React.FC;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelinePlayCursorSyncer = 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 imperative_state_1 = require("./imperative-state");
8
+ const timeline_refs_1 = require("./timeline-refs");
9
+ const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
10
+ let lastTimelinePositionWhileScrolling = null;
11
+ const TimelinePlayCursorSyncer = () => {
12
+ var _a, _b, _c;
13
+ const video = remotion_1.Internals.useVideo();
14
+ const timelineContext = (0, react_1.useContext)(remotion_1.Internals.Timeline.TimelineContext);
15
+ const { zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
16
+ (0, imperative_state_1.setCurrentFrame)(timelineContext.frame);
17
+ (0, imperative_state_1.setCurrentZoom)(zoom);
18
+ (0, imperative_state_1.setCurrentDuration)((_a = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _a !== void 0 ? _a : 1);
19
+ (0, imperative_state_1.setCurrentFps)((_b = video === null || video === void 0 ? void 0 : video.fps) !== null && _b !== void 0 ? _b : 1);
20
+ const playing = (_c = timelineContext.playing) !== null && _c !== void 0 ? _c : false;
21
+ /**
22
+ * While playing (forwards or backwards), jump one viewport width to the left or right when the cursor goes out of the viewport.
23
+ */
24
+ (0, react_1.useEffect)(() => {
25
+ if (!video) {
26
+ return;
27
+ }
28
+ if (!playing) {
29
+ return;
30
+ }
31
+ (0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
32
+ direction: timelineContext.playbackRate > 0 ? 'page-right' : 'page-left',
33
+ durationInFrames: video.durationInFrames,
34
+ frame: timelineContext.frame,
35
+ });
36
+ }, [playing, timelineContext, video]);
37
+ /**
38
+ * Restore state if `enter` is being pressed
39
+ */
40
+ (0, react_1.useEffect)(() => {
41
+ const { current } = timeline_refs_1.scrollableRef;
42
+ if (!current) {
43
+ return;
44
+ }
45
+ if (playing) {
46
+ lastTimelinePositionWhileScrolling = {
47
+ scrollLeft: current.scrollLeft,
48
+ frame: (0, imperative_state_1.getCurrentFrame)(),
49
+ zoomLevel: (0, imperative_state_1.getCurrentZoom)(),
50
+ durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
51
+ };
52
+ }
53
+ else if (lastTimelinePositionWhileScrolling !== null) {
54
+ if ((0, timeline_scroll_logic_1.isCursorInViewport)({
55
+ frame: (0, imperative_state_1.getCurrentFrame)(),
56
+ durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
57
+ })) {
58
+ return;
59
+ }
60
+ if (lastTimelinePositionWhileScrolling.zoomLevel === (0, imperative_state_1.getCurrentZoom)() &&
61
+ lastTimelinePositionWhileScrolling.durationInFrames ===
62
+ (0, imperative_state_1.getCurrentDuration)()) {
63
+ current.scrollLeft = lastTimelinePositionWhileScrolling.scrollLeft;
64
+ }
65
+ else {
66
+ (0, timeline_scroll_logic_1.ensureFrameIsInViewport)({
67
+ direction: 'center',
68
+ durationInFrames: (0, imperative_state_1.getCurrentDuration)(),
69
+ frame: lastTimelinePositionWhileScrolling.frame,
70
+ });
71
+ }
72
+ }
73
+ }, [playing]);
74
+ return null;
75
+ };
76
+ exports.TimelinePlayCursorSyncer = TimelinePlayCursorSyncer;
@@ -3,19 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineScrollable = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const colors_1 = require("../../helpers/colors");
6
7
  const timeline_refs_1 = require("./timeline-refs");
7
8
  const outer = {
8
9
  width: '100%',
9
10
  height: '100%',
10
11
  overflowX: 'auto',
12
+ overflowY: 'hidden',
11
13
  position: 'relative',
12
- backgroundColor: '#111',
14
+ backgroundColor: colors_1.TIMELINE_BACKGROUND,
13
15
  };
14
16
  const TimelineScrollable = ({ children }) => {
15
17
  const containerStyle = (0, react_1.useMemo)(() => {
16
18
  return {
17
19
  width: '100%',
18
- height: '100%',
20
+ minHeight: '100%',
19
21
  };
20
22
  }, []);
21
23
  return ((0, jsx_runtime_1.jsx)("div", { ref: timeline_refs_1.scrollableRef, style: outer, children: (0, jsx_runtime_1.jsx)("div", { style: containerStyle, children: children }) }));
@@ -1,2 +1,5 @@
1
1
  import React from 'react';
2
+ export declare const redrawTimelineSliderFast: React.RefObject<{
3
+ draw: (frame: number, width?: number) => void;
4
+ }>;
2
5
  export declare const TimelineSlider: React.FC;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineSlider = void 0;
3
+ exports.TimelineSlider = exports.redrawTimelineSliderFast = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
7
  const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
8
+ const imperative_state_1 = require("./imperative-state");
9
+ const timeline_refs_1 = require("./timeline-refs");
8
10
  const TimelineSliderHandle_1 = require("./TimelineSliderHandle");
9
11
  const container = {
10
12
  position: 'absolute',
@@ -18,9 +20,11 @@ const line = {
18
20
  position: 'fixed',
19
21
  backgroundColor: '#f02c00',
20
22
  };
23
+ exports.redrawTimelineSliderFast = (0, react_1.createRef)();
21
24
  const TimelineSlider = () => {
22
25
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
23
26
  const { get } = (0, get_left_of_timeline_slider_1.useGetXPositionOfItemInTimeline)();
27
+ const ref = (0, react_1.useRef)(null);
24
28
  const style = (0, react_1.useMemo)(() => {
25
29
  const left = get(timelinePosition);
26
30
  return {
@@ -28,6 +32,35 @@ const TimelineSlider = () => {
28
32
  transform: `translateX(${left}px)`,
29
33
  };
30
34
  }, [timelinePosition, get]);
31
- return ((0, jsx_runtime_1.jsx)("div", { style: style, children: (0, jsx_runtime_1.jsx)("div", { style: line, children: (0, jsx_runtime_1.jsx)(TimelineSliderHandle_1.TimelineSliderHandle, {}) }) }));
35
+ (0, react_1.useImperativeHandle)(exports.redrawTimelineSliderFast, () => {
36
+ return {
37
+ draw: (frame, width) => {
38
+ var _a, _b;
39
+ const { current } = ref;
40
+ if (!current) {
41
+ throw new Error('unexpectedly did not have ref to timelineslider');
42
+ }
43
+ current.style.transform = `translateX(${(0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, (0, imperative_state_1.getCurrentDuration)(), (_b = width !== null && width !== void 0 ? width : (_a = timeline_refs_1.sliderAreaRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0)}px)`;
44
+ },
45
+ };
46
+ });
47
+ (0, react_1.useEffect)(() => {
48
+ const currentRef = ref.current;
49
+ if (!currentRef) {
50
+ return;
51
+ }
52
+ const { current } = timeline_refs_1.timelineVerticalScroll;
53
+ if (!current) {
54
+ return;
55
+ }
56
+ const onScroll = () => {
57
+ currentRef.style.top = current.scrollTop + 'px';
58
+ };
59
+ current.addEventListener('scroll', onScroll);
60
+ return () => {
61
+ current.removeEventListener('scroll', onScroll);
62
+ };
63
+ }, []);
64
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: style, children: [(0, jsx_runtime_1.jsx)("div", { style: line }), (0, jsx_runtime_1.jsx)(TimelineSliderHandle_1.TimelineSliderHandle, {})] }));
32
65
  };
33
66
  exports.TimelineSlider = TimelineSlider;
@@ -6,11 +6,9 @@ const container = {
6
6
  width: 20,
7
7
  height: 20,
8
8
  position: 'fixed',
9
- };
10
- const style = {
11
9
  marginLeft: -8,
12
10
  };
13
11
  const TimelineSliderHandle = () => {
14
- return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)("svg", { width: 17, viewBox: "0 0 159 212", version: "1.1", style: style, children: (0, jsx_runtime_1.jsx)("path", { d: "M17.0234375,1.07763419 L143.355469,1.07763419 C151.63974,1.07763419 158.355469,7.79336295 158.355469,16.0776342 L158.355469,69.390507 C158.355469,73.7938677 156.420655,77.9748242 153.064021,80.8248415 L89.3980057,134.881757 C83.7986799,139.635978 75.5802263,139.635978 69.9809005,134.881757 L6.66764807,81.1243622 C3.0872392,78.0843437 1.0234375,73.6246568 1.0234375,68.9277387 L1.0234375,17.0776342 C1.0234375,8.2410782 8.1868815,1.07763419 17.0234375,1.07763419 Z", fill: "#f02c00" }) }) }));
12
+ return ((0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)("svg", { width: 17, viewBox: "0 0 159 212", version: "1.1", children: (0, jsx_runtime_1.jsx)("path", { d: "M17.0234375,1.07763419 L143.355469,1.07763419 C151.63974,1.07763419 158.355469,7.79336295 158.355469,16.0776342 L158.355469,69.390507 C158.355469,73.7938677 156.420655,77.9748242 153.064021,80.8248415 L89.3980057,134.881757 C83.7986799,139.635978 75.5802263,139.635978 69.9809005,134.881757 L6.66764807,81.1243622 C3.0872392,78.0843437 1.0234375,73.6246568 1.0234375,68.9277387 L1.0234375,17.0776342 C1.0234375,8.2410782 8.1868815,1.07763419 17.0234375,1.07763419 Z", fill: "#f02c00" }) }) }));
15
13
  };
16
14
  exports.TimelineSliderHandle = TimelineSliderHandle;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const TIMELINE_TIME_INDICATOR_HEIGHT = 30;
3
+ export declare const TimelineTimePlaceholders: React.FC;
4
+ export declare const TimelineTimePadding: React.FC;
5
+ export declare const TimelineTimeIndicators: React.FC;