@remotion/studio 4.0.473 → 4.0.475

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 (123) hide show
  1. package/dist/components/AssetSelectorItem.js +30 -6
  2. package/dist/components/Canvas.js +77 -0
  3. package/dist/components/ColorPicker/ColorPicker.js +4 -31
  4. package/dist/components/CompositionSelectorItem.js +4 -4
  5. package/dist/components/Editor.js +4 -1
  6. package/dist/components/Modals.js +2 -2
  7. package/dist/components/NewComposition/ComboBox.js +1 -0
  8. package/dist/components/NewComposition/InputDragger.d.ts +1 -0
  9. package/dist/components/NewComposition/InputDragger.js +9 -6
  10. package/dist/components/PreviewToolbar.js +2 -2
  11. package/dist/components/SelectedOutlineOverlay.d.ts +61 -33
  12. package/dist/components/SelectedOutlineOverlay.js +813 -351
  13. package/dist/components/SelectedOutlineUvControls.d.ts +17 -0
  14. package/dist/components/SelectedOutlineUvControls.js +167 -0
  15. package/dist/components/StudioCanvasCapture.d.ts +5 -0
  16. package/dist/components/StudioCanvasCapture.js +40 -0
  17. package/dist/components/Timeline/EasingEditorModal.d.ts +11 -0
  18. package/dist/components/Timeline/EasingEditorModal.js +247 -0
  19. package/dist/components/Timeline/KeyframeSettingsModal.js +5 -4
  20. package/dist/components/Timeline/SequencePropsObserver.js +3 -3
  21. package/dist/components/Timeline/Timeline.js +10 -7
  22. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -7
  23. package/dist/components/Timeline/TimelineClipboardKeybindings.js +19 -16
  24. package/dist/components/Timeline/TimelineDeleteKeybindings.js +71 -40
  25. package/dist/components/Timeline/TimelineDragHandler.js +2 -2
  26. package/dist/components/Timeline/TimelineEffectItem.js +8 -9
  27. package/dist/components/Timeline/TimelineEffectPropItem.js +18 -18
  28. package/dist/components/Timeline/TimelineExpandedKeyframeRow.d.ts +1 -0
  29. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +7 -2
  30. package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
  31. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +1 -1
  32. package/dist/components/Timeline/TimelineHeightContainer.js +2 -0
  33. package/dist/components/Timeline/TimelineItemStack.js +3 -56
  34. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +7 -0
  35. package/dist/components/Timeline/TimelineKeyframeControls.js +265 -68
  36. package/dist/components/Timeline/TimelineKeyframeDiamond.js +4 -3
  37. package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
  38. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +245 -0
  39. package/dist/components/Timeline/TimelineKeyframeTracksContext.d.ts +7 -0
  40. package/dist/components/Timeline/TimelineKeyframeTracksContext.js +17 -0
  41. package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
  42. package/dist/components/Timeline/TimelineMediaInfo.js +4 -24
  43. package/dist/components/Timeline/TimelineNumberField.js +15 -7
  44. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +4 -0
  45. package/dist/components/Timeline/TimelineRotationField.js +22 -34
  46. package/dist/components/Timeline/TimelineScaleField.js +16 -12
  47. package/dist/components/Timeline/TimelineScrollable.js +19 -3
  48. package/dist/components/Timeline/TimelineSelection.d.ts +82 -3
  49. package/dist/components/Timeline/TimelineSelection.js +312 -30
  50. package/dist/components/Timeline/TimelineSequence.js +23 -15
  51. package/dist/components/Timeline/TimelineSequenceItem.js +48 -73
  52. package/dist/components/Timeline/TimelineSequenceName.js +3 -17
  53. package/dist/components/Timeline/TimelineSequencePropItem.js +37 -37
  54. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
  55. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +46 -44
  56. package/dist/components/Timeline/TimelineTimeIndicators.js +4 -2
  57. package/dist/components/Timeline/TimelineTransformOriginField.d.ts +11 -0
  58. package/dist/components/Timeline/TimelineTransformOriginField.js +138 -0
  59. package/dist/components/Timeline/TimelineTranslateField.js +24 -19
  60. package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
  61. package/dist/components/Timeline/{apply-effect-response-to-code-values.d.ts → apply-effect-response-to-prop-statuses.d.ts} +1 -1
  62. package/dist/components/Timeline/{apply-effect-response-to-code-values.js → apply-effect-response-to-prop-statuses.js} +3 -3
  63. package/dist/components/Timeline/call-add-keyframe.d.ts +22 -5
  64. package/dist/components/Timeline/call-add-keyframe.js +71 -7
  65. package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
  66. package/dist/components/Timeline/call-delete-keyframe.js +7 -7
  67. package/dist/components/Timeline/call-move-keyframe.d.ts +3 -3
  68. package/dist/components/Timeline/call-move-keyframe.js +3 -3
  69. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +5 -5
  70. package/dist/components/Timeline/call-update-keyframe-settings.js +6 -6
  71. package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
  72. package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
  73. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +5 -5
  74. package/dist/components/Timeline/delete-selected-timeline-item.js +28 -16
  75. package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
  76. package/dist/components/Timeline/get-node-keyframes.js +4 -4
  77. package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
  78. package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
  79. package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
  80. package/dist/components/Timeline/reset-selected-timeline-props.js +23 -15
  81. package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
  82. package/dist/components/Timeline/save-effect-prop.js +5 -5
  83. package/dist/components/Timeline/save-prop-queue.d.ts +3 -3
  84. package/dist/components/Timeline/save-prop-queue.js +3 -3
  85. package/dist/components/Timeline/save-sequence-prop.d.ts +3 -3
  86. package/dist/components/Timeline/save-sequence-prop.js +4 -4
  87. package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
  88. package/dist/components/Timeline/timeline-field-utils.js +26 -5
  89. package/dist/components/Timeline/timeline-rotation-utils.d.ts +2 -0
  90. package/dist/components/Timeline/timeline-rotation-utils.js +32 -0
  91. package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
  92. package/dist/components/Timeline/timeline-translate-utils.js +4 -5
  93. package/dist/components/Timeline/transform-origin-utils.d.ts +24 -0
  94. package/dist/components/Timeline/transform-origin-utils.js +170 -0
  95. package/dist/components/Timeline/update-selected-easing.d.ts +35 -0
  96. package/dist/components/Timeline/update-selected-easing.js +133 -0
  97. package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +1 -0
  98. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +35 -7
  99. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
  100. package/dist/components/Timeline/use-timeline-height.js +3 -3
  101. package/dist/components/Timeline/use-timeline-keyframe-drag.js +13 -11
  102. package/dist/components/canvas-capture-enabled.d.ts +1 -0
  103. package/dist/components/canvas-capture-enabled.js +4 -0
  104. package/dist/components/effect-drag-and-drop.d.ts +11 -0
  105. package/dist/components/effect-drag-and-drop.js +73 -0
  106. package/dist/components/import-assets.d.ts +15 -0
  107. package/dist/components/import-assets.js +63 -1
  108. package/dist/components/selected-outline-geometry.d.ts +20 -0
  109. package/dist/components/selected-outline-geometry.js +18 -0
  110. package/dist/components/selected-outline-uv.d.ts +46 -0
  111. package/dist/components/selected-outline-uv.js +240 -0
  112. package/dist/esm/{chunk-q0jkt0zq.js → chunk-qaqqvw4q.js} +8096 -5307
  113. package/dist/esm/internals.mjs +8096 -5307
  114. package/dist/esm/previewEntry.mjs +8106 -5317
  115. package/dist/esm/renderEntry.mjs +1 -1
  116. package/dist/helpers/colors.d.ts +0 -1
  117. package/dist/helpers/colors.js +1 -2
  118. package/dist/helpers/timeline-layout.d.ts +6 -6
  119. package/dist/helpers/timeline-layout.js +5 -5
  120. package/dist/state/modals.d.ts +2 -4
  121. package/package.json +11 -10
  122. package/dist/components/NewComposition/DeleteStaticFile.d.ts +0 -4
  123. package/dist/components/NewComposition/DeleteStaticFile.js +0 -44
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateSelectedTimelineEasings = exports.getTimelineEasingValueForSelection = exports.getEasingSelections = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const call_update_keyframe_settings_1 = require("./call-update-keyframe-settings");
6
+ const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
7
+ const parse_keyframe_field_from_node_path_1 = require("./parse-keyframe-field-from-node-path");
8
+ const canEditEasingForInterpolationFunction = (interpolationFunction) => interpolationFunction === 'interpolate' ||
9
+ interpolationFunction === 'interpolateColors';
10
+ const isEasingSelection = (selection) => selection.type === 'easing';
11
+ const getSelectedEasingUpdate = ({ selection, sequences, overrideIdsToNodePaths, propStatuses, }) => {
12
+ var _a;
13
+ var _b, _c, _d;
14
+ const field = (0, parse_keyframe_field_from_node_path_1.parseKeyframeFieldFromNodePath)(selection.nodePathInfo.auxiliaryKeys);
15
+ if (field === null) {
16
+ return null;
17
+ }
18
+ const track = (0, find_track_for_node_path_info_1.findTrackForNodePathInfo)({
19
+ sequences,
20
+ overrideIdsToNodePaths,
21
+ nodePathInfo: selection.nodePathInfo,
22
+ });
23
+ const sequence = (_b = track === null || track === void 0 ? void 0 : track.sequence) !== null && _b !== void 0 ? _b : null;
24
+ if (!sequence) {
25
+ return null;
26
+ }
27
+ const nodePath = selection.nodePathInfo.sequenceSubscriptionKey;
28
+ const fileName = nodePath.absolutePath;
29
+ if (field.type === 'sequence') {
30
+ if (!sequence.controls) {
31
+ return null;
32
+ }
33
+ const sequencePropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[field.fieldKey];
34
+ if ((sequencePropStatus === null || sequencePropStatus === void 0 ? void 0 : sequencePropStatus.status) !== 'keyframed' ||
35
+ !canEditEasingForInterpolationFunction(sequencePropStatus.interpolationFunction)) {
36
+ return null;
37
+ }
38
+ return {
39
+ type: 'sequence',
40
+ fileName,
41
+ nodePath,
42
+ fieldKey: field.fieldKey,
43
+ schema: sequence.controls.schema,
44
+ segmentIndex: selection.segmentIndex,
45
+ currentEasing: (_c = sequencePropStatus.easing[selection.segmentIndex]) !== null && _c !== void 0 ? _c : 'linear',
46
+ };
47
+ }
48
+ const effect = sequence.effects[field.effectIndex];
49
+ if (!effect) {
50
+ return null;
51
+ }
52
+ const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
53
+ propStatuses,
54
+ nodePath,
55
+ effectIndex: field.effectIndex,
56
+ });
57
+ const effectPropStatus = effectStatus.type === 'can-update-effect'
58
+ ? effectStatus.props[field.fieldKey]
59
+ : null;
60
+ if ((effectPropStatus === null || effectPropStatus === void 0 ? void 0 : effectPropStatus.status) !== 'keyframed' ||
61
+ !canEditEasingForInterpolationFunction(effectPropStatus.interpolationFunction)) {
62
+ return null;
63
+ }
64
+ return {
65
+ type: 'effect',
66
+ fileName,
67
+ nodePath,
68
+ effectIndex: field.effectIndex,
69
+ fieldKey: field.fieldKey,
70
+ schema: effect.schema,
71
+ segmentIndex: selection.segmentIndex,
72
+ currentEasing: (_d = effectPropStatus.easing[selection.segmentIndex]) !== null && _d !== void 0 ? _d : 'linear',
73
+ };
74
+ };
75
+ const getEasingSelections = (selections) => selections.filter(isEasingSelection);
76
+ exports.getEasingSelections = getEasingSelections;
77
+ const getTimelineEasingValueForSelection = ({ selection, sequences, overrideIdsToNodePaths, propStatuses, }) => {
78
+ var _a;
79
+ var _b;
80
+ return ((_b = (_a = getSelectedEasingUpdate({
81
+ selection,
82
+ sequences,
83
+ overrideIdsToNodePaths,
84
+ propStatuses,
85
+ })) === null || _a === void 0 ? void 0 : _a.currentEasing) !== null && _b !== void 0 ? _b : null);
86
+ };
87
+ exports.getTimelineEasingValueForSelection = getTimelineEasingValueForSelection;
88
+ const updateSelectedTimelineEasings = ({ selections, sequences, overrideIdsToNodePaths, propStatuses, setPropStatuses, clientId, easing, }) => {
89
+ const easingSelections = (0, exports.getEasingSelections)(selections);
90
+ if (easingSelections.length === 0) {
91
+ return null;
92
+ }
93
+ const updates = easingSelections
94
+ .map((selection) => getSelectedEasingUpdate({
95
+ selection,
96
+ sequences,
97
+ overrideIdsToNodePaths,
98
+ propStatuses,
99
+ }))
100
+ .filter((update) => update !== null);
101
+ if (updates.length === 0) {
102
+ return null;
103
+ }
104
+ return Promise.all(updates.map((update) => {
105
+ const settings = {
106
+ type: 'easing',
107
+ segmentIndex: update.segmentIndex,
108
+ easing,
109
+ };
110
+ if (update.type === 'sequence') {
111
+ return (0, call_update_keyframe_settings_1.callUpdateSequenceKeyframeSettings)({
112
+ fileName: update.fileName,
113
+ nodePath: update.nodePath,
114
+ fieldKey: update.fieldKey,
115
+ settings,
116
+ schema: update.schema,
117
+ setPropStatuses,
118
+ clientId,
119
+ });
120
+ }
121
+ return (0, call_update_keyframe_settings_1.callUpdateEffectKeyframeSettings)({
122
+ fileName: update.fileName,
123
+ nodePath: update.nodePath,
124
+ effectIndex: update.effectIndex,
125
+ fieldKey: update.fieldKey,
126
+ settings,
127
+ schema: update.schema,
128
+ setPropStatuses,
129
+ clientId,
130
+ });
131
+ })).then(() => undefined);
132
+ };
133
+ exports.updateSelectedTimelineEasings = updateSelectedTimelineEasings;
@@ -4,6 +4,7 @@ import type { getTimelineKeyframes } from './get-timeline-keyframes';
4
4
  export type ExpandedTrackKeyframeRow = {
5
5
  readonly height: number;
6
6
  readonly keyframes: ReturnType<typeof getTimelineKeyframes>;
7
+ readonly canEditEasing: boolean;
7
8
  readonly nodePathInfo: SequenceNodePathInfo;
8
9
  readonly rowKey: string;
9
10
  };
