remotion 4.0.0-preload.13 → 4.0.0-publish.3

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 (128) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/README.md +1 -1
  3. package/dist/AbsoluteFill.d.ts +6 -1
  4. package/dist/AbsoluteFill.js +5 -1
  5. package/dist/Composition.d.ts +3 -6
  6. package/dist/Composition.js +30 -27
  7. package/dist/CompositionManager.d.ts +4 -6
  8. package/dist/CompositionManager.js +6 -2
  9. package/dist/Folder.d.ts +15 -0
  10. package/dist/Folder.js +33 -0
  11. package/dist/IFrame.js +1 -1
  12. package/dist/Img.js +20 -24
  13. package/dist/RemotionRoot.js +1 -1
  14. package/dist/Sequence.d.ts +25 -0
  15. package/dist/Sequence.js +127 -0
  16. package/dist/Still.d.ts +1 -1
  17. package/dist/Still.js +1 -1
  18. package/dist/audio/Audio.d.ts +1 -1
  19. package/dist/audio/Audio.js +4 -4
  20. package/dist/audio/AudioForDevelopment.js +2 -1
  21. package/dist/audio/AudioForRendering.d.ts +1 -1
  22. package/dist/audio/AudioForRendering.js +6 -6
  23. package/dist/audio/index.js +5 -1
  24. package/dist/audio/props.d.ts +1 -1
  25. package/dist/audio/shared-audio-tags.d.ts +1 -1
  26. package/dist/audio/shared-audio-tags.js +6 -2
  27. package/dist/audio/use-audio-frame.js +4 -4
  28. package/dist/compress-assets.d.ts +1 -1
  29. package/dist/config/bundle-out-dir.d.ts +2 -0
  30. package/dist/config/bundle-out-dir.js +12 -0
  31. package/dist/config/chromium-flags.d.ts +1 -1
  32. package/dist/config/codec.d.ts +1 -2
  33. package/dist/config/codec.js +2 -3
  34. package/dist/config/crf.d.ts +1 -1
  35. package/dist/config/every-nth-file.d.ts +2 -0
  36. package/dist/config/every-nth-file.js +12 -0
  37. package/dist/config/ffmpeg-executable.d.ts +2 -0
  38. package/dist/config/ffmpeg-executable.js +10 -1
  39. package/dist/config/image-format.d.ts +1 -1
  40. package/dist/config/image-sequence.d.ts +1 -1
  41. package/dist/config/index.d.ts +15 -10
  42. package/dist/config/index.js +5 -0
  43. package/dist/config/input-props.js +12 -14
  44. package/dist/config/loop.d.ts +3 -0
  45. package/dist/config/loop.js +15 -0
  46. package/dist/config/override-webpack.d.ts +2 -8
  47. package/dist/config/pixel-format.d.ts +1 -1
  48. package/dist/config/prores-profile.d.ts +1 -1
  49. package/dist/config/public-path.d.ts +2 -0
  50. package/dist/config/public-path.js +12 -0
  51. package/dist/config/skip-n-frames.d.ts +2 -0
  52. package/dist/config/skip-n-frames.js +12 -0
  53. package/dist/default-css.d.ts +1 -0
  54. package/dist/default-css.js +9 -2
  55. package/dist/delay-render.d.ts +1 -1
  56. package/dist/freeze.d.ts +2 -2
  57. package/dist/freeze.js +2 -2
  58. package/dist/index.d.ts +10 -6
  59. package/dist/index.js +13 -7
  60. package/dist/internals.d.ts +16 -12
  61. package/dist/internals.js +15 -3
  62. package/dist/interpolate-colors.d.ts +5 -0
  63. package/dist/interpolate-colors.js +401 -0
  64. package/dist/is-audio-codec.d.ts +1 -1
  65. package/dist/loading-indicator.d.ts +2 -0
  66. package/dist/loading-indicator.js +35 -0
  67. package/dist/loop/index.js +1 -1
  68. package/dist/perf/index.d.ts +1 -1
  69. package/dist/perf/index.js +2 -0
  70. package/dist/play-and-handle-not-allowed-error.d.ts +1 -1
  71. package/dist/portal-node.d.ts +1 -0
  72. package/dist/portal-node.js +23 -0
  73. package/dist/preload.d.ts +7 -0
  74. package/dist/preload.js +39 -0
  75. package/dist/register-root.d.ts +2 -1
  76. package/dist/register-root.js +20 -5
  77. package/dist/sequencing/index.js +1 -1
  78. package/dist/series/index.d.ts +2 -2
  79. package/dist/series/index.js +4 -4
  80. package/dist/spring/index.d.ts +8 -4
  81. package/dist/spring/index.js +21 -6
  82. package/dist/spring/measure-spring.d.ts +1 -1
  83. package/dist/timeline-inout-position-state.d.ts +1 -1
  84. package/dist/timeline-position-state.d.ts +1 -1
  85. package/dist/use-current-frame.d.ts +7 -0
  86. package/dist/use-current-frame.js +25 -0
  87. package/dist/use-lazy-component.d.ts +3 -3
  88. package/dist/use-lazy-component.js +5 -1
  89. package/dist/use-media-in-timeline.d.ts +2 -2
  90. package/dist/use-media-in-timeline.js +2 -2
  91. package/dist/use-media-playback.d.ts +3 -2
  92. package/dist/use-media-playback.js +8 -5
  93. package/dist/use-media-tag-volume.d.ts +1 -1
  94. package/dist/use-sync-volume-with-media-tag.d.ts +2 -2
  95. package/dist/use-unsafe-video-config.d.ts +1 -1
  96. package/dist/use-unsafe-video-config.js +2 -2
  97. package/dist/use-video-config.d.ts +1 -1
  98. package/dist/validate-media-props.d.ts +4 -3
  99. package/dist/validation/validate-every-nth-frame.d.ts +1 -0
  100. package/dist/validation/validate-every-nth-frame.js +21 -0
  101. package/dist/validation/validate-image-format.d.ts +1 -1
  102. package/dist/validation/validate-offthreadvideo-image-format.d.ts +1 -0
  103. package/dist/validation/validate-offthreadvideo-image-format.js +15 -0
  104. package/dist/validation/validation-spring-duration.d.ts +1 -0
  105. package/dist/validation/validation-spring-duration.js +21 -0
  106. package/dist/video/OffthreadVideo.d.ts +2 -2
  107. package/dist/video/OffthreadVideo.js +20 -83
  108. package/dist/video/OffthreadVideoForRendering.d.ts +3 -0
  109. package/dist/video/OffthreadVideoForRendering.js +95 -0
  110. package/dist/video/Video.d.ts +1 -1
  111. package/dist/video/Video.js +4 -4
  112. package/dist/video/VideoForDevelopment.d.ts +6 -2
  113. package/dist/video/VideoForDevelopment.js +3 -2
  114. package/dist/video/VideoForRendering.d.ts +1 -1
  115. package/dist/video/VideoForRendering.js +9 -7
  116. package/dist/video/get-current-time.d.ts +5 -0
  117. package/dist/video/get-current-time.js +10 -2
  118. package/dist/video/index.d.ts +3 -2
  119. package/dist/video/index.js +5 -12
  120. package/dist/video/props.d.ts +13 -2
  121. package/dist/volume-prop.js +1 -1
  122. package/dist/warn-about-non-seekable-media.d.ts +1 -1
  123. package/dist/warn-about-non-seekable-media.js +11 -2
  124. package/dist/wrap-remotion-context.d.ts +1 -1
  125. package/dist/wrap-remotion-context.js +8 -4
  126. package/package.json +4 -4
  127. package/.turbo/turbo-lint.log +0 -11
  128. package/.turbo/turbo-test.log +0 -63
