@remotion/cli 4.0.0-alpha11 → 4.0.0-alpha13
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/config/image-format.d.ts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/max-timeline-tracks.js +2 -1
- package/dist/editor/components/AudioWaveform.d.ts +0 -1
- package/dist/editor/components/AudioWaveform.js +11 -6
- package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
- package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
- package/dist/editor/components/RenderModal/RenderModalData.d.ts +2 -3
- package/dist/editor/components/RenderModal/RenderModalData.js +34 -23
- package/dist/editor/components/RenderModal/human-readable-codec.d.ts +1 -1
- package/dist/editor/components/Splitter/SplitterContainer.js +1 -0
- package/dist/editor/components/Timeline/MaxTimelineTracks.d.ts +1 -0
- package/dist/editor/components/Timeline/MaxTimelineTracks.js +3 -2
- package/dist/editor/components/Timeline/Timeline.js +4 -5
- package/dist/editor/components/Timeline/TimelineDragHandler.js +26 -11
- package/dist/editor/components/Timeline/TimelineInOutPointer.js +7 -5
- package/dist/editor/components/Timeline/TimelineInOutPointerHandle.js +9 -3
- package/dist/editor/components/Timeline/TimelineSequence.d.ts +0 -1
- package/dist/editor/components/Timeline/TimelineSequence.js +23 -21
- package/dist/editor/components/Timeline/TimelineSlider.js +17 -4
- package/dist/editor/components/Timeline/TimelineTimeIndicators.js +21 -23
- package/dist/editor/components/Timeline/TimelineTracks.d.ts +0 -1
- package/dist/editor/components/Timeline/TimelineTracks.js +2 -2
- package/dist/editor/components/Timeline/TimelineWidthProvider.d.ts +7 -0
- package/dist/editor/components/Timeline/TimelineWidthProvider.js +17 -0
- package/dist/editor/helpers/get-left-of-timeline-slider.d.ts +0 -4
- package/dist/editor/helpers/get-left-of-timeline-slider.js +1 -24
- package/dist/get-cli-options.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/preview-server/dev-middleware/range-parser.d.ts +1 -1
- package/dist/preview-server/start-server.js +4 -4
- package/dist/preview.js +0 -2
- package/package.json +8 -8
- package/dist/ansi/ansi-regex.d.ts +0 -2
- package/dist/ansi/ansi-regex.js +0 -18
- package/dist/config/ffmpeg-executable.d.ts +0 -5
- package/dist/config/ffmpeg-executable.js +0 -21
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.js +0 -17
- package/dist/editor/components/ClipboardIcon.d.ts +0 -2
- package/dist/editor/components/ClipboardIcon.js +0 -12
- package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
- package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
- package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
- package/dist/editor/components/RichTimelineToggle.js +0 -29
- package/dist/editor/components/Thumbnail.d.ts +0 -8
- package/dist/editor/components/Thumbnail.js +0 -76
- package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
- package/dist/editor/helpers/use-compact-ui.js +0 -18
- package/dist/editor/icons/film.d.ts +0 -3
- package/dist/editor/icons/film.js +0 -8
- package/dist/editor/icons/timeline.d.ts +0 -3
- package/dist/editor/icons/timeline.js +0 -9
- package/dist/editor/state/rich-timeline.d.ts +0 -9
- package/dist/editor/state/rich-timeline.js +0 -17
- package/dist/get-render-media-options.d.ts +0 -8
- package/dist/get-render-media-options.js +0 -55
- package/dist/install.d.ts +0 -2
- package/dist/install.js +0 -36
- package/dist/is-javascript.d.ts +0 -2
- package/dist/is-javascript.js +0 -9
- package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
- package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
- package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
- package/dist/preview-server/hot-middleware/strip-ansi.js +0 -21
|
@@ -2,4 +2,4 @@ import type { StillImageFormat, VideoImageFormat } from '@remotion/renderer';
|
|
|
2
2
|
export declare const setStillImageFormat: (format: StillImageFormat) => void;
|
|
3
3
|
export declare const setVideoImageFormat: (format: VideoImageFormat) => void;
|
|
4
4
|
export declare const getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
|
|
5
|
-
export declare const getUserPreferredVideoImageFormat: () => "
|
|
5
|
+
export declare const getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -273,7 +273,7 @@ export declare const ConfigInternals: {
|
|
|
273
273
|
getShouldOutputImageSequence: (frameRange: FrameRange | null) => boolean;
|
|
274
274
|
getDotEnvLocation: () => string | null;
|
|
275
275
|
getUserPreferredStillImageFormat: () => "png" | "jpeg" | "pdf" | "webp" | undefined;
|
|
276
|
-
getUserPreferredVideoImageFormat: () => "
|
|
276
|
+
getUserPreferredVideoImageFormat: () => "none" | "png" | "jpeg" | undefined;
|
|
277
277
|
getWebpackOverrideFn: () => WebpackOverrideFn;
|
|
278
278
|
getWebpackCaching: () => boolean;
|
|
279
279
|
getOutputLocation: () => string | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMaxTimelineTracks = exports.setMaxTimelineTracks = void 0;
|
|
4
|
-
|
|
4
|
+
const MaxTimelineTracks_1 = require("../editor/components/Timeline/MaxTimelineTracks");
|
|
5
|
+
let maxTimelineTracks = MaxTimelineTracks_1.DEFAULT_TIMELINE_TRACKS;
|
|
5
6
|
const setMaxTimelineTracks = (maxTracks) => {
|
|
6
7
|
if (typeof maxTracks !== 'number') {
|
|
7
8
|
throw new Error(`Need to pass a number to Config.setMaxTimelineTracks(), got ${typeof maxTracks}`);
|
|
@@ -4,6 +4,7 @@ exports.AudioWaveform = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const media_utils_1 = require("@remotion/media-utils");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
+
const remotion_1 = require("remotion");
|
|
7
8
|
const timeline_layout_1 = require("../helpers/timeline-layout");
|
|
8
9
|
const AudioWaveformBar_1 = require("./AudioWaveformBar");
|
|
9
10
|
const container = {
|
|
@@ -26,10 +27,14 @@ const errorMessage = {
|
|
|
26
27
|
const canvasStyle = {
|
|
27
28
|
position: 'absolute',
|
|
28
29
|
};
|
|
29
|
-
const AudioWaveform = ({ src,
|
|
30
|
+
const AudioWaveform = ({ src, startFrom, durationInFrames, visualizationWidth, setMaxMediaDuration, volume, doesVolumeChange, playbackRate, }) => {
|
|
30
31
|
const [metadata, setMetadata] = (0, react_1.useState)(null);
|
|
31
32
|
const [error, setError] = (0, react_1.useState)(null);
|
|
32
33
|
const mountState = (0, react_1.useRef)({ isMounted: true });
|
|
34
|
+
const vidConf = remotion_1.Internals.useUnsafeVideoConfig();
|
|
35
|
+
if (vidConf === null) {
|
|
36
|
+
throw new Error('Expected video config');
|
|
37
|
+
}
|
|
33
38
|
const canvas = (0, react_1.useRef)(null);
|
|
34
39
|
(0, react_1.useEffect)(() => {
|
|
35
40
|
const { current } = mountState;
|
|
@@ -74,7 +79,7 @@ const AudioWaveform = ({ src, fps, startFrom, durationInFrames, visualizationWid
|
|
|
74
79
|
(0, media_utils_1.getAudioData)(src)
|
|
75
80
|
.then((data) => {
|
|
76
81
|
if (mountState.current.isMounted) {
|
|
77
|
-
setMaxMediaDuration(Math.floor(data.durationInSeconds * fps));
|
|
82
|
+
setMaxMediaDuration(Math.floor(data.durationInSeconds * vidConf.fps));
|
|
78
83
|
setMetadata(data);
|
|
79
84
|
}
|
|
80
85
|
})
|
|
@@ -84,7 +89,7 @@ const AudioWaveform = ({ src, fps, startFrom, durationInFrames, visualizationWid
|
|
|
84
89
|
setError(err);
|
|
85
90
|
}
|
|
86
91
|
});
|
|
87
|
-
}, [
|
|
92
|
+
}, [setMaxMediaDuration, src, vidConf.fps]);
|
|
88
93
|
const normalized = (0, react_1.useMemo)(() => {
|
|
89
94
|
if (!metadata || metadata.numberOfChannels === 0) {
|
|
90
95
|
return [];
|
|
@@ -92,13 +97,13 @@ const AudioWaveform = ({ src, fps, startFrom, durationInFrames, visualizationWid
|
|
|
92
97
|
const numberOfSamples = Math.floor(visualizationWidth / (AudioWaveformBar_1.WAVEFORM_BAR_LENGTH + AudioWaveformBar_1.WAVEFORM_BAR_MARGIN));
|
|
93
98
|
return (0, media_utils_1.getWaveformPortion)({
|
|
94
99
|
audioData: metadata,
|
|
95
|
-
startTimeInSeconds: startFrom / fps,
|
|
96
|
-
durationInSeconds: (durationInFrames / fps) * playbackRate,
|
|
100
|
+
startTimeInSeconds: startFrom / vidConf.fps,
|
|
101
|
+
durationInSeconds: (durationInFrames / vidConf.fps) * playbackRate,
|
|
97
102
|
numberOfSamples,
|
|
98
103
|
});
|
|
99
104
|
}, [
|
|
100
105
|
durationInFrames,
|
|
101
|
-
fps,
|
|
106
|
+
vidConf.fps,
|
|
102
107
|
metadata,
|
|
103
108
|
playbackRate,
|
|
104
109
|
startFrom,
|
|
@@ -13,5 +13,5 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
|
|
|
13
13
|
isFocused: boolean;
|
|
14
14
|
isHovered: boolean;
|
|
15
15
|
}) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#ff3232" | "#f1c40f";
|
|
16
|
-
export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "
|
|
16
|
+
export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status" | "rightAlign"> & React.RefAttributes<HTMLInputElement>>;
|
|
17
17
|
export {};
|
|
@@ -3,5 +3,5 @@ import type { RemInputStatus } from './RemInput';
|
|
|
3
3
|
declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
4
4
|
status: RemInputStatus;
|
|
5
5
|
};
|
|
6
|
-
export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "
|
|
6
|
+
export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "status"> & React.RefAttributes<HTMLInputElement>>;
|
|
7
7
|
export {};
|
|
@@ -3,5 +3,5 @@ declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextA
|
|
|
3
3
|
status: 'error' | 'warning' | 'ok';
|
|
4
4
|
};
|
|
5
5
|
export declare const inputBaseStyle: React.CSSProperties;
|
|
6
|
-
export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "
|
|
6
|
+
export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
7
7
|
export {};
|
|
@@ -4,15 +4,14 @@ export declare type State = {
|
|
|
4
4
|
str: string;
|
|
5
5
|
value: Record<string, unknown>;
|
|
6
6
|
validJSON: true;
|
|
7
|
-
zodValidation: Zod.SafeParseReturnType<unknown, unknown>;
|
|
8
7
|
} | {
|
|
9
8
|
str: string;
|
|
10
9
|
validJSON: false;
|
|
11
10
|
error: string;
|
|
12
11
|
};
|
|
13
12
|
export declare type PropsEditType = 'input-props' | 'default-props';
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
13
|
+
export declare const RenderModalData: React.FC<{
|
|
14
|
+
composition: AnyComposition;
|
|
16
15
|
inputProps: Record<string, unknown>;
|
|
17
16
|
setInputProps: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
18
17
|
compact: boolean;
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.RenderModalData = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const remotion_1 = require("remotion");
|
|
@@ -62,7 +62,6 @@ const outer = {
|
|
|
62
62
|
flexDirection: 'column',
|
|
63
63
|
flex: 1,
|
|
64
64
|
overflow: 'hidden',
|
|
65
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
66
65
|
};
|
|
67
66
|
const controlContainer = {
|
|
68
67
|
flexDirection: 'column',
|
|
@@ -77,6 +76,15 @@ const tabWrapper = {
|
|
|
77
76
|
alignItems: 'center',
|
|
78
77
|
};
|
|
79
78
|
const persistanceKey = 'remotion.show-render-modalwarning';
|
|
79
|
+
const parseJSON = (str) => {
|
|
80
|
+
try {
|
|
81
|
+
const value = (0, input_props_serialization_1.deserializeJSONWithCustomFields)(str);
|
|
82
|
+
return { str, value, validJSON: true };
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
return { str, validJSON: false, error: e.message };
|
|
86
|
+
}
|
|
87
|
+
};
|
|
80
88
|
const getPersistedShowWarningState = () => {
|
|
81
89
|
const val = localStorage.getItem(persistanceKey);
|
|
82
90
|
if (!val) {
|
|
@@ -87,7 +95,7 @@ const getPersistedShowWarningState = () => {
|
|
|
87
95
|
const setPersistedShowWarningState = (val) => {
|
|
88
96
|
localStorage.setItem(persistanceKey, String(Boolean(val)));
|
|
89
97
|
};
|
|
90
|
-
const
|
|
98
|
+
const RenderModalData = ({ composition, inputProps, setInputProps, compact, mayShowSaveButton, propsEditType, }) => {
|
|
91
99
|
const [mode, setMode] = (0, react_1.useState)('schema');
|
|
92
100
|
const [valBeforeSafe, setValBeforeSafe] = (0, react_1.useState)(inputProps);
|
|
93
101
|
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
@@ -106,21 +114,21 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
106
114
|
}, [inJSONEditor, inputProps]);
|
|
107
115
|
const cliProps = (0, remotion_1.getInputProps)();
|
|
108
116
|
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({
|
|
109
|
-
[
|
|
117
|
+
[composition.id]: get_render_modal_warnings_1.defaultTypeCanSaveState,
|
|
110
118
|
});
|
|
111
119
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
112
120
|
const schema = (0, react_1.useMemo)(() => {
|
|
113
121
|
if (!z) {
|
|
114
122
|
return 'no-zod';
|
|
115
123
|
}
|
|
116
|
-
if (!
|
|
124
|
+
if (!composition.schema) {
|
|
117
125
|
return z.object({});
|
|
118
126
|
}
|
|
119
|
-
if (!(typeof
|
|
127
|
+
if (!(typeof composition.schema.safeParse === 'function')) {
|
|
120
128
|
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
121
129
|
}
|
|
122
|
-
return
|
|
123
|
-
}, [
|
|
130
|
+
return composition.schema;
|
|
131
|
+
}, [composition.schema, z]);
|
|
124
132
|
const zodValidationResult = (0, react_1.useMemo)(() => {
|
|
125
133
|
if (schema === 'no-zod') {
|
|
126
134
|
return 'no-zod';
|
|
@@ -138,19 +146,19 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
138
146
|
});
|
|
139
147
|
}, []);
|
|
140
148
|
const canSaveDefaultProps = (0, react_1.useMemo)(() => {
|
|
141
|
-
return canSaveDefaultPropsObjectState[
|
|
142
|
-
? canSaveDefaultPropsObjectState[
|
|
149
|
+
return canSaveDefaultPropsObjectState[composition.id]
|
|
150
|
+
? canSaveDefaultPropsObjectState[composition.id]
|
|
143
151
|
: get_render_modal_warnings_1.defaultTypeCanSaveState;
|
|
144
|
-
}, [canSaveDefaultPropsObjectState,
|
|
152
|
+
}, [canSaveDefaultPropsObjectState, composition.id]);
|
|
145
153
|
const showSaveButton = mayShowSaveButton && canSaveDefaultProps.canUpdate;
|
|
146
154
|
const { fastRefreshes } = (0, react_1.useContext)(remotion_1.Internals.NonceContext);
|
|
147
155
|
(0, react_1.useEffect)(() => {
|
|
148
|
-
(0, actions_1.canUpdateDefaultProps)(
|
|
156
|
+
(0, actions_1.canUpdateDefaultProps)(composition.id)
|
|
149
157
|
.then((can) => {
|
|
150
158
|
if (can.canUpdate) {
|
|
151
159
|
setCanSaveDefaultProps((prevState) => ({
|
|
152
160
|
...prevState,
|
|
153
|
-
[
|
|
161
|
+
[composition.id]: {
|
|
154
162
|
canUpdate: true,
|
|
155
163
|
},
|
|
156
164
|
}));
|
|
@@ -158,7 +166,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
158
166
|
else {
|
|
159
167
|
setCanSaveDefaultProps((prevState) => ({
|
|
160
168
|
...prevState,
|
|
161
|
-
[
|
|
169
|
+
[composition.id]: {
|
|
162
170
|
canUpdate: false,
|
|
163
171
|
reason: can.reason,
|
|
164
172
|
determined: true,
|
|
@@ -169,14 +177,14 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
169
177
|
.catch((err) => {
|
|
170
178
|
setCanSaveDefaultProps((prevState) => ({
|
|
171
179
|
...prevState,
|
|
172
|
-
[
|
|
180
|
+
[composition.id]: {
|
|
173
181
|
canUpdate: false,
|
|
174
182
|
reason: err.message,
|
|
175
183
|
determined: true,
|
|
176
184
|
},
|
|
177
185
|
}));
|
|
178
186
|
});
|
|
179
|
-
}, [
|
|
187
|
+
}, [composition.id]);
|
|
180
188
|
const modeItems = (0, react_1.useMemo)(() => {
|
|
181
189
|
return [
|
|
182
190
|
{
|
|
@@ -197,18 +205,21 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
197
205
|
},
|
|
198
206
|
];
|
|
199
207
|
}, [mode]);
|
|
208
|
+
const switchToSchema = (0, react_1.useCallback)(() => {
|
|
209
|
+
setMode('schema');
|
|
210
|
+
}, []);
|
|
200
211
|
const onUpdate = (0, react_1.useCallback)(() => {
|
|
201
212
|
if (schema === 'no-zod' || z === null) {
|
|
202
213
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: No Zod schema');
|
|
203
214
|
return;
|
|
204
215
|
}
|
|
205
216
|
setValBeforeSafe(inputProps);
|
|
206
|
-
(0, actions_1.updateDefaultProps)(
|
|
217
|
+
(0, actions_1.updateDefaultProps)(composition.id, inputProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, [])).then((response) => {
|
|
207
218
|
if (!response.success) {
|
|
208
219
|
(0, NotificationCenter_1.sendErrorNotification)('Cannot update default props: ' + response.reason);
|
|
209
220
|
}
|
|
210
221
|
});
|
|
211
|
-
}, [
|
|
222
|
+
}, [composition.id, inputProps, schema, z]);
|
|
212
223
|
(0, react_1.useEffect)(() => {
|
|
213
224
|
setSaving(false);
|
|
214
225
|
}, [fastRefreshes]);
|
|
@@ -218,7 +229,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
218
229
|
return;
|
|
219
230
|
}
|
|
220
231
|
setSaving(true);
|
|
221
|
-
(0, actions_1.updateDefaultProps)(
|
|
232
|
+
(0, actions_1.updateDefaultProps)(composition.id, updater(composition.defaultProps), (0, extract_enum_json_paths_1.extractEnumJsonPaths)(schema, z, []))
|
|
222
233
|
.then((response) => {
|
|
223
234
|
if (!response.success) {
|
|
224
235
|
console.log(response.stack);
|
|
@@ -229,7 +240,7 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
229
240
|
(0, NotificationCenter_1.sendErrorNotification)(`Cannot update default props: ${err.message}`);
|
|
230
241
|
setSaving(false);
|
|
231
242
|
});
|
|
232
|
-
}, [
|
|
243
|
+
}, [composition.defaultProps, composition.id, schema, z]);
|
|
233
244
|
const connectionStatus = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx).type;
|
|
234
245
|
const warnings = (0, react_1.useMemo)(() => {
|
|
235
246
|
return (0, get_render_modal_warnings_1.getRenderModalWarnings)({
|
|
@@ -267,11 +278,11 @@ const DataEditor = ({ unresolvedComposition, inputProps, setInputProps, compact,
|
|
|
267
278
|
if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
|
|
268
279
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoSchemaDefined, {});
|
|
269
280
|
}
|
|
270
|
-
if (!
|
|
281
|
+
if (!composition.defaultProps) {
|
|
271
282
|
return (0, jsx_runtime_1.jsx)(SchemaErrorMessages_1.NoDefaultProps, {});
|
|
272
283
|
}
|
|
273
284
|
return ((0, jsx_runtime_1.jsxs)("div", { style: outer, children: [(0, jsx_runtime_1.jsxs)("div", { style: controlContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: tabWrapper, children: [(0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: modeItems, needsWrapping: false }), (0, jsx_runtime_1.jsx)(layout_1.Flex, {}), warnings.length > 0 ? ((0, jsx_runtime_1.jsx)(WarningIndicatorButton_1.WarningIndicatorButton, { setShowWarning: setShowWarning, showWarning: showWarning, warningCount: warnings.length })) : null] }), showWarning && warnings.length > 0
|
|
274
285
|
? warnings.map((warning) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1 }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: warning, align: "flex-start", type: "warning" })] }, warning)))
|
|
275
|
-
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps:
|
|
286
|
+
: null] }), mode === 'schema' ? ((0, jsx_runtime_1.jsx)(SchemaEditor_1.SchemaEditor, { value: inputProps, setValue: setInputProps, schema: schema, zodValidationResult: zodValidationResult, compact: compact, defaultProps: composition.defaultProps, onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: !zodValidationResult.success })) : ((0, jsx_runtime_1.jsx)(RenderModalJSONPropsEditor_1.RenderModalJSONPropsEditor, { value: inputProps !== null && inputProps !== void 0 ? inputProps : {}, setValue: setInputProps, zodValidationResult: zodValidationResult, switchToSchema: switchToSchema, onSave: onUpdate, valBeforeSafe: valBeforeSafe, showSaveButton: showSaveButton, serializedJSON: serializedJSON, parseJSON: parseJSON }))] }));
|
|
276
287
|
};
|
|
277
|
-
exports.
|
|
288
|
+
exports.RenderModalData = RenderModalData;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Codec } from '@remotion/renderer';
|
|
2
|
-
export declare const humanReadableCodec: (codec: Codec) => "
|
|
2
|
+
export declare const humanReadableCodec: (codec: Codec) => "AAC" | "MP3" | "GIF" | "H.264" | "H.264 Matroska" | "H.265" | "ProRes" | "WebM VP8" | "WebM VP9" | "Waveform" | undefined;
|
|
@@ -15,6 +15,7 @@ const containerColumn = {
|
|
|
15
15
|
display: 'flex',
|
|
16
16
|
flexDirection: 'column',
|
|
17
17
|
flex: 1,
|
|
18
|
+
height: '100%',
|
|
18
19
|
};
|
|
19
20
|
const SplitterContainer = ({ orientation, children, defaultFlex, maxFlex, minFlex, id }) => {
|
|
20
21
|
const [initialTimelineFlex, persistFlex] = (0, timeline_1.useTimelineFlex)(id);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MaxTimelineTracksReached = exports.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = exports.MAX_TIMELINE_TRACKS = void 0;
|
|
3
|
+
exports.MaxTimelineTracksReached = exports.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = exports.MAX_TIMELINE_TRACKS = exports.DEFAULT_TIMELINE_TRACKS = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
6
|
+
exports.DEFAULT_TIMELINE_TRACKS = 90;
|
|
6
7
|
exports.MAX_TIMELINE_TRACKS = typeof process.env.MAX_TIMELINE_TRACKS === 'undefined'
|
|
7
|
-
?
|
|
8
|
+
? exports.DEFAULT_TIMELINE_TRACKS
|
|
8
9
|
: Number(process.env.MAX_TIMELINE_TRACKS);
|
|
9
10
|
exports.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
|
|
10
11
|
const container = {
|
|
@@ -8,6 +8,7 @@ const calculate_timeline_1 = require("../../helpers/calculate-timeline");
|
|
|
8
8
|
const colors_1 = require("../../helpers/colors");
|
|
9
9
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
10
10
|
const timeline_ref_1 = require("../../state/timeline-ref");
|
|
11
|
+
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
11
12
|
const SplitterContainer_1 = require("../Splitter/SplitterContainer");
|
|
12
13
|
const SplitterElement_1 = require("../Splitter/SplitterElement");
|
|
13
14
|
const SplitterHandle_1 = require("../Splitter/SplitterHandle");
|
|
@@ -23,6 +24,7 @@ const TimelineScrollable_1 = require("./TimelineScrollable");
|
|
|
23
24
|
const TimelineSlider_1 = require("./TimelineSlider");
|
|
24
25
|
const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
|
|
25
26
|
const TimelineTracks_1 = require("./TimelineTracks");
|
|
27
|
+
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
26
28
|
const container = {
|
|
27
29
|
minHeight: '100%',
|
|
28
30
|
flex: 1,
|
|
@@ -34,7 +36,7 @@ const container = {
|
|
|
34
36
|
const noop = () => undefined;
|
|
35
37
|
const Timeline = () => {
|
|
36
38
|
var _a;
|
|
37
|
-
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.
|
|
39
|
+
const { sequences } = (0, react_1.useContext)(remotion_1.Internals.SequenceManager);
|
|
38
40
|
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
39
41
|
const [state, dispatch] = (0, react_1.useReducer)(timeline_state_reducer_1.timelineStateReducer, {
|
|
40
42
|
collapsed: {},
|
|
@@ -85,9 +87,6 @@ const Timeline = () => {
|
|
|
85
87
|
overflowX: 'hidden',
|
|
86
88
|
};
|
|
87
89
|
}, [hasBeenCut, shown.length]);
|
|
88
|
-
|
|
89
|
-
return (0, jsx_runtime_1.jsx)("div", { style: container, className: "css-reset" });
|
|
90
|
-
}
|
|
91
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: timeline_refs_1.timelineVerticalScroll, style: container, className: "css-reset", children: (0, jsx_runtime_1.jsx)("div", { style: inner, children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "flexer", children: (0, jsx_runtime_1.jsx)(TimelineList_1.TimelineList, { dispatchStateChange: dispatch, viewState: state, timeline: shown }) }), (0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { onCollapse: noop, allowToCollapse: "none" }), (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "anti-flexer", children: (0, jsx_runtime_1.jsxs)(TimelineScrollable_1.TimelineScrollable, { children: [(0, jsx_runtime_1.jsx)(TimelineTracks_1.TimelineTracks, { viewState: state, timeline: shown, fps: videoConfig.fps, hasBeenCut: hasBeenCut }), (0, jsx_runtime_1.jsx)(TimelineInOutPointer_1.TimelineInOutPointer, {}), (0, jsx_runtime_1.jsx)(TimelineDragHandler_1.TimelineDragHandler, {}), (0, jsx_runtime_1.jsx)(TimelineSlider_1.TimelineSlider, {}), (0, jsx_runtime_1.jsx)(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {})] }) })] }) }) }));
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: timeline_refs_1.timelineVerticalScroll, style: container, className: 'css-reset ' + is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME, children: (0, jsx_runtime_1.jsx)(TimelineWidthProvider_1.TimelineWidthProvider, { children: (0, jsx_runtime_1.jsx)("div", { style: inner, children: (0, jsx_runtime_1.jsxs)(SplitterContainer_1.SplitterContainer, { orientation: "vertical", defaultFlex: 0.2, id: "names-to-timeline", maxFlex: 0.5, minFlex: 0.15, children: [(0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "flexer", children: (0, jsx_runtime_1.jsx)(TimelineList_1.TimelineList, { dispatchStateChange: dispatch, viewState: state, timeline: shown }) }), (0, jsx_runtime_1.jsx)(SplitterHandle_1.SplitterHandle, { onCollapse: noop, allowToCollapse: "none" }), (0, jsx_runtime_1.jsx)(SplitterElement_1.SplitterElement, { type: "anti-flexer", children: (0, jsx_runtime_1.jsxs)(TimelineScrollable_1.TimelineScrollable, { children: [(0, jsx_runtime_1.jsx)(TimelineTracks_1.TimelineTracks, { viewState: state, timeline: shown, hasBeenCut: hasBeenCut }), (0, jsx_runtime_1.jsx)(TimelineInOutPointer_1.TimelineInOutPointer, {}), (0, jsx_runtime_1.jsx)(TimelineDragHandler_1.TimelineDragHandler, {}), (0, jsx_runtime_1.jsx)(TimelineSlider_1.TimelineSlider, {}), (0, jsx_runtime_1.jsx)(TimelinePlayCursorSyncer_1.TimelinePlayCursorSyncer, {})] }) })] }) }) }) }));
|
|
92
91
|
};
|
|
93
92
|
exports.Timeline = Timeline;
|
|
@@ -10,11 +10,13 @@ const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
|
10
10
|
const in_out_1 = require("../../state/in-out");
|
|
11
11
|
const timeline_zoom_1 = require("../../state/timeline-zoom");
|
|
12
12
|
const FramePersistor_1 = require("../FramePersistor");
|
|
13
|
+
const is_menu_item_1 = require("../Menu/is-menu-item");
|
|
13
14
|
const timeline_refs_1 = require("./timeline-refs");
|
|
14
15
|
const timeline_scroll_logic_1 = require("./timeline-scroll-logic");
|
|
15
16
|
const TimelineInOutPointer_1 = require("./TimelineInOutPointer");
|
|
16
17
|
const TimelineInOutPointerHandle_1 = require("./TimelineInOutPointerHandle");
|
|
17
18
|
const TimelineSlider_1 = require("./TimelineSlider");
|
|
19
|
+
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
18
20
|
const inner = {
|
|
19
21
|
overflowY: 'auto',
|
|
20
22
|
overflowX: 'hidden',
|
|
@@ -30,7 +32,20 @@ const getClientXWithScroll = (x) => {
|
|
|
30
32
|
return x + ((_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft);
|
|
31
33
|
};
|
|
32
34
|
const TimelineDragHandler = () => {
|
|
35
|
+
const video = remotion_1.Internals.useUnsafeVideoConfig();
|
|
36
|
+
const { zoom } = (0, react_1.useContext)(timeline_zoom_1.TimelineZoomCtx);
|
|
37
|
+
const containerStyle = (0, react_1.useMemo)(() => {
|
|
38
|
+
return {
|
|
39
|
+
...container,
|
|
40
|
+
width: 100 * zoom + '%',
|
|
41
|
+
};
|
|
42
|
+
}, [zoom]);
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, children: video ? (0, jsx_runtime_1.jsx)(Inner, {}) : null }));
|
|
44
|
+
};
|
|
45
|
+
exports.TimelineDragHandler = TimelineDragHandler;
|
|
46
|
+
const Inner = () => {
|
|
33
47
|
var _a, _b, _c;
|
|
48
|
+
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
34
49
|
const size = player_1.PlayerInternals.useElementSize(timeline_refs_1.scrollableRef, {
|
|
35
50
|
triggerOnWindowResize: true,
|
|
36
51
|
shouldApplyCssTransforms: true,
|
|
@@ -38,16 +53,21 @@ const TimelineDragHandler = () => {
|
|
|
38
53
|
const [inOutDragging, setInOutDragging] = (0, react_1.useState)({
|
|
39
54
|
dragging: false,
|
|
40
55
|
});
|
|
56
|
+
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
57
|
+
const get = (0, react_1.useCallback)((frame) => {
|
|
58
|
+
if (timelineWidth === null) {
|
|
59
|
+
throw new Error('timeline width is not yet determined');
|
|
60
|
+
}
|
|
61
|
+
return (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(frame, videoConfig.durationInFrames, timelineWidth);
|
|
62
|
+
}, [timelineWidth, videoConfig.durationInFrames]);
|
|
41
63
|
const width = (_b = (_a = timeline_refs_1.scrollableRef.current) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
|
|
42
64
|
const left = (_c = size === null || size === void 0 ? void 0 : size.left) !== null && _c !== void 0 ? _c : 0;
|
|
43
65
|
const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
|
|
44
66
|
const { setInAndOutFrames } = (0, in_out_1.useTimelineSetInOutFramePosition)();
|
|
45
|
-
const { get } = (0, get_left_of_timeline_slider_1.useGetXPositionOfItemInTimeline)();
|
|
46
67
|
const [dragging, setDragging] = (0, react_1.useState)({
|
|
47
68
|
dragging: false,
|
|
48
69
|
});
|
|
49
70
|
const { playing, play, pause, seek } = player_1.PlayerInternals.usePlayer();
|
|
50
|
-
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
51
71
|
const scroller = (0, react_1.useRef)(null);
|
|
52
72
|
const stopInterval = () => {
|
|
53
73
|
if (scroller.current) {
|
|
@@ -312,13 +332,8 @@ const TimelineDragHandler = () => {
|
|
|
312
332
|
window.removeEventListener('pointerup', onPointerUpInOut);
|
|
313
333
|
};
|
|
314
334
|
}, [inOutDragging.dragging, onPointerMoveInOut, onPointerUpInOut]);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
width: 100 * zoom + '%',
|
|
320
|
-
};
|
|
321
|
-
}, [zoom]);
|
|
322
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: timeline_refs_1.sliderAreaRef, style: containerStyle, onPointerDown: onPointerDown, children: [(0, jsx_runtime_1.jsx)("div", { style: inner }), inFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "in", atFrame: inFrame, dragging: inOutDragging.dragging === 'in' })), outFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "out", dragging: inOutDragging.dragging === 'out', atFrame: outFrame }))] }));
|
|
335
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
336
|
+
width: '100%',
|
|
337
|
+
height: '100%',
|
|
338
|
+
}, onPointerDown: onPointerDown, children: [(0, jsx_runtime_1.jsx)("div", { style: inner, className: is_menu_item_1.VERTICAL_SCROLLBAR_CLASSNAME }), inFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "in", atFrame: inFrame, dragging: inOutDragging.dragging === 'in' })), outFrame !== null && ((0, jsx_runtime_1.jsx)(TimelineInOutPointerHandle_1.TimelineInOutPointerHandle, { type: "out", dragging: inOutDragging.dragging === 'out', atFrame: outFrame }))] }));
|
|
323
339
|
};
|
|
324
|
-
exports.TimelineDragHandler = TimelineDragHandler;
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
7
|
const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
|
|
8
8
|
const in_out_1 = require("../../state/in-out");
|
|
9
|
+
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
9
10
|
const areaHighlight = {
|
|
10
11
|
position: 'absolute',
|
|
11
12
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
@@ -18,18 +19,19 @@ exports.outMarkerAreaRef = (0, react_1.createRef)();
|
|
|
18
19
|
const TimelineInOutPointer = () => {
|
|
19
20
|
const { inFrame, outFrame } = (0, in_out_1.useTimelineInOutFramePosition)();
|
|
20
21
|
const videoConfig = remotion_1.Internals.useUnsafeVideoConfig();
|
|
21
|
-
const
|
|
22
|
-
if (!videoConfig) {
|
|
22
|
+
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
23
|
+
if (!videoConfig || timelineWidth === null) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [inFrame !== null && ((0, jsx_runtime_1.jsx)("div", { ref: exports.inMarkerAreaRef, style: {
|
|
26
27
|
...areaHighlight,
|
|
27
28
|
left: 0,
|
|
28
|
-
width:
|
|
29
|
+
width: (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(inFrame, videoConfig.durationInFrames, timelineWidth),
|
|
29
30
|
} })), outFrame !== null && ((0, jsx_runtime_1.jsx)("div", { ref: exports.outMarkerAreaRef, style: {
|
|
30
31
|
...areaHighlight,
|
|
31
|
-
left:
|
|
32
|
-
width:
|
|
32
|
+
left: (0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(outFrame, videoConfig.durationInFrames, timelineWidth),
|
|
33
|
+
width: timelineWidth -
|
|
34
|
+
(0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(outFrame, videoConfig.durationInFrames, timelineWidth),
|
|
33
35
|
} }))] }));
|
|
34
36
|
};
|
|
35
37
|
exports.TimelineInOutPointer = TimelineInOutPointer;
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimelineInOutPointerHandle = exports.outPointerHandle = exports.inPointerHandle = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
6
7
|
const get_left_of_timeline_slider_1 = require("../../helpers/get-left-of-timeline-slider");
|
|
8
|
+
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
7
9
|
const line = {
|
|
8
10
|
height: '100%',
|
|
9
11
|
width: 1,
|
|
@@ -16,16 +18,20 @@ const line = {
|
|
|
16
18
|
exports.inPointerHandle = (0, react_1.createRef)();
|
|
17
19
|
exports.outPointerHandle = (0, react_1.createRef)();
|
|
18
20
|
const TimelineInOutPointerHandle = ({ dragging, type, atFrame }) => {
|
|
19
|
-
const
|
|
21
|
+
const timelineWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
22
|
+
const videoConfig = (0, remotion_1.useVideoConfig)();
|
|
23
|
+
if (timelineWidth === null) {
|
|
24
|
+
throw new Error('Timeline width is null');
|
|
25
|
+
}
|
|
20
26
|
const style = (0, react_1.useMemo)(() => {
|
|
21
27
|
return {
|
|
22
28
|
...line,
|
|
23
29
|
backgroundColor: dragging
|
|
24
30
|
? 'rgba(255, 255, 255, 0.7)'
|
|
25
31
|
: 'rgba(255, 255, 255, 0.1)',
|
|
26
|
-
transform: `translateX(${
|
|
32
|
+
transform: `translateX(${(0, get_left_of_timeline_slider_1.getXPositionOfItemInTimelineImperatively)(atFrame, videoConfig.durationInFrames, timelineWidth)}px)`,
|
|
27
33
|
};
|
|
28
|
-
}, [atFrame, dragging,
|
|
34
|
+
}, [atFrame, dragging, timelineWidth, videoConfig.durationInFrames]);
|
|
29
35
|
return ((0, jsx_runtime_1.jsx)("div", { ref: type === 'in' ? exports.inPointerHandle : exports.outPointerHandle, style: style }));
|
|
30
36
|
};
|
|
31
37
|
exports.TimelineInOutPointerHandle = TimelineInOutPointerHandle;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimelineSequence = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const player_1 = require("@remotion/player");
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const remotion_1 = require("remotion");
|
|
8
7
|
const colors_1 = require("../../helpers/colors");
|
|
@@ -10,17 +9,19 @@ const get_timeline_sequence_layout_1 = require("../../helpers/get-timeline-seque
|
|
|
10
9
|
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
11
10
|
const AudioWaveform_1 = require("../AudioWaveform");
|
|
12
11
|
const LoopedTimelineIndicators_1 = require("./LoopedTimelineIndicators");
|
|
13
|
-
const timeline_refs_1 = require("./timeline-refs");
|
|
14
12
|
const TimelineVideoInfo_1 = require("./TimelineVideoInfo");
|
|
13
|
+
const TimelineWidthProvider_1 = require("./TimelineWidthProvider");
|
|
15
14
|
const AUDIO_GRADIENT = 'linear-gradient(rgb(16 171 58), rgb(43 165 63) 60%)';
|
|
16
15
|
const VIDEO_GRADIENT = 'linear-gradient(to top, #8e44ad, #9b59b6)';
|
|
17
|
-
const TimelineSequence = ({ s
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
16
|
+
const TimelineSequence = ({ s }) => {
|
|
17
|
+
const windowWidth = (0, react_1.useContext)(TimelineWidthProvider_1.TimelineWidthContext);
|
|
18
|
+
if (windowWidth === null) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(Inner, { windowWidth: windowWidth, s: s });
|
|
22
|
+
};
|
|
23
|
+
exports.TimelineSequence = TimelineSequence;
|
|
24
|
+
const Inner = ({ s, windowWidth }) => {
|
|
24
25
|
// If a duration is 1, it is essentially a still and it should have width 0
|
|
25
26
|
// Some compositions may not be longer than their media duration,
|
|
26
27
|
// if that is the case, it needs to be asynchronously determined
|
|
@@ -29,16 +30,18 @@ const TimelineSequence = ({ s, fps }) => {
|
|
|
29
30
|
if (!video) {
|
|
30
31
|
throw new TypeError('Expected video config');
|
|
31
32
|
}
|
|
32
|
-
const { marginLeft, width } = (0,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
const { marginLeft, width } = (0, react_1.useMemo)(() => {
|
|
34
|
+
return (0, get_timeline_sequence_layout_1.getTimelineSequenceLayout)({
|
|
35
|
+
durationInFrames: s.loopDisplay
|
|
36
|
+
? s.loopDisplay.durationInFrames * s.loopDisplay.numberOfTimes
|
|
37
|
+
: s.duration,
|
|
38
|
+
startFrom: s.loopDisplay ? s.from + s.loopDisplay.startOffset : s.from,
|
|
39
|
+
startFromMedia: s.type === 'sequence' ? 0 : s.startMediaFrom,
|
|
40
|
+
maxMediaDuration,
|
|
41
|
+
video,
|
|
42
|
+
windowWidth,
|
|
43
|
+
});
|
|
44
|
+
}, [maxMediaDuration, s, video, windowWidth]);
|
|
42
45
|
const style = (0, react_1.useMemo)(() => {
|
|
43
46
|
return {
|
|
44
47
|
background: s.type === 'audio'
|
|
@@ -57,6 +60,5 @@ const TimelineSequence = ({ s, fps }) => {
|
|
|
57
60
|
overflow: 'hidden',
|
|
58
61
|
};
|
|
59
62
|
}, [marginLeft, s.type, width]);
|
|
60
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: style, title: s.displayName, children: [s.type === 'audio' ? ((0, jsx_runtime_1.jsx)(AudioWaveform_1.AudioWaveform, { src: s.src, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration,
|
|
63
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: style, title: s.displayName, children: [s.type === 'audio' ? ((0, jsx_runtime_1.jsx)(AudioWaveform_1.AudioWaveform, { src: s.src, doesVolumeChange: s.doesVolumeChange, visualizationWidth: width, startFrom: s.startMediaFrom, durationInFrames: s.duration, volume: s.volume, setMaxMediaDuration: setMaxMediaDuration, playbackRate: s.playbackRate })) : null, s.type === 'video' ? (0, jsx_runtime_1.jsx)(TimelineVideoInfo_1.TimelineVideoInfo, { src: s.src }) : null, s.loopDisplay === undefined ? null : ((0, jsx_runtime_1.jsx)(LoopedTimelineIndicators_1.LoopedTimelineIndicator, { loops: s.loopDisplay.numberOfTimes }))] }, s.id));
|
|
61
64
|
};
|
|
62
|
-
exports.TimelineSequence = TimelineSequence;
|