remotion 4.0.504 → 4.0.506

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.
@@ -7,6 +7,7 @@ import type { EffectDefinition } from './effects/effect-types.js';
7
7
  import type { InteractivitySchema } from './interactivity-schema.js';
8
8
  import type { NonceHistory } from './nonce.js';
9
9
  import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
10
+ import type { RuntimeValueSnapshot, RuntimeValueStore } from './runtime-value-store.js';
10
11
  export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
11
12
  width: number | undefined;
12
13
  height: number | undefined;
@@ -56,14 +57,17 @@ export type LoopDisplay = {
56
57
  durationInFrames: number;
57
58
  };
58
59
  export type JsxComponentIdentity = string;
59
- export type SequenceControls = {
60
+ export type SequenceRegistrationControls = {
60
61
  schema: InteractivitySchema;
61
- currentRuntimeValueDotNotation: Record<string, unknown>;
62
+ runtimeValues: RuntimeValueStore;
62
63
  overrideId: string;
63
64
  supportsEffects: boolean;
64
65
  componentIdentity: JsxComponentIdentity | null;
65
66
  componentName: string;
66
67
  };
68
+ export type SequenceControls = SequenceRegistrationControls & {
69
+ currentRuntimeValueDotNotation: RuntimeValueSnapshot;
70
+ };
67
71
  export type TSequence = {
68
72
  from: number;
69
73
  trimBefore: number | null;
@@ -78,7 +82,7 @@ export type TSequence = {
78
82
  getStack: () => string | null;
79
83
  premountDisplay: number | null;
80
84
  postmountDisplay: number | null;
81
- controls: SequenceControls | null;
85
+ controls: SequenceRegistrationControls | null;
82
86
  refForOutline: React.RefObject<Element | null> | null;
83
87
  effects: readonly EffectDefinition<unknown>[];
84
88
  isInsideSeries: boolean;
@@ -10,8 +10,8 @@ export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'fro
10
10
  export type InteractiveTransformProps = Pick<AbsoluteFillLayout, 'style'>;
11
11
  export type InteractiveCropProps = Pick<SequenceProps, 'cropLeft' | 'cropRight' | 'cropTop' | 'cropBottom'>;
12
12
  export type InteractivePremountProps = Pick<AbsoluteFillLayout, 'premountFor' | 'postmountFor' | 'styleWhilePremounted' | 'styleWhilePostmounted'>;
13
- type InteractiveSequenceProps = InteractiveBaseProps;
14
- type InteractiveElementProps<Tag extends InteractiveTag> = Omit<React.ComponentPropsWithoutRef<Tag>, keyof InteractiveSequenceProps> & InteractiveSequenceProps;
13
+ type InteractiveManagedProps = InteractiveBaseProps & InteractiveCropProps;
14
+ type InteractiveElementProps<Tag extends InteractiveTag> = Omit<React.ComponentPropsWithoutRef<Tag>, keyof InteractiveManagedProps> & InteractiveManagedProps;
15
15
  type InteractiveElementComponent<Tag extends InteractiveTag> = React.ComponentType<InteractiveElementProps<Tag> & React.RefAttributes<ElementForTag<Tag>>>;
16
16
  type RemotionComponentIdentityPackage = 'remotion' | `@remotion/${string}`;
17
17
  /**
@@ -39,6 +39,7 @@ const react_1 = __importStar(require("react"));
39
39
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
40
40
  const interactivity_schema_js_1 = require("./interactivity-schema.js");
41
41
  const Sequence_js_1 = require("./Sequence.js");
42
+ const use_crop_style_js_1 = require("./use-crop-style.js");
42
43
  const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
43
44
  const sourcePathToIdentityPrefix = (packageName) => {
44
45
  if (packageName === 'remotion') {
@@ -58,6 +59,7 @@ const makeRemotionComponentIdentity = ({ packageName, componentName, }) => {
58
59
  const interactiveElementSchema = {
59
60
  ...interactivity_schema_js_1.baseSchema,
60
61
  ...interactivity_schema_js_1.transformSchema,
62
+ ...interactivity_schema_js_1.cropSchema,
61
63
  };
62
64
  const interactiveBackgroundElementSchema = {
63
65
  ...interactiveElementSchema,
@@ -106,7 +108,15 @@ const withSchema = (options) => {
106
108
  };
107
109
  const makeInteractiveElement = (tag, displayName, schema) => {
108
110
  const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
109
- const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, controls, ...props } = propsWithControls;
111
+ const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, controls, cropLeft, cropRight, cropTop, cropBottom, style, ...props } = propsWithControls;
112
+ const croppedStyle = (0, use_crop_style_js_1.useCropStyle)({
113
+ cropLeft,
114
+ cropRight,
115
+ cropTop,
116
+ cropBottom,
117
+ style: style !== null && style !== void 0 ? style : null,
118
+ componentName: displayName,
119
+ });
110
120
  const refForOutline = (0, react_1.useRef)(null);
111
121
  const callbackRef = (0, react_1.useCallback)((element) => {
112
122
  refForOutline.current = element;
@@ -114,6 +124,7 @@ const makeInteractiveElement = (tag, displayName, schema) => {
114
124
  }, [ref]);
115
125
  return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : displayName, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, controls: controls, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive", outlineRef: refForOutline, children: react_1.default.createElement(tag, {
116
126
  ...props,
127
+ style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined,
117
128
  ref: callbackRef,
118
129
  }) }));
119
130
  });
@@ -189,6 +189,37 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
189
189
  : registeredFrozenFrame) *
190
190
  isMedia.data.playbackRate
191
191
  : null;
192
+ const controlsSchema = controls === null || controls === void 0 ? void 0 : controls.schema;
193
+ const controlsRuntimeValues = controls === null || controls === void 0 ? void 0 : controls.runtimeValues;
194
+ const controlsOverrideId = controls === null || controls === void 0 ? void 0 : controls.overrideId;
195
+ const controlsSupportsEffects = controls === null || controls === void 0 ? void 0 : controls.supportsEffects;
196
+ const controlsComponentIdentity = controls === null || controls === void 0 ? void 0 : controls.componentIdentity;
197
+ const controlsComponentName = controls === null || controls === void 0 ? void 0 : controls.componentName;
198
+ const registrationControls = (0, react_1.useMemo)(() => {
199
+ if (controlsSchema === undefined ||
200
+ controlsRuntimeValues === undefined ||
201
+ controlsOverrideId === undefined ||
202
+ controlsSupportsEffects === undefined ||
203
+ controlsComponentIdentity === undefined ||
204
+ controlsComponentName === undefined) {
205
+ return null;
206
+ }
207
+ return {
208
+ schema: controlsSchema,
209
+ runtimeValues: controlsRuntimeValues,
210
+ overrideId: controlsOverrideId,
211
+ supportsEffects: controlsSupportsEffects,
212
+ componentIdentity: controlsComponentIdentity,
213
+ componentName: controlsComponentName,
214
+ };
215
+ }, [
216
+ controlsComponentIdentity,
217
+ controlsComponentName,
218
+ controlsOverrideId,
219
+ controlsRuntimeValues,
220
+ controlsSchema,
221
+ controlsSupportsEffects,
222
+ ]);
192
223
  (0, react_1.useEffect)(() => {
193
224
  var _a, _b, _c;
194
225
  if (!env.isStudio) {
@@ -198,7 +229,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
198
229
  if (isMedia.type === 'image') {
199
230
  registerSequence({
200
231
  type: 'image',
201
- controls: controls !== null && controls !== void 0 ? controls : null,
232
+ controls: registrationControls,
202
233
  effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
203
234
  displayName: timelineClipName,
204
235
  documentationLink: resolvedDocumentationLink,
@@ -223,7 +254,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
223
254
  else {
224
255
  registerSequence({
225
256
  type: isMedia.type,
226
- controls: controls !== null && controls !== void 0 ? controls : null,
257
+ controls: registrationControls,
227
258
  effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
228
259
  displayName: timelineClipName,
229
260
  documentationLink: resolvedDocumentationLink,
@@ -270,7 +301,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
270
301
  getStack: () => stackRef.current,
271
302
  premountDisplay: premountDisplay !== null && premountDisplay !== void 0 ? premountDisplay : null,
272
303
  postmountDisplay: postmountDisplay !== null && postmountDisplay !== void 0 ? postmountDisplay : null,
273
- controls: controls !== null && controls !== void 0 ? controls : null,
304
+ controls: registrationControls,
274
305
  effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
275
306
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
276
307
  isInsideSeries,
@@ -298,7 +329,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 0, freeze
298
329
  premountDisplay,
299
330
  postmountDisplay,
300
331
  env.isStudio,
301
- controls,
332
+ registrationControls,
302
333
  _remotionInternalEffects,
303
334
  isMedia,
304
335
  resolvedDocumentationLink,
@@ -7,6 +7,11 @@ export type TimelineContextValue = {
7
7
  imperativePlaying: RefObject<boolean>;
8
8
  audioAndVideoTags: RefObject<PlayableMediaTag[]>;
9
9
  };
10
+ export type TimelineImperativeContextValue = {
11
+ frameRef: RefObject<Record<string, number>>;
12
+ imperativePlaying: RefObject<boolean>;
13
+ audioAndVideoTags: RefObject<PlayableMediaTag[]>;
14
+ };
10
15
  export type PlaybackRateContextValue = {
11
16
  playbackRate: number;
12
17
  setPlaybackRate: (u: React.SetStateAction<number>) => void;
@@ -17,6 +22,7 @@ export type SetTimelineContextValue = {
17
22
  };
18
23
  export declare const SetTimelineContext: React.Context<SetTimelineContextValue>;
19
24
  export declare const TimelineContext: React.Context<TimelineContextValue | null>;
25
+ export declare const TimelineImperativeContext: React.Context<TimelineImperativeContextValue | null>;
20
26
  export declare const PlaybackRateContext: React.Context<PlaybackRateContextValue | null>;
21
27
  export declare const AbsoluteTimeContext: React.Context<TimelineContextValue | null>;
22
28
  export declare const TimelineContextProvider: React.FC<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimelineContextProvider = exports.AbsoluteTimeContext = exports.PlaybackRateContext = exports.TimelineContext = exports.SetTimelineContext = void 0;
3
+ exports.TimelineContextProvider = exports.AbsoluteTimeContext = exports.PlaybackRateContext = exports.TimelineImperativeContext = exports.TimelineContext = exports.SetTimelineContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const timeline_position_state_1 = require("./timeline-position-state");
@@ -14,6 +14,7 @@ exports.SetTimelineContext = (0, react_1.createContext)({
14
14
  },
15
15
  });
16
16
  exports.TimelineContext = (0, react_1.createContext)(null);
17
+ exports.TimelineImperativeContext = (0, react_1.createContext)(null);
17
18
  exports.PlaybackRateContext = (0, react_1.createContext)(null);
18
19
  exports.AbsoluteTimeContext = (0, react_1.createContext)(null);
19
20
  const TimelineContextProvider = ({ children, frameState }) => {
@@ -23,6 +24,8 @@ const TimelineContextProvider = ({ children, frameState }) => {
23
24
  const audioAndVideoTags = (0, react_1.useRef)([]);
24
25
  const [_frame, setFrame] = (0, react_1.useState)(() => (0, timeline_position_state_1.getInitialFrameState)());
25
26
  const frame = frameState !== null && frameState !== void 0 ? frameState : _frame;
27
+ const frameRef = (0, react_1.useRef)(frame);
28
+ frameRef.current = frame;
26
29
  const { delayRender, continueRender } = (0, use_delay_render_1.useDelayRender)();
27
30
  if (typeof window !== 'undefined') {
28
31
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -63,6 +66,13 @@ const TimelineContextProvider = ({ children, frameState }) => {
63
66
  audioAndVideoTags,
64
67
  };
65
68
  }, [frame, playing]);
69
+ const timelineImperativeContextValue = (0, react_1.useMemo)(() => {
70
+ return {
71
+ frameRef,
72
+ imperativePlaying,
73
+ audioAndVideoTags,
74
+ };
75
+ }, []);
66
76
  const playbackRateContextValue = (0, react_1.useMemo)(() => {
67
77
  return {
68
78
  playbackRate,
@@ -75,6 +85,6 @@ const TimelineContextProvider = ({ children, frameState }) => {
75
85
  setPlaying,
76
86
  };
77
87
  }, []);
78
- return (jsx_runtime_1.jsx(exports.AbsoluteTimeContext.Provider, { value: timelineContextValue, children: jsx_runtime_1.jsx(exports.PlaybackRateContext.Provider, { value: playbackRateContextValue, children: jsx_runtime_1.jsx(exports.TimelineContext.Provider, { value: timelineContextValue, children: jsx_runtime_1.jsx(exports.SetTimelineContext.Provider, { value: setTimelineContextValue, children: children }) }) }) }));
88
+ return (jsx_runtime_1.jsx(exports.AbsoluteTimeContext.Provider, { value: timelineContextValue, children: jsx_runtime_1.jsx(exports.PlaybackRateContext.Provider, { value: playbackRateContextValue, children: jsx_runtime_1.jsx(exports.TimelineImperativeContext.Provider, { value: timelineImperativeContextValue, children: jsx_runtime_1.jsx(exports.TimelineContext.Provider, { value: timelineContextValue, children: jsx_runtime_1.jsx(exports.SetTimelineContext.Provider, { value: setTimelineContextValue, children: children }) }) }) }) }));
79
89
  };
80
90
  exports.TimelineContextProvider = TimelineContextProvider;
@@ -1,7 +1,7 @@
1
1
  import './_check-rsc.js';
2
2
  import './asset-types.js';
3
3
  import type { Codec } from './codec.js';
4
- import type { AnyCompMetadata, AnyComposition, AudioOrVideoAsset, JsxComponentIdentity, LoopDisplay, SequenceControls, TRenderAsset } from './CompositionManager.js';
4
+ import type { AnyCompMetadata, AnyComposition, AudioOrVideoAsset, JsxComponentIdentity, LoopDisplay, SequenceControls, SequenceRegistrationControls, TRenderAsset } from './CompositionManager.js';
5
5
  import type { DelayRenderScope } from './delay-render.js';
6
6
  import { type TFolder } from './Folder.js';
7
7
  import type { StaticFile } from './get-static-files.js';
@@ -9,6 +9,7 @@ import type { AssetFieldSchema, ArrayFieldSchema, ArrayItemFieldSchema, Captions
9
9
  import type { LogLevel } from './log.js';
10
10
  import type { ProResProfile } from './prores-profile.js';
11
11
  import type { PixelFormat, VideoImageFormat } from './render-types.js';
12
+ import type { RuntimeValueSnapshot, RuntimeValueStore } from './runtime-value-store.js';
12
13
  import type { UseBufferState } from './use-buffer-state';
13
14
  import type { VideoConfig } from './video-config.js';
14
15
  export type VideoConfigWithSerializedProps = Omit<VideoConfig, 'defaultProps' | 'props'> & {
@@ -183,4 +184,4 @@ export type _InternalTypes = {
183
184
  TRenderAsset: TRenderAsset;
184
185
  ProResProfile: ProResProfile;
185
186
  };
186
- export type { AnyComposition, AssetFieldSchema, ArrayFieldSchema, ArrayItemFieldSchema, CaptionsFieldSchema, DelayRenderScope, JsxComponentIdentity, LoopDisplay, SequenceControls, InteractivitySchemaField, InteractivitySchema, UseBufferState, };
187
+ export type { AnyComposition, AssetFieldSchema, ArrayFieldSchema, ArrayItemFieldSchema, CaptionsFieldSchema, DelayRenderScope, JsxComponentIdentity, LoopDisplay, RuntimeValueSnapshot, RuntimeValueStore, SequenceControls, SequenceRegistrationControls, InteractivitySchemaField, InteractivitySchema, UseBufferState, };
@@ -16,7 +16,7 @@ import type { ResolvedStackLocation } from './sequence-stack-traces.js';
16
16
  import type { CannotUpdateSequenceReason } from './SequenceManager.js';
17
17
  import { type CanUpdateEffectPropsResponse, type CanUpdateEffectPropsResponseFalse, type CanUpdateEffectPropsResponseTrue, type CanUpdateSequencePropsResponse, type CanUpdateSequencePropsResponseFalse, type CanUpdateSequencePropsResponseTrue, type SequenceNodePath, type SequencePropsSubscriptionKey, type VideoConfigValues } from './SequenceManager.js';
18
18
  import * as TimelinePosition from './timeline-position-state.js';
19
- import { type PlaybackRateContextValue, type SetTimelineContextValue, type TimelineContextValue } from './TimelineContext.js';
19
+ import { type PlaybackRateContextValue, type SetTimelineContextValue, type TimelineImperativeContextValue, type TimelineContextValue } from './TimelineContext.js';
20
20
  import { truthy } from './truthy.js';
21
21
  import type { CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, VideoConfigNumericExpression } from './use-schema.js';
22
22
  import { type CanUpdateSequencePropStatus, type DragOverrides, type EffectDragOverrides, type PropStatuses } from './use-schema.js';
@@ -1166,6 +1166,7 @@ export declare const Internals: {
1166
1166
  readonly TimelinePosition: typeof TimelinePosition;
1167
1167
  readonly DelayRenderContextType: import("react").Context<import("./delay-render.js").DelayRenderScope | null>;
1168
1168
  readonly TimelineContext: import("react").Context<TimelineContextValue | null>;
1169
+ readonly TimelineImperativeContext: import("react").Context<TimelineImperativeContextValue | null>;
1169
1170
  readonly PlaybackRateContext: import("react").Context<PlaybackRateContextValue | null>;
1170
1171
  readonly AbsoluteTimeContext: import("react").Context<TimelineContextValue | null>;
1171
1172
  readonly RenderAssetManagerProvider: import("react").FC<{
@@ -1269,4 +1270,4 @@ export declare const Internals: {
1269
1270
  readonly componentName: string;
1270
1271
  }) => import("react").CSSProperties | null;
1271
1272
  };
1272
- export type { ArrayFieldSchema, AssetFieldSchema, ArrayItemFieldSchema, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateEffectPropsResponseFalse, CanUpdateEffectPropsResponseTrue, CanUpdateSequencePropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, VideoConfigNumericExpression, CompositionManagerContext, CompProps, DragOverrides, DragOverrideValue, EffectDragOverrides, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, JsxComponentIdentity, LoggingContextValue, MediaVolumeContextValue, NonceHistory, OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext, OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSetters, PlaybackRateContextValue, PropStatuses, RemotionAudioContextState, RemotionEnvironment, ResolvedStackLocation, ScheduleAudioNodeOptions, ScheduleAudioNodeResult, InteractivitySchemaField, SequenceNodePath, SequencePropsSubscriptionKey, VideoConfigValues, InteractivitySchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TRenderAsset, TSequence, VisibleFieldSchema, WatchRemotionStaticFilesPayload, };
1273
+ export type { ArrayFieldSchema, AssetFieldSchema, ArrayItemFieldSchema, CannotUpdateSequenceReason, CanUpdateEffectPropsResponse, CanUpdateEffectPropsResponseFalse, CanUpdateEffectPropsResponseTrue, CanUpdateSequencePropsResponse, CanUpdateSequencePropsResponseFalse, CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, CanUpdateSequencePropStatusEasing, CanUpdateSequencePropStatusFalse, CanUpdateSequencePropStatusKeyframed, CanUpdateSequencePropStatusStatic, VideoConfigNumericExpression, CompositionManagerContext, CompProps, DragOverrides, DragOverrideValue, EffectDragOverrides, GetDragOverrides, GetEffectDragOverrides, GetEffectPropStatuses, GetPropStatuses, JsxComponentIdentity, LoggingContextValue, MediaVolumeContextValue, NonceHistory, OverrideIdsToNodePathsGettersContext, OverrideIdsToNodePathsSettersContext, OverrideIdToNodePaths, OverrideToNodePathGetters, OverrideToNodeSetters, PlaybackRateContextValue, PropStatuses, RemotionAudioContextState, RemotionEnvironment, ResolvedStackLocation, ScheduleAudioNodeOptions, ScheduleAudioNodeResult, InteractivitySchemaField, SequenceNodePath, SequencePropsSubscriptionKey, VideoConfigValues, InteractivitySchema, SerializedJSONWithCustomFields, SetMediaVolumeContextValue, SetTimelineContextValue, TCompMetadata, TComposition, TimelineContextValue, TimelineImperativeContextValue, TRenderAsset, TSequence, VisibleFieldSchema, WatchRemotionStaticFilesPayload, };
@@ -248,6 +248,7 @@ exports.Internals = {
248
248
  TimelinePosition,
249
249
  DelayRenderContextType: use_delay_render_js_1.DelayRenderContextType,
250
250
  TimelineContext: TimelineContext_js_1.TimelineContext,
251
+ TimelineImperativeContext: TimelineContext_js_1.TimelineImperativeContext,
251
252
  PlaybackRateContext: TimelineContext_js_1.PlaybackRateContext,
252
253
  AbsoluteTimeContext: TimelineContext_js_1.AbsoluteTimeContext,
253
254
  RenderAssetManagerProvider: RenderAssetManager_js_1.RenderAssetManagerProvider,
@@ -0,0 +1,10 @@
1
+ export type RuntimeValueSnapshot = Readonly<Record<string, unknown>>;
2
+ export type RuntimeValueStore = {
3
+ getSnapshot: () => RuntimeValueSnapshot;
4
+ subscribe: (listener: () => void) => () => void;
5
+ };
6
+ export type RuntimeValueStoreController = {
7
+ store: RuntimeValueStore;
8
+ setSnapshot: (newSnapshot: RuntimeValueSnapshot) => void;
9
+ };
10
+ export declare const createRuntimeValueStore: (initialSnapshot: Readonly<Record<string, unknown>>) => RuntimeValueStoreController;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRuntimeValueStore = void 0;
4
+ const createRuntimeValueStore = (initialSnapshot) => {
5
+ let snapshot = initialSnapshot;
6
+ const listeners = new Set();
7
+ const store = {
8
+ getSnapshot: () => snapshot,
9
+ subscribe: (listener) => {
10
+ listeners.add(listener);
11
+ return () => {
12
+ listeners.delete(listener);
13
+ };
14
+ },
15
+ };
16
+ return {
17
+ store,
18
+ setSnapshot: (newSnapshot) => {
19
+ if (snapshot === newSnapshot) {
20
+ return;
21
+ }
22
+ snapshot = newSnapshot;
23
+ for (const listener of listeners) {
24
+ listener();
25
+ }
26
+ },
27
+ };
28
+ };
29
+ exports.createRuntimeValueStore = createRuntimeValueStore;
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.504";
6
+ export declare const VERSION = "4.0.506";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.504';
10
+ exports.VERSION = '4.0.506';
@@ -40,6 +40,7 @@ const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
40
40
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
41
41
  const flatten_schema_js_1 = require("./flatten-schema.js");
42
42
  const interactivity_schema_js_1 = require("./interactivity-schema.js");
43
+ const runtime_value_store_js_1 = require("./runtime-value-store.js");
43
44
  const sequence_node_path_js_1 = require("./sequence-node-path.js");
44
45
  const SequenceManager_js_1 = require("./SequenceManager.js");
45
46
  const use_current_frame_js_1 = require("./use-current-frame.js");
@@ -187,16 +188,25 @@ const withInteractivitySchema = ({ Component, componentName, componentIdentity,
187
188
  // eslint-disable-next-line react-hooks/exhaustive-deps
188
189
  runtimeValues);
189
190
  // eslint-disable-next-line react-hooks/rules-of-hooks
191
+ const [runtimeValueStore] = (0, react_1.useState)(() => (0, runtime_value_store_js_1.createRuntimeValueStore)(currentRuntimeValueDotNotation));
192
+ // Publishing in a layout effect ensures that abandoned renders cannot expose
193
+ // uncommitted runtime values to Studio consumers.
194
+ // eslint-disable-next-line react-hooks/rules-of-hooks
195
+ (0, react_1.useLayoutEffect)(() => {
196
+ runtimeValueStore.setSnapshot(currentRuntimeValueDotNotation);
197
+ }, [currentRuntimeValueDotNotation, runtimeValueStore]);
198
+ // eslint-disable-next-line react-hooks/rules-of-hooks
190
199
  const controls = (0, react_1.useMemo)(() => {
191
200
  return {
192
201
  schema: schemaWithSequenceName,
193
202
  currentRuntimeValueDotNotation,
203
+ runtimeValues: runtimeValueStore.store,
194
204
  overrideId,
195
205
  supportsEffects,
196
206
  componentIdentity,
197
207
  componentName,
198
208
  };
199
- }, [currentRuntimeValueDotNotation, overrideId]);
209
+ }, [currentRuntimeValueDotNotation, overrideId, runtimeValueStore.store]);
200
210
  (0, enable_sequence_stack_traces_js_1.setStackForControls)(controls, internalStack);
201
211
  // 3. Apply drag/code overrides on top of the runtime values.
202
212
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export declare function useRemotionContexts(): {
3
3
  compositionManagerCtx: import("./CompositionManagerContext.js").CompositionManagerContext;
4
4
  timelineContext: import("./TimelineContext.js").TimelineContextValue | null;
5
+ timelineImperativeContext: import("./TimelineContext.js").TimelineImperativeContextValue | null;
5
6
  setTimelineContext: import("./TimelineContext.js").SetTimelineContextValue;
6
7
  sequenceContext: import("./SequenceContext.js").SequenceContextType | null;
7
8
  nonceContext: import("./nonce.js").TNonceContext;
@@ -54,6 +54,7 @@ const TimelineContext_js_1 = require("./TimelineContext.js");
54
54
  function useRemotionContexts() {
55
55
  const compositionManagerCtx = react_1.default.useContext(CompositionManagerContext_js_1.CompositionManager);
56
56
  const timelineContext = react_1.default.useContext(TimelineContext_js_1.TimelineContext);
57
+ const timelineImperativeContext = react_1.default.useContext(TimelineContext_js_1.TimelineImperativeContext);
57
58
  const setTimelineContext = react_1.default.useContext(TimelineContext_js_1.SetTimelineContext);
58
59
  const sequenceContext = react_1.default.useContext(SequenceContext_js_1.SequenceContext);
59
60
  const nonceContext = react_1.default.useContext(nonce_js_1.NonceContext);
@@ -69,6 +70,7 @@ function useRemotionContexts() {
69
70
  return (0, react_1.useMemo)(() => ({
70
71
  compositionManagerCtx,
71
72
  timelineContext,
73
+ timelineImperativeContext,
72
74
  setTimelineContext,
73
75
  sequenceContext,
74
76
  nonceContext,
@@ -87,6 +89,7 @@ function useRemotionContexts() {
87
89
  sequenceContext,
88
90
  setTimelineContext,
89
91
  timelineContext,
92
+ timelineImperativeContext,
90
93
  canUseRemotionHooksContext,
91
94
  preloadContext,
92
95
  resolveCompositionContext,
@@ -100,6 +103,6 @@ function useRemotionContexts() {
100
103
  }
101
104
  const RemotionContextProvider = (props) => {
102
105
  const { children, contexts } = props;
103
- return (jsx_runtime_1.jsx(log_level_context_js_1.LogLevelContext.Provider, { value: contexts.logLevelContext, children: jsx_runtime_1.jsx(CanUseRemotionHooks_js_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: jsx_runtime_1.jsx(nonce_js_1.NonceContext.Provider, { value: contexts.nonceContext, children: jsx_runtime_1.jsx(prefetch_state_js_1.PreloadContext.Provider, { value: contexts.preloadContext, children: jsx_runtime_1.jsx(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: jsx_runtime_1.jsx(SequenceManager_js_1.SequenceManagerRefContext.Provider, { value: contexts.sequenceManagerRefContext, children: jsx_runtime_1.jsx(SequenceManager_js_1.SequenceManager.Provider, { value: contexts.sequenceManagerContext, children: jsx_runtime_1.jsx(SequenceManager_js_1.VisualModePropStatusesRefContext.Provider, { value: contexts.visualModePropStatusesRefContext, children: jsx_runtime_1.jsx(RenderAssetManager_js_1.RenderAssetManager.Provider, { value: contexts.renderAssetManagerContext, children: jsx_runtime_1.jsx(ResolveCompositionConfig_js_1.ResolveCompositionContext.Provider, { value: contexts.resolveCompositionContext, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: contexts.timelineContext, children: jsx_runtime_1.jsx(TimelineContext_js_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: jsx_runtime_1.jsx(SequenceContext_js_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: jsx_runtime_1.jsx(buffering_js_1.BufferingContextReact.Provider, { value: contexts.bufferManagerContext, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }));
106
+ return (jsx_runtime_1.jsx(log_level_context_js_1.LogLevelContext.Provider, { value: contexts.logLevelContext, children: jsx_runtime_1.jsx(CanUseRemotionHooks_js_1.CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: jsx_runtime_1.jsx(nonce_js_1.NonceContext.Provider, { value: contexts.nonceContext, children: jsx_runtime_1.jsx(prefetch_state_js_1.PreloadContext.Provider, { value: contexts.preloadContext, children: jsx_runtime_1.jsx(CompositionManagerContext_js_1.CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: jsx_runtime_1.jsx(SequenceManager_js_1.SequenceManagerRefContext.Provider, { value: contexts.sequenceManagerRefContext, children: jsx_runtime_1.jsx(SequenceManager_js_1.SequenceManager.Provider, { value: contexts.sequenceManagerContext, children: jsx_runtime_1.jsx(SequenceManager_js_1.VisualModePropStatusesRefContext.Provider, { value: contexts.visualModePropStatusesRefContext, children: jsx_runtime_1.jsx(RenderAssetManager_js_1.RenderAssetManager.Provider, { value: contexts.renderAssetManagerContext, children: jsx_runtime_1.jsx(ResolveCompositionConfig_js_1.ResolveCompositionContext.Provider, { value: contexts.resolveCompositionContext, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineImperativeContext.Provider, { value: contexts.timelineImperativeContext, children: jsx_runtime_1.jsx(TimelineContext_js_1.TimelineContext.Provider, { value: contexts.timelineContext, children: jsx_runtime_1.jsx(TimelineContext_js_1.SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: jsx_runtime_1.jsx(SequenceContext_js_1.SequenceContext.Provider, { value: contexts.sequenceContext, children: jsx_runtime_1.jsx(buffering_js_1.BufferingContextReact.Provider, { value: contexts.bufferManagerContext, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
104
107
  };
105
108
  exports.RemotionContextProvider = RemotionContextProvider;
@@ -1322,7 +1322,7 @@ var getSingleChildComponent = (children) => {
1322
1322
  };
1323
1323
 
1324
1324
  // src/version.ts
1325
- var VERSION = "4.0.504";
1325
+ var VERSION = "4.0.506";
1326
1326
 
1327
1327
  // src/multiple-versions-warning.ts
1328
1328
  var checkMultipleRemotionVersions = () => {
@@ -1410,6 +1410,7 @@ var SetTimelineContext = createContext13({
1410
1410
  }
1411
1411
  });
1412
1412
  var TimelineContext = createContext13(null);
1413
+ var TimelineImperativeContext = createContext13(null);
1413
1414
  var PlaybackRateContext = createContext13(null);
1414
1415
  var AbsoluteTimeContext = createContext13(null);
1415
1416
  var TimelineContextProvider = ({ children, frameState }) => {
@@ -1419,6 +1420,8 @@ var TimelineContextProvider = ({ children, frameState }) => {
1419
1420
  const audioAndVideoTags = useRef3([]);
1420
1421
  const [_frame, setFrame] = useState2(() => getInitialFrameState());
1421
1422
  const frame = frameState ?? _frame;
1423
+ const frameRef = useRef3(frame);
1424
+ frameRef.current = frame;
1422
1425
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
1423
1426
  if (typeof window !== "undefined") {
1424
1427
  useLayoutEffect(() => {
@@ -1454,6 +1457,13 @@ var TimelineContextProvider = ({ children, frameState }) => {
1454
1457
  audioAndVideoTags
1455
1458
  };
1456
1459
  }, [frame, playing]);
1460
+ const timelineImperativeContextValue = useMemo8(() => {
1461
+ return {
1462
+ frameRef,
1463
+ imperativePlaying,
1464
+ audioAndVideoTags
1465
+ };
1466
+ }, []);
1457
1467
  const playbackRateContextValue = useMemo8(() => {
1458
1468
  return {
1459
1469
  playbackRate,
@@ -1470,11 +1480,14 @@ var TimelineContextProvider = ({ children, frameState }) => {
1470
1480
  value: timelineContextValue,
1471
1481
  children: /* @__PURE__ */ jsx8(PlaybackRateContext.Provider, {
1472
1482
  value: playbackRateContextValue,
1473
- children: /* @__PURE__ */ jsx8(TimelineContext.Provider, {
1474
- value: timelineContextValue,
1475
- children: /* @__PURE__ */ jsx8(SetTimelineContext.Provider, {
1476
- value: setTimelineContextValue,
1477
- children
1483
+ children: /* @__PURE__ */ jsx8(TimelineImperativeContext.Provider, {
1484
+ value: timelineImperativeContextValue,
1485
+ children: /* @__PURE__ */ jsx8(TimelineContext.Provider, {
1486
+ value: timelineContextValue,
1487
+ children: /* @__PURE__ */ jsx8(SetTimelineContext.Provider, {
1488
+ value: setTimelineContextValue,
1489
+ children
1490
+ })
1478
1491
  })
1479
1492
  })
1480
1493
  })
@@ -2432,7 +2445,13 @@ var usePremounting = ({
2432
2445
  };
2433
2446
 
2434
2447
  // src/with-interactivity-schema.ts
2435
- import React14, { forwardRef as forwardRef2, useContext as useContext17, useMemo as useMemo14, useState as useState4 } from "react";
2448
+ import React14, {
2449
+ forwardRef as forwardRef2,
2450
+ useContext as useContext17,
2451
+ useLayoutEffect as useLayoutEffect2,
2452
+ useMemo as useMemo14,
2453
+ useState as useState4
2454
+ } from "react";
2436
2455
 
2437
2456
  // src/delete-nested-key.ts
2438
2457
  var deleteNestedKey = (obj, keysToRemove) => {
@@ -4377,6 +4396,33 @@ var getFlatSchemaWithAllKeys = (schema) => {
4377
4396
  return out;
4378
4397
  };
4379
4398
 
4399
+ // src/runtime-value-store.ts
4400
+ var createRuntimeValueStore = (initialSnapshot) => {
4401
+ let snapshot = initialSnapshot;
4402
+ const listeners = new Set;
4403
+ const store = {
4404
+ getSnapshot: () => snapshot,
4405
+ subscribe: (listener) => {
4406
+ listeners.add(listener);
4407
+ return () => {
4408
+ listeners.delete(listener);
4409
+ };
4410
+ }
4411
+ };
4412
+ return {
4413
+ store,
4414
+ setSnapshot: (newSnapshot) => {
4415
+ if (snapshot === newSnapshot) {
4416
+ return;
4417
+ }
4418
+ snapshot = newSnapshot;
4419
+ for (const listener of listeners) {
4420
+ listener();
4421
+ }
4422
+ }
4423
+ };
4424
+ };
4425
+
4380
4426
  // src/find-props-to-delete.ts
4381
4427
  var findPropsToDelete = ({
4382
4428
  schema,
@@ -4683,16 +4729,21 @@ var withInteractivitySchema = ({
4683
4729
  props: cleanProps
4684
4730
  }));
4685
4731
  const currentRuntimeValueDotNotation = useMemo14(() => readValuesFromProps(cleanProps, flatKeys, flatSchema), runtimeValues);
4732
+ const [runtimeValueStore] = useState4(() => createRuntimeValueStore(currentRuntimeValueDotNotation));
4733
+ useLayoutEffect2(() => {
4734
+ runtimeValueStore.setSnapshot(currentRuntimeValueDotNotation);
4735
+ }, [currentRuntimeValueDotNotation, runtimeValueStore]);
4686
4736
  const controls = useMemo14(() => {
4687
4737
  return {
4688
4738
  schema: schemaWithSequenceName,
4689
4739
  currentRuntimeValueDotNotation,
4740
+ runtimeValues: runtimeValueStore.store,
4690
4741
  overrideId,
4691
4742
  supportsEffects,
4692
4743
  componentIdentity,
4693
4744
  componentName
4694
4745
  };
4695
- }, [currentRuntimeValueDotNotation, overrideId]);
4746
+ }, [currentRuntimeValueDotNotation, overrideId, runtimeValueStore.store]);
4696
4747
  setStackForControls(controls, internalStack);
4697
4748
  const { merged: valuesDotNotation, propsToDelete } = useMemo14(() => {
4698
4749
  return computeEffectiveSchemaValuesDotNotation({
@@ -4880,6 +4931,32 @@ var RegularSequenceRefForwardingFunction = ({
4880
4931
  const startMediaFrom = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom - cumulatedNegativeFrom : null;
4881
4932
  const mediaFrameAtSequenceZero = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom : null;
4882
4933
  const frozenMediaFrame = isMedia && isMedia.type !== "image" && mediaFrameAtSequenceZero !== null ? registeredFrozenFrame === null ? null : mediaFrameAtSequenceZero + (loopDisplay ? registeredFrozenFrame % loopDisplay.durationInFrames : registeredFrozenFrame) * isMedia.data.playbackRate : null;
4934
+ const controlsSchema = controls?.schema;
4935
+ const controlsRuntimeValues = controls?.runtimeValues;
4936
+ const controlsOverrideId = controls?.overrideId;
4937
+ const controlsSupportsEffects = controls?.supportsEffects;
4938
+ const controlsComponentIdentity = controls?.componentIdentity;
4939
+ const controlsComponentName = controls?.componentName;
4940
+ const registrationControls = useMemo15(() => {
4941
+ if (controlsSchema === undefined || controlsRuntimeValues === undefined || controlsOverrideId === undefined || controlsSupportsEffects === undefined || controlsComponentIdentity === undefined || controlsComponentName === undefined) {
4942
+ return null;
4943
+ }
4944
+ return {
4945
+ schema: controlsSchema,
4946
+ runtimeValues: controlsRuntimeValues,
4947
+ overrideId: controlsOverrideId,
4948
+ supportsEffects: controlsSupportsEffects,
4949
+ componentIdentity: controlsComponentIdentity,
4950
+ componentName: controlsComponentName
4951
+ };
4952
+ }, [
4953
+ controlsComponentIdentity,
4954
+ controlsComponentName,
4955
+ controlsOverrideId,
4956
+ controlsRuntimeValues,
4957
+ controlsSchema,
4958
+ controlsSupportsEffects
4959
+ ]);
4883
4960
  useEffect3(() => {
4884
4961
  if (!env.isStudio) {
4885
4962
  return;
@@ -4888,7 +4965,7 @@ var RegularSequenceRefForwardingFunction = ({
4888
4965
  if (isMedia.type === "image") {
4889
4966
  registerSequence({
4890
4967
  type: "image",
4891
- controls: controls ?? null,
4968
+ controls: registrationControls,
4892
4969
  effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
4893
4970
  displayName: timelineClipName,
4894
4971
  documentationLink: resolvedDocumentationLink,
@@ -4912,7 +4989,7 @@ var RegularSequenceRefForwardingFunction = ({
4912
4989
  } else {
4913
4990
  registerSequence({
4914
4991
  type: isMedia.type,
4915
- controls: controls ?? null,
4992
+ controls: registrationControls,
4916
4993
  effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
4917
4994
  displayName: timelineClipName,
4918
4995
  documentationLink: resolvedDocumentationLink,
@@ -4959,7 +5036,7 @@ var RegularSequenceRefForwardingFunction = ({
4959
5036
  getStack: () => stackRef.current,
4960
5037
  premountDisplay: premountDisplay ?? null,
4961
5038
  postmountDisplay: postmountDisplay ?? null,
4962
- controls: controls ?? null,
5039
+ controls: registrationControls,
4963
5040
  effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
4964
5041
  refForOutline: refForOutline ?? null,
4965
5042
  isInsideSeries,
@@ -4987,7 +5064,7 @@ var RegularSequenceRefForwardingFunction = ({
4987
5064
  premountDisplay,
4988
5065
  postmountDisplay,
4989
5066
  env.isStudio,
4990
- controls,
5067
+ registrationControls,
4991
5068
  _remotionInternalEffects,
4992
5069
  isMedia,
4993
5070
  resolvedDocumentationLink,
@@ -5210,7 +5287,7 @@ import {
5210
5287
  forwardRef as forwardRef4,
5211
5288
  useEffect as useEffect5,
5212
5289
  useImperativeHandle as useImperativeHandle2,
5213
- useLayoutEffect as useLayoutEffect2,
5290
+ useLayoutEffect as useLayoutEffect3,
5214
5291
  useRef as useRef10,
5215
5292
  useState as useState6
5216
5293
  } from "react";
@@ -5962,7 +6039,7 @@ var AnimatedImageContent = forwardRef4(({
5962
6039
  imageDecoder?.close();
5963
6040
  };
5964
6041
  }, [imageDecoder]);
5965
- useLayoutEffect2(() => {
6042
+ useLayoutEffect3(() => {
5966
6043
  if (!imageDecoder) {
5967
6044
  return;
5968
6045
  }
@@ -6159,14 +6236,14 @@ var createEffect = (definition) => {
6159
6236
  return factory;
6160
6237
  };
6161
6238
  // src/Artifact.tsx
6162
- import { useContext as useContext19, useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
6239
+ import { useContext as useContext19, useLayoutEffect as useLayoutEffect5, useState as useState8 } from "react";
6163
6240
 
6164
6241
  // src/RenderAssetManager.tsx
6165
6242
  import {
6166
6243
  createContext as createContext17,
6167
6244
  useCallback as useCallback9,
6168
6245
  useImperativeHandle as useImperativeHandle3,
6169
- useLayoutEffect as useLayoutEffect3,
6246
+ useLayoutEffect as useLayoutEffect4,
6170
6247
  useMemo as useMemo19,
6171
6248
  useRef as useRef11,
6172
6249
  useState as useState7
@@ -6238,7 +6315,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
6238
6315
  renderAssetsRef.current = renderAssetsRef.current.filter((a2) => a2.id !== id);
6239
6316
  setRenderAssets(renderAssetsRef.current);
6240
6317
  }, []);
6241
- useLayoutEffect3(() => {
6318
+ useLayoutEffect4(() => {
6242
6319
  if (typeof window !== "undefined") {
6243
6320
  window.remotion_collectAssets = () => {
6244
6321
  const assets = renderAssetsRef.current;
@@ -6270,7 +6347,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
6270
6347
  const [id] = useState8(() => {
6271
6348
  return String(Math.random());
6272
6349
  });
6273
- useLayoutEffect4(() => {
6350
+ useLayoutEffect5(() => {
6274
6351
  if (!env.isRendering) {
6275
6352
  return;
6276
6353
  }
@@ -6864,7 +6941,7 @@ var random = (seed, dummy) => {
6864
6941
  };
6865
6942
 
6866
6943
  // src/use-amplification.ts
6867
- import { useContext as useContext22, useLayoutEffect as useLayoutEffect5, useRef as useRef15 } from "react";
6944
+ import { useContext as useContext22, useLayoutEffect as useLayoutEffect6, useRef as useRef15 } from "react";
6868
6945
 
6869
6946
  // src/audio/shared-audio-tags.tsx
6870
6947
  import React21, {
@@ -7667,7 +7744,7 @@ var useVolume = ({
7667
7744
  }
7668
7745
  const { audioContext, gainNode: masterGainNode } = sharedAudioContext;
7669
7746
  if (typeof window !== "undefined") {
7670
- useLayoutEffect5(() => {
7747
+ useLayoutEffect6(() => {
7671
7748
  if (!audioContext) {
7672
7749
  return;
7673
7750
  }
@@ -7988,7 +8065,7 @@ import {
7988
8065
  useCallback as useCallback13,
7989
8066
  useContext as useContext27,
7990
8067
  useEffect as useEffect12,
7991
- useLayoutEffect as useLayoutEffect7,
8068
+ useLayoutEffect as useLayoutEffect8,
7992
8069
  useRef as useRef19
7993
8070
  } from "react";
7994
8071
 
@@ -8003,7 +8080,7 @@ import React22, {
8003
8080
  useCallback as useCallback11,
8004
8081
  useContext as useContext25,
8005
8082
  useEffect as useEffect9,
8006
- useLayoutEffect as useLayoutEffect6,
8083
+ useLayoutEffect as useLayoutEffect7,
8007
8084
  useMemo as useMemo25,
8008
8085
  useRef as useRef16,
8009
8086
  useState as useState12
@@ -8074,7 +8151,7 @@ var useBufferManager = (logLevel, mountTime) => {
8074
8151
  }
8075
8152
  }, [blocks]);
8076
8153
  if (typeof window !== "undefined") {
8077
- useLayoutEffect6(() => {
8154
+ useLayoutEffect7(() => {
8078
8155
  if (rendering) {
8079
8156
  return;
8080
8157
  }
@@ -8731,7 +8808,7 @@ var useMediaPlayback = ({
8731
8808
  isPostmounting
8732
8809
  ]);
8733
8810
  const env = useRemotionEnvironment();
8734
- useLayoutEffect7(() => {
8811
+ useLayoutEffect8(() => {
8735
8812
  const playbackRateToSet = Math.max(0, playbackRate);
8736
8813
  if (mediaRef.current && mediaRef.current.playbackRate !== playbackRateToSet) {
8737
8814
  mediaRef.current.playbackRate = playbackRateToSet;
@@ -9141,7 +9218,7 @@ import {
9141
9218
  useContext as useContext30,
9142
9219
  useEffect as useEffect15,
9143
9220
  useImperativeHandle as useImperativeHandle5,
9144
- useLayoutEffect as useLayoutEffect8,
9221
+ useLayoutEffect as useLayoutEffect9,
9145
9222
  useMemo as useMemo30,
9146
9223
  useRef as useRef21
9147
9224
  } from "react";
@@ -9232,7 +9309,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
9232
9309
  ]);
9233
9310
  const { src } = props;
9234
9311
  const needsToRenderAudioTag = ref || _remotionInternalNeedsDurationCalculation;
9235
- useLayoutEffect8(() => {
9312
+ useLayoutEffect9(() => {
9236
9313
  if (window.process?.env?.NODE_ENV === "test") {
9237
9314
  return;
9238
9315
  }
@@ -9645,7 +9722,7 @@ import {
9645
9722
  forwardRef as forwardRef9,
9646
9723
  useCallback as useCallback17,
9647
9724
  useContext as useContext32,
9648
- useLayoutEffect as useLayoutEffect9,
9725
+ useLayoutEffect as useLayoutEffect10,
9649
9726
  useMemo as useMemo32,
9650
9727
  useRef as useRef23
9651
9728
  } from "react";
@@ -9904,7 +9981,7 @@ var HtmlInCanvasContent = forwardRef9(({
9904
9981
  resolvedPixelDensity,
9905
9982
  canRetryMissingPaintRecord
9906
9983
  ]);
9907
- useLayoutEffect9(() => {
9984
+ useLayoutEffect10(() => {
9908
9985
  const placeholder = canvas2dRef.current;
9909
9986
  if (!placeholder) {
9910
9987
  throw new Error("Canvas not found");
@@ -9936,7 +10013,7 @@ var HtmlInCanvasContent = forwardRef9(({
9936
10013
  usesDirectLayoutCanvas
9937
10014
  ]);
9938
10015
  const onPaintChangedRef = useRef23(false);
9939
- useLayoutEffect9(() => {
10016
+ useLayoutEffect10(() => {
9940
10017
  if (!onPaintChangedRef.current) {
9941
10018
  onPaintChangedRef.current = true;
9942
10019
  return;
@@ -9947,7 +10024,7 @@ var HtmlInCanvasContent = forwardRef9(({
9947
10024
  }
9948
10025
  canvas.requestPaint?.();
9949
10026
  }, [onPaint, memoizedEffects]);
9950
- useLayoutEffect9(() => {
10027
+ useLayoutEffect10(() => {
9951
10028
  const canvas = canvas2dRef.current;
9952
10029
  if (!canvas) {
9953
10030
  return;
@@ -10091,7 +10168,7 @@ import {
10091
10168
  useCallback as useCallback18,
10092
10169
  useContext as useContext33,
10093
10170
  useImperativeHandle as useImperativeHandle7,
10094
- useLayoutEffect as useLayoutEffect10,
10171
+ useLayoutEffect as useLayoutEffect11,
10095
10172
  useMemo as useMemo33,
10096
10173
  useRef as useRef24,
10097
10174
  useState as useState16
@@ -10261,7 +10338,7 @@ var CanvasImageContent = forwardRef10(({
10261
10338
  ref.current = canvas;
10262
10339
  }
10263
10340
  }, [ref, refForOutline]);
10264
- useLayoutEffect10(() => {
10341
+ useLayoutEffect11(() => {
10265
10342
  if (!pauseWhenLoading || !isLoadPending || isPremounting || isPostmounting) {
10266
10343
  return;
10267
10344
  }
@@ -10273,7 +10350,7 @@ var CanvasImageContent = forwardRef10(({
10273
10350
  isPremounting,
10274
10351
  pauseWhenLoading
10275
10352
  ]);
10276
- useLayoutEffect10(() => {
10353
+ useLayoutEffect11(() => {
10277
10354
  const handle = delayRender2(`Rendering <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`, {
10278
10355
  retries: delayRenderRetries ?? undefined,
10279
10356
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
@@ -10335,7 +10412,7 @@ var CanvasImageContent = forwardRef10(({
10335
10412
  maxRetries,
10336
10413
  onError
10337
10414
  ]);
10338
- useLayoutEffect10(() => {
10415
+ useLayoutEffect11(() => {
10339
10416
  if (!loadedImage || !outputCanvas || !sourceCanvas) {
10340
10417
  return;
10341
10418
  }
@@ -10625,7 +10702,7 @@ var IFrame = forwardRef11(IFrameRefForwarding);
10625
10702
  import {
10626
10703
  useCallback as useCallback20,
10627
10704
  useContext as useContext34,
10628
- useLayoutEffect as useLayoutEffect11,
10705
+ useLayoutEffect as useLayoutEffect12,
10629
10706
  useRef as useRef25,
10630
10707
  useState as useState18
10631
10708
  } from "react";
@@ -10706,7 +10783,7 @@ var ImgContent = ({
10706
10783
  } catch {}
10707
10784
  }, [cancelRender2, maxRetries, onError, retryIn]);
10708
10785
  if (typeof window !== "undefined") {
10709
- useLayoutEffect11(() => {
10786
+ useLayoutEffect12(() => {
10710
10787
  if (!pauseWhenLoading || !isLoading || isPremounting || isPostmounting) {
10711
10788
  return;
10712
10789
  }
@@ -10718,7 +10795,7 @@ var ImgContent = ({
10718
10795
  isPremounting,
10719
10796
  pauseWhenLoading
10720
10797
  ]);
10721
- useLayoutEffect11(() => {
10798
+ useLayoutEffect12(() => {
10722
10799
  if (window.process?.env?.NODE_ENV === "test") {
10723
10800
  if (imageRef.current) {
10724
10801
  imageRef.current.src = actualSrc;
@@ -11072,7 +11149,8 @@ var makeRemotionComponentIdentity = ({
11072
11149
  };
11073
11150
  var interactiveElementSchema = {
11074
11151
  ...baseSchema,
11075
- ...transformSchema
11152
+ ...transformSchema,
11153
+ ...cropSchema
11076
11154
  };
11077
11155
  var interactiveBackgroundElementSchema = {
11078
11156
  ...interactiveElementSchema,
@@ -11129,8 +11207,21 @@ var makeInteractiveElement = (tag, displayName, schema) => {
11129
11207
  name,
11130
11208
  showInTimeline,
11131
11209
  controls,
11210
+ cropLeft,
11211
+ cropRight,
11212
+ cropTop,
11213
+ cropBottom,
11214
+ style,
11132
11215
  ...props2
11133
11216
  } = propsWithControls;
11217
+ const croppedStyle = useCropStyle({
11218
+ cropLeft,
11219
+ cropRight,
11220
+ cropTop,
11221
+ cropBottom,
11222
+ style: style ?? null,
11223
+ componentName: displayName
11224
+ });
11134
11225
  const refForOutline = useRef26(null);
11135
11226
  const callbackRef = useCallback21((element) => {
11136
11227
  refForOutline.current = element;
@@ -11150,6 +11241,7 @@ var makeInteractiveElement = (tag, displayName, schema) => {
11150
11241
  outlineRef: refForOutline,
11151
11242
  children: React31.createElement(tag, {
11152
11243
  ...props2,
11244
+ style: croppedStyle ?? undefined,
11153
11245
  ref: callbackRef
11154
11246
  })
11155
11247
  });
@@ -11868,7 +11960,7 @@ import {
11868
11960
  useCallback as useCallback23,
11869
11961
  useContext as useContext37,
11870
11962
  useEffect as useEffect17,
11871
- useLayoutEffect as useLayoutEffect12,
11963
+ useLayoutEffect as useLayoutEffect13,
11872
11964
  useMemo as useMemo37,
11873
11965
  useState as useState20
11874
11966
  } from "react";
@@ -11987,7 +12079,7 @@ var OffthreadVideoForRendering = ({
11987
12079
  }, [toneMapped, currentTime, src, transparent]);
11988
12080
  const [imageSrc, setImageSrc] = useState20(null);
11989
12081
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
11990
- useLayoutEffect12(() => {
12082
+ useLayoutEffect13(() => {
11991
12083
  if (!window.remotion_videoEnabled) {
11992
12084
  return;
11993
12085
  }
@@ -12584,6 +12676,7 @@ import { jsx as jsx37 } from "react/jsx-runtime";
12584
12676
  function useRemotionContexts() {
12585
12677
  const compositionManagerCtx = React41.useContext(CompositionManager);
12586
12678
  const timelineContext = React41.useContext(TimelineContext);
12679
+ const timelineImperativeContext = React41.useContext(TimelineImperativeContext);
12587
12680
  const setTimelineContext = React41.useContext(SetTimelineContext);
12588
12681
  const sequenceContext = React41.useContext(SequenceContext);
12589
12682
  const nonceContext = React41.useContext(NonceContext);
@@ -12599,6 +12692,7 @@ function useRemotionContexts() {
12599
12692
  return useMemo39(() => ({
12600
12693
  compositionManagerCtx,
12601
12694
  timelineContext,
12695
+ timelineImperativeContext,
12602
12696
  setTimelineContext,
12603
12697
  sequenceContext,
12604
12698
  nonceContext,
@@ -12617,6 +12711,7 @@ function useRemotionContexts() {
12617
12711
  sequenceContext,
12618
12712
  setTimelineContext,
12619
12713
  timelineContext,
12714
+ timelineImperativeContext,
12620
12715
  canUseRemotionHooksContext,
12621
12716
  preloadContext,
12622
12717
  resolveCompositionContext,
@@ -12650,15 +12745,18 @@ var RemotionContextProvider = (props2) => {
12650
12745
  value: contexts.renderAssetManagerContext,
12651
12746
  children: /* @__PURE__ */ jsx37(ResolveCompositionContext.Provider, {
12652
12747
  value: contexts.resolveCompositionContext,
12653
- children: /* @__PURE__ */ jsx37(TimelineContext.Provider, {
12654
- value: contexts.timelineContext,
12655
- children: /* @__PURE__ */ jsx37(SetTimelineContext.Provider, {
12656
- value: contexts.setTimelineContext,
12657
- children: /* @__PURE__ */ jsx37(SequenceContext.Provider, {
12658
- value: contexts.sequenceContext,
12659
- children: /* @__PURE__ */ jsx37(BufferingContextReact.Provider, {
12660
- value: contexts.bufferManagerContext,
12661
- children
12748
+ children: /* @__PURE__ */ jsx37(TimelineImperativeContext.Provider, {
12749
+ value: contexts.timelineImperativeContext,
12750
+ children: /* @__PURE__ */ jsx37(TimelineContext.Provider, {
12751
+ value: contexts.timelineContext,
12752
+ children: /* @__PURE__ */ jsx37(SetTimelineContext.Provider, {
12753
+ value: contexts.setTimelineContext,
12754
+ children: /* @__PURE__ */ jsx37(SequenceContext.Provider, {
12755
+ value: contexts.sequenceContext,
12756
+ children: /* @__PURE__ */ jsx37(BufferingContextReact.Provider, {
12757
+ value: contexts.bufferManagerContext,
12758
+ children
12759
+ })
12662
12760
  })
12663
12761
  })
12664
12762
  })
@@ -12804,6 +12902,7 @@ var Internals = {
12804
12902
  TimelinePosition: exports_timeline_position_state,
12805
12903
  DelayRenderContextType,
12806
12904
  TimelineContext,
12905
+ TimelineImperativeContext,
12807
12906
  PlaybackRateContext,
12808
12907
  AbsoluteTimeContext,
12809
12908
  RenderAssetManagerProvider,
@@ -13111,7 +13210,7 @@ import {
13111
13210
  useContext as useContext39,
13112
13211
  useEffect as useEffect20,
13113
13212
  useImperativeHandle as useImperativeHandle10,
13114
- useLayoutEffect as useLayoutEffect13,
13213
+ useLayoutEffect as useLayoutEffect14,
13115
13214
  useMemo as useMemo41,
13116
13215
  useRef as useRef29
13117
13216
  } from "react";
@@ -13420,7 +13519,7 @@ var VideoForRenderingForwardFunction = ({
13420
13519
  ]);
13421
13520
  const { src } = props2;
13422
13521
  if (environment.isRendering) {
13423
- useLayoutEffect13(() => {
13522
+ useLayoutEffect14(() => {
13424
13523
  if (window.process?.env?.NODE_ENV === "test") {
13425
13524
  return;
13426
13525
  }
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.504";
2
+ var VERSION = "4.0.506";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.504",
6
+ "version": "4.0.506",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.4.3",
38
- "@remotion/eslint-config-internal": "4.0.504",
38
+ "@remotion/eslint-config-internal": "4.0.506",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },