@remotion/studio 4.0.460 → 4.0.462
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/ExpandedTracksProvider.js +8 -3
- 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/SubscribeToNodePaths.d.ts +4 -3
- package/dist/components/Timeline/SubscribeToNodePaths.js +11 -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/TimelineColorField.d.ts +11 -0
- package/dist/components/Timeline/TimelineColorField.js +181 -0
- package/dist/components/Timeline/TimelineDragHandler.js +37 -3
- package/dist/components/Timeline/TimelineEffectFieldRow.d.ts +11 -0
- package/dist/components/Timeline/TimelineEffectFieldRow.js +177 -0
- 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/TimelineExpandedRow.d.ts +3 -3
- package/dist/components/Timeline/TimelineExpandedRow.js +8 -1
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +2 -2
- package/dist/components/Timeline/TimelineExpandedSection.js +8 -21
- package/dist/components/Timeline/TimelineFieldRow.d.ts +3 -3
- package/dist/components/Timeline/TimelineFieldRow.js +65 -26
- package/dist/components/Timeline/TimelineHeightContainer.d.ts +1 -1
- package/dist/components/Timeline/TimelineHeightContainer.js +36 -3
- package/dist/components/Timeline/TimelineListItem.js +20 -18
- 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 +11 -7
- package/dist/components/Timeline/TimelineSchemaField.js +27 -21
- 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 +42 -12
- package/dist/components/Timeline/TimelineTranslateField.d.ts +5 -5
- package/dist/components/Timeline/TimelineTranslateField.js +21 -37
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -1
- package/dist/components/Timeline/sequence-props-subscription-store.js +11 -5
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +2 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +6 -4
- package/dist/components/Timeline/use-timeline-height.js +5 -14
- 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-yvg1f56k.js} +4168 -3948
- package/dist/esm/index.mjs +20 -8
- package/dist/esm/internals.mjs +4168 -3948
- package/dist/esm/previewEntry.mjs +2913 -2705
- package/dist/esm/renderEntry.mjs +2 -5
- package/dist/helpers/calculate-timeline.js +34 -4
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +4 -2
- package/dist/helpers/timeline-layout.d.ts +11 -15
- package/dist/helpers/timeline-layout.js +36 -28
- package/dist/icons/eyedropper.d.ts +4 -0
- package/dist/icons/eyedropper.js +6 -0
- package/dist/internals.d.ts +0 -1
- package/dist/previewEntry.js +1 -1
- package/dist/renderEntry.js +3 -3
- package/package.json +14 -24
- 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,
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExpandedTracksProvider = exports.ExpandedTracksSetterContext = exports.ExpandedTracksGetterContext = 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
|
-
const
|
|
7
|
+
const nodePathInfoToExpandedKey = (info) => [
|
|
8
|
+
(0, studio_shared_1.stringifySequenceExpandedRowKey)(info.sequenceSubscriptionKey),
|
|
9
|
+
info.auxiliaryKeys.join('.'),
|
|
10
|
+
info.index,
|
|
11
|
+
].join('.');
|
|
7
12
|
const LOCAL_STORAGE_KEY = 'remotion.editor.expandedTracks';
|
|
8
13
|
const loadExpandedTracks = () => {
|
|
9
14
|
if (typeof window === 'undefined') {
|
|
@@ -38,7 +43,7 @@ const ExpandedTracksProvider = ({ children }) => {
|
|
|
38
43
|
const [expandedTracks, setExpandedTracks] = (0, react_1.useState)(loadExpandedTracks);
|
|
39
44
|
const toggleTrack = (0, react_1.useCallback)((nodePathInfo) => {
|
|
40
45
|
setExpandedTracks((prev) => {
|
|
41
|
-
const key =
|
|
46
|
+
const key = nodePathInfoToExpandedKey(nodePathInfo);
|
|
42
47
|
const next = { ...prev, [key]: !prev[key] };
|
|
43
48
|
window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(next));
|
|
44
49
|
return next;
|
|
@@ -47,7 +52,7 @@ const ExpandedTracksProvider = ({ children }) => {
|
|
|
47
52
|
const getterValue = (0, react_1.useMemo)(() => ({
|
|
48
53
|
getIsExpanded: (nodePathInfo) => {
|
|
49
54
|
var _a;
|
|
50
|
-
return (_a = expandedTracks[
|
|
55
|
+
return (_a = expandedTracks[nodePathInfoToExpandedKey(nodePathInfo)]) !== null && _a !== void 0 ? _a : false;
|
|
51
56
|
},
|
|
52
57
|
}), [expandedTracks]);
|
|
53
58
|
const setterValue = (0, react_1.useMemo)(() => ({ toggleTrack }), [toggleTrack]);
|
|
@@ -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 () => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { SequenceSchema } from 'remotion';
|
|
3
|
-
export declare const SubscribeToNodePaths:
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { EffectDefinition, SequenceSchema } from 'remotion';
|
|
3
|
+
export declare const SubscribeToNodePaths: FC<{
|
|
4
4
|
readonly overrideId: string;
|
|
5
5
|
readonly schema: SequenceSchema;
|
|
6
6
|
readonly stack: string;
|
|
7
|
+
readonly effects: readonly EffectDefinition<unknown>[];
|
|
7
8
|
}>;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SubscribeToNodePaths = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const no_react_1 = require("remotion/no-react");
|
|
4
6
|
const use_resolved_stack_1 = require("./use-resolved-stack");
|
|
5
7
|
const use_sequence_props_subscription_1 = require("./use-sequence-props-subscription");
|
|
6
|
-
const SubscribeToNodePaths = ({ overrideId, schema, stack }) => {
|
|
8
|
+
const SubscribeToNodePaths = ({ overrideId, schema, stack, effects }) => {
|
|
7
9
|
const originalLocation = (0, use_resolved_stack_1.useResolvedStack)(stack);
|
|
10
|
+
const effectSubscriptions = (0, react_1.useMemo)(() => {
|
|
11
|
+
return effects
|
|
12
|
+
.map((effect) => {
|
|
13
|
+
return effect.schema;
|
|
14
|
+
})
|
|
15
|
+
.filter(no_react_1.NoReactInternals.truthy);
|
|
16
|
+
}, [effects]);
|
|
8
17
|
(0, use_sequence_props_subscription_1.useSequencePropsSubscription)({
|
|
9
18
|
overrideId,
|
|
10
19
|
schema,
|
|
20
|
+
effects: effectSubscriptions,
|
|
11
21
|
originalLocation,
|
|
12
22
|
});
|
|
13
23
|
return null;
|
|
@@ -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, effects: sequence.effects }, 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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CanUpdateSequencePropStatus } from 'remotion';
|
|
3
|
+
import type { SchemaFieldInfo, TimelineFieldOnDragValueChange, TimelineFieldOnSave } from '../../helpers/timeline-layout';
|
|
4
|
+
export declare const TimelineColorField: React.FC<{
|
|
5
|
+
readonly field: SchemaFieldInfo;
|
|
6
|
+
readonly effectiveValue: unknown;
|
|
7
|
+
readonly propStatus: CanUpdateSequencePropStatus;
|
|
8
|
+
readonly onSave: TimelineFieldOnSave;
|
|
9
|
+
readonly onDragValueChange: TimelineFieldOnDragValueChange;
|
|
10
|
+
readonly onDragEnd: () => void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimelineColorField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const no_react_1 = require("remotion/no-react");
|
|
7
|
+
const colors_1 = require("../../helpers/colors");
|
|
8
|
+
const eyedropper_1 = require("../../icons/eyedropper");
|
|
9
|
+
const z_index_1 = require("../../state/z-index");
|
|
10
|
+
const SWATCH_WIDTH = 20;
|
|
11
|
+
const SWATCH_HEIGHT = 15;
|
|
12
|
+
const containerStyle = {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: 3,
|
|
16
|
+
};
|
|
17
|
+
const swatchWrapperBase = {
|
|
18
|
+
position: 'relative',
|
|
19
|
+
width: SWATCH_WIDTH,
|
|
20
|
+
height: SWATCH_HEIGHT,
|
|
21
|
+
display: 'inline-block',
|
|
22
|
+
borderRadius: 3,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
borderStyle: 'solid',
|
|
26
|
+
borderWidth: 1,
|
|
27
|
+
};
|
|
28
|
+
const hiddenInputStyle = {
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
inset: 0,
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: '100%',
|
|
33
|
+
opacity: 0,
|
|
34
|
+
cursor: 'pointer',
|
|
35
|
+
border: 'none',
|
|
36
|
+
padding: 0,
|
|
37
|
+
margin: 0,
|
|
38
|
+
};
|
|
39
|
+
const swatchFillStyle = {
|
|
40
|
+
width: '100%',
|
|
41
|
+
height: '100%',
|
|
42
|
+
};
|
|
43
|
+
const eyedropperButtonBase = {
|
|
44
|
+
background: 'transparent',
|
|
45
|
+
border: 'none',
|
|
46
|
+
padding: 0,
|
|
47
|
+
margin: 0,
|
|
48
|
+
cursor: 'pointer',
|
|
49
|
+
display: 'inline-flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
width: 20,
|
|
53
|
+
height: 20,
|
|
54
|
+
color: 'rgba(255, 255, 255, 0.7)',
|
|
55
|
+
};
|
|
56
|
+
const eyedropperIconStyle = {
|
|
57
|
+
width: 16,
|
|
58
|
+
height: 16,
|
|
59
|
+
};
|
|
60
|
+
// Normalizes any color string the user provided (e.g. `red`, `rgb(...)`, `#fff`)
|
|
61
|
+
// into a `#rrggbb` string that `<input type="color">` accepts.
|
|
62
|
+
const toHex = (value) => {
|
|
63
|
+
try {
|
|
64
|
+
const argb = no_react_1.NoReactInternals.processColor(value);
|
|
65
|
+
const r = (argb >>> 16) & 0xff;
|
|
66
|
+
const g = (argb >>> 8) & 0xff;
|
|
67
|
+
const b = argb & 0xff;
|
|
68
|
+
return `#${r.toString(16).padStart(2, '0')}${g
|
|
69
|
+
.toString(16)
|
|
70
|
+
.padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
71
|
+
}
|
|
72
|
+
catch (_a) {
|
|
73
|
+
return '#000000';
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const hasEyeDropper = () => typeof window !== 'undefined' && 'EyeDropper' in window;
|
|
77
|
+
const TimelineColorField = ({ field, effectiveValue, propStatus, onSave, onDragValueChange, onDragEnd, }) => {
|
|
78
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
79
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
80
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
81
|
+
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
82
|
+
const commitTimeoutRef = (0, react_1.useRef)(null);
|
|
83
|
+
const pendingCommitRef = (0, react_1.useRef)(null);
|
|
84
|
+
// `<input type="color">` doesn't fire an event when dismissed; debounce
|
|
85
|
+
// commits and flush any pending commit on unmount so we never lose the
|
|
86
|
+
// final value.
|
|
87
|
+
(0, react_1.useEffect)(() => {
|
|
88
|
+
return () => {
|
|
89
|
+
if (commitTimeoutRef.current) {
|
|
90
|
+
clearTimeout(commitTimeoutRef.current);
|
|
91
|
+
}
|
|
92
|
+
if (pendingCommitRef.current) {
|
|
93
|
+
pendingCommitRef.current();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
const currentValue = typeof effectiveValue === 'string'
|
|
98
|
+
? effectiveValue
|
|
99
|
+
: field.fieldSchema.type === 'color'
|
|
100
|
+
? field.fieldSchema.default
|
|
101
|
+
: '';
|
|
102
|
+
const hexValue = (0, react_1.useMemo)(() => toHex(currentValue), [currentValue]);
|
|
103
|
+
const onColorChange = (0, react_1.useCallback)((e) => {
|
|
104
|
+
const newValue = e.target.value;
|
|
105
|
+
if (!propStatus.canUpdate) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
onDragValueChange(newValue);
|
|
109
|
+
if (commitTimeoutRef.current) {
|
|
110
|
+
clearTimeout(commitTimeoutRef.current);
|
|
111
|
+
}
|
|
112
|
+
const commit = () => {
|
|
113
|
+
pendingCommitRef.current = null;
|
|
114
|
+
if (propStatus.canUpdate && newValue !== propStatus.codeValue) {
|
|
115
|
+
onSave(newValue);
|
|
116
|
+
}
|
|
117
|
+
onDragEnd();
|
|
118
|
+
};
|
|
119
|
+
pendingCommitRef.current = commit;
|
|
120
|
+
commitTimeoutRef.current = setTimeout(() => {
|
|
121
|
+
commitTimeoutRef.current = null;
|
|
122
|
+
commit();
|
|
123
|
+
}, 500);
|
|
124
|
+
}, [onSave, onDragValueChange, onDragEnd, propStatus]);
|
|
125
|
+
const onPickColor = (0, react_1.useCallback)(() => {
|
|
126
|
+
// `EyeDropper` is a Chromium-only API; it's feature-detected at render
|
|
127
|
+
// time so this only runs in supported browsers.
|
|
128
|
+
const EyeDropperCtor = typeof window !== 'undefined'
|
|
129
|
+
? window.EyeDropper
|
|
130
|
+
: undefined;
|
|
131
|
+
if (!EyeDropperCtor) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const eyeDropper = new EyeDropperCtor();
|
|
135
|
+
eyeDropper
|
|
136
|
+
.open()
|
|
137
|
+
.then((result) => {
|
|
138
|
+
if (propStatus.canUpdate && result.sRGBHex !== propStatus.codeValue) {
|
|
139
|
+
onSave(result.sRGBHex);
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
.catch(() => {
|
|
143
|
+
// User aborted or picker failed; safe to ignore.
|
|
144
|
+
});
|
|
145
|
+
}, [onSave, propStatus]);
|
|
146
|
+
const swatchWrapperStyle = (0, react_1.useMemo)(() => {
|
|
147
|
+
return {
|
|
148
|
+
...swatchWrapperBase,
|
|
149
|
+
borderColor: isHovered || isFocused
|
|
150
|
+
? colors_1.INPUT_BORDER_COLOR_HOVERED
|
|
151
|
+
: colors_1.INPUT_BORDER_COLOR_UNHOVERED,
|
|
152
|
+
cursor: propStatus.canUpdate ? 'pointer' : 'not-allowed',
|
|
153
|
+
marginLeft: 5,
|
|
154
|
+
};
|
|
155
|
+
}, [isFocused, isHovered, propStatus.canUpdate]);
|
|
156
|
+
const swatchFill = (0, react_1.useMemo)(() => {
|
|
157
|
+
return {
|
|
158
|
+
...swatchFillStyle,
|
|
159
|
+
backgroundColor: currentValue || hexValue,
|
|
160
|
+
position: 'absolute',
|
|
161
|
+
display: 'block',
|
|
162
|
+
};
|
|
163
|
+
}, [currentValue, hexValue]);
|
|
164
|
+
const onMouseEnter = (0, react_1.useCallback)(() => setIsHovered(true), []);
|
|
165
|
+
const onMouseLeave = (0, react_1.useCallback)(() => setIsHovered(false), []);
|
|
166
|
+
const onFocus = (0, react_1.useCallback)(() => setIsFocused(true), []);
|
|
167
|
+
const onBlur = (0, react_1.useCallback)(() => setIsFocused(false), []);
|
|
168
|
+
const onSwatchClick = (0, react_1.useCallback)(() => {
|
|
169
|
+
var _a;
|
|
170
|
+
if (!propStatus.canUpdate) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
174
|
+
}, [propStatus.canUpdate]);
|
|
175
|
+
const showEyeDropper = hasEyeDropper();
|
|
176
|
+
return (jsx_runtime_1.jsxs("span", { style: containerStyle, children: [
|
|
177
|
+
jsx_runtime_1.jsxs("span", { style: swatchWrapperStyle, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onSwatchClick, title: currentValue, children: [
|
|
178
|
+
jsx_runtime_1.jsx("span", { style: swatchFill }), jsx_runtime_1.jsx("input", { ref: inputRef, type: "color", value: hexValue, onChange: onColorChange, onFocus: onFocus, onBlur: onBlur, disabled: !propStatus.canUpdate, name: field.key, tabIndex: tabIndex, style: hiddenInputStyle })
|
|
179
|
+
] }), showEyeDropper ? (jsx_runtime_1.jsx("button", { type: "button", onClick: onPickColor, disabled: !propStatus.canUpdate, style: eyedropperButtonBase, tabIndex: tabIndex, title: "Pick color from screen", "aria-label": "Pick color from screen", children: jsx_runtime_1.jsx(eyedropper_1.EyedropperIcon, { style: eyedropperIconStyle }) })) : null] }));
|
|
180
|
+
};
|
|
181
|
+
exports.TimelineColorField = TimelineColorField;
|
|
@@ -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);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequencePropsSubscriptionKey } from 'remotion';
|
|
3
|
+
import type { CodePosition } from '../../error-overlay/react-overlay/utils/get-source-map';
|
|
4
|
+
import type { EffectSchemaFieldInfo } from '../../helpers/timeline-layout';
|
|
5
|
+
export declare const TimelineEffectFieldRow: React.FC<{
|
|
6
|
+
readonly field: EffectSchemaFieldInfo;
|
|
7
|
+
readonly validatedLocation: CodePosition;
|
|
8
|
+
readonly paddingLeft: number;
|
|
9
|
+
readonly nestedDepth: number;
|
|
10
|
+
readonly nodePath: SequencePropsSubscriptionKey;
|
|
11
|
+
}>;
|