remotion 4.0.477 → 4.0.479

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/CompositionManager.d.ts +5 -2
  2. package/dist/cjs/HtmlInCanvas.d.ts +4 -3
  3. package/dist/cjs/HtmlInCanvas.js +7 -10
  4. package/dist/cjs/Img.d.ts +6 -4
  5. package/dist/cjs/Img.js +10 -13
  6. package/dist/cjs/Interactive.d.ts +187 -2
  7. package/dist/cjs/Interactive.js +12 -10
  8. package/dist/cjs/Sequence.d.ts +4 -3
  9. package/dist/cjs/Sequence.js +35 -9
  10. package/dist/cjs/animated-image/AnimatedImage.d.ts +2 -3
  11. package/dist/cjs/animated-image/AnimatedImage.js +7 -10
  12. package/dist/cjs/animated-image/props.d.ts +2 -3
  13. package/dist/cjs/canvas-image/CanvasImage.d.ts +5 -3
  14. package/dist/cjs/canvas-image/CanvasImage.js +86 -42
  15. package/dist/cjs/canvas-image/props.d.ts +5 -4
  16. package/dist/cjs/effects/Solid.d.ts +2 -2
  17. package/dist/cjs/effects/Solid.js +7 -10
  18. package/dist/cjs/effects/create-effect.d.ts +2 -2
  19. package/dist/cjs/effects/effect-types.d.ts +2 -2
  20. package/dist/cjs/effects/index.d.ts +2 -1
  21. package/dist/cjs/effects/index.js +3 -0
  22. package/dist/cjs/find-props-to-delete.d.ts +2 -2
  23. package/dist/cjs/flatten-schema.d.ts +3 -3
  24. package/dist/cjs/index.d.ts +4 -4
  25. package/dist/cjs/index.js +16 -14
  26. package/dist/cjs/interactivity-schema.d.ts +524 -0
  27. package/dist/cjs/interactivity-schema.js +143 -0
  28. package/dist/cjs/internals.d.ts +95 -21
  29. package/dist/cjs/internals.js +12 -11
  30. package/dist/cjs/interpolate-keyframed-status.js +14 -3
  31. package/dist/cjs/no-react.d.ts +11 -12
  32. package/dist/cjs/no-react.js +2 -2
  33. package/dist/cjs/series/index.js +4 -4
  34. package/dist/cjs/use-media-in-timeline.js +2 -0
  35. package/dist/cjs/use-schema.d.ts +21 -3
  36. package/dist/cjs/use-schema.js +5 -2
  37. package/dist/cjs/version.d.ts +1 -1
  38. package/dist/cjs/version.js +1 -1
  39. package/dist/cjs/with-interactivity-schema.d.ts +20 -0
  40. package/dist/cjs/with-interactivity-schema.js +203 -0
  41. package/dist/cjs/wrap-in-schema.d.ts +3 -3
  42. package/dist/cjs/wrap-in-schema.js +2 -2
  43. package/dist/esm/index.mjs +242 -171
  44. package/dist/esm/no-react.mjs +133 -131
  45. package/dist/esm/version.mjs +1 -1
  46. package/package.json +2 -2
  47. package/dist/cjs/interpolate-translate.d.ts +0 -8
  48. package/dist/cjs/interpolate-translate.js +0 -70
@@ -4,9 +4,9 @@ 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
6
  import type { EffectDefinition } from './effects/effect-types.js';
7
+ import type { InteractivitySchema } from './interactivity-schema.js';
7
8
  import type { NonceHistory } from './nonce.js';
8
9
  import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
9
- import type { SequenceSchema } from './sequence-field-schema.js';
10
10
  export type TComposition<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
11
11
  width: number | undefined;
12
12
  height: number | undefined;
