@remotion/studio 4.0.520 → 4.0.522
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/api/shut-down-studio.d.ts +6 -0
- package/dist/api/shut-down-studio.js +23 -0
- package/dist/components/AudioWaveform.js +10 -6
- package/dist/components/Canvas.js +84 -12
- package/dist/components/CanvasIfSizeIsAvailable.js +7 -0
- package/dist/components/CaptionInspector.d.ts +1 -0
- package/dist/components/CaptionInspector.js +43 -2
- package/dist/components/CaptionTextEditor.js +1 -1
- package/dist/components/CompositionSelector.js +41 -30
- package/dist/components/CompositionSelectorItem.d.ts +7 -0
- package/dist/components/CompositionSelectorItem.js +343 -67
- package/dist/components/CopyButton.js +7 -14
- package/dist/components/Editor.js +6 -5
- package/dist/components/EditorContent.js +1 -1
- package/dist/components/ElementInstallConfirmation.js +77 -65
- package/dist/components/ElementLibraryModal.js +3 -1
- package/dist/components/FixComputedValueModal.js +20 -10
- package/dist/components/InlineCaptionInspector.js +37 -1
- package/dist/components/InspectorLocationCopy.js +10 -5
- package/dist/components/InspectorPanel/ElementLibraryButton.js +3 -18
- package/dist/components/InspectorSequenceSection.js +1 -4
- package/dist/components/Menu/MenuSubItem.js +1 -1
- package/dist/components/MenuBuildIndicator.js +7 -2
- package/dist/components/MenuCompositionName.js +62 -6
- package/dist/components/ModalContainer.d.ts +1 -0
- package/dist/components/ModalContainer.js +2 -2
- package/dist/components/ModalHeader.js +5 -1
- package/dist/components/QuickSwitcher/asset-search.d.ts +0 -1
- package/dist/components/QuickSwitcher/asset-search.js +1 -16
- package/dist/components/RenderButton.js +2 -2
- package/dist/components/RenderModal/CliCopyButton.js +13 -27
- package/dist/components/RenderModal/RenderStatusModal.js +7 -1
- package/dist/components/RenderModal/ServerRenderModal.js +1 -1
- package/dist/components/RenderModal/WebRenderModal.js +1 -1
- package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +1 -1
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +7 -4
- package/dist/components/SettingsModal.js +8 -5
- package/dist/components/SidebarCollapserControls.js +11 -5
- package/dist/components/SkillsSettings.js +9 -5
- package/dist/components/Splitter/SplitterContainer.js +63 -10
- package/dist/components/Splitter/SplitterContext.d.ts +3 -0
- package/dist/components/Splitter/SplitterContext.js +5 -1
- package/dist/components/Splitter/SplitterElement.js +11 -2
- package/dist/components/Splitter/SplitterHandle.d.ts +1 -0
- package/dist/components/Splitter/SplitterHandle.js +55 -25
- package/dist/components/TimeValue.js +36 -7
- package/dist/components/Timeline/SubscribeToNodePaths.d.ts +2 -1
- package/dist/components/Timeline/SubscribeToNodePaths.js +2 -1
- package/dist/components/Timeline/Timeline.d.ts +1 -1
- package/dist/components/Timeline/Timeline.js +45 -22
- package/dist/components/Timeline/TimelineAssetField.d.ts +0 -1
- package/dist/components/Timeline/TimelineAssetField.js +16 -9
- package/dist/components/Timeline/TimelineCollapseToggle.js +1 -1
- package/dist/components/Timeline/TimelineDragHandler.js +9 -4
- package/dist/components/Timeline/TimelineFontWeightField.d.ts +11 -0
- package/dist/components/Timeline/TimelineFontWeightField.js +65 -0
- package/dist/components/Timeline/TimelineLayerChildren.d.ts +21 -0
- package/dist/components/Timeline/TimelineLayerChildren.js +129 -0
- package/dist/components/Timeline/TimelineNumberField.js +13 -5
- package/dist/components/Timeline/TimelinePinchZoom.js +6 -30
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -7
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +4 -0
- package/dist/components/Timeline/TimelineSequence.js +113 -42
- package/dist/components/Timeline/TimelineSequenceItem.js +14 -2
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +13 -3
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +185 -126
- package/dist/components/Timeline/TimelineSlider.js +1 -4
- package/dist/components/Timeline/TimelineTickFormatProvider.d.ts +8 -0
- package/dist/components/Timeline/TimelineTickFormatProvider.js +16 -0
- package/dist/components/Timeline/TimelineTimeIndicators.js +7 -3
- package/dist/components/Timeline/TimelineVideoInfo.js +7 -3
- package/dist/components/Timeline/TimelineWidthProvider.js +2 -5
- package/dist/components/Timeline/TimelineZoomControls.js +20 -20
- package/dist/components/Timeline/get-sequence-split-menu-item.d.ts +11 -0
- package/dist/components/Timeline/get-sequence-split-menu-item.js +55 -0
- package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +3 -2
- package/dist/components/Timeline/use-sequence-props-subscription.js +4 -10
- package/dist/components/TopPanel.js +3 -19
- package/dist/components/UpdateStatusContext.d.ts +5 -0
- package/dist/components/UpdateStatusContext.js +53 -2
- package/dist/components/UpdatesSettings.js +34 -9
- package/dist/components/WebMcp.js +26 -0
- package/dist/components/ZoomPersistor.js +6 -3
- package/dist/components/composition-menu-items.js +1 -1
- package/dist/components/composition-selector-drag-data.d.ts +27 -0
- package/dist/components/composition-selector-drag-data.js +80 -0
- package/dist/components/import-assets.d.ts +2 -1
- package/dist/components/import-assets.js +11 -1
- package/dist/components/parse-caption-file.d.ts +5 -0
- package/dist/components/parse-caption-file.js +63 -0
- package/dist/esm/{chunk-np6q13k5.js → chunk-3netyjd9.js} +7943 -6314
- package/dist/esm/index.mjs +23 -8
- package/dist/esm/internals.mjs +7965 -6336
- package/dist/esm/previewEntry.mjs +8007 -6378
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/copy-text.js +1 -2
- package/dist/helpers/get-preview-file-type.js +22 -3
- package/dist/helpers/inserted-element-selection.d.ts +2 -1
- package/dist/helpers/use-copy-feedback.d.ts +4 -0
- package/dist/helpers/use-copy-feedback.js +19 -0
- package/dist/helpers/use-menu-structure.js +2 -2
- package/dist/icons/copy.d.ts +5 -0
- package/dist/icons/copy.js +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/state/canvas-ref.d.ts +1 -0
- package/dist/state/canvas-ref.js +2 -1
- package/dist/state/modals.d.ts +0 -2
- package/dist/state/sidebar.d.ts +3 -0
- package/dist/state/sidebar.js +6 -1
- package/dist/state/timeline-zoom.d.ts +1 -1
- package/dist/state/timeline-zoom.js +3 -3
- package/dist/visual-controls/VisualControls.js +4 -0
- package/package.json +16 -16
- package/dist/helpers/use-max-media-duration.d.ts +0 -2
- package/dist/helpers/use-max-media-duration.js +0 -61
|
@@ -15,7 +15,9 @@ const SplitterElement = ({ children, type, sticky }) => {
|
|
|
15
15
|
flex:
|
|
16
16
|
// Multiply by 1000 because if flex values don't add up to at least 1, they will not fill up the screen
|
|
17
17
|
(type === 'flexer' ? context.flexValue : 1 - context.flexValue) * 1000,
|
|
18
|
-
display: '
|
|
18
|
+
display: context.collapsedDuringDrag === (type === 'flexer' ? 'left' : 'right')
|
|
19
|
+
? 'none'
|
|
20
|
+
: 'flex',
|
|
19
21
|
position: 'relative',
|
|
20
22
|
overflow: 'hidden',
|
|
21
23
|
flexDirection: 'column',
|
|
@@ -28,7 +30,14 @@ const SplitterElement = ({ children, type, sticky }) => {
|
|
|
28
30
|
? (minSize !== null && minSize !== void 0 ? minSize : undefined)
|
|
29
31
|
: undefined,
|
|
30
32
|
};
|
|
31
|
-
}, [
|
|
33
|
+
}, [
|
|
34
|
+
context.collapsedDuringDrag,
|
|
35
|
+
context.flexValue,
|
|
36
|
+
context.orientation,
|
|
37
|
+
maxSize,
|
|
38
|
+
minSize,
|
|
39
|
+
type,
|
|
40
|
+
]);
|
|
32
41
|
const stickStyle = (0, react_1.useMemo)(() => {
|
|
33
42
|
return {
|
|
34
43
|
position: 'absolute',
|
|
@@ -3,4 +3,5 @@ export declare const SPLITTER_HANDLE_SIZE = 3;
|
|
|
3
3
|
export declare const SplitterHandle: React.FC<{
|
|
4
4
|
readonly allowToCollapse: 'right' | 'left' | 'none';
|
|
5
5
|
readonly onCollapse: () => void;
|
|
6
|
+
readonly onCollapseDuringDrag: ((side: 'left' | 'right' | null) => void) | null;
|
|
6
7
|
}>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SplitterHandle = exports.SPLITTER_HANDLE_SIZE = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const player_1 = require("@remotion/player");
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
8
7
|
const ForceSpecificCursor_1 = require("../ForceSpecificCursor");
|
|
@@ -11,10 +10,14 @@ exports.SPLITTER_HANDLE_SIZE = 3;
|
|
|
11
10
|
const containerRow = {
|
|
12
11
|
height: exports.SPLITTER_HANDLE_SIZE,
|
|
13
12
|
};
|
|
13
|
+
const collapsedContainer = {
|
|
14
|
+
width: 0,
|
|
15
|
+
height: 0,
|
|
16
|
+
};
|
|
14
17
|
const containerColumn = {
|
|
15
18
|
width: exports.SPLITTER_HANDLE_SIZE,
|
|
16
19
|
};
|
|
17
|
-
const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
|
|
20
|
+
const SplitterHandle = ({ allowToCollapse, onCollapse, onCollapseDuringDrag }) => {
|
|
18
21
|
const context = (0, react_1.useContext)(SplitterContext_1.SplitterContext);
|
|
19
22
|
if (!context) {
|
|
20
23
|
throw new Error('Cannot find splitter context');
|
|
@@ -22,8 +25,13 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
|
|
|
22
25
|
const ref = (0, react_1.useRef)(null);
|
|
23
26
|
// Keep the latest props/context readable inside the long-lived pointerdown
|
|
24
27
|
// listener without re-subscribing it on every render.
|
|
25
|
-
const latest = (0, react_1.useRef)({
|
|
26
|
-
|
|
28
|
+
const latest = (0, react_1.useRef)({
|
|
29
|
+
context,
|
|
30
|
+
allowToCollapse,
|
|
31
|
+
onCollapse,
|
|
32
|
+
onCollapseDuringDrag,
|
|
33
|
+
});
|
|
34
|
+
latest.current = { context, allowToCollapse, onCollapse, onCollapseDuringDrag };
|
|
27
35
|
(0, react_1.useEffect)(() => {
|
|
28
36
|
const { current } = ref;
|
|
29
37
|
if (!current) {
|
|
@@ -75,41 +83,59 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
|
|
|
75
83
|
}
|
|
76
84
|
return newFlex;
|
|
77
85
|
};
|
|
86
|
+
const getCollapsedSide = (ev) => {
|
|
87
|
+
const collapse = latest.current.allowToCollapse;
|
|
88
|
+
const unclamped = getNewValue(ev, false);
|
|
89
|
+
if (collapse === 'left' && unclamped < dragContext.minFlex / 2) {
|
|
90
|
+
return 'left';
|
|
91
|
+
}
|
|
92
|
+
if (collapse === 'right' &&
|
|
93
|
+
1 - unclamped < (1 - dragContext.maxFlex) / 2) {
|
|
94
|
+
return 'right';
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
let lastFlex = startFlex;
|
|
99
|
+
let lastCollapsedSide = null;
|
|
78
100
|
const onPointerMove = (ev) => {
|
|
101
|
+
var _a, _b;
|
|
79
102
|
if (!dragContext.isDragging.current) {
|
|
80
103
|
return;
|
|
81
104
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else if (collapse === 'right') {
|
|
92
|
-
const unclamped = 1 - getNewValue(ev, false);
|
|
93
|
-
if (unclamped < (1 - dragContext.maxFlex) / 2) {
|
|
94
|
-
endDrag === null || endDrag === void 0 ? void 0 : endDrag();
|
|
95
|
-
latest.current.onCollapse();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
105
|
+
// Keep the handle mounted and captured until release, even while
|
|
106
|
+
// the panel is hidden, so moving inward can restore it.
|
|
107
|
+
lastCollapsedSide = getCollapsedSide(ev);
|
|
108
|
+
lastFlex = getNewValue(ev, true);
|
|
109
|
+
(_b = (_a = latest.current).onCollapseDuringDrag) === null || _b === void 0 ? void 0 : _b.call(_a, lastCollapsedSide);
|
|
110
|
+
dragContext.setCollapsedDuringDrag(lastCollapsedSide);
|
|
111
|
+
dragContext.setFlexValue(lastFlex);
|
|
98
112
|
};
|
|
99
113
|
endDrag = (0, pointer_session_1.startCapturedPointerSession)({
|
|
100
114
|
event: e,
|
|
101
115
|
captureTarget: current,
|
|
102
116
|
onMove: onPointerMove,
|
|
103
117
|
onEnd: (reason, endEvent) => {
|
|
118
|
+
var _a, _b;
|
|
104
119
|
if ((reason === 'pointerup' || reason === 'buttons-released') &&
|
|
105
|
-
endEvent
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
endEvent) {
|
|
121
|
+
lastFlex = getNewValue(endEvent, true);
|
|
122
|
+
lastCollapsedSide = getCollapsedSide(endEvent);
|
|
123
|
+
}
|
|
124
|
+
// Capture loss and cancellation may have no usable coordinates.
|
|
125
|
+
// Commit the last displayed state instead of resetting the panel.
|
|
126
|
+
if (reason !== 'manual' && dragContext.isDragging.current) {
|
|
127
|
+
const savedFlex = lastCollapsedSide === null ? lastFlex : startFlex;
|
|
128
|
+
dragContext.setFlexValue(savedFlex);
|
|
129
|
+
dragContext.persistFlex(savedFlex);
|
|
130
|
+
if (lastCollapsedSide !== null) {
|
|
131
|
+
latest.current.onCollapse();
|
|
132
|
+
}
|
|
108
133
|
}
|
|
134
|
+
(_b = (_a = latest.current).onCollapseDuringDrag) === null || _b === void 0 ? void 0 : _b.call(_a, null);
|
|
135
|
+
dragContext.setCollapsedDuringDrag(null);
|
|
109
136
|
dragContext.isDragging.current = false;
|
|
110
137
|
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
111
138
|
endDrag = null;
|
|
112
|
-
player_1.PlayerInternals.updateAllElementsSizes();
|
|
113
139
|
},
|
|
114
140
|
});
|
|
115
141
|
};
|
|
@@ -124,6 +150,10 @@ const SplitterHandle = ({ allowToCollapse, onCollapse }) => {
|
|
|
124
150
|
context.orientation === 'horizontal'
|
|
125
151
|
? 'remotion-splitter-horizontal'
|
|
126
152
|
: 'remotion-splitter-vertical',
|
|
127
|
-
].join(' '), style: context.
|
|
153
|
+
].join(' '), style: context.collapsedDuringDrag !== null
|
|
154
|
+
? collapsedContainer
|
|
155
|
+
: context.orientation === 'horizontal'
|
|
156
|
+
? containerRow
|
|
157
|
+
: containerColumn }));
|
|
128
158
|
};
|
|
129
159
|
exports.SplitterHandle = SplitterHandle;
|
|
@@ -6,11 +6,13 @@ const player_1 = require("@remotion/player");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const colors_1 = require("../helpers/colors");
|
|
9
|
+
const hoverable_1 = require("../helpers/hoverable");
|
|
9
10
|
const is_current_selected_still_1 = require("../helpers/is-current-selected-still");
|
|
10
11
|
const use_keybinding_1 = require("../helpers/use-keybinding");
|
|
11
12
|
const render_frame_1 = require("../state/render-frame");
|
|
12
13
|
const layout_1 = require("./layout");
|
|
13
14
|
const InputDragger_1 = require("./NewComposition/InputDragger");
|
|
15
|
+
const TimelineTickFormatProvider_1 = require("./Timeline/TimelineTickFormatProvider");
|
|
14
16
|
const TimelineZoomControls_1 = require("./Timeline/TimelineZoomControls");
|
|
15
17
|
const text = {
|
|
16
18
|
color: colors_1.WHITE,
|
|
@@ -22,7 +24,7 @@ const text = {
|
|
|
22
24
|
width: '100%',
|
|
23
25
|
};
|
|
24
26
|
const currentTimeTypography = {
|
|
25
|
-
color: colors_1.
|
|
27
|
+
color: colors_1.LIGHT_TEXT,
|
|
26
28
|
display: 'inline-block',
|
|
27
29
|
fontSize: 14,
|
|
28
30
|
fontVariantNumeric: 'tabular-nums',
|
|
@@ -32,14 +34,34 @@ const currentTimeTypography = {
|
|
|
32
34
|
};
|
|
33
35
|
const currentTimeInputStyle = {
|
|
34
36
|
...currentTimeTypography,
|
|
35
|
-
padding:
|
|
37
|
+
padding: 0,
|
|
36
38
|
};
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
+
const currentTimeStack = {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
alignItems: 'flex-start',
|
|
43
|
+
lineHeight: 1,
|
|
44
|
+
padding: '5px 7px 5px 1px',
|
|
39
45
|
transform: 'translateY(-1px)',
|
|
40
46
|
};
|
|
47
|
+
const currentTimeButtonStyle = {
|
|
48
|
+
display: 'block',
|
|
49
|
+
padding: 0,
|
|
50
|
+
border: 'none',
|
|
51
|
+
lineHeight: '21px',
|
|
52
|
+
'--remotion-cli-internals-blue-hovered': colors_1.WHITE,
|
|
53
|
+
};
|
|
41
54
|
const currentTimeSubtitle = {
|
|
42
|
-
|
|
55
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
56
|
+
idleBackground: colors_1.TRANSPARENT,
|
|
57
|
+
hoverBackground: colors_1.TRANSPARENT,
|
|
58
|
+
idleColor: colors_1.LIGHT_TEXT,
|
|
59
|
+
hoverColor: colors_1.WHITE,
|
|
60
|
+
}),
|
|
61
|
+
background: colors_1.TRANSPARENT,
|
|
62
|
+
border: 'none',
|
|
63
|
+
padding: 0,
|
|
64
|
+
cursor: 'default',
|
|
43
65
|
display: 'block',
|
|
44
66
|
fontFamily: 'monospace',
|
|
45
67
|
fontSize: 10,
|
|
@@ -50,6 +72,10 @@ const currentTimeSubtitle = {
|
|
|
50
72
|
};
|
|
51
73
|
const TimeValue = () => {
|
|
52
74
|
const frame = (0, remotion_1.useCurrentFrame)();
|
|
75
|
+
const { showFrames, setShowFrames } = (0, react_1.useContext)(TimelineTickFormatProvider_1.TimelineTickFormatContext);
|
|
76
|
+
const toggleTickFormat = (0, react_1.useCallback)(() => {
|
|
77
|
+
setShowFrames((previous) => !previous);
|
|
78
|
+
}, [setShowFrames]);
|
|
53
79
|
const config = remotion_1.Internals.useUnsafeVideoConfig();
|
|
54
80
|
const isStill = (0, is_current_selected_still_1.useIsStill)();
|
|
55
81
|
const { seek, play, pause, toggle } = player_1.PlayerInternals.usePlayerMethods();
|
|
@@ -64,7 +90,6 @@ const TimeValue = () => {
|
|
|
64
90
|
const formatter = (0, react_1.useCallback)((value) => {
|
|
65
91
|
return config ? (0, render_frame_1.renderFrame)(Number(value), config.fps) : String(value);
|
|
66
92
|
}, [config]);
|
|
67
|
-
const formatterSubtitle = (0, react_1.useCallback)((value) => String(value), []);
|
|
68
93
|
(0, react_1.useImperativeHandle)(remotion_1.Internals.timeValueRef, () => ({
|
|
69
94
|
goToFrame: () => {
|
|
70
95
|
var _a;
|
|
@@ -99,7 +124,11 @@ const TimeValue = () => {
|
|
|
99
124
|
return null;
|
|
100
125
|
}
|
|
101
126
|
return (jsx_runtime_1.jsxs("div", { style: text, children: [
|
|
102
|
-
jsx_runtime_1.
|
|
127
|
+
jsx_runtime_1.jsxs("div", { style: currentTimeStack, children: [
|
|
128
|
+
jsx_runtime_1.jsx(InputDragger_1.InputDragger, { ref: ref, "aria-label": String(frame), value: frame, onTextChange: onTextChange, onValueChange: onValueChange, formatter: formatter, formatterStyle: currentTimeTypography, buttonStyle: currentTimeButtonStyle, rightAlign: false, status: "ok", style: currentTimeInputStyle }), jsx_runtime_1.jsx("button", { type: "button", className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, style: currentTimeSubtitle, onClick: toggleTickFormat, "aria-label": "Show timeline ticks as frames", "aria-pressed": showFrames, title: showFrames
|
|
129
|
+
? 'Show timeline ticks as timecode'
|
|
130
|
+
: 'Show timeline ticks as frames', children: frame })
|
|
131
|
+
] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }), jsx_runtime_1.jsx(layout_1.Flex, {}), jsx_runtime_1.jsx(TimelineZoomControls_1.TimelineZoomControls, { sliderMaxWidth: 80 }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 })
|
|
103
132
|
] }));
|
|
104
133
|
};
|
|
105
134
|
exports.TimeValue = TimeValue;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
import type { EffectDefinition, JsxComponentIdentity, InteractivitySchema } from 'remotion';
|
|
2
|
+
import type { EffectDefinition, JsxComponentIdentity, InteractivitySchema, VideoConfigValues } from 'remotion';
|
|
3
3
|
export declare const SubscribeToNodePaths: FC<{
|
|
4
4
|
readonly overrideId: string;
|
|
5
5
|
readonly componentIdentity: JsxComponentIdentity | null;
|
|
6
6
|
readonly schema: InteractivitySchema;
|
|
7
7
|
readonly getStack: () => string | null;
|
|
8
8
|
readonly effects: readonly EffectDefinition<unknown>[];
|
|
9
|
+
readonly videoConfigValues: VideoConfigValues | null;
|
|
9
10
|
}>;
|
|
@@ -5,7 +5,7 @@ const react_1 = require("react");
|
|
|
5
5
|
const no_react_1 = require("remotion/no-react");
|
|
6
6
|
const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
|
|
7
7
|
const use_sequence_props_subscription_1 = require("./use-sequence-props-subscription");
|
|
8
|
-
const SubscribeToNodePaths = ({ overrideId, componentIdentity, schema, getStack, effects }) => {
|
|
8
|
+
const SubscribeToNodePaths = ({ overrideId, componentIdentity, schema, getStack, effects, videoConfigValues, }) => {
|
|
9
9
|
const { resolvedLocation, stack, preferMappedNodePath } = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(getStack, overrideId);
|
|
10
10
|
const effectSubscriptions = (0, react_1.useMemo)(() => {
|
|
11
11
|
return effects
|
|
@@ -22,6 +22,7 @@ const SubscribeToNodePaths = ({ overrideId, componentIdentity, schema, getStack,
|
|
|
22
22
|
originalLocation: resolvedLocation,
|
|
23
23
|
preferMappedNodePath,
|
|
24
24
|
stack,
|
|
25
|
+
videoConfigValues,
|
|
25
26
|
});
|
|
26
27
|
return null;
|
|
27
28
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const Timeline: React.
|
|
2
|
+
export declare const Timeline: React.FC;
|
|
@@ -69,6 +69,7 @@ const TimelineHeightContainer_1 = require("./TimelineHeightContainer");
|
|
|
69
69
|
const TimelineInOutDragHandler_1 = require("./TimelineInOutDragHandler");
|
|
70
70
|
const TimelineInOutPointer_1 = require("./TimelineInOutPointer");
|
|
71
71
|
const TimelineKeyframeTracksContext_1 = require("./TimelineKeyframeTracksContext");
|
|
72
|
+
const TimelineLayerChildren_1 = require("./TimelineLayerChildren");
|
|
72
73
|
const TimelineList_1 = require("./TimelineList");
|
|
73
74
|
const TimelinePinchZoom_1 = require("./TimelinePinchZoom");
|
|
74
75
|
const TimelinePlayCursorSyncer_1 = require("./TimelinePlayCursorSyncer");
|
|
@@ -76,6 +77,7 @@ const TimelineScrollable_1 = require("./TimelineScrollable");
|
|
|
76
77
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
77
78
|
const TimelineSequenceItem_1 = require("./TimelineSequenceItem");
|
|
78
79
|
const TimelineSlider_1 = require("./TimelineSlider");
|
|
80
|
+
const TimelineTickFormatProvider_1 = require("./TimelineTickFormatProvider");
|
|
79
81
|
const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
|
|
80
82
|
const TimelineTracks_1 = require("./TimelineTracks");
|
|
81
83
|
const TimelineVirtualization_1 = require("./TimelineVirtualization");
|
|
@@ -308,10 +310,11 @@ const TimelineInner = () => {
|
|
|
308
310
|
return;
|
|
309
311
|
}
|
|
310
312
|
const matchesInsertedNodePath = (track) => track.nodePathInfo !== null &&
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
(pendingInsertedElementSelection.nodePath === null ||
|
|
314
|
+
(track.nodePathInfo.sequenceSubscriptionKey.absolutePath ===
|
|
315
|
+
pendingInsertedElementSelection.nodePath.absolutePath &&
|
|
316
|
+
JSON.stringify(track.nodePathInfo.sequenceSubscriptionKey.nodePath) ===
|
|
317
|
+
JSON.stringify(pendingInsertedElementSelection.nodePath.nodePath)));
|
|
315
318
|
if (((_a = pendingSelectionStart.current) === null || _a === void 0 ? void 0 : _a.selection) !==
|
|
316
319
|
pendingInsertedElementSelection) {
|
|
317
320
|
pendingSelectionStart.current = {
|
|
@@ -342,6 +345,9 @@ const TimelineInner = () => {
|
|
|
342
345
|
}
|
|
343
346
|
selectItems([{ type: 'sequence', nodePathInfo: insertedTrack.nodePathInfo }], { reveal: true });
|
|
344
347
|
(0, inserted_element_selection_1.clearInsertedElementSelection)(pendingInsertedElementSelection);
|
|
348
|
+
if (pendingInsertedElementSelection.notification !== null) {
|
|
349
|
+
(0, NotificationCenter_1.showNotification)(pendingInsertedElementSelection.notification, 3000);
|
|
350
|
+
}
|
|
345
351
|
}, [
|
|
346
352
|
canvasContent,
|
|
347
353
|
fastRefreshes,
|
|
@@ -350,9 +356,20 @@ const TimelineInner = () => {
|
|
|
350
356
|
timeline,
|
|
351
357
|
]);
|
|
352
358
|
const durationInFrames = (_a = videoConfig === null || videoConfig === void 0 ? void 0 : videoConfig.durationInFrames) !== null && _a !== void 0 ? _a : 0;
|
|
359
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
353
360
|
const filtered = (0, react_1.useMemo)(() => {
|
|
354
|
-
return timeline.filter((t) =>
|
|
355
|
-
|
|
361
|
+
return timeline.filter((t) => {
|
|
362
|
+
// Moving outside the composition can reduce the displayed duration to
|
|
363
|
+
// zero. Keep the drag owner mounted until its pending edit is saved.
|
|
364
|
+
if (t.sequence.showInTimeline &&
|
|
365
|
+
t.nodePathInfo !== null &&
|
|
366
|
+
getDragOverrides(t.nodePathInfo.sequenceSubscriptionKey).from !==
|
|
367
|
+
undefined) {
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
return (0, should_show_track_in_timeline_1.shouldShowTrackInTimeline)(t, durationInFrames);
|
|
371
|
+
});
|
|
372
|
+
}, [durationInFrames, getDragOverrides, timeline]);
|
|
356
373
|
// Keep `filtered` complete so a future toggle can show every programmatic
|
|
357
374
|
// instance without recalculating the timeline or losing its instance index.
|
|
358
375
|
const collapsed = (0, react_1.useMemo)(() => {
|
|
@@ -369,27 +386,33 @@ const TimelineInner = () => {
|
|
|
369
386
|
return true;
|
|
370
387
|
});
|
|
371
388
|
}, [filtered]);
|
|
389
|
+
const { visibleTracks, value: layerChildrenValue } = (0, TimelineLayerChildren_1.useTimelineLayerChildren)(collapsed, sequences, (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ? canvasContent.compositionId : null);
|
|
372
390
|
const maxTimelineTracks = (0, studio_runtime_config_1.getStudioMaxTimelineTracks)();
|
|
373
391
|
const shown = (0, react_1.useMemo)(() => {
|
|
374
|
-
return maxTimelineTracks !== null &&
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
392
|
+
return maxTimelineTracks !== null &&
|
|
393
|
+
visibleTracks.length > maxTimelineTracks
|
|
394
|
+
? visibleTracks.slice(0, maxTimelineTracks)
|
|
395
|
+
: visibleTracks;
|
|
396
|
+
}, [visibleTracks, maxTimelineTracks]);
|
|
397
|
+
const hasBeenCut = visibleTracks.length > shown.length;
|
|
379
398
|
return (jsx_runtime_1.jsxs(TimelineContextMenuArea, { children: [sequences.map((sequence) => {
|
|
380
399
|
if (!(0, should_subscribe_to_sequence_props_1.shouldSubscribeToSequenceProps)(sequence, previewInteractive)) {
|
|
381
400
|
return null;
|
|
382
401
|
}
|
|
383
|
-
return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, componentIdentity: sequence.controls.componentIdentity, schema: sequence.controls.schema, getStack: sequence.getStack, effects: sequence.effects }, sequence.id));
|
|
384
|
-
}), (0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}) : null, jsx_runtime_1.jsx(TimelineKeyframeTracksContext_1.TimelineKeyframeTracksProvider, { tracks: filtered, children: jsx_runtime_1.jsx(TimelineSelection_1.TimelineSelectableItemsProvider, { timeline: shown, children: jsx_runtime_1.jsxs(TimelineVirtualization_1.TimelineVirtualizationProvider, { hasBeenCut: hasBeenCut, isStill: isStill, timeline: shown, children: [(0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? (jsx_runtime_1.jsx(TimelineSelection_1.TimelineSelectAllKeybindings, { timeline: shown })) : null, jsx_runtime_1.jsx(TimelineHeightContainer_1.TimelineHeightContainer, { children: isStill ? (jsx_runtime_1.jsx(TimelineList_1.TimelineList, {})) : (jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
402
|
+
return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, componentIdentity: sequence.controls.componentIdentity, schema: sequence.controls.schema, getStack: sequence.getStack, effects: sequence.effects, videoConfigValues: sequence.controls.videoConfigValues }, sequence.id));
|
|
403
|
+
}), (0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}) : null, jsx_runtime_1.jsx(TimelineLayerChildren_1.TimelineLayerChildrenProvider, { value: layerChildrenValue, children: jsx_runtime_1.jsx(TimelineKeyframeTracksContext_1.TimelineKeyframeTracksProvider, { tracks: filtered, children: jsx_runtime_1.jsx(TimelineSelection_1.TimelineSelectableItemsProvider, { timeline: shown, children: jsx_runtime_1.jsxs(TimelineVirtualization_1.TimelineVirtualizationProvider, { hasBeenCut: hasBeenCut, isStill: isStill, timeline: shown, children: [(0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? (jsx_runtime_1.jsx(TimelineSelection_1.TimelineSelectAllKeybindings, { timeline: shown })) : null, jsx_runtime_1.jsx(TimelineHeightContainer_1.TimelineHeightContainer, { children: isStill ? (jsx_runtime_1.jsx(TimelineList_1.TimelineList, {})) : (jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
|
|
404
|
+
jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, maxFlexerSize: null, minFlexerSize: MIN_TIMELINE_LABELS_WIDTH, maxAntiFlexerSize: null, minAntiFlexerSize: null, children: [
|
|
405
|
+
jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "flexer", sticky: jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimePlaceholders, {}), children: jsx_runtime_1.jsx(TimelineList_1.TimelineList, {}) }), jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { onCollapse: noop, onCollapseDuringDrag: null, allowToCollapse: "none" }), jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "anti-flexer", sticky: jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
406
|
+
jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimeIndicators, {}), jsx_runtime_1.jsx(TimelineSlider_1.TimelineSlider, {})
|
|
407
|
+
] }), children: jsx_runtime_1.jsxs(TimelineScrollable_1.TimelineScrollable, { children: [
|
|
408
|
+
jsx_runtime_1.jsx(TimelineTracks_1.TimelineTracks, { hasBeenCut: hasBeenCut }), jsx_runtime_1.jsx(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {}), jsx_runtime_1.jsx(TimelineInOutPointer_1.TimelineInOutPointer, {}), jsx_runtime_1.jsx(TimelineDragHandler_1.TimelineDragHandler, {}), (0, interactivity_enabled_1.isStudioInteractivityEnabled)() ? (jsx_runtime_1.jsx(TimelineInOutDragHandler_1.TimelineInOutDragHandler, {})) : null] }) })
|
|
409
|
+
] })
|
|
410
|
+
] })) })
|
|
411
|
+
] }) }) }) })
|
|
393
412
|
] }));
|
|
394
413
|
};
|
|
395
|
-
|
|
414
|
+
const MemoizedTimelineInner = react_1.default.memo(TimelineInner);
|
|
415
|
+
const Timeline = () => {
|
|
416
|
+
return (jsx_runtime_1.jsx(TimelineTickFormatProvider_1.TimelineTickFormatProvider, { children: jsx_runtime_1.jsx(MemoizedTimelineInner, {}) }));
|
|
417
|
+
};
|
|
418
|
+
exports.Timeline = Timeline;
|
|
@@ -4,7 +4,6 @@ import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSa
|
|
|
4
4
|
import { type InspectorQuickActionProps } from '../InspectorPanel/common';
|
|
5
5
|
export type InspectorSourceAction = InspectorQuickActionProps;
|
|
6
6
|
type AssetSelectionContextValue = {
|
|
7
|
-
readonly initialQuery: string;
|
|
8
7
|
readonly getSourceAction: (src: string) => InspectorSourceAction | null;
|
|
9
8
|
readonly sourceAction: InspectorSourceAction | null;
|
|
10
9
|
};
|
|
@@ -32,9 +32,13 @@ const standaloneSourceActionStyle = {
|
|
|
32
32
|
minWidth: 0,
|
|
33
33
|
width: 'auto',
|
|
34
34
|
};
|
|
35
|
+
const assetTypeToAccept = {
|
|
36
|
+
audio: 'audio/*',
|
|
37
|
+
video: 'video/*',
|
|
38
|
+
image: 'image/*',
|
|
39
|
+
};
|
|
35
40
|
exports.AssetSelectionContext = (0, react_1.createContext)({
|
|
36
41
|
getSourceAction: () => null,
|
|
37
|
-
initialQuery: '',
|
|
38
42
|
sourceAction: null,
|
|
39
43
|
});
|
|
40
44
|
const toFileToken = (name) => {
|
|
@@ -50,14 +54,14 @@ const TimelineAssetField = ({ field, effectiveValue, propStatus, onSave, onDragV
|
|
|
50
54
|
}
|
|
51
55
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
|
|
52
56
|
const staticFiles = (0, use_static_files_1.useStaticFiles)();
|
|
53
|
-
const { getSourceAction,
|
|
57
|
+
const { getSourceAction, sourceAction } = (0, react_1.useContext)(exports.AssetSelectionContext);
|
|
58
|
+
const { assetType } = field.fieldSchema;
|
|
59
|
+
const initialQuery = assetType ? `type:${assetType} ` : '';
|
|
54
60
|
const inlineSourceAction = (0, react_1.useMemo)(() => {
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
61
|
+
if (typeof effectiveValue === 'string') {
|
|
62
|
+
return getSourceAction(effectiveValue);
|
|
57
63
|
}
|
|
58
|
-
return
|
|
59
|
-
? getSourceAction(effectiveValue)
|
|
60
|
-
: sourceAction;
|
|
64
|
+
return field.key === 'src' ? sourceAction : null;
|
|
61
65
|
}, [effectiveValue, field.key, getSourceAction, sourceAction]);
|
|
62
66
|
const onSelect = (0, react_1.useCallback)((assetName, previewValue) => {
|
|
63
67
|
const sourceValue = (0, exports.toFileToken)(assetName);
|
|
@@ -70,7 +74,10 @@ const TimelineAssetField = ({ field, effectiveValue, propStatus, onSave, onDragV
|
|
|
70
74
|
});
|
|
71
75
|
}, [propStatus.codeValue, onDragValueChange, onSave, onDragEnd]);
|
|
72
76
|
const selectFile = (0, react_1.useCallback)(async () => {
|
|
73
|
-
const [file] = await (0, import_assets_1.pickFilesToImport)({
|
|
77
|
+
const [file] = await (0, import_assets_1.pickFilesToImport)({
|
|
78
|
+
multiple: false,
|
|
79
|
+
accept: assetType ? assetTypeToAccept[assetType] : null,
|
|
80
|
+
});
|
|
74
81
|
if (!file) {
|
|
75
82
|
return;
|
|
76
83
|
}
|
|
@@ -94,7 +101,7 @@ const TimelineAssetField = ({ field, effectiveValue, propStatus, onSave, onDragV
|
|
|
94
101
|
catch (error) {
|
|
95
102
|
(0, NotificationCenter_1.showNotification)(`Could not upload asset: ${error instanceof Error ? error.message : String(error)}`, 4000);
|
|
96
103
|
}
|
|
97
|
-
}, [onSelect, staticFiles]);
|
|
104
|
+
}, [assetType, onSelect, staticFiles]);
|
|
98
105
|
const openAssetSelection = (0, react_1.useCallback)(() => {
|
|
99
106
|
setSelectedModal({
|
|
100
107
|
type: 'quick-switcher',
|
|
@@ -10,7 +10,7 @@ const container = {
|
|
|
10
10
|
alignItems: 'center',
|
|
11
11
|
};
|
|
12
12
|
const Icon = ({ color, ...props }) => {
|
|
13
|
-
return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 8 10", ...props, style: { height:
|
|
13
|
+
return (jsx_runtime_1.jsx("svg", { viewBox: "0 0 8 10", ...props, style: { height: 8, width: 6.4 }, children: jsx_runtime_1.jsx("path", { d: "M 0 0 L 8 5 L 0 10 z", fill: color }) }));
|
|
14
14
|
};
|
|
15
15
|
const TimelineCollapseToggle = ({ collapsed, color }) => {
|
|
16
16
|
return (jsx_runtime_1.jsx("div", { style: collapsed ? container : { ...container, transform: 'rotate(90deg)' }, children: jsx_runtime_1.jsx(Icon, { color: color }) }));
|
|
@@ -80,6 +80,7 @@ const TimelineDragHandler = () => {
|
|
|
80
80
|
});
|
|
81
81
|
const { zoom: zoomMap } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
82
82
|
const { canvasContent, currentAssetMetadata } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
83
|
+
const videoId = video === null || video === void 0 ? void 0 : video.id;
|
|
83
84
|
const containerStyle = (0, react_1.useMemo)(() => {
|
|
84
85
|
var _a;
|
|
85
86
|
var _b, _c, _d, _e;
|
|
@@ -90,16 +91,20 @@ const TimelineDragHandler = () => {
|
|
|
90
91
|
const zoom = (0, get_timeline_max_zoom_1.getTimelineZoom)({
|
|
91
92
|
durationInFrames,
|
|
92
93
|
timelineViewportWidth: (_d = (_c = timelineSize === null || timelineSize === void 0 ? void 0 : timelineSize.width) !== null && _c !== void 0 ? _c : (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _d !== void 0 ? _d : 0,
|
|
93
|
-
zoom:
|
|
94
|
-
? ((_e = zoomMap[canvasContent.compositionId]) !== null && _e !== void 0 ? _e : null)
|
|
95
|
-
: null,
|
|
94
|
+
zoom: videoId ? ((_e = zoomMap[videoId]) !== null && _e !== void 0 ? _e : null) : null,
|
|
96
95
|
});
|
|
97
96
|
return {
|
|
98
97
|
...container,
|
|
99
98
|
width: (0, get_timeline_max_zoom_1.getTimelineWidth)({ durationInFrames, zoom }),
|
|
100
99
|
height: TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT,
|
|
101
100
|
};
|
|
102
|
-
}, [
|
|
101
|
+
}, [
|
|
102
|
+
canvasContent,
|
|
103
|
+
timelineSize === null || timelineSize === void 0 ? void 0 : timelineSize.width,
|
|
104
|
+
video === null || video === void 0 ? void 0 : video.durationInFrames,
|
|
105
|
+
videoId,
|
|
106
|
+
zoomMap,
|
|
107
|
+
]);
|
|
103
108
|
const hasPlayableContent = (canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'composition' ||
|
|
104
109
|
((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'asset' &&
|
|
105
110
|
(currentAssetMetadata === null || currentAssetMetadata === void 0 ? void 0 : currentAssetMetadata.asset) === canvasContent.asset);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CanUpdateSequencePropStatusStatic } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
|
+
export declare const TimelineFontWeightField: React.FC<{
|
|
5
|
+
readonly field: SchemaFieldInfo;
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatusStatic;
|
|
7
|
+
readonly effectiveValue: unknown;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
10
|
+
readonly onDragEnd: () => void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineFontWeightField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
7
|
+
const RemInput_1 = require("../NewComposition/RemInput");
|
|
8
|
+
const timeline_field_utils_1 = require("./timeline-field-utils");
|
|
9
|
+
const TimelineNumberField_1 = require("./TimelineNumberField");
|
|
10
|
+
const FONT_WEIGHT_KEYWORDS = ['normal', 'bold', 'bolder', 'lighter'];
|
|
11
|
+
const TimelineFontWeightField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const { fieldSchema } = field;
|
|
14
|
+
if (fieldSchema.type !== 'font-weight') {
|
|
15
|
+
throw new Error('TimelineFontWeightField rendered for non-font-weight field');
|
|
16
|
+
}
|
|
17
|
+
const sourceValue = (_a = propStatus.codeValue) !== null && _a !== void 0 ? _a : fieldSchema.default;
|
|
18
|
+
const currentValue = effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : sourceValue;
|
|
19
|
+
const onSelectKeyword = (0, react_1.useCallback)((newValue) => {
|
|
20
|
+
if (newValue === propStatus.codeValue) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
onDragValueChange(newValue);
|
|
24
|
+
onSave(newValue).finally(onDragEnd);
|
|
25
|
+
}, [onDragEnd, onDragValueChange, onSave, propStatus.codeValue]);
|
|
26
|
+
const keywordItems = (0, react_1.useMemo)(() => {
|
|
27
|
+
return FONT_WEIGHT_KEYWORDS.map((keyword) => ({
|
|
28
|
+
type: 'item',
|
|
29
|
+
id: keyword,
|
|
30
|
+
value: keyword,
|
|
31
|
+
label: keyword,
|
|
32
|
+
onClick: () => onSelectKeyword(keyword),
|
|
33
|
+
keyHint: null,
|
|
34
|
+
leftItem: null,
|
|
35
|
+
subMenu: null,
|
|
36
|
+
quickSwitcherLabel: null,
|
|
37
|
+
disabled: false,
|
|
38
|
+
}));
|
|
39
|
+
}, [onSelectKeyword]);
|
|
40
|
+
if (typeof sourceValue === 'number') {
|
|
41
|
+
return (jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { effectiveValue: currentValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }));
|
|
42
|
+
}
|
|
43
|
+
if (FONT_WEIGHT_KEYWORDS.includes(sourceValue)) {
|
|
44
|
+
return (jsx_runtime_1.jsx(ComboBox_1.Combobox, { size: "small", title: field.key, selectedId: String(currentValue), values: keywordItems }));
|
|
45
|
+
}
|
|
46
|
+
return (jsx_runtime_1.jsx(RemInput_1.RemotionInput, { status: "ok", rightAlign: false, small: true, defaultValue: String(currentValue !== null && currentValue !== void 0 ? currentValue : ''), onBlur: (event) => {
|
|
47
|
+
const newValue = event.currentTarget.value;
|
|
48
|
+
if (newValue === propStatus.codeValue) {
|
|
49
|
+
onDragEnd();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
onSave(newValue).finally(onDragEnd);
|
|
53
|
+
}, onChange: (event) => onDragValueChange(event.currentTarget.value), onDoubleClick: (event) => event.stopPropagation(), onKeyDown: (event) => {
|
|
54
|
+
var _a;
|
|
55
|
+
if (event.key === 'Enter') {
|
|
56
|
+
event.currentTarget.blur();
|
|
57
|
+
}
|
|
58
|
+
if (event.key === 'Escape') {
|
|
59
|
+
event.currentTarget.value = String((_a = propStatus.codeValue) !== null && _a !== void 0 ? _a : '');
|
|
60
|
+
onDragEnd();
|
|
61
|
+
event.currentTarget.blur();
|
|
62
|
+
}
|
|
63
|
+
}, style: { ...timeline_field_utils_1.draggerStyle, boxSizing: 'border-box' } }, String(sourceValue)));
|
|
64
|
+
};
|
|
65
|
+
exports.TimelineFontWeightField = TimelineFontWeightField;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TSequence } from 'remotion';
|
|
3
|
+
import type { TimelineTrackData } from '../../helpers/get-timeline-sequence-sort-key';
|
|
4
|
+
export declare const TimelineLayerChildrenProvider: React.Provider<{
|
|
5
|
+
readonly collapsed: Record<string, boolean>;
|
|
6
|
+
readonly keys: Map<string, string>;
|
|
7
|
+
readonly parents: Set<string>;
|
|
8
|
+
readonly toggle: (key: string) => void;
|
|
9
|
+
} | null>;
|
|
10
|
+
export declare const useTimelineLayerChildren: (tracks: TimelineTrackData[], sequences: TSequence[], compositionId: string | null) => {
|
|
11
|
+
visibleTracks: TimelineTrackData[];
|
|
12
|
+
value: {
|
|
13
|
+
collapsed: Record<string, boolean>;
|
|
14
|
+
keys: Map<string, string>;
|
|
15
|
+
parents: Set<string>;
|
|
16
|
+
toggle: (key: string) => void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const TimelineLayerChildrenToggle: React.FC<{
|
|
20
|
+
readonly sequence: TSequence;
|
|
21
|
+
}>;
|