@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.
Files changed (56) hide show
  1. package/dist/components/Canvas.js +19 -0
  2. package/dist/components/Editor.js +1 -1
  3. package/dist/components/GlobalKeybindings.js +1 -1
  4. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +3 -2
  5. package/dist/components/InspectorPanel/styles.js +2 -0
  6. package/dist/components/InspectorSequenceSection.js +45 -2
  7. package/dist/components/MediaVolumeProvider.js +4 -4
  8. package/dist/components/Modals.js +2 -1
  9. package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
  10. package/dist/components/NewComposition/CodemodFooter.js +25 -3
  11. package/dist/components/NewComposition/InputDragger.d.ts +4 -0
  12. package/dist/components/NewComposition/InputDragger.js +18 -2
  13. package/dist/components/NewComposition/NewComposition.d.ts +2 -0
  14. package/dist/components/NewComposition/NewComposition.js +178 -0
  15. package/dist/components/PreviewToolbar.js +3 -3
  16. package/dist/components/SelectedOutlineOverlay.d.ts +6 -0
  17. package/dist/components/SelectedOutlineOverlay.js +18 -2
  18. package/dist/components/SelectedOutlineUvControls.js +461 -2
  19. package/dist/components/Timeline/EasingEditorModal.js +39 -1
  20. package/dist/components/Timeline/Timeline.js +2 -1
  21. package/dist/components/Timeline/TimelineEffectItem.js +8 -5
  22. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +2 -2
  23. package/dist/components/Timeline/TimelineKeyframedValue.js +1 -0
  24. package/dist/components/Timeline/TimelineRowChrome.js +6 -4
  25. package/dist/components/Timeline/TimelineSelection.d.ts +13 -4
  26. package/dist/components/Timeline/TimelineSelection.js +100 -39
  27. package/dist/components/Timeline/TimelineSequence.js +20 -8
  28. package/dist/components/Timeline/TimelineSequenceItem.js +17 -16
  29. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +40 -1
  30. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +308 -1
  31. package/dist/components/Timeline/TimelineTrack.js +2 -4
  32. package/dist/components/Timeline/should-subscribe-to-sequence-props.d.ts +4 -0
  33. package/dist/components/Timeline/should-subscribe-to-sequence-props.js +10 -0
  34. package/dist/components/Timeline/timeline-field-display-utils.js +3 -0
  35. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +2 -1
  36. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +19 -13
  37. package/dist/components/composition-menu-items.js +17 -0
  38. package/dist/components/element-drag-and-drop.d.ts +3 -0
  39. package/dist/components/element-drag-and-drop.js +30 -0
  40. package/dist/components/import-assets.d.ts +11 -0
  41. package/dist/components/import-assets.js +23 -1
  42. package/dist/components/selected-outline-uv.d.ts +71 -1
  43. package/dist/components/selected-outline-uv.js +332 -10
  44. package/dist/esm/{chunk-4rq5gt8c.js → chunk-fq0j774v.js} +3438 -1648
  45. package/dist/esm/internals.mjs +3438 -1648
  46. package/dist/esm/previewEntry.mjs +3455 -1665
  47. package/dist/esm/renderEntry.mjs +1 -1
  48. package/dist/helpers/calculate-timeline.js +6 -2
  49. package/dist/helpers/get-sequence-visible-range.d.ts +1 -0
  50. package/dist/helpers/get-sequence-visible-range.js +15 -1
  51. package/dist/helpers/timeline-layout.d.ts +3 -3
  52. package/dist/helpers/timeline-layout.js +3 -1
  53. package/dist/state/modals.d.ts +2 -0
  54. package/package.json +11 -11
  55. package/dist/components/Timeline/TimelineItemStack.d.ts +0 -5
  56. package/dist/components/Timeline/TimelineItemStack.js +0 -29
@@ -57,7 +57,6 @@ const save_sequence_prop_1 = require("./save-sequence-prop");
57
57
  const timeline_asset_link_1 = require("./timeline-asset-link");
58
58
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
59
59
  const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
60
- const TimelineItemStack_1 = require("./TimelineItemStack");
61
60
  const TimelineLayerEye_1 = require("./TimelineLayerEye");
62
61
  const TimelineMediaInfo_1 = require("./TimelineMediaInfo");
63
62
  const TimelineRowChrome_1 = require("./TimelineRowChrome");
@@ -438,17 +437,6 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
438
437
  }
439
438
  toggleTrack(nodePathInfo);
440
439
  }, [nodePathInfo, toggleTrack]);
