@remotion/studio 4.0.471 → 4.0.473

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 (192) hide show
  1. package/dist/api/rename-static-file.d.ts +6 -0
  2. package/dist/api/rename-static-file.js +18 -0
  3. package/dist/components/AssetSelector.js +55 -5
  4. package/dist/components/AssetSelectorItem.js +153 -27
  5. package/dist/components/Canvas.js +147 -0
  6. package/dist/components/CompositionSelectorItem.d.ts +1 -0
  7. package/dist/components/CompositionSelectorItem.js +12 -4
  8. package/dist/components/ConfirmationDialog-types.d.ts +8 -0
  9. package/dist/components/ConfirmationDialog-types.js +2 -0
  10. package/dist/components/ConfirmationDialog.d.ts +7 -0
  11. package/dist/components/ConfirmationDialog.js +103 -0
  12. package/dist/components/ContextMenu.d.ts +9 -1
  13. package/dist/components/ContextMenu.js +99 -47
  14. package/dist/components/CurrentAsset.d.ts +1 -0
  15. package/dist/components/CurrentAsset.js +13 -2
  16. package/dist/components/Editor.js +14 -6
  17. package/dist/components/EditorContent.js +15 -2
  18. package/dist/components/EditorContexts.js +2 -1
  19. package/dist/components/EditorRuler/Ruler.js +2 -0
  20. package/dist/components/ExplorerPanel.d.ts +0 -4
  21. package/dist/components/ExplorerPanel.js +8 -4
  22. package/dist/components/ExplorerPanelRef.d.ts +4 -0
  23. package/dist/components/ExplorerPanelRef.js +5 -0
  24. package/dist/components/FilePreview.d.ts +1 -1
  25. package/dist/components/InitialCompositionLoader.d.ts +0 -1
  26. package/dist/components/InitialCompositionLoader.js +5 -27
  27. package/dist/components/Menu/MenuItem.js +7 -1
  28. package/dist/components/Menu/SubMenu.js +5 -1
  29. package/dist/components/Menu/portals.js +17 -8
  30. package/dist/components/MenuToolbar.js +5 -1
  31. package/dist/components/ModalContainer.js +6 -1
  32. package/dist/components/Modals.js +8 -2
  33. package/dist/components/NewComposition/CodemodFooter.js +2 -2
  34. package/dist/components/NewComposition/ComboBox.js +8 -2
  35. package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
  36. package/dist/components/NewComposition/DeleteFolder.js +39 -0
  37. package/dist/components/NewComposition/DeleteStaticFile.d.ts +4 -0
  38. package/dist/components/NewComposition/DeleteStaticFile.js +44 -0
  39. package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
  40. package/dist/components/NewComposition/RenameFolder.js +60 -0
  41. package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
  42. package/dist/components/NewComposition/RenameStaticFile.js +118 -0
  43. package/dist/components/OptionsPanel.js +5 -1
  44. package/dist/components/OutlineToggle.d.ts +2 -0
  45. package/dist/components/OutlineToggle.js +20 -0
  46. package/dist/components/Preview.d.ts +0 -2
  47. package/dist/components/Preview.js +23 -33
  48. package/dist/components/PreviewToolbar.js +19 -6
  49. package/dist/components/RenderButton.js +8 -2
  50. package/dist/components/RenderPreview.js +2 -2
  51. package/dist/components/SelectedOutlineOverlay.d.ts +105 -4
  52. package/dist/components/SelectedOutlineOverlay.js +578 -59
  53. package/dist/components/ShowOutlinesProvider.d.ts +4 -0
  54. package/dist/components/ShowOutlinesProvider.js +24 -0
  55. package/dist/components/SizeSelector.js +3 -3
  56. package/dist/components/Splitter/SplitterContainer.js +9 -0
  57. package/dist/components/Splitter/SplitterHandle.js +65 -70
  58. package/dist/components/StaticFilePreview.js +2 -2
  59. package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
  60. package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
  61. package/dist/components/Timeline/Timeline.js +50 -15
  62. package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
  63. package/dist/components/Timeline/TimelineArrayField.js +210 -0
  64. package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
  65. package/dist/components/Timeline/TimelineBooleanField.js +2 -2
  66. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +43 -0
  67. package/dist/components/Timeline/TimelineClipboardKeybindings.js +479 -0
  68. package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
  69. package/dist/components/Timeline/TimelineColorField.js +2 -8
  70. package/dist/components/Timeline/TimelineDeleteKeybindings.js +12 -2
  71. package/dist/components/Timeline/TimelineEffectItem.js +3 -2
  72. package/dist/components/Timeline/TimelineEffectPropItem.js +146 -26
  73. package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
  74. package/dist/components/Timeline/TimelineEnumField.js +3 -3
  75. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
  76. package/dist/components/Timeline/TimelineKeyframeControls.js +41 -37
  77. package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -21
  78. package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
  79. package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
  80. package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
  81. package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
  82. package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
  83. package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
  84. package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
  85. package/dist/components/Timeline/TimelineLayerEye.js +8 -3
  86. package/dist/components/Timeline/TimelineList.js +2 -2
  87. package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
  88. package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
  89. package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
  90. package/dist/components/Timeline/TimelineNumberField.js +7 -11
  91. package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
  92. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
  93. package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
  94. package/dist/components/Timeline/TimelineRotationField.js +41 -24
  95. package/dist/components/Timeline/TimelineRowChrome.js +8 -7
  96. package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
  97. package/dist/components/Timeline/TimelineScaleField.js +314 -0
  98. package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
  99. package/dist/components/Timeline/TimelineSchemaField.js +8 -42
  100. package/dist/components/Timeline/TimelineSelection.js +3 -2
  101. package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
  102. package/dist/components/Timeline/TimelineSequence.js +51 -10
  103. package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
  104. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
  105. package/dist/components/Timeline/TimelineSequenceItem.js +282 -28
  106. package/dist/components/Timeline/TimelineSequencePropItem.js +161 -35
  107. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
  108. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +525 -0
  109. package/dist/components/Timeline/TimelineTrack.js +1 -1
  110. package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
  111. package/dist/components/Timeline/TimelineTranslateField.js +21 -25
  112. package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
  113. package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
  114. package/dist/components/Timeline/apply-effect-response-to-code-values.d.ts +5 -0
  115. package/dist/components/Timeline/apply-effect-response-to-code-values.js +19 -0
  116. package/dist/components/Timeline/call-add-keyframe.js +4 -0
  117. package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
  118. package/dist/components/Timeline/call-move-keyframe.js +71 -0
  119. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
  120. package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
  121. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +7 -4
  122. package/dist/components/Timeline/delete-selected-timeline-item.js +33 -21
  123. package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
  124. package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
  125. package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
  126. package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
  127. package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
  128. package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
  129. package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
  130. package/dist/components/Timeline/get-node-keyframes.js +38 -5
  131. package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
  132. package/dist/components/Timeline/reset-selected-timeline-props.js +22 -8
  133. package/dist/components/Timeline/save-effect-prop.d.ts +14 -3
  134. package/dist/components/Timeline/save-effect-prop.js +36 -18
  135. package/dist/components/Timeline/save-prop-queue.d.ts +2 -1
  136. package/dist/components/Timeline/save-prop-queue.js +5 -2
  137. package/dist/components/Timeline/save-sequence-prop.d.ts +2 -7
  138. package/dist/components/Timeline/save-sequence-prop.js +33 -30
  139. package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
  140. package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
  141. package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
  142. package/dist/components/Timeline/timeline-asset-link.js +37 -0
  143. package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
  144. package/dist/components/Timeline/timeline-field-utils.js +5 -1
  145. package/dist/components/Timeline/timeline-translate-utils.js +9 -2
  146. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
  147. package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
  148. package/dist/components/Timeline/use-timeline-keyframe-drag.js +378 -0
  149. package/dist/components/TopPanel.d.ts +1 -1
  150. package/dist/components/folder-menu-items.d.ts +12 -0
  151. package/dist/components/folder-menu-items.js +147 -0
  152. package/dist/components/import-assets.d.ts +22 -0
  153. package/dist/components/import-assets.js +294 -0
  154. package/dist/components/load-canvas-content-from-url.d.ts +1 -0
  155. package/dist/components/load-canvas-content-from-url.js +9 -3
  156. package/dist/components/use-select-asset.d.ts +1 -0
  157. package/dist/components/use-select-asset.js +30 -0
  158. package/dist/error-overlay/error-origin.d.ts +3 -0
  159. package/dist/error-overlay/error-origin.js +42 -0
  160. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
  161. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
  162. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
  163. package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
  164. package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
  165. package/dist/esm/{chunk-z0z9d4r0.js → chunk-q0jkt0zq.js} +23062 -17350
  166. package/dist/esm/internals.mjs +23062 -17350
  167. package/dist/esm/previewEntry.mjs +22351 -16615
  168. package/dist/esm/renderEntry.mjs +1 -1
  169. package/dist/helpers/calculate-timeline.js +7 -3
  170. package/dist/helpers/create-folder-tree.js +1 -0
  171. package/dist/helpers/get-asset-metadata.js +2 -2
  172. package/dist/helpers/get-folder-id.d.ts +4 -0
  173. package/dist/helpers/get-folder-id.js +7 -0
  174. package/dist/helpers/get-preview-file-type.d.ts +2 -0
  175. package/dist/helpers/get-preview-file-type.js +33 -0
  176. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
  177. package/dist/helpers/install-required-package.d.ts +1 -0
  178. package/dist/helpers/install-required-package.js +39 -0
  179. package/dist/helpers/remote-asset-drag.d.ts +4 -0
  180. package/dist/helpers/remote-asset-drag.js +73 -0
  181. package/dist/helpers/timeline-layout.js +5 -1
  182. package/dist/helpers/use-asset-drag-events.d.ts +5 -2
  183. package/dist/helpers/use-asset-drag-events.js +13 -2
  184. package/dist/helpers/validate-folder-rename.d.ts +6 -0
  185. package/dist/helpers/validate-folder-rename.js +19 -0
  186. package/dist/hot-middleware-client/client.js +6 -0
  187. package/dist/state/editor-outlines.d.ts +8 -0
  188. package/dist/state/editor-outlines.js +18 -0
  189. package/dist/state/modals.d.ts +29 -2
  190. package/dist/state/scale-lock.d.ts +18 -0
  191. package/dist/state/scale-lock.js +59 -0
  192. package/package.json +10 -10