@@ -1,5 +1,5 @@
1
- remotion:build: cache hit, replaying output 18641be29acc0312
2
- remotion:build: 
3
- remotion:build: > remotion@3.0.9 build /Users/jonathanburger/remotion/packages/core
4
- remotion:build: > tsc -d
5
- remotion:build: 
1
+ remotion:build: cache hit, replaying output 38e71a8d4ac2f314
2
+ remotion:build: 
3
+ remotion:build: > remotion@3.0.27 build /Users/jonathanburger/remotion/packages/core
4
+ remotion:build: > tsc -d
5
+ remotion:build: 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
- [![Discord Shield](https://discordapp.com/api/guilds/809501355504959528/widget.png?style=shield)](https://discord.gg/6VzzNDwUwV)
7
+ [![Discord Shield](https://discordapp.com/api/guilds/809501355504959528/widget.png?style=shield)](https://remotion.dev/discord)
8
8
  [![NPM Version](http://img.shields.io/npm/v/remotion.svg?style=flat)](https://www.npmjs.org/package/remotion)
9
9
  [![NPM Downloads](https://img.shields.io/npm/dm/remotion.svg?style=flat)](https://npmcharts.com/compare/remotion?minimal=true)
10
10
  [![Install Size](https://packagephobia.now.sh/badge?p=remotion)](https://packagephobia.now.sh/result?p=remotion)
@@ -1,2 +1,7 @@
1
- import React, { HTMLAttributes } from 'react';
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ /**
4
+ * An absolutely positioned <div> element with 100% width, height, and a column flex style
5
+ * @link https://www.remotion.dev/docs/absolute-fill
6
+ */
2
7
  export declare const AbsoluteFill: React.FC<HTMLAttributes<HTMLDivElement>>;
@@ -3,6 +3,10 @@ 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
+ */
6
10
  const AbsoluteFill = (props) => {
7
11
  const { style, ...other } = props;
8
12
  const actualStyle = (0, react_1.useMemo)(() => {
@@ -19,6 +23,6 @@ const AbsoluteFill = (props) => {
19
23
  ...style,
20
24
  };
21
25
  }, [style]);
22
- return (0, jsx_runtime_1.jsx)("div", { style: actualStyle, ...other }, void 0);
26
+ return (0, jsx_runtime_1.jsx)("div", { style: actualStyle, ...other });
23
27
  };
24
28
  exports.AbsoluteFill = AbsoluteFill;
@@ -1,8 +1,5 @@
1
- import React, { ComponentType, FC } from 'react';
2
- export declare const Folder: FC<{
3
- name: string;
4
- children: React.ReactNode;
5
- }>;
1
+ import type { ComponentType } from 'react';
2
+ import React from 'react';
6
3
  declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
7
4
  export declare type CompProps<T> = {
8
5
  lazyComponent: () => Promise<{
@@ -21,5 +18,5 @@ declare type CompositionProps<T> = StillProps<T> & {
21
18
  fps: number;
22
19
  durationInFrames: number;
23
20
  };
24
- export declare const Composition: <T>({ width, height, fps, durationInFrames, id, defaultProps, ...compProps }: CompositionProps<T>) => null;
21
+ export declare const Composition: <T>({ width, height, fps, durationInFrames, id, defaultProps, ...compProps }: CompositionProps<T>) => React.ReactPortal | null;
25
22
  export {};
@@ -1,47 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Composition = exports.Folder = void 0;
3
+ exports.Composition = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const react_dom_1 = require("react-dom");
6
7
  const CompositionManager_1 = require("./CompositionManager");
8
+ const input_props_1 = require("./config/input-props");
9
+ const delay_render_1 = require("./delay-render");
10
+ const Folder_1 = require("./Folder");
11
+ const get_environment_1 = require("./get-environment");
12
+ const loading_indicator_1 = require("./loading-indicator");
7
13
  const nonce_1 = require("./nonce");
8
- const truthy_1 = require("./truthy");
14
+ const portal_node_1 = require("./portal-node");
9
15
  const use_lazy_component_1 = require("./use-lazy-component");
16
+ const use_video_1 = require("./use-video");
10
17
  const validate_composition_id_1 = require("./validation/validate-composition-id");
11
18
  const validate_dimensions_1 = require("./validation/validate-dimensions");
12
19
  const validate_duration_in_frames_1 = require("./validation/validate-duration-in-frames");
13
- const validate_folder_name_1 = require("./validation/validate-folder-name");
14
20
  const validate_fps_1 = require("./validation/validate-fps");
15
- const FolderContext = (0, react_1.createContext)({
16
- folderName: null,
17
- parentName: null,
18
- });
19
- const Folder = ({ name, children, }) => {
20
- const parent = (0, react_1.useContext)(FolderContext);
21
- const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
22
- (0, validate_folder_name_1.validateFolderName)(name);
23
- const parentNameArr = [parent.parentName, parent.folderName].filter(truthy_1.truthy);
24
- const parentName = parentNameArr.length === 0 ? null : parentNameArr.join('/');
25
- const value = (0, react_1.useMemo)(() => {
26
- return {
27
- folderName: name,
28
- parentName,
29
- };
30
- }, [name, parentName]);
21
+ const Fallback = () => {
31
22
  (0, react_1.useEffect)(() => {
32
- registerFolder(name, parentName);
33
- return () => {
34
- unregisterFolder(name, parentName);
35
- };
36
- }, [name, parent.folderName, parentName, registerFolder, unregisterFolder]);
37
- return ((0, jsx_runtime_1.jsx)(FolderContext.Provider, { value: value, children: children }, void 0));
23
+ const fallback = (0, delay_render_1.delayRender)('Waiting for Root component to unsuspend');
24
+ return () => (0, delay_render_1.continueRender)(fallback);
25
+ }, []);
26
+ return null;
38
27
  };
39
- exports.Folder = Folder;
40
28
  const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, ...compProps }) => {
41
29
  const { registerComposition, unregisterComposition } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
30
+ const video = (0, use_video_1.useVideo)();
42
31
  const lazy = (0, use_lazy_component_1.useLazyComponent)(compProps);
43
32
  const nonce = (0, nonce_1.useNonce)();
44
- const { folderName, parentName } = (0, react_1.useContext)(FolderContext);
33
+ const { folderName, parentName } = (0, react_1.useContext)(Folder_1.FolderContext);
45
34
  (0, react_1.useEffect)(() => {
46
35
  // Ensure it's a URL safe id
47
36
  if (!id) {
@@ -81,6 +70,20 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, .
81
70
  nonce,
82
71
  parentName,
83
72
  ]);
73
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'preview' &&
74
+ video &&
75
+ video.component === lazy) {
76
+ const Comp = lazy;
77
+ const inputProps = (0, input_props_1.getInputProps)();
78
+ return (0, react_dom_1.createPortal)((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)());
79
+ }
80
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering' &&
81
+ video &&
82
+ video.component === lazy) {
83
+ const Comp = lazy;
84
+ const inputProps = (0, input_props_1.getInputProps)();
85
+ return (0, react_dom_1.createPortal)((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)());
86
+ }
84
87
  return null;
85
88
  };
86
89
  exports.Composition = Composition;
@@ -1,4 +1,6 @@
1
- import React, { ComponentType, LazyExoticComponent } from 'react';
1
+ import type { ComponentType, LazyExoticComponent } from 'react';
2
+ import React from 'react';
3
+ import type { TFolder } from './Folder';
2
4
  export declare type TComposition<T = unknown> = {
3
5
  width: number;
4
6
  height: number;
@@ -12,7 +14,7 @@ export declare type TComposition<T = unknown> = {
12
14
  nonce: number;
13
15
  };
14
16
  export declare type TCompMetadata = Pick<TComposition, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
15
- export declare type SmallTCompMetadata = Pick<TComposition, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames'>;
17
+ export declare type SmallTCompMetadata = Pick<TComposition, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames'> & Partial<Pick<TComposition, 'defaultProps'>>;
16
18
  declare type EnhancedTSequenceData = {
17
19
  type: 'sequence';
18
20
  } | {
@@ -74,10 +76,6 @@ export declare const CompositionManager: React.Context<CompositionManagerContext
74
76
  export declare const compositionsRef: React.RefObject<{
75
77
  getCompositions: () => TCompMetadata[];
76
78
  }>;
77
- export declare type TFolder = {
78
- name: string;
79
- parent: string | null;
80
- };
81
79
  export declare const CompositionManagerProvider: React.FC<{
82
80
  children: React.ReactNode;
83
81
  }>;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -139,6 +143,6 @@ const CompositionManagerProvider = ({ children }) => {
139
143
  unregisterFolder,
140
144
  folders,
141
145
  ]);
142
- return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: children }, void 0));
146
+ return ((0, jsx_runtime_1.jsx)(exports.CompositionManager.Provider, { value: contextValue, children: children }));
143
147
  };
144
148
  exports.CompositionManagerProvider = CompositionManagerProvider;
@@ -0,0 +1,15 @@
1
+ import type { FC } from 'react';
2
+ export declare type TFolder = {
3
+ name: string;
4
+ parent: string | null;
5
+ };
6
+ declare type FolderContextType = {
7
+ folderName: string | null;
8
+ parentName: string | null;
9
+ };
10
+ export declare const FolderContext: import("react").Context<FolderContextType>;
11
+ export declare const Folder: FC<{
12
+ name: string;
13
+ children: React.ReactNode;
14
+ }>;
15
+ export {};
package/dist/Folder.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Folder = exports.FolderContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const CompositionManager_1 = require("./CompositionManager");
7
+ const truthy_1 = require("./truthy");
8
+ const validate_folder_name_1 = require("./validation/validate-folder-name");
9
+ exports.FolderContext = (0, react_1.createContext)({
10
+ folderName: null,
11
+ parentName: null,
12
+ });
13
+ const Folder = ({ name, children, }) => {
14
+ const parent = (0, react_1.useContext)(exports.FolderContext);
15
+ const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
16
+ (0, validate_folder_name_1.validateFolderName)(name);
17
+ const parentNameArr = [parent.parentName, parent.folderName].filter(truthy_1.truthy);
18
+ const parentName = parentNameArr.length === 0 ? null : parentNameArr.join('/');
19
+ const value = (0, react_1.useMemo)(() => {
20
+ return {
21
+ folderName: name,
22
+ parentName,
23
+ };
24
+ }, [name, parentName]);
25
+ (0, react_1.useEffect)(() => {
26
+ registerFolder(name, parentName);
27
+ return () => {
28
+ unregisterFolder(name, parentName);
29
+ };
30
+ }, [name, parent.folderName, parentName, registerFolder, unregisterFolder]);
31
+ return ((0, jsx_runtime_1.jsx)(exports.FolderContext.Provider, { value: value, children: children }));
32
+ };
33
+ exports.Folder = Folder;
package/dist/IFrame.js CHANGED
@@ -19,6 +19,6 @@ const IFrameRefForwarding = ({ onLoad, onError, ...props }, ref) => {
19
19
  console.error('Error loading iframe:', e, 'Handle the event using the onError() prop to make this message disappear.');
20
20
  }
21
21
  }, [handle, onError]);
22
- return (0, jsx_runtime_1.jsx)("iframe", { ...props, ref: ref, onError: didGetError, onLoad: didLoad }, void 0);
22
+ return (0, jsx_runtime_1.jsx)("iframe", { ...props, ref: ref, onError: didGetError, onLoad: didLoad });
23
23
  };
24
24
  exports.IFrame = (0, react_1.forwardRef)(IFrameRefForwarding);
package/dist/Img.js CHANGED
@@ -4,43 +4,39 @@ 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 ImgRefForwarding = ({ onLoad, onError, ...props }, ref) => {
8
- const [handle, setHandle] = (0, react_1.useState)(() => {
9
- return null;
7
+ const ImgRefForwarding = ({ onError, ...props }, ref) => {
8
+ const imageRef = (0, react_1.useRef)(null);
9
+ (0, react_1.useImperativeHandle)(ref, () => {
10
+ return imageRef.current;
10
11
  });
11
- (0, react_1.useEffect)(() => {
12
- if (ref &&
13
- ref.current.complete &&
14
- handle) {
15
- (0, delay_render_1.continueRender)(handle);
16
- }
17
- }, [handle, ref]);
18
- const didLoad = (0, react_1.useCallback)((e) => {
19
- if (handle) {
20
- (0, delay_render_1.continueRender)(handle);
21
- }
22
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
23
- }, [handle, onLoad]);
24
12
  const didGetError = (0, react_1.useCallback)((e) => {
25
- if (handle) {
26
- (0, delay_render_1.continueRender)(handle);
27
- }
13
+ var _a;
28
14
  if (onError) {
29
15
  onError(e);
30
16
  }
31
17
  else {
32
- console.error('Error loading image:', e, 'Handle the event using the onError() prop to make this message disappear.');
18
+ console.error('Error loading image with src:', (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src, e, 'Handle the event using the onError() prop to make this message disappear.');
33
19
  }
34
- }, [handle, onError]);
20
+ }, [onError]);
35
21
  // If image source switches, make new handle
36
- (0, react_1.useEffect)(() => {
22
+ (0, react_1.useLayoutEffect)(() => {
37
23
  const newHandle = (0, delay_render_1.delayRender)('Loading <Img> with src=' + props.src);
38
- setHandle(newHandle);
24
+ const { current } = imageRef;
25
+ const didLoad = () => {
26
+ (0, delay_render_1.continueRender)(newHandle);
27
+ };
28
+ if (current === null || current === void 0 ? void 0 : current.complete) {
29
+ (0, delay_render_1.continueRender)(newHandle);
30
+ }
31
+ else {
32
+ current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
33
+ }
39
34
  // If tag gets unmounted, clear pending handles because image is not going to load
40
35
  return () => {
36
+ current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
41
37
  (0, delay_render_1.continueRender)(newHandle);
42
38
  };
43
39
  }, [props.src]);
44
- return (0, jsx_runtime_1.jsx)("img", { ...props, ref: ref, onLoad: didLoad, onError: didGetError }, void 0);
40
+ return (0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, onError: didGetError });
45
41
  };
46
42
  exports.Img = (0, react_1.forwardRef)(ImgRefForwarding);
@@ -65,6 +65,6 @@ const RemotionRoot = ({ children }) => {
65
65
  // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
66
66
  , {
67
67
  // In the preview, which is mostly played on Desktop, we opt out of the autoplay policy fix as described in https://github.com/remotion-dev/remotion/pull/554, as it mostly applies to mobile.
68
- numberOfAudioTags: 0, children: children }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
68
+ numberOfAudioTags: 0, children: children }) }) }) }) }));
69
69
  };
