@remotion/studio 4.0.473 → 4.0.474

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 (79) hide show
  1. package/dist/components/AssetSelectorItem.js +30 -6
  2. package/dist/components/Canvas.js +71 -0
  3. package/dist/components/Modals.js +1 -2
  4. package/dist/components/NewComposition/InputDragger.d.ts +1 -0
  5. package/dist/components/NewComposition/InputDragger.js +9 -6
  6. package/dist/components/SelectedOutlineOverlay.d.ts +7 -5
  7. package/dist/components/SelectedOutlineOverlay.js +78 -67
  8. package/dist/components/Timeline/KeyframeSettingsModal.js +4 -4
  9. package/dist/components/Timeline/SequencePropsObserver.js +3 -3
  10. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -7
  11. package/dist/components/Timeline/TimelineClipboardKeybindings.js +19 -16
  12. package/dist/components/Timeline/TimelineDeleteKeybindings.js +11 -9
  13. package/dist/components/Timeline/TimelineEffectItem.js +7 -7
  14. package/dist/components/Timeline/TimelineEffectPropItem.js +17 -17
  15. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +6 -1
  16. package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
  17. package/dist/components/Timeline/TimelineKeyframeControls.js +8 -8
  18. package/dist/components/Timeline/TimelineKeyframeDiamond.js +0 -1
  19. package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
  20. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +120 -0
  21. package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
  22. package/dist/components/Timeline/TimelineNumberField.js +15 -7
  23. package/dist/components/Timeline/TimelineRotationField.js +17 -11
  24. package/dist/components/Timeline/TimelineScaleField.js +16 -12
  25. package/dist/components/Timeline/TimelineSelection.d.ts +15 -0
  26. package/dist/components/Timeline/TimelineSelection.js +26 -1
  27. package/dist/components/Timeline/TimelineSequence.js +6 -6
  28. package/dist/components/Timeline/TimelineSequenceItem.js +21 -14
  29. package/dist/components/Timeline/TimelineSequencePropItem.js +37 -37
  30. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
  31. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +46 -44
  32. package/dist/components/Timeline/TimelineTranslateField.js +24 -19
  33. package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
  34. package/dist/components/Timeline/{apply-effect-response-to-code-values.d.ts → apply-effect-response-to-prop-statuses.d.ts} +1 -1
  35. package/dist/components/Timeline/{apply-effect-response-to-code-values.js → apply-effect-response-to-prop-statuses.js} +3 -3
  36. package/dist/components/Timeline/call-add-keyframe.d.ts +5 -5
  37. package/dist/components/Timeline/call-add-keyframe.js +6 -6
  38. package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
  39. package/dist/components/Timeline/call-delete-keyframe.js +7 -7
  40. package/dist/components/Timeline/call-move-keyframe.d.ts +3 -3
  41. package/dist/components/Timeline/call-move-keyframe.js +3 -3
  42. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +5 -5
  43. package/dist/components/Timeline/call-update-keyframe-settings.js +6 -6
  44. package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
  45. package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
  46. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +5 -5
  47. package/dist/components/Timeline/delete-selected-timeline-item.js +6 -4
  48. package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
  49. package/dist/components/Timeline/get-node-keyframes.js +4 -4
  50. package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
  51. package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
  52. package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
  53. package/dist/components/Timeline/reset-selected-timeline-props.js +10 -10
  54. package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
  55. package/dist/components/Timeline/save-effect-prop.js +5 -5
  56. package/dist/components/Timeline/save-prop-queue.d.ts +3 -3
  57. package/dist/components/Timeline/save-prop-queue.js +3 -3
  58. package/dist/components/Timeline/save-sequence-prop.d.ts +3 -3
  59. package/dist/components/Timeline/save-sequence-prop.js +4 -4
  60. package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
  61. package/dist/components/Timeline/timeline-field-utils.js +26 -5
  62. package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
  63. package/dist/components/Timeline/timeline-translate-utils.js +4 -5
  64. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -7
  65. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
  66. package/dist/components/Timeline/use-timeline-height.js +3 -3
  67. package/dist/components/Timeline/use-timeline-keyframe-drag.js +13 -11
  68. package/dist/components/import-assets.d.ts +15 -0
  69. package/dist/components/import-assets.js +63 -1
  70. package/dist/esm/{chunk-q0jkt0zq.js → chunk-xjvc8qen.js} +1708 -1394
  71. package/dist/esm/internals.mjs +1708 -1394
  72. package/dist/esm/previewEntry.mjs +1711 -1397
  73. package/dist/esm/renderEntry.mjs +1 -1
  74. package/dist/helpers/timeline-layout.d.ts +6 -6
  75. package/dist/helpers/timeline-layout.js +5 -5
  76. package/dist/state/modals.d.ts +0 -3
  77. package/package.json +10 -10
  78. package/dist/components/NewComposition/DeleteStaticFile.d.ts +0 -4
  79. package/dist/components/NewComposition/DeleteStaticFile.js +0 -44
