remotion 4.0.499 → 4.0.501

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 (57) hide show
  1. package/dist/cjs/AbsoluteFill.d.ts +237 -1
  2. package/dist/cjs/AbsoluteFill.js +40 -103
  3. package/dist/cjs/AbsoluteFillElement.d.ts +3 -0
  4. package/dist/cjs/AbsoluteFillElement.js +111 -0
  5. package/dist/cjs/Composition.js +2 -1
  6. package/dist/cjs/CompositionManager.d.ts +0 -1
  7. package/dist/cjs/Folder.js +2 -1
  8. package/dist/cjs/HtmlInCanvas.d.ts +84 -3
  9. package/dist/cjs/HtmlInCanvas.js +30 -2
  10. package/dist/cjs/Img.d.ts +84 -11
  11. package/dist/cjs/Img.js +16 -5
  12. package/dist/cjs/Interactive.d.ts +211 -6
  13. package/dist/cjs/Interactive.js +33 -11
  14. package/dist/cjs/Sequence.d.ts +4 -0
  15. package/dist/cjs/Sequence.js +30 -13
  16. package/dist/cjs/TimelineContext.d.ts +0 -1
  17. package/dist/cjs/TimelineContext.js +1 -4
  18. package/dist/cjs/animated-image/AnimatedImage.d.ts +82 -1
  19. package/dist/cjs/animated-image/AnimatedImage.js +13 -2
  20. package/dist/cjs/animated-image/props.d.ts +2 -2
  21. package/dist/cjs/audio/AudioForPreview.d.ts +0 -1
  22. package/dist/cjs/audio/AudioForPreview.js +1 -1
  23. package/dist/cjs/audio/html5-audio.d.ts +2 -2
  24. package/dist/cjs/audio/html5-audio.js +2 -2
  25. package/dist/cjs/canvas-image/CanvasImage.d.ts +83 -3
  26. package/dist/cjs/canvas-image/CanvasImage.js +13 -2
  27. package/dist/cjs/canvas-image/props.d.ts +6 -7
  28. package/dist/cjs/effects/Solid.d.ts +84 -3
  29. package/dist/cjs/effects/Solid.js +13 -2
  30. package/dist/cjs/enable-sequence-stack-traces.d.ts +4 -0
  31. package/dist/cjs/enable-sequence-stack-traces.js +16 -1
  32. package/dist/cjs/index.d.ts +3 -3
  33. package/dist/cjs/interactivity-schema.d.ts +420 -1
  34. package/dist/cjs/interactivity-schema.js +122 -1
  35. package/dist/cjs/internals.d.ts +211 -2
  36. package/dist/cjs/internals.js +7 -0
  37. package/dist/cjs/no-react.d.ts +81 -0
  38. package/dist/cjs/sequence-crop.d.ts +20 -0
  39. package/dist/cjs/sequence-crop.js +59 -0
  40. package/dist/cjs/series/index.js +4 -4
  41. package/dist/cjs/static-file.js +10 -0
  42. package/dist/cjs/truncate-src-for-label.js +5 -1
  43. package/dist/cjs/use-crop-style.d.ts +6 -0
  44. package/dist/cjs/use-crop-style.js +19 -0
  45. package/dist/cjs/use-media-in-timeline.d.ts +0 -1
  46. package/dist/cjs/use-media-in-timeline.js +1 -7
  47. package/dist/cjs/version.d.ts +1 -1
  48. package/dist/cjs/version.js +1 -1
  49. package/dist/cjs/video/OffthreadVideo.js +6 -6
  50. package/dist/cjs/video/html5-video.d.ts +2 -2
  51. package/dist/cjs/video/html5-video.js +5 -5
  52. package/dist/cjs/video/props.d.ts +1 -1
  53. package/dist/cjs/with-interactivity-schema.js +22 -12
  54. package/dist/esm/index.mjs +2453 -2022
  55. package/dist/esm/no-react.mjs +111 -0
  56. package/dist/esm/version.mjs +1 -1
  57. package/package.json +2 -2
@@ -9,6 +9,7 @@ const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
9
9
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
10
10
  const interactivity_schema_js_1 = require("./interactivity-schema.js");
11
11
  const Sequence_js_1 = require("./Sequence.js");
12
+ const use_crop_style_js_1 = require("./use-crop-style.js");
12
13
  const use_delay_render_js_1 = require("./use-delay-render.js");
13
14
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
14
15
  const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
