remotion 4.0.481 → 4.0.483

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 (41) hide show
  1. package/dist/cjs/CompositionManager.d.ts +1 -0
  2. package/dist/cjs/HtmlInCanvas.d.ts +74 -0
  3. package/dist/cjs/HtmlInCanvas.js +68 -26
  4. package/dist/cjs/Img.d.ts +7 -0
  5. package/dist/cjs/Img.js +5 -5
  6. package/dist/cjs/Interactive.d.ts +86 -1
  7. package/dist/cjs/Interactive.js +4 -2
  8. package/dist/cjs/Sequence.d.ts +1 -0
  9. package/dist/cjs/Sequence.js +25 -6
  10. package/dist/cjs/audio/AudioForPreview.js +3 -3
  11. package/dist/cjs/audio/html5-audio.js +6 -2
  12. package/dist/cjs/canvas-image/CanvasImage.d.ts +7 -0
  13. package/dist/cjs/canvas-image/CanvasImage.js +2 -2
  14. package/dist/cjs/easing.d.ts +5 -2
  15. package/dist/cjs/easing.js +19 -3
  16. package/dist/cjs/effects/Solid.d.ts +95 -0
  17. package/dist/cjs/effects/Solid.js +14 -5
  18. package/dist/cjs/effects/use-memoized-effects.js +1 -0
  19. package/dist/cjs/get-effective-visual-mode-value.js +2 -0
  20. package/dist/cjs/interactivity-schema.d.ts +116 -1
  21. package/dist/cjs/interactivity-schema.js +81 -1
  22. package/dist/cjs/internals.d.ts +88 -2
  23. package/dist/cjs/internals.js +2 -1
  24. package/dist/cjs/interpolate-keyframed-status.d.ts +2 -1
  25. package/dist/cjs/interpolate-keyframed-status.js +14 -11
  26. package/dist/cjs/interpolate.d.ts +3 -1
  27. package/dist/cjs/interpolate.js +56 -12
  28. package/dist/cjs/no-react.d.ts +7 -0
  29. package/dist/cjs/prefetch.js +15 -10
  30. package/dist/cjs/use-media-in-timeline.js +1 -0
  31. package/dist/cjs/use-schema.d.ts +2 -0
  32. package/dist/cjs/use-schema.js +20 -0
  33. package/dist/cjs/version.d.ts +1 -1
  34. package/dist/cjs/version.js +1 -1
  35. package/dist/cjs/video/VideoForPreview.js +2 -2
  36. package/dist/cjs/volume-position-state.d.ts +4 -4
  37. package/dist/cjs/volume-position-state.js +9 -9
  38. package/dist/esm/index.mjs +351 -79
  39. package/dist/esm/no-react.mjs +70 -11
  40. package/dist/esm/version.mjs +1 -1
  41. package/package.json +2 -2
@@ -63,6 +63,7 @@ export type SequenceControls = {
63
63
  };
64
64
  export type TSequence = {
65
65
  from: number;
66
+ trimBefore: number | null;
66
67
  duration: number;
67
68
  id: string;
68
69
  displayName: string;
@@ -64,6 +64,80 @@ export type HtmlInCanvasProps = Omit<InteractiveBaseProps, 'children'> & Omit<Ab
64
64
  readonly onInit?: HtmlInCanvasOnInit;
65
65
  readonly pixelDensity?: HtmlInCanvasPixelDensity;
66
66
  };
