@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
@@ -2,10 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimelineSequencePropItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const studio_shared_1 = require("@remotion/studio-shared");
5
6
  const react_1 = require("react");
6
7
  const remotion_1 = require("remotion");
7
8
  const client_id_1 = require("../../helpers/client-id");
9
+ const modals_1 = require("../../state/modals");
8
10
  const ContextMenu_1 = require("../ContextMenu");
11
+ const call_add_keyframe_1 = require("./call-add-keyframe");
9
12
  const save_sequence_prop_1 = require("./save-sequence-prop");
10
13
  const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
11
14
  const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
@@ -17,6 +20,23 @@ const TimelineRowChrome_1 = require("./TimelineRowChrome");
17
20
  const TimelineSchemaField_1 = require("./TimelineSchemaField");
18
21
  const TimelineSelection_1 = require("./TimelineSelection");
19
22
  const fieldRowBase = {};
23
+ const isKeyframedStatus = (status) => {
24
+ return status.status === 'keyframed';
25
+ };
26
+ const isResettableStatus = ({ status, defaultValue, }) => {
27
+ var _a;
28
+ if (defaultValue === undefined) {
29
+ return false;
30
+ }
31
+ if (status.status === 'keyframed') {
32
+ return true;
33
+ }
34
+ if (status.status === 'computed') {
35
+ return false;
36
+ }
37
+ const effectiveCodeValue = (_a = status.codeValue) !== null && _a !== void 0 ? _a : defaultValue;
38
+ return JSON.stringify(effectiveCodeValue) !== JSON.stringify(defaultValue);
39
+ };
20
40
  const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
21
41
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
22
42
  const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
@@ -38,9 +58,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
38
58
  ? previewServerState.clientId
39
59
  : null;
40
60
  const onSave = (0, react_1.useCallback)((value) => {
41
- if (!codeValue || !codeValue.canUpdate) {
42
- return Promise.reject(new Error('Cannot save'));
43
- }
61
+ var _a;
44
62
  if (!clientId) {
45
63
  return Promise.reject(new Error('Not connected to studio server'));
46
64
  }
@@ -48,6 +66,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
48
66
  ? JSON.stringify(field.fieldSchema.default)
49
67
  : null;
50
68
  const stringifiedValue = JSON.stringify(value);
69
+ const fieldLabel = (_a = field.description) !== null && _a !== void 0 ? _a : field.key;
51
70
  if (value === codeValue.codeValue) {
52
71
  return Promise.resolve();
53
72
  }
@@ -55,19 +74,26 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
55
74
  codeValue.codeValue === undefined) {
56
75
  return Promise.resolve();
57
76
  }
58
- return (0, save_sequence_prop_1.saveSequenceProp)({
59
- fileName: validatedLocation.source,
60
- nodePath,
61
- fieldKey: field.key,
62
- value,
63
- defaultValue,
64
- schema,
77
+ return (0, save_sequence_prop_1.saveSequenceProps)({
78
+ changes: [
79
+ {
80
+ fileName: validatedLocation.source,
81
+ nodePath,
82
+ fieldKey: field.key,
83
+ value,
84
+ defaultValue,
85
+ schema,
86
+ },
87
+ ],
65
88
  setCodeValues,
66
89
  clientId,
90
+ undoLabel: `Update ${fieldLabel}`,
91
+ redoLabel: `Update ${fieldLabel} again`,
67
92
  });
68
93
  }, [
69
94
  codeValue,
70
95
  clientId,
96
+ field.description,
71
97
  field.fieldSchema.default,
72
98
  field.key,
73
99
  nodePath,
@@ -79,7 +105,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
79
105
  if (nodePath === null) {
80
106
  throw new Error('Cannot drag value');
81
107
  }
82
- setDragOverrides(nodePath, field.key, value);
108
+ setDragOverrides(nodePath, field.key, remotion_1.Internals.makeStaticDragOverride(value));
83
109
  }, [setDragOverrides, nodePath, field.key]);
84
110
  const onDragEnd = (0, react_1.useCallback)(() => {
85
111
  if (nodePath === null) {
@@ -87,17 +113,23 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
87
113
  }
88
114
  clearDragOverrides(nodePath);
89
115
  }, [clearDragOverrides, nodePath]);
90
- return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
116
+ return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue, scaleLockNodePath: nodePath }));
91
117
  };
