@remotion/studio 4.0.431 → 4.0.433
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/Studio.d.ts +1 -0
- package/dist/Studio.js +4 -6
- package/dist/components/AssetSelectorItem.js +6 -8
- package/dist/components/CompositionSelector.js +16 -9
- package/dist/components/CurrentComposition.js +2 -5
- package/dist/components/EditorContent.js +4 -5
- package/dist/components/NewComposition/InputDragger.d.ts +1 -0
- package/dist/components/NewComposition/InputDragger.js +27 -8
- package/dist/components/OptionsPanel.js +1 -1
- package/dist/components/PlaybackRatePersistor.js +1 -1
- package/dist/components/PreviewToolbar.js +4 -2
- package/dist/components/RenderModal/WebRenderModal.d.ts +1 -1
- package/dist/components/RenderModal/WebRenderModal.js +55 -26
- package/dist/components/RenderModal/WebRenderModalAudio.d.ts +2 -0
- package/dist/components/RenderModal/WebRenderModalAudio.js +13 -5
- package/dist/components/RenderModal/WebRenderModalBasic.js +42 -35
- package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -3
- package/dist/components/RenderQueue/client-side-render-types.d.ts +1 -1
- package/dist/components/RendersTab.js +1 -9
- package/dist/components/Timeline/TimelineBooleanField.d.ts +9 -0
- package/dist/components/Timeline/TimelineBooleanField.js +20 -0
- package/dist/components/Timeline/TimelineEmptyState.d.ts +2 -0
- package/dist/components/Timeline/TimelineEmptyState.js +15 -0
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +5 -0
- package/dist/components/Timeline/TimelineExpandedSection.js +54 -152
- package/dist/components/Timeline/TimelineFieldRow.d.ts +11 -0
- package/dist/components/Timeline/TimelineFieldRow.js +83 -0
- package/dist/components/Timeline/TimelineListItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineListItem.js +12 -23
- package/dist/components/Timeline/TimelineNumberField.d.ts +11 -0
- package/dist/components/Timeline/TimelineNumberField.js +53 -0
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -1
- package/dist/components/Timeline/TimelineRotationField.d.ts +11 -0
- package/dist/components/Timeline/TimelineRotationField.js +64 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -4
- package/dist/components/Timeline/TimelineSchemaField.js +20 -77
- package/dist/components/Timeline/TimelineTranslateField.d.ts +11 -0
- package/dist/components/Timeline/TimelineTranslateField.js +115 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +2 -0
- package/dist/components/Timeline/timeline-field-utils.js +12 -0
- package/dist/components/Timeline/use-resolved-stack.d.ts +2 -0
- package/dist/components/Timeline/use-resolved-stack.js +54 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +4 -0
- package/dist/components/Timeline/use-sequence-props-subscription.js +150 -0
- package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +5 -0
- package/dist/esm/{chunk-3msfwcwh.js → chunk-bd1bkakk.js} +3001 -2433
- package/dist/esm/internals.mjs +3001 -2433
- package/dist/esm/previewEntry.mjs +3011 -2442
- package/dist/esm/renderEntry.mjs +5 -4
- package/dist/helpers/calculate-timeline.js +17 -11
- package/dist/helpers/get-timeline-sequence-layout.js +3 -3
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -1
- package/dist/helpers/get-timeline-sequence-sort-key.js +6 -3
- package/dist/helpers/inject-css.js +6 -1
- package/dist/helpers/sort-by-nonce-history.d.ts +5 -0
- package/dist/helpers/sort-by-nonce-history.js +73 -0
- package/dist/helpers/timeline-layout.d.ts +2 -2
- package/dist/helpers/timeline-layout.js +10 -4
- package/dist/internals.d.ts +1 -0
- package/dist/previewEntry.js +1 -1
- package/dist/renderEntry.js +3 -3
- package/package.json +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimelineListItem = void 0;
|
|
3
|
+
exports.TimelineListItem = exports.SPACING = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
@@ -11,10 +11,11 @@ const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
|
|
|
11
11
|
const TimelineExpandedSection_1 = require("./TimelineExpandedSection");
|
|
12
12
|
const TimelineLayerEye_1 = require("./TimelineLayerEye");
|
|
13
13
|
const TimelineStack_1 = require("./TimelineStack");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const use_resolved_stack_1 = require("./use-resolved-stack");
|
|
15
|
+
const use_sequence_props_subscription_1 = require("./use-sequence-props-subscription");
|
|
16
|
+
exports.SPACING = 5;
|
|
16
17
|
const space = {
|
|
17
|
-
width: SPACING,
|
|
18
|
+
width: exports.SPACING,
|
|
18
19
|
flexShrink: 0,
|
|
19
20
|
};
|
|
20
21
|
const arrowButton = {
|
|
@@ -36,33 +37,21 @@ const arrowButton = {
|
|
|
36
37
|
lineHeight: 1,
|
|
37
38
|
};
|
|
38
39
|
const TimelineListItem = ({ nestedDepth, sequence, isCompact }) => {
|
|
39
|
-
var _a;
|
|
40
|
+
var _a, _b;
|
|
40
41
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
41
42
|
const visualModeEnabled = Boolean(process.env.EXPERIMENTAL_VISUAL_MODE_ENABLED) &&
|
|
42
43
|
previewServerState.type === 'connected';
|
|
43
44
|
const { hidden, setHidden } = (0, react_1.useContext)(remotion_1.Internals.SequenceVisibilityToggleContext);
|
|
44
45
|
const { expandedTracks, toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksContext);
|
|
45
|
-
const
|
|
46
|
-
(0,
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
(0, get_stack_1.getOriginalLocationFromStack)(sequence.stack, 'sequence')
|
|
51
|
-
.then((frame) => {
|
|
52
|
-
setOriginalLocation(frame);
|
|
53
|
-
})
|
|
54
|
-
.catch((err) => {
|
|
55
|
-
// eslint-disable-next-line no-console
|
|
56
|
-
console.error('Could not get original location of Sequence', err);
|
|
57
|
-
});
|
|
58
|
-
}, [sequence.stack]);
|
|
59
|
-
const isExpanded = visualModeEnabled && ((_a = expandedTracks[sequence.id]) !== null && _a !== void 0 ? _a : false);
|
|
46
|
+
const originalLocation = (0, use_resolved_stack_1.useResolvedStack)((_a = sequence.stack) !== null && _a !== void 0 ? _a : null);
|
|
47
|
+
const nodePath = (0, use_sequence_props_subscription_1.useSequencePropsSubscription)(sequence, originalLocation);
|
|
48
|
+
const isExpanded = visualModeEnabled && ((_b = expandedTracks[sequence.id]) !== null && _b !== void 0 ? _b : false);
|
|
60
49
|
const onToggleExpand = (0, react_1.useCallback)(() => {
|
|
61
50
|
toggleTrack(sequence.id);
|
|
62
51
|
}, [sequence.id, toggleTrack]);
|
|
63
52
|
const padder = (0, react_1.useMemo)(() => {
|
|
64
53
|
return {
|
|
65
|
-
width: Number(SPACING *
|
|
54
|
+
width: Number(exports.SPACING * 3) * nestedDepth,
|
|
66
55
|
flexShrink: 0,
|
|
67
56
|
};
|
|
68
57
|
}, [nestedDepth]);
|
|
@@ -89,7 +78,7 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact }) => {
|
|
|
89
78
|
alignItems: 'center',
|
|
90
79
|
wordBreak: 'break-all',
|
|
91
80
|
textAlign: 'left',
|
|
92
|
-
paddingLeft: SPACING,
|
|
81
|
+
paddingLeft: exports.SPACING,
|
|
93
82
|
borderBottom: `1px solid ${colors_1.TIMELINE_TRACK_SEPARATOR}`,
|
|
94
83
|
};
|
|
95
84
|
}, [sequence.type]);
|
|
@@ -102,6 +91,6 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact }) => {
|
|
|
102
91
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
103
92
|
jsx_runtime_1.jsxs("div", { style: outer, children: [
|
|
104
93
|
jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility }), jsx_runtime_1.jsx("div", { style: padder }), sequence.parent && nestedDepth > 0 ? jsx_runtime_1.jsx("div", { style: space }) : null, visualModeEnabled ? (sequence.controls ? (jsx_runtime_1.jsx("button", { type: "button", style: arrowStyle, onClick: onToggleExpand, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} track`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: { display: 'block' }, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "white" }) }) })) : (jsx_runtime_1.jsx("div", { style: arrowButton }))) : null, jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation })
|
|
105
|
-
] }), visualModeEnabled && isExpanded && sequence.controls ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, originalLocation: originalLocation })) : null] }));
|
|
94
|
+
] }), visualModeEnabled && isExpanded && sequence.controls ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, originalLocation: originalLocation, nestedDepth: nestedDepth, nodePath: nodePath })) : null] }));
|
|
106
95
|
};
|
|
107
96
|
exports.TimelineListItem = TimelineListItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
3
|
+
export declare const TimelineNumberField: React.FC<{
|
|
4
|
+
readonly field: SchemaFieldInfo;
|
|
5
|
+
readonly effectiveValue: unknown;
|
|
6
|
+
readonly codeValue: unknown;
|
|
7
|
+
readonly canUpdate: boolean;
|
|
8
|
+
readonly onSave: (key: string, value: unknown) => Promise<void>;
|
|
9
|
+
readonly onDragValueChange: (key: string, value: unknown) => void;
|
|
10
|
+
readonly onDragEnd: () => void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineNumberField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
|
+
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
8
|
+
const TimelineNumberField = ({ field, effectiveValue, canUpdate, onSave, onDragValueChange, onDragEnd, codeValue, }) => {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
const [dragValue, setDragValue] = (0, react_1.useState)(null);
|
|
11
|
+
const onValueChange = (0, react_1.useCallback)((newVal) => {
|
|
12
|
+
setDragValue(newVal);
|
|
13
|
+
onDragValueChange(field.key, newVal);
|
|
14
|
+
}, [onDragValueChange, field.key]);
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
setDragValue(null);
|
|
17
|
+
onDragEnd();
|
|
18
|
+
}, [field.currentValue, onDragEnd]);
|
|
19
|
+
const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
20
|
+
if (canUpdate && newVal !== codeValue) {
|
|
21
|
+
onSave(field.key, newVal).catch(() => {
|
|
22
|
+
setDragValue(null);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setDragValue(null);
|
|
27
|
+
}
|
|
28
|
+
}, [canUpdate, onSave, field.key, codeValue]);
|
|
29
|
+
const onTextChange = (0, react_1.useCallback)((newVal) => {
|
|
30
|
+
if (canUpdate) {
|
|
31
|
+
const parsed = Number(newVal);
|
|
32
|
+
if (!Number.isNaN(parsed) && parsed !== codeValue) {
|
|
33
|
+
setDragValue(parsed);
|
|
34
|
+
onSave(field.key, parsed).catch(() => {
|
|
35
|
+
setDragValue(null);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, [canUpdate, onSave, field.key, codeValue]);
|
|
40
|
+
const step = field.fieldSchema.type === 'number' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
|
|
41
|
+
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
42
|
+
const formatter = (0, react_1.useCallback)((v) => {
|
|
43
|
+
const num = Number(v);
|
|
44
|
+
const digits = Math.max(stepDecimals, (0, timeline_field_utils_1.getDecimalPlaces)(num));
|
|
45
|
+
return digits === 0 ? String(num) : num.toFixed(digits);
|
|
46
|
+
}, [stepDecimals]);
|
|
47
|
+
return (jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragValue !== null && dragValue !== void 0 ? dragValue : effectiveValue, style: timeline_field_utils_1.draggerStyle, status: "ok", small: true, onValueChange: onValueChange, onValueChangeEnd: onValueChangeEnd, onTextChange: onTextChange, min: field.fieldSchema.type === 'number'
|
|
48
|
+
? ((_b = field.fieldSchema.min) !== null && _b !== void 0 ? _b : -Infinity)
|
|
49
|
+
: -Infinity, max: field.fieldSchema.type === 'number'
|
|
50
|
+
? ((_c = field.fieldSchema.max) !== null && _c !== void 0 ? _c : Infinity)
|
|
51
|
+
: Infinity, step: step, formatter: formatter, rightAlign: false }));
|
|
52
|
+
};
|
|
53
|
+
exports.TimelineNumberField = TimelineNumberField;
|
|
@@ -11,7 +11,7 @@ let lastTimelinePositionWhileScrolling = null;
|
|
|
11
11
|
const TimelinePlayCursorSyncer = () => {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const video = remotion_1.Internals.useVideo();
|
|
14
|
-
const timelineContext =
|
|
14
|
+
const timelineContext = remotion_1.Internals.useTimelineContext();
|
|
15
15
|
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
16
16
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
17
17
|
const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
3
|
+
export declare const TimelineRotationField: React.FC<{
|
|
4
|
+
readonly field: SchemaFieldInfo;
|
|
5
|
+
readonly effectiveValue: unknown;
|
|
6
|
+
readonly codeValue: unknown;
|
|
7
|
+
readonly canUpdate: boolean;
|
|
8
|
+
readonly onSave: (key: string, value: unknown) => Promise<void>;
|
|
9
|
+
readonly onDragValueChange: (key: string, value: unknown) => void;
|
|
10
|
+
readonly onDragEnd: () => void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineRotationField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
|
+
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
8
|
+
const parseCssRotationToDegrees = (value) => {
|
|
9
|
+
try {
|
|
10
|
+
const m = new DOMMatrix(`rotate(${value})`);
|
|
11
|
+
return Math.round(Math.atan2(m.b, m.a) * (180 / Math.PI) * 1e6) / 1e6;
|
|
12
|
+
}
|
|
13
|
+
catch (_a) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const TimelineRotationField = ({ field, effectiveValue, codeValue, canUpdate, onSave, onDragValueChange, onDragEnd, }) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const [dragValue, setDragValue] = (0, react_1.useState)(null);
|
|
20
|
+
const degrees = (0, react_1.useMemo)(() => parseCssRotationToDegrees(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0deg')), [effectiveValue]);
|
|
21
|
+
const onValueChange = (0, react_1.useCallback)((newVal) => {
|
|
22
|
+
setDragValue(newVal);
|
|
23
|
+
onDragValueChange(field.key, `${newVal}deg`);
|
|
24
|
+
}, [onDragValueChange, field.key]);
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
setDragValue(null);
|
|
27
|
+
onDragEnd();
|
|
28
|
+
}, [field.currentValue, onDragEnd]);
|
|
29
|
+
const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
30
|
+
const newStr = `${newVal}deg`;
|
|
31
|
+
if (canUpdate && newStr !== codeValue) {
|
|
32
|
+
onSave(field.key, newStr).catch(() => {
|
|
33
|
+
setDragValue(null);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setDragValue(null);
|
|
38
|
+
}
|
|
39
|
+
}, [canUpdate, onSave, field.key, codeValue]);
|
|
40
|
+
const onTextChange = (0, react_1.useCallback)((newVal) => {
|
|
41
|
+
if (canUpdate) {
|
|
42
|
+
const parsed = Number(newVal);
|
|
43
|
+
if (!Number.isNaN(parsed)) {
|
|
44
|
+
const newStr = `${parsed}deg`;
|
|
45
|
+
if (newStr !== codeValue) {
|
|
46
|
+
setDragValue(parsed);
|
|
47
|
+
onSave(field.key, newStr).catch(() => {
|
|
48
|
+
setDragValue(null);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [canUpdate, onSave, field.key, codeValue]);
|
|
54
|
+
const step = field.fieldSchema.type === 'rotation' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
|
|
55
|
+
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
56
|
+
const formatter = (0, react_1.useCallback)((v) => {
|
|
57
|
+
const num = Number(v);
|
|
58
|
+
const digits = Math.max(stepDecimals, (0, timeline_field_utils_1.getDecimalPlaces)(num));
|
|
59
|
+
const formatted = digits === 0 ? String(num) : num.toFixed(digits);
|
|
60
|
+
return `${formatted}\u00B0`;
|
|
61
|
+
}, [stepDecimals]);
|
|
62
|
+
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: -Infinity, max: Infinity, step: step, formatter: formatter, rightAlign: false }));
|
|
63
|
+
};
|
|
64
|
+
exports.TimelineRotationField = TimelineRotationField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CanUpdateSequencePropStatus } from '@remotion/studio-shared';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
3
|
import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
4
4
|
export declare const TimelineFieldValue: React.FC<{
|
|
5
5
|
readonly field: SchemaFieldInfo;
|
|
@@ -8,7 +8,6 @@ export declare const TimelineFieldValue: React.FC<{
|
|
|
8
8
|
readonly onDragEnd: () => void;
|
|
9
9
|
readonly canUpdate: boolean;
|
|
10
10
|
readonly propStatus: CanUpdateSequencePropStatus | null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly saving: boolean;
|
|
11
|
+
readonly codeValue: unknown;
|
|
12
|
+
readonly effectiveValue: unknown;
|
|
14
13
|
}>;
|
|
@@ -1,80 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TimelineFieldValue = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
5
|
+
const TimelineBooleanField_1 = require("./TimelineBooleanField");
|
|
6
|
+
const TimelineNumberField_1 = require("./TimelineNumberField");
|
|
7
|
+
const TimelineRotationField_1 = require("./TimelineRotationField");
|
|
8
|
+
const TimelineTranslateField_1 = require("./TimelineTranslateField");
|
|
9
9
|
const unsupportedLabel = {
|
|
10
10
|
color: 'rgba(255, 255, 255, 0.4)',
|
|
11
11
|
fontSize: 12,
|
|
12
|
-
marginLeft: 'auto',
|
|
13
12
|
fontStyle: 'italic',
|
|
14
13
|
};
|
|
15
|
-
const draggerStyle = {
|
|
16
|
-
width: 80,
|
|
17
|
-
marginLeft: 'auto',
|
|
18
|
-
};
|
|
19
|
-
const checkboxContainer = {
|
|
20
|
-
marginLeft: 'auto',
|
|
21
|
-
};
|
|
22
14
|
const notEditableBackground = {
|
|
23
15
|
backgroundColor: 'rgba(255, 0, 0, 0.2)',
|
|
24
16
|
borderRadius: 3,
|
|
25
17
|
padding: '0 4px',
|
|
26
18
|
};
|
|
27
|
-
const
|
|
28
|
-
var _a, _b, _c;
|
|
29
|
-
const [dragValue, setDragValue] = (0, react_1.useState)(null);
|
|
30
|
-
const dragging = (0, react_1.useRef)(false);
|
|
31
|
-
const onValueChange = (0, react_1.useCallback)((newVal) => {
|
|
32
|
-
dragging.current = true;
|
|
33
|
-
setDragValue(newVal);
|
|
34
|
-
onDragValueChange(field.key, newVal);
|
|
35
|
-
}, [onDragValueChange, field.key]);
|
|
36
|
-
(0, react_1.useEffect)(() => {
|
|
37
|
-
setDragValue(null);
|
|
38
|
-
onDragEnd();
|
|
39
|
-
}, [field.currentValue, onDragEnd]);
|
|
40
|
-
const onValueChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
41
|
-
if (canUpdate && newVal !== codeValue) {
|
|
42
|
-
onSave(field.key, newVal).catch(() => {
|
|
43
|
-
setDragValue(null);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
setDragValue(null);
|
|
48
|
-
}
|
|
49
|
-
}, [canUpdate, onSave, field.key, codeValue]);
|
|
50
|
-
const onTextChange = (0, react_1.useCallback)((newVal) => {
|
|
51
|
-
if (canUpdate) {
|
|
52
|
-
const parsed = Number(newVal);
|
|
53
|
-
if (!Number.isNaN(parsed) && parsed !== codeValue) {
|
|
54
|
-
setDragValue(parsed);
|
|
55
|
-
onSave(field.key, parsed).catch(() => {
|
|
56
|
-
setDragValue(null);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, [canUpdate, onSave, field.key, codeValue]);
|
|
61
|
-
return (jsx_runtime_1.jsx(InputDragger_1.InputDragger, { type: "number", value: dragValue !== null && dragValue !== void 0 ? dragValue : codeValue, style: draggerStyle, status: "ok", onValueChange: onValueChange, onValueChangeEnd: onValueChangeEnd, onTextChange: onTextChange, min: field.fieldSchema.type === 'number'
|
|
62
|
-
? ((_a = field.fieldSchema.min) !== null && _a !== void 0 ? _a : -Infinity)
|
|
63
|
-
: -Infinity, max: field.fieldSchema.type === 'number'
|
|
64
|
-
? ((_b = field.fieldSchema.max) !== null && _b !== void 0 ? _b : Infinity)
|
|
65
|
-
: Infinity, step: field.fieldSchema.type === 'number' ? ((_c = field.fieldSchema.step) !== null && _c !== void 0 ? _c : 1) : 1, rightAlign: true }));
|
|
66
|
-
};
|
|
67
|
-
const TimelineBooleanField = ({ field, codeValue, canUpdate, onSave }) => {
|
|
68
|
-
const checked = Boolean(codeValue);
|
|
69
|
-
const onChange = (0, react_1.useCallback)(() => {
|
|
70
|
-
if (canUpdate) {
|
|
71
|
-
onSave(field.key, !checked);
|
|
72
|
-
}
|
|
73
|
-
}, [canUpdate, onSave, field.key, checked]);
|
|
74
|
-
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled: !canUpdate }) }));
|
|
75
|
-
};
|
|
76
|
-
const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, canUpdate }) => {
|
|
77
|
-
var _a, _b;
|
|
19
|
+
const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, canUpdate, effectiveValue, codeValue, }) => {
|
|
78
20
|
const wrapperStyle = canUpdate === null || canUpdate === false
|
|
79
21
|
? notEditableBackground
|
|
80
22
|
: undefined;
|
|
@@ -82,25 +24,26 @@ const TimelineFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propS
|
|
|
82
24
|
return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "unsupported" });
|
|
83
25
|
}
|
|
84
26
|
if (propStatus !== null && !propStatus.canUpdate) {
|
|
85
|
-
|
|
27
|
+
if (propStatus.reason === 'computed') {
|
|
28
|
+
return jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "computed" });
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`Unsupported prop status: ${propStatus.reason}`);
|
|
86
31
|
}
|
|
87
32
|
if (propStatus === null) {
|
|
88
|
-
return (jsx_runtime_1.jsx("span", { style:
|
|
33
|
+
return (jsx_runtime_1.jsx("span", { style: notEditableBackground, children: jsx_runtime_1.jsx("span", { style: unsupportedLabel, children: "error" }) }));
|
|
89
34
|
}
|
|
90
|
-
const effectiveCodeValue = (_b = (_a = propStatus.codeValue) !== null && _a !== void 0 ? _a : field.currentValue) !== null && _b !== void 0 ? _b : field.fieldSchema.default;
|
|
91
35
|
if (field.typeName === 'number') {
|
|
92
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineNumberField, { field: field,
|
|
36
|
+
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { field: field, effectiveValue: effectiveValue, canUpdate: canUpdate, onSave: onSave, codeValue: codeValue, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
37
|
+
}
|
|
38
|
+
if (field.typeName === 'rotation') {
|
|
39
|
+
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineRotationField_1.TimelineRotationField, { field: field, effectiveValue: effectiveValue, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
40
|
+
}
|
|
41
|
+
if (field.typeName === 'translate') {
|
|
42
|
+
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineTranslateField_1.TimelineTranslateField, { field: field, effectiveValue: effectiveValue, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd }) }));
|
|
93
43
|
}
|
|
94
44
|
if (field.typeName === 'boolean') {
|
|
95
|
-
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineBooleanField, { field: field, codeValue:
|
|
45
|
+
return (jsx_runtime_1.jsx("span", { style: wrapperStyle, children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { field: field, codeValue: codeValue, canUpdate: canUpdate, onSave: onSave, effectiveValue: effectiveValue }) }));
|
|
96
46
|
}
|
|
97
|
-
return (jsx_runtime_1.jsx("span", { style: { ...unsupportedLabel, fontStyle: 'normal' }, children: String(
|
|
47
|
+
return (jsx_runtime_1.jsx("span", { style: { ...unsupportedLabel, fontStyle: 'normal' }, children: String(effectiveValue) }));
|
|
98
48
|
};
|
|
99
49
|
exports.TimelineFieldValue = TimelineFieldValue;
|
|
100
|
-
const TimelineFieldSavingSpinner = ({ saving }) => {
|
|
101
|
-
if (!saving) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
return jsx_runtime_1.jsx(Spinner_1.Spinner, { duration: 0.5, size: 12 });
|
|
105
|
-
};
|
|
106
|
-
exports.TimelineFieldSavingSpinner = TimelineFieldSavingSpinner;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
3
|
+
export declare const TimelineTranslateField: React.FC<{
|
|
4
|
+
readonly field: SchemaFieldInfo;
|
|
5
|
+
readonly codeValue: unknown;
|
|
6
|
+
readonly effectiveValue: unknown;
|
|
7
|
+
readonly canUpdate: boolean;
|
|
8
|
+
readonly onSave: (key: string, value: unknown) => Promise<void>;
|
|
9
|
+
readonly onDragValueChange: (key: string, value: unknown) => void;
|
|
10
|
+
readonly onDragEnd: () => void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineTranslateField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const InputDragger_1 = require("../NewComposition/InputDragger");
|
|
7
|
+
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
8
|
+
const leftDraggerStyle = {
|
|
9
|
+
paddingLeft: 0,
|
|
10
|
+
};
|
|
11
|
+
const rightDraggerStyle = {
|
|
12
|
+
paddingRight: 0,
|
|
13
|
+
};
|
|
14
|
+
const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
|
|
15
|
+
const parseTranslate = (value) => {
|
|
16
|
+
const m = value.match(PIXEL_PATTERN);
|
|
17
|
+
if (!m) {
|
|
18
|
+
return [0, 0];
|
|
19
|
+
}
|
|
20
|
+
return [Number(m[1]), m[2] !== undefined ? Number(m[2]) : 0];
|
|
21
|
+
};
|
|
22
|
+
const containerStyle = {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
gap: 4,
|
|
25
|
+
};
|
|
26
|
+
const TimelineTranslateField = ({ field, codeValue, effectiveValue, canUpdate, onSave, onDragValueChange, onDragEnd, }) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const [dragX, setDragX] = (0, react_1.useState)(null);
|
|
29
|
+
const [dragY, setDragY] = (0, react_1.useState)(null);
|
|
30
|
+
const [codeX, codeY] = (0, react_1.useMemo)(() => parseTranslate(String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : '0px 0px')), [effectiveValue]);
|
|
31
|
+
const makeString = (0, react_1.useCallback)((x, y) => `${x}px ${y}px`, []);
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
setDragX(null);
|
|
34
|
+
setDragY(null);
|
|
35
|
+
onDragEnd();
|
|
36
|
+
}, [field.currentValue, onDragEnd]);
|
|
37
|
+
const step = field.fieldSchema.type === 'translate' ? ((_a = field.fieldSchema.step) !== null && _a !== void 0 ? _a : 1) : 1;
|
|
38
|
+
const stepDecimals = (0, react_1.useMemo)(() => (0, timeline_field_utils_1.getDecimalPlaces)(step), [step]);
|
|
39
|
+
const formatter = (0, react_1.useCallback)((v) => {
|
|
40
|
+
const num = Number(v);
|
|
41
|
+
const digits = Math.max(stepDecimals, (0, timeline_field_utils_1.getDecimalPlaces)(num));
|
|
42
|
+
const formatted = digits === 0 ? String(num) : num.toFixed(digits);
|
|
43
|
+
return `${formatted}px`;
|
|
44
|
+
}, [stepDecimals]);
|
|
45
|
+
// --- X callbacks ---
|
|
46
|
+
const onXChange = (0, react_1.useCallback)((newVal) => {
|
|
47
|
+
setDragX(newVal);
|
|
48
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
49
|
+
onDragValueChange(field.key, makeString(newVal, currentY));
|
|
50
|
+
}, [onDragValueChange, field.key, dragY, codeY, makeString]);
|
|
51
|
+
const onXChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
52
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
53
|
+
const newStr = makeString(newVal, currentY);
|
|
54
|
+
if (canUpdate && newStr !== codeValue) {
|
|
55
|
+
onSave(field.key, newStr).catch(() => {
|
|
56
|
+
setDragX(null);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
setDragX(null);
|
|
61
|
+
}
|
|
62
|
+
}, [canUpdate, onSave, field.key, codeValue, dragY, codeY, makeString]);
|
|
63
|
+
const onXTextChange = (0, react_1.useCallback)((newVal) => {
|
|
64
|
+
if (canUpdate) {
|
|
65
|
+
const parsed = Number(newVal);
|
|
66
|
+
if (!Number.isNaN(parsed)) {
|
|
67
|
+
const currentY = dragY !== null && dragY !== void 0 ? dragY : codeY;
|
|
68
|
+
const newStr = makeString(parsed, currentY);
|
|
69
|
+
if (newStr !== codeValue) {
|
|
70
|
+
setDragX(parsed);
|
|
71
|
+
onSave(field.key, newStr).catch(() => {
|
|
72
|
+
setDragX(null);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [canUpdate, onSave, field.key, codeValue, dragY, codeY, makeString]);
|
|
78
|
+
// --- Y callbacks ---
|
|
79
|
+
const onYChange = (0, react_1.useCallback)((newVal) => {
|
|
80
|
+
setDragY(newVal);
|
|
81
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
82
|
+
onDragValueChange(field.key, makeString(currentX, newVal));
|
|
83
|
+
}, [onDragValueChange, field.key, dragX, codeX, makeString]);
|
|
84
|
+
const onYChangeEnd = (0, react_1.useCallback)((newVal) => {
|
|
85
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
86
|
+
const newStr = makeString(currentX, newVal);
|
|
87
|
+
if (canUpdate && newStr !== codeValue) {
|
|
88
|
+
onSave(field.key, newStr).catch(() => {
|
|
89
|
+
setDragY(null);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
setDragY(null);
|
|
94
|
+
}
|
|
95
|
+
}, [canUpdate, onSave, field.key, codeValue, dragX, codeX, makeString]);
|
|
96
|
+
const onYTextChange = (0, react_1.useCallback)((newVal) => {
|
|
97
|
+
if (canUpdate) {
|
|
98
|
+
const parsed = Number(newVal);
|
|
99
|
+
if (!Number.isNaN(parsed)) {
|
|
100
|
+
const currentX = dragX !== null && dragX !== void 0 ? dragX : codeX;
|
|
101
|
+
const newStr = makeString(currentX, parsed);
|
|
102
|
+
if (newStr !== codeValue) {
|
|
103
|
+
setDragY(parsed);
|
|
104
|
+
onSave(field.key, newStr).catch(() => {
|
|
105
|
+
setDragY(null);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, [canUpdate, onSave, field.key, codeValue, dragX, codeX, makeString]);
|
|
111
|
+
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
112
|
+
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 }), 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 })
|
|
113
|
+
] }));
|
|
114
|
+
};
|
|
115
|
+
exports.TimelineTranslateField = TimelineTranslateField;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.draggerStyle = exports.getDecimalPlaces = void 0;
|
|
4
|
+
const getDecimalPlaces = (num) => {
|
|
5
|
+
const str = String(num);
|
|
6
|
+
const decimalIndex = str.indexOf('.');
|
|
7
|
+
return decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
|
|
8
|
+
};
|
|
9
|
+
exports.getDecimalPlaces = getDecimalPlaces;
|
|
10
|
+
exports.draggerStyle = {
|
|
11
|
+
width: 80,
|
|
12
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useResolvedStack = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const get_stack_1 = require("./TimelineStack/get-stack");
|
|
7
|
+
const resolvedCache = new Map();
|
|
8
|
+
const inFlight = new Set();
|
|
9
|
+
const subscribers = new Map();
|
|
10
|
+
const useResolvedStack = (stack) => {
|
|
11
|
+
const updateResolvedStackTrace = (0, react_1.useContext)(remotion_1.Internals.SequenceStackTracesUpdateContext);
|
|
12
|
+
const [value, setValue] = (0, react_1.useState)(() => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (!stack) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (_a = resolvedCache.get(stack)) !== null && _a !== void 0 ? _a : null;
|
|
18
|
+
});
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
if (!stack) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (resolvedCache.has(stack)) {
|
|
24
|
+
setValue(resolvedCache.get(stack));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!subscribers.has(stack)) {
|
|
28
|
+
subscribers.set(stack, new Set());
|
|
29
|
+
}
|
|
30
|
+
const subs = subscribers.get(stack);
|
|
31
|
+
subs.add(setValue);
|
|
32
|
+
if (!inFlight.has(stack)) {
|
|
33
|
+
inFlight.add(stack);
|
|
34
|
+
(0, get_stack_1.getOriginalLocationFromStack)(stack, 'sequence')
|
|
35
|
+
.then((frame) => {
|
|
36
|
+
resolvedCache.set(stack, frame);
|
|
37
|
+
updateResolvedStackTrace(stack, frame);
|
|
38
|
+
subs.forEach((fn) => fn(frame));
|
|
39
|
+
})
|
|
40
|
+
.catch((err) => {
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.error('Could not get original location of Sequence', err);
|
|
43
|
+
})
|
|
44
|
+
.finally(() => {
|
|
45
|
+
inFlight.delete(stack);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
subs.delete(setValue);
|
|
50
|
+
};
|
|
51
|
+
}, [stack, updateResolvedStackTrace]);
|
|
52
|
+
return value;
|
|
53
|
+
};
|
|
54
|
+
exports.useResolvedStack = useResolvedStack;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SequenceNodePath } from '@remotion/studio-shared';
|
|
2
|
+
import type { TSequence } from 'remotion';
|
|
3
|
+
import type { OriginalPosition } from '../../error-overlay/react-overlay/utils/get-source-map';
|
|
4
|
+
export declare const useSequencePropsSubscription: (sequence: TSequence, originalLocation: OriginalPosition | null) => SequenceNodePath | null;
|