remotion 4.0.0-webhook.26 → 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.
Files changed (283) hide show
  1. package/LICENSE.md +8 -8
  2. package/README.md +7 -7
  3. package/dist/{AbsoluteFill.d.ts → cjs/AbsoluteFill.d.ts} +2 -2
  4. package/dist/{AbsoluteFill.js → cjs/AbsoluteFill.js} +2 -2
  5. package/dist/cjs/AssetManager.d.ts +11 -0
  6. package/dist/cjs/AssetManager.js +40 -0
  7. package/dist/{CanUseRemotionHooks.d.ts → cjs/CanUseRemotionHooks.d.ts} +0 -0
  8. package/dist/{CanUseRemotionHooks.js → cjs/CanUseRemotionHooks.js} +0 -0
  9. package/dist/cjs/Clipper.d.ts +7 -0
  10. package/dist/cjs/Clipper.js +24 -0
  11. package/dist/cjs/Composition.d.ts +41 -0
  12. package/dist/cjs/Composition.js +132 -0
  13. package/dist/cjs/CompositionManager.d.ts +75 -0
  14. package/dist/{CompositionManager.js → cjs/CompositionManager.js} +29 -66
  15. package/dist/cjs/CompositionManagerContext.d.ts +18 -0
  16. package/dist/cjs/CompositionManagerContext.js +16 -0
  17. package/dist/cjs/EditorProps.d.ts +15 -0
  18. package/dist/cjs/EditorProps.js +53 -0
  19. package/dist/{Folder.d.ts → cjs/Folder.d.ts} +6 -2
  20. package/dist/{Folder.js → cjs/Folder.js} +10 -6
  21. package/dist/{IFrame.d.ts → cjs/IFrame.d.ts} +4 -0
  22. package/dist/{IFrame.js → cjs/IFrame.js} +8 -4
  23. package/dist/cjs/Img.d.ts +9 -0
  24. package/dist/cjs/Img.js +100 -0
  25. package/dist/cjs/NativeLayers.d.ts +13 -0
  26. package/dist/cjs/NativeLayers.js +29 -0
  27. package/dist/cjs/Null.d.ts +2 -0
  28. package/dist/cjs/Null.js +25 -0
  29. package/dist/{RemotionRoot.d.ts → cjs/RemotionRoot.d.ts} +1 -0
  30. package/dist/cjs/RemotionRoot.js +72 -0
  31. package/dist/cjs/ResolveCompositionConfig.d.ts +24 -0
  32. package/dist/cjs/ResolveCompositionConfig.js +192 -0
  33. package/dist/cjs/Sequence.d.ts +22 -0
  34. package/dist/{Sequence.js → cjs/Sequence.js} +27 -29
  35. package/dist/cjs/SequenceContext.d.ts +9 -0
  36. package/dist/cjs/SequenceContext.js +5 -0
  37. package/dist/cjs/SequenceManager.d.ts +11 -0
  38. package/dist/cjs/SequenceManager.js +57 -0
  39. package/dist/cjs/Still.d.ts +8 -0
  40. package/dist/cjs/Still.js +22 -0
  41. package/dist/{absolute-src.d.ts → cjs/absolute-src.d.ts} +0 -0
  42. package/dist/{absolute-src.js → cjs/absolute-src.js} +0 -0
  43. package/dist/{asset-types.d.ts → cjs/asset-types.d.ts} +0 -0
  44. package/dist/{asset-types.js → cjs/asset-types.js} +0 -0
  45. package/dist/{audio → cjs/audio}/Audio.d.ts +10 -4
  46. package/dist/cjs/audio/Audio.js +58 -0
  47. package/dist/cjs/audio/AudioForDevelopment.d.ts +11 -0
  48. package/dist/cjs/audio/AudioForDevelopment.js +101 -0
  49. package/dist/cjs/audio/AudioForRendering.d.ts +10 -0
  50. package/dist/cjs/audio/AudioForRendering.js +111 -0
  51. package/dist/cjs/audio/index.d.ts +2 -0
  52. package/dist/{audio → cjs/audio}/index.js +2 -2
  53. package/dist/cjs/audio/props.d.ts +12 -0
  54. package/dist/{audio → cjs/audio}/props.js +0 -0
  55. package/dist/{audio → cjs/audio}/shared-audio-tags.d.ts +10 -4
  56. package/dist/{audio → cjs/audio}/shared-audio-tags.js +35 -13
  57. package/dist/{audio → cjs/audio}/use-audio-frame.d.ts +0 -0
  58. package/dist/{audio → cjs/audio}/use-audio-frame.js +4 -4
  59. package/dist/{bezier.d.ts → cjs/bezier.d.ts} +0 -0
  60. package/dist/{bezier.js → cjs/bezier.js} +0 -0
  61. package/dist/cjs/cancel-render.d.ts +5 -0
  62. package/dist/cjs/cancel-render.js +47 -0
  63. package/dist/{config → cjs/config}/input-props.d.ts +0 -0
  64. package/dist/{config → cjs/config}/input-props.js +3 -3
  65. package/dist/{default-css.d.ts → cjs/default-css.d.ts} +0 -0
  66. package/dist/{default-css.js → cjs/default-css.js} +0 -0
  67. package/dist/{delay-render.d.ts → cjs/delay-render.d.ts} +4 -4
  68. package/dist/{delay-render.js → cjs/delay-render.js} +12 -12
  69. package/dist/{easing.d.ts → cjs/easing.d.ts} +4 -0
  70. package/dist/{easing.js → cjs/easing.js} +6 -2
  71. package/dist/cjs/freeze.d.ts +11 -0
  72. package/dist/{freeze.js → cjs/freeze.js} +8 -4
  73. package/dist/{get-asset-file-name.d.ts → cjs/get-asset-file-name.d.ts} +0 -0
  74. package/dist/{get-asset-file-name.js → cjs/get-asset-file-name.js} +0 -0
  75. package/dist/cjs/get-environment.d.ts +3 -0
  76. package/dist/{get-environment.js → cjs/get-environment.js} +14 -2
  77. package/dist/cjs/get-preview-dom-element.d.ts +2 -0
  78. package/dist/cjs/get-preview-dom-element.js +8 -0
  79. package/dist/cjs/get-static-files.d.ts +21 -0
  80. package/dist/cjs/get-static-files.js +35 -0
  81. package/dist/{get-timeline-clip-name.d.ts → cjs/get-timeline-clip-name.d.ts} +0 -0
  82. package/dist/{get-timeline-clip-name.js → cjs/get-timeline-clip-name.js} +0 -0
  83. package/dist/cjs/index.d.ts +102 -0
  84. package/dist/cjs/index.js +105 -0
  85. package/dist/cjs/internals.d.ts +131 -0
  86. package/dist/cjs/internals.js +120 -0
  87. package/dist/{interpolate-colors.d.ts → cjs/interpolate-colors.d.ts} +5 -0
  88. package/dist/{interpolate-colors.js → cjs/interpolate-colors.js} +10 -10
  89. package/dist/{interpolate.d.ts → cjs/interpolate.d.ts} +11 -7
  90. package/dist/{interpolate.js → cjs/interpolate.js} +0 -0
  91. package/dist/{is-approximately-the-same.d.ts → cjs/is-approximately-the-same.d.ts} +0 -0
  92. package/dist/{is-approximately-the-same.js → cjs/is-approximately-the-same.js} +0 -0
  93. package/dist/cjs/is-player.d.ts +3 -0
  94. package/dist/cjs/is-player.js +14 -0
  95. package/dist/{loading-indicator.d.ts → cjs/loading-indicator.d.ts} +0 -0
  96. package/dist/{loading-indicator.js → cjs/loading-indicator.js} +4 -4
  97. package/dist/cjs/loop/index.d.ts +13 -0
  98. package/dist/cjs/loop/index.js +46 -0
  99. package/dist/{multiple-versions-warning.d.ts → cjs/multiple-versions-warning.d.ts} +0 -0
  100. package/dist/{multiple-versions-warning.js → cjs/multiple-versions-warning.js} +11 -6
  101. package/dist/{nonce.d.ts → cjs/nonce.d.ts} +1 -1
  102. package/dist/{nonce.js → cjs/nonce.js} +6 -0
  103. package/dist/{play-and-handle-not-allowed-error.d.ts → cjs/play-and-handle-not-allowed-error.d.ts} +0 -0
  104. package/dist/{play-and-handle-not-allowed-error.js → cjs/play-and-handle-not-allowed-error.js} +4 -0
  105. package/dist/{portal-node.d.ts → cjs/portal-node.d.ts} +0 -0
  106. package/dist/{portal-node.js → cjs/portal-node.js} +0 -0
  107. package/dist/cjs/prefetch-state.d.ts +8 -0
  108. package/dist/cjs/prefetch-state.js +27 -0
  109. package/dist/cjs/prefetch.d.ts +13 -0
  110. package/dist/{prefetch.js → cjs/prefetch.js} +43 -17
  111. package/dist/cjs/props-if-has-props.d.ts +10 -0
  112. package/dist/{video-config.js → cjs/props-if-has-props.js} +0 -0
  113. package/dist/cjs/random.d.ts +6 -0
  114. package/dist/{random.js → cjs/random.js} +3 -3
  115. package/dist/{register-root.d.ts → cjs/register-root.d.ts} +4 -0
  116. package/dist/{register-root.js → cjs/register-root.js} +4 -0
  117. package/dist/cjs/resolve-video-config.d.ts +8 -0
  118. package/dist/cjs/resolve-video-config.js +89 -0
  119. package/dist/cjs/series/flatten-children.d.ts +2 -0
  120. package/dist/{series → cjs/series}/flatten-children.js +0 -0
  121. package/dist/cjs/series/index.d.ts +17 -0
  122. package/dist/{series → cjs/series}/index.js +22 -8
  123. package/dist/cjs/setup-env-variables.d.ts +1 -0
  124. package/dist/{setup-env-variables.js → cjs/setup-env-variables.js} +7 -9
  125. package/dist/{spring → cjs/spring}/index.d.ts +10 -6
  126. package/dist/cjs/spring/index.js +75 -0
  127. package/dist/cjs/spring/measure-spring.d.ts +12 -0
  128. package/dist/{spring → cjs/spring}/measure-spring.js +8 -4
  129. package/dist/{spring → cjs/spring}/spring-utils.d.ts +2 -2
  130. package/dist/{spring → cjs/spring}/spring-utils.js +0 -0
  131. package/dist/cjs/static-file.d.ts +33 -0
  132. package/dist/cjs/static-file.js +87 -0
  133. package/dist/{timeline-position-state.d.ts → cjs/timeline-position-state.d.ts} +4 -4
  134. package/dist/{timeline-position-state.js → cjs/timeline-position-state.js} +9 -1
  135. package/dist/cjs/truthy.d.ts +3 -0
  136. package/dist/{truthy.js → cjs/truthy.js} +0 -0
  137. package/dist/cjs/use-current-frame.d.ts +5 -0
  138. package/dist/{use-current-frame.js → cjs/use-current-frame.js} +8 -9
  139. package/dist/cjs/use-lazy-component.d.ts +7 -0
  140. package/dist/{use-lazy-component.js → cjs/use-lazy-component.js} +0 -0
  141. package/dist/{use-media-in-timeline.d.ts → cjs/use-media-in-timeline.d.ts} +3 -2
  142. package/dist/{use-media-in-timeline.js → cjs/use-media-in-timeline.js} +29 -25
  143. package/dist/{use-media-playback.d.ts → cjs/use-media-playback.d.ts} +3 -1
  144. package/dist/cjs/use-media-playback.js +86 -0
  145. package/dist/{use-media-tag-volume.d.ts → cjs/use-media-tag-volume.d.ts} +0 -0
  146. package/dist/{use-media-tag-volume.js → cjs/use-media-tag-volume.js} +0 -0
  147. package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts} +2 -2
  148. package/dist/{use-sync-volume-with-media-tag.js → cjs/use-sync-volume-with-media-tag.js} +5 -4
  149. package/dist/{use-unsafe-video-config.d.ts → cjs/use-unsafe-video-config.d.ts} +1 -1
  150. package/dist/{use-unsafe-video-config.js → cjs/use-unsafe-video-config.js} +4 -4
  151. package/dist/cjs/use-video-config.d.ts +8 -0
  152. package/dist/cjs/use-video-config.js +34 -0
  153. package/dist/cjs/use-video.d.ts +7 -0
  154. package/dist/cjs/use-video.js +38 -0
  155. package/dist/cjs/validate-frame.d.ts +5 -0
  156. package/dist/cjs/validate-frame.js +24 -0
  157. package/dist/cjs/validate-media-props.d.ts +4 -0
  158. package/dist/{validate-media-props.js → cjs/validate-media-props.js} +0 -0
  159. package/dist/{validate-start-from-props.d.ts → cjs/validate-start-from-props.d.ts} +0 -0
  160. package/dist/{validate-start-from-props.js → cjs/validate-start-from-props.js} +0 -0
  161. package/dist/{validation → cjs/validation}/validate-composition-id.d.ts +0 -0
  162. package/dist/{validation → cjs/validation}/validate-composition-id.js +0 -0
  163. package/dist/cjs/validation/validate-default-props.d.ts +1 -0
  164. package/dist/cjs/validation/validate-default-props.js +15 -0
  165. package/dist/{validation → cjs/validation}/validate-dimensions.d.ts +0 -0
  166. package/dist/{validation → cjs/validation}/validate-dimensions.js +0 -0
  167. package/dist/cjs/validation/validate-duration-in-frames.d.ts +5 -0
  168. package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +5 -2
  169. package/dist/{validation → cjs/validation}/validate-folder-name.d.ts +0 -0
  170. package/dist/{validation → cjs/validation}/validate-folder-name.js +0 -0
  171. package/dist/{validation → cjs/validation}/validate-fps.d.ts +0 -0
  172. package/dist/{validation → cjs/validation}/validate-fps.js +0 -0
  173. package/dist/{validation → cjs/validation}/validation-spring-duration.d.ts +0 -0
  174. package/dist/{validation → cjs/validation}/validation-spring-duration.js +0 -0
  175. package/dist/cjs/version.d.ts +1 -0
  176. package/dist/{version.js → cjs/version.js} +1 -1
  177. package/dist/cjs/video/OffthreadVideo.d.ts +7 -0
  178. package/dist/cjs/video/OffthreadVideo.js +38 -0
  179. package/dist/{video → cjs/video}/OffthreadVideoForRendering.d.ts +1 -1
  180. package/dist/cjs/video/OffthreadVideoForRendering.js +103 -0
  181. package/dist/cjs/video/Video.d.ts +12 -0
  182. package/dist/cjs/video/Video.js +55 -0
  183. package/dist/{video → cjs/video}/VideoForDevelopment.d.ts +5 -2
  184. package/dist/cjs/video/VideoForDevelopment.js +117 -0
  185. package/dist/cjs/video/VideoForRendering.d.ts +10 -0
  186. package/dist/cjs/video/VideoForRendering.js +208 -0
  187. package/dist/cjs/video/duration-state.d.ts +17 -0
  188. package/dist/cjs/video/duration-state.js +35 -0
  189. package/dist/{video → cjs/video}/get-current-time.d.ts +0 -0
  190. package/dist/{video → cjs/video}/get-current-time.js +12 -11
  191. package/dist/cjs/video/index.d.ts +3 -0
  192. package/dist/{video → cjs/video}/index.js +4 -4
  193. package/dist/cjs/video/props.d.ts +32 -0
  194. package/dist/cjs/video/props.js +2 -0
  195. package/dist/cjs/video/video-fragment.d.ts +12 -0
  196. package/dist/cjs/video/video-fragment.js +60 -0
  197. package/dist/{video-config.d.ts → cjs/video-config.d.ts} +2 -2
  198. package/dist/{video/props.js → cjs/video-config.js} +0 -0
  199. package/dist/{volume-position-state.d.ts → cjs/volume-position-state.d.ts} +4 -4
  200. package/dist/{volume-position-state.js → cjs/volume-position-state.js} +0 -0
  201. package/dist/{volume-prop.d.ts → cjs/volume-prop.d.ts} +3 -2
  202. package/dist/{volume-prop.js → cjs/volume-prop.js} +4 -3
  203. package/dist/{warn-about-non-seekable-media.d.ts → cjs/warn-about-non-seekable-media.d.ts} +0 -0
  204. package/dist/{warn-about-non-seekable-media.js → cjs/warn-about-non-seekable-media.js} +2 -2
  205. package/dist/cjs/wrap-remotion-context.d.ts +31 -0
  206. package/dist/cjs/wrap-remotion-context.js +85 -0
  207. package/dist/esm/index.mjs +4623 -0
  208. package/dist/esm/version.mjs +4 -0
  209. package/package.json +80 -57
  210. package/version.js +2 -1
  211. package/.prettierrc.js +0 -14
  212. package/.turbo/turbo-build.log +0 -5
  213. package/dist/Composition.d.ts +0 -22
  214. package/dist/Composition.js +0 -98
  215. package/dist/CompositionManager.d.ts +0 -79
  216. package/dist/Img.d.ts +0 -2
  217. package/dist/Img.js +0 -51
  218. package/dist/RemotionRoot.js +0 -71
  219. package/dist/Sequence.d.ts +0 -29
  220. package/dist/Still.d.ts +0 -3
  221. package/dist/Still.js +0 -9
  222. package/dist/audio/Audio.js +0 -32
  223. package/dist/audio/AudioForDevelopment.d.ts +0 -8
  224. package/dist/audio/AudioForDevelopment.js +0 -71
  225. package/dist/audio/AudioForRendering.d.ts +0 -6
  226. package/dist/audio/AudioForRendering.js +0 -75
  227. package/dist/audio/index.d.ts +0 -2
  228. package/dist/audio/props.d.ts +0 -10
  229. package/dist/config.d.ts +0 -218
  230. package/dist/config.js +0 -21
  231. package/dist/freeze.d.ts +0 -7
  232. package/dist/get-environment.d.ts +0 -2
  233. package/dist/get-preview-dom-element.d.ts +0 -1
  234. package/dist/get-preview-dom-element.js +0 -7
  235. package/dist/index.d.ts +0 -72
  236. package/dist/index.js +0 -58
  237. package/dist/internals.d.ts +0 -88
  238. package/dist/internals.js +0 -93
  239. package/dist/loop/index.d.ts +0 -9
  240. package/dist/loop/index.js +0 -28
  241. package/dist/prefetch-state.d.ts +0 -13
  242. package/dist/prefetch-state.js +0 -26
  243. package/dist/prefetch.d.ts +0 -7
  244. package/dist/random.d.ts +0 -6
  245. package/dist/series/flatten-children.d.ts +0 -2
  246. package/dist/series/index.d.ts +0 -13
  247. package/dist/setup-env-variables.d.ts +0 -2
  248. package/dist/spring/index.js +0 -51
  249. package/dist/spring/measure-spring.d.ts +0 -8
  250. package/dist/static-file.d.ts +0 -1
  251. package/dist/static-file.js +0 -29
  252. package/dist/truthy.d.ts +0 -3
  253. package/dist/use-current-frame.d.ts +0 -6
  254. package/dist/use-lazy-component.d.ts +0 -7
  255. package/dist/use-media-playback.js +0 -75
  256. package/dist/use-video-config.d.ts +0 -7
  257. package/dist/use-video-config.js +0 -26
  258. package/dist/use-video.d.ts +0 -13
  259. package/dist/use-video.js +0 -28
  260. package/dist/validate-media-props.d.ts +0 -4
  261. package/dist/validation/validate-duration-in-frames.d.ts +0 -1
  262. package/dist/validation/validate-offthreadvideo-image-format.d.ts +0 -1
  263. package/dist/validation/validate-offthreadvideo-image-format.js +0 -15
  264. package/dist/version.d.ts +0 -1
  265. package/dist/video/LoopedVideo.d.ts +0 -3
  266. package/dist/video/LoopedVideo.js +0 -16
  267. package/dist/video/OffthreadVideo.d.ts +0 -3
  268. package/dist/video/OffthreadVideo.js +0 -27
  269. package/dist/video/OffthreadVideoForRendering.js +0 -101
  270. package/dist/video/Video.d.ts +0 -6
  271. package/dist/video/Video.js +0 -29
  272. package/dist/video/VideoForDevelopment.js +0 -69
  273. package/dist/video/VideoForRendering.d.ts +0 -6
  274. package/dist/video/VideoForRendering.js +0 -168
  275. package/dist/video/duration-state.d.ts +0 -8
  276. package/dist/video/duration-state.js +0 -15
  277. package/dist/video/index.d.ts +0 -3
  278. package/dist/video/props.d.ts +0 -21
  279. package/dist/wrap-remotion-context.d.ts +0 -14
  280. package/dist/wrap-remotion-context.js +0 -65
  281. package/ensure-correct-version.js +0 -24
  282. package/tsconfig.json +0 -12
  283. package/version.d.ts +0 -1
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 organisations 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.
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 © 2022 [Jonny Burger](https://jonny.io)
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 organisation with up to 3 employees
18
- - a non-profit or not-for-profit organisation
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 and 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.
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 noninfringement. 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.
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
@@ -7,11 +7,11 @@
7
7
  </a>
8
8
  </p>
9
9
 
10
- [![Discord Shield](https://discordapp.com/api/guilds/809501355504959528/widget.png?style=shield)](https://remotion.dev/discord)
11
- [![NPM Version](https://img.shields.io/npm/v/remotion.svg?style=flat)](https://www.npmjs.org/package/remotion)
12
- [![NPM Downloads](https://img.shields.io/npm/dm/remotion.svg?style=flat)](https://npmcharts.com/compare/remotion?minimal=true)
13
- [![Install Size](https://packagephobia.now.sh/badge?p=remotion)](https://packagephobia.now.sh/result?p=remotion)
14
- <a href="https://twitter.com/remotion_dev"><img src="https://img.shields.io/twitter/follow/remotion_dev?label=Twitter&style=social" alt="Twitter"></a>
10
+ [![Discord Shield](https://img.shields.io/discord/809501355504959528?color=000000&label=Discord&logo=fdgssdf)](https://remotion.dev/discord)
11
+ [![NPM Version](https://img.shields.io/npm/v/remotion.svg?style=flat&color=black)](https://www.npmjs.org/package/remotion)
12
+ [![NPM Downloads](https://img.shields.io/npm/dm/remotion.svg?style=flat&color=black&label=Downloads)](https://npmcharts.com/compare/remotion?minimal=true)
13
+ [![Open Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Fremotion%2Fbounties%3Fstatus%3Dopen&style=flat&color=black&labelColor=grey&label=Open+Bounties)](https://github.com/remotion-dev/remotion/issues?q=is%3Aopen+label%3A%22%F0%9F%92%8E+Bounty%22+sort%3Aupdated-desc)
14
+ <a href="https://twitter.com/remotion"><img src="https://img.shields.io/twitter/follow/remotion?label=Twitter&color=black" alt="Twitter"></a>
15
15
 
16
16
  Remotion is a framework for **creating videos programmatically using React.**
17
17
 
@@ -30,8 +30,8 @@ Remotion is a framework for **creating videos programmatically using React.**
30
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
31
  </td>
32
32
  <td align="center">
33
- <img style="width: 240px" src="packages/docs/static/img/github-unwrapped.gif" />
34
- <p>GitHub Unwrapped - Personalized year in Review <a href="https://githubunwrapped.com">Try</a> • <a href="https://github.com/remotion-dev/github-unwrapped">Source</a></p>
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
35
  </td>
36
36
  <td align="center">
37
37
  <em>View more in the <a href="https://remotion.dev/showcase">Remotion Showcase</a>!</em>
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  /**
3
- * An absolutely positioned <div> element with 100% width, height, and a column flex style
4
- * @link https://www.remotion.dev/docs/absolute-fill
3
+ * @description An absolutely positioned <div> element with 100% width, height, and a column flex style
4
+ * @see [Documentation](https://www.remotion.dev/docs/absolute-fill)
5
5
  */
6
6
  export declare const AbsoluteFill: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
@@ -22,7 +22,7 @@ const AbsoluteFillRefForwarding = (props, ref) => {
22
22
  return (0, jsx_runtime_1.jsx)("div", { ref: ref, style: actualStyle, ...other });
23
23
  };
24
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
25
+ * @description An absolutely positioned <div> element with 100% width, height, and a column flex style
26
+ * @see [Documentation](https://www.remotion.dev/docs/absolute-fill)
27
27
  */
28
28
  exports.AbsoluteFill = (0, react_1.forwardRef)(AbsoluteFillRefForwarding);
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { TAsset } from './CompositionManager.js';
3
+ export type AssetManagerContext = {
4
+ registerAsset: (asset: TAsset) => void;
5
+ unregisterAsset: (id: string) => void;
6
+ assets: TAsset[];
7
+ };
8
+ export declare const AssetManager: import("react").Context<AssetManagerContext>;
9
+ export declare const AssetManagerProvider: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssetManagerProvider = exports.AssetManager = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ exports.AssetManager = (0, react_1.createContext)({
7
+ registerAsset: () => undefined,
8
+ unregisterAsset: () => undefined,
9
+ assets: [],
10
+ });
11
+ const AssetManagerProvider = ({ children }) => {
12
+ const [assets, setAssets] = (0, react_1.useState)([]);
13
+ const registerAsset = (0, react_1.useCallback)((asset) => {
14
+ setAssets((assts) => {
15
+ return [...assts, asset];
16
+ });
17
+ }, []);
18
+ const unregisterAsset = (0, react_1.useCallback)((id) => {
19
+ setAssets((assts) => {
20
+ return assts.filter((a) => a.id !== id);
21
+ });
22
+ }, []);
23
+ (0, react_1.useLayoutEffect)(() => {
24
+ if (typeof window !== 'undefined') {
25
+ window.remotion_collectAssets = () => {
26
+ setAssets([]); // clear assets at next render
27
+ return assets;
28
+ };
29
+ }
30
+ }, [assets]);
31
+ const contextValue = (0, react_1.useMemo)(() => {
32
+ return {
33
+ registerAsset,
34
+ unregisterAsset,
35
+ assets,
36
+ };
37
+ }, [assets, registerAsset, unregisterAsset]);
38
+ return ((0, jsx_runtime_1.jsx)(exports.AssetManager.Provider, { value: contextValue, children: children }));
39
+ };
40
+ exports.AssetManagerProvider = AssetManagerProvider;
@@ -0,0 +1,7 @@
1
+ import type React from 'react';
2
+ export declare const Clipper: React.FC<{
3
+ width: number;
4
+ height: number;
5
+ x: number;
6
+ y: number;
7
+ }>;
@@ -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_js_1 = require("./NativeLayers.js");
6
+ const Clipper = ({ height, width, x, y }) => {
7
+ const { setClipRegion } = (0, react_1.useContext)(NativeLayers_js_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;
@@ -0,0 +1,41 @@
1
+ import type { ComponentType } from 'react';
2
+ import React from 'react';
3
+ import type { AnyZodObject } from 'zod';
4
+ import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
5
+ type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
6
+ export type CompProps<Props> = {
7
+ lazyComponent: () => Promise<{
8
+ default: LooseComponentType<Props>;
9
+ }>;
10
+ } | {
11
+ component: LooseComponentType<Props>;
12
+ };
13
+ export type CalcMetadataReturnType<T extends Record<string, unknown> | undefined> = {
14
+ durationInFrames?: number;
15
+ fps?: number;
16
+ width?: number;
17
+ height?: number;
18
+ props?: T;
19
+ };
20
+ export type CalculateMetadataFunction<T extends Record<string, unknown> | undefined> = (options: {
21
+ defaultProps: T;
22
+ props: T;
23
+ abortSignal: AbortSignal;
24
+ }) => Promise<CalcMetadataReturnType<T>> | CalcMetadataReturnType<T>;
25
+ export type StillProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
26
+ width: number;
27
+ height: number;
28
+ id: string;
29
+ calculateMetadata?: CalculateMetadataFunction<InferProps<Schema, Props>>;
30
+ schema?: Schema;
31
+ } & CompProps<Props> & PropsIfHasProps<Schema, Props>;
32
+ export type CompositionProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = StillProps<Schema, Props> & {
33
+ fps: number;
34
+ durationInFrames: number;
35
+ };
36
+ /**
37
+ * @description This component is used to register a video to make it renderable and make it show in the sidebar, in dev mode.
38
+ * @see [Documentation](https://www.remotion.dev/docs/composition)
39
+ */
40
+ export declare const Composition: <Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined>({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }: CompositionProps<Schema, Props>) => React.ReactPortal | null;
41
+ export {};
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Composition = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_dom_1 = require("react-dom");
7
+ const AbsoluteFill_js_1 = require("./AbsoluteFill.js");
8
+ const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
9
+ const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
10
+ const delay_render_js_1 = require("./delay-render.js");
11
+ const Folder_js_1 = require("./Folder.js");
12
+ const get_environment_js_1 = require("./get-environment.js");
13
+ const loading_indicator_js_1 = require("./loading-indicator.js");
14
+ const NativeLayers_js_1 = require("./NativeLayers.js");
15
+ const nonce_js_1 = require("./nonce.js");
16
+ const portal_node_js_1 = require("./portal-node.js");
17
+ const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
18
+ const use_lazy_component_js_1 = require("./use-lazy-component.js");
19
+ const use_video_js_1 = require("./use-video.js");
20
+ const validate_composition_id_js_1 = require("./validation/validate-composition-id.js");
21
+ const validate_default_props_js_1 = require("./validation/validate-default-props.js");
22
+ const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
23
+ const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
24
+ const validate_fps_js_1 = require("./validation/validate-fps.js");
25
+ const Fallback = () => {
26
+ (0, react_1.useEffect)(() => {
27
+ const fallback = (0, delay_render_js_1.delayRender)('Waiting for Root component to unsuspend');
28
+ return () => (0, delay_render_js_1.continueRender)(fallback);
29
+ }, []);
30
+ return null;
31
+ };
32
+ /**
33
+ * @description This component is used to register a video to make it renderable and make it show in the sidebar, in dev mode.
34
+ * @see [Documentation](https://www.remotion.dev/docs/composition)
35
+ */
36
+ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }) => {
37
+ var _a, _b;
38
+ const { registerComposition, unregisterComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
39
+ const video = (0, use_video_js_1.useVideo)();
40
+ const lazy = (0, use_lazy_component_js_1.useLazyComponent)(compProps);
41
+ const nonce = (0, nonce_js_1.useNonce)();
42
+ const environment = (0, get_environment_js_1.useRemotionEnvironment)();
43
+ const canUseComposition = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
44
+ if (canUseComposition) {
45
+ if (environment === 'player-development' ||
46
+ environment === 'player-production') {
47
+ 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.');
48
+ }
49
+ throw new Error('<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.');
50
+ }
51
+ const { folderName, parentName } = (0, react_1.useContext)(Folder_js_1.FolderContext);
52
+ (0, react_1.useEffect)(() => {
53
+ var _a;
54
+ // Ensure it's a URL safe id
55
+ if (!id) {
56
+ throw new Error('No id for composition passed.');
57
+ }
58
+ (0, validate_composition_id_js_1.validateCompositionId)(id);
59
+ (0, validate_dimensions_js_1.validateDimension)(width, 'width', 'of the <Composition/> component');
60
+ (0, validate_dimensions_js_1.validateDimension)(height, 'height', 'of the <Composition/> component');
61
+ (0, validate_duration_in_frames_js_1.validateDurationInFrames)({
62
+ durationInFrames,
63
+ component: 'of the <Composition/> component',
64
+ allowFloats: false,
65
+ });
66
+ (0, validate_fps_js_1.validateFps)(fps, 'as a prop of the <Composition/> component', false);
67
+ (0, validate_default_props_js_1.validateDefaultAndInputProps)(defaultProps, 'defaultProps', id);
68
+ registerComposition({
69
+ durationInFrames,
70
+ fps,
71
+ height,
72
+ width,
73
+ id,
74
+ folderName,
75
+ component: lazy,
76
+ defaultProps: defaultProps,
77
+ nonce,
78
+ parentFolderName: parentName,
79
+ schema: schema !== null && schema !== void 0 ? schema : null,
80
+ calculateMetadata: (_a = compProps.calculateMetadata) !== null && _a !== void 0 ? _a : null,
81
+ });
82
+ return () => {
83
+ unregisterComposition(id);
84
+ };
85
+ }, [
86
+ durationInFrames,
87
+ fps,
88
+ height,
89
+ lazy,
90
+ id,
91
+ folderName,
92
+ defaultProps,
93
+ registerComposition,
94
+ unregisterComposition,
95
+ width,
96
+ nonce,
97
+ parentName,
98
+ schema,
99
+ compProps.calculateMetadata,
100
+ ]);
101
+ const resolved = (0, ResolveCompositionConfig_js_1.useResolvedVideoConfig)(id);
102
+ if (environment === 'preview' && video && video.component === lazy) {
103
+ const Comp = lazy;
104
+ if (resolved === null || resolved.type !== 'success') {
105
+ return null;
106
+ }
107
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ClipComposition, { children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_a = resolved.result.defaultProps) !== null && _a !== void 0 ? _a : {}) }) }) }) }), (0, portal_node_js_1.portalNode)());
108
+ }
109
+ if (environment === 'rendering' && video && video.component === lazy) {
110
+ const Comp = lazy;
111
+ if (resolved === null || resolved.type !== 'success') {
112
+ return null;
113
+ }
114
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...((_b = resolved.result.defaultProps) !== null && _b !== void 0 ? _b : {}) }) }) }), (0, portal_node_js_1.portalNode)());
115
+ }
116
+ return null;
117
+ };
118
+ exports.Composition = Composition;
119
+ const ClipComposition = ({ children }) => {
120
+ const { clipRegion } = (0, react_1.useContext)(NativeLayers_js_1.NativeLayersContext);
121
+ const style = (0, react_1.useMemo)(() => {
122
+ return {
123
+ display: 'flex',
124
+ flexDirection: 'row',
125
+ opacity: clipRegion === 'hide' ? 0 : 1,
126
+ clipPath: clipRegion && clipRegion !== 'hide'
127
+ ? `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)`
128
+ : undefined,
129
+ };
130
+ }, [clipRegion]);
131
+ return (0, jsx_runtime_1.jsx)(AbsoluteFill_js_1.AbsoluteFill, { style: style, children: children });
132
+ };
@@ -0,0 +1,75 @@
1
+ import type { ComponentType, LazyExoticComponent } from 'react';
2
+ import React from 'react';
3
+ import type { AnyZodObject } from 'zod';
4
+ import type { CalculateMetadataFunction } from './Composition.js';
5
+ import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
6
+ export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
7
+ width: number;
8
+ height: number;
9
+ fps: number;
10
+ durationInFrames: number;
11
+ id: string;
12
+ folderName: string | null;
13
+ parentFolderName: string | null;
14
+ component: LazyExoticComponent<ComponentType<Props>>;
15
+ nonce: number;
16
+ schema: Schema | null;
17
+ calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
18
+ } & PropsIfHasProps<Schema, Props>;
19
+ export type AnyComposition = TComposition<AnyZodObject, Record<string, unknown> | undefined>;
20
+ export type TCompMetadataWithCalcFunction<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps' | 'calculateMetadata'>;
21
+ export type TCompMetadata<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
22
+ export type AnyCompMetadata = TCompMetadata<AnyZodObject, Record<string, unknown> | undefined>;
23
+ export type SmallTCompMetadata<T extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<T, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames'> & Partial<Pick<TComposition<T, Props>, 'defaultProps'>>;
24
+ export type AnySmallCompMetadata = SmallTCompMetadata<AnyZodObject, Record<string, unknown> | undefined>;
25
+ type EnhancedTSequenceData = {
26
+ type: 'sequence';
27
+ } | {
28
+ type: 'audio';
29
+ src: string;
30
+ volume: string | number;
31
+ doesVolumeChange: boolean;
32
+ startMediaFrom: number;
33
+ playbackRate: number;
34
+ } | {
35
+ type: 'video';
36
+ src: string;
37
+ volume: string | number;
38
+ doesVolumeChange: boolean;
39
+ startMediaFrom: number;
40
+ playbackRate: number;
41
+ };
42
+ export type LoopDisplay = {
43
+ numberOfTimes: number;
44
+ startOffset: number;
45
+ durationInFrames: number;
46
+ };
47
+ export type TSequence = {
48
+ from: number;
49
+ duration: number;
50
+ id: string;
51
+ displayName: string;
52
+ parent: string | null;
53
+ rootId: string;
54
+ showInTimeline: boolean;
55
+ nonce: number;
56
+ loopDisplay: LoopDisplay | undefined;
57
+ } & EnhancedTSequenceData;
58
+ export type TAsset = {
59
+ type: 'audio' | 'video';
60
+ src: string;
61
+ id: string;
62
+ frame: number;
63
+ volume: number;
64
+ mediaFrame: number;
65
+ playbackRate: number;
66
+ allowAmplificationDuringRender: boolean;
67
+ };
68
+ export declare const compositionsRef: React.RefObject<{
69
+ getCompositions: () => TCompMetadataWithCalcFunction<AnyZodObject, Record<string, unknown> | undefined>[];
70
+ }>;
71
+ export declare const CompositionManagerProvider: React.FC<{
72
+ children: React.ReactNode;
73
+ numberOfAudioTags: number;
74
+ }>;
75
+ export {};
@@ -23,68 +23,50 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CompositionManagerProvider = exports.compositionsRef = exports.CompositionManager = void 0;
26
+ exports.CompositionManagerProvider = exports.compositionsRef = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = __importStar(require("react"));
29
- exports.CompositionManager = (0, react_1.createContext)({
30
- compositions: [],
31
- registerComposition: () => undefined,
32
- unregisterComposition: () => undefined,
33
- registerFolder: () => undefined,
34
- unregisterFolder: () => undefined,
35
- currentComposition: null,
36
- setCurrentComposition: () => undefined,
37
- setCurrentCompositionMetadata: () => undefined,
38
- registerSequence: () => undefined,
39
- unregisterSequence: () => undefined,
40
- registerAsset: () => undefined,
41
- unregisterAsset: () => undefined,
42
- sequences: [],
43
- assets: [],
44
- folders: [],
45
- currentCompositionMetadata: null,
46
- });
29
+ const AssetManager_js_1 = require("./AssetManager.js");
30
+ const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
31
+ const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
32
+ const ResolveCompositionConfig_js_1 = require("./ResolveCompositionConfig.js");
33
+ const SequenceManager_js_1 = require("./SequenceManager.js");
47
34
  exports.compositionsRef = react_1.default.createRef();