92
118
  const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, schema, keyframeDisplayOffset, }) => {
93
119
  var _a, _b;
94
120
  const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
95
121
  const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
96
- const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
122
+ const { setCodeValues, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
97
123
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
124
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
98
125
  const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
126
+ const clientId = previewServerState.type === 'connected'
127
+ ? previewServerState.clientId
128
+ : null;
99
129
  const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
100
130
  const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
131
+ const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
132
+ const jsxFrame = timelinePosition - keyframeDisplayOffset;
101
133
  const dragOverrideValue = (0, react_1.useMemo)(() => {
102
134
  var _a;
103
135
  return ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
@@ -106,6 +138,10 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
106
138
  (0, TimelineKeyframeControls_1.shouldShowTimelineKeyframeControls)({
107
139
  propStatus: codeValue,
108
140
  selected: selection.selected,
141
+ keyframable: (0, studio_shared_1.isSchemaFieldKeyframable)({
142
+ schema,
143
+ key: field.key,
144
+ }),
109
145
  }) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus: codeValue, nodePath: nodePath, fileName: validatedLocation.source, keyframeDisplayOffset: keyframeDisplayOffset, defaultValue: field.fieldSchema.default, dragOverrideValue: dragOverrideValue, schema: schema, effectIndex: null })) : null;
110
146
  const style = (0, react_1.useMemo)(() => {
111
147
  return {
@@ -113,71 +149,161 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
113
149
  height: field.rowHeight,
114
150
  };
115
151
  }, [field.rowHeight]);
116
- const isNonDefault = (0, react_1.useMemo)(() => {
117
- var _a;
118
- if (!codeValue || !codeValue.canUpdate) {
152
+ const canResetToDefault = (0, react_1.useMemo)(() => {
153
+ if (!codeValue || codeValue.status === 'computed') {
119
154
  return false;
120
155
  }
121
- const effectiveCodeValue = (_a = codeValue.codeValue) !== null && _a !== void 0 ? _a : field.fieldSchema.default;
122
- return (JSON.stringify(effectiveCodeValue) !==
123
- JSON.stringify(field.fieldSchema.default));
156
+ return isResettableStatus({
157
+ status: codeValue,
158
+ defaultValue: field.fieldSchema.default,
159
+ });
124
160
  }, [codeValue, field.fieldSchema.default]);
125
161
  const canPerformReset = previewServerState.type === 'connected' &&
126
162
  codeValue !== null &&
127
- codeValue.canUpdate;
163
+ codeValue.status !== 'computed';
164
+ const canShowReset = canPerformReset && field.fieldSchema.default !== undefined;
128
165
  const onReset = (0, react_1.useCallback)(() => {
129
- if (!canPerformReset ||
166
+ var _a;
167
+ if (!canShowReset ||
168
+ !canResetToDefault ||
130
169
  previewServerState.type !== 'connected' ||
131
- codeValue === null ||
132
- !isNonDefault) {
170
+ codeValue === null) {
133
171
  return;
134
172
  }
135
173
  const defaultValue = field.fieldSchema.default !== undefined
136
174
  ? JSON.stringify(field.fieldSchema.default)
137
175
  : null;
138
- (0, save_sequence_prop_1.saveSequenceProp)({
176
+ const fieldLabel = (_a = field.description) !== null && _a !== void 0 ? _a : field.key;
177
+ (0, save_sequence_prop_1.saveSequenceProps)({
178
+ changes: [
179
+ {
180
+ fileName: validatedLocation.source,
181
+ nodePath,
182
+ fieldKey: field.key,
183
+ value: field.fieldSchema.default,
184
+ defaultValue,
185
+ schema,
186
+ },
187
+ ],
188
+ setCodeValues,
189
+ clientId: previewServerState.clientId,
190
+ undoLabel: `Reset ${fieldLabel}`,
191
+ redoLabel: `Reapply ${fieldLabel}`,
192
+ });
193
+ }, [
194
+ canResetToDefault,
195
+ canShowReset,
196
+ field.description,
197
+ field.fieldSchema.default,
198
+ field.key,
199
+ nodePath,
200
+ previewServerState,
201
+ schema,
202
+ setCodeValues,
203
+ validatedLocation.source,
204
+ codeValue,
205
+ ]);
206
+ const onSaveKeyframed = (0, react_1.useCallback)((value, sourceFrame) => {
207
+ if (!clientId) {
208
+ return Promise.reject(new Error('Not connected to studio server'));
209
+ }
210
+ return (0, call_add_keyframe_1.callAddSequenceKeyframe)({
139
211
  fileName: validatedLocation.source,
140
212
  nodePath,
141
213
  fieldKey: field.key,
142
- value: field.fieldSchema.default,
143
- defaultValue,
214
+ sourceFrame,
215
+ value,
144
216
  schema,
145
217
  setCodeValues,
146
- clientId: previewServerState.clientId,
218
+ clientId,
147
219
  });
148
220
  }, [
149
- canPerformReset,
150
- field.fieldSchema.default,
221
+ clientId,
151
222
  field.key,
152
- isNonDefault,
153
223
  nodePath,
154
- previewServerState,
155
224
  schema,
156
225
  setCodeValues,
157
226
  validatedLocation.source,
227
+ ]);
228
+ const onKeyframedDragValueChange = (0, react_1.useCallback)((value) => {
229
+ if (codeValue === null || !isKeyframedStatus(codeValue)) {
230
+ throw new Error('Expected keyframed status');
231
+ }
232
+ setDragOverrides(nodePath, field.key, remotion_1.Internals.makeKeyframedDragOverride({
233
+ status: codeValue,
234
+ frame: jsxFrame,
235
+ value,
236
+ }));
237
+ }, [codeValue, field.key, jsxFrame, nodePath, setDragOverrides]);
238
+ const onKeyframedDragEnd = (0, react_1.useCallback)(() => {
239
+ clearDragOverrides(nodePath);
240
+ }, [clearDragOverrides, nodePath]);
241
+ const onOpenKeyframeSettings = (0, react_1.useCallback)(() => {
242
+ var _a;
243
+ if (codeValue === null || !isKeyframedStatus(codeValue)) {
244
+ return;
245
+ }
246
+ setSelectedModal({
247
+ type: 'keyframe-settings',
248
+ fileName: validatedLocation.source,
249
+ nodePath,
250
+ fieldKey: field.key,
251
+ fieldLabel: (_a = field.description) !== null && _a !== void 0 ? _a : field.key,
252
+ status: codeValue,
253
+ schema,
254
+ effectIndex: null,
255
+ });
256
+ }, [
158
257
  codeValue,
258
+ field.description,
259
+ field.key,
260
+ nodePath,
261
+ schema,
262
+ setSelectedModal,
263
+ validatedLocation.source,
159
264
  ]);
160
265
  const contextMenuValues = (0, react_1.useMemo)(() => {
161
- return [
266
+ const values = [
162
267
  {
163
268
  type: 'item',
164
269
  id: 'reset-sequence-field',
165
270
  keyHint: null,
166
271
  label: 'Reset',
167
272
  leftItem: null,
168
- disabled: !canPerformReset,
273
+ disabled: !canShowReset,
169
274
  onClick: onReset,
170
275
  quickSwitcherLabel: null,
171
276
  subMenu: null,
172
277
  value: 'reset-sequence-field',
173
278
  },
174
279
  ];
175
- }, [canPerformReset, onReset]);
280
+ if (codeValue !== null && isKeyframedStatus(codeValue)) {
281
+ values.push({
282
+ type: 'item',
283
+ id: 'keyframe-settings-sequence-field',
284
+ keyHint: null,
285
+ label: 'Keyframe settings...',
286
+ leftItem: null,
287
+ disabled: previewServerState.type !== 'connected',
288
+ onClick: onOpenKeyframeSettings,
289
+ quickSwitcherLabel: null,
290
+ subMenu: null,
291
+ value: 'keyframe-settings-sequence-field',
292
+ });
293
+ }
294
+ return values;
295
+ }, [
296
+ canShowReset,
297
+ codeValue,
298
+ onOpenKeyframeSettings,
299
+ onReset,
300
+ previewServerState,
301
+ ]);
176
302
  if (codeValue === null) {
177
303
  return null;
178
304
  }
179
305
  const row = (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), keyframeControls: keyframeControls, arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, selected: selection.selected, selectable: selection.selectable, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection: false, outerHeight: null, children: [
180
- jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), codeValue.canUpdate ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue }) })) : codeValue.reason === 'keyframed' ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: codeValue, keyframeDisplayOffset: keyframeDisplayOffset }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }) }))] }));
306
+ jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), isKeyframedStatus(codeValue) ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: codeValue, keyframeDisplayOffset: keyframeDisplayOffset, dragOverrideValue: dragOverrideValue, onSave: onSaveKeyframed, onDragValueChange: onKeyframedDragValueChange, onDragEnd: onKeyframedDragEnd, scaleLockNodePath: nodePath }) })) : codeValue.status === 'static' ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }) }))] }));
181
307
  return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selection.selectable ? selection.onSelect : null, children: row }));
