remotion 4.0.0-alpha13 → 4.0.0-alpha16

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 (47) hide show
  1. package/dist/cjs/AssetManager.d.ts +1 -1
  2. package/dist/cjs/Composition.d.ts +6 -6
  3. package/dist/cjs/CompositionManager.d.ts +11 -11
  4. package/dist/cjs/CompositionManagerContext.d.ts +2 -2
  5. package/dist/cjs/EditorProps.d.ts +2 -2
  6. package/dist/cjs/Folder.d.ts +2 -2
  7. package/dist/cjs/NativeLayers.d.ts +2 -2
  8. package/dist/cjs/RemotionRoot.js +0 -1
  9. package/dist/cjs/ResolveCompositionConfig.d.ts +2 -2
  10. package/dist/cjs/ResolveCompositionConfig.js +20 -7
  11. package/dist/cjs/Sequence.d.ts +2 -2
  12. package/dist/cjs/SequenceContext.d.ts +1 -1
  13. package/dist/cjs/SequenceManager.d.ts +1 -1
  14. package/dist/cjs/audio/props.d.ts +2 -2
  15. package/dist/cjs/audio/shared-audio-tags.d.ts +2 -2
  16. package/dist/cjs/freeze.d.ts +1 -1
  17. package/dist/cjs/get-environment.d.ts +1 -1
  18. package/dist/cjs/get-static-files.d.ts +1 -1
  19. package/dist/cjs/index.d.ts +4 -3
  20. package/dist/cjs/internals.d.ts +1 -0
  21. package/dist/cjs/internals.js +1 -0
  22. package/dist/cjs/interpolate.d.ts +2 -2
  23. package/dist/cjs/loop/index.d.ts +1 -1
  24. package/dist/cjs/nonce.d.ts +1 -1
  25. package/dist/cjs/prefetch-state.d.ts +1 -1
  26. package/dist/cjs/prefetch.d.ts +1 -1
  27. package/dist/cjs/props-if-has-props.d.ts +3 -3
  28. package/dist/cjs/random.d.ts +1 -1
  29. package/dist/cjs/resolve-video-config.js +9 -2
  30. package/dist/cjs/series/index.d.ts +1 -1
  31. package/dist/cjs/spring/spring-utils.d.ts +2 -2
  32. package/dist/cjs/static-file.d.ts +2 -2
  33. package/dist/cjs/timeline-position-state.d.ts +4 -4
  34. package/dist/cjs/truthy.d.ts +1 -1
  35. package/dist/cjs/use-lazy-component.d.ts +1 -1
  36. package/dist/cjs/use-sync-volume-with-media-tag.d.ts +1 -1
  37. package/dist/cjs/use-video.d.ts +1 -1
  38. package/dist/cjs/version.d.ts +1 -1
  39. package/dist/cjs/version.js +1 -1
  40. package/dist/cjs/video/duration-state.d.ts +3 -3
  41. package/dist/cjs/video/props.d.ts +4 -4
  42. package/dist/cjs/video-config.d.ts +1 -1
  43. package/dist/cjs/volume-position-state.d.ts +4 -4
  44. package/dist/cjs/volume-prop.d.ts +1 -1
  45. package/dist/esm/index.mjs +31 -11
  46. package/dist/esm/version.mjs +1 -1
  47. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { TAsset } from './CompositionManager.js';
