@remotion/studio 4.0.470 → 4.0.472
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/AssetSelector.js +10 -1
- package/dist/components/Canvas.js +98 -0
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +12 -4
- package/dist/components/ContextMenu.d.ts +7 -2
- package/dist/components/ContextMenu.js +91 -43
- package/dist/components/Editor.js +14 -6
- package/dist/components/Modals.js +3 -1
- package/dist/components/NewComposition/CodemodFooter.js +2 -2
- package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
- package/dist/components/NewComposition/DeleteFolder.js +39 -0
- package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
- package/dist/components/NewComposition/RenameFolder.js +60 -0
- package/dist/components/Preview.js +2 -1
- package/dist/components/SelectedOutlineOverlay.d.ts +109 -1
- package/dist/components/SelectedOutlineOverlay.js +489 -73
- package/dist/components/Splitter/SplitterContainer.js +9 -0
- package/dist/components/Splitter/SplitterHandle.js +63 -70
- package/dist/components/Timeline/Timeline.js +121 -1
- package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
- package/dist/components/Timeline/TimelineArrayField.js +210 -0
- package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
- package/dist/components/Timeline/TimelineBooleanField.js +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +20 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +265 -0
- package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
- package/dist/components/Timeline/TimelineColorField.js +2 -8
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +15 -0
- package/dist/components/Timeline/TimelineDragHandler.js +1 -0
- package/dist/components/Timeline/TimelineEffectItem.js +159 -6
- package/dist/components/Timeline/TimelineEffectPropItem.js +95 -25
- package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
- package/dist/components/Timeline/TimelineEnumField.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +52 -33
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
- package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
- package/dist/components/Timeline/TimelineLayerEye.js +8 -3
- package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
- package/dist/components/Timeline/TimelineNumberField.js +7 -11
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
- package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +41 -24
- package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
- package/dist/components/Timeline/TimelineRowChrome.js +11 -10
- package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
- package/dist/components/Timeline/TimelineScaleField.js +314 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
- package/dist/components/Timeline/TimelineSchemaField.js +8 -42
- package/dist/components/Timeline/TimelineSelection.js +3 -2
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +51 -10
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +97 -7
- package/dist/components/Timeline/TimelineSequencePropItem.js +82 -21
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +528 -0
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineTranslateField.js +21 -25
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
- package/dist/components/Timeline/call-add-keyframe.js +2 -0
- package/dist/components/Timeline/call-delete-keyframe.d.ts +16 -0
- package/dist/components/Timeline/call-delete-keyframe.js +86 -14
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +10 -0
- package/dist/components/Timeline/delete-selected-keyframe.js +48 -7
- package/dist/components/Timeline/delete-selected-timeline-item.js +6 -11
- package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
- package/dist/components/Timeline/get-node-keyframes.js +38 -5
- package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +38 -0
- package/dist/components/Timeline/reset-selected-timeline-props.js +156 -0
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -2
- package/dist/components/Timeline/sequence-props-subscription-store.js +2 -1
- package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
- package/dist/components/Timeline/timeline-field-utils.js +5 -1
- package/dist/components/Timeline/timeline-scroll-logic.js +3 -3
- package/dist/components/Timeline/timeline-translate-utils.js +6 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
- package/dist/components/Timeline/use-sequence-props-subscription.js +2 -1
- package/dist/components/TopPanel.d.ts +1 -1
- package/dist/components/folder-menu-items.d.ts +12 -0
- package/dist/components/folder-menu-items.js +147 -0
- package/dist/components/import-assets.d.ts +6 -0
- package/dist/components/import-assets.js +157 -0
- package/dist/esm/{chunk-dny42qnq.js → chunk-48grt472.js} +9717 -5925
- package/dist/esm/internals.mjs +9717 -5925
- package/dist/esm/previewEntry.mjs +9531 -5737
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +7 -3
- package/dist/helpers/create-folder-tree.js +1 -0
- package/dist/helpers/detect-file-type.d.ts +69 -0
- package/dist/helpers/detect-file-type.js +278 -0
- package/dist/helpers/get-folder-id.d.ts +4 -0
- package/dist/helpers/get-folder-id.js +7 -0
- package/dist/helpers/get-left-of-timeline-slider.js +1 -1
- package/dist/helpers/get-timeline-sequence-layout.js +10 -11
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
- package/dist/helpers/open-in-editor.d.ts +19 -1
- package/dist/helpers/open-in-editor.js +42 -4
- package/dist/helpers/timeline-layout.js +5 -1
- package/dist/helpers/use-menu-structure.js +0 -1
- package/dist/helpers/validate-folder-rename.d.ts +6 -0
- package/dist/helpers/validate-folder-rename.js +19 -0
- package/dist/state/modals.d.ts +10 -0
- package/dist/state/scale-lock.d.ts +18 -0
- package/dist/state/scale-lock.js +59 -0
- package/dist/state/z-index.js +5 -2
- package/package.json +10 -10
|
@@ -57,8 +57,7 @@ const TimelineUvCoordinateField = ({ field, propStatus, effectiveValue, onSave,
|
|
|
57
57
|
const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
58
58
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
59
59
|
const newTuple = [newVal, currentY];
|
|
60
|
-
if (propStatus.
|
|
61
|
-
!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
60
|
+
if (!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
62
61
|
onSave(newTuple).finally(() => {
|
|
63
62
|
setDragX(null);
|
|
64
63
|
onDragEnd();
|
|
@@ -70,17 +69,15 @@ const TimelineUvCoordinateField = ({ field, propStatus, effectiveValue, onSave,
|
|
|
70
69
|
}
|
|
71
70
|
}, [dragY, codeY, propStatus, onSave, onDragEnd]);
|
|
72
71
|
const onXTextChange = (0, react_1.useCallback)((newVal) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
}
|
|
72
|
+
const parsed = Number(newVal);
|
|
73
|
+
if (!Number.isNaN(parsed)) {
|
|
74
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
75
|
+
const newTuple = [parsed, currentY];
|
|
76
|
+
if (!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
77
|
+
setDragX(parsed);
|
|
78
|
+
onSave(newTuple).finally(() => {
|
|
79
|
+
setDragX(null);
|
|
80
|
+
});
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
}, [propStatus, dragY, codeY, onSave]);
|
|
@@ -92,8 +89,7 @@ const TimelineUvCoordinateField = ({ field, propStatus, effectiveValue, onSave,
|
|
|
92
89
|
const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
93
90
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
94
91
|
const newTuple = [currentX, newVal];
|
|
95
|
-
if (propStatus.
|
|
96
|
-
!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
92
|
+
if (!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
97
93
|
onSave(newTuple).finally(() => {
|
|
98
94
|
setDragY(null);
|
|
99
95
|
onDragEnd();
|
|
@@ -105,17 +101,15 @@ const TimelineUvCoordinateField = ({ field, propStatus, effectiveValue, onSave,
|
|
|
105
101
|
}
|
|
106
102
|
}, [dragX, codeX, propStatus, onSave, onDragEnd]);
|
|
107
103
|
const onYTextChange = (0, react_1.useCallback)((newVal) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
}
|
|
104
|
+
const parsed = Number(newVal);
|
|
105
|
+
if (!Number.isNaN(parsed)) {
|
|
106
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
107
|
+
const newTuple = [currentX, parsed];
|
|
108
|
+
if (!tuplesEqual(propStatus.codeValue, newTuple)) {
|
|
109
|
+
setDragY(parsed);
|
|
110
|
+
onSave(newTuple).finally(() => {
|
|
111
|
+
setDragY(null);
|
|
112
|
+
});
|
|
119
113
|
}
|
|
120
114
|
}
|
|
121
115
|
}, [propStatus, onSave, dragX, codeX]);
|
|
@@ -13,6 +13,7 @@ const callAddSequenceKeyframe = ({ fileName, nodePath, fieldKey, sourceFrame, va
|
|
|
13
13
|
fieldKey,
|
|
14
14
|
frame: sourceFrame,
|
|
15
15
|
value,
|
|
16
|
+
schema,
|
|
16
17
|
}),
|
|
17
18
|
apiCall: () => (0, call_api_1.callApi)('/api/add-sequence-keyframe', {
|
|
18
19
|
fileName,
|
|
@@ -37,6 +38,7 @@ const callAddEffectKeyframe = ({ fileName, nodePath, effectIndex, fieldKey, sour
|
|
|
37
38
|
fieldKey,
|
|
38
39
|
frame: sourceFrame,
|
|
39
40
|
value,
|
|
41
|
+
schema,
|
|
40
42
|
}),
|
|
41
43
|
apiCall: () => (0, call_api_1.callApi)('/api/add-effect-keyframe', {
|
|
42
44
|
fileName,
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
|
|
2
2
|
import type { SetCodeValues } from './save-sequence-prop';
|
|
3
|
+
export type DeleteSequenceKeyframeChange = {
|
|
4
|
+
fileName: string;
|
|
5
|
+
nodePath: SequencePropsSubscriptionKey;
|
|
6
|
+
fieldKey: string;
|
|
7
|
+
sourceFrame: number;
|
|
8
|
+
schema: SequenceSchema;
|
|
9
|
+
};
|
|
10
|
+
export type DeleteEffectKeyframeChange = DeleteSequenceKeyframeChange & {
|
|
11
|
+
effectIndex: number;
|
|
12
|
+
};
|
|
3
13
|
export declare const callDeleteSequenceKeyframe: ({ fileName, nodePath, fieldKey, sourceFrame, schema, setCodeValues, clientId, }: {
|
|
4
14
|
fileName: string;
|
|
5
15
|
nodePath: SequencePropsSubscriptionKey;
|
|
@@ -19,3 +29,9 @@ export declare const callDeleteEffectKeyframe: ({ fileName, nodePath, effectInde
|
|
|
19
29
|
setCodeValues: SetCodeValues;
|
|
20
30
|
clientId: string;
|
|
21
31
|
}) => Promise<void>;
|
|
32
|
+
export declare const callDeleteKeyframes: ({ sequenceKeyframes, effectKeyframes, setCodeValues, clientId, }: {
|
|
33
|
+
sequenceKeyframes: DeleteSequenceKeyframeChange[];
|
|
34
|
+
effectKeyframes: DeleteEffectKeyframeChange[];
|
|
35
|
+
setCodeValues: SetCodeValues;
|
|
36
|
+
clientId: string;
|
|
37
|
+
}) => Promise<void>;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.callDeleteEffectKeyframe = exports.callDeleteSequenceKeyframe = void 0;
|
|
3
|
+
exports.callDeleteKeyframes = exports.callDeleteEffectKeyframe = exports.callDeleteSequenceKeyframe = void 0;
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const call_api_1 = require("../call-api");
|
|
6
6
|
const save_prop_queue_1 = require("./save-prop-queue");
|
|
7
|
+
const groupByNodePath = (keyframes) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const groups = new Map();
|
|
10
|
+
for (const keyframe of keyframes) {
|
|
11
|
+
const key = JSON.stringify(keyframe.nodePath);
|
|
12
|
+
const group = (_a = groups.get(key)) !== null && _a !== void 0 ? _a : [];
|
|
13
|
+
group.push(keyframe);
|
|
14
|
+
groups.set(key, group);
|
|
15
|
+
}
|
|
16
|
+
return [...groups.values()];
|
|
17
|
+
};
|
|
7
18
|
const callDeleteSequenceKeyframe = ({ fileName, nodePath, fieldKey, sourceFrame, schema, setCodeValues, clientId, }) => {
|
|
8
19
|
return (0, save_prop_queue_1.enqueueSavePropChange)({
|
|
9
20
|
nodePath,
|
|
@@ -13,12 +24,17 @@ const callDeleteSequenceKeyframe = ({ fileName, nodePath, fieldKey, sourceFrame,
|
|
|
13
24
|
fieldKey,
|
|
14
25
|
frame: sourceFrame,
|
|
15
26
|
}),
|
|
16
|
-
apiCall: () => (0, call_api_1.callApi)('/api/delete-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
apiCall: () => (0, call_api_1.callApi)('/api/delete-keyframes', {
|
|
28
|
+
sequenceKeyframes: [
|
|
29
|
+
{
|
|
30
|
+
fileName,
|
|
31
|
+
nodePath,
|
|
32
|
+
key: fieldKey,
|
|
33
|
+
frame: sourceFrame,
|
|
34
|
+
schema,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
effectKeyframes: [],
|
|
22
38
|
clientId,
|
|
23
39
|
}),
|
|
24
40
|
errorLabel: 'Could not delete keyframe',
|
|
@@ -35,16 +51,72 @@ const callDeleteEffectKeyframe = ({ fileName, nodePath, effectIndex, fieldKey, s
|
|
|
35
51
|
fieldKey,
|
|
36
52
|
frame: sourceFrame,
|
|
37
53
|
}),
|
|
38
|
-
apiCall: () => (0, call_api_1.callApi)('/api/delete-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
apiCall: () => (0, call_api_1.callApi)('/api/delete-keyframes', {
|
|
55
|
+
sequenceKeyframes: [],
|
|
56
|
+
effectKeyframes: [
|
|
57
|
+
{
|
|
58
|
+
fileName,
|
|
59
|
+
sequenceNodePath: nodePath,
|
|
60
|
+
effectIndex,
|
|
61
|
+
key: fieldKey,
|
|
62
|
+
frame: sourceFrame,
|
|
63
|
+
schema,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
45
66
|
clientId,
|
|
46
67
|
}),
|
|
47
68
|
errorLabel: 'Could not delete keyframe',
|
|
48
69
|
});
|
|
49
70
|
};
|
|
50
71
|
exports.callDeleteEffectKeyframe = callDeleteEffectKeyframe;
|
|
72
|
+
const callDeleteKeyframes = ({ sequenceKeyframes, effectKeyframes, setCodeValues, clientId, }) => {
|
|
73
|
+
if (sequenceKeyframes.length === 0 && effectKeyframes.length === 0) {
|
|
74
|
+
return Promise.resolve();
|
|
75
|
+
}
|
|
76
|
+
for (const keyframes of groupByNodePath(sequenceKeyframes)) {
|
|
77
|
+
const [firstKeyframe] = keyframes;
|
|
78
|
+
if (!firstKeyframe) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
setCodeValues(firstKeyframe.nodePath, (prev) => (0, studio_shared_1.optimisticDeleteSequenceKeyframes)({
|
|
82
|
+
previous: prev,
|
|
83
|
+
keyframes: keyframes.map((keyframe) => ({
|
|
84
|
+
fieldKey: keyframe.fieldKey,
|
|
85
|
+
frame: keyframe.sourceFrame,
|
|
86
|
+
})),
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
for (const keyframes of groupByNodePath(effectKeyframes)) {
|
|
90
|
+
const [firstKeyframe] = keyframes;
|
|
91
|
+
if (!firstKeyframe) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
setCodeValues(firstKeyframe.nodePath, (prev) => (0, studio_shared_1.optimisticDeleteEffectKeyframes)({
|
|
95
|
+
previous: prev,
|
|
96
|
+
keyframes: keyframes.map((keyframe) => ({
|
|
97
|
+
effectIndex: keyframe.effectIndex,
|
|
98
|
+
fieldKey: keyframe.fieldKey,
|
|
99
|
+
frame: keyframe.sourceFrame,
|
|
100
|
+
})),
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
return (0, call_api_1.callApi)('/api/delete-keyframes', {
|
|
104
|
+
sequenceKeyframes: sequenceKeyframes.map((keyframe) => ({
|
|
105
|
+
fileName: keyframe.fileName,
|
|
106
|
+
nodePath: keyframe.nodePath,
|
|
107
|
+
key: keyframe.fieldKey,
|
|
108
|
+
frame: keyframe.sourceFrame,
|
|
109
|
+
schema: keyframe.schema,
|
|
110
|
+
})),
|
|
111
|
+
effectKeyframes: effectKeyframes.map((keyframe) => ({
|
|
112
|
+
fileName: keyframe.fileName,
|
|
113
|
+
sequenceNodePath: keyframe.nodePath,
|
|
114
|
+
effectIndex: keyframe.effectIndex,
|
|
115
|
+
key: keyframe.fieldKey,
|
|
116
|
+
frame: keyframe.sourceFrame,
|
|
117
|
+
schema: keyframe.schema,
|
|
118
|
+
})),
|
|
119
|
+
clientId,
|
|
120
|
+
}).then(() => undefined);
|
|
121
|
+
};
|
|
122
|
+
exports.callDeleteKeyframes = callDeleteKeyframes;
|
|
@@ -9,3 +9,13 @@ export declare const deleteSelectedKeyframe: ({ nodePathInfo, frame, sequences,
|
|
|
9
9
|
setCodeValues: SetCodeValues;
|
|
10
10
|
clientId: string;
|
|
11
11
|
}) => Promise<void> | null;
|
|
12
|
+
export declare const deleteSelectedKeyframes: ({ keyframes, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }: {
|
|
13
|
+
keyframes: {
|
|
14
|
+
nodePathInfo: SequenceNodePathInfo;
|
|
15
|
+
frame: number;
|
|
16
|
+
}[];
|
|
17
|
+
sequences: TSequence[];
|
|
18
|
+
overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
19
|
+
setCodeValues: SetCodeValues;
|
|
20
|
+
clientId: string;
|
|
21
|
+
}) => Promise<void> | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteSelectedKeyframe = void 0;
|
|
3
|
+
exports.deleteSelectedKeyframes = exports.deleteSelectedKeyframe = void 0;
|
|
4
4
|
const call_delete_keyframe_1 = require("./call-delete-keyframe");
|
|
5
5
|
const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
|
|
6
6
|
const parse_keyframe_field_from_node_path_1 = require("./parse-keyframe-field-from-node-path");
|
|
7
|
-
const
|
|
7
|
+
const getSelectedKeyframeDeletion = ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, }) => {
|
|
8
8
|
var _a, _b;
|
|
9
9
|
const field = (0, parse_keyframe_field_from_node_path_1.parseKeyframeFieldFromNodePath)(nodePathInfo.auxiliaryKeys);
|
|
10
10
|
if (field === null) {
|
|
@@ -27,25 +27,66 @@ const deleteSelectedKeyframe = ({ nodePathInfo, frame, sequences, overrideIdsToN
|
|
|
27
27
|
if (!effect) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
type: 'effect',
|
|
31
32
|
fileName,
|
|
32
33
|
nodePath,
|
|
33
34
|
effectIndex: field.effectIndex,
|
|
34
35
|
fieldKey: field.fieldKey,
|
|
35
36
|
sourceFrame,
|
|
36
37
|
schema: effect.schema,
|
|
37
|
-
|
|
38
|
-
clientId,
|
|
39
|
-
});
|
|
38
|
+
};
|
|
40
39
|
}
|
|
41
|
-
return
|
|
40
|
+
return {
|
|
41
|
+
type: 'sequence',
|
|
42
42
|
fileName,
|
|
43
43
|
nodePath,
|
|
44
44
|
fieldKey: field.fieldKey,
|
|
45
45
|
sourceFrame,
|
|
46
46
|
schema: sequence.controls.schema,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const deleteSelectedKeyframe = ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }) => {
|
|
50
|
+
const deletion = getSelectedKeyframeDeletion({
|
|
51
|
+
nodePathInfo,
|
|
52
|
+
frame,
|
|
53
|
+
sequences,
|
|
54
|
+
overrideIdsToNodePaths,
|
|
55
|
+
});
|
|
56
|
+
if (deletion === null) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (deletion.type === 'effect') {
|
|
60
|
+
return (0, call_delete_keyframe_1.callDeleteEffectKeyframe)({
|
|
61
|
+
...deletion,
|
|
62
|
+
setCodeValues,
|
|
63
|
+
clientId,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return (0, call_delete_keyframe_1.callDeleteSequenceKeyframe)({
|
|
67
|
+
...deletion,
|
|
47
68
|
setCodeValues,
|
|
48
69
|
clientId,
|
|
49
70
|
});
|
|
50
71
|
};
|
|
51
72
|
exports.deleteSelectedKeyframe = deleteSelectedKeyframe;
|
|
73
|
+
const deleteSelectedKeyframes = ({ keyframes, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }) => {
|
|
74
|
+
const deletions = keyframes
|
|
75
|
+
.map((keyframe) => getSelectedKeyframeDeletion({
|
|
76
|
+
nodePathInfo: keyframe.nodePathInfo,
|
|
77
|
+
frame: keyframe.frame,
|
|
78
|
+
sequences,
|
|
79
|
+
overrideIdsToNodePaths,
|
|
80
|
+
}))
|
|
81
|
+
.filter((deletion) => deletion !== null);
|
|
82
|
+
if (deletions.length === 0) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return (0, call_delete_keyframe_1.callDeleteKeyframes)({
|
|
86
|
+
sequenceKeyframes: deletions.filter((deletion) => deletion.type === 'sequence'),
|
|
87
|
+
effectKeyframes: deletions.filter((deletion) => deletion.type === 'effect'),
|
|
88
|
+
setCodeValues,
|
|
89
|
+
clientId,
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.deleteSelectedKeyframes = deleteSelectedKeyframes;
|
|
@@ -152,21 +152,16 @@ const deleteSelectedTimelineItems = ({ selections, sequences, overrideIdsToNodeP
|
|
|
152
152
|
effectIndex: selection.i,
|
|
153
153
|
})));
|
|
154
154
|
case 'keyframe': {
|
|
155
|
-
|
|
156
|
-
.filter(isKeyframeSelection)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
return (0, delete_selected_keyframe_1.deleteSelectedKeyframes)({
|
|
156
|
+
keyframes: selections.filter(isKeyframeSelection).map((selection) => ({
|
|
157
|
+
nodePathInfo: selection.nodePathInfo,
|
|
158
|
+
frame: selection.frame,
|
|
159
|
+
})),
|
|
160
160
|
sequences,
|
|
161
161
|
overrideIdsToNodePaths,
|
|
162
162
|
setCodeValues,
|
|
163
163
|
clientId,
|
|
164
|
-
})
|
|
165
|
-
.filter((promise) => promise !== null);
|
|
166
|
-
if (deletePromises.length === 0) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
return Promise.all(deletePromises).then(() => undefined);
|
|
164
|
+
});
|
|
170
165
|
}
|
|
171
166
|
case 'sequence-prop':
|
|
172
167
|
case 'sequence-effect-prop':
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { type CodeValues, type SequencePropsSubscriptionKey } from 'remotion';
|
|
1
|
+
import { type CodeValues, type GetDragOverrides, type GetEffectDragOverrides, type SequencePropsSubscriptionKey } from 'remotion';
|
|
2
2
|
import type { TimelineTreeNode } from '../../helpers/timeline-layout';
|
|
3
|
-
export declare const getNodeKeyframes: ({ node, nodePath, codeValues, keyframeDisplayOffset, }: {
|
|
3
|
+
export declare const getNodeKeyframes: ({ node, nodePath, codeValues, keyframeDisplayOffset, getDragOverrides, getEffectDragOverrides, timelinePosition, }: {
|
|
4
4
|
node: TimelineTreeNode;
|
|
5
5
|
nodePath: SequencePropsSubscriptionKey;
|
|
6
6
|
codeValues: CodeValues;
|
|
7
7
|
keyframeDisplayOffset: number;
|
|
8
|
+
getDragOverrides: GetDragOverrides;
|
|
9
|
+
getEffectDragOverrides: GetEffectDragOverrides;
|
|
10
|
+
timelinePosition: number;
|
|
8
11
|
}) => {
|
|
9
12
|
frame: number;
|
|
10
13
|
value: unknown;
|
|
@@ -3,21 +3,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getNodeKeyframes = void 0;
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
5
|
const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
|
|
6
|
-
const
|
|
6
|
+
const hasOverride = (overrides, key) => Object.prototype.hasOwnProperty.call(overrides, key);
|
|
7
|
+
const withDragOverrideKeyframe = ({ propStatus, keyframeDisplayOffset, timelinePosition, dragOverrideValue, hasDragOverride, }) => {
|
|
8
|
+
if ((dragOverrideValue === null || dragOverrideValue === void 0 ? void 0 : dragOverrideValue.type) === 'keyframed') {
|
|
9
|
+
return (0, get_timeline_keyframes_1.getTimelineKeyframes)(dragOverrideValue.status, keyframeDisplayOffset);
|
|
10
|
+
}
|
|
11
|
+
const keyframes = (0, get_timeline_keyframes_1.getTimelineKeyframes)(propStatus, keyframeDisplayOffset);
|
|
12
|
+
if (!hasDragOverride || (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) !== 'keyframed') {
|
|
13
|
+
return keyframes;
|
|
14
|
+
}
|
|
15
|
+
const dragKeyframe = {
|
|
16
|
+
frame: timelinePosition,
|
|
17
|
+
value: dragOverrideValue === null || dragOverrideValue === void 0 ? void 0 : dragOverrideValue.value,
|
|
18
|
+
};
|
|
19
|
+
const existingIndex = keyframes.findIndex((keyframe) => keyframe.frame === timelinePosition);
|
|
20
|
+
if (existingIndex !== -1) {
|
|
21
|
+
return keyframes.map((keyframe, index) => index === existingIndex ? dragKeyframe : keyframe);
|
|
22
|
+
}
|
|
23
|
+
return [...keyframes, dragKeyframe].sort((first, second) => first.frame - second.frame);
|
|
24
|
+
};
|
|
25
|
+
const getNodeKeyframes = ({ node, nodePath, codeValues, keyframeDisplayOffset, getDragOverrides, getEffectDragOverrides, timelinePosition, }) => {
|
|
7
26
|
var _a, _b;
|
|
8
27
|
if (node.kind !== 'field' || node.field === null) {
|
|
9
28
|
return [];
|
|
10
29
|
}
|
|
11
30
|
if (node.field.kind === 'sequence-field') {
|
|
12
|
-
|
|
31
|
+
const dragOverrides = getDragOverrides(nodePath);
|
|
32
|
+
return withDragOverrideKeyframe({
|
|
33
|
+
propStatus: (_a = remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)) === null || _a === void 0 ? void 0 : _a[node.field.key],
|
|
34
|
+
keyframeDisplayOffset,
|
|
35
|
+
timelinePosition,
|
|
36
|
+
dragOverrideValue: dragOverrides[node.field.key],
|
|
37
|
+
hasDragOverride: hasOverride(dragOverrides, node.field.key),
|
|
38
|
+
});
|
|
13
39
|
}
|
|
14
40
|
const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
|
|
15
41
|
codeValues,
|
|
16
42
|
nodePath,
|
|
17
43
|
effectIndex: node.field.effectIndex,
|
|
18
44
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:
|
|
45
|
+
const effectDragOverrides = getEffectDragOverrides(nodePath, node.field.effectIndex);
|
|
46
|
+
return withDragOverrideKeyframe({
|
|
47
|
+
propStatus: effectStatus.type === 'can-update-effect'
|
|
48
|
+
? (_b = effectStatus.props) === null || _b === void 0 ? void 0 : _b[node.field.key]
|
|
49
|
+
: null,
|
|
50
|
+
keyframeDisplayOffset,
|
|
51
|
+
timelinePosition,
|
|
52
|
+
dragOverrideValue: effectDragOverrides[node.field.key],
|
|
53
|
+
hasDragOverride: hasOverride(effectDragOverrides, node.field.key),
|
|
54
|
+
});
|
|
22
55
|
};
|
|
23
56
|
exports.getNodeKeyframes = getNodeKeyframes;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTimelineKeyframes = exports.getComputedStatusLabel = void 0;
|
|
4
4
|
const getComputedStatusLabel = (propStatus) => {
|
|
5
|
-
if (propStatus.
|
|
5
|
+
if (propStatus.status === 'computed') {
|
|
6
6
|
return 'computed';
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
throw new Error(`Unsupported prop status: ${propStatus.status}`);
|
|
9
9
|
};
|
|
10
10
|
exports.getComputedStatusLabel = getComputedStatusLabel;
|
|
11
11
|
const getTimelineKeyframes = (propStatus, keyframeDisplayOffset = 0) => {
|
|
12
|
-
if (!propStatus
|
|
12
|
+
if (!propStatus) {
|
|
13
13
|
return [];
|
|
14
14
|
}
|
|
15
|
-
if (propStatus.
|
|
15
|
+
if (propStatus.status !== 'keyframed') {
|
|
16
16
|
return [];
|
|
17
17
|
}
|
|
18
18
|
const { keyframes } = propStatus;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CodeValues, OverrideIdToNodePaths, SequencePropsSubscriptionKey, SequenceSchema, TSequence } from 'remotion';
|
|
2
|
+
import type { SetCodeValues } from './save-sequence-prop';
|
|
3
|
+
import type { TimelineSelection } from './TimelineSelection';
|
|
4
|
+
type SequencePropResetTarget = {
|
|
5
|
+
readonly type: 'sequence-prop';
|
|
6
|
+
readonly fileName: string;
|
|
7
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
8
|
+
readonly fieldKey: string;
|
|
9
|
+
readonly value: unknown;
|
|
10
|
+
readonly defaultValue: string | null;
|
|
11
|
+
readonly schema: SequenceSchema;
|
|
12
|
+
};
|
|
13
|
+
type EffectPropResetTarget = {
|
|
14
|
+
readonly type: 'effect-prop';
|
|
15
|
+
readonly fileName: string;
|
|
16
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
17
|
+
readonly effectIndex: number;
|
|
18
|
+
readonly fieldKey: string;
|
|
19
|
+
readonly value: unknown;
|
|
20
|
+
readonly defaultValue: string | null;
|
|
21
|
+
readonly schema: SequenceSchema;
|
|
22
|
+
};
|
|
23
|
+
type TimelinePropResetTarget = SequencePropResetTarget | EffectPropResetTarget;
|
|
24
|
+
export declare const getTimelinePropResetTargets: ({ selections, sequences, overrideIdsToNodePaths, codeValues, }: {
|
|
25
|
+
readonly selections: readonly TimelineSelection[];
|
|
26
|
+
readonly sequences: TSequence[];
|
|
27
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
28
|
+
readonly codeValues: CodeValues;
|
|
29
|
+
}) => TimelinePropResetTarget[] | null;
|
|
30
|
+
export declare const resetSelectedTimelineProps: ({ selections, sequences, overrideIdsToNodePaths, codeValues, setCodeValues, clientId, }: {
|
|
31
|
+
readonly selections: readonly TimelineSelection[];
|
|
32
|
+
readonly sequences: TSequence[];
|
|
33
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
34
|
+
readonly codeValues: CodeValues;
|
|
35
|
+
readonly setCodeValues: SetCodeValues;
|
|
36
|
+
readonly clientId: string;
|
|
37
|
+
}) => Promise<void> | null;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resetSelectedTimelineProps = exports.getTimelinePropResetTargets = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const find_track_for_node_path_info_1 = require("./find-track-for-node-path-info");
|
|
6
|
+
const save_effect_prop_1 = require("./save-effect-prop");
|
|
7
|
+
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
8
|
+
const isPropResetSelection = (selection) => selection.type === 'sequence-prop' ||
|
|
9
|
+
selection.type === 'sequence-effect-prop';
|
|
10
|
+
const isVisibleFieldSchema = (fieldSchema) => fieldSchema !== undefined && fieldSchema.type !== 'hidden';
|
|
11
|
+
const isNonDefaultCodeValue = ({ codeValue, defaultValue, }) => JSON.stringify(codeValue !== null && codeValue !== void 0 ? codeValue : defaultValue) !== JSON.stringify(defaultValue);
|
|
12
|
+
const isResettablePropStatus = ({ propStatus, defaultValue, }) => {
|
|
13
|
+
if (!propStatus || propStatus.status === 'computed') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (defaultValue === undefined) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (propStatus.status === 'keyframed') {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return isNonDefaultCodeValue({
|
|
23
|
+
codeValue: propStatus.codeValue,
|
|
24
|
+
defaultValue,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const getDefaultValue = (fieldSchema) => fieldSchema.default !== undefined
|
|
28
|
+
? JSON.stringify(fieldSchema.default)
|
|
29
|
+
: null;
|
|
30
|
+
const getTimelinePropResetTargets = ({ selections, sequences, overrideIdsToNodePaths, codeValues, }) => {
|
|
31
|
+
var _a;
|
|
32
|
+
var _b;
|
|
33
|
+
const firstSelection = selections[0];
|
|
34
|
+
if (!firstSelection || !isPropResetSelection(firstSelection)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const resetTargets = [];
|
|
38
|
+
for (const selection of selections) {
|
|
39
|
+
if (!isPropResetSelection(selection)) {
|
|
40
|
+
throw new Error(`Assertion failed: Cannot reset timeline selections of different types (${firstSelection.type}, ${selection.type})`);
|
|
41
|
+
}
|
|
42
|
+
const track = (0, find_track_for_node_path_info_1.findTrackForNodePathInfo)({
|
|
43
|
+
sequences,
|
|
44
|
+
overrideIdsToNodePaths,
|
|
45
|
+
nodePathInfo: selection.nodePathInfo,
|
|
46
|
+
});
|
|
47
|
+
const sequence = (_b = track === null || track === void 0 ? void 0 : track.sequence) !== null && _b !== void 0 ? _b : null;
|
|
48
|
+
if (!sequence) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const nodePath = selection.nodePathInfo.sequenceSubscriptionKey;
|
|
52
|
+
if (selection.type === 'sequence-prop') {
|
|
53
|
+
if (!sequence.controls) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const sequenceFieldSchema = sequence.controls.schema[selection.key];
|
|
57
|
+
const sequencePropStatus = (_a = remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)) === null || _a === void 0 ? void 0 : _a[selection.key];
|
|
58
|
+
if (!isVisibleFieldSchema(sequenceFieldSchema) ||
|
|
59
|
+
!isResettablePropStatus({
|
|
60
|
+
propStatus: sequencePropStatus,
|
|
61
|
+
defaultValue: sequenceFieldSchema.default,
|
|
62
|
+
})) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
resetTargets.push({
|
|
66
|
+
type: 'sequence-prop',
|
|
67
|
+
fileName: nodePath.absolutePath,
|
|
68
|
+
nodePath,
|
|
69
|
+
fieldKey: selection.key,
|
|
70
|
+
value: sequenceFieldSchema.default,
|
|
71
|
+
defaultValue: getDefaultValue(sequenceFieldSchema),
|
|
72
|
+
schema: sequence.controls.schema,
|
|
73
|
+
});
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const effect = sequence.effects[selection.i];
|
|
77
|
+
const fieldSchema = effect === null || effect === void 0 ? void 0 : effect.schema[selection.key];
|
|
78
|
+
const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
|
|
79
|
+
codeValues,
|
|
80
|
+
nodePath,
|
|
81
|
+
effectIndex: selection.i,
|
|
82
|
+
});
|
|
83
|
+
const propStatus = effectStatus.type === 'can-update-effect'
|
|
84
|
+
? effectStatus.props[selection.key]
|
|
85
|
+
: null;
|
|
86
|
+
if (!effect ||
|
|
87
|
+
!isVisibleFieldSchema(fieldSchema) ||
|
|
88
|
+
!isResettablePropStatus({
|
|
89
|
+
propStatus,
|
|
90
|
+
defaultValue: fieldSchema.default,
|
|
91
|
+
})) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
resetTargets.push({
|
|
95
|
+
type: 'effect-prop',
|
|
96
|
+
fileName: nodePath.absolutePath,
|
|
97
|
+
nodePath,
|
|
98
|
+
effectIndex: selection.i,
|
|
99
|
+
fieldKey: selection.key,
|
|
100
|
+
value: fieldSchema.default,
|
|
101
|
+
defaultValue: getDefaultValue(fieldSchema),
|
|
102
|
+
schema: effect.schema,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return resetTargets;
|
|
106
|
+
};
|
|
107
|
+
exports.getTimelinePropResetTargets = getTimelinePropResetTargets;
|
|
108
|
+
const resetSelectedTimelineProps = ({ selections, sequences, overrideIdsToNodePaths, codeValues, setCodeValues, clientId, }) => {
|
|
109
|
+
const resetTargets = (0, exports.getTimelinePropResetTargets)({
|
|
110
|
+
selections,
|
|
111
|
+
sequences,
|
|
112
|
+
overrideIdsToNodePaths,
|
|
113
|
+
codeValues,
|
|
114
|
+
});
|
|
115
|
+
if (resetTargets === null || resetTargets.length === 0) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const sequencePropTargets = resetTargets.filter((target) => target.type === 'sequence-prop');
|
|
119
|
+
const effectPropTargets = resetTargets.filter((target) => target.type === 'effect-prop');
|
|
120
|
+
const resetPromises = [];
|
|
121
|
+
if (sequencePropTargets.length > 0) {
|
|
122
|
+
resetPromises.push((0, save_sequence_prop_1.saveSequenceProps)({
|
|
123
|
+
changes: sequencePropTargets.map((target) => ({
|
|
124
|
+
fileName: target.fileName,
|
|
125
|
+
nodePath: target.nodePath,
|
|
126
|
+
fieldKey: target.fieldKey,
|
|
127
|
+
value: target.value,
|
|
128
|
+
defaultValue: target.defaultValue,
|
|
129
|
+
schema: target.schema,
|
|
130
|
+
})),
|
|
131
|
+
setCodeValues,
|
|
132
|
+
clientId,
|
|
133
|
+
undoLabel: sequencePropTargets.length > 1
|
|
134
|
+
? 'Reset selected sequence props'
|
|
135
|
+
: null,
|
|
136
|
+
redoLabel: sequencePropTargets.length > 1
|
|
137
|
+
? 'Reapply selected sequence props'
|
|
138
|
+
: null,
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
for (const target of effectPropTargets) {
|
|
142
|
+
resetPromises.push((0, save_effect_prop_1.saveEffectProp)({
|
|
143
|
+
fileName: target.fileName,
|
|
144
|
+
nodePath: target.nodePath,
|
|
145
|
+
effectIndex: target.effectIndex,
|
|
146
|
+
fieldKey: target.fieldKey,
|
|
147
|
+
value: target.value,
|
|
148
|
+
defaultValue: target.defaultValue,
|
|
149
|
+
schema: target.schema,
|
|
150
|
+
setCodeValues,
|
|
151
|
+
clientId,
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
return Promise.all(resetPromises).then(() => undefined);
|
|
155
|
+
};
|
|
156
|
+
exports.resetSelectedTimelineProps = resetSelectedTimelineProps;
|