@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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelinePrimitiveFieldValue = exports.isTimelinePrimitiveFieldInfo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const TimelineBooleanField_1 = require("./TimelineBooleanField");
|
|
6
|
+
const TimelineColorField_1 = require("./TimelineColorField");
|
|
7
|
+
const TimelineEnumField_1 = require("./TimelineEnumField");
|
|
8
|
+
const TimelineNumberField_1 = require("./TimelineNumberField");
|
|
9
|
+
const TimelineRotationField_1 = require("./TimelineRotationField");
|
|
10
|
+
const TimelineScaleField_1 = require("./TimelineScaleField");
|
|
11
|
+
const TimelineTranslateField_1 = require("./TimelineTranslateField");
|
|
12
|
+
const TimelineUvCoordinateField_1 = require("./TimelineUvCoordinateField");
|
|
13
|
+
const inlineWrapper = {
|
|
14
|
+
fontSize: 12,
|
|
15
|
+
};
|
|
16
|
+
const isTimelinePrimitiveFieldInfo = (field) => {
|
|
17
|
+
return (field.typeName !== 'array' &&
|
|
18
|
+
field.typeName !== 'hidden' &&
|
|
19
|
+
field.fieldSchema.type !== 'array');
|
|
20
|
+
};
|
|
21
|
+
exports.isTimelinePrimitiveFieldInfo = isTimelinePrimitiveFieldInfo;
|
|
22
|
+
const TimelinePrimitiveFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, effectiveValue, scaleLockNodePath, }) => {
|
|
23
|
+
if (field.typeName === 'number') {
|
|
24
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
|
|
25
|
+
}
|
|
26
|
+
if (field.typeName === 'rotation-css' ||
|
|
27
|
+
field.typeName === 'rotation-degrees') {
|
|
28
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineRotationField_1.TimelineRotationField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
|
|
29
|
+
}
|
|
30
|
+
if (field.typeName === 'translate') {
|
|
31
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineTranslateField_1.TimelineTranslateField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
|
|
32
|
+
}
|
|
33
|
+
if (field.typeName === 'scale') {
|
|
34
|
+
if (scaleLockNodePath === null) {
|
|
35
|
+
throw new Error('Expected scale lock node path for scale field');
|
|
36
|
+
}
|
|
37
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineScaleField_1.TimelineScaleField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus, scaleLockNodePath: scaleLockNodePath }) }));
|
|
38
|
+
}
|
|
39
|
+
if (field.typeName === 'uv-coordinate') {
|
|
40
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineUvCoordinateField_1.TimelineUvCoordinateField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
|
|
41
|
+
}
|
|
42
|
+
if (field.typeName === 'boolean') {
|
|
43
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { effectiveValue: effectiveValue, field: field, onSave: onSave, propStatus: propStatus }) }));
|
|
44
|
+
}
|
|
45
|
+
if (field.typeName === 'color') {
|
|
46
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineColorField_1.TimelineColorField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
|
|
47
|
+
}
|
|
48
|
+
if (field.typeName === 'enum') {
|
|
49
|
+
return (jsx_runtime_1.jsx("span", { style: inlineWrapper, children: jsx_runtime_1.jsx(TimelineEnumField_1.TimelineEnumField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Unsupported field type: ${field.typeName}`);
|
|
52
|
+
};
|
|
53
|
+
exports.TimelinePrimitiveFieldValue = TimelinePrimitiveFieldValue;
|
|
@@ -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 TimelineRotationField: 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;
|
|
@@ -15,28 +15,38 @@ const unitToDegrees = {
|
|
|
15
15
|
const parseCssRotationToDegrees = (value) => {
|
|
16
16
|
const match = value.trim().match(unitPattern);
|
|
17
17
|
if (match) {
|
|
18
|
-
return Number(match[1]) * unitToDegrees[match[2]];
|
|
18
|
+
return (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(match[1]) * unitToDegrees[match[2]]);
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
21
|
const m = new DOMMatrix(`rotate(${value})`);
|
|
22
|
-
return
|
|
22
|
+
return (0, timeline_field_utils_1.normalizeTimelineNumber)(Math.atan2(m.b, m.a) * (180 / Math.PI));
|
|
23
23
|
}
|
|
24
24
|
catch (_a) {
|
|
25
25
|
return 0;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
|
|
29
|
-
var _a;
|
|
29
|
+
var _a, _b, _c;
|
|
30
30
|
const [dragValue, setDragValue] = (0, react_1.useState)(null);
|
|
31
|
-
const
|
|
31
|
+
const isCssRotation = field.fieldSchema.type === 'rotation-css';
|
|
32
|
+
const degrees = (0, react_1.useMemo)(() => {
|
|
33
|
+
if (isCssRotation) {
|
|
34
|
+
return parseCssRotationToDegrees(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0deg'));
|
|
35
|
+
}
|
|
36
|
+
return typeof effectiveValue === 'number' ? effectiveValue : 0;
|
|
37
|
+
}, [effectiveValue, isCssRotation]);
|
|
38
|
+
const serializeValue = (0, react_1.useCallback)((value) => {
|
|
39
|
+
const normalized = (0, timeline_field_utils_1.normalizeTimelineNumber)(value);
|
|
40
|
+
return isCssRotation ? `${normalized}deg` : normalized;
|
|
41
|
+
}, [isCssRotation]);
|
|
32
42
|
const onValueChange = (0, react_1.useCallback)((newVal) => {
|
|
33
43
|
setDragValue(newVal);
|
|
34
|
-
onDragValueChange(
|
|
35
|
-
}, [onDragValueChange]);
|
|
44
|
+
onDragValueChange(serializeValue(newVal));
|
|
45
|
+
}, [onDragValueChange, serializeValue]);
|
|
36
46
|
const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
onSave(
|
|
47
|
+
const newValue = serializeValue(newVal);
|
|
48
|
+
if (newValue !== propStatus.codeValue) {
|
|
49
|
+
onSave(newValue).finally(() => {
|
|
40
50
|
setDragValue(null);
|
|
41
51
|
onDragEnd();
|
|
42
52
|
});
|
|
@@ -45,29 +55,36 @@ const TimelineRotationField = ({ field, effectiveValue, propStatus, onSave, onDr
|
|
|
45
55
|
setDragValue(null);
|
|
46
56
|
onDragEnd();
|
|
47
57
|
}
|
|
48
|
-
}, [propStatus, onSave, onDragEnd]);
|
|
58
|
+
}, [propStatus, onSave, onDragEnd, serializeValue]);
|
|
49
59
|
const onTextChange = (0, react_1.useCallback)((newVal) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
+
const parsed = Number(newVal);
|
|
61
|
+
if (!Number.isNaN(parsed)) {
|
|
62
|
+
const newValue = serializeValue(parsed);
|
|
63
|
+
if (newValue !== propStatus.codeValue) {
|
|
64
|
+
setDragValue(parsed);
|
|
65
|
+
onSave(newValue).finally(() => {
|
|
66
|
+
setDragValue(null);
|
|
67
|
+
});
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
}, [propStatus, onSave]);
|
|
63
|
-
const step = field.fieldSchema.type === 'rotation'
|
|
70
|
+
}, [propStatus, onSave, serializeValue]);
|
|
71
|
+
const step = field.fieldSchema.type === 'rotation-css' ||
|
|
72
|
+
field.fieldSchema.type === 'rotation-degrees'
|
|
73
|
+
? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1)
|
|
74
|
+
: 1;
|
|
75
|
+
const min = field.fieldSchema.type === 'rotation-degrees'
|
|
76
|
+
? ((_b = field.fieldSchema.min) !== null && _b !== void 0 ? _b : -Infinity)
|
|
77
|
+
: -Infinity;
|
|
78
|
+
const max = field.fieldSchema.type === 'rotation-degrees'
|
|
79
|
+
? ((_c = field.fieldSchema.max) !== null && _c !== void 0 ? _c : Infinity)
|
|
80
|
+
: Infinity;
|
|
64
81
|
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
65
82
|
const formatter = (0, react_1.useCallback)((v) => {
|
|
66
|
-
const num = Number(v);
|
|
83
|
+
const num = (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(v));
|
|
67
84
|
const digits = Math.max(stepDecimals, (0, timeline_field_utils_1.getDecimalPlaces)(num));
|
|
68
85
|
const formatted = digits === 0 ? String(num) : num.toFixed(digits);
|
|
69
86
|
return `${formatted}\u00B0`;
|
|
70
87
|
}, [stepDecimals]);
|
|
71
|
-
return (jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragValue !== null && dragValue !== void 0 ? dragValue : degrees, style: timeline_field_utils_1.draggerStyle, status: "ok", small: true, onValueChange: onValueChange, onValueChangeEnd: onValueChangeEnd, onTextChange: onTextChange, min:
|
|
88
|
+
return (jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragValue !== null && dragValue !== void 0 ? dragValue : degrees, style: timeline_field_utils_1.draggerStyle, status: "ok", small: true, onValueChange: onValueChange, onValueChangeEnd: onValueChangeEnd, onTextChange: onTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false }));
|
|
72
89
|
};
|
|
73
90
|
exports.TimelineRotationField = TimelineRotationField;
|
|
@@ -13,5 +13,8 @@ export declare const TimelineRowChrome: React.FC<{
|
|
|
13
13
|
readonly showSelectedBackground: boolean;
|
|
14
14
|
readonly containsSelection: boolean;
|
|
15
15
|
readonly outerHeight: number | null;
|
|
16
|
+
readonly onDragLeave?: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
17
|
+
readonly onDragOver?: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
18
|
+
readonly onDrop?: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
16
19
|
readonly onDoubleClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
17
20
|
}>;
|
|
@@ -17,23 +17,25 @@ const leftChromeStyle = {
|
|
|
17
17
|
display: 'flex',
|
|
18
18
|
flexShrink: 0,
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const keyframeControlsColumnBaseStyle = {
|
|
21
21
|
alignItems: 'center',
|
|
22
22
|
display: 'flex',
|
|
23
23
|
flexShrink: 0,
|
|
24
24
|
justifyContent: 'flex-start',
|
|
25
|
-
marginRight: -(timeline_row_layout_1.TIMELINE_KEYFRAME_CONTROLS_WIDTH - timeline_row_layout_1.TIMELINE_ROW_BASE_PADDING),
|
|
26
|
-
width: timeline_row_layout_1.TIMELINE_KEYFRAME_CONTROLS_WIDTH,
|
|
27
25
|
};
|
|
28
|
-
const TimelineRowChrome = ({ depth, eye, keyframeControls, arrow, children, style, selected, selectable, onSelect, showSelectedBackground, containsSelection, outerHeight, onDoubleClick, }) => {
|
|
26
|
+
const TimelineRowChrome = ({ depth, eye, keyframeControls, arrow, children, style, selected, selectable, onSelect, showSelectedBackground, containsSelection, outerHeight, onDragLeave, onDragOver, onDrop, onDoubleClick, }) => {
|
|
29
27
|
const indentWidth = (0, timeline_row_layout_1.getTimelineRowIndentWidth)(depth);
|
|
28
|
+
const keyframeControlsColumnStyle = (0, react_1.useMemo)(() => ({
|
|
29
|
+
...keyframeControlsColumnBaseStyle,
|
|
30
|
+
width: (0, timeline_row_layout_1.getTimelineRowLeftChromeWidth)(depth),
|
|
31
|
+
}), [depth]);
|
|
30
32
|
const chromeColumnStyle = (0, react_1.useMemo)(() => ({
|
|
31
33
|
alignItems: 'center',
|
|
32
34
|
alignSelf: 'stretch',
|
|
33
35
|
display: 'flex',
|
|
34
36
|
flexShrink: 0,
|
|
35
|
-
paddingLeft:
|
|
36
|
-
}), [
|
|
37
|
+
paddingLeft: timeline_row_layout_1.TIMELINE_ROW_BASE_PADDING,
|
|
38
|
+
}), []);
|
|
37
39
|
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
38
40
|
if (e.button === 0) {
|
|
39
41
|
e.stopPropagation();
|
|
@@ -69,11 +71,10 @@ const TimelineRowChrome = ({ depth, eye, keyframeControls, arrow, children, styl
|
|
|
69
71
|
};
|
|
70
72
|
}, [outerHeight, highlightBackground]);
|
|
71
73
|
const chrome = (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
72
|
-
jsx_runtime_1.
|
|
73
|
-
] }), children] }));
|
|
74
|
+
jsx_runtime_1.jsx("div", { style: leftChromeStyle, children: keyframeControls ? (jsx_runtime_1.jsx("div", { style: keyframeControlsColumnStyle, children: keyframeControls })) : (jsx_runtime_1.jsxs("div", { style: chromeColumnStyle, children: [eye, indentWidth > 0 ? jsx_runtime_1.jsx(Padder_1.Padder, { depth: depth }) : null, arrow] })) }), children] }));
|
|
74
75
|
if (outerStyle) {
|
|
75
|
-
return (jsx_runtime_1.jsx("div", { style: outerStyle, onPointerDown: selectable ? onPointerDown : undefined, onContextMenu: selectable ? onContextMenu : undefined, onDoubleClick: onDoubleClick, children: jsx_runtime_1.jsx("div", { style: innerRowStyle, children: chrome }) }));
|
|
76
|
+
return (jsx_runtime_1.jsx("div", { style: outerStyle, onDragLeave: onDragLeave, onDragOver: onDragOver, onDrop: onDrop, onPointerDown: selectable ? onPointerDown : undefined, onContextMenu: selectable ? onContextMenu : undefined, onDoubleClick: onDoubleClick, children: jsx_runtime_1.jsx("div", { style: innerRowStyle, children: chrome }) }));
|
|
76
77
|
}
|
|
77
|
-
return (jsx_runtime_1.jsx("div", { onPointerDown: selectable ? onPointerDown : undefined, onContextMenu: selectable ? onContextMenu : undefined, onDoubleClick: onDoubleClick, style: innerRowStyle, children: chrome }));
|
|
78
|
+
return (jsx_runtime_1.jsx("div", { onDragLeave: onDragLeave, onDragOver: onDragOver, onDrop: onDrop, onPointerDown: selectable ? onPointerDown : undefined, onContextMenu: selectable ? onContextMenu : undefined, onDoubleClick: onDoubleClick, style: innerRowStyle, children: chrome }));
|
|
78
79
|
};
|
|
79
80
|
exports.TimelineRowChrome = TimelineRowChrome;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CanUpdateSequencePropStatusStatic, SequencePropsSubscriptionKey } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
|
+
export declare const getLinkedScale: ({ axis, newValue, baseX, baseY, min, max, }: {
|
|
5
|
+
readonly axis: "x" | "y";
|
|
6
|
+
readonly newValue: number;
|
|
7
|
+
readonly baseX: number;
|
|
8
|
+
readonly baseY: number;
|
|
9
|
+
readonly min: number;
|
|
10
|
+
readonly max: number;
|
|
11
|
+
}) => [number, number];
|
|
12
|
+
export declare const TimelineScaleField: React.FC<{
|
|
13
|
+
readonly field: SchemaFieldInfo;
|
|
14
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
15
|
+
readonly effectiveValue: unknown;
|
|
16
|
+
readonly onSave: TimelineFieldOnSave;
|
|
17
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
18
|
+
readonly onDragEnd: () => void;
|
|
19
|
+
readonly scaleLockNodePath: SequencePropsSubscriptionKey;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineScaleField = exports.getLinkedScale = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const no_react_1 = require("remotion/no-react");
|
|
7
|
+
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const scale_lock_1 = require("../../state/scale-lock");
|
|
9
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
10
|
+
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
11
|
+
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
12
|
+
const leftDraggerStyle = {
|
|
13
|
+
paddingLeft: 0,
|
|
14
|
+
};
|
|
15
|
+
const rightDraggerStyle = {
|
|
16
|
+
paddingRight: 0,
|
|
17
|
+
};
|
|
18
|
+
const containerStyle = {
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
gap: 4,
|
|
22
|
+
};
|
|
23
|
+
const toggleStyle = {
|
|
24
|
+
...TimelineLayerEye_1.timelineLayerIconContainer,
|
|
25
|
+
border: 'none',
|
|
26
|
+
color: colors_1.LIGHT_COLOR,
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
marginRight: 0,
|
|
29
|
+
padding: 0,
|
|
30
|
+
};
|
|
31
|
+
const linkIconStyle = {
|
|
32
|
+
width: 14,
|
|
33
|
+
height: 14,
|
|
34
|
+
pointerEvents: 'none',
|
|
35
|
+
};
|
|
36
|
+
const gapStyle = {
|
|
37
|
+
marginLeft: -6,
|
|
38
|
+
marginRight: -6,
|
|
39
|
+
};
|
|
40
|
+
const clamp = (value, min, max) => {
|
|
41
|
+
return Math.min(max, Math.max(min, value));
|
|
42
|
+
};
|
|
43
|
+
const getLinkedScale = ({ axis, newValue, baseX, baseY, min, max, }) => {
|
|
44
|
+
const drivingBase = axis === 'x' ? baseX : baseY;
|
|
45
|
+
const linkedBase = axis === 'x' ? baseY : baseX;
|
|
46
|
+
if (drivingBase === 0 || linkedBase === 0) {
|
|
47
|
+
const clamped = (0, timeline_field_utils_1.normalizeTimelineNumber)(clamp(newValue, min, max));
|
|
48
|
+
return [clamped, clamped];
|
|
49
|
+
}
|
|
50
|
+
let factor = newValue / drivingBase;
|
|
51
|
+
let driving = newValue;
|
|
52
|
+
let linked = linkedBase * factor;
|
|
53
|
+
const clampedLinked = clamp(linked, min, max);
|
|
54
|
+
if (clampedLinked !== linked) {
|
|
55
|
+
factor = clampedLinked / linkedBase;
|
|
56
|
+
linked = clampedLinked;
|
|
57
|
+
driving = drivingBase * factor;
|
|
58
|
+
}
|
|
59
|
+
const clampedDriving = clamp(driving, min, max);
|
|
60
|
+
const normalizedDriving = (0, timeline_field_utils_1.normalizeTimelineNumber)(clampedDriving);
|
|
61
|
+
const normalizedLinked = (0, timeline_field_utils_1.normalizeTimelineNumber)(linked);
|
|
62
|
+
return axis === 'x'
|
|
63
|
+
? [normalizedDriving, normalizedLinked]
|
|
64
|
+
: [normalizedLinked, normalizedDriving];
|
|
65
|
+
};
|
|
66
|
+
exports.getLinkedScale = getLinkedScale;
|
|
67
|
+
const valuesEqual = (left, right) => {
|
|
68
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
69
|
+
};
|
|
70
|
+
const LinkToggle = ({ linked, onToggle }) => {
|
|
71
|
+
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
72
|
+
if (e.button !== 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
onToggle();
|
|
77
|
+
}, [onToggle]);
|
|
78
|
+
return (jsx_runtime_1.jsx("button", { type: "button", style: toggleStyle, onPointerDown: onPointerDown, title: linked ? 'Unlink scale axes' : 'Link scale axes', "aria-label": linked ? 'Unlink scale axes' : 'Link scale axes', children: linked ? (jsx_runtime_1.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 640 640", style: linkIconStyle, children: jsx_runtime_1.jsx("path", { fill: "currentcolor", d: "M32 320C32 214 118 128 224 128L288 128L288 192L224 192C153.3 192 96 249.3 96 320C96 390.7 153.3 448 224 448L288 448L288 512L224 512C118 512 32 426 32 320zM608 320C608 426 522 512 416 512L352 512L352 448L416 448C486.7 448 544 390.7 544 320C544 249.3 486.7 192 416 192L352 192L352 128L416 128C522 128 608 214 608 320zM224 288L448 288L448 352L192 352L192 288L224 288z" }) })) : null }));
|
|
79
|
+
};
|
|
80
|
+
const TimelineScaleField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, scaleLockNodePath, }) => {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
83
|
+
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
84
|
+
const dragStartRef = (0, react_1.useRef)(null);
|
|
85
|
+
const { getScaleLockState, setScaleLockState } = (0, react_1.useContext)(scale_lock_1.ScaleLockContext);
|
|
86
|
+
const [codeX, codeY, codeZ] = (0, react_1.useMemo)(() => no_react_1.NoReactInternals.parseScaleValue(effectiveValue), [effectiveValue]);
|
|
87
|
+
const defaultLinked = codeX === codeY;
|
|
88
|
+
const linked = getScaleLockState({
|
|
89
|
+
nodePath: scaleLockNodePath,
|
|
90
|
+
fieldKey: field.key,
|
|
91
|
+
defaultValue: defaultLinked,
|
|
92
|
+
});
|
|
93
|
+
const step = field.fieldSchema.type === 'scale'
|
|
94
|
+
? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 0.01)
|
|
95
|
+
: 0.01;
|
|
96
|
+
const min = field.fieldSchema.type === 'scale'
|
|
97
|
+
? ((_b = field.fieldSchema.min) !== null && _b !== void 0 ? _b : -Infinity)
|
|
98
|
+
: -Infinity;
|
|
99
|
+
const max = field.fieldSchema.type === 'scale'
|
|
100
|
+
? ((_c = field.fieldSchema.max) !== null && _c !== void 0 ? _c : Infinity)
|
|
101
|
+
: Infinity;
|
|
102
|
+
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
103
|
+
const formatter = (0, react_1.useCallback)((v) => {
|
|
104
|
+
const num = Number(v);
|
|
105
|
+
const digits = Math.max(stepDecimals, (0, timeline_field_utils_1.getDecimalPlaces)(num));
|
|
106
|
+
return digits === 0 ? String(num) : num.toFixed(digits);
|
|
107
|
+
}, [stepDecimals]);
|
|
108
|
+
const getDragStart = (0, react_1.useCallback)(() => {
|
|
109
|
+
if (dragStartRef.current === null) {
|
|
110
|
+
dragStartRef.current = [dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY];
|
|
111
|
+
}
|
|
112
|
+
return dragStartRef.current;
|
|
113
|
+
}, [codeX, codeY, dragX, dragY]);
|
|
114
|
+
const serialize = (0, react_1.useCallback)((x, y) => {
|
|
115
|
+
return no_react_1.NoReactInternals.serializeScaleValue([x, y, codeZ]);
|
|
116
|
+
}, [codeZ]);
|
|
117
|
+
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
118
|
+
if (linked) {
|
|
119
|
+
const [baseX, baseY] = getDragStart();
|
|
120
|
+
const [newX, newY] = (0, exports.getLinkedScale)({
|
|
121
|
+
axis: 'x',
|
|
122
|
+
newValue: newVal,
|
|
123
|
+
baseX,
|
|
124
|
+
baseY,
|
|
125
|
+
min,
|
|
126
|
+
max,
|
|
127
|
+
});
|
|
128
|
+
setDragX(newX);
|
|
129
|
+
setDragY(newY);
|
|
130
|
+
onDragValueChange(serialize(newX, newY));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
setDragX(newVal);
|
|
134
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
135
|
+
onDragValueChange(serialize(newVal, currentY));
|
|
136
|
+
}, [
|
|
137
|
+
codeY,
|
|
138
|
+
dragY,
|
|
139
|
+
getDragStart,
|
|
140
|
+
linked,
|
|
141
|
+
max,
|
|
142
|
+
min,
|
|
143
|
+
onDragValueChange,
|
|
144
|
+
serialize,
|
|
145
|
+
]);
|
|
146
|
+
const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
var _c, _d;
|
|
149
|
+
const [newX, newY] = linked
|
|
150
|
+
? (0, exports.getLinkedScale)({
|
|
151
|
+
axis: 'x',
|
|
152
|
+
newValue: newVal,
|
|
153
|
+
baseX: (_c = (_a = dragStartRef.current) === null || _a === void 0 ? void 0 : _a[0]) !== null && _c !== void 0 ? _c : codeX,
|
|
154
|
+
baseY: (_d = (_b = dragStartRef.current) === null || _b === void 0 ? void 0 : _b[1]) !== null && _d !== void 0 ? _d : codeY,
|
|
155
|
+
min,
|
|
156
|
+
max,
|
|
157
|
+
})
|
|
158
|
+
: [newVal, dragY !== null && dragY !== void 0 ? dragY : codeY];
|
|
159
|
+
const newScale = serialize(newX, newY);
|
|
160
|
+
const clearDragState = () => {
|
|
161
|
+
dragStartRef.current = null;
|
|
162
|
+
setDragX(null);
|
|
163
|
+
setDragY(null);
|
|
164
|
+
onDragEnd();
|
|
165
|
+
};
|
|
166
|
+
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
167
|
+
onSave(newScale).finally(clearDragState);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
clearDragState();
|
|
171
|
+
}
|
|
172
|
+
}, [
|
|
173
|
+
codeX,
|
|
174
|
+
codeY,
|
|
175
|
+
dragY,
|
|
176
|
+
linked,
|
|
177
|
+
max,
|
|
178
|
+
min,
|
|
179
|
+
onDragEnd,
|
|
180
|
+
onSave,
|
|
181
|
+
propStatus,
|
|
182
|
+
serialize,
|
|
183
|
+
]);
|
|
184
|
+
const onXTextChange = (0, react_1.useCallback)((newVal) => {
|
|
185
|
+
const parsed = Number(newVal);
|
|
186
|
+
if (Number.isNaN(parsed)) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const [newX, newY] = linked
|
|
190
|
+
? (0, exports.getLinkedScale)({
|
|
191
|
+
axis: 'x',
|
|
192
|
+
newValue: parsed,
|
|
193
|
+
baseX: codeX,
|
|
194
|
+
baseY: codeY,
|
|
195
|
+
min,
|
|
196
|
+
max,
|
|
197
|
+
})
|
|
198
|
+
: [parsed, dragY !== null && dragY !== void 0 ? dragY : codeY];
|
|
199
|
+
const newScale = serialize(newX, newY);
|
|
200
|
+
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
201
|
+
setDragX(newX);
|
|
202
|
+
setDragY(newY);
|
|
203
|
+
onSave(newScale).finally(() => {
|
|
204
|
+
dragStartRef.current = null;
|
|
205
|
+
setDragX(null);
|
|
206
|
+
setDragY(null);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}, [codeX, codeY, dragY, linked, max, min, onSave, propStatus, serialize]);
|
|
210
|
+
const onYChange = (0, react_1.useCallback)((newVal) => {
|
|
211
|
+
if (linked) {
|
|
212
|
+
const [baseX, baseY] = getDragStart();
|
|
213
|
+
const [newX, newY] = (0, exports.getLinkedScale)({
|
|
214
|
+
axis: 'y',
|
|
215
|
+
newValue: newVal,
|
|
216
|
+
baseX,
|
|
217
|
+
baseY,
|
|
218
|
+
min,
|
|
219
|
+
max,
|
|
220
|
+
});
|
|
221
|
+
setDragX(newX);
|
|
222
|
+
setDragY(newY);
|
|
223
|
+
onDragValueChange(serialize(newX, newY));
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
setDragY(newVal);
|
|
227
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
228
|
+
onDragValueChange(serialize(currentX, newVal));
|
|
229
|
+
}, [
|
|
230
|
+
codeX,
|
|
231
|
+
dragX,
|
|
232
|
+
getDragStart,
|
|
233
|
+
linked,
|
|
234
|
+
max,
|
|
235
|
+
min,
|
|
236
|
+
onDragValueChange,
|
|
237
|
+
serialize,
|
|
238
|
+
]);
|
|
239
|
+
const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
240
|
+
var _a, _b;
|
|
241
|
+
var _c, _d;
|
|
242
|
+
const [newX, newY] = linked
|
|
243
|
+
? (0, exports.getLinkedScale)({
|
|
244
|
+
axis: 'y',
|
|
245
|
+
newValue: newVal,
|
|
246
|
+
baseX: (_c = (_a = dragStartRef.current) === null || _a === void 0 ? void 0 : _a[0]) !== null && _c !== void 0 ? _c : codeX,
|
|
247
|
+
baseY: (_d = (_b = dragStartRef.current) === null || _b === void 0 ? void 0 : _b[1]) !== null && _d !== void 0 ? _d : codeY,
|
|
248
|
+
min,
|
|
249
|
+
max,
|
|
250
|
+
})
|
|
251
|
+
: [dragX !== null && dragX !== void 0 ? dragX : codeX, newVal];
|
|
252
|
+
const newScale = serialize(newX, newY);
|
|
253
|
+
const clearDragState = () => {
|
|
254
|
+
dragStartRef.current = null;
|
|
255
|
+
setDragX(null);
|
|
256
|
+
setDragY(null);
|
|
257
|
+
onDragEnd();
|
|
258
|
+
};
|
|
259
|
+
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
260
|
+
onSave(newScale).finally(clearDragState);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
clearDragState();
|
|
264
|
+
}
|
|
265
|
+
}, [
|
|
266
|
+
codeX,
|
|
267
|
+
codeY,
|
|
268
|
+
dragX,
|
|
269
|
+
linked,
|
|
270
|
+
max,
|
|
271
|
+
min,
|
|
272
|
+
onDragEnd,
|
|
273
|
+
onSave,
|
|
274
|
+
propStatus,
|
|
275
|
+
serialize,
|
|
276
|
+
]);
|
|
277
|
+
const onYTextChange = (0, react_1.useCallback)((newVal) => {
|
|
278
|
+
const parsed = Number(newVal);
|
|
279
|
+
if (Number.isNaN(parsed)) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const [newX, newY] = linked
|
|
283
|
+
? (0, exports.getLinkedScale)({
|
|
284
|
+
axis: 'y',
|
|
285
|
+
newValue: parsed,
|
|
286
|
+
baseX: codeX,
|
|
287
|
+
baseY: codeY,
|
|
288
|
+
min,
|
|
289
|
+
max,
|
|
290
|
+
})
|
|
291
|
+
: [dragX !== null && dragX !== void 0 ? dragX : codeX, parsed];
|
|
292
|
+
const newScale = serialize(newX, newY);
|
|
293
|
+
if (!valuesEqual(newScale, propStatus.codeValue)) {
|
|
294
|
+
setDragX(newX);
|
|
295
|
+
setDragY(newY);
|
|
296
|
+
onSave(newScale).finally(() => {
|
|
297
|
+
dragStartRef.current = null;
|
|
298
|
+
setDragX(null);
|
|
299
|
+
setDragY(null);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}, [codeX, codeY, dragX, linked, max, min, onSave, propStatus, serialize]);
|
|
303
|
+
const onToggleLink = (0, react_1.useCallback)(() => {
|
|
304
|
+
setScaleLockState({
|
|
305
|
+
nodePath: scaleLockNodePath,
|
|
306
|
+
fieldKey: field.key,
|
|
307
|
+
linked: !linked,
|
|
308
|
+
});
|
|
309
|
+
}, [field.key, linked, scaleLockNodePath, setScaleLockState]);
|
|
310
|
+
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
311
|
+
jsx_runtime_1.jsx(LinkToggle, { linked: linked, onToggle: onToggleLink }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : codeX, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false }), jsx_runtime_1.jsx("div", { style: gapStyle }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragY !== null && dragY !== void 0 ? dragY : codeY, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: min, max: max, step: step, formatter: formatter, rightAlign: false })
|
|
312
|
+
] }));
|
|
313
|
+
};
|
|
314
|
+
exports.TimelineScaleField = TimelineScaleField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { CanUpdateSequencePropStatusFalse,
|
|
2
|
+
import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusStatic, SequencePropsSubscriptionKey } from 'remotion';
|
|
3
3
|
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
4
|
export declare const UnsupportedStatus: React.FC<{
|
|
5
5
|
readonly label: string;
|
|
@@ -12,6 +12,7 @@ export declare const TimelineFieldValue: React.FC<{
|
|
|
12
12
|
readonly onSave: TimelineFieldOnSave;
|
|
13
13
|
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
14
14
|
readonly onDragEnd: () => void;
|
|
15
|
-
readonly propStatus:
|
|
15
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
16
16
|
readonly effectiveValue: unknown;
|
|
17
|
+
readonly scaleLockNodePath: SequencePropsSubscriptionKey | null;
|
|
17
18
|
}>;
|
|
@@ -3,13 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelineFieldValue = exports.TimelineNonEditableStatus = exports.UnsupportedStatus = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const get_timeline_keyframes_1 = require("./get-timeline-keyframes");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const TimelineEnumField_1 = require("./TimelineEnumField");
|
|
9
|
-
const TimelineNumberField_1 = require("./TimelineNumberField");
|
|
10
|
-
const TimelineRotationField_1 = require("./TimelineRotationField");
|
|
11
|
-
const TimelineTranslateField_1 = require("./TimelineTranslateField");
|
|
12
|
-
const TimelineUvCoordinateField_1 = require("./TimelineUvCoordinateField");
|
|
6
|
+
const TimelineArrayField_1 = require("./TimelineArrayField");
|
|
7
|
+
const TimelinePrimitiveFieldValue_1 = require("./TimelinePrimitiveFieldValue");
|
|
13
8
|
const unsupportedLabel = {
|
|
14
9
|
color: 'rgba(255, 255, 255, 0.4)',
|
|
15
10
|
fontSize: 12,
|
|
@@ -17,51 +12,22 @@ const unsupportedLabel = {
|
|
|
17
12
|
userSelect: 'none',
|
|
18
13
|
WebkitUserSelect: 'none',
|
|
19
14
|
};
|
|
20
|
-
const notEditableBackground = {
|
|
21
|
-
backgroundColor: 'rgba(255, 0, 0, 0.2)',
|
|
22
|
-
borderRadius: 3,
|
|
23
|
-
padding: '0 4px',
|
|
24
|
-
};
|
|
25
|
-
const inlineWrapper = {
|
|
26
|
-
fontSize: 12,
|
|
27
|
-
};
|
|
28
15
|
const UnsupportedStatus = ({ label }) => {
|
|
29
16
|
return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: label });
|
|
30
17
|
};
|
|
31
18
|
exports.UnsupportedStatus = UnsupportedStatus;
|
|
32
19
|
const TimelineNonEditableStatus = ({ propStatus }) => {
|
|
33
|
-
if (propStatus.
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
if (propStatus.reason === 'computed' || propStatus.reason === 'keyframed') {
|
|
20
|
+
if (propStatus.status === 'computed') {
|
|
37
21
|
return (jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: (0, get_timeline_keyframes_1.getComputedStatusLabel)(propStatus) }));
|
|
38
22
|
}
|
|
39
23
|
};
|
|
40
24
|
exports.TimelineNonEditableStatus = TimelineNonEditableStatus;
|
|
41
|
-
const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, effectiveValue, }) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
: undefined;
|
|
45
|
-
if (field.typeName === 'number') {
|
|
46
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { field: field, effectiveValue: effectiveValue, onSave: onSave, propStatus: propStatus, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
47
|
-
}
|
|
48
|
-
if (field.typeName === 'rotation') {
|
|
49
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineRotationField_1.TimelineRotationField, { field: field, effectiveValue: effectiveValue, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
50
|
-
}
|
|
51
|
-
if (field.typeName === 'translate') {
|
|
52
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineTranslateField_1.TimelineTranslateField, { field: field, effectiveValue: effectiveValue, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
53
|
-
}
|
|
54
|
-
if (field.typeName === 'uv-coordinate') {
|
|
55
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineUvCoordinateField_1.TimelineUvCoordinateField, { field: field, effectiveValue: effectiveValue, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
56
|
-
}
|
|
57
|
-
if (field.typeName === 'boolean') {
|
|
58
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { field: field, propStatus: propStatus, onSave: onSave, effectiveValue: effectiveValue }) }));
|
|
59
|
-
}
|
|
60
|
-
if (field.typeName === 'color') {
|
|
61
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineColorField_1.TimelineColorField, { field: field, propStatus: propStatus, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }) }));
|
|
25
|
+
const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, effectiveValue, scaleLockNodePath, }) => {
|
|
26
|
+
if ((0, TimelinePrimitiveFieldValue_1.isTimelinePrimitiveFieldInfo)(field)) {
|
|
27
|
+
return (jsx_runtime_1.jsx(TimelinePrimitiveFieldValue_1.TimelinePrimitiveFieldValue, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus, scaleLockNodePath: scaleLockNodePath }));
|
|
62
28
|
}
|
|
63
|
-
if (field.typeName === '
|
|
64
|
-
return (jsx_runtime_1.jsx("span", {
|
|
29
|
+
if (field.typeName === 'array') {
|
|
30
|
+
return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineArrayField_1.TimelineArrayField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave }) }));
|
|
65
31
|
}
|
|
66
32
|
throw new Error(`Unsupported field type: ${field.typeName}`);
|
|
67
33
|
};
|