@@ -34,6 +34,7 @@ type EnhancedTSequenceData = {
34
34
  doesVolumeChange: boolean;
35
35
  startMediaFrom: number;
36
36
  playbackRate: number;
37
+ frozenMediaFrame: number | null;
37
38
  } | {
38
39
  type: 'video';
39
40
  src: string;
@@ -41,6 +42,7 @@ type EnhancedTSequenceData = {
41
42
  doesVolumeChange: boolean;
42
43
  startMediaFrom: number;
43
44
  playbackRate: number;
45
+ frozenMediaFrame: number | null;
44
46
  } | {
45
47
  type: 'image';
46
48
  src: string;
@@ -52,7 +54,7 @@ export type LoopDisplay = {
52
54
  };
53
55
  export type JsxComponentIdentity = string;
54
56
  export type SequenceControls = {
55
- schema: SequenceSchema;
57
+ schema: InteractivitySchema;
56
58
  currentRuntimeValueDotNotation: Record<string, unknown>;
57
59
  overrideId: string;
58
60
  supportsEffects: boolean;
@@ -76,6 +78,7 @@ export type TSequence = {
76
78
  refForOutline: React.RefObject<Element | null> | null;
77
79
  effects: readonly EffectDefinition<unknown>[];
78
80
  isInsideSeries: boolean;
81
+ frozenFrame: number | null;
79
82
  } & EnhancedTSequenceData;
80
83
  export type AudioOrVideoAsset = {
81
84
  type: 'audio' | 'video';
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { EffectsProp } from './effects/effect-types.js';
3
- import type { AbsoluteFillLayout, LayoutAndStyle, SequenceProps } from './Sequence.js';
3
+ import type { InteractiveBaseProps } from './Interactive.js';
4
+ import type { AbsoluteFillLayout } from './Sequence.js';
4
5
  declare global {
5
6
  interface ElementImage {
6
7
  readonly width: number;
@@ -53,7 +54,7 @@ export type HtmlInCanvasOnPaint = (params: HtmlInCanvasOnPaintParams) => void |
53
54
  export type HtmlInCanvasOnInitCleanup = () => void;
54
55
  export type HtmlInCanvasOnInit = (params: HtmlInCanvasOnPaintParams) => HtmlInCanvasOnInitCleanup | Promise<HtmlInCanvasOnInitCleanup>;
55
56
  export type HtmlInCanvasPixelDensity = number;
56
- export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFrames' | keyof LayoutAndStyle | '_remotionInternalEffects' | '_remotionInternalRefForOutline'> & Omit<AbsoluteFillLayout, 'layout' | 'styleWhilePostmounted' | 'postmountFor' | 'premountFor' | 'styleWhilePremounted'> & {
57
+ export type HtmlInCanvasProps = Omit<InteractiveBaseProps, 'children'> & Omit<AbsoluteFillLayout, 'layout' | 'styleWhilePostmounted' | 'postmountFor' | 'premountFor' | 'styleWhilePremounted'> & {
57
58
  readonly durationInFrames?: number;
58
59
  readonly width: number;
59
60
  readonly height: number;
@@ -63,7 +64,7 @@ export type HtmlInCanvasProps = Omit<SequenceProps, 'children' | 'durationInFram
63
64
  readonly onInit?: HtmlInCanvasOnInit;
64
65
  readonly pixelDensity?: HtmlInCanvasPixelDensity;
65
66
  };
66
- export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<SequenceProps, "_remotionInternalEffects" | "_remotionInternalRefForOutline" | "children" | "durationInFrames" | "layout"> & Omit<AbsoluteFillLayout, "layout" | "postmountFor" | "premountFor" | "styleWhilePostmounted" | "styleWhilePremounted"> & {
67
+ export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<InteractiveBaseProps, "children"> & Omit<AbsoluteFillLayout, "layout" | "postmountFor" | "premountFor" | "styleWhilePostmounted" | "styleWhilePremounted"> & {
67
68
  readonly durationInFrames?: number | undefined;
68
69
  readonly width: number;
69
70
  readonly height: number;
@@ -8,11 +8,11 @@ const run_effect_chain_js_1 = require("./effects/run-effect-chain.js");
8
8
  const use_effect_chain_state_js_1 = require("./effects/use-effect-chain-state.js");
9
9
  const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
10
10
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
11
- const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
11
+ const interactivity_schema_js_1 = require("./interactivity-schema.js");
12
12
  const Sequence_js_1 = require("./Sequence.js");
13
13
  const use_delay_render_js_1 = require("./use-delay-render.js");
14
14
  const use_video_config_js_1 = require("./use-video-config.js");
15
- const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
15
+ const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
16
16
  // Memoize the support check across the session — neither the platform
17
17
  // capability nor the chrome://flags toggle can change between calls.
18
18
  // SSR results are not cached so the check runs again once `document` exists.
@@ -275,7 +275,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
275
275
  return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: true, children: jsx_runtime_1.jsx("canvas", { ref: setLayoutCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle, children: jsx_runtime_1.jsx("div", { ref: divRef, style: innerStyle, children: children }) }, canvasSizeKey) }));
276
276
  });
277
277
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
278
- const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, _experimentalControls: controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
278
+ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
279
279
  const { durationInFrames: videoDuration } = (0, use_video_config_js_1.useVideoConfig)();
280
280
  const resolvedDuration = durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : videoDuration;
281
281
  const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
@@ -290,17 +290,14 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
290
290
  node;
291
291
  }
292
292
  }, [ref]);
