remotion 4.0.0-alpha4 → 4.0.0-alpha5

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.
@@ -1,20 +1,22 @@
1
1
  import type { ComponentType, PropsWithChildren } from 'react';
2
2
  import React from 'react';
3
+ import type { z } from 'zod';
4
+ import type { PropsIfHasProps } from './props-if-has-props.js';
3
5
  declare type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
4
- export declare type CompProps<T> = {
6
+ export declare type CompProps<Props> = {
5
7
  lazyComponent: () => Promise<{
6
- default: LooseComponentType<T>;
8
+ default: LooseComponentType<Props>;
7
9
  }>;
8
10
  } | {
9
- component: LooseComponentType<T>;
11
+ component: LooseComponentType<Props>;
10
12
  };
11
- export declare type StillProps<T> = {
13
+ export declare type StillProps<Schema extends z.ZodTypeAny, Props> = {
12
14
  width: number;
13
15
  height: number;
14
16
  id: string;
15
- defaultProps?: T;
16
- } & CompProps<T>;
17
- declare type CompositionProps<T> = StillProps<T> & {
17
+ schema?: Schema;
18
+ } & CompProps<Props> & PropsIfHasProps<Schema, Props>;
19
+ export declare type CompositionProps<Schema extends z.ZodTypeAny, Props> = StillProps<Schema, Props> & {
18
20
  fps: number;
19
21
  durationInFrames: number;
20
22
  };
@@ -22,6 +24,6 @@ declare type CompositionProps<T> = StillProps<T> & {
22
24
  * @description This component is used to register a video to make it renderable and make it show in the sidebar, in dev mode.
23
25
  * @see [Documentation](https://www.remotion.dev/docs/composition)
24
26
  */
25
- export declare const Composition: <T>({ width, height, fps, durationInFrames, id, defaultProps, ...compProps }: CompositionProps<T>) => React.ReactPortal | null;
27
+ export declare const Composition: <Schema extends z.ZodTypeAny, Props>({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }: CompositionProps<Schema, Props>) => React.ReactPortal | null;
26
28
  export declare const ClipComposition: React.FC<PropsWithChildren>;
27
29
  export {};
@@ -9,9 +9,9 @@ const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
9
9
  const CompositionManager_js_1 = require("./CompositionManager.js");
10
10
  const input_props_js_1 = require("./config/input-props.js");
11
11
  const delay_render_js_1 = require("./delay-render.js");
12
+ const EditorProps_js_1 = require("./EditorProps.js");
12
13
  const Folder_js_1 = require("./Folder.js");
13
14
  const get_environment_js_1 = require("./get-environment.js");
14
- const internals_js_1 = require("./internals.js");
15
15
  const loading_indicator_js_1 = require("./loading-indicator.js");
16
16
  const NativeLayers_js_1 = require("./NativeLayers.js");
17
17
  const nonce_js_1 = require("./nonce.js");
@@ -33,13 +33,15 @@ const Fallback = () => {
33
33
  * @description This component is used to register a video to make it renderable and make it show in the sidebar, in dev mode.
34
34
  * @see [Documentation](https://www.remotion.dev/docs/composition)
35
35
  */
36
- const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, ...compProps }) => {
36
+ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, schema, ...compProps }) => {
37
+ var _a;
37
38
  const { registerComposition, unregisterComposition } = (0, react_1.useContext)(CompositionManager_js_1.CompositionManager);
38
39
  const video = (0, use_video_js_1.useVideo)();
39
40
  const lazy = (0, use_lazy_component_js_1.useLazyComponent)(compProps);
41
+ const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
40
42
  const nonce = (0, nonce_js_1.useNonce)();
41
43
  const environment = (0, get_environment_js_1.useRemotionEnvironment)();
42
- const canUseComposition = (0, react_1.useContext)(internals_js_1.Internals.CanUseRemotionHooks);
44
+ const canUseComposition = (0, react_1.useContext)(CanUseRemotionHooks_js_1.CanUseRemotionHooks);
43
45
  if (canUseComposition) {
44
46
  if (environment === 'player-development' ||
45
47
  environment === 'player-production') {
@@ -70,9 +72,10 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, .
70
72
  id,
71
73
  folderName,
72
74
  component: lazy,
73
- defaultProps,
75
+ defaultProps: defaultProps,
74
76
  nonce,
75
77
  parentFolderName: parentName,
78
+ schema: schema !== null && schema !== void 0 ? schema : null,
76
79
  });
77
80
  return () => {
78
81
  unregisterComposition(id);
@@ -90,16 +93,18 @@ const Composition = ({ width, height, fps, durationInFrames, id, defaultProps, .
90
93
  width,
91
94
  nonce,
92
95
  parentName,
96
+ schema,
93
97
  ]);
98
+ const editorPropsOrUndefined = (_a = allEditorProps[id]) !== null && _a !== void 0 ? _a : {};
94
99
  if (environment === 'preview' && video && video.component === lazy) {
95
100
  const Comp = lazy;
96
101
  const inputProps = (0, input_props_js_1.getInputProps)();
97
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(exports.ClipComposition, { children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }) }) }) }), (0, portal_node_js_1.portalNode)());
102
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(exports.ClipComposition, { children: (0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(loading_indicator_js_1.Loading, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...editorPropsOrUndefined, ...inputProps }) }) }) }), (0, portal_node_js_1.portalNode)());
98
103
  }