@@ -7,9 +7,32 @@ const timeline_layout_1 = require("../../helpers/timeline-layout");
7
7
  const timeline_node_path_key_1 = require("../../helpers/timeline-node-path-key");
8
8
  const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
9
9
  const get_node_keyframes_1 = require("./get-node-keyframes");
10
+ const canEditEasingForInterpolationFunction = (interpolationFunction) => interpolationFunction === 'interpolate' ||
11
+ interpolationFunction === 'interpolateColors';
12
+ const getNodeCanEditEasing = ({ node, nodePath, propStatuses, }) => {
13
+ var _a;
14
+ if (node.kind !== 'field' || node.field === null) {
15
+ return false;
16
+ }
17
+ if (node.field.kind === 'sequence-field') {
18
+ const sequencePropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[node.field.key];
19
+ return ((sequencePropStatus === null || sequencePropStatus === void 0 ? void 0 : sequencePropStatus.status) === 'keyframed' &&
20
+ canEditEasingForInterpolationFunction(sequencePropStatus.interpolationFunction));
21
+ }
22
+ const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
23
+ propStatuses,
24
+ nodePath,
25
+ effectIndex: node.field.effectIndex,
26
+ });
27
+ const effectPropStatus = effectStatus.type === 'can-update-effect'
28
+ ? effectStatus.props[node.field.key]
29
+ : null;
30
+ return ((effectPropStatus === null || effectPropStatus === void 0 ? void 0 : effectPropStatus.status) === 'keyframed' &&
31
+ canEditEasingForInterpolationFunction(effectPropStatus.interpolationFunction));
32
+ };
10
33
  const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayOffset, }) => {
11
34
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
12
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
35
+ const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
13
36
  const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
14
37
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
15
38
  const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
@@ -17,9 +40,9 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
17
40
  nodePathInfo,
18
41
  getDragOverrides,
19
42
  getEffectDragOverrides,
20
- codeValues,
43
+ propStatuses,
21
44
  }), [
22
- codeValues,
45
+ propStatuses,
23
46
  getDragOverrides,
24
47
  getEffectDragOverrides,
25
48
  nodePathInfo,
@@ -30,23 +53,28 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
30
53
  sequence,
31
54
  nodePathInfo,
32
55
  getIsExpanded,
33
- codeValues,
34
- }), [codeValues, getIsExpanded, nodePathInfo, sequence]);
56
+ propStatuses,
57
+ }), [propStatuses, getIsExpanded, nodePathInfo, sequence]);
35
58
  const rows = (0, react_1.useMemo)(() => flat.map(({ node }) => ({
36
59
  height: (0, timeline_layout_1.getTreeRowHeight)(node),
37
60
  keyframes: (0, get_node_keyframes_1.getNodeKeyframes)({
38
61
  node,
39
62
  nodePath: nodePathInfo.sequenceSubscriptionKey,
40
- codeValues,
63
+ propStatuses,
41
64
  keyframeDisplayOffset,
42
65
  getDragOverrides,
43
66
  getEffectDragOverrides,
44
67
  timelinePosition,
45
68
  }),
69
+ canEditEasing: getNodeCanEditEasing({
70
+ node,
71
+ nodePath: nodePathInfo.sequenceSubscriptionKey,
72
+ propStatuses,
73
+ }),
46
74
  rowKey: (0, timeline_node_path_key_1.timelineNodePathInfoToKey)(node.nodePathInfo),
47
75
  nodePathInfo: node.nodePathInfo,
48
76
  })), [
49
- codeValues,
77
+ propStatuses,
50
78
  flat,
51
79
  getDragOverrides,
52
80
  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,
@@ -0,0 +1 @@
1
+ export declare const CANVAS_CAPTURE_ENABLED = false;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANVAS_CAPTURE_ENABLED = void 0;
4
+ exports.CANVAS_CAPTURE_ENABLED = false;
@@ -0,0 +1,11 @@
1
+ import { type EffectDragData } from '@remotion/studio-shared';
2
+ import type { SequencePropsSubscriptionKey } from 'remotion';
3
+ export declare const hasEffectDragType: (dataTransfer: DataTransfer) => boolean;
4
+ export declare const hasExplicitEffectDragType: (dataTransfer: DataTransfer) => boolean;
5
+ export declare const getEffectDragData: (dataTransfer: DataTransfer) => EffectDragData | null;
6
+ export declare const addEffectFromDragData: ({ clientId, dragData, fileName, nodePath, }: {
7
+ readonly clientId: string;
8
+ readonly dragData: EffectDragData;
9
+ readonly fileName: string;
10
+ readonly nodePath: SequencePropsSubscriptionKey;
11
+ }) => Promise<void>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addEffectFromDragData = exports.getEffectDragData = exports.hasExplicitEffectDragType = exports.hasEffectDragType = void 0;
4
+ const studio_shared_1 = require("@remotion/studio-shared");
5
+ const install_required_package_1 = require("../helpers/install-required-package");
6
+ const call_api_1 = require("./call-api");
7
+ const NotificationCenter_1 = require("./Notifications/NotificationCenter");
8
+ const hasEffectDragType = (dataTransfer) => {
9
+ const types = Array.from(dataTransfer.types);
10
+ const hasExplicitEffectType = types.includes(studio_shared_1.EFFECT_DRAG_MIME_TYPE);
11
+ if (!hasExplicitEffectType && hasImportableAssetDragType(dataTransfer)) {
12
+ return false;
13
+ }
14
+ return types.some((type) => type === studio_shared_1.EFFECT_DRAG_MIME_TYPE || isGenericDragType(type));
15
+ };
16
+ exports.hasEffectDragType = hasEffectDragType;
17
+ const hasExplicitEffectDragType = (dataTransfer) => {
18
+ return Array.from(dataTransfer.types).includes(studio_shared_1.EFFECT_DRAG_MIME_TYPE);
19
+ };
20
+ exports.hasExplicitEffectDragType = hasExplicitEffectDragType;
21
+ const isGenericDragType = (type) => {
22
+ return type === 'application/json' || type === 'text/plain';
23
+ };
24
+ const hasImportableAssetDragType = (dataTransfer) => {
25
+ return Array.from(dataTransfer.types).some((type) => type === 'Files' ||
26
+ type === studio_shared_1.ASSET_DRAG_MIME_TYPE ||
27
+ type === studio_shared_1.COMPONENT_DRAG_MIME_TYPE ||
28
+ type === studio_shared_1.SFX_DRAG_MIME_TYPE ||
29
+ type === 'text/uri-list' ||
30
+ type === 'text/html');
31
+ };
32
+ const getEffectDragData = (dataTransfer) => {
33
+ for (const type of [
34
+ studio_shared_1.EFFECT_DRAG_MIME_TYPE,
35
+ 'application/json',
36
+ 'text/plain',
37
+ ]) {
38
+ const value = dataTransfer.getData(type);
39
+ if (!value) {
40
+ continue;
41
+ }
42
+ const parsed = (0, studio_shared_1.parseEffectDragData)(value);
43
+ if (parsed) {
44
+ return parsed;
45
+ }
46
+ }
47
+ return null;
48
+ };
49
+ exports.getEffectDragData = getEffectDragData;
50
+ const addEffectFromDragData = async ({ clientId, dragData, fileName, nodePath, }) => {
51
+ try {
52
+ const requiredPackage = (0, studio_shared_1.getRequiredPackageForEffectImportPath)(dragData.effect.importPath);
53
+ await (0, install_required_package_1.installRequiredPackages)(requiredPackage ? [requiredPackage] : []);
54
+ const result = await (0, call_api_1.callApi)('/api/add-effect', {
55
+ fileName,
56
+ sequenceNodePath: nodePath,
57
+ effectName: dragData.effect.name,
58
+ effectImportPath: dragData.effect.importPath,
59
+ effectConfig: dragData.effect.config,
60
+ clientId,
61
+ });
62
+ if (result.success) {
63
+ (0, NotificationCenter_1.showNotification)(`Added ${dragData.effect.name}()`, 2000);
64
+ }
65
+ else {
66
+ (0, NotificationCenter_1.showNotification)(result.reason, 4000);
67
+ }
68
+ }
69
+ catch (err) {
70
+ (0, NotificationCenter_1.showNotification)(err.message, 4000);
71
+ }
72
+ };
73
+ exports.addEffectFromDragData = addEffectFromDragData;
@@ -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;
@@ -0,0 +1,20 @@
1
+ export type OutlinePoint = {
2
+ readonly x: number;
3
+ readonly y: number;
4
+ };
5
+ export type SelectedOutline = {
6
+ readonly key: string;
7
+ readonly dimensions: {
8
+ readonly width: number;
9
+ readonly height: number;
10
+ } | null;
11
+ readonly points: readonly [
12
+ OutlinePoint,
13
+ OutlinePoint,
14
+ OutlinePoint,
15
+ OutlinePoint
16
+ ];
17
+ };
18
+ export declare const clamp: (value: number, min: number, max: number) => number;
19
+ export declare const mix: (from: number, to: number, progress: number) => number;
20
+ export declare const mixPoint: (from: OutlinePoint, to: OutlinePoint, progress: number) => OutlinePoint;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mixPoint = exports.mix = exports.clamp = void 0;
4
+ const clamp = (value, min, max) => {
5
+ return Math.min(max, Math.max(min, value));
6
+ };
7
+ exports.clamp = clamp;
8
+ const mix = (from, to, progress) => {
9
+ return from + (to - from) * progress;
10
+ };
11
+ exports.mix = mix;
12
+ const mixPoint = (from, to, progress) => {
13
+ return {
14
+ x: (0, exports.mix)(from.x, to.x, progress),
15
+ y: (0, exports.mix)(from.y, to.y, progress),
16
+ };
17
+ };
18
+ exports.mixPoint = mixPoint;