@@ -8,13 +8,17 @@ const remotion_1 = require("remotion");
8
8
  const no_react_1 = require("remotion/no-react");
9
9
  const client_id_1 = require("../../helpers/client-id");
10
10
  const format_file_location_1 = require("../../helpers/format-file-location");
11
+ const install_required_package_1 = require("../../helpers/install-required-package");
11
12
  const timeline_layout_1 = require("../../helpers/timeline-layout");
12
13
  const call_api_1 = require("../call-api");
14
+ const ConfirmationDialog_1 = require("../ConfirmationDialog");
13
15
  const ContextMenu_1 = require("../ContextMenu");
14
16
  const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
15
17
  const NotificationCenter_1 = require("../Notifications/NotificationCenter");
18
+ const use_select_asset_1 = require("../use-select-asset");
16
19
  const duplicate_selected_timeline_item_1 = require("./duplicate-selected-timeline-item");
17
20
  const save_sequence_prop_1 = require("./save-sequence-prop");
21
+ const timeline_asset_link_1 = require("./timeline-asset-link");
18
22
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
19
23
  const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
20
24
  const TimelineItemStack_1 = require("./TimelineItemStack");
@@ -37,6 +41,65 @@ const effectDropHighlight = {
37
41
  outline: '1px solid rgba(0, 155, 255, 0.75)',
38
42
  outlineOffset: -1,
39
43
  };
