@remotion/studio 4.0.482 → 4.0.483
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/components/Canvas.js +19 -0
- package/dist/components/InspectorPanel/styles.js +2 -0
- package/dist/components/InspectorSequenceSection.js +45 -2
- package/dist/components/SelectedOutlineUvControls.js +461 -2
- package/dist/components/Timeline/EasingEditorModal.js +39 -1
- package/dist/components/Timeline/Timeline.js +2 -1
- package/dist/components/Timeline/TimelineEffectItem.js +8 -5
- package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +2 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +1 -0
- package/dist/components/Timeline/TimelineRowChrome.js +6 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +7 -1
- package/dist/components/Timeline/TimelineSelection.js +19 -3
- package/dist/components/Timeline/TimelineSequence.js +20 -8
- package/dist/components/Timeline/TimelineSequenceItem.js +16 -13
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +40 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +308 -1
- package/dist/components/Timeline/TimelineTrack.js +2 -4
- package/dist/components/Timeline/should-subscribe-to-sequence-props.d.ts +4 -0
- package/dist/components/Timeline/should-subscribe-to-sequence-props.js +10 -0
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +2 -1
- package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +19 -13
- package/dist/components/element-drag-and-drop.d.ts +3 -0
- package/dist/components/element-drag-and-drop.js +30 -0
- package/dist/components/import-assets.d.ts +11 -0
- package/dist/components/import-assets.js +23 -1
- package/dist/components/selected-outline-uv.d.ts +71 -1
- package/dist/components/selected-outline-uv.js +332 -10
- package/dist/esm/{chunk-nkqfa5bw.js → chunk-fq0j774v.js} +2191 -817
- package/dist/esm/internals.mjs +2191 -817
- package/dist/esm/previewEntry.mjs +2201 -827
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/timeline-layout.d.ts +3 -3
- package/dist/helpers/timeline-layout.js +3 -1
- package/package.json +11 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimelineSequenceRightEdgeDragHandle = exports.useTimelineSequenceFromDrag = exports.getTimelineSequenceFromDragTargets = exports.getTimelineSequenceDurationDragTargets = exports.getTimelineSequenceFromDragChanges = exports.getTimelineSequenceFromDragValue = exports.getTimelineSequenceDurationDragChanges = exports.getTimelineSequenceDurationDragValue = void 0;
|
|
3
|
+
exports.TimelineSequenceRightEdgeDragHandle = exports.useTimelineSequenceFromDrag = exports.TimelineSequenceLeftEdgeDragHandle = exports.getTimelineSequenceFromDragTargets = exports.getTimelineSequenceLeftEdgeDragTargets = exports.getTimelineSequenceDurationDragTargets = exports.getTimelineSequenceFromDragChanges = exports.getTimelineSequenceFromDragValue = exports.getTimelineSequenceDurationDragChanges = exports.getTimelineSequenceLeftEdgeDragChanges = exports.getTimelineSequenceLeftEdgeDragValues = exports.getTimelineSequenceLeftEdgeDragDelta = exports.getTimelineSequenceDurationDragValue = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -32,12 +32,25 @@ const canUpdateFrom = ({ propStatuses, nodePath, }) => {
|
|
|
32
32
|
const status = (_b = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.from) === null || _b === void 0 ? void 0 : _b.status;
|
|
33
33
|
return status === 'static';
|
|
34
34
|
};
|
|
35
|
+
const canUpdateTrimBefore = ({ propStatuses, nodePath, }) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const status = (_b = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a.trimBefore) === null || _b === void 0 ? void 0 : _b.status;
|
|
38
|
+
return status === 'static';
|
|
39
|
+
};
|
|
35
40
|
const isDurationDraggableSequence = (sequence) => {
|
|
36
41
|
return ((sequence.type === 'sequence' || sequence.type === 'image') &&
|
|
37
42
|
!sequence.loopDisplay &&
|
|
38
43
|
!sequence.isInsideSeries &&
|
|
39
44
|
Boolean(sequence.controls));
|
|
40
45
|
};
|
|
46
|
+
const isLeftEdgeDraggableSequence = (sequence) => {
|
|
47
|
+
return (!sequence.isInsideSeries &&
|
|
48
|
+
Boolean(sequence.controls) &&
|
|
49
|
+
(sequence.type === 'sequence' ||
|
|
50
|
+
sequence.type === 'image' ||
|
|
51
|
+
sequence.type === 'audio' ||
|
|
52
|
+
sequence.type === 'video'));
|
|
53
|
+
};
|
|
41
54
|
const isFromDraggableSequence = (sequence) => {
|
|
42
55
|
return (!sequence.loopDisplay &&
|
|
43
56
|
!sequence.isInsideSeries &&
|
|
@@ -45,6 +58,68 @@ const isFromDraggableSequence = (sequence) => {
|
|
|
45
58
|
};
|
|
46
59
|
const getTimelineSequenceDurationDragValue = ({ initialDuration, deltaFrames, }) => Math.max(1, initialDuration + deltaFrames);
|
|
47
60
|
exports.getTimelineSequenceDurationDragValue = getTimelineSequenceDurationDragValue;
|
|
61
|
+
const getTimelineSequenceLeftEdgeDragDelta = ({ initialDuration, initialTrimBefore, deltaFrames, }) => {
|
|
62
|
+
const minDeltaFrames = 0 - initialTrimBefore;
|
|
63
|
+
const maxDeltaFrames = initialDuration - 1;
|
|
64
|
+
return Math.max(minDeltaFrames, Math.min(deltaFrames, maxDeltaFrames));
|
|
65
|
+
};
|
|
66
|
+
exports.getTimelineSequenceLeftEdgeDragDelta = getTimelineSequenceLeftEdgeDragDelta;
|
|
67
|
+
const getTimelineSequenceLeftEdgeDragValues = ({ initialDuration, initialFrom, initialTrimBefore, deltaFrames, }) => {
|
|
68
|
+
const clampedDeltaFrames = (0, exports.getTimelineSequenceLeftEdgeDragDelta)({
|
|
69
|
+
initialDuration,
|
|
70
|
+
initialTrimBefore,
|
|
71
|
+
deltaFrames,
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
durationInFrames: initialDuration - clampedDeltaFrames,
|
|
75
|
+
from: initialFrom + clampedDeltaFrames,
|
|
76
|
+
trimBefore: initialTrimBefore + clampedDeltaFrames,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.getTimelineSequenceLeftEdgeDragValues = getTimelineSequenceLeftEdgeDragValues;
|
|
80
|
+
const getTimelineSequenceLeftEdgeDragChanges = ({ targets, deltaFrames, }) => {
|
|
81
|
+
return targets.flatMap((target) => {
|
|
82
|
+
const nextValues = (0, exports.getTimelineSequenceLeftEdgeDragValues)({
|
|
83
|
+
initialDuration: target.initialDuration,
|
|
84
|
+
initialFrom: target.initialFrom,
|
|
85
|
+
initialTrimBefore: target.initialTrimBefore,
|
|
86
|
+
deltaFrames,
|
|
87
|
+
});
|
|
88
|
+
const changes = [];
|
|
89
|
+
if (nextValues.from !== target.initialFrom) {
|
|
90
|
+
changes.push({
|
|
91
|
+
fileName: target.fileName,
|
|
92
|
+
nodePath: target.nodePath,
|
|
93
|
+
fieldKey: 'from',
|
|
94
|
+
value: nextValues.from,
|
|
95
|
+
defaultValue: '0',
|
|
96
|
+
schema: target.schema,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (nextValues.durationInFrames !== target.initialDuration) {
|
|
100
|
+
changes.push({
|
|
101
|
+
fileName: target.fileName,
|
|
102
|
+
nodePath: target.nodePath,
|
|
103
|
+
fieldKey: 'durationInFrames',
|
|
104
|
+
value: nextValues.durationInFrames,
|
|
105
|
+
defaultValue: null,
|
|
106
|
+
schema: target.schema,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (nextValues.trimBefore !== target.initialTrimBefore) {
|
|
110
|
+
changes.push({
|
|
111
|
+
fileName: target.fileName,
|
|
112
|
+
nodePath: target.nodePath,
|
|
113
|
+
fieldKey: 'trimBefore',
|
|
114
|
+
value: nextValues.trimBefore,
|
|
115
|
+
defaultValue: '0',
|
|
116
|
+
schema: target.schema,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return changes;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
exports.getTimelineSequenceLeftEdgeDragChanges = getTimelineSequenceLeftEdgeDragChanges;
|
|
48
123
|
const getTimelineSequenceDurationDragChanges = ({ targets, deltaFrames, }) => {
|
|
49
124
|
return targets.flatMap((target) => {
|
|
50
125
|
const nextValue = (0, exports.getTimelineSequenceDurationDragValue)({
|
|
@@ -141,6 +216,60 @@ const getTimelineSequenceDurationDragTargets = ({ draggedNodePathInfo, selectedI
|
|
|
141
216
|
return [...targets.values()];
|
|
142
217
|
};
|
|
143
218
|
exports.getTimelineSequenceDurationDragTargets = getTimelineSequenceDurationDragTargets;
|
|
219
|
+
const getTimelineSequenceLeftEdgeDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }) => {
|
|
220
|
+
var _a, _b;
|
|
221
|
+
const draggedSelectionKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(draggedNodePathInfo);
|
|
222
|
+
const selectedSequenceItems = selectedItems.filter((item) => item.type === 'sequence');
|
|
223
|
+
const draggedItemIsSelected = selectedSequenceItems.some((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo) ===
|
|
224
|
+
draggedSelectionKey);
|
|
225
|
+
if (draggedItemIsSelected &&
|
|
226
|
+
selectedSequenceItems.length !== selectedItems.length) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
const targetNodePathInfos = draggedItemIsSelected && selectedSequenceItems.length > 1
|
|
230
|
+
? selectedSequenceItems.map((item) => item.nodePathInfo)
|
|
231
|
+
: [draggedNodePathInfo];
|
|
232
|
+
const tracks = (0, calculate_timeline_1.calculateTimeline)({ sequences, overrideIdsToNodePaths });
|
|
233
|
+
const targets = new Map();
|
|
234
|
+
for (const nodePathInfo of targetNodePathInfos) {
|
|
235
|
+
const track = findSequenceTrack({ tracks, nodePathInfo });
|
|
236
|
+
const originalSequence = track
|
|
237
|
+
? sequences.find((sequence) => sequence.id === track.sequence.id)
|
|
238
|
+
: null;
|
|
239
|
+
if (!track ||
|
|
240
|
+
!track.nodePathInfo ||
|
|
241
|
+
!originalSequence ||
|
|
242
|
+
!isLeftEdgeDraggableSequence(originalSequence)) {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
const nodePath = track.nodePathInfo.sequenceSubscriptionKey;
|
|
246
|
+
const trimsMedia = originalSequence.type === 'audio' || originalSequence.type === 'video';
|
|
247
|
+
if (!canUpdateFrom({ propStatuses, nodePath }) ||
|
|
248
|
+
!canUpdateDurationInFrames({ propStatuses, nodePath }) ||
|
|
249
|
+
!canUpdateTrimBefore({ propStatuses, nodePath })) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
const { controls } = originalSequence;
|
|
253
|
+
if (!controls) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
const key = (0, studio_shared_1.stringifySequenceSubscriptionKey)(nodePath);
|
|
257
|
+
if (!targets.has(key)) {
|
|
258
|
+
targets.set(key, {
|
|
259
|
+
fileName: nodePath.absolutePath,
|
|
260
|
+
initialDuration: originalSequence.duration,
|
|
261
|
+
initialFrom: originalSequence.from,
|
|
262
|
+
initialTrimBefore: trimsMedia
|
|
263
|
+
? ((_a = originalSequence.trimBefore) !== null && _a !== void 0 ? _a : Math.max(0, originalSequence.startMediaFrom))
|
|
264
|
+
: ((_b = originalSequence.trimBefore) !== null && _b !== void 0 ? _b : 0),
|
|
265
|
+
nodePath,
|
|
266
|
+
schema: controls.schema,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return [...targets.values()];
|
|
271
|
+
};
|
|
272
|
+
exports.getTimelineSequenceLeftEdgeDragTargets = getTimelineSequenceLeftEdgeDragTargets;
|
|
144
273
|
const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, propStatuses, }) => {
|
|
145
274
|
const draggedSelectionKey = (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(draggedNodePathInfo);
|
|
146
275
|
const selectedSequenceItems = selectedItems.filter((item) => item.type === 'sequence');
|
|
@@ -182,6 +311,11 @@ const getTimelineSequenceFromDragTargets = ({ draggedNodePathInfo, selectedItems
|
|
|
182
311
|
return [...targets.values()];
|
|
183
312
|
};
|
|
184
313
|
exports.getTimelineSequenceFromDragTargets = getTimelineSequenceFromDragTargets;
|
|
314
|
+
const clearLeftEdgeDragOverrides = ({ clearDragOverrides, targets, }) => {
|
|
315
|
+
for (const target of targets) {
|
|
316
|
+
clearDragOverrides(target.nodePath);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
185
319
|
const clearDurationDragOverrides = ({ clearDragOverrides, targets, }) => {
|
|
186
320
|
for (const target of targets) {
|
|
187
321
|
clearDragOverrides(target.nodePath);
|
|
@@ -192,6 +326,179 @@ const clearFromDragOverrides = ({ clearDragOverrides, targets, }) => {
|
|
|
192
326
|
clearDragOverrides(target.nodePath);
|
|
193
327
|
}
|
|
194
328
|
};
|
|
329
|
+
const TimelineSequenceLeftEdgeDragHandle = ({ nodePathInfo, windowWidth, timelineDurationInFrames }) => {
|
|
330
|
+
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
331
|
+
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
332
|
+
const sequencesRef = (0, react_1.useContext)(remotion_1.Internals.SequenceManagerRefContext);
|
|
333
|
+
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
|
|
334
|
+
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
335
|
+
const currentSelection = (0, TimelineSelection_1.useCurrentTimelineSelectionStateAsRef)();
|
|
336
|
+
const [dragging, setDragging] = (0, react_1.useState)(false);
|
|
337
|
+
const dragStateRef = (0, react_1.useRef)(null);
|
|
338
|
+
const latestRef = (0, react_1.useRef)({
|
|
339
|
+
nodePathInfo,
|
|
340
|
+
setPropStatuses,
|
|
341
|
+
setDragOverrides,
|
|
342
|
+
clearDragOverrides,
|
|
343
|
+
previewServerState,
|
|
344
|
+
overrideIdToNodePathMappings,
|
|
345
|
+
});
|
|
346
|
+
latestRef.current = {
|
|
347
|
+
nodePathInfo,
|
|
348
|
+
setPropStatuses,
|
|
349
|
+
setDragOverrides,
|
|
350
|
+
clearDragOverrides,
|
|
351
|
+
previewServerState,
|
|
352
|
+
overrideIdToNodePathMappings,
|
|
353
|
+
};
|
|
354
|
+
const finishDrag = (0, react_1.useCallback)((commit) => {
|
|
355
|
+
const dragState = dragStateRef.current;
|
|
356
|
+
dragStateRef.current = null;
|
|
357
|
+
document.body.style.userSelect = '';
|
|
358
|
+
document.body.style.webkitUserSelect = '';
|
|
359
|
+
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
360
|
+
setDragging(false);
|
|
361
|
+
if (!dragState) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const { setPropStatuses: latestSetPropStatuses, clearDragOverrides: latestClear, previewServerState: latestServerState, } = latestRef.current;
|
|
365
|
+
const changes = (0, exports.getTimelineSequenceLeftEdgeDragChanges)({
|
|
366
|
+
targets: dragState.targets,
|
|
367
|
+
deltaFrames: dragState.latestDeltaFrames,
|
|
368
|
+
});
|
|
369
|
+
if (!commit ||
|
|
370
|
+
latestServerState.type !== 'connected' ||
|
|
371
|
+
changes.length === 0) {
|
|
372
|
+
clearLeftEdgeDragOverrides({
|
|
373
|
+
clearDragOverrides: latestClear,
|
|
374
|
+
targets: dragState.targets,
|
|
375
|
+
});
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const savePromise = (0, save_sequence_prop_1.saveSequenceProps)({
|
|
379
|
+
changes,
|
|
380
|
+
setPropStatuses: latestSetPropStatuses,
|
|
381
|
+
clientId: latestServerState.clientId,
|
|
382
|
+
undoLabel: dragState.targets.length > 1
|
|
383
|
+
? 'Resize selected sequences'
|
|
384
|
+
: 'Resize sequence',
|
|
385
|
+
redoLabel: dragState.targets.length > 1
|
|
386
|
+
? 'Resize selected sequences back'
|
|
387
|
+
: 'Resize sequence back',
|
|
388
|
+
});
|
|
389
|
+
savePromise
|
|
390
|
+
.catch((err) => {
|
|
391
|
+
remotion_1.Internals.Log.error({ logLevel: 'error', tag: null }, 'Could not save left edge drag', err);
|
|
392
|
+
})
|
|
393
|
+
.finally(() => {
|
|
394
|
+
clearLeftEdgeDragOverrides({
|
|
395
|
+
clearDragOverrides: latestClear,
|
|
396
|
+
targets: dragState.targets,
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
}, []);
|
|
400
|
+
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
401
|
+
if (e.button !== 0) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const pxPerFrame = timelineDurationInFrames > 0
|
|
405
|
+
? (windowWidth - timeline_layout_1.TIMELINE_PADDING * 2) / timelineDurationInFrames
|
|
406
|
+
: 0;
|
|
407
|
+
if (pxPerFrame <= 0) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const { nodePathInfo: latestNodePathInfo, overrideIdToNodePathMappings: latestOverrideIdsToNodePaths, } = latestRef.current;
|
|
411
|
+
const { selectedItems: latestSelectedItems } = currentSelection.current;
|
|
412
|
+
const targets = (0, exports.getTimelineSequenceLeftEdgeDragTargets)({
|
|
413
|
+
draggedNodePathInfo: latestNodePathInfo,
|
|
414
|
+
selectedItems: latestSelectedItems,
|
|
415
|
+
sequences: sequencesRef.current,
|
|
416
|
+
overrideIdsToNodePaths: latestOverrideIdsToNodePaths,
|
|
417
|
+
propStatuses: propStatusesRef.current,
|
|
418
|
+
});
|
|
419
|
+
if (targets === null || targets.length === 0) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
e.stopPropagation();
|
|
423
|
+
e.preventDefault();
|
|
424
|
+
dragStateRef.current = {
|
|
425
|
+
initialClientX: e.clientX,
|
|
426
|
+
latestDeltaFrames: 0,
|
|
427
|
+
pxPerFrame,
|
|
428
|
+
pointerId: e.pointerId,
|
|
429
|
+
targets,
|
|
430
|
+
};
|
|
431
|
+
document.body.style.userSelect = 'none';
|
|
432
|
+
document.body.style.webkitUserSelect = 'none';
|
|
433
|
+
(0, ForceSpecificCursor_1.forceSpecificCursor)('ew-resize');
|
|
434
|
+
setDragging(true);
|
|
435
|
+
}, [
|
|
436
|
+
currentSelection,
|
|
437
|
+
propStatusesRef,
|
|
438
|
+
sequencesRef,
|
|
439
|
+
timelineDurationInFrames,
|
|
440
|
+
windowWidth,
|
|
441
|
+
]);
|
|
442
|
+
(0, react_1.useEffect)(() => {
|
|
443
|
+
if (!dragging) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const onMove = (e) => {
|
|
447
|
+
const dragState = dragStateRef.current;
|
|
448
|
+
if (!dragState || e.pointerId !== dragState.pointerId) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const dx = e.clientX - dragState.initialClientX;
|
|
452
|
+
const deltaFrames = Math.round(dx / dragState.pxPerFrame);
|
|
453
|
+
dragState.latestDeltaFrames = deltaFrames;
|
|
454
|
+
for (const target of dragState.targets) {
|
|
455
|
+
const nextValues = (0, exports.getTimelineSequenceLeftEdgeDragValues)({
|
|
456
|
+
initialDuration: target.initialDuration,
|
|
457
|
+
initialFrom: target.initialFrom,
|
|
458
|
+
initialTrimBefore: target.initialTrimBefore,
|
|
459
|
+
deltaFrames,
|
|
460
|
+
});
|
|
461
|
+
latestRef.current.setDragOverrides(target.nodePath, 'from', remotion_1.Internals.makeStaticDragOverride(nextValues.from));
|
|
462
|
+
latestRef.current.setDragOverrides(target.nodePath, 'durationInFrames', remotion_1.Internals.makeStaticDragOverride(nextValues.durationInFrames));
|
|
463
|
+
latestRef.current.setDragOverrides(target.nodePath, 'trimBefore', remotion_1.Internals.makeStaticDragOverride(nextValues.trimBefore));
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
const onUp = (e) => {
|
|
467
|
+
const dragState = dragStateRef.current;
|
|
468
|
+
if (!dragState || e.pointerId !== dragState.pointerId) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
finishDrag(true);
|
|
472
|
+
};
|
|
473
|
+
const onCancel = (e) => {
|
|
474
|
+
const dragState = dragStateRef.current;
|
|
475
|
+
if (!dragState || e.pointerId !== dragState.pointerId) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
finishDrag(false);
|
|
479
|
+
};
|
|
480
|
+
const onWindowBlur = () => {
|
|
481
|
+
finishDrag(false);
|
|
482
|
+
};
|
|
483
|
+
window.addEventListener('pointermove', onMove);
|
|
484
|
+
window.addEventListener('pointerup', onUp);
|
|
485
|
+
window.addEventListener('pointercancel', onCancel);
|
|
486
|
+
window.addEventListener('blur', onWindowBlur);
|
|
487
|
+
return () => {
|
|
488
|
+
window.removeEventListener('pointermove', onMove);
|
|
489
|
+
window.removeEventListener('pointerup', onUp);
|
|
490
|
+
window.removeEventListener('pointercancel', onCancel);
|
|
491
|
+
window.removeEventListener('blur', onWindowBlur);
|
|
492
|
+
};
|
|
493
|
+
}, [dragging, finishDrag]);
|
|
494
|
+
const style = {
|
|
495
|
+
...baseStyle,
|
|
496
|
+
left: 0,
|
|
497
|
+
background: 'transparent',
|
|
498
|
+
};
|
|
499
|
+
return (jsx_runtime_1.jsx("div", { role: "separator", "aria-orientation": "vertical", title: "Drag to trim start", style: style, onPointerDown: onPointerDown }));
|
|
500
|
+
};
|
|
501
|
+
exports.TimelineSequenceLeftEdgeDragHandle = TimelineSequenceLeftEdgeDragHandle;
|
|
195
502
|
const useTimelineSequenceFromDrag = ({ nodePathInfo, windowWidth, timelineDurationInFrames, }) => {
|
|
196
503
|
const { setPropStatuses, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
197
504
|
const propStatusesRef = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesRefContext);
|
|
@@ -48,8 +48,7 @@ const TimelineTrackUnmemoized = ({ track }) => {
|
|
|
48
48
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
49
49
|
const previewServerConnected = previewServerState.type === 'connected';
|
|
50
50
|
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
51
|
-
const
|
|
52
|
-
const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(track.nodePathInfo);
|
|
51
|
+
const rowHighlightBackground = (0, TimelineSelection_1.useTimelineRowHighlightBackground)(track.nodePathInfo);
|
|
53
52
|
const layerStyle = (0, react_1.useMemo)(() => ({
|
|
54
53
|
height: (0, timeline_layout_1.getTimelineLayerHeight)(track.sequence.type),
|
|
55
54
|
marginBottom: timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM,
|
|
@@ -58,9 +57,8 @@ const TimelineTrackUnmemoized = ({ track }) => {
|
|
|
58
57
|
const showExpandedKeyframes = track.nodePathInfo !== null &&
|
|
59
58
|
previewServerConnected &&
|
|
60
59
|
getIsExpanded(track.nodePathInfo);
|
|
61
|
-
const showRowHighlight = track.nodePathInfo !== null && (rowSelected || containsSelection);
|
|
62
60
|
return (jsx_runtime_1.jsxs("div", { children: [
|
|
63
|
-
jsx_runtime_1.jsxs("div", { style: layerStyle, children: [
|
|
61
|
+
jsx_runtime_1.jsxs("div", { style: layerStyle, children: [rowHighlightBackground && timelineWidth !== null ? (jsx_runtime_1.jsx("div", { style: (0, TimelineSelection_1.getTimelineSelectedTrackHighlightStyle)(timelineWidth, rowHighlightBackground) })) : null, jsx_runtime_1.jsx(TimelineSequence_1.TimelineSequence, { s: track.sequence, nodePathInfo: track.nodePathInfo, sequenceFrameOffset: track.sequenceFrameOffset })
|
|
64
62
|
] }), showExpandedKeyframes && track.nodePathInfo ? (jsx_runtime_1.jsx(TimelineExpandedTrackKeyframes_1.TimelineExpandedTrackKeyframes, { sequence: track.sequence, nodePathInfo: track.nodePathInfo, keyframeDisplayOffset: track.keyframeDisplayOffset })) : null] }));
|
|
65
63
|
};
|
|
66
64
|
exports.TimelineTrack = react_1.default.memo(TimelineTrackUnmemoized);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldSubscribeToSequenceProps = void 0;
|
|
4
|
+
const shouldSubscribeToSequenceProps = (sequence, previewConnected) => {
|
|
5
|
+
return (sequence.showInTimeline &&
|
|
6
|
+
Boolean(sequence.controls) &&
|
|
7
|
+
previewConnected &&
|
|
8
|
+
Boolean(sequence.getStack()));
|
|
9
|
+
};
|
|
10
|
+
exports.shouldSubscribeToSequenceProps = shouldSubscribeToSequenceProps;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatus, SequencePropsSubscriptionKey, TSequence } from 'remotion';
|
|
2
2
|
import type { ComboboxValue } from '../NewComposition/ComboBox';
|
|
3
3
|
import { type SetPropStatuses } from './save-sequence-prop';
|
|
4
|
+
export declare const shouldShowFreezeFrameMenuItem: (sequence: TSequence) => boolean;
|
|
4
5
|
export declare const useSequenceFreezeFrameMenuItem: ({ clientId, nodePath, propStatusesForOverride, sequence, sequenceFrameOffset, setPropStatuses, timelinePosition, validatedSource, }: {
|
|
5
6
|
readonly clientId: string | null;
|
|
6
7
|
readonly nodePath: SequencePropsSubscriptionKey | null;
|
|
@@ -10,4 +11,4 @@ export declare const useSequenceFreezeFrameMenuItem: ({ clientId, nodePath, prop
|
|
|
10
11
|
readonly setPropStatuses: SetPropStatuses;
|
|
11
12
|
readonly timelinePosition: number;
|
|
12
13
|
readonly validatedSource: string | null;
|
|
13
|
-
}) => ComboboxValue;
|
|
14
|
+
}) => ComboboxValue | null;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSequenceFreezeFrameMenuItem = void 0;
|
|
3
|
+
exports.useSequenceFreezeFrameMenuItem = exports.shouldShowFreezeFrameMenuItem = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
6
|
+
const shouldShowFreezeFrameMenuItem = (sequence) => {
|
|
7
|
+
return sequence.type !== 'audio';
|
|
8
|
+
};
|
|
9
|
+
exports.shouldShowFreezeFrameMenuItem = shouldShowFreezeFrameMenuItem;
|
|
6
10
|
const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOverride, sequence, sequenceFrameOffset, setPropStatuses, timelinePosition, validatedSource, }) => {
|
|
7
11
|
const freezeStatus = propStatusesForOverride === null || propStatusesForOverride === void 0 ? void 0 : propStatusesForOverride.freeze;
|
|
8
12
|
const isFrozen = (freezeStatus === null || freezeStatus === void 0 ? void 0 : freezeStatus.status) === 'static' &&
|
|
@@ -57,17 +61,19 @@ const useSequenceFreezeFrameMenuItem = ({ clientId, nodePath, propStatusesForOve
|
|
|
57
61
|
timelinePosition,
|
|
58
62
|
validatedSource,
|
|
59
63
|
]);
|
|
60
|
-
return (0, react_1.useMemo)(() => (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
return (0, react_1.useMemo)(() => (0, exports.shouldShowFreezeFrameMenuItem)(sequence)
|
|
65
|
+
? {
|
|
66
|
+
type: 'item',
|
|
67
|
+
id: 'toggle-freeze-frame',
|
|
68
|
+
keyHint: null,
|
|
69
|
+
label: isFrozen ? 'Unfreeze frame' : 'Freeze frame',
|
|
70
|
+
leftItem: null,
|
|
71
|
+
disabled: !canToggleFreeze,
|
|
72
|
+
onClick: onToggleFreezeFrame,
|
|
73
|
+
quickSwitcherLabel: null,
|
|
74
|
+
subMenu: null,
|
|
75
|
+
value: 'toggle-freeze-frame',
|
|
76
|
+
}
|
|
77
|
+
: null, [canToggleFreeze, isFrozen, onToggleFreezeFrame, sequence]);
|
|
72
78
|
};
|
|
73
79
|
exports.useSequenceFreezeFrameMenuItem = useSequenceFreezeFrameMenuItem;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getElementDragData = exports.hasElementDragType = void 0;
|
|
4
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
|
+
const hasElementDragType = (dataTransfer) => {
|
|
6
|
+
var _a;
|
|
7
|
+
return Array.from((_a = dataTransfer === null || dataTransfer === void 0 ? void 0 : dataTransfer.types) !== null && _a !== void 0 ? _a : []).includes(studio_shared_1.ELEMENT_DRAG_MIME_TYPE);
|
|
8
|
+
};
|
|
9
|
+
exports.hasElementDragType = hasElementDragType;
|
|
10
|
+
const getElementDragData = (dataTransfer) => {
|
|
11
|
+
if (!dataTransfer) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
for (const type of [
|
|
15
|
+
studio_shared_1.ELEMENT_DRAG_MIME_TYPE,
|
|
16
|
+
'application/json',
|
|
17
|
+
'text/plain',
|
|
18
|
+
]) {
|
|
19
|
+
const raw = dataTransfer.getData(type);
|
|
20
|
+
if (!raw) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const parsed = (0, studio_shared_1.parseElementDragData)(raw);
|
|
24
|
+
if (parsed) {
|
|
25
|
+
return parsed;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
exports.getElementDragData = getElementDragData;
|
|
@@ -72,3 +72,14 @@ export declare const insertComponent: ({ component, compositionFile, composition
|
|
|
72
72
|
compositionId: string;
|
|
73
73
|
dropPosition: InsertElementDropPosition | null;
|
|
74
74
|
}) => Promise<void>;
|
|
75
|
+
export declare const insertElement: ({ compositionFile, compositionId, dropPosition, element, }: {
|
|
76
|
+
compositionFile: string;
|
|
77
|
+
compositionId: string;
|
|
78
|
+
dropPosition: InsertElementDropPosition | null;
|
|
79
|
+
element: {
|
|
80
|
+
slug: string;
|
|
81
|
+
displayName: string;
|
|
82
|
+
sourceCode: string;
|
|
83
|
+
dimensions: import("@remotion/studio-shared").ComponentDimensions;
|
|
84
|
+
};
|
|
85
|
+
}) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertComponent = exports.insertExistingAssets = exports.insertRemoteAudio = exports.importRemoteAsset = exports.importAssets = exports.pickFilesToImport = exports.getComponentDimensions = exports.getAssetElementFromPath = exports.getAssetElement = void 0;
|
|
3
|
+
exports.insertElement = exports.insertComponent = exports.insertExistingAssets = exports.insertRemoteAudio = exports.importRemoteAsset = exports.importAssets = exports.pickFilesToImport = exports.getComponentDimensions = exports.getAssetElementFromPath = exports.getAssetElement = void 0;
|
|
4
4
|
const media_utils_1 = require("@remotion/media-utils");
|
|
5
5
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
@@ -569,3 +569,25 @@ const insertComponent = async ({ component, compositionFile, compositionId, drop
|
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
571
|
exports.insertComponent = insertComponent;
|
|
572
|
+
const insertElement = async ({ compositionFile, compositionId, dropPosition, element, }) => {
|
|
573
|
+
try {
|
|
574
|
+
const response = await (0, call_api_1.callApi)('/api/insert-element', {
|
|
575
|
+
compositionFile,
|
|
576
|
+
compositionId,
|
|
577
|
+
element,
|
|
578
|
+
position: getCenteredPosition({
|
|
579
|
+
dimensions: element.dimensions,
|
|
580
|
+
dropPosition,
|
|
581
|
+
}),
|
|
582
|
+
});
|
|
583
|
+
if (!response.success) {
|
|
584
|
+
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${response.reason}`, 4000);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
(0, NotificationCenter_1.showNotification)(`Added ${element.displayName} to source file`, 2000);
|
|
588
|
+
}
|
|
589
|
+
catch (error) {
|
|
590
|
+
(0, NotificationCenter_1.showNotification)(`Could not add Element: ${error instanceof Error ? error.message : String(error)}`, 4000);
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
exports.insertElement = insertElement;
|
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, GetEffectDragOverrides, PropStatuses, InteractivitySchemaField, SequencePropsSubscriptionKey, InteractivitySchema, TSequence } from 'remotion';
|
|
2
2
|
import { type OutlinePoint } from './selected-outline-geometry';
|
|
3
3
|
export type UvCoordinate = readonly [number, number];
|
|
4
|
+
type UvEllipseDimensions = {
|
|
5
|
+
readonly width: number;
|
|
6
|
+
readonly height: number;
|
|
7
|
+
};
|
|
4
8
|
export type UvCoordinateFieldSchema = Extract<InteractivitySchemaField, {
|
|
5
9
|
type: 'uv-coordinate';
|
|
6
10
|
}>;
|
|
11
|
+
export type NumericUvEllipseFieldSchema = Extract<InteractivitySchemaField, {
|
|
12
|
+
type: 'number' | 'rotation-degrees';
|
|
13
|
+
}>;
|
|
14
|
+
export type UvEllipseControlField = {
|
|
15
|
+
readonly fieldKey: string;
|
|
16
|
+
readonly fieldSchema: NumericUvEllipseFieldSchema;
|
|
17
|
+
readonly fieldDefault: number | null | undefined;
|
|
18
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
|
|
19
|
+
readonly value: number;
|
|
20
|
+
};
|
|
21
|
+
export type UvEllipseControls = {
|
|
22
|
+
readonly width: UvEllipseControlField;
|
|
23
|
+
readonly height: UvEllipseControlField;
|
|
24
|
+
readonly rotation: UvEllipseControlField | null;
|
|
25
|
+
readonly innerScale: UvEllipseControlField | null;
|
|
26
|
+
};
|
|
7
27
|
export type SelectedOutlineUvHandle = {
|
|
8
28
|
readonly clientId: string;
|
|
9
29
|
readonly propStatus: CanUpdateSequencePropStatusStatic | CanUpdateSequencePropStatusKeyframed;
|
|
10
30
|
readonly effectIndex: number;
|
|
31
|
+
readonly effectValues: Record<string, unknown>;
|
|
32
|
+
readonly ellipseControls: UvEllipseControls | null;
|
|
11
33
|
readonly fieldDefault: UvCoordinate | undefined;
|
|
12
34
|
readonly fieldKey: string;
|
|
13
35
|
readonly fieldSchema: UvCoordinateFieldSchema;
|
|
@@ -17,12 +39,49 @@ export type SelectedOutlineUvHandle = {
|
|
|
17
39
|
readonly sourceFrame: number;
|
|
18
40
|
readonly value: UvCoordinate;
|
|
19
41
|
};
|
|
20
|
-
type UvConnectionHandle = Pick<SelectedOutlineUvHandle, 'effectIndex' | 'fieldKey' | 'fieldSchema' | 'value'
|
|
42
|
+
type UvConnectionHandle = Pick<SelectedOutlineUvHandle, 'effectIndex' | 'fieldKey' | 'fieldSchema' | 'value'> & {
|
|
43
|
+
readonly effectValues?: Record<string, unknown>;
|
|
44
|
+
readonly ellipseControls?: UvEllipseControls | null;
|
|
45
|
+
};
|
|
21
46
|
type UvHandleConnectionLine = {
|
|
22
47
|
readonly key: string;
|
|
23
48
|
readonly from: OutlinePoint;
|
|
24
49
|
readonly to: OutlinePoint;
|
|
25
50
|
};
|
|
51
|
+
type UvHandleConnectionEllipse = {
|
|
52
|
+
readonly key: string;
|
|
53
|
+
readonly points: readonly OutlinePoint[];
|
|
54
|
+
};
|
|
55
|
+
export type UvEllipseResizeAxis = 'width' | 'height';
|
|
56
|
+
export type UvEllipseResizeControl = {
|
|
57
|
+
readonly key: string;
|
|
58
|
+
readonly axis: UvEllipseResizeAxis;
|
|
59
|
+
readonly field: UvEllipseControlField;
|
|
60
|
+
readonly position: OutlinePoint;
|
|
61
|
+
readonly cursor: string;
|
|
62
|
+
};
|
|
63
|
+
export type UvEllipseRotationControl = {
|
|
64
|
+
readonly key: string;
|
|
65
|
+
readonly field: UvEllipseControlField;
|
|
66
|
+
readonly position: OutlinePoint;
|
|
67
|
+
readonly cursor: string;
|
|
68
|
+
};
|
|
69
|
+
export type UvEllipseStartControl = {
|
|
70
|
+
readonly key: string;
|
|
71
|
+
readonly field: UvEllipseControlField;
|
|
72
|
+
readonly position: OutlinePoint;
|
|
73
|
+
readonly cursor: string;
|
|
74
|
+
};
|
|
75
|
+
export type UvEllipseInteractiveControls = {
|
|
76
|
+
readonly handle: SelectedOutlineUvHandle;
|
|
77
|
+
readonly center: OutlinePoint;
|
|
78
|
+
readonly width: number;
|
|
79
|
+
readonly height: number;
|
|
80
|
+
readonly rotation: number;
|
|
81
|
+
readonly resize: readonly UvEllipseResizeControl[];
|
|
82
|
+
readonly rotationControl: UvEllipseRotationControl | null;
|
|
83
|
+
readonly startControl: UvEllipseStartControl | null;
|
|
84
|
+
};
|
|
26
85
|
type SelectedEffectFields = {
|
|
27
86
|
readonly allFields: boolean;
|
|
28
87
|
readonly fieldKeys: ReadonlySet<string>;
|
|
@@ -33,9 +92,20 @@ export declare const getUvHandleConnectionLines: ({ handles, points, }: {
|
|
|
33
92
|
readonly handles: readonly UvConnectionHandle[];
|
|
34
93
|
readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
|
|
35
94
|
}) => UvHandleConnectionLine[];
|
|
95
|
+
export declare const getUvHandleConnectionEllipses: ({ handles, dimensions, points, }: {
|
|
96
|
+
readonly handles: readonly UvConnectionHandle[];
|
|
97
|
+
readonly dimensions?: UvEllipseDimensions | null | undefined;
|
|
98
|
+
readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
|
|
99
|
+
}) => UvHandleConnectionEllipse[];
|
|
100
|
+
export declare const getUvEllipseInteractiveControls: ({ handles, dimensions, points, }: {
|
|
101
|
+
readonly handles: readonly SelectedOutlineUvHandle[];
|
|
102
|
+
readonly dimensions?: UvEllipseDimensions | null | undefined;
|
|
103
|
+
readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
|
|
104
|
+
}) => UvEllipseInteractiveControls[];
|
|
36
105
|
export declare const getUvCoordinateForPoint: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], point: OutlinePoint) => UvCoordinate;
|
|
37
106
|
export declare function constrainUv(value: UvCoordinate, schema: UvCoordinateFieldSchema): UvCoordinate;
|
|
38
107
|
export declare function roundUvCoordinate(value: UvCoordinate, schema: UvCoordinateFieldSchema): UvCoordinate;
|
|
108
|
+
export declare const roundNumericUvEllipseValue: (value: number, schema: NumericUvEllipseFieldSchema) => number;
|
|
39
109
|
export declare const getSelectedUvHandles: ({ propStatuses, clientId, getEffectDragOverrides, nodePath, selectedEffects, sequence, sourceFrame, }: {
|
|
40
110
|
readonly propStatuses: PropStatuses;
|
|
41
111
|
readonly clientId: string | null;
|