@remotion/studio 4.0.468 → 4.0.470

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 (134) hide show
  1. package/dist/Studio.js +1 -1
  2. package/dist/api/save-render-output.js +3 -12
  3. package/dist/components/AudioWaveform.d.ts +1 -0
  4. package/dist/components/AudioWaveform.js +41 -23
  5. package/dist/components/CompositionSelectorItem.js +1 -1
  6. package/dist/components/ContextMenu.d.ts +1 -0
  7. package/dist/components/ContextMenu.js +8 -3
  8. package/dist/components/EditorContent.js +5 -4
  9. package/dist/components/EditorGuides/Guide.js +1 -1
  10. package/dist/components/ExpandedTracksProvider.js +3 -8
  11. package/dist/components/Menu/MenuItem.d.ts +1 -1
  12. package/dist/components/Menu/MenuItem.js +2 -2
  13. package/dist/components/Menu/MenuSubItem.js +5 -5
  14. package/dist/components/MenuBuildIndicator.js +0 -1
  15. package/dist/components/NewComposition/InputDragger.js +1 -0
  16. package/dist/components/Preview.js +4 -1
  17. package/dist/components/PreviewToolbar.js +2 -4
  18. package/dist/components/SelectedOutlineOverlay.d.ts +18 -0
  19. package/dist/components/SelectedOutlineOverlay.js +645 -0
  20. package/dist/components/Timeline/Timeline.js +18 -3
  21. package/dist/components/Timeline/TimelineDeleteKeybindings.d.ts +2 -0
  22. package/dist/components/Timeline/TimelineDeleteKeybindings.js +86 -0
  23. package/dist/components/Timeline/TimelineDragHandler.js +19 -244
  24. package/dist/components/Timeline/{TimelineEffectGroupRow.d.ts → TimelineEffectItem.d.ts} +1 -1
  25. package/dist/components/Timeline/{TimelineEffectGroupRow.js → TimelineEffectItem.js} +61 -35
  26. package/dist/components/Timeline/{TimelineEffectFieldRow.d.ts → TimelineEffectPropItem.d.ts} +4 -1
  27. package/dist/components/Timeline/{TimelineEffectFieldRow.js → TimelineEffectPropItem.js} +100 -16
  28. package/dist/components/Timeline/TimelineExpandArrowButton.js +5 -1
  29. package/dist/components/Timeline/TimelineExpandedKeyframeRow.d.ts +11 -0
  30. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +55 -0
  31. package/dist/components/Timeline/TimelineExpandedRow.d.ts +1 -0
  32. package/dist/components/Timeline/TimelineExpandedRow.js +29 -11
  33. package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -0
  34. package/dist/components/Timeline/TimelineExpandedSection.js +4 -4
  35. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +1 -1
  36. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +9 -120
  37. package/dist/components/Timeline/TimelineFieldLabel.d.ts +6 -0
  38. package/dist/components/Timeline/TimelineFieldLabel.js +30 -0
  39. package/dist/components/Timeline/TimelineInOutDragHandler.d.ts +2 -0
  40. package/dist/components/Timeline/TimelineInOutDragHandler.js +324 -0
  41. package/dist/components/Timeline/TimelineInOutPointer.js +3 -1
  42. package/dist/components/Timeline/TimelineInOutPointerHandle.d.ts +1 -0
  43. package/dist/components/Timeline/TimelineInOutPointerHandle.js +5 -4
  44. package/dist/components/Timeline/TimelineItemStack.d.ts +5 -0
  45. package/dist/components/Timeline/TimelineItemStack.js +82 -0
  46. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +17 -0
  47. package/dist/components/Timeline/TimelineKeyframeControls.js +217 -0
  48. package/dist/components/Timeline/TimelineKeyframeDiamond.d.ts +7 -0
  49. package/dist/components/Timeline/TimelineKeyframeDiamond.js +88 -0
  50. package/dist/components/Timeline/TimelineKeyframedValue.d.ts +8 -0
  51. package/dist/components/Timeline/TimelineKeyframedValue.js +36 -0
  52. package/dist/components/Timeline/TimelineLayerEye.js +1 -0
  53. package/dist/components/Timeline/TimelineList.js +3 -11
  54. package/dist/components/Timeline/TimelineMediaInfo.d.ts +13 -1
  55. package/dist/components/Timeline/TimelineMediaInfo.js +33 -80
  56. package/dist/components/Timeline/TimelineRowChrome.d.ts +10 -1
  57. package/dist/components/Timeline/TimelineRowChrome.js +64 -6
  58. package/dist/components/Timeline/TimelineSchemaField.js +7 -2
  59. package/dist/components/Timeline/TimelineSelection.d.ts +85 -0
  60. package/dist/components/Timeline/TimelineSelection.js +417 -0
  61. package/dist/components/Timeline/TimelineSequence.d.ts +2 -0
  62. package/dist/components/Timeline/TimelineSequence.js +18 -6
  63. package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
  64. package/dist/components/Timeline/{TimelineListItem.d.ts → TimelineSequenceItem.d.ts} +2 -2
  65. package/dist/components/Timeline/{TimelineListItem.js → TimelineSequenceItem.js} +148 -63
  66. package/dist/components/Timeline/TimelineSequenceName.d.ts +7 -0
  67. package/dist/components/Timeline/TimelineSequenceName.js +50 -0
  68. package/dist/components/Timeline/{TimelineFieldRow.d.ts → TimelineSequencePropItem.d.ts} +5 -3
  69. package/dist/components/Timeline/TimelineSequencePropItem.js +183 -0
  70. package/dist/components/Timeline/TimelineTimeIndicators.js +0 -1
  71. package/dist/components/Timeline/TimelineTrack.d.ts +5 -0
  72. package/dist/components/Timeline/TimelineTrack.js +66 -0
  73. package/dist/components/Timeline/TimelineTracks.js +2 -16
  74. package/dist/components/Timeline/TimelineTranslateField.js +14 -22
  75. package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +11 -0
  76. package/dist/components/Timeline/TimelineUvCoordinateField.js +126 -0
  77. package/dist/components/Timeline/TimelineVideoInfo.js +11 -12
  78. package/dist/components/Timeline/call-add-keyframe.d.ts +23 -0
  79. package/dist/components/Timeline/call-add-keyframe.js +54 -0
  80. package/dist/components/Timeline/call-delete-keyframe.d.ts +21 -0
  81. package/dist/components/Timeline/call-delete-keyframe.js +50 -0
  82. package/dist/components/Timeline/delete-selected-keyframe.d.ts +11 -0
  83. package/dist/components/Timeline/delete-selected-keyframe.js +51 -0
  84. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +17 -0
  85. package/dist/components/Timeline/delete-selected-timeline-item.js +183 -0
  86. package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +13 -0
  87. package/dist/components/Timeline/duplicate-selected-timeline-item.js +66 -0
  88. package/dist/components/Timeline/find-track-for-node-path-info.d.ts +7 -0
  89. package/dist/components/Timeline/find-track-for-node-path-info.js +13 -0
  90. package/dist/components/Timeline/get-keyframe-navigation.d.ts +9 -0
  91. package/dist/components/Timeline/get-keyframe-navigation.js +26 -0
  92. package/dist/components/Timeline/get-node-keyframes.d.ts +11 -0
  93. package/dist/components/Timeline/get-node-keyframes.js +23 -0
  94. package/dist/components/Timeline/get-timeline-keyframes.js +6 -8
  95. package/dist/components/Timeline/parse-keyframe-field-from-node-path.d.ts +8 -0
  96. package/dist/components/Timeline/parse-keyframe-field-from-node-path.js +26 -0
  97. package/dist/components/Timeline/save-sequence-prop.d.ts +14 -2
  98. package/dist/components/Timeline/save-sequence-prop.js +42 -7
  99. package/dist/components/Timeline/timeline-field-row-layout.d.ts +1 -0
  100. package/dist/components/Timeline/timeline-field-row-layout.js +11 -1
  101. package/dist/components/Timeline/timeline-row-layout.d.ts +1 -0
  102. package/dist/components/Timeline/timeline-row-layout.js +2 -1
  103. package/dist/components/Timeline/timeline-translate-utils.d.ts +2 -0
  104. package/dist/components/Timeline/timeline-translate-utils.js +20 -0
  105. package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +17 -0
  106. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +52 -0
  107. package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +6 -0
  108. package/dist/components/Timeline/use-open-sequence-in-editor.js +31 -0
  109. package/dist/components/composition-menu-items.js +32 -1
  110. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +0 -1
  111. package/dist/esm/{chunk-8q828zk7.js → chunk-dny42qnq.js} +10566 -6221
  112. package/dist/esm/internals.mjs +10566 -6221
  113. package/dist/esm/previewEntry.mjs +10548 -6203
  114. package/dist/esm/renderEntry.mjs +3 -1
  115. package/dist/helpers/colors.d.ts +1 -1
  116. package/dist/helpers/colors.js +1 -1
  117. package/dist/helpers/format-file-location.d.ts +9 -0
  118. package/dist/helpers/format-file-location.js +27 -0
  119. package/dist/helpers/get-box-quads-polyfill-internals.d.ts +82 -0
  120. package/dist/helpers/get-box-quads-polyfill-internals.js +2395 -0
  121. package/dist/helpers/get-box-quads-ponyfill.d.ts +10 -0
  122. package/dist/helpers/get-box-quads-ponyfill.js +23 -0
  123. package/dist/helpers/open-in-editor.d.ts +1 -1
  124. package/dist/helpers/open-in-editor.js +11 -26
  125. package/dist/helpers/timeline-layout.d.ts +8 -7
  126. package/dist/helpers/timeline-layout.js +9 -8
  127. package/dist/helpers/timeline-node-path-key.d.ts +2 -0
  128. package/dist/helpers/timeline-node-path-key.js +10 -0
  129. package/dist/helpers/use-menu-structure.js +8 -16
  130. package/dist/renderEntry.js +2 -2
  131. package/package.json +10 -10
  132. package/dist/components/Timeline/TimelineFieldRow.js +0 -113
  133. package/dist/components/Timeline/TimelineStack/index.d.ts +0 -8
  134. package/dist/components/Timeline/TimelineStack/index.js +0 -119
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineKeyframeControls = exports.shouldShowTimelineKeyframeControls = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const client_id_1 = require("../../helpers/client-id");
8
+ const colors_1 = require("../../helpers/colors");
9
+ const call_add_keyframe_1 = require("./call-add-keyframe");
10
+ const call_delete_keyframe_1 = require("./call-delete-keyframe");
11
+ const get_keyframe_navigation_1 = require("./get-keyframe-navigation");
12
+ const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
13
+ const TimelineSelection_1 = require("./TimelineSelection");
14
+ const controlsContainerStyle = {
15
+ alignItems: 'center',
16
+ display: 'flex',
17
+ flexShrink: 0,
18
+ gap: 2,
19
+ marginRight: 4,
20
+ };
21
+ const navButtonStyle = {
22
+ alignItems: 'center',
23
+ background: 'none',
24
+ border: 'none',
25
+ color: 'white',
26
+ cursor: 'pointer',
27
+ display: 'flex',
28
+ flexShrink: 0,
29
+ fontSize: 8,
30
+ height: 12,
31
+ justifyContent: 'center',
32
+ lineHeight: 1,
33
+ outline: 'none',
34
+ padding: 0,
35
+ userSelect: 'none',
36
+ width: 10,
37
+ };
38
+ const diamondButtonStyle = {
39
+ ...navButtonStyle,
40
+ height: 10,
41
+ width: 10,
42
+ };
43
+ const svgStyle = { display: 'block' };
44
+ const getCurrentKeyframeValue = ({ propStatus, jsxFrame, defaultValue, dragOverrideValue, }) => {
45
+ if (propStatus.canUpdate) {
46
+ return remotion_1.Internals.getEffectiveVisualModeValue({
47
+ codeValue: propStatus,
48
+ dragOverrideValue,
49
+ defaultValue,
50
+ shouldResortToDefaultValueIfUndefined: true,
51
+ });
52
+ }
53
+ if (propStatus.reason === 'keyframed') {
54
+ return remotion_1.Internals.interpolateKeyframedStatus({
55
+ frame: jsxFrame,
56
+ status: propStatus,
57
+ });
58
+ }
59
+ return null;
60
+ };
61
+ const shouldShowTimelineKeyframeControls = ({ propStatus, selected, }) => {
62
+ if (propStatus === null) {
63
+ return false;
64
+ }
65
+ if (selected) {
66
+ return true;
67
+ }
68
+ return (TimelineSelection_1.SELECTION_ENABLED &&
69
+ !propStatus.canUpdate &&
70
+ propStatus.reason === 'keyframed');
71
+ };
72
+ exports.shouldShowTimelineKeyframeControls = shouldShowTimelineKeyframeControls;
73
+ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, keyframeDisplayOffset, defaultValue, dragOverrideValue, schema, effectIndex, }) => {
74
+ const videoConfig = (0, remotion_1.useVideoConfig)();
75
+ const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
76
+ const setFrame = remotion_1.Internals.useTimelineSetFrame();
77
+ const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
78
+ const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
79
+ const clientId = previewServerState.type === 'connected'
80
+ ? previewServerState.clientId
81
+ : null;
82
+ const jsxFrame = timelinePosition - keyframeDisplayOffset;
83
+ const keyframes = (0, react_1.useMemo)(() => (0, get_timeline_keyframes_1.getTimelineKeyframes)(propStatus, keyframeDisplayOffset), [propStatus, keyframeDisplayOffset]);
84
+ const hasKeyframeAtCurrentFrame = (0, react_1.useMemo)(() => {
85
+ if (propStatus.canUpdate || propStatus.reason === 'computed') {
86
+ return false;
87
+ }
88
+ return (0, get_keyframe_navigation_1.hasKeyframeAtSourceFrame)(propStatus.keyframes, jsxFrame);
89
+ }, [jsxFrame, propStatus]);
90
+ const previousDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getPreviousKeyframeDisplayFrame)(keyframes, timelinePosition), [keyframes, timelinePosition]);
91
+ const nextDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getNextKeyframeDisplayFrame)(keyframes, timelinePosition), [keyframes, timelinePosition]);
92
+ const canToggleKeyframe = propStatus.canUpdate || propStatus.reason === 'keyframed';
93
+ const seekToDisplayFrame = (0, react_1.useCallback)((frame) => {
94
+ setFrame((current) => {
95
+ const next = { ...current, [videoConfig.id]: frame };
96
+ remotion_1.Internals.persistCurrentFrame(next);
97
+ return next;
98
+ });
99
+ }, [setFrame, videoConfig.id]);
100
+ const onPrevious = (0, react_1.useCallback)((e) => {
101
+ e.stopPropagation();
102
+ if (previousDisplayFrame !== null) {
103
+ seekToDisplayFrame(previousDisplayFrame);
104
+ }
105
+ }, [previousDisplayFrame, seekToDisplayFrame]);
106
+ const onNext = (0, react_1.useCallback)((e) => {
107
+ e.stopPropagation();
108
+ if (nextDisplayFrame !== null) {
109
+ seekToDisplayFrame(nextDisplayFrame);
110
+ }
111
+ }, [nextDisplayFrame, seekToDisplayFrame]);
112
+ const onToggleKeyframe = (0, react_1.useCallback)(async (e) => {
113
+ e.stopPropagation();
114
+ if (!clientId || !canToggleKeyframe) {
115
+ return;
116
+ }
117
+ if (hasKeyframeAtCurrentFrame &&
118
+ !propStatus.canUpdate &&
119
+ propStatus.reason === 'keyframed') {
120
+ if (effectIndex === null) {
121
+ await (0, call_delete_keyframe_1.callDeleteSequenceKeyframe)({
122
+ fileName,
123
+ nodePath,
124
+ fieldKey,
125
+ sourceFrame: jsxFrame,
126
+ schema,
127
+ setCodeValues,
128
+ clientId,
129
+ });
130
+ return;
131
+ }
132
+ await (0, call_delete_keyframe_1.callDeleteEffectKeyframe)({
133
+ fileName,
134
+ nodePath,
135
+ effectIndex,
136
+ fieldKey,
137
+ sourceFrame: jsxFrame,
138
+ schema,
139
+ setCodeValues,
140
+ clientId,
141
+ });
142
+ return;
143
+ }
144
+ const value = getCurrentKeyframeValue({
145
+ propStatus,
146
+ jsxFrame,
147
+ defaultValue,
148
+ dragOverrideValue,
149
+ });
150
+ if (value === null) {
151
+ return;
152
+ }
153
+ if (effectIndex === null) {
154
+ await (0, call_add_keyframe_1.callAddSequenceKeyframe)({
155
+ fileName,
156
+ nodePath,
157
+ fieldKey,
158
+ sourceFrame: jsxFrame,
159
+ value,
160
+ schema,
161
+ setCodeValues,
162
+ clientId,
163
+ });
164
+ return;
165
+ }
166
+ await (0, call_add_keyframe_1.callAddEffectKeyframe)({
167
+ fileName,
168
+ nodePath,
169
+ effectIndex,
170
+ fieldKey,
171
+ sourceFrame: jsxFrame,
172
+ value,
173
+ schema,
174
+ setCodeValues,
175
+ clientId,
176
+ });
177
+ }, [
178
+ canToggleKeyframe,
179
+ clientId,
180
+ defaultValue,
181
+ dragOverrideValue,
182
+ effectIndex,
183
+ fieldKey,
184
+ fileName,
185
+ hasKeyframeAtCurrentFrame,
186
+ jsxFrame,
187
+ nodePath,
188
+ propStatus,
189
+ schema,
190
+ setCodeValues,
191
+ ]);
192
+ const previousDisabled = previousDisplayFrame === null;
193
+ const nextDisabled = nextDisplayFrame === null;
194
+ const previousStyle = (0, react_1.useMemo)(() => ({
195
+ ...navButtonStyle,
196
+ cursor: previousDisabled ? 'default' : 'pointer',
197
+ opacity: previousDisabled ? 0.35 : 1,
198
+ }), [previousDisabled]);
199
+ const nextStyle = (0, react_1.useMemo)(() => ({
200
+ ...navButtonStyle,
201
+ cursor: nextDisabled ? 'default' : 'pointer',
202
+ opacity: nextDisabled ? 0.35 : 1,
203
+ }), [nextDisabled]);
204
+ const diamondStyle = (0, react_1.useMemo)(() => ({
205
+ ...diamondButtonStyle,
206
+ backgroundColor: hasKeyframeAtCurrentFrame ? colors_1.BLUE : colors_1.LIGHT_TEXT,
207
+ borderRadius: 1,
208
+ boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
209
+ cursor: canToggleKeyframe && clientId ? 'pointer' : 'default',
210
+ opacity: canToggleKeyframe && clientId ? 1 : 0.35,
211
+ transform: 'rotate(45deg)',
212
+ }), [canToggleKeyframe, clientId, hasKeyframeAtCurrentFrame]);
213
+ return (jsx_runtime_1.jsxs("div", { style: controlsContainerStyle, children: [
214
+ jsx_runtime_1.jsx("button", { type: "button", style: previousStyle, disabled: previousDisabled, onPointerDown: previousDisabled ? undefined : onPrevious, "aria-label": "Go to previous keyframe", title: "Previous keyframe", children: jsx_runtime_1.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M5 1L2 4L5 7Z", fill: "#ccc" }) }) }), jsx_runtime_1.jsx("button", { type: "button", style: diamondStyle, disabled: !canToggleKeyframe || !clientId, onPointerDown: canToggleKeyframe && clientId ? onToggleKeyframe : undefined, "aria-label": hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe', title: hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe' }), jsx_runtime_1.jsx("button", { type: "button", style: nextStyle, disabled: nextDisabled, onPointerDown: nextDisabled ? undefined : onNext, "aria-label": "Go to next keyframe", title: "Next keyframe", children: jsx_runtime_1.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M3 1L6 4L3 7Z", fill: "#ccc" }) }) })
215
+ ] }));
216
+ };
217
+ exports.TimelineKeyframeControls = TimelineKeyframeControls;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
3
+ export declare const TimelineKeyframeDiamond: React.NamedExoticComponent<{
4
+ readonly frame: number;
5
+ readonly rowHeight: number;
6
+ readonly nodePathInfo: SequenceNodePathInfo;
7
+ }>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TimelineKeyframeDiamond = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const react_1 = __importStar(require("react"));
39
+ const remotion_1 = require("remotion");
40
+ const colors_1 = require("../../helpers/colors");
41
+ const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
42
+ const timeline_layout_1 = require("../../helpers/timeline-layout");
43
+ const TimelineSelection_1 = require("./TimelineSelection");
44
+ const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
45
+ const diamondBase = {
46
+ position: 'absolute',
47
+ width: 8,
48
+ height: 8,
49
+ backgroundColor: colors_1.LIGHT_TEXT,
50
+ borderRadius: 1,
51
+ boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
52
+ };
53
+ const TimelineKeyframeDiamondUnmemoized = ({ frame, rowHeight, nodePathInfo }) => {
54
+ const videoConfig = (0, remotion_1.useVideoConfig)();
55
+ const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
56
+ const { selected, onSelect, selectable } = (0, TimelineSelection_1.useTimelineKeyframeSelection)(nodePathInfo, frame);
57
+ const style = (0, react_1.useMemo)(() => {
58
+ if (timelineWidth === null) {
59
+ return null;
60
+ }
61
+ return {
62
+ ...diamondBase,
63
+ backgroundColor: colors_1.LIGHT_TEXT,
64
+ outline: selected ? '2px solid ' + colors_1.BLUE : 'none',
65
+ border: 'none',
66
+ cursor: 'pointer',
67
+ left: (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, timelineWidth) - timeline_layout_1.TIMELINE_PADDING,
68
+ padding: 0,
69
+ pointerEvents: 'auto',
70
+ top: rowHeight / 2,
71
+ transform: 'translate(-50%, -50%) rotate(45deg)',
72
+ };
73
+ }, [frame, rowHeight, selected, timelineWidth, videoConfig.durationInFrames]);
74
+ const onPointerDown = (0, react_1.useCallback)((e) => {
75
+ if (e.button === 0) {
76
+ e.stopPropagation();
77
+ onSelect({
78
+ shiftKey: e.shiftKey,
79
+ toggleKey: e.metaKey || e.ctrlKey,
80
+ });
81
+ }
82
+ }, [onSelect]);
83
+ if (style === null) {
84
+ return null;
85
+ }
86
+ return (jsx_runtime_1.jsx("button", { type: "button", style: style, title: `Keyframe at frame ${frame}`, "aria-label": `Select keyframe at frame ${frame}`, onPointerDown: selectable ? onPointerDown : undefined }));
87
+ };
88
+ exports.TimelineKeyframeDiamond = react_1.default.memo(TimelineKeyframeDiamondUnmemoized);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { CanUpdateSequencePropStatusKeyframed } from 'remotion';
3
+ import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
4
+ export declare const TimelineKeyframedValue: React.FC<{
5
+ readonly field: SchemaFieldInfo;
6
+ readonly propStatus: CanUpdateSequencePropStatusKeyframed;
7
+ readonly keyframeDisplayOffset: number;
8
+ }>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineKeyframedValue = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const TimelineSchemaField_1 = require("./TimelineSchemaField");
8
+ const wrapperStyle = {
9
+ opacity: 0.5,
10
+ pointerEvents: 'none',
11
+ };
12
+ const noop = () => undefined;
13
+ const noopAsync = () => Promise.resolve();
14
+ const TimelineKeyframedValue = ({ field, propStatus, keyframeDisplayOffset }) => {
15
+ const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
16
+ const jsxFrame = timelinePosition - keyframeDisplayOffset;
17
+ const computedValue = (0, react_1.useMemo)(() => {
18
+ const raw = remotion_1.Internals.interpolateKeyframedStatus({
19
+ frame: jsxFrame,
20
+ status: propStatus,
21
+ });
22
+ if (typeof raw === 'number') {
23
+ return Math.round(raw * 100) / 100;
24
+ }
25
+ return raw;
26
+ }, [jsxFrame, propStatus]);
27
+ const fakeStatus = (0, react_1.useMemo)(() => ({
28
+ canUpdate: true,
29
+ codeValue: computedValue,
30
+ }), [computedValue]);
31
+ if (computedValue === null) {
32
+ return null;
33
+ }
34
+ return (jsx_runtime_1.jsx("div", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: fakeStatus, effectiveValue: computedValue, onSave: noopAsync, onDragValueChange: noop, onDragEnd: noop }) }));
35
+ };
36
+ exports.TimelineKeyframedValue = TimelineKeyframedValue;
@@ -47,6 +47,7 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
47
47
  if (e.button !== 0) {
48
48
  return;
49
49
  }