441
- const onShowInEditorDoubleClick = (0, react_1.useCallback)((e) => {
442
- if (!canOpenInEditor) {
443
- return;
444
- }
445
- if ((0, TimelineSelection_1.isTimelineSelectionModifierEvent)(e)) {
446
- e.stopPropagation();
447
- return;
448
- }
449
- e.stopPropagation();
450
- openInEditor();
451
- }, [canOpenInEditor, openInEditor]);
452
440
  const propStatusesForOverride = (0, react_1.useMemo)(() => {
453
441
  return nodePath
454
442
  ? remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)
@@ -549,6 +537,18 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
549
537
  codeNameStatus !== undefined &&
550
538
  codeNameStatus !== null &&
551
539
  codeNameStatus.status === 'static';
540
+ const onSequenceDoubleClick = (0, react_1.useCallback)((e) => {
541
+ if ((0, TimelineSelection_1.isTimelineSelectionModifierEvent)(e)) {
542
+ e.stopPropagation();
543
+ return;
544
+ }
545
+ e.stopPropagation();
546
+ if (canRenameThisSequence) {
547
+ setIsRenaming(true);
548
+ return;
549
+ }
550
+ openInEditor();
551
+ }, [canRenameThisSequence, openInEditor]);
552
552
  const canRenameSelectedSequence = canRenameThisSequence &&
553
553
  selected &&
554
554
  selectedItems.length === 1 &&
@@ -719,7 +719,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
719
719
  subMenu: null,
720
720
  value: 'rename-sequence',
721
721
  },
722
- freezeFrameMenuItem,
722
+ ...(freezeFrameMenuItem ? [freezeFrameMenuItem] : []),
723
723
  ],
724
724
  });
725
725
  }, [
@@ -802,13 +802,14 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
802
802
  clientId: previewServerState.clientId,
803
803
  });
804
804
  }, [canDropEffect, nodePath, previewServerState, validatedLocation]);
805
- const trackRow = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent && nodePathInfo !== null ? (jsx_runtime_1.jsx(TimelineSequenceExpandArrow, { disabled: !previewConnected, isExpanded: isExpanded, nodePathInfo: nodePathInfo, onToggleExpand: onToggleExpand, sequence: sequence })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: rowStyle, selected: selected, selectable: selectable, selectionItem: selectionItem, onSelect: onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: outerHeight, onDragLeave: canDropEffect ? onEffectDragLeave : undefined, onDragOver: canDropEffect ? onEffectDragOver : undefined, onDrop: canDropEffect ? onEffectDrop : undefined, onDoubleClick: canOpenInEditor ? onShowInEditorDoubleClick : undefined, children: jsx_runtime_1.jsxs("div", { style: labelContainerStyle, children: [
805
+ const trackRow = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent && nodePathInfo !== null ? (jsx_runtime_1.jsx(TimelineSequenceExpandArrow, { disabled: !previewConnected, isExpanded: isExpanded, nodePathInfo: nodePathInfo, onToggleExpand: onToggleExpand, sequence: sequence })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: rowStyle, selected: selected, selectable: selectable, selectionItem: selectionItem, onSelect: onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: outerHeight, onDragLeave: canDropEffect ? onEffectDragLeave : undefined, onDragOver: canDropEffect ? onEffectDragOver : undefined, onDrop: canDropEffect ? onEffectDrop : undefined, onDoubleClick: canRenameThisSequence || canOpenInEditor
806
+ ? onSequenceDoubleClick
807
+ : undefined, children: jsx_runtime_1.jsxs("div", { style: labelContainerStyle, children: [
806
808
  jsx_runtime_1.jsx(TimelineSequenceName_1.TimelineSequenceName, { displayName: displayName, selected: selected, containsSelection: containsSelection, editing: isRenaming, onCancelEditing: onCancelRenaming, onSaveName: onSaveName }), mediaSrc ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
807
809
  jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }),
808
810
  " ",
809
811
  jsx_runtime_1.jsx(TimelineMediaInfo_1.TimelineMediaInfo, { src: mediaSrc })
810
- ] })) : null, jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(TimelineItemStack_1.TimelineItemStack, { originalLocation: originalLocation })
811
- ] }) }));
812
+ ] })) : null] }) }));
812
813
  const draggableTrackRow = canHandleSequenceDrag ? (jsx_runtime_1.jsxs("div", { draggable: canReorderSequence, onDragStart: onSequenceDragStart, onDragEnd: onSequenceDragEnd, onDragOver: onSequenceDragOver, onDragLeave: onSequenceDragLeave, onDrop: onSequenceDrop, style: sequenceReorderWrapper, children: [sequenceReorderLineStyle ? (jsx_runtime_1.jsx("div", { style: sequenceReorderLineStyle })) : null, sequenceDropRejection ? (jsx_runtime_1.jsx("div", { style: sequenceReorderRejectionStyle, children: sequenceDropRejection })) : null, trackRow] })) : (trackRow);
813
814
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selectable ? onSelect : null, children: draggableTrackRow })) : (draggableTrackRow), previewConnected &&
814
815
  isExpanded &&
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { OverrideIdToNodePaths, PropStatuses, SequencePropsSubscriptionKey, TSequence } from 'remotion';
2
+ import type { OverrideIdToNodePaths, PropStatuses, SequencePropsSubscriptionKey, TSequence, InteractivitySchema } from 'remotion';
3
3
  import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
4
4
  import { type SaveSequencePropChange } from './save-sequence-prop';
5
5
  import { type TimelineSelection } from './TimelineSelection';
