@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,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;
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineTimeIndicators = exports.TimelineTimePadding = exports.TimelineTimePlaceholders = exports.TIMELINE_TIME_INDICATOR_HEIGHT = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const player_1 = require("@remotion/player");
6
+ const react_1 = require("react");
7
+ const remotion_1 = require("remotion");
8
+ const colors_1 = require("../../helpers/colors");
9
+ const timeline_layout_1 = require("../../helpers/timeline-layout");
10
+ const render_frame_1 = require("../../state/render-frame");
11
+ const TimeValue_1 = require("../TimeValue");
12
+ const timeline_refs_1 = require("./timeline-refs");
13
+ const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
14
+ const TimelineListItem_1 = require("./TimelineListItem");
15
+ exports.TIMELINE_TIME_INDICATOR_HEIGHT = 30;
16
+ const container = {
17
+ height: exports.TIMELINE_TIME_INDICATOR_HEIGHT - 4,
18
+ boxShadow: `0 0 4px ${colors_1.TIMELINE_BACKGROUND}`,
19
+ position: 'absolute',
20
+ backgroundColor: colors_1.TIMELINE_BACKGROUND,
21
+ top: 0,
22
+ left: 0,
23
+ };
24
+ const tick = {
25
+ width: 1,
26
+ backgroundColor: 'rgba(255, 255, 255, 0.15)',
27
+ height: 20,
28
+ position: 'absolute',
29
+ };
30
+ const secondTick = {
31
+ ...tick,
32
+ height: 15,
33
+ };
34
+ const tickLabel = {
35
+ fontSize: 12,
36
+ marginLeft: 8,
37
+ marginTop: 7,
38
+ color: colors_1.LIGHT_TEXT,
39
+ };
40
+ const timeValue = {
41
+ height: exports.TIMELINE_TIME_INDICATOR_HEIGHT,
42
+ position: 'absolute',
43
+ top: 0,
44
+ width: '100%',
45
+ paddingLeft: TimelineListItem_1.TOTAL_TIMELINE_LAYER_LEFT_PADDING,
46
+ boxShadow: `0 0 20px ${colors_1.BACKGROUND}`,
47
+ display: 'flex',
48
+ alignItems: 'center',
49
+ background: colors_1.BACKGROUND,
50
+ };
51
+ const TimelineTimePlaceholders = () => {
52
+ const ref = (0, react_1.useRef)(null);
53
+ (0, react_1.useEffect)(() => {
54
+ const currentRef = ref.current;
55
+ if (!currentRef) {
56
+ return;
57
+ }
58
+ const { current } = timeline_refs_1.timelineVerticalScroll;
59
+ if (!current) {
60
+ return;
61
+ }
62
+ const onScroll = () => {
63
+ currentRef.style.top = current.scrollTop + 'px';
64
+ };
65
+ current.addEventListener('scroll', onScroll);
66
+ return () => {
67
+ current.removeEventListener('scroll', onScroll);
68
+ };
69
+ }, []);
70
+ return ((0, jsx_runtime_1.jsx)("div", { ref: ref, style: timeValue, children: (0, jsx_runtime_1.jsx)(TimeValue_1.TimeValue, {}) }));
71
+ };
72
+ exports.TimelineTimePlaceholders = TimelineTimePlaceholders;
73
+ const TimelineTimePadding = () => {
74
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
75
+ height: exports.TIMELINE_TIME_INDICATOR_HEIGHT,
76
+ } }));
77
+ };
78
+ exports.TimelineTimePadding = TimelineTimePadding;
79
+ const TimelineTimeIndicators = () => {
80
+ var _a;
81
+ const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.sliderAreaRef, {
82
+ triggerOnWindowResize: false,
83
+ shouldApplyCssTransforms: true,
84
+ });
85
+ const video = remotion_1.Internals.useVideo();
86
+ const windowWidth = (_a = size === null || size === void 0 ? void 0 : size.width) !== null && _a !== void 0 ? _a : 0;
87
+ const ref = (0, react_1.useRef)(null);
88
+ (0, react_1.useEffect)(() => {
89
+ const currentRef = ref.current;
90
+ if (!currentRef) {
91
+ return;
92
+ }
93
+ const { current } = timeline_refs_1.timelineVerticalScroll;
94
+ if (!current) {
95
+ return;
96
+ }
97
+ const onScroll = () => {
98
+ currentRef.style.top = current.scrollTop + 'px';
99
+ };
100
+ current.addEventListener('scroll', onScroll);
101
+ return () => {
102
+ current.removeEventListener('scroll', onScroll);
103
+ };
104
+ }, []);
105
+ const style = (0, react_1.useMemo)(() => {
106
+ return {
107
+ ...container,
108
+ width: windowWidth,
109
+ overflow: 'hidden',
110
+ };
111
+ }, [windowWidth]);
112
+ const ticks = (0, react_1.useMemo)(() => {
113
+ if (!video) {
114
+ return [];
115
+ }
116
+ const frameInterval = (0, timeline_scroll_logic_1.getFrameIncrementFromWidth)(video.durationInFrames, windowWidth);
117
+ const MIN_SPACING_BETWEEN_TICKS_PX = 5;
118
+ const seconds = Math.floor(video.durationInFrames / video.fps);
119
+ const secondMarkerEveryNth = Math.ceil((MIN_SPACING_BETWEEN_TICKS_PX * video.fps) / (frameInterval * video.fps));
120
+ const frameMarkerEveryNth = Math.ceil(MIN_SPACING_BETWEEN_TICKS_PX / frameInterval);
121
+ // Big ticks showing for every second
122
+ const secondTicks = new Array(seconds)
123
+ .fill(true)
124
+ .map((_, index) => {
125
+ return {
126
+ frame: index * video.fps,
127
+ style: {
128
+ ...secondTick,
129
+ left: frameInterval * index * video.fps + timeline_layout_1.TIMELINE_PADDING,
130
+ },
131
+ showTime: index > 0,
132
+ };
133
+ })
134
+ .filter((_, idx) => idx % secondMarkerEveryNth === 0);
135
+ const frameTicks = new Array(video.durationInFrames)
136
+ .fill(true)
137
+ .map((_, index) => {
138
+ return {
139
+ frame: index,
140
+ style: {
141
+ ...tick,
142
+ left: frameInterval * index + timeline_layout_1.TIMELINE_PADDING,
143
+ height: index % video.fps === 0
144
+ ? 10
145
+ : (index / frameMarkerEveryNth) % 2 === 0
146
+ ? 5
147
+ : 2,
148
+ },
149
+ showTime: false,
150
+ };
151
+ })
152
+ .filter((_, idx) => idx % frameMarkerEveryNth === 0);
153
+ // Merge and deduplicate ticks
154
+ const hasTicks = [];
155
+ return [...secondTicks, ...frameTicks].filter((t) => {
156
+ const alreadyUsed = hasTicks.find((ht) => ht === t.frame) !== undefined;
157
+ hasTicks.push(t.frame);
158
+ return !alreadyUsed;
159
+ });
160
+ }, [video, windowWidth]);
161
+ if (!video) {
162
+ return null;
163
+ }
164
+ return ((0, jsx_runtime_1.jsx)("div", { ref: ref, style: style, children: ticks.map((t) => {
165
+ return ((0, jsx_runtime_1.jsx)("div", { style: t.style, children: t.showTime ? ((0, jsx_runtime_1.jsx)("div", { style: tickLabel, children: (0, render_frame_1.renderFrame)(t.frame, video.fps) })) : null }, t.frame));
166
+ }) }));
167
+ };
168
+ exports.TimelineTimeIndicators = TimelineTimeIndicators;
@@ -7,14 +7,13 @@ const timeline_layout_1 = require("../../helpers/timeline-layout");
7
7
  const is_collapsed_1 = require("./is-collapsed");