67
+ export declare const htmlInCanvasSchema: {
68
+ readonly 'style.transformOrigin': {
69
+ readonly type: "transform-origin";
70
+ readonly step: 1;
71
+ readonly default: "50% 50%";
72
+ readonly description: "Transform origin";
73
+ };
74
+ readonly 'style.translate': {
75
+ readonly type: "translate";
76
+ readonly step: 1;
77
+ readonly default: "0px 0px";
78
+ readonly description: "Offset";
79
+ };
80
+ readonly 'style.scale': {
81
+ readonly type: "scale";
82
+ readonly max: 100;
83
+ readonly step: 0.01;
84
+ readonly default: 1;
85
+ readonly description: "Scale";
86
+ };
87
+ readonly 'style.rotate': {
88
+ readonly type: "rotation-css";
89
+ readonly step: 1;
90
+ readonly default: "0deg";
91
+ readonly description: "Rotation";
92
+ };
93
+ readonly 'style.opacity': {
94
+ readonly type: "number";
95
+ readonly min: 0;
96
+ readonly max: 1;
97
+ readonly step: 0.01;
98
+ readonly default: 1;
99
+ readonly description: "Opacity";
100
+ readonly hiddenFromList: false;
101
+ };
102
+ readonly durationInFrames: {
103
+ readonly type: "number";
104
+ readonly default: undefined;
105
+ readonly min: 1;
106
+ readonly step: 1;
107
+ readonly hiddenFromList: true;
108
+ };
109
+ readonly from: {
110
+ readonly type: "number";
111
+ readonly default: 0;
112
+ readonly step: 1;
113
+ readonly hiddenFromList: true;
114
+ };
115
+ readonly trimBefore: {
116
+ readonly type: "number";
117
+ readonly default: 0;
118
+ readonly min: 0;
119
+ readonly step: 1;
120
+ readonly hiddenFromList: true;
121
+ };
122
+ readonly freeze: {
123
+ readonly type: "number";
124
+ readonly default: null;
125
+ readonly step: 1;
126
+ readonly hiddenFromList: true;
127
+ };
128
+ readonly hidden: import("./interactivity-schema.js").BooleanFieldSchema;
129
+ readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
130
+ readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
131
+ readonly pixelDensity: {
132
+ readonly type: "number";
133
+ readonly min: 1;
134
+ readonly max: 3;
135
+ readonly step: 0.1;
136
+ readonly default: 1;
137
+ readonly description: "Pixel density";
138
+ readonly hiddenFromList: false;
139
+ };
140
+ };
67
141
  export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<InteractiveBaseProps, "children"> & Omit<AbsoluteFillLayout, "layout" | "postmountFor" | "premountFor" | "styleWhilePostmounted" | "styleWhilePremounted"> & {
68
142
  readonly durationInFrames?: number | undefined;
69
143
  readonly width: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HtmlInCanvas = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasSupported = void 0;
3
+ exports.HtmlInCanvas = exports.htmlInCanvasSchema = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasSupported = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const delay_render_js_1 = require("./delay-render.js");
@@ -11,6 +11,7 @@ const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-trace
11
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
+ const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
14
15
  const use_video_config_js_1 = require("./use-video-config.js");
15
16
  const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js");
16
17
  // Memoize the support check across the session — neither the platform
@@ -58,6 +59,10 @@ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
58
59
  }
59
60
  return pixelDensity;
60
61
  }