48
- const CompositionManagerProvider = ({ children }) => {
35
+ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
36
+ var _a;
49
37
  // Wontfix, expected to have
50
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
39
  const [compositions, setCompositions] = (0, react_1.useState)([]);
40
+ const currentcompositionsRef = (0, react_1.useRef)(compositions);
52
41
  const [currentComposition, setCurrentComposition] = (0, react_1.useState)(null);
53
- const [assets, setAssets] = (0, react_1.useState)([]);
54
42
  const [folders, setFolders] = (0, react_1.useState)([]);
55
- const [sequences, setSequences] = (0, react_1.useState)([]);
56
43
  const [currentCompositionMetadata, setCurrentCompositionMetadata] = (0, react_1.useState)(null);
57
- const registerComposition = (0, react_1.useCallback)((comp) => {
44
+ const updateCompositions = (0, react_1.useCallback)((
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ updateComps) => {
58
47
  setCompositions((comps) => {
48
+ const updated = updateComps(comps);
49
+ currentcompositionsRef.current = updated;
50
+ return updated;
51
+ });
52
+ }, []);
53
+ const registerComposition = (0, react_1.useCallback)((comp) => {
54
+ updateCompositions((comps) => {
59
55
  if (comps.find((c) => c.id === comp.id)) {
60
56
  throw new Error(`Multiple composition with id ${comp.id} are registered.`);
61
57
  }
62
- return [...comps, comp].slice().sort((a, b) => a.nonce - b.nonce);
63
- });
64
- }, []);
65
- const registerSequence = (0, react_1.useCallback)((seq) => {
66
- setSequences((seqs) => {
67
- return [...seqs, seq];
58
+ const value = [...comps, comp]
59
+ .slice()
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ .sort((a, b) => a.nonce - b.nonce);
62
+ return value;
68
63
  });
69
- }, []);
64
+ }, [updateCompositions]);
70
65
  const unregisterComposition = (0, react_1.useCallback)((id) => {
71
66
  setCompositions((comps) => {
72
67
  return comps.filter((c) => c.id !== id);
73
68
  });
74
69
  }, []);
75
- const unregisterSequence = (0, react_1.useCallback)((seq) => {
76
- setSequences((seqs) => seqs.filter((s) => s.id !== seq));
77
- }, []);
78
- const registerAsset = (0, react_1.useCallback)((asset) => {
79
- setAssets((assts) => {
80
- return [...assts, asset];
81
- });
82
- }, []);
83
- const unregisterAsset = (0, react_1.useCallback)((id) => {
84
- setAssets((assts) => {
85
- return assts.filter((a) => a.id !== id);
86
- });
87
- }, []);
88
70
  const registerFolder = (0, react_1.useCallback)((name, parent) => {
89
71
  setFolders((prevFolders) => {
90
72
  return [
@@ -101,19 +83,12 @@ const CompositionManagerProvider = ({ children }) => {
101
83
  return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
102
84
  });
103
85
  }, []);
104
- (0, react_1.useLayoutEffect)(() => {
105
- if (typeof window !== 'undefined') {
106
- window.remotion_collectAssets = () => {
107
- setAssets([]); // clear assets at next render
108
- return assets;
109
- };
110
- }
111
- }, [assets]);
112
86
  (0, react_1.useImperativeHandle)(exports.compositionsRef, () => {
113
87
  return {
114
- getCompositions: () => compositions,
88
+ getCompositions: () => currentcompositionsRef.current,
115
89
  };
116
- }, [compositions]);
90
+ }, []);
91
+ const composition = compositions.find((c) => c.id === currentComposition);
117
92
  const contextValue = (0, react_1.useMemo)(() => {
118
93
  return {
119
94
  compositions,
@@ -121,12 +96,6 @@ const CompositionManagerProvider = ({ children }) => {
121
96
  unregisterComposition,
122
97
  currentComposition,
123
98
  setCurrentComposition,
124
- registerSequence,
125
- unregisterSequence,
126
- registerAsset,
127
- unregisterAsset,
128
- sequences,
129
- assets,
130
99
  folders,
131
100
  registerFolder,
132
101
  unregisterFolder,
@@ -138,17 +107,11 @@ const CompositionManagerProvider = ({ children }) => {
138
107
  registerComposition,
139
108
  unregisterComposition,
140
109
  currentComposition,
141
- registerSequence,
142
- unregisterSequence,
143
- registerAsset,
144
- unregisterAsset,
145
- sequences,
146
- assets,
147
110
  folders,
148
111
  registerFolder,
149
112
  unregisterFolder,
150
113
  currentCompositionMetadata,
151
114
  ]);
152
- return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: children }));
115
+ return ((0, jsx_runtime_1.jsx)(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(SequenceManager_js_1.SequenceManagerProvider, { children: (0, jsx_runtime_1.jsx)(AssetManager_js_1.AssetManagerProvider, { children: (0, jsx_runtime_1.jsx)(ResolveCompositionConfig_js_1.ResolveCompositionConfig, { children: (0, jsx_runtime_1.jsx)(shared_audio_tags_js_1.SharedAudioContextProvider, { numberOfAudioTags: numberOfAudioTags, component: (_a = composition === null || composition === void 0 ? void 0 : composition.component) !== null && _a !== void 0 ? _a : null, children: children }) }) }) }) }));
153
116
  };