8
8
  const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
9
9
  const TimelineSequence_1 = require("./TimelineSequence");
10
+ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
10
11
  const content = {
11
12
  paddingLeft: timeline_layout_1.TIMELINE_PADDING,
12
13
  paddingRight: timeline_layout_1.TIMELINE_PADDING,
13
14
  };
14
15
  const timelineContent = {
15
- flex: 1,
16
- backgroundColor: '#111111',
17
- width: '100%',
16
+ minHeight: '100%',
18
17
  };
19
18
  const TimelineTracks = ({ timeline, fps, viewState, hasBeenCut }) => {
20
19
  const inner = (0, react_1.useMemo)(() => {
@@ -22,11 +21,17 @@ const TimelineTracks = ({ timeline, fps, viewState, hasBeenCut }) => {
22
21
  height: timeline_layout_1.TIMELINE_LAYER_HEIGHT + timeline_layout_1.TIMELINE_BORDER * 2,
23
22
  };
24
23
  }, []);
25
- return ((0, jsx_runtime_1.jsxs)("div", { style: timelineContent, children: [(0, jsx_runtime_1.jsx)("div", { style: content, children: timeline.map((track) => {
26
- if ((0, is_collapsed_1.isTrackHidden)(track, timeline, viewState)) {
27
- return null;
28
- }
29
- return ((0, jsx_runtime_1.jsx)("div", { style: inner, children: (0, jsx_runtime_1.jsx)(TimelineSequence_1.TimelineSequence, { fps: fps, s: track.sequence }) }, track.sequence.id));
30
- }) }), hasBeenCut ? (0, jsx_runtime_1.jsx)(MaxTimelineTracks_1.MaxTimelineTracksReached, {}) : null] }));
24
+ const timelineStyle = (0, react_1.useMemo)(() => {
25
+ return {
26
+ ...timelineContent,
27
+ width: 100 + '%',
28
+ };
29
+ }, []);
30
+ return ((0, jsx_runtime_1.jsxs)("div", { style: timelineStyle, children: [(0, jsx_runtime_1.jsxs)("div", { style: content, children: [(0, jsx_runtime_1.jsx)(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => {
31
+ if ((0, is_collapsed_1.isTrackHidden)(track, timeline, viewState)) {
32
+ return null;
33
+ }
34
+ return ((0, jsx_runtime_1.jsx)("div", { style: inner, children: (0, jsx_runtime_1.jsx)(TimelineSequence_1.TimelineSequence, { fps: fps, s: track.sequence }) }, track.sequence.id));
35
+ }), (0, jsx_runtime_1.jsx)(TimelineTimeIndicators_1.TimelineTimeIndicators, {})] }), hasBeenCut ? (0, jsx_runtime_1.jsx)(MaxTimelineTracks_1.MaxTimelineTracksReached, {}) : null] }));
31
36
  };
