remotion 4.0.0-alpha.217 → 4.0.0-alpha10
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/cjs/Composition.d.ts +19 -7
- package/dist/cjs/Composition.js +19 -13
- package/dist/cjs/CompositionManager.d.ts +18 -31
- package/dist/cjs/CompositionManager.js +10 -22
- package/dist/cjs/CompositionManagerContext.d.ts +24 -0
- package/dist/cjs/CompositionManagerContext.js +22 -0
- package/dist/cjs/EditorProps.d.ts +3 -3
- package/dist/cjs/Folder.js +2 -2
- package/dist/cjs/Img.d.ts +3 -2
- package/dist/cjs/Img.js +3 -0
- package/dist/cjs/ResolveCompositionConfig.d.ts +22 -0
- package/dist/cjs/ResolveCompositionConfig.js +158 -0
- package/dist/cjs/Sequence.d.ts +2 -1
- package/dist/cjs/Sequence.js +5 -5
- package/dist/cjs/Still.d.ts +3 -3
- package/dist/cjs/Still.js +1 -1
- package/dist/cjs/audio/Audio.js +5 -3
- package/dist/cjs/audio/AudioForDevelopment.js +10 -3
- package/dist/cjs/audio/AudioForRendering.js +4 -4
- package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
- package/dist/cjs/get-static-files.js +1 -1
- package/dist/cjs/index.d.ts +7 -5
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/internals.d.ts +30 -17
- package/dist/cjs/internals.js +12 -3
- package/dist/cjs/loading-indicator.js +2 -2
- package/dist/cjs/loop/index.js +14 -5
- package/dist/cjs/props-if-has-props.d.ts +8 -8
- package/dist/cjs/resolve-video-config.d.ts +8 -0
- package/dist/cjs/resolve-video-config.js +76 -0
- package/dist/cjs/spring/index.d.ts +5 -1
- package/dist/cjs/spring/index.js +34 -14
- package/dist/cjs/static-file.d.ts +28 -0
- package/dist/cjs/static-file.js +43 -3
- package/dist/cjs/timeline-position-state.js +9 -1
- package/dist/cjs/use-media-in-timeline.js +3 -3
- package/dist/cjs/use-media-playback.js +12 -3
- package/dist/cjs/use-video-config.js +5 -1
- package/dist/cjs/use-video.d.ts +7 -14
- package/dist/cjs/use-video.js +28 -18
- package/dist/cjs/validation/validate-default-props.d.ts +1 -0
- package/dist/cjs/validation/validate-default-props.js +15 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/OffthreadVideo.js +5 -4
- package/dist/cjs/video/OffthreadVideoForRendering.js +5 -6
- package/dist/cjs/video/Video.js +3 -2
- package/dist/cjs/video/VideoForDevelopment.js +6 -2
- package/dist/cjs/video/VideoForRendering.js +8 -3
- package/dist/cjs/video/duration-state.js +2 -1
- package/dist/cjs/video/index.d.ts +1 -1
- package/dist/cjs/video/props.d.ts +10 -3
- package/dist/cjs/video-config.d.ts +1 -1
- package/dist/cjs/wrap-remotion-context.d.ts +12 -1
- package/dist/cjs/wrap-remotion-context.js +7 -3
- package/dist/esm/index.mjs +1086 -732
- package/dist/esm/version.mjs +1 -1
- package/package.json +80 -81
- package/dist/cjs/z-color.d.ts +0 -9
- package/dist/cjs/z-color.js +0 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ComponentType
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
import type { PropsIfHasProps } from './props-if-has-props.js';
|
|
3
|
+
import type { AnyZodObject } from 'zod';
|
|
4
|
+
import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
|
|
5
5
|
declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
|
|
6
6
|
export declare type CompProps<Props> = {
|
|
7
7
|
lazyComponent: () => Promise<{
|
|
@@ -10,13 +10,26 @@ export declare type CompProps<Props> = {
|
|
|
10
10
|
} | {
|
|
11
11
|
component: LooseComponentType<Props>;
|
|
12
12
|
};
|
|
13
|
-
export declare type
|
|
13
|
+
export declare type CalcMetadataReturnType<T> = {
|
|
14
|
+
durationInFrames?: number;
|
|
15
|
+
fps?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
props?: T;
|
|
19
|
+
};
|
|
20
|
+
export declare type CalculateMetadataFunction<T> = (options: {
|
|
21
|
+
defaultProps: T;
|
|
22
|
+
props: T;
|
|
23
|
+
abortSignal: AbortSignal;
|
|
24
|
+
}) => Promise<CalcMetadataReturnType<T>> | CalcMetadataReturnType<T>;
|
|
25
|
+
export declare type StillProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
|
|
14
26
|
width: number;
|
|
15
27
|
height: number;
|
|
16
28
|
id: string;
|
|
29
|
+
calculateMetadata?: CalculateMetadataFunction<InferProps<Schema, Props>>;
|
|
17
30
|
schema?: Schema;
|
|
18
31
|
} & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
19
|
-
export declare type CompositionProps<Schema extends
|
|
32
|
+
export declare type CompositionProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = StillProps<Schema, Props> & {
|
|
20
33
|
fps: number;
|
|
21
34
|
durationInFrames: number;
|
|
22
35
|
};
|
|
@@ -24,6 +37,5 @@ export declare type CompositionProps<Schema extends z.ZodTypeAny, Props> = Still
|
|
|
24
37
|
* @description This component is used to register a video to make it renderable and make it show in the sidebar, in dev mode.
|
|
25
38
|
* @see [Documentation](https://www.remotion.dev/docs/composition)
|
|
26
39
|
*/
|
|
27
|
-
export declare const Composition: <Schema extends
|
|
28
|
-
export declare const ClipComposition: React.FC<PropsWithChildren>;
|
|
40
|
+
export declare const Composition: <Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined>({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }: CompositionProps<Schema, Props>) => React.ReactPortal | null;
|
|
29
41
|
export {};
|
package/dist/cjs/Composition.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Composition = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_dom_1 = require("react-dom");
|
|
7
7
|
const AbsoluteFill_js_1 = require("./AbsoluteFill.js");
|
|
8
8
|
const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
|
|
9
|
-
const
|
|
10
|
-
const input_props_js_1 = require("./config/input-props.js");
|
|
9
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
11
10
|
const delay_render_js_1 = require("./delay-render.js");
|
|
12
|
-
const EditorProps_js_1 = require("./EditorProps.js");
|
|
13
11
|
const Folder_js_1 = require("./Folder.js");
|
|
14
12
|
const get_environment_js_1 = require("./get-environment.js");
|
|
15
13
|
const loading_indicator_js_1 = require("./loading-indicator.js");
|
|
16
14
|
const NativeLayers_js_1 = require("./NativeLayers.js");
|
|
17
15
|
const nonce_js_1 = require("./nonce.js");
|
|
18
16
|
const portal_node_js_1 = require("./portal-node.js");
|
|
17
|
+
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
19
18
|
const use_lazy_component_js_1 = require("./use-lazy-component.js");
|
|
20
19
|
const use_video_js_1 = require("./use-video.js");
|
|
21
20
|
const validate_composition_id_js_1 = require("./validation/validate-composition-id.js");
|
|
21
|
+
const validate_default_props_js_1 = require("./validation/validate-default-props.js");
|
|
22
22
|
const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
|
|
23
23
|
const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
|
|
24
24
|
const validate_fps_js_1 = require("./validation/validate-fps.js");
|
|
@@ -34,11 +34,10 @@ const Fallback = () => {
|
|
|
34
34
|
* @see [Documentation](https://www.remotion.dev/docs/composition)
|
|
35
35
|
*/
|
|
36
36
|
const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }) => {
|
|
37
|
-
var _a;
|
|
38
|
-
const { registerComposition, unregisterComposition } = (0, react_1.useContext)(
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const { registerComposition, unregisterComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
39
39
|
const video = (0, use_video_js_1.useVideo)();
|
|
40
40
|
const lazy = (0, use_lazy_component_js_1.useLazyComponent)(compProps);
|
|
41
|
-
const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
|
|
42
41
|
const nonce = (0, nonce_js_1.useNonce)();
|
|
43
42
|
const environment = (0, get_environment_js_1.useRemotionEnvironment)();
|
|
44
43
|
const canUseComposition = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
|
|
@@ -51,6 +50,7 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, s
|
|
|
51
50
|
}
|
|
52
51
|
const { folderName, parentName } = (0, react_1.useContext)(Folder_js_1.FolderContext);
|
|
53
52
|
(0, react_1.useEffect)(() => {
|
|
53
|
+
var _a;
|
|
54
54
|
// Ensure it's a URL safe id
|
|
55
55
|
if (!id) {
|
|
56
56
|
throw new Error('No id for composition passed.');
|
|
@@ -64,6 +64,7 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, s
|
|
|
64
64
|
allowFloats: false,
|
|
65
65
|
});
|
|
66
66
|
(0, validate_fps_js_1.validateFps)(fps, 'as a prop of the <Composition/> component', false);
|
|
67
|
+
(0, validate_default_props_js_1.validateDefaultAndInputProps)(defaultProps, 'defaultProps', id);
|
|
67
68
|
registerComposition({
|
|
68
69
|
durationInFrames,
|
|
69
70
|
fps,
|
|
@@ -76,6 +77,7 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, s
|
|
|
76
77
|
nonce,
|
|
77
78
|
parentFolderName: parentName,
|
|
78
79
|
schema: schema !== null && schema !== void 0 ? schema : null,
|
|
80
|
+
calculateMetadata: (_a = compProps.calculateMetadata) !== null && _a !== void 0 ? _a : null,
|
|
79
81
|
});
|
|
80
82
|
return () => {
|
|
81
83
|
unregisterComposition(id);
|
|
@@ -94,17 +96,22 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, s
|
|
|
94
96
|
nonce,
|
|
95
97
|
parentName,
|
|
96
98
|
schema,
|
|
99
|
+
compProps.calculateMetadata,
|
|
97
100
|
]);
|
|
98
|
-
const
|
|
101
|
+
const resolved = (0, ResolveCompositionConfig_js_1.useResolvedVideoConfig)(id);
|
|
99
102
|
if (environment === 'preview' && video && video.component === lazy) {
|
|
100
103
|
const Comp = lazy;
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
if (resolved === null || resolved.type !== 'success') {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ClipComposition, { children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_a = resolved.result.defaultProps) !== null && _a !== void 0 ? _a : {}) }) }) }) }), (0, portal_node_js_1.portalNode)());
|
|
103
108
|
}
|
|
104
109
|
if (environment === 'rendering' && video && video.component === lazy) {
|
|
105
110
|
const Comp = lazy;
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
if (resolved === null || resolved.type !== 'success') {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_b = resolved.result.defaultProps) !== null && _b !== void 0 ? _b : {}) }) }) }), (0, portal_node_js_1.portalNode)());
|
|
108
115
|
}
|
|
109
116
|
return null;
|
|
110
117
|
};
|
|
@@ -123,4 +130,3 @@ const ClipComposition = ({ children }) => {
|
|
|
123
130
|
}, [clipRegion]);
|
|
124
131
|
return (0, jsx_runtime_1.jsx)(AbsoluteFill_js_1.AbsoluteFill, { style: style, children: children });
|
|
125
132
|
};
|
|
126
|
-
exports.ClipComposition = ClipComposition;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { PropsIfHasProps } from './props-if-has-props.js';
|
|
6
|
-
export declare type TComposition<Schema extends
|
|
3
|
+
import type { AnyZodObject } from 'zod';
|
|
4
|
+
import type { CalculateMetadataFunction } from './Composition.js';
|
|
5
|
+
import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
|
|
6
|
+
export declare type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
fps: number;
|
|
@@ -14,12 +14,14 @@ export declare type TComposition<Schema extends z.ZodTypeAny, Props> = {
|
|
|
14
14
|
component: LazyExoticComponent<ComponentType<Props>>;
|
|
15
15
|
nonce: number;
|
|
16
16
|
schema: Schema | null;
|
|
17
|
+
calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
|
|
17
18
|
} & PropsIfHasProps<Schema, Props>;
|
|
18
|
-
export declare type AnyComposition = TComposition<
|
|
19
|
-
export declare type
|
|
20
|
-
export declare type
|
|
21
|
-
export declare type
|
|
22
|
-
export declare type
|
|
19
|
+
export declare type AnyComposition = TComposition<AnyZodObject, Record<string, unknown> | undefined>;
|
|
20
|
+
export declare type TCompMetadataWithCalcFunction<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps' | 'calculateMetadata'>;
|
|
21
|
+
export declare type TCompMetadata<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
|
|
22
|
+
export declare type AnyCompMetadata = TCompMetadata<AnyZodObject, Record<string, unknown> | undefined>;
|
|
23
|
+
export declare type SmallTCompMetadata<T extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<T, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames'> & Partial<Pick<TComposition<T, Props>, 'defaultProps'>>;
|
|
24
|
+
export declare type AnySmallCompMetadata = SmallTCompMetadata<AnyZodObject, Record<string, unknown> | undefined>;
|
|
23
25
|
declare type EnhancedTSequenceData = {
|
|
24
26
|
type: 'sequence';
|
|
25
27
|
} | {
|
|
@@ -37,6 +39,11 @@ declare type EnhancedTSequenceData = {
|
|
|
37
39
|
startMediaFrom: number;
|
|
38
40
|
playbackRate: number;
|
|
39
41
|
};
|
|
42
|
+
export declare type LoopDisplay = {
|
|
43
|
+
numberOfTimes: number;
|
|
44
|
+
startOffset: number;
|
|
45
|
+
durationInFrames: number;
|
|
46
|
+
};
|
|
40
47
|
export declare type TSequence = {
|
|
41
48
|
from: number;
|
|
42
49
|
duration: number;
|
|
@@ -46,7 +53,7 @@ export declare type TSequence = {
|
|
|
46
53
|
rootId: string;
|
|
47
54
|
showInTimeline: boolean;
|
|
48
55
|
nonce: number;
|
|
49
|
-
|
|
56
|
+
loopDisplay: LoopDisplay | undefined;
|
|
50
57
|
} & EnhancedTSequenceData;
|
|
51
58
|
export declare type TAsset = {
|
|
52
59
|
type: 'audio' | 'video';
|
|
@@ -58,28 +65,8 @@ export declare type TAsset = {
|
|
|
58
65
|
playbackRate: number;
|
|
59
66
|
allowAmplificationDuringRender: boolean;
|
|
60
67
|
};
|
|
61
|
-
declare type BaseMetadata = Pick<AnyCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
|
|
62
|
-
export declare type CompositionManagerContext = {
|
|
63
|
-
compositions: AnyComposition[];
|
|
64
|
-
registerComposition: <Schema extends z.ZodTypeAny, Props>(comp: TComposition<Schema, Props>) => void;
|
|
65
|
-
unregisterComposition: (name: string) => void;
|
|
66
|
-
registerFolder: (name: string, parent: string | null) => void;
|
|
67
|
-
unregisterFolder: (name: string, parent: string | null) => void;
|
|
68
|
-
currentComposition: string | null;
|
|
69
|
-
setCurrentComposition: (curr: string) => void;
|
|
70
|
-
setCurrentCompositionMetadata: (metadata: BaseMetadata) => void;
|
|
71
|
-
currentCompositionMetadata: BaseMetadata | null;
|
|
72
|
-
registerSequence: (seq: TSequence) => void;
|
|
73
|
-
unregisterSequence: (id: string) => void;
|
|
74
|
-
registerAsset: (asset: TAsset) => void;
|
|
75
|
-
unregisterAsset: (id: string) => void;
|
|
76
|
-
sequences: TSequence[];
|
|
77
|
-
assets: TAsset[];
|
|
78
|
-
folders: TFolder[];
|
|
79
|
-
};
|
|
80
|
-
export declare const CompositionManager: React.Context<CompositionManagerContext>;
|
|
81
68
|
export declare const compositionsRef: React.RefObject<{
|
|
82
|
-
getCompositions: () =>
|
|
69
|
+
getCompositions: () => TCompMetadataWithCalcFunction<AnyZodObject, Record<string, unknown> | undefined>[];
|
|
83
70
|
}>;
|
|
84
71
|
export declare const CompositionManagerProvider: React.FC<{
|
|
85
72
|
children: React.ReactNode;
|
|
@@ -23,28 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.CompositionManagerProvider = exports.compositionsRef =
|
|
26
|
+
exports.CompositionManagerProvider = exports.compositionsRef = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
registerComposition: () => undefined,
|
|
33
|
-
unregisterComposition: () => undefined,
|
|
34
|
-
registerFolder: () => undefined,
|
|
35
|
-
unregisterFolder: () => undefined,
|
|
36
|
-
currentComposition: null,
|
|
37
|
-
setCurrentComposition: () => undefined,
|
|
38
|
-
setCurrentCompositionMetadata: () => undefined,
|
|
39
|
-
registerSequence: () => undefined,
|
|
40
|
-
unregisterSequence: () => undefined,
|
|
41
|
-
registerAsset: () => undefined,
|
|
42
|
-
unregisterAsset: () => undefined,
|
|
43
|
-
sequences: [],
|
|
44
|
-
assets: [],
|
|
45
|
-
folders: [],
|
|
46
|
-
currentCompositionMetadata: null,
|
|
47
|
-
});
|
|
30
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
31
|
+
const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
|
|
48
32
|
exports.compositionsRef = react_1.default.createRef();
|
|
49
33
|
const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
|
|
50
34
|
var _a;
|
|
@@ -71,7 +55,11 @@ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
|
|
|
71
55
|
if (comps.find((c) => c.id === comp.id)) {
|
|
72
56
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
73
57
|
}
|
|
74
|
-
|
|
58
|
+
const value = [...comps, comp]
|
|
59
|
+
.slice()
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
.sort((a, b) => a.nonce - b.nonce);
|
|
62
|
+
return value;
|
|
75
63
|
});
|
|
76
64
|
}, [updateCompositions]);
|
|
77
65
|
const registerSequence = (0, react_1.useCallback)((seq) => {
|
|
@@ -126,6 +114,7 @@ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
|
|
|
126
114
|
getCompositions: () => currentcompositionsRef.current,
|
|
127
115
|
};
|
|
128
116
|
}, []);
|
|
117
|
+
const composition = compositions.find((c) => c.id === currentComposition);
|
|
129
118
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
130
119
|
return {
|
|
131
120
|
compositions,
|
|
@@ -161,7 +150,6 @@ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
|
|
|
161
150
|
unregisterFolder,
|
|
162
151
|
currentCompositionMetadata,
|
|
163
152
|
]);
|
|
164
|
-
|
|
165
|
-
return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, component: composition !== null && composition !== void 0 ? composition : null, children: children }) }));
|
|
153
|
+
return ((0, jsx_runtime_1.jsx)(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(ResolveCompositionConfig_js_1.ResolveCompositionConfig, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, component: (_a = composition === null || composition === void 0 ? void 0 : composition.component) !== null && _a !== void 0 ? _a : null, children: children }) }) }));
|
|
166
154
|
};
|
|
167
155
|
exports.CompositionManagerProvider = CompositionManagerProvider;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AnyZodObject } from 'zod';
|
|
3
|
+
import type { AnyCompMetadata, AnyComposition, TAsset, TComposition, TSequence } from './CompositionManager.js';
|
|
4
|
+
import type { TFolder } from './Folder.js';
|
|
5
|
+
export declare type BaseMetadata = Pick<AnyCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
|
|
6
|
+
export declare type CompositionManagerContext = {
|
|
7
|
+
compositions: AnyComposition[];
|
|
8
|
+
registerComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined>(comp: TComposition<Schema, Props>) => void;
|
|
9
|
+
unregisterComposition: (name: string) => void;
|
|
10
|
+
registerFolder: (name: string, parent: string | null) => void;
|
|
11
|
+
unregisterFolder: (name: string, parent: string | null) => void;
|
|
12
|
+
currentComposition: string | null;
|
|
13
|
+
setCurrentComposition: (curr: string) => void;
|
|
14
|
+
setCurrentCompositionMetadata: (metadata: BaseMetadata) => void;
|
|
15
|
+
currentCompositionMetadata: BaseMetadata | null;
|
|
16
|
+
registerSequence: (seq: TSequence) => void;
|
|
17
|
+
unregisterSequence: (id: string) => void;
|
|
18
|
+
registerAsset: (asset: TAsset) => void;
|
|
19
|
+
unregisterAsset: (id: string) => void;
|
|
20
|
+
sequences: TSequence[];
|
|
21
|
+
assets: TAsset[];
|
|
22
|
+
folders: TFolder[];
|
|
23
|
+
};
|
|
24
|
+
export declare const CompositionManager: import("react").Context<CompositionManagerContext>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompositionManager = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.CompositionManager = (0, react_1.createContext)({
|
|
6
|
+
compositions: [],
|
|
7
|
+
registerComposition: () => undefined,
|
|
8
|
+
unregisterComposition: () => undefined,
|
|
9
|
+
registerFolder: () => undefined,
|
|
10
|
+
unregisterFolder: () => undefined,
|
|
11
|
+
currentComposition: null,
|
|
12
|
+
setCurrentComposition: () => undefined,
|
|
13
|
+
setCurrentCompositionMetadata: () => undefined,
|
|
14
|
+
registerSequence: () => undefined,
|
|
15
|
+
unregisterSequence: () => undefined,
|
|
16
|
+
registerAsset: () => undefined,
|
|
17
|
+
unregisterAsset: () => undefined,
|
|
18
|
+
sequences: [],
|
|
19
|
+
assets: [],
|
|
20
|
+
folders: [],
|
|
21
|
+
currentCompositionMetadata: null,
|
|
22
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare type Props = Record<string,
|
|
2
|
+
declare type Props = Record<string, Record<string, unknown>>;
|
|
3
3
|
export declare type EditorPropsContextType = {
|
|
4
4
|
props: Props;
|
|
5
5
|
updateProps: (options: {
|
|
6
6
|
id: string;
|
|
7
|
-
defaultProps:
|
|
8
|
-
newProps:
|
|
7
|
+
defaultProps: Record<string, unknown>;
|
|
8
|
+
newProps: Record<string, unknown> | ((oldProps: Record<string, unknown>) => Record<string, unknown>);
|
|
9
9
|
}) => void;
|
|
10
10
|
};
|
|
11
11
|
export declare const EditorPropsContext: React.Context<EditorPropsContextType>;
|
package/dist/cjs/Folder.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Folder = exports.FolderContext = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
7
7
|
const truthy_js_1 = require("./truthy.js");
|
|
8
8
|
const validate_folder_name_js_1 = require("./validation/validate-folder-name.js");
|
|
9
9
|
exports.FolderContext = (0, react_1.createContext)({
|
|
@@ -16,7 +16,7 @@ exports.FolderContext = (0, react_1.createContext)({
|
|
|
16
16
|
*/
|
|
17
17
|
const Folder = ({ name, children, }) => {
|
|
18
18
|
const parent = (0, react_1.useContext)(exports.FolderContext);
|
|
19
|
-
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(
|
|
19
|
+
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
20
20
|
(0, validate_folder_name_js_1.validateFolderName)(name);
|
|
21
21
|
const parentNameArr = [parent.parentName, parent.folderName].filter(truthy_js_1.truthy);
|
|
22
22
|
const parentName = parentNameArr.length === 0 ? null : parentNameArr.join('/');
|
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
* @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
|
|
4
4
|
* @see [Documentation](https://www.remotion.dev/docs/img)
|
|
5
5
|
*/
|
|
6
|
-
export declare const Img: React.ForwardRefExoticComponent<Pick<React.
|
|
6
|
+
export declare const Img: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src"> & {
|
|
7
7
|
maxRetries?: number | undefined;
|
|
8
|
-
|
|
8
|
+
src: string;
|
|
9
|
+
}, "id" | "height" | "width" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "crossOrigin" | "src" | "loading" | "referrerPolicy" | "alt" | "decoding" | "sizes" | "srcSet" | "useMap" | "maxRetries"> & React.RefAttributes<HTMLImageElement>>;
|
package/dist/cjs/Img.js
CHANGED
|
@@ -12,6 +12,9 @@ function exponentialBackoff(errorCount) {
|
|
|
12
12
|
const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
13
13
|
const imageRef = (0, react_1.useRef)(null);
|
|
14
14
|
const errors = (0, react_1.useRef)({});
|
|
15
|
+
if (!src) {
|
|
16
|
+
throw new Error('No "src" prop was passed to <Img>.');
|
|
17
|
+
}
|
|
15
18
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
16
19
|
return imageRef.current;
|
|
17
20
|
}, []);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { VideoConfig } from './video-config.js';
|
|
3
|
+
declare type ResolveCompositionConfigContect = Record<string, VideoConfigState | undefined>;
|
|
4
|
+
export declare const ResolveCompositionContext: import("react").Context<ResolveCompositionConfigContect | null>;
|
|
5
|
+
export declare const resolveCompositionsRef: import("react").RefObject<{
|
|
6
|
+
setCurrentRenderModalComposition: (compositionId: string | null) => void;
|
|
7
|
+
reloadCurrentlySelectedComposition: () => void;
|
|
8
|
+
}>;
|
|
9
|
+
declare type VideoConfigState = {
|
|
10
|
+
type: 'loading';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'success';
|
|
13
|
+
result: VideoConfig;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'error';
|
|
16
|
+
error: Error;
|
|
17
|
+
};
|
|
18
|
+
export declare const ResolveCompositionConfig: React.FC<PropsWithChildren<{
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}>>;
|
|
21
|
+
export declare const useResolvedVideoConfig: (preferredCompositionId: string | null) => VideoConfigState | null;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useResolvedVideoConfig = exports.ResolveCompositionConfig = exports.resolveCompositionsRef = exports.ResolveCompositionContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
7
|
+
const EditorProps_js_1 = require("./EditorProps.js");
|
|
8
|
+
const resolve_video_config_js_1 = require("./resolve-video-config.js");
|
|
9
|
+
exports.ResolveCompositionContext = (0, react_1.createContext)(null);
|
|
10
|
+
exports.resolveCompositionsRef = (0, react_1.createRef)();
|
|
11
|
+
const ResolveCompositionConfig = ({ children }) => {
|
|
12
|
+
const [currentRenderModalComposition, setCurrentRenderModalComposition] = (0, react_1.useState)(null);
|
|
13
|
+
const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
14
|
+
const selectedComposition = compositions.find((c) => c.id === currentComposition);
|
|
15
|
+
const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
|
|
16
|
+
const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
|
|
17
|
+
const [resolvedConfigs, setResolvedConfigs] = (0, react_1.useState)({});
|
|
18
|
+
const selectedEditorProps = (0, react_1.useMemo)(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
return selectedComposition
|
|
21
|
+
? (_a = allEditorProps[selectedComposition.id]) !== null && _a !== void 0 ? _a : {}
|
|
22
|
+
: {};
|
|
23
|
+
}, [allEditorProps, selectedComposition]);
|
|
24
|
+
const renderModalProps = (0, react_1.useMemo)(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
return renderModalComposition
|
|
27
|
+
? (_a = allEditorProps[renderModalComposition.id]) !== null && _a !== void 0 ? _a : {}
|
|
28
|
+
: {};
|
|
29
|
+
}, [allEditorProps, renderModalComposition]);
|
|
30
|
+
const doResolution = (0, react_1.useCallback)((composition, editorProps) => {
|
|
31
|
+
const controller = new AbortController();
|
|
32
|
+
const { signal } = controller;
|
|
33
|
+
const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({ composition, editorProps, signal });
|
|
34
|
+
if (typeof promOrNot === 'object' && 'then' in promOrNot) {
|
|
35
|
+
setResolvedConfigs((r) => ({
|
|
36
|
+
...r,
|
|
37
|
+
[composition.id]: {
|
|
38
|
+
type: 'loading',
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
promOrNot
|
|
42
|
+
.then((c) => {
|
|
43
|
+
if (controller.signal.aborted) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setResolvedConfigs((r) => ({
|
|
47
|
+
...r,
|
|
48
|
+
[composition.id]: {
|
|
49
|
+
type: 'success',
|
|
50
|
+
result: c,
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
})
|
|
54
|
+
.catch((err) => {
|
|
55
|
+
if (controller.signal.aborted) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setResolvedConfigs((r) => ({
|
|
59
|
+
...r,
|
|
60
|
+
[composition.id]: {
|
|
61
|
+
type: 'error',
|
|
62
|
+
error: err,
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
setResolvedConfigs((r) => ({
|
|
69
|
+
...r,
|
|
70
|
+
[composition.id]: {
|
|
71
|
+
type: 'success',
|
|
72
|
+
result: promOrNot,
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
return controller;
|
|
77
|
+
}, []);
|
|
78
|
+
(0, react_1.useImperativeHandle)(exports.resolveCompositionsRef, () => {
|
|
79
|
+
return {
|
|
80
|
+
setCurrentRenderModalComposition: (id) => {
|
|
81
|
+
setCurrentRenderModalComposition(id);
|
|
82
|
+
},
|
|
83
|
+
reloadCurrentlySelectedComposition: () => {
|
|
84
|
+
var _a;
|
|
85
|
+
if (!currentComposition) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const composition = compositions.find((c) => c.id === currentComposition);
|
|
89
|
+
if (!composition) {
|
|
90
|
+
throw new Error(`Could not find composition with id ${currentComposition}`);
|
|
91
|
+
}
|
|
92
|
+
const editorProps = (_a = allEditorProps[currentComposition]) !== null && _a !== void 0 ? _a : {};
|
|
93
|
+
doResolution(composition, editorProps);
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}, [allEditorProps, compositions, currentComposition, doResolution]);
|
|
97
|
+
const isTheSame = (selectedComposition === null || selectedComposition === void 0 ? void 0 : selectedComposition.id) === (renderModalComposition === null || renderModalComposition === void 0 ? void 0 : renderModalComposition.id);
|
|
98
|
+
(0, react_1.useEffect)(() => {
|
|
99
|
+
if (selectedComposition) {
|
|
100
|
+
const controller = doResolution(selectedComposition, selectedEditorProps);
|
|
101
|
+
return () => {
|
|
102
|
+
controller.abort();
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}, [doResolution, selectedComposition, selectedEditorProps]);
|
|
106
|
+
(0, react_1.useEffect)(() => {
|
|
107
|
+
if (renderModalComposition && !isTheSame) {
|
|
108
|
+
const controller = doResolution(renderModalComposition, renderModalProps);
|
|
109
|
+
return () => {
|
|
110
|
+
controller.abort();
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}, [doResolution, isTheSame, renderModalComposition, renderModalProps]);
|
|
114
|
+
const resolvedConfigsIncludingStaticOnes = (0, react_1.useMemo)(() => {
|
|
115
|
+
const staticComps = compositions.filter((c) => {
|
|
116
|
+
return c.calculateMetadata === null;
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
...resolvedConfigs,
|
|
120
|
+
...staticComps.reduce((acc, curr) => {
|
|
121
|
+
var _a;
|
|
122
|
+
return {
|
|
123
|
+
...acc,
|
|
124
|
+
[curr.id]: {
|
|
125
|
+
type: 'success',
|
|
126
|
+
result: { ...curr, defaultProps: (_a = curr.defaultProps) !== null && _a !== void 0 ? _a : {} },
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}, {}),
|
|
130
|
+
};
|
|
131
|
+
}, [compositions, resolvedConfigs]);
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)(exports.ResolveCompositionContext.Provider, { value: resolvedConfigsIncludingStaticOnes, children: children }));
|
|
133
|
+
};
|
|
134
|
+
exports.ResolveCompositionConfig = ResolveCompositionConfig;
|
|
135
|
+
const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
136
|
+
const context = (0, react_1.useContext)(exports.ResolveCompositionContext);
|
|
137
|
+
const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
138
|
+
const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
|
|
139
|
+
const composition = compositions.find((c) => c.id === compositionId);
|
|
140
|
+
return (0, react_1.useMemo)(() => {
|
|
141
|
+
var _a;
|
|
142
|
+
if (!composition) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const needsResolution = composition.calculateMetadata;
|
|
146
|
+
if (needsResolution === null) {
|
|
147
|
+
return {
|
|
148
|
+
type: 'success',
|
|
149
|
+
result: { ...composition, defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {} },
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (!context[composition.id]) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return context[composition.id];
|
|
156
|
+
}, [composition, context]);
|
|
157
|
+
};
|
|
158
|
+
exports.useResolvedVideoConfig = useResolvedVideoConfig;
|
package/dist/cjs/Sequence.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { LoopDisplay } from './CompositionManager.js';
|
|
2
3
|
export declare type LayoutAndStyle = {
|
|
3
4
|
layout: 'none';
|
|
4
5
|
} | {
|
|
@@ -12,7 +13,7 @@ export declare type SequenceProps = {
|
|
|
12
13
|
durationInFrames?: number;
|
|
13
14
|
name?: string;
|
|
14
15
|
showInTimeline?: boolean;
|
|
15
|
-
|
|
16
|
+
loopDisplay?: LoopDisplay;
|
|
16
17
|
} & LayoutAndStyle;
|
|
17
18
|
/**
|
|
18
19
|
* @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
|