99
104
  if (environment === 'rendering' && video && video.component === lazy) {
100
105
  const Comp = lazy;
101
106
  const inputProps = (0, input_props_js_1.getInputProps)();
102
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...inputProps }) }) }), (0, portal_node_js_1.portalNode)());
107
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Fallback, {}), children: (0, jsx_runtime_1.jsx)(Comp, { ...defaultProps, ...editorPropsOrUndefined, ...inputProps }) }) }), (0, portal_node_js_1.portalNode)());
103
108
  }
104
109
  return null;
105
110
  };
@@ -1,7 +1,9 @@
1
1
  import type { ComponentType, LazyExoticComponent } from 'react';
2
2
  import React from 'react';
3
+ import type { z } from 'zod';
3
4
  import type { TFolder } from './Folder.js';
4
- export declare type TComposition<T = unknown> = {
5
+ import type { PropsIfHasProps } from './props-if-has-props.js';
6
+ export declare type TComposition<Schema extends z.ZodTypeAny, Props> = {
5
7
  width: number;
6
8
  height: number;
7
9
  fps: number;
@@ -9,12 +11,15 @@ export declare type TComposition<T = unknown> = {
9
11
  id: string;
10
12
  folderName: string | null;
11
13
  parentFolderName: string | null;
12
- component: LazyExoticComponent<ComponentType<T>>;
13
- defaultProps: T | undefined;
14
+ component: LazyExoticComponent<ComponentType<Props>>;
14
15
  nonce: number;
15
- };
16
- export declare type TCompMetadata = Pick<TComposition, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
17
- export declare type SmallTCompMetadata = Pick<TComposition, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames'> & Partial<Pick<TComposition, 'defaultProps'>>;
16
+ schema: Schema | null;
17
+ } & PropsIfHasProps<Schema, Props>;
18
+ export declare type AnyComposition = TComposition<z.ZodTypeAny, unknown>;
19
+ export declare type TCompMetadata<Schema extends z.ZodTypeAny, Props> = Pick<TComposition<Schema, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames' | 'defaultProps'>;
20
+ export declare type AnyCompMetadata = TCompMetadata<z.ZodTypeAny, unknown>;
21
+ export declare type SmallTCompMetadata<T extends z.ZodTypeAny, Props> = Pick<TComposition<T, Props>, 'id' | 'height' | 'width' | 'fps' | 'durationInFrames'> & Partial<Pick<TComposition<T, Props>, 'defaultProps'>>;
22
+ export declare type AnySmallCompMetadata = SmallTCompMetadata<z.ZodTypeAny, unknown>;
18
23
  declare type EnhancedTSequenceData = {
19
24
  type: 'sequence';
20
25
  } | {
@@ -53,10 +58,10 @@ export declare type TAsset = {
53
58
  playbackRate: number;
54
59
  allowAmplificationDuringRender: boolean;
55
60
  };
56
- declare type BaseMetadata = Pick<TCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
61
+ declare type BaseMetadata = Pick<AnyCompMetadata, 'durationInFrames' | 'fps' | 'defaultProps' | 'height' | 'width'>;
57
62
  export declare type CompositionManagerContext = {
58
- compositions: TComposition[];
59
- registerComposition: <T>(comp: TComposition<T>) => void;
63
+ compositions: AnyComposition[];
64
+ registerComposition: <Schema extends z.ZodTypeAny, Props>(comp: TComposition<Schema, Props>) => void;
60
65
  unregisterComposition: (name: string) => void;
61
66
  registerFolder: (name: string, parent: string | null) => void;
62
67
  unregisterFolder: (name: string, parent: string | null) => void;
@@ -74,7 +79,7 @@ export declare type CompositionManagerContext = {
74
79
  };
75
80
  export declare const CompositionManager: React.Context<CompositionManagerContext>;
76
81
  export declare const compositionsRef: React.RefObject<{
77
- getCompositions: () => TCompMetadata[];
82
+ getCompositions: () => TCompMetadata<z.ZodTypeAny, unknown>[];
78
83
  }>;
79
84
  export declare const CompositionManagerProvider: React.FC<{
80
85
  children: React.ReactNode;
@@ -57,9 +57,9 @@ const CompositionManagerProvider = ({ children, numberOfAudioTags }) => {
57
57
  const [folders, setFolders] = (0, react_1.useState)([]);
58
58
  const [sequences, setSequences] = (0, react_1.useState)([]);
59
59
  const [currentCompositionMetadata, setCurrentCompositionMetadata] = (0, react_1.useState)(null);
60
- const updateCompositions = (0, react_1.useCallback)(
60
+ const updateCompositions = (0, react_1.useCallback)((
61
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
- (updateComps) => {
62
+ updateComps) => {
63
63
  setCompositions((comps) => {
64
64
  const updated = updateComps(comps);
65
65
  currentcompositionsRef.current = updated;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ declare type Props = Record<string, object>;
3
+ export declare type EditorPropsContextType = {
4
+ props: Props;
5
+ updateProps: (options: {
6
+ id: string;
7
+ defaultProps: object;
8
+ newProps: object;
9
+ }) => void;
10
+ };
11
+ export declare const EditorPropsContext: React.Context<EditorPropsContextType>;
12
+ export declare const EditorPropsProvider: React.FC<{
13
+ children: React.ReactNode;
14
+ }>;
15
+ export {};
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = 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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.EditorPropsProvider = exports.EditorPropsContext = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
28
+ const react_1 = __importStar(require("react"));
29
+ exports.EditorPropsContext = (0, react_1.createContext)({
30
+ props: {},
31
+ updateProps: () => {
32
+ throw new Error('Not implemented');
33
+ },
34
+ });
35
+ const EditorPropsProvider = ({ children }) => {
36
+ const [props, setProps] = react_1.default.useState({});
37
+ const updateProps = (0, react_1.useCallback)(({ defaultProps, id, newProps, }) => {
38
+ setProps((prev) => {
39
+ var _a;
40
+ return {
41
+ ...prev,
42
+ [id]: typeof newProps === 'function'
43
+ ? newProps((_a = prev[id]) !== null && _a !== void 0 ? _a : defaultProps)
44
+ : newProps,
45
+ };
46
+ });
47
+ }, []);
48
+ const ctx = (0, react_1.useMemo)(() => {
49
+ return { props, updateProps };
50
+ }, [props, updateProps]);
51
+ return ((0, jsx_runtime_1.jsx)(exports.EditorPropsContext.Provider, { value: ctx, children: children }));
52
+ };
53
+ exports.EditorPropsProvider = EditorPropsProvider;
package/dist/cjs/Img.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Img = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const cancel_render_js_1 = require("./cancel-render.js");
6
7
  const delay_render_js_1 = require("./delay-render.js");
7
8
  const prefetch_js_1 = require("./prefetch.js");
8
9
  function exponentialBackoff(errorCount) {
@@ -53,7 +54,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
53
54
  retryIn(backoff);
54
55
  return;
55
56
  }
56
- console.error('Error loading image with src:', (_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src, e, 'Handle the event using the onError() prop to make this message disappear.');
57
+ (0, cancel_render_js_1.cancelRender)('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
57
58
  }, [maxRetries, onError, retryIn]);
58
59
  (0, react_1.useLayoutEffect)(() => {
59
60
  if (process.env.NODE_ENV === 'test') {
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const CompositionManager_js_1 = require("./CompositionManager.js");
7
7
  const delay_render_js_1 = require("./delay-render.js");
8
+ const EditorProps_js_1 = require("./EditorProps.js");
8
9
  const NativeLayers_js_1 = require("./NativeLayers.js");
9
10
  const nonce_js_1 = require("./nonce.js");
10
11
  const prefetch_state_js_1 = require("./prefetch-state.js");
@@ -66,6 +67,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
66
67
  }
67
68
  }
68
69
  }, []);
69
- return ((0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(NativeLayers_js_1.NativeLayersProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_js_1.CompositionManagerProvider, { numberOfAudioTags: numberOfAudioTags, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: children }) }) }) }) }) }) }));
70
+ return ((0, jsx_runtime_1.jsx)(nonce_js_1.NonceContext.Provider, { value: nonceContext, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.TimelineContext.Provider, { value: timelineContextValue, children: (0, jsx_runtime_1.jsx)(timeline_position_state_js_1.SetTimelineContext.Provider, { value: setTimelineContextValue, children: (0, jsx_runtime_1.jsx)(EditorProps_js_1.EditorPropsProvider, { children: (0, jsx_runtime_1.jsx)(prefetch_state_js_1.PrefetchProvider, { children: (0, jsx_runtime_1.jsx)(NativeLayers_js_1.NativeLayersProvider, { children: (0, jsx_runtime_1.jsx)(CompositionManager_js_1.CompositionManagerProvider, { numberOfAudioTags: numberOfAudioTags, children: (0, jsx_runtime_1.jsx)(duration_state_js_1.DurationsContextProvider, { children: children }) }) }) }) }) }) }) }));
70
71
  };