32
37
  exports.TimelineTracks = TimelineTracks;
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineZoomControls = 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");
7
+ const minus_1 = require("../../icons/minus");
8
+ const plus_1 = require("../../icons/plus");
6
9
  const timeline_zoom_1 = require("../../state/timeline-zoom");
7
10
  const ControlButton_1 = require("../ControlButton");
11
+ const layout_1 = require("../layout");
8
12
  const container = {
9
13
  color: 'black',
10
14
  flexDirection: 'row',
@@ -13,6 +17,14 @@ const container = {
13
17
  const buttonStyle = {
14
18
  fontSize: 24,
15
19
  };
20
+ const iconStyle = {
21
+ color: 'white',
22
+ width: 14,
23
+ };
24
+ const slider = {
25
+ width: 60,
26
+ accentColor: 'var(--blue)',
27
+ };
16
28
  const TimelineZoomControls = () => {
17
29
  const { setZoom, zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
18
30
  const onMinusClicked = (0, react_1.useCallback)(() => {
@@ -22,8 +34,12 @@ const TimelineZoomControls = () => {
22
34
  setZoom((z) => Math.min(timeline_zoom_1.TIMELINE_MAX_ZOOM, z + 0.2));
23
35
  }, [setZoom]);
24
36
  const onChange = (0, react_1.useCallback)((e) => {
25
- setZoom(Number(e.target.value));
37
+ setZoom(() => Number(e.target.value));
26
38
  }, [setZoom]);
27
- return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onMinusClicked, style: buttonStyle, title: "Zoom out timeline", role: 'ControlButton', type: "button", children: "-" }), (0, jsx_runtime_1.jsx)("input", { type: 'range', min: timeline_zoom_1.TIMELINE_MIN_ZOOM, step: 0.1, value: zoom, max: timeline_zoom_1.TIMELINE_MAX_ZOOM, onChange: onChange }), (0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onPlusClicked, style: buttonStyle, title: "Zoom in timeline", role: 'button', type: "button", children: "+" })] }));
39
+ const isStill = (0, is_current_selected_still_1.useIsStill)();
40
+ if (isStill) {
41
+ return null;
42
+ }
43
+ return ((0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onMinusClicked, style: buttonStyle, title: "Zoom out timeline", role: 'ControlButton', type: "button", disabled: timeline_zoom_1.TIMELINE_MIN_ZOOM === zoom, 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)("input", { title: `Timeline zoom (${zoom}x)`, alt: `Timeline zoom (${zoom}x)`, type: 'range', min: timeline_zoom_1.TIMELINE_MIN_ZOOM, step: 0.1, value: zoom, max: timeline_zoom_1.TIMELINE_MAX_ZOOM, onChange: onChange, style: slider }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }), (0, jsx_runtime_1.jsx)(ControlButton_1.ControlButton, { onClick: onPlusClicked, style: buttonStyle, title: "Zoom in timeline", role: 'button', type: "button", disabled: timeline_zoom_1.TIMELINE_MAX_ZOOM === zoom, children: (0, jsx_runtime_1.jsx)(plus_1.Plus, { style: iconStyle }) })] }));
28
44
  };
