@remotion/studio 4.0.507 → 4.0.508
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/FastRefreshProvider.js +13 -9
- package/dist/components/CodingAgentIcon.d.ts +3 -1
- package/dist/components/CodingAgentIcon.js +4 -9
- package/dist/components/ConfigureDefaultEditorModal.js +1 -1
- package/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu.js +32 -5
- package/dist/components/EditorContent.js +4 -3
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +3 -3
- package/dist/components/InspectorLocationCopy.js +1 -1
- package/dist/components/InspectorOpenInEditor.d.ts +1 -0
- package/dist/components/InspectorOpenInEditor.js +44 -3
- package/dist/components/InspectorPanel/AlignmentControls.js +2 -2
- package/dist/components/InspectorPanel/CompositionInspector.js +3 -1
- package/dist/components/InspectorPanel/styles.js +1 -1
- package/dist/components/InspectorSequenceSection.js +36 -4
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/PlayPause.d.ts +1 -1
- package/dist/components/PlayPause.js +61 -12
- package/dist/components/RenderButton.js +16 -12
- package/dist/components/RenderModal/GuiRenderStatus.js +23 -6
- package/dist/components/RenderModal/InfoBubble.d.ts +1 -0
- package/dist/components/RenderModal/InfoBubble.js +6 -4
- package/dist/components/RenderModal/InfoTooltip.d.ts +1 -0
- package/dist/components/RenderModal/InfoTooltip.js +12 -12
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +5 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +16 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -0
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +6 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +1 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +12 -1
- package/dist/components/SelectedOutlineCanvasRotation.d.ts +9 -0
- package/dist/components/SelectedOutlineCanvasRotation.js +237 -0
- package/dist/components/SelectedOutlineElement.d.ts +2 -1
- package/dist/components/SelectedOutlineElement.js +36 -5
- package/dist/components/SelectedOutlineOverlay.d.ts +1 -1
- package/dist/components/SelectedOutlineOverlay.js +55 -26
- package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
- package/dist/components/SelectedOutlinePolygon.js +4 -3
- package/dist/components/SelectedOutlineRenderer.d.ts +1 -0
- package/dist/components/SelectedOutlineRenderer.js +24 -7
- package/dist/components/SelectedOutlineRotationCornerHandle.d.ts +1 -0
- package/dist/components/SelectedOutlineRotationCornerHandle.js +7 -5
- package/dist/components/SelectedOutlineScaleEdgeLine.d.ts +1 -0
- package/dist/components/SelectedOutlineScaleEdgeLine.js +9 -5
- package/dist/components/SelectedOutlineTransformOriginHandle.js +48 -22
- package/dist/components/SequencePropsSubscriptionProvider.js +8 -0
- package/dist/components/SettingsModalFooter.js +1 -1
- package/dist/components/Timeline/SequencePropsObserver.js +97 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +4 -2
- package/dist/components/Timeline/TimelineEffectItem.js +1 -4
- package/dist/components/Timeline/TimelineFieldRowContent.js +10 -3
- package/dist/components/Timeline/TimelineRotationField.js +84 -12
- package/dist/components/Timeline/TimelineScaleField.js +58 -4
- package/dist/components/Timeline/TimelineSelection.d.ts +4 -0
- package/dist/components/Timeline/TimelineSelection.js +45 -2
- package/dist/components/Timeline/TimelineSequenceItem.js +42 -1
- package/dist/components/Timeline/TimelineSequencePropItem.js +5 -2
- package/dist/components/Timeline/TimelineTransformOriginField.js +78 -4
- package/dist/components/Timeline/TimelineTranslateField.js +55 -15
- package/dist/components/Timeline/Transform3DModeContext.d.ts +1 -0
- package/dist/components/Timeline/Transform3DModeContext.js +5 -0
- package/dist/components/Timeline/delete-selected-timeline-item.js +0 -6
- package/dist/components/Timeline/get-sequence-context-menu-items.js +13 -6
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
- package/dist/components/Timeline/sequence-props-subscription-store.js +5 -2
- package/dist/components/Timeline/timeline-field-display-utils.js +2 -2
- package/dist/components/Timeline/timeline-field-row-layout.d.ts +6 -0
- package/dist/components/Timeline/timeline-field-row-layout.js +16 -1
- package/dist/components/Timeline/timeline-rotation-utils.d.ts +16 -0
- package/dist/components/Timeline/timeline-rotation-utils.js +145 -4
- package/dist/components/Timeline/timeline-translate-utils.d.ts +3 -2
- package/dist/components/Timeline/timeline-translate-utils.js +8 -4
- package/dist/components/Timeline/transform-3d-mode.d.ts +6 -0
- package/dist/components/Timeline/transform-3d-mode.js +36 -0
- package/dist/components/Timeline/transform-origin-utils.d.ts +4 -0
- package/dist/components/Timeline/transform-origin-utils.js +12 -6
- package/dist/components/Timeline/use-open-sequence-in-apps.js +1 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.d.ts +5 -1
- package/dist/components/Timeline/use-resolved-stack-react-to-change.js +45 -9
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +7 -2
- package/dist/components/call-api.js +2 -0
- package/dist/components/canvas-rotation-cursor.d.ts +1 -0
- package/dist/components/canvas-rotation-cursor.js +14 -0
- package/dist/components/get-open-in-menu-items.d.ts +6 -1
- package/dist/components/get-open-in-menu-items.js +69 -8
- package/dist/components/selected-outline-drag.d.ts +11 -5
- package/dist/components/selected-outline-drag.js +80 -42
- package/dist/components/selected-outline-measurement.d.ts +5 -0
- package/dist/components/selected-outline-measurement.js +28 -1
- package/dist/components/selected-outline-types.d.ts +6 -0
- package/dist/esm/{chunk-ptnd65a9.js → chunk-zpn4m49r.js} +8458 -6911
- package/dist/esm/index.mjs +357 -2
- package/dist/esm/internals.mjs +8458 -6911
- package/dist/esm/previewEntry.mjs +8363 -6816
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/get-box-quads-polyfill-internals.js +10 -2
- package/dist/helpers/open-in-editor.d.ts +3 -1
- package/dist/helpers/open-in-editor.js +5 -1
- package/dist/helpers/preview-server-events.js +4 -0
- package/dist/helpers/sequence-node-path-mutations.d.ts +4 -0
- package/dist/helpers/sequence-node-path-mutations.js +31 -0
- package/dist/icons/cube.d.ts +4 -0
- package/dist/icons/cube.js +6 -0
- package/dist/icons/finder.d.ts +4 -0
- package/dist/icons/finder.js +8 -0
- package/dist/icons/terminal.d.ts +6 -0
- package/dist/icons/terminal.js +46 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -0
- package/dist/state/transform-3d-mode.d.ts +10 -0
- package/dist/state/transform-3d-mode.js +27 -0
- package/dist/state/z-index.js +5 -8
- package/package.json +12 -12
|
@@ -7,11 +7,16 @@ const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
|
7
7
|
const timeline_field_display_utils_1 = require("./timeline-field-display-utils");
|
|
8
8
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
9
9
|
const timeline_translate_utils_1 = require("./timeline-translate-utils");
|
|
10
|
+
const Transform3DModeContext_1 = require("./Transform3DModeContext");
|
|
10
11
|
const leftDraggerStyle = {
|
|
12
|
+
paddingBottom: 2,
|
|
11
13
|
paddingLeft: 0,
|
|
14
|
+
paddingTop: 2,
|
|
12
15
|
};
|
|
13
16
|
const rightDraggerStyle = {
|
|
17
|
+
paddingBottom: 2,
|
|
14
18
|
paddingRight: 0,
|
|
19
|
+
paddingTop: 2,
|
|
15
20
|
};
|
|
16
21
|
const containerStyle = {
|
|
17
22
|
display: 'flex',
|
|
@@ -19,9 +24,13 @@ const containerStyle = {
|
|
|
19
24
|
};
|
|
20
25
|
const translateDragSensitivity = 3;
|
|
21
26
|
const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
|
|
27
|
+
var _a;
|
|
22
28
|
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
23
29
|
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
24
|
-
const [
|
|
30
|
+
const [dragZ, setDragZ] = (0, react_1.useState)(null);
|
|
31
|
+
const transform3DMode = (0, react_1.useContext)(Transform3DModeContext_1.Transform3DModeContext);
|
|
32
|
+
const [codeX, codeY, codeZ] = (0, react_1.useMemo)(() => (0, timeline_translate_utils_1.parseTranslate)(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px')), [effectiveValue]);
|
|
33
|
+
const show3D = transform3DMode || (codeZ !== null && codeZ !== 0);
|
|
25
34
|
const configuredStep = field.fieldSchema.type === 'translate' ? field.fieldSchema.step : undefined;
|
|
26
35
|
const step = configuredStep !== null && configuredStep !== void 0 ? configuredStep : 1;
|
|
27
36
|
const decimalPlaces = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getTimelineDisplayDecimalPlaces)({
|
|
@@ -34,15 +43,18 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
34
43
|
value: v,
|
|
35
44
|
});
|
|
36
45
|
}, [field.fieldSchema]);
|
|
46
|
+
const serialize = (0, react_1.useCallback)((x, y, z = dragZ !== null && dragZ !== void 0 ? dragZ : codeZ) => {
|
|
47
|
+
return (0, timeline_translate_utils_1.serializeTranslate)([x, y, z], decimalPlaces);
|
|
48
|
+
}, [codeZ, decimalPlaces, dragZ]);
|
|
37
49
|
// --- X callbacks ---
|
|
38
50
|
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
39
51
|
setDragX(newVal);
|
|
40
52
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
41
|
-
onDragValueChange((
|
|
42
|
-
}, [
|
|
53
|
+
onDragValueChange(serialize(newVal, currentY));
|
|
54
|
+
}, [codeY, dragY, onDragValueChange, serialize]);
|
|
43
55
|
const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
44
56
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
45
|
-
const newStr = (
|
|
57
|
+
const newStr = serialize(newVal, currentY);
|
|
46
58
|
if (newStr !== propStatus.codeValue) {
|
|
47
59
|
onSave(newStr).finally(() => {
|
|
48
60
|
setDragX(null);
|
|
@@ -53,12 +65,12 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
53
65
|
setDragX(null);
|
|
54
66
|
onDragEnd();
|
|
55
67
|
}
|
|
56
|
-
}, [dragY,
|
|
68
|
+
}, [codeY, dragY, onDragEnd, onSave, propStatus, serialize]);
|
|
57
69
|
const onXTextChange = (0, react_1.useCallback)((newVal) => {
|
|
58
70
|
const parsed = Number(newVal);
|
|
59
71
|
if (!Number.isNaN(parsed)) {
|
|
60
72
|
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
61
|
-
const newStr = (
|
|
73
|
+
const newStr = serialize(parsed, currentY);
|
|
62
74
|
if (newStr !== propStatus.codeValue) {
|
|
63
75
|
setDragX(parsed);
|
|
64
76
|
onSave(newStr).finally(() => {
|
|
@@ -66,16 +78,16 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
66
78
|
});
|
|
67
79
|
}
|
|
68
80
|
}
|
|
69
|
-
}, [
|
|
81
|
+
}, [codeY, dragY, onSave, propStatus, serialize]);
|
|
70
82
|
// --- Y callbacks ---
|
|
71
83
|
const onYChange = (0, react_1.useCallback)((newVal) => {
|
|
72
84
|
setDragY(newVal);
|
|
73
85
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
74
|
-
onDragValueChange((
|
|
75
|
-
}, [
|
|
86
|
+
onDragValueChange(serialize(currentX, newVal));
|
|
87
|
+
}, [codeX, dragX, onDragValueChange, serialize]);
|
|
76
88
|
const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
77
89
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
78
|
-
const newStr = (
|
|
90
|
+
const newStr = serialize(currentX, newVal);
|
|
79
91
|
if (newStr !== propStatus.codeValue) {
|
|
80
92
|
onSave(newStr).finally(() => {
|
|
81
93
|
setDragY(null);
|
|
@@ -86,12 +98,12 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
86
98
|
setDragY(null);
|
|
87
99
|
onDragEnd();
|
|
88
100
|
}
|
|
89
|
-
}, [dragX,
|
|
101
|
+
}, [codeX, dragX, onDragEnd, onSave, propStatus, serialize]);
|
|
90
102
|
const onYTextChange = (0, react_1.useCallback)((newVal) => {
|
|
91
103
|
const parsed = Number(newVal);
|
|
92
104
|
if (!Number.isNaN(parsed)) {
|
|
93
105
|
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
94
|
-
const newStr = (
|
|
106
|
+
const newStr = serialize(currentX, parsed);
|
|
95
107
|
if (newStr !== propStatus.codeValue) {
|
|
96
108
|
setDragY(parsed);
|
|
97
109
|
onSave(newStr).finally(() => {
|
|
@@ -99,9 +111,37 @@ const TimelineTranslateField = ({ field, propStatus, effectiveValue, onSave, onD
|
|
|
99
111
|
});
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
|
-
}, [
|
|
114
|
+
}, [codeX, dragX, onSave, propStatus, serialize]);
|
|
115
|
+
const onZChange = (0, react_1.useCallback)((newVal) => {
|
|
116
|
+
setDragZ(newVal);
|
|
117
|
+
onDragValueChange(serialize(dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY, newVal));
|
|
118
|
+
}, [codeX, codeY, dragX, dragY, onDragValueChange, serialize]);
|
|
119
|
+
const onZChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
120
|
+
const newStr = serialize(dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY, newVal);
|
|
121
|
+
if (newStr !== propStatus.codeValue) {
|
|
122
|
+
onSave(newStr).finally(() => {
|
|
123
|
+
setDragZ(null);
|
|
124
|
+
onDragEnd();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
setDragZ(null);
|
|
129
|
+
onDragEnd();
|
|
130
|
+
}
|
|
131
|
+
}, [codeX, codeY, dragX, dragY, onDragEnd, onSave, propStatus, serialize]);
|
|
132
|
+
const onZTextChange = (0, react_1.useCallback)((newVal) => {
|
|
133
|
+
const parsed = Number(newVal);
|
|
134
|
+
if (!Number.isNaN(parsed)) {
|
|
135
|
+
const newStr = serialize(dragX !== null && dragX !== void 0 ? dragX : codeX, dragY !== null && dragY !== void 0 ? dragY : codeY, parsed);
|
|
136
|
+
if (newStr !== propStatus.codeValue) {
|
|
137
|
+
setDragZ(parsed);
|
|
138
|
+
onSave(newStr).finally(() => setDragZ(null));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [codeX, codeY, dragX, dragY, onSave, propStatus, serialize]);
|
|
103
142
|
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
104
|
-
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: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, dragSensitivity: translateDragSensitivity }), jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), 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: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, dragSensitivity: translateDragSensitivity })
|
|
105
|
-
|
|
143
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragX !== null && dragX !== void 0 ? dragX : codeX, buttonStyle: leftDraggerStyle, style: leftDraggerStyle, status: "ok", small: true, onValueChange: onXChange, onValueChangeEnd: onXChangeEnd, onTextChange: onXTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, dragSensitivity: translateDragSensitivity, "aria-label": "Offset X" }), jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragY !== null && dragY !== void 0 ? dragY : codeY, buttonStyle: rightDraggerStyle, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onYChange, onValueChangeEnd: onYChangeEnd, onTextChange: onYTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, dragSensitivity: translateDragSensitivity, "aria-label": "Offset Y" }), show3D ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
144
|
+
jsx_runtime_1.jsx("div", { style: { marginLeft: -6, marginRight: -6 } }), jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: (_a = dragZ !== null && dragZ !== void 0 ? dragZ : codeZ) !== null && _a !== void 0 ? _a : 0, buttonStyle: rightDraggerStyle, style: rightDraggerStyle, status: "ok", small: true, onValueChange: onZChange, onValueChangeEnd: onZChangeEnd, onTextChange: onZTextChange, min: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false, snapToStep: false, dragDecimalPlaces: decimalPlaces, dragSensitivity: translateDragSensitivity, "aria-label": "Offset Z" })
|
|
145
|
+
] })) : null] }));
|
|
106
146
|
};
|
|
107
147
|
exports.TimelineTranslateField = TimelineTranslateField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Transform3DModeContext: import("react").Context<boolean>;
|
|
@@ -78,12 +78,6 @@ const deleteEffects = (effects) => {
|
|
|
78
78
|
}))
|
|
79
79
|
.then((result) => {
|
|
80
80
|
if (result.success) {
|
|
81
|
-
const singleEffect = effects[0];
|
|
82
|
-
(0, NotificationCenter_1.showNotification)(effects.length === 1 && (singleEffect === null || singleEffect === void 0 ? void 0 : singleEffect.type) === 'single-effect'
|
|
83
|
-
? 'Removed effect from source file'
|
|
84
|
-
: effects.length === 1
|
|
85
|
-
? 'Removed effects from source file'
|
|
86
|
-
: 'Removed effects from source files', 2000);
|
|
87
81
|
return true;
|
|
88
82
|
}
|
|
89
83
|
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
@@ -5,6 +5,7 @@ const no_react_1 = require("remotion/no-react");
|
|
|
5
5
|
const format_file_location_1 = require("../../helpers/format-file-location");
|
|
6
6
|
const get_open_in_menu_items_1 = require("../get-open-in-menu-items");
|
|
7
7
|
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
|
|
8
|
+
const actions_1 = require("../RenderQueue/actions");
|
|
8
9
|
const timeline_asset_link_1 = require("./timeline-asset-link");
|
|
9
10
|
const normalizeMenuDividers = (items) => {
|
|
10
11
|
var _a;
|
|
@@ -47,9 +48,20 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
47
48
|
editorInfo,
|
|
48
49
|
excludeCodingAgentId: (_g = defaultCodingAgent === null || defaultCodingAgent === void 0 ? void 0 : defaultCodingAgent.id) !== null && _g !== void 0 ? _g : null,
|
|
49
50
|
excludeEditorId: defaultEditorId,
|
|
51
|
+
fileManagerDisabled: !(originalLocation === null || originalLocation === void 0 ? void 0 : originalLocation.source),
|
|
52
|
+
folder: false,
|
|
50
53
|
onConfigureApps,
|
|
51
54
|
onOpenInCodingAgent: openInCodingAgentWithContext,
|
|
52
55
|
onOpenInEditor: openInEditor,
|
|
56
|
+
onOpenInFileExplorer: () => {
|
|
57
|
+
if (!(originalLocation === null || originalLocation === void 0 ? void 0 : originalLocation.source)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(0, actions_1.openInFileExplorer)({ directory: originalLocation.source }).catch((err) => {
|
|
61
|
+
(0, NotificationCenter_1.showNotification)(`Could not open file: ${err.message}`, 2000);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
onOpenInTerminal: null,
|
|
53
65
|
})
|
|
54
66
|
: [];
|
|
55
67
|
const items = [
|
|
@@ -110,12 +122,7 @@ const getSequenceContextMenuItems = ({ assetLinkInfo, canOpenInEditor, deleteDis
|
|
|
110
122
|
if (!contextForAgents) {
|
|
111
123
|
return;
|
|
112
124
|
}
|
|
113
|
-
navigator.clipboard
|
|
114
|
-
.writeText(contextForAgents)
|
|
115
|
-
.then(() => {
|
|
116
|
-
(0, NotificationCenter_1.showNotification)('Copied context for agents', 1000);
|
|
117
|
-
})
|
|
118
|
-
.catch((err) => {
|
|
125
|
+
navigator.clipboard.writeText(contextForAgents).catch((err) => {
|
|
119
126
|
(0, NotificationCenter_1.showNotification)(`Could not copy to clipboard: ${err.message}`, 1000);
|
|
120
127
|
});
|
|
121
128
|
},
|
|
@@ -2,7 +2,7 @@ import type { SequenceNodePath, InteractivitySchema, VideoConfigValues } from 'r
|
|
|
2
2
|
import { subscribeToSequenceProps } from '../sequence-props-api';
|
|
3
3
|
type SubscribeResult = Awaited<ReturnType<typeof subscribeToSequenceProps>>;
|
|
4
4
|
type ApplyResult = (result: SubscribeResult) => void;
|
|
5
|
-
export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, }: {
|
|
5
|
+
export declare const acquireSequencePropsSubscription: ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, stack, }: {
|
|
6
6
|
fileName: string;
|
|
7
7
|
line: number;
|
|
8
8
|
column: number;
|
|
@@ -14,6 +14,7 @@ export declare const acquireSequencePropsSubscription: ({ fileName, line, column
|
|
|
14
14
|
applyOnce: ApplyResult;
|
|
15
15
|
applyEach: ApplyResult;
|
|
16
16
|
videoConfigValues: VideoConfigValues;
|
|
17
|
+
stack: string | null;
|
|
17
18
|
}) => {
|
|
18
19
|
release: () => void;
|
|
19
20
|
};
|
|
@@ -4,9 +4,11 @@ exports.acquireSequencePropsSubscription = void 0;
|
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
6
|
const sequence_props_api_1 = require("../sequence-props-api");
|
|
7
|
-
|
|
7
|
+
// The generated stack distinguishes Fast Refresh instances even when source maps
|
|
8
|
+
// resolve both the old and new JSX nodes to the same line and column.
|
|
9
|
+
const makeKey = ({ fileName, line, column, componentIdentity, sequenceKeys, assetKeys, effectKeys, videoConfigValues, stack, }) => `${fileName}\0${line}\0${column}\0${componentIdentity !== null && componentIdentity !== void 0 ? componentIdentity : ''}\0${sequenceKeys.join('\0')}\0${assetKeys.join('\0')}\0${effectKeys.map((keys) => keys.join('\0')).join('\0\0')}\0${JSON.stringify(videoConfigValues)}\0${stack !== null && stack !== void 0 ? stack : ''}`;
|
|
8
10
|
const entries = new Map();
|
|
9
|
-
const acquireSequencePropsSubscription = ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, }) => {
|
|
11
|
+
const acquireSequencePropsSubscription = ({ fileName, line, column, schema, componentIdentity, effects, nodePath, clientId, applyOnce, applyEach, videoConfigValues, stack, }) => {
|
|
10
12
|
const sequenceKeys = (0, studio_shared_1.getAllSchemaKeys)(schema);
|
|
11
13
|
const assetKeys = (0, studio_shared_1.getAssetSchemaKeys)(schema);
|
|
12
14
|
const effectKeys = effects.map((effect) => (0, studio_shared_1.getAllSchemaKeys)(effect));
|
|
@@ -19,6 +21,7 @@ const acquireSequencePropsSubscription = ({ fileName, line, column, schema, comp
|
|
|
19
21
|
assetKeys,
|
|
20
22
|
effectKeys,
|
|
21
23
|
videoConfigValues,
|
|
24
|
+
stack,
|
|
22
25
|
});
|
|
23
26
|
let entry = entries.get(key);
|
|
24
27
|
if (!entry) {
|
|
@@ -150,8 +150,8 @@ const formatTranslateTimelineFieldValueForDisplay = ({ fieldSchema, value, }) =>
|
|
|
150
150
|
if (numericValue !== null) {
|
|
151
151
|
return formatTranslateCoordinateForDisplay(numericValue, decimalPlaces);
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
return (0, timeline_translate_utils_1.serializeTranslate)(
|
|
153
|
+
const translate = (0, timeline_translate_utils_1.parseTranslate)(String(value !== null && value !== void 0 ? value : '0px 0px'));
|
|
154
|
+
return (0, timeline_translate_utils_1.serializeTranslate)(translate, decimalPlaces);
|
|
155
155
|
};
|
|
156
156
|
const formatTransformOriginAxisValueForDisplay = ({ decimalPlaces, unit, value, }) => {
|
|
157
157
|
return `${(0, timeline_field_utils_1.formatTimelineNumber)({
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import { type SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
3
|
+
export declare const isTimelineFieldStacked: ({ field, transform3DMode, }: {
|
|
4
|
+
readonly field: SchemaFieldInfo;
|
|
5
|
+
readonly transform3DMode: boolean;
|
|
6
|
+
}) => boolean;
|
|
2
7
|
export declare const getTimelineFieldLabelRowStyle: (depth: number, basePadding?: number | undefined) => React.CSSProperties;
|
|
3
8
|
export declare const timelineFieldValueColumnStyle: React.CSSProperties;
|
|
9
|
+
export declare const timelineCompactStackedFieldValueColumnStyle: React.CSSProperties;
|
|
4
10
|
export declare const timelineStackedFieldContentStyle: React.CSSProperties;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timelineStackedFieldContentStyle = exports.timelineFieldValueColumnStyle = exports.getTimelineFieldLabelRowStyle = void 0;
|
|
3
|
+
exports.timelineStackedFieldContentStyle = exports.timelineCompactStackedFieldValueColumnStyle = exports.timelineFieldValueColumnStyle = exports.getTimelineFieldLabelRowStyle = exports.isTimelineFieldStacked = void 0;
|
|
4
4
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
5
5
|
const timeline_row_layout_1 = require("./timeline-row-layout");
|
|
6
|
+
const isTimelineFieldStacked = ({ field, transform3DMode, }) => {
|
|
7
|
+
return (field.typeName === 'text-content' ||
|
|
8
|
+
(transform3DMode &&
|
|
9
|
+
(field.typeName === 'translate' ||
|
|
10
|
+
field.typeName === 'rotation-css' ||
|
|
11
|
+
field.typeName === 'scale' ||
|
|
12
|
+
field.typeName === 'transform-origin')));
|
|
13
|
+
};
|
|
14
|
+
exports.isTimelineFieldStacked = isTimelineFieldStacked;
|
|
6
15
|
const getTimelineFieldLabelRowStyle = (depth, basePadding) => {
|
|
7
16
|
return {
|
|
8
17
|
flex: `0 0 ${(0, timeline_row_layout_1.getTimelineFieldLabelFlexBasis)(depth, basePadding)}`,
|
|
@@ -22,6 +31,12 @@ exports.timelineFieldValueColumnStyle = {
|
|
|
22
31
|
minWidth: 0,
|
|
23
32
|
paddingRight: timeline_layout_1.EXPANDED_SECTION_PADDING_RIGHT,
|
|
24
33
|
};
|
|
34
|
+
exports.timelineCompactStackedFieldValueColumnStyle = {
|
|
35
|
+
...exports.timelineFieldValueColumnStyle,
|
|
36
|
+
marginBottom: -2,
|
|
37
|
+
position: 'relative',
|
|
38
|
+
top: -2,
|
|
39
|
+
};
|
|
25
40
|
exports.timelineStackedFieldContentStyle = {
|
|
26
41
|
alignSelf: 'stretch',
|
|
27
42
|
display: 'flex',
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
+
export type ParsedCssRotation = {
|
|
2
|
+
readonly axis: readonly [number, number, number];
|
|
3
|
+
readonly degrees: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const parseCssRotation: (value: string) => ParsedCssRotation | null;
|
|
1
6
|
export declare const parseCssRotationToDegrees: (value: string) => number;
|
|
7
|
+
export type CssRotationEuler = readonly [number, number, number];
|
|
8
|
+
export declare const parseCssRotationToEuler: (value: string) => CssRotationEuler;
|
|
9
|
+
export declare const serializeCssRotation3d: ({ axis, degrees, decimalPlaces, }: {
|
|
10
|
+
readonly axis: readonly [number, number, number];
|
|
11
|
+
readonly degrees: number;
|
|
12
|
+
readonly decimalPlaces?: number | undefined;
|
|
13
|
+
}) => string;
|
|
14
|
+
export declare const serializeCssRotationFromEuler: ({ rotation, decimalPlaces, }: {
|
|
15
|
+
readonly rotation: CssRotationEuler;
|
|
16
|
+
readonly decimalPlaces?: number | undefined;
|
|
17
|
+
}) => string;
|
|
2
18
|
export declare const serializeCssRotation: (value: number, decimalPlaces?: number) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeCssRotation = exports.parseCssRotationToDegrees = void 0;
|
|
3
|
+
exports.serializeCssRotation = exports.serializeCssRotationFromEuler = exports.serializeCssRotation3d = exports.parseCssRotationToEuler = exports.parseCssRotationToDegrees = exports.parseCssRotation = void 0;
|
|
4
4
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
5
5
|
const unitPattern = /^([+-]?(?:\d+\.?\d*|\.\d+))(deg|rad|turn|grad)$/;
|
|
6
6
|
const unitToDegrees = {
|
|
@@ -9,10 +9,54 @@ const unitToDegrees = {
|
|
|
9
9
|
turn: 360,
|
|
10
10
|
grad: 360 / 400,
|
|
11
11
|
};
|
|
12
|
+
const parseCssRotation = (value) => {
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
const bareAngle = trimmed.match(unitPattern);
|
|
15
|
+
if (bareAngle) {
|
|
16
|
+
return {
|
|
17
|
+
axis: [0, 0, 1],
|
|
18
|
+
degrees: (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(bareAngle[1]) * unitToDegrees[bareAngle[2]]),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const keywordAxis = /^(x|y|z)\s+(.+)$/i.exec(trimmed);
|
|
22
|
+
if (keywordAxis) {
|
|
23
|
+
const keywordAngle = keywordAxis[2].match(unitPattern);
|
|
24
|
+
if (!keywordAngle) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const keywordAxisName = keywordAxis[1].toLowerCase();
|
|
28
|
+
return {
|
|
29
|
+
axis: keywordAxisName === 'x'
|
|
30
|
+
? [1, 0, 0]
|
|
31
|
+
: keywordAxisName === 'y'
|
|
32
|
+
? [0, 1, 0]
|
|
33
|
+
: [0, 0, 1],
|
|
34
|
+
degrees: (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(keywordAngle[1]) * unitToDegrees[keywordAngle[2]]),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const vectorAxis = /^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/.exec(trimmed);
|
|
38
|
+
if (!vectorAxis) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const vectorAxisComponents = [
|
|
42
|
+
Number(vectorAxis[1]),
|
|
43
|
+
Number(vectorAxis[2]),
|
|
44
|
+
Number(vectorAxis[3]),
|
|
45
|
+
];
|
|
46
|
+
const vectorAngle = vectorAxis[4].match(unitPattern);
|
|
47
|
+
if (!vectorAxisComponents.every(Number.isFinite) || !vectorAngle) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
axis: vectorAxisComponents,
|
|
52
|
+
degrees: (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(vectorAngle[1]) * unitToDegrees[vectorAngle[2]]),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
exports.parseCssRotation = parseCssRotation;
|
|
12
56
|
const parseCssRotationToDegrees = (value) => {
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
57
|
+
const parsed = (0, exports.parseCssRotation)(value);
|
|
58
|
+
if (parsed) {
|
|
59
|
+
return parsed.degrees;
|
|
16
60
|
}
|
|
17
61
|
if (typeof DOMMatrix === 'undefined') {
|
|
18
62
|
return 0;
|
|
@@ -26,6 +70,103 @@ const parseCssRotationToDegrees = (value) => {
|
|
|
26
70
|
}
|
|
27
71
|
};
|
|
28
72
|
exports.parseCssRotationToDegrees = parseCssRotationToDegrees;
|
|
73
|
+
const parseCssRotationToEuler = (value) => {
|
|
74
|
+
const parsed = (0, exports.parseCssRotation)(value);
|
|
75
|
+
if (parsed === null) {
|
|
76
|
+
return [0, 0, (0, exports.parseCssRotationToDegrees)(value)];
|
|
77
|
+
}
|
|
78
|
+
const [axisX, axisY, axisZ] = parsed.axis;
|
|
79
|
+
if (parsed.degrees === 0) {
|
|
80
|
+
return [0, 0, 0];
|
|
81
|
+
}
|
|
82
|
+
if (axisY === 0 && axisZ === 0 && axisX !== 0) {
|
|
83
|
+
return [Math.sign(axisX) * parsed.degrees, 0, 0];
|
|
84
|
+
}
|
|
85
|
+
if (axisX === 0 && axisZ === 0 && axisY !== 0) {
|
|
86
|
+
return [0, Math.sign(axisY) * parsed.degrees, 0];
|
|
87
|
+
}
|
|
88
|
+
if (axisX === 0 && axisY === 0 && axisZ !== 0) {
|
|
89
|
+
return [0, 0, Math.sign(axisZ) * parsed.degrees];
|
|
90
|
+
}
|
|
91
|
+
const axisLength = Math.hypot(axisX, axisY, axisZ);
|
|
92
|
+
if (axisLength === 0) {
|
|
93
|
+
return [0, 0, 0];
|
|
94
|
+
}
|
|
95
|
+
const halfAngle = (parsed.degrees * Math.PI) / 360;
|
|
96
|
+
const sinHalfAngle = Math.sin(halfAngle);
|
|
97
|
+
const quaternionX = (axisX / axisLength) * sinHalfAngle;
|
|
98
|
+
const quaternionY = (axisY / axisLength) * sinHalfAngle;
|
|
99
|
+
const quaternionZ = (axisZ / axisLength) * sinHalfAngle;
|
|
100
|
+
const quaternionW = Math.cos(halfAngle);
|
|
101
|
+
// Decompose the rotation using the same X → Y → Z order used when serializing.
|
|
102
|
+
const matrix11 = 1 - 2 * (quaternionY * quaternionY + quaternionZ * quaternionZ);
|
|
103
|
+
const matrix12 = 2 * (quaternionX * quaternionY - quaternionZ * quaternionW);
|
|
104
|
+
const matrix13 = 2 * (quaternionX * quaternionZ + quaternionY * quaternionW);
|
|
105
|
+
const matrix22 = 1 - 2 * (quaternionX * quaternionX + quaternionZ * quaternionZ);
|
|
106
|
+
const matrix23 = 2 * (quaternionY * quaternionZ - quaternionX * quaternionW);
|
|
107
|
+
const matrix32 = 2 * (quaternionY * quaternionZ + quaternionX * quaternionW);
|
|
108
|
+
const matrix33 = 1 - 2 * (quaternionX * quaternionX + quaternionY * quaternionY);
|
|
109
|
+
const clampedMatrix13 = Math.max(-1, Math.min(1, matrix13));
|
|
110
|
+
const rotationY = Math.asin(clampedMatrix13);
|
|
111
|
+
const rotationX = Math.abs(clampedMatrix13) < 0.9999999
|
|
112
|
+
? Math.atan2(-matrix23, matrix33)
|
|
113
|
+
: Math.atan2(matrix32, matrix22);
|
|
114
|
+
const rotationZ = Math.abs(clampedMatrix13) < 0.9999999 ? Math.atan2(-matrix12, matrix11) : 0;
|
|
115
|
+
return [rotationX, rotationY, rotationZ].map((rotation) => (0, timeline_field_utils_1.normalizeTimelineNumber)(rotation * (180 / Math.PI)));
|
|
116
|
+
};
|
|
117
|
+
exports.parseCssRotationToEuler = parseCssRotationToEuler;
|
|
118
|
+
const serializeCssRotation3d = ({ axis, degrees, decimalPlaces = 6, }) => {
|
|
119
|
+
const factor = 10 ** decimalPlaces;
|
|
120
|
+
const values = [...axis, degrees].map((value) => {
|
|
121
|
+
const rounded = Math.round((0, timeline_field_utils_1.normalizeTimelineNumber)(value) * factor) / factor;
|
|
122
|
+
return Object.is(rounded, -0) ? 0 : rounded;
|
|
123
|
+
});
|
|
124
|
+
return `${values[0]} ${values[1]} ${values[2]} ${values[3]}deg`;
|
|
125
|
+
};
|
|
126
|
+
exports.serializeCssRotation3d = serializeCssRotation3d;
|
|
127
|
+
const serializeCssRotationFromEuler = ({ rotation, decimalPlaces = 6, }) => {
|
|
128
|
+
const [rotationX, rotationY, rotationZ] = rotation.map((value) => (0, timeline_field_utils_1.normalizeTimelineNumber)(value));
|
|
129
|
+
if (rotationY === 0 && rotationZ === 0) {
|
|
130
|
+
return rotationX === 0
|
|
131
|
+
? (0, exports.serializeCssRotation)(0, decimalPlaces)
|
|
132
|
+
: `x ${(0, exports.serializeCssRotation)(rotationX, decimalPlaces)}`;
|
|
133
|
+
}
|
|
134
|
+
if (rotationX === 0 && rotationZ === 0) {
|
|
135
|
+
return `y ${(0, exports.serializeCssRotation)(rotationY, decimalPlaces)}`;
|
|
136
|
+
}
|
|
137
|
+
if (rotationX === 0 && rotationY === 0) {
|
|
138
|
+
return (0, exports.serializeCssRotation)(rotationZ, decimalPlaces);
|
|
139
|
+
}
|
|
140
|
+
const halfRotationX = (rotationX * Math.PI) / 360;
|
|
141
|
+
const halfRotationY = (rotationY * Math.PI) / 360;
|
|
142
|
+
const halfRotationZ = (rotationZ * Math.PI) / 360;
|
|
143
|
+
const sinX = Math.sin(halfRotationX);
|
|
144
|
+
const cosX = Math.cos(halfRotationX);
|
|
145
|
+
const sinY = Math.sin(halfRotationY);
|
|
146
|
+
const cosY = Math.cos(halfRotationY);
|
|
147
|
+
const sinZ = Math.sin(halfRotationZ);
|
|
148
|
+
const cosZ = Math.cos(halfRotationZ);
|
|
149
|
+
// Compose the three editable angles into the axis-angle form CSS rotate accepts.
|
|
150
|
+
const quaternionX = sinX * cosY * cosZ + cosX * sinY * sinZ;
|
|
151
|
+
const quaternionY = cosX * sinY * cosZ - sinX * cosY * sinZ;
|
|
152
|
+
const quaternionZ = cosX * cosY * sinZ + sinX * sinY * cosZ;
|
|
153
|
+
const quaternionW = cosX * cosY * cosZ - sinX * sinY * sinZ;
|
|
154
|
+
const angle = 2 * Math.acos(Math.max(-1, Math.min(1, quaternionW)));
|
|
155
|
+
const sinHalfAngle = Math.sqrt(Math.max(0, 1 - quaternionW * quaternionW));
|
|
156
|
+
if (sinHalfAngle < 0.0000001) {
|
|
157
|
+
return (0, exports.serializeCssRotation)(0, decimalPlaces);
|
|
158
|
+
}
|
|
159
|
+
return (0, exports.serializeCssRotation3d)({
|
|
160
|
+
axis: [
|
|
161
|
+
quaternionX / sinHalfAngle,
|
|
162
|
+
quaternionY / sinHalfAngle,
|
|
163
|
+
quaternionZ / sinHalfAngle,
|
|
164
|
+
],
|
|
165
|
+
degrees: angle * (180 / Math.PI),
|
|
166
|
+
decimalPlaces,
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
exports.serializeCssRotationFromEuler = serializeCssRotationFromEuler;
|
|
29
170
|
const serializeCssRotation = (value, decimalPlaces = 6) => {
|
|
30
171
|
const factor = 10 ** decimalPlaces;
|
|
31
172
|
const rounded = Math.round((0, timeline_field_utils_1.normalizeTimelineNumber)(value) * factor) / factor;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const
|
|
1
|
+
export type ParsedTranslate = readonly [number, number, number | null];
|
|
2
|
+
export declare const parseTranslate: (value: string) => ParsedTranslate;
|
|
3
|
+
export declare const serializeTranslate: ([x, y, z]: ParsedTranslate, decimalPlaces?: number) => string;
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serializeTranslate = exports.parseTranslate = void 0;
|
|
4
4
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
5
|
-
const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
|
|
5
|
+
const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
|
|
6
6
|
const translateDecimalPlaces = 1;
|
|
7
7
|
const parseTranslate = (value) => {
|
|
8
8
|
const m = value.match(PIXEL_PATTERN);
|
|
9
9
|
if (!m) {
|
|
10
|
-
return [0, 0];
|
|
10
|
+
return [0, 0, null];
|
|
11
11
|
}
|
|
12
12
|
return [
|
|
13
13
|
(0, timeline_field_utils_1.normalizeTimelineNumber)(Number(m[1])),
|
|
14
14
|
m[2] !== undefined ? (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(m[2])) : 0,
|
|
15
|
+
m[3] !== undefined ? (0, timeline_field_utils_1.normalizeTimelineNumber)(Number(m[3])) : null,
|
|
15
16
|
];
|
|
16
17
|
};
|
|
17
18
|
exports.parseTranslate = parseTranslate;
|
|
@@ -20,7 +21,10 @@ const formatTranslateCoordinate = (value, decimalPlaces) => {
|
|
|
20
21
|
const rounded = (0, timeline_field_utils_1.roundToDecimalPlaces)(normalized, decimalPlaces);
|
|
21
22
|
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
22
23
|
};
|
|
23
|
-
const serializeTranslate = (x, y, decimalPlaces = translateDecimalPlaces) => {
|
|
24
|
-
|
|
24
|
+
const serializeTranslate = ([x, y, z], decimalPlaces = translateDecimalPlaces) => {
|
|
25
|
+
const xy = `${formatTranslateCoordinate(x, decimalPlaces)}px ${formatTranslateCoordinate(y, decimalPlaces)}px`;
|
|
26
|
+
return z === null
|
|
27
|
+
? xy
|
|
28
|
+
: `${xy} ${formatTranslateCoordinate(z, decimalPlaces)}px`;
|
|
25
29
|
};
|
|
26
30
|
exports.serializeTranslate = serializeTranslate;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
2
|
+
export declare const propStatusHas3DTransformValue: ({ fieldKey, propStatus, runtimeValue, }: {
|
|
3
|
+
readonly fieldKey: string;
|
|
4
|
+
readonly propStatus: CanUpdateSequencePropStatus | undefined;
|
|
5
|
+
readonly runtimeValue: unknown;
|
|
6
|
+
}) => boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propStatusHas3DTransformValue = void 0;
|
|
4
|
+
const no_react_1 = require("remotion/no-react");
|
|
5
|
+
const timeline_rotation_utils_1 = require("./timeline-rotation-utils");
|
|
6
|
+
const timeline_translate_utils_1 = require("./timeline-translate-utils");
|
|
7
|
+
const transform_origin_utils_1 = require("./transform-origin-utils");
|
|
8
|
+
const has3DTransformValue = ({ fieldKey, value, }) => {
|
|
9
|
+
if (fieldKey === 'style.scale') {
|
|
10
|
+
return no_react_1.NoReactInternals.parseScaleValue(value)[2] !== 1;
|
|
11
|
+
}
|
|
12
|
+
if (fieldKey === 'style.rotate') {
|
|
13
|
+
const rotation = (0, timeline_rotation_utils_1.parseCssRotationToEuler)(String(value !== null && value !== void 0 ? value : '0deg'));
|
|
14
|
+
return rotation[0] !== 0 || rotation[1] !== 0;
|
|
15
|
+
}
|
|
16
|
+
if (fieldKey === 'style.translate') {
|
|
17
|
+
const z = (0, timeline_translate_utils_1.parseTranslate)(String(value !== null && value !== void 0 ? value : '0px 0px'))[2];
|
|
18
|
+
return z !== null && z !== 0;
|
|
19
|
+
}
|
|
20
|
+
if (fieldKey === 'style.transformOrigin') {
|
|
21
|
+
const parsed = (0, transform_origin_utils_1.parseTransformOrigin)(value);
|
|
22
|
+
const z = (parsed === null || parsed === void 0 ? void 0 : parsed.z) ? (0, transform_origin_utils_1.parseTransformOriginZ)(parsed.z) : null;
|
|
23
|
+
return z !== null && z.value !== 0;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
const propStatusHas3DTransformValue = ({ fieldKey, propStatus, runtimeValue, }) => {
|
|
28
|
+
if ((propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'keyframed') {
|
|
29
|
+
return propStatus.keyframes.some((keyframe) => has3DTransformValue({ fieldKey, value: keyframe.value }));
|
|
30
|
+
}
|
|
31
|
+
return has3DTransformValue({
|
|
32
|
+
fieldKey,
|
|
33
|
+
value: (propStatus === null || propStatus === void 0 ? void 0 : propStatus.status) === 'static' ? propStatus.codeValue : runtimeValue,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.propStatusHas3DTransformValue = propStatusHas3DTransformValue;
|
|
@@ -8,6 +8,10 @@ export type ParsedTransformOrigin = {
|
|
|
8
8
|
readonly y: TransformOriginAxisValue;
|
|
9
9
|
readonly z: string | null;
|
|
10
10
|
};
|
|
11
|
+
export declare const parseTransformOriginZ: (token: string) => {
|
|
12
|
+
readonly value: number;
|
|
13
|
+
readonly unit: string;
|
|
14
|
+
} | null;
|
|
11
15
|
export declare const parseTransformOrigin: (value: unknown) => ParsedTransformOrigin | null;
|
|
12
16
|
export declare const axisValueToUv: (axis: TransformOriginAxisValue, size: number) => number | null;
|
|
13
17
|
export declare const parsedTransformOriginToUv: ({ parsed, width, height, }: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformOriginPercentToUv = exports.parsedTransformOriginToPercent = exports.serializeTransformOrigin = exports.parsedTransformOriginToUv = exports.axisValueToUv = exports.parseTransformOrigin = void 0;
|
|
3
|
+
exports.transformOriginPercentToUv = exports.parsedTransformOriginToPercent = exports.serializeTransformOrigin = exports.parsedTransformOriginToUv = exports.axisValueToUv = exports.parseTransformOrigin = exports.parseTransformOriginZ = void 0;
|
|
4
4
|
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
5
5
|
const cssNumberWithUnit = /^([+-]?(?:\d+\.?\d*|\.\d+))(px|%)$/i;
|
|
6
|
-
const cssLength = /^([+-]?(?:\d+\.?\d*|\.\d+))[a-zA-Z]
|
|
6
|
+
const cssLength = /^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z]+)$/;
|
|
7
7
|
const keywords = new Set(['left', 'center', 'right', 'top', 'bottom']);
|
|
8
8
|
const center = { value: 50, unit: '%' };
|
|
9
9
|
const keywordOptions = (keyword) => {
|
|
@@ -108,12 +108,18 @@ const parseXY = (parts) => {
|
|
|
108
108
|
}
|
|
109
109
|
return keywordIsFirst ? [center, length] : [length, center];
|
|
110
110
|
};
|
|
111
|
-
const
|
|
111
|
+
const parseTransformOriginZ = (token) => {
|
|
112
112
|
if (token.includes('%')) {
|
|
113
|
-
return
|
|
113
|
+
return null;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
const match = cssLength.exec(token);
|
|
116
|
+
if (!match) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const value = Number(match[1]);
|
|
120
|
+
return Number.isFinite(value) ? { value, unit: match[2] } : null;
|
|
116
121
|
};
|
|
122
|
+
exports.parseTransformOriginZ = parseTransformOriginZ;
|
|
117
123
|
const parseTransformOrigin = (value) => {
|
|
118
124
|
var _a;
|
|
119
125
|
if (typeof value !== 'string') {
|
|
@@ -128,7 +134,7 @@ const parseTransformOrigin = (value) => {
|
|
|
128
134
|
return null;
|
|
129
135
|
}
|
|
130
136
|
const z = (_a = parts[2]) !== null && _a !== void 0 ? _a : null;
|
|
131
|
-
if (z !== null &&
|
|
137
|
+
if (z !== null && (0, exports.parseTransformOriginZ)(z) === null) {
|
|
132
138
|
return null;
|
|
133
139
|
}
|
|
134
140
|
return { x: xy[0], y: xy[1], z };
|