293
- return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalRefForOutline: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, controls: controls, style: style, children: children }) }));
293
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: resolvedDuration, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, outlineRef: actualRef, layout: "none", ...sequenceProps, children: jsx_runtime_1.jsx(HtmlInCanvasContent, { ref: setCanvasRef, width: width, height: height, effects: effects, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, controls: controls, style: style, children: children }) }));
294
294
  });
295
295
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
296
296
  const htmlInCanvasSchema = {
297
- durationInFrames: sequence_field_schema_js_1.durationInFramesField,
298
- from: sequence_field_schema_js_1.fromField,
299
- freeze: sequence_field_schema_js_1.freezeField,
300
- ...sequence_field_schema_js_1.sequenceVisualStyleSchema,
301
- hidden: sequence_field_schema_js_1.hiddenField,
297
+ ...interactivity_schema_js_1.baseSchema,
298
+ ...interactivity_schema_js_1.transformSchema,
302
299
  };
303
- const HtmlInCanvasWrapped = (0, wrap_in_schema_js_1.wrapInSchema)({
300
+ const HtmlInCanvasWrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
304
301
  Component: HtmlInCanvasInner,
305
302
  componentIdentity: 'dev.remotion.remotion.HtmlInCanvas',
306
303
  schema: htmlInCanvasSchema,
package/dist/cjs/Img.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { EffectsProp } from './effects/effect-types.js';
3
- import type { SequenceProps } from './Sequence.js';
3
+ import type { InteractiveBaseProps } from './Interactive.js';
4
4
  type NativeImgProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'>;
5
5
  export type ImgProps = NativeImgProps & {
6
6
  readonly maxRetries?: number;
@@ -16,7 +16,7 @@ export type ImgProps = NativeImgProps & {
16
16
  * @deprecated For internal use only
17
17
  */
18
18
  readonly stack?: string;
19
- } & Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden'>;
19
+ } & InteractiveBaseProps;
20
20
  export declare const imgSchema: {
21
21
  readonly 'style.transformOrigin': {
22
22
  readonly type: "transform-origin";
@@ -71,7 +71,9 @@ export declare const imgSchema: {
71
71
  readonly step: 1;
72
72
  readonly hiddenFromList: true;
73
73
  };
74
- readonly hidden: import("./sequence-field-schema.js").SequenceFieldSchema;
74
+ readonly hidden: import("./interactivity-schema.js").BooleanFieldSchema;
75
+ readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
76
+ readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
75
77
  };
76
78
  export declare const Img: React.ComponentType<NativeImgProps & {
77
79
  readonly maxRetries?: number | undefined;
@@ -87,5 +89,5 @@ export declare const Img: React.ComponentType<NativeImgProps & {
87
89
  * @deprecated For internal use only
88
90
  */
89
91
  readonly stack?: string | undefined;
90
- } & Pick<SequenceProps, "durationInFrames" | "freeze" | "from" | "hidden">>;
92
+ } & InteractiveBaseProps>;
91
93
  export {};
package/dist/cjs/Img.js CHANGED
@@ -6,15 +6,15 @@ const react_1 = require("react");
6
6
  const index_js_1 = require("./canvas-image/index.js");
7
7
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
8
8
  const get_cross_origin_value_js_1 = require("./get-cross-origin-value.js");
9
+ const interactivity_schema_js_1 = require("./interactivity-schema.js");
9
10
  const prefetch_js_1 = require("./prefetch.js");
10
- const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
11
11
  const Sequence_js_1 = require("./Sequence.js");
12
12
  const SequenceContext_js_1 = require("./SequenceContext.js");
13
13
  const truncate_src_for_label_js_1 = require("./truncate-src-for-label.js");
14
14
  const use_buffer_state_js_1 = require("./use-buffer-state.js");
15
15
  const use_delay_render_js_1 = require("./use-delay-render.js");
16
16
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
17
- const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
17
+ const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
18
18
  function exponentialBackoff(errorCount) {
19
19
  return 1000 * 2 ** (errorCount - 1);
20
20
  }
@@ -183,19 +183,16 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
183
183
  // src gets set once we've loaded and decoded the image.
184
184
  return (jsx_runtime_1.jsx("img", { ...props, ref: imageCallbackRef, crossOrigin: crossOriginValue, onError: didGetError, decoding: isRendering ? 'sync' : decoding }));
185
185
  };
186
- const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, _experimentalControls: controls, _remotionInternalRefForOutline: refForOutline, ...props }) => {
186
+ const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, controls, outlineRef: refForOutline, ...props }) => {
187
187
  if (!src) {
188
188
  throw new Error('No "src" prop was passed to <Img>.');
189
189
  }
190
- return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, name: name !== null && name !== void 0 ? name : '<Img>', _experimentalControls: controls, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, hidden: hidden, _remotionInternalRefForOutline: refForOutline, children: jsx_runtime_1.jsx(ImgContent, { src: src, refForOutline: refForOutline, ...props }) }));
190
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, freeze: freeze, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, name: name !== null && name !== void 0 ? name : '<Img>', controls: controls, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, hidden: hidden, outlineRef: refForOutline, children: jsx_runtime_1.jsx(ImgContent, { src: src, refForOutline: refForOutline, ...props }) }));
191
191
  };