@@ -9,7 +9,7 @@ const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
9
9
  const get_node_keyframes_1 = require("./get-node-keyframes");
10
10
  const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayOffset, }) => {
11
11
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
12
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
12
+ const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
13
13
  const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
14
14
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
15
15
  const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
@@ -17,9 +17,9 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
17
17
  nodePathInfo,
18
18
  getDragOverrides,
19
19
  getEffectDragOverrides,
20
- codeValues,
20
+ propStatuses,
21
21
  }), [
22
- codeValues,
22
+ propStatuses,
23
23
  getDragOverrides,
24
24
  getEffectDragOverrides,
25
25
  nodePathInfo,
@@ -30,14 +30,14 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
30
30
  sequence,
31
31
  nodePathInfo,
32
32
  getIsExpanded,
33
- codeValues,
34
- }), [codeValues, getIsExpanded, nodePathInfo, sequence]);
33
+ propStatuses,
34
+ }), [propStatuses, getIsExpanded, nodePathInfo, sequence]);
35
35
  const rows = (0, react_1.useMemo)(() => flat.map(({ node }) => ({
36
36
  height: (0, timeline_layout_1.getTreeRowHeight)(node),
37
37
  keyframes: (0, get_node_keyframes_1.getNodeKeyframes)({
38
38
  node,
39
39
  nodePath: nodePathInfo.sequenceSubscriptionKey,
40
- codeValues,
40
+ propStatuses,
41
41
  keyframeDisplayOffset,
42
42
  getDragOverrides,
43
43
  getEffectDragOverrides,
@@ -46,7 +46,7 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
46
46
  rowKey: (0, timeline_node_path_key_1.timelineNodePathInfoToKey)(node.nodePathInfo),
47
47
  nodePathInfo: node.nodePathInfo,
48
48
  })), [
49
- codeValues,
49
+ propStatuses,
50
50
  flat,
51
51
  getDragOverrides,
52
52
  getEffectDragOverrides,
@@ -9,7 +9,7 @@ const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
9
9
  const sequence_props_subscription_store_1 = require("./sequence-props-subscription-store");
10
10
  const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, effects, }) => {
11
11
  var _a, _b, _c;
12
- const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
12
+ const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
13
13
  const { setOverrideIdToNodePath } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsSettersContext);
14
14
  const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
15
15
  const { migrateExpandedTracksForSubscriptionKey } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
@@ -57,7 +57,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, ef
57
57
  if (!result.success) {
58
58
  return;
59
59
  }
60
- setCodeValues(result.nodePath, () => result.status);
60
+ setPropStatuses(result.nodePath, () => result.status);
61
61
  },
62
62
  applyEach: (result) => {
63
63
  var _a;
@@ -93,7 +93,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, ef
93
93
  migrateExpandedTracksForSubscriptionKey,
94
94
  overrideId,
95
95
  schema,
96
- setCodeValues,
96
+ setPropStatuses,
97
97
  setOverrideIdToNodePath,
98
98
  ]);
99
99
  };