50
+ e.stopPropagation();
50
51
  layerPointedDown = hidden ? 'enable' : 'disable';
51
52
  onInvoked(layerPointedDown);
52
53
  window.addEventListener('pointerup', () => {
@@ -2,25 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineList = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const player_1 = require("@remotion/player");
6
- const react_1 = require("react");
7
5
  const colors_1 = require("../../helpers/colors");
8
- const TimelineListItem_1 = require("./TimelineListItem");
6
+ const TimelineSequenceItem_1 = require("./TimelineSequenceItem");
9
7
  const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
10
8
  const container = {
11
9
  flex: 1,
12
10
  background: colors_1.BACKGROUND,
13
11
  };
14
12
  const TimelineList = ({ timeline }) => {
15
- const ref = (0, react_1.useRef)(null);
16
- const size = player_1.PlayerInternals.useElementSize(ref, {
17
- shouldApplyCssTransforms: false,
18
- triggerOnWindowResize: false,
19
- });
20
- const isCompact = size ? size.width < 250 : false;
21
- return (jsx_runtime_1.jsxs("div", { ref: ref, style: container, children: [
13
+ return (jsx_runtime_1.jsxs("div", { style: container, children: [
22
14
  jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePadding, {}), timeline.map((track) => {
23
- return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(TimelineListItem_1.TimelineListItem, { nestedDepth: track.depth, sequence: track.sequence, isCompact: isCompact, nodePathInfo: track.nodePathInfo }, track.sequence.id) }, track.sequence.id));
15
+ return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(TimelineSequenceItem_1.TimelineSequenceItem, { nestedDepth: track.depth, sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset }, track.sequence.id) }, track.sequence.id));
24
16
  })] }));
