remotion 4.0.432 → 4.0.434
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.
- package/dist/cjs/Composition.js +1 -1
- package/dist/cjs/CompositionManager.d.ts +3 -2
- package/dist/cjs/CompositionManagerContext.d.ts +2 -1
- package/dist/cjs/CompositionManagerProvider.js +3 -5
- package/dist/cjs/Folder.d.ts +2 -0
- package/dist/cjs/Folder.js +11 -2
- package/dist/cjs/RemotionRoot.d.ts +0 -1
- package/dist/cjs/RemotionRoot.js +2 -3
- package/dist/cjs/Sequence.js +3 -4
- package/dist/cjs/TimelineContext.d.ts +2 -2
- package/dist/cjs/TimelineContext.js +2 -26
- package/dist/cjs/freeze.js +2 -1
- package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -1
- package/dist/cjs/get-effective-visual-mode-value.js +3 -2
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/internals.d.ts +11 -6
- package/dist/cjs/internals.js +3 -0
- package/dist/cjs/nonce.d.ts +7 -1
- package/dist/cjs/nonce.js +30 -10
- package/dist/cjs/sequence-field-schema.d.ts +13 -1
- package/dist/cjs/timeline-position-state.d.ts +2 -0
- package/dist/cjs/timeline-position-state.js +14 -3
- package/dist/cjs/use-media-in-timeline.d.ts +1 -1
- package/dist/cjs/use-media-in-timeline.js +3 -3
- package/dist/cjs/use-media-playback.js +1 -2
- package/dist/cjs/use-media-tag.js +2 -2
- package/dist/cjs/use-schema.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-in-schema.d.ts +6 -0
- package/dist/cjs/wrap-in-schema.js +114 -0
- package/dist/cjs/wrap-remotion-context.d.ts +1 -1
- package/dist/esm/index.mjs +810 -729
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -3
package/dist/cjs/Composition.js
CHANGED
|
@@ -69,7 +69,7 @@ const InnerComposition = ({ width, height, fps, durationInFrames, id, defaultPro
|
|
|
69
69
|
folderName,
|
|
70
70
|
component: lazy,
|
|
71
71
|
defaultProps: (0, input_props_serialization_js_1.serializeThenDeserializeInStudio)((defaultProps !== null && defaultProps !== void 0 ? defaultProps : {})),
|
|
72
|
-
nonce,
|
|
72
|
+
nonce: nonce.get(),
|
|
73
73
|
parentFolderName: parentName,
|
|
74
74
|
schema: schema !== null && schema !== void 0 ? schema : null,
|
|
75
75
|
calculateMetadata: (_a = compProps.calculateMetadata) !== null && _a !== void 0 ? _a : null,
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { AnyZodObject } from './any-zod-type.js';
|
|
4
4
|
import type { CalculateMetadataFunction } from './Composition.js';
|
|
5
5
|
import type { DownloadBehavior } from './download-behavior.js';
|
|
6
|
+
import type { NonceHistory } from './nonce.js';
|
|
6
7
|
import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
|
|
7
8
|
import type { SequenceSchema } from './sequence-field-schema.js';
|
|
8
9
|
export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
@@ -14,7 +15,7 @@ export type TComposition<Schema extends AnyZodObject, Props extends Record<strin
|
|
|
14
15
|
folderName: string | null;
|
|
15
16
|
parentFolderName: string | null;
|
|
16
17
|
component: LazyExoticComponent<ComponentType<Props>> | ComponentType<Props>;
|
|
17
|
-
nonce:
|
|
18
|
+
nonce: NonceHistory;
|
|
18
19
|
schema: Schema | null;
|
|
19
20
|
calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>> | null;
|
|
20
21
|
} & PropsIfHasProps<Schema, Props>;
|
|
@@ -57,7 +58,7 @@ export type TSequence = {
|
|
|
57
58
|
parent: string | null;
|
|
58
59
|
rootId: string;
|
|
59
60
|
showInTimeline: boolean;
|
|
60
|
-
nonce:
|
|
61
|
+
nonce: NonceHistory;
|
|
61
62
|
loopDisplay: LoopDisplay | undefined;
|
|
62
63
|
stack: string | null;
|
|
63
64
|
premountDisplay: number | null;
|
|
@@ -2,6 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
import type { AnyZodObject } from './any-zod-type.js';
|
|
3
3
|
import type { AnyComposition, TComposition } from './CompositionManager.js';
|
|
4
4
|
import type { TFolder } from './Folder.js';
|
|
5
|
+
import type { NonceHistory } from './nonce.js';
|
|
5
6
|
import type { VideoConfig } from './video-config.js';
|
|
6
7
|
export type BaseMetadata = Pick<VideoConfig, 'durationInFrames' | 'fps' | 'props' | 'height' | 'width' | 'defaultCodec' | 'defaultOutName' | 'defaultVideoImageFormat' | 'defaultPixelFormat' | 'defaultProResProfile'>;
|
|
7
8
|
export type CanvasContent = {
|
|
@@ -24,7 +25,7 @@ export type CanvasContent = {
|
|
|
24
25
|
export type CompositionManagerSetters = {
|
|
25
26
|
registerComposition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(comp: TComposition<Schema, Props>) => void;
|
|
26
27
|
unregisterComposition: (name: string) => void;
|
|
27
|
-
registerFolder: (name: string, parent: string | null) => void;
|
|
28
|
+
registerFolder: (name: string, parent: string | null, nonce: NonceHistory) => void;
|
|
28
29
|
unregisterFolder: (name: string, parent: string | null) => void;
|
|
29
30
|
setCanvasContent: React.Dispatch<React.SetStateAction<CanvasContent | null>>;
|
|
30
31
|
updateCompositionDefaultProps: (id: string, newDefaultProps: Record<string, unknown>) => void;
|
|
@@ -23,10 +23,7 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
|
|
|
23
23
|
if (comps.find((c) => c.id === comp.id)) {
|
|
24
24
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
.slice()
|
|
28
|
-
.sort((a, b) => a.nonce - b.nonce);
|
|
29
|
-
return value;
|
|
26
|
+
return [...comps, comp];
|
|
30
27
|
});
|
|
31
28
|
}, [updateCompositions]);
|
|
32
29
|
const unregisterComposition = (0, react_1.useCallback)((id) => {
|
|
@@ -34,13 +31,14 @@ const CompositionManagerProvider = ({ children, onlyRenderComposition, currentCo
|
|
|
34
31
|
return comps.filter((c) => c.id !== id);
|
|
35
32
|
});
|
|
36
33
|
}, []);
|
|
37
|
-
const registerFolder = (0, react_1.useCallback)((name, parent) => {
|
|
34
|
+
const registerFolder = (0, react_1.useCallback)((name, parent, nonce) => {
|
|
38
35
|
setFolders((prevFolders) => {
|
|
39
36
|
return [
|
|
40
37
|
...prevFolders,
|
|
41
38
|
{
|
|
42
39
|
name,
|
|
43
40
|
parent,
|
|
41
|
+
nonce,
|
|
44
42
|
},
|
|
45
43
|
];
|
|
46
44
|
});
|
package/dist/cjs/Folder.d.ts
CHANGED
package/dist/cjs/Folder.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.Folder = exports.FolderContext = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const CompositionManagerContext_js_1 = require("./CompositionManagerContext.js");
|
|
7
|
+
const nonce_js_1 = require("./nonce.js");
|
|
7
8
|
const truthy_js_1 = require("./truthy.js");
|
|
8
9
|
const validate_folder_name_js_1 = require("./validation/validate-folder-name.js");
|
|
9
10
|
exports.FolderContext = (0, react_1.createContext)({
|
|
@@ -17,6 +18,7 @@ exports.FolderContext = (0, react_1.createContext)({
|
|
|
17
18
|
const Folder = ({ name, children }) => {
|
|
18
19
|
const parent = (0, react_1.useContext)(exports.FolderContext);
|
|
19
20
|
const { registerFolder, unregisterFolder } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionSetters);
|
|
21
|
+
const nonce = (0, nonce_js_1.useNonce)();
|
|
20
22
|
(0, validate_folder_name_js_1.validateFolderName)(name);
|
|
21
23
|
const parentNameArr = [parent.parentName, parent.folderName].filter(truthy_js_1.truthy);
|
|
22
24
|
const parentName = parentNameArr.length === 0 ? null : parentNameArr.join('/');
|
|
@@ -27,11 +29,18 @@ const Folder = ({ name, children }) => {
|
|
|
27
29
|
};
|
|
28
30
|
}, [name, parentName]);
|
|
29
31
|
(0, react_1.useEffect)(() => {
|
|
30
|
-
registerFolder(name, parentName);
|
|
32
|
+
registerFolder(name, parentName, nonce.get());
|
|
31
33
|
return () => {
|
|
32
34
|
unregisterFolder(name, parentName);
|
|
33
35
|
};
|
|
34
|
-
}, [
|
|
36
|
+
}, [
|
|
37
|
+
name,
|
|
38
|
+
parent.folderName,
|
|
39
|
+
parentName,
|
|
40
|
+
registerFolder,
|
|
41
|
+
unregisterFolder,
|
|
42
|
+
nonce,
|
|
43
|
+
]);
|
|
35
44
|
return ((0, jsx_runtime_1.jsx)(exports.FolderContext.Provider, { value: value, children: children }));
|
|
36
45
|
};
|
|
37
46
|
exports.Folder = Folder;
|
package/dist/cjs/RemotionRoot.js
CHANGED
|
@@ -13,14 +13,13 @@ const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
|
13
13
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
14
14
|
const use_media_enabled_js_1 = require("./use-media-enabled.js");
|
|
15
15
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
16
|
-
const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, videoEnabled, audioEnabled, frameState,
|
|
16
|
+
const RemotionRootContexts = ({ children, numberOfAudioTags, logLevel, audioLatencyHint, videoEnabled, audioEnabled, frameState, visualModeEnabled, }) => {
|
|
17
17
|
const nonceContext = (0, react_1.useMemo)(() => {
|
|
18
18
|
let counter = 0;
|
|
19
19
|
return {
|
|
20
20
|
getNonce: () => counter++,
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
}, [nonceContextSeed]);
|
|
22
|
+
}, []);
|
|
24
23
|
const logging = (0, react_1.useMemo)(() => {
|
|
25
24
|
return { logLevel, mountTime: Date.now() };
|
|
26
25
|
}, [logLevel]);
|
package/dist/cjs/Sequence.js
CHANGED
|
@@ -11,7 +11,6 @@ const PremountContext_js_1 = require("./PremountContext.js");
|
|
|
11
11
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
12
12
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
13
13
|
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
14
|
-
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
15
14
|
const use_current_frame_1 = require("./use-current-frame");
|
|
16
15
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
17
16
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
@@ -21,7 +20,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
21
20
|
const { layout = 'absolute-fill' } = other;
|
|
22
21
|
const [id] = (0, react_1.useState)(() => String(Math.random()));
|
|
23
22
|
const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
24
|
-
const { rootId } = (0,
|
|
23
|
+
const { rootId } = (0, timeline_position_state_js_1.useTimelineContext)();
|
|
25
24
|
const cumulatedFrom = parentSequence
|
|
26
25
|
? parentSequence.cumulatedFrom + parentSequence.relativeFrom
|
|
27
26
|
: 0;
|
|
@@ -110,7 +109,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, durationInFrames = Inf
|
|
|
110
109
|
type: 'sequence',
|
|
111
110
|
rootId,
|
|
112
111
|
showInTimeline,
|
|
113
|
-
nonce,
|
|
112
|
+
nonce: nonce.get(),
|
|
114
113
|
loopDisplay,
|
|
115
114
|
stack: stack !== null && stack !== void 0 ? stack : inheritedStack,
|
|
116
115
|
premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
|
|
@@ -203,7 +202,7 @@ const PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
|
|
|
203
202
|
styleWhilePremounted,
|
|
204
203
|
styleWhilePostmounted,
|
|
205
204
|
]);
|
|
206
|
-
const { playing } = (0,
|
|
205
|
+
const { playing } = (0, timeline_position_state_js_1.useTimelineContext)();
|
|
207
206
|
const premountFramesRemaining = premountingActive ? from - frame : 0;
|
|
208
207
|
const premountContextValue = (0, react_1.useMemo)(() => {
|
|
209
208
|
return {
|
|
@@ -15,8 +15,8 @@ export type SetTimelineContextValue = {
|
|
|
15
15
|
setPlaying: (u: React.SetStateAction<boolean>) => void;
|
|
16
16
|
};
|
|
17
17
|
export declare const SetTimelineContext: React.Context<SetTimelineContextValue>;
|
|
18
|
-
export declare const TimelineContext: React.Context<TimelineContextValue>;
|
|
19
|
-
export declare const AbsoluteTimeContext: React.Context<TimelineContextValue>;
|
|
18
|
+
export declare const TimelineContext: React.Context<TimelineContextValue | null>;
|
|
19
|
+
export declare const AbsoluteTimeContext: React.Context<TimelineContextValue | null>;
|
|
20
20
|
export declare const TimelineContextProvider: React.FC<{
|
|
21
21
|
readonly children: React.ReactNode;
|
|
22
22
|
readonly frameState: Record<string, number> | null;
|
|
@@ -14,32 +14,8 @@ exports.SetTimelineContext = (0, react_1.createContext)({
|
|
|
14
14
|
throw new Error('default');
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
|
-
exports.TimelineContext = (0, react_1.createContext)(
|
|
18
|
-
|
|
19
|
-
playing: false,
|
|
20
|
-
playbackRate: 1,
|
|
21
|
-
rootId: '',
|
|
22
|
-
imperativePlaying: {
|
|
23
|
-
current: false,
|
|
24
|
-
},
|
|
25
|
-
setPlaybackRate: () => {
|
|
26
|
-
throw new Error('default');
|
|
27
|
-
},
|
|
28
|
-
audioAndVideoTags: { current: [] },
|
|
29
|
-
});
|
|
30
|
-
exports.AbsoluteTimeContext = (0, react_1.createContext)({
|
|
31
|
-
frame: {},
|
|
32
|
-
playing: false,
|
|
33
|
-
playbackRate: 1,
|
|
34
|
-
rootId: '',
|
|
35
|
-
imperativePlaying: {
|
|
36
|
-
current: false,
|
|
37
|
-
},
|
|
38
|
-
setPlaybackRate: () => {
|
|
39
|
-
throw new Error('default');
|
|
40
|
-
},
|
|
41
|
-
audioAndVideoTags: { current: [] },
|
|
42
|
-
});
|
|
17
|
+
exports.TimelineContext = (0, react_1.createContext)(null);
|
|
18
|
+
exports.AbsoluteTimeContext = (0, react_1.createContext)(null);
|
|
43
19
|
const TimelineContextProvider = ({ children, frameState }) => {
|
|
44
20
|
const [playing, setPlaying] = (0, react_1.useState)(false);
|
|
45
21
|
const imperativePlaying = (0, react_1.useRef)(false);
|
package/dist/cjs/freeze.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.Freeze = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
7
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
7
8
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
8
9
|
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
9
10
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
@@ -35,7 +36,7 @@ const Freeze = ({ frame: frameToFreeze, children, active = true, }) => {
|
|
|
35
36
|
return active(frame);
|
|
36
37
|
}
|
|
37
38
|
}, [active, frame]);
|
|
38
|
-
const timelineContext = (0,
|
|
39
|
+
const timelineContext = (0, timeline_position_state_js_1.useTimelineContext)();
|
|
39
40
|
const sequenceContext = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
40
41
|
const relativeFrom = (_a = sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.relativeFrom) !== null && _a !== void 0 ? _a : 0;
|
|
41
42
|
const timelineValue = (0, react_1.useMemo)(() => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CanUpdateSequencePropStatus } from './use-schema';
|
|
2
|
-
export declare const getEffectiveVisualModeValue: ({ codeValue, runtimeValue, dragOverrideValue, defaultValue, }: {
|
|
2
|
+
export declare const getEffectiveVisualModeValue: ({ codeValue, runtimeValue, dragOverrideValue, defaultValue, shouldResortToDefaultValueIfUndefined, }: {
|
|
3
3
|
codeValue: CanUpdateSequencePropStatus | null;
|
|
4
4
|
runtimeValue: unknown;
|
|
5
5
|
dragOverrideValue: unknown;
|
|
6
6
|
defaultValue: unknown;
|
|
7
|
+
shouldResortToDefaultValueIfUndefined: boolean;
|
|
7
8
|
}) => unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEffectiveVisualModeValue = void 0;
|
|
4
|
-
const getEffectiveVisualModeValue = ({ codeValue, runtimeValue, dragOverrideValue, defaultValue, }) => {
|
|
4
|
+
const getEffectiveVisualModeValue = ({ codeValue, runtimeValue, dragOverrideValue, defaultValue, shouldResortToDefaultValueIfUndefined = false, }) => {
|
|
5
5
|
if (dragOverrideValue !== undefined) {
|
|
6
6
|
return dragOverrideValue;
|
|
7
7
|
}
|
|
@@ -11,7 +11,8 @@ const getEffectiveVisualModeValue = ({ codeValue, runtimeValue, dragOverrideValu
|
|
|
11
11
|
if (!codeValue.canUpdate) {
|
|
12
12
|
return runtimeValue;
|
|
13
13
|
}
|
|
14
|
-
if (codeValue.codeValue === undefined
|
|
14
|
+
if (codeValue.codeValue === undefined &&
|
|
15
|
+
shouldResortToDefaultValueIfUndefined) {
|
|
15
16
|
return defaultValue;
|
|
16
17
|
}
|
|
17
18
|
return codeValue.codeValue;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ export { DownloadBehavior } from './download-behavior.js';
|
|
|
105
105
|
export * from './easing.js';
|
|
106
106
|
export * from './Folder.js';
|
|
107
107
|
export * from './freeze.js';
|
|
108
|
+
export type { NonceHistory } from './nonce.js';
|
|
108
109
|
export { getRemotionEnvironment } from './get-remotion-environment.js';
|
|
109
110
|
export { getStaticFiles, StaticFile } from './get-static-files.js';
|
|
110
111
|
export * from './IFrame.js';
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { CompositionManagerContext } from './CompositionManagerContext.js';
|
|
|
6
6
|
import * as CSSUtils from './default-css.js';
|
|
7
7
|
import type { SerializedJSONWithCustomFields } from './input-props-serialization.js';
|
|
8
8
|
import type { LoggingContextValue } from './log-level-context.js';
|
|
9
|
+
import type { NonceHistory } from './nonce.js';
|
|
9
10
|
import type { RemotionEnvironment } from './remotion-environment-context.js';
|
|
10
11
|
import type { SequenceFieldSchema, SequenceSchema } from './sequence-field-schema.js';
|
|
11
12
|
import type { ResolvedStackLocation } from './sequence-stack-traces.js';
|
|
@@ -84,6 +85,9 @@ export declare const Internals: {
|
|
|
84
85
|
controls: import("./CompositionManager.js").SequenceControls | undefined;
|
|
85
86
|
values: T;
|
|
86
87
|
};
|
|
88
|
+
readonly wrapInSchema: <S extends SequenceSchema, Props extends object>(Component: React.ComponentType<Props & {
|
|
89
|
+
readonly controls: import("./CompositionManager.js").SequenceControls | undefined;
|
|
90
|
+
}>, schema: S) => React.ComponentType<Props>;
|
|
87
91
|
readonly useSequenceControlOverride: (key: string) => unknown | undefined;
|
|
88
92
|
readonly RemotionRootContexts: import("react").FC<{
|
|
89
93
|
readonly children: React.ReactNode;
|
|
@@ -93,7 +97,6 @@ export declare const Internals: {
|
|
|
93
97
|
readonly videoEnabled: boolean;
|
|
94
98
|
readonly audioEnabled: boolean;
|
|
95
99
|
readonly frameState: Record<string, number> | null;
|
|
96
|
-
readonly nonceContextSeed: number;
|
|
97
100
|
readonly visualModeEnabled: boolean;
|
|
98
101
|
}>;
|
|
99
102
|
readonly CompositionManagerProvider: ({ children, onlyRenderComposition, currentCompositionMetadata, initialCompositions, initialCanvasContent, }: {
|
|
@@ -277,6 +280,7 @@ export declare const Internals: {
|
|
|
277
280
|
readonly persistCurrentFrame: (time: {
|
|
278
281
|
[x: string]: number;
|
|
279
282
|
}) => void;
|
|
283
|
+
readonly useTimelineContext: () => TimelineContextValue;
|
|
280
284
|
readonly useTimelineSetFrame: () => ((u: React.SetStateAction<Record<string, number>>) => void);
|
|
281
285
|
readonly isIosSafari: () => boolean;
|
|
282
286
|
readonly WATCH_REMOTION_STATIC_FILES: "remotion_staticFilesChanged";
|
|
@@ -407,7 +411,7 @@ export declare const Internals: {
|
|
|
407
411
|
volumes: string | number;
|
|
408
412
|
duration: number;
|
|
409
413
|
doesVolumeChange: boolean;
|
|
410
|
-
nonce:
|
|
414
|
+
nonce: import("./nonce.js").NonceHistoryContext;
|
|
411
415
|
rootId: string;
|
|
412
416
|
isStudio: boolean;
|
|
413
417
|
finalDisplayName: string;
|
|
@@ -432,17 +436,18 @@ export declare const Internals: {
|
|
|
432
436
|
}) => boolean;
|
|
433
437
|
readonly TimelinePosition: typeof TimelinePosition;
|
|
434
438
|
readonly DelayRenderContextType: import("react").Context<import("./delay-render.js").DelayRenderScope | null>;
|
|
435
|
-
readonly TimelineContext: import("react").Context<TimelineContextValue>;
|
|
436
|
-
readonly AbsoluteTimeContext: import("react").Context<TimelineContextValue>;
|
|
439
|
+
readonly TimelineContext: import("react").Context<TimelineContextValue | null>;
|
|
440
|
+
readonly AbsoluteTimeContext: import("react").Context<TimelineContextValue | null>;
|
|
437
441
|
readonly RenderAssetManagerProvider: import("react").FC<{
|
|
438
442
|
children: React.ReactNode;
|
|
439
443
|
collectAssets: null | React.RefObject<import("./RenderAssetManager.js").CollectAssetsRef | null>;
|
|
440
444
|
}>;
|
|
441
|
-
readonly getEffectiveVisualModeValue: ({ codeValue, runtimeValue, dragOverrideValue, defaultValue, }: {
|
|
445
|
+
readonly getEffectiveVisualModeValue: ({ codeValue, runtimeValue, dragOverrideValue, defaultValue, shouldResortToDefaultValueIfUndefined, }: {
|
|
442
446
|
codeValue: CanUpdateSequencePropStatus | null;
|
|
443
447
|
runtimeValue: unknown;
|
|
444
448
|
dragOverrideValue: unknown;
|
|
445
449
|
defaultValue: unknown;
|
|
450
|
+
shouldResortToDefaultValueIfUndefined: boolean;
|
|
446
451
|
}) => unknown;
|
|
447
452
|
};
|
|
448
|
-
export type { CompositionManagerContext, ResolvedStackLocation, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SequenceFieldSchema, SequenceSchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, ScheduleAudioNodeOptions, CanUpdateSequencePropStatus, ScheduleAudioNodeResult, };
|
|
453
|
+
export type { CompositionManagerContext, ResolvedStackLocation, CompProps, LoggingContextValue, MediaVolumeContextValue, RemotionEnvironment, SequenceFieldSchema, SequenceSchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, WatchRemotionStaticFilesPayload, ScheduleAudioNodeOptions, CanUpdateSequencePropStatus, ScheduleAudioNodeResult, NonceHistory, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -98,6 +98,7 @@ const volume_position_state_js_1 = require("./volume-position-state.js");
|
|
|
98
98
|
const volume_prop_js_1 = require("./volume-prop.js");
|
|
99
99
|
const volume_safeguard_js_1 = require("./volume-safeguard.js");
|
|
100
100
|
const watch_static_file_js_1 = require("./watch-static-file.js");
|
|
101
|
+
const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
|
|
101
102
|
const wrap_remotion_context_js_1 = require("./wrap-remotion-context.js");
|
|
102
103
|
// needs to be in core package so gets deduplicated in studio
|
|
103
104
|
const compositionSelectorRef = (0, react_1.createRef)();
|
|
@@ -123,6 +124,7 @@ exports.Internals = {
|
|
|
123
124
|
SequenceStackTracesUpdateContext: sequence_stack_traces_js_1.SequenceStackTracesUpdateContext,
|
|
124
125
|
SequenceVisibilityToggleContext: SequenceManager_js_1.SequenceVisibilityToggleContext,
|
|
125
126
|
useSchema: use_schema_js_1.useSchema,
|
|
127
|
+
wrapInSchema: wrap_in_schema_js_1.wrapInSchema,
|
|
126
128
|
useSequenceControlOverride: use_sequence_control_override_js_1.useSequenceControlOverride,
|
|
127
129
|
RemotionRootContexts: RemotionRoot_js_1.RemotionRootContexts,
|
|
128
130
|
CompositionManagerProvider: CompositionManagerProvider_js_1.CompositionManagerProvider,
|
|
@@ -170,6 +172,7 @@ exports.Internals = {
|
|
|
170
172
|
REMOTION_STUDIO_CONTAINER_ELEMENT: get_preview_dom_element_js_1.REMOTION_STUDIO_CONTAINER_ELEMENT,
|
|
171
173
|
RenderAssetManager: RenderAssetManager_js_1.RenderAssetManager,
|
|
172
174
|
persistCurrentFrame: timeline_position_state_js_1.persistCurrentFrame,
|
|
175
|
+
useTimelineContext: timeline_position_state_js_1.useTimelineContext,
|
|
173
176
|
useTimelineSetFrame: timeline_position_state_js_1.useTimelineSetFrame,
|
|
174
177
|
isIosSafari: video_fragment_js_1.isIosSafari,
|
|
175
178
|
WATCH_REMOTION_STATIC_FILES: watch_static_file_js_1.WATCH_REMOTION_STATIC_FILES,
|
package/dist/cjs/nonce.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type TNonceContext = {
|
|
2
2
|
getNonce: () => number;
|
|
3
3
|
};
|
|
4
|
+
type NonceHistoryItem = [number, number];
|
|
5
|
+
export type NonceHistory = NonceHistoryItem[];
|
|
6
|
+
export type NonceHistoryContext = {
|
|
7
|
+
get: () => NonceHistory;
|
|
8
|
+
};
|
|
4
9
|
export declare const NonceContext: import("react").Context<TNonceContext>;
|
|
5
|
-
export declare const useNonce: () =>
|
|
10
|
+
export declare const useNonce: () => NonceHistoryContext;
|
|
11
|
+
export {};
|
package/dist/cjs/nonce.js
CHANGED
|
@@ -5,18 +5,38 @@ const react_1 = require("react");
|
|
|
5
5
|
exports.NonceContext = (0, react_1.createContext)({
|
|
6
6
|
getNonce: () => 0,
|
|
7
7
|
});
|
|
8
|
+
let fastRefreshNonce = 0;
|
|
9
|
+
try {
|
|
10
|
+
if (typeof __webpack_module__ !== 'undefined') {
|
|
11
|
+
if (__webpack_module__.hot) {
|
|
12
|
+
__webpack_module__.hot.addStatusHandler((status) => {
|
|
13
|
+
if (status === 'idle') {
|
|
14
|
+
fastRefreshNonce++;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
// __webpack_module__ may throw ReferenceError in some environments
|
|
22
|
+
}
|
|
8
23
|
const useNonce = () => {
|
|
9
24
|
const context = (0, react_1.useContext)(exports.NonceContext);
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
(0, react_1.
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
const nonce = context.getNonce();
|
|
26
|
+
const nonceRef = (0, react_1.useRef)(nonce);
|
|
27
|
+
nonceRef.current = nonce;
|
|
28
|
+
const history = (0, react_1.useRef)([[fastRefreshNonce, nonce]]);
|
|
29
|
+
const get = (0, react_1.useCallback)(() => {
|
|
30
|
+
if (fastRefreshNonce !== history.current[history.current.length - 1][0]) {
|
|
31
|
+
history.current = [
|
|
32
|
+
...history.current,
|
|
33
|
+
[fastRefreshNonce, nonceRef.current],
|
|
34
|
+
];
|
|
16
35
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
36
|
+
return history.current;
|
|
37
|
+
}, [history]);
|
|
38
|
+
return (0, react_1.useMemo)(() => {
|
|
39
|
+
return { get };
|
|
40
|
+
}, [get]);
|
|
21
41
|
};
|
|
22
42
|
exports.useNonce = useNonce;
|
|
@@ -11,6 +11,18 @@ export type BooleanFieldSchema = {
|
|
|
11
11
|
default: boolean;
|
|
12
12
|
description?: string;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
14
|
+
export type RotationFieldSchema = {
|
|
15
|
+
type: 'rotation';
|
|
16
|
+
step?: number;
|
|
17
|
+
default: string | undefined;
|
|
18
|
+
description?: string;
|
|
19
|
+
};
|
|
20
|
+
export type TranslateFieldSchema = {
|
|
21
|
+
type: 'translate';
|
|
22
|
+
step?: number;
|
|
23
|
+
default: string | undefined;
|
|
24
|
+
description?: string;
|
|
25
|
+
};
|
|
26
|
+
export type SequenceFieldSchema = NumberFieldSchema | BooleanFieldSchema | RotationFieldSchema | TranslateFieldSchema;
|
|
15
27
|
export type SequenceSchema = Record<string, SequenceFieldSchema>;
|
|
16
28
|
export type SchemaKeysRecord<S extends SequenceSchema> = Record<keyof S, unknown>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MutableRefObject } from 'react';
|
|
2
|
+
import { type TimelineContextValue } from './TimelineContext.js';
|
|
2
3
|
export type PlayableMediaTag = {
|
|
3
4
|
play: (reason: string) => void;
|
|
4
5
|
id: string;
|
|
@@ -7,6 +8,7 @@ type CurrentTimePerComposition = Record<string, number>;
|
|
|
7
8
|
export declare const persistCurrentFrame: (time: CurrentTimePerComposition) => void;
|
|
8
9
|
export declare const getInitialFrameState: () => CurrentTimePerComposition;
|
|
9
10
|
export declare const getFrameForComposition: (composition: string) => number;
|
|
11
|
+
export declare const useTimelineContext: () => TimelineContextValue;
|
|
10
12
|
export declare const useTimelinePosition: () => number;
|
|
11
13
|
export declare const useAbsoluteTimelinePosition: () => number;
|
|
12
14
|
export declare const useTimelineSetFrame: () => ((u: React.SetStateAction<Record<string, number>>) => void);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePlayingState = exports.useTimelineSetFrame = exports.useAbsoluteTimelinePosition = exports.useTimelinePosition = exports.getFrameForComposition = exports.getInitialFrameState = exports.persistCurrentFrame = void 0;
|
|
3
|
+
exports.usePlayingState = exports.useTimelineSetFrame = exports.useAbsoluteTimelinePosition = exports.useTimelinePosition = exports.useTimelineContext = exports.getFrameForComposition = exports.getInitialFrameState = exports.persistCurrentFrame = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
6
6
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
@@ -44,13 +44,24 @@ const useTimelinePositionFromContext = (state) => {
|
|
|
44
44
|
const unclamped = (_b = state.frame[videoConfig.id]) !== null && _b !== void 0 ? _b : (env.isPlayer ? 0 : (0, exports.getFrameForComposition)(videoConfig.id));
|
|
45
45
|
return Math.min(videoConfig.durationInFrames - 1, unclamped);
|
|
46
46
|
};
|
|
47
|
-
const
|
|
47
|
+
const useTimelineContext = () => {
|
|
48
48
|
const state = (0, react_1.useContext)(TimelineContext_js_1.TimelineContext);
|
|
49
|
+
if (state === null) {
|
|
50
|
+
throw new Error('TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.');
|
|
51
|
+
}
|
|
52
|
+
return state;
|
|
53
|
+
};
|
|
54
|
+
exports.useTimelineContext = useTimelineContext;
|
|
55
|
+
const useTimelinePosition = () => {
|
|
56
|
+
const state = (0, exports.useTimelineContext)();
|
|
49
57
|
return useTimelinePositionFromContext(state);
|
|
50
58
|
};
|
|
51
59
|
exports.useTimelinePosition = useTimelinePosition;
|
|
52
60
|
const useAbsoluteTimelinePosition = () => {
|
|
53
61
|
const state = (0, react_1.useContext)(TimelineContext_js_1.AbsoluteTimeContext);
|
|
62
|
+
if (state === null) {
|
|
63
|
+
throw new Error('AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.');
|
|
64
|
+
}
|
|
54
65
|
return useTimelinePositionFromContext(state);
|
|
55
66
|
};
|
|
56
67
|
exports.useAbsoluteTimelinePosition = useAbsoluteTimelinePosition;
|
|
@@ -60,7 +71,7 @@ const useTimelineSetFrame = () => {
|
|
|
60
71
|
};
|
|
61
72
|
exports.useTimelineSetFrame = useTimelineSetFrame;
|
|
62
73
|
const usePlayingState = () => {
|
|
63
|
-
const { playing, imperativePlaying } = (0,
|
|
74
|
+
const { playing, imperativePlaying } = (0, exports.useTimelineContext)();
|
|
64
75
|
const { setPlaying } = (0, react_1.useContext)(TimelineContext_js_1.SetTimelineContext);
|
|
65
76
|
return (0, react_1.useMemo)(() => [playing, setPlaying, imperativePlaying], [imperativePlaying, playing, setPlaying]);
|
|
66
77
|
};
|
|
@@ -13,7 +13,7 @@ export declare const useBasicMediaInTimeline: ({ volume, mediaVolume, mediaType,
|
|
|
13
13
|
volumes: string | number;
|
|
14
14
|
duration: number;
|
|
15
15
|
doesVolumeChange: boolean;
|
|
16
|
-
nonce:
|
|
16
|
+
nonce: import("./nonce.js").NonceHistoryContext;
|
|
17
17
|
rootId: string;
|
|
18
18
|
isStudio: boolean;
|
|
19
19
|
finalDisplayName: string;
|
|
@@ -8,7 +8,7 @@ const get_asset_file_name_js_1 = require("./get-asset-file-name.js");
|
|
|
8
8
|
const nonce_js_1 = require("./nonce.js");
|
|
9
9
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
10
10
|
const SequenceManager_js_1 = require("./SequenceManager.js");
|
|
11
|
-
const
|
|
11
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
12
12
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
13
13
|
const use_video_config_js_1 = require("./use-video-config.js");
|
|
14
14
|
const volume_prop_js_1 = require("./volume-prop.js");
|
|
@@ -60,7 +60,7 @@ const useBasicMediaInTimeline = ({ volume, mediaVolume, mediaType, src, displayN
|
|
|
60
60
|
}, [initialVolume, mediaType, src, volume]);
|
|
61
61
|
const doesVolumeChange = typeof volume === 'function';
|
|
62
62
|
const nonce = (0, nonce_js_1.useNonce)();
|
|
63
|
-
const { rootId } = (0,
|
|
63
|
+
const { rootId } = (0, timeline_position_state_js_1.useTimelineContext)();
|
|
64
64
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
65
65
|
return {
|
|
66
66
|
volumes,
|
|
@@ -109,7 +109,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, src, mediaType, playbackRate,
|
|
|
109
109
|
rootId,
|
|
110
110
|
volume: volumes,
|
|
111
111
|
showInTimeline: true,
|
|
112
|
-
nonce,
|
|
112
|
+
nonce: nonce.get(),
|
|
113
113
|
startMediaFrom: 0 - startsAt,
|
|
114
114
|
doesVolumeChange,
|
|
115
115
|
loopDisplay,
|
|
@@ -12,7 +12,6 @@ const play_and_handle_not_allowed_error_js_1 = require("./play-and-handle-not-al
|
|
|
12
12
|
const playback_logging_js_1 = require("./playback-logging.js");
|
|
13
13
|
const seek_js_1 = require("./seek.js");
|
|
14
14
|
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
15
|
-
const TimelineContext_js_1 = require("./TimelineContext.js");
|
|
16
15
|
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
17
16
|
const use_media_buffering_js_1 = require("./use-media-buffering.js");
|
|
18
17
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
@@ -21,7 +20,7 @@ const use_video_config_js_1 = require("./use-video-config.js");
|
|
|
21
20
|
const get_current_time_js_1 = require("./video/get-current-time.js");
|
|
22
21
|
const warn_about_non_seekable_media_js_1 = require("./warn-about-non-seekable-media.js");
|
|
23
22
|
const useMediaPlayback = ({ mediaRef, src, mediaType, playbackRate: localPlaybackRate, onlyWarnForMediaSeekingError, acceptableTimeshift, pauseWhenBuffering, isPremounting, isPostmounting, onAutoPlayError, }) => {
|
|
24
|
-
const { playbackRate: globalPlaybackRate } = (0,
|
|
23
|
+
const { playbackRate: globalPlaybackRate } = (0, timeline_position_state_js_1.useTimelineContext)();
|
|
25
24
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
26
25
|
const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
|
|
27
26
|
const [playing] = (0, timeline_position_state_js_1.usePlayingState)();
|
|
@@ -4,10 +4,10 @@ exports.useMediaTag = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const log_level_context_js_1 = require("./log-level-context.js");
|
|
6
6
|
const play_and_handle_not_allowed_error_js_1 = require("./play-and-handle-not-allowed-error.js");
|
|
7
|
-
const
|
|
7
|
+
const timeline_position_state_js_1 = require("./timeline-position-state.js");
|
|
8
8
|
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
9
9
|
const useMediaTag = ({ mediaRef, id, mediaType, onAutoPlayError, isPremounting, isPostmounting, }) => {
|
|
10
|
-
const { audioAndVideoTags, imperativePlaying } = (0,
|
|
10
|
+
const { audioAndVideoTags, imperativePlaying } = (0, timeline_position_state_js_1.useTimelineContext)();
|
|
11
11
|
const logLevel = (0, log_level_context_js_1.useLogLevel)();
|
|
12
12
|
const mountTime = (0, log_level_context_js_1.useMountTime)();
|
|
13
13
|
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
package/dist/cjs/use-schema.js
CHANGED
|
@@ -60,6 +60,7 @@ const useSchema = (schema, currentValue) => {
|
|
|
60
60
|
runtimeValue: currentValue[key],
|
|
61
61
|
dragOverrideValue: overrideValues[key],
|
|
62
62
|
defaultValue: (_c = schema[key]) === null || _c === void 0 ? void 0 : _c.default,
|
|
63
|
+
shouldResortToDefaultValueIfUndefined: false,
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
return {
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequenceControls } from './CompositionManager.js';
|
|
3
|
+
import type { SequenceSchema } from './sequence-field-schema.js';
|
|
4
|
+
export declare const wrapInSchema: <S extends SequenceSchema, Props extends object>(Component: React.ComponentType<Props & {
|
|
5
|
+
readonly controls: SequenceControls | undefined;
|
|
6
|
+
}>, schema: S) => React.ComponentType<Props>;
|