71
72
  exports.RemotionRoot = RemotionRoot;
@@ -1,7 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
+ import type { z } from 'zod';
2
3
  import type { StillProps } from './Composition.js';
3
4
  /**
4
5
  * @description A <Still /> is a <Composition /> that is only 1 frame long.
5
6
  * @see [Documentation](https://www.remotion.dev/docs/still)
6
7
  */
7
- export declare const Still: <T>(props: StillProps<T>) => JSX.Element;
8
+ export declare const Still: <Schema extends z.ZodTypeAny, Props>(props: StillProps<Schema, Props>) => React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
package/dist/cjs/Still.js CHANGED
@@ -1,13 +1,22 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Still = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = __importDefault(require("react"));
5
8
  const Composition_js_1 = require("./Composition.js");
6
9
  /**
7
10
  * @description A <Still /> is a <Composition /> that is only 1 frame long.
8
11
  * @see [Documentation](https://www.remotion.dev/docs/still)
9
12
  */
10
13
  const Still = (props) => {
11
- return (0, jsx_runtime_1.jsx)(Composition_js_1.Composition, { fps: 1, durationInFrames: 1, ...props });
14
+ const newProps = {
15
+ ...props,
16
+ durationInFrames: 1,
17
+ fps: 1,
18
+ };
19
+ // @ts-expect-error TypeScript does not understand it, but should still fail on type mismatch
20
+ return react_1.default.createElement((Composition_js_1.Composition), newProps);
12
21
  };