62
+ const isMissingPaintRecordError = (error) => {
63
+ return error instanceof DOMException && error.name === 'InvalidStateError';
64
+ };
65
+ const missingPaintRecordMessage = 'HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.';
61
66
  const resizeOffscreenCanvas = ({ offscreen, width, height, }) => {
62
67
  if (offscreen.width !== width) {
63
68
  offscreen.width = width;
@@ -85,6 +90,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
85
90
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
86
91
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
87
92
  const { continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
93
+ const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
88
94
  if (!(0, exports.isHtmlInCanvasSupported)()) {
89
95
  cancelRender(new Error(exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
90
96
  }
@@ -137,44 +143,70 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
137
143
  if (!placeholderCanvas) {
138
144
  throw new Error('Canvas not found');
139
145
  }
140
- // `GPUQueue.copyElementImageToTexture` / related paths validate the
141
- // linked offscreen surface has a rendering context. Acquire `2d` here
142
- // before any capture or handler (must not call getContext on placeholder).
143
- const offscreen2d = offscreen.getContext('2d');
144
- if (!offscreen2d) {
145
- throw new Error('Failed to acquire 2D context for <HtmlInCanvas> offscreen canvas');
146
- }
147
146
  const handle = (0, delay_render_js_1.delayRender)('onPaint');
148
147
  if (!initializedRef.current) {
149
- initializedRef.current = true;
150
148
  // `onInit` may be async (e.g. WebGPU `requestAdapter`/`requestDevice`).
151
149
  // Capture an `ElementImage` here only for `onInit` consumers — do NOT
152
150
  // reuse it for the paint handler below, because awaiting `onInit`
153
151
  // can invalidate the capture's paint context, leaving subsequent
154
152
  // uploads (e.g. `copyElementImageToTexture`) failing with
155
153
  // "No context found for ElementImage" on the very first paint.
156
- const initImage = placeholderCanvas.captureElementImage(element);
157
- const currentOnInit = onInitRef.current;
158
- if (currentOnInit) {
159
- const cleanup = await currentOnInit({
160
- canvas: offscreen,
161
- element,
162
- elementImage: initImage,
163
- pixelDensity: resolvedPixelDensity,
164
- });
165
- if (typeof cleanup !== 'function') {
166
- throw new Error('HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.');
154
+ let initImage = null;
155
+ try {
156
+ initImage = placeholderCanvas.captureElementImage(element);
157
+ }
158
+ catch (error) {
159
+ if (isMissingPaintRecordError(error) && !isRendering) {
160
+ // Element may be outside viewport (no cached paint record).
161
+ // Skip init — will retry on the next paint cycle.
167
162
  }
168
- if (unmountedRef.current) {
169
- cleanup();
163
+ else if (isMissingPaintRecordError(error)) {
164
+ throw new Error(missingPaintRecordMessage);
170
165
  }
171
166
  else {
172
- onInitCleanupRef.current = cleanup;
167
+ throw error;
168
+ }
169
+ }
170
+ if (initImage) {
171
+ initializedRef.current = true;
172
+ const currentOnInit = onInitRef.current;
173
+ if (currentOnInit) {
174
+ const cleanup = await currentOnInit({
175
+ canvas: offscreen,
176
+ element,
177
+ elementImage: initImage,
178
+ pixelDensity: resolvedPixelDensity,
179
+ });
180
+ if (typeof cleanup !== 'function') {
181
+ throw new Error('HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.');
182
+ }
183
+ if (unmountedRef.current) {
184
+ cleanup();
185
+ }
186
+ else {
187
+ onInitCleanupRef.current = cleanup;
188
+ }
173
189
  }
174
190
  }
175
191
  }
176
192
  const handler = (_a = onPaintRef.current) !== null && _a !== void 0 ? _a : defaultOnPaint;
177
- const elImage = placeholderCanvas.captureElementImage(element);
193
+ let elImage;
194
+ try {
195
+ elImage = placeholderCanvas.captureElementImage(element);
196
+ }
197
+ catch (error) {
198
+ // `captureElementImage` throws `InvalidStateError` when the
199
+ // element is outside the viewport (no cached paint record).
200
+ // Skip this paint cycle — the canvas retains its last state.
201
+ if (isMissingPaintRecordError(error) && !isRendering) {
202
+ continueRender(handle);
203
+ return;
204
+ }
205
+ if (isMissingPaintRecordError(error)) {
206
+ throw new Error(missingPaintRecordMessage);
207
+ }
208
+ throw error;
209
+ }
178
210
  await handler({
179
211
  canvas: offscreen,
180
212
  element,
@@ -201,6 +233,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, c
201
233
  continueRender,
202
234
  cancelRender,
203
235
  resolvedPixelDensity,
236
+ isRendering,
204
237
  ]);
205
238
  // Transfer control once per layout canvas instance, then listen for paint on
206
239
  // the placeholder (capture) while drawing on the linked offscreen surface.
@@ -293,15 +326,24 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
293
326
  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
327
  });
295
328
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
296
- const htmlInCanvasSchema = {
329
+ exports.htmlInCanvasSchema = {
297
330
  ...interactivity_schema_js_1.baseSchema,
331
+ pixelDensity: {
332
+ type: 'number',
333
+ min: 1,
334
+ max: 3,
335
+ step: 0.1,
336
+ default: 1,
337
+ description: 'Pixel density',
338
+ hiddenFromList: false,
339
+ },
298
340
  ...interactivity_schema_js_1.transformSchema,
299
341
  };
300
342
  const HtmlInCanvasWrapped = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
301
343
  Component: HtmlInCanvasInner,
302
344
  componentName: '<HtmlInCanvas>',
303
345
  componentIdentity: 'dev.remotion.remotion.HtmlInCanvas',
304
- schema: htmlInCanvasSchema,
346
+ schema: exports.htmlInCanvasSchema,
305
347
  supportsEffects: true,
306
348
  });
307
349
  exports.HtmlInCanvas = Object.assign(HtmlInCanvasWrapped, {
package/dist/cjs/Img.d.ts CHANGED
@@ -65,6 +65,13 @@ export declare const imgSchema: {
65
65
  readonly step: 1;
66
66
  readonly hiddenFromList: true;
67
67
  };
68
+ readonly trimBefore: {
69
+ readonly type: "number";
70
+ readonly default: 0;
71
+ readonly min: 0;
72
+ readonly step: 1;
73
+ readonly hiddenFromList: true;
74
+ };
68
75
  readonly freeze: {
69
76
  readonly type: "number";
70
77
  readonly default: null;
package/dist/cjs/Img.js CHANGED
@@ -183,11 +183,11 @@ 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, controls, outlineRef: refForOutline, ...props }) => {
186
+ const NativeImgInner = ({ hidden, name, stack, showInTimeline, src, from, trimBefore, 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>', 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 }) }));
190
+ 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, _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 = {
@@ -233,11 +233,11 @@ const getFitFromObjectFit = (style) => {
233
233
  }
234
234
  return undefined;
235
235
  };
236
- const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, durationInFrames, freeze, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
236
+ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src, from, trimBefore, durationInFrames, freeze, controls, width, height, className, style, id, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...props }) => {
237
237
  var _a;
238
238
  const refForOutline = (0, react_1.useRef)(null);
239
239
  if (effects.length === 0) {
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 }));
240
+ 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, controls: controls, width: width, height: height, className: className, style: style, id: id, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, outlineRef: refForOutline }));
241
241
  }
242
242
  if (!src) {
243
243
  throw new Error('No "src" prop was passed to <Img>.');
@@ -252,7 +252,7 @@ const ImgInner = ({ effects = [], ref, hidden, name, stack, showInTimeline, src,
252
252
  const canvasHeight = typeof height === 'number' ? height : undefined;
253
253
  const canvasProps = props;
254
254
  const canvasFit = (_a = getFitFromObjectFit(style)) !== null && _a !== void 0 ? _a : 'fill';
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 }));
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, trimBefore: trimBefore, 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 }));
256
256
  };
