@remotion/studio 4.0.460 → 4.0.461
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 +0 -1
- package/dist/Studio.js +4 -4
- package/dist/components/AudioWaveform.js +17 -9
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/MenuCompositionName.js +1 -0
- package/dist/components/RenderButton.js +1 -1
- package/dist/components/Timeline/SequencePropsObserver.js +1 -1
- package/dist/components/Timeline/Timeline.js +11 -10
- package/dist/components/Timeline/TimelineBooleanField.d.ts +4 -4
- package/dist/components/Timeline/TimelineBooleanField.js +5 -5
- package/dist/components/Timeline/TimelineDragHandler.js +37 -3
- package/dist/components/Timeline/TimelineEnumField.d.ts +5 -5
- package/dist/components/Timeline/TimelineEnumField.js +7 -7
- package/dist/components/Timeline/TimelineExpandArrowButton.js +1 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +3 -3
- package/dist/components/Timeline/TimelineFieldRow.js +49 -16
- package/dist/components/Timeline/TimelineHeightContainer.d.ts +1 -1
- package/dist/components/Timeline/TimelineHeightContainer.js +36 -3
- package/dist/components/Timeline/TimelineListItem.js +15 -14
- package/dist/components/Timeline/TimelineNumberField.d.ts +5 -5
- package/dist/components/Timeline/TimelineNumberField.js +12 -10
- package/dist/components/Timeline/TimelineRotationField.d.ts +5 -5
- package/dist/components/Timeline/TimelineRotationField.js +10 -10
- package/dist/components/Timeline/TimelineSchemaField.d.ts +4 -6
- package/dist/components/Timeline/TimelineSchemaField.js +8 -11
- package/dist/components/Timeline/TimelineSequence.js +2 -2
- package/dist/components/Timeline/TimelineSlider.js +2 -2
- package/dist/components/Timeline/TimelineStack/get-stack.js +17 -31
- package/dist/components/Timeline/TimelineStack/index.js +0 -10
- package/dist/components/Timeline/TimelineTimeIndicators.js +2 -2
- package/dist/components/Timeline/TimelineTracks.d.ts +1 -1
- package/dist/components/Timeline/TimelineTracks.js +40 -10
- package/dist/components/Timeline/TimelineTranslateField.d.ts +5 -5
- package/dist/components/Timeline/TimelineTranslateField.js +19 -37
- package/dist/components/Timeline/sequence-props-subscription-store.js +1 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
- package/dist/components/Timeline/use-timeline-height.js +4 -13
- package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +3 -3
- package/dist/error-overlay/react-overlay/utils/get-source-map.js +5 -5
- package/dist/error-overlay/react-overlay/utils/unmapper.d.ts +0 -6
- package/dist/error-overlay/react-overlay/utils/unmapper.js +8 -1
- package/dist/esm/{chunk-nrgs0ad5.js → chunk-yzh34sp0.js} +286 -538
- package/dist/esm/internals.mjs +286 -538
- package/dist/esm/previewEntry.mjs +289 -542
- package/dist/esm/renderEntry.mjs +2 -5
- package/dist/helpers/calculate-timeline.js +26 -4
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -0
- package/dist/helpers/timeline-layout.d.ts +3 -2
- package/dist/helpers/timeline-layout.js +31 -9
- package/dist/internals.d.ts +0 -1
- package/dist/previewEntry.js +1 -1
- package/dist/renderEntry.js +3 -3
- package/package.json +13 -22
- package/dist/audio-waveform-worker.d.ts +0 -1
- package/dist/audio-waveform-worker.js +0 -102
- package/dist/components/audio-waveform-worker-types.d.ts +0 -28
- package/dist/components/audio-waveform-worker-types.js +0 -2
- package/dist/components/draw-peaks.d.ts +0 -1
- package/dist/components/draw-peaks.js +0 -68
- package/dist/components/load-waveform-peaks.d.ts +0 -13
- package/dist/components/load-waveform-peaks.js +0 -76
- package/dist/components/parse-color.d.ts +0 -1
- package/dist/components/parse-color.js +0 -17
- package/dist/components/slice-waveform-peaks.d.ts +0 -7
- package/dist/components/slice-waveform-peaks.js +0 -15
- package/dist/components/waveform-peak-processor.d.ts +0 -23
- package/dist/components/waveform-peak-processor.js +0 -77
- package/dist/esm/audio-waveform-worker.mjs +0 -346
- package/dist/make-audio-waveform-worker.d.ts +0 -1
- package/dist/make-audio-waveform-worker.js +0 -10
package/dist/Studio.d.ts
CHANGED
package/dist/Studio.js
CHANGED
|
@@ -15,17 +15,17 @@ const ResolveCompositionConfigInStudio_1 = require("./ResolveCompositionConfigIn
|
|
|
15
15
|
const getServerDisconnectedDomElement = () => {
|
|
16
16
|
return document.getElementById('server-disconnected-overlay');
|
|
17
17
|
};
|
|
18
|
-
const StudioInner = ({ rootComponent, readOnly
|
|
18
|
+
const StudioInner = ({ rootComponent, readOnly }) => {
|
|
19
19
|
var _a, _b;
|
|
20
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: jsx_runtime_1.jsx(remotion_1.Internals.RemotionRootContexts, {
|
|
20
|
+
return (jsx_runtime_1.jsx(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: jsx_runtime_1.jsx(remotion_1.Internals.RemotionRootContexts, { frameState: null, audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: (_a = window.remotion_logLevel) !== null && _a !== void 0 ? _a : 'info', numberOfAudioTags: window.remotion_numberOfAudioTags, audioLatencyHint: (_b = window.remotion_audioLatencyHint) !== null && _b !== void 0 ? _b : 'playback', children: jsx_runtime_1.jsx(use_static_files_1.StaticFilesProvider, { children: jsx_runtime_1.jsx(ResolveCompositionConfigInStudio_1.ResolveCompositionConfigInStudio, { children: jsx_runtime_1.jsxs(EditorContexts_1.EditorContexts, { readOnlyStudio: readOnly, children: [
|
|
21
21
|
jsx_runtime_1.jsx(Editor_1.Editor, { readOnlyStudio: readOnly, Root: rootComponent }), readOnly
|
|
22
22
|
? null
|
|
23
23
|
: (0, react_dom_1.createPortal)(jsx_runtime_1.jsx(ServerDisconnected_1.ServerDisconnected, {}), getServerDisconnectedDomElement())] }) }) }) }) }));
|
|
24
24
|
};
|
|
25
|
-
const Studio = ({ rootComponent, readOnly
|
|
25
|
+
const Studio = ({ rootComponent, readOnly }) => {
|
|
26
26
|
(0, react_1.useLayoutEffect)(() => {
|
|
27
27
|
(0, inject_css_1.injectCSS)();
|
|
28
28
|
}, []);
|
|
29
|
-
return (jsx_runtime_1.jsx(FastRefreshProvider_1.FastRefreshProvider, { children: jsx_runtime_1.jsx(StudioInner, { rootComponent: rootComponent, readOnly: readOnly
|
|
29
|
+
return (jsx_runtime_1.jsx(FastRefreshProvider_1.FastRefreshProvider, { children: jsx_runtime_1.jsx(StudioInner, { rootComponent: rootComponent, readOnly: readOnly }) }));
|
|
30
30
|
};
|
|
31
31
|
exports.Studio = Studio;
|
|
@@ -7,10 +7,6 @@ const react_1 = require("react");
|
|
|
7
7
|
const remotion_1 = require("remotion");
|
|
8
8
|
const colors_1 = require("../helpers/colors");
|
|
9
9
|
const timeline_layout_1 = require("../helpers/timeline-layout");
|
|
10
|
-
const make_audio_waveform_worker_1 = require("../make-audio-waveform-worker");
|
|
11
|
-
const draw_peaks_1 = require("./draw-peaks");
|
|
12
|
-
const load_waveform_peaks_1 = require("./load-waveform-peaks");
|
|
13
|
-
const slice_waveform_peaks_1 = require("./slice-waveform-peaks");
|
|
14
10
|
const EMPTY_PEAKS = new Float32Array(0);
|
|
15
11
|
// Recreate the canvas after Fast Refresh because an already transferred canvas
|
|
16
12
|
// cannot be handed to OffscreenCanvas again.
|
|
@@ -56,7 +52,13 @@ const drawLoopedWaveform = ({ canvas, peaks, volume, visualizationWidth, loopWid
|
|
|
56
52
|
const targetCanvas = document.createElement('canvas');
|
|
57
53
|
targetCanvas.width = Math.max(1, Math.ceil(loopWidth));
|
|
58
54
|
targetCanvas.height = h;
|
|
59
|
-
(0,
|
|
55
|
+
(0, timeline_utils_1.drawBars)({
|
|
56
|
+
canvas: targetCanvas,
|
|
57
|
+
peaks,
|
|
58
|
+
color: 'rgba(255, 255, 255, 0.6)',
|
|
59
|
+
volume,
|
|
60
|
+
width: targetCanvas.width,
|
|
61
|
+
});
|
|
60
62
|
canvas.width = w;
|
|
61
63
|
canvas.height = h;
|
|
62
64
|
const ctx = canvas.getContext('2d');
|
|
@@ -94,7 +96,7 @@ const AudioWaveform = ({ src, startFrom, durationInFrames, visualizationWidth, v
|
|
|
94
96
|
const controller = new AbortController();
|
|
95
97
|
setPeaks(null);
|
|
96
98
|
setError(null);
|
|
97
|
-
(0,
|
|
99
|
+
(0, timeline_utils_1.loadWaveformPeaks)(src, controller.signal)
|
|
98
100
|
.then((p) => {
|
|
99
101
|
if (!controller.signal.aborted) {
|
|
100
102
|
setPeaks(p);
|
|
@@ -115,7 +117,7 @@ const AudioWaveform = ({ src, startFrom, durationInFrames, visualizationWidth, v
|
|
|
115
117
|
if (!canvasElement || hasTransferredCanvas.current) {
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
|
-
const worker = (0,
|
|
120
|
+
const worker = (0, timeline_utils_1.makeAudioWaveformWorker)();
|
|
119
121
|
waveformWorker.current = worker;
|
|
120
122
|
worker.addEventListener('message', (event) => {
|
|
121
123
|
if (event.data.type === 'error') {
|
|
@@ -151,7 +153,7 @@ const AudioWaveform = ({ src, startFrom, durationInFrames, visualizationWidth, v
|
|
|
151
153
|
if (canUseWorkerPath || !peaks) {
|
|
152
154
|
return null;
|
|
153
155
|
}
|
|
154
|
-
return (0,
|
|
156
|
+
return (0, timeline_utils_1.sliceWaveformPeaks)({
|
|
155
157
|
durationInFrames: (0, timeline_utils_1.shouldTileLoopDisplay)(loopDisplay)
|
|
156
158
|
? loopDisplay.durationInFrames
|
|
157
159
|
: durationInFrames,
|
|
@@ -216,7 +218,13 @@ const AudioWaveform = ({ src, startFrom, durationInFrames, visualizationWidth, v
|
|
|
216
218
|
});
|
|
217
219
|
}
|
|
218
220
|
else {
|
|
219
|
-
(0,
|
|
221
|
+
(0, timeline_utils_1.drawBars)({
|
|
222
|
+
canvas: canvasElement,
|
|
223
|
+
peaks: portionPeaks !== null && portionPeaks !== void 0 ? portionPeaks : EMPTY_PEAKS,
|
|
224
|
+
color: 'rgba(255, 255, 255, 0.6)',
|
|
225
|
+
volume: vol,
|
|
226
|
+
width: w,
|
|
227
|
+
});
|
|
220
228
|
}
|
|
221
229
|
}, [
|
|
222
230
|
canUseWorkerPath,
|
|
@@ -94,7 +94,7 @@ const MenuBuildIndicator = () => {
|
|
|
94
94
|
window.remotion_finishedBuilding = undefined;
|
|
95
95
|
};
|
|
96
96
|
}, []);
|
|
97
|
-
return (jsx_runtime_1.jsxs("div", { style: cwd, title: window.remotion_cwd, children: [isClickable ? jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }) : null, isBuilding ? (jsx_runtime_1.jsx("div", { style: spinner, children: jsx_runtime_1.jsx(Spinner_1.Spinner, { duration: 0.5, size: spinnerSize }) })) : (jsx_runtime_1.jsx("div", { style: noSpinner })),
|
|
97
|
+
return (jsx_runtime_1.jsxs("div", { style: cwd, title: window.remotion_cwd, children: [isClickable ? jsx_runtime_1.jsx(layout_1.Spacing, { x: 2 }) : null, isBuilding ? (jsx_runtime_1.jsx("div", { style: spinner, children: jsx_runtime_1.jsx(Spinner_1.Spinner, { duration: 0.5, size: spinnerSize }) })) : (jsx_runtime_1.jsx("div", { style: noSpinner })), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), isClickable ? (jsx_runtime_1.jsx("a", { style: projectNameHovered ? projectNameLinkHovered : projectNameLink, title: projectNameTitle, onClick: handleProjectNameClick, onPointerEnter: () => setProjectNameHovered(true), onPointerLeave: () => setProjectNameHovered(false), children: window.remotion_projectName })) : (window.remotion_projectName), jsx_runtime_1.jsx(MenuCompositionName_1.MenuCompositionName, {})
|
|
98
98
|
] }));
|
|
99
99
|
};
|
|
100
100
|
exports.MenuBuildIndicator = MenuBuildIndicator;
|
|
@@ -166,7 +166,7 @@ const RenderButton = ({ readOnlyStudio, }) => {
|
|
|
166
166
|
};
|
|
167
167
|
}, []);
|
|
168
168
|
const video = remotion_1.Internals.useVideo();
|
|
169
|
-
const getCurrentFrame = player_1.PlayerInternals.
|
|
169
|
+
const { getCurrentFrame } = player_1.PlayerInternals.usePlayer();
|
|
170
170
|
const { props } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
171
171
|
const openServerRenderModal = (0, react_1.useCallback)((copyCommandOnly) => {
|
|
172
172
|
var _a;
|
|
@@ -12,7 +12,7 @@ const SequencePropsObserver = () => {
|
|
|
12
12
|
if (event.type !== 'sequence-props-updated') {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
setCodeValues(event.nodePath, event.result);
|
|
15
|
+
setCodeValues(event.nodePath, () => event.result);
|
|
16
16
|
};
|
|
17
17
|
const unsubscribe = subscribeToEvent('sequence-props-updated', handleEvent);
|
|
18
18
|
return () => {
|
|
@@ -93,17 +93,18 @@ const TimelineInner = () => {
|
|
|
93
93
|
t.sequence.duration > 0 &&
|
|
94
94
|
t.sequence.showInTimeline);
|
|
95
95
|
}, [durationInFrames, timeline]);
|
|
96
|
-
const shown =
|
|
96
|
+
const shown = (0, react_1.useMemo)(() => {
|
|
97
|
+
return filtered.length > MaxTimelineTracks_1.MAX_TIMELINE_TRACKS
|
|
98
|
+
? filtered.slice(0, MaxTimelineTracks_1.MAX_TIMELINE_TRACKS)
|
|
99
|
+
: filtered;
|
|
100
|
+
}, [filtered]);
|
|
97
101
|
const hasBeenCut = filtered.length > shown.length;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, schema: sequence.controls.schema, stack: sequence.stack }, sequence.id));
|
|
105
|
-
})
|
|
106
|
-
: null, jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}), jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
|
|
102
|
+
return (jsx_runtime_1.jsxs("div", { ref: timeline_refs_1.timelineVerticalScroll, style: container, className: 'css-reset ' + is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: [sequences.map((sequence) => {
|
|
103
|
+
if (!sequence.controls || !previewConnected || !sequence.stack) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return (jsx_runtime_1.jsx(SubscribeToNodePaths_1.SubscribeToNodePaths, { overrideId: sequence.controls.overrideId, schema: sequence.controls.schema, stack: sequence.stack }, sequence.id));
|
|
107
|
+
}), jsx_runtime_1.jsx(SequencePropsObserver_1.SequencePropsObserver, {}), jsx_runtime_1.jsxs(TimelineWidthProvider_1.TimelineWidthProvider, { children: [
|
|
107
108
|
jsx_runtime_1.jsx(TimelinePinchZoom_1.TimelinePinchZoom, {}), jsx_runtime_1.jsx(TimelineHeightContainer_1.TimelineHeightContainer, { shown: shown, hasBeenCut: hasBeenCut, children: jsx_runtime_1.jsxs(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [
|
|
108
109
|
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, { timeline: shown }) }), jsx_runtime_1.jsx(SplitterHandle_1.SplitterHandle, { onCollapse: noop, allowToCollapse: "none" }), jsx_runtime_1.jsx(SplitterElement_1.SplitterElement, { type: "anti-flexer", sticky: null, children: jsx_runtime_1.jsxs(TimelineScrollable_1.TimelineScrollable, { children: [
|
|
109
110
|
jsx_runtime_1.jsx(TimelineTracks_1.TimelineTracks, { timeline: shown, hasBeenCut: hasBeenCut }), jsx_runtime_1.jsx(TimelineInOutPointer_1.TimelineInOutPointer, {}), jsx_runtime_1.jsx(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {}), jsx_runtime_1.jsx(TimelineDragHandler_1.TimelineDragHandler, {}), jsx_runtime_1.jsx(TimelineTimeIndicators_1.TimelineTimeIndicators, {}), jsx_runtime_1.jsx(TimelineSlider_1.TimelineSlider, {})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
3
4
|
export declare const TimelineBooleanField: React.FC<{
|
|
4
5
|
readonly field: SchemaFieldInfo;
|
|
5
|
-
readonly
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatus;
|
|
6
7
|
readonly effectiveValue: unknown;
|
|
7
|
-
readonly
|
|
8
|
-
readonly onSave: (key: string, value: unknown) => Promise<void>;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
9
|
}>;
|
|
@@ -7,14 +7,14 @@ const Checkbox_1 = require("../Checkbox");
|
|
|
7
7
|
const checkboxContainer = {
|
|
8
8
|
marginLeft: 8,
|
|
9
9
|
};
|
|
10
|
-
const TimelineBooleanField = ({ field,
|
|
10
|
+
const TimelineBooleanField = ({ field, propStatus, effectiveValue, onSave }) => {
|
|
11
11
|
const checked = Boolean(effectiveValue);
|
|
12
12
|
const onChange = (0, react_1.useCallback)(() => {
|
|
13
13
|
const newValue = !checked;
|
|
14
|
-
if (canUpdate && newValue !== codeValue) {
|
|
15
|
-
onSave(
|
|
14
|
+
if (propStatus.canUpdate && newValue !== propStatus.codeValue) {
|
|
15
|
+
onSave(newValue);
|
|
16
16
|
}
|
|
17
|
-
}, [
|
|
18
|
-
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, variant: "small" }) }));
|
|
17
|
+
}, [propStatus, onSave, checked]);
|
|
18
|
+
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled: !propStatus.canUpdate, variant: "small" }) }));
|
|
19
19
|
};
|
|
20
20
|
exports.TimelineBooleanField = TimelineBooleanField;
|
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.TimelineDragHandler = void 0;
|
|
4
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
38
|
const player_1 = require("@remotion/player");
|
|
6
|
-
const react_1 = require("react");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
7
40
|
const remotion_1 = require("remotion");
|
|
8
41
|
const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
|
|
9
42
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
@@ -59,10 +92,10 @@ const TimelineDragHandler = () => {
|
|
|
59
92
|
if (!canvasContent || canvasContent.type !== 'composition') {
|
|
60
93
|
return null;
|
|
61
94
|
}
|
|
62
|
-
return (jsx_runtime_1.jsx("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, children: video ? jsx_runtime_1.jsx(
|
|
95
|
+
return (jsx_runtime_1.jsx("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, children: video ? jsx_runtime_1.jsx(TimelineDragHandlerInnerMemo, {}) : null }));
|
|
63
96
|
};
|
|
64
97
|
exports.TimelineDragHandler = TimelineDragHandler;
|
|
65
|
-
const
|
|
98
|
+
const TimelineDragHandlerInner = () => {
|
|
66
99
|
var _a;
|
|
67
100
|
var _b, _c;
|
|
68
101
|
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
@@ -470,3 +503,4 @@ const Inner = () => {
|
|
|
470
503
|
return (jsx_runtime_1.jsxs("div", { style: style, onPointerDown: onPointerDown, children: [
|
|
471
504
|
jsx_runtime_1.jsx("div", { style: inner, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME }), inFrame !== null && (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: inContextMenu, children: jsx_runtime_1.jsx(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "in", atFrame: inFrame, dragging: inOutDragging.dragging === 'in' }) })), outFrame !== null && (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: outContextMenu, children: jsx_runtime_1.jsx(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "out", dragging: inOutDragging.dragging === 'out', atFrame: outFrame }) }))] }));
|
|
472
505
|
};
|
|
506
|
+
const TimelineDragHandlerInnerMemo = react_1.default.memo(TimelineDragHandlerInner);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
3
4
|
export declare const TimelineEnumField: React.FC<{
|
|
4
5
|
readonly field: SchemaFieldInfo;
|
|
5
|
-
readonly
|
|
6
|
+
readonly propStatus: CanUpdateSequencePropStatus;
|
|
6
7
|
readonly effectiveValue: unknown;
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly onDragValueChange: (key: string, value: unknown) => void;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
10
10
|
readonly onDragEnd: () => void;
|
|
11
11
|
}>;
|
|
@@ -7,7 +7,7 @@ const ComboBox_1 = require("../NewComposition/ComboBox");
|
|
|
7
7
|
const comboboxStyle = {
|
|
8
8
|
marginLeft: 8,
|
|
9
9
|
};
|
|
10
|
-
const TimelineEnumField = ({ field,
|
|
10
|
+
const TimelineEnumField = ({ field, propStatus, effectiveValue, onSave, onDragValueChange, onDragEnd, }) => {
|
|
11
11
|
const { fieldSchema } = field;
|
|
12
12
|
if (fieldSchema.type !== 'enum') {
|
|
13
13
|
throw new Error('TimelineEnumField rendered for non-enum field');
|
|
@@ -15,14 +15,14 @@ const TimelineEnumField = ({ field, codeValue, effectiveValue, canUpdate, onSave
|
|
|
15
15
|
const variantKeys = Object.keys(fieldSchema.variants);
|
|
16
16
|
const current = String(effectiveValue !== null && effectiveValue !== void 0 ? effectiveValue : fieldSchema.default);
|
|
17
17
|
const onSelect = (0, react_1.useCallback)((newValue) => {
|
|
18
|
-
if (!canUpdate || newValue === codeValue) {
|
|
18
|
+
if (!propStatus.canUpdate || newValue === propStatus.codeValue) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
onDragValueChange(
|
|
22
|
-
onSave(
|
|
21
|
+
onDragValueChange(newValue);
|
|
22
|
+
onSave(newValue).finally(() => {
|
|
23
23
|
onDragEnd();
|
|
24
24
|
});
|
|
25
|
-
}, [
|
|
25
|
+
}, [propStatus, onSave, onDragValueChange, onDragEnd]);
|
|
26
26
|
const items = (0, react_1.useMemo)(() => {
|
|
27
27
|
return variantKeys.map((key) => ({
|
|
28
28
|
type: 'item',
|
|
@@ -34,9 +34,9 @@ const TimelineEnumField = ({ field, codeValue, effectiveValue, canUpdate, onSave
|
|
|
34
34
|
leftItem: null,
|
|
35
35
|
subMenu: null,
|
|
36
36
|
quickSwitcherLabel: null,
|
|
37
|
-
disabled: !canUpdate,
|
|
37
|
+
disabled: !propStatus.canUpdate,
|
|
38
38
|
}));
|
|
39
|
-
}, [variantKeys, onSelect,
|
|
39
|
+
}, [variantKeys, onSelect, propStatus]);
|
|
40
40
|
return (jsx_runtime_1.jsx(ComboBox_1.Combobox, { small: true, title: field.key, selectedId: current, values: items, style: comboboxStyle }));
|
|
41
41
|
};
|
|
42
42
|
exports.TimelineEnumField = TimelineEnumField;
|
|
@@ -31,7 +31,7 @@ const TimelineExpandArrowButton = ({ isExpanded, onClick, label, disabled = fals
|
|
|
31
31
|
opacity: disabled ? 0.5 : 1,
|
|
32
32
|
};
|
|
33
33
|
}, [isExpanded, disabled]);
|
|
34
|
-
return (jsx_runtime_1.jsx("button", { type: "button", style: style, onClick: onClick, disabled: disabled, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} ${label}`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "
|
|
34
|
+
return (jsx_runtime_1.jsx("button", { type: "button", style: style, onClick: onClick, disabled: disabled, "aria-expanded": isExpanded, "aria-label": `${isExpanded ? 'Collapse' : 'Expand'} ${label}`, children: jsx_runtime_1.jsx("svg", { width: "12", height: "12", viewBox: "0 0 8 8", style: svgStyle, children: jsx_runtime_1.jsx("path", { d: "M2 1L6 4L2 7Z", fill: "#ccc" }) }) }));
|
|
35
35
|
};
|
|
36
36
|
exports.TimelineExpandArrowButton = TimelineExpandArrowButton;
|
|
37
37
|
const TimelineExpandArrowSpacer = () => {
|
|
@@ -56,7 +56,8 @@ const separator = {
|
|
|
56
56
|
const TimelineExpandedSection = ({ sequence, originalLocation, nodePathInfo, nestedDepth }) => {
|
|
57
57
|
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
58
58
|
const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
59
|
-
const {
|
|
59
|
+
const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
60
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
60
61
|
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
61
62
|
var _a;
|
|
62
63
|
if (!originalLocation ||
|
|
@@ -81,9 +82,8 @@ const TimelineExpandedSection = ({ sequence, originalLocation, nodePathInfo, nes
|
|
|
81
82
|
sequence,
|
|
82
83
|
nodePathInfo,
|
|
83
84
|
getIsExpanded,
|
|
84
|
-
getDragOverrides,
|
|
85
85
|
getCodeValues,
|
|
86
|
-
}), [sequence, nodePathInfo, getIsExpanded,
|
|
86
|
+
}), [sequence, nodePathInfo, getIsExpanded, getCodeValues]);
|
|
87
87
|
const style = (0, react_1.useMemo)(() => {
|
|
88
88
|
return {
|
|
89
89
|
...expandedSectionBase,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineFieldRow = 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 timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
@@ -27,11 +28,15 @@ const fieldLabelRow = {
|
|
|
27
28
|
gap: 6,
|
|
28
29
|
};
|
|
29
30
|
const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth, nodePath, schema, }) => {
|
|
30
|
-
var _a, _b
|
|
31
|
-
const {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const { getCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
|
|
33
|
+
const { getDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
|
|
32
34
|
const { setDragOverrides, clearDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
33
35
|
const codeValuesForOverride = getCodeValues(nodePath);
|
|
34
36
|
const codeValue = (_a = codeValuesForOverride === null || codeValuesForOverride === void 0 ? void 0 : codeValuesForOverride[field.key]) !== null && _a !== void 0 ? _a : null;
|
|
37
|
+
if (codeValue === null) {
|
|
38
|
+
throw new Error('Unexpectedly got null code value for field' + field.key);
|
|
39
|
+
}
|
|
35
40
|
const dragOverrideValue = (0, react_1.useMemo)(() => {
|
|
36
41
|
var _a;
|
|
37
42
|
return nodePath === null
|
|
@@ -46,45 +51,73 @@ const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth,
|
|
|
46
51
|
shouldResortToDefaultValueIfUndefined: true,
|
|
47
52
|
});
|
|
48
53
|
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
|
|
49
|
-
const onSave = (0, react_1.useCallback)((
|
|
54
|
+
const onSave = (0, react_1.useCallback)((value) => {
|
|
50
55
|
if (!codeValuesForOverride || !validatedLocation || !nodePath) {
|
|
51
56
|
return Promise.reject(new Error('Cannot save'));
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
if (!status || !status.canUpdate) {
|
|
58
|
+
if (!codeValue || !codeValue.canUpdate) {
|
|
55
59
|
return Promise.reject(new Error('Cannot save'));
|
|
56
60
|
}
|
|
57
61
|
const defaultValue = field.fieldSchema.default !== undefined
|
|
58
62
|
? JSON.stringify(field.fieldSchema.default)
|
|
59
63
|
: null;
|
|
64
|
+
const stringifiedValue = JSON.stringify(value);
|
|
65
|
+
if (value === codeValue.codeValue) {
|
|
66
|
+
return Promise.resolve();
|
|
67
|
+
}
|
|
68
|
+
if (defaultValue === stringifiedValue &&
|
|
69
|
+
codeValue.codeValue === undefined) {
|
|
70
|
+
return Promise.resolve();
|
|
71
|
+
}
|
|
72
|
+
let previousUpdate;
|
|
73
|
+
// Optimistic update to prevent flicker
|
|
74
|
+
setCodeValues(nodePath, (prev) => {
|
|
75
|
+
previousUpdate = prev;
|
|
76
|
+
return (0, studio_shared_1.optimisticUpdateForCodeValues)({
|
|
77
|
+
previous: prev,
|
|
78
|
+
fieldKey: field.key,
|
|
79
|
+
value,
|
|
80
|
+
schema,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
60
83
|
return (0, call_api_1.callApi)('/api/save-sequence-props', {
|
|
61
84
|
fileName: validatedLocation.source,
|
|
62
85
|
nodePath,
|
|
63
|
-
key,
|
|
64
|
-
value:
|
|
86
|
+
key: field.key,
|
|
87
|
+
value: stringifiedValue,
|
|
65
88
|
defaultValue,
|
|
66
89
|
schema,
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
90
|
+
})
|
|
91
|
+
.then((data) => {
|
|
92
|
+
setCodeValues(nodePath, () => data);
|
|
93
|
+
})
|
|
94
|
+
.catch(() => {
|
|
95
|
+
// In case something went wrong, undo optimistic update
|
|
96
|
+
if (previousUpdate) {
|
|
97
|
+
setCodeValues(nodePath, (current) => {
|
|
98
|
+
if (previousUpdate) {
|
|
99
|
+
return previousUpdate;
|
|
100
|
+
}
|
|
101
|
+
return current;
|
|
102
|
+
});
|
|
71
103
|
}
|
|
72
|
-
return Promise.reject(new Error(data.reason));
|
|
73
104
|
});
|
|
74
105
|
}, [
|
|
106
|
+
codeValue,
|
|
75
107
|
codeValuesForOverride,
|
|
76
108
|
field.fieldSchema.default,
|
|
109
|
+
field.key,
|
|
77
110
|
nodePath,
|
|
78
111
|
schema,
|
|
79
112
|
setCodeValues,
|
|
80
113
|
validatedLocation,
|
|
81
114
|
]);
|
|
82
|
-
const onDragValueChange = (0, react_1.useCallback)((
|
|
115
|
+
const onDragValueChange = (0, react_1.useCallback)((value) => {
|
|
83
116
|
if (nodePath === null) {
|
|
84
117
|
throw new Error('Cannot drag value');
|
|
85
118
|
}
|
|
86
|
-
setDragOverrides(nodePath, key, value);
|
|
87
|
-
}, [setDragOverrides, nodePath]);
|
|
119
|
+
setDragOverrides(nodePath, field.key, value);
|
|
120
|
+
}, [setDragOverrides, nodePath, field.key]);
|
|
88
121
|
const onDragEnd = (0, react_1.useCallback)(() => {
|
|
89
122
|
if (nodePath === null) {
|
|
90
123
|
throw new Error('Cannot clear drag value');
|
|
@@ -99,7 +132,7 @@ const TimelineFieldRow = ({ field, validatedLocation, paddingLeft, nestedDepth,
|
|
|
99
132
|
};
|
|
100
133
|
}, [field.rowHeight, paddingLeft]);
|
|
101
134
|
return (jsx_runtime_1.jsxs("div", { style: style, children: [
|
|
102
|
-
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx("div", { style: fieldLabelRow, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }) }), jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd,
|
|
135
|
+
jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth + 1 }), jsx_runtime_1.jsx("div", { style: fieldLabelRow, children: jsx_runtime_1.jsx("span", { style: fieldName, children: (_b = field.description) !== null && _b !== void 0 ? _b : field.key }) }), jsx_runtime_1.jsx(TimelineSchemaField_1.TimelineFieldValue, { field: field, propStatus: codeValue, onSave: onSave, onDragValueChange: onDragValueChange, onDragEnd: onDragEnd, effectiveValue: effectiveValue })
|
|
103
136
|
] }));
|
|
104
137
|
};
|
|
105
138
|
exports.TimelineFieldRow = TimelineFieldRow;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TrackWithHash } from '../../helpers/get-timeline-sequence-sort-key';
|
|
3
|
-
export declare const TimelineHeightContainer: React.
|
|
3
|
+
export declare const TimelineHeightContainer: React.NamedExoticComponent<{
|
|
4
4
|
readonly shown: TrackWithHash[];
|
|
5
5
|
readonly hasBeenCut: boolean;
|
|
6
6
|
readonly children: React.ReactNode;
|
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.TimelineHeightContainer = void 0;
|
|
4
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
6
39
|
const use_timeline_height_1 = require("./use-timeline-height");
|
|
7
40
|
const baseStyle = {
|
|
8
41
|
display: 'flex',
|
|
@@ -10,9 +43,9 @@ const baseStyle = {
|
|
|
10
43
|
minHeight: '100%',
|
|
11
44
|
overflowX: 'hidden',
|
|
12
45
|
};
|
|
13
|
-
const
|
|
46
|
+
const TimelineHeightContainerInner = ({ shown, hasBeenCut, children }) => {
|
|
14
47
|
const height = (0, use_timeline_height_1.useTimelineHeight)({ shown, hasBeenCut });
|
|
15
48
|
const style = (0, react_1.useMemo)(() => ({ ...baseStyle, height }), [height]);
|
|
16
49
|
return jsx_runtime_1.jsx("div", { style: style, children: children });
|
|
17
50
|
};
|
|
18
|
-
exports.TimelineHeightContainer =
|
|
51
|
+
exports.TimelineHeightContainer = react_1.default.memo(TimelineHeightContainerInner);
|
|
@@ -22,13 +22,10 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
22
22
|
var _a, _b;
|
|
23
23
|
const nodePath = (_a = nodePathInfo === null || nodePathInfo === void 0 ? void 0 : nodePathInfo.nodePath) !== null && _a !== void 0 ? _a : null;
|
|
24
24
|
const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
25
|
-
const visualModeEnvEnabled = Boolean(process.env.EXPERIMENTAL_VISUAL_MODE_ENABLED);
|
|
26
25
|
const previewConnected = previewServerState.type === 'connected';
|
|
27
|
-
const visualModeActive = visualModeEnvEnabled && previewConnected;
|
|
28
26
|
const { hidden, setHidden } = (0, react_1.useContext)(remotion_1.Internals.SequenceVisibilityToggleContext);
|
|
29
27
|
const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
|
|
30
28
|
const { toggleTrack } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
|
|
31
|
-
const { getIsJsxInMapCallback } = (0, react_1.useContext)(remotion_1.Internals.VisualModeGettersContext);
|
|
32
29
|
const originalLocation = (0, use_resolved_stack_1.useResolvedStack)((_b = sequence.stack) !== null && _b !== void 0 ? _b : null);
|
|
33
30
|
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
34
31
|
var _a;
|
|
@@ -50,8 +47,10 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
50
47
|
if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
|
|
51
48
|
return;
|
|
52
49
|
}
|
|
53
|
-
if (
|
|
54
|
-
const message = 'This sequence is
|
|
50
|
+
if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
|
|
51
|
+
const message = 'This sequence is programmatically duplicated ' +
|
|
52
|
+
nodePathInfo.numberOfSequencesWithThisNodePath +
|
|
53
|
+
' times in the code. Duplicating inserts another copy. Continue?';
|
|
55
54
|
// eslint-disable-next-line no-alert -- native confirm before applying duplicate codemod in .map callbacks
|
|
56
55
|
if (!window.confirm(message)) {
|
|
57
56
|
return;
|
|
@@ -72,13 +71,15 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
72
71
|
catch (err) {
|
|
73
72
|
(0, NotificationCenter_1.showNotification)(err.message, 4000);
|
|
74
73
|
}
|
|
75
|
-
}, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
|
|
74
|
+
}, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
|
|
76
75
|
const onDeleteSequenceFromSource = (0, react_1.useCallback)(async () => {
|
|
77
76
|
if (!(validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) || !nodePath) {
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
|
-
if (
|
|
81
|
-
const message = 'This sequence is
|
|
79
|
+
if (nodePathInfo && nodePathInfo.numberOfSequencesWithThisNodePath > 1) {
|
|
80
|
+
const message = 'This sequence is programmatically duplicated ' +
|
|
81
|
+
nodePathInfo.numberOfSequencesWithThisNodePath +
|
|
82
|
+
' times in the code. Deleting removes all instances. Continue?';
|
|
82
83
|
// eslint-disable-next-line no-alert -- native confirm before applying duplicate codemod in .map callbacks
|
|
83
84
|
if (!window.confirm(message)) {
|
|
84
85
|
return;
|
|
@@ -99,9 +100,9 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
99
100
|
catch (err) {
|
|
100
101
|
(0, NotificationCenter_1.showNotification)(err.message, 4000);
|
|
101
102
|
}
|
|
102
|
-
}, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source,
|
|
103
|
+
}, [nodePath, validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source, nodePathInfo]);
|
|
103
104
|
const contextMenuValues = (0, react_1.useMemo)(() => {
|
|
104
|
-
if (!
|
|
105
|
+
if (!previewConnected) {
|
|
105
106
|
return [];
|
|
106
107
|
}
|
|
107
108
|
return [
|
|
@@ -145,9 +146,9 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
145
146
|
duplicateDisabled,
|
|
146
147
|
onDeleteSequenceFromSource,
|
|
147
148
|
onDuplicateSequenceFromSource,
|
|
148
|
-
|
|
149
|
+
previewConnected,
|
|
149
150
|
]);
|
|
150
|
-
const isExpanded =
|
|
151
|
+
const isExpanded = previewConnected && nodePathInfo !== null && getIsExpanded(nodePathInfo);
|
|
151
152
|
const onToggleExpand = (0, react_1.useCallback)(() => {
|
|
152
153
|
if (nodePathInfo === null) {
|
|
153
154
|
return;
|
|
@@ -188,9 +189,9 @@ const TimelineListItem = ({ nestedDepth, sequence, isCompact, nodePathInfo }) =>
|
|
|
188
189
|
}, []);
|
|
189
190
|
const hasExpandableContent = Boolean(sequence.controls) || sequence.effects.length > 0;
|
|
190
191
|
const trackRow = (jsx_runtime_1.jsx("div", { style: outer, children: jsx_runtime_1.jsxs("div", { style: inner, children: [
|
|
191
|
-
jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility }), jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth }),
|
|
192
|
+
jsx_runtime_1.jsx(TimelineLayerEye_1.TimelineLayerEye, { type: sequence.type === 'audio' ? 'speaker' : 'eye', hidden: isItemHidden, onInvoked: onToggleVisibility }), jsx_runtime_1.jsx(Padder_1.Padder, { depth: nestedDepth }), previewConnected ? (hasExpandableContent ? (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowButton, { isExpanded: isExpanded, onClick: onToggleExpand, label: "track properties", disabled: nodePathInfo === null })) : (jsx_runtime_1.jsx(TimelineExpandArrowButton_1.TimelineExpandArrowSpacer, {}))) : null, jsx_runtime_1.jsx(TimelineStack_1.TimelineStack, { sequence: sequence, isCompact: isCompact, originalLocation: originalLocation })
|
|
192
193
|
] }) }));
|
|
193
|
-
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
194
|
+
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [previewConnected ? (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: contextMenuValues, children: trackRow })) : (trackRow), previewConnected &&
|
|
194
195
|
isExpanded &&
|
|
195
196
|
hasExpandableContent &&
|
|
196
197
|
nodePathInfo ? (jsx_runtime_1.jsx(TimelineExpandedSection_1.TimelineExpandedSection, { sequence: sequence, originalLocation: originalLocation, nodePathInfo: nodePathInfo, nestedDepth: nestedDepth })) : null] }));
|