13
22
  exports.Still = Still;
@@ -1,12 +1,12 @@
1
1
  import './asset-types.js';
2
- import type { TAsset, TCompMetadata } from './CompositionManager.js';
2
+ import type { AnyCompMetadata, TAsset } from './CompositionManager.js';
3
3
  import type { StaticFile } from './get-static-files.js';
4
4
  import type { ClipRegion } from './NativeLayers.js';
5
5
  declare global {
6
6
  interface Window {
7
7
  ready: boolean;
8
8
  remotion_cancelledError: string | undefined;
9
- getStaticCompositions: () => TCompMetadata[];
9
+ getStaticCompositions: () => AnyCompMetadata[];
10
10
  setBundleMode: (bundleMode: BundleState) => void;
11
11
  remotion_staticBase: string;
12
12
  remotion_staticFiles: StaticFile[];
@@ -50,8 +50,7 @@ export * from './AbsoluteFill.js';
50
50
  export * from './audio/index.js';
51
51
  export { cancelRender } from './cancel-render.js';
52
52
  export * from './Composition.js';
53
- export { SmallTCompMetadata, TAsset, TCompMetadata, } from './CompositionManager.js';
54
- export { Config, ConfigType, WebpackConfiguration, WebpackOverrideFn, } from './config.js';
53
+ export { AnyCompMetadata, AnyComposition, AnySmallCompMetadata, SmallTCompMetadata, TAsset, TCompMetadata, } from './CompositionManager.js';
55
54
  export { getInputProps } from './config/input-props.js';
56
55
  export { continueRender, delayRender } from './delay-render.js';
57
56
  export * from './easing.js';
@@ -97,3 +96,4 @@ export declare const Experimental: {
97
96
  Null: import("react").FC<{}>;
98
97
  useIsPlayer: () => boolean;
99
98
  };
99
+ export declare const Config: {};
package/dist/cjs/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Experimental = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.getStaticFiles = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Config = exports.cancelRender = void 0;
17
+ exports.Config = exports.Experimental = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.getStaticFiles = exports.delayRender = exports.continueRender = exports.getInputProps = exports.cancelRender = void 0;
18
18
  require("./asset-types.js");
19
19
  const Clipper_js_1 = require("./Clipper.js");
20
20
  const is_player_js_1 = require("./is-player.js");
@@ -26,8 +26,6 @@ __exportStar(require("./audio/index.js"), exports);
26
26
  var cancel_render_js_1 = require("./cancel-render.js");
27
27
  Object.defineProperty(exports, "cancelRender", { enumerable: true, get: function () { return cancel_render_js_1.cancelRender; } });
28
28
  __exportStar(require("./Composition.js"), exports);
29
- var config_js_1 = require("./config.js");
30
- Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_js_1.Config; } });
31
29
  var input_props_js_1 = require("./config/input-props.js");