44
+ const SEQUENCE_REORDER_MIME_TYPE = 'application/remotion-sequence-reorder';
45
+ let currentSequenceDrag = null;
46
+ const sequenceReorderWrapper = {
47
+ position: 'relative',
48
+ };
49
+ const sequenceReorderLineBase = {
50
+ backgroundColor: '#0b84ff',
51
+ height: 2,
52
+ left: 0,
53
+ pointerEvents: 'none',
54
+ position: 'absolute',
55
+ right: 0,
56
+ zIndex: 1,
57
+ };
58
+ const sequenceReorderRejectionStyle = {
59
+ backgroundColor: 'rgba(0, 0, 0, 0.85)',
60
+ border: '1px solid rgba(255, 255, 255, 0.2)',
61
+ borderRadius: 4,
62
+ color: 'white',
63
+ fontSize: 11,
64
+ lineHeight: 1.2,
65
+ maxWidth: 260,
66
+ padding: '3px 6px',
67
+ pointerEvents: 'none',
68
+ position: 'absolute',
69
+ right: 6,
70
+ top: 2,
71
+ zIndex: 2,
72
+ };
73
+ const hasSequenceReorderDragType = (dataTransfer) => {
74
+ return Array.from(dataTransfer.types).includes(SEQUENCE_REORDER_MIME_TYPE);
75
+ };
76
+ const getSequenceReorderDragData = (dataTransfer) => {
77
+ if (currentSequenceDrag) {
78
+ return currentSequenceDrag;
79
+ }
80
+ const value = dataTransfer.getData(SEQUENCE_REORDER_MIME_TYPE);
81
+ if (!value) {
82
+ return null;
83
+ }
84
+ try {
85
+ const parsed = JSON.parse(value);
86
+ if (typeof parsed.nodePathKey === 'string' &&
87
+ typeof parsed.trackIndex === 'number' &&
88
+ (typeof parsed.parentId === 'string' || parsed.parentId === null) &&
89
+ typeof parsed.fileName === 'string' &&
90
+ parsed.nodePath &&
91
+ Array.isArray(parsed.nodePath.nodePath)) {
92
+ return parsed;
93
+ }
94
+ }
95
+ catch (_a) {
96
+ return null;
97
+ }
98
+ return null;
99
+ };
100
+ const getDestinationIndex = ({ fromIndex, insertionIndex, }) => {
101
+ return insertionIndex > fromIndex ? insertionIndex - 1 : insertionIndex;
102
+ };
40
103
  const hasEffectDragType = (dataTransfer) => {
41
104
  return Array.from(dataTransfer.types).some((type) => type === studio_shared_1.EFFECT_DRAG_MIME_TYPE ||
42
105
  type === 'application/json' ||
@@ -59,20 +122,22 @@ const getEffectDragData = (dataTransfer) => {
59
122
  }
60
123
  return null;
61
124
  };
62
- const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDisplayOffset }) => {
63
- var _a;
64
- var _b;
65
- const nodePath = (_b = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _b !== void 0 ? _b : null;
125
+ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDisplayOffset, trackIndex, }) => {
126
+ var _a, _b;
127
+ var _c, _d;
128
+ const nodePath = (_c = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _c !== void 0 ? _c : null;
66
129
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
67
130
  const previewConnected = previewServerState.type === 'connected';
68
131
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
69
132
  const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
70
133
  const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
71
134
  const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
72
- const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
135
+ const selectAsset = (0, use_select_asset_1.useSelectAsset)();
73
136
  const { onSelect, selectable, selected } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
74
137
  const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(nodePathInfo);
75
138
  const [effectDropHovered, setEffectDropHovered] = (0, react_1.useState)(false);
139
+ const [sequenceDropIndicator, setSequenceDropIndicator] = (0, react_1.useState)(null);
140
+ const [sequenceDropRejection, setSequenceDropRejection] = (0, react_1.useState)(null);
76
141
  const { canOpenInEditor, openInEditor, originalLocation } = (0, use_open_sequence_in_editor_1.useOpenSequenceInEditor)(sequence);
77
142
  const fileLocation = (0, react_1.useMemo)(() => (0, format_file_location_1.formatFileLocation)({
78
143
  location: originalLocation,
@@ -92,24 +157,35 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
92
157
  };
93
158
  }, [originalLocation]);
94
159
  const canDeleteFromSource = Boolean(nodePath && (validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source));
160
+ const nodePathKey = (0, react_1.useMemo)(() => nodePath ? remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath) : null, [nodePath]);
161
+ const parentId = (_d = sequence.parent) !== null && _d !== void 0 ? _d : null;
162
+ const canReorderSequence = TimelineSelection_1.SELECTION_ENABLED &&
163
+ previewConnected &&
164
+ Boolean(nodePath && nodePathKey && (validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source)) &&
165
+ (nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.numberOfSequencesWithThisNodePath) === 1;
166
+ const canHandleSequenceDrag = TimelineSelection_1.SELECTION_ENABLED && previewConnected;
167
+ const confirm = (0, ConfirmationDialog_1.useConfirmationDialog)();
95
168
  const deleteDisabled = (0, react_1.useMemo)(() => !previewConnected || !sequence.controls || !canDeleteFromSource, [previewConnected, sequence.controls, canDeleteFromSource]);
96
169
  const duplicateDisabled = deleteDisabled;
97
170
  const onDuplicateSequenceFromSource = (0, react_1.useCallback)(() => {
98
171
  if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePathInfo) {
99
172
  return;
100
173
  }
101
- (0, duplicate_selected_timeline_item_1.duplicateSequencesFromSource)([nodePathInfo]).catch(() => undefined);
102
- }, [nodePathInfo, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source]);
174
+ (0, duplicate_selected_timeline_item_1.duplicateSequencesFromSource)([nodePathInfo], confirm).catch(() => undefined);
175
+ }, [confirm, nodePathInfo, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source]);
103
176
  const onDeleteSequenceFromSource = (0, react_1.useCallback)(async () => {
104
177
  if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
105
178
  return;
106
179
  }
107
180
  if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
108
- const message = 'This sequence is programmatically duplicated ' +
109
- nodePathInfo.numberOfSequencesWithThisNodePath +
110
- ' times in the code. Deleting removes all instances. Continue?';
111
- // eslint-disable-next-line no-alert -- native confirm before applying duplicate codemod in .map callbacks
112
- if (!window.confirm(message)) {
181
+ const shouldDelete = await confirm({
182
+ title: 'Delete sequence?',
183
+ message: 'This sequence is programmatically duplicated ' +
184
+ nodePathInfo.numberOfSequencesWithThisNodePath +
185
+ ' times in the code. Deleting removes all instances. Continue?',
186
+ confirmLabel: 'Delete',
187
+ });
188
+ if (!shouldDelete) {
113
189
  return;
114
190
  }
115
191
  }
@@ -132,13 +208,173 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
132
208
  catch (err) {
133
209
  (0, NotificationCenter_1.showNotification)(err.message, 4000);
134
210
  }
135
- }, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
211
+ }, [confirm, nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
212
+ const getSequenceDropTarget = (0, react_1.useCallback)((e) => {
213
+ const dragData = getSequenceReorderDragData(e.dataTransfer);
214
+ if (!dragData) {
215
+ return null;
216
+ }
217
+ if (!nodePath || !nodePathKey || !(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source)) {
218
+ return {
219
+ type: 'invalid',
220
+ reason: 'This sequence cannot be reordered from source.',
221
+ };
222
+ }
223
+ if (dragData.nodePathKey === nodePathKey) {
224
+ return {
225
+ type: 'invalid',
226
+ reason: 'Drop onto another sequence to reorder.',
227
+ };
228
+ }
229
+ if ((nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.numberOfSequencesWithThisNodePath) !== 1) {
230
+ return {
231
+ type: 'invalid',
232
+ reason: 'Programmatically duplicated sequences cannot be reordered.',
233
+ };
234
+ }
235
+ if (dragData.parentId !== parentId ||
236
+ dragData.fileName !== validatedLocation.source) {
237
+ return {
238
+ type: 'invalid',
239
+ reason: 'Sequences can only be reordered with direct JSX siblings.',
240
+ };
241
+ }
242
+ const rect = e.currentTarget.getBoundingClientRect();
243
+ const before = e.clientY < rect.top + rect.height / 2;
244
+ const insertionIndex = before ? trackIndex : trackIndex + 1;
245
+ const toIndex = getDestinationIndex({
246
+ fromIndex: dragData.trackIndex,
247
+ insertionIndex,
248
+ });
249
+ if (toIndex === dragData.trackIndex) {
250
+ return {
251
+ type: 'invalid',
252
+ reason: 'This sequence is already in that position.',
253
+ };
254
+ }
255
+ return {
256
+ type: 'valid',
257
+ dragData,
258
+ position: before ? 'before' : 'after',
259
+ };
260
+ }, [
261
+ nodePath,
262
+ nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.numberOfSequencesWithThisNodePath,
263
+ nodePathKey,
264
+ parentId,
265
+ trackIndex,
266
+ validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
267
+ ]);
268
+ const onSequenceDragStart = (0, react_1.useCallback)((e) => {
269
+ if (!canReorderSequence ||
270
+ !nodePath ||
271
+ !nodePathKey ||
272
+ !(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source)) {
273
+ e.preventDefault();
274
+ return;
275
+ }
276
+ const dragData = {
277
+ nodePath,
278
+ nodePathKey,
279
+ trackIndex,
280
+ parentId,
281
+ fileName: validatedLocation.source,
282
+ };
283
+ currentSequenceDrag = dragData;
284
+ e.dataTransfer.effectAllowed = 'move';
285
+ e.dataTransfer.setData(SEQUENCE_REORDER_MIME_TYPE, JSON.stringify(dragData));
286
+ e.stopPropagation();
287
+ }, [
288
+ canReorderSequence,
289
+ nodePath,
290
+ nodePathKey,
291
+ parentId,
292
+ trackIndex,
293
+ validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
294
+ ]);
295
+ const onSequenceDragEnd = (0, react_1.useCallback)(() => {
296
+ currentSequenceDrag = null;
297
+ setSequenceDropIndicator(null);
298
+ setSequenceDropRejection(null);
299
+ }, []);
300
+ const onSequenceDragOver = (0, react_1.useCallback)((e) => {
301
+ if (!hasSequenceReorderDragType(e.dataTransfer)) {
302
+ return;
303
+ }
304
+ const dropTarget = getSequenceDropTarget(e);
305
+ if (!dropTarget) {
306
+ setSequenceDropIndicator(null);
307
+ setSequenceDropRejection(null);
308
+ return;
309
+ }
310
+ if (dropTarget.type === 'invalid') {
311
+ setSequenceDropIndicator(null);
312
+ setSequenceDropRejection(dropTarget.reason);
313
+ e.dataTransfer.dropEffect = 'none';
314
+ return;
315
+ }
316
+ e.preventDefault();
317
+ e.stopPropagation();
318
+ e.dataTransfer.dropEffect = 'move';
319
+ setSequenceDropIndicator(dropTarget.position);
320
+ setSequenceDropRejection(null);
321
+ }, [getSequenceDropTarget]);
322
+ const onSequenceDragLeave = (0, react_1.useCallback)((e) => {
323
+ if (e.currentTarget.contains(e.relatedTarget)) {
324
+ return;
325
+ }
326
+ setSequenceDropIndicator(null);
327
+ setSequenceDropRejection(null);
328
+ }, []);
329
+ const onSequenceDrop = (0, react_1.useCallback)(async (e) => {
330
+ if (!canReorderSequence ||
331
+ previewServerState.type !== 'connected' ||
332
+ !nodePath ||
333
+ !(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source)) {
334
+ return;
335
+ }
336
+ const dropTarget = getSequenceDropTarget(e);
337
+ if (!dropTarget || dropTarget.type === 'invalid') {
338
+ setSequenceDropIndicator(null);
339
+ setSequenceDropRejection((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === 'invalid' ? dropTarget.reason : null);
340
+ return;
341
+ }
342
+ e.preventDefault();
343
+ e.stopPropagation();
344
+ setSequenceDropIndicator(null);
345
+ setSequenceDropRejection(null);
346
+ currentSequenceDrag = null;
347
+ try {
348
+ const result = await (0, call_api_1.callApi)('/api/reorder-sequence', {
349
+ fileName: validatedLocation.source,
350
+ sourceNodePath: dropTarget.dragData.nodePath,
351
+ targetNodePath: nodePath,
352
+ position: dropTarget.position,
353
+ clientId: previewServerState.clientId,
354
+ });
355
+ if (result.success) {
356
+ (0, NotificationCenter_1.showNotification)('Reordered sequence', 2000);
357
+ }
358
+ else {
359
+ (0, NotificationCenter_1.showNotification)(result.reason, 4000);
360
+ }
361
+ }
362
+ catch (err) {
363
+ (0, NotificationCenter_1.showNotification)(err.message, 4000);
364
+ }
365
+ }, [
366
+ canReorderSequence,
367
+ getSequenceDropTarget,
368
+ nodePath,
369
+ previewServerState,
370
+ validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
371
+ ]);
136
372
  const mediaSrc = sequence.type === 'audio' ||
137
373
  sequence.type === 'video' ||
138
374
  sequence.type === 'image'
139
375
  ? sequence.src
140
376
  : null;
141
- const assetLinkInfo = (0, react_1.useMemo)(() => (mediaSrc ? (0, TimelineMediaInfo_1.getTimelineAssetLinkInfo)(mediaSrc) : null), [mediaSrc]);
377
+ const assetLinkInfo = (0, react_1.useMemo)(() => (mediaSrc ? (0, timeline_asset_link_1.getTimelineAssetLinkInfo)(mediaSrc) : null), [mediaSrc]);
142
378
  const contextMenuValues = (0, react_1.useMemo)(() => {
143
379
  if (!previewConnected) {
144
380
  return [];
@@ -211,7 +447,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
211
447
  leftItem: null,
212
448
  disabled: false,
213
449
  onClick: () => {
214
- (0, TimelineMediaInfo_1.openTimelineAssetLink)(assetLinkInfo, setCanvasContent);
450
+ (0, timeline_asset_link_1.openTimelineAssetLink)(assetLinkInfo, selectAsset);
215
451
  },
216
452
  quickSwitcherLabel: null,
217
453
  subMenu: null,
@@ -269,8 +505,8 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
269
505
  canOpenInEditor,
270
506
  openInEditor,
271
507
  previewConnected,
508
+ selectAsset,
272
509
  sequence,
273
- setCanvasContent,
274
510
  ]);
275
511
  const isExpanded = previewConnected && nodePathInfo !== null && getIsExpanded(nodePathInfo);
276
512
  const onToggleExpand = (0, react_1.useCallback)(() => {
@@ -298,7 +534,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
298
534
  const codeHiddenStatus = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride.hidden;
299
535
  const isItemHidden = (0, react_1.useMemo)(() => {
300
536
  var _a;
301
- const codeValue = codeHiddenStatus && codeHiddenStatus.canUpdate
537
+ const codeValue = codeHiddenStatus && codeHiddenStatus.status === 'static'
302
538
  ? codeHiddenStatus.codeValue
303
539
  : undefined;
304
540
  const runtimeValue = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.currentRuntimeValueDotNotation.hidden;
@@ -311,7 +547,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
311
547
  !validatedLocation ||
312
548
  !codeValuesForOverride ||
313
549
  !codeHiddenStatus ||
314
- !codeHiddenStatus.canUpdate ||
550
+ codeHiddenStatus.status !== 'static' ||
315
551
  previewServerState.type !== 'connected') {
316
552
  return;
317
553
  }
@@ -321,15 +557,21 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
321
557
  const defaultValue = fieldSchema && fieldSchema.type === 'boolean'
322
558
  ? JSON.stringify(fieldSchema.default)
323
559
  : null;
324
- (0, save_sequence_prop_1.saveSequenceProp)({
325
- fileName: validatedLocation.source,
326
- nodePath,
327
- fieldKey: 'hidden',
328
- value: newValue,
329
- defaultValue,
330
- schema,
560
+ (0, save_sequence_prop_1.saveSequenceProps)({
561
+ changes: [
562
+ {
563
+ fileName: validatedLocation.source,
564
+ nodePath,
565
+ fieldKey: 'hidden',
566
+ value: newValue,
567
+ defaultValue,
568
+ schema,
569
+ },
570
+ ],
331
571
  setCodeValues,
332
572
  clientId: previewServerState.clientId,
573
+ undoLabel: newValue ? 'Hide sequence' : 'Show sequence',
574
+ redoLabel: newValue ? 'Hide sequence again' : 'Show sequence again',
333
575
  });
334
576
  }, [
335
577
  codeHiddenStatus,
@@ -366,11 +608,20 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
366
608
  validatedLocation !== null &&
367
609
  codeHiddenStatus !== undefined &&
368
610
  codeHiddenStatus !== null &&
369
- codeHiddenStatus.canUpdate;
611
+ codeHiddenStatus.status === 'static';
370
612
  const canDropEffect = previewServerState.type === 'connected' &&
371
613
  nodePath !== null &&
372
614
  validatedLocation !== null &&
373
- sequence.type !== 'audio';
615
+ ((_b = sequence.controls) === null || _b === void 0 ? void 0 : _b.supportsEffects) === true;
616
+ const sequenceReorderLineStyle = (0, react_1.useMemo)(() => {
617
+ if (!sequenceDropIndicator) {
618
+ return null;
619
+ }
620
+ return {
621
+ ...sequenceReorderLineBase,
622
+ ...(sequenceDropIndicator === 'before' ? { top: -1 } : { bottom: -1 }),
623
+ };
624
+ }, [sequenceDropIndicator]);
374
625
  const onEffectDragOver = (0, react_1.useCallback)((e) => {
375
626
  if (!canDropEffect || !hasEffectDragType(e.dataTransfer)) {
376
627
  return;
@@ -401,6 +652,8 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
401
652
  return;
402
653
  }
403
654
  try {
655
+ const requiredPackage = (0, studio_shared_1.getRequiredPackageForEffectImportPath)(dragData.effect.importPath);
656
+ await (0, install_required_package_1.installRequiredPackages)(requiredPackage ? [requiredPackage] : []);
404
657
  const result = await (0, call_api_1.callApi)('/api/add-effect', {
405
658
  fileName: validatedLocation.source,
406
659
  sequenceNodePath: nodePath,
@@ -425,7 +678,8 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
425
678
  : undefined, children: jsx_runtime_1.jsxs("div", { style: labelContainerStyle, children: [
426
679
  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 })
427
680
  ] }) }));
428
- 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 &&
681
+ 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);
682
+ 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 &&
429
683
  isExpanded &&
430
684
  hasExpandableContent &&
431
685
  nodePathInfo &&