182
308
  };
183
309
  exports.TimelineSequencePropItem = TimelineSequencePropItem;
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import type { CodeValues, OverrideIdToNodePaths, SequencePropsSubscriptionKey, TSequence } from 'remotion';
3
+ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
4
+ import { type SaveSequencePropChange } from './save-sequence-prop';
5
+ import { type TimelineSelection } from './TimelineSelection';
6
+ export type TimelineSequenceDurationDragTarget = {
7
+ readonly fileName: string;
8
+ readonly initialDuration: number;
9
+ readonly nodePath: SequencePropsSubscriptionKey;
10
+ };
11
+ export type TimelineSequenceFromDragTarget = {
12
+ readonly fileName: string;
13
+ readonly initialFrom: number;
14
+ readonly nodePath: SequencePropsSubscriptionKey;
15
+ };
16
+ export declare const getTimelineSequenceDurationDragValue: ({ initialDuration, deltaFrames, }: {
17
+ readonly initialDuration: number;
18
+ readonly deltaFrames: number;
19
+ }) => number;
20
+ export declare const getTimelineSequenceDurationDragChanges: ({ targets, deltaFrames, }: {
21
+ readonly targets: readonly TimelineSequenceDurationDragTarget[];
22
+ readonly deltaFrames: number;
23
+ }) => SaveSequencePropChange[];
24
+ export declare const getTimelineSequenceFromDragValue: ({ initialFrom, deltaFrames, }: {
25
+ readonly initialFrom: number;
26
+ readonly deltaFrames: number;
27
+ }) => number;
28
+ export declare const getTimelineSequenceFromDragChanges: ({ targets, deltaFrames, }: {
29
+ readonly targets: readonly TimelineSequenceFromDragTarget[];
30
+ readonly deltaFrames: number;
31
+ }) => SaveSequencePropChange[];
32
+ export declare const getTimelineSequenceDurationDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, codeValues, }: {
33
+ readonly draggedNodePathInfo: SequenceNodePathInfo;
34
+ readonly selectedItems: readonly TimelineSelection[];
35
+ readonly sequences: TSequence[];
36
+ readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
37
+ readonly codeValues: CodeValues;
38
+ }) => TimelineSequenceDurationDragTarget[] | null;
39
+ export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, codeValues, }: {
40
+ readonly draggedNodePathInfo: SequenceNodePathInfo;
41
+ readonly selectedItems: readonly TimelineSelection[];
42
+ readonly sequences: TSequence[];
43
+ readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
44
+ readonly codeValues: CodeValues;
45
+ }) => TimelineSequenceFromDragTarget[] | null;
46
+ export declare const useTimelineSequenceFromDrag: ({ nodePathInfo, windowWidth, timelineDurationInFrames, }: {
47
+ readonly nodePathInfo: SequenceNodePathInfo | null;
48
+ readonly windowWidth: number;
49
+ readonly timelineDurationInFrames: number;
50
+ }) => {
51
+ dragging: boolean;
52
+ onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
53
+ };
54
+ export declare const TimelineSequenceRightEdgeDragHandle: React.FC<{
55
+ readonly nodePathInfo: SequenceNodePathInfo;
56
+ readonly windowWidth: number;
57
+ readonly timelineDurationInFrames: number;
58
+ }>;