29
45
  exports.TimelineZoomControls = TimelineZoomControls;
@@ -0,0 +1,12 @@
1
+ export declare let currentFrame: number;
2
+ export declare let currentZoom: number;
3
+ export declare let currentDuration: number;
4
+ export declare let currentFps: number;
5
+ export declare const getCurrentZoom: () => number;
6
+ export declare const setCurrentZoom: (z: number) => void;
7
+ export declare const getCurrentFrame: () => number;
8
+ export declare const setCurrentFrame: (f: number) => void;
9
+ export declare const getCurrentDuration: () => number;
10
+ export declare const setCurrentDuration: (d: number) => void;
11
+ export declare const getCurrentFps: () => number;
12
+ export declare const setCurrentFps: (d: number) => void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setCurrentFps = exports.getCurrentFps = exports.setCurrentDuration = exports.getCurrentDuration = exports.setCurrentFrame = exports.getCurrentFrame = exports.setCurrentZoom = exports.getCurrentZoom = exports.currentFps = exports.currentDuration = exports.currentZoom = exports.currentFrame = void 0;
4
+ exports.currentFrame = 0;
5
+ exports.currentZoom = 1;
6
+ exports.currentDuration = 1;
7
+ exports.currentFps = 1;
8
+ const getCurrentZoom = () => {
9
+ return exports.currentZoom;
10
+ };
11
+ exports.getCurrentZoom = getCurrentZoom;
12
+ const setCurrentZoom = (z) => {
13
+ exports.currentZoom = z;
14
+ };
15
+ exports.setCurrentZoom = setCurrentZoom;
16
+ const getCurrentFrame = () => {
17
+ return exports.currentFrame;
18
+ };
19
+ exports.getCurrentFrame = getCurrentFrame;
20
+ const setCurrentFrame = (f) => {
21
+ exports.currentFrame = f;
22
+ };
23
+ exports.setCurrentFrame = setCurrentFrame;
24
+ const getCurrentDuration = () => {
25
+ return exports.currentDuration;
26
+ };
27
+ exports.getCurrentDuration = getCurrentDuration;
28
+ const setCurrentDuration = (d) => {
29
+ exports.currentDuration = d;
30
+ };
31
+ exports.setCurrentDuration = setCurrentDuration;
32
+ const getCurrentFps = () => {
33
+ return exports.currentFps;
34
+ };
35
+ exports.getCurrentFps = getCurrentFps;
36
+ const setCurrentFps = (d) => {
37
+ exports.currentFps = d;
38
+ };
39
+ exports.setCurrentFps = setCurrentFps;
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
2
  export declare const sliderAreaRef: React.RefObject<HTMLDivElement>;