32
30
  Object.defineProperty(exports, "getInputProps", { enumerable: true, get: function () { return input_props_js_1.getInputProps; } });
33
31
  var delay_render_js_1 = require("./delay-render.js");
@@ -80,3 +78,27 @@ exports.Experimental = {
80
78
  Null: Null_js_1.Null,
81
79
  useIsPlayer: is_player_js_1.useIsPlayer,
82
80
  };
81
+ const proxyObj = {};
82
+ exports.Config = new Proxy(proxyObj, {
83
+ get(_, prop) {
84
+ if (prop === 'Bundling' ||
85
+ prop === 'Rendering' ||
86
+ prop === 'Log' ||
87
+ prop === 'Puppeteer' ||
88
+ prop === 'Output') {
89
+ return exports.Config;
90
+ }
91
+ return () => {
92
+ console.warn('⚠️ The CLI configuration has been extracted from Remotion Core.');
93
+ console.warn('Update the import from the config file:');
94
+ console.warn();
95
+ console.warn('- Delete:');
96
+ console.warn('import {Config} from "remotion";');
97
+ console.warn('+ Replace:');
98
+ console.warn('import {Config} from "@remotion/cli/config";');
99
+ console.warn();
100
+ console.warn('For more information, see https://v4.remotion.dev/docs/4-0-migration.');
101
+ process.exit(1);
102
+ };
103
+ },
104
+ });
@@ -3,6 +3,7 @@ import type { CompProps } from './Composition.js';
3
3
  import type { CompositionManagerContext, TAsset, TCompMetadata, TComposition, TSequence } from './CompositionManager.js';
4
4
  import * as CSSUtils from './default-css.js';
5
5
  import type { RemotionEnvironment } from './get-environment.js';
