@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
|
@@ -8,6 +8,7 @@ const remotion_1 = require("remotion");
|
|
|
8
8
|
const client_id_1 = require("../../helpers/client-id");
|
|
9
9
|
const call_api_1 = require("../call-api");
|
|
10
10
|
const ContextMenu_1 = require("../ContextMenu");
|
|
11
|
+
const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
11
12
|
const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
|
|
12
13
|
const save_effect_prop_1 = require("./save-effect-prop");
|
|
13
14
|
const save_prop_queue_1 = require("./save-prop-queue");
|
|
@@ -21,6 +22,23 @@ const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
|
21
22
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
22
23
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
23
24
|
const fieldRowBase = {};
|
|
25
|
+
const isKeyframedStatus = (status) => {
|
|
26
|
+
return status.status === 'keyframed';
|
|
27
|
+
};
|
|
28
|
+
const isResettableStatus = ({ status, defaultValue, }) => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (defaultValue === undefined) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (status.status === 'keyframed') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (status.status === 'computed') {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const effectiveCodeValue = (_a = status.codeValue) !== null && _a !== void 0 ? _a : defaultValue;
|
|
40
|
+
return JSON.stringify(effectiveCodeValue) !== JSON.stringify(defaultValue);
|
|
41
|
+
};
|
|
24
42
|
const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) => {
|
|
25
43
|
var _a;
|
|
26
44
|
var _b;
|
|
@@ -39,9 +57,25 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
39
57
|
const propStatus = effectStatus.type === 'can-update-effect'
|
|
40
58
|
? ((_b = (_a = effectStatus.props) === null || _a === void 0 ? void 0 : _a[field.key]) !== null && _b !== void 0 ? _b : null)
|
|
41
59
|
: null;
|
|
60
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
61
|
+
const jsxFrame = timelinePosition - keyframeDisplayOffset;
|
|
42
62
|
const onDragValueChange = (0, react_1.useCallback)((value) => {
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
const nextDragOverrideValue = propStatus !== null && isKeyframedStatus(propStatus)
|
|
64
|
+
? remotion_1.Internals.makeKeyframedDragOverride({
|
|
65
|
+
status: propStatus,
|
|
66
|
+
frame: jsxFrame,
|
|
67
|
+
value,
|
|
68
|
+
})
|
|
69
|
+
: remotion_1.Internals.makeStaticDragOverride(value);
|
|
70
|
+
setEffectDragOverrides(nodePath, field.effectIndex, field.key, nextDragOverrideValue);
|
|
71
|
+
}, [
|
|
72
|
+
field.effectIndex,
|
|
73
|
+
field.key,
|
|
74
|
+
jsxFrame,
|
|
75
|
+
nodePath,
|
|
76
|
+
propStatus,
|
|
77
|
+
setEffectDragOverrides,
|
|
78
|
+
]);
|
|
45
79
|
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
46
80
|
clearEffectDragOverrides(nodePath, field.effectIndex);
|
|
47
81
|
}, [clearEffectDragOverrides, nodePath, field.effectIndex]);
|
|
@@ -56,7 +90,7 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
56
90
|
if (!propStatus) {
|
|
57
91
|
return Promise.reject(new Error('Cannot save'));
|
|
58
92
|
}
|
|
59
|
-
if (
|
|
93
|
+
if (propStatus.status !== 'static') {
|
|
60
94
|
return Promise.reject(new Error('Cannot save'));
|
|
61
95
|
}
|
|
62
96
|
if (!clientId) {
|
|
@@ -106,6 +140,36 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
106
140
|
setCodeValues,
|
|
107
141
|
validatedLocation,
|
|
108
142
|
]);
|
|
143
|
+
const onSaveKeyframed = (0, react_1.useCallback)((value, sourceFrame) => {
|
|
144
|
+
if (!validatedLocation) {
|
|
145
|
+
return Promise.reject(new Error('Cannot save'));
|
|
146
|
+
}
|
|
147
|
+
if (!clientId) {
|
|
148
|
+
return Promise.reject(new Error('Not connected to studio server'));
|
|
149
|
+
}
|
|
150
|
+
return (0, call_add_keyframe_1.callAddEffectKeyframe)({
|
|
151
|
+
fileName: validatedLocation.source,
|
|
152
|
+
nodePath,
|
|
153
|
+
effectIndex: field.effectIndex,
|
|
154
|
+
fieldKey: field.key,
|
|
155
|
+
sourceFrame,
|
|
156
|
+
value,
|
|
157
|
+
schema: field.effectSchema,
|
|
158
|
+
setCodeValues,
|
|
159
|
+
clientId,
|
|
160
|
+
});
|
|
161
|
+
}, [
|
|
162
|
+
clientId,
|
|
163
|
+
field.effectIndex,
|
|
164
|
+
field.effectSchema,
|
|
165
|
+
field.key,
|
|
166
|
+
nodePath,
|
|
167
|
+
setCodeValues,
|
|
168
|
+
validatedLocation,
|
|
169
|
+
]);
|
|
170
|
+
if (field.fieldSchema.type === 'scale') {
|
|
171
|
+
throw new Error(`Effects do not support scale fields: ${field.key}`);
|
|
172
|
+
}
|
|
109
173
|
if (effectStatus.type === 'cannot-update-effect') {
|
|
110
174
|
if (effectStatus.reason === 'computed') {
|
|
111
175
|
return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: "computed" });
|
|
@@ -127,22 +191,23 @@ const Value = ({ field, nodePath, validatedLocation, keyframeDisplayOffset }) =>
|
|
|
127
191
|
}
|
|
128
192
|
throw new Error(`Unsupported effect status: ${effectStatus.reason}`);
|
|
129
193
|
}
|
|
130
|
-
if (propStatus === null
|
|
131
|
-
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.reason) === 'keyframed') {
|
|
132
|
-
return (jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: propStatus, keyframeDisplayOffset: keyframeDisplayOffset }));
|
|
133
|
-
}
|
|
134
|
-
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.reason) === 'computed') {
|
|
135
|
-
return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: (0, get_timeline_keyframes_1.getComputedStatusLabel)(propStatus) });
|
|
136
|
-
}
|
|
194
|
+
if (propStatus === null) {
|
|
137
195
|
return null;
|
|
138
196
|
}
|
|
197
|
+
if (isKeyframedStatus(propStatus)) {
|
|
198
|
+
return (jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: propStatus, keyframeDisplayOffset: keyframeDisplayOffset, dragOverrideValue: dragOverrideValue, onSave: onSaveKeyframed, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, scaleLockNodePath: nodePath }));
|
|
199
|
+
}
|
|
200
|
+
if (propStatus.status === 'computed') {
|
|
201
|
+
return jsx_runtime_1.jsx(TimelineSchemaField_1.UnsupportedStatus, { label: (0, get_timeline_keyframes_1.getComputedStatusLabel)(propStatus) });
|
|
202
|
+
}
|
|
139
203
|
const effectiveValue = remotion_1.Internals.getEffectiveVisualModeValue({
|
|
140
204
|
codeValue: propStatus,
|
|
141
205
|
dragOverrideValue,
|
|
142
206
|
defaultValue: field.fieldSchema.default,
|
|
207
|
+
frame: jsxFrame,
|
|
143
208
|
shouldResortToDefaultValueIfUndefined: true,
|
|
144
209
|
});
|
|
145
|
-
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
210
|
+
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue, scaleLockNodePath: null }));
|
|
146
211
|
};
|
|
147
212
|
const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, keyframeDisplayOffset, }) => {
|
|
148
213
|
var _a;
|
|
@@ -174,23 +239,28 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
174
239
|
(0, TimelineKeyframeControls_1.shouldShowTimelineKeyframeControls)({
|
|
175
240
|
propStatus,
|
|
176
241
|
selected: selection.selected,
|
|
242
|
+
keyframable: (0, studio_shared_1.isSchemaFieldKeyframable)({
|
|
243
|
+
schema: field.effectSchema,
|
|
244
|
+
key: field.key,
|
|
245
|
+
}),
|
|
177
246
|
}) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus: propStatus, nodePath: nodePath, fileName: validatedLocation.source, keyframeDisplayOffset: keyframeDisplayOffset, defaultValue: field.fieldSchema.default, dragOverrideValue: dragOverrideValue, schema: field.effectSchema, effectIndex: field.effectIndex })) : null;
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
if (!propStatus || !propStatus.canUpdate) {
|
|
247
|
+
const canResetToDefault = (0, react_1.useMemo)(() => {
|
|
248
|
+
if (!propStatus || propStatus.status === 'computed') {
|
|
181
249
|
return false;
|
|
182
250
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
251
|
+
return isResettableStatus({
|
|
252
|
+
status: propStatus,
|
|
253
|
+
defaultValue: field.fieldSchema.default,
|
|
254
|
+
});
|
|
186
255
|
}, [field.fieldSchema.default, propStatus]);
|
|
187
256
|
const canPerformReset = previewServerState.type === 'connected' &&
|
|
188
257
|
propStatus !== null &&
|
|
189
|
-
propStatus.
|
|
258
|
+
propStatus.status !== 'computed';
|
|
259
|
+
const canShowReset = canPerformReset && field.fieldSchema.default !== undefined;
|
|
190
260
|
const onReset = (0, react_1.useCallback)(() => {
|
|
191
|
-
if (!
|
|
192
|
-
|
|
193
|
-
|
|
261
|
+
if (!canShowReset ||
|
|
262
|
+
!canResetToDefault ||
|
|
263
|
+
previewServerState.type !== 'connected') {
|
|
194
264
|
return;
|
|
195
265
|
}
|
|
196
266
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
@@ -208,12 +278,12 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
208
278
|
clientId: previewServerState.clientId,
|
|
209
279
|
});
|
|
210
280
|
}, [
|
|
211
|
-
|
|
281
|
+
canResetToDefault,
|
|
282
|
+
canShowReset,
|
|
212
283
|
field.effectIndex,
|
|
213
284
|
field.effectSchema,
|
|
214
285
|
field.fieldSchema.default,
|
|
215
286
|
field.key,
|
|
216
|
-
isNonDefault,
|
|
217
287
|
nodePath,
|
|
218
288
|
previewServerState,
|
|
219
289
|
setCodeValues,
|
|
@@ -227,14 +297,14 @@ const TimelineEffectPropItem = ({ field, validatedLocation, rowDepth, nodePath,
|
|
|
227
297
|
keyHint: null,
|
|
228
298
|
label: 'Reset',
|
|
229
299
|
leftItem: null,
|
|
230
|
-
disabled: !
|
|
300
|
+
disabled: !canShowReset,
|
|
231
301
|
onClick: onReset,
|
|
232
302
|
quickSwitcherLabel: null,
|
|
233
303
|
subMenu: null,
|
|
234
304
|
value: 'reset-effect-field',
|
|
235
305
|
},
|
|
236
306
|
];
|
|
237
|
-
}, [
|
|
307
|
+
}, [canShowReset, onReset]);
|
|
238
308
|
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: [
|
|
239
309
|
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 }) })
|
|
240
310
|
] }));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatusStatic } from 'remotion';
|
|
3
3
|
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
4
|
export declare const TimelineEnumField: React.FC<{
|
|
5
5
|
readonly field: SchemaFieldInfo;
|
|
6
|
-
readonly propStatus:
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
7
7
|
readonly effectiveValue: unknown;
|
|
8
8
|
readonly onSave: TimelineFieldOnSave;
|
|
9
9
|
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
@@ -15,7 +15,7 @@ const TimelineEnumField = ({ field, propStatus, effectiveValue, onSave, onDragVa
|
|
|
15
15
|
const variantKeys = Object.keys(fieldSchema.variants);
|
|
16
16
|
const current = String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : fieldSchema.default);
|
|
17
17
|
const onSelect = (0, react_1.useCallback)((newValue) => {
|
|
18
|
-
if (
|
|
18
|
+
if (newValue === propStatus.codeValue) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
onDragValueChange(newValue);
|
|
@@ -34,9 +34,9 @@ const TimelineEnumField = ({ field, propStatus, effectiveValue, onSave, onDragVa
|
|
|
34
34
|
leftItem: null,
|
|
35
35
|
subMenu: null,
|
|
36
36
|
quickSwitcherLabel: null,
|
|
37
|
-
disabled:
|
|
37
|
+
disabled: false,
|
|
38
38
|
}));
|
|
39
|
-
}, [variantKeys, onSelect
|
|
39
|
+
}, [variantKeys, onSelect]);
|
|
40
40
|
return (jsx_runtime_1.jsx(ComboBox_1.Combobox, { small: true, title: field.key, selectedId: current, values: items, style: comboboxStyle }));
|
|
41
41
|
};
|
|
42
42
|
exports.TimelineEnumField = TimelineEnumField;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { CanUpdateSequencePropStatus, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
|
|
3
|
-
export declare const shouldShowTimelineKeyframeControls: ({ propStatus, selected, }: {
|
|
2
|
+
import type { CanUpdateSequencePropStatus, DragOverrideValue, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
|
|
3
|
+
export declare const shouldShowTimelineKeyframeControls: ({ propStatus, selected, keyframable, }: {
|
|
4
4
|
propStatus: CanUpdateSequencePropStatus | null;
|
|
5
5
|
selected: boolean;
|
|
6
|
+
keyframable: boolean;
|
|
6
7
|
}) => boolean;
|
|
7
8
|
export declare const TimelineKeyframeControls: React.FC<{
|
|
8
9
|
readonly fieldKey: string;
|
|
@@ -11,7 +12,7 @@ export declare const TimelineKeyframeControls: React.FC<{
|
|
|
11
12
|
readonly fileName: string;
|
|
12
13
|
readonly keyframeDisplayOffset: number;
|
|
13
14
|
readonly defaultValue: unknown;
|
|
14
|
-
readonly dragOverrideValue:
|
|
15
|
+
readonly dragOverrideValue: DragOverrideValue | undefined;
|
|
15
16
|
readonly schema: SequenceSchema;
|
|
16
17
|
readonly effectIndex: number | null;
|
|
17
18
|
}>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineKeyframeControls = exports.shouldShowTimelineKeyframeControls = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const remotion_1 = require("remotion");
|
|
7
8
|
const client_id_1 = require("../../helpers/client-id");
|
|
@@ -15,7 +16,7 @@ const controlsContainerStyle = {
|
|
|
15
16
|
alignItems: 'center',
|
|
16
17
|
display: 'flex',
|
|
17
18
|
flexShrink: 0,
|
|
18
|
-
gap:
|
|
19
|
+
gap: 1,
|
|
19
20
|
marginRight: 4,
|
|
20
21
|
};
|
|
21
22
|
const navButtonStyle = {
|
|
@@ -26,48 +27,62 @@ const navButtonStyle = {
|
|
|
26
27
|
cursor: 'pointer',
|
|
27
28
|
display: 'flex',
|
|
28
29
|
flexShrink: 0,
|
|
29
|
-
|
|
30
|
-
height: 12,
|
|
30
|
+
height: 14,
|
|
31
31
|
justifyContent: 'center',
|
|
32
32
|
lineHeight: 1,
|
|
33
33
|
outline: 'none',
|
|
34
34
|
padding: 0,
|
|
35
35
|
userSelect: 'none',
|
|
36
|
-
width:
|
|
36
|
+
width: 14,
|
|
37
|
+
};
|
|
38
|
+
const isKeyframedStatus = (status) => {
|
|
39
|
+
return status.status === 'keyframed';
|
|
37
40
|
};
|
|
38
41
|
const diamondButtonStyle = {
|
|
39
42
|
...navButtonStyle,
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
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,
|
|
42
52
|
};
|
|
43
53
|
const svgStyle = { display: 'block' };
|
|
44
54
|
const getCurrentKeyframeValue = ({ propStatus, jsxFrame, defaultValue, dragOverrideValue, }) => {
|
|
45
|
-
if (propStatus
|
|
55
|
+
if (isKeyframedStatus(propStatus)) {
|
|
46
56
|
return remotion_1.Internals.getEffectiveVisualModeValue({
|
|
47
57
|
codeValue: propStatus,
|
|
48
58
|
dragOverrideValue,
|
|
59
|
+
frame: jsxFrame,
|
|
49
60
|
defaultValue,
|
|
50
61
|
shouldResortToDefaultValueIfUndefined: true,
|
|
51
62
|
});
|
|
52
63
|
}
|
|
53
|
-
if (propStatus.
|
|
54
|
-
return remotion_1.Internals.
|
|
64
|
+
if (propStatus.status === 'static') {
|
|
65
|
+
return remotion_1.Internals.getEffectiveVisualModeValue({
|
|
66
|
+
codeValue: propStatus,
|
|
67
|
+
dragOverrideValue,
|
|
55
68
|
frame: jsxFrame,
|
|
56
|
-
|
|
69
|
+
defaultValue,
|
|
70
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
57
71
|
});
|
|
58
72
|
}
|
|
59
73
|
return null;
|
|
60
74
|
};
|
|
61
|
-
const shouldShowTimelineKeyframeControls = ({ propStatus, selected, }) => {
|
|
75
|
+
const shouldShowTimelineKeyframeControls = ({ propStatus, selected, keyframable, }) => {
|
|
62
76
|
if (propStatus === null) {
|
|
63
77
|
return false;
|
|
64
78
|
}
|
|
79
|
+
if (!keyframable && !isKeyframedStatus(propStatus)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
65
82
|
if (selected) {
|
|
66
83
|
return true;
|
|
67
84
|
}
|
|
68
|
-
return
|
|
69
|
-
!propStatus.canUpdate &&
|
|
70
|
-
propStatus.reason === 'keyframed');
|
|
85
|
+
return TimelineSelection_1.SELECTION_ENABLED && isKeyframedStatus(propStatus);
|
|
71
86
|
};
|
|
72
87
|
exports.shouldShowTimelineKeyframeControls = shouldShowTimelineKeyframeControls;
|
|
73
88
|
const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, keyframeDisplayOffset, defaultValue, dragOverrideValue, schema, effectIndex, }) => {
|
|
@@ -82,14 +97,26 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
82
97
|
const jsxFrame = timelinePosition - keyframeDisplayOffset;
|
|
83
98
|
const keyframes = (0, react_1.useMemo)(() => (0, get_timeline_keyframes_1.getTimelineKeyframes)(propStatus, keyframeDisplayOffset), [propStatus, keyframeDisplayOffset]);
|
|
84
99
|
const hasKeyframeAtCurrentFrame = (0, react_1.useMemo)(() => {
|
|
85
|
-
if (propStatus
|
|
100
|
+
if (!isKeyframedStatus(propStatus)) {
|
|
86
101
|
return false;
|
|
87
102
|
}
|
|
88
103
|
return (0, get_keyframe_navigation_1.hasKeyframeAtSourceFrame)(propStatus.keyframes, jsxFrame);
|
|
89
104
|
}, [jsxFrame, propStatus]);
|
|
105
|
+
const currentKeyframeValue = (0, react_1.useMemo)(() => getCurrentKeyframeValue({
|
|
106
|
+
propStatus,
|
|
107
|
+
jsxFrame,
|
|
108
|
+
defaultValue,
|
|
109
|
+
dragOverrideValue,
|
|
110
|
+
}), [defaultValue, dragOverrideValue, jsxFrame, propStatus]);
|
|
90
111
|
const previousDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getPreviousKeyframeDisplayFrame)(keyframes, timelinePosition), [keyframes, timelinePosition]);
|
|
91
112
|
const nextDisplayFrame = (0, react_1.useMemo)(() => (0, get_keyframe_navigation_1.getNextKeyframeDisplayFrame)(keyframes, timelinePosition), [keyframes, timelinePosition]);
|
|
92
|
-
const
|
|
113
|
+
const keyframable = (0, studio_shared_1.isSchemaFieldKeyframable)({
|
|
114
|
+
schema,
|
|
115
|
+
key: fieldKey,
|
|
116
|
+
});
|
|
117
|
+
const canAddKeyframe = keyframable;
|
|
118
|
+
const canToggleKeyframe = propStatus.status !== 'computed' &&
|
|
119
|
+
(hasKeyframeAtCurrentFrame || canAddKeyframe);
|
|
93
120
|
const seekToDisplayFrame = (0, react_1.useCallback)((frame) => {
|
|
94
121
|
setFrame((current) => {
|
|
95
122
|
const next = { ...current, [videoConfig.id]: frame };
|
|
@@ -114,9 +141,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
114
141
|
if (!clientId || !canToggleKeyframe) {
|
|
115
142
|
return;
|
|
116
143
|
}
|
|
117
|
-
if (hasKeyframeAtCurrentFrame &&
|
|
118
|
-
!propStatus.canUpdate &&
|
|
119
|
-
propStatus.reason === 'keyframed') {
|
|
144
|
+
if (hasKeyframeAtCurrentFrame && isKeyframedStatus(propStatus)) {
|
|
120
145
|
if (effectIndex === null) {
|
|
121
146
|
await (0, call_delete_keyframe_1.callDeleteSequenceKeyframe)({
|
|
122
147
|
fileName,
|
|
@@ -141,12 +166,7 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
141
166
|
});
|
|
142
167
|
return;
|
|
143
168
|
}
|
|
144
|
-
const value =
|
|
145
|
-
propStatus,
|
|
146
|
-
jsxFrame,
|
|
147
|
-
defaultValue,
|
|
148
|
-
dragOverrideValue,
|
|
149
|
-
});
|
|
169
|
+
const value = currentKeyframeValue;
|
|
150
170
|
if (value === null) {
|
|
151
171
|
return;
|
|
152
172
|
}
|
|
@@ -177,12 +197,11 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
177
197
|
}, [
|
|
178
198
|
canToggleKeyframe,
|
|
179
199
|
clientId,
|
|
180
|
-
defaultValue,
|
|
181
|
-
dragOverrideValue,
|
|
182
200
|
effectIndex,
|
|
183
201
|
fieldKey,
|
|
184
202
|
fileName,
|
|
185
203
|
hasKeyframeAtCurrentFrame,
|
|
204
|
+
currentKeyframeValue,
|
|
186
205
|
jsxFrame,
|
|
187
206
|
nodePath,
|
|
188
207
|
propStatus,
|
|
@@ -203,15 +222,15 @@ const TimelineKeyframeControls = ({ fieldKey, propStatus, nodePath, fileName, ke
|
|
|
203
222
|
}), [nextDisabled]);
|
|
204
223
|
const diamondStyle = (0, react_1.useMemo)(() => ({
|
|
205
224
|
...diamondButtonStyle,
|
|
206
|
-
backgroundColor: hasKeyframeAtCurrentFrame ? colors_1.BLUE : colors_1.LIGHT_TEXT,
|
|
207
|
-
borderRadius: 1,
|
|
208
|
-
boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.4)',
|
|
209
225
|
cursor: canToggleKeyframe && clientId ? 'pointer' : 'default',
|
|
210
226
|
opacity: canToggleKeyframe && clientId ? 1 : 0.35,
|
|
211
|
-
|
|
212
|
-
|
|
227
|
+
}), [canToggleKeyframe, clientId]);
|
|
228
|
+
const diamondIcon = (0, react_1.useMemo)(() => ({
|
|
229
|
+
...diamondIconStyle,
|
|
230
|
+
backgroundColor: hasKeyframeAtCurrentFrame ? colors_1.BLUE : colors_1.LIGHT_TEXT,
|
|
231
|
+
}), [hasKeyframeAtCurrentFrame]);
|
|
213
232
|
return (jsx_runtime_1.jsxs("div", { style: controlsContainerStyle, children: [
|
|
214
|
-
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: "
|
|
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("span", { style: diamondIcon }) }), 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" }) }) })
|
|
215
234
|
] }));
|
|
216
235
|
};
|
|
217
236
|
exports.TimelineKeyframeControls = TimelineKeyframeControls;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { CanUpdateSequencePropStatusKeyframed } from 'remotion';
|
|
3
|
-
import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
2
|
+
import type { CanUpdateSequencePropStatusKeyframed, DragOverrideValue, SequencePropsSubscriptionKey } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange } from '../../helpers/timeline-layout';
|
|
4
4
|
export declare const TimelineKeyframedValue: React.FC<{
|
|
5
5
|
readonly field: SchemaFieldInfo;
|
|
6
6
|
readonly propStatus: CanUpdateSequencePropStatusKeyframed;
|
|
7
7
|
readonly keyframeDisplayOffset: number;
|
|
8
|
+
readonly dragOverrideValue: DragOverrideValue | undefined;
|
|
9
|
+
readonly onSave: (value: unknown, sourceFrame: number) => Promise<void>;
|
|
10
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
11
|
+
readonly onDragEnd: () => void;
|
|
12
|
+
readonly scaleLockNodePath: SequencePropsSubscriptionKey;
|
|
8
13
|
}>;
|
|
@@ -5,13 +5,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
pointerEvents: 'none',
|
|
8
|
+
const valuesEqual = (left, right) => {
|
|
9
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
11
10
|
};
|
|
12
|
-
const
|
|
13
|
-
const noopAsync = () => Promise.resolve();
|
|
14
|
-
const TimelineKeyframedValue = ({ field, propStatus, keyframeDisplayOffset }) => {
|
|
11
|
+
const TimelineKeyframedValue = ({ field, propStatus, keyframeDisplayOffset, dragOverrideValue, onSave, onDragValueChange, onDragEnd, scaleLockNodePath, }) => {
|
|
15
12
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
16
13
|
const jsxFrame = timelinePosition - keyframeDisplayOffset;
|
|
17
14
|
const computedValue = (0, react_1.useMemo)(() => {
|
|
@@ -25,12 +22,29 @@ const TimelineKeyframedValue = ({ field, propStatus, keyframeDisplayOffset }) =>
|
|
|
25
22
|
return raw;
|
|
26
23
|
}, [jsxFrame, propStatus]);
|
|
27
24
|
const fakeStatus = (0, react_1.useMemo)(() => ({
|
|
28
|
-
|
|
25
|
+
status: 'static',
|
|
29
26
|
codeValue: computedValue,
|
|
30
27
|
}), [computedValue]);
|
|
28
|
+
const effectiveValue = (0, react_1.useMemo)(() => {
|
|
29
|
+
return remotion_1.Internals.getEffectiveVisualModeValue({
|
|
30
|
+
codeValue: fakeStatus,
|
|
31
|
+
dragOverrideValue,
|
|
32
|
+
frame: jsxFrame,
|
|
33
|
+
defaultValue: field.fieldSchema.default,
|
|
34
|
+
shouldResortToDefaultValueIfUndefined: true,
|
|
35
|
+
});
|
|
36
|
+
}, [dragOverrideValue, fakeStatus, field.fieldSchema.default, jsxFrame]);
|
|
37
|
+
const onSaveIfChanged = (0, react_1.useCallback)((value) => {
|
|
38
|
+
const existingKeyframe = propStatus.keyframes.find((keyframe) => keyframe.frame === jsxFrame);
|
|
39
|
+
if (valuesEqual(value, computedValue) ||
|
|
40
|
+
(existingKeyframe && valuesEqual(value, existingKeyframe.value))) {
|
|
41
|
+
return Promise.resolve();
|
|
42
|
+
}
|
|
43
|
+
return onSave(value, jsxFrame);
|
|
44
|
+
}, [computedValue, jsxFrame, onSave, propStatus.keyframes]);
|
|
31
45
|
if (computedValue === null) {
|
|
32
46
|
return null;
|
|
33
47
|
}
|
|
34
|
-
return (jsx_runtime_1.jsx(
|
|
48
|
+
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: fakeStatus, effectiveValue: effectiveValue, onSave: onSaveIfChanged, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, scaleLockNodePath: scaleLockNodePath }));
|
|
35
49
|
};
|
|
36
50
|
exports.TimelineKeyframedValue = TimelineKeyframedValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimelineLayerEyeSpacer = exports.TimelineLayerEye = void 0;
|
|
3
|
+
exports.TimelineLayerEyeSpacer = exports.TimelineLayerEye = exports.timelineLayerIconContainer = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../../helpers/colors");
|
|
@@ -18,7 +18,7 @@ const speakerIcon = {
|
|
|
18
18
|
height: 10,
|
|
19
19
|
marginLeft: -1,
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
exports.timelineLayerIconContainer = {
|
|
22
22
|
height: 16,
|
|
23
23
|
width: 16,
|
|
24
24
|
borderRadius: 2,
|
|
@@ -47,6 +47,7 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
|
|
|
47
47
|
if (e.button !== 0) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
+
e.preventDefault();
|
|
50
51
|
e.stopPropagation();
|
|
51
52
|
layerPointedDown = hidden ? 'enable' : 'disable';
|
|
52
53
|
onInvoked(layerPointedDown);
|
|
@@ -54,12 +55,16 @@ const TimelineLayerEye = ({ onInvoked, hidden, type }) => {
|
|
|
54
55
|
layerPointedDown = null;
|
|
55
56
|
}, { once: true });
|
|
56
57
|
}, [hidden, onInvoked]);
|
|
58
|
+
const onDragStart = (0, react_1.useCallback)((e) => {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
}, []);
|
|
57
62
|
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
58
63
|
if (layerPointedDown) {
|
|
59
64
|
onInvoked(layerPointedDown);
|
|
60
65
|
}
|
|
61
66
|
}, [onInvoked]);
|
|
62
|
-
return (jsx_runtime_1.jsx("div", { style:
|
|
67
|
+
return (jsx_runtime_1.jsx("div", { style: exports.timelineLayerIconContainer, draggable: false, onDragStart: onDragStart, onPointerEnter: onPointerEnter, onPointerDown: onPointerDown, children: renderAction(colors_1.LIGHT_COLOR) }));
|
|
63
68
|
};
|
|
64
69
|
exports.TimelineLayerEye = TimelineLayerEye;
|
|
65
70
|
const spacerStyle = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatusStatic } from 'remotion';
|
|
3
3
|
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
4
|
export declare const TimelineNumberField: React.FC<{
|
|
5
5
|
readonly field: SchemaFieldInfo;
|
|
6
6
|
readonly effectiveValue: unknown;
|
|
7
|
-
readonly propStatus:
|
|
7
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
8
8
|
readonly onSave: TimelineFieldOnSave;
|
|
9
9
|
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
10
10
|
readonly onDragEnd: () => void;
|
|
@@ -13,7 +13,7 @@ const TimelineNumberField = ({ field, effectiveValue, onSave, onDragValueChange,
|
|
|
13
13
|
onDragValueChange(newVal);
|
|
14
14
|
}, [onDragValueChange]);
|
|
15
15
|
const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
16
|
-
if (
|
|
16
|
+
if (newVal !== propStatus.codeValue) {
|
|
17
17
|
onSave(newVal).finally(() => {
|
|
18
18
|
setDragValue(null);
|
|
19
19
|
onDragEnd();
|
|
@@ -25,16 +25,12 @@ const TimelineNumberField = ({ field, effectiveValue, onSave, onDragValueChange,
|
|
|
25
25
|
}
|
|
26
26
|
}, [onSave, propStatus, onDragEnd]);
|
|
27
27
|
const onTextChange = (0, react_1.useCallback)((newVal) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onSave(parsed).finally(() => {
|
|
35
|
-
setDragValue(null);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
28
|
+
const parsed = Number(newVal);
|
|
29
|
+
if (!Number.isNaN(parsed) && parsed !== propStatus.codeValue) {
|
|
30
|
+
setDragValue(parsed);
|
|
31
|
+
onSave(parsed).finally(() => {
|
|
32
|
+
setDragValue(null);
|
|
33
|
+
});
|
|
38
34
|
}
|
|
39
35
|
}, [onSave, propStatus]);
|
|
40
36
|
const step = field.fieldSchema.type === 'number' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ArrayFieldSchema, CanUpdateSequencePropStatusStatic, SequencePropsSubscriptionKey, VisibleFieldSchema } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
|
+
export type TimelinePrimitiveFieldInfo = Omit<SchemaFieldInfo, 'fieldSchema' | 'typeName'> & {
|
|
5
|
+
readonly fieldSchema: Exclude<VisibleFieldSchema, ArrayFieldSchema>;
|
|
6
|
+
readonly typeName: Exclude<VisibleFieldSchema['type'], 'array'>;
|
|
7
|
+
};
|
|
8
|
+
export declare const isTimelinePrimitiveFieldInfo: (field: SchemaFieldInfo) => field is TimelinePrimitiveFieldInfo;
|
|
9
|
+
export declare const TimelinePrimitiveFieldValue: React.FC<{
|
|
10
|
+
readonly field: TimelinePrimitiveFieldInfo;
|
|
11
|
+
readonly onSave: TimelineFieldOnSave;
|
|
12
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
13
|
+
readonly onDragEnd: () => void;
|
|
14
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
15
|
+
readonly effectiveValue: unknown;
|
|
16
|
+
readonly scaleLockNodePath: SequencePropsSubscriptionKey | null;
|
|
17
|
+
}>;
|