25
17
  };
26
18
  exports.TimelineList = TimelineList;
@@ -1,5 +1,17 @@
1
1
  import React from 'react';
2
+ type LinkInfo = {
3
+ kind: 'local';
4
+ assetPath: string;
5
+ title: string;
6
+ } | {
7
+ kind: 'remote';
8
+ href: string;
9
+ title: string;
10
+ } | null;
11
+ export type TimelineAssetLinkInfo = Exclude<LinkInfo, null>;
12
+ export declare const getTimelineAssetLinkInfo: (src: string) => LinkInfo;
13
+ export declare const openTimelineAssetLink: (linkInfo: TimelineAssetLinkInfo, setCanvasContent: React.Dispatch<React.SetStateAction<import("remotion").CanvasContent | null>>) => void;
2
14
  export declare const TimelineMediaInfo: React.FC<{
3
15
  readonly src: string;
4
- readonly type: 'audio' | 'video' | 'image';
5
16
  }>;
17
+ export {};
@@ -33,25 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.TimelineMediaInfo = void 0;
36
+ exports.TimelineMediaInfo = exports.openTimelineAssetLink = exports.getTimelineAssetLinkInfo = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
- const media_utils_1 = require("@remotion/media-utils");
39
38
  const react_1 = __importStar(require("react"));