@@ -35,6 +36,17 @@ const isHtmlInCanvasSupported = () => {
35
36
  exports.isHtmlInCanvasSupported = isHtmlInCanvasSupported;
36
37
  /** Shown when {@link isHtmlInCanvasSupported} is false: APIs are absent (old Chrome and/or flag off). */
37
38
  exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = 'HTML in Canvas is not supported. Two common causes: Chrome is older than version 148 (update Chrome), or the HTML-in-Canvas flag is disabled at chrome://flags/#canvas-draw-element (enable it and restart Chrome).';
39
+ const MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS = 152;
40
+ const getChromeMajorVersion = () => {
41
+ if (typeof navigator === 'undefined') {
42
+ return null;
43
+ }
44
+ const match = navigator.userAgent.match(/\b(?:HeadlessChrome|Chrome)\/(\d+)/);
45
+ if (!match) {
46
+ return null;
47
+ }
48
+ return Number(match[1]);
49
+ };
38
50
  function assertHtmlInCanvasDimensions(width, height) {
39
51
  if (typeof width !== 'number' || typeof height !== 'number') {
40
52
  throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(width)}, height=${String(height)}.`);
@@ -83,6 +95,12 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
83
95
  var _a;
84
96
  const ancestor = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
85
97
  assertHtmlInCanvasDimensions(width, height);
98
+ const chromeMajorVersion = getChromeMajorVersion();
99
+ if (ancestor &&
100
+ chromeMajorVersion !== null &&
101
+ chromeMajorVersion < MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS) {
102
+ throw new Error(`Nested <HtmlInCanvas> components require Chrome ${MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS} or newer, but the current browser is Chrome ${chromeMajorVersion}. Upgrade Chrome or avoid nesting components that use <HtmlInCanvas>, such as shapes with effects.`);
103
+ }
86
104
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
87
105
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
88
106
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
@@ -355,7 +373,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
355
373
  return (jsx_runtime_1.jsx(HtmlInCanvasAncestorContext.Provider, { value: ancestorValue, 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) }));
356
374
  });
357
375
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
358
- const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, controls, style, durationInFrames, name, ...sequenceProps }, ref) => {
376
+ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], children, onPaint, onInit, pixelDensity, controls, style, cropLeft, cropRight, cropTop, cropBottom, durationInFrames, name, ...sequenceProps }, ref) => {
359
377
  const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
360
378
  const actualRef = (0, react_1.useRef)(null);
361
379
  const setCanvasRef = (0, react_1.useCallback)((node) => {
@@ -367,7 +385,15 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
367
385
  ref.current = node;
368
386
  }
369
387
  }, [ref]);
370
- return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, 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 }) }));
388
+ const croppedStyle = (0, use_crop_style_js_1.useCropStyle)({
389
+ cropLeft,
390
+ cropRight,
391
+ cropTop,
392
+ cropBottom,
393
+ style: style !== null && style !== void 0 ? style : null,
394
+ componentName: '<HtmlInCanvas />',
395
+ });
396
+ return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { durationInFrames: durationInFrames, 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: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, children: children }) }));
371
397
  });
372
398
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
373
399
  exports.htmlInCanvasSchema = {
@@ -384,6 +410,8 @@ exports.htmlInCanvasSchema = {
384
410
  ...interactivity_schema_js_1.transformSchema,
385
411
  ...interactivity_schema_js_1.backgroundSchema,
386
412
  ...interactivity_schema_js_1.borderSchema,
413
+ ...interactivity_schema_js_1.borderRadiusSchema,
414
+ ...interactivity_schema_js_1.cropSchema,
387
415
  };
388
416
  const HtmlInCanvasWrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
389
417
  Component: HtmlInCanvasInner,
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 { InteractiveBaseProps, InteractivePremountProps } from './Interactive.js';
3
+ import type { InteractiveBaseProps, InteractiveCropProps, InteractivePremountProps } 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;
@@ -12,11 +12,7 @@ export type ImgProps = NativeImgProps & {
12
12
  readonly effects?: EffectsProp;
13
13
  readonly showInTimeline?: boolean;
14
14
  readonly name?: string;
15
- /**
16
- * @deprecated For internal use only
17
- */
18
- readonly stack?: string;
19
- } & InteractiveBaseProps & InteractivePremountProps;
15
+ } & InteractiveBaseProps & InteractiveCropProps & InteractivePremountProps;
20
16
  export declare const imgSchema: {
21
17
  readonly 'style.transformOrigin': {
22
18
  readonly type: "transform-origin";
@@ -83,6 +79,47 @@ export declare const imgSchema: {
83
79
  readonly default: undefined;
84
80
  readonly description: "Border color";
85
81
  };
82
+ readonly 'style.borderRadius': {
83
+ readonly type: "number";
84
+ readonly default: 0;
85
+ readonly min: 0;
86
+ readonly step: 1;
87
+ readonly description: "Border radius";
88
+ readonly hiddenFromList: false;
89
+ readonly keyframable: true;
90
+ };
91
+ readonly 'style.borderTopLeftRadius': {
92
+ readonly type: "number";
93
+ readonly default: 0;
94
+ readonly min: 0;
95
+ readonly step: 1;
96
+ readonly description: "Top left radius";
97
+ readonly hiddenFromList: false;
98
+ };
99
+ readonly 'style.borderTopRightRadius': {
100
+ readonly type: "number";
101
+ readonly default: 0;
102
+ readonly min: 0;
103
+ readonly step: 1;
104
+ readonly description: "Top right radius";
105
+ readonly hiddenFromList: false;
106
+ };
107
+ readonly 'style.borderBottomRightRadius': {
108
+ readonly type: "number";
109
+ readonly default: 0;
110
+ readonly min: 0;
111
+ readonly step: 1;
112
+ readonly description: "Bottom right radius";
113
+ readonly hiddenFromList: false;
114
+ };
115
+ readonly 'style.borderBottomLeftRadius': {
116
+ readonly type: "number";
117
+ readonly default: 0;
118
+ readonly min: 0;
119
+ readonly step: 1;
120
+ readonly description: "Bottom left radius";
121
+ readonly hiddenFromList: false;
122
+ };
86
123
  readonly 'style.backgroundColor': {
87
124
  readonly type: "color";
88
125
  readonly default: "transparent";
@@ -105,6 +142,46 @@ export declare const imgSchema: {
105
142
  readonly hiddenFromList: true;
106
143
  readonly keyframable: false;
107
144
  };
145
+ readonly cropLeft: {
146
+ readonly type: "number";
147
+ readonly default: 0;
148
+ readonly description: "Crop left";
149
+ readonly min: 0;
150
+ readonly max: 1;
151
+ readonly step: 0.01;
152
+ readonly hiddenFromList: false;
153
+ readonly keyframable: true;
154
+ };
155
+ readonly cropRight: {
156
+ readonly type: "number";
157
+ readonly default: 0;
158
+ readonly description: "Crop right";
159
+ readonly min: 0;
160
+ readonly max: 1;
161
+ readonly step: 0.01;
162
+ readonly hiddenFromList: false;
163
+ readonly keyframable: true;
164
+ };
165
+ readonly cropTop: {
166
+ readonly type: "number";
167
+ readonly default: 0;
168
+ readonly description: "Crop top";
169
+ readonly min: 0;
170
+ readonly max: 1;
171
+ readonly step: 0.01;
172
+ readonly hiddenFromList: false;
173
+ readonly keyframable: true;
174
+ };
175
+ readonly cropBottom: {
176
+ readonly type: "number";
177
+ readonly default: 0;
178
+ readonly description: "Crop bottom";
179
+ readonly min: 0;
180
+ readonly max: 1;
181
+ readonly step: 0.01;
182
+ readonly hiddenFromList: false;
183
+ readonly keyframable: true;
184
+ };
108
185
  readonly durationInFrames: {
109
186
  readonly type: "number";
110
187
  readonly default: undefined;
@@ -151,9 +228,5 @@ export declare const Img: React.ComponentType<NativeImgProps & {
151
228
  readonly effects?: EffectsProp | undefined;
152
229
  readonly showInTimeline?: boolean | undefined;
153
230
  readonly name?: string | undefined;
154
- /**
155
- * @deprecated For internal use only
156
- */
157
- readonly stack?: string | undefined;
158
- } & InteractiveBaseProps & InteractivePremountProps>;
231
+ } & InteractiveBaseProps & InteractiveCropProps & InteractivePremountProps>;
159
232
  export {};
package/dist/cjs/Img.js CHANGED
@@ -13,6 +13,7 @@ const Sequence_js_1 = require("./Sequence.js");
13
13
  const SequenceContext_js_1 = require("./SequenceContext.js");
14
14
  const truncate_src_for_label_js_1 = require("./truncate-src-for-label.js");
15
15
  const use_buffer_state_js_1 = require("./use-buffer-state.js");
16
+ const use_crop_style_js_1 = require("./use-crop-style.js");
16
17
  const use_delay_render_js_1 = require("./use-delay-render.js");
17
18
  const use_premounting_js_1 = require("./use-premounting.js");
18
19
  const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
@@ -195,7 +196,7 @@ const ImgContent = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRende
195
196
  // blocks frame rendering.
196
197
  return (jsx_runtime_1.jsx("img", { ...props, ref: imageCallbackRef, crossOrigin: crossOriginValue, onError: didGetError, decoding: isRendering ? 'sync' : decoding }));
197
198
  };
198
- const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, style, styleWhilePremounted, styleWhilePostmounted, controls, outlineRef: refForOutline, ...props }) => {
199
+ const NativeImgInner = ({ hidden, name, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, style, styleWhilePremounted, styleWhilePostmounted, cropLeft, cropRight, cropTop, cropBottom, controls, outlineRef: refForOutline, ...props }) => {
199
200
  if (!src) {
200
201
  throw new Error('No "src" prop was passed to <Img>.');
201
202
  }
@@ -209,7 +210,15 @@ const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBe
209
210
  styleWhilePostmounted: styleWhilePostmounted !== null && styleWhilePostmounted !== void 0 ? styleWhilePostmounted : null,
210
211
  hideWhilePremounted: 'display-none',
211
212
  });
212
- return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: 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, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, 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, style: premountingStyle !== null && premountingStyle !== void 0 ? premountingStyle : undefined, ...props }) }) }));
213
+ const croppedStyle = (0, use_crop_style_js_1.useCropStyle)({
214
+ cropLeft,
215
+ cropRight,
216
+ cropTop,
217
+ cropBottom,
218
+ style: premountingStyle,
219
+ componentName: '<Img />',
220
+ });
221
+ return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: 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, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalIsMedia: { type: 'image', src }, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, 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, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, ...props }) }) }));
213
222
  };
214
223
  const CanvasImageWithPrivateProps = index_js_1.CanvasImage;
215
224
  exports.imgSchema = {
@@ -220,10 +229,12 @@ exports.imgSchema = {
220
229
  keyframable: false,
221
230
  },
222
231
  ...interactivity_schema_js_1.baseSchema,
232
+ ...interactivity_schema_js_1.cropSchema,
223
233
  ...interactivity_schema_js_1.premountSchema,
224
234
  ...interactivity_schema_js_1.transformSchema,
225
235
  ...interactivity_schema_js_1.backgroundSchema,
226
236
  ...interactivity_schema_js_1.borderSchema,
237
+ ...interactivity_schema_js_1.borderRadiusSchema,
227
238
  };
228
239
  const imgCanvasFallbackIncompatibleProps = new Set([
229
240
  'alt',
@@ -264,12 +275,12 @@ const getFitFromObjectFit = (style) => {
264
275
  }
265
276
  return undefined;
266
277
  };
267
- const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
278
+ const ImgInner = ({ effects = [], ref, hidden, name, showInTimeline, src, from, trimBefore, durationInFrames, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, controls, width, height, className, style, cropLeft, cropRight, cropTop, cropBottom, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
268
279
  var _a;
269
280
  const refForOutline = (0, react_1.useRef)(null);
270
281
  const shouldPauseWhenLoading = (0, v5_flag_js_1.resolveV5Default)(pauseWhenLoading);
271
282
  if (effects.length === 0) {
272
- return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, stack: stack, showInTimeline: showInTimeline, src: src, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, premountFor: premountFor, postmountFor: postmountFor, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: shouldPauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
283
+ return (jsx_runtime_1.jsx(NativeImgInner, { ...props, ref: ref, hidden: hidden, name: name, showInTimeline: showInTimeline, src: src, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, premountFor: premountFor, postmountFor: postmountFor, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, controls: controls, width: width, height: height, className: className, style: style, cropLeft: cropLeft, cropRight: cropRight, cropTop: cropTop, cropBottom: cropBottom, id: id, pauseWhenLoading: shouldPauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
273
284
  }
274
285
  if (!src) {
275
286
  throw new Error('No "src" prop was passed to <Img>.');
@@ -284,7 +295,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
284
295
  const canvasHeight = typeof height === 'number' ? height : undefined;
285
296
  const canvasProps = props;
286
297
  const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
287
- return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, id: id, pauseWhenLoading: shouldPauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, premountFor: premountFor, postmountFor: postmountFor, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, 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 }));
298
+ return (jsx_runtime_1.jsx(CanvasImageWithPrivateProps, { src: src, width: canvasWidth, height: canvasHeight, fit: canvasFit, effects: effects, className: className, style: style, cropLeft: cropLeft, cropRight: cropRight, cropTop: cropTop, cropBottom: cropBottom, id: id, pauseWhenLoading: shouldPauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, from: from, trimBefore: trimBefore, durationInFrames: durationInFrames, freeze: freeze, premountFor: premountFor, postmountFor: postmountFor, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, hidden: hidden, name: name !== null && name !== void 0 ? name : '<Img>', showInTimeline: showInTimeline, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img", _remotionInternalCropComponentName: "<Img />", controls: controls, outlineRef: refForOutline, ...canvasProps }));
288
299
  };
289
300
  /*
290
301
  * @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.
@@ -8,13 +8,9 @@ type InteractiveTag = InteractiveHtmlTag | InteractiveSvgTag;
8
8
  type ElementForTag<Tag extends InteractiveTag> = Tag extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[Tag] : Tag extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Tag] : Element;
9
9
  export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'trimBefore' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'>;
10
10
  export type InteractiveTransformProps = Pick<AbsoluteFillLayout, 'style'>;
11
+ export type InteractiveCropProps = Pick<SequenceProps, 'cropLeft' | 'cropRight' | 'cropTop' | 'cropBottom'>;
11
12
  export type InteractivePremountProps = Pick<AbsoluteFillLayout, 'premountFor' | 'postmountFor' | 'styleWhilePremounted' | 'styleWhilePostmounted'>;
12
- type InteractiveSequenceProps = InteractiveBaseProps & {
13
- /**
14
- * @deprecated For internal use only
15
- */
16
- readonly stack?: string;
17
- };
13
+ type InteractiveSequenceProps = InteractiveBaseProps;
18
14
  type InteractiveElementProps<Tag extends InteractiveTag> = Omit<React.ComponentPropsWithoutRef<Tag>, keyof InteractiveSequenceProps> & InteractiveSequenceProps;
19
15
  type InteractiveElementComponent<Tag extends InteractiveTag> = React.ComponentType<InteractiveElementProps<Tag> & React.RefAttributes<ElementForTag<Tag>>>;
20
16
  type RemotionComponentIdentityPackage = 'remotion' | `@remotion/${string}`;
@@ -53,6 +49,14 @@ export declare const Interactive: {
53
49
  readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
54
50
  readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
55
51
  };
52
+ captionsSchema: {
53
+ readonly captions: {
54
+ readonly type: "remotion-captions";
55
+ readonly default: undefined;
56
+ readonly description: "Captions";
57
+ readonly keyframable: false;
58
+ };
59
+ };
56
60
  transformSchema: {
57
61
  readonly 'style.transformOrigin': {
58
62
  readonly type: "transform-origin";
@@ -206,6 +210,126 @@ export declare const Interactive: {
206
210
  readonly description: "Border color";
207
211
  };
208
212
  };
213
+ borderRadiusSchema: {
214
+ readonly 'style.borderRadius': {
215
+ readonly type: "number";
216
+ readonly default: 0;
217
+ readonly min: 0;
218
+ readonly step: 1;
219
+ readonly description: "Border radius";
220
+ readonly hiddenFromList: false;
221
+ readonly keyframable: true;
222
+ };
223
+ readonly 'style.borderTopLeftRadius': {
224
+ readonly type: "number";
225
+ readonly default: 0;
226
+ readonly min: 0;
227
+ readonly step: 1;
228
+ readonly description: "Top left radius";
229
+ readonly hiddenFromList: false;
230
+ };
231
+ readonly 'style.borderTopRightRadius': {
232
+ readonly type: "number";
233
+ readonly default: 0;
234
+ readonly min: 0;
235
+ readonly step: 1;
236
+ readonly description: "Top right radius";
237
+ readonly hiddenFromList: false;
238
+ };
239
+ readonly 'style.borderBottomRightRadius': {
240
+ readonly type: "number";
241
+ readonly default: 0;
242
+ readonly min: 0;
243
+ readonly step: 1;
244
+ readonly description: "Bottom right radius";
245
+ readonly hiddenFromList: false;
246
+ };
247
+ readonly 'style.borderBottomLeftRadius': {
248
+ readonly type: "number";
249
+ readonly default: 0;
250
+ readonly min: 0;
251
+ readonly step: 1;
252
+ readonly description: "Bottom left radius";
253
+ readonly hiddenFromList: false;
254
+ };
255
+ };
256
+ cropSchema: {
257
+ readonly cropLeft: {
258
+ readonly type: "number";
259
+ readonly default: 0;
260
+ readonly description: "Crop left";
261
+ readonly min: 0;
262
+ readonly max: 1;
263
+ readonly step: 0.01;
264
+ readonly hiddenFromList: false;
265
+ readonly keyframable: true;
266
+ };
267
+ readonly cropRight: {
268
+ readonly type: "number";
269
+ readonly default: 0;
270
+ readonly description: "Crop right";
271
+ readonly min: 0;
272
+ readonly max: 1;
273
+ readonly step: 0.01;
274
+ readonly hiddenFromList: false;
275
+ readonly keyframable: true;
276
+ };
277
+ readonly cropTop: {
278
+ readonly type: "number";
279
+ readonly default: 0;
280
+ readonly description: "Crop top";
281
+ readonly min: 0;
282
+ readonly max: 1;
283
+ readonly step: 0.01;
284
+ readonly hiddenFromList: false;
285
+ readonly keyframable: true;
286
+ };
287
+ readonly cropBottom: {
288
+ readonly type: "number";
289
+ readonly default: 0;
290
+ readonly description: "Crop bottom";
291
+ readonly min: 0;
292
+ readonly max: 1;
293
+ readonly step: 0.01;
294
+ readonly hiddenFromList: false;
295
+ readonly keyframable: true;
296
+ };
297
+ };
298
+ svgPaintSchema: {
299
+ readonly stroke: {
300
+ readonly type: "color";
301
+ readonly default: "none";
302
+ readonly description: "Stroke";
303
+ };
304
+ readonly strokeWidth: {
305
+ readonly type: "number";
306
+ readonly default: 1;
307
+ readonly description: "Stroke width";
308
+ readonly min: 0;
309
+ readonly step: 1;
310
+ readonly hiddenFromList: false;
311
+ };
312
+ readonly fill: {
313
+ readonly type: "color";
314
+ readonly default: undefined;
315
+ readonly description: "Fill";
316
+ };
317
+ };
318
+ svgStrokeSchema: {
319
+ readonly stroke: {
320
+ readonly type: "color";
321
+ readonly default: "none";
322
+ readonly description: "Stroke";
323
+ };
324
+ readonly strokeWidth: {
325
+ readonly type: "number";
326
+ readonly default: 1;
327
+ readonly description: "Stroke width";
328
+ readonly min: 0;
329
+ readonly step: 1;
330
+ readonly hiddenFromList: false;
331
+ };
332
+ };
209
333
  premountSchema: {
210
334
  readonly premountFor: {
211
335
  readonly type: "number";
@@ -326,6 +450,47 @@ export declare const Interactive: {
326
450
  readonly default: undefined;
327
451
  readonly description: "Border color";
328
452
  };
453
+ readonly 'style.borderRadius': {
454
+ readonly type: "number";
455
+ readonly default: 0;
456
+ readonly min: 0;
457
+ readonly step: 1;
458
+ readonly description: "Border radius";
459
+ readonly hiddenFromList: false;
460
+ readonly keyframable: true;
461
+ };
462
+ readonly 'style.borderTopLeftRadius': {
463
+ readonly type: "number";
464
+ readonly default: 0;
465
+ readonly min: 0;
466
+ readonly step: 1;
467
+ readonly description: "Top left radius";
468
+ readonly hiddenFromList: false;
469
+ };
470
+ readonly 'style.borderTopRightRadius': {
471
+ readonly type: "number";
472
+ readonly default: 0;
473
+ readonly min: 0;
474
+ readonly step: 1;
475
+ readonly description: "Top right radius";
476
+ readonly hiddenFromList: false;
477
+ };
478
+ readonly 'style.borderBottomRightRadius': {
479
+ readonly type: "number";
480
+ readonly default: 0;
481
+ readonly min: 0;
482
+ readonly step: 1;
483
+ readonly description: "Bottom right radius";
484
+ readonly hiddenFromList: false;
485
+ };
486
+ readonly 'style.borderBottomLeftRadius': {
487
+ readonly type: "number";
488
+ readonly default: 0;
489
+ readonly min: 0;
490
+ readonly step: 1;
491
+ readonly description: "Bottom left radius";
492
+ readonly hiddenFromList: false;
493
+ };
329
494
  readonly 'style.backgroundColor': {
330
495
  readonly type: "color";
331
496
  readonly default: "transparent";
@@ -348,6 +513,46 @@ export declare const Interactive: {
348
513
  readonly hiddenFromList: true;
349
514
  readonly keyframable: false;
350
515
  };
516
+ readonly cropLeft: {
517
+ readonly type: "number";
518
+ readonly default: 0;
519
+ readonly description: "Crop left";
520
+ readonly min: 0;
521
+ readonly max: 1;
522
+ readonly step: 0.01;
523
+ readonly hiddenFromList: false;
524
+ readonly keyframable: true;
525
+ };
526
+ readonly cropRight: {
527
+ readonly type: "number";
528
+ readonly default: 0;
529
+ readonly description: "Crop right";
530
+ readonly min: 0;
531
+ readonly max: 1;
532
+ readonly step: 0.01;
533
+ readonly hiddenFromList: false;
534
+ readonly keyframable: true;
535
+ };
536
+ readonly cropTop: {
537
+ readonly type: "number";
538
+ readonly default: 0;
539
+ readonly description: "Crop top";
540
+ readonly min: 0;
541
+ readonly max: 1;
542
+ readonly step: 0.01;
543
+ readonly hiddenFromList: false;
544
+ readonly keyframable: true;
545
+ };
546
+ readonly cropBottom: {
547
+ readonly type: "number";
548
+ readonly default: 0;
549
+ readonly description: "Crop bottom";
550
+ readonly min: 0;
551
+ readonly max: 1;
552
+ readonly step: 0.01;
553
+ readonly hiddenFromList: false;
554
+ readonly keyframable: true;
555
+ };
351
556
  };
352
557
  readonly none: {};
353
558
  };
@@ -66,6 +66,7 @@ const interactiveBackgroundElementSchema = {
66
66
  const interactiveBorderElementSchema = {
67
67
  ...interactiveBackgroundElementSchema,
68
68
  ...interactivity_schema_js_1.borderSchema,
69
+ ...interactivity_schema_js_1.borderRadiusSchema,
69
70
  };
70
71
  const interactiveTextElementSchema = {
71
72
  ...interactiveBorderElementSchema,
@@ -74,9 +75,22 @@ const interactiveTextElementSchema = {
74
75
  };
75
76
  const interactiveSvgTextElementSchema = {
76
77
  ...interactiveElementSchema,
78
+ ...interactivity_schema_js_1.svgPaintSchema,
77
79
  ...interactivity_schema_js_1.textSchema,
78
80
  ...interactivity_schema_js_1.textContentSchema,
79
81
  };
82
+ const interactiveSvgElementSchema = {
83
+ ...interactiveElementSchema,
84
+ ...interactivity_schema_js_1.svgPaintSchema,
85
+ };
86
+ const interactiveSvgStrokeElementSchema = {
87
+ ...interactiveElementSchema,
88
+ ...interactivity_schema_js_1.svgStrokeSchema,
89
+ };
90
+ const interactiveSvgRootElementSchema = {
91
+ ...interactiveBorderElementSchema,
92
+ ...interactivity_schema_js_1.svgPaintSchema,
93
+ };
80
94
  const setRef = (ref, value) => {
81
95
  if (typeof ref === 'function') {
82
96
  ref(value);
@@ -92,13 +106,13 @@ const withSchema = (options) => {
92
106
  };
93
107
  const makeInteractiveElement = (tag, displayName, schema) => {
94
108
  const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
95
- const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
109
+ const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, controls, ...props } = propsWithControls;
96
110
  const refForOutline = (0, react_1.useRef)(null);
97
111
  const callbackRef = (0, react_1.useCallback)((element) => {
98
112
  refForOutline.current = element;
99
113
  setRef(ref, element);
100
114
  }, [ref]);
101
- 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, _remotionInternalStack: stack, _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive", outlineRef: refForOutline, children: react_1.default.createElement(tag, {
115
+ 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, {
102
116
  ...props,
103
117
  ref: callbackRef,
104
118
  }) }));
@@ -120,18 +134,26 @@ const makeInteractiveElement = (tag, displayName, schema) => {
120
134
  const makeInteractiveTextElement = (tag, displayName) => {
121
135
  return makeInteractiveElement(tag, displayName, interactiveTextElementSchema);
122
136
  };
123
- const makeInteractiveNonTextElement = (tag, displayName) => {
124
- return makeInteractiveElement(tag, displayName, interactiveElementSchema);
137
+ const makeInteractiveSvgElement = (tag, displayName) => {
138
+ return makeInteractiveElement(tag, displayName, interactiveSvgElementSchema);
139
+ };
140
+ const makeInteractiveSvgStrokeElement = (tag, displayName) => {
141
+ return makeInteractiveElement(tag, displayName, interactiveSvgStrokeElementSchema);
125
142
  };
126
143
  /**
127
144
  * @description HTML and SVG elements that are registered in the Remotion Studio timeline and can be visually edited.
128
145
  */
129
146
  exports.Interactive = {
130
147
  baseSchema: interactivity_schema_js_1.baseSchema,
148
+ captionsSchema: interactivity_schema_js_1.captionsSchema,
131
149
  transformSchema: interactivity_schema_js_1.transformSchema,
132
150
  textSchema: interactivity_schema_js_1.textSchema,
133
151
  backgroundSchema: interactivity_schema_js_1.backgroundSchema,
134
152
  borderSchema: interactivity_schema_js_1.borderSchema,
153
+ borderRadiusSchema: interactivity_schema_js_1.borderRadiusSchema,
154
+ cropSchema: interactivity_schema_js_1.cropSchema,
155
+ svgPaintSchema: interactivity_schema_js_1.svgPaintSchema,
156
+ svgStrokeSchema: interactivity_schema_js_1.svgStrokeSchema,
135
157
  premountSchema: interactivity_schema_js_1.premountSchema,
136
158
  sequenceSchema: interactivity_schema_js_1.sequenceSchema,
137
159
  withSchema,
@@ -140,13 +162,13 @@ exports.Interactive = {
140
162
  Article: makeInteractiveTextElement('article', '<Interactive.Article>'),
141
163
  Aside: makeInteractiveTextElement('aside', '<Interactive.Aside>'),
142
164
  Button: makeInteractiveTextElement('button', '<Interactive.Button>'),
143
- Circle: makeInteractiveNonTextElement('circle', '<Interactive.Circle>'),
165
+ Circle: makeInteractiveSvgElement('circle', '<Interactive.Circle>'),
144
166
  Code: makeInteractiveTextElement('code', '<Interactive.Code>'),
145
167
  Div: makeInteractiveTextElement('div', '<Interactive.Div>'),
146
- Ellipse: makeInteractiveNonTextElement('ellipse', '<Interactive.Ellipse>'),
168
+ Ellipse: makeInteractiveSvgElement('ellipse', '<Interactive.Ellipse>'),
147
169
  Em: makeInteractiveTextElement('em', '<Interactive.Em>'),
148
170
  Footer: makeInteractiveTextElement('footer', '<Interactive.Footer>'),
149
- G: makeInteractiveNonTextElement('g', '<Interactive.G>'),
171
+ G: makeInteractiveSvgElement('g', '<Interactive.G>'),
150
172
  H1: makeInteractiveTextElement('h1', '<Interactive.H1>'),
151
173
  H2: makeInteractiveTextElement('h2', '<Interactive.H2>'),
152
174
  H3: makeInteractiveTextElement('h3', '<Interactive.H3>'),
@@ -156,19 +178,19 @@ exports.Interactive = {
156
178
  Header: makeInteractiveTextElement('header', '<Interactive.Header>'),
157
179
  Label: makeInteractiveTextElement('label', '<Interactive.Label>'),
158
180
  Li: makeInteractiveTextElement('li', '<Interactive.Li>'),
159
- Line: makeInteractiveNonTextElement('line', '<Interactive.Line>'),
181
+ Line: makeInteractiveSvgStrokeElement('line', '<Interactive.Line>'),
160
182
  Main: makeInteractiveTextElement('main', '<Interactive.Main>'),
161
183
  Nav: makeInteractiveTextElement('nav', '<Interactive.Nav>'),
162
184
  Ol: makeInteractiveTextElement('ol', '<Interactive.Ol>'),
163
185
  P: makeInteractiveTextElement('p', '<Interactive.P>'),
164
- Path: makeInteractiveNonTextElement('path', '<Interactive.Path>'),
186
+ Path: makeInteractiveSvgElement('path', '<Interactive.Path>'),
165
187
  Pre: makeInteractiveTextElement('pre', '<Interactive.Pre>'),
166
- Rect: makeInteractiveNonTextElement('rect', '<Interactive.Rect>'),
188
+ Rect: makeInteractiveSvgElement('rect', '<Interactive.Rect>'),
167
189
  Section: makeInteractiveTextElement('section', '<Interactive.Section>'),
168
190
  Small: makeInteractiveTextElement('small', '<Interactive.Small>'),
169
191
  Span: makeInteractiveTextElement('span', '<Interactive.Span>'),
170
192
  Strong: makeInteractiveTextElement('strong', '<Interactive.Strong>'),
171
- Svg: makeInteractiveElement('svg', '<Interactive.Svg>', interactiveBorderElementSchema),
193
+ Svg: makeInteractiveElement('svg', '<Interactive.Svg>', interactiveSvgRootElementSchema),
172
194
  Text: makeInteractiveElement('text', '<Interactive.Text>', interactiveSvgTextElementSchema),
173
195
  Ul: makeInteractiveTextElement('ul', '<Interactive.Ul>'),
174
196
  };
@@ -18,6 +18,10 @@ export type SequencePropsWithoutDuration = {
18
18
  readonly children?: React.ReactNode;
19
19
  readonly width?: number;
20
20
  readonly height?: number;
21
+ readonly cropLeft?: number;
22
+ readonly cropRight?: number;
23
+ readonly cropTop?: number;
24
+ readonly cropBottom?: number;
21
25
  readonly from?: number;
22
26
  readonly trimBefore?: number;
23
27
  readonly freeze?: number | null;