@@ -8,6 +8,14 @@ export type TimelineSequenceDurationDragTarget = {
8
8
  readonly initialDuration: number;
9
9
  readonly nodePath: SequencePropsSubscriptionKey;
10
10
  };
11
+ export type TimelineSequenceLeftEdgeDragTarget = {
12
+ readonly fileName: string;
13
+ readonly initialDuration: number;
14
+ readonly initialFrom: number;
15
+ readonly initialTrimBefore: number;
16
+ readonly nodePath: SequencePropsSubscriptionKey;
17
+ readonly schema: InteractivitySchema;
18
+ };
11
19
  export type TimelineSequenceFromDragTarget = {
12
20
  readonly fileName: string;
13
21
  readonly initialFrom: number;
@@ -17,6 +25,25 @@ export declare const getTimelineSequenceDurationDragValue: ({ initialDuration, d
17
25
  readonly initialDuration: number;
18
26
  readonly deltaFrames: number;
19
27
  }) => number;
28
+ export declare const getTimelineSequenceLeftEdgeDragDelta: ({ initialDuration, initialTrimBefore, deltaFrames, }: {
29
+ readonly initialDuration: number;
30
+ readonly initialTrimBefore: number;
31
+ readonly deltaFrames: number;
32
+ }) => number;
33
+ export declare const getTimelineSequenceLeftEdgeDragValues: ({ initialDuration, initialFrom, initialTrimBefore, deltaFrames, }: {
34
+ readonly initialDuration: number;
35
+ readonly initialFrom: number;
36
+ readonly initialTrimBefore: number;
37
+ readonly deltaFrames: number;
38
+ }) => {
39
+ durationInFrames: number;
40
+ from: number;
41
+ trimBefore: number;
42
+ };
43
+ export declare const getTimelineSequenceLeftEdgeDragChanges: ({ targets, deltaFrames, }: {
44
+ readonly targets: readonly TimelineSequenceLeftEdgeDragTarget[];
45
+ readonly deltaFrames: number;
46
+ }) => SaveSequencePropChange[];
20
47
  export declare const getTimelineSequenceDurationDragChanges: ({ targets, deltaFrames, }: {
21
48
  readonly targets: readonly TimelineSequenceDurationDragTarget[];
22
49
  readonly deltaFrames: number;
@@ -36,6 +63,13 @@ export declare const getTimelineSequenceDurationDragTargets: ({ draggedNodePathI
36
63
  readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
37
64
  readonly propStatuses: PropStatuses;
38
65
  }) => TimelineSequenceDurationDragTarget[] | null;
66
+ export declare const getTimelineSequenceLeftEdgeDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }: {
67
+ readonly draggedNodePathInfo: SequenceNodePathInfo;
68
+ readonly selectedItems: readonly TimelineSelection[];
69
+ readonly sequences: TSequence[];
70
+ readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
71
+ readonly propStatuses: PropStatuses;
72
+ }) => TimelineSequenceLeftEdgeDragTarget[] | null;
39
73
  export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }: {
40
74
  readonly draggedNodePathInfo: SequenceNodePathInfo;
41
75
  readonly selectedItems: readonly TimelineSelection[];
@@ -43,6 +77,11 @@ export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo,
43
77
  readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
44
78
  readonly propStatuses: PropStatuses;
45
79
  }) => TimelineSequenceFromDragTarget[] | null;