40
39
  const remotion_1 = require("remotion");
41
40
  const colors_1 = require("../../helpers/colors");
42
- const format_media_duration_1 = require("../../helpers/format-media-duration");
43
41
  const url_state_1 = require("../../helpers/url-state");
44
- const use_media_metadata_1 = require("../../helpers/use-media-metadata");
45
- const containerStyle = {
46
- fontFamily: 'Arial, Helvetica, sans-serif',
47
- fontSize: 12,
48
- lineHeight: 1,
49
- overflow: 'hidden',
50
- whiteSpace: 'nowrap',
51
- textOverflow: 'ellipsis',
52
- minWidth: 0,
53
- marginTop: 2,
54
- };
42
+ const TimelineSelection_1 = require("./TimelineSelection");
55
43
  const lineStyle = {
56
44
  whiteSpace: 'nowrap',
57
45
  overflow: 'hidden',
@@ -59,9 +47,9 @@ const lineStyle = {
59
47
  minWidth: 0,
60
48
  fontSize: 12,
61
49
  color: colors_1.VERY_LIGHT_TEXT,
62
- lineHeight: 1.3,
50
+ display: 'inline-block',
63
51
  };
64
- const getLinkInfo = (src) => {
52
+ const getTimelineAssetLinkInfo = (src) => {
65
53
  const staticBase = typeof window === 'undefined' ? null : window.remotion_staticBase;
66
54
  if (staticBase && src.startsWith(staticBase + '/')) {
67
55
  const assetPath = src.slice(staticBase.length + 1);
@@ -84,90 +72,55 @@ const getLinkInfo = (src) => {
84
72
  }
85
73
  return null;
86
74
  };
75
+ exports.getTimelineAssetLinkInfo = getTimelineAssetLinkInfo;
76
+ const openTimelineAssetLink = (linkInfo, setCanvasContent) => {
77
+ if (linkInfo.kind === 'local') {
78
+ setCanvasContent({ type: 'asset', asset: linkInfo.assetPath });
79
+ (0, url_state_1.pushUrl)(`/assets/${linkInfo.assetPath}`);
80
+ return;
81
+ }
82
+ window.open(linkInfo.href, '_blank', 'noopener,noreferrer');
83
+ };
84
+ exports.openTimelineAssetLink = openTimelineAssetLink;
87
85
  const useAssetLink = (src) => {
88
86
  const { setCanvasContent } = react_1.default.useContext(remotion_1.Internals.CompositionSetters);
89
87
  const [hovered, setHovered] = (0, react_1.useState)(false);
90
- const linkInfo = (0, react_1.useMemo)(() => getLinkInfo(src), [src]);
88
+ const linkInfo = (0, react_1.useMemo)(() => (0, exports.getTimelineAssetLinkInfo)(src), [src]);
89
+ const interactive = !TimelineSelection_1.SELECTION_ENABLED && linkInfo !== null;
91
90
  const onClick = (0, react_1.useCallback)((e) => {
92
91
  if (!linkInfo) {
93
92
  return;
94
93
  }
95
94
  e.preventDefault();
96
95
  e.stopPropagation();
97
- if (linkInfo.kind === 'local') {
98
- setCanvasContent({ type: 'asset', asset: linkInfo.assetPath });
99
- (0, url_state_1.pushUrl)(`/assets/${linkInfo.assetPath}`);
100
- return;
101
- }
102
- window.open(linkInfo.href, '_blank', 'noopener,noreferrer');
96
+ (0, exports.openTimelineAssetLink)(linkInfo, setCanvasContent);
103
97
  }, [linkInfo, setCanvasContent]);
104
98
  const onPointerEnter = (0, react_1.useCallback)(() => setHovered(true), []);
105
99
  const onPointerLeave = (0, react_1.useCallback)(() => setHovered(false), []);
106
100
  const fileNameStyle = (0, react_1.useMemo)(() => ({
107
101
  ...lineStyle,
108
- color: linkInfo && hovered ? colors_1.LIGHT_TEXT : colors_1.VERY_LIGHT_TEXT,
109
- cursor: linkInfo ? 'pointer' : undefined,
102
+ color: interactive && hovered ? colors_1.LIGHT_TEXT : colors_1.VERY_LIGHT_TEXT,
103
+ cursor: interactive ? 'pointer' : undefined,
110
104
  textDecoration: 'none',
111
105
  display: 'inline-block',
112
106
  overflow: 'hidden',
113
107
  whiteSpace: 'pre',
114
108
  textOverflow: 'ellipsis',
115
- }), [linkInfo, hovered]);
116
- return { linkInfo, onClick, onPointerEnter, onPointerLeave, fileNameStyle };
109
+ userSelect: 'none',
110
+ WebkitUserSelect: 'none',
111
+ }), [interactive, hovered]);
112
+ return {
113
+ linkInfo,
114
+ interactive,
115
+ onClick,
116
+ onPointerEnter,
117
+ onPointerLeave,
118
+ fileNameStyle,
119
+ };
117
120
  };