6
+ import { processColor } from './interpolate-colors.js';
6
7
  import type { SetTimelineContextValue, TimelineContextValue } from './timeline-position-state.js';
7
8
  import * as TimelinePosition from './timeline-position-state.js';
8
9
  import { truthy } from './truthy.js';
@@ -22,18 +23,19 @@ export declare const Internals: {
22
23
  width: number;
23
24
  fps: number;
24
25
  durationInFrames: number;
25
- defaultProps: unknown;
26
+ defaultProps?: unknown;
26
27
  id: string;
27
28
  folderName: string | null;
28
29
  parentFolderName: string | null;
29
30
  component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>>;
30
31
  nonce: number;
32
+ schema: import("zod").ZodTypeAny | null;
31
33
  } | null;
32
34
  getRoot: () => import("react").FC<{}> | null;
33
35
  useMediaVolumeState: () => readonly [number, (u: number) => void];
34
36
  useMediaMutedState: () => readonly [boolean, (u: import("react").SetStateAction<boolean>) => void];
35
- useLazyComponent: <T>(compProps: CompProps<T>) => import("react").ExoticComponent<(import("react").PropsWithoutRef<T> & import("react").RefAttributes<import("react").Component<T, any, any>>) | import("react").PropsWithRef<T>> & {
36
- readonly _result: import("react").ComponentType<T>;
37
+ useLazyComponent: <Props>(compProps: CompProps<Props>) => import("react").ExoticComponent<(import("react").PropsWithoutRef<Props> & import("react").RefAttributes<import("react").Component<Props, any, any>>) | import("react").PropsWithRef<Props>> & {
38
+ readonly _result: import("react").ComponentType<Props>;
37
39
  };
38
40
  truthy: typeof truthy;
39
41
  SequenceContext: import("react").Context<import("./SequenceContext.js").SequenceContextType | null>;
@@ -77,17 +79,15 @@ export declare const Internals: {
77
79
  isCompositionIdValid: (id: string) => RegExpMatchArray | null;
78
80
  getPreviewDomElement: () => HTMLElement | null;
79
81
  compositionsRef: import("react").RefObject<{
80
- getCompositions: () => TCompMetadata[];
82
+ getCompositions: () => TCompMetadata<import("zod").ZodTypeAny, unknown>[];
81
83
  }>;
82
84
  DELAY_RENDER_CALLSTACK_TOKEN: string;
83
85
  portalNode: () => HTMLElement;
84
86
  waitForRoot: (fn: (comp: import("react").FC<{}>) => void) => () => void;
85
- validateOffthreadVideoImageFormat: (input: unknown) => void;
86
87
  CanUseRemotionHooksProvider: import("react").FC<{
87
88
  children: import("react").ReactNode;
88
89
  }>;
89
90
  CanUseRemotionHooks: import("react").Context<boolean>;
90
- enableLegacyRemotionConfig: () => void;
91
91
  PrefetchProvider: import("react").FC<{
92
92
  children: import("react").ReactNode;
93
93
  }>;
@@ -104,6 +104,12 @@ export declare const Internals: {
104
104
  durationInFrames: number;
105
105
  allowFloats: boolean;
106
106
  }) => void;
107
+ EditorPropsProvider: import("react").FC<{
108
+ children: import("react").ReactNode;
109
+ }>;
110
+ EditorPropsContext: import("react").Context<import("./EditorProps.js").EditorPropsContextType>;
107
111
  usePreload: (src: string) => string;
112
+ processColor: typeof processColor;
113
+ NonceContext: import("react").Context<import("./nonce.js").TNonceContext>;
108
114
  };
109
115
  export type { TComposition, Timeline, TCompMetadata, TSequence, TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, };
@@ -24,15 +24,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Internals = void 0;
27
- const config_js_1 = require("./config.js");
28
27
  const shared_audio_tags_js_1 = require("./audio/shared-audio-tags.js");
29
28
  const CanUseRemotionHooks_js_1 = require("./CanUseRemotionHooks.js");
30
29
  const CompositionManager_js_1 = require("./CompositionManager.js");
31
30
  const CSSUtils = __importStar(require("./default-css.js"));
32
31
  const delay_render_js_1 = require("./delay-render.js");
