remotion 4.0.178 → 4.0.180

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 (81) hide show
  1. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/CanUseRemotionHooks.d.ts +1 -1
  2. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/Composition.js +3 -3
  3. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/CompositionManager.d.ts +2 -4
  4. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/CompositionManager.js +1 -1
  5. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/IFrame.d.ts +1 -4
  6. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/IFrame.js +2 -5
  7. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/Img.d.ts +3 -5
  8. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/Img.js +5 -18
  9. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/RemotionRoot.d.ts +2 -2
  10. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/RemotionRoot.js +4 -5
  11. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/ResolveCompositionConfig.js +1 -1
  12. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/Sequence.d.ts +2 -11
  13. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/Sequence.js +3 -43
  14. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/SequenceContext.d.ts +0 -1
  15. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/Audio.d.ts +1 -4
  16. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/Audio.js +1 -1
  17. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/AudioForPreview.d.ts +6 -7
  18. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/AudioForPreview.js +5 -10
  19. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/AudioForRendering.d.ts +1 -4
  20. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/AudioForRendering.js +7 -18
  21. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/props.d.ts +0 -4
  22. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/use-audio-frame.d.ts +1 -2
  23. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/audio/use-audio-frame.js +2 -7
  24. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/delay-render.d.ts +1 -7
  25. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/delay-render.js +5 -11
  26. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/freeze.js +9 -5
  27. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/index.d.ts +4 -6
  28. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/internals.d.ts +9 -4
  29. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/internals.js +5 -0
  30. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/loop/index.d.ts +5 -13
  31. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/loop/index.js +3 -15
  32. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/no-react.d.ts +2 -12
  33. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/no-react.js +2 -12
  34. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/series/index.js +1 -1
  35. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/spring/index.d.ts +2 -2
  36. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/spring/measure-spring.d.ts +1 -1
  37. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/audio-for-rendering.test.js +11 -10
  38. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/freeze.test.js +1 -1
  39. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/not-all-props-in-media-tags.test.js +3 -3
  40. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/sequence-from-initial-offset.test.js +17 -2
  41. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/sequence-validation.test.js +4 -3
  42. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/spring-bench.test.js +1 -1
  43. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/spring.test.js +3 -3
  44. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/static-file-errors.test.js +4 -6
  45. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/use-media-in-timeline.test.js +4 -3
  46. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/use-media-tag-volume.test.js +31 -1
  47. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/video.test.js +2 -1
  48. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/wrap-sequence-context.d.ts +3 -1
  49. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/test/wrap-sequence-context.js +1 -1
  50. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/use-media-buffering.d.ts +1 -5
  51. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/use-media-buffering.js +2 -12
  52. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/use-media-in-timeline.d.ts +1 -2
  53. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/use-media-in-timeline.js +3 -5
  54. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/version.d.ts +1 -1
  55. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/version.js +1 -1
  56. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/OffthreadVideo.js +1 -1
  57. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/OffthreadVideoForRendering.js +5 -8
  58. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/Video.d.ts +2 -5
  59. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/Video.js +2 -2
  60. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/VideoForPreview.d.ts +7 -7
  61. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/VideoForPreview.js +10 -13
  62. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/VideoForRendering.d.ts +1 -4
  63. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/VideoForRendering.js +7 -18
  64. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/index.d.ts +1 -1
  65. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/props.d.ts +0 -5
  66. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/video/video-fragment.js +5 -9
  67. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/wrap-remotion-context.js +3 -3
  68. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/tsconfig-esm.tsbuildinfo +1 -1
  69. package/dist/cjs/validation/validate-composition-id.js +1 -1
  70. package/dist/cjs/version.d.ts +1 -1
  71. package/dist/cjs/version.js +1 -1
  72. package/dist/cjs/video/Video.d.ts +1 -1
  73. package/dist/cjs/video/VideoForPreview.js +1 -1
  74. package/dist/cjs/video/VideoForRendering.d.ts +1 -1
  75. package/dist/cjs/video/props.d.ts +1 -1
  76. package/dist/esm/index.mjs +3 -2
  77. package/dist/esm/version.mjs +1 -1
  78. package/dist/tsconfig-esm.tsbuildinfo +1 -0
  79. package/package.json +1 -1
  80. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/v5-flag.d.ts +0 -1
  81. package/.rollup.cache/Users/jonathanburger/remotion/packages/core/dist/esm/v5-flag.js +0 -1
@@ -1,4 +1,3 @@
1
- import { cancelRender } from './cancel-render.js';
2
1
  import { getRemotionEnvironment } from './get-remotion-environment.js';
3
2
  import { truthy } from './truthy.js';
