remotion 4.0.0-reorg.8 → 4.0.0-resetpath.13
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 +29 -18
- package/dist/AbsoluteFill.d.ts +1 -2
- package/dist/AbsoluteFill.js +7 -7
- package/dist/CanUseRemotionHooks.d.ts +0 -0
- package/dist/CanUseRemotionHooks.js +0 -0
- package/dist/Clipper.d.ts +7 -0
- package/dist/Clipper.js +24 -0
- package/dist/Composition.d.ts +2 -1
- package/dist/Composition.js +24 -9
- package/dist/CompositionManager.d.ts +6 -6
- package/dist/CompositionManager.js +9 -3
- package/dist/Folder.d.ts +0 -0
- package/dist/Folder.js +0 -0
- package/dist/IFrame.d.ts +0 -0
- package/dist/IFrame.js +0 -0
- package/dist/Img.d.ts +0 -0
- package/dist/Img.js +31 -24
- package/dist/LayerMaster.d.ts +8 -0
- package/dist/LayerMaster.js +39 -0
- package/dist/NativeLayers.d.ts +13 -0
- package/dist/NativeLayers.js +29 -0
- package/dist/Null.d.ts +2 -0
- package/dist/Null.js +25 -0
- package/dist/RemotionRoot.d.ts +1 -0
- package/dist/RemotionRoot.js +9 -6
- package/dist/Sequence.d.ts +7 -4
- package/dist/Sequence.js +25 -21
- package/dist/Still.d.ts +0 -0
- package/dist/Still.js +0 -0
- package/dist/absolute-src.d.ts +0 -0
- package/dist/absolute-src.js +0 -0
- package/dist/asset-types.d.ts +0 -0
- package/dist/asset-types.js +0 -0
- package/dist/audio/Audio.d.ts +4 -2
- package/dist/audio/Audio.js +24 -4
- package/dist/audio/AudioForDevelopment.d.ts +6 -2
- package/dist/audio/AudioForDevelopment.js +35 -9
- package/dist/audio/AudioForRendering.d.ts +9 -2
- package/dist/audio/AudioForRendering.js +48 -5
- package/dist/audio/index.d.ts +0 -0
- package/dist/audio/index.js +0 -0
- package/dist/audio/props.d.ts +3 -1
- package/dist/audio/props.js +0 -0
- package/dist/audio/shared-audio-tags.d.ts +5 -1
- package/dist/audio/shared-audio-tags.js +42 -13
- package/dist/audio/use-audio-frame.d.ts +0 -0
- package/dist/audio/use-audio-frame.js +0 -0
- package/dist/bezier.d.ts +0 -0
- package/dist/bezier.js +0 -0
- package/dist/config/input-props.d.ts +0 -0
- package/dist/config/input-props.js +0 -0
- package/dist/config.d.ts +98 -1
- package/dist/config.js +0 -0
- package/dist/default-css.d.ts +0 -0
- package/dist/default-css.js +0 -0
- package/dist/delay-render.d.ts +0 -0
- package/dist/delay-render.js +0 -0
- package/dist/easing.d.ts +0 -0
- package/dist/easing.js +0 -0
- package/dist/freeze.d.ts +0 -0
- package/dist/freeze.js +0 -0
- package/dist/get-asset-file-name.d.ts +0 -0
- package/dist/get-asset-file-name.js +0 -0
- package/dist/get-compositions-from-markup.d.ts +3 -0
- package/dist/get-compositions-from-markup.js +19 -0
- package/dist/get-environment.d.ts +1 -0
- package/dist/get-environment.js +14 -2
- package/dist/get-preview-dom-element.d.ts +0 -0
- package/dist/get-preview-dom-element.js +0 -0
- package/dist/get-static-files.d.ts +17 -0
- package/dist/get-static-files.js +31 -0
- package/dist/get-timeline-clip-name.d.ts +0 -0
- package/dist/get-timeline-clip-name.js +2 -1
- package/dist/index.d.ts +31 -3
- package/dist/index.js +16 -2
- package/dist/internals.d.ts +32 -5
- package/dist/internals.js +8 -2
- package/dist/interpolate-colors.d.ts +0 -0
- package/dist/interpolate-colors.js +0 -0
- package/dist/interpolate.d.ts +0 -0
- package/dist/interpolate.js +0 -0
- package/dist/is-approximately-the-same.d.ts +0 -0
- package/dist/is-approximately-the-same.js +0 -0
- package/dist/is-player.d.ts +3 -0
- package/dist/is-player.js +14 -0
- package/dist/layers.d.ts +24 -0
- package/dist/layers.js +149 -0
- package/dist/loading-indicator.d.ts +0 -0
- package/dist/loading-indicator.js +0 -0
- package/dist/loop/index.d.ts +2 -2
- package/dist/loop/index.js +7 -5
- package/dist/multiple-versions-warning.d.ts +0 -0
- package/dist/multiple-versions-warning.js +23 -4
- package/dist/nonce.d.ts +0 -0
- package/dist/nonce.js +0 -0
- package/dist/play-and-handle-not-allowed-error.d.ts +0 -0
- package/dist/play-and-handle-not-allowed-error.js +4 -0
- package/dist/portal-node.d.ts +0 -0
- package/dist/portal-node.js +0 -0
- package/dist/prefetch-state.d.ts +8 -0
- package/dist/prefetch-state.js +27 -0
- package/dist/prefetch.d.ts +9 -0
- package/dist/prefetch.js +108 -0
- package/dist/random.d.ts +2 -1
- package/dist/random.js +0 -0
- package/dist/register-root.d.ts +0 -0
- package/dist/register-root.js +3 -0
- package/dist/series/flatten-children.d.ts +1 -1
- package/dist/series/flatten-children.js +0 -0
- package/dist/series/index.d.ts +3 -3
- package/dist/series/index.js +4 -2
- package/dist/setup-env-variables.d.ts +0 -0
- package/dist/setup-env-variables.js +0 -0
- package/dist/spring/index.d.ts +0 -0
- package/dist/spring/index.js +0 -0
- package/dist/spring/measure-spring.d.ts +0 -0
- package/dist/spring/measure-spring.js +0 -0
- package/dist/spring/spring-utils.d.ts +0 -0
- package/dist/spring/spring-utils.js +0 -0
- package/dist/static-file.d.ts +4 -0
- package/dist/static-file.js +10 -0
- package/dist/timeline-position-state.d.ts +0 -0
- package/dist/timeline-position-state.js +0 -0
- package/dist/truthy.d.ts +0 -0
- package/dist/truthy.js +0 -0
- package/dist/use-current-frame.d.ts +0 -1
- package/dist/use-current-frame.js +2 -7
- package/dist/use-lazy-component.d.ts +0 -0
- package/dist/use-lazy-component.js +0 -0
- package/dist/use-media-in-timeline.d.ts +2 -1
- package/dist/use-media-in-timeline.js +13 -6
- package/dist/use-media-playback.d.ts +3 -1
- package/dist/use-media-playback.js +6 -4
- package/dist/use-media-tag-volume.d.ts +0 -0
- package/dist/use-media-tag-volume.js +0 -0
- package/dist/use-sync-volume-with-media-tag.d.ts +0 -0
- package/dist/use-sync-volume-with-media-tag.js +1 -0
- package/dist/use-unsafe-video-config.d.ts +0 -0
- package/dist/use-unsafe-video-config.js +0 -0
- package/dist/use-video-config.d.ts +0 -0
- package/dist/use-video-config.js +4 -1
- package/dist/use-video.d.ts +13 -1
- package/dist/use-video.js +16 -3
- package/dist/validate-media-props.d.ts +0 -0
- package/dist/validate-media-props.js +0 -0
- package/dist/validate-start-from-props.d.ts +0 -0
- package/dist/validate-start-from-props.js +0 -0
- package/dist/validation/validate-composition-id.d.ts +0 -0
- package/dist/validation/validate-composition-id.js +0 -0
- package/dist/validation/validate-dimensions.d.ts +0 -0
- package/dist/validation/validate-dimensions.js +0 -0
- package/dist/validation/validate-duration-in-frames.d.ts +0 -0
- package/dist/validation/validate-duration-in-frames.js +0 -0
- package/dist/validation/validate-folder-name.d.ts +0 -0
- package/dist/validation/validate-folder-name.js +0 -0
- package/dist/validation/validate-fps.d.ts +0 -0
- package/dist/validation/validate-fps.js +1 -1
- package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -0
- package/dist/validation/validate-offthreadvideo-image-format.js +0 -0
- package/dist/validation/validation-spring-duration.d.ts +0 -0
- package/dist/validation/validation-spring-duration.js +0 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/video/NativeVideo.d.ts +5 -0
- package/dist/video/NativeVideo.js +33 -0
- package/dist/video/NativeVideoForRendering.d.ts +8 -0
- package/dist/video/NativeVideoForRendering.js +14 -0
- package/dist/video/OffthreadVideo.d.ts +1 -1
- package/dist/video/OffthreadVideo.js +8 -2
- package/dist/video/OffthreadVideoForRendering.d.ts +0 -0
- package/dist/video/OffthreadVideoForRendering.js +13 -4
- package/dist/video/Video.d.ts +4 -2
- package/dist/video/Video.js +25 -4
- package/dist/video/VideoForDevelopment.d.ts +6 -2
- package/dist/video/VideoForDevelopment.js +74 -7
- package/dist/video/VideoForRendering.d.ts +9 -2
- package/dist/video/VideoForRendering.js +77 -23
- package/dist/video/duration-state.d.ts +17 -0
- package/dist/video/duration-state.js +34 -0
- package/dist/video/get-current-time.d.ts +0 -0
- package/dist/video/get-current-time.js +0 -0
- package/dist/video/index.d.ts +0 -0
- package/dist/video/index.js +0 -0
- package/dist/video/props.d.ts +5 -1
- package/dist/video/props.js +0 -0
- package/dist/video/video-fragment.d.ts +12 -0
- package/dist/video/video-fragment.js +60 -0
- package/dist/video-config.d.ts +0 -0
- package/dist/video-config.js +0 -0
- package/dist/volume-position-state.d.ts +0 -0
- package/dist/volume-position-state.js +0 -0
- package/dist/volume-prop.d.ts +2 -1
- package/dist/volume-prop.js +4 -3
- package/dist/warn-about-non-seekable-media.d.ts +0 -0
- package/dist/warn-about-non-seekable-media.js +1 -1
- package/dist/wrap-remotion-context.d.ts +4 -0
- package/dist/wrap-remotion-context.js +9 -1
- package/package.json +22 -11
- package/.turbo/turbo-build.log +0 -5
- package/dist/compress-assets.d.ts +0 -7
- package/dist/compress-assets.js +0 -25
- package/dist/config/browser-executable.d.ts +0 -3
- package/dist/config/browser-executable.js +0 -12
- package/dist/config/browser.d.ts +0 -4
- package/dist/config/browser.js +0 -19
- package/dist/config/chromium-flags.d.ts +0 -10
- package/dist/config/chromium-flags.js +0 -34
- package/dist/config/codec.d.ts +0 -16
- package/dist/config/codec.js +0 -109
- package/dist/config/concurrency.d.ts +0 -3
- package/dist/config/concurrency.js +0 -12
- package/dist/config/crf.d.ts +0 -9
- package/dist/config/crf.js +0 -83
- package/dist/config/env-file.d.ts +0 -2
- package/dist/config/env-file.js +0 -10
- package/dist/config/every-nth-frame.d.ts +0 -3
- package/dist/config/every-nth-frame.js +0 -20
- package/dist/config/ffmpeg-executable.d.ts +0 -5
- package/dist/config/ffmpeg-executable.js +0 -21
- package/dist/config/frame-range.d.ts +0 -5
- package/dist/config/frame-range.js +0 -80
- package/dist/config/image-format.d.ts +0 -8
- package/dist/config/image-format.js +0 -37
- package/dist/config/image-sequence.d.ts +0 -3
- package/dist/config/image-sequence.js +0 -15
- package/dist/config/index.d.ts +0 -182
- package/dist/config/index.js +0 -198
- package/dist/config/log.d.ts +0 -7
- package/dist/config/log.js +0 -25
- package/dist/config/max-timeline-tracks.d.ts +0 -2
- package/dist/config/max-timeline-tracks.js +0 -24
- package/dist/config/number-of-gif-loops.d.ts +0 -4
- package/dist/config/number-of-gif-loops.js +0 -21
- package/dist/config/output-location.d.ts +0 -2
- package/dist/config/output-location.js +0 -16
- package/dist/config/override-webpack.d.ts +0 -6
- package/dist/config/override-webpack.js +0 -14
- package/dist/config/overwrite.d.ts +0 -3
- package/dist/config/overwrite.js +0 -14
- package/dist/config/pixel-format.d.ts +0 -8
- package/dist/config/pixel-format.js +0 -38
- package/dist/config/preview-server.d.ts +0 -2
- package/dist/config/preview-server.js +0 -20
- package/dist/config/prores-profile.d.ts +0 -7
- package/dist/config/prores-profile.js +0 -32
- package/dist/config/quality.d.ts +0 -2
- package/dist/config/quality.js +0 -17
- package/dist/config/scale.d.ts +0 -3
- package/dist/config/scale.js +0 -15
- package/dist/config/still-frame.d.ts +0 -2
- package/dist/config/still-frame.js +0 -12
- package/dist/config/timeout.d.ts +0 -2
- package/dist/config/timeout.js +0 -17
- package/dist/config/webpack-caching.d.ts +0 -3
- package/dist/config/webpack-caching.js +0 -16
- package/dist/feature-flags.d.ts +0 -1
- package/dist/feature-flags.js +0 -7
- package/dist/is-audio-codec.d.ts +0 -2
- package/dist/is-audio-codec.js +0 -7
- package/dist/perf/index.d.ts +0 -5
- package/dist/perf/index.js +0 -35
- package/dist/timeline-inout-position-state.d.ts +0 -12
- package/dist/timeline-inout-position-state.js +0 -23
- package/dist/timeout.d.ts +0 -2
- package/dist/timeout.js +0 -12
- package/dist/validation/validate-every-nth-frame.d.ts +0 -1
- package/dist/validation/validate-every-nth-frame.js +0 -21
- package/dist/validation/validate-frame.d.ts +0 -1
- package/dist/validation/validate-frame.js +0 -24
- package/dist/validation/validate-image-format.d.ts +0 -2
- package/dist/validation/validate-image-format.js +0 -9
- package/dist/validation/validate-opengl-renderer.d.ts +0 -4
- package/dist/validation/validate-opengl-renderer.js +0 -14
- package/dist/validation/validate-quality.d.ts +0 -1
- package/dist/validation/validate-quality.js +0 -21
package/LICENSE.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# Remotion License
|
|
2
2
|
|
|
3
|
-
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion create videos for free (even commercial), while a company license is required for for-profit
|
|
3
|
+
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
4
4
|
|
|
5
5
|
- [Free license](#free-license)
|
|
6
6
|
- [Company license](#company-license)
|
|
7
7
|
|
|
8
8
|
## Free license
|
|
9
9
|
|
|
10
|
-
Copyright ©
|
|
10
|
+
Copyright © 2023 [Remotion](https://www.remotion.dev/)
|
|
11
11
|
|
|
12
12
|
### Eligibility
|
|
13
13
|
|
|
14
14
|
You are eligible to use Remotion for free if you are:
|
|
15
15
|
|
|
16
16
|
- an individual
|
|
17
|
-
- a for-profit
|
|
18
|
-
- a non-profit or not-for-profit
|
|
17
|
+
- a for-profit organization with up to 3 employees
|
|
18
|
+
- a non-profit or not-for-profit organization
|
|
19
19
|
- evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
|
|
20
20
|
|
|
21
21
|
### Allowed use cases
|
|
22
22
|
|
|
23
|
-
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify
|
|
23
|
+
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
|
|
24
24
|
|
|
25
25
|
### Disallowed use cases
|
|
26
26
|
|
|
27
|
-
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
|
|
27
|
+
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
|
|
28
28
|
|
|
29
29
|
### Warranty notice
|
|
30
30
|
|
|
31
|
-
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and
|
|
31
|
+
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
32
32
|
|
|
33
33
|
### Support
|
|
34
34
|
|
|
@@ -36,6 +36,6 @@ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
|
|
|
36
36
|
|
|
37
37
|
## Company license
|
|
38
38
|
|
|
39
|
-
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
|
|
39
|
+
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](/docs/support)).
|
|
40
40
|
|
|
41
41
|
Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
|
package/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://github.com/remotion-dev/logo">
|
|
3
|
-
<
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/remotion-dev/logo/raw/main/animated-logo-banner-dark.gif">
|
|
5
|
+
<img alt="Animated Remotion Logo" src="https://github.com/remotion-dev/logo/raw/main/animated-logo-banner-light.gif">
|
|
6
|
+
</picture>
|
|
4
7
|
</a>
|
|
5
8
|
</p>
|
|
6
9
|
|
|
7
10
|
[](https://remotion.dev/discord)
|
|
8
|
-
[](https://www.npmjs.org/package/remotion)
|
|
9
12
|
[](https://npmcharts.com/compare/remotion?minimal=true)
|
|
10
13
|
[](https://packagephobia.now.sh/result?p=remotion)
|
|
14
|
+
<a href="https://twitter.com/remotion"><img src="https://img.shields.io/twitter/follow/remotion?label=Twitter&style=social" alt="Twitter"></a>
|
|
11
15
|
|
|
12
|
-
Remotion is a
|
|
16
|
+
Remotion is a framework for **creating videos programmatically using React.**
|
|
13
17
|
|
|
14
18
|
## Why create videos in React?
|
|
15
19
|
|
|
@@ -17,35 +21,42 @@ Remotion is a suite of libraries building a foundation for **creating videos pro
|
|
|
17
21
|
- **Leverage programming**: Use variables, functions, APIs, math and algorithms to create new effects
|
|
18
22
|
- **Leverage React**: Reusable components, Powerful composition, Fast Refresh, Package ecosystem
|
|
19
23
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
## Created with Remotion
|
|
25
|
+
|
|
26
|
+
<table>
|
|
27
|
+
<tr>
|
|
28
|
+
<td align="center">
|
|
29
|
+
<img style="width: 290px" src="packages/docs/static/img/fireship-quick.gif" />
|
|
30
|
+
<p>"This video was made with code" <em>- Fireship</em> <a href="https://youtu.be/deg8bOoziaE">Watch</a> • <a href="https://github.com/wcandillon/remotion-fireship">Source</a></p>
|
|
31
|
+
</td>
|
|
32
|
+
<td align="center">
|
|
33
|
+
<img style="width: 240px" src="packages/docs/static/img/unwrapped-2022.gif" />
|
|
34
|
+
<p>GitHub Unwrapped - Personalized Year in Review <a href="https://www.githubunwrapped.com">Try</a> • <a href="https://github.com/remotion-dev/github-unwrapped-2022">Source</a></p>
|
|
35
|
+
</td>
|
|
36
|
+
<td align="center">
|
|
37
|
+
<em>View more in the <a href="https://remotion.dev/showcase">Remotion Showcase</a>!</em>
|
|
38
|
+
</td>
|
|
39
|
+
</tr>
|
|
40
|
+
</table>
|
|
31
41
|
|
|
32
42
|
## Get started
|
|
33
43
|
|
|
34
|
-
If you already have
|
|
44
|
+
If you already have Node.JS installed, type
|
|
35
45
|
|
|
36
46
|
```console
|
|
37
|
-
|
|
47
|
+
npm init video
|
|
38
48
|
```
|
|
39
49
|
|
|
40
50
|
to get started. Otherwise, read the [installation page](https://www.remotion.dev/docs/) in the documentation.
|
|
41
51
|
|
|
42
52
|
## Documentation
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
Documentation: [**remotion.dev/docs**](https://www.remotion.dev/docs)
|
|
55
|
+
API Reference: [**remotion.dev/api**](https://www.remotion.dev/api)
|
|
45
56
|
|
|
46
57
|
## License
|
|
47
58
|
|
|
48
|
-
Be aware of that Remotion has a special license and requires obtaining a company license in some cases. Read the [LICENSE](LICENSE.md)
|
|
59
|
+
Be aware of that Remotion has a special license and requires obtaining a company license in some cases. Read the [LICENSE](LICENSE.md) page for more information.
|
|
49
60
|
|
|
50
61
|
## Contributing
|
|
51
62
|
|
package/dist/AbsoluteFill.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
/**
|
|
4
3
|
* An absolutely positioned <div> element with 100% width, height, and a column flex style
|
|
5
4
|
* @link https://www.remotion.dev/docs/absolute-fill
|
|
6
5
|
*/
|
|
7
|
-
export declare const AbsoluteFill: React.
|
|
6
|
+
export declare const AbsoluteFill: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
package/dist/AbsoluteFill.js
CHANGED
|
@@ -3,11 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AbsoluteFill = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
|
|
7
|
-
* An absolutely positioned <div> element with 100% width, height, and a column flex style
|
|
8
|
-
* @link https://www.remotion.dev/docs/absolute-fill
|
|
9
|
-
*/
|
|
10
|
-
const AbsoluteFill = (props) => {
|
|
6
|
+
const AbsoluteFillRefForwarding = (props, ref) => {
|
|
11
7
|
const { style, ...other } = props;
|
|
12
8
|
const actualStyle = (0, react_1.useMemo)(() => {
|
|
13
9
|
return {
|
|
@@ -23,6 +19,10 @@ const AbsoluteFill = (props) => {
|
|
|
23
19
|
...style,
|
|
24
20
|
};
|
|
25
21
|
}, [style]);
|
|
26
|
-
return (0, jsx_runtime_1.jsx)("div", { style: actualStyle, ...other });
|
|
22
|
+
return (0, jsx_runtime_1.jsx)("div", { ref: ref, style: actualStyle, ...other });
|
|
27
23
|
};
|
|
28
|
-
|
|
24
|
+
/**
|
|
25
|
+
* An absolutely positioned <div> element with 100% width, height, and a column flex style
|
|
26
|
+
* @link https://www.remotion.dev/docs/absolute-fill
|
|
27
|
+
*/
|
|
28
|
+
exports.AbsoluteFill = (0, react_1.forwardRef)(AbsoluteFillRefForwarding);
|
|
File without changes
|
|
File without changes
|
package/dist/Clipper.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Clipper = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const NativeLayers_1 = require("./NativeLayers");
|
|
6
|
+
const Clipper = ({ height, width, x, y }) => {
|
|
7
|
+
const { setClipRegion } = (0, react_1.useContext)(NativeLayers_1.NativeLayersContext);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
setClipRegion((c) => {
|
|
10
|
+
if (c === 'hide') {
|
|
11
|
+
throw new Error('Cannot render <Clipper>, because another <Null> is already rendered');
|
|
12
|
+
}
|
|
13
|
+
if (c === null) {
|
|
14
|
+
return { height, width, x, y };
|
|
15
|
+
}
|
|
16
|
+
throw new Error('Cannot render <Clipper>, because another component clipping the region was already rendered (most likely <Clipper>)');
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
setClipRegion(null);
|
|
20
|
+
};
|
|
21
|
+
}, [height, setClipRegion, width, x, y]);
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
exports.Clipper = Clipper;
|
package/dist/Composition.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
1
|
+
import type { ComponentType, PropsWithChildren } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
|
|
4
4
|
export declare type CompProps<T> = {
|
|
@@ -19,4 +19,5 @@ declare type CompositionProps<T> = StillProps<T> & {
|
|
|
19
19
|
durationInFrames: number;
|
|
20
20
|
};
|
|
21
21
|
export declare const Composition: <T>({ width, height, fps, durationInFrames, id, defaultProps, ...compProps }: CompositionProps<T>) => React.ReactPortal | null;
|
|
22
|
+
export declare const ClipComposition: React.FC<PropsWithChildren>;
|
|
22
23
|
export {};
|
package/dist/Composition.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Composition = void 0;
|
|
3
|
+
exports.ClipComposition = 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
|
+
const AbsoluteFill_1 = require("./AbsoluteFill");
|
|
7
8
|
const CanUseRemotionHooks_1 = require("./CanUseRemotionHooks");
|
|
8
9
|
const CompositionManager_1 = require("./CompositionManager");
|
|
9
10
|
const input_props_1 = require("./config/input-props");
|
|
@@ -12,6 +13,7 @@ const Folder_1 = require("./Folder");
|
|
|
12
13
|
const get_environment_1 = require("./get-environment");
|
|
13
14
|
const internals_1 = require("./internals");
|
|
14
15
|
const loading_indicator_1 = require("./loading-indicator");
|
|
16
|
+
const NativeLayers_1 = require("./NativeLayers");
|
|
15
17
|
const nonce_1 = require("./nonce");
|
|
16
18
|
const portal_node_1 = require("./portal-node");
|
|
17
19
|
const use_lazy_component_1 = require("./use-lazy-component");
|
|
@@ -32,9 +34,11 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, .
|
|
|
32
34
|
const video = (0, use_video_1.useVideo)();
|
|
33
35
|
const lazy = (0, use_lazy_component_1.useLazyComponent)(compProps);
|
|
34
36
|
const nonce = (0, nonce_1.useNonce)();
|
|
37
|
+
const environment = (0, get_environment_1.useRemotionEnvironment)();
|
|
35
38
|
const canUseComposition = (0, react_1.useContext)(internals_1.Internals.CanUseRemotionHooks);
|
|
36
39
|
if (canUseComposition) {
|
|
37
|
-
if (
|
|
40
|
+
if (environment === 'player-development' ||
|
|
41
|
+
environment === 'player-production') {
|
|
38
42
|
throw new Error('<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help.');
|
|
39
43
|
}
|
|
40
44
|
throw new Error('<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.');
|
|
@@ -79,16 +83,12 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, .
|
|
|
79
83
|
nonce,
|
|
80
84
|
parentName,
|
|
81
85
|
]);
|
|
82
|
-
if (
|
|
83
|
-
video &&
|
|
84
|
-
video.component === lazy) {
|
|
86
|
+
if (environment === 'preview' && video && video.component === lazy) {
|
|
85
87
|
const Comp = lazy;
|
|
86
88
|
const inputProps = (0, input_props_1.getInputProps)();
|
|
87
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }) }) }), (0, portal_node_1.portalNode)());
|
|
89
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(exports.ClipComposition, { children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }) }) }) }), (0, portal_node_1.portalNode)());
|
|
88
90
|
}
|
|
89
|
-
if (
|
|
90
|
-
video &&
|
|
91
|
-
video.component === lazy) {
|
|
91
|
+
if (environment === 'rendering' && video && video.component === lazy) {
|
|
92
92
|
const Comp = lazy;
|
|
93
93
|
const inputProps = (0, input_props_1.getInputProps)();
|
|
94
94
|
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_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, { ...defaultProps, ...inputProps }) }) }), (0, portal_node_1.portalNode)());
|
|
@@ -96,3 +96,18 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, .
|
|
|
96
96
|
return null;
|
|
97
97
|
};
|
|
98
98
|
exports.Composition = Composition;
|
|
99
|
+
const ClipComposition = ({ children }) => {
|
|
100
|
+
const { clipRegion } = (0, react_1.useContext)(NativeLayers_1.NativeLayersContext);
|
|
101
|
+
const style = (0, react_1.useMemo)(() => {
|
|
102
|
+
return {
|
|
103
|
+
display: 'flex',
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
opacity: clipRegion === 'hide' ? 0 : 1,
|
|
106
|
+
clipPath: clipRegion && clipRegion !== 'hide'
|
|
107
|
+
? `polygon(${clipRegion.x}px ${clipRegion.y}px, ${clipRegion.x}px ${clipRegion.height + clipRegion.y}px, ${clipRegion.width + clipRegion.x}px ${clipRegion.height + clipRegion.y}px, ${clipRegion.width + clipRegion.x}px ${clipRegion.y}px)`
|
|
108
|
+
: undefined,
|
|
109
|
+
};
|
|
110
|
+
}, [clipRegion]);
|
|
111
|
+
return (0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { style: style, children: children });
|
|
112
|
+
};
|
|
113
|
+
exports.ClipComposition = ClipComposition;
|
|
@@ -23,12 +23,14 @@ declare type EnhancedTSequenceData = {
|
|
|
23
23
|
volume: string | number;
|
|
24
24
|
doesVolumeChange: boolean;
|
|
25
25
|
startMediaFrom: number;
|
|
26
|
+
playbackRate: number;
|
|
26
27
|
} | {
|
|
27
28
|
type: 'video';
|
|
28
29
|
src: string;
|
|
29
30
|
volume: string | number;
|
|
30
31
|
doesVolumeChange: boolean;
|
|
31
32
|
startMediaFrom: number;
|
|
33
|
+
playbackRate: number;
|
|
32
34
|
};
|
|
33
35
|
export declare type TSequence = {
|
|
34
36
|
from: number;
|
|
@@ -49,13 +51,9 @@ export declare type TAsset = {
|
|
|
49
51
|
volume: number;
|
|
50
52
|
mediaFrame: number;
|
|
51
53
|
playbackRate: number;
|
|
54
|
+
allowAmplificationDuringRender: boolean;
|
|
52
55
|
};
|
|
53
|
-
|
|
54
|
-
assets: TAsset[][];
|
|
55
|
-
imageSequenceName: string;
|
|
56
|
-
downloadDir: string;
|
|
57
|
-
firstFrameIndex: number;
|
|
58
|
-
};
|
|
56
|
+
declare type BaseMetadata = Pick<TCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
|
|
59
57
|
export declare type CompositionManagerContext = {
|
|
60
58
|
compositions: TComposition[];
|
|
61
59
|
registerComposition: <T>(comp: TComposition<T>) => void;
|
|
@@ -64,6 +62,8 @@ export declare type CompositionManagerContext = {
|
|
|
64
62
|
unregisterFolder: (name: string, parent: string | null) => void;
|
|
65
63
|
currentComposition: string | null;
|
|
66
64
|
setCurrentComposition: (curr: string) => void;
|
|
65
|
+
setCurrentCompositionMetadata: (metadata: BaseMetadata) => void;
|
|
66
|
+
currentCompositionMetadata: BaseMetadata | null;
|
|
67
67
|
registerSequence: (seq: TSequence) => void;
|
|
68
68
|
unregisterSequence: (id: string) => void;
|
|
69
69
|
registerAsset: (asset: TAsset) => void;
|
|
@@ -34,6 +34,7 @@ exports.CompositionManager = (0, react_1.createContext)({
|
|
|
34
34
|
unregisterFolder: () => undefined,
|
|
35
35
|
currentComposition: null,
|
|
36
36
|
setCurrentComposition: () => undefined,
|
|
37
|
+
setCurrentCompositionMetadata: () => undefined,
|
|
37
38
|
registerSequence: () => undefined,
|
|
38
39
|
unregisterSequence: () => undefined,
|
|
39
40
|
registerAsset: () => undefined,
|
|
@@ -41,6 +42,7 @@ exports.CompositionManager = (0, react_1.createContext)({
|
|
|
41
42
|
sequences: [],
|
|
42
43
|
assets: [],
|
|
43
44
|
folders: [],
|
|
45
|
+
currentCompositionMetadata: null,
|
|
44
46
|
});
|
|
45
47
|
exports.compositionsRef = react_1.default.createRef();
|
|
46
48
|
const CompositionManagerProvider = ({ children }) => {
|
|
@@ -51,6 +53,7 @@ const CompositionManagerProvider = ({ children }) => {
|
|
|
51
53
|
const [assets, setAssets] = (0, react_1.useState)([]);
|
|
52
54
|
const [folders, setFolders] = (0, react_1.useState)([]);
|
|
53
55
|
const [sequences, setSequences] = (0, react_1.useState)([]);
|
|
56
|
+
const [currentCompositionMetadata, setCurrentCompositionMetadata] = (0, react_1.useState)(null);
|
|
54
57
|
const registerComposition = (0, react_1.useCallback)((comp) => {
|
|
55
58
|
setCompositions((comps) => {
|
|
56
59
|
if (comps.find((c) => c.id === comp.id)) {
|
|
@@ -127,21 +130,24 @@ const CompositionManagerProvider = ({ children }) => {
|
|
|
127
130
|
folders,
|
|
128
131
|
registerFolder,
|
|
129
132
|
unregisterFolder,
|
|
133
|
+
currentCompositionMetadata,
|
|
134
|
+
setCurrentCompositionMetadata,
|
|
130
135
|
};
|
|
131
136
|
}, [
|
|
132
137
|
compositions,
|
|
133
|
-
currentComposition,
|
|
134
138
|
registerComposition,
|
|
135
|
-
registerSequence,
|
|
136
139
|
unregisterComposition,
|
|
140
|
+
currentComposition,
|
|
141
|
+
registerSequence,
|
|
137
142
|
unregisterSequence,
|
|
138
143
|
registerAsset,
|
|
139
144
|
unregisterAsset,
|
|
140
145
|
sequences,
|
|
141
146
|
assets,
|
|
147
|
+
folders,
|
|
142
148
|
registerFolder,
|
|
143
149
|
unregisterFolder,
|
|
144
|
-
|
|
150
|
+
currentCompositionMetadata,
|
|
145
151
|
]);
|
|
146
152
|
return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: children }));
|
|
147
153
|
};
|
package/dist/Folder.d.ts
CHANGED
|
File without changes
|
package/dist/Folder.js
CHANGED
|
File without changes
|
package/dist/IFrame.d.ts
CHANGED
|
File without changes
|
package/dist/IFrame.js
CHANGED
|
File without changes
|
package/dist/Img.d.ts
CHANGED
|
File without changes
|
package/dist/Img.js
CHANGED
|
@@ -4,11 +4,15 @@ exports.Img = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const delay_render_1 = require("./delay-render");
|
|
7
|
-
const
|
|
7
|
+
const get_environment_1 = require("./get-environment");
|
|
8
|
+
const prefetch_1 = require("./prefetch");
|
|
9
|
+
const ImgRefForwarding = ({ onError, src, ...props }, ref) => {
|
|
8
10
|
const imageRef = (0, react_1.useRef)(null);
|
|
11
|
+
const environment = (0, get_environment_1.useRemotionEnvironment)();
|
|
9
12
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
10
13
|
return imageRef.current;
|
|
11
|
-
});
|
|
14
|
+
}, []);
|
|
15
|
+
const actualSrc = (0, prefetch_1.usePreload)(src);
|
|
12
16
|
const didGetError = (0, react_1.useCallback)((e) => {
|
|
13
17
|
var _a;
|
|
14
18
|
if (onError) {
|
|
@@ -19,27 +23,30 @@ const ImgRefForwarding = ({ onError, ...props }, ref) => {
|
|
|
19
23
|
}
|
|
20
24
|
}, [onError]);
|
|
21
25
|
// If image source switches, make new handle
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
if (environment === 'rendering') {
|
|
27
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
28
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
29
|
+
if (process.env.NODE_ENV === 'test') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const newHandle = (0, delay_render_1.delayRender)('Loading <Img> with src=' + src);
|
|
33
|
+
const { current } = imageRef;
|
|
34
|
+
const didLoad = () => {
|
|
35
|
+
(0, delay_render_1.continueRender)(newHandle);
|
|
36
|
+
};
|
|
37
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
38
|
+
(0, delay_render_1.continueRender)(newHandle);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
42
|
+
}
|
|
43
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
44
|
+
return () => {
|
|
45
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
46
|
+
(0, delay_render_1.continueRender)(newHandle);
|
|
47
|
+
};
|
|
48
|
+
}, [src]);
|
|
49
|
+
}
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
44
51
|
};
|
|
45
52
|
exports.Img = (0, react_1.forwardRef)(ImgRefForwarding);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Layer } from './layers';
|
|
3
|
+
export declare const LayerMaster: <T extends object>({ layers, defaultProps, inputProps, fallbackComponent: FallbackComponent, }: {
|
|
4
|
+
layers: Layer<T>[];
|
|
5
|
+
defaultProps: T | undefined;
|
|
6
|
+
inputProps: any;
|
|
7
|
+
fallbackComponent: React.FC | null;
|
|
8
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LayerMaster = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const AbsoluteFill_1 = require("./AbsoluteFill");
|
|
7
|
+
const get_environment_1 = require("./get-environment");
|
|
8
|
+
const LayerMaster = ({ layers, defaultProps, inputProps, fallbackComponent: FallbackComponent, }) => {
|
|
9
|
+
return (
|
|
10
|
+
// TODO: Same styles as normal
|
|
11
|
+
(0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { children: layers.map((layer, i) => {
|
|
12
|
+
const Comp = layer.component;
|
|
13
|
+
if (layer.type === 'web') {
|
|
14
|
+
if (FallbackComponent === null) {
|
|
15
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }, String(i));
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
20
|
+
(0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(FallbackComponent, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }) }, String(i)));
|
|
21
|
+
}
|
|
22
|
+
// SVG should not support suspense
|
|
23
|
+
if (layer.type === 'svg') {
|
|
24
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }, String(i)) }));
|
|
28
|
+
}
|
|
29
|
+
if (layer.type === 'video') {
|
|
30
|
+
if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
// TODO: AbsoluteFill is different flex direction
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }, String(i)) }));
|
|
35
|
+
}
|
|
36
|
+
throw new Error('Unknown layer type');
|
|
37
|
+
}) }));
|
|
38
|
+
};
|
|
39
|
+
exports.LayerMaster = LayerMaster;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
export declare type ClipRegion = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
} | 'hide';
|
|
8
|
+
export declare 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/Null.d.ts
ADDED
package/dist/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_1 = require("./NativeLayers");
|
|
6
|
+
const Null = () => {
|
|
7
|
+
const { setClipRegion } = (0, react_1.useContext)(NativeLayers_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;
|