@remotion/studio 4.0.470 → 4.0.472
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AssetSelector.js +10 -1
- package/dist/components/Canvas.js +98 -0
- package/dist/components/CompositionSelectorItem.d.ts +1 -0
- package/dist/components/CompositionSelectorItem.js +12 -4
- package/dist/components/ContextMenu.d.ts +7 -2
- package/dist/components/ContextMenu.js +91 -43
- package/dist/components/Editor.js +14 -6
- package/dist/components/Modals.js +3 -1
- package/dist/components/NewComposition/CodemodFooter.js +2 -2
- package/dist/components/NewComposition/DeleteFolder.d.ts +6 -0
- package/dist/components/NewComposition/DeleteFolder.js +39 -0
- package/dist/components/NewComposition/RenameFolder.d.ts +6 -0
- package/dist/components/NewComposition/RenameFolder.js +60 -0
- package/dist/components/Preview.js +2 -1
- package/dist/components/SelectedOutlineOverlay.d.ts +109 -1
- package/dist/components/SelectedOutlineOverlay.js +489 -73
- package/dist/components/Splitter/SplitterContainer.js +9 -0
- package/dist/components/Splitter/SplitterHandle.js +63 -70
- package/dist/components/Timeline/Timeline.js +121 -1
- package/dist/components/Timeline/TimelineArrayField.d.ts +9 -0
- package/dist/components/Timeline/TimelineArrayField.js +210 -0
- package/dist/components/Timeline/TimelineBooleanField.d.ts +2 -2
- package/dist/components/Timeline/TimelineBooleanField.js +2 -2
- package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +20 -0
- package/dist/components/Timeline/TimelineClipboardKeybindings.js +265 -0
- package/dist/components/Timeline/TimelineColorField.d.ts +2 -2
- package/dist/components/Timeline/TimelineColorField.js +2 -8
- package/dist/components/Timeline/TimelineDeleteKeybindings.js +15 -0
- package/dist/components/Timeline/TimelineDragHandler.js +1 -0
- package/dist/components/Timeline/TimelineEffectItem.js +159 -6
- package/dist/components/Timeline/TimelineEffectPropItem.js +95 -25
- package/dist/components/Timeline/TimelineEnumField.d.ts +2 -2
- package/dist/components/Timeline/TimelineEnumField.js +3 -3
- package/dist/components/Timeline/TimelineKeyframeControls.d.ts +4 -3
- package/dist/components/Timeline/TimelineKeyframeControls.js +52 -33
- package/dist/components/Timeline/TimelineKeyframedValue.d.ts +7 -2
- package/dist/components/Timeline/TimelineKeyframedValue.js +22 -8
- package/dist/components/Timeline/TimelineLayerEye.d.ts +1 -0
- package/dist/components/Timeline/TimelineLayerEye.js +8 -3
- package/dist/components/Timeline/TimelineNumberField.d.ts +2 -2
- package/dist/components/Timeline/TimelineNumberField.js +7 -11
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.d.ts +17 -0
- package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +53 -0
- package/dist/components/Timeline/TimelineRotationField.d.ts +2 -2
- package/dist/components/Timeline/TimelineRotationField.js +41 -24
- package/dist/components/Timeline/TimelineRowChrome.d.ts +3 -0
- package/dist/components/Timeline/TimelineRowChrome.js +11 -10
- package/dist/components/Timeline/TimelineScaleField.d.ts +20 -0
- package/dist/components/Timeline/TimelineScaleField.js +314 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -2
- package/dist/components/Timeline/TimelineSchemaField.js +8 -42
- package/dist/components/Timeline/TimelineSelection.js +3 -2
- package/dist/components/Timeline/TimelineSequence.d.ts +1 -0
- package/dist/components/Timeline/TimelineSequence.js +51 -10
- package/dist/components/Timeline/TimelineSequenceFrame.js +1 -0
- package/dist/components/Timeline/TimelineSequenceItem.js +97 -7
- package/dist/components/Timeline/TimelineSequencePropItem.js +82 -21
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +58 -0
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +528 -0
- package/dist/components/Timeline/TimelineTrack.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineTranslateField.js +21 -25
- package/dist/components/Timeline/TimelineUvCoordinateField.d.ts +2 -2
- package/dist/components/Timeline/TimelineUvCoordinateField.js +20 -26
- package/dist/components/Timeline/call-add-keyframe.js +2 -0
- package/dist/components/Timeline/call-delete-keyframe.d.ts +16 -0
- package/dist/components/Timeline/call-delete-keyframe.js +86 -14
- package/dist/components/Timeline/delete-selected-keyframe.d.ts +10 -0
- package/dist/components/Timeline/delete-selected-keyframe.js +48 -7
- package/dist/components/Timeline/delete-selected-timeline-item.js +6 -11
- package/dist/components/Timeline/get-node-keyframes.d.ts +5 -2
- package/dist/components/Timeline/get-node-keyframes.js +38 -5
- package/dist/components/Timeline/get-timeline-keyframes.js +4 -4
- package/dist/components/Timeline/reset-selected-timeline-props.d.ts +38 -0
- package/dist/components/Timeline/reset-selected-timeline-props.js +156 -0
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +3 -2
- package/dist/components/Timeline/sequence-props-subscription-store.js +2 -1
- package/dist/components/Timeline/timeline-field-utils.d.ts +1 -0
- package/dist/components/Timeline/timeline-field-utils.js +5 -1
- package/dist/components/Timeline/timeline-scroll-logic.js +3 -3
- package/dist/components/Timeline/timeline-translate-utils.js +6 -2
- package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -0
- package/dist/components/Timeline/use-sequence-props-subscription.js +2 -1
- package/dist/components/TopPanel.d.ts +1 -1
- package/dist/components/folder-menu-items.d.ts +12 -0
- package/dist/components/folder-menu-items.js +147 -0
- package/dist/components/import-assets.d.ts +6 -0
- package/dist/components/import-assets.js +157 -0
- package/dist/esm/{chunk-dny42qnq.js → chunk-48grt472.js} +9717 -5925
- package/dist/esm/internals.mjs +9717 -5925
- package/dist/esm/previewEntry.mjs +9531 -5737
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/calculate-timeline.js +7 -3
- package/dist/helpers/create-folder-tree.js +1 -0
- package/dist/helpers/detect-file-type.d.ts +69 -0
- package/dist/helpers/detect-file-type.js +278 -0
- package/dist/helpers/get-folder-id.d.ts +4 -0
- package/dist/helpers/get-folder-id.js +7 -0
- package/dist/helpers/get-left-of-timeline-slider.js +1 -1
- package/dist/helpers/get-timeline-sequence-layout.js +10 -11
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +2 -0
- package/dist/helpers/open-in-editor.d.ts +19 -1
- package/dist/helpers/open-in-editor.js +42 -4
- package/dist/helpers/timeline-layout.js +5 -1
- package/dist/helpers/use-menu-structure.js +0 -1
- package/dist/helpers/validate-folder-rename.d.ts +6 -0
- package/dist/helpers/validate-folder-rename.js +19 -0
- package/dist/state/modals.d.ts +10 -0
- package/dist/state/scale-lock.d.ts +18 -0
- package/dist/state/scale-lock.js +59 -0
- package/dist/state/z-index.js +5 -2
- package/package.json +10 -10
|
@@ -8,6 +8,7 @@ const client_id_1 = require("../../helpers/client-id");
|
|
|
8
8
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
9
9
|
const timeline_node_path_key_1 = require("../../helpers/timeline-node-path-key");
|
|
10
10
|
const use_keybinding_1 = require("../../helpers/use-keybinding");
|
|
11
|
+
const TimelineClipboardKeybindings_1 = require("./TimelineClipboardKeybindings");
|
|
11
12
|
const TimelineDeleteKeybindings_1 = require("./TimelineDeleteKeybindings");
|
|
12
13
|
exports.TIMELINE_SELECTED_BACKGROUND = '#3B3F42';
|
|
13
14
|
exports.TIMELINE_SELECTED_LABEL_BACKGROUND = '#B0B0B0';
|
|
@@ -255,7 +256,7 @@ const TimelineSelectAllKeybindings = ({ timeline }) => {
|
|
|
255
256
|
exports.TimelineSelectAllKeybindings = TimelineSelectAllKeybindings;
|
|
256
257
|
const TimelineSelectionProvider = ({ children }) => {
|
|
257
258
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
258
|
-
const canSelect = exports.SELECTION_ENABLED &&
|
|
259
|
+
const canSelect = (exports.SELECTION_ENABLED || exports.ENABLE_OUTLINES) &&
|
|
259
260
|
previewServerState.type === 'connected' &&
|
|
260
261
|
!window.remotion_isReadOnlyStudio;
|
|
261
262
|
const [selectedItems, setSelectedItems] = (0, react_1.useState)([]);
|
|
@@ -347,7 +348,7 @@ const TimelineSelectionProvider = ({ children }) => {
|
|
|
347
348
|
]);
|
|
348
349
|
const currentSelection = (0, react_1.useRef)(value);
|
|
349
350
|
currentSelection.current = value;
|
|
350
|
-
return (jsx_runtime_1.jsx(CurrentTimelineSelectionContext.Provider, { value: currentSelection, children: jsx_runtime_1.jsxs(TimelineSelectionContext.Provider, { value: value, children: [children, jsx_runtime_1.jsx(TimelineDeleteKeybindings_1.TimelineDeleteKeybindings, {})
|
|
351
|
+
return (jsx_runtime_1.jsx(CurrentTimelineSelectionContext.Provider, { value: currentSelection, children: jsx_runtime_1.jsxs(TimelineSelectionContext.Provider, { value: value, children: [children, jsx_runtime_1.jsx(TimelineClipboardKeybindings_1.TimelineClipboardKeybindings, {}), jsx_runtime_1.jsx(TimelineDeleteKeybindings_1.TimelineDeleteKeybindings, {})
|
|
351
352
|
] }) }));
|
|
352
353
|
};
|
|
353
354
|
exports.TimelineSelectionProvider = TimelineSelectionProvider;
|
|
@@ -4,4 +4,5 @@ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-s
|
|
|
4
4
|
export declare const TimelineSequence: React.NamedExoticComponent<{
|
|
5
5
|
readonly s: TSequence;
|
|
6
6
|
readonly nodePathInfo: SequenceNodePathInfo | null;
|
|
7
|
+
readonly sequenceFrameOffset: number;
|
|
7
8
|
}>;
|
|
@@ -46,19 +46,21 @@ const LoopedTimelineIndicators_1 = require("./LoopedTimelineIndicators");
|
|
|
46
46
|
const TimelineImageInfo_1 = require("./TimelineImageInfo");
|
|
47
47
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
48
48
|
const TimelineSequenceFrame_1 = require("./TimelineSequenceFrame");
|
|
49
|
+
const TimelineSequenceRightEdgeDragHandle_1 = require("./TimelineSequenceRightEdgeDragHandle");
|
|
49
50
|
const TimelineVideoInfo_1 = require("./TimelineVideoInfo");
|
|
50
51
|
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
52
|
+
const use_resolved_stack_react_to_change_1 = require("./use-resolved-stack-react-to-change");
|
|
51
53
|
const AUDIO_GRADIENT = 'linear-gradient(rgb(16 171 58), rgb(43 165 63) 60%)';
|
|
52
54
|
const VIDEO_GRADIENT = 'linear-gradient(to top, #8e44ad, #9b59b6)';
|
|
53
55
|
const IMAGE_GRADIENT = 'linear-gradient(to top, #2980b9, #3498db)';
|
|
54
|
-
const TimelineSequenceFn = ({ s, nodePathInfo }) => {
|
|
56
|
+
const TimelineSequenceFn = ({ s, nodePathInfo, sequenceFrameOffset }) => {
|
|
55
57
|
const windowWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
56
58
|
if (windowWidth === null) {
|
|
57
59
|
return null;
|
|
58
60
|
}
|
|
59
|
-
return (jsx_runtime_1.jsx(TimelineSequenceInner, { windowWidth: windowWidth, s: s, nodePathInfo: nodePathInfo }));
|
|
61
|
+
return (jsx_runtime_1.jsx(TimelineSequenceInner, { windowWidth: windowWidth, s: s, nodePathInfo: nodePathInfo, sequenceFrameOffset: sequenceFrameOffset }));
|
|
60
62
|
};
|
|
61
|
-
const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidth, postmountWidth, style, children, nodePathInfo, }) => {
|
|
63
|
+
const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidth, postmountWidth, style, children, nodePathInfo, sequenceFrameOffset, fromCanUpdate, onMoveDragPointerDown, }) => {
|
|
62
64
|
var _a, _b;
|
|
63
65
|
const { onSelect, selectable } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
64
66
|
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
@@ -68,13 +70,17 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidt
|
|
|
68
70
|
shiftKey: e.shiftKey,
|
|
69
71
|
toggleKey: e.metaKey || e.ctrlKey,
|
|
70
72
|
});
|
|
73
|
+
if (TimelineSelection_1.TIMELINE_TOP_DRAG && fromCanUpdate) {
|
|
74
|
+
onMoveDragPointerDown(e);
|
|
75
|
+
}
|
|
71
76
|
}
|
|
72
|
-
}, [onSelect]);
|
|
77
|
+
}, [fromCanUpdate, onMoveDragPointerDown, onSelect]);
|
|
73
78
|
const frame = (0, remotion_1.useCurrentFrame)();
|
|
74
79
|
const relativeFrame = frame - s.from;
|
|
80
|
+
const sequenceFrame = relativeFrame + sequenceFrameOffset;
|
|
75
81
|
const relativeFrameWithPremount = relativeFrame + ((_a = s.premountDisplay) !== null && _a !== void 0 ? _a : 0);
|
|
76
82
|
const relativeFrameWithPostmount = relativeFrame - displayDurationInFrames;
|
|
77
|
-
const roundedFrame = Math.round(
|
|
83
|
+
const roundedFrame = Math.round(sequenceFrame * 100) / 100;
|
|
78
84
|
const isInRange = relativeFrame >= 0 && relativeFrame < displayDurationInFrames;
|
|
79
85
|
const isPremounting = relativeFrameWithPremount >= 0 &&
|
|
80
86
|
relativeFrameWithPremount < displayDurationInFrames &&
|
|
@@ -86,7 +92,6 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidt
|
|
|
86
92
|
return {
|
|
87
93
|
...style,
|
|
88
94
|
opacity: isInRange ? 1 : 0.5,
|
|
89
|
-
...(TimelineSelection_1.TIMELINE_TOP_DRAG ? { cursor: 'pointer' } : {}),
|
|
90
95
|
};
|
|
91
96
|
}, [isInRange, style]);
|
|
92
97
|
return (jsx_runtime_1.jsxs("div", { style: actualStyle, title: s.displayName, onPointerDown: selectable ? onPointerDown : undefined, children: [premountWidth ? (jsx_runtime_1.jsx("div", { style: {
|
|
@@ -123,14 +128,43 @@ const TimelineSequenceCurrentFrame = ({ s, displayDurationInFrames, premountWidt
|
|
|
123
128
|
alignItems: 'center',
|
|
124
129
|
}, children: jsx_runtime_1.jsx(TimelineSequenceFrame_1.TimelineSequenceFrame, { premounted: isPremounting, postmounted: isPostmounting ? s.duration - 1 : null, roundedFrame: roundedFrame }) })) : null] }));
|
|
125
130
|
};
|
|
126
|
-
const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo }) => {
|
|
131
|
+
const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo, sequenceFrameOffset }) => {
|
|
127
132
|
// If a duration is 1, it is essentially a still and it should have width 0
|
|
128
133
|
// Some compositions may not be longer than their media duration,
|
|
129
134
|
// if that is the case, it needs to be asynchronously determined
|
|
130
|
-
var _a;
|
|
135
|
+
var _a, _b;
|
|
136
|
+
var _c, _d, _e, _f;
|
|
131
137
|
const video = remotion_1.Internals.useVideo();
|
|
132
|
-
const maxMediaDuration = (0, use_max_media_duration_1.useMaxMediaDuration)(s, (
|
|
138
|
+
const maxMediaDuration = (0, use_max_media_duration_1.useMaxMediaDuration)(s, (_c = video === null || video === void 0 ? void 0 : video.fps) !== null && _c !== void 0 ? _c : 30);
|
|
133
139
|
const effectiveMaxMediaDuration = s.loopDisplay ? null : maxMediaDuration;
|
|
140
|
+
const originalLocation = (0, use_resolved_stack_react_to_change_1.useResolveStackAndReactToChange)(s.getStack);
|
|
141
|
+
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
142
|
+
var _a;
|
|
143
|
+
if (!originalLocation ||
|
|
144
|
+
!originalLocation.source ||
|
|
145
|
+
!originalLocation.line) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
source: originalLocation.source,
|
|
150
|
+
line: originalLocation.line,
|
|
151
|
+
column: (_a = originalLocation.column) !== null && _a !== void 0 ? _a : 0,
|
|
152
|
+
};
|
|
153
|
+
}, [originalLocation]);
|
|
154
|
+
const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
155
|
+
const nodePath = (_d = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _d !== void 0 ? _d : null;
|
|
156
|
+
const codeValuesForOverride = (0, react_1.useMemo)(() => {
|
|
157
|
+
return nodePath
|
|
158
|
+
? remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)
|
|
159
|
+
: undefined;
|
|
160
|
+
}, [codeValues, nodePath]);
|
|
161
|
+
const durationCanUpdate = Boolean(((_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride.durationInFrames) === null || _a === void 0 ? void 0 : _a.status) === 'static');
|
|
162
|
+
const fromCanUpdate = Boolean(((_b = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride.from) === null || _b === void 0 ? void 0 : _b.status) === 'static');
|
|
163
|
+
const { onPointerDown: onMoveDragPointerDown } = (0, TimelineSequenceRightEdgeDragHandle_1.useTimelineSequenceFromDrag)({
|
|
164
|
+
nodePathInfo,
|
|
165
|
+
windowWidth,
|
|
166
|
+
timelineDurationInFrames: (_e = video === null || video === void 0 ? void 0 : video.durationInFrames) !== null && _e !== void 0 ? _e : 1,
|
|
167
|
+
});
|
|
134
168
|
if (!video) {
|
|
135
169
|
throw new TypeError('Expected video config');
|
|
136
170
|
}
|
|
@@ -174,9 +208,16 @@ const TimelineSequenceInner = ({ s, windowWidth, nodePathInfo }) => {
|
|
|
174
208
|
overflow: 'hidden',
|
|
175
209
|
};
|
|
176
210
|
}, [marginLeft, s.type, width]);
|
|
211
|
+
const showRightEdgeDragHandle = TimelineSelection_1.TIMELINE_TOP_DRAG &&
|
|
212
|
+
(s.type === 'sequence' || s.type === 'image') &&
|
|
213
|
+
!s.loopDisplay &&
|
|
214
|
+
!s.isInsideSeries &&
|
|
215
|
+
nodePath !== null &&
|
|
216
|
+
validatedLocation !== null &&
|
|
217
|
+
durationCanUpdate;
|
|
177
218
|
if (maxMediaDuration === null && !s.loopDisplay) {
|
|
178
219
|
return null;
|
|
179
220
|
}
|
|
180
|
-
return (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, playbackRate: s.playbackRate, loopDisplay: s.loopDisplay })) : null, s.type === 'video' ? (jsx_runtime_1.jsx(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src, visualizationWidth: width, naturalWidth: naturalWidth, trimBefore: s.startMediaFrom, durationInFrames: s.duration, playbackRate: s.playbackRate, volume: s.volume, doesVolumeChange: s.doesVolumeChange, premountWidth: premountWidth !== null && premountWidth !== void 0 ? premountWidth : 0, postmountWidth: postmountWidth !== null && postmountWidth !== void 0 ? postmountWidth : 0, loopDisplay: s.loopDisplay })) : null, s.type === 'image' ? (jsx_runtime_1.jsx(TimelineImageInfo_1.TimelineImageInfo, { src: s.src, visualizationWidth: width })) : null, s.loopDisplay === undefined ? null : (jsx_runtime_1.jsx(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes }))] }));
|
|
221
|
+
return (jsx_runtime_1.jsxs(TimelineSequenceCurrentFrame, { s: s, displayDurationInFrames: displayDurationInFrames, premountWidth: premountWidth, postmountWidth: postmountWidth, style: style, nodePathInfo: nodePathInfo, sequenceFrameOffset: sequenceFrameOffset, fromCanUpdate: fromCanUpdate, onMoveDragPointerDown: onMoveDragPointerDown, children: [s.type === 'audio' ? (jsx_runtime_1.jsx(AudioWaveform_1.AudioWaveform, { src: s.src, height: timeline_layout_1.TIMELINE_LAYER_HEIGHT_AUDIO, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, playbackRate: s.playbackRate, loopDisplay: s.loopDisplay })) : null, s.type === 'video' ? (jsx_runtime_1.jsx(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src, visualizationWidth: width, naturalWidth: naturalWidth, trimBefore: s.startMediaFrom, durationInFrames: s.duration, playbackRate: s.playbackRate, volume: s.volume, doesVolumeChange: s.doesVolumeChange, premountWidth: premountWidth !== null && premountWidth !== void 0 ? premountWidth : 0, postmountWidth: postmountWidth !== null && postmountWidth !== void 0 ? postmountWidth : 0, loopDisplay: s.loopDisplay })) : null, s.type === 'image' ? (jsx_runtime_1.jsx(TimelineImageInfo_1.TimelineImageInfo, { src: s.src, visualizationWidth: width })) : null, s.loopDisplay === undefined ? null : (jsx_runtime_1.jsx(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes })), showRightEdgeDragHandle && nodePathInfo && validatedLocation ? (jsx_runtime_1.jsx(TimelineSequenceRightEdgeDragHandle_1.TimelineSequenceRightEdgeDragHandle, { nodePathInfo: nodePathInfo, windowWidth: windowWidth, timelineDurationInFrames: (_f = video.durationInFrames) !== null && _f !== void 0 ? _f : 1 })) : null] }));
|
|
181
222
|
};
|
|
182
223
|
exports.TimelineSequence = react_1.default.memo(TimelineSequenceFn);
|
|
@@ -9,6 +9,7 @@ const relativeFrameStyle = {
|
|
|
9
9
|
opacity: 0.5,
|
|
10
10
|
whiteSpace: 'nowrap',
|
|
11
11
|
pointerEvents: 'none',
|
|
12
|
+
userSelect: 'none',
|
|
12
13
|
};
|
|
13
14
|
const TimelineSequenceFrame = ({ roundedFrame, premounted, postmounted }) => {
|
|
14
15
|
return (jsx_runtime_1.jsx("div", { style: relativeFrameStyle, children: premounted
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineSequenceItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const remotion_1 = require("remotion");
|
|
7
8
|
const no_react_1 = require("remotion/no-react");
|
|
@@ -31,10 +32,37 @@ const labelContainerStyle = {
|
|
|
31
32
|
minWidth: 0,
|
|
32
33
|
gap: 4,
|
|
33
34
|
};
|
|
35
|
+
const effectDropHighlight = {
|
|
36
|
+
backgroundColor: 'rgba(0, 155, 255, 0.16)',
|
|
37
|
+
outline: '1px solid rgba(0, 155, 255, 0.75)',
|
|
38
|
+
outlineOffset: -1,
|
|
39
|
+
};
|
|
40
|
+
const hasEffectDragType = (dataTransfer) => {
|
|
41
|
+
return Array.from(dataTransfer.types).some((type) => type === studio_shared_1.EFFECT_DRAG_MIME_TYPE ||
|
|
42
|
+
type === 'application/json' ||
|
|
43
|
+
type === 'text/plain');
|
|
44
|
+
};
|
|
45
|
+
const getEffectDragData = (dataTransfer) => {
|
|
46
|
+
for (const type of [
|
|
47
|
+
studio_shared_1.EFFECT_DRAG_MIME_TYPE,
|
|
48
|
+
'application/json',
|
|
49
|
+
'text/plain',
|
|
50
|
+
]) {
|
|
51
|
+
const value = dataTransfer.getData(type);
|
|
52
|
+
if (!value) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const parsed = (0, studio_shared_1.parseEffectDragData)(value);
|
|
56
|
+
if (parsed) {
|
|
57
|
+
return parsed;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
};
|
|
34
62
|
const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDisplayOffset }) => {
|
|
35
|
-
var _a;
|
|
36
|
-
var
|
|
37
|
-
const nodePath = (
|
|
63
|
+
var _a, _b;
|
|
64
|
+
var _c;
|
|
65
|
+
const nodePath = (_c = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.sequenceSubscriptionKey) !== null && _c !== void 0 ? _c : null;
|
|
38
66
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
39
67
|
const previewConnected = previewServerState.type === 'connected';
|
|
40
68
|
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
@@ -44,6 +72,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
|
|
|
44
72
|
const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
|
|
45
73
|
const { onSelect, selectable, selected } = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
46
74
|
const containsSelection = (0, TimelineSelection_1.useTimelineRowContainsSelection)(nodePathInfo);
|
|
75
|
+
const [effectDropHovered, setEffectDropHovered] = (0, react_1.useState)(false);
|
|
47
76
|
const { canOpenInEditor, openInEditor, originalLocation } = (0, use_open_sequence_in_editor_1.useOpenSequenceInEditor)(sequence);
|
|
48
77
|
const fileLocation = (0, react_1.useMemo)(() => (0, format_file_location_1.formatFileLocation)({
|
|
49
78
|
location: originalLocation,
|
|
@@ -269,7 +298,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
|
|
|
269
298
|
const codeHiddenStatus = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride.hidden;
|
|
270
299
|
const isItemHidden = (0, react_1.useMemo)(() => {
|
|
271
300
|
var _a;
|
|
272
|
-
const codeValue = codeHiddenStatus && codeHiddenStatus.
|
|
301
|
+
const codeValue = codeHiddenStatus && codeHiddenStatus.status === 'static'
|
|
273
302
|
? codeHiddenStatus.codeValue
|
|
274
303
|
: undefined;
|
|
275
304
|
const runtimeValue = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.currentRuntimeValueDotNotation.hidden;
|
|
@@ -282,7 +311,7 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
|
|
|
282
311
|
!validatedLocation ||
|
|
283
312
|
!codeValuesForOverride ||
|
|
284
313
|
!codeHiddenStatus ||
|
|
285
|
-
|
|
314
|
+
codeHiddenStatus.status !== 'static' ||
|
|
286
315
|
previewServerState.type !== 'connected') {
|
|
287
316
|
return;
|
|
288
317
|
}
|
|
@@ -322,6 +351,14 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
|
|
|
322
351
|
flexShrink: 0,
|
|
323
352
|
};
|
|
324
353
|
}, []);
|
|
354
|
+
const rowStyle = (0, react_1.useMemo)(() => {
|
|
355
|
+
return effectDropHovered
|
|
356
|
+
? {
|
|
357
|
+
...inner,
|
|
358
|
+
...effectDropHighlight,
|
|
359
|
+
}
|
|
360
|
+
: inner;
|
|
361
|
+
}, [effectDropHovered, inner]);
|
|
325
362
|
const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
|
|
326
363
|
const canToggleVisibility = previewConnected &&
|
|
327
364
|
Boolean(sequence.controls) &&
|
|
@@ -329,8 +366,61 @@ const TimelineSequenceItem = ({ nestedDepth, sequence, nodePathInfo, keyframeDis
|
|
|
329
366
|
validatedLocation !== null &&
|
|
330
367
|
codeHiddenStatus !== undefined &&
|
|
331
368
|
codeHiddenStatus !== null &&
|
|
332
|
-
codeHiddenStatus.
|
|
333
|
-
const
|
|
369
|
+
codeHiddenStatus.status === 'static';
|
|
370
|
+
const canDropEffect = previewServerState.type === 'connected' &&
|
|
371
|
+
nodePath !== null &&
|
|
372
|
+
validatedLocation !== null &&
|
|
373
|
+
((_b = sequence.controls) === null || _b === void 0 ? void 0 : _b.supportsEffects) === true;
|
|
374
|
+
const onEffectDragOver = (0, react_1.useCallback)((e) => {
|
|
375
|
+
if (!canDropEffect || !hasEffectDragType(e.dataTransfer)) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
e.preventDefault();
|
|
379
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
380
|
+
setEffectDropHovered(true);
|
|
381
|
+
}, [canDropEffect]);
|
|
382
|
+
const onEffectDragLeave = (0, react_1.useCallback)((e) => {
|
|
383
|
+
if (e.currentTarget.contains(e.relatedTarget)) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
setEffectDropHovered(false);
|
|
387
|
+
}, []);
|
|
388
|
+
const onEffectDrop = (0, react_1.useCallback)(async (e) => {
|
|
389
|
+
if (!canDropEffect ||
|
|
390
|
+
previewServerState.type !== 'connected' ||
|
|
391
|
+
nodePath === null ||
|
|
392
|
+
validatedLocation === null) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
e.preventDefault();
|
|
396
|
+
e.stopPropagation();
|
|
397
|
+
setEffectDropHovered(false);
|
|
398
|
+
const dragData = getEffectDragData(e.dataTransfer);
|
|
399
|
+
if (!dragData) {
|
|
400
|
+
(0, NotificationCenter_1.showNotification)('Could not read effect drag data', 3000);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
try {
|
|
404
|
+
const result = await (0, call_api_1.callApi)('/api/add-effect', {
|
|
405
|
+
fileName: validatedLocation.source,
|
|
406
|
+
sequenceNodePath: nodePath,
|
|
407
|
+
effectName: dragData.effect.name,
|
|
408
|
+
effectImportPath: dragData.effect.importPath,
|
|
409
|
+
effectConfig: dragData.effect.config,
|
|
410
|
+
clientId: previewServerState.clientId,
|
|
411
|
+
});
|
|
412
|
+
if (result.success) {
|
|
413
|
+
(0, NotificationCenter_1.showNotification)(`Added ${dragData.effect.name}()`, 2000);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
(0, NotificationCenter_1.showNotification)(result.reason, 4000);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
(0, NotificationCenter_1.showNotification)(err.message, 4000);
|
|
421
|
+
}
|
|
422
|
+
}, [canDropEffect, nodePath, previewServerState, validatedLocation]);
|
|
423
|
+
const trackRow = (jsx_runtime_1.jsx(TimelineRowChrome_1.TimelineRowChrome, { depth: nestedDepth, eye: canToggleVisibility ? (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility })) : (jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {})), arrow: hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: !previewConnected || nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {})), style: rowStyle, selected: selected, selectable: selectable, onSelect: onSelect, showSelectedBackground: true, containsSelection: containsSelection, outerHeight: outerHeight, onDragLeave: canDropEffect ? onEffectDragLeave : undefined, onDragOver: canDropEffect ? onEffectDragOver : undefined, onDrop: canDropEffect ? onEffectDrop : undefined, onDoubleClick: TimelineSelection_1.SELECTION_ENABLED && canOpenInEditor
|
|
334
424
|
? onShowInEditorDoubleClick
|
|
335
425
|
: undefined, children: jsx_runtime_1.jsxs("div", { style: labelContainerStyle, children: [
|
|
336
426
|
jsx_runtime_1.jsx(TimelineSequenceName_1.TimelineSequenceName, { sequence: sequence, selected: selected, containsSelection: containsSelection }), mediaSrc ? jsx_runtime_1.jsx(TimelineMediaInfo_1.TimelineMediaInfo, { src: mediaSrc }) : null, jsx_runtime_1.jsx(TimelineItemStack_1.TimelineItemStack, { originalLocation: originalLocation })
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineSequencePropItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const remotion_1 = require("remotion");
|
|
7
8
|
const client_id_1 = require("../../helpers/client-id");
|
|
8
9
|
const ContextMenu_1 = require("../ContextMenu");
|
|
10
|
+
const call_add_keyframe_1 = require("./call-add-keyframe");
|
|
9
11
|
const save_sequence_prop_1 = require("./save-sequence-prop");
|
|
10
12
|
const timeline_field_row_layout_1 = require("./timeline-field-row-layout");
|
|
11
13
|
const TimelineExpandArrowButton_1 = require("./TimelineExpandArrowButton");
|
|
@@ -17,6 +19,23 @@ const TimelineRowChrome_1 = require("./TimelineRowChrome");
|
|
|
17
19
|
const TimelineSchemaField_1 = require("./TimelineSchemaField");
|
|
18
20
|
const TimelineSelection_1 = require("./TimelineSelection");
|
|
19
21
|
const fieldRowBase = {};
|
|
22
|
+
const isKeyframedStatus = (status) => {
|
|
23
|
+
return status.status === 'keyframed';
|
|
24
|
+
};
|
|
25
|
+
const isResettableStatus = ({ status, defaultValue, }) => {
|
|
26
|
+
var _a;
|
|
27
|
+
if (defaultValue === undefined) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (status.status === 'keyframed') {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if (status.status === 'computed') {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const effectiveCodeValue = (_a = status.codeValue) !== null && _a !== void 0 ? _a : defaultValue;
|
|
37
|
+
return JSON.stringify(effectiveCodeValue) !== JSON.stringify(defaultValue);
|
|
38
|
+
};
|
|
20
39
|
const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
21
40
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
22
41
|
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
@@ -38,9 +57,6 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
38
57
|
? previewServerState.clientId
|
|
39
58
|
: null;
|
|
40
59
|
const onSave = (0, react_1.useCallback)((value) => {
|
|
41
|
-
if (!codeValue || !codeValue.canUpdate) {
|
|
42
|
-
return Promise.reject(new Error('Cannot save'));
|
|
43
|
-
}
|
|
44
60
|
if (!clientId) {
|
|
45
61
|
return Promise.reject(new Error('Not connected to studio server'));
|
|
46
62
|
}
|
|
@@ -79,7 +95,7 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
79
95
|
if (nodePath === null) {
|
|
80
96
|
throw new Error('Cannot drag value');
|
|
81
97
|
}
|
|
82
|
-
setDragOverrides(nodePath, field.key, value);
|
|
98
|
+
setDragOverrides(nodePath, field.key, remotion_1.Internals.makeStaticDragOverride(value));
|
|
83
99
|
}, [setDragOverrides, nodePath, field.key]);
|
|
84
100
|
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
85
101
|
if (nodePath === null) {
|
|
@@ -87,17 +103,22 @@ const Value = ({ field, nodePath, validatedLocation, schema, codeValue }) => {
|
|
|
87
103
|
}
|
|
88
104
|
clearDragOverrides(nodePath);
|
|
89
105
|
}, [clearDragOverrides, nodePath]);
|
|
90
|
-
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue }));
|
|
106
|
+
return (jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue, scaleLockNodePath: nodePath }));
|
|
91
107
|
};
|
|
92
108
|
const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath, nodePathInfo, schema, keyframeDisplayOffset, }) => {
|
|
93
109
|
var _a, _b;
|
|
94
110
|
const { codeValues: visualModeCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
95
111
|
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
96
|
-
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
112
|
+
const { setCodeValues, setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
97
113
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
98
114
|
const selection = (0, TimelineSelection_1.useTimelineRowSelection)(nodePathInfo);
|
|
115
|
+
const clientId = previewServerState.type === 'connected'
|
|
116
|
+
? previewServerState.clientId
|
|
117
|
+
: null;
|
|
99
118
|
const codeValuesForOverride = remotion_1.Internals.getCodeValuesCtx(visualModeCodeValues, nodePath);
|
|
100
119
|
const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
120
|
+
const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
|
|
121
|
+
const jsxFrame = timelinePosition - keyframeDisplayOffset;
|
|
101
122
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
102
123
|
var _a;
|
|
103
124
|
return ((_a = getDragOverrides(nodePath)) !== null && _a !== void 0 ? _a : {})[field.key];
|
|
@@ -106,6 +127,10 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
106
127
|
(0, TimelineKeyframeControls_1.shouldShowTimelineKeyframeControls)({
|
|
107
128
|
propStatus: codeValue,
|
|
108
129
|
selected: selection.selected,
|
|
130
|
+
keyframable: (0, studio_shared_1.isSchemaFieldKeyframable)({
|
|
131
|
+
schema,
|
|
132
|
+
key: field.key,
|
|
133
|
+
}),
|
|
109
134
|
}) ? (jsx_runtime_1.jsx(TimelineKeyframeControls_1.TimelineKeyframeControls, { fieldKey: field.key, propStatus: codeValue, nodePath: nodePath, fileName: validatedLocation.source, keyframeDisplayOffset: keyframeDisplayOffset, defaultValue: field.fieldSchema.default, dragOverrideValue: dragOverrideValue, schema: schema, effectIndex: null })) : null;
|
|
110
135
|
const style = (0, react_1.useMemo)(() => {
|
|
111
136
|
return {
|
|
@@ -113,23 +138,24 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
113
138
|
height: field.rowHeight,
|
|
114
139
|
};
|
|
115
140
|
}, [field.rowHeight]);
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
if (!codeValue || !codeValue.canUpdate) {
|
|
141
|
+
const canResetToDefault = (0, react_1.useMemo)(() => {
|
|
142
|
+
if (!codeValue || codeValue.status === 'computed') {
|
|
119
143
|
return false;
|
|
120
144
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
145
|
+
return isResettableStatus({
|
|
146
|
+
status: codeValue,
|
|
147
|
+
defaultValue: field.fieldSchema.default,
|
|
148
|
+
});
|
|
124
149
|
}, [codeValue, field.fieldSchema.default]);
|
|
125
150
|
const canPerformReset = previewServerState.type === 'connected' &&
|
|
126
151
|
codeValue !== null &&
|
|
127
|
-
codeValue.
|
|
152
|
+
codeValue.status !== 'computed';
|
|
153
|
+
const canShowReset = canPerformReset && field.fieldSchema.default !== undefined;
|
|
128
154
|
const onReset = (0, react_1.useCallback)(() => {
|
|
129
|
-
if (!
|
|
155
|
+
if (!canShowReset ||
|
|
156
|
+
!canResetToDefault ||
|
|
130
157
|
previewServerState.type !== 'connected' ||
|
|
131
|
-
codeValue === null
|
|
132
|
-
!isNonDefault) {
|
|
158
|
+
codeValue === null) {
|
|
133
159
|
return;
|
|
134
160
|
}
|
|
135
161
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
@@ -146,10 +172,10 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
146
172
|
clientId: previewServerState.clientId,
|
|
147
173
|
});
|
|
148
174
|
}, [
|
|
149
|
-
|
|
175
|
+
canResetToDefault,
|
|
176
|
+
canShowReset,
|
|
150
177
|
field.fieldSchema.default,
|
|
151
178
|
field.key,
|
|
152
|
-
isNonDefault,
|
|
153
179
|
nodePath,
|
|
154
180
|
previewServerState,
|
|
155
181
|
schema,
|
|
@@ -157,6 +183,41 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
157
183
|
validatedLocation.source,
|
|
158
184
|
codeValue,
|
|
159
185
|
]);
|
|
186
|
+
const onSaveKeyframed = (0, react_1.useCallback)((value, sourceFrame) => {
|
|
187
|
+
if (!clientId) {
|
|
188
|
+
return Promise.reject(new Error('Not connected to studio server'));
|
|
189
|
+
}
|
|
190
|
+
return (0, call_add_keyframe_1.callAddSequenceKeyframe)({
|
|
191
|
+
fileName: validatedLocation.source,
|
|
192
|
+
nodePath,
|
|
193
|
+
fieldKey: field.key,
|
|
194
|
+
sourceFrame,
|
|
195
|
+
value,
|
|
196
|
+
schema,
|
|
197
|
+
setCodeValues,
|
|
198
|
+
clientId,
|
|
199
|
+
});
|
|
200
|
+
}, [
|
|
201
|
+
clientId,
|
|
202
|
+
field.key,
|
|
203
|
+
nodePath,
|
|
204
|
+
schema,
|
|
205
|
+
setCodeValues,
|
|
206
|
+
validatedLocation.source,
|
|
207
|
+
]);
|
|
208
|
+
const onKeyframedDragValueChange = (0, react_1.useCallback)((value) => {
|
|
209
|
+
if (codeValue === null || !isKeyframedStatus(codeValue)) {
|
|
210
|
+
throw new Error('Expected keyframed status');
|
|
211
|
+
}
|
|
212
|
+
setDragOverrides(nodePath, field.key, remotion_1.Internals.makeKeyframedDragOverride({
|
|
213
|
+
status: codeValue,
|
|
214
|
+
frame: jsxFrame,
|
|
215
|
+
value,
|
|
216
|
+
}));
|
|
217
|
+
}, [codeValue, field.key, jsxFrame, nodePath, setDragOverrides]);
|
|
218
|
+
const onKeyframedDragEnd = (0, react_1.useCallback)(() => {
|
|
219
|
+
clearDragOverrides(nodePath);
|
|
220
|
+
}, [clearDragOverrides, nodePath]);
|
|
160
221
|
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
161
222
|
return [
|
|
162
223
|
{
|
|
@@ -165,19 +226,19 @@ const TimelineSequencePropItem = ({ field, validatedLocation, rowDepth, nodePath
|
|
|
165
226
|
keyHint: null,
|
|
166
227
|
label: 'Reset',
|
|
167
228
|
leftItem: null,
|
|
168
|
-
disabled: !
|
|
229
|
+
disabled: !canShowReset,
|
|
169
230
|
onClick: onReset,
|
|
170
231
|
quickSwitcherLabel: null,
|
|
171
232
|
subMenu: null,
|
|
172
233
|
value: 'reset-sequence-field',
|
|
173
234
|
},
|
|
174
235
|
];
|
|
175
|
-
}, [
|
|
236
|
+
}, [canShowReset, onReset]);
|
|
176
237
|
if (codeValue === null) {
|
|
177
238
|
return null;
|
|
178
239
|
}
|
|
179
240
|
const row = (jsx_runtime_1.jsxs(TimelineRowChrome_1.TimelineRowChrome, { depth: rowDepth, eye: jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEyeSpacer, {}), keyframeControls: keyframeControls, arrow: jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}), style: style, selected: selection.selected, selectable: selection.selectable, onSelect: selection.onSelect, showSelectedBackground: true, containsSelection: false, outerHeight: null, children: [
|
|
180
|
-
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), codeValue
|
|
241
|
+
jsx_runtime_1.jsx(TimelineFieldLabel_1.TimelineFieldLabel, { rowDepth: rowDepth, selected: selection.selected, label: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }), isKeyframedStatus(codeValue) ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineKeyframedValue_1.TimelineKeyframedValue, { field: field, propStatus: codeValue, keyframeDisplayOffset: keyframeDisplayOffset, dragOverrideValue: dragOverrideValue, onSave: onSaveKeyframed, onDragValueChange: onKeyframedDragValueChange, onDragEnd: onKeyframedDragEnd, scaleLockNodePath: nodePath }) })) : codeValue.status === 'static' ? (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(Value, { field: field, nodePath: nodePath, validatedLocation: validatedLocation, schema: schema, codeValue: codeValue }) })) : (jsx_runtime_1.jsx("div", { style: timeline_field_row_layout_1.timelineFieldValueColumnStyle, children: jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineNonEditableStatus, { propStatus: codeValue }) }))] }));
|
|
181
242
|
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, onOpen: selection.selectable ? selection.onSelect : null, children: row }));
|
|
182
243
|
};
|
|
183
244
|
exports.TimelineSequencePropItem = TimelineSequencePropItem;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CodeValues, OverrideIdToNodePaths, SequencePropsSubscriptionKey, TSequence } from 'remotion';
|
|
3
|
+
import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
|
|
4
|
+
import { type SaveSequencePropChange } from './save-sequence-prop';
|
|
5
|
+
import { type TimelineSelection } from './TimelineSelection';
|
|
6
|
+
export type TimelineSequenceDurationDragTarget = {
|
|
7
|
+
readonly fileName: string;
|
|
8
|
+
readonly initialDuration: number;
|
|
9
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
10
|
+
};
|
|
11
|
+
export type TimelineSequenceFromDragTarget = {
|
|
12
|
+
readonly fileName: string;
|
|
13
|
+
readonly initialFrom: number;
|
|
14
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
15
|
+
};
|
|
16
|
+
export declare const getTimelineSequenceDurationDragValue: ({ initialDuration, deltaFrames, }: {
|
|
17
|
+
readonly initialDuration: number;
|
|
18
|
+
readonly deltaFrames: number;
|
|
19
|
+
}) => number;
|
|
20
|
+
export declare const getTimelineSequenceDurationDragChanges: ({ targets, deltaFrames, }: {
|
|
21
|
+
readonly targets: readonly TimelineSequenceDurationDragTarget[];
|
|
22
|
+
readonly deltaFrames: number;
|
|
23
|
+
}) => SaveSequencePropChange[];
|
|
24
|
+
export declare const getTimelineSequenceFromDragValue: ({ initialFrom, deltaFrames, }: {
|
|
25
|
+
readonly initialFrom: number;
|
|
26
|
+
readonly deltaFrames: number;
|
|
27
|
+
}) => number;
|
|
28
|
+
export declare const getTimelineSequenceFromDragChanges: ({ targets, deltaFrames, }: {
|
|
29
|
+
readonly targets: readonly TimelineSequenceFromDragTarget[];
|
|
30
|
+
readonly deltaFrames: number;
|
|
31
|
+
}) => SaveSequencePropChange[];
|
|
32
|
+
export declare const getTimelineSequenceDurationDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, codeValues, }: {
|
|
33
|
+
readonly draggedNodePathInfo: SequenceNodePathInfo;
|
|
34
|
+
readonly selectedItems: readonly TimelineSelection[];
|
|
35
|
+
readonly sequences: TSequence[];
|
|
36
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
37
|
+
readonly codeValues: CodeValues;
|
|
38
|
+
}) => TimelineSequenceDurationDragTarget[] | null;
|
|
39
|
+
export declare const getTimelineSequenceFromDragTargets: ({ draggedNodePathInfo, selectedItems, sequences, overrideIdsToNodePaths, codeValues, }: {
|
|
40
|
+
readonly draggedNodePathInfo: SequenceNodePathInfo;
|
|
41
|
+
readonly selectedItems: readonly TimelineSelection[];
|
|
42
|
+
readonly sequences: TSequence[];
|
|
43
|
+
readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
|
|
44
|
+
readonly codeValues: CodeValues;
|
|
45
|
+
}) => TimelineSequenceFromDragTarget[] | null;
|
|
46
|
+
export declare const useTimelineSequenceFromDrag: ({ nodePathInfo, windowWidth, timelineDurationInFrames, }: {
|
|
47
|
+
readonly nodePathInfo: SequenceNodePathInfo | null;
|
|
48
|
+
readonly windowWidth: number;
|
|
49
|
+
readonly timelineDurationInFrames: number;
|
|
50
|
+
}) => {
|
|
51
|
+
dragging: boolean;
|
|
52
|
+
onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
|
|
53
|
+
};
|
|
54
|
+
export declare const TimelineSequenceRightEdgeDragHandle: React.FC<{
|
|
55
|
+
readonly nodePathInfo: SequenceNodePathInfo;
|
|
56
|
+
readonly windowWidth: number;
|
|
57
|
+
readonly timelineDurationInFrames: number;
|
|
58
|
+
}>;
|