3
- export declare type AssetManagerContext = {
3
+ export type AssetManagerContext = {
4
4
  registerAsset: (asset: TAsset) => void;
5
5
  unregisterAsset: (id: string) => void;
6
6
  assets: TAsset[];
@@ -2,34 +2,34 @@ import type { ComponentType } from 'react';
2
2
  import React from 'react';
3
3
  import type { AnyZodObject } from 'zod';
4
4
  import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
5
- declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
6
- export declare type CompProps<Props> = {
5
+ type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
6
+ export type CompProps<Props> = {
7
7
  lazyComponent: () => Promise<{
8
8
  default: LooseComponentType<Props>;
9
9
  }>;
10
10
  } | {
11
11
  component: LooseComponentType<Props>;
12
12
  };
13
- export declare type CalcMetadataReturnType<T> = {
13
+ export type CalcMetadataReturnType<T> = {
14
14
  durationInFrames?: number;
15
15
  fps?: number;
16
16
  width?: number;
17
17
  height?: number;
18
18
  props?: T;
19
19
  };
20
- export declare type CalculateMetadataFunction<T> = (options: {
20
+ export type CalculateMetadataFunction<T> = (options: {
21
21
  defaultProps: T;
22
22
  props: T;
23
23
  abortSignal: AbortSignal;
24
24
  }) => Promise<CalcMetadataReturnType<T>> | CalcMetadataReturnType<T>;
25
- export declare type StillProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
25
+ export type StillProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
26
26
  width: number;
27
27
  height: number;
28
28
  id: string;
29
29
  calculateMetadata?: CalculateMetadataFunction<InferProps<Schema, Props>>;
30
30
  schema?: Schema;
31
31
  } & CompProps<Props> & PropsIfHasProps<Schema, Props>;
32
- export declare type CompositionProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = StillProps<Schema, Props> & {
32
+ export type CompositionProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = StillProps<Schema, Props> & {
33
33
  fps: number;
34
34
  durationInFrames: number;
35
35
  };
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import type { AnyZodObject } from 'zod';
4
4
  import type { CalculateMetadataFunction } from './Composition.js';
5
5
  import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
6
- export declare type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
6
+ export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = {
7
7
  width: number;
8
8
  height: number;
9
9
  fps: number;
@@ -16,13 +16,13 @@ export declare type TComposition<Schema extends AnyZodObject, Props extends Reco
16
16
  schema: Schema | null;
17
17
  calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
18
18
  } & PropsIfHasProps<Schema, Props>;
19
- export declare type AnyComposition = TComposition<AnyZodObject, Record<string, unknown> | undefined>;
20
- export declare type TCompMetadataWithCalcFunction<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps' | 'calculateMetadata'>;
21
- export declare type TCompMetadata<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
22
- export declare type AnyCompMetadata = TCompMetadata<AnyZodObject, Record<string, unknown> | undefined>;
23
- export declare 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 declare type AnySmallCompMetadata = SmallTCompMetadata<AnyZodObject, Record<string, unknown> | undefined>;
25
- declare type EnhancedTSequenceData = {
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
26
  type: 'sequence';
27
27
  } | {
28
28
  type: 'audio';
@@ -39,12 +39,12 @@ declare type EnhancedTSequenceData = {
39
39
  startMediaFrom: number;
40
40
  playbackRate: number;
41
41
  };
42
- export declare type LoopDisplay = {
42
+ export type LoopDisplay = {
43
43
  numberOfTimes: number;
44
44
  startOffset: number;
45
45
  durationInFrames: number;
46
46
  };
47
- export declare type TSequence = {
47
+ export type TSequence = {
48
48
  from: number;
49
49
  duration: number;
50
50
  id: string;
@@ -55,7 +55,7 @@ export declare type TSequence = {
55
55
  nonce: number;
56
56
  loopDisplay: LoopDisplay | undefined;
57
57
  } & EnhancedTSequenceData;
58
- export declare type TAsset = {
58
+ export type TAsset = {
59
59
  type: 'audio' | 'video';
60
60
  src: string;
61
61
  id: string;
@@ -2,8 +2,8 @@
2
2
  import type { AnyZodObject } from 'zod';
3
3
  import type { AnyCompMetadata, AnyComposition, TComposition } from './CompositionManager.js';
4
4
  import type { TFolder } from './Folder.js';
5
- export declare type BaseMetadata = Pick<AnyCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
6
- export declare type CompositionManagerContext = {
5
+ export type BaseMetadata = Pick<AnyCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
6
+ export type CompositionManagerContext = {
7
7
  compositions: AnyComposition[];
8
8
  registerComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined>(comp: TComposition<Schema, Props>) => void;
9
9
  unregisterComposition: (name: string) => void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- declare type Props = Record<string, Record<string, unknown>>;
3
- export declare type EditorPropsContextType = {
2
+ type Props = Record<string, Record<string, unknown>>;
3
+ export type EditorPropsContextType = {
4
4
  props: Props;
5
5
  updateProps: (options: {
6
6
  id: string;
@@ -1,9 +1,9 @@
1
1
  import type { FC } from 'react';
2
- export declare type TFolder = {
2
+ export type TFolder = {
3
3
  name: string;
4
4
  parent: string | null;
5
5
  };
6
- declare type FolderContextType = {
6
+ type FolderContextType = {
7
7
  folderName: string | null;
8
8
  parentName: string | null;
9
9
  };
@@ -1,11 +1,11 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- export declare type ClipRegion = {
2
+ export type ClipRegion = {
3
3
  x: number;
4
4
  y: number;
5
5
  width: number;
6
6
  height: number;
7
7
  } | 'hide';
8
- export declare type TNativeLayersContext = {
8
+ export type TNativeLayersContext = {
9
9
  clipRegion: ClipRegion | null;
10
10
  setClipRegion: React.Dispatch<React.SetStateAction<ClipRegion | null>>;
11
11
  };
@@ -57,7 +57,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
57
57
  };
58
58
  }, [fastRefreshes]);
59
59
  (0, react_1.useEffect)(() => {
60
- // TODO: This can be moved to renderer?
61
60
  if (typeof __webpack_module__ !== 'undefined') {
62
61
  if (__webpack_module__.hot) {
63
62
  __webpack_module__.hot.addStatusHandler((status) => {
@@ -1,13 +1,13 @@
1
1
  import type { PropsWithChildren } from 'react';
2
2
  import type { AnyComposition } from './CompositionManager.js';
3
3
  import type { VideoConfig } from './video-config.js';
4
- declare type ResolveCompositionConfigContect = Record<string, VideoConfigState | undefined>;
4
+ type ResolveCompositionConfigContect = Record<string, VideoConfigState | undefined>;
5
5
  export declare const ResolveCompositionContext: import("react").Context<ResolveCompositionConfigContect | null>;
6
6
  export declare const resolveCompositionsRef: import("react").RefObject<{
7
7
  setCurrentRenderModalComposition: (compositionId: string | null) => void;
8
8
  reloadCurrentlySelectedComposition: () => void;
9
9
  }>;
10
- declare type VideoConfigState = {
10
+ type VideoConfigState = {
11
11
  type: 'loading';
12
12
  } | {
13
13
  type: 'success';
@@ -12,7 +12,7 @@ exports.ResolveCompositionContext = (0, react_1.createContext)(null);
12
12
  exports.resolveCompositionsRef = (0, react_1.createRef)();
13
13
  const ResolveCompositionConfig = ({ children }) => {
14
14
  const [currentRenderModalComposition, setCurrentRenderModalComposition] = (0, react_1.useState)(null);
15
- const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
15
+ const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
16
16
  const selectedComposition = compositions.find((c) => c.id === currentComposition);
17
17
  const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
18
18
  const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
@@ -31,6 +31,9 @@ const ResolveCompositionConfig = ({ children }) => {
31
31
  }, [allEditorProps, renderModalComposition]);
32
32
  const doResolution = (0, react_1.useCallback)((composition, editorProps) => {
33
33
  const controller = new AbortController();
34
+ if (currentCompositionMetadata) {
35
+ return controller;
36
+ }
34
37
  const { signal } = controller;
35
38
  const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({ composition, editorProps, signal });
36
39
  if (typeof promOrNot === 'object' && 'then' in promOrNot) {
@@ -76,7 +79,7 @@ const ResolveCompositionConfig = ({ children }) => {
76
79
  }));
77
80
  }
78
81
  return controller;
79
- }, []);
82
+ }, [currentCompositionMetadata]);
80
83
  (0, react_1.useImperativeHandle)(exports.resolveCompositionsRef, () => {
81
84
  return {
82
85
  setCurrentRenderModalComposition: (id) => {
@@ -141,7 +144,7 @@ exports.needsResolution = needsResolution;
141
144
  const useResolvedVideoConfig = (preferredCompositionId) => {
142
145
  const context = (0, react_1.useContext)(exports.ResolveCompositionContext);
143
146
  const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
144
- const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
147
+ const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
145
148
  const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
146
149
  const composition = compositions.find((c) => c.id === compositionId);
147
150
  const selectedEditorProps = (0, react_1.useMemo)(() => {
@@ -149,23 +152,33 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
149
152
  return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
150
153
  }, [allEditorProps, composition]);
151
154
  return (0, react_1.useMemo)(() => {
152
- var _a, _b;
155
+ var _a, _b, _c;
153
156
  if (!composition) {
154
157
  return null;
155
158
  }
159
+ if (currentCompositionMetadata) {
160
+ return {
161
+ type: 'success',
162
+ result: {
163
+ ...currentCompositionMetadata,
164
+ id: composition.id,
165
+ defaultProps: (_a = currentCompositionMetadata.defaultProps) !== null && _a !== void 0 ? _a : {},
166
+ },
167
+ };
168
+ }
156
169
  if (!(0, exports.needsResolution)(composition)) {
157
170
  return {
158
171
  type: 'success',
159
172
  result: {
160
173
  ...composition,
161
174
  defaultProps: {
162
- ...((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
175
+ ...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
163
176
  ...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
164
177
  ...(typeof window === 'undefined' ||
165
178
  (0, get_environment_js_1.getRemotionEnvironment)() === 'player-development' ||
166
179
  (0, get_environment_js_1.getRemotionEnvironment)() === 'player-production'
167
180
  ? {}
168
- : (_b = (0, input_props_js_1.getInputProps)()) !== null && _b !== void 0 ? _b : {}),
181
+ : (_c = (0, input_props_js_1.getInputProps)()) !== null && _c !== void 0 ? _c : {}),
169
182
  },
170
183
  },
171
184
  };
@@ -174,6 +187,6 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
174
187
  return null;
175
188
  }
176
189
  return context[composition.id];
177
- }, [composition, context, selectedEditorProps]);
190
+ }, [composition, context, currentCompositionMetadata, selectedEditorProps]);
178
191
  };
179
192
  exports.useResolvedVideoConfig = useResolvedVideoConfig;
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { LoopDisplay } from './CompositionManager.js';
3
- export declare type LayoutAndStyle = {
3
+ export type LayoutAndStyle = {
4
4
  layout: 'none';
5
5
  } | {
6
6
  layout?: 'absolute-fill';
7
7
  style?: React.CSSProperties;
8
8
  className?: string;
9
9
  };
10
- export declare type SequenceProps = {
10
+ export type SequenceProps = {
11
11
  children: React.ReactNode;
12
12
  from?: number;
13
13
  durationInFrames?: number;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const SequenceContext: import("react").Context<SequenceContextType | null>;
3
- export declare type SequenceContextType = {
3
+ export type SequenceContextType = {
4
4
  cumulatedFrom: number;
5
5
  relativeFrom: number;
6
6
  parentFrom: number;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { TSequence } from './CompositionManager.js';
3
- export declare type SequenceManagerContext = {
3
+ export type SequenceManagerContext = {
4
4
  registerSequence: (seq: TSequence) => void;
5
5
  unregisterSequence: (id: string) => void;
6
6
  sequences: TSequence[];
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import type { VolumeProp } from '../volume-prop.js';
3
- export declare type RemotionMainAudioProps = {
3
+ export type RemotionMainAudioProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
6
6
  };
7
- export declare type RemotionAudioProps = Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce' | 'onResize' | 'onResizeCapture'> & {
7
+ export type RemotionAudioProps = Omit<React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce' | 'onResize' | 'onResizeCapture'> & {
8
8
  volume?: VolumeProp;
9
9
  playbackRate?: number;
10
10
  acceptableTimeShiftInSeconds?: number;
@@ -12,13 +12,13 @@ import type { RemotionAudioProps } from './props.js';
12
12
  *
13
13
  * The behavior can be disabled by passing `0` as the number of shared audio tracks.
14
14
  */
15
- declare type AudioElem = {
15
+ type AudioElem = {
16
16
  id: number;
17
17
  props: RemotionAudioProps;
18
18
  el: React.RefObject<HTMLAudioElement>;
19
19
  audioId: string;
20
20
  };
21
- declare type SharedContext = {
21
+ type SharedContext = {
22
22
  registerAudio: (aud: RemotionAudioProps, audioId: string) => AudioElem;
23
23
  unregisterAudio: (id: number) => void;
24
24
  updateAudio: (options: {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type FreezeProps = {
2
+ type FreezeProps = {
3
3
  frame: number;
4
4
  children: React.ReactNode;
5
5
  };
@@ -1,3 +1,3 @@
1
- export declare type RemotionEnvironment = 'preview' | 'rendering' | 'player-development' | 'player-production';
1
+ export type RemotionEnvironment = 'preview' | 'rendering' | 'player-development' | 'player-production';
2
2
  export declare const getRemotionEnvironment: () => RemotionEnvironment;
3
3
  export declare const useRemotionEnvironment: () => RemotionEnvironment;
@@ -3,7 +3,7 @@
3
3
  * @see [Documentation](https://www.remotion.dev/docs/getstaticfiles)
4
4
  */
5
5
  export declare const getStaticFiles: () => StaticFile[];
6
- export declare type StaticFile = {
6
+ export type StaticFile = {
7
7
  /**
8
8
  * A string that you can pass to the `src` attribute of an `<Audio>`, `<Img>` and `<Video>` element.
9
9
  */
@@ -7,9 +7,10 @@ declare global {
7
7
  interface Window {
8
8
  remotion_renderReady: boolean;
9
9
  remotion_cancelledError: string | undefined;
10
+ remotion_getCompositionNames: () => string[];
10
11
  getStaticCompositions: () => Promise<AnyCompMetadata[]>;
11
- calculateComposition: (compId: string) => Promise<VideoConfig>;
12
- setBundleMode: (bundleMode: BundleState) => void;
12
+ remotion_calculateComposition: (compId: string) => Promise<VideoConfig>;
13
+ remotion_setBundleMode: (bundleMode: BundleState) => void;
13
14
  remotion_staticBase: string;
14
15
  remotion_staticFiles: StaticFile[];
15
16
  remotion_editorName: string | null;
@@ -35,7 +36,7 @@ declare global {
35
36
  remotion_imported: string | boolean;
36
37
  }
37
38
  }
38
- export declare type BundleState = {
39
+ export type BundleState = {
39
40
  type: 'index';
40
41
  } | {
41
42
  type: 'evaluation';
@@ -126,5 +126,6 @@ export declare const Internals: {
126
126
  }>>;
127
127
  REMOTION_STUDIO_CONTAINER_ELEMENT: string;
128
128
  AssetManager: import("react").Context<import("./AssetManager.js").AssetManagerContext>;
129
+ bundleName: string;
129
130
  };
130
131
  export type { TComposition, Timeline, TCompMetadata, TSequence, TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, };
@@ -116,4 +116,5 @@ exports.Internals = {
116
116
  ResolveCompositionConfig: ResolveCompositionConfig_js_1.ResolveCompositionConfig,
117
117
  REMOTION_STUDIO_CONTAINER_ELEMENT: get_preview_dom_element_js_1.REMOTION_STUDIO_CONTAINER_ELEMENT,
118
118
  AssetManager: AssetManager_js_1.AssetManager,
119
+ bundleName: 'bundle.js',
119
120
  };
@@ -1,9 +1,9 @@
1
- export declare type ExtrapolateType = 'extend' | 'identity' | 'clamp';
1
+ export type ExtrapolateType = 'extend' | 'identity' | 'clamp';
2
2
  /**
3
3
  * @description This function allows you to map a range of values to another with a conside syntax
4
4
  * @see [Documentation](https://www.remotion.dev/docs/interpolate)
5
5
  */
6
- export declare type InterpolateOptions = Partial<{
6
+ export type InterpolateOptions = Partial<{
7
7
  easing: (input: number) => number;
8
8
  extrapolateLeft: ExtrapolateType;
9
9
  extrapolateRight: ExtrapolateType;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { LayoutAndStyle } from '../Sequence.js';
3
- export declare type LoopProps = {
3
+ export type LoopProps = {
4
4
  durationInFrames: number;
5
5
  times?: number;
6
6
  name?: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare type TNonceContext = {
2
+ export type TNonceContext = {
3
3
  getNonce: () => number;
4
4
  fastRefreshes: number;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type Value = Record<string, string>;
2
+ type Value = Record<string, string>;
3
3
  export declare const PreloadContext: React.Context<Value>;
4
4
  export declare const setPreloads: (updater: (p: Value) => Value) => void;
5
5
  export declare const PrefetchProvider: React.FC<{
@@ -1,5 +1,5 @@
1
1
  export declare const usePreload: (src: string) => string;
2
- declare type FetchAndPreload = {
2
+ type FetchAndPreload = {
3
3
  free: () => void;
4
4
  waitUntilDone: () => Promise<string>;
5
5
  };
@@ -1,10 +1,10 @@
1
1
  import type { AnyZodObject, z } from 'zod';
2
- declare type And<A extends boolean, B extends boolean> = A extends true ? B extends true ? true : false : false;
3
- export declare type PropsIfHasProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = And<AnyZodObject extends Schema ? true : false, {} extends Props ? true : false> extends true ? {
2
+ type And<A extends boolean, B extends boolean> = A extends true ? B extends true ? true : false : false;
3
+ export type PropsIfHasProps<Schema extends AnyZodObject, Props extends Record<string, unknown> | undefined> = And<AnyZodObject extends Schema ? true : false, {} extends Props ? true : false> extends true ? {
4
4
  defaultProps?: {};
5
5
  } : {
6
6
  defaultProps: InferProps<Schema, Props>;
7
7
  };
8
- export declare type InferProps<Schema extends AnyZodObject, Props> = AnyZodObject extends Schema ? {} extends Props ? unknown : Props : {} extends Props ? z.infer<Schema> : // Props and schema specified
8
+ export type InferProps<Schema extends AnyZodObject, Props> = AnyZodObject extends Schema ? {} extends Props ? unknown : Props : {} extends Props ? z.infer<Schema> : // Props and schema specified
9
9
  z.infer<Schema> & Props;
10
10
  export {};
@@ -1,4 +1,4 @@
1
- export declare type RandomSeed = number | string | null;
1
+ export type RandomSeed = number | string | null;
2
2
  /**
3
3
  * @description A deterministic pseudo-random number generator. Pass in the same seed and get the same pseudorandom number.
4
4
  * @see [Documentation](https://remotion.dev/docs/random)
@@ -6,7 +6,7 @@ const get_environment_js_1 = require("./get-environment.js");
6
6
  const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
7
7
  const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
8
8
  const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, }) => {
9
- var _a, _b, _c, _d;
9
+ var _a, _b, _c, _d, _e;
10
10
  const calculatedProm = composition.calculateMetadata
11
11
  ? composition.calculateMetadata({
12
12
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
@@ -44,10 +44,17 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
44
44
  calculated: calculatedProm,
45
45
  composition,
46
46
  });
47
+ if (calculatedProm === null) {
48
+ return {
49
+ ...data,
50
+ id: composition.id,
51
+ defaultProps: (_d = composition === null || composition === void 0 ? void 0 : composition.defaultProps) !== null && _d !== void 0 ? _d : {},
52
+ };
53
+ }
47
54
  return {
48
55
  ...data,
49
56
  id: composition.id,
50
- defaultProps: ((_d = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _d !== void 0 ? _d : {}),
57
+ defaultProps: ((_e = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _e !== void 0 ? _e : {}),
51
58
  };
52
59
  };
53
60
  exports.resolveVideoConfig = resolveVideoConfig;
@@ -1,6 +1,6 @@
1
1
  import type { FC, PropsWithChildren } from 'react';
2
2
  import type { LayoutAndStyle, SequenceProps } from '../Sequence.js';
3
- declare type SeriesSequenceProps = PropsWithChildren<{
3
+ type SeriesSequenceProps = PropsWithChildren<{
4
4
  durationInFrames: number;
5
5
  offset?: number;
6
6
  } & Pick<SequenceProps, 'layout' | 'name'> & LayoutAndStyle>;
@@ -1,11 +1,11 @@
1
- declare type AnimationNode = {
1
+ type AnimationNode = {
2
2
  lastTimestamp: number;
3
3
  toValue: number;
4
4
  current: number;
5
5
  velocity: number;
6
6
  prevPosition?: number;
7
7
  };
8
- export declare type SpringConfig = {
8
+ export type SpringConfig = {
9
9
  damping: number;
10
10
  mass: number;
11
11
  stiffness: number;
@@ -17,8 +17,8 @@ declare const problematicCharacters: {
17
17
  '%2C': string;
18
18
  '%3B': string;
19
19
  };
20
- declare type HexCode = keyof typeof problematicCharacters;
21
- export declare type HexInfo = {
20
+ type HexCode = keyof typeof problematicCharacters;
21
+ export type HexInfo = {
22
22
  containsHex: false;
23
23
  } | {
24
24
  containsHex: true;
@@ -1,9 +1,9 @@
1
1
  import type { MutableRefObject } from 'react';
2
- export declare type PlayableMediaTag = {
2
+ export type PlayableMediaTag = {
3
3
  play: () => void;
4
4
  id: string;
5
5
  };
6
- export declare type TimelineContextValue = {
6
+ export type TimelineContextValue = {
7
7
  frame: number;
8
8
  playing: boolean;
9
9
  rootId: string;
@@ -12,7 +12,7 @@ export declare type TimelineContextValue = {
12
12
  setPlaybackRate: (u: React.SetStateAction<number>) => void;
13
13
  audioAndVideoTags: MutableRefObject<PlayableMediaTag[]>;
14
14
  };
15
- export declare type SetTimelineContextValue = {
15
+ export type SetTimelineContextValue = {
16
16
  setFrame: (u: React.SetStateAction<number>) => void;
17
17
  setPlaying: (u: React.SetStateAction<boolean>) => void;
18
18
  };
@@ -20,7 +20,7 @@ export declare const TimelineContext: import("react").Context<TimelineContextVal
20
20
  export declare const SetTimelineContext: import("react").Context<SetTimelineContextValue>;
21
21
  export declare const useTimelinePosition: () => number;
22
22
  export declare const useTimelineSetFrame: () => (u: React.SetStateAction<number>) => void;
23
- declare type PlayingReturnType = readonly [
23
+ type PlayingReturnType = readonly [
24
24
  boolean,
25
25
  (u: React.SetStateAction<boolean>) => void,
26
26
  MutableRefObject<boolean>
@@ -1,3 +1,3 @@
1
- declare type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
1
+ type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
2
2
  export declare function truthy<T>(value: T): value is Truthy<T>;
3
3
  export {};
@@ -1,6 +1,6 @@
1
1
  import type { ComponentPropsWithRef, ComponentType, ExoticComponent } from 'react';
2
2
  import type { CompProps } from './Composition.js';
3
- declare type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
3
+ type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
4
4
  readonly _result: T;
5
5
  };
6
6
  export declare const useLazyComponent: <Props>(compProps: CompProps<Props>) => LazyExoticComponent<ComponentType<Props>>;
@@ -1,6 +1,6 @@
1
1
  import type { RefObject } from 'react';
2
2
  import type { VolumeProp } from './volume-prop.js';
3
- export declare type UseSyncVolumeWithMediaTagOptions = {
3
+ export type UseSyncVolumeWithMediaTagOptions = {
4
4
  volumePropFrame: number;
5
5
  actualVolume: number;
6
6
  volume?: VolumeProp;
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType, LazyExoticComponent } from 'react';
2
2
  import type { VideoConfig } from './video-config.js';
3
- declare type ReturnType = (VideoConfig & {
3
+ type ReturnType = (VideoConfig & {
4
4
  component: LazyExoticComponent<ComponentType<Record<string, unknown> | undefined>>;
5
5
  }) | null;
6
6
  export declare const useVideo: () => ReturnType;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-alpha13";
1
+ export declare const VERSION = "4.0.0-alpha16";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.0-alpha13';
5
+ exports.VERSION = '4.0.0-alpha16';
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- declare type DurationState = Record<string, number>;
3
- declare type DurationAction = {
2
+ type DurationState = Record<string, number>;
3
+ type DurationAction = {
4
4
  type: 'got-duration';
5
5
  src: string;
6
6
  durationInSeconds: number;
7
7
  };
8
8
  export declare const durationReducer: (state: DurationState, action: DurationAction) => DurationState;
9
- declare type TDurationsContext = {
9
+ type TDurationsContext = {
10
10
  durations: DurationState;
11
11
  setDurations: React.Dispatch<DurationAction>;
12
12
  };
@@ -1,22 +1,22 @@
1
1
  import type React from 'react';
2
2
  import type { VolumeProp } from '../volume-prop.js';
3
- export declare type RemotionMainVideoProps = {
3
+ export type RemotionMainVideoProps = {
4
4
  startFrom?: number;
5
5
  endAt?: number;
6
6
  };
7
- export declare type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce'> & {
7
+ export type RemotionVideoProps = Omit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, 'autoPlay' | 'controls' | 'onEnded' | 'nonce'> & {
8
8
  volume?: VolumeProp;
9
9
  playbackRate?: number;
10
10
  acceptableTimeShiftInSeconds?: number;
11
11
  allowAmplificationDuringRender?: boolean;
12
12
  };
13
- declare type DeprecatedOffthreadVideoProps = {
13
+ type DeprecatedOffthreadVideoProps = {
14
14
  /**
15
15
  * @deprecated Use the `transparent` prop instead
16
16
  */
17
17
  imageFormat?: never;
18
18
  };
19
- export declare type OffthreadVideoProps = {
19
+ export type OffthreadVideoProps = {
20
20
  src: string;
21
21
  className?: string;
22
22
  id?: string;
@@ -1,4 +1,4 @@
1
- export declare type VideoConfig = {
1
+ export type VideoConfig = {
2
2
  width: number;
3
3
  height: number;
4
4
  fps: number;
@@ -1,17 +1,17 @@
1
1
  /// <reference types="react" />
2
- export declare type MediaVolumeContextValue = {
2
+ export type MediaVolumeContextValue = {
3
3
  mediaMuted: boolean;
4
4
  mediaVolume: number;
5
5
  };
6
- export declare type SetMediaVolumeContextValue = {
6
+ export type SetMediaVolumeContextValue = {
7
7
  setMediaMuted: (u: React.SetStateAction<boolean>) => void;
8
8
  setMediaVolume: (u: number) => void;
9
9
  };
10
10
  export declare const MediaVolumeContext: import("react").Context<MediaVolumeContextValue>;
11
11
  export declare const SetMediaVolumeContext: import("react").Context<SetMediaVolumeContextValue>;
12
- declare type MediaVolumeReturnType = readonly [number, (u: number) => void];
12
+ type MediaVolumeReturnType = readonly [number, (u: number) => void];
13
13
  export declare const useMediaVolumeState: () => MediaVolumeReturnType;
14
- declare type MediaMutedReturnType = readonly [
14
+ type MediaMutedReturnType = readonly [
15
15
  boolean,
16
16
  (u: React.SetStateAction<boolean>) => void
17
17
  ];
@@ -1,4 +1,4 @@
1
- export declare type VolumeProp = number | ((frame: number) => number);
1
+ export type VolumeProp = number | ((frame: number) => number);
2
2
  export declare const evaluateVolume: ({ frame, volume, mediaVolume, allowAmplificationDuringRender, }: {
3
3
  frame: number;
4
4
  volume: VolumeProp | undefined;
@@ -58,7 +58,7 @@ function truthy(value) {
58
58
  }
59
59
 
60
60
  // Automatically generated on publish
61
- const VERSION = '4.0.0-alpha13';
61
+ const VERSION = '4.0.0-alpha16';
62
62
 
63
63
  const checkMultipleRemotionVersions = () => {
64
64
  if (typeof globalThis === 'undefined') {
@@ -378,7 +378,7 @@ const validateDurationInFrames = ({ allowFloats, component, durationInFrames, })
378
378
  };
379
379
 
380
380
  const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, }) => {
381
- var _a, _b, _c, _d;
381
+ var _a, _b, _c, _d, _e;
382
382
  const calculatedProm = composition.calculateMetadata
383
383
  ? composition.calculateMetadata({
384
384
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
@@ -416,10 +416,17 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
416
416
  calculated: calculatedProm,
417
417
  composition,
418
418
  });
419
+ if (calculatedProm === null) {
420
+ return {
421
+ ...data,
422
+ id: composition.id,
423
+ defaultProps: (_d = composition === null || composition === void 0 ? void 0 : composition.defaultProps) !== null && _d !== void 0 ? _d : {},
424
+ };
425
+ }
419
426
  return {
420
427
  ...data,
421
428
  id: composition.id,
422
- defaultProps: ((_d = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _d !== void 0 ? _d : {}),
429
+ defaultProps: ((_e = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _e !== void 0 ? _e : {}),
423
430
  };
424
431
  };
425
432
  const validateCalculated = ({ composition, calculated, }) => {
@@ -455,7 +462,7 @@ const ResolveCompositionContext = createContext(null);
455
462
  const resolveCompositionsRef = createRef();
456
463
  const ResolveCompositionConfig = ({ children }) => {
457
464
  const [currentRenderModalComposition, setCurrentRenderModalComposition] = useState(null);
458
- const { compositions, currentComposition } = useContext(CompositionManager);
465
+ const { compositions, currentComposition, currentCompositionMetadata } = useContext(CompositionManager);
459
466
  const selectedComposition = compositions.find((c) => c.id === currentComposition);
460
467
  const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
461
468
  const { props: allEditorProps } = useContext(EditorPropsContext);
@@ -474,6 +481,9 @@ const ResolveCompositionConfig = ({ children }) => {
474
481
  }, [allEditorProps, renderModalComposition]);
475
482
  const doResolution = useCallback((composition, editorProps) => {
476
483
  const controller = new AbortController();
484
+ if (currentCompositionMetadata) {
485
+ return controller;
486
+ }
477
487
  const { signal } = controller;
478
488
  const promOrNot = resolveVideoConfig({ composition, editorProps, signal });
479
489
  if (typeof promOrNot === 'object' && 'then' in promOrNot) {
@@ -519,7 +529,7 @@ const ResolveCompositionConfig = ({ children }) => {
519
529
  }));
520
530
  }
521
531
  return controller;
522
- }, []);
532
+ }, [currentCompositionMetadata]);
523
533
  useImperativeHandle(resolveCompositionsRef, () => {
524
534
  return {
525
535
  setCurrentRenderModalComposition: (id) => {
@@ -582,7 +592,7 @@ const needsResolution = (composition) => {
582
592
  const useResolvedVideoConfig = (preferredCompositionId) => {
583
593
  const context = useContext(ResolveCompositionContext);
584
594
  const { props: allEditorProps } = useContext(EditorPropsContext);
585
- const { compositions, currentComposition } = useContext(CompositionManager);
595
+ const { compositions, currentComposition, currentCompositionMetadata } = useContext(CompositionManager);
586
596
  const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
587
597
  const composition = compositions.find((c) => c.id === compositionId);
588
598
  const selectedEditorProps = useMemo(() => {
@@ -590,23 +600,33 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
590
600
  return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
591
601
  }, [allEditorProps, composition]);
592
602
  return useMemo(() => {
593
- var _a, _b;
603
+ var _a, _b, _c;
594
604
  if (!composition) {
595
605
  return null;
596
606
  }
607
+ if (currentCompositionMetadata) {
608
+ return {
609
+ type: 'success',
610
+ result: {
611
+ ...currentCompositionMetadata,
612
+ id: composition.id,
613
+ defaultProps: (_a = currentCompositionMetadata.defaultProps) !== null && _a !== void 0 ? _a : {},
614
+ },
615
+ };
616
+ }
597
617
  if (!needsResolution(composition)) {
598
618
  return {
599
619
  type: 'success',
600
620
  result: {
601
621
  ...composition,
602
622
  defaultProps: {
603
- ...((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
623
+ ...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
604
624
  ...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
605
625
  ...(typeof window === 'undefined' ||
606
626
  getRemotionEnvironment() === 'player-development' ||
607
627
  getRemotionEnvironment() === 'player-production'
608
628
  ? {}
609
- : (_b = getInputProps()) !== null && _b !== void 0 ? _b : {}),
629
+ : (_c = getInputProps()) !== null && _c !== void 0 ? _c : {}),
610
630
  },
611
631
  },
612
632
  };
@@ -615,7 +635,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
615
635
  return null;
616
636
  }
617
637
  return context[composition.id];
618
- }, [composition, context, selectedEditorProps]);
638
+ }, [composition, context, currentCompositionMetadata, selectedEditorProps]);
619
639
  };
620
640
 
621
641
  const useVideo = () => {
@@ -3478,7 +3498,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
3478
3498
  };
3479
3499
  }, [fastRefreshes]);
3480
3500
  useEffect(() => {
3481
- // TODO: This can be moved to renderer?
3482
3501
  if (typeof __webpack_module__ !== 'undefined') {
3483
3502
  if (__webpack_module__.hot) {
3484
3503
  __webpack_module__.hot.addStatusHandler((status) => {
@@ -3641,6 +3660,7 @@ const Internals = {
3641
3660
  ResolveCompositionConfig,
3642
3661
  REMOTION_STUDIO_CONTAINER_ELEMENT,
3643
3662
  AssetManager,
3663
+ bundleName: 'bundle.js',
3644
3664
  };
3645
3665
 
3646
3666
  const flattenChildren = (children) => {
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.0-alpha13';
2
+ const VERSION = '4.0.0-alpha16';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.0-alpha13",
3
+ "version": "4.0.0-alpha16",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "@types/react": "18.0.26",
26
26
  "@types/react-dom": "18.0.10",
27
27
  "@vitejs/plugin-react": "^2.0.0",
28
- "eslint": "8.25.0",
28
+ "eslint": "8.42.0",
29
29
  "eslint-plugin-require-extensions": "^0.1.2",
30
30
  "jsdom": "21.1.0",
31
31
  "prettier": "^2.7.1",
@@ -34,7 +34,7 @@
34
34
  "react-dom": "^18.0.0",
35
35
  "rimraf": "^3.0.2",
36
36
  "rollup": "^2.70.1",
37
- "typescript": "^4.7.0",
37
+ "typescript": "4.9.5",
38
38
  "vitest": "0.31.1",
39
39
  "webpack": "5.83.1",
40
40
  "zod": "3.21.4"