@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
@@ -44,21 +44,32 @@ const use_max_media_duration_1 = require("../../helpers/use-max-media-duration")
44
44
  const AudioWaveform_1 = require("../AudioWaveform");
45
45
  const LoopedTimelineIndicators_1 = require("./LoopedTimelineIndicators");
46
46
  const TimelineImageInfo_1 = require("./TimelineImageInfo");
47
+ const TimelineSelection_1 = require("./TimelineSelection");
47
48
  const TimelineSequenceFrame_1 = require("./TimelineSequenceFrame");
48
49
  const TimelineVideoInfo_1 = require("./TimelineVideoInfo");
49
50
  const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
50
51
  const AUDIO_GRADIENT = 'linear-gradient(rgb(16 171 58), rgb(43 165 63) 60%)';
51
52
  const VIDEO_GRADIENT = 'linear-gradient(to top, #8e44ad, #9b59b6)';
52
53
  const IMAGE_GRADIENT = 'linear-gradient(to top, #2980b9, #3498db)';
53
- const TimelineSequenceFn = ({ s }) => {
54
+ const TimelineSequenceFn = ({ s, nodePathInfo }) => {
54
55
  const windowWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
55
56
  if (windowWidth === null) {
56
57
  return null;
57
58
  }
58
- return jsx_runtime_1.jsx(TimelineSequenceInner, { windowWidth: windowWidth, s: s });
59
+ return (jsx_runtime_1.jsx(TimelineSequenceInner, { windowWidth: windowWidth, s: s, nodePathInfo: nodePathInfo }));
59
60
  };
60
- const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidth, postmountWidth, style, children, }) => {
61
+ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidth, postmountWidth, style, children, nodePathInfo, }) => {
61
62
  var _a, _b;
63
+ const { onSelect, selectable } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
64
+ const onPointerDown = (0, react_1.useCallback)((e) => {
65
+ if (e.button === 0) {
66
+ e.stopPropagation();
67
+ onSelect({
68
+ shiftKey: e.shiftKey,
69
+ toggleKey: e.metaKey || e.ctrlKey,
70
+ });
71
+ }
72
+ }, [onSelect]);
62
73
  const frame = (0, remotion_1.useCurrentFrame)();
63
74
  const relativeFrame = frame - s.from;
64
75
  const relativeFrameWithPremount = relativeFrame + ((_a = s.premountDisplay) !== null && _a !== void 0 ? _a : 0);
@@ -75,9 +86,10 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidt
75
86
  return {
76
87
  ...style,
77
88
  opacity: isInRange ? 1 : 0.5,
89
+ ...(TimelineSelection_1.TIMELINE_TOP_DRAG ? { cursor: 'pointer' } : {}),
78
90
  };
79
91
  }, [isInRange, style]);