257
257
  /*
258
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.
@@ -6,7 +6,7 @@ type InteractiveHtmlTag = 'a' | 'article' | 'aside' | 'button' | 'code' | 'div'
6
6
  type InteractiveSvgTag = 'circle' | 'ellipse' | 'g' | 'line' | 'path' | 'rect' | 'svg' | 'text';
7
7
  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
- export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'>;
9
+ export type InteractiveBaseProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'trimBefore' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'>;
10
10
  export type InteractiveTransformProps = Pick<AbsoluteFillLayout, 'style'>;
11
11
  export type InteractivePremountProps = Pick<AbsoluteFillLayout, 'premountFor' | 'postmountFor' | 'styleWhilePremounted' | 'styleWhilePostmounted'>;
12
12
  type InteractiveSequenceProps = InteractiveBaseProps & {
@@ -35,6 +35,13 @@ export declare const Interactive: {
35
35
  readonly step: 1;
36
36
  readonly hiddenFromList: true;
37
37
  };
38
+ readonly trimBefore: {
39
+ readonly type: "number";
40
+ readonly default: 0;
41
+ readonly min: 0;
42
+ readonly step: 1;
43
+ readonly hiddenFromList: true;
44
+ };
38
45
  readonly freeze: {
39
46
  readonly type: "number";
40
47
  readonly default: null;
@@ -81,6 +88,77 @@ export declare const Interactive: {
81
88
  readonly hiddenFromList: false;
82
89
  };
83
90
  };
91
+ textSchema: {
92
+ readonly 'style.color': {
93
+ readonly type: "color";
94
+ readonly default: undefined;
95
+ readonly description: "Color";
96
+ };
97
+ readonly 'style.fontSize': {
98
+ readonly type: "number";
99
+ readonly default: undefined;
100
+ readonly min: 0;
101
+ readonly step: 1;
102
+ readonly description: "Font size";
103
+ readonly hiddenFromList: false;
104
+ };
105
+ readonly 'style.lineHeight': {
106
+ readonly type: "number";
107
+ readonly default: undefined;
108
+ readonly min: 0;
109
+ readonly step: 0.05;
110
+ readonly description: "Line height";
111
+ readonly hiddenFromList: false;
112
+ };
113
+ readonly 'style.fontWeight': {
114
+ readonly type: "enum";
115
+ readonly default: "400";
116
+ readonly description: "Font weight";
117
+ readonly variants: {
118
+ readonly '100': {};
119
+ readonly '200': {};
120
+ readonly '300': {};
121
+ readonly '400': {};
122
+ readonly '500': {};
123
+ readonly '600': {};
124
+ readonly '700': {};
125
+ readonly '800': {};
126
+ readonly '900': {};
127
+ readonly normal: {};
128
+ readonly bold: {};
129
+ };
130
+ };
131
+ readonly 'style.fontStyle': {
132
+ readonly type: "enum";
133
+ readonly default: "normal";
134
+ readonly description: "Font style";
135
+ readonly variants: {
136
+ readonly normal: {};
137
+ readonly italic: {};
138
+ readonly oblique: {};
139
+ };
140
+ };
141
+ readonly 'style.textAlign': {
142
+ readonly type: "enum";
143
+ readonly default: "left";
144
+ readonly description: "Text align";
145
+ readonly variants: {
146
+ readonly left: {};
147
+ readonly center: {};
148
+ readonly right: {};
149
+ readonly justify: {};
150
+ readonly start: {};
151
+ readonly end: {};
152
+ };
153
+ };
154
+ readonly 'style.letterSpacing': {
155
+ readonly type: "number";
156
+ readonly default: undefined;
157
+ readonly step: 0.1;
158
+ readonly description: "Letter spacing";
159
+ readonly hiddenFromList: false;
160
+ };
161
+ };
84
162
  premountSchema: {
85
163
  readonly premountFor: {
86
164
  readonly type: "number";
@@ -118,6 +196,13 @@ export declare const Interactive: {
118
196
  readonly step: 1;
119
197
  readonly hiddenFromList: true;
120
198
  };
199
+ readonly trimBefore: {
200
+ readonly type: "number";
201
+ readonly default: 0;
202
+ readonly min: 0;
203
+ readonly step: 1;
204
+ readonly hiddenFromList: true;
205
+ };
121
206
  readonly freeze: {
122
207
  readonly type: "number";
123
208
  readonly default: null;
@@ -43,6 +43,7 @@ const with_interactivity_schema_js_1 = require("./with-interactivity-schema.js")
43
43
  const interactiveElementSchema = {
44
44
  ...interactivity_schema_js_1.baseSchema,
45
45
  ...interactivity_schema_js_1.transformSchema,
46
+ ...interactivity_schema_js_1.textSchema,
46
47
  };
47
48
  const setRef = (ref, value) => {
48
49
  if (typeof ref === 'function') {
@@ -54,13 +55,13 @@ const setRef = (ref, value) => {
54
55
  };
55
56
  const makeInteractiveElement = (tag, displayName) => {
56
57
  const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
57
- const { durationInFrames, from, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
58
+ const { durationInFrames, from, trimBefore, freeze, hidden, name, showInTimeline, stack, controls, ...props } = propsWithControls;
58
59
  const refForOutline = (0, react_1.useRef)(null);
59
60
  const callbackRef = (0, react_1.useCallback)((element) => {
60
61
  refForOutline.current = element;
61
62
  setRef(ref, element);
62
63
  }, [ref]);
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, {
64
+ 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, {
64
65
  ...props,
65
66
  ref: callbackRef,
66
67
  }) }));
@@ -83,6 +84,7 @@ const makeInteractiveElement = (tag, displayName) => {
83
84
  exports.Interactive = {
84
85
  baseSchema: interactivity_schema_js_1.baseSchema,
85
86
  transformSchema: interactivity_schema_js_1.transformSchema,
87
+ textSchema: interactivity_schema_js_1.textSchema,
86
88
  premountSchema: interactivity_schema_js_1.premountSchema,
87
89
  sequenceSchema: interactivity_schema_js_1.sequenceSchema,
88
90
  withSchema: with_interactivity_schema_js_1.withInteractivitySchema,
@@ -19,6 +19,7 @@ export type SequencePropsWithoutDuration = {
19
19
  readonly width?: number;
20
20
  readonly height?: number;
21
21
  readonly from?: number;
22
+ readonly trimBefore?: number;
22
23
  readonly freeze?: number | null;
23
24
  readonly name?: string;
24
25
  readonly showInTimeline?: boolean;
@@ -19,7 +19,7 @@ const use_video_config_js_1 = require("./use-video-config.js");
19
19
  const v5_flag_js_1 = require("./v5-flag.js");
20
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, controls, _remotionInternalEffects, _remotionInternalLoopDisplay: loopDisplay, _remotionInternalStack: stack, _remotionInternalDocumentationLink: documentationLink, _remotionInternalPremountDisplay: premountDisplay, _remotionInternalPostmountDisplay: postmountDisplay, _remotionInternalIsMedia: isMedia, outlineRef: passedRefForOutline, ...other }, ref) => {
22
+ const RegularSequenceRefForwardingFunction = ({ from = 0, trimBefore = 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
23
  var _a, _b, _c;
24
24
  const { layout = 'absolute-fill' } = other;
25
25
  const [id] = (0, react_1.useState)(() => String(Math.random()));
@@ -28,7 +28,6 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
28
28
  const cumulatedFrom = parentSequence
29
29
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
30
30
  : 0;
31
- const absoluteFrom = ((_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.absoluteFrom) !== null && _a !== void 0 ? _a : 0) + from;
32
31
  const nonce = (0, nonce_js_1.useNonce)();
33
32
  if (layout !== 'absolute-fill' && layout !== 'none') {
34
33
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
@@ -51,6 +50,18 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
51
50
  if (!Number.isFinite(from)) {
52
51
  throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
53
52
  }
53
+ if (typeof trimBefore !== 'number') {
54
+ throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`);
55
+ }
56
+ if (trimBefore < 0) {
57
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`);
58
+ }
59
+ if (Number.isNaN(trimBefore)) {
60
+ throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');
61
+ }
62
+ if (!Number.isFinite(trimBefore)) {
63
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`);
64
+ }
54
65
  if (typeof freeze !== 'undefined' && freeze !== null) {
55
66
  if (typeof freeze !== 'number') {
56
67
  throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`);
@@ -64,8 +75,10 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
64
75
  }
65
76
  const absoluteFrame = (0, timeline_position_state_js_1.useTimelinePosition)();
66
77
  const videoConfig = (0, use_video_config_js_1.useVideoConfig)();
78
+ const effectiveRelativeFrom = from - trimBefore;
79
+ const absoluteFrom = ((_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.absoluteFrom) !== null && _a !== void 0 ? _a : 0) + effectiveRelativeFrom;
67
80
  const parentSequenceDuration = parentSequence
68
- ? Math.min(parentSequence.durationInFrames - from, durationInFrames)
81
+ ? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames)
69
82
  : durationInFrames;
70
83
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
71
84
  const { registerSequence, unregisterSequence } = (0, react_1.useContext)(SequenceManager_js_1.SequenceManager);
@@ -96,7 +109,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
96
109
  // 10-frame pre-roll, because the positive child offset cancels part of the
97
110
  // negative parent offset. But <Sequence from={10}><Sequence from={-5}>
98
111
  // should still trim 5 frames from the media once the parent starts.
99
- const currentSequenceStart = cumulatedFrom + from;
112
+ const currentSequenceStart = cumulatedFrom + effectiveRelativeFrom;
100
113
  const parentSequenceStart = parentSequence
101
114
  ? parentSequence.cumulatedFrom + parentSequence.relativeFrom
102
115
  : 0;
@@ -110,7 +123,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
110
123
  return {
111
124
  absoluteFrom,
112
125
  cumulatedFrom,
113
- relativeFrom: from,
126
+ relativeFrom: effectiveRelativeFrom,
114
127
  cumulatedNegativeFrom,
115
128
  durationInFrames: actualDurationInFrames,
116
129
  parentFrom: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.relativeFrom) !== null && _a !== void 0 ? _a : 0,
@@ -125,7 +138,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
125
138
  }, [
126
139
  cumulatedFrom,
127
140
  absoluteFrom,
128
- from,
141
+ effectiveRelativeFrom,
129
142
  actualDurationInFrames,
130
143
  parentSequence,
131
144
  id,
@@ -149,6 +162,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
149
162
  const stackRef = (0, react_1.useRef)(null);
150
163
  stackRef.current = stack !== null && stack !== void 0 ? stack : inheritedStack;
151
164
  const registeredFrozenFrame = typeof freeze === 'number' ? freeze : null;
165
+ const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
152
166
  const parentCumulatedNegativeFrom = (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.cumulatedNegativeFrom) !== null && _c !== void 0 ? _c : 0;
153
167
  const startMediaFrom = isMedia && isMedia.type !== 'image'
154
168
  ? isMedia.data.startMediaFrom +
@@ -182,6 +196,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
182
196
  documentationLink: resolvedDocumentationLink,
183
197
  duration: actualDurationInFrames,
184
198
  from,
199
+ trimBefore: registeredTrimBefore,
185
200
  id,
186
201
  loopDisplay,
187
202
  nonce: nonce.get(),
@@ -207,6 +222,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
207
222
  doesVolumeChange: isMedia.data.doesVolumeChange,
208
223
  duration: actualDurationInFrames,
209
224
  from,
225
+ trimBefore: registeredTrimBefore,
210
226
  id,
211
227
  loopDisplay,
212
228
  nonce: nonce.get(),
@@ -232,6 +248,7 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
232
248
  }
233
249
  registerSequence({
234
250
  from,
251
+ trimBefore: registeredTrimBefore,
235
252
  duration: actualDurationInFrames,
236
253
  id,
237
254
  displayName: timelineClipName,
@@ -265,6 +282,8 @@ const RegularSequenceRefForwardingFunction = ({ from = 0, freeze, durationInFram
265
282
  actualDurationInFrames,
266
283
  rootId,
267
284
  from,
285
+ trimBefore,
286
+ registeredTrimBefore,
268
287
  showInTimeline,
269
288
  nonce,
270
289
  loopDisplay,
@@ -66,7 +66,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
66
66
  throw new Error('typecheck error');
67
67
  }
68
68
  const [mediaVolume] = (0, volume_position_state_js_1.useMediaVolumeState)();
69
- const [mediaMuted] = (0, volume_position_state_js_1.useMediaMutedState)();
69
+ const [playerMuted] = (0, volume_position_state_js_1.usePlayerMutedState)();
70
70
  const volumePropFrame = (0, use_audio_frame_js_1.useFrameForVolumeProp)(loopVolumeCurveBehavior !== null && loopVolumeCurveBehavior !== void 0 ? loopVolumeCurveBehavior : 'repeat');
71
71
  if (!src) {
72
72
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
@@ -87,7 +87,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
87
87
  });
88
88
  const propsToPass = (0, react_2.useMemo)(() => {
89
89
  return {
90
- muted: muted || mediaMuted || userPreferredVolume <= 0,
90
+ muted: muted || playerMuted || userPreferredVolume <= 0,
91
91
  src: preloadedSrc,
92
92
  loop: _remotionInternalNativeLoopPassed,
93
93
  crossOrigin: crossOriginValue,
@@ -95,7 +95,7 @@ const AudioForDevelopmentForwardRefFunction = (props, ref) => {
95
95
  };
96
96
  }, [
97
97
  _remotionInternalNativeLoopPassed,
98
- mediaMuted,
98
+ playerMuted,
99
99
  muted,
100
100
  nativeProps,
101
101
  preloadedSrc,
@@ -22,13 +22,17 @@ const shared_audio_tags_js_1 = require("./shared-audio-tags.js");
22
22
  const AudioRefForwardingFunction = (props, ref) => {
23
23
  var _a, _b, _c;
24
24
  const audioTagsContext = (0, react_1.useContext)(shared_audio_tags_js_1.SharedAudioTagsContext);
25
- const { startFrom, endAt, trimBefore, trimAfter, name, stack, pauseWhenBuffering, showInTimeline, onError: onRemotionError, ...otherProps } = props;
26
- const { loop, ...propsOtherThanLoop } = props;
25
+ const propsWithFreeze = props;
26
+ const { startFrom, endAt, trimBefore, trimAfter, name, stack, pauseWhenBuffering, showInTimeline, onError: onRemotionError, freeze, ...otherProps } = propsWithFreeze;
27
+ const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
27
28
  const { fps } = (0, use_video_config_js_1.useVideoConfig)();
28
29
  const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
29
30
  if (environment.isClientSideRendering) {
30
31
  throw new Error('<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations');
31
32
  }
33
+ if (typeof freeze !== 'undefined') {
34
+ throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
35
+ }
32
36
  const { durations, setDurations } = (0, react_1.useContext)(duration_state_js_1.DurationsContext);
33
37
  if (typeof props.src !== 'string') {
34
38
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -49,6 +49,13 @@ export declare const canvasImageSchema: {
49
49
  readonly step: 1;
50
50
  readonly hiddenFromList: true;
51
51
  };
52
+ readonly trimBefore: {
53
+ readonly type: "number";
54
+ readonly default: 0;
55
+ readonly min: 0;
56
+ readonly step: 1;
57
+ readonly hiddenFromList: true;
58
+ };
52
59
  readonly freeze: {
53
60
  readonly type: "number";
54
61
  readonly default: null;