118
- const TimelineMediaInfo = ({ src, type }) => {
119
- // Images aren't supported by mediabunny, so don't even try.
120
- const metadata = (0, use_media_metadata_1.useMediaMetadata)(type === 'image' ? null : src);
121
+ const TimelineMediaInfo = ({ src }) => {
121
122
  const fileName = (0, react_1.useMemo)(() => remotion_1.Internals.getAssetDisplayName(src), [src]);
122
- const { linkInfo, onClick, onPointerEnter, onPointerLeave, fileNameStyle } = useAssetLink(src);
123
- const [imageDimensions, setImageDimensions] = (0, react_1.useState)(null);
124
- (0, react_1.useEffect)(() => {
125
- if (type !== 'image') {
126
- return;
127
- }
128
- let cancelled = false;
129
- setImageDimensions(null);
130
- (0, media_utils_1.getImageDimensions)(src)
131
- .then((dims) => {
132
- if (cancelled) {
133
- return;
134
- }
135
- setImageDimensions({ width: dims.width, height: dims.height });
136
- })
137
- .catch(() => {
138
- // Non-image or load failure — ignore silently.
139
- });
140
- return () => {
141
- cancelled = true;
142
- };
143
- }, [src, type]);
144
- const detailsLine = (0, react_1.useMemo)(() => {
145
- if (type === 'image') {
146
- if (!imageDimensions) {
147
- return null;
148
- }
149
- return `${imageDimensions.width}x${imageDimensions.height}`;
150
- }
151
- if (!metadata) {
152
- return null;
153
- }
154
- const parts = [];
155
- if (metadata.format) {
156
- parts.push(metadata.format);
157
- }
158
- if (type === 'video' && metadata.videoCodec) {
159
- parts.push(metadata.videoCodec);
160
- }
161
- if (metadata.audioCodec) {
162
- parts.push(metadata.audioCodec);
163
- }
164
- if (metadata.width !== null && metadata.height !== null) {
165
- parts.push(`${metadata.width}x${metadata.height}`);
166
- }
167
- parts.push((0, format_media_duration_1.formatMediaDuration)(metadata.duration));
168
- return parts.join(' · ');
169
- }, [imageDimensions, metadata, type]);
170
- return (jsx_runtime_1.jsxs("div", { style: containerStyle, children: [
171
- jsx_runtime_1.jsx("div", { style: fileNameStyle, title: linkInfo ? linkInfo.title : fileName, onClick: linkInfo ? onClick : undefined, onPointerEnter: linkInfo ? onPointerEnter : undefined, onPointerLeave: linkInfo ? onPointerLeave : undefined, children: fileName }), detailsLine ? (jsx_runtime_1.jsx("div", { style: lineStyle, title: detailsLine, children: detailsLine })) : null] }));
123
+ const { linkInfo, interactive, onClick, onPointerEnter, onPointerLeave, fileNameStyle, } = useAssetLink(src);
124
+ return (jsx_runtime_1.jsx("div", { style: fileNameStyle, title: linkInfo ? linkInfo.title : fileName, onClick: interactive ? onClick : undefined, onPointerEnter: interactive ? onPointerEnter : undefined, onPointerLeave: interactive ? onPointerLeave : undefined, children: fileName }));
172
125
  };
173
126
  exports.TimelineMediaInfo = TimelineMediaInfo;
@@ -1,8 +1,17 @@
1
1
  import React from 'react';
2
+ import type { TimelineSelectionInteraction } from './TimelineSelection';
2
3
  export declare const TimelineRowChrome: React.FC<{
3
4
  readonly depth: number;
4
5
  readonly eye: React.ReactNode;
6
+ readonly keyframeControls?: React.ReactNode;
5
7
  readonly arrow: React.ReactNode;
6
8
  readonly children: React.ReactNode;
7
- readonly style?: React.CSSProperties;
9
+ readonly style: React.CSSProperties;
10
+ readonly selected: boolean;
11
+ readonly selectable: boolean;
12
+ readonly onSelect: (interaction?: TimelineSelectionInteraction) => void;
13
+ readonly showSelectedBackground: boolean;
14
+ readonly containsSelection: boolean;
15
+ readonly outerHeight: number | null;
16
+ readonly onDoubleClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
8
17
  }>;