4
3
  if (typeof window !== 'undefined') {
@@ -9,8 +8,6 @@ if (typeof window !== 'undefined') {
9
8
  window.remotion_delayRenderTimeouts = {};
10
9
  }
11
10
  export const DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
12
- export const DELAY_RENDER_RETRIES_LEFT = 'Retries left: ';
13
- export const DELAY_RENDER_RETRY_TOKEN = '- Rendering the frame will be retried.';
14
11
  const defaultTimeout = 30000;
15
12
  /**
16
13
  * @description Call this function to tell Remotion to wait before capturing this frame until data has loaded. Use continueRender() to unblock the render.
@@ -18,8 +15,8 @@ const defaultTimeout = 30000;
18
15
  * @returns {number} An identifier to be passed to continueRender().
19
16
  * @see [Documentation](https://www.remotion.dev/docs/delay-render)
20
17
  */
21
- export const delayRender = (label, options) => {
22
- var _a, _b, _c, _d, _e;
18
+ export const delayRender = (label) => {
19
+ var _a, _b, _c;
23
20
  if (typeof label !== 'string' && typeof label !== 'undefined') {
24
21
  throw new Error('The label parameter of delayRender() must be a string or undefined, got: ' +
25
22
  JSON.stringify(label));
@@ -28,11 +25,10 @@ export const delayRender = (label, options) => {
28
25
  handles.push(handle);
29
26
  const called = (_b = (_a = Error().stack) === null || _a === void 0 ? void 0 : _a.replace(/^Error/g, '')) !== null && _b !== void 0 ? _b : '';
30
27
  if (getRemotionEnvironment().isRendering) {
31
- const timeoutToUse = ((_c = options === null || options === void 0 ? void 0 : options.timeoutInMilliseconds) !== null && _c !== void 0 ? _c : (typeof window === 'undefined'
28
+ const timeoutToUse = typeof window === 'undefined'
32
29
  ? defaultTimeout
33
- : (_d = window.remotion_puppeteerTimeout) !== null && _d !== void 0 ? _d : defaultTimeout)) - 2000;
30
+ : ((_c = window.remotion_puppeteerTimeout) !== null && _c !== void 0 ? _c : defaultTimeout) - 2000;
34
31
  if (typeof window !== 'undefined') {
35
- const retriesLeft = ((_e = options === null || options === void 0 ? void 0 : options.retries) !== null && _e !== void 0 ? _e : 0) - (window.remotion_attempt - 1);
36
32
  window.remotion_delayRenderTimeouts[handle] = {
37
33
  label: label !== null && label !== void 0 ? label : null,
38
34
  timeout: setTimeout(() => {
@@ -40,14 +36,12 @@ export const delayRender = (label, options) => {
40
36
  `A delayRender()`,
41
37
  label ? `"${label}"` : null,
42
38
  `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
43
- retriesLeft > 0 ? DELAY_RENDER_RETRIES_LEFT + retriesLeft : null,
44
- retriesLeft > 0 ? DELAY_RENDER_RETRY_TOKEN : null,
45
39
  DELAY_RENDER_CALLSTACK_TOKEN,
46
40
  called,
47
41
  ]
48
42
  .filter(truthy)
49
43
  .join(' ');
50
- cancelRender(Error(message));
44
+ throw new Error(message);
51
45
  }, timeoutToUse),
52
46
  };
53
47
  }
@@ -9,7 +9,6 @@ import { useVideoConfig } from './use-video-config.js';
9
9
  * @see [Documentation](https://www.remotion.dev/docs/freeze)
10
10
  */
11
11
  export const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
12
- var _a;
13
12
  const frame = useCurrentFrame();
14
13
  const videoConfig = useVideoConfig();
15
14
  if (typeof frameToFreeze === 'undefined') {
@@ -34,7 +33,6 @@ export const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
34
33
  }, [active, frame]);
35
34
  const timelineContext = useContext(TimelineContext);
36
35
  const sequenceContext = useContext(SequenceContext);
37
- const relativeFrom = (_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0;
38
36
  const timelineValue = useMemo(() => {
39
37
  if (!isActive) {
40
38
  return timelineContext;
@@ -46,9 +44,15 @@ export const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
46
44
  current: false,
47
45
  },
48
46
  frame: {
49
- [videoConfig.id]: frameToFreeze + relativeFrom,
47
+ [videoConfig.id]: frameToFreeze,
50
48
  },
51
49
  };
52
- }, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
53
- return (_jsx(TimelineContext.Provider, { value: timelineValue, children: children }));
50
+ }, [timelineContext, frameToFreeze, isActive, videoConfig.id]);
51
+ const sequenceValue = useMemo(() => {
52
+ if (isActive) {
53
+ return null;
54
+ }
55
+ return sequenceContext;
56
+ }, [isActive, sequenceContext]);
57
+ return (_jsx(TimelineContext.Provider, { value: timelineValue, children: _jsx(SequenceContext.Provider, { value: sequenceValue, children: children }) }));
54
58
  };
@@ -1,4 +1,4 @@
1
- /// <reference types="bun-types" />
1
+ /// <reference types="node" />
2
2
  /// <reference types="react" />
3
3
  import './asset-types.js';
4
4
  import type { Codec } from './codec.js';
@@ -16,7 +16,7 @@ declare global {
16
16
  remotion_delayRenderTimeouts: {
17
17
  [key: string]: {
18
18
  label: string | null;
19
- timeout: number | Timer;
19
+ timeout: number | NodeJS.Timeout;
20
20
  };
21
21
  };
22
22
  remotion_cancelledError: string | undefined;
@@ -26,15 +26,13 @@ declare global {
26
26
  remotion_setBundleMode: (bundleMode: BundleState) => void;
27
27
  remotion_staticBase: string;
28
28
  remotion_staticFiles: StaticFile[];
29
- remotion_publicPath: string;
30
29
  remotion_publicFolderExists: string | null;
31
30
  remotion_editorName: string | null;
32
31
  remotion_numberOfAudioTags: number;
33
32
  remotion_projectName: string;
34
33
  remotion_cwd: string;
35
34
  remotion_studioServerCommand: string;
36
- remotion_setFrame: (frame: number, composition: string, attempt: number) => void;
37
- remotion_attempt: number;
35
+ remotion_setFrame: (frame: number, composition: string) => void;
38
36
  remotion_initialFrame: number;
39
37
  remotion_proxyPort: number;
40
38
  remotion_audioEnabled: boolean;
@@ -48,7 +46,7 @@ declare global {
48
46
  remotion_isStudio: boolean;
49
47
  remotion_isBuilding: undefined | (() => void);
50
48
  remotion_finishedBuilding: undefined | (() => void);
51
- siteVersion: '11';
49
+ siteVersion: '10';
52
50
  remotion_version: string;
53
51
  remotion_imported: string | boolean;
54
52
  remotion_unsavedProps: boolean | undefined;
@@ -18,8 +18,8 @@ export declare const Internals: {
18
18
  readonly SequenceManager: import("react").Context<import("./SequenceManager.js").SequenceManagerContext>;
19
19
  readonly SequenceVisibilityToggleContext: import("react").Context<import("./SequenceManager.js").SequenceVisibilityToggleState>;
20
20
  readonly RemotionRoot: import("react").FC<{
21
- readonly children: import("react").ReactNode;
22
- readonly numberOfAudioTags: number;
21
+ children: import("react").ReactNode;
22
+ numberOfAudioTags: number;
23
23
  }>;
24
24
  readonly useVideo: () => (import("./video-config.js").VideoConfig & {
25
25
  component: import("react").LazyExoticComponent<import("react").ComponentType<Record<string, unknown>>>;
@@ -69,7 +69,7 @@ export declare const Internals: {
69
69
  readonly portalNode: () => HTMLElement;
70
70
  readonly waitForRoot: (fn: (comp: import("react").FC<{}>) => void) => () => void;
71
71
  readonly CanUseRemotionHooksProvider: import("react").FC<{
72
- readonly children: import("react").ReactNode;
72
+ children: import("react").ReactNode;
73
73
  }>;
74
74
  readonly CanUseRemotionHooks: import("react").Context<boolean>;
75
75
  readonly PrefetchProvider: import("react").FC<{
@@ -116,6 +116,8 @@ export declare const Internals: {
116
116
  [x: string]: number;
117
117
  }) => void;
118
118
  readonly useTimelineSetFrame: () => (u: import("react").SetStateAction<Record<string, number>>) => void;
119
+ readonly FILE_TOKEN: "remotion-file:";
120
+ readonly DATE_TOKEN: "remotion-date:";
119
121
  readonly NativeLayersProvider: import("react").FC<{
120
122
  children?: import("react").ReactNode;
121
123
  }>;
@@ -144,6 +146,9 @@ export declare const Internals: {
144
146
  buffering: import("react").MutableRefObject<boolean>;
145
147
  } | null>;
146
148
  readonly enableSequenceStackTraces: () => void;
149
+ readonly colorNames: {
150
+ [key: string]: number;
151
+ };
147
152
  readonly CurrentScaleContext: import("react").Context<import("./use-current-scale.js").CurrentScaleContextType | null>;
148
153
  readonly PreviewSizeContext: import("react").Context<import("./use-current-scale.js").PreviewSizeCtx>;
149
154
  readonly calculateScale: ({ canvasSize, compositionHeight, compositionWidth, previewSize, }: {
@@ -156,4 +161,4 @@ export declare const Internals: {
156
161
  };
157
162
  }) => number;
158
163
  };
159
- export type { CompositionManagerContext, CompProps, MediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TRenderAsset as TAsset, TCompMetadata, TComposition, TimelinePosition as Timeline, TimelineContextValue, TSequence, WatchRemotionStaticFilesPayload, };
164
+ export type { TComposition, TimelinePosition as Timeline, TCompMetadata, TSequence, TRenderAsset as TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, SerializedJSONWithCustomFields, WatchRemotionStaticFilesPayload, };
@@ -10,6 +10,8 @@ import { EditorPropsContext, EditorPropsProvider } from './EditorProps.js';
10
10
  import { addSequenceStackTraces, enableSequenceStackTraces, } from './enable-sequence-stack-traces.js';
11
11
  import { getPreviewDomElement, REMOTION_STUDIO_CONTAINER_ELEMENT, } from './get-preview-dom-element.js';
12
12
  import { getRemotionEnvironment } from './get-remotion-environment.js';
13
+ import { DATE_TOKEN, FILE_TOKEN } from './input-props-serialization.js';
14
+ import { colorNames } from './interpolate-colors.js';
13
15
  import { IsPlayerContextProvider, useIsPlayer } from './is-player.js';
14
16
  import { NativeLayersProvider } from './NativeLayers.js';
15
17
  import { NonceContext } from './nonce.js';
@@ -86,6 +88,8 @@ export const Internals = {
86
88
  RenderAssetManager,
87
89
  persistCurrentFrame,
88
90
  useTimelineSetFrame,
91
+ FILE_TOKEN,
92
+ DATE_TOKEN,
89
93
  NativeLayersProvider,
90
94
  ClipComposition,
91
95
  isIosSafari,
@@ -95,6 +99,7 @@ export const Internals = {
95
99
  BufferingProvider,
96
100
  BufferingContextReact,
97
101
  enableSequenceStackTraces,
102
+ colorNames,
98
103
  CurrentScaleContext,
99
104
  PreviewSizeContext,
100
105
  calculateScale,
@@ -1,21 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { LayoutAndStyle } from '../Sequence.js';
3
3
  export type LoopProps = {
4
- readonly durationInFrames: number;
5
- readonly times?: number;
6
- readonly name?: string;
7
- readonly children: React.ReactNode;
8
- } & LayoutAndStyle;
9
- type LoopContextType = {
10
- iteration: number;
11
4
  durationInFrames: number;
12
- };
13
- declare const useLoop: () => LoopContextType | null;
5
+ times?: number;
6
+ name?: string;
7
+ children: React.ReactNode;
8
+ } & LayoutAndStyle;
14
9
  /**
15
10
  * @description This component allows you to quickly lay out an animation so it repeats itself.
16
11
  * @see [Documentation](https://www.remotion.dev/docs/loop)
17
12
  */
18
- export declare const Loop: React.FC<LoopProps> & {
19
- useLoop: typeof useLoop;
20
- };
21
- export {};
13
+ export declare const Loop: React.FC<LoopProps>;
@@ -1,13 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { createContext, useMemo } from 'react';
2
+ import { useMemo } from 'react';
3
3
  import { Sequence } from '../Sequence.js';
4
4
  import { useCurrentFrame } from '../use-current-frame.js';
5
5
  import { useVideoConfig } from '../use-video-config.js';
6
6
  import { validateDurationInFrames } from '../validation/validate-duration-in-frames.js';
7
- const LoopContext = createContext(null);
8
- const useLoop = () => {
9
- return React.useContext(LoopContext);
10
- };
11
7
  /**
12
8
  * @description This component allows you to quickly lay out an animation so it repeats itself.
13
9
  * @see [Documentation](https://www.remotion.dev/docs/loop)
@@ -32,8 +28,7 @@ export const Loop = ({ durationInFrames, times = Infinity, children, name, ...pr
32
28
  const actualTimes = Math.min(maxTimes, times);
33
29
  const style = props.layout === 'none' ? undefined : props.style;
34
30
  const maxFrame = durationInFrames * (actualTimes - 1);
35
- const iteration = Math.floor(currentFrame / durationInFrames);
36
- const start = iteration * durationInFrames;
31
+ const start = Math.floor(currentFrame / durationInFrames) * durationInFrames;
37
32
  const from = Math.min(start, maxFrame);
38
33
  const loopDisplay = useMemo(() => {
39
34
  return {
@@ -42,12 +37,5 @@ export const Loop = ({ durationInFrames, times = Infinity, children, name, ...pr
42
37
  durationInFrames,
43
38
  };
44
39
  }, [actualTimes, durationInFrames, from]);
45
- const loopContext = useMemo(() => {
46
- return {
47
- iteration: Math.floor(currentFrame / durationInFrames),
48
- durationInFrames,
49
- };
50
- }, [currentFrame, durationInFrames]);
51
- return (_jsx(LoopContext.Provider, { value: loopContext, children: _jsx(Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', _remotionInternalLoopDisplay: loopDisplay, layout: props.layout, style: style, children: children }) }));
40
+ return (_jsx(Sequence, { durationInFrames: durationInFrames, from: from, name: name !== null && name !== void 0 ? name : '<Loop>', loopDisplay: loopDisplay, layout: props.layout, style: style, children: children }));
52
41
  };
53
- Loop.useLoop = useLoop;
@@ -1,7 +1,7 @@
1
1
  export type { TRenderAsset } from './CompositionManager';
2
+ export { EasingFunction, ExtrapolateType, interpolate, InterpolateOptions, } from './interpolate';
2
3
  export type { ClipRegion } from './NativeLayers';
3
- export { EasingFunction, ExtrapolateType, InterpolateOptions, interpolate, } from './interpolate';
4
- export { RandomSeed, random } from './random.js';
4
+ export { random, RandomSeed } from './random.js';
5
5
  export type { VideoConfig } from './video-config';
6
6
  import { processColor } from './interpolate-colors';
7
7
  import { truthy } from './truthy';
@@ -29,8 +29,6 @@ export declare const NoReactInternals: {
29
29
  bundleMapName: string;
30
30
  deserializeJSONWithCustomFields: <T = Record<string, unknown>>(data: string) => T;
31
31
  DELAY_RENDER_CALLSTACK_TOKEN: string;
32
- DELAY_RENDER_RETRY_TOKEN: string;
33
- DELAY_RENDER_ATTEMPT_TOKEN: string;
34
32
  getOffthreadVideoSource: ({ src, transparent, currentTime, toneMapped, }: {
35
33
  src: string;
36
34
  transparent: boolean;
@@ -42,12 +40,4 @@ export declare const NoReactInternals: {
42
40
  playbackRate: number;
43
41
  startFrom: number;
44
42
  }) => number;
45
- ENABLE_V5_BREAKING_CHANGES: false;
46
- MIN_NODE_VERSION: number;
47
- MIN_BUN_VERSION: string;
48
- colorNames: {
49
- [key: string]: number;
50
- };
51
- DATE_TOKEN: string;
52
- FILE_TOKEN: string;
53
43
  };
@@ -1,11 +1,9 @@
1
1
  export { interpolate, } from './interpolate';
2
2
  export { random } from './random.js';
3
- import { DELAY_RENDER_CALLSTACK_TOKEN, DELAY_RENDER_RETRIES_LEFT, DELAY_RENDER_RETRY_TOKEN, } from './delay-render';
3
+ import { DELAY_RENDER_CALLSTACK_TOKEN } from './delay-render';
4
4
  import { deserializeJSONWithCustomFields, serializeJSONWithDate, } from './input-props-serialization';
5
- import { DATE_TOKEN, FILE_TOKEN } from './input-props-serialization.js';
6
- import { colorNames, processColor } from './interpolate-colors';
5
+ import { processColor } from './interpolate-colors';
7
6
  import { truthy } from './truthy';
8
- import { ENABLE_V5_BREAKING_CHANGES } from './v5-flag';
9
7
  import { validateFrame } from './validate-frame';
10
8
  import { validateDefaultAndInputProps } from './validation/validate-default-props';
11
9
  import { validateDimension } from './validation/validate-dimensions';
@@ -26,14 +24,6 @@ export const NoReactInternals = {
26
24
  bundleMapName: 'bundle.js.map',
27
25
  deserializeJSONWithCustomFields,
28
26
  DELAY_RENDER_CALLSTACK_TOKEN,
29
- DELAY_RENDER_RETRY_TOKEN,
30
- DELAY_RENDER_ATTEMPT_TOKEN: DELAY_RENDER_RETRIES_LEFT,
31
27
  getOffthreadVideoSource,
32
28
  getExpectedMediaFrameUncorrected,
33
- ENABLE_V5_BREAKING_CHANGES,
34
- MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
35
- MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES ? '1.1.3' : '1.0.3',
36
- colorNames,
37
- DATE_TOKEN,
38
- FILE_TOKEN,
39
29
  };
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Children, forwardRef, useMemo } from 'react';
3
- import { Sequence } from '../Sequence.js';
4
3
  import { addSequenceStackTraces } from '../enable-sequence-stack-traces.js';
4
+ import { Sequence } from '../Sequence.js';
5
5
  import { validateDurationInFrames } from '../validation/validate-duration-in-frames.js';
6
6
  import { flattenChildren } from './flatten-children.js';
7
7
  const SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
@@ -1,4 +1,4 @@
1
- import type { SpringConfig } from './spring-utils';
1
+ import type { SpringConfig } from './spring-utils.js';
2
2
  /**
3
3
  * @description Calculates a position based on physical parameters, start and end value, and time.
4
4
  * @see [Documentation](https://www.remotion.dev/docs/spring)
@@ -28,4 +28,4 @@ export declare function spring({ frame: passedFrame, fps, config, from, to, dura
28
28
  reverse?: boolean;
29
29
  }): number;
30
30
  export { measureSpring } from './measure-spring.js';
31
- export type { SpringConfig } from './spring-utils';
31
+ export { SpringConfig } from './spring-utils.js';
@@ -1,4 +1,4 @@
1
- import type { SpringConfig } from './spring-utils';
1
+ import type { SpringConfig } from './spring-utils.js';
2
2
  /**
3
3
  * @description The function returns how long it takes for a spring animation to settle
4
4
  * @see [Documentation](https://www.remotion.dev/docs/measure-spring)
@@ -4,12 +4,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  */
5
5
  import { render } from '@testing-library/react';
6
6
  import { beforeEach, describe, expect, test, vitest } from 'vitest';
7
+ import { AudioForRendering } from '../audio/AudioForRendering.js';
7
8
  import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
9
+ import { CompositionManager } from '../CompositionManagerContext.js';
8
10
  import { RenderAssetManager } from '../RenderAssetManager.js';
9
11
  import { ResolveCompositionConfig } from '../ResolveCompositionConfig.js';
10
- import { AudioForRendering } from '../audio/AudioForRendering.js';
11
12
  import { expectToThrow } from './expect-to-throw.js';
12
- import { WrapSequenceContext } from './wrap-sequence-context.js';
13
+ import { mockCompositionContext } from './wrap-sequence-context.js';
13
14
  let mockContext;
14
15
  describe('Register and unregister asset', () => {
15
16
  function createMockContext() {
@@ -17,15 +18,15 @@ describe('Register and unregister asset', () => {
17
18
  const unregisterRenderAsset = vitest.fn();
18
19
  window.remotion_audioEnabled = true;
19
20
  const MockProvider = ({ children }) => {
20
- return (_jsx(WrapSequenceContext, { children: _jsx(RenderAssetManager.Provider
21
- // eslint-disable-next-line react/jsx-no-constructed-context-values
22
- , {
21
+ return (_jsx(CanUseRemotionHooksProvider, { children: _jsx(CompositionManager.Provider, { value: mockCompositionContext, children: _jsx(RenderAssetManager.Provider
23
22
  // eslint-disable-next-line react/jsx-no-constructed-context-values
24
- value: {
25
- registerRenderAsset,
26
- unregisterRenderAsset,
27
- renderAssets: [],
28
- }, children: _jsx(ResolveCompositionConfig, { children: children }) }) }));
23
+ , {
24
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
25
+ value: {
26
+ registerRenderAsset,
27
+ unregisterRenderAsset,
28
+ renderAssets: [],
29
+ }, children: _jsx(ResolveCompositionConfig, { children: children }) }) }) }));
29
30
  };
30
31
  return {
31
32
  MockProvider,
@@ -4,8 +4,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  */
5
5
  import { render } from '@testing-library/react';
6
6
  import { describe, expect, test } from 'vitest';
7
- import { Sequence } from '../Sequence.js';
8
7
  import { Freeze } from '../freeze.js';
8
+ import { Sequence } from '../Sequence.js';
9
9
  import { TimelineContext } from '../timeline-position-state.js';
10
10
  import { useCurrentFrame } from '../use-current-frame.js';
11
11
  import { expectToThrow } from './expect-to-throw.js';
@@ -6,19 +6,19 @@ test('Should not have disableRemotePlayback props in the <VideoForPreview> compo
6
6
  const file = path.resolve(process.cwd(), 'dist', 'esm', 'video', 'VideoForPreview.d.ts');
7
7
  const read = fs.readFileSync(file, 'utf-8');
8
8
  expect(read).not.toContain('disableRemotePlayback');
9
- expect(read).toContain('./props');
9
+ expect(read).toContain('./props.js');
10
10
  });
11
11
  test('Should not have disableRemotePlayback props in the <VideoForPreview> component type definition', () => {
12
12
  const file = path.resolve(process.cwd(), 'dist', 'esm', 'video', 'VideoForPreview.d.ts');
13
13
  const read = fs.readFileSync(file, 'utf-8');
14
14
  expect(read).not.toContain('disableRemotePlayback');
15
- expect(read).toContain('./props');
15
+ expect(read).toContain('./props.js');
16
16
  });
17
17
  test('Should not have disableRemotePlayback props in the <AudioForPreview> component type definition', () => {
18
18
  const file = path.resolve(process.cwd(), 'dist', 'esm', 'audio', 'AudioForPreview.d.ts');
19
19
  const read = fs.readFileSync(file, 'utf-8');
20
20
  expect(read).not.toContain('aria-disabled');
21
- expect(read).toContain('./props');
21
+ expect(read).toContain('./props.js');
22
22
  });
23
23
  test('Should not have disableRemotePlayback props in the <AudioForRendering> component type definition', () => {
24
24
  const file = path.resolve(process.cwd(), 'dist', 'esm', 'audio', 'AudioForRendering.d.ts');
@@ -4,17 +4,32 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  */
5
5
  import { render } from '@testing-library/react';
6
6
  import { describe, expect, test } from 'vitest';
7
- import { Sequence } from '../Sequence.js';
7
+ import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
8
8
  import { Freeze } from '../freeze.js';
9
+ import { Sequence } from '../Sequence.js';
10
+ import { TimelineContext } from '../timeline-position-state.js';
9
11
  import { useVideoConfig } from '../use-video-config.js';
10
12
  import { WrapSequenceContext } from './wrap-sequence-context.js';
11
13
  const Inner = () => {
12
14
  const config = useVideoConfig();
13
15
  return _jsx("div", { children: config.durationInFrames });
14
16
  };
17
+ const context = {
18
+ audioAndVideoTags: { current: [] },
19
+ frame: {
20
+ 'my-comp': 100000,
21
+ },
22
+ imperativePlaying: {
23
+ current: false,
24
+ },
25
+ playbackRate: 0,
26
+ playing: false,
27
+ rootId: 'hither',
28
+ setPlaybackRate: () => undefined,
29
+ };
15
30
  describe('Composition-validation render should NOT throw with valid props', () => {
16
31
  test('It should allow undefined as children', () => {
17
- const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(Freeze, { frame: 10000, children: _jsx(Sequence, { durationInFrames: 2424, from: 9265, children: _jsx(Inner, {}) }) }) }));
32
+ const { queryByText } = render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: context, children: _jsx(Freeze, { frame: 10000, children: _jsx(Sequence, { durationInFrames: 2424, from: 9265, children: _jsx(Inner, {}) }) }) }) }) }));
18
33
  expect(queryByText(/^2424$/)).not.toBe(null);
19
34
  });
20
35
  });
@@ -5,13 +5,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { render } from '@testing-library/react';
6
6
  import { renderToString } from 'react-dom/server';
7
7
  import { describe, expect, test } from 'vitest';
8
+ import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
8
9
  import { Sequence } from '../Sequence.js';
9
10
  import { expectToThrow } from './expect-to-throw.js';
10
11
  import { WrapSequenceContext } from './wrap-sequence-context.js';
11
12
  describe('Composition-validation render should throw with invalid props', () => {
12
13
  describe('Throw with invalid duration props', () => {
13
14
  test('It should throw if Sequence has non-integer durationInFrames', () => {
14
- expect(renderToString(_jsx(WrapSequenceContext, { children: _jsx(Sequence, { from: 0, durationInFrames: 1.1, children: "hi" }) }))).toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex">hi</div>');
15
+ expect(renderToString(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { from: 0, durationInFrames: 1.1, children: "hi" }) }) }))).toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex">hi</div>');
15
16
  });
16
17
  test('It should throw if Sequence has negative duration', () => {
17
18
  expectToThrow(
@@ -34,9 +35,9 @@ describe('Composition-validation render should throw with invalid props', () =>
34
35
  });
35
36
  describe('Composition-validation render should NOT throw with valid props', () => {
36
37
  test('It should allow null as children', () => {
37
- expect(() => render(_jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: null }) }))).not.toThrow();
38
+ expect(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: null }) }) }))).not.toThrow();
38
39
  });
39
40
  test('It should allow undefined as children', () => {
40
- expect(() => render(_jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: undefined }) }))).not.toThrow();
41
+ expect(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: undefined }) }) }))).not.toThrow();
41
42
  });
42
43
  });
@@ -26,5 +26,5 @@ test('Springs should calculate fast and cache the natural duration', async () =>
26
26
  resolve(performance.now() - date);
27
27
  });
28
28
  });
29
- expect(time).toBeLessThan(process.platform === 'darwin' || process.platform === 'win32' ? 1500 : 800);
29
+ expect(time).toBeLessThan(process.platform === 'darwin' ? 1500 : 600);
30
30
  });
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, test } from 'vitest';
2
- import { isApproximatelyTheSame } from '../is-approximately-the-same';
3
- import { spring } from '../spring/index';
4
- import { measureSpring } from '../spring/measure-spring';
2
+ import { isApproximatelyTheSame } from '../is-approximately-the-same.js';
3
+ import { spring } from '../spring/index.js';
4
+ import { measureSpring } from '../spring/measure-spring.js';
5
5
  test('Basic spring to equal 0', () => {
6
6
  expect(spring({
7
7
  fps: 30,
@@ -1,12 +1,10 @@
1
1
  import { expect, test } from 'vitest';
2
2
  import { staticFile } from '../static-file.js';
3
3
  test('duplicate staticFile() should throw a warning', () => {
4
- if (typeof Bun === 'undefined') {
5
- // @ts-expect-error
6
- global.window = {
7
- remotion_staticBase: '/static-abcdef',
8
- };
9
- }
4
+ // @ts-expect-error
5
+ global.window = {
6
+ remotion_staticBase: '/static-abcdef',
7
+ };
10
8
  expect(() => staticFile(staticFile('file.mp3'))).toThrow('The value "/static-abcdef/file.mp3" is already prefixed with the static base /static-abcdef. You don\'t need to call staticFile() on it.');
11
9
  });
12
10
  test('"https//" in staticFile() should throw an error', () => {
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { afterAll, beforeAll, expect, test, vitest } from 'vitest';
4
+ import { CompositionManager } from '../CompositionManagerContext.js';
5
+ import { RenderAssetManagerProvider } from '../RenderAssetManager.js';
4
6
  import { ResolveCompositionConfig } from '../ResolveCompositionConfig.js';
5
7
  import { SequenceManager } from '../SequenceManager.js';
6
8
  import { useMediaInTimeline } from '../use-media-in-timeline.js';
7
9
  import * as useVideoConfigModule from '../use-video-config.js';
8
10
  import { renderHook } from './render-hook.js';
9
- import { WrapSequenceContext } from './wrap-sequence-context.js';
11
+ import { mockCompositionContext } from './wrap-sequence-context.js';
10
12
  beforeAll(() => {
11
13
  vitest
12
14
  .spyOn(useVideoConfigModule, 'useVideoConfig')
@@ -36,7 +38,7 @@ test('useMediaInTimeline registers and unregisters new sequence', () => {
36
38
  sequences: [],
37
39
  };
38
40
  }, []);
39
- return (_jsx(WrapSequenceContext, { children: _jsx(SequenceManager.Provider, { value: sequenceManagerContext, children: _jsx(ResolveCompositionConfig, { children: children }) }) }));
41
+ return (_jsx(CompositionManager.Provider, { value: mockCompositionContext, children: _jsx(SequenceManager.Provider, { value: sequenceManagerContext, children: _jsx(RenderAssetManagerProvider, { children: _jsx(ResolveCompositionConfig, { children: children }) }) }) }));
40
42
  };
41
43
  const audioRef = {
42
44
  current: { volume: 0.5 },
@@ -52,7 +54,6 @@ test('useMediaInTimeline registers and unregisters new sequence', () => {
52
54
  id: 'test',
53
55
  stack: null,
54
56
  showInTimeline: true,
55
- premountDisplay: null,
56
57
  }), {
57
58
  wrapper,
58
59
  });
@@ -1,6 +1,36 @@
1
- import { expect, test, vitest } from 'vitest';
1
+ import React from 'react';
2
+ import { afterEach, beforeEach, describe, expect, test, vitest } from 'vitest';
2
3
  import { useMediaTagVolume } from '../use-media-tag-volume.js';
3
4
  import { renderHook } from './render-hook.js';
5
+ describe('Should update state when volume changes', () => {
6
+ const setState = vitest.fn();
7
+ const useStateSpy = vitest.spyOn(React, 'useState');
8
+ beforeEach(() => {
9
+ // @ts-expect-error
10
+ useStateSpy.mockImplementation((init) => [init, setState]);
11
+ });
12
+ afterEach(() => {
13
+ useStateSpy.mockRestore();
14
+ });
15
+ test.skip('has the volume been set', () => {
16
+ const addEventListener = vitest.fn();
17
+ const removeEventListener = vitest.fn();
18
+ let audioRef = {
19
+ current: { volume: 0.5, addEventListener, removeEventListener },
20
+ };
21
+ const { rerender } = renderHook(({ mediaRef }) => useMediaTagVolume(mediaRef), {
22
+ initialProps: { mediaRef: audioRef },
23
+ });
24
+ expect(setState).toHaveBeenCalledWith(0.5);
25
+ audioRef = {
26
+ current: { ...audioRef.current, volume: 0.75 },
27
+ };
28
+ rerender({ mediaRef: audioRef });
29
+ expect(setState).toHaveBeenCalledWith(0.75);
30
+ expect(addEventListener).toHaveBeenCalledWith('volumechange', expect.anything());
31
+ expect(removeEventListener).toHaveBeenCalledWith('volumechange', expect.anything());
32
+ });
33
+ });
4
34
  test('Should listen for volume changes', () => {
5
35
  const addEventListener = vitest.fn();
6
36
  const removeEventListener = vitest.fn();
@@ -4,6 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  */
5
5
  import { render } from '@testing-library/react';
6
6
  import { describe, expect, test } from 'vitest';
7
+ import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
7
8
  import { Video } from '../video/index.js';
8
9
  import { expectToThrow } from './expect-to-throw.js';
9
10
  import { WrapSequenceContext } from './wrap-sequence-context.js';
@@ -21,6 +22,6 @@ describe('Render correctly with props', () => {
21
22
  expect(() => render(_jsx(WrapSequenceContext, { children: _jsx(Video, { src: "test", startFrom: 10, endAt: 15 }) }))).not.toThrow();
22
23
  });
23
24
  test('It should throw if videoConfig/Wrapper is missing', () => {
24
- expectToThrow(() => render(_jsx(Video, { startFrom: 10, endAt: 15 })), /No video config found/);
25
+ expectToThrow(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(Video, { startFrom: 10, endAt: 15 }) })), /No video config found/);
25
26
  });
26
27
  });