remotion 4.0.0-webhook.27 → 4.1.0-alpha1
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/LICENSE.md +8 -8
- package/README.md +7 -7
- package/dist/{AbsoluteFill.d.ts → cjs/AbsoluteFill.d.ts} +2 -2
- package/dist/{AbsoluteFill.js → cjs/AbsoluteFill.js} +2 -2
- package/dist/cjs/AssetManager.d.ts +11 -0
- package/dist/cjs/AssetManager.js +40 -0
- package/dist/{CanUseRemotionHooks.d.ts → cjs/CanUseRemotionHooks.d.ts} +0 -0
- package/dist/{CanUseRemotionHooks.js → cjs/CanUseRemotionHooks.js} +0 -0
- package/dist/cjs/Clipper.d.ts +7 -0
- package/dist/cjs/Clipper.js +24 -0
- package/dist/cjs/Composition.d.ts +41 -0
- package/dist/cjs/Composition.js +132 -0
- package/dist/cjs/CompositionManager.d.ts +75 -0
- package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
- package/dist/cjs/CompositionManagerContext.d.ts +18 -0
- package/dist/cjs/CompositionManagerContext.js +16 -0
- package/dist/cjs/EditorProps.d.ts +15 -0
- package/dist/cjs/EditorProps.js +53 -0
- package/dist/{Folder.d.ts → cjs/Folder.d.ts} +6 -2
- package/dist/{Folder.js → cjs/Folder.js} +10 -6
- package/dist/{IFrame.d.ts → cjs/IFrame.d.ts} +4 -0
- package/dist/{IFrame.js → cjs/IFrame.js} +8 -4
- package/dist/cjs/Img.d.ts +9 -0
- package/dist/cjs/Img.js +100 -0
- package/dist/cjs/NativeLayers.d.ts +13 -0
- package/dist/cjs/NativeLayers.js +29 -0
- package/dist/cjs/Null.d.ts +2 -0
- package/dist/cjs/Null.js +25 -0
- package/dist/{RemotionRoot.d.ts → cjs/RemotionRoot.d.ts} +1 -0
- package/dist/cjs/RemotionRoot.js +72 -0
- package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
- package/dist/cjs/ResolveCompositionConfig.js +192 -0
- package/dist/cjs/Sequence.d.ts +22 -0
- package/dist/{Sequence.js → cjs/Sequence.js} +27 -29
- package/dist/cjs/SequenceContext.d.ts +9 -0
- package/dist/cjs/SequenceContext.js +5 -0
- package/dist/cjs/SequenceManager.d.ts +11 -0
- package/dist/cjs/SequenceManager.js +57 -0
- package/dist/cjs/Still.d.ts +8 -0
- package/dist/cjs/Still.js +22 -0
- package/dist/{absolute-src.d.ts → cjs/absolute-src.d.ts} +0 -0
- package/dist/{absolute-src.js → cjs/absolute-src.js} +0 -0
- package/dist/{asset-types.d.ts → cjs/asset-types.d.ts} +0 -0
- package/dist/{asset-types.js → cjs/asset-types.js} +0 -0
- package/dist/{audio → cjs/audio}/Audio.d.ts +10 -4
- package/dist/cjs/audio/Audio.js +58 -0
- package/dist/cjs/audio/AudioForDevelopment.d.ts +11 -0
- package/dist/cjs/audio/AudioForDevelopment.js +101 -0
- package/dist/cjs/audio/AudioForRendering.d.ts +10 -0
- package/dist/cjs/audio/AudioForRendering.js +111 -0
- package/dist/cjs/audio/index.d.ts +2 -0
- package/dist/{audio → cjs/audio}/index.js +2 -2
- package/dist/cjs/audio/props.d.ts +12 -0
- package/dist/{audio → cjs/audio}/props.js +0 -0
- package/dist/{audio → cjs/audio}/shared-audio-tags.d.ts +10 -4
- package/dist/{audio → cjs/audio}/shared-audio-tags.js +35 -13
- package/dist/{audio → cjs/audio}/use-audio-frame.d.ts +0 -0
- package/dist/{audio → cjs/audio}/use-audio-frame.js +4 -4
- package/dist/{bezier.d.ts → cjs/bezier.d.ts} +0 -0
- package/dist/{bezier.js → cjs/bezier.js} +0 -0
- package/dist/cjs/cancel-render.d.ts +5 -0
- package/dist/cjs/cancel-render.js +47 -0
- package/dist/{config → cjs/config}/input-props.d.ts +0 -0
- package/dist/{config → cjs/config}/input-props.js +3 -3
- package/dist/{default-css.d.ts → cjs/default-css.d.ts} +0 -0
- package/dist/{default-css.js → cjs/default-css.js} +0 -0
- package/dist/{delay-render.d.ts → cjs/delay-render.d.ts} +4 -4
- package/dist/{delay-render.js → cjs/delay-render.js} +12 -12
- package/dist/{easing.d.ts → cjs/easing.d.ts} +4 -0
- package/dist/{easing.js → cjs/easing.js} +6 -2
- package/dist/cjs/freeze.d.ts +11 -0
- package/dist/{freeze.js → cjs/freeze.js} +8 -4
- package/dist/{get-asset-file-name.d.ts → cjs/get-asset-file-name.d.ts} +0 -0
- package/dist/{get-asset-file-name.js → cjs/get-asset-file-name.js} +0 -0
- package/dist/cjs/get-environment.d.ts +3 -0
- package/dist/{get-environment.js → cjs/get-environment.js} +14 -2
- package/dist/cjs/get-preview-dom-element.d.ts +2 -0
- package/dist/cjs/get-preview-dom-element.js +8 -0
- package/dist/cjs/get-static-files.d.ts +21 -0
- package/dist/cjs/get-static-files.js +35 -0
- package/dist/{get-timeline-clip-name.d.ts → cjs/get-timeline-clip-name.d.ts} +0 -0
- package/dist/{get-timeline-clip-name.js → cjs/get-timeline-clip-name.js} +0 -0
- package/dist/cjs/index.d.ts +102 -0
- package/dist/cjs/index.js +105 -0
- package/dist/cjs/internals.d.ts +131 -0
- package/dist/cjs/internals.js +120 -0
- package/dist/{interpolate-colors.d.ts → cjs/interpolate-colors.d.ts} +5 -0
- package/dist/{interpolate-colors.js → cjs/interpolate-colors.js} +10 -10
- package/dist/{interpolate.d.ts → cjs/interpolate.d.ts} +11 -7
- package/dist/{interpolate.js → cjs/interpolate.js} +0 -0
- package/dist/{is-approximately-the-same.d.ts → cjs/is-approximately-the-same.d.ts} +0 -0
- package/dist/{is-approximately-the-same.js → cjs/is-approximately-the-same.js} +0 -0
- package/dist/cjs/is-player.d.ts +3 -0
- package/dist/cjs/is-player.js +14 -0
- package/dist/{loading-indicator.d.ts → cjs/loading-indicator.d.ts} +0 -0
- package/dist/{loading-indicator.js → cjs/loading-indicator.js} +4 -4
- package/dist/cjs/loop/index.d.ts +13 -0
- package/dist/cjs/loop/index.js +46 -0
- package/dist/{multiple-versions-warning.d.ts → cjs/multiple-versions-warning.d.ts} +0 -0
- package/dist/{multiple-versions-warning.js → cjs/multiple-versions-warning.js} +11 -6
- package/dist/{nonce.d.ts → cjs/nonce.d.ts} +1 -1
- package/dist/{nonce.js → cjs/nonce.js} +6 -0
- package/dist/{play-and-handle-not-allowed-error.d.ts → cjs/play-and-handle-not-allowed-error.d.ts} +0 -0
- package/dist/{play-and-handle-not-allowed-error.js → cjs/play-and-handle-not-allowed-error.js} +4 -0
- package/dist/{portal-node.d.ts → cjs/portal-node.d.ts} +0 -0
- package/dist/{portal-node.js → cjs/portal-node.js} +0 -0
- package/dist/cjs/prefetch-state.d.ts +8 -0
- package/dist/cjs/prefetch-state.js +27 -0
- package/dist/cjs/prefetch.d.ts +13 -0
- package/dist/{prefetch.js → cjs/prefetch.js} +43 -17
- package/dist/cjs/props-if-has-props.d.ts +10 -0
- package/dist/{video-config.js → cjs/props-if-has-props.js} +0 -0
- package/dist/cjs/random.d.ts +6 -0
- package/dist/{random.js → cjs/random.js} +3 -3
- package/dist/{register-root.d.ts → cjs/register-root.d.ts} +4 -0
- package/dist/{register-root.js → cjs/register-root.js} +4 -0
- package/dist/cjs/resolve-video-config.d.ts +8 -0
- package/dist/cjs/resolve-video-config.js +89 -0
- package/dist/cjs/series/flatten-children.d.ts +2 -0
- package/dist/{series → cjs/series}/flatten-children.js +0 -0
- package/dist/cjs/series/index.d.ts +17 -0
- package/dist/{series → cjs/series}/index.js +22 -8
- package/dist/cjs/setup-env-variables.d.ts +1 -0
- package/dist/{setup-env-variables.js → cjs/setup-env-variables.js} +7 -9
- package/dist/{spring → cjs/spring}/index.d.ts +10 -6
- package/dist/cjs/spring/index.js +75 -0
- package/dist/cjs/spring/measure-spring.d.ts +12 -0
- package/dist/{spring → cjs/spring}/measure-spring.js +8 -4
- package/dist/{spring → cjs/spring}/spring-utils.d.ts +2 -2
- package/dist/{spring → cjs/spring}/spring-utils.js +0 -0
- package/dist/cjs/static-file.d.ts +33 -0
- package/dist/cjs/static-file.js +87 -0
- package/dist/{timeline-position-state.d.ts → cjs/timeline-position-state.d.ts} +4 -4
- package/dist/{timeline-position-state.js → cjs/timeline-position-state.js} +9 -1
- package/dist/cjs/truthy.d.ts +3 -0
- package/dist/{truthy.js → cjs/truthy.js} +0 -0
- package/dist/cjs/use-current-frame.d.ts +5 -0
- package/dist/{use-current-frame.js → cjs/use-current-frame.js} +8 -9
- package/dist/cjs/use-lazy-component.d.ts +7 -0
- package/dist/{use-lazy-component.js → cjs/use-lazy-component.js} +0 -0
- package/dist/{use-media-in-timeline.d.ts → cjs/use-media-in-timeline.d.ts} +3 -2
- package/dist/{use-media-in-timeline.js → cjs/use-media-in-timeline.js} +29 -25
- package/dist/{use-media-playback.d.ts → cjs/use-media-playback.d.ts} +3 -1
- package/dist/cjs/use-media-playback.js +86 -0
- package/dist/{use-media-tag-volume.d.ts → cjs/use-media-tag-volume.d.ts} +0 -0
- package/dist/{use-media-tag-volume.js → cjs/use-media-tag-volume.js} +0 -0
- package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts} +2 -2
- package/dist/{use-sync-volume-with-media-tag.js → cjs/use-sync-volume-with-media-tag.js} +5 -4
- package/dist/{use-unsafe-video-config.d.ts → cjs/use-unsafe-video-config.d.ts} +1 -1
- package/dist/{use-unsafe-video-config.js → cjs/use-unsafe-video-config.js} +4 -4
- package/dist/cjs/use-video-config.d.ts +8 -0
- package/dist/cjs/use-video-config.js +34 -0
- package/dist/cjs/use-video.d.ts +7 -0
- package/dist/cjs/use-video.js +38 -0
- package/dist/cjs/validate-frame.d.ts +5 -0
- package/dist/cjs/validate-frame.js +24 -0
- package/dist/cjs/validate-media-props.d.ts +4 -0
- package/dist/{validate-media-props.js → cjs/validate-media-props.js} +0 -0
- package/dist/{validate-start-from-props.d.ts → cjs/validate-start-from-props.d.ts} +0 -0
- package/dist/{validate-start-from-props.js → cjs/validate-start-from-props.js} +0 -0
- package/dist/{validation → cjs/validation}/validate-composition-id.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-composition-id.js +0 -0
- package/dist/cjs/validation/validate-default-props.d.ts +1 -0
- package/dist/cjs/validation/validate-default-props.js +15 -0
- package/dist/{validation → cjs/validation}/validate-dimensions.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-dimensions.js +0 -0
- package/dist/cjs/validation/validate-duration-in-frames.d.ts +5 -0
- package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +5 -2
- package/dist/{validation → cjs/validation}/validate-folder-name.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-folder-name.js +0 -0
- package/dist/{validation → cjs/validation}/validate-fps.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validate-fps.js +0 -0
- package/dist/{validation → cjs/validation}/validation-spring-duration.d.ts +0 -0
- package/dist/{validation → cjs/validation}/validation-spring-duration.js +0 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/{version.js → cjs/version.js} +1 -1
- package/dist/cjs/video/OffthreadVideo.d.ts +7 -0
- package/dist/cjs/video/OffthreadVideo.js +38 -0
- package/dist/{video → cjs/video}/OffthreadVideoForRendering.d.ts +1 -1
- package/dist/cjs/video/OffthreadVideoForRendering.js +103 -0
- package/dist/cjs/video/Video.d.ts +12 -0
- package/dist/cjs/video/Video.js +55 -0
- package/dist/{video → cjs/video}/VideoForDevelopment.d.ts +5 -2
- package/dist/cjs/video/VideoForDevelopment.js +117 -0
- package/dist/cjs/video/VideoForRendering.d.ts +10 -0
- package/dist/cjs/video/VideoForRendering.js +208 -0
- package/dist/cjs/video/duration-state.d.ts +17 -0
- package/dist/cjs/video/duration-state.js +35 -0
- package/dist/{video → cjs/video}/get-current-time.d.ts +0 -0
- package/dist/{video → cjs/video}/get-current-time.js +12 -11
- package/dist/cjs/video/index.d.ts +3 -0
- package/dist/{video → cjs/video}/index.js +4 -4
- package/dist/cjs/video/props.d.ts +32 -0
- package/dist/cjs/video/props.js +2 -0
- package/dist/cjs/video/video-fragment.d.ts +12 -0
- package/dist/cjs/video/video-fragment.js +60 -0
- package/dist/{video-config.d.ts → cjs/video-config.d.ts} +2 -2
- package/dist/{video/props.js → cjs/video-config.js} +0 -0
- package/dist/{volume-position-state.d.ts → cjs/volume-position-state.d.ts} +4 -4
- package/dist/{volume-position-state.js → cjs/volume-position-state.js} +0 -0
- package/dist/{volume-prop.d.ts → cjs/volume-prop.d.ts} +3 -2
- package/dist/{volume-prop.js → cjs/volume-prop.js} +4 -3
- package/dist/{warn-about-non-seekable-media.d.ts → cjs/warn-about-non-seekable-media.d.ts} +0 -0
- package/dist/{warn-about-non-seekable-media.js → cjs/warn-about-non-seekable-media.js} +2 -2
- package/dist/cjs/wrap-remotion-context.d.ts +31 -0
- package/dist/cjs/wrap-remotion-context.js +85 -0
- package/dist/esm/index.mjs +4623 -0
- package/dist/esm/version.mjs +4 -0
- package/package.json +80 -57
- package/version.js +2 -1
- package/.prettierrc.js +0 -14
- package/.turbo/turbo-build.log +0 -5
- package/dist/Composition.d.ts +0 -22
- package/dist/Composition.js +0 -98
- package/dist/CompositionManager.d.ts +0 -79
- package/dist/Img.d.ts +0 -2
- package/dist/Img.js +0 -51
- package/dist/RemotionRoot.js +0 -71
- package/dist/Sequence.d.ts +0 -29
- package/dist/Still.d.ts +0 -3
- package/dist/Still.js +0 -9
- package/dist/audio/Audio.js +0 -32
- package/dist/audio/AudioForDevelopment.d.ts +0 -8
- package/dist/audio/AudioForDevelopment.js +0 -71
- package/dist/audio/AudioForRendering.d.ts +0 -6
- package/dist/audio/AudioForRendering.js +0 -75
- package/dist/audio/index.d.ts +0 -2
- package/dist/audio/props.d.ts +0 -10
- package/dist/config.d.ts +0 -218
- package/dist/config.js +0 -21
- package/dist/freeze.d.ts +0 -7
- package/dist/get-environment.d.ts +0 -2
- package/dist/get-preview-dom-element.d.ts +0 -1
- package/dist/get-preview-dom-element.js +0 -7
- package/dist/index.d.ts +0 -72
- package/dist/index.js +0 -58
- package/dist/internals.d.ts +0 -88
- package/dist/internals.js +0 -93
- package/dist/loop/index.d.ts +0 -9
- package/dist/loop/index.js +0 -28
- package/dist/prefetch-state.d.ts +0 -13
- package/dist/prefetch-state.js +0 -26
- package/dist/prefetch.d.ts +0 -7
- package/dist/random.d.ts +0 -6
- package/dist/series/flatten-children.d.ts +0 -2
- package/dist/series/index.d.ts +0 -13
- package/dist/setup-env-variables.d.ts +0 -2
- package/dist/spring/index.js +0 -51
- package/dist/spring/measure-spring.d.ts +0 -8
- package/dist/static-file.d.ts +0 -1
- package/dist/static-file.js +0 -29
- package/dist/truthy.d.ts +0 -3
- package/dist/use-current-frame.d.ts +0 -6
- package/dist/use-lazy-component.d.ts +0 -7
- package/dist/use-media-playback.js +0 -75
- package/dist/use-video-config.d.ts +0 -7
- package/dist/use-video-config.js +0 -26
- package/dist/use-video.d.ts +0 -13
- package/dist/use-video.js +0 -28
- package/dist/validate-media-props.d.ts +0 -4
- package/dist/validation/validate-duration-in-frames.d.ts +0 -1
- package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -1
- package/dist/validation/validate-offthreadvideo-image-format.js +0 -15
- package/dist/version.d.ts +0 -1
- package/dist/video/LoopedVideo.d.ts +0 -3
- package/dist/video/LoopedVideo.js +0 -16
- package/dist/video/OffthreadVideo.d.ts +0 -3
- package/dist/video/OffthreadVideo.js +0 -27
- package/dist/video/OffthreadVideoForRendering.js +0 -101
- package/dist/video/Video.d.ts +0 -6
- package/dist/video/Video.js +0 -29
- package/dist/video/VideoForDevelopment.js +0 -69
- package/dist/video/VideoForRendering.d.ts +0 -6
- package/dist/video/VideoForRendering.js +0 -168
- package/dist/video/duration-state.d.ts +0 -8
- package/dist/video/duration-state.js +0 -15
- package/dist/video/index.d.ts +0 -3
- package/dist/video/props.d.ts +0 -21
- package/dist/wrap-remotion-context.d.ts +0 -14
- package/dist/wrap-remotion-context.js +0 -65
- package/ensure-correct-version.js +0 -24
- package/tsconfig.json +0 -12
- package/version.d.ts +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.EditorPropsProvider = exports.EditorPropsContext = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
exports.EditorPropsContext = (0, react_1.createContext)({
|
|
30
|
+
props: {},
|
|
31
|
+
updateProps: () => {
|
|
32
|
+
throw new Error('Not implemented');
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const EditorPropsProvider = ({ children }) => {
|
|
36
|
+
const [props, setProps] = react_1.default.useState({});
|
|
37
|
+
const updateProps = (0, react_1.useCallback)(({ defaultProps, id, newProps, }) => {
|
|
38
|
+
setProps((prev) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return {
|
|
41
|
+
...prev,
|
|
42
|
+
[id]: typeof newProps === 'function'
|
|
43
|
+
? newProps((_a = prev[id]) !== null && _a !== void 0 ? _a : defaultProps)
|
|
44
|
+
: newProps,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}, []);
|
|
48
|
+
const ctx = (0, react_1.useMemo)(() => {
|
|
49
|
+
return { props, updateProps };
|
|
50
|
+
}, [props, updateProps]);
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(exports.EditorPropsContext.Provider, { value: ctx, children: children }));
|
|
52
|
+
};
|
|
53
|
+
exports.EditorPropsProvider = EditorPropsProvider;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type TFolder = {
|
|
3
3
|
name: string;
|
|
4
4
|
parent: string | null;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type FolderContextType = {
|
|
7
7
|
folderName: string | null;
|
|
8
8
|
parentName: string | null;
|
|
9
9
|
};
|
|
10
10
|
export declare const FolderContext: import("react").Context<FolderContextType>;
|
|
11
|
+
/**
|
|
12
|
+
* @description By wrapping a <Composition /> inside a <Folder />, you can visually categorize it in your sidebar, should you have many compositions.
|
|
13
|
+
* @see [Documentation](https://www.remotion.dev/docs/folder)
|
|
14
|
+
*/
|
|
11
15
|
export declare const Folder: FC<{
|
|
12
16
|
name: string;
|
|
13
17
|
children: React.ReactNode;
|
|
@@ -3,18 +3,22 @@ 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
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
7
|
+
const truthy_js_1 = require("./truthy.js");
|
|
8
|
+
const validate_folder_name_js_1 = require("./validation/validate-folder-name.js");
|
|
9
9
|
exports.FolderContext = (0, react_1.createContext)({
|
|
10
10
|
folderName: null,
|
|
11
11
|
parentName: null,
|
|
12
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* @description By wrapping a <Composition /> inside a <Folder />, you can visually categorize it in your sidebar, should you have many compositions.
|
|
15
|
+
* @see [Documentation](https://www.remotion.dev/docs/folder)
|
|
16
|
+
*/
|
|
13
17
|
const Folder = ({ name, children, }) => {
|
|
14
18
|
const parent = (0, react_1.useContext)(exports.FolderContext);
|
|
15
|
-
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(
|
|
16
|
-
(0,
|
|
17
|
-
const parentNameArr = [parent.parentName, parent.folderName].filter(
|
|
19
|
+
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
20
|
+
(0, validate_folder_name_js_1.validateFolderName)(name);
|
|
21
|
+
const parentNameArr = [parent.parentName, parent.folderName].filter(truthy_js_1.truthy);
|
|
18
22
|
const parentName = parentNameArr.length === 0 ? null : parentNameArr.join('/');
|
|
19
23
|
const value = (0, react_1.useMemo)(() => {
|
|
20
24
|
return {
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @description The <IFrame /> can be used like a regular <iframe> HTML tag.
|
|
4
|
+
* @see [Documentation](https://www.remotion.dev/docs/iframe)
|
|
5
|
+
*/
|
|
2
6
|
export declare const IFrame: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>, "key" | keyof React.IframeHTMLAttributes<HTMLIFrameElement>> & React.RefAttributes<HTMLIFrameElement>>;
|
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IFrame = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const delay_render_js_1 = require("./delay-render.js");
|
|
7
7
|
const IFrameRefForwarding = ({ onLoad, onError, ...props }, ref) => {
|
|
8
|
-
const [handle] = (0, react_1.useState)(() => (0,
|
|
8
|
+
const [handle] = (0, react_1.useState)(() => (0, delay_render_js_1.delayRender)(`Loading <IFrame> with source ${props.src}`));
|
|
9
9
|
const didLoad = (0, react_1.useCallback)((e) => {
|
|
10
|
-
(0,
|
|
10
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
11
11
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
|
|
12
12
|
}, [handle, onLoad]);
|
|
13
13
|
const didGetError = (0, react_1.useCallback)((e) => {
|
|
14
|
-
(0,
|
|
14
|
+
(0, delay_render_js_1.continueRender)(handle);
|
|
15
15
|
if (onError) {
|
|
16
16
|
onError(e);
|
|
17
17
|
}
|
|
@@ -21,4 +21,8 @@ const IFrameRefForwarding = ({ onLoad, onError, ...props }, ref) => {
|
|
|
21
21
|
}, [handle, onError]);
|
|
22
22
|
return (0, jsx_runtime_1.jsx)("iframe", { ...props, ref: ref, onError: didGetError, onLoad: didLoad });
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* @description The <IFrame /> can be used like a regular <iframe> HTML tag.
|
|
26
|
+
* @see [Documentation](https://www.remotion.dev/docs/iframe)
|
|
27
|
+
*/
|
|
24
28
|
exports.IFrame = (0, react_1.forwardRef)(IFrameRefForwarding);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
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
|
+
* @see [Documentation](https://www.remotion.dev/docs/img)
|
|
5
|
+
*/
|
|
6
|
+
export declare const Img: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src"> & {
|
|
7
|
+
maxRetries?: number | undefined;
|
|
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
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Img = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cancel_render_js_1 = require("./cancel-render.js");
|
|
7
|
+
const delay_render_js_1 = require("./delay-render.js");
|
|
8
|
+
const prefetch_js_1 = require("./prefetch.js");
|
|
9
|
+
function exponentialBackoff(errorCount) {
|
|
10
|
+
return 1000 * 2 ** (errorCount - 1);
|
|
11
|
+
}
|
|
12
|
+
const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
13
|
+
const imageRef = (0, react_1.useRef)(null);
|
|
14
|
+
const errors = (0, react_1.useRef)({});
|
|
15
|
+
if (!src) {
|
|
16
|
+
throw new Error('No "src" prop was passed to <Img>.');
|
|
17
|
+
}
|
|
18
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
19
|
+
return imageRef.current;
|
|
20
|
+
}, []);
|
|
21
|
+
const actualSrc = (0, prefetch_js_1.usePreload)(src);
|
|
22
|
+
const retryIn = (0, react_1.useCallback)((timeout) => {
|
|
23
|
+
if (!imageRef.current) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const currentSrc = imageRef.current.src;
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
if (!imageRef.current) {
|
|
30
|
+
// Component has been unmounted, do not retry
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const newSrc = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src;
|
|
34
|
+
if (newSrc !== currentSrc) {
|
|
35
|
+
// src has changed, do not retry
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
imageRef.current.removeAttribute('src');
|
|
39
|
+
imageRef.current.setAttribute('src', newSrc);
|
|
40
|
+
}, timeout);
|
|
41
|
+
}, []);
|
|
42
|
+
const didGetError = (0, react_1.useCallback)((e) => {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
44
|
+
if (!errors.current) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src] =
|
|
48
|
+
((_c = errors.current[(_b = imageRef.current) === null || _b === void 0 ? void 0 : _b.src]) !== null && _c !== void 0 ? _c : 0) + 1;
|
|
49
|
+
if (onError &&
|
|
50
|
+
((_e = errors.current[(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src]) !== null && _e !== void 0 ? _e : 0) > maxRetries) {
|
|
51
|
+
onError(e);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (((_g = errors.current[(_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.src]) !== null && _g !== void 0 ? _g : 0) <= maxRetries) {
|
|
55
|
+
const backoff = exponentialBackoff((_j = errors.current[(_h = imageRef.current) === null || _h === void 0 ? void 0 : _h.src]) !== null && _j !== void 0 ? _j : 0);
|
|
56
|
+
console.warn(`Could not load image with source ${(_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src}, retrying again in ${backoff}ms`);
|
|
57
|
+
retryIn(backoff);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(0, cancel_render_js_1.cancelRender)('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
|
|
61
|
+
}, [maxRetries, onError, retryIn]);
|
|
62
|
+
if (typeof window !== 'undefined') {
|
|
63
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
64
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
65
|
+
if (process.env.NODE_ENV === 'test') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + src);
|
|
69
|
+
const { current } = imageRef;
|
|
70
|
+
const onComplete = () => {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
72
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
73
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
74
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
75
|
+
}
|
|
76
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
77
|
+
};
|
|
78
|
+
const didLoad = () => {
|
|
79
|
+
onComplete();
|
|
80
|
+
};
|
|
81
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
82
|
+
onComplete();
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
86
|
+
}
|
|
87
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
88
|
+
return () => {
|
|
89
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
90
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
91
|
+
};
|
|
92
|
+
}, [src]);
|
|
93
|
+
}
|
|
94
|
+
return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @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.
|
|
98
|
+
* @see [Documentation](https://www.remotion.dev/docs/img)
|
|
99
|
+
*/
|
|
100
|
+
exports.Img = (0, react_1.forwardRef)(ImgRefForwarding);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
export type ClipRegion = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
} | 'hide';
|
|
8
|
+
export type TNativeLayersContext = {
|
|
9
|
+
clipRegion: ClipRegion | null;
|
|
10
|
+
setClipRegion: React.Dispatch<React.SetStateAction<ClipRegion | null>>;
|
|
11
|
+
};
|
|
12
|
+
export declare const NativeLayersContext: import("react").Context<TNativeLayersContext>;
|
|
13
|
+
export declare const NativeLayersProvider: React.FC<PropsWithChildren>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NativeLayersProvider = exports.NativeLayersContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.NativeLayersContext = (0, react_1.createContext)({
|
|
7
|
+
setClipRegion: () => {
|
|
8
|
+
throw new Error('NativeLayers not set');
|
|
9
|
+
},
|
|
10
|
+
clipRegion: null,
|
|
11
|
+
});
|
|
12
|
+
const NativeLayersProvider = ({ children, }) => {
|
|
13
|
+
const [clipRegion, setClipRegion] = (0, react_1.useState)(null);
|
|
14
|
+
const context = (0, react_1.useMemo)(() => {
|
|
15
|
+
return {
|
|
16
|
+
setClipRegion,
|
|
17
|
+
clipRegion,
|
|
18
|
+
};
|
|
19
|
+
}, [clipRegion, setClipRegion]);
|
|
20
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
21
|
+
if (typeof window !== 'undefined') {
|
|
22
|
+
window.remotion_getClipRegion = () => {
|
|
23
|
+
return clipRegion;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, [clipRegion, setClipRegion]);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(exports.NativeLayersContext.Provider, { value: context, children: children }));
|
|
28
|
+
};
|
|
29
|
+
exports.NativeLayersProvider = NativeLayersProvider;
|
package/dist/cjs/Null.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Null = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const NativeLayers_js_1 = require("./NativeLayers.js");
|
|
6
|
+
const Null = () => {
|
|
7
|
+
const { setClipRegion } = (0, react_1.useContext)(NativeLayers_js_1.NativeLayersContext);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
setClipRegion((c) => {
|
|
10
|
+
if (c === null) {
|
|
11
|
+
return 'hide';
|
|
12
|
+
}
|
|
13
|
+
// Rendering multiple <Null> is fine, because they are all hidden
|
|
14
|
+
if (c === 'hide') {
|
|
15
|
+
return 'hide';
|
|
16
|
+
}
|
|
17
|
+
throw new Error('Cannot render <Null>, because another component clipping the region was already rendered (most likely <Clipper>)');
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
setClipRegion(null);
|
|
21
|
+
};
|
|
22
|
+
}, [setClipRegion]);
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
exports.Null = Null;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemotionRoot = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const CompositionManager_js_1 = require("./CompositionManager.js");
|
|
7
|
+
const delay_render_js_1 = require("./delay-render.js");
|
|
8
|
+
const EditorProps_js_1 = require("./EditorProps.js");
|
|
9
|
+
const NativeLayers_js_1 = require("./NativeLayers.js");
|
|
10
|
+
const nonce_js_1 = require("./nonce.js");
|
|
11
|
+
const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
12
|
+
const random_js_1 = require("./random.js");
|
|
13
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
14
|
+
const duration_state_js_1 = require("./video/duration-state.js");
|
|
15
|
+
const RemotionRoot = ({ children, numberOfAudioTags }) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const [remotionRootId] = (0, react_1.useState)(() => String((0, random_js_1.random)(null)));
|
|
18
|
+
const [frame, setFrame] = (0, react_1.useState)((_a = window.remotion_initialFrame) !== null && _a !== void 0 ? _a : 0);
|
|
19
|
+
const [playing, setPlaying] = (0, react_1.useState)(false);
|
|
20
|
+
const imperativePlaying = (0, react_1.useRef)(false);
|
|
21
|
+
const [fastRefreshes, setFastRefreshes] = (0, react_1.useState)(0);
|
|
22
|
+
const [playbackRate, setPlaybackRate] = (0, react_1.useState)(1);
|
|
23
|
+
const audioAndVideoTags = (0, react_1.useRef)([]);
|
|
24
|
+
if (typeof window !== 'undefined') {
|
|
25
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
26
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
27
|
+
window.remotion_setFrame = (f) => {
|
|
28
|
+
const id = (0, delay_render_js_1.delayRender)(`Setting the current frame to ${f}`);
|
|
29
|
+
setFrame(f);
|
|
30
|
+
requestAnimationFrame(() => (0, delay_render_js_1.continueRender)(id));
|
|
31
|
+
};
|
|
32
|
+
window.remotion_isPlayer = false;
|
|
33
|
+
}, []);
|
|
34
|
+
}
|
|
35
|
+
const timelineContextValue = (0, react_1.useMemo)(() => {
|
|
36
|
+
return {
|
|
37
|
+
frame,
|
|
38
|
+
playing,
|
|
39
|
+
imperativePlaying,
|
|
40
|
+
rootId: remotionRootId,
|
|
41
|
+
playbackRate,
|
|
42
|
+
setPlaybackRate,
|
|
43
|
+
audioAndVideoTags,
|
|
44
|
+
};
|
|
45
|
+
}, [frame, playbackRate, playing, remotionRootId]);
|
|
46
|
+
const setTimelineContextValue = (0, react_1.useMemo)(() => {
|
|
47
|
+
return {
|
|
48
|
+
setFrame,
|
|
49
|
+
setPlaying,
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
const nonceContext = (0, react_1.useMemo)(() => {
|
|
53
|
+
let counter = 0;
|
|
54
|
+
return {
|
|
55
|
+
getNonce: () => counter++,
|
|
56
|
+
fastRefreshes,
|
|
57
|
+
};
|
|
58
|
+
}, [fastRefreshes]);
|
|
59
|
+
(0, react_1.useEffect)(() => {
|
|
60
|
+
if (typeof __webpack_module__ !== 'undefined') {
|
|
61
|
+
if (__webpack_module__.hot) {
|
|
62
|
+
__webpack_module__.hot.addStatusHandler((status) => {
|
|
63
|
+
if (status === 'idle') {
|
|
64
|
+
setFastRefreshes((i) => i + 1);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(NativeLayers_js_1.NativeLayersProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_js_1.CompositionManagerProvider, { numberOfAudioTags: numberOfAudioTags, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: children }) }) }) }) }) }) }) }));
|
|
71
|
+
};
|
|
72
|
+
exports.RemotionRoot = RemotionRoot;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { AnyComposition } from './CompositionManager.js';
|
|
3
|
+
import type { VideoConfig } from './video-config.js';
|
|
4
|
+
type ResolveCompositionConfigContect = Record<string, VideoConfigState | undefined>;
|
|
5
|
+
export declare const ResolveCompositionContext: import("react").Context<ResolveCompositionConfigContect | null>;
|
|
6
|
+
export declare const resolveCompositionsRef: import("react").RefObject<{
|
|
7
|
+
setCurrentRenderModalComposition: (compositionId: string | null) => void;
|
|
8
|
+
reloadCurrentlySelectedComposition: () => void;
|
|
9
|
+
}>;
|
|
10
|
+
type VideoConfigState = {
|
|
11
|
+
type: 'loading';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'success';
|
|
14
|
+
result: VideoConfig;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'error';
|
|
17
|
+
error: Error;
|
|
18
|
+
};
|
|
19
|
+
export declare const ResolveCompositionConfig: React.FC<PropsWithChildren<{
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const needsResolution: (composition: AnyComposition) => boolean;
|
|
23
|
+
export declare const useResolvedVideoConfig: (preferredCompositionId: string | null) => VideoConfigState | null;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useResolvedVideoConfig = exports.needsResolution = 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 input_props_js_1 = require("./config/input-props.js");
|
|
8
|
+
const EditorProps_js_1 = require("./EditorProps.js");
|
|
9
|
+
const get_environment_js_1 = require("./get-environment.js");
|
|
10
|
+
const resolve_video_config_js_1 = require("./resolve-video-config.js");
|
|
11
|
+
exports.ResolveCompositionContext = (0, react_1.createContext)(null);
|
|
12
|
+
exports.resolveCompositionsRef = (0, react_1.createRef)();
|
|
13
|
+
const ResolveCompositionConfig = ({ children }) => {
|
|
14
|
+
const [currentRenderModalComposition, setCurrentRenderModalComposition] = (0, react_1.useState)(null);
|
|
15
|
+
const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
16
|
+
const selectedComposition = compositions.find((c) => c.id === currentComposition);
|
|
17
|
+
const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
|
|
18
|
+
const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
|
|
19
|
+
const [resolvedConfigs, setResolvedConfigs] = (0, react_1.useState)({});
|
|
20
|
+
const selectedEditorProps = (0, react_1.useMemo)(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
return selectedComposition
|
|
23
|
+
? (_a = allEditorProps[selectedComposition.id]) !== null && _a !== void 0 ? _a : {}
|
|
24
|
+
: {};
|
|
25
|
+
}, [allEditorProps, selectedComposition]);
|
|
26
|
+
const renderModalProps = (0, react_1.useMemo)(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
return renderModalComposition
|
|
29
|
+
? (_a = allEditorProps[renderModalComposition.id]) !== null && _a !== void 0 ? _a : {}
|
|
30
|
+
: {};
|
|
31
|
+
}, [allEditorProps, renderModalComposition]);
|
|
32
|
+
const doResolution = (0, react_1.useCallback)((composition, editorProps) => {
|
|
33
|
+
const controller = new AbortController();
|
|
34
|
+
if (currentCompositionMetadata) {
|
|
35
|
+
return controller;
|
|
36
|
+
}
|
|
37
|
+
const { signal } = controller;
|
|
38
|
+
const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({ composition, editorProps, signal });
|
|
39
|
+
if (typeof promOrNot === 'object' && 'then' in promOrNot) {
|
|
40
|
+
setResolvedConfigs((r) => ({
|
|
41
|
+
...r,
|
|
42
|
+
[composition.id]: {
|
|
43
|
+
type: 'loading',
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
promOrNot
|
|
47
|
+
.then((c) => {
|
|
48
|
+
if (controller.signal.aborted) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
setResolvedConfigs((r) => ({
|
|
52
|
+
...r,
|
|
53
|
+
[composition.id]: {
|
|
54
|
+
type: 'success',
|
|
55
|
+
result: c,
|
|
56
|
+
},
|
|
57
|
+
}));
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
if (controller.signal.aborted) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setResolvedConfigs((r) => ({
|
|
64
|
+
...r,
|
|
65
|
+
[composition.id]: {
|
|
66
|
+
type: 'error',
|
|
67
|
+
error: err,
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
setResolvedConfigs((r) => ({
|
|
74
|
+
...r,
|
|
75
|
+
[composition.id]: {
|
|
76
|
+
type: 'success',
|
|
77
|
+
result: promOrNot,
|
|
78
|
+
},
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
return controller;
|
|
82
|
+
}, [currentCompositionMetadata]);
|
|
83
|
+
(0, react_1.useImperativeHandle)(exports.resolveCompositionsRef, () => {
|
|
84
|
+
return {
|
|
85
|
+
setCurrentRenderModalComposition: (id) => {
|
|
86
|
+
setCurrentRenderModalComposition(id);
|
|
87
|
+
},
|
|
88
|
+
reloadCurrentlySelectedComposition: () => {
|
|
89
|
+
var _a;
|
|
90
|
+
if (!currentComposition) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const composition = compositions.find((c) => c.id === currentComposition);
|
|
94
|
+
if (!composition) {
|
|
95
|
+
throw new Error(`Could not find composition with id ${currentComposition}`);
|
|
96
|
+
}
|
|
97
|
+
const editorProps = (_a = allEditorProps[currentComposition]) !== null && _a !== void 0 ? _a : {};
|
|
98
|
+
doResolution(composition, editorProps);
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}, [allEditorProps, compositions, currentComposition, doResolution]);
|
|
102
|
+
const isTheSame = (selectedComposition === null || selectedComposition === void 0 ? void 0 : selectedComposition.id) === (renderModalComposition === null || renderModalComposition === void 0 ? void 0 : renderModalComposition.id);
|
|
103
|
+
(0, react_1.useEffect)(() => {
|
|
104
|
+
if (selectedComposition && (0, exports.needsResolution)(selectedComposition)) {
|
|
105
|
+
const controller = doResolution(selectedComposition, selectedEditorProps);
|
|
106
|
+
return () => {
|
|
107
|
+
controller.abort();
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}, [doResolution, selectedComposition, selectedEditorProps]);
|
|
111
|
+
(0, react_1.useEffect)(() => {
|
|
112
|
+
if (renderModalComposition && !isTheSame) {
|
|
113
|
+
const controller = doResolution(renderModalComposition, renderModalProps);
|
|
114
|
+
return () => {
|
|
115
|
+
controller.abort();
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}, [doResolution, isTheSame, renderModalComposition, renderModalProps]);
|
|
119
|
+
const resolvedConfigsIncludingStaticOnes = (0, react_1.useMemo)(() => {
|
|
120
|
+
const staticComps = compositions.filter((c) => {
|
|
121
|
+
return c.calculateMetadata === null;
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
...resolvedConfigs,
|
|
125
|
+
...staticComps.reduce((acc, curr) => {
|
|
126
|
+
var _a;
|
|
127
|
+
return {
|
|
128
|
+
...acc,
|
|
129
|
+
[curr.id]: {
|
|
130
|
+
type: 'success',
|
|
131
|
+
result: { ...curr, defaultProps: (_a = curr.defaultProps) !== null && _a !== void 0 ? _a : {} },
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}, {}),
|
|
135
|
+
};
|
|
136
|
+
}, [compositions, resolvedConfigs]);
|
|
137
|
+
return ((0, jsx_runtime_1.jsx)(exports.ResolveCompositionContext.Provider, { value: resolvedConfigsIncludingStaticOnes, children: children }));
|
|
138
|
+
};
|
|
139
|
+
exports.ResolveCompositionConfig = ResolveCompositionConfig;
|
|
140
|
+
const needsResolution = (composition) => {
|
|
141
|
+
return Boolean(composition.calculateMetadata);
|
|
142
|
+
};
|
|
143
|
+
exports.needsResolution = needsResolution;
|
|
144
|
+
const useResolvedVideoConfig = (preferredCompositionId) => {
|
|
145
|
+
const context = (0, react_1.useContext)(exports.ResolveCompositionContext);
|
|
146
|
+
const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
|
|
147
|
+
const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
|
|
148
|
+
const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
|
|
149
|
+
const composition = compositions.find((c) => c.id === compositionId);
|
|
150
|
+
const selectedEditorProps = (0, react_1.useMemo)(() => {
|
|
151
|
+
var _a;
|
|
152
|
+
return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
|
|
153
|
+
}, [allEditorProps, composition]);
|
|
154
|
+
return (0, react_1.useMemo)(() => {
|
|
155
|
+
var _a, _b, _c;
|
|
156
|
+
if (!composition) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
if (currentCompositionMetadata) {
|
|
160
|
+
return {
|
|
161
|
+
type: 'success',
|
|
162
|
+
result: {
|
|
163
|
+
...currentCompositionMetadata,
|
|
164
|
+
id: composition.id,
|
|
165
|
+
defaultProps: (_a = currentCompositionMetadata.defaultProps) !== null && _a !== void 0 ? _a : {},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (!(0, exports.needsResolution)(composition)) {
|
|
170
|
+
return {
|
|
171
|
+
type: 'success',
|
|
172
|
+
result: {
|
|
173
|
+
...composition,
|
|
174
|
+
defaultProps: {
|
|
175
|
+
...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
|
|
176
|
+
...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
|
|
177
|
+
...(typeof window === 'undefined' ||
|
|
178
|
+
(0, get_environment_js_1.getRemotionEnvironment)() === 'player-development' ||
|
|
179
|
+
(0, get_environment_js_1.getRemotionEnvironment)() === 'player-production'
|
|
180
|
+
? {}
|
|
181
|
+
: (_c = (0, input_props_js_1.getInputProps)()) !== null && _c !== void 0 ? _c : {}),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (!context[composition.id]) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
return context[composition.id];
|
|
190
|
+
}, [composition, context, currentCompositionMetadata, selectedEditorProps]);
|
|
191
|
+
};
|
|
192
|
+
exports.useResolvedVideoConfig = useResolvedVideoConfig;
|