80
+ export declare const TimelineSequenceLeftEdgeDragHandle: React.FC<{
81
+ readonly nodePathInfo: SequenceNodePathInfo;
82
+ readonly windowWidth: number;
83
+ readonly timelineDurationInFrames: number;
84
+ }>;
46
85
  export declare const useTimelineSequenceFromDrag: ({ nodePathInfo, windowWidth, timelineDurationInFrames, }: {
47
86
  readonly nodePathInfo: SequenceNodePathInfo | null;
48
87
  readonly windowWidth: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineSequenceRightEdgeDragHandle = exports.useTimelineSequenceFromDrag = exports.getTimelineSequenceFromDragTargets = exports.getTimelineSequenceDurationDragTargets = exports.getTimelineSequenceFromDragChanges = exports.getTimelineSequenceFromDragValue = exports.getTimelineSequenceDurationDragChanges = exports.getTimelineSequenceDurationDragValue = void 0;
3
+ exports.TimelineSequenceRightEdgeDragHandle = exports.useTimelineSequenceFromDrag = exports.TimelineSequenceLeftEdgeDragHandle = exports.getTimelineSequenceFromDragTargets = exports.getTimelineSequenceLeftEdgeDragTargets = exports.getTimelineSequenceDurationDragTargets = exports.getTimelineSequenceFromDragChanges = exports.getTimelineSequenceFromDragValue = exports.getTimelineSequenceDurationDragChanges = exports.getTimelineSequenceLeftEdgeDragChanges = exports.getTimelineSequenceLeftEdgeDragValues = exports.getTimelineSequenceLeftEdgeDragDelta = exports.getTimelineSequenceDurationDragValue = 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");
@@ -32,12 +32,25 @@ const canUpdateFrom = ({ propStatuses, nodePath, }) => {
32
32
  const status = (_b = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.from) === null || _b === void 0 ? void 0 : _b.status;
33
33
  return status === 'static';
34
34
  };
35
+ const canUpdateTrimBefore = ({ propStatuses, nodePath, }) => {
36
+ var _a, _b;
37
+ const status = (_b = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.trimBefore) === null || _b === void 0 ? void 0 : _b.status;
38
+ return status === 'static';
39
+ };
35
40
  const isDurationDraggableSequence = (sequence) => {
36
41
  return ((sequence.type === 'sequence' || sequence.type === 'image') &&
37
42
  !sequence.loopDisplay &&
38
43
  !sequence.isInsideSeries &&
39
44
  Boolean(sequence.controls));
40
45
  };
46
+ const isLeftEdgeDraggableSequence = (sequence) => {
47
+ return (!sequence.isInsideSeries &&
48
+ Boolean(sequence.controls) &&
49
+ (sequence.type === 'sequence' ||
50
+ sequence.type === 'image' ||
51
+ sequence.type === 'audio' ||
52
+ sequence.type === 'video'));
53
+ };
41
54
  const isFromDraggableSequence = (sequence) => {
42
55
  return (!sequence.loopDisplay &&
43
56
  !sequence.isInsideSeries &&
@@ -45,6 +58,68 @@ const isFromDraggableSequence = (sequence) => {
45
58
  };
46
59
  const getTimelineSequenceDurationDragValue = ({ initialDuration, deltaFrames, }) => Math.max(1, initialDuration + deltaFrames);
47
60
  exports.getTimelineSequenceDurationDragValue = getTimelineSequenceDurationDragValue;
61
+ const getTimelineSequenceLeftEdgeDragDelta = ({ initialDuration, initialTrimBefore, deltaFrames, }) => {
62
+ const minDeltaFrames = 0 - initialTrimBefore;
63
+ const maxDeltaFrames = initialDuration - 1;
64
+ return Math.max(minDeltaFrames, Math.min(deltaFrames, maxDeltaFrames));
65
+ };
66
+ exports.getTimelineSequenceLeftEdgeDragDelta = getTimelineSequenceLeftEdgeDragDelta;
67
+ const getTimelineSequenceLeftEdgeDragValues = ({ initialDuration, initialFrom, initialTrimBefore, deltaFrames, }) => {
68
+ const clampedDeltaFrames = (0, exports.getTimelineSequenceLeftEdgeDragDelta)({
69
+ initialDuration,
70
+ initialTrimBefore,
71
+ deltaFrames,
72
+ });
73
+ return {
74
+ durationInFrames: initialDuration - clampedDeltaFrames,
75
+ from: initialFrom + clampedDeltaFrames,
76
+ trimBefore: initialTrimBefore + clampedDeltaFrames,
77
+ };
78
+ };
79
+ exports.getTimelineSequenceLeftEdgeDragValues = getTimelineSequenceLeftEdgeDragValues;
80
+ const getTimelineSequenceLeftEdgeDragChanges = ({ targets, deltaFrames, }) => {
81
+ return targets.flatMap((target) => {
82
+ const nextValues = (0, exports.getTimelineSequenceLeftEdgeDragValues)({
83
+ initialDuration: target.initialDuration,
84
+ initialFrom: target.initialFrom,
85
+ initialTrimBefore: target.initialTrimBefore,
86
+ deltaFrames,
87
+ });
88
+ const changes = [];
89
+ if (nextValues.from !== target.initialFrom) {
90
+ changes.push({
91
+ fileName: target.fileName,
92
+ nodePath: target.nodePath,
93
+ fieldKey: 'from',
94
+ value: nextValues.from,
95
+ defaultValue: '0',
96
+ schema: target.schema,
97
+ });
98
+ }
99
+ if (nextValues.durationInFrames !== target.initialDuration) {
100
+ changes.push({
101
+ fileName: target.fileName,
102
+ nodePath: target.nodePath,
103
+ fieldKey: 'durationInFrames',
104
+ value: nextValues.durationInFrames,
105
+ defaultValue: null,
106
+ schema: target.schema,
107
+ });
108
+ }
109
+ if (nextValues.trimBefore !== target.initialTrimBefore) {
110
+ changes.push({
111
+ fileName: target.fileName,
112
+ nodePath: target.nodePath,
113
+ fieldKey: 'trimBefore',
114
+ value: nextValues.trimBefore,
115
+ defaultValue: '0',
116
+ schema: target.schema,
117
+ });
118
+ }
119
+ return changes;
120
+ });
121
+ };
122
+ exports.getTimelineSequenceLeftEdgeDragChanges = getTimelineSequenceLeftEdgeDragChanges;
48
123
  const getTimelineSequenceDurationDragChanges = ({ targets, deltaFrames, }) => {
49
124
  return targets.flatMap((target) => {
50
125
  const nextValue = (0, exports.getTimelineSequenceDurationDragValue)({
@@ -141,6 +216,60 @@ const getTimelineSequenceDurationDragTargets = ({ draggedNodePathInfo, selectedI
141
216
  return [...targets.values()];
142
217
  };
143
218
  exports.getTimelineSequenceDurationDragTargets = getTimelineSequenceDurationDragTargets;
219
+ const getTimelineSequenceLeftEdgeDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }) => {
220
+ var _a, _b;
221
+ const draggedSelectionKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(draggedNodePathInfo);
222
+ const selectedSequenceItems = selectedItems.filter((item) => item.type === 'sequence');
223
+ const draggedItemIsSelected = selectedSequenceItems.some((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo) ===
224
+ draggedSelectionKey);
225
+ if (draggedItemIsSelected &&
226
+ selectedSequenceItems.length !== selectedItems.length) {
227
+ return null;
228
+ }
229
+ const targetNodePathInfos = draggedItemIsSelected && selectedSequenceItems.length > 1
230
+ ? selectedSequenceItems.map((item) => item.nodePathInfo)
231
+ : [draggedNodePathInfo];
232
+ const tracks = (0, calculate_timeline_1.calculateTimeline)({ sequences, overrideIdsToNodePaths });
233
+ const targets = new Map();
234
+ for (const nodePathInfo of targetNodePathInfos) {
235
+ const track = findSequenceTrack({ tracks, nodePathInfo });
236
+ const originalSequence = track
237
+ ? sequences.find((sequence) => sequence.id === track.sequence.id)
238
+ : null;
239
+ if (!track ||
240
+ !track.nodePathInfo ||
241
+ !originalSequence ||
242
+ !isLeftEdgeDraggableSequence(originalSequence)) {
243
+ return null;
244
+ }
245
+ const nodePath = track.nodePathInfo.sequenceSubscriptionKey;
246
+ const trimsMedia = originalSequence.type === 'audio' || originalSequence.type === 'video';
247
+ if (!canUpdateFrom({ propStatuses, nodePath }) ||
248
+ !canUpdateDurationInFrames({ propStatuses, nodePath }) ||
249
+ !canUpdateTrimBefore({ propStatuses, nodePath })) {
250
+ return null;
251
+ }
252
+ const { controls } = originalSequence;
253
+ if (!controls) {
254
+ return null;
255
+ }
256
+ const key = (0, studio_shared_1.stringifySequenceSubscriptionKey)(nodePath);
257
+ if (!targets.has(key)) {
258
+ targets.set(key, {
259
+ fileName: nodePath.absolutePath,
260
+ initialDuration: originalSequence.duration,
261
+ initialFrom: originalSequence.from,
262
+ initialTrimBefore: trimsMedia
263
+ ? ((_a = originalSequence.trimBefore) !== null && _a !== void 0 ? _a : Math.max(0, originalSequence.startMediaFrom))
264
+ : ((_b = originalSequence.trimBefore) !== null && _b !== void 0 ? _b : 0),
265
+ nodePath,
266
+ schema: controls.schema,
267
+ });
268
+ }
269
+ }
270
+ return [...targets.values()];
271
+ };
272
+ exports.getTimelineSequenceLeftEdgeDragTargets = getTimelineSequenceLeftEdgeDragTargets;
144
273
  const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }) => {
145
274
  const draggedSelectionKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(draggedNodePathInfo);
146
275
  const selectedSequenceItems = selectedItems.filter((item) => item.type === 'sequence');
@@ -182,6 +311,11 @@ const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems
182
311
  return [...targets.values()];
183
312
  };
184
313
  exports.getTimelineSequenceFromDragTargets = getTimelineSequenceFromDragTargets;
314
+ const clearLeftEdgeDragOverrides = ({ clearDragOverrides, targets, }) => {
315
+ for (const target of targets) {
316
+ clearDragOverrides(target.nodePath);
317
+ }
318
+ };
185
319
  const clearDurationDragOverrides = ({ clearDragOverrides, targets, }) => {
186
320
  for (const target of targets) {
187
321
  clearDragOverrides(target.nodePath);
@@ -192,6 +326,179 @@ const clearFromDragOverrides = ({ clearDragOverrides, targets, }) => {
192
326
  clearDragOverrides(target.nodePath);
193
327
  }
194
328
  };
329
+ const TimelineSequenceLeftEdgeDragHandle = ({ nodePathInfo, windowWidth, timelineDurationInFrames }) => {
330
+ const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
331
+ const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
332
+ const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
333
+ const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
334
+ const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
335
+ const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
336
+ const [dragging, setDragging] = (0, react_1.useState)(false);
337
+ const dragStateRef = (0, react_1.useRef)(null);
338
+ const latestRef = (0, react_1.useRef)({
339
+ nodePathInfo,
340
+ setPropStatuses,
341
+ setDragOverrides,
342
+ clearDragOverrides,
343
+ previewServerState,
344
+ overrideIdToNodePathMappings,
345
+ });
346
+ latestRef.current = {
347
+ nodePathInfo,
348
+ setPropStatuses,
349
+ setDragOverrides,
350
+ clearDragOverrides,
351
+ previewServerState,
352
+ overrideIdToNodePathMappings,
353
+ };
354
+ const finishDrag = (0, react_1.useCallback)((commit) => {
355
+ const dragState = dragStateRef.current;
356
+ dragStateRef.current = null;
357
+ document.body.style.userSelect = '';
358
+ document.body.style.webkitUserSelect = '';
359
+ (0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
360
+ setDragging(false);
361
+ if (!dragState) {
362
+ return;
363
+ }
364
+ const { setPropStatuses: latestSetPropStatuses, clearDragOverrides: latestClear, previewServerState: latestServerState, } = latestRef.current;
365
+ const changes = (0, exports.getTimelineSequenceLeftEdgeDragChanges)({
366
+ targets: dragState.targets,
367
+ deltaFrames: dragState.latestDeltaFrames,
368
+ });
369
+ if (!commit ||
370
+ latestServerState.type !== 'connected' ||
371
+ changes.length === 0) {
372
+ clearLeftEdgeDragOverrides({
373
+ clearDragOverrides: latestClear,
374
+ targets: dragState.targets,
375
+ });
376
+ return;
377
+ }
378
+ const savePromise = (0, save_sequence_prop_1.saveSequenceProps)({
379
+ changes,
380
+ setPropStatuses: latestSetPropStatuses,
381
+ clientId: latestServerState.clientId,
382
+ undoLabel: dragState.targets.length > 1
383
+ ? 'Resize selected sequences'
384
+ : 'Resize sequence',
385
+ redoLabel: dragState.targets.length > 1
386
+ ? 'Resize selected sequences back'
387
+ : 'Resize sequence back',
388
+ });
389
+ savePromise
390
+ .catch((err) => {
391
+ remotion_1.Internals.Log.error({ logLevel: 'error', tag: null }, 'Could not save left edge drag', err);
392
+ })
393
+ .finally(() => {
394
+ clearLeftEdgeDragOverrides({
395
+ clearDragOverrides: latestClear,
396
+ targets: dragState.targets,
397
+ });
398
+ });
399
+ }, []);
400
+ const onPointerDown = (0, react_1.useCallback)((e) => {
401
+ if (e.button !== 0) {
402
+ return;
403
+ }
404
+ const pxPerFrame = timelineDurationInFrames > 0
405
+ ? (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2) / timelineDurationInFrames
406
+ : 0;
407
+ if (pxPerFrame <= 0) {
408
+ return;
409
+ }
410
+ const { nodePathInfo: latestNodePathInfo, overrideIdToNodePathMappings: latestOverrideIdsToNodePaths, } = latestRef.current;
411
+ const { selectedItems: latestSelectedItems } = currentSelection.current;
412
+ const targets = (0, exports.getTimelineSequenceLeftEdgeDragTargets)({
413
+ draggedNodePathInfo: latestNodePathInfo,
414
+ selectedItems: latestSelectedItems,
415
+ sequences: sequencesRef.current,
416
+ overrideIdsToNodePaths: latestOverrideIdsToNodePaths,
417
+ propStatuses: propStatusesRef.current,
418
+ });
419
+ if (targets === null || targets.length === 0) {
420
+ return;
421
+ }
422
+ e.stopPropagation();
423
+ e.preventDefault();
424
+ dragStateRef.current = {
425
+ initialClientX: e.clientX,
426
+ latestDeltaFrames: 0,
427
+ pxPerFrame,
428
+ pointerId: e.pointerId,
429
+ targets,
430
+ };
431
+ document.body.style.userSelect = 'none';
432
+ document.body.style.webkitUserSelect = 'none';
433
+ (0, ForceSpecificCursor_1.forceSpecificCursor)('ew-resize');
434
+ setDragging(true);
435
+ }, [
436
+ currentSelection,
437
+ propStatusesRef,
438
+ sequencesRef,
439
+ timelineDurationInFrames,
440
+ windowWidth,
441
+ ]);
442
+ (0, react_1.useEffect)(() => {
443
+ if (!dragging) {
444
+ return;
445
+ }
446
+ const onMove = (e) => {
447
+ const dragState = dragStateRef.current;
448
+ if (!dragState || e.pointerId !== dragState.pointerId) {
449
+ return;
450
+ }
451
+ const dx = e.clientX - dragState.initialClientX;
452
+ const deltaFrames = Math.round(dx / dragState.pxPerFrame);
453
+ dragState.latestDeltaFrames = deltaFrames;
454
+ for (const target of dragState.targets) {
455
+ const nextValues = (0, exports.getTimelineSequenceLeftEdgeDragValues)({
456
+ initialDuration: target.initialDuration,
457
+ initialFrom: target.initialFrom,
458
+ initialTrimBefore: target.initialTrimBefore,
459
+ deltaFrames,
460
+ });
461
+ latestRef.current.setDragOverrides(target.nodePath, 'from', remotion_1.Internals.makeStaticDragOverride(nextValues.from));
462
+ latestRef.current.setDragOverrides(target.nodePath, 'durationInFrames', remotion_1.Internals.makeStaticDragOverride(nextValues.durationInFrames));
463
+ latestRef.current.setDragOverrides(target.nodePath, 'trimBefore', remotion_1.Internals.makeStaticDragOverride(nextValues.trimBefore));
464
+ }
465
+ };
466
+ const onUp = (e) => {
467
+ const dragState = dragStateRef.current;
468
+ if (!dragState || e.pointerId !== dragState.pointerId) {
469
+ return;
470
+ }
471
+ finishDrag(true);
472
+ };
473
+ const onCancel = (e) => {
474
+ const dragState = dragStateRef.current;
475
+ if (!dragState || e.pointerId !== dragState.pointerId) {
476
+ return;
477
+ }
478
+ finishDrag(false);
479
+ };
480
+ const onWindowBlur = () => {
481
+ finishDrag(false);
482
+ };
483
+ window.addEventListener('pointermove', onMove);
484
+ window.addEventListener('pointerup', onUp);
485
+ window.addEventListener('pointercancel', onCancel);
486
+ window.addEventListener('blur', onWindowBlur);
487
+ return () => {
488
+ window.removeEventListener('pointermove', onMove);
489
+ window.removeEventListener('pointerup', onUp);
490
+ window.removeEventListener('pointercancel', onCancel);
491
+ window.removeEventListener('blur', onWindowBlur);
492
+ };
493
+ }, [dragging, finishDrag]);
494
+ const style = {
495
+ ...baseStyle,
496
+ left: 0,
497
+ background: 'transparent',
498
+ };
499
+ return (jsx_runtime_1.jsx("div", { role: "separator", "aria-orientation": "vertical", title: "Drag to trim start", style: style, onPointerDown: onPointerDown }));
500
+ };
501
+ exports.TimelineSequenceLeftEdgeDragHandle = TimelineSequenceLeftEdgeDragHandle;
195
502
  const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurationInFrames, }) => {
196
503
  const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
197
504
  const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
@@ -48,8 +48,7 @@ const TimelineTrackUnmemoized = ({ track }) => {
48
48
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
49
49
  const previewServerConnected = previewServerState.type === 'connected';
50
50
  const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
51
- const { selected: rowSelected } = (0, TimelineSelection_1.useTimelineRowSelection)(track.nodePathInfo);
52
- const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(track.nodePathInfo);
51
+ const rowHighlightBackground = (0, TimelineSelection_1.useTimelineRowHighlightBackground)(track.nodePathInfo);
53
52
  const layerStyle = (0, react_1.useMemo)(() => ({
54
53
  height: (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type),
55
54
  marginBottom: timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
@@ -58,9 +57,8 @@ const TimelineTrackUnmemoized = ({ track }) => {
58
57
  const showExpandedKeyframes = track.nodePathInfo !== null &&
59
58
  previewServerConnected &&
60
59
  getIsExpanded(track.nodePathInfo);
61
- const showRowHighlight = track.nodePathInfo !== null && (rowSelected || containsSelection);
62
60
  return (jsx_runtime_1.jsxs("div", { children: [
63
- jsx_runtime_1.jsxs("div", { style: layerStyle, children: [showRowHighlight && timelineWidth !== null ? (jsx_runtime_1.jsx("div", { style: (0, TimelineSelection_1.getTimelineSelectedTrackHighlightStyle)(timelineWidth) })) : null, jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence, nodePathInfo: track.nodePathInfo, sequenceFrameOffset: track.sequenceFrameOffset })
61
+ jsx_runtime_1.jsxs("div", { style: layerStyle, children: [rowHighlightBackground && timelineWidth !== null ? (jsx_runtime_1.jsx("div", { style: (0, TimelineSelection_1.getTimelineSelectedTrackHighlightStyle)(timelineWidth, rowHighlightBackground) })) : null, jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence, nodePathInfo: track.nodePathInfo, sequenceFrameOffset: track.sequenceFrameOffset })
64
62
  ] }), showExpandedKeyframes && track.nodePathInfo ? (jsx_runtime_1.jsx(TimelineExpandedTrackKeyframes_1.TimelineExpandedTrackKeyframes, { sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset })) : null] }));
65
63
  };
66
64
  exports.TimelineTrack = react_1.default.memo(TimelineTrackUnmemoized);
@@ -0,0 +1,4 @@
1
+ import type { TSequence } from 'remotion';
2
+ export declare const shouldSubscribeToSequenceProps: (sequence: TSequence, previewConnected: boolean) => sequence is TSequence & {
3
+ readonly controls: import("remotion").SequenceControls;
4
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldSubscribeToSequenceProps = void 0;
4
+ const shouldSubscribeToSequenceProps = (sequence, previewConnected) => {
5
+ return (sequence.showInTimeline &&
6
+ Boolean(sequence.controls) &&
7
+ previewConnected &&
8
+ Boolean(sequence.getStack()));
9
+ };
10
+ exports.shouldSubscribeToSequenceProps = shouldSubscribeToSequenceProps;
@@ -214,6 +214,9 @@ const formatTimelineFieldValueForDisplay = ({ fieldSchema, value, }) => {
214
214
  if (!fieldSchema) {
215
215
  return formatUnknownTimelineValueForDisplay(value);
216
216
  }
217
+ if (value === undefined) {
218
+ return 'unset';
219
+ }
217
220
  switch (fieldSchema.type) {
218
221
  case 'number':
219
222
  return ((_a = formatNumberTimelineFieldValueForDisplay({ fieldSchema, value })) !== null && _a !== void 0 ? _a : formatUnknownTimelineValueForDisplay(value));
@@ -1,6 +1,7 @@
1
1
  import type { CanUpdateSequencePropStatus, SequencePropsSubscriptionKey, TSequence } from 'remotion';
2
2
  import type { ComboboxValue } from '../NewComposition/ComboBox';
3
3
  import { type SetPropStatuses } from './save-sequence-prop';
4
+ export declare const shouldShowFreezeFrameMenuItem: (sequence: TSequence) => boolean;
4
5
  export declare const useSequenceFreezeFrameMenuItem: ({ clientId, nodePath, propStatusesForOverride, sequence, sequenceFrameOffset, setPropStatuses, timelinePosition, validatedSource, }: {
5
6
  readonly clientId: string | null;
6
7
  readonly nodePath: SequencePropsSubscriptionKey | null;
@@ -10,4 +11,4 @@ export declare const useSequenceFreezeFrameMenuItem: ({ clientId, nodePath, prop
10
11
  readonly setPropStatuses: SetPropStatuses;
11
12
  readonly timelinePosition: number;
12
13
  readonly validatedSource: string | null;
13
- }) => ComboboxValue;
14
+ }) => ComboboxValue | null;
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSequenceFreezeFrameMenuItem = void 0;
3
+ exports.useSequenceFreezeFrameMenuItem = exports.shouldShowFreezeFrameMenuItem = void 0;
4
4
  const react_1 = require("react");
5
5
  const save_sequence_prop_1 = require("./save-sequence-prop");
6
+ const shouldShowFreezeFrameMenuItem = (sequence) => {
7
+ return sequence.type !== 'audio';
8
+ };
9
+ exports.shouldShowFreezeFrameMenuItem = shouldShowFreezeFrameMenuItem;
6
10
  const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOverride, sequence, sequenceFrameOffset, setPropStatuses, timelinePosition, validatedSource, }) => {
7
11
  const freezeStatus = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.freeze;
8
12
  const isFrozen = (freezeStatus === null || freezeStatus === void 0 ? void 0 : freezeStatus.status) === 'static' &&
@@ -57,17 +61,19 @@ const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOve
57
61
  timelinePosition,
58
62
  validatedSource,
59
63
  ]);
60
- return (0, react_1.useMemo)(() => ({
61
- type: 'item',
62
- id: 'toggle-freeze-frame',
63
- keyHint: null,
64
- label: isFrozen ? 'Unfreeze frame' : 'Freeze frame',
65
- leftItem: null,
66
- disabled: !canToggleFreeze,
67
- onClick: onToggleFreezeFrame,
68
- quickSwitcherLabel: null,
69
- subMenu: null,
70
- value: 'toggle-freeze-frame',
71
- }), [canToggleFreeze, isFrozen, onToggleFreezeFrame]);
64
+ return (0, react_1.useMemo)(() => (0, exports.shouldShowFreezeFrameMenuItem)(sequence)
65
+ ? {
66
+ type: 'item',
67
+ id: 'toggle-freeze-frame',
68
+ keyHint: null,
69
+ label: isFrozen ? 'Unfreeze frame' : 'Freeze frame',
70
+ leftItem: null,
71
+ disabled: !canToggleFreeze,
72
+ onClick: onToggleFreezeFrame,
73
+ quickSwitcherLabel: null,
74
+ subMenu: null,
75
+ value: 'toggle-freeze-frame',
76
+ }
77
+ : null, [canToggleFreeze, isFrozen, onToggleFreezeFrame, sequence]);
72
78
  };
73
79
  exports.useSequenceFreezeFrameMenuItem = useSequenceFreezeFrameMenuItem;
@@ -99,6 +99,23 @@ const getCompositionMenuItems = ({ composition, connectionStatus, resolvedLocati
99
99
  id: 'show-in-editor-divider',
100
100
  }
101
101
  : null,
102
+ {
103
+ id: 'new',
104
+ keyHint: null,
105
+ label: `New...`,
106
+ leftItem: null,
107
+ onClick: () => {
108
+ closeMenu();
109
+ setSelectedModal({
110
+ type: 'new-comp',
111
+ });
112
+ },
113
+ quickSwitcherLabel: 'New composition...',
114
+ subMenu: null,
115
+ type: 'item',
116
+ value: 'new',
117
+ disabled: readOnlyStudio,
118
+ },
102
119
  {
103
120
  id: 'rename',
104
121
  keyHint: null,
@@ -0,0 +1,3 @@
1
+ import { type ElementDragData } from '@remotion/studio-shared';
2
+ export declare const hasElementDragType: (dataTransfer: DataTransfer | null) => boolean;
3
+ export declare const getElementDragData: (dataTransfer: DataTransfer | null) => ElementDragData | null;