@remotion/studio 4.0.481 → 4.0.483
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Canvas.js +19 -0
- package/dist/components/Editor.js +1 -1
- package/dist/components/GlobalKeybindings.js +1 -1
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +3 -2
- package/dist/components/InspectorPanel/styles.js +2 -0
- package/dist/components/InspectorSequenceSection.js +45 -2
- package/dist/components/MediaVolumeProvider.js +4 -4
- package/dist/components/Modals.js +2 -1
- package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
- package/dist/components/NewComposition/CodemodFooter.js +25 -3
- package/dist/components/NewComposition/InputDragger.d.ts +4 -0
- package/dist/components/NewComposition/InputDragger.js +18 -2
- package/dist/components/NewComposition/NewComposition.d.ts +2 -0
- package/dist/components/NewComposition/NewComposition.js +178 -0
- package/dist/components/PreviewToolbar.js +3 -3
- package/dist/components/SelectedOutlineOverlay.d.ts +6 -0
- package/dist/components/SelectedOutlineOverlay.js +18 -2
- package/dist/components/SelectedOutlineUvControls.js +461 -2
- package/dist/components/Timeline/EasingEditorModal.js +39 -1
- package/dist/components/Timeline/Timeline.js +2 -1
- package/dist/components/Timeline/TimelineEffectItem.js +8 -5
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +2 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +1 -0
- package/dist/components/Timeline/TimelineRowChrome.js +6 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +13 -4
- package/dist/components/Timeline/TimelineSelection.js +100 -39
- package/dist/components/Timeline/TimelineSequence.js +20 -8
- package/dist/components/Timeline/TimelineSequenceItem.js +17 -16
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +40 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +308 -1
- package/dist/components/Timeline/TimelineTrack.js +2 -4
- package/dist/components/Timeline/should-subscribe-to-sequence-props.d.ts +4 -0
- package/dist/components/Timeline/should-subscribe-to-sequence-props.js +10 -0
- package/dist/components/Timeline/timeline-field-display-utils.js +3 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +2 -1
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +19 -13
- package/dist/components/composition-menu-items.js +17 -0
- package/dist/components/element-drag-and-drop.d.ts +3 -0
- package/dist/components/element-drag-and-drop.js +30 -0
- package/dist/components/import-assets.d.ts +11 -0
- package/dist/components/import-assets.js +23 -1
- package/dist/components/selected-outline-uv.d.ts +71 -1
- package/dist/components/selected-outline-uv.js +332 -10
- package/dist/esm/{chunk-4rq5gt8c.js → chunk-fq0j774v.js} +3438 -1648
- package/dist/esm/internals.mjs +3438 -1648
- package/dist/esm/previewEntry.mjs +3455 -1665
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +6 -2
- package/dist/helpers/get-sequence-visible-range.d.ts +1 -0
- package/dist/helpers/get-sequence-visible-range.js +15 -1
- package/dist/helpers/timeline-layout.d.ts +3 -3
- package/dist/helpers/timeline-layout.js +3 -1
- package/dist/state/modals.d.ts +2 -0
- package/package.json +11 -11
- package/dist/components/Timeline/TimelineItemStack.d.ts +0 -5
- package/dist/components/Timeline/TimelineItemStack.js +0 -29
|
@@ -37,9 +37,12 @@ const PRESET_PREVIEW_HEIGHT = 30;
|
|
|
37
37
|
const PRESET_PREVIEW_PADDING = 5;
|
|
38
38
|
const PRESET_PREVIEW_Y_MIN = -0.35;
|
|
39
39
|
const PRESET_PREVIEW_Y_MAX = 1.45;
|
|
40
|
+
const DEFAULT_DURATION_REST_THRESHOLD = 0.02;
|
|
40
41
|
const DEFAULT_SPRING_EASING = {
|
|
41
42
|
type: 'spring',
|
|
43
|
+
allowTail: true,
|
|
42
44
|
damping: 10,
|
|
45
|
+
durationRestThreshold: DEFAULT_DURATION_REST_THRESHOLD,
|
|
43
46
|
mass: 1,
|
|
44
47
|
overshootClamping: false,
|
|
45
48
|
stiffness: 100,
|
|
@@ -54,14 +57,22 @@ const EDITOR_EASING_PRESETS = [
|
|
|
54
57
|
];
|
|
55
58
|
const SPRING_LIMITS = {
|
|
56
59
|
damping: { min: 1, max: 200, step: 1 },
|
|
60
|
+
durationRestThreshold: { min: 0.001, max: 0.5, step: 0.001 },
|
|
57
61
|
mass: { min: 0.1, max: 20, step: 0.1 },
|
|
58
62
|
stiffness: { min: 1, max: 1000, step: 1 },
|
|
59
63
|
};
|
|
60
64
|
const SPRING_DECIMAL_PLACES = {
|
|
61
65
|
damping: 0,
|
|
66
|
+
durationRestThreshold: 3,
|
|
62
67
|
mass: 2,
|
|
63
68
|
stiffness: 0,
|
|
64
69
|
};
|
|
70
|
+
const SPRING_FALLBACKS = {
|
|
71
|
+
damping: DEFAULT_SPRING_EASING.damping,
|
|
72
|
+
durationRestThreshold: DEFAULT_DURATION_REST_THRESHOLD,
|
|
73
|
+
mass: DEFAULT_SPRING_EASING.mass,
|
|
74
|
+
stiffness: DEFAULT_SPRING_EASING.stiffness,
|
|
75
|
+
};
|
|
65
76
|
const inlineContainer = {
|
|
66
77
|
width: '100%',
|
|
67
78
|
minWidth: 0,
|
|
@@ -186,7 +197,11 @@ const sanitizeSpringValue = (value, key, fallback) => {
|
|
|
186
197
|
};
|
|
187
198
|
const sanitizeSpring = (spring) => ({
|
|
188
199
|
type: 'spring',
|
|
200
|
+
allowTail: spring.allowTail,
|
|
189
201
|
damping: sanitizeSpringValue(spring.damping, 'damping', DEFAULT_SPRING_EASING.damping),
|
|
202
|
+
durationRestThreshold: spring.durationRestThreshold === null
|
|
203
|
+
? null
|
|
204
|
+
: sanitizeSpringValue(spring.durationRestThreshold, 'durationRestThreshold', DEFAULT_DURATION_REST_THRESHOLD),
|
|
190
205
|
mass: sanitizeSpringValue(spring.mass, 'mass', DEFAULT_SPRING_EASING.mass),
|
|
191
206
|
overshootClamping: spring.overshootClamping,
|
|
192
207
|
stiffness: sanitizeSpringValue(spring.stiffness, 'stiffness', DEFAULT_SPRING_EASING.stiffness),
|
|
@@ -210,6 +225,7 @@ const formatNumberWithDecimalPlaces = (decimalPlaces) => (value) => {
|
|
|
210
225
|
};
|
|
211
226
|
const springFormatters = {
|
|
212
227
|
damping: formatNumberWithDecimalPlaces(SPRING_DECIMAL_PLACES.damping),
|
|
228
|
+
durationRestThreshold: formatNumberWithDecimalPlaces(SPRING_DECIMAL_PLACES.durationRestThreshold),
|
|
213
229
|
mass: formatNumberWithDecimalPlaces(SPRING_DECIMAL_PLACES.mass),
|
|
214
230
|
stiffness: formatNumberWithDecimalPlaces(SPRING_DECIMAL_PLACES.stiffness),
|
|
215
231
|
};
|
|
@@ -225,7 +241,9 @@ const areEasingsEqual = (first, second) => {
|
|
|
225
241
|
return true;
|
|
226
242
|
case 'spring':
|
|
227
243
|
return (second.type === 'spring' &&
|
|
244
|
+
first.allowTail === second.allowTail &&
|
|
228
245
|
first.damping === second.damping &&
|
|
246
|
+
first.durationRestThreshold === second.durationRestThreshold &&
|
|
229
247
|
first.mass === second.mass &&
|
|
230
248
|
first.overshootClamping === second.overshootClamping &&
|
|
231
249
|
first.stiffness === second.stiffness);
|
|
@@ -295,6 +313,7 @@ const presetPreviewYToSvg = (value) => PRESET_PREVIEW_PADDING +
|
|
|
295
313
|
(PRESET_PREVIEW_Y_MAX - PRESET_PREVIEW_Y_MIN)) *
|
|
296
314
|
(PRESET_PREVIEW_HEIGHT - PRESET_PREVIEW_PADDING * 2);
|
|
297
315
|
const getEasingFunction = (easing) => {
|
|
316
|
+
var _a, _b;
|
|
298
317
|
switch (easing.type) {
|
|
299
318
|
case 'linear':
|
|
300
319
|
return remotion_1.Easing.linear;
|
|
@@ -302,7 +321,9 @@ const getEasingFunction = (easing) => {
|
|
|
302
321
|
return remotion_1.Easing.bezier(easing.x1, easing.y1, easing.x2, easing.y2);
|
|
303
322
|
case 'spring':
|
|
304
323
|
return remotion_1.Easing.spring({
|
|
324
|
+
allowTail: (_a = easing.allowTail) !== null && _a !== void 0 ? _a : undefined,
|
|
305
325
|
damping: easing.damping,
|
|
326
|
+
durationRestThreshold: (_b = easing.durationRestThreshold) !== null && _b !== void 0 ? _b : undefined,
|
|
306
327
|
mass: easing.mass,
|
|
307
328
|
overshootClamping: easing.overshootClamping,
|
|
308
329
|
stiffness: easing.stiffness,
|
|
@@ -374,6 +395,7 @@ const EasingPresetButton = ({ currentEasing, disabled, onClick, preset }) => {
|
|
|
374
395
|
return (jsx_runtime_1.jsx("button", { type: "button", style: style, title: preset.label, "aria-label": `Apply ${preset.label} easing`, disabled: disabled, onClick: handleClick, children: jsx_runtime_1.jsx("svg", { width: PRESET_PREVIEW_WIDTH, height: PRESET_PREVIEW_HEIGHT, viewBox: `0 0 ${PRESET_PREVIEW_WIDTH} ${PRESET_PREVIEW_HEIGHT}`, style: presetPreviewSvgStyle, "aria-hidden": "true", focusable: false, children: jsx_runtime_1.jsx("path", { d: path, fill: "none", stroke: "white", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
|
|
375
396
|
};
|
|
376
397
|
const EasingEditor = ({ state, renderHeader }) => {
|
|
398
|
+
var _a, _b;
|
|
377
399
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
378
400
|
const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
|
|
379
401
|
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
@@ -532,7 +554,7 @@ const EasingEditor = ({ state, renderHeader }) => {
|
|
|
532
554
|
const setSpringNumber = (0, react_1.useCallback)((key, value, commit) => {
|
|
533
555
|
const next = {
|
|
534
556
|
...springRef.current,
|
|
535
|
-
[key]: sanitizeSpringValue(value, key,
|
|
557
|
+
[key]: sanitizeSpringValue(value, key, SPRING_FALLBACKS[key]),
|
|
536
558
|
};
|
|
537
559
|
const version = setSpringAndPreview(next);
|
|
538
560
|
if (commit) {
|
|
@@ -547,6 +569,15 @@ const EasingEditor = ({ state, renderHeader }) => {
|
|
|
547
569
|
const version = setSpringAndPreview(next);
|
|
548
570
|
commitEasing(serializeSpring(next), version);
|
|
549
571
|
}, [commitEasing, setSpringAndPreview]);
|
|
572
|
+
const setAllowTail = (0, react_1.useCallback)(() => {
|
|
573
|
+
var _a;
|
|
574
|
+
const next = {
|
|
575
|
+
...springRef.current,
|
|
576
|
+
allowTail: !((_a = springRef.current.allowTail) !== null && _a !== void 0 ? _a : false),
|
|
577
|
+
};
|
|
578
|
+
const version = setSpringAndPreview(next);
|
|
579
|
+
commitEasing(serializeSpring(next), version);
|
|
580
|
+
}, [commitEasing, setSpringAndPreview]);
|
|
550
581
|
const switchMode = (0, react_1.useCallback)((nextMode) => {
|
|
551
582
|
setMode(nextMode);
|
|
552
583
|
if (mode === nextMode || previewServerState.type !== 'connected') {
|
|
@@ -647,8 +678,11 @@ const EasingEditor = ({ state, renderHeader }) => {
|
|
|
647
678
|
return `M ${startPoint.x} ${startPoint.y} C ${firstHandle.x} ${firstHandle.y}, ${secondHandle.x} ${secondHandle.y}, ${endPoint.x} ${endPoint.y}`;
|
|
648
679
|
}, [endPoint, firstHandle, secondHandle, startPoint]);
|
|
649
680
|
const springPath = (0, react_1.useMemo)(() => {
|
|
681
|
+
var _a, _b;
|
|
650
682
|
const easing = remotion_1.Easing.spring({
|
|
683
|
+
allowTail: (_a = spring.allowTail) !== null && _a !== void 0 ? _a : undefined,
|
|
651
684
|
damping: spring.damping,
|
|
685
|
+
durationRestThreshold: (_b = spring.durationRestThreshold) !== null && _b !== void 0 ? _b : undefined,
|
|
652
686
|
mass: spring.mass,
|
|
653
687
|
overshootClamping: spring.overshootClamping,
|
|
654
688
|
stiffness: spring.stiffness,
|
|
@@ -711,8 +745,12 @@ const EasingEditor = ({ state, renderHeader }) => {
|
|
|
711
745
|
jsx_runtime_1.jsx("div", { style: coordinateLabel, children: "Mass" }), jsx_runtime_1.jsx("div", { style: coordinateInputWrapper, children: jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: spring.mass, status: "ok", onValueChange: (value) => setSpringNumber('mass', value, false), onValueChangeEnd: (value) => setSpringNumber('mass', value, true), onTextChange: () => undefined, min: SPRING_LIMITS.mass.min, max: SPRING_LIMITS.mass.max, step: SPRING_LIMITS.mass.step, formatter: springFormatters.mass, rightAlign: false, style: numberInputStyle, snapToStep: false, dragDecimalPlaces: SPRING_DECIMAL_PLACES.mass, disabled: disabled }) })
|
|
712
746
|
] }), jsx_runtime_1.jsxs("div", { style: coordinateRow, children: [
|
|
713
747
|
jsx_runtime_1.jsx("div", { style: coordinateLabel, children: "Stiffness" }), jsx_runtime_1.jsx("div", { style: coordinateInputWrapper, children: jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: spring.stiffness, status: "ok", onValueChange: (value) => setSpringNumber('stiffness', value, false), onValueChangeEnd: (value) => setSpringNumber('stiffness', value, true), onTextChange: () => undefined, min: SPRING_LIMITS.stiffness.min, max: SPRING_LIMITS.stiffness.max, step: SPRING_LIMITS.stiffness.step, formatter: springFormatters.stiffness, rightAlign: false, style: numberInputStyle, snapToStep: false, dragDecimalPlaces: SPRING_DECIMAL_PLACES.stiffness, disabled: disabled }) })
|
|
748
|
+
] }), jsx_runtime_1.jsxs("div", { style: coordinateRow, children: [
|
|
749
|
+
jsx_runtime_1.jsx("div", { style: coordinateLabel, children: "Rest threshold" }), jsx_runtime_1.jsx("div", { style: coordinateInputWrapper, children: jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: (_a = spring.durationRestThreshold) !== null && _a !== void 0 ? _a : DEFAULT_DURATION_REST_THRESHOLD, status: "ok", onValueChange: (value) => setSpringNumber('durationRestThreshold', value, false), onValueChangeEnd: (value) => setSpringNumber('durationRestThreshold', value, true), onTextChange: () => undefined, min: SPRING_LIMITS.durationRestThreshold.min, max: SPRING_LIMITS.durationRestThreshold.max, step: SPRING_LIMITS.durationRestThreshold.step, formatter: springFormatters.durationRestThreshold, rightAlign: false, style: numberInputStyle, snapToStep: false, dragDecimalPlaces: SPRING_DECIMAL_PLACES.durationRestThreshold, disabled: disabled }) })
|
|
714
750
|
] }), jsx_runtime_1.jsxs("div", { style: coordinateRow, children: [
|
|
715
751
|
jsx_runtime_1.jsx("div", { style: coordinateLabel, children: "Clamp overshoot" }), jsx_runtime_1.jsx("div", { style: checkboxWrapper, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: spring.overshootClamping, onChange: setOvershootClamping, name: "spring-overshoot-clamping", disabled: disabled, variant: "small" }) })
|
|
752
|
+
] }), jsx_runtime_1.jsxs("div", { style: coordinateRow, children: [
|
|
753
|
+
jsx_runtime_1.jsx("div", { style: coordinateLabel, children: "Allow tail" }), jsx_runtime_1.jsx("div", { style: checkboxWrapper, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: (_b = spring.allowTail) !== null && _b !== void 0 ? _b : false, onChange: setAllowTail, name: "spring-allow-tail", disabled: disabled, variant: "small" }) })
|
|
716
754
|
] })
|
|
717
755
|
] })
|
|
718
756
|
] }))] }));
|
|
@@ -53,6 +53,7 @@ const SplitterHandle_1 = require("../Splitter/SplitterHandle");
|
|
|
53
53
|
const MaxTimelineTracks_1 = require("./MaxTimelineTracks");
|
|
54
54
|
const SequencePropsObserver_1 = require("./SequencePropsObserver");
|
|
55
55
|
const should_show_track_in_timeline_1 = require("./should-show-track-in-timeline");
|
|
56
|
+
const should_subscribe_to_sequence_props_1 = require("./should-subscribe-to-sequence-props");
|
|
56
57
|
const SubscribeToNodePaths_1 = require("./SubscribeToNodePaths");
|
|
57
58
|
const timeline_refs_1 = require("./timeline-refs");
|
|
58
59
|
const TimelineDragHandler_1 = require("./TimelineDragHandler");
|
|
@@ -227,7 +228,7 @@ const TimelineInner = () => {
|
|
|
227
228
|
}, [filtered]);
|
|
228
229
|
const hasBeenCut = filtered.length > shown.length;
|
|
229
230
|
return (jsx_runtime_1.jsxs(TimelineContextMenuArea, { children: [sequences.map((sequence) => {
|
|
230
|
-
if (!sequence
|
|
231
|
+
if (!(0, should_subscribe_to_sequence_props_1.shouldSubscribeToSequenceProps)(sequence, previewConnected)) {
|
|
231
232
|
return null;
|
|
232
233
|
}
|
|
233
234
|
return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, componentIdentity: sequence.controls.componentIdentity, schema: sequence.controls.schema, getStack: sequence.getStack, effects: sequence.effects }, sequence.id));
|
|
@@ -71,6 +71,7 @@ const TimelineEffectItem = ({ label, nodePathInfo, effectIndex, effectSchema, do
|
|
|
71
71
|
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
72
72
|
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
73
73
|
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
74
|
+
const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(nodePathInfo);
|
|
74
75
|
const [dropIndicator, setDropIndicator] = (0, react_1.useState)(null);
|
|
75
76
|
const effectStatus = (0, react_1.useMemo)(() => remotion_1.Internals.getEffectPropStatusesCtx({
|
|
76
77
|
propStatuses,
|
|
@@ -205,12 +206,14 @@ const TimelineEffectItem = ({ label, nodePathInfo, effectIndex, effectSchema, do
|
|
|
205
206
|
alignSelf: 'stretch',
|
|
206
207
|
alignItems: 'center',
|
|
207
208
|
color: (0, TimelineSelection_1.getTimelineColor)(selection.selected, true),
|
|
208
|
-
display: 'flex',
|
|
209
|
-
|
|
209
|
+
display: 'inline-flex',
|
|
210
|
+
marginRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
210
211
|
minWidth: 0,
|
|
211
|
-
|
|
212
|
+
boxShadow: containsSelection && !selection.selected
|
|
213
|
+
? `inset 0 0 0 2px ${TimelineSelection_1.TIMELINE_SELECTED_LABEL_BACKGROUND}`
|
|
214
|
+
: undefined,
|
|
212
215
|
};
|
|
213
|
-
}, [selection.selected]);
|
|
216
|
+
}, [containsSelection, selection.selected]);
|
|
214
217
|
const getDropTarget = (0, react_1.useCallback)((e) => {
|
|
215
218
|
const dragData = getEffectReorderDragData(e.dataTransfer);
|
|
216
219
|
if (!dragData || dragData.nodePathKey !== nodePathKey) {
|
|
@@ -316,7 +319,7 @@ const TimelineEffectItem = ({ label, nodePathInfo, effectIndex, effectSchema, do
|
|
|
316
319
|
...(dropIndicator === 'before' ? { top: -1 } : { bottom: -1 }),
|
|
317
320
|
};
|
|
318
321
|
}, [dropIndicator]);
|
|
319
|
-
const row = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: canToggle ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: "effect", hidden: isDisabled, onInvoked: onToggle })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(nodePathInfo), label: `${label} section`, disabled: false }), style: rowStyle, selected: selection.selected, selectable: selection.selectable, selectionItem: selection.selectionItem, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection:
|
|
322
|
+
const row = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: canToggle ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: "effect", hidden: isDisabled, onInvoked: onToggle })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: () => toggleTrack(nodePathInfo), label: `${label} section`, disabled: false }), style: rowStyle, selected: selection.selected, selectable: selection.selectable, selectionItem: selection.selectionItem, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: null, children: jsx_runtime_1.jsx("span", { title: label, style: labelStyle, children: label }) }));
|
|
320
323
|
const draggableRow = canReorder ? (jsx_runtime_1.jsxs("div", { draggable: true, onDragStart: onDragStart, onDragEnd: onDragEnd, onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop, style: reorderWrapper, children: [reorderLineStyle ? jsx_runtime_1.jsx("div", { style: reorderLineStyle }) : null, row] })) : (row);
|
|
321
324
|
return previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selection.selectable ? selection.onSelect : null, children: draggableRow })) : (draggableRow);
|
|
322
325
|
};
|
|
@@ -50,11 +50,11 @@ const rowSeparator = {
|
|
|
50
50
|
};
|
|
51
51
|
const TimelineExpandedKeyframeRowUnmemoized = ({ height, keyframes, canEditEasing, nodePathInfo, showSeparator }) => {
|
|
52
52
|
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
53
|
-
const
|
|
53
|
+
const rowHighlightBackground = (0, TimelineSelection_1.useTimelineRowHighlightBackground)(nodePathInfo);
|
|
54
54
|
const easingSegments = canEditEasing
|
|
55
55
|
? (0, get_timeline_easing_segments_1.getTimelineEasingSegments)(keyframes)
|
|
56
56
|
: [];
|
|
57
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [showSeparator ? jsx_runtime_1.jsx("div", { style: rowSeparator }) : null, jsx_runtime_1.jsxs("div", { style: { ...row, height }, children: [
|
|
57
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [showSeparator ? jsx_runtime_1.jsx("div", { style: rowSeparator }) : null, jsx_runtime_1.jsxs("div", { style: { ...row, height }, children: [rowHighlightBackground && timelineWidth !== null ? (jsx_runtime_1.jsx("div", { style: (0, TimelineSelection_1.getTimelineSelectedTrackHighlightStyle)(timelineWidth, rowHighlightBackground) })) : null, easingSegments.map((segment) => (jsx_runtime_1.jsx(TimelineKeyframeEasingLine_1.TimelineKeyframeEasingLine, { fromFrame: segment.fromFrame, toFrame: segment.toFrame, rowHeight: height, nodePathInfo: nodePathInfo, segmentIndex: segment.segmentIndex }, `${segment.segmentIndex}-${segment.fromFrame}-${segment.toFrame}`))), keyframes.map((keyframe) => (jsx_runtime_1.jsx(TimelineKeyframeDiamond_1.TimelineKeyframeDiamond, { frame: keyframe.frame, rowHeight: height, nodePathInfo: nodePathInfo }, keyframe.frame)))] })
|
|
58
58
|
] }));
|
|
59
59
|
};
|
|
60
60
|
exports.TimelineExpandedKeyframeRow = react_1.default.memo(TimelineExpandedKeyframeRowUnmemoized);
|
|
@@ -11,6 +11,7 @@ const valuesEqual = (left, right) => {
|
|
|
11
11
|
const TimelineKeyframedValue = ({ field, propStatus, sourceFrame, dragOverrideValue, onSave, onDragValueChange, onDragEnd, scaleLockNodePath, }) => {
|
|
12
12
|
const computedValue = (0, react_1.useMemo)(() => {
|
|
13
13
|
const raw = remotion_1.Internals.interpolateKeyframedStatus({
|
|
14
|
+
forceSpringAllowTail: false,
|
|
14
15
|
frame: sourceFrame,
|
|
15
16
|
status: propStatus,
|
|
16
17
|
});
|
|
@@ -51,13 +51,15 @@ const TimelineRowChrome = ({ depth, eye, keyframeControls, arrow, children, styl
|
|
|
51
51
|
e.stopPropagation();
|
|
52
52
|
onSelect();
|
|
53
53
|
}, [onSelect]);
|
|
54
|
-
const highlightBackground =
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const highlightBackground = (0, TimelineSelection_1.getTimelineRowHighlightBackground)({
|
|
55
|
+
showSelectedBackground,
|
|
56
|
+
selected,
|
|
57
|
+
containsSelection,
|
|
58
|
+
});
|
|
57
59
|
const innerRowStyle = (0, react_1.useMemo)(() => ({
|
|
58
60
|
...rowBase,
|
|
59
61
|
...style,
|
|
60
|
-
backgroundColor: outerHeight ===
|
|
62
|
+
backgroundColor: outerHeight === null ? highlightBackground : undefined,
|
|
61
63
|
}), [style, outerHeight, highlightBackground]);
|
|
62
64
|
const outerStyle = (0, react_1.useMemo)(() => {
|
|
63
65
|
if (outerHeight === null) {
|
|
@@ -8,7 +8,12 @@ export declare const TIMELINE_SELECTED_LABEL_TEXT = "black";
|
|
|
8
8
|
export declare const TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = 2;
|
|
9
9
|
export declare const getTimelineSelectedLabelStyle: (selected: boolean, subcategory: boolean) => CSSProperties;
|
|
10
10
|
export declare const getTimelineColor: (selected: boolean, subcategory: boolean) => "black" | "rgba(255, 255, 255, 0.8)";
|
|
11
|
-
export declare const getTimelineSelectedTrackHighlightStyle: (timelineWidth: number) => CSSProperties;
|
|
11
|
+
export declare const getTimelineSelectedTrackHighlightStyle: (timelineWidth: number, backgroundColor?: string) => CSSProperties;
|
|
12
|
+
export declare const getTimelineRowHighlightBackground: ({ showSelectedBackground, selected, containsSelection, }: {
|
|
13
|
+
readonly showSelectedBackground: boolean;
|
|
14
|
+
readonly selected: boolean;
|
|
15
|
+
readonly containsSelection: boolean;
|
|
16
|
+
}) => string | undefined;
|
|
12
17
|
export declare const TIMELINE_BACKGROUND = "#0F1113";
|
|
13
18
|
export declare const TIMELINE_TICKS_BACKGROUND = "rgb(31,36,40)";
|
|
14
19
|
export type TimelineSelection = {
|
|
@@ -116,10 +121,10 @@ type TimelineSelectionContextValue = {
|
|
|
116
121
|
readonly canSelect: boolean;
|
|
117
122
|
readonly selectedItems: readonly TimelineSelection[];
|
|
118
123
|
readonly isSelected: (item: TimelineSelection) => boolean;
|
|
119
|
-
readonly selectItem: (item: TimelineSelection, interaction?: TimelineSelectionInteraction, allSelectableItems?: readonly TimelineSelection[]) => void;
|
|
120
|
-
readonly selectItems: (items: readonly TimelineSelection[]) => void;
|
|
124
|
+
readonly selectItem: (item: TimelineSelection, interaction?: TimelineSelectionInteraction, allSelectableItems?: readonly TimelineSelection[], options?: TimelineSelectionOptions) => void;
|
|
125
|
+
readonly selectItems: (items: readonly TimelineSelection[], options?: TimelineSelectionOptions) => void;
|
|
121
126
|
readonly registerMarqueeSelectableItem: (item: TimelineSelection, getRect: () => DOMRect | null) => () => void;
|
|
122
|
-
readonly registerFocusableItem: (item: TimelineSelection,
|
|
127
|
+
readonly registerFocusableItem: (item: TimelineSelection, getElement: () => Element | null) => () => void;
|
|
123
128
|
readonly getMarqueeSelection: (marqueeRect: TimelineMarqueeRect, lockedSelectionKind: TimelineMarqueeSelectionKind | null) => {
|
|
124
129
|
readonly lockedSelectionKind: TimelineMarqueeSelectionKind | null;
|
|
125
130
|
readonly selectedItems: readonly TimelineSelection[];
|
|
@@ -131,6 +136,9 @@ export declare const TimelineSelectionOrderProvider: React.FC<{
|
|
|
131
136
|
readonly children: React.ReactNode;
|
|
132
137
|
readonly items: readonly TimelineSelection[];
|
|
133
138
|
}>;
|
|
139
|
+
type TimelineSelectionOptions = {
|
|
140
|
+
readonly reveal?: boolean;
|
|
141
|
+
};
|
|
134
142
|
export declare const getTimelineSelectionFromNodePathInfo: (nodePathInfo: SequenceNodePathInfo | null) => TimelineSelection | null;
|
|
135
143
|
export declare const getTimelineSelectionKey: (item: TimelineSelection) => string;
|
|
136
144
|
export declare const getSelectableTimelineSequenceSelections: (tracks: readonly Pick<TrackWithHash, "nodePathInfo">[]) => TimelineSelection[];
|
|
@@ -201,4 +209,5 @@ export declare const useTimelineGuideSelection: (guideId: string) => {
|
|
|
201
209
|
selectionItem: TimelineSelection;
|
|
202
210
|
};
|
|
203
211
|
export declare const useTimelineRowContainsSelection: (nodePathInfo: SequenceNodePathInfo | null) => boolean;
|
|
212
|
+
export declare const useTimelineRowHighlightBackground: (nodePathInfo: SequenceNodePathInfo | null) => string | undefined;
|
|
204
213
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTimelineRowContainsSelection = exports.useTimelineGuideSelection = exports.useTimelineEasingSelection = exports.useTimelineKeyframeSelection = exports.useTimelineRowSelection = exports.useTimelineFocusableItem = exports.useTimelineMarqueeSelectableItem = exports.useTimelineMarqueeSelection = exports.useCurrentTimelineSelectionStateAsRef = exports.TIMELINE_SCRUBBER_ATTR = exports.TIMELINE_MARQUEE_ITEM_ATTR = exports.useTimelineSelection = exports.TimelineSelectionProvider = exports.TimelineSelectableItemsProvider = exports.TimelineSelectAllKeybindings = exports.getTimelineSequenceSelectionKey = exports.getSelectableTimelineItems = exports.getSelectableTimelineSequenceSelections = exports.getTimelineSelectionKey = exports.getTimelineSelectionFromNodePathInfo = exports.TimelineSelectionOrderProvider = exports.getTimelineMarqueeSelection = exports.timelineMarqueeRectsIntersect = exports.getClampedTimelineMarqueePoint = exports.getNormalizedTimelineMarqueeRect = exports.getAvailableTimelineSelectionState = exports.getTimelineSelectionAfterInteraction = exports.EMPTY_TIMELINE_SELECTION_STATE = exports.shouldSelectTimelineRowOnPointerDown = exports.isTimelineSelectionModifierEvent = exports.TIMELINE_TICKS_BACKGROUND = exports.TIMELINE_BACKGROUND = exports.getTimelineSelectedTrackHighlightStyle = exports.getTimelineColor = exports.getTimelineSelectedLabelStyle = exports.TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = exports.TIMELINE_SELECTED_LABEL_TEXT = exports.TIMELINE_SELECTED_LABEL_BACKGROUND = exports.TIMELINE_SELECTED_BACKGROUND = void 0;
|
|
3
|
+
exports.useTimelineRowHighlightBackground = exports.useTimelineRowContainsSelection = exports.useTimelineGuideSelection = exports.useTimelineEasingSelection = exports.useTimelineKeyframeSelection = exports.useTimelineRowSelection = exports.useTimelineFocusableItem = exports.useTimelineMarqueeSelectableItem = exports.useTimelineMarqueeSelection = exports.useCurrentTimelineSelectionStateAsRef = exports.TIMELINE_SCRUBBER_ATTR = exports.TIMELINE_MARQUEE_ITEM_ATTR = exports.useTimelineSelection = exports.TimelineSelectionProvider = exports.TimelineSelectableItemsProvider = exports.TimelineSelectAllKeybindings = exports.getTimelineSequenceSelectionKey = exports.getSelectableTimelineItems = exports.getSelectableTimelineSequenceSelections = exports.getTimelineSelectionKey = exports.getTimelineSelectionFromNodePathInfo = exports.TimelineSelectionOrderProvider = exports.getTimelineMarqueeSelection = exports.timelineMarqueeRectsIntersect = exports.getClampedTimelineMarqueePoint = exports.getNormalizedTimelineMarqueeRect = exports.getAvailableTimelineSelectionState = exports.getTimelineSelectionAfterInteraction = exports.EMPTY_TIMELINE_SELECTION_STATE = exports.shouldSelectTimelineRowOnPointerDown = exports.isTimelineSelectionModifierEvent = exports.TIMELINE_TICKS_BACKGROUND = exports.TIMELINE_BACKGROUND = exports.getTimelineRowHighlightBackground = exports.getTimelineSelectedTrackHighlightStyle = exports.getTimelineColor = exports.getTimelineSelectedLabelStyle = exports.TIMELINE_SELECTED_LABEL_HORIZONTAL_PADDING = exports.TIMELINE_SELECTED_LABEL_TEXT = exports.TIMELINE_SELECTED_LABEL_BACKGROUND = exports.TIMELINE_SELECTED_BACKGROUND = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -42,8 +42,8 @@ const getTimelineColor = (selected, subcategory) => {
|
|
|
42
42
|
: 'rgba(255, 255, 255, 0.8)';
|
|
43
43
|
};
|
|
44
44
|
exports.getTimelineColor = getTimelineColor;
|
|
45
|
-
const getTimelineSelectedTrackHighlightStyle = (timelineWidth) => ({
|
|
46
|
-
backgroundColor
|
|
45
|
+
const getTimelineSelectedTrackHighlightStyle = (timelineWidth, backgroundColor = exports.TIMELINE_SELECTED_BACKGROUND) => ({
|
|
46
|
+
backgroundColor,
|
|
47
47
|
bottom: 0,
|
|
48
48
|
left: -timeline_layout_1.TIMELINE_PADDING,
|
|
49
49
|
pointerEvents: 'none',
|
|
@@ -52,6 +52,12 @@ const getTimelineSelectedTrackHighlightStyle = (timelineWidth) => ({
|
|
|
52
52
|
width: timelineWidth,
|
|
53
53
|
});
|
|
54
54
|
exports.getTimelineSelectedTrackHighlightStyle = getTimelineSelectedTrackHighlightStyle;
|
|
55
|
+
const getTimelineRowHighlightBackground = ({ showSelectedBackground, selected, containsSelection, }) => {
|
|
56
|
+
return showSelectedBackground && (selected || containsSelection)
|
|
57
|
+
? exports.TIMELINE_SELECTED_BACKGROUND
|
|
58
|
+
: undefined;
|
|
59
|
+
};
|
|
60
|
+
exports.getTimelineRowHighlightBackground = getTimelineRowHighlightBackground;
|
|
55
61
|
exports.TIMELINE_BACKGROUND = '#0F1113';
|
|
56
62
|
exports.TIMELINE_TICKS_BACKGROUND = colors_1.BACKGROUND;
|
|
57
63
|
const isTimelineSelectionModifierEvent = ({ shiftKey, metaKey, ctrlKey, }) => {
|
|
@@ -266,7 +272,7 @@ const TimelineSelectionOrderProvider = ({ children, items }) => {
|
|
|
266
272
|
};
|
|
267
273
|
exports.TimelineSelectionOrderProvider = TimelineSelectionOrderProvider;
|
|
268
274
|
const CurrentTimelineSelectionContext = (0, react_1.createContext)(null);
|
|
269
|
-
const
|
|
275
|
+
const TIMELINE_SELECTION_REVEAL_RETRY_COUNT = 2;
|
|
270
276
|
const parseEffectIndex = (effectIndex) => {
|
|
271
277
|
const parsed = Number(effectIndex);
|
|
272
278
|
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
@@ -557,11 +563,13 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
557
563
|
const marqueeSelectableItems = (0, react_1.useRef)(new Map());
|
|
558
564
|
const marqueeRegistrationCounter = (0, react_1.useRef)(0);
|
|
559
565
|
const focusableItems = (0, react_1.useRef)(new Map());
|
|
560
|
-
const
|
|
566
|
+
const focusableRegistrationCounter = (0, react_1.useRef)(0);
|
|
567
|
+
const [revealRequest, setRevealRequest] = (0, react_1.useState)(null);
|
|
561
568
|
(0, react_1.useEffect)(() => {
|
|
562
569
|
if (!canSelect) {
|
|
563
570
|
selectionScope.current = null;
|
|
564
571
|
selectionAnchor.current = null;
|
|
572
|
+
setRevealRequest(null);
|
|
565
573
|
setSelectedItems([]);
|
|
566
574
|
}
|
|
567
575
|
}, [canSelect]);
|
|
@@ -577,37 +585,62 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
577
585
|
}, [timelineSelectionScope]);
|
|
578
586
|
const availableSelectionState = getCurrentAvailableSelectionState(selectedItems);
|
|
579
587
|
const availableSelectedItems = availableSelectionState.selectedItems;
|
|
580
|
-
(0, react_1.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}
|
|
585
|
-
const selectedKey = (0, exports.getTimelineSelectionKey)(availableSelectedItems[0]);
|
|
586
|
-
if (previousSingleSelectionKey.current === selectedKey) {
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
previousSingleSelectionKey.current = selectedKey;
|
|
590
|
-
const animationFrame = requestAnimationFrame(() => {
|
|
588
|
+
const revealSelectionKey = (0, react_1.useCallback)((selectedKey) => {
|
|
589
|
+
let cancelled = false;
|
|
590
|
+
let animationFrame = null;
|
|
591
|
+
const reveal = (attempt) => {
|
|
591
592
|
var _a;
|
|
592
|
-
|
|
593
|
+
var _b;
|
|
594
|
+
if (cancelled) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
593
597
|
const scrollParent = timeline_refs_1.timelineVerticalScroll.current;
|
|
594
|
-
const
|
|
598
|
+
const focusableRegistrations = focusableItems.current.get(selectedKey);
|
|
599
|
+
const focusableElement = scrollParent && focusableRegistrations
|
|
600
|
+
? [...focusableRegistrations.values()]
|
|
601
|
+
.sort((a, b) => a.order - b.order)
|
|
602
|
+
.map((registered) => registered.getElement())
|
|
603
|
+
.find((element) => element !== null && scrollParent.contains(element))
|
|
604
|
+
: null;
|
|
605
|
+
const rect = (_b = focusableElement === null || focusableElement === void 0 ? void 0 : focusableElement.getBoundingClientRect()) !== null && _b !== void 0 ? _b : (_a = marqueeSelectableItems.current.get(selectedKey)) === null || _a === void 0 ? void 0 : _a.getRect();
|
|
595
606
|
if (!scrollParent || !rect) {
|
|
607
|
+
if (attempt < TIMELINE_SELECTION_REVEAL_RETRY_COUNT) {
|
|
608
|
+
animationFrame = requestAnimationFrame(() => reveal(attempt + 1));
|
|
609
|
+
}
|
|
596
610
|
return;
|
|
597
611
|
}
|
|
598
612
|
const parentRect = scrollParent.getBoundingClientRect();
|
|
599
|
-
if (rect.top
|
|
600
|
-
scrollParent.scrollTop -=
|
|
601
|
-
parentRect.top - rect.top + TIMELINE_SELECTION_FOCUS_PADDING;
|
|
613
|
+
if (rect.top >= parentRect.top && rect.bottom <= parentRect.bottom) {
|
|
602
614
|
return;
|
|
603
615
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
616
|
+
const elementCenter = rect.top + rect.height / 2;
|
|
617
|
+
const parentCenter = parentRect.top + parentRect.height / 2;
|
|
618
|
+
scrollParent.scrollTop += elementCenter - parentCenter;
|
|
619
|
+
};
|
|
620
|
+
animationFrame = requestAnimationFrame(() => reveal(0));
|
|
621
|
+
return () => {
|
|
622
|
+
cancelled = true;
|
|
623
|
+
if (animationFrame !== null) {
|
|
624
|
+
cancelAnimationFrame(animationFrame);
|
|
607
625
|
}
|
|
626
|
+
};
|
|
627
|
+
}, []);
|
|
628
|
+
(0, react_1.useEffect)(() => {
|
|
629
|
+
if (revealRequest === null) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
return revealSelectionKey(revealRequest.key);
|
|
633
|
+
}, [revealRequest, revealSelectionKey]);
|
|
634
|
+
const requestRevealSelectionItem = (0, react_1.useCallback)((item) => {
|
|
635
|
+
const key = (0, exports.getTimelineSelectionKey)(item);
|
|
636
|
+
setRevealRequest((previousRequest) => {
|
|
637
|
+
var _a;
|
|
638
|
+
return ({
|
|
639
|
+
key,
|
|
640
|
+
token: ((_a = previousRequest === null || previousRequest === void 0 ? void 0 : previousRequest.token) !== null && _a !== void 0 ? _a : 0) + 1,
|
|
641
|
+
});
|
|
608
642
|
});
|
|
609
|
-
|
|
610
|
-
}, [availableSelectedItems]);
|
|
643
|
+
}, []);
|
|
611
644
|
const expandParentsForSelectionItems = (0, react_1.useCallback)((items) => {
|
|
612
645
|
for (const item of items) {
|
|
613
646
|
if (item.type === 'guide') {
|
|
@@ -646,11 +679,14 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
646
679
|
const selectItem = (0, react_1.useCallback)((item, interaction = {
|
|
647
680
|
shiftKey: false,
|
|
648
681
|
toggleKey: false,
|
|
649
|
-
}, allSelectableItems = []) => {
|
|
682
|
+
}, allSelectableItems = [], options = {}) => {
|
|
650
683
|
if (!canSelectItem(item)) {
|
|
651
684
|
return;
|
|
652
685
|
}
|
|
653
686
|
expandParentsForSelectionItem(item);
|
|
687
|
+
if (options.reveal) {
|
|
688
|
+
requestRevealSelectionItem(item);
|
|
689
|
+
}
|
|
654
690
|
setSelectedItems((currentSelectedItems) => {
|
|
655
691
|
const currentSelectionState = getCurrentAvailableSelectionState(currentSelectedItems);
|
|
656
692
|
const nextState = (0, exports.getTimelineSelectionAfterInteraction)({
|
|
@@ -670,9 +706,10 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
670
706
|
canSelectItem,
|
|
671
707
|
expandParentsForSelectionItem,
|
|
672
708
|
getCurrentAvailableSelectionState,
|
|
709
|
+
requestRevealSelectionItem,
|
|
673
710
|
timelineSelectionScope,
|
|
674
711
|
]);
|
|
675
|
-
const selectItems = (0, react_1.useCallback)((items) => {
|
|
712
|
+
const selectItems = (0, react_1.useCallback)((items, options = {}) => {
|
|
676
713
|
if (!items.every(canSelectItem)) {
|
|
677
714
|
return;
|
|
678
715
|
}
|
|
@@ -680,8 +717,16 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
680
717
|
selectionAnchor.current =
|
|
681
718
|
items.length === 0 ? null : items[items.length - 1];
|
|
682
719
|
expandParentsForSelectionItems(items);
|
|
720
|
+
if (options.reveal && items.length === 1) {
|
|
721
|
+
requestRevealSelectionItem(items[0]);
|
|
722
|
+
}
|
|
683
723
|
setSelectedItems(items);
|
|
684
|
-
}, [
|
|
724
|
+
}, [
|
|
725
|
+
canSelectItem,
|
|
726
|
+
expandParentsForSelectionItems,
|
|
727
|
+
requestRevealSelectionItem,
|
|
728
|
+
timelineSelectionScope,
|
|
729
|
+
]);
|
|
685
730
|
const registerMarqueeSelectableItem = (0, react_1.useCallback)((item, getRect) => {
|
|
686
731
|
const key = (0, exports.getTimelineSelectionKey)(item);
|
|
687
732
|
const registrationOrder = marqueeRegistrationCounter.current;
|
|
@@ -695,13 +740,23 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
695
740
|
marqueeSelectableItems.current.delete(key);
|
|
696
741
|
};
|
|
697
742
|
}, []);
|
|
698
|
-
const registerFocusableItem = (0, react_1.useCallback)((item,
|
|
743
|
+
const registerFocusableItem = (0, react_1.useCallback)((item, getElement) => {
|
|
744
|
+
var _a;
|
|
699
745
|
const key = (0, exports.getTimelineSelectionKey)(item);
|
|
700
|
-
|
|
701
|
-
|
|
746
|
+
const registrationOrder = focusableRegistrationCounter.current;
|
|
747
|
+
focusableRegistrationCounter.current += 1;
|
|
748
|
+
const registrations = (_a = focusableItems.current.get(key)) !== null && _a !== void 0 ? _a : new Map();
|
|
749
|
+
registrations.set(registrationOrder, {
|
|
750
|
+
getElement,
|
|
751
|
+
order: registrationOrder,
|
|
702
752
|
});
|
|
753
|
+
focusableItems.current.set(key, registrations);
|
|
703
754
|
return () => {
|
|
704
|
-
focusableItems.current.
|
|
755
|
+
const latestRegistrations = focusableItems.current.get(key);
|
|
756
|
+
latestRegistrations === null || latestRegistrations === void 0 ? void 0 : latestRegistrations.delete(registrationOrder);
|
|
757
|
+
if ((latestRegistrations === null || latestRegistrations === void 0 ? void 0 : latestRegistrations.size) === 0) {
|
|
758
|
+
focusableItems.current.delete(key);
|
|
759
|
+
}
|
|
705
760
|
};
|
|
706
761
|
}, []);
|
|
707
762
|
const getMarqueeSelectionForRect = (0, react_1.useCallback)((marqueeRect, lockedSelectionKind) => {
|
|
@@ -902,11 +957,7 @@ const useTimelineFocusableItem = (item, ref) => {
|
|
|
902
957
|
if (item === null) {
|
|
903
958
|
return;
|
|
904
959
|
}
|
|
905
|
-
return registerFocusableItem(item, () =>
|
|
906
|
-
var _a;
|
|
907
|
-
var _b;
|
|
908
|
-
return (_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : null;
|
|
909
|
-
});
|
|
960
|
+
return registerFocusableItem(item, () => ref.current);
|
|
910
961
|
}, [item, ref, registerFocusableItem]);
|
|
911
962
|
};
|
|
912
963
|
exports.useTimelineFocusableItem = useTimelineFocusableItem;
|
|
@@ -919,7 +970,7 @@ const useTimelineRowSelection = (nodePathInfo) => {
|
|
|
919
970
|
if (selectionItem === null) {
|
|
920
971
|
return;
|
|
921
972
|
}
|
|
922
|
-
selectItem(selectionItem, interaction, selectableTimelineItemsRef.current);
|
|
973
|
+
selectItem(selectionItem, interaction, selectableTimelineItemsRef.current, { reveal: true });
|
|
923
974
|
}, [selectItem, selectableTimelineItemsRef, selectionItem]);
|
|
924
975
|
return {
|
|
925
976
|
onSelect,
|
|
@@ -998,3 +1049,13 @@ const useTimelineRowContainsSelection = (nodePathInfo) => {
|
|
|
998
1049
|
return containsSelection(nodePathInfo);
|
|
999
1050
|
};
|
|
1000
1051
|
exports.useTimelineRowContainsSelection = useTimelineRowContainsSelection;
|
|
1052
|
+
const useTimelineRowHighlightBackground = (nodePathInfo) => {
|
|
1053
|
+
const { selected } = (0, exports.useTimelineRowSelection)(nodePathInfo);
|
|
1054
|
+
const containsSelection = (0, exports.useTimelineRowContainsSelection)(nodePathInfo);
|
|
1055
|
+
return (0, exports.getTimelineRowHighlightBackground)({
|
|
1056
|
+
showSelectedBackground: true,
|
|
1057
|
+
selected,
|
|
1058
|
+
containsSelection,
|
|
1059
|
+
});
|
|
1060
|
+
};
|
|
1061
|
+
exports.useTimelineRowHighlightBackground = useTimelineRowHighlightBackground;
|
|
@@ -154,10 +154,10 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
154
154
|
// If a duration is 1, it is essentially a still and it should have width 0
|
|
155
155
|
// Some compositions may not be longer than their media duration,
|
|
156
156
|
// if that is the case, it needs to be asynchronously determined
|
|
157
|
-
var _a, _b;
|
|
158
|
-
var
|
|
157
|
+
var _a, _b, _c;
|
|
158
|
+
var _d, _e, _f, _g, _h, _j;
|
|
159
159
|
const video = remotion_1.Internals.useVideo();
|
|
160
|
-
const maxMediaDuration = (0, use_max_media_duration_1.useMaxMediaDuration)(s, (
|
|
160
|
+
const maxMediaDuration = (0, use_max_media_duration_1.useMaxMediaDuration)(s, (_d = video === null || video === void 0 ? void 0 : video.fps) !== null && _d !== void 0 ? _d : 30);
|
|
161
161
|
const effectiveMaxMediaDuration = s.loopDisplay ? null : maxMediaDuration;
|
|
162
162
|
const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(s.getStack);
|
|
163
163
|
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
@@ -174,7 +174,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
174
174
|
};
|
|
175
175
|
}, [originalLocation]);
|
|
176
176
|
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
177
|
-
const nodePath = (
|
|
177
|
+
const nodePath = (_e = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _e !== void 0 ? _e : null;
|
|
178
178
|
const propStatusesForOverride = (0, react_1.useMemo)(() => {
|
|
179
179
|
return nodePath
|
|
180
180
|
? remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)
|
|
@@ -182,6 +182,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
182
182
|
}, [propStatuses, nodePath]);
|
|
183
183
|
const durationCanUpdate = Boolean(((_a = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.durationInFrames) === null || _a === void 0 ? void 0 : _a.status) === 'static');
|
|
184
184
|
const fromCanUpdate = Boolean(((_b = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.from) === null || _b === void 0 ? void 0 : _b.status) === 'static');
|
|
185
|
+
const trimBeforeCanUpdate = Boolean(((_c = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.trimBefore) === null || _c === void 0 ? void 0 : _c.status) === 'static');
|
|
185
186
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
186
187
|
const previewConnected = previewServerState.type === 'connected';
|
|
187
188
|
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
@@ -291,7 +292,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
291
292
|
sequenceFrameOffset,
|
|
292
293
|
setPropStatuses,
|
|
293
294
|
timelinePosition,
|
|
294
|
-
validatedSource: (
|
|
295
|
+
validatedSource: (_f = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) !== null && _f !== void 0 ? _f : null,
|
|
295
296
|
});
|
|
296
297
|
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
297
298
|
if (!previewConnected) {
|
|
@@ -312,7 +313,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
312
313
|
originalLocation,
|
|
313
314
|
selectAsset,
|
|
314
315
|
sequence: s,
|
|
315
|
-
sourceActions: [freezeFrameMenuItem],
|
|
316
|
+
sourceActions: freezeFrameMenuItem ? [freezeFrameMenuItem] : [],
|
|
316
317
|
});
|
|
317
318
|
}, [
|
|
318
319
|
assetLinkInfo,
|
|
@@ -340,7 +341,7 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
340
341
|
const { onPointerDown: onMoveDragPointerDown } = (0, TimelineSequenceRightEdgeDragHandle_1.useTimelineSequenceFromDrag)({
|
|
341
342
|
nodePathInfo,
|
|
342
343
|
windowWidth,
|
|
343
|
-
timelineDurationInFrames: (
|
|
344
|
+
timelineDurationInFrames: (_g = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _g !== void 0 ? _g : 1,
|
|
344
345
|
});
|
|
345
346
|
if (!video) {
|
|
346
347
|
throw new TypeError('Expected video config');
|
|
@@ -391,10 +392,21 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffs
|
|
|
391
392
|
nodePath !== null &&
|
|
392
393
|
validatedLocation !== null &&
|
|
393
394
|
durationCanUpdate;
|
|
395
|
+
const showLeftEdgeDragHandle = (s.type === 'sequence' ||
|
|
396
|
+
s.type === 'image' ||
|
|
397
|
+
s.type === 'audio' ||
|
|
398
|
+
s.type === 'video') &&
|
|
399
|
+
!s.isInsideSeries &&
|
|
400
|
+
nodePath !== null &&
|
|
401
|
+
validatedLocation !== null &&
|
|
402
|
+
Boolean(s.controls) &&
|
|
403
|
+
fromCanUpdate &&
|
|
404
|
+
durationCanUpdate &&
|
|
405
|
+
trimBeforeCanUpdate;
|
|
394
406
|
if (maxMediaDuration === null && !s.loopDisplay) {
|
|
395
407
|
return null;
|
|
396
408
|
}
|
|
397
|
-
const sequence = (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, sequenceFrameOffset: sequenceFrameOffset, fromCanUpdate: fromCanUpdate, frozenFrame: frozenFrame, onMoveDragPointerDown: onMoveDragPointerDown, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, playbackRate: s.playbackRate, loopDisplay: s.loopDisplay })) : null, s.type === 'video' ? (jsx_runtime_1.jsx(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src, visualizationWidth: width, naturalWidth: naturalWidth, trimBefore: s.startMediaFrom, durationInFrames: s.duration, playbackRate: s.playbackRate, volume: s.volume, doesVolumeChange: s.doesVolumeChange, premountWidth: premountWidth !== null && premountWidth !== void 0 ? premountWidth : 0, postmountWidth: postmountWidth !== null && postmountWidth !== void 0 ? postmountWidth : 0, loopDisplay: s.loopDisplay, frozenMediaFrame: s.frozenMediaFrame })) : null, s.type === 'image' ? (jsx_runtime_1.jsx(TimelineImageInfo_1.TimelineImageInfo, { src: s.src, visualizationWidth: width })) : null, s.loopDisplay === undefined ? null : (jsx_runtime_1.jsx(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes })), showRightEdgeDragHandle && nodePathInfo && validatedLocation ? (jsx_runtime_1.jsx(TimelineSequenceRightEdgeDragHandle_1.TimelineSequenceRightEdgeDragHandle, { nodePathInfo: nodePathInfo, windowWidth: windowWidth, timelineDurationInFrames: (
|
|
409
|
+
const sequence = (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, sequenceFrameOffset: sequenceFrameOffset, fromCanUpdate: fromCanUpdate, frozenFrame: frozenFrame, onMoveDragPointerDown: onMoveDragPointerDown, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, playbackRate: s.playbackRate, loopDisplay: s.loopDisplay })) : null, s.type === 'video' ? (jsx_runtime_1.jsx(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src, visualizationWidth: width, naturalWidth: naturalWidth, trimBefore: s.startMediaFrom, durationInFrames: s.duration, playbackRate: s.playbackRate, volume: s.volume, doesVolumeChange: s.doesVolumeChange, premountWidth: premountWidth !== null && premountWidth !== void 0 ? premountWidth : 0, postmountWidth: postmountWidth !== null && postmountWidth !== void 0 ? postmountWidth : 0, loopDisplay: s.loopDisplay, frozenMediaFrame: s.frozenMediaFrame })) : null, s.type === 'image' ? (jsx_runtime_1.jsx(TimelineImageInfo_1.TimelineImageInfo, { src: s.src, visualizationWidth: width })) : null, s.loopDisplay === undefined ? null : (jsx_runtime_1.jsx(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes })), showLeftEdgeDragHandle && nodePathInfo && validatedLocation ? (jsx_runtime_1.jsx(TimelineSequenceRightEdgeDragHandle_1.TimelineSequenceLeftEdgeDragHandle, { nodePathInfo: nodePathInfo, windowWidth: windowWidth, timelineDurationInFrames: (_h = video.durationInFrames) !== null && _h !== void 0 ? _h : 1 })) : null, showRightEdgeDragHandle && nodePathInfo && validatedLocation ? (jsx_runtime_1.jsx(TimelineSequenceRightEdgeDragHandle_1.TimelineSequenceRightEdgeDragHandle, { nodePathInfo: nodePathInfo, windowWidth: windowWidth, timelineDurationInFrames: (_j = video.durationInFrames) !== null && _j !== void 0 ? _j : 1 })) : null] }));
|
|
398
410
|
return previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: onContextMenuOpen, children: sequence })) : (sequence);
|
|
399
411
|
};
|
|
400
412
|
exports.TimelineSequence = react_1.default.memo(TimelineSequenceFn);
|