@remotion/studio 4.0.472 → 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.
- package/dist/api/rename-static-file.d.ts +6 -0
- package/dist/api/rename-static-file.js +18 -0
- package/dist/components/AssetSelector.js +45 -4
- package/dist/components/AssetSelectorItem.js +177 -27
- package/dist/components/Canvas.js +131 -11
- package/dist/components/ConfirmationDialog-types.d.ts +8 -0
- package/dist/components/ConfirmationDialog-types.js +2 -0
- package/dist/components/ConfirmationDialog.d.ts +7 -0
- package/dist/components/ConfirmationDialog.js +103 -0
- package/dist/components/ContextMenu.d.ts +9 -1
- package/dist/components/ContextMenu.js +49 -5
- package/dist/components/CurrentAsset.d.ts +1 -0
- package/dist/components/CurrentAsset.js +13 -2
- package/dist/components/EditorContent.js +15 -2
- package/dist/components/EditorContexts.js +2 -1
- package/dist/components/EditorRuler/Ruler.js +2 -0
- package/dist/components/ExplorerPanel.d.ts +0 -4
- package/dist/components/ExplorerPanel.js +8 -4
- package/dist/components/ExplorerPanelRef.d.ts +4 -0
- package/dist/components/ExplorerPanelRef.js +5 -0
- package/dist/components/FilePreview.d.ts +1 -1
- package/dist/components/InitialCompositionLoader.d.ts +0 -1
- package/dist/components/InitialCompositionLoader.js +5 -27
- package/dist/components/Menu/MenuItem.js +7 -1
- package/dist/components/Menu/SubMenu.js +5 -1
- package/dist/components/Menu/portals.js +17 -8
- package/dist/components/MenuToolbar.js +5 -1
- package/dist/components/ModalContainer.js +6 -1
- package/dist/components/Modals.js +5 -2
- package/dist/components/NewComposition/ComboBox.js +8 -2
- package/dist/components/NewComposition/InputDragger.d.ts +1 -0
- package/dist/components/NewComposition/InputDragger.js +9 -6
- package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
- package/dist/components/NewComposition/RenameStaticFile.js +118 -0
- package/dist/components/OptionsPanel.js +5 -1
- package/dist/components/OutlineToggle.d.ts +2 -0
- package/dist/components/OutlineToggle.js +20 -0
- package/dist/components/Preview.d.ts +0 -2
- package/dist/components/Preview.js +23 -33
- package/dist/components/PreviewToolbar.js +19 -6
- package/dist/components/RenderButton.js +8 -2
- package/dist/components/RenderPreview.js +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +29 -3
- package/dist/components/SelectedOutlineOverlay.js +259 -80
- package/dist/components/ShowOutlinesProvider.d.ts +4 -0
- package/dist/components/ShowOutlinesProvider.js +24 -0
- package/dist/components/SizeSelector.js +3 -3
- package/dist/components/Splitter/SplitterHandle.js +2 -0
- package/dist/components/StaticFilePreview.js +2 -2
- package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
- package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
- package/dist/components/Timeline/SequencePropsObserver.js +3 -3
- package/dist/components/Timeline/Timeline.js +3 -13
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +26 -3
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +242 -25
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +23 -11
- package/dist/components/Timeline/TimelineEffectItem.js +8 -7
- package/dist/components/Timeline/TimelineEffectPropItem.js +69 -19
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +6 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
- package/dist/components/Timeline/TimelineKeyframeControls.js +13 -23
- package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -22
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
- package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
- package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
- package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
- package/dist/components/Timeline/TimelineKeyframeEasingLine.js +120 -0
- package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
- package/dist/components/Timeline/TimelineList.js +2 -2
- package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
- package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
- package/dist/components/Timeline/TimelineNumberField.js +15 -7
- package/dist/components/Timeline/TimelineRotationField.js +17 -11
- package/dist/components/Timeline/TimelineScaleField.js +17 -13
- package/dist/components/Timeline/TimelineSelection.d.ts +15 -0
- package/dist/components/Timeline/TimelineSelection.js +26 -1
- package/dist/components/Timeline/TimelineSequence.js +6 -6
- package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +297 -36
- package/dist/components/Timeline/TimelineSequencePropItem.js +113 -48
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +69 -70
- package/dist/components/Timeline/TimelineTranslateField.js +24 -19
- package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
- package/dist/components/Timeline/apply-effect-response-to-prop-statuses.d.ts +5 -0
- package/dist/components/Timeline/apply-effect-response-to-prop-statuses.js +19 -0
- package/dist/components/Timeline/call-add-keyframe.d.ts +5 -5
- package/dist/components/Timeline/call-add-keyframe.js +6 -4
- package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
- package/dist/components/Timeline/call-delete-keyframe.js +7 -7
- package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
- package/dist/components/Timeline/call-move-keyframe.js +71 -0
- package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
- package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
- package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
- package/dist/components/Timeline/delete-selected-timeline-item.d.ts +10 -7
- package/dist/components/Timeline/delete-selected-timeline-item.js +37 -23
- package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
- package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
- package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
- package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
- package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
- package/dist/components/Timeline/get-node-keyframes.js +4 -4
- package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
- package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
- package/dist/components/Timeline/reset-selected-timeline-props.js +13 -12
- package/dist/components/Timeline/save-effect-prop.d.ts +16 -5
- package/dist/components/Timeline/save-effect-prop.js +37 -19
- package/dist/components/Timeline/save-prop-queue.d.ts +4 -3
- package/dist/components/Timeline/save-prop-queue.js +6 -3
- package/dist/components/Timeline/save-sequence-prop.d.ts +5 -10
- package/dist/components/Timeline/save-sequence-prop.js +35 -32
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
- package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
- package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
- package/dist/components/Timeline/timeline-asset-link.js +37 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
- package/dist/components/Timeline/timeline-field-utils.js +26 -5
- package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
- package/dist/components/Timeline/timeline-translate-utils.js +6 -4
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -7
- package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
- package/dist/components/Timeline/use-timeline-height.js +3 -3
- package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +380 -0
- package/dist/components/import-assets.d.ts +31 -0
- package/dist/components/import-assets.js +216 -17
- package/dist/components/load-canvas-content-from-url.d.ts +1 -0
- package/dist/components/load-canvas-content-from-url.js +9 -3
- package/dist/components/use-select-asset.d.ts +1 -0
- package/dist/components/use-select-asset.js +30 -0
- package/dist/error-overlay/error-origin.d.ts +3 -0
- package/dist/error-overlay/error-origin.js +42 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
- package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
- package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
- package/dist/esm/{chunk-48grt472.js → chunk-xjvc8qen.js} +21838 -18862
- package/dist/esm/internals.mjs +21838 -18862
- package/dist/esm/previewEntry.mjs +21127 -18127
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-asset-metadata.js +2 -2
- package/dist/helpers/get-preview-file-type.d.ts +2 -0
- package/dist/helpers/get-preview-file-type.js +33 -0
- package/dist/helpers/install-required-package.d.ts +1 -0
- package/dist/helpers/install-required-package.js +39 -0
- package/dist/helpers/remote-asset-drag.d.ts +4 -0
- package/dist/helpers/remote-asset-drag.js +73 -0
- package/dist/helpers/timeline-layout.d.ts +6 -6
- package/dist/helpers/timeline-layout.js +5 -5
- package/dist/helpers/use-asset-drag-events.d.ts +5 -2
- package/dist/helpers/use-asset-drag-events.js +13 -2
- package/dist/hot-middleware-client/client.js +6 -0
- package/dist/state/editor-outlines.d.ts +8 -0
- package/dist/state/editor-outlines.js +18 -0
- package/dist/state/modals.d.ts +16 -2
- package/package.json +10 -10
- package/dist/helpers/detect-file-type.d.ts +0 -69
- package/dist/helpers/detect-file-type.js +0 -278
|
@@ -6,6 +6,7 @@ const studio_shared_1 = require("@remotion/studio-shared");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const client_id_1 = require("../../helpers/client-id");
|
|
9
|
+
const modals_1 = require("../../state/modals");
|
|
9
10
|
const call_api_1 = require("../call-api");
|
|
10
11
|
const ContextMenu_1 = require("../ContextMenu");
|
|
11
12
|
const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
@@ -42,15 +43,15 @@ const isResettableStatus = ({ status, defaultValue, }) => {
|
|
|
42
43
|
const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) => {
|
|
43
44
|
var _a;
|
|
44
45
|
var _b;
|
|
45
|
-
const { setEffectDragOverrides, clearEffectDragOverrides,
|
|
46
|
+
const { setEffectDragOverrides, clearEffectDragOverrides, setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
46
47
|
const { getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
47
|
-
const {
|
|
48
|
+
const { propStatuses: visualModePropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
48
49
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
49
50
|
const clientId = previewServerState.type === 'connected'
|
|
50
51
|
? previewServerState.clientId
|
|
51
52
|
: null;
|
|
52
|
-
const effectStatus = remotion_1.Internals.
|
|
53
|
-
|
|
53
|
+
const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
|
|
54
|
+
propStatuses: visualModePropStatuses,
|
|
54
55
|
nodePath,
|
|
55
56
|
effectIndex: field.effectIndex,
|
|
56
57
|
});
|
|
@@ -109,8 +110,8 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
109
110
|
}
|
|
110
111
|
return (0, save_prop_queue_1.enqueueSavePropChange)({
|
|
111
112
|
nodePath,
|
|
112
|
-
|
|
113
|
-
applyOptimistic: (prev) => (0, studio_shared_1.
|
|
113
|
+
setPropStatuses,
|
|
114
|
+
applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForEffectPropStatuses)({
|
|
114
115
|
previous: prev,
|
|
115
116
|
effectIndex: field.effectIndex,
|
|
116
117
|
fieldKey: field.key,
|
|
@@ -118,6 +119,7 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
118
119
|
schema: field.effectSchema,
|
|
119
120
|
}),
|
|
120
121
|
apiCall: () => (0, call_api_1.callApi)('/api/save-effect-props', {
|
|
122
|
+
type: 'value',
|
|
121
123
|
fileName: validatedLocation.source,
|
|
122
124
|
sequenceNodePath: nodePath,
|
|
123
125
|
effectIndex: field.effectIndex,
|
|
@@ -137,7 +139,7 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
137
139
|
field.key,
|
|
138
140
|
nodePath,
|
|
139
141
|
propStatus,
|
|
140
|
-
|
|
142
|
+
setPropStatuses,
|
|
141
143
|
validatedLocation,
|
|
142
144
|
]);
|
|
143
145
|
const onSaveKeyframed = (0, react_1.useCallback)((value, sourceFrame) => {
|
|
@@ -155,7 +157,7 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
155
157
|
sourceFrame,
|
|
156
158
|
value,
|
|
157
159
|
schema: field.effectSchema,
|
|
158
|
-
|
|
160
|
+
setPropStatuses,
|
|
159
161
|
clientId,
|
|
160
162
|
});
|
|
161
163
|
}, [
|
|
@@ -164,7 +166,7 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
164
166
|
field.effectSchema,
|
|
165
167
|
field.key,
|
|
166
168
|
nodePath,
|
|
167
|
-
|
|
169
|
+
setPropStatuses,
|
|
168
170
|
validatedLocation,
|
|
169
171
|
]);
|
|
170
172
|
if (field.fieldSchema.type === 'scale') {
|
|
@@ -201,7 +203,7 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
201
203
|
return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: (0, get_timeline_keyframes_1.getComputedStatusLabel)(propStatus) });
|
|
202
204
|
}
|
|
203
205
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
204
|
-
|
|
206
|
+
propStatus,
|
|
205
207
|
dragOverrideValue,
|
|
206
208
|
defaultValue: field.fieldSchema.default,
|
|
207
209
|
frame: jsxFrame,
|
|
@@ -213,8 +215,9 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
213
215
|
var _a;
|
|
214
216
|
var _b, _c;
|
|
215
217
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
216
|
-
const {
|
|
217
|
-
const {
|
|
218
|
+
const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
|
|
219
|
+
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
220
|
+
const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
218
221
|
const { getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
219
222
|
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
220
223
|
const style = (0, react_1.useMemo)(() => {
|
|
@@ -223,11 +226,11 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
223
226
|
height: field.rowHeight,
|
|
224
227
|
};
|
|
225
228
|
}, [field.rowHeight]);
|
|
226
|
-
const effectStatus = (0, react_1.useMemo)(() => remotion_1.Internals.
|
|
227
|
-
|
|
229
|
+
const effectStatus = (0, react_1.useMemo)(() => remotion_1.Internals.getEffectPropStatusesCtx({
|
|
230
|
+
propStatuses,
|
|
228
231
|
nodePath,
|
|
229
232
|
effectIndex: field.effectIndex,
|
|
230
|
-
}), [
|
|
233
|
+
}), [propStatuses, nodePath, field.effectIndex]);
|
|
231
234
|
const propStatus = effectStatus.type === 'can-update-effect'
|
|
232
235
|
? ((_b = (_a = effectStatus.props) === null || _a === void 0 ? void 0 : _a[field.key]) !== null && _b !== void 0 ? _b : null)
|
|
233
236
|
: null;
|
|
@@ -267,6 +270,7 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
267
270
|
? JSON.stringify(field.fieldSchema.default)
|
|
268
271
|
: null;
|
|
269
272
|
(0, save_effect_prop_1.saveEffectProp)({
|
|
273
|
+
type: 'value',
|
|
270
274
|
fileName: validatedLocation.source,
|
|
271
275
|
nodePath,
|
|
272
276
|
effectIndex: field.effectIndex,
|
|
@@ -274,7 +278,7 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
274
278
|
value: field.fieldSchema.default,
|
|
275
279
|
defaultValue,
|
|
276
280
|
schema: field.effectSchema,
|
|
277
|
-
|
|
281
|
+
setPropStatuses,
|
|
278
282
|
clientId: previewServerState.clientId,
|
|
279
283
|
});
|
|
280
284
|
}, [
|
|
@@ -286,11 +290,36 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
286
290
|
field.key,
|
|
287
291
|
nodePath,
|
|
288
292
|
previewServerState,
|
|
289
|
-
|
|
293
|
+
setPropStatuses,
|
|
294
|
+
validatedLocation.source,
|
|
295
|
+
]);
|
|
296
|
+
const onOpenKeyframeSettings = (0, react_1.useCallback)(() => {
|
|
297
|
+
var _a;
|
|
298
|
+
if (propStatus === null || !isKeyframedStatus(propStatus)) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
setSelectedModal({
|
|
302
|
+
type: 'keyframe-settings',
|
|
303
|
+
fileName: validatedLocation.source,
|
|
304
|
+
nodePath,
|
|
305
|
+
fieldKey: field.key,
|
|
306
|
+
fieldLabel: (_a = field.description) !== null && _a !== void 0 ? _a : field.key,
|
|
307
|
+
status: propStatus,
|
|
308
|
+
schema: field.effectSchema,
|
|
309
|
+
effectIndex: field.effectIndex,
|
|
310
|
+
});
|
|
311
|
+
}, [
|
|
312
|
+
field.description,
|
|
313
|
+
field.effectIndex,
|
|
314
|
+
field.effectSchema,
|
|
315
|
+
field.key,
|
|
316
|
+
nodePath,
|
|
317
|
+
propStatus,
|
|
318
|
+
setSelectedModal,
|
|
290
319
|
validatedLocation.source,
|
|
291
320
|
]);
|
|
292
321
|
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
293
|
-
|
|
322
|
+
const values = [
|
|
294
323
|
{
|
|
295
324
|
type: 'item',
|
|
296
325
|
id: 'reset-effect-field',
|
|
@@ -304,7 +333,28 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
304
333
|
value: 'reset-effect-field',
|
|
305
334
|
},
|
|
306
335
|
];
|
|
307
|
-
|
|
336
|
+
if (propStatus !== null && isKeyframedStatus(propStatus)) {
|
|
337
|
+
values.push({
|
|
338
|
+
type: 'item',
|
|
339
|
+
id: 'keyframe-settings-effect-field',
|
|
340
|
+
keyHint: null,
|
|
341
|
+
label: 'Keyframe settings...',
|
|
342
|
+
leftItem: null,
|
|
343
|
+
disabled: previewServerState.type !== 'connected',
|
|
344
|
+
onClick: onOpenKeyframeSettings,
|
|
345
|
+
quickSwitcherLabel: null,
|
|
346
|
+
subMenu: null,
|
|
347
|
+
value: 'keyframe-settings-effect-field',
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
return values;
|
|
351
|
+
}, [
|
|
352
|
+
canShowReset,
|
|
353
|
+
onOpenKeyframeSettings,
|
|
354
|
+
onReset,
|
|
355
|
+
previewServerState,
|
|
356
|
+
propStatus,
|
|
357
|
+
]);
|
|
308
358
|
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: [
|
|
309
359
|
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_c = field.description) !== null && _c !== void 0 ? _c : field.key }), jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, keyframeDisplayOffset: keyframeDisplayOffset }) })
|
|
310
360
|
] }));
|
|
@@ -37,7 +37,9 @@ exports.TimelineExpandedKeyframeRow = void 0;
|
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
40
|
+
const get_timeline_easing_segments_1 = require("./get-timeline-easing-segments");
|
|
40
41
|
const TimelineKeyframeDiamond_1 = require("./TimelineKeyframeDiamond");
|
|
42
|
+
const TimelineKeyframeEasingLine_1 = require("./TimelineKeyframeEasingLine");
|
|
41
43
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
42
44
|
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
43
45
|
const row = {
|
|
@@ -49,7 +51,10 @@ const rowSeparator = {
|
|
|
49
51
|
const TimelineExpandedKeyframeRowUnmemoized = ({ height, keyframes, nodePathInfo, showSeparator }) => {
|
|
50
52
|
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
51
53
|
const { selected: rowSelected } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
52
|
-
|
|
54
|
+
const easingSegments = TimelineSelection_1.ENABLE_OUTLINES
|
|
55
|
+
? (0, get_timeline_easing_segments_1.getTimelineEasingSegments)(keyframes)
|
|
56
|
+
: [];
|
|
57
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [showSeparator ? jsx_runtime_1.jsx("div", { style: rowSeparator }) : null, jsx_runtime_1.jsxs("div", { style: { ...row, height }, children: [rowSelected && timelineWidth !== null ? (jsx_runtime_1.jsx("div", { style: (0, TimelineSelection_1.getTimelineSelectedTrackHighlightStyle)(timelineWidth) })) : null, easingSegments.map((segment) => (jsx_runtime_1.jsx(TimelineKeyframeEasingLine_1.TimelineKeyframeEasingLine, { fromFrame: segment.fromFrame, toFrame: segment.toFrame, rowHeight: height, nodePathInfo: nodePathInfo, segmentIndex: segment.segmentIndex }, `${segment.segmentIndex}-${segment.fromFrame}-${segment.toFrame}`))), keyframes.map((keyframe) => (jsx_runtime_1.jsx(TimelineKeyframeDiamond_1.TimelineKeyframeDiamond, { frame: keyframe.frame, rowHeight: height, nodePathInfo: nodePathInfo }, keyframe.frame)))] })
|
|
53
58
|
] }));
|
|
54
59
|
};
|
|
55
60
|
exports.TimelineExpandedKeyframeRow = react_1.default.memo(TimelineExpandedKeyframeRowUnmemoized);
|
|
@@ -56,28 +56,28 @@ const separator = {
|
|
|
56
56
|
const TimelineExpandedSection = ({ sequence, validatedLocation, nodePathInfo, nestedDepth, keyframeDisplayOffset, }) => {
|
|
57
57
|
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
58
58
|
const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
59
|
-
const {
|
|
59
|
+
const { propStatuses: visualModePropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
|
|
60
60
|
const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
61
61
|
const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
|
|
62
62
|
sequence,
|
|
63
63
|
nodePathInfo,
|
|
64
64
|
getDragOverrides,
|
|
65
65
|
getEffectDragOverrides,
|
|
66
|
-
|
|
66
|
+
propStatuses: visualModePropStatuses,
|
|
67
67
|
}), [
|
|
68
68
|
sequence,
|
|
69
69
|
nodePathInfo,
|
|
70
70
|
getDragOverrides,
|
|
71
71
|
getEffectDragOverrides,
|
|
72
|
-
|
|
72
|
+
visualModePropStatuses,
|
|
73
73
|
]);
|
|
74
74
|
const flat = (0, react_1.useMemo)(() => (0, timeline_layout_1.flattenVisibleTreeNodes)({ nodes: tree, getIsExpanded }), [tree, getIsExpanded]);
|
|
75
75
|
const expandedHeight = (0, react_1.useMemo)(() => (0, timeline_layout_1.getExpandedTrackHeight)({
|
|
76
76
|
sequence,
|
|
77
77
|
nodePathInfo,
|
|
78
78
|
getIsExpanded,
|
|
79
|
-
|
|
80
|
-
}), [sequence, nodePathInfo, getIsExpanded,
|
|
79
|
+
propStatuses: visualModePropStatuses,
|
|
80
|
+
}), [sequence, nodePathInfo, getIsExpanded, visualModePropStatuses]);
|
|
81
81
|
const style = (0, react_1.useMemo)(() => {
|
|
82
82
|
return {
|
|
83
83
|
...expandedSectionBase,
|
|
@@ -11,6 +11,7 @@ const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
|
11
11
|
const call_delete_keyframe_1 = require("./call-delete-keyframe");
|
|
12
12
|
const get_keyframe_navigation_1 = require("./get-keyframe-navigation");
|
|
13
13
|
const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
|
|
14
|
+
const TimelineKeyframeDiamondIcon_1 = require("./TimelineKeyframeDiamondIcon");
|
|
14
15
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
15
16
|
const controlsContainerStyle = {
|
|
16
17
|
alignItems: 'center',
|
|
@@ -41,20 +42,12 @@ const isKeyframedStatus = (status) => {
|
|
|
41
42
|
const diamondButtonStyle = {
|
|
42
43
|
...navButtonStyle,
|
|
43
44
|
background: 'none',
|
|
44
|
-
translate: '0 -0.5px',
|
|
45
|
-
};
|
|
46
|
-
const diamondIconStyle = {
|
|
47
|
-
borderRadius: 1,
|
|
48
|
-
boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
|
|
49
|
-
height: 7,
|
|
50
|
-
transform: 'rotate(45deg)',
|
|
51
|
-
width: 7,
|
|
52
45
|
};
|
|
53
46
|
const svgStyle = { display: 'block' };
|
|
54
47
|
const getCurrentKeyframeValue = ({ propStatus, jsxFrame, defaultValue, dragOverrideValue, }) => {
|
|
55
48
|
if (isKeyframedStatus(propStatus)) {
|
|
56
49
|
return remotion_1.Internals.getEffectiveVisualModeValue({
|
|
57
|
-
|
|
50
|
+
propStatus,
|
|
58
51
|
dragOverrideValue,
|
|
59
52
|
frame: jsxFrame,
|
|
60
53
|
defaultValue,
|
|
@@ -63,7 +56,7 @@ const getCurrentKeyframeValue = ({ propStatus, jsxFrame, defaultValue, dragOverr
|
|
|
63
56
|
}
|
|
64
57
|
if (propStatus.status === 'static') {
|
|
65
58
|
return remotion_1.Internals.getEffectiveVisualModeValue({
|
|
66
|
-
|
|
59
|
+
propStatus,
|
|
67
60
|
dragOverrideValue,
|
|
68
61
|
frame: jsxFrame,
|
|
69
62
|
defaultValue,
|
|
@@ -89,7 +82,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
89
82
|
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
90
83
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
91
84
|
const setFrame = remotion_1.Internals.useTimelineSetFrame();
|
|
92
|
-
const {
|
|
85
|
+
const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
93
86
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
94
87
|
const clientId = previewServerState.type === 'connected'
|
|
95
88
|
? previewServerState.clientId
|
|
@@ -108,8 +101,8 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
108
101
|
defaultValue,
|
|
109
102
|
dragOverrideValue,
|
|
110
103
|
}), [defaultValue, dragOverrideValue, jsxFrame, propStatus]);
|
|
111
|
-
const previousDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getPreviousKeyframeDisplayFrame)(keyframes, timelinePosition), [keyframes, timelinePosition]);
|
|
112
|
-
const nextDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getNextKeyframeDisplayFrame)(keyframes, timelinePosition), [keyframes, timelinePosition]);
|
|
104
|
+
const previousDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getPreviousKeyframeDisplayFrame)(keyframes, timelinePosition, videoConfig.durationInFrames), [keyframes, timelinePosition, videoConfig.durationInFrames]);
|
|
105
|
+
const nextDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getNextKeyframeDisplayFrame)(keyframes, timelinePosition, videoConfig.durationInFrames), [keyframes, timelinePosition, videoConfig.durationInFrames]);
|
|
113
106
|
const keyframable = (0, studio_shared_1.isSchemaFieldKeyframable)({
|
|
114
107
|
schema,
|
|
115
108
|
key: fieldKey,
|
|
@@ -149,7 +142,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
149
142
|
fieldKey,
|
|
150
143
|
sourceFrame: jsxFrame,
|
|
151
144
|
schema,
|
|
152
|
-
|
|
145
|
+
setPropStatuses,
|
|
153
146
|
clientId,
|
|
154
147
|
});
|
|
155
148
|
return;
|
|
@@ -161,7 +154,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
161
154
|
fieldKey,
|
|
162
155
|
sourceFrame: jsxFrame,
|
|
163
156
|
schema,
|
|
164
|
-
|
|
157
|
+
setPropStatuses,
|
|
165
158
|
clientId,
|
|
166
159
|
});
|
|
167
160
|
return;
|
|
@@ -178,7 +171,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
178
171
|
sourceFrame: jsxFrame,
|
|
179
172
|
value,
|
|
180
173
|
schema,
|
|
181
|
-
|
|
174
|
+
setPropStatuses,
|
|
182
175
|
clientId,
|
|
183
176
|
});
|
|
184
177
|
return;
|
|
@@ -191,7 +184,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
191
184
|
sourceFrame: jsxFrame,
|
|
192
185
|
value,
|
|
193
186
|
schema,
|
|
194
|
-
|
|
187
|
+
setPropStatuses,
|
|
195
188
|
clientId,
|
|
196
189
|
});
|
|
197
190
|
}, [
|
|
@@ -206,7 +199,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
206
199
|
nodePath,
|
|
207
200
|
propStatus,
|
|
208
201
|
schema,
|
|
209
|
-
|
|
202
|
+
setPropStatuses,
|
|
210
203
|
]);
|
|
211
204
|
const previousDisabled = previousDisplayFrame === null;
|
|
212
205
|
const nextDisabled = nextDisplayFrame === null;
|
|
@@ -225,12 +218,9 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
225
218
|
cursor: canToggleKeyframe && clientId ? 'pointer' : 'default',
|
|
226
219
|
opacity: canToggleKeyframe && clientId ? 1 : 0.35,
|
|
227
220
|
}), [canToggleKeyframe, clientId]);
|
|
228
|
-
const
|
|
229
|
-
...diamondIconStyle,
|
|
230
|
-
backgroundColor: hasKeyframeAtCurrentFrame ? colors_1.BLUE : colors_1.LIGHT_TEXT,
|
|
231
|
-
}), [hasKeyframeAtCurrentFrame]);
|
|
221
|
+
const diamondColor = hasKeyframeAtCurrentFrame ? colors_1.BLUE : colors_1.LIGHT_TEXT;
|
|
232
222
|
return (jsx_runtime_1.jsxs("div", { style: controlsContainerStyle, children: [
|
|
233
|
-
jsx_runtime_1.jsx("button", { type: "button", style: previousStyle, disabled: previousDisabled, onPointerDown: previousDisabled ? undefined : onPrevious, "aria-label": "Go to previous keyframe", title: "Previous keyframe", children: jsx_runtime_1.jsx("svg", { width: "14", height: "14", viewBox: "0 0 10 10", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M7 1.5L3 5L7 8.5Z", fill: "#ccc" }) }) }), jsx_runtime_1.jsx("button", { type: "button", style: diamondStyle, disabled: !canToggleKeyframe || !clientId, onPointerDown: canToggleKeyframe && clientId ? onToggleKeyframe : undefined, "aria-label": hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe', title: hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe', children: jsx_runtime_1.jsx(
|
|
223
|
+
jsx_runtime_1.jsx("button", { type: "button", style: previousStyle, disabled: previousDisabled, onPointerDown: previousDisabled ? undefined : onPrevious, "aria-label": "Go to previous keyframe", title: "Previous keyframe", children: jsx_runtime_1.jsx("svg", { width: "14", height: "14", viewBox: "0 0 10 10", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M7 1.5L3 5L7 8.5Z", fill: "#ccc" }) }) }), jsx_runtime_1.jsx("button", { type: "button", style: diamondStyle, disabled: !canToggleKeyframe || !clientId, onPointerDown: canToggleKeyframe && clientId ? onToggleKeyframe : undefined, "aria-label": hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe', title: hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe', children: jsx_runtime_1.jsx(TimelineKeyframeDiamondIcon_1.TimelineKeyframeDiamondIcon, { color: diamondColor, size: 12 }) }), jsx_runtime_1.jsx("button", { type: "button", style: nextStyle, disabled: nextDisabled, onPointerDown: nextDisabled ? undefined : onNext, "aria-label": "Go to next keyframe", title: "Next keyframe", children: jsx_runtime_1.jsx("svg", { width: "14", height: "14", viewBox: "0 0 10 10", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M3 1.5L7 5L3 8.5Z", fill: "#ccc" }) }) })
|
|
234
224
|
] }));
|
|
235
225
|
};
|
|
236
226
|
exports.TimelineKeyframeControls = TimelineKeyframeControls;
|
|
@@ -40,49 +40,51 @@ const remotion_1 = require("remotion");
|
|
|
40
40
|
const colors_1 = require("../../helpers/colors");
|
|
41
41
|
const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
|
|
42
42
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
43
|
+
const TimelineKeyframeDiamondIcon_1 = require("./TimelineKeyframeDiamondIcon");
|
|
44
|
+
const TimelineKeyframeDragState_1 = require("./TimelineKeyframeDragState");
|
|
43
45
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
44
46
|
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
47
|
+
const use_timeline_keyframe_drag_1 = require("./use-timeline-keyframe-drag");
|
|
48
|
+
const diamondSize = 12;
|
|
45
49
|
const diamondBase = {
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
background: 'none',
|
|
52
|
+
border: 'none',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
height: diamondSize,
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
padding: 0,
|
|
46
57
|
position: 'absolute',
|
|
47
|
-
width:
|
|
48
|
-
height: 8,
|
|
49
|
-
backgroundColor: colors_1.LIGHT_TEXT,
|
|
50
|
-
borderRadius: 1,
|
|
51
|
-
boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
|
|
58
|
+
width: diamondSize,
|
|
52
59
|
};
|
|
53
60
|
const TimelineKeyframeDiamondUnmemoized = ({ frame, rowHeight, nodePathInfo }) => {
|
|
54
61
|
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
55
62
|
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
56
63
|
const { selected, onSelect, selectable } = (0, TimelineSelection_1.useTimelineKeyframeSelection)(nodePathInfo, frame);
|
|
64
|
+
const { isKeyframeDragging } = (0, TimelineKeyframeDragState_1.useTimelineKeyframeDragState)();
|
|
65
|
+
const visuallySelected = selected || isKeyframeDragging({ nodePathInfo, frame });
|
|
57
66
|
const style = (0, react_1.useMemo)(() => {
|
|
58
67
|
if (timelineWidth === null) {
|
|
59
68
|
return null;
|
|
60
69
|
}
|
|
61
70
|
return {
|
|
62
71
|
...diamondBase,
|
|
63
|
-
backgroundColor: colors_1.LIGHT_TEXT,
|
|
64
|
-
outline: selected ? '2px solid ' + colors_1.BLUE : 'none',
|
|
65
|
-
border: 'none',
|
|
66
|
-
cursor: 'pointer',
|
|
67
72
|
left: (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, timelineWidth) - timeline_layout_1.TIMELINE_PADDING,
|
|
68
|
-
padding: 0,
|
|
69
73
|
pointerEvents: 'auto',
|
|
70
74
|
top: rowHeight / 2,
|
|
71
|
-
transform: 'translate(-50%, -50%)
|
|
75
|
+
transform: 'translate(-50%, -50%)',
|
|
72
76
|
};
|
|
73
|
-
}, [frame, rowHeight,
|
|
74
|
-
const onPointerDown = (0,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}, [onSelect]);
|
|
77
|
+
}, [frame, rowHeight, timelineWidth, videoConfig.durationInFrames]);
|
|
78
|
+
const onPointerDown = (0, use_timeline_keyframe_drag_1.useTimelineKeyframeDrag)({
|
|
79
|
+
frame,
|
|
80
|
+
nodePathInfo,
|
|
81
|
+
onSelect,
|
|
82
|
+
selectable,
|
|
83
|
+
selected,
|
|
84
|
+
});
|
|
83
85
|
if (style === null) {
|
|
84
86
|
return null;
|
|
85
87
|
}
|
|
86
|
-
return (jsx_runtime_1.jsx("button", { type: "button", style: style, title: `Keyframe at frame ${frame}`, "aria-label": `Select keyframe at frame ${frame}`, onPointerDown: selectable ? onPointerDown : undefined }));
|
|
88
|
+
return (jsx_runtime_1.jsx("button", { type: "button", style: style, title: `Keyframe at frame ${frame}`, "aria-label": `Select keyframe at frame ${frame}`, onPointerDown: selectable ? onPointerDown : undefined, children: jsx_runtime_1.jsx(TimelineKeyframeDiamondIcon_1.TimelineKeyframeDiamondIcon, { color: colors_1.LIGHT_TEXT, selected: visuallySelected, size: diamondSize }) }));
|
|
87
89
|
};
|
|
88
90
|
exports.TimelineKeyframeDiamond = react_1.default.memo(TimelineKeyframeDiamondUnmemoized);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineKeyframeDiamondIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../../helpers/colors");
|
|
6
|
+
const svgStyle = {
|
|
7
|
+
display: 'block',
|
|
8
|
+
overflow: 'visible',
|
|
9
|
+
};
|
|
10
|
+
const TimelineKeyframeDiamondIcon = ({ color, selected = false, size }) => {
|
|
11
|
+
return (jsx_runtime_1.jsxs("svg", { width: size, height: size, viewBox: "0 0 12 12", style: svgStyle, "aria-hidden": "true", focusable: "false", children: [selected ? (jsx_runtime_1.jsx("polygon", { points: "6 0.75 11.25 6 6 11.25 0.75 6", fill: "none", stroke: colors_1.BLUE, strokeWidth: "1.5", strokeLinejoin: "round" })) : null, jsx_runtime_1.jsx("polygon", { points: "6 1.5 10.5 6 6 10.5 1.5 6", fill: color, stroke: "rgba(0, 0, 0, 0.4)", strokeWidth: "1", strokeLinejoin: "round" })
|
|
12
|
+
] }));
|
|
13
|
+
};
|
|
14
|
+
exports.TimelineKeyframeDiamondIcon = TimelineKeyframeDiamondIcon;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
3
|
+
export type TimelineDraggedKeyframe = {
|
|
4
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
5
|
+
readonly frame: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const getTimelineKeyframeDragKey: ({ nodePathInfo, frame, }: TimelineDraggedKeyframe) => string;
|
|
8
|
+
type TimelineKeyframeDragStateContextValue = {
|
|
9
|
+
readonly clearDraggedKeyframes: () => void;
|
|
10
|
+
readonly isKeyframeDragging: (keyframe: TimelineDraggedKeyframe) => boolean;
|
|
11
|
+
readonly setDraggedKeyframes: (keyframes: readonly TimelineDraggedKeyframe[]) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const TimelineKeyframeDragStateProvider: React.FC<{
|
|
14
|
+
readonly children: React.ReactNode;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const useTimelineKeyframeDragState: () => TimelineKeyframeDragStateContextValue;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTimelineKeyframeDragState = exports.TimelineKeyframeDragStateProvider = exports.getTimelineKeyframeDragKey = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const timeline_node_path_key_1 = require("../../helpers/timeline-node-path-key");
|
|
7
|
+
const emptyDraggedKeyframes = new Set();
|
|
8
|
+
const getTimelineKeyframeDragKey = ({ nodePathInfo, frame, }) => {
|
|
9
|
+
return `${(0, timeline_node_path_key_1.timelineNodePathInfoToKey)(nodePathInfo)}.keyframe.${frame}`;
|
|
10
|
+
};
|
|
11
|
+
exports.getTimelineKeyframeDragKey = getTimelineKeyframeDragKey;
|
|
12
|
+
const TimelineKeyframeDragStateContext = (0, react_1.createContext)({
|
|
13
|
+
clearDraggedKeyframes: () => undefined,
|
|
14
|
+
isKeyframeDragging: () => false,
|
|
15
|
+
setDraggedKeyframes: () => undefined,
|
|
16
|
+
});
|
|
17
|
+
const TimelineKeyframeDragStateProvider = ({ children }) => {
|
|
18
|
+
const [draggedKeys, setDraggedKeys] = (0, react_1.useState)(emptyDraggedKeyframes);
|
|
19
|
+
const setDraggedKeyframes = (0, react_1.useCallback)((keyframes) => {
|
|
20
|
+
setDraggedKeys(new Set(keyframes.map(exports.getTimelineKeyframeDragKey)));
|
|
21
|
+
}, []);
|
|
22
|
+
const clearDraggedKeyframes = (0, react_1.useCallback)(() => {
|
|
23
|
+
setDraggedKeys(emptyDraggedKeyframes);
|
|
24
|
+
}, []);
|
|
25
|
+
const isKeyframeDragging = (0, react_1.useCallback)((keyframe) => {
|
|
26
|
+
return draggedKeys.has((0, exports.getTimelineKeyframeDragKey)(keyframe));
|
|
27
|
+
}, [draggedKeys]);
|
|
28
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
29
|
+
clearDraggedKeyframes,
|
|
30
|
+
isKeyframeDragging,
|
|
31
|
+
setDraggedKeyframes,
|
|
32
|
+
}), [clearDraggedKeyframes, isKeyframeDragging, setDraggedKeyframes]);
|
|
33
|
+
return (jsx_runtime_1.jsx(TimelineKeyframeDragStateContext.Provider, { value: value, children: children }));
|
|
34
|
+
};
|
|
35
|
+
exports.TimelineKeyframeDragStateProvider = TimelineKeyframeDragStateProvider;
|
|
36
|
+
const useTimelineKeyframeDragState = () => {
|
|
37
|
+
return (0, react_1.useContext)(TimelineKeyframeDragStateContext);
|
|
38
|
+
};
|
|
39
|
+
exports.useTimelineKeyframeDragState = useTimelineKeyframeDragState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
3
|
+
export declare const TimelineKeyframeEasingLine: React.NamedExoticComponent<{
|
|
4
|
+
readonly fromFrame: number;
|
|
5
|
+
readonly toFrame: number;
|
|
6
|
+
readonly rowHeight: number;
|
|
7
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
8
|
+
readonly segmentIndex: number;
|
|
9
|
+
}>;
|