192
192
  const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
193
193
  exports.imgSchema = {
194
- durationInFrames: sequence_field_schema_js_1.durationInFramesField,
195
- from: sequence_field_schema_js_1.fromField,
196
- freeze: sequence_field_schema_js_1.freezeField,
197
- ...sequence_field_schema_js_1.sequenceVisualStyleSchema,
198
- hidden: sequence_field_schema_js_1.hiddenField,
194
+ ...interactivity_schema_js_1.baseSchema,
195
+ ...interactivity_schema_js_1.transformSchema,
199
196
  };
200
197
  const imgCanvasFallbackIncompatibleProps = new Set([
201
198
  'alt',
@@ -236,11 +233,11 @@ const getFitFromObjectFit = (style) => {
236
233
  }
237
234
  return undefined;
238
235
  };
239
- const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, _experimentalControls: controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
236
+ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
240
237
  var _a;
241
238
  const refForOutline = (0, react_1.useRef)(null);
242
239
  if (effects.length === 0) {
243
- return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, durationInFrames: durationInFrames, freeze: freeze, _experimentalControls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, _remotionInternalRefForOutline: refForOutline }));
240
+ return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, durationInFrames: durationInFrames, freeze: freeze, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
244
241
  }
245
242
  if (!src) {
246
243
  throw new Error('No "src" prop was passed to <Img>.');
@@ -255,13 +252,13 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
255
252
  const canvasHeight = typeof height === 'number' ? height : undefined;
256
253
  const canvasProps = props;
257
254
  const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
258
- return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _experimentalControls: controls, _remotionInternalRefForOutline: refForOutline, ...canvasProps }));
255
+ return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, stack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", controls: controls, outlineRef: refForOutline, ...canvasProps }));
259
256
  };
260
257
  /*
261
258
  * @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
262
259
  * @see [Documentation](https://remotion.dev/docs/img)
263
260
  */