80
- return (jsx_runtime_1.jsxs("div", { style: actualStyle, title: s.displayName, children: [premountWidth ? (jsx_runtime_1.jsx("div", { style: {
92
+ return (jsx_runtime_1.jsxs("div", { style: actualStyle, title: s.displayName, onPointerDown: selectable ? onPointerDown : undefined, children: [premountWidth ? (jsx_runtime_1.jsx("div", { style: {
81
93
  width: premountWidth,
82
94
  height: '100%',
83
95
  background: `repeating-linear-gradient(
@@ -111,7 +123,7 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidt
111
123
  alignItems: 'center',
112
124
  }, children: jsx_runtime_1.jsx(TimelineSequenceFrame_1.TimelineSequenceFrame, { premounted: isPremounting, postmounted: isPostmounting ? s.duration - 1 : null, roundedFrame: roundedFrame }) })) : null] }));
113
125
  };
114
- const TimelineSequenceInner = ({ s, windowWidth }) => {
126
+ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo }) => {
115
127
  // If a duration is 1, it is essentially a still and it should have width 0
116
128
  // Some compositions may not be longer than their media duration,
117
129
  // if that is the case, it needs to be asynchronously determined
@@ -165,6 +177,6 @@ const TimelineSequenceInner = ({ s, windowWidth }) => {
165
177
  if (maxMediaDuration === null && !s.loopDisplay) {
166
178
  return null;
167
179
  }
168
- return (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, 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 })) : 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 }))] }));
180
+ return (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, 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 })) : 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 }))] }));
169
181
  };
170
182
  exports.TimelineSequence = react_1.default.memo(TimelineSequenceFn);
@@ -8,6 +8,7 @@ const relativeFrameStyle = {
8
8
  color: 'white',
9
9
  opacity: 0.5,
10
10
  whiteSpace: 'nowrap',
11
+ pointerEvents: 'none',
11
12
  };
12
13
  const TimelineSequenceFrame = ({ roundedFrame, premounted, postmounted }) => {
13
14
  return (jsx_runtime_1.jsx("div", { style: relativeFrameStyle, children: premounted
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { TSequence } from 'remotion';
3
3
  import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
4
- export declare const TimelineListItem: React.FC<{
4
+ export declare const TimelineSequenceItem: React.FC<{
5
5
  readonly sequence: TSequence;
6
6
  readonly nestedDepth: number;
7
- readonly isCompact: boolean;
8
7
  readonly nodePathInfo: SequenceNodePathInfo | null;
8
+ readonly keyframeDisplayOffset: number;
9
9
  }>;
@@ -1,26 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineListItem = void 0;
3
+ exports.TimelineSequenceItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
+ const no_react_1 = require("remotion/no-react");
7
8
  const client_id_1 = require("../../helpers/client-id");
8
- const colors_1 = require("../../helpers/colors");
9
+ const format_file_location_1 = require("../../helpers/format-file-location");
9
10
  const timeline_layout_1 = require("../../helpers/timeline-layout");
10
11
  const call_api_1 = require("../call-api");
11
12
  const ContextMenu_1 = require("../ContextMenu");
12
13
  const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
13
14
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
15
+ const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
14
16
  const save_sequence_prop_1 = require("./save-sequence-prop");
15
- const timeline_row_layout_1 = require("./timeline-row-layout");
16
17
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
17
18
  const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
19
+ const TimelineItemStack_1 = require("./TimelineItemStack");
18
20
  const TimelineLayerEye_1 = require("./TimelineLayerEye");
19
21
  const TimelineMediaInfo_1 = require("./TimelineMediaInfo");
20
22
  const TimelineRowChrome_1 = require("./TimelineRowChrome");
21
- const TimelineStack_1 = require("./TimelineStack");
22
- const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
23
- const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) => {
23
+ const TimelineSelection_1 = require("./TimelineSelection");
24
+ const TimelineSequenceName_1 = require("./TimelineSequenceName");
25
+ const use_open_sequence_in_editor_1 = require("./use-open-sequence-in-editor");
26
+ const labelContainerStyle = {
27
+ alignItems: 'center',
28
+ alignSelf: 'stretch',
29
+ display: 'flex',
30
+ flexDirection: 'row',
31
+ minWidth: 0,
32
+ gap: 4,
33
+ };
34
+ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDisplayOffset }) => {
24
35
  var _a;
25
36
  var _b;
26
37
  const nodePath = (_b = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _b !== void 0 ? _b : null;
@@ -30,7 +41,14 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
30
41
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
31
42
  const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
32
43
  const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
33
- const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(sequence.getStack);
44
+ const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
45
+ const { onSelect, selectable, selected } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
46
+ const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(nodePathInfo);
47
+ const { canOpenInEditor, openInEditor, originalLocation } = (0, use_open_sequence_in_editor_1.useOpenSequenceInEditor)(sequence);
48
+ const fileLocation = (0, react_1.useMemo)(() => (0, format_file_location_1.formatFileLocation)({
49
+ location: originalLocation,
50
+ root: window.remotion_cwd,
51
+ }), [originalLocation]);
34
52
  const validatedLocation = (0, react_1.useMemo)(() => {
35
53
  var _a;
36
54
  if (!originalLocation ||
@@ -47,35 +65,12 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
47
65
  const canDeleteFromSource = Boolean(nodePath && (validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source));
48
66
  const deleteDisabled = (0, react_1.useMemo)(() => !previewConnected || !sequence.controls || !canDeleteFromSource, [previewConnected, sequence.controls, canDeleteFromSource]);
49
67
  const duplicateDisabled = deleteDisabled;
50
- const onDuplicateSequenceFromSource = (0, react_1.useCallback)(async () => {
51
- if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
68
+ const onDuplicateSequenceFromSource = (0, react_1.useCallback)(() => {
69
+ if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePathInfo) {
52
70
  return;
53
71
  }
54
- if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
55
- const message = 'This sequence is programmatically duplicated ' +
56
- nodePathInfo.numberOfSequencesWithThisNodePath +
57
- ' times in the code. Duplicating inserts another copy. Continue?';
58
- // eslint-disable-next-line no-alert -- native confirm before applying duplicate codemod in .map callbacks
59
- if (!window.confirm(message)) {
60
- return;
61
- }
62
- }
63
- try {
64
- const result = await (0, call_api_1.callApi)('/api/duplicate-jsx-node', {
65
- fileName: validatedLocation.source,
66
- nodePath: nodePath.nodePath,
67
- });
68
- if (result.success) {
69
- (0, NotificationCenter_1.showNotification)('Duplicated sequence in source file', 2000);
70
- }
71
- else {
72
- (0, NotificationCenter_1.showNotification)(result.reason, 4000);
73
- }
74
- }
75
- catch (err) {
76
- (0, NotificationCenter_1.showNotification)(err.message, 4000);
77
- }
78
- }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
72
+ (0, duplicate_selected_timeline_item_1.duplicateSequencesFromSource)([nodePathInfo]).catch(() => undefined);
73
+ }, [nodePathInfo, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source]);
79
74
  const onDeleteSequenceFromSource = (0, react_1.useCallback)(async () => {
80
75
  if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
81
76
  return;
@@ -91,8 +86,12 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
91
86
  }
92
87
  try {
93
88
  const result = await (0, call_api_1.callApi)('/api/delete-jsx-node', {
94
- fileName: validatedLocation.source,
95
- nodePath: nodePath.nodePath,
89
+ nodes: [
90
+ {
91
+ fileName: validatedLocation.source,
92
+ nodePath: nodePath.nodePath,
93
+ },
94
+ ],
96
95
  });
97
96
  if (result.success) {
98
97
  (0, NotificationCenter_1.showNotification)('Removed sequence from source file', 2000);
@@ -105,11 +104,97 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
105
104
  (0, NotificationCenter_1.showNotification)(err.message, 4000);
106
105
  }
107
106
  }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
107
+ const mediaSrc = sequence.type === 'audio' ||
108
+ sequence.type === 'video' ||
109
+ sequence.type === 'image'
110
+ ? sequence.src
111
+ : null;
112
+ const assetLinkInfo = (0, react_1.useMemo)(() => (mediaSrc ? (0, TimelineMediaInfo_1.getTimelineAssetLinkInfo)(mediaSrc) : null), [mediaSrc]);
108
113
  const contextMenuValues = (0, react_1.useMemo)(() => {
109
114
  if (!previewConnected) {
110
115
  return [];
111
116
  }
117
+ const editorName = window.remotion_editorName;
118
+ const { documentationLink } = sequence;
112
119
  return [
120
+ editorName
121
+ ? {
122
+ type: 'item',
123
+ id: 'show-in-editor',
124
+ keyHint: null,
125
+ label: `Show in ${editorName}`,
126
+ leftItem: null,
127
+ disabled: !canOpenInEditor,
128
+ onClick: () => {
129
+ openInEditor();
130
+ },
131
+ quickSwitcherLabel: null,
132
+ subMenu: null,
133
+ value: 'show-in-editor',
134
+ }
135
+ : null,
136
+ {
137
+ type: 'item',
138
+ id: 'copy-file-location',
139
+ keyHint: null,
140
+ label: 'Copy file location',
141
+ leftItem: null,
142
+ disabled: !fileLocation,
143
+ onClick: () => {
144
+ if (!fileLocation) {
145
+ return;
146
+ }
147
+ navigator.clipboard
148
+ .writeText(fileLocation)
149
+ .then(() => {
150
+ (0, NotificationCenter_1.showNotification)('Copied file location to clipboard', 1000);
151
+ })
152
+ .catch((err) => {
153
+ (0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
154
+ });
155
+ },
156
+ quickSwitcherLabel: null,
157
+ subMenu: null,
158
+ value: 'copy-file-location',
159
+ },
160
+ documentationLink
161
+ ? {
162
+ type: 'item',
163
+ id: 'open-component-docs',
164
+ keyHint: null,
165
+ label: 'Open component docs',
166
+ leftItem: null,
167
+ disabled: false,
168
+ onClick: () => {
169
+ window.open(documentationLink, '_blank', 'noopener,noreferrer');
170
+ },
171
+ quickSwitcherLabel: null,
172
+ subMenu: null,
173
+ value: 'open-component-docs',
174
+ }
175
+ : null,
176
+ assetLinkInfo
177
+ ? {
178
+ type: 'item',
179
+ id: 'show-asset',
180
+ keyHint: null,
181
+ label: 'Show asset',
182
+ leftItem: null,
183
+ disabled: false,
184
+ onClick: () => {
185
+ (0, TimelineMediaInfo_1.openTimelineAssetLink)(assetLinkInfo, setCanvasContent);
186
+ },
187
+ quickSwitcherLabel: null,
188
+ subMenu: null,
189
+ value: 'show-asset',
190
+ }
191
+ : null,
192
+ documentationLink
193
+ ? {
194
+ type: 'divider',
195
+ id: 'open-component-docs-divider',
196
+ }
197
+ : null,
113
198
  {
114
199
  type: 'item',
115
200
  id: 'duplicate-sequence',
@@ -144,13 +229,19 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
144
229
  subMenu: null,
145
230
  value: 'delete-sequence',
146
231
  },
147
- ];
232
+ ].filter(no_react_1.NoReactInternals.truthy);
148
233
  }, [
234
+ assetLinkInfo,
149
235
  deleteDisabled,
150
236
  duplicateDisabled,
237
+ fileLocation,
151
238
  onDeleteSequenceFromSource,
152
239
  onDuplicateSequenceFromSource,
240
+ canOpenInEditor,
241
+ openInEditor,
153
242
  previewConnected,
243
+ sequence,
244
+ setCanvasContent,
154
245
  ]);
155
246
  const isExpanded = previewConnected && nodePathInfo !== null && getIsExpanded(nodePathInfo);
156
247
  const onToggleExpand = (0, react_1.useCallback)(() => {
@@ -159,6 +250,17 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
159
250
  }
160
251
  toggleTrack(nodePathInfo);
161
252
  }, [nodePathInfo, toggleTrack]);
253
+ const onShowInEditorDoubleClick = (0, react_1.useCallback)((e) => {
254
+ if (!TimelineSelection_1.SELECTION_ENABLED || !canOpenInEditor) {
255
+ return;
256
+ }
257
+ if ((0, TimelineSelection_1.isTimelineSelectionModifierEvent)(e)) {
258
+ e.stopPropagation();
259
+ return;
260
+ }
261
+ e.stopPropagation();
262
+ openInEditor();
263
+ }, [canOpenInEditor, openInEditor]);
162
264
  const codeValuesForOverride = (0, react_1.useMemo)(() => {
163
265
  return nodePath
164
266
  ? remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)
@@ -209,14 +311,7 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
209
311
  setCodeValues,
210
312
  validatedLocation,
211
313
  ]);
212
- const outer = (0, react_1.useMemo)(() => {
213
- return {
214
- height: (0, timeline_layout_1.getTimelineLayerHeight)(sequence.type) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
215
- borderBottom: `1px solid ${colors_1.TIMELINE_TRACK_SEPARATOR}`,
216
- display: 'flex',
217
- flexDirection: 'column',
218
- };
219
- }, [sequence.type]);
314
+ const outerHeight = (0, react_1.useMemo)(() => (0, timeline_layout_1.getTimelineLayerHeight)(sequence.type) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM, [sequence.type]);
220
315
  const inner = (0, react_1.useMemo)(() => {
221
316
  return {
222
317
  height: timeline_layout_1.TIMELINE_LIST_ITEM_ROW_HEIGHT,
@@ -227,20 +322,6 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
227
322
  flexShrink: 0,
228
323
  };
229
324
  }, []);
230
- const mediaInfoStyle = (0, react_1.useMemo)(() => {
231
- return {
232
- paddingLeft: (0, timeline_row_layout_1.getTimelineRowLeftChromeWidth)(nestedDepth),
233
- paddingRight: 8,
234
- marginTop: -6,
235
- overflow: 'hidden',
236
- minHeight: 0,
237
- };
238
- }, [nestedDepth]);
239
- const mediaSrc = sequence.type === 'audio' ||
240
- sequence.type === 'video' ||
241
- sequence.type === 'image'
242
- ? sequence.src
243
- : null;
244
325
  const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
245
326
  const canToggleVisibility = previewConnected &&
246
327
  Boolean(sequence.controls) &&
@@ -249,11 +330,15 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
249
330
  codeHiddenStatus !== undefined &&
250
331
  codeHiddenStatus !== null &&
251
332
  codeHiddenStatus.canUpdate;
252
- const trackRow = (jsx_runtime_1.jsxs("div", { style: outer, children: [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 ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: !previewConnected || nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: inner, children: jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation }) }), mediaSrc ? (jsx_runtime_1.jsx("div", { style: mediaInfoStyle, children: jsx_runtime_1.jsx(TimelineMediaInfo_1.TimelineMediaInfo, { src: mediaSrc, type: sequence.type }) })) : null] }));
253
- return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), previewConnected &&
333
+ 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 ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: !previewConnected || nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: inner, selected: selected, selectable: selectable, onSelect: onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: outerHeight, onDoubleClick: TimelineSelection_1.SELECTION_ENABLED && canOpenInEditor
334
+ ? onShowInEditorDoubleClick
335
+ : undefined, children: jsx_runtime_1.jsxs("div", { style: labelContainerStyle, children: [
336
+ jsx_runtime_1.jsx(TimelineSequenceName_1.TimelineSequenceName, { sequence: sequence, selected: selected, containsSelection: containsSelection }), mediaSrc ? jsx_runtime_1.jsx(TimelineMediaInfo_1.TimelineMediaInfo, { src: mediaSrc }) : null, jsx_runtime_1.jsx(TimelineItemStack_1.TimelineItemStack, { originalLocation: originalLocation })
337
+ ] }) }));
338
+ 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: trackRow })) : (trackRow), previewConnected &&
254
339
  isExpanded &&
255
340
  hasExpandableContent &&
256
341
  nodePathInfo &&
257
- validatedLocation ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, validatedLocation: validatedLocation, nodePathInfo: nodePathInfo, nestedDepth: nestedDepth })) : null] }));
342
+ validatedLocation ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, validatedLocation: validatedLocation, nodePathInfo: nodePathInfo, nestedDepth: nestedDepth, keyframeDisplayOffset: keyframeDisplayOffset })) : null] }));
258
343
  };
259
- exports.TimelineListItem = TimelineListItem;
344
+ exports.TimelineSequenceItem = TimelineSequenceItem;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { TSequence } from 'remotion';
3
+ export declare const TimelineSequenceName: React.FC<{
4
+ readonly sequence: TSequence;
5
+ readonly selected: boolean;
6
+ readonly containsSelection: boolean;
7
+ }>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimelineSequenceName = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const TimelineSelection_1 = require("./TimelineSelection");
7
+ const MAX_DISPLAY_NAME_LENGTH = 1000;
8
+ const getTruncatedDisplayName = (displayName) => {
9
+ if (displayName.length > MAX_DISPLAY_NAME_LENGTH) {
10
+ return displayName.slice(0, MAX_DISPLAY_NAME_LENGTH) + '...';
11
+ }
12
+ return displayName;
13
+ };
14
+ const TimelineSequenceName = ({ sequence, selected, containsSelection }) => {
15
+ const [hovered, setHovered] = (0, react_1.useState)(false);
16
+ const { documentationLink } = sequence;
17
+ const hoverable = !TimelineSelection_1.SELECTION_ENABLED && documentationLink !== null;
18
+ const onClick = (0, react_1.useCallback)(() => {
19
+ if (documentationLink === null) {
20
+ return;
21
+ }
22
+ window.open(documentationLink, '_blank', 'noopener,noreferrer');
23
+ }, [documentationLink]);
24
+ const onPointerEnter = (0, react_1.useCallback)(() => setHovered(true), []);
25
+ const onPointerLeave = (0, react_1.useCallback)(() => setHovered(false), []);
26
+ const style = (0, react_1.useMemo)(() => {
27
+ const hoverEffect = hovered && hoverable;
28
+ return {
29
+ alignItems: 'center',
30
+ alignSelf: 'stretch',
31
+ ...(0, TimelineSelection_1.getTimelineSelectedLabelStyle)(selected, false),
32
+ display: 'inline-flex',
33
+ fontSize: 12,
34
+ whiteSpace: 'nowrap',
35
+ textOverflow: 'ellipsis',
36
+ overflow: 'hidden',
37
+ color: (0, TimelineSelection_1.getTimelineColor)(selected, false),
38
+ userSelect: 'none',
39
+ WebkitUserSelect: 'none',
40
+ textDecoration: hoverEffect ? 'underline' : 'none',
41
+ cursor: hoverEffect ? 'pointer' : undefined,
42
+ boxShadow: containsSelection && !selected
43
+ ? `inset 0 0 0 2px ${TimelineSelection_1.TIMELINE_SELECTED_LABEL_BACKGROUND}`
44
+ : undefined,
45
+ };
46
+ }, [hovered, hoverable, selected, containsSelection]);
47
+ const text = getTruncatedDisplayName(sequence.displayName) || '<Sequence>';
48
+ return (jsx_runtime_1.jsx("div", { onPointerEnter: hoverable ? onPointerEnter : undefined, onPointerLeave: hoverable ? onPointerLeave : undefined, title: documentationLink ? `Open documentation: ${documentationLink}` : text, style: style, onClick: hoverable ? onClick : undefined, children: text }));
49
+ };
50
+ exports.TimelineSequenceName = TimelineSequenceName;
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
- import type { SequencePropsSubscriptionKey } from 'remotion';
3
- import type { SequenceSchema } from 'remotion';
2
+ import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
4
3
  import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
4
+ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
5
5
  import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
6
- export declare const TimelineFieldRow: React.FC<{
6
+ export declare const TimelineSequencePropItem: React.FC<{
7
7
  readonly field: SchemaFieldInfo;
8
8
  readonly validatedLocation: CodePosition;
9
9
  readonly rowDepth: number;
10
10
  readonly nodePath: SequencePropsSubscriptionKey;
11
+ readonly nodePathInfo: SequenceNodePathInfo;
11
12
  readonly schema: SequenceSchema;
13
+ readonly keyframeDisplayOffset: number;
12
14
  }>;