3
+ export declare const scrollableRef: React.RefObject<HTMLDivElement>;
4
+ export declare const timelineVerticalScroll: React.RefObject<HTMLDivElement>;
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sliderAreaRef = void 0;
6
+ exports.timelineVerticalScroll = exports.scrollableRef = exports.sliderAreaRef = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  exports.sliderAreaRef = react_1.default.createRef();
9
+ exports.scrollableRef = react_1.default.createRef();
10
+ exports.timelineVerticalScroll = react_1.default.createRef();
@@ -2,3 +2,43 @@ export declare const canScrollTimelineIntoDirection: () => {
2
2
  canScrollRight: boolean;
3
3
  canScrollLeft: boolean;
4
4
  };
5
+ export declare const getFrameWhileScrollingLeft: ({ durationInFrames, width, }: {
6
+ durationInFrames: number;
7
+ width: number;
8
+ }) => number;
9
+ export declare const isCursorInViewport: ({ frame, durationInFrames, }: {
10
+ frame: number;
11
+ durationInFrames: number;
12
+ }) => boolean;
13
+ export declare const ensureFrameIsInViewport: ({ direction, durationInFrames, frame, }: {
14
+ direction: 'fit-left' | 'fit-right' | 'page-right' | 'page-left' | 'center';
15
+ durationInFrames: number;
16
+ frame: number;
17
+ }) => void;
18
+ export declare const scrollToTimelineXOffset: (scrollPos: number) => void;
19
+ export declare const getScrollPositionForCursorOnLeftEdge: ({ nextFrame, durationInFrames, }: {
20
+ nextFrame: number;
21
+ durationInFrames: number;
22
+ }) => number;
23
+ export declare const getScrollPositionForCursorOnRightEdge: ({ nextFrame, durationInFrames, }: {
24
+ nextFrame: number;
25
+ durationInFrames: number;
26
+ }) => number;
27
+ export declare const getFrameIncrement: (durationInFrames: number) => number;
28
+ export declare const getFrameIncrementFromWidth: (durationInFrames: number, width: number) => number;
29
+ export declare const getFrameWhileScrollingRight: ({ durationInFrames, width, }: {
30
+ durationInFrames: number;
31
+ width: number;
32
+ }) => number;
33
+ export declare const getFrameFromX: ({ clientX, durationInFrames, width, extrapolate, }: {
34
+ clientX: number;
35
+ durationInFrames: number;
36
+ width: number;
37
+ extrapolate: 'clamp' | 'extend';
38
+ }) => number;
39
+ export declare const zoomAndPreserveCursor: ({ oldZoom, newZoom, currentFrame, currentDurationInFrames, }: {
40
+ oldZoom: number;
41
+ newZoom: number;
42
+ currentFrame: number;
43
+ currentDurationInFrames: number;
44
+ }) => void;