264
- exports.Img = (0, wrap_in_schema_js_1.wrapInSchema)({
261
+ exports.Img = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
265
262
  Component: ImgInner,
266
263
  componentIdentity: 'dev.remotion.remotion.Img',
267
264
  schema: exports.imgSchema,
@@ -1,10 +1,15 @@
1
1
  import React from 'react';
2
- import type { SequenceProps } from './Sequence.js';
2
+ import type { SequenceControls } from './CompositionManager.js';
3
+ import { type InteractivitySchema } from './interactivity-schema.js';
4
+ import type { AbsoluteFillLayout, SequenceProps } from './Sequence.js';
3
5
  type InteractiveHtmlTag = 'a' | 'article' | 'aside' | 'button' | 'code' | 'div' | 'em' | 'footer' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'label' | 'li' | 'main' | 'nav' | 'ol' | 'p' | 'pre' | 'section' | 'small' | 'span' | 'strong' | 'ul';
4
6
  type InteractiveSvgTag = 'circle' | 'ellipse' | 'g' | 'line' | 'path' | 'rect' | 'svg' | 'text';
5
7
  type InteractiveTag = InteractiveHtmlTag | InteractiveSvgTag;
6
8
  type ElementForTag<Tag extends InteractiveTag> = Tag extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[Tag] : Tag extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Tag] : Element;
7
- type InteractiveSequenceProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'> & {
9
+ export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'>;
10
+ export type InteractiveTransformProps = Pick<AbsoluteFillLayout, 'style'>;
11
+ export type InteractivePremountProps = Pick<AbsoluteFillLayout, 'premountFor' | 'postmountFor' | 'styleWhilePremounted' | 'styleWhilePostmounted'>;
12
+ type InteractiveSequenceProps = InteractiveBaseProps & {
8
13
  /**
9
14
  * @deprecated For internal use only
10
15
  */
@@ -16,6 +21,186 @@ type InteractiveElementComponent<Tag extends InteractiveTag> = React.ComponentTy
16
21
  * @description HTML and SVG elements that are registered in the Remotion Studio timeline and can be visually edited.
17
22
  */
18
23
  export declare const Interactive: {
24
+ baseSchema: {
25
+ readonly durationInFrames: {
26
+ readonly type: "number";
27
+ readonly default: undefined;
28
+ readonly min: 1;
29
+ readonly step: 1;
30
+ readonly hiddenFromList: true;
31
+ };
32
+ readonly from: {
33
+ readonly type: "number";
34
+ readonly default: 0;
35
+ readonly step: 1;
36
+ readonly hiddenFromList: true;
37
+ };
38
+ readonly freeze: {
39
+ readonly type: "number";
40
+ readonly default: null;
41
+ readonly step: 1;
42
+ readonly hiddenFromList: true;
43
+ };
44
+ readonly hidden: import("./interactivity-schema.js").BooleanFieldSchema;
45
+ readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
46
+ readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
47
+ };
48
+ transformSchema: {
49
+ readonly 'style.transformOrigin': {
50
+ readonly type: "transform-origin";
51
+ readonly step: 1;
52
+ readonly default: "50% 50%";
53
+ readonly description: "Transform origin";
54
+ };
55
+ readonly 'style.translate': {
56
+ readonly type: "translate";
57
+ readonly step: 1;
58
+ readonly default: "0px 0px";
59
+ readonly description: "Offset";
60
+ };
61
+ readonly 'style.scale': {
62
+ readonly type: "scale";
63
+ readonly max: 100;
64
+ readonly step: 0.01;
65
+ readonly default: 1;
66
+ readonly description: "Scale";
67
+ };
68
+ readonly 'style.rotate': {
69
+ readonly type: "rotation-css";
70
+ readonly step: 1;
71
+ readonly default: "0deg";
72
+ readonly description: "Rotation";
73
+ };
74
+ readonly 'style.opacity': {
75
+ readonly type: "number";
76
+ readonly min: 0;
77
+ readonly max: 1;
78
+ readonly step: 0.01;
79
+ readonly default: 1;
80
+ readonly description: "Opacity";
81
+ readonly hiddenFromList: false;
82
+ };
83
+ };
84
+ premountSchema: {
85
+ readonly premountFor: {
86
+ readonly type: "number";
87
+ readonly default: 0;
88
+ readonly description: "Premount For";
89
+ readonly min: 0;
90
+ readonly step: 1;
91
+ readonly hiddenFromList: false;
92
+ };
93
+ readonly postmountFor: {
94
+ readonly type: "number";
95
+ readonly default: 0;
96
+ readonly min: 0;
97
+ readonly step: 1;
98
+ readonly hiddenFromList: true;
99
+ };
100
+ readonly styleWhilePremounted: {
101
+ readonly type: "hidden";
102
+ };
103
+ readonly styleWhilePostmounted: {
104
+ readonly type: "hidden";
105
+ };
106
+ };
107
+ sequenceSchema: {
108
+ readonly durationInFrames: {
109
+ readonly type: "number";
110
+ readonly default: undefined;
111
+ readonly min: 1;
112
+ readonly step: 1;
113
+ readonly hiddenFromList: true;
114
+ };
115
+ readonly from: {
116
+ readonly type: "number";
117
+ readonly default: 0;
118
+ readonly step: 1;
119
+ readonly hiddenFromList: true;
120
+ };
121
+ readonly freeze: {
122
+ readonly type: "number";
123
+ readonly default: null;
124
+ readonly step: 1;
125
+ readonly hiddenFromList: true;
126
+ };
127
+ readonly hidden: import("./interactivity-schema.js").BooleanFieldSchema;
128
+ readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
129
+ readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
130
+ readonly layout: {
131
+ readonly type: "enum";
132
+ readonly default: "absolute-fill";
133
+ readonly description: "Layout";
134
+ readonly variants: {
135
+ readonly 'absolute-fill': {
136
+ readonly 'style.transformOrigin': {
137
+ readonly type: "transform-origin";
138
+ readonly step: 1;
139
+ readonly default: "50% 50%";
140
+ readonly description: "Transform origin";
141
+ };
142
+ readonly 'style.translate': {
143
+ readonly type: "translate";
144
+ readonly step: 1;
145
+ readonly default: "0px 0px";
146
+ readonly description: "Offset";
147
+ };
148
+ readonly 'style.scale': {
149
+ readonly type: "scale";
150
+ readonly max: 100;
151
+ readonly step: 0.01;
152
+ readonly default: 1;
153
+ readonly description: "Scale";
154
+ };
155
+ readonly 'style.rotate': {
156
+ readonly type: "rotation-css";
157
+ readonly step: 1;
158
+ readonly default: "0deg";
159
+ readonly description: "Rotation";
160
+ };
161
+ readonly 'style.opacity': {
162
+ readonly type: "number";
163
+ readonly min: 0;
164
+ readonly max: 1;
165
+ readonly step: 0.01;
166
+ readonly default: 1;
167
+ readonly description: "Opacity";
168
+ readonly hiddenFromList: false;
169
+ };
170
+ readonly premountFor: {
171
+ readonly type: "number";
172
+ readonly default: 0;
173
+ readonly description: "Premount For";
174
+ readonly min: 0;
175
+ readonly step: 1;
176
+ readonly hiddenFromList: false;
177
+ };
178
+ readonly postmountFor: {
179
+ readonly type: "number";
180
+ readonly default: 0;
181
+ readonly min: 0;
182
+ readonly step: 1;
183
+ readonly hiddenFromList: true;
184
+ };
185
+ readonly styleWhilePremounted: {
186
+ readonly type: "hidden";
187
+ };
188
+ readonly styleWhilePostmounted: {
189
+ readonly type: "hidden";
190
+ };
191
+ };
192
+ readonly none: {};
193
+ };
194
+ };
195
+ };
196
+ withSchema: <S extends InteractivitySchema, Props extends object>({ Component, componentIdentity, schema, supportsEffects, }: {
197
+ Component: React.ComponentType<Props & {
198
+ readonly controls: SequenceControls | undefined;
199
+ }>;
200
+ componentIdentity: string | null;
201
+ schema: S;
202
+ supportsEffects: boolean;
203
+ }) => React.ComponentType<Props>;
19
204
  A: InteractiveElementComponent<"a">;
20
205
  Article: InteractiveElementComponent<"article">;
21
206
  Aside: InteractiveElementComponent<"aside">;
@@ -37,15 +37,12 @@ exports.Interactive = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = __importStar(require("react"));
39
39
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
40
- const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
40
+ const interactivity_schema_js_1 = require("./interactivity-schema.js");
41
41
  const Sequence_js_1 = require("./Sequence.js");
42
- const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
42
+ const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
43
43
  const interactiveElementSchema = {
44
- durationInFrames: sequence_field_schema_js_1.durationInFramesField,
45
- from: sequence_field_schema_js_1.fromField,
46
- freeze: sequence_field_schema_js_1.freezeField,
47
- ...sequence_field_schema_js_1.sequenceVisualStyleSchema,
48
- hidden: sequence_field_schema_js_1.hiddenField,
44
+ ...interactivity_schema_js_1.baseSchema,
45
+ ...interactivity_schema_js_1.transformSchema,
49
46
  };
50
47
  const setRef = (ref, value) => {
51
48
  if (typeof ref === 'function') {
@@ -57,19 +54,19 @@ const setRef = (ref, value) => {
57
54
  };
58
55
  const makeInteractiveElement = (tag, displayName) => {
59
56
  const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
60
- const { durationInFrames, from, freeze, hidden, name, showInTimeline, stack, _experimentalControls, ...props } = propsWithControls;
57
+ const { durationInFrames, from, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
61
58
  const refForOutline = (0, react_1.useRef)(null);
62
59
  const callbackRef = (0, react_1.useCallback)((element) => {
63
60
  refForOutline.current = element;
64
61
  setRef(ref, element);
65
62
  }, [ref]);
66
- return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, 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, _experimentalControls: _experimentalControls, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive", _remotionInternalRefForOutline: refForOutline, children: react_1.default.createElement(tag, {
63
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, 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, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive", outlineRef: refForOutline, children: react_1.default.createElement(tag, {
67
64
  ...props,
68
65
  ref: callbackRef,
69
66
  }) }));
70
67
  });