@@ -11,7 +11,7 @@ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
11
11
  const useTimelineHeight = ({ shown, hasBeenCut, }) => {
12
12
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
13
13
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
14
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
14
+ const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
15
15
  const previewServerConnected = previewServerState.type === 'connected';
16
16
  return (0, react_1.useMemo)(() => {
17
17
  const tracksHeight = shown.reduce((acc, track) => {
@@ -25,7 +25,7 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
25
25
  sequence: track.sequence,
26
26
  nodePathInfo: track.nodePathInfo,
27
27
  getIsExpanded,
28
- codeValues,
28
+ propStatuses,
29
29
  }) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM
30
30
  : 0;
31
31
  return acc + layerHeight + expandedHeight;
@@ -34,6 +34,6 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
34
34
  timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM +
35
35
  (hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
36
36
  TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT);
37
- }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, codeValues]);
37
+ }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, propStatuses]);
38
38
  };
39
39
  exports.useTimelineHeight = useTimelineHeight;
@@ -15,8 +15,8 @@ const TimelineSelection_1 = require("./TimelineSelection");
15
15
  const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
16
16
  const pointerDragThreshold = 3;
17
17
  const isKeyframeSelection = (selection) => selection.type === 'keyframe';
18
- const getCodeValueForTarget = ({ codeValues, nodePath, }) => codeValues[remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath)];
19
- const getTimelineKeyframeDragTarget = ({ codeValues, displayFrame, nodePathInfo, overrideIdsToNodePaths, sequences, }) => {
18
+ const getCodeValueForTarget = ({ propStatuses, nodePath, }) => propStatuses[remotion_1.Internals.makeSequencePropsSubscriptionKey(nodePath)];
19
+ const getTimelineKeyframeDragTarget = ({ propStatuses, displayFrame, nodePathInfo, overrideIdsToNodePaths, sequences, }) => {
20
20
  var _a, _b;
21
21
  const field = (0, parse_keyframe_field_from_node_path_1.parseKeyframeFieldFromNodePath)(nodePathInfo.auxiliaryKeys);
22
22
  if (field === null) {
@@ -34,7 +34,7 @@ const getTimelineKeyframeDragTarget = ({ codeValues, displayFrame, nodePathInfo,
34
34
  const sourceFrame = displayFrame - ((_b = track === null || track === void 0 ? void 0 : track.keyframeDisplayOffset) !== null && _b !== void 0 ? _b : 0);
35
35
  const nodePath = nodePathInfo.sequenceSubscriptionKey;
36
36
  const fileName = nodePath.absolutePath;
37
- const sequenceStatus = getCodeValueForTarget({ codeValues, nodePath });
37
+ const sequenceStatus = getCodeValueForTarget({ propStatuses, nodePath });
38
38
  if (!(sequenceStatus === null || sequenceStatus === void 0 ? void 0 : sequenceStatus.canUpdate)) {
39
39
  return null;
40
40
  }
@@ -187,10 +187,10 @@ const useTimelineKeyframeDrag = ({ frame, nodePathInfo, onSelect, selectable, se
187
187
  const videoConfig = (0, remotion_1.useVideoConfig)();
188
188
  const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
189
189
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
190
- const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
190
+ const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
191
191
  const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
192
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
193
- const { clearDragOverrides, clearEffectDragOverrides, setCodeValues, setDragOverrides, setEffectDragOverrides, } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
192
+ const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
193
+ const { clearDragOverrides, clearEffectDragOverrides, setPropStatuses, setDragOverrides, setEffectDragOverrides, } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
194
194
  const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
195
195
  const { clearDraggedKeyframes, setDraggedKeyframes } = (0, TimelineKeyframeDragState_1.useTimelineKeyframeDragState)();
196
196
  return (0, react_1.useCallback)((e) => {
@@ -223,13 +223,15 @@ const useTimelineKeyframeDrag = ({ frame, nodePathInfo, onSelect, selectable, se
223
223
  let dragTargets = null;
224
224
  let hasDragged = false;
225
225
  let lastDelta = 0;
226
+ const propStatuses = propStatusesRef.current;
227
+ const sequences = sequencesRef.current;
226
228
  const resolveDragTargets = () => {
227
229
  if (dragTargets !== null) {
228
230
  return dragTargets;
229
231
  }
230
232
  dragTargets = keyframesToDrag
231
233
  .map((keyframe) => getTimelineKeyframeDragTarget({
232
- codeValues,
234
+ propStatuses,
233
235
  displayFrame: keyframe.frame,
234
236
  nodePathInfo: keyframe.nodePathInfo,
235
237
  overrideIdsToNodePaths: overrideIdToNodePathMappings,
@@ -341,7 +343,7 @@ const useTimelineKeyframeDrag = ({ frame, nodePathInfo, onSelect, selectable, se
341
343
  toFrame: target.sourceFrame + lastDelta,
342
344
  schema: target.schema,
343
345
  })),
344
- setCodeValues,
346
+ setPropStatuses,
345
347
  clientId: previewServerState.clientId,
346
348
  }).catch(() => undefined);
347
349
  };
@@ -357,17 +359,17 @@ const useTimelineKeyframeDrag = ({ frame, nodePathInfo, onSelect, selectable, se
357
359
  clearDragOverrides,
358
360
  clearEffectDragOverrides,
359
361
  clearDraggedKeyframes,
360
- codeValues,
361
362
  currentSelection,
362
363
  frame,
363
364
  nodePathInfo,
364
365
  onSelect,
365
366
  overrideIdToNodePathMappings,
367
+ propStatusesRef,
366
368
  previewServerState,
367
369
  selectable,
368
370
  selected,
369
- sequences,
370
- setCodeValues,
371
+ sequencesRef,
372
+ setPropStatuses,
371
373
  setDragOverrides,
372
374
  setDraggedKeyframes,
373
375
  setEffectDragOverrides,
@@ -15,8 +15,23 @@ export declare const importRemoteAsset: ({ compositionFile, compositionId, url,
15
15
  compositionId: string;
16
16
  url: string;
17
17
  }) => Promise<void>;
18
+ export declare const insertRemoteAudio: ({ compositionFile, compositionId, url, }: {
19
+ compositionFile: string;
20
+ compositionId: string;
21
+ url: string;
22
+ }) => Promise<void>;
18
23
  export declare const insertExistingAssets: ({ assetPaths, compositionFile, compositionId, }: {
19
24
  assetPaths: string[];
20
25
  compositionFile: string;
21
26
  compositionId: string;
22
27
  }) => Promise<void>;
28
+ export declare const insertComponent: ({ component, compositionFile, compositionId, }: {
29
+ component: {
30
+ componentName: string;
31
+ importName: string;
32
+ importPath: string;
33
+ props: import("@remotion/studio-shared").ComponentProp[];
34
+ };
35
+ compositionFile: string;
36
+ compositionId: string;
37
+ }) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insertExistingAssets = exports.importRemoteAsset = exports.importAssets = exports.pickFilesToImport = exports.getAssetElementFromPath = exports.getAssetElement = void 0;
3
+ exports.insertComponent = exports.insertExistingAssets = exports.insertRemoteAudio = exports.importRemoteAsset = exports.importAssets = exports.pickFilesToImport = exports.getAssetElementFromPath = exports.getAssetElement = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const get_static_files_1 = require("../api/get-static-files");
6
6
  const write_static_file_1 = require("../api/write-static-file");
@@ -16,6 +16,7 @@ const getAssetElement = ({ fileType, src, }) => {
16
16
  type: 'asset',
17
17
  assetType: 'image',
18
18
  src,
19
+ srcType: 'static',
19
20
  dimensions: fileType.dimensions,
20
21
  };
21
22
  }
@@ -24,6 +25,7 @@ const getAssetElement = ({ fileType, src, }) => {
24
25
  type: 'asset',
25
26
  assetType: 'gif',
26
27
  src,
28
+ srcType: 'static',
27
29
  dimensions: fileType.dimensions,
28
30
  };
29
31
  }
@@ -35,6 +37,7 @@ const getAssetElement = ({ fileType, src, }) => {
35
37
  type: 'asset',
36
38
  assetType: 'video',
37
39
  src,
40
+ srcType: 'static',
38
41
  dimensions: null,
39
42
  };
40
43
  }
@@ -46,6 +49,7 @@ const getAssetElement = ({ fileType, src, }) => {
46
49
  type: 'asset',
47
50
  assetType: 'audio',
48
51
  src,
52
+ srcType: 'static',
49
53
  dimensions: null,
50
54
  };
51
55
  }
@@ -66,6 +70,7 @@ const getAssetElementFromPath = (assetPath) => {
66
70
  type: 'asset',
67
71
  assetType: 'image',
68
72
  src: assetPath,
73
+ srcType: 'static',
69
74
  dimensions: null,
70
75
  };
71
76
  }
@@ -74,6 +79,7 @@ const getAssetElementFromPath = (assetPath) => {
74
79
  type: 'asset',
75
80
  assetType: 'gif',
76
81
  src: assetPath,
82
+ srcType: 'static',
77
83
  dimensions: null,
78
84
  };
79
85
  }
@@ -82,6 +88,7 @@ const getAssetElementFromPath = (assetPath) => {
82
88
  type: 'asset',
83
89
  assetType: 'video',
84
90
  src: assetPath,
91
+ srcType: 'static',
85
92
  dimensions: null,
86
93
  };
87
94
  }
@@ -90,6 +97,7 @@ const getAssetElementFromPath = (assetPath) => {
90
97
  type: 'asset',
91
98
  assetType: 'audio',
92
99
  src: assetPath,
100
+ srcType: 'static',
93
101
  dimensions: null,
94
102
  };
95
103
  }
@@ -114,6 +122,9 @@ const getAssetLabel = (element) => {
114
122
  }
115
123
  throw new Error('Unsupported asset type');
116
124
  };
125
+ const getComponentLabel = (component) => {
126
+ return `<${component.componentName}>`;
127
+ };
117
128
  const pickFilesToImport = () => {
118
129
  return new Promise((resolve) => {
119
130
  const input = document.createElement('input');
@@ -261,6 +272,34 @@ const importRemoteAsset = async ({ compositionFile, compositionId, url, }) => {
261
272
  }
262
273
  };
263
274
  exports.importRemoteAsset = importRemoteAsset;
275
+ const insertRemoteAudio = async ({ compositionFile, compositionId, url, }) => {
276
+ if (!(0, studio_shared_1.isUrl)(url)) {
277
+ (0, NotificationCenter_1.showNotification)('Cannot add sound effect: Unsupported URL', 3000);
278
+ return;
279
+ }
280
+ const element = {
281
+ type: 'asset',
282
+ assetType: 'audio',
283
+ src: url,
284
+ srcType: 'remote',
285
+ dimensions: null,
286
+ };
287
+ try {
288
+ const inserted = await insertAssetElement({
289
+ compositionFile,
290
+ compositionId,
291
+ element,
292
+ });
293
+ if (!inserted) {
294
+ return;
295
+ }
296
+ notifyInsertedAssets([getAssetLabel(element)]);
297
+ }
298
+ catch (error) {
299
+ (0, NotificationCenter_1.showNotification)(`Could not add sound effect: ${error instanceof Error ? error.message : String(error)}`, 4000);
300
+ }
301
+ };
302
+ exports.insertRemoteAudio = insertRemoteAudio;
264
303
  const insertExistingAssets = async ({ assetPaths, compositionFile, compositionId, }) => {
265
304
  if (assetPaths.length === 0) {
266
305
  return;
@@ -292,3 +331,26 @@ const insertExistingAssets = async ({ assetPaths, compositionFile, compositionId
292
331
  }
293
332
  };
294
333
  exports.insertExistingAssets = insertExistingAssets;
334
+ const insertComponent = async ({ component, compositionFile, compositionId, }) => {
335
+ try {
336
+ const inserted = await insertAssetElement({
337
+ compositionFile,
338
+ compositionId,
339
+ element: {
340
+ type: 'component',
341
+ componentName: component.componentName,
342
+ importName: component.importName,
343
+ importPath: component.importPath,
344
+ props: component.props,
345
+ },
346
+ });
347
+ if (!inserted) {
348
+ return;
349
+ }
350
+ (0, NotificationCenter_1.showNotification)(`Added ${getComponentLabel(component)} to source file`, 2000);
351
+ }
352
+ catch (error) {
353
+ (0, NotificationCenter_1.showNotification)(`Could not add component: ${error instanceof Error ? error.message : String(error)}`, 4000);
354
+ }
355
+ };
356
+ exports.insertComponent = insertComponent;