32
+ const EditorProps_js_1 = require("./EditorProps.js");
33
33
  const get_environment_js_1 = require("./get-environment.js");
34
34
  const get_preview_dom_element_js_1 = require("./get-preview-dom-element.js");
35
+ const interpolate_colors_js_1 = require("./interpolate-colors.js");
35
36
  const is_player_js_1 = require("./is-player.js");
37
+ const nonce_js_1 = require("./nonce.js");
36
38
  const portal_node_js_1 = require("./portal-node.js");
37
39
  const prefetch_state_js_1 = require("./prefetch-state.js");
38
40
  const prefetch_js_1 = require("./prefetch.js");
@@ -50,7 +52,6 @@ const validate_composition_id_js_1 = require("./validation/validate-composition-
50
52
  const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
51
53
  const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
52
54
  const validate_fps_js_1 = require("./validation/validate-fps.js");
53
- const validate_offthreadvideo_image_format_js_1 = require("./validation/validate-offthreadvideo-image-format.js");
54
55
  const duration_state_js_1 = require("./video/duration-state.js");
55
56
  const volume_position_state_js_1 = require("./volume-position-state.js");
56
57
  const wrap_remotion_context_js_1 = require("./wrap-remotion-context.js");
@@ -89,15 +90,17 @@ exports.Internals = {
89
90
  DELAY_RENDER_CALLSTACK_TOKEN: delay_render_js_1.DELAY_RENDER_CALLSTACK_TOKEN,
90
91
  portalNode: portal_node_js_1.portalNode,
91
92
  waitForRoot: register_root_js_1.waitForRoot,
92
- validateOffthreadVideoImageFormat: validate_offthreadvideo_image_format_js_1.validateOffthreadVideoImageFormat,
93
93
  CanUseRemotionHooksProvider: CanUseRemotionHooks_js_1.CanUseRemotionHooksProvider,
94
94
  CanUseRemotionHooks: CanUseRemotionHooks_js_1.CanUseRemotionHooks,
95
- enableLegacyRemotionConfig: config_js_1.enableLegacyRemotionConfig,
96
95
  PrefetchProvider: prefetch_state_js_1.PrefetchProvider,
97
96
  DurationsContextProvider: duration_state_js_1.DurationsContextProvider,
98
97
  IsPlayerContextProvider: is_player_js_1.IsPlayerContextProvider,
99
98
  useIsPlayer: is_player_js_1.useIsPlayer,
100
99
  useRemotionEnvironment: get_environment_js_1.useRemotionEnvironment,
101
100
  validateFrame: validate_frame_js_1.validateFrame,
101
+ EditorPropsProvider: EditorProps_js_1.EditorPropsProvider,
102
+ EditorPropsContext: EditorProps_js_1.EditorPropsContext,
102
103
  usePreload: prefetch_js_1.usePreload,
104
+ processColor: interpolate_colors_js_1.processColor,
105
+ NonceContext: nonce_js_1.NonceContext,
103
106
  };
@@ -2,6 +2,7 @@
2
2
  * Copied from:
3
3
  * https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
4
4
  */
5
+ export declare function processColor(color: string): number;
5
6
  /**
6
7
  * @description This function allows you to map a range of values to colors using a concise syntax.
7
8
  * @see [Documentation](https://www.remotion.dev/docs/interpolate-colors)
@@ -4,7 +4,7 @@
4
4
  * https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.interpolateColors = void 0;
7
+ exports.interpolateColors = exports.processColor = void 0;
8
8
  /* eslint no-bitwise: 0 */
9
9
  const interpolate_js_1 = require("./interpolate.js");
10
10
  // var INTEGER = '[-+]?\\d+';
@@ -356,15 +356,11 @@ const blue = (c) => {
356
356
  const rgbaColor = (r, g, b, alpha) => {
357
357
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
358
358
  };
359
- function processColorInitially(color) {
360
- let normalizedColor = normalizeColor(color);
361
- normalizedColor = ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
362
- return normalizedColor;
363
- }
364
359
  function processColor(color) {
365
- const normalizedColor = processColorInitially(color);
366
- return normalizedColor;
360
+ const normalizedColor = normalizeColor(color);
361
+ return ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
367
362
  }
363
+ exports.processColor = processColor;
368
364
  const interpolateColorsRGB = (value, inputRange, colors) => {
369
365
  const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
370
366
  const unrounded = (0, interpolate_js_1.interpolate)(value, inputRange, colors.map((c) => f(c)), {
@@ -0,0 +1,10 @@
1
+ import type { z } from 'zod';
2
+ export declare type PropsIfHasProps<Schema extends z.ZodTypeAny, Props> = z.ZodTypeAny extends Schema ? {} extends Props ? {
3
+ defaultProps?: Props;
4
+ } : {
5
+ defaultProps: Props;
6
+ } : {} extends Props ? {
7
+ defaultProps: z.infer<Schema>;
8
+ } : {
9
+ defaultProps: z.infer<Schema> & Props;
10
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
1
  import type { ComponentPropsWithRef, ComponentType, ExoticComponent } from 'react';
2
- import type { CompProps } from './internals.js';
2
+ import type { CompProps } from './Composition.js';
3
3
  declare type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
4
4
  readonly _result: T;
5
5
  };
6
- export declare const useLazyComponent: <T>(compProps: CompProps<T>) => LazyExoticComponent<ComponentType<T>>;
6
+ export declare const useLazyComponent: <Props>(compProps: CompProps<Props>) => LazyExoticComponent<ComponentType<Props>>;
7
7
  export {};
@@ -4,10 +4,11 @@ export declare const useVideo: () => {
4
4
  width: number;
5
5
  fps: number;
6
6
  durationInFrames: number;
7
- defaultProps: unknown;
7
+ defaultProps?: unknown;
8
8
  id: string;
9
9
  folderName: string | null;
10
10
  parentFolderName: string | null;
11
11
  component: import("react").LazyExoticComponent<import("react").ComponentType<unknown>>;
12
12
  nonce: number;
13
+ schema: import("zod").ZodTypeAny | null;
13
14
  } | null;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-alpha4";
1
+ export declare const VERSION = "4.0.0-alpha5";
@@ -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-alpha4';
5
+ exports.VERSION = '4.0.0-alpha5';
@@ -7,7 +7,6 @@ const get_environment_js_1 = require("../get-environment.js");
7
7
  const Sequence_js_1 = require("../Sequence.js");
8
8
  const validate_media_props_js_1 = require("../validate-media-props.js");
9
9
  const validate_start_from_props_js_1 = require("../validate-start-from-props.js");
10
- const validate_offthreadvideo_image_format_js_1 = require("../validation/validate-offthreadvideo-image-format.js");
11
10
  const OffthreadVideoForRendering_js_1 = require("./OffthreadVideoForRendering.js");
12
11
  const VideoForDevelopment_js_1 = require("./VideoForDevelopment.js");
13
12
  /**
@@ -21,6 +20,9 @@ const OffthreadVideo = (props) => {
21
20
  if (typeof props.src !== 'string') {
22
21
  throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
23
22
  }
23
+ if (props.imageFormat) {
24
+ throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
25
+ }
24
26
  if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
25
27
  (0, validate_start_from_props_js_1.validateStartFromProps)(startFrom, endAt);
26
28
  const startFromFrameNo = startFrom !== null && startFrom !== void 0 ? startFrom : 0;
@@ -28,7 +30,6 @@ const OffthreadVideo = (props) => {
28
30
  return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", from: 0 - startFromFrameNo, showInTimeline: false, durationInFrames: endAtFrameNo, children: (0, jsx_runtime_1.jsx)(exports.OffthreadVideo, { ...otherProps }) }));
29
31
  }
30
32
  (0, validate_media_props_js_1.validateMediaProps)(props, 'Video');
31
- (0, validate_offthreadvideo_image_format_js_1.validateOffthreadVideoImageFormat)(props.imageFormat);
32
33
  if (environment === 'rendering') {
33
34
  return (0, jsx_runtime_1.jsx)(OffthreadVideoForRendering_js_1.OffthreadVideoForRendering, { ...otherProps });
34
35
  }