71
68
  Inner.displayName = displayName;
72
- const Wrapped = (0, wrap_in_schema_js_1.wrapInSchema)({
69
+ const Wrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
73
70
  Component: Inner,
74
71
  componentIdentity: `dev.remotion.remotion.${displayName.slice(1, -1)}`,
75
72
  schema: interactiveElementSchema,
@@ -83,6 +80,11 @@ const makeInteractiveElement = (tag, displayName) => {
83
80
  * @description HTML and SVG elements that are registered in the Remotion Studio timeline and can be visually edited.
84
81
  */
85
82
  exports.Interactive = {
83
+ baseSchema: interactivity_schema_js_1.baseSchema,
84
+ transformSchema: interactivity_schema_js_1.transformSchema,
85
+ premountSchema: interactivity_schema_js_1.premountSchema,
86
+ sequenceSchema: interactivity_schema_js_1.sequenceSchema,
87
+ withSchema: with_interactivity_schema_js_1.withInteractivitySchema,
86
88
  A: makeInteractiveElement('a', '<Interactive.A>'),
87
89
  Article: makeInteractiveElement('article', '<Interactive.Article>'),
88
90
  Aside: makeInteractiveElement('aside', '<Interactive.Aside>'),
@@ -23,7 +23,7 @@ export type SequencePropsWithoutDuration = {
23
23
  readonly name?: string;
24
24
  readonly showInTimeline?: boolean;
25
25
  readonly hidden?: boolean;
26
- readonly _experimentalControls?: SequenceControls;
26
+ readonly controls?: SequenceControls;
27
27
  readonly _remotionInternalEffects?: readonly EffectDefinition<unknown>[];
28
28
  /**
29
29
  * @deprecated For internal use only.
@@ -64,9 +64,10 @@ export type SequencePropsWithoutDuration = {
64
64
  src: string;
65
65
  };
66
66
  /**
67
- * @deprecated For internal use only.
67
+ * A React ref pointing to the element that Remotion Studio should use for
68
+ * drawing the selection outline in the preview.
68
69
  */
69
- readonly _remotionInternalRefForOutline?: React.RefObject<Element | null> | null;
70
+ readonly outlineRef?: React.RefObject<Element | null> | null;
70
71
  } & LayoutAndStyle;
71
72
  export type SequenceProps = {
72
73
  readonly durationInFrames?: number;
@@ -6,9 +6,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
7
  const AbsoluteFill_js_1 = require("./AbsoluteFill.js");
8
8
  const freeze_js_1 = require("./freeze.js");
9
+ const interactivity_schema_js_1 = require("./interactivity-schema.js");
9
10
  const nonce_js_1 = require("./nonce.js");
10
11
  const PremountContext_js_1 = require("./PremountContext.js");
11
- const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
12
12
  const SequenceContext_js_1 = require("./SequenceContext.js");
13
13
  const SequenceManager_js_1 = require("./SequenceManager.js");
14
14
  const is_inside_series_js_1 = require("./series/is-inside-series.js");
@@ -17,10 +17,10 @@ const use_current_frame_1 = require("./use-current-frame");
17
17
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
18
18
  const use_video_config_js_1 = require("./use-video-config.js");
19
19
  const v5_flag_js_1 = require("./v5-flag.js");
20
- const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
20
+ const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
21
21
  const EMPTY_EFFECTS = [];
22
- const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, _experimentalControls: controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, _remotionInternalRefForOutline: passedRefForOutline, ...other }, ref) => {
23
- var _a, _b;
22
+ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFrames = Infinity, children, name, height, width, showInTimeline = true, hidden = false, controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, outlineRef: passedRefForOutline, ...other }, ref) => {
23
+ var _a, _b, _c;
24
24
  const { layout = 'absolute-fill' } = other;
25
25
  const [id] = (0, react_1.useState)(() => String(Math.random()));
26
26
  const parentSequence = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
@@ -148,6 +148,25 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
148
148
  // and if it changes, it would lead to-remounting of the sequence.
149
149
  const stackRef = (0, react_1.useRef)(null);
150
150
  stackRef.current = stack !== null && stack !== void 0 ? stack : inheritedStack;
151
+ const registeredFrozenFrame = typeof freeze === 'number' ? freeze : null;
152
+ const parentCumulatedNegativeFrom = (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.cumulatedNegativeFrom) !== null && _c !== void 0 ? _c : 0;
153
+ const startMediaFrom = isMedia && isMedia.type !== 'image'
154
+ ? isMedia.data.startMediaFrom +
155
+ parentCumulatedNegativeFrom -
156
+ cumulatedNegativeFrom
157
+ : null;
158
+ const mediaFrameAtSequenceZero = isMedia && isMedia.type !== 'image'
159
+ ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom
160
+ : null;
161
+ const frozenMediaFrame = isMedia && isMedia.type !== 'image' && mediaFrameAtSequenceZero !== null
162
+ ? registeredFrozenFrame === null
163
+ ? null
164
+ : mediaFrameAtSequenceZero +
165
+ (loopDisplay
166
+ ? registeredFrozenFrame % loopDisplay.durationInFrames
167
+ : registeredFrozenFrame) *
168
+ isMedia.data.playbackRate
169
+ : null;
151
170
  (0, react_1.useEffect)(() => {
152
171
  var _a, _b, _c;
153
172
  if (!env.isStudio) {
@@ -175,6 +194,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
175
194
  getStack: () => stackRef.current,
176
195
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
177
196
  isInsideSeries,
197
+ frozenFrame: registeredFrozenFrame,
178
198
  });
179
199
  }
180
200
  else {
@@ -198,10 +218,12 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
198
218
  showInTimeline,
199
219
  src: isMedia.data.src,
200
220
  getStack: () => stackRef.current,
201
- startMediaFrom: isMedia.data.startMediaFrom,
221
+ startMediaFrom: startMediaFrom !== null && startMediaFrom !== void 0 ? startMediaFrom : isMedia.data.startMediaFrom,
202
222
  volume: isMedia.data.volumes,
203
223
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
204
224
  isInsideSeries,
225
+ frozenFrame: registeredFrozenFrame,
226
+ frozenMediaFrame,
205
227
  });
206
228
  }
207
229
  return () => {
@@ -227,6 +249,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
227
249
  effects: _remotionInternalEffects !== null && _remotionInternalEffects !== void 0 ? _remotionInternalEffects : EMPTY_EFFECTS,
228
250
  refForOutline: refForOutline !== null && refForOutline !== void 0 ? refForOutline : null,
229
251
  isInsideSeries,
252
+ frozenFrame: registeredFrozenFrame,
230
253
  });