70
70
  exports.RemotionRoot = RemotionRoot;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ export declare type SequenceContextType = {
3
+ cumulatedFrom: number;
4
+ relativeFrom: number;
5
+ parentFrom: number;
6
+ durationInFrames: number;
7
+ id: string;
8
+ };
9
+ export declare const SequenceContext: React.Context<SequenceContextType | null>;
10
+ declare type LayoutAndStyle = {
11
+ layout: 'none';
12
+ } | {
13
+ layout?: 'absolute-fill';
14
+ style?: React.CSSProperties;
15
+ };
16
+ export declare type SequenceProps = {
17
+ children: React.ReactNode;
18
+ from: number;
19
+ durationInFrames?: number;
20
+ name?: string;
21
+ showInTimeline?: boolean;
22
+ showLoopTimesInTimeline?: number;
23
+ } & LayoutAndStyle;
24
+ export declare const Sequence: React.FC<SequenceProps>;
25
+ export {};
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sequence = exports.SequenceContext = 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 CompositionManager_1 = require("./CompositionManager");
8
+ const get_timeline_clip_name_1 = require("./get-timeline-clip-name");
9
+ const nonce_1 = require("./nonce");
10
+ const timeline_position_state_1 = require("./timeline-position-state");
11
+ const use_current_frame_1 = require("./use-current-frame");
12
+ const use_unsafe_video_config_1 = require("./use-unsafe-video-config");
13
+ exports.SequenceContext = (0, react_1.createContext)(null);
14
+ const Sequence = ({ from, durationInFrames = Infinity, children, name, showInTimeline = true, showLoopTimesInTimeline, ...other }) => {
15
+ const { layout = 'absolute-fill' } = other;
16
+ const [id] = (0, react_1.useState)(() => String(Math.random()));
17
+ const parentSequence = (0, react_1.useContext)(exports.SequenceContext);
18
+ const { rootId } = (0, react_1.useContext)(timeline_position_state_1.TimelineContext);
19
+ const cumulatedFrom = parentSequence
20
+ ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
21
+ : 0;
22
+ const actualFrom = cumulatedFrom + from;
23
+ const nonce = (0, nonce_1.useNonce)();
24
+ if (layout !== 'absolute-fill' && layout !== 'none') {
25
+ throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
26
+ }
27
+ // @ts-expect-error
28
+ if (layout === 'none' && typeof other.style !== 'undefined') {
29
+ throw new TypeError('If layout="none", you may not pass a style.');
30
+ }
31
+ if (typeof durationInFrames !== 'number') {
32
+ throw new TypeError(`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`);
33
+ }
34
+ if (durationInFrames <= 0) {
35
+ throw new TypeError(`durationInFrames must be positive, but got ${durationInFrames}`);
36
+ }
37
+ // Infinity is non-integer but allowed!
38
+ if (durationInFrames % 1 !== 0 && Number.isFinite(durationInFrames)) {
39
+ throw new TypeError(`The "durationInFrames" of a sequence must be an integer, but got ${durationInFrames}.`);
40
+ }
41
+ if (typeof from !== 'number') {
42
+ throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof from}, but it must be a number.`);
43
+ }
44
+ if (from % 1 !== 0) {
45
+ throw new TypeError(`The "from" prop of a sequence must be an integer, but got ${from}.`);
46
+ }
47
+ const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
48
+ const unsafeVideoConfig = (0, use_unsafe_video_config_1.useUnsafeVideoConfig)();
49
+ const compositionDuration = unsafeVideoConfig
50
+ ? unsafeVideoConfig.durationInFrames
51
+ : 0;
52
+ const actualDurationInFrames = Math.min(compositionDuration - from, parentSequence
53
+ ? Math.min(parentSequence.durationInFrames +
54
+ (parentSequence.cumulatedFrom + parentSequence.relativeFrom) -
55
+ actualFrom, durationInFrames)
56
+ : durationInFrames);
57
+ const { registerSequence, unregisterSequence } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
58
+ const contextValue = (0, react_1.useMemo)(() => {
59
+ var _a;
60
+ return {
61
+ cumulatedFrom,
62
+ relativeFrom: from,
63
+ durationInFrames: actualDurationInFrames,
64
+ parentFrom: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0,
65
+ id,
66
+ };
67
+ }, [
68
+ cumulatedFrom,
69
+ from,
70
+ actualDurationInFrames,
71
+ parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom,
72
+ id,
73
+ ]);
74
+ const timelineClipName = (0, react_1.useMemo)(() => {
75
+ return name !== null && name !== void 0 ? name : (0, get_timeline_clip_name_1.getTimelineClipName)(children);
76
+ }, [children, name]);
77
+ (0, react_1.useEffect)(() => {
78
+ var _a;
79
+ registerSequence({
80
+ from,
81
+ duration: actualDurationInFrames,
82
+ id,
83
+ displayName: timelineClipName,
84
+ parent: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _a !== void 0 ? _a : null,
85
+ type: 'sequence',
86
+ rootId,
87
+ showInTimeline,
88
+ nonce,
89
+ showLoopTimesInTimeline,
90
+ });
91
+ return () => {
92
+ unregisterSequence(id);
93
+ };
94
+ }, [
95
+ durationInFrames,
96
+ actualFrom,
97
+ id,
98
+ name,
99
+ registerSequence,
100
+ timelineClipName,
101
+ unregisterSequence,
102
+ parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id,
103
+ actualDurationInFrames,
104
+ rootId,
105
+ from,
106
+ showInTimeline,
107
+ nonce,
108
+ showLoopTimesInTimeline,
109
+ ]);
110
+ const endThreshold = (() => {
111
+ return actualFrom + durationInFrames - 1;
112
+ })();
113
+ const content = absoluteFrame < actualFrom
114
+ ? null
115
+ : absoluteFrame > endThreshold
116
+ ? null
117
+ : children;
118
+ const styleIfThere = other.layout === 'none' ? undefined : other.style;
119
+ const defaultStyle = (0, react_1.useMemo)(() => {
120
+ return {
121
+ flexDirection: undefined,
122
+ ...(styleIfThere !== null && styleIfThere !== void 0 ? styleIfThere : {}),
123
+ };
124
+ }, [styleIfThere]);
125
+ return ((0, jsx_runtime_1.jsx)(exports.SequenceContext.Provider, { value: contextValue, children: content === null ? null : layout === 'absolute-fill' ? ((0, jsx_runtime_1.jsx)(AbsoluteFill_1.AbsoluteFill, { style: defaultStyle, children: content })) : (content) }));
126
+ };
127
+ exports.Sequence = Sequence;
package/dist/Still.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { StillProps } from './Composition';
1
+ import type { StillProps } from './Composition';
2
2
  export declare const Still: <T>(props: StillProps<T>) => JSX.Element;
package/dist/Still.js CHANGED
@@ -4,6 +4,6 @@ exports.Still = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const Composition_1 = require("./Composition");
6
6
  const Still = (props) => {
7
- return (0, jsx_runtime_1.jsx)(Composition_1.Composition, { fps: 1, durationInFrames: 1, ...props }, void 0);
7
+ return (0, jsx_runtime_1.jsx)(Composition_1.Composition, { fps: 1, durationInFrames: 1, ...props });
8
8
  };
9
9
  exports.Still = Still;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { RemotionMainAudioProps } from './props';
2
+ import type { RemotionMainAudioProps } from './props';
3
3
  export declare const Audio: React.ForwardRefExoticComponent<Pick<Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, "onEnded" | "autoPlay" | "controls" | "loop"> & {
4
4
  volume?: import("../volume-prop").VolumeProp | undefined;
5
5
  playbackRate?: number | undefined;
@@ -4,7 +4,7 @@ exports.Audio = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const get_environment_1 = require("../get-environment");
7
- const sequencing_1 = require("../sequencing");
7
+ const Sequence_1 = require("../Sequence");
8
8
  const validate_media_props_1 = require("../validate-media-props");
9
9
  const validate_start_from_props_1 = require("../validate-start-from-props");
10
10
  const AudioForDevelopment_1 = require("./AudioForDevelopment");
@@ -21,12 +21,12 @@ const AudioRefForwardingFunction = (props, ref) => {
21
21
  (0, validate_start_from_props_1.validateStartFromProps)(startFrom, endAt);
22
22
  const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
23
23
  const endAtFrameNo = endAt !== null && endAt !== void 0 ? endAt : Infinity;
24
- return ((0, jsx_runtime_1.jsx)(sequencing_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...otherProps, ref: ref }, void 0) }, void 0));
24
+ return ((0, jsx_runtime_1.jsx)(Sequence_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.Audio, { ...otherProps, ref: ref }) }));
25
25
  }
26
26
  (0, validate_media_props_1.validateMediaProps)(props, 'Audio');
27
27
  if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
28
- return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError }, void 0);
28
+ return (0, jsx_runtime_1.jsx)(AudioForRendering_1.AudioForRendering, { ...props, ref: ref, onError: onError });
29
29
  }
30
- return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }, void 0));
30
+ return ((0, jsx_runtime_1.jsx)(AudioForDevelopment_1.AudioForDevelopment, { shouldPreMountAudioTags: audioContext !== null && audioContext.numberOfAudioTags > 0, ...props, ref: ref, onError: onError }));
31
31
  };
32
32
  exports.Audio = (0, react_1.forwardRef)(AudioRefForwardingFunction);
@@ -46,6 +46,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
46
46
  src: nativeProps.src,
47
47
  mediaType: 'audio',
48
48
  playbackRate: playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1,
49
+ onlyWarnForMediaSeekingError: false,
49
50
  });
50
51
  (0, react_1.useImperativeHandle)(ref, () => {
51
52
  return audioRef.current;
@@ -53,6 +54,6 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
53
54
  if (initialShouldPreMountAudioElements) {
54
55
  return null;
55
56
  }
56
- return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass }, void 0);
57
+ return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...propsToPass });
57
58
  };
58
59
  exports.AudioForDevelopment = (0, react_1.forwardRef)(AudioForDevelopmentForwardRefFunction);
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { RemotionAudioProps } from './props';
2
+ import type { RemotionAudioProps } from './props';
3
3
  export declare const AudioForRendering: React.ForwardRefExoticComponent<Pick<RemotionAudioProps, "style" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "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" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "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" | "src" | "volume" | "playbackRate" | "controlsList" | "crossOrigin" | "mediaGroup" | "muted" | "playsInline" | "preload" | "key"> & React.RefAttributes<HTMLAudioElement>>;
@@ -6,16 +6,16 @@ const react_1 = require("react");
6
6
  const absolute_src_1 = require("../absolute-src");
7
7
  const CompositionManager_1 = require("../CompositionManager");
8
8
  const random_1 = require("../random");
9
- const sequencing_1 = require("../sequencing");
10
- const use_frame_1 = require("../use-frame");
9
+ const Sequence_1 = require("../Sequence");
10
+ const use_current_frame_1 = require("../use-current-frame");
11
11
  const volume_prop_1 = require("../volume-prop");
12
12
  const use_audio_frame_1 = require("./use-audio-frame");
13
13
  const AudioForRenderingRefForwardingFunction = (props, ref) => {
14
14
  const audioRef = (0, react_1.useRef)(null);
15
- const absoluteFrame = (0, use_frame_1.useAbsoluteCurrentFrame)();
15
+ const absoluteFrame = (0, use_current_frame_1.useAbsoluteCurrentFrame)();
16
16
  const volumePropFrame = (0, use_audio_frame_1.useFrameForVolumeProp)();
17
- const frame = (0, use_frame_1.useCurrentFrame)();
18
- const sequenceContext = (0, react_1.useContext)(sequencing_1.SequenceContext);
17
+ const frame = (0, use_current_frame_1.useCurrentFrame)();
18
+ const sequenceContext = (0, react_1.useContext)(Sequence_1.SequenceContext);
19
19
  const { registerAsset, unregisterAsset } = (0, react_1.useContext)(CompositionManager_1.CompositionManager);
20
20
  // Generate a string that's as unique as possible for this asset
21
21
  // but at the same time the same on all threads
@@ -63,6 +63,6 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
63
63
  playbackRate,
64
64
  props.playbackRate,
65
65
  ]);
66
- return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps }, void 0);
66
+ return (0, jsx_runtime_1.jsx)("audio", { ref: audioRef, ...nativeProps });
67
67
  };
68
68
  exports.AudioForRendering = (0, react_1.forwardRef)(AudioForRenderingRefForwardingFunction);
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { VolumeProp } from '../volume-prop';
2
+ import type { VolumeProp } from '../volume-prop';
3
3
  export declare type RemotionMainAudioProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { RemotionAudioProps } from './props';
2
+ import type { RemotionAudioProps } from './props';
3
3
  /**
4
4
  * This functionality of Remotion will keep a certain amount
5
5
  * of <audio> tags pre-mounted and by default filled with an empty audio track.