154
117
  exports.CompositionManagerProvider = CompositionManagerProvider;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import type { AnyZodObject } from 'zod';
3
+ import type { AnyCompMetadata, AnyComposition, TComposition } from './CompositionManager.js';
4
+ import type { TFolder } from './Folder.js';
5
+ export type BaseMetadata = Pick<AnyCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
6
+ export type CompositionManagerContext = {
7
+ compositions: AnyComposition[];
8
+ registerComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined>(comp: TComposition<Schema, Props>) => void;
9
+ unregisterComposition: (name: string) => void;
10
+ registerFolder: (name: string, parent: string | null) => void;
11
+ unregisterFolder: (name: string, parent: string | null) => void;
12
+ currentComposition: string | null;
13
+ setCurrentComposition: (curr: string) => void;
14
+ setCurrentCompositionMetadata: (metadata: BaseMetadata) => void;
15
+ currentCompositionMetadata: BaseMetadata | null;
16
+ folders: TFolder[];
17
+ };
18
+ export declare const CompositionManager: import("react").Context<CompositionManagerContext>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompositionManager = void 0;
4
+ const react_1 = require("react");
5
+ exports.CompositionManager = (0, react_1.createContext)({
6
+ compositions: [],
7
+ registerComposition: () => undefined,
8
+ unregisterComposition: () => undefined,
9
+ registerFolder: () => undefined,
10
+ unregisterFolder: () => undefined,
11
+ currentComposition: null,
12
+ setCurrentComposition: () => undefined,
13
+ setCurrentCompositionMetadata: () => undefined,
14
+ folders: [],
15
+ currentCompositionMetadata: null,
16
+ });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ type Props = Record<string, Record<string, unknown>>;
3
+ export type EditorPropsContextType = {
4
+ props: Props;
5
+ updateProps: (options: {
6
+ id: string;
7
+ defaultProps: Record<string, unknown>;
8
+ newProps: Record<string, unknown> | ((oldProps: Record<string, unknown>) => Record<string, unknown>);
9
+ }) => void;
10
+ };
11
+ export declare const EditorPropsContext: React.Context<EditorPropsContextType>;
12
+ export declare const EditorPropsProvider: React.FC<{
13
+ children: React.ReactNode;
14
+ }>;
15
+ export {};