231
254
  return () => {
232
255
  unregisterSequence(id);
@@ -254,6 +277,9 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
254
277
  resolvedDocumentationLink,
255
278
  refForOutline,
256
279
  isInsideSeries,
280
+ registeredFrozenFrame,
281
+ startMediaFrom,
282
+ frozenMediaFrame,
257
283
  ]);
258
284
  // Ceil to support floats
259
285
  // https://github.com/remotion-dev/remotion/issues/2958
@@ -349,15 +375,15 @@ exports.SequenceWithoutSchema = SequenceInner;
349
375
  * @description A component that time-shifts its children and wraps them in an absolutely positioned <div>.
350
376
  * @see [Documentation](https://www.remotion.dev/docs/sequence)
351
377
  */
352
- exports.Sequence = (0, wrap_in_schema_js_1.wrapInSchema)({
378
+ exports.Sequence = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
353
379
  Component: SequenceInner,
354
380
  componentIdentity: 'dev.remotion.remotion.Sequence',
355
- schema: sequence_field_schema_js_1.sequenceSchema,
381
+ schema: interactivity_schema_js_1.sequenceSchema,
356
382
  supportsEffects: false,
357
383
  });
358
- exports.SequenceWithoutFrom = (0, wrap_in_schema_js_1.wrapInSchema)({
384
+ exports.SequenceWithoutFrom = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
359
385
  Component: SequenceInner,
360
386
  componentIdentity: null,
361
- schema: sequence_field_schema_js_1.sequenceSchemaWithoutFrom,
387
+ schema: interactivity_schema_js_1.sequenceSchemaWithoutFrom,
362
388
  supportsEffects: false,
363
389
  });
@@ -2,10 +2,9 @@ import type React from 'react';
2
2
  import type { SequenceControls } from '../CompositionManager.js';
3
3
  import type { EffectsProp } from '../effects/effect-types.js';
4
4
  import type { RemotionAnimatedImageProps } from './props';
5
- export declare const AnimatedImage: React.ComponentType<Omit<import("../Sequence.js").SequenceProps, "_remotionInternalEffects" | "children" | "durationInFrames" | "layout"> & RemotionAnimatedImageProps & {
6
- readonly durationInFrames?: number | undefined;
5
+ export declare const AnimatedImage: React.ComponentType<import("../Interactive.js").InteractiveBaseProps & RemotionAnimatedImageProps & {
7
6
  readonly effects?: EffectsProp | undefined;
8
7
  } & {
9
- readonly _experimentalControls?: SequenceControls | undefined;
8
+ readonly controls?: SequenceControls | undefined;
10
9
  readonly ref?: React.Ref<HTMLCanvasElement> | undefined;
11
10
  }>;