remotion 4.0.536 → 4.0.538

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 (172) hide show
  1. package/dist/cjs/AbsoluteFill.d.ts +62 -62
  2. package/dist/cjs/AbsoluteFill.js +3 -3
  3. package/dist/cjs/AbsoluteFillElement.d.ts +1 -1
  4. package/dist/cjs/AbsoluteFillElement.js +36 -3
  5. package/dist/cjs/CanUseRemotionHooks.js +1 -1
  6. package/dist/cjs/Composition.js +5 -11
  7. package/dist/cjs/CompositionErrorBoundary.js +5 -2
  8. package/dist/cjs/CompositionManager.d.ts +1 -0
  9. package/dist/cjs/CompositionManagerContext.d.ts +3 -0
  10. package/dist/cjs/CompositionManagerContext.js +5 -3
  11. package/dist/cjs/CompositionManagerProvider.d.ts +1 -1
  12. package/dist/cjs/CompositionManagerProvider.js +3 -1
  13. package/dist/cjs/CompositionRegistryProvider.d.ts +1 -1
  14. package/dist/cjs/CompositionRegistryProvider.js +1 -1
  15. package/dist/cjs/EditorProps.d.ts +2 -2
  16. package/dist/cjs/EditorProps.js +1 -1
  17. package/dist/cjs/Folder.js +1 -1
  18. package/dist/cjs/HtmlInCanvas.d.ts +58 -67
  19. package/dist/cjs/HtmlInCanvas.js +84 -20
  20. package/dist/cjs/HtmlInCanvasFallback.d.ts +6 -0
  21. package/dist/cjs/HtmlInCanvasFallback.js +39 -0
  22. package/dist/cjs/IFrame.d.ts +2 -2
  23. package/dist/cjs/IFrame.js +1 -1
  24. package/dist/cjs/Img.d.ts +62 -62
  25. package/dist/cjs/Img.js +160 -132
  26. package/dist/cjs/Interactive.d.ts +147 -145
  27. package/dist/cjs/Interactive.js +2 -2
  28. package/dist/cjs/RemotionRoot.js +1 -1
  29. package/dist/cjs/RenderAssetManager.js +1 -1
  30. package/dist/cjs/Sequence.js +37 -27
  31. package/dist/cjs/SequenceActivityBoundary.js +1 -1
  32. package/dist/cjs/SequenceActivityBudget.js +1 -1
  33. package/dist/cjs/SequenceActivitySuspensionProvider.js +1 -1
  34. package/dist/cjs/SequenceManager.d.ts +6 -0
  35. package/dist/cjs/SequenceManager.js +71 -27
  36. package/dist/cjs/SequenceRegistryProvider.js +16 -3
  37. package/dist/cjs/TimelineContext.js +1 -1
  38. package/dist/cjs/Track.js +2 -2
  39. package/dist/cjs/animated-image/AnimatedImage.d.ts +69 -69
  40. package/dist/cjs/animated-image/AnimatedImage.js +17 -12
  41. package/dist/cjs/animated-image/canvas.d.ts +6 -5
  42. package/dist/cjs/animated-image/canvas.js +1 -1
  43. package/dist/cjs/animated-image/create-image-decoder.d.ts +1 -1
  44. package/dist/cjs/animated-image/decode-image.d.ts +1 -1
  45. package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +1 -1
  46. package/dist/cjs/animated-image/index.js +1 -1
  47. package/dist/cjs/audio/AudioForPreview.js +5 -28
  48. package/dist/cjs/audio/AudioForRendering.d.ts +5 -20
  49. package/dist/cjs/audio/AudioForRendering.js +44 -5
  50. package/dist/cjs/audio/html5-audio.d.ts +36 -36
  51. package/dist/cjs/audio/html5-audio.js +8 -10
  52. package/dist/cjs/audio/index.js +1 -1
  53. package/dist/cjs/audio/shared-audio-tags.js +10 -16
  54. package/dist/cjs/audio/shared-element-source-node.d.ts +1 -1
  55. package/dist/cjs/audio/use-audio-context.d.ts +2 -1
  56. package/dist/cjs/audio/wait-until-actually-resumed.d.ts +2 -1
  57. package/dist/cjs/buffer-until-first-frame.d.ts +4 -3
  58. package/dist/cjs/buffering.js +1 -1
  59. package/dist/cjs/cancel-render.js +3 -0
  60. package/dist/cjs/canvas-image/CanvasImage.d.ts +71 -71
  61. package/dist/cjs/canvas-image/CanvasImage.js +27 -24
  62. package/dist/cjs/canvas-image/index.js +1 -1
  63. package/dist/cjs/codec.d.ts +1 -1
  64. package/dist/cjs/committed-metadata.d.ts +4 -2
  65. package/dist/cjs/composition-registry-fallback.d.ts +4 -2
  66. package/dist/cjs/composition-registry-fallback.js +12 -10
  67. package/dist/cjs/create-element-source-proxy.js +46 -6
  68. package/dist/cjs/default-css.d.ts +1 -1
  69. package/dist/cjs/delay-render.d.ts +2 -1
  70. package/dist/cjs/delay-render.js +4 -2
  71. package/dist/cjs/easing.js +3 -1
  72. package/dist/cjs/effects/Solid.d.ts +60 -60
  73. package/dist/cjs/effects/Solid.js +2 -2
  74. package/dist/cjs/effects/canvas-pool.js +6 -9
  75. package/dist/cjs/effects/index.js +1 -1
  76. package/dist/cjs/effects/use-memoized-effects.d.ts +2 -1
  77. package/dist/cjs/effects/use-memoized-effects.js +107 -54
  78. package/dist/cjs/freeze.js +2 -2
  79. package/dist/cjs/get-cross-origin-value.d.ts +1 -1
  80. package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
  81. package/dist/cjs/index.d.ts +3 -1
  82. package/dist/cjs/index.js +32 -32
  83. package/dist/cjs/interactivity-schema.d.ts +286 -286
  84. package/dist/cjs/internals.d.ts +411 -595
  85. package/dist/cjs/internals.js +8 -0
  86. package/dist/cjs/interpolate-colors.d.ts +1 -1
  87. package/dist/cjs/interpolate-colors.js +17 -16
  88. package/dist/cjs/interpolate.d.ts +2 -9
  89. package/dist/cjs/is-player.js +1 -1
  90. package/dist/cjs/loading-indicator.js +2 -6
  91. package/dist/cjs/log-level-context.d.ts +1 -1
  92. package/dist/cjs/log.d.ts +12 -7
  93. package/dist/cjs/loop/index.js +1 -1
  94. package/dist/cjs/media-resource-manager.d.ts +1 -1
  95. package/dist/cjs/media-tag-current-time-timestamp.d.ts +1 -1
  96. package/dist/cjs/no-react.d.ts +85 -91
  97. package/dist/cjs/no-react.js +2 -2
  98. package/dist/cjs/play-and-handle-not-allowed-error.d.ts +5 -4
  99. package/dist/cjs/playback-logging.d.ts +2 -1
  100. package/dist/cjs/playback-pitch-context.d.ts +1 -0
  101. package/dist/cjs/playback-pitch-context.js +5 -0
  102. package/dist/cjs/prefetch-state.js +1 -1
  103. package/dist/cjs/prefetch.d.ts +7 -6
  104. package/dist/cjs/props-if-has-props.d.ts +2 -1
  105. package/dist/cjs/prores-profile.d.ts +1 -1
  106. package/dist/cjs/register-root.d.ts +2 -2
  107. package/dist/cjs/render-resource-manager.d.ts +1 -1
  108. package/dist/cjs/render-types.d.ts +2 -2
  109. package/dist/cjs/resolve-video-config.d.ts +8 -8
  110. package/dist/cjs/runtime-value-store.d.ts +1 -1
  111. package/dist/cjs/scale-value.d.ts +1 -1
  112. package/dist/cjs/seek.d.ts +3 -2
  113. package/dist/cjs/sequence-activity-context.js +1 -1
  114. package/dist/cjs/sequence-crop.js +1 -4
  115. package/dist/cjs/series/flatten-children.d.ts +3 -1
  116. package/dist/cjs/series/index.js +4 -5
  117. package/dist/cjs/series/is-inside-series.js +2 -2
  118. package/dist/cjs/spring/index.d.ts +1 -1
  119. package/dist/cjs/spring/index.js +1 -1
  120. package/dist/cjs/spring/measure-spring.d.ts +1 -1
  121. package/dist/cjs/spring/spring-utils.d.ts +1 -1
  122. package/dist/cjs/spring/spring-utils.js +11 -5
  123. package/dist/cjs/timeline-position-state.d.ts +2 -1
  124. package/dist/cjs/timeline-position-state.js +23 -3
  125. package/dist/cjs/use-amplification.d.ts +4 -7
  126. package/dist/cjs/use-current-frame.d.ts +1 -0
  127. package/dist/cjs/use-current-frame.js +14 -7
  128. package/dist/cjs/use-current-scale.d.ts +2 -2
  129. package/dist/cjs/use-delay-render.d.ts +2 -1
  130. package/dist/cjs/use-lazy-component.d.ts +1 -1
  131. package/dist/cjs/use-lazy-component.js +15 -5
  132. package/dist/cjs/use-media-buffering.d.ts +3 -2
  133. package/dist/cjs/use-media-duration.d.ts +4 -0
  134. package/dist/cjs/use-media-duration.js +36 -0
  135. package/dist/cjs/use-media-enabled.d.ts +1 -1
  136. package/dist/cjs/use-media-enabled.js +1 -1
  137. package/dist/cjs/use-media-in-timeline.d.ts +1 -1
  138. package/dist/cjs/use-media-playback.d.ts +3 -3
  139. package/dist/cjs/use-media-tag.d.ts +2 -2
  140. package/dist/cjs/use-pixel-density.d.ts +1 -1
  141. package/dist/cjs/use-premounting.d.ts +1 -1
  142. package/dist/cjs/use-premounting.js +6 -2
  143. package/dist/cjs/use-request-video-callback-time.d.ts +3 -3
  144. package/dist/cjs/use-schema.d.ts +4 -4
  145. package/dist/cjs/use-video.js +1 -1
  146. package/dist/cjs/validate-media-props.d.ts +1 -1
  147. package/dist/cjs/validation/validate-default-props.d.ts +1 -1
  148. package/dist/cjs/validation/validate-duration-in-frames.js +3 -3
  149. package/dist/cjs/version.d.ts +1 -1
  150. package/dist/cjs/version.js +1 -1
  151. package/dist/cjs/video/MediaPlaybackError.js +0 -1
  152. package/dist/cjs/video/OffthreadVideo.js +5 -5
  153. package/dist/cjs/video/OffthreadVideoForRendering.js +9 -7
  154. package/dist/cjs/video/VideoForPreview.js +6 -28
  155. package/dist/cjs/video/VideoForRendering.d.ts +5 -3
  156. package/dist/cjs/video/VideoForRendering.js +4 -2
  157. package/dist/cjs/video/duration-state.d.ts +1 -0
  158. package/dist/cjs/video/duration-state.js +8 -2
  159. package/dist/cjs/video/emit-video-frame.d.ts +1 -1
  160. package/dist/cjs/video/html5-video.d.ts +36 -36
  161. package/dist/cjs/video/html5-video.js +8 -10
  162. package/dist/cjs/video/index.js +2 -2
  163. package/dist/cjs/video/seek-until-right.d.ts +3 -2
  164. package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -1
  165. package/dist/cjs/with-interactivity-schema.d.ts +1 -1
  166. package/dist/cjs/with-interactivity-schema.js +15 -18
  167. package/dist/cjs/wrap-remotion-context.d.ts +4 -4
  168. package/dist/cjs/wrap-remotion-context.js +2 -2
  169. package/dist/esm/index.mjs +1060 -728
  170. package/dist/esm/no-react.mjs +30 -25
  171. package/dist/esm/version.mjs +1 -1
  172. package/package.json +4 -4
@@ -91,55 +91,57 @@ export type HtmlInCanvasProps = Omit<InteractiveBaseProps, 'children'> & Interac
91
91
  readonly onInit?: HtmlInCanvasOnInit;
92
92
  readonly pixelDensity?: HtmlInCanvasPixelDensity;
93
93
  readonly _remotionInternalCanvasSiblings?: React.ReactNode;
94
+ readonly _remotionInternalFallbackLabel?: string;
94
95
  };
96
+ export declare const useHtmlInCanvasUnsupportedMessage: () => string | null;
95
97
  export declare const htmlInCanvasSchema: {
96
98
  readonly 'style.transformOrigin': {
97
- readonly type: "transform-origin";
99
+ readonly type: 'transform-origin';
98
100
  readonly step: 1;
99
- readonly default: "50% 50%";
100
- readonly description: "Transform origin";
101
+ readonly default: '50% 50%';
102
+ readonly description: 'Transform origin';
101
103
  };
102
104
  readonly 'style.translate': {
103
- readonly type: "translate";
105
+ readonly type: 'translate';
104
106
  readonly step: 1;
105
- readonly default: "0px 0px";
106
- readonly description: "Offset";
107
+ readonly default: '0px 0px';
108
+ readonly description: 'Offset';
107
109
  };
108
110
  readonly 'style.scale': {
109
- readonly type: "scale";
111
+ readonly type: 'scale';
110
112
  readonly max: 100;
111
113
  readonly step: 0.01;
112
114
  readonly default: 1;
113
- readonly description: "Scale";
114
- readonly defaultKeyframeOutput: "perceptual-scale";
115
+ readonly description: 'Scale';
116
+ readonly defaultKeyframeOutput: 'perceptual-scale';
115
117
  };
116
118
  readonly 'style.rotate': {
117
- readonly type: "rotation-css";
119
+ readonly type: 'rotation-css';
118
120
  readonly step: 1;
119
- readonly default: "0deg";
120
- readonly description: "Rotation";
121
+ readonly default: '0deg';
122
+ readonly description: 'Rotation';
121
123
  };
122
124
  readonly 'style.opacity': {
123
- readonly type: "number";
125
+ readonly type: 'number';
124
126
  readonly min: 0;
125
127
  readonly max: 1;
126
128
  readonly step: 0.01;
127
129
  readonly default: 1;
128
- readonly description: "Opacity";
130
+ readonly description: 'Opacity';
129
131
  readonly hiddenFromList: false;
130
132
  };
131
133
  readonly 'style.borderWidth': {
132
- readonly type: "number";
134
+ readonly type: 'number';
133
135
  readonly default: undefined;
134
136
  readonly min: 0;
135
137
  readonly step: 1;
136
- readonly description: "Border width";
138
+ readonly description: 'Border width';
137
139
  readonly hiddenFromList: false;
138
140
  };
139
141
  readonly 'style.borderStyle': {
140
- readonly type: "enum";
141
- readonly default: "none";
142
- readonly description: "Border style";
142
+ readonly type: 'enum';
143
+ readonly default: 'none';
144
+ readonly description: 'Border style';
143
145
  readonly variants: {
144
146
  readonly none: {};
145
147
  readonly hidden: {};
@@ -154,67 +156,67 @@ export declare const htmlInCanvasSchema: {
154
156
  };
155
157
  };
156
158
  readonly 'style.borderColor': {
157
- readonly type: "color";
159
+ readonly type: 'color';
158
160
  readonly default: undefined;
159
- readonly description: "Border color";
161
+ readonly description: 'Border color';
160
162
  };
161
163
  readonly 'style.borderRadius': {
162
- readonly type: "number";
164
+ readonly type: 'number';
163
165
  readonly default: 0;
164
166
  readonly min: 0;
165
167
  readonly step: 1;
166
- readonly description: "Border radius";
168
+ readonly description: 'Border radius';
167
169
  readonly hiddenFromList: false;
168
170
  readonly keyframable: true;
169
171
  };
170
172
  readonly 'style.borderTopLeftRadius': {
171
- readonly type: "number";
173
+ readonly type: 'number';
172
174
  readonly default: 0;
173
175
  readonly min: 0;
174
176
  readonly step: 1;
175
- readonly description: "Top left radius";
177
+ readonly description: 'Top left radius';
176
178
  readonly hiddenFromList: false;
177
179
  };
178
180
  readonly 'style.borderTopRightRadius': {
179
- readonly type: "number";
181
+ readonly type: 'number';
180
182
  readonly default: 0;
181
183
  readonly min: 0;
182
184
  readonly step: 1;
183
- readonly description: "Top right radius";
185
+ readonly description: 'Top right radius';
184
186
  readonly hiddenFromList: false;
185
187
  };
186
188
  readonly 'style.borderBottomRightRadius': {
187
- readonly type: "number";
189
+ readonly type: 'number';
188
190
  readonly default: 0;
189
191
  readonly min: 0;
190
192
  readonly step: 1;
191
- readonly description: "Bottom right radius";
193
+ readonly description: 'Bottom right radius';
192
194
  readonly hiddenFromList: false;
193
195
  };
194
196
  readonly 'style.borderBottomLeftRadius': {
195
- readonly type: "number";
197
+ readonly type: 'number';
196
198
  readonly default: 0;
197
199
  readonly min: 0;
198
200
  readonly step: 1;
199
- readonly description: "Bottom left radius";
201
+ readonly description: 'Bottom left radius';
200
202
  readonly hiddenFromList: false;
201
203
  };
202
204
  readonly 'style.backgroundColor': {
203
- readonly type: "color";
204
- readonly default: "transparent";
205
- readonly description: "Color";
205
+ readonly type: 'color';
206
+ readonly default: 'transparent';
207
+ readonly description: 'Color';
206
208
  };
207
209
  readonly premountFor: {
208
- readonly type: "number";
210
+ readonly type: 'number';
209
211
  readonly default: undefined;
210
- readonly description: "Premount For";
212
+ readonly description: 'Premount For';
211
213
  readonly min: 0;
212
214
  readonly step: 1;
213
215
  readonly hiddenFromList: false;
214
216
  readonly keyframable: false;
215
217
  };
216
218
  readonly postmountFor: {
217
- readonly type: "number";
219
+ readonly type: 'number';
218
220
  readonly default: 0;
219
221
  readonly min: 0;
220
222
  readonly step: 1;
@@ -222,9 +224,9 @@ export declare const htmlInCanvasSchema: {
222
224
  readonly keyframable: false;
223
225
  };
224
226
  readonly cropLeft: {
225
- readonly type: "number";
227
+ readonly type: 'number';
226
228
  readonly default: 0;
227
- readonly description: "Crop left";
229
+ readonly description: 'Crop left';
228
230
  readonly min: 0;
229
231
  readonly max: 1;
230
232
  readonly step: 0.01;
@@ -232,9 +234,9 @@ export declare const htmlInCanvasSchema: {
232
234
  readonly keyframable: true;
233
235
  };
234
236
  readonly cropRight: {
235
- readonly type: "number";
237
+ readonly type: 'number';
236
238
  readonly default: 0;
237
- readonly description: "Crop right";
239
+ readonly description: 'Crop right';
238
240
  readonly min: 0;
239
241
  readonly max: 1;
240
242
  readonly step: 0.01;
@@ -242,9 +244,9 @@ export declare const htmlInCanvasSchema: {
242
244
  readonly keyframable: true;
243
245
  };
244
246
  readonly cropTop: {
245
- readonly type: "number";
247
+ readonly type: 'number';
246
248
  readonly default: 0;
247
- readonly description: "Crop top";
249
+ readonly description: 'Crop top';
248
250
  readonly min: 0;
249
251
  readonly max: 1;
250
252
  readonly step: 0.01;
@@ -252,9 +254,9 @@ export declare const htmlInCanvasSchema: {
252
254
  readonly keyframable: true;
253
255
  };
254
256
  readonly cropBottom: {
255
- readonly type: "number";
257
+ readonly type: 'number';
256
258
  readonly default: 0;
257
- readonly description: "Crop bottom";
259
+ readonly description: 'Crop bottom';
258
260
  readonly min: 0;
259
261
  readonly max: 1;
260
262
  readonly step: 0.01;
@@ -262,36 +264,36 @@ export declare const htmlInCanvasSchema: {
262
264
  readonly keyframable: true;
263
265
  };
264
266
  readonly durationInFrames: {
265
- readonly type: "number";
267
+ readonly type: 'number';
266
268
  readonly default: undefined;
267
269
  readonly min: 1;
268
270
  readonly step: 1;
269
271
  readonly hiddenFromList: true;
270
272
  };
271
273
  readonly from: {
272
- readonly type: "number";
274
+ readonly type: 'number';
273
275
  readonly default: 0;
274
276
  readonly step: 1;
275
277
  readonly hiddenFromList: true;
276
278
  };
277
279
  readonly trimBefore: {
278
- readonly type: "number";
280
+ readonly type: 'number';
279
281
  readonly default: 0;
280
282
  readonly min: 0;
281
283
  readonly step: 1;
282
284
  readonly hiddenFromList: true;
283
285
  };
284
286
  readonly playbackRate: {
285
- readonly type: "number";
287
+ readonly type: 'number';
286
288
  readonly default: 1;
287
289
  readonly min: 0.01;
288
290
  readonly step: 0.1;
289
- readonly description: "Playback rate";
291
+ readonly description: 'Playback rate';
290
292
  readonly hiddenFromList: false;
291
293
  readonly keyframable: false;
292
294
  };
293
295
  readonly freeze: {
294
- readonly type: "number";
296
+ readonly type: 'number';
295
297
  readonly default: null;
296
298
  readonly step: 1;
297
299
  readonly hiddenFromList: true;
@@ -300,27 +302,16 @@ export declare const htmlInCanvasSchema: {
300
302
  readonly name: import("./interactivity-schema.js").HiddenFieldSchema;
301
303
  readonly showInTimeline: import("./interactivity-schema.js").HiddenFieldSchema;
302
304
  readonly pixelDensity: {
303
- readonly type: "number";
305
+ readonly type: 'number';
304
306
  readonly min: 1;
305
307
  readonly max: 3;
306
308
  readonly step: 0.1;
307
309
  readonly default: 1;
308
- readonly description: "Pixel density";
310
+ readonly description: 'Pixel density';
309
311
  readonly hiddenFromList: false;
310
312
  };
311
313
  };
312
- export declare const HtmlInCanvas: React.ForwardRefExoticComponent<Omit<InteractiveBaseProps, "children"> & InteractiveCropProps & Omit<AbsoluteFillLayout, "layout"> & {
313
- readonly durationInFrames?: number | undefined;
314
- readonly width: number;
315
- readonly height: number;
316
- readonly effects?: EffectsProp | undefined;
317
- readonly effectsOutputSize?: EffectsOutputSize | undefined;
318
- readonly children: React.ReactNode;
319
- readonly onPaint?: HtmlInCanvasOnPaint | undefined;
320
- readonly onInit?: HtmlInCanvasOnInit | undefined;
321
- readonly pixelDensity?: number | undefined;
322
- readonly _remotionInternalCanvasSiblings?: React.ReactNode;
323
- } & React.RefAttributes<HTMLCanvasElement>> & {
324
- readonly isSupported: () => boolean;
325
- readonly isNestingSupported: () => boolean;
314
+ export declare const HtmlInCanvas: React.ForwardRefExoticComponent<HtmlInCanvasProps & React.RefAttributes<HTMLCanvasElement>> & {
315
+ readonly isSupported: typeof isHtmlInCanvasSupported;
316
+ readonly isNestingSupported: typeof isHtmlInCanvasNestingSupported;
326
317
  };
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HtmlInCanvas = exports.htmlInCanvasSchema = exports.getHtmlInCanvasUnsupportedMessage = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasNestingSupported = exports.isHtmlInCanvasSupported = void 0;
3
+ exports.HtmlInCanvas = exports.htmlInCanvasSchema = exports.useHtmlInCanvasUnsupportedMessage = exports.getHtmlInCanvasUnsupportedMessage = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.isHtmlInCanvasNestingSupported = exports.isHtmlInCanvasSupported = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const DefaultPremountContext_js_1 = require("./DefaultPremountContext.js");
6
7
  const run_effect_chain_js_1 = require("./effects/run-effect-chain.js");
7
8
  const use_effect_chain_state_js_1 = require("./effects/use-effect-chain-state.js");
8
9
  const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
9
10
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
10
11
  const freeze_js_1 = require("./freeze.js");
12
+ const HtmlInCanvasFallback_js_1 = require("./HtmlInCanvasFallback.js");
11
13
  const interactivity_schema_js_1 = require("./interactivity-schema.js");
12
14
  const resolve_sequence_duration_js_1 = require("./resolve-sequence-duration.js");
13
15
  const Sequence_js_1 = require("./Sequence.js");
@@ -146,6 +148,17 @@ const defaultOnPaint = ({ canvas, elementImage, }) => {
146
148
  ctx.drawElementImage(elementImage, 0, 0);
147
149
  };
148
150
  const HtmlInCanvasAncestorContext = (0, react_1.createContext)(null);
151
+ const useHtmlInCanvasUnsupportedMessage = () => {
152
+ const ancestorPaintState = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
153
+ if (!(0, exports.isHtmlInCanvasSupported)()) {
154
+ return (0, exports.getHtmlInCanvasUnsupportedMessage)();
155
+ }
156
+ if (ancestorPaintState && !(0, exports.isHtmlInCanvasNestingSupported)()) {
157
+ return `Nested <HtmlInCanvas> components require Chrome ${MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS} or newer with HTML-in-canvas enabled.`;
158
+ }
159
+ return null;
160
+ };
161
+ exports.useHtmlInCanvasUnsupportedMessage = useHtmlInCanvasUnsupportedMessage;
149
162
  const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, effectsOutputSize, children, canvasSiblings, onPaint, onInit, pixelDensity, controls, style, renderFrame, }, ref) => {
150
163
  var _a, _b;
151
164
  const ancestorPaintState = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
@@ -160,11 +173,15 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
160
173
  const { isClientSideRendering, isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
161
174
  const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
162
175
  const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
163
- const paintTargetMode = usesDirectLayoutCanvas
164
- ? 'direct'
165
- : isRendering
166
- ? 'copied'
167
- : 'transferred';
176
+ // Keep a nested drawable canvas separate from the bitmap captured by its
177
+ // parent. Reusing it for both can crash Chromium during raster invalidation.
178
+ const paintTargetMode = ancestorPaintState
179
+ ? 'copied'
180
+ : usesDirectLayoutCanvas
181
+ ? 'direct'
182
+ : isRendering
183
+ ? 'copied'
184
+ : 'transferred';
168
185
  if (!(0, exports.isHtmlInCanvasSupported)()) {
169
186
  cancelRender(new Error((0, exports.getHtmlInCanvasUnsupportedMessage)()));
170
187
  }
@@ -237,9 +254,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
237
254
  const initializedRef = (0, react_1.useRef)(false);
238
255
  const onInitCleanupRef = (0, react_1.useRef)(null);
239
256
  const unmountedRef = (0, react_1.useRef)(false);
257
+ const effectScratchCanvasesRef = (0, react_1.useRef)(null);
240
258
  const paintingTargets = (0, react_1.useRef)(new WeakMap());
241
259
  const onPaintCb = (0, react_1.useCallback)(async () => {
242
260
  var _a, _b;
261
+ var _c;
243
262
  if (isRendering && paintState.pendingChildren > 0) {
244
263
  return;
245
264
  }
@@ -351,6 +370,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
351
370
  }
352
371
  throw error;
353
372
  }
373
+ let effectSourceCanvas = null;
354
374
  try {
355
375
  const currentOnPaint = onPaintRef.current;
356
376
  if (currentOnPaint) {
@@ -367,6 +387,48 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
367
387
  await paintResult;
368
388
  }
369
389
  }
390
+ else if (paintTarget instanceof HTMLCanvasElement &&
391
+ effectsRef.current.some((effect) => !effect.params.disabled)) {
392
+ // The element image can only be drawn into the visible layout
393
+ // canvas, but effects finish asynchronously (e.g. while the
394
+ // WebGPU device initializes). Move the unprocessed pixels to a
395
+ // scratch canvas and restore the previous output within this task,
396
+ // so the browser never presents the HTML without its effects.
397
+ (_c = effectScratchCanvasesRef.current) !== null && _c !== void 0 ? _c : (effectScratchCanvasesRef.current = {
398
+ source: document.createElement('canvas'),
399
+ previousOutput: document.createElement('canvas'),
400
+ });
401
+ const { source: effectSource, previousOutput } = effectScratchCanvasesRef.current;
402
+ resizePaintTarget({
403
+ target: effectSource,
404
+ width: canvasWidth,
405
+ height: canvasHeight,
406
+ });
407
+ resizePaintTarget({
408
+ target: previousOutput,
409
+ width: canvasWidth,
410
+ height: canvasHeight,
411
+ });
412
+ const effectSourceCtx = effectSource.getContext('2d');
413
+ const previousOutputCtx = previousOutput.getContext('2d');
414
+ const paintTargetCtx = paintTarget.getContext('2d');
415
+ if (!effectSourceCtx || !previousOutputCtx || !paintTargetCtx) {
416
+ throw new Error('Failed to acquire 2D context for <HtmlInCanvas> canvas');
417
+ }
418
+ previousOutputCtx.reset();
419
+ previousOutputCtx.drawImage(paintTarget, 0, 0);
420
+ defaultOnPaint({
421
+ canvas: paintTarget,
422
+ element,
423
+ elementImage: elImage,
424
+ pixelDensity: resolvedPixelDensity,
425
+ });
426
+ effectSourceCtx.reset();
427
+ effectSourceCtx.drawImage(paintTarget, 0, 0);
428
+ paintTargetCtx.reset();
429
+ paintTargetCtx.drawImage(previousOutput, 0, 0);
430
+ effectSourceCanvas = effectSource;
431
+ }
370
432
  else {
371
433
  defaultOnPaint({
372
434
  canvas: paintTarget,
@@ -380,7 +442,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
380
442
  if (state) {
381
443
  await (0, run_effect_chain_js_1.runEffectChain)({
382
444
  state,
383
- source: paintTarget,
445
+ source: effectSourceCanvas !== null && effectSourceCanvas !== void 0 ? effectSourceCanvas : paintTarget,
384
446
  effects: effectsRef.current,
385
447
  output: paintTarget,
386
448
  width: canvasWidth,
@@ -445,10 +507,11 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
445
507
  paintState.release = null;
446
508
  };
447
509
  }, [paintState]);
448
- // Default paint handlers draw synchronously on the layout canvas itself.
449
- // ElementImage can only be drawn into its associated canvas, so custom
450
- // handlers retain a transferred target. Rendering copies it to a separate
451
- // visible canvas without waiting for the transferred canvas to present.
510
+ // Non-nested default handlers paint directly on the layout canvas. Nested
511
+ // canvases and custom handlers retain a transferred target because an
512
+ // ElementImage can only be drawn into its associated canvas. Nested canvases
513
+ // and rendering copy it to a separate visible canvas without waiting for
514
+ // the transferred canvas to present.
452
515
  (0, react_1.useLayoutEffect)(() => {
453
516
  var _a;
454
517
  const placeholder = canvas2dRef.current;
@@ -538,8 +601,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
538
601
  ...(style !== null && style !== void 0 ? style : {}),
539
602
  };
540
603
  }, [height, style, width]);
541
- return (jsx_runtime_1.jsxs(HtmlInCanvasAncestorContext.Provider, { value: paintState, children: [
542
- jsx_runtime_1.jsxs("canvas", { ref: paintTargetMode === 'copied' ? canvas2dRef : setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: paintTargetMode === 'copied'
604
+ return ((0, jsx_runtime_1.jsxs)(HtmlInCanvasAncestorContext.Provider, { value: paintState, children: [(0, jsx_runtime_1.jsx)("canvas", { ref: paintTargetMode === 'copied' ? canvas2dRef : setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: paintTargetMode === 'copied'
543
605
  ? {
544
606
  ...canvasStyle,
545
607
  position: 'absolute',
@@ -548,22 +610,24 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
548
610
  visibility: 'hidden',
549
611
  pointerEvents: 'none',
550
612
  }
551
- : canvasStyle, children: [
552
- jsx_runtime_1.jsx("div", { ref: divRef, style: paintTargetMode === 'copied'
553
- ? { ...innerStyle, visibility: 'visible' }
554
- : innerStyle, children: children }), canvasSiblings] }, canvasSizeKey), paintTargetMode === 'copied' ? (jsx_runtime_1.jsx("canvas", { ref: setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle }, `output-${canvasSizeKey}`)) : null] }));
613
+ : canvasStyle, children: (0, jsx_runtime_1.jsxs)(DefaultPremountContext_js_1.DefaultPremountContext.Provider, { value: 0, children: [(0, jsx_runtime_1.jsx)("div", { ref: divRef, style: paintTargetMode === 'copied'
614
+ ? { ...innerStyle, visibility: 'visible' }
615
+ : innerStyle, children: children }), canvasSiblings] }) }, canvasSizeKey), paintTargetMode === 'copied' ? ((0, jsx_runtime_1.jsx)("canvas", { ref: setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle }, `output-${canvasSizeKey}`)) : null] }));
555
616
  });
556
617
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
557
618
  // Subscribe to frame changes only while rendering. Preview keeps relying on
558
619
  // the browser's paints and does not need a capture barrier on every frame.
559
620
  const HtmlInCanvasContentForRendering = (0, react_1.forwardRef)((props, ref) => {
560
621
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
561
- return jsx_runtime_1.jsx(HtmlInCanvasContent, { ...props, ref: ref, renderFrame: frame });
622
+ return (0, jsx_runtime_1.jsx)(HtmlInCanvasContent, { ...props, ref: ref, renderFrame: frame });
562
623
  });
563
624
  HtmlInCanvasContentForRendering.displayName = 'HtmlInCanvasContentForRendering';
564
- const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], effectsOutputSize, children, onPaint, onInit, pixelDensity, _remotionInternalCanvasSiblings, controls, style, cropLeft, cropRight, cropTop, cropBottom, durationInFrames, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, name, ...sequenceProps }, ref) => {
625
+ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = [], effectsOutputSize, children, onPaint, onInit, pixelDensity, _remotionInternalCanvasSiblings, _remotionInternalFallbackLabel = 'Effects are not visible', controls, style, cropLeft, cropRight, cropTop, cropBottom, durationInFrames, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, name, ...sequenceProps }, ref) => {
565
626
  var _a;
566
627
  const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
628
+ const unsupportedMessage = (0, exports.useHtmlInCanvasUnsupportedMessage)();
629
+ assertHtmlInCanvasDimensions(width, height);
630
+ resolveHtmlInCanvasPixelDensity(pixelDensity);
567
631
  const Content = isRendering
568
632
  ? HtmlInCanvasContentForRendering
569
633
  : HtmlInCanvasContent;
@@ -600,7 +664,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
600
664
  style: premountingStyle,
601
665
  componentName: '<HtmlInCanvas />',
602
666
  });
603
- return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(Content, { ref: setCanvasRef, renderFrame: null, width: width, height: height, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, canvasSiblings: _remotionInternalCanvasSiblings !== null && _remotionInternalCanvasSiblings !== void 0 ? _remotionInternalCanvasSiblings : null, controls: controls, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, children: children }) }) }));
667
+ return ((0, jsx_runtime_1.jsx)(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { layout: "none", durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<HtmlInCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas", controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...sequenceProps, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: !isRendering && unsupportedMessage !== null ? ((0, jsx_runtime_1.jsx)(HtmlInCanvasFallback_js_1.HtmlInCanvasFallback, { style: { width, height, ...croppedStyle }, label: _remotionInternalFallbackLabel, children: (0, jsx_runtime_1.jsx)(DefaultPremountContext_js_1.DefaultPremountContext.Provider, { value: 0, children: (0, jsx_runtime_1.jsx)("div", { style: { width, height }, children: children }) }) })) : ((0, jsx_runtime_1.jsx)(Content, { ref: setCanvasRef, renderFrame: null, width: width, height: height, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, onPaint: onPaint, onInit: onInit, pixelDensity: pixelDensity, canvasSiblings: _remotionInternalCanvasSiblings !== null && _remotionInternalCanvasSiblings !== void 0 ? _remotionInternalCanvasSiblings : null, controls: controls, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, children: children })) }) }));
604
668
  });
605
669
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
606
670
  exports.htmlInCanvasSchema = {
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const HtmlInCanvasFallback: React.FC<{
3
+ readonly children: React.ReactNode;
4
+ readonly style: React.CSSProperties;
5
+ readonly label: string;
6
+ }>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HtmlInCanvasFallback = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const use_current_scale_js_1 = require("./use-current-scale.js");
6
+ const HtmlInCanvasFallback = ({ children, style, label }) => {
7
+ const currentScale = (0, use_current_scale_js_1.useCurrentScale)({ dontThrowIfOutsideOfRemotion: true });
8
+ const scale = currentScale > 0 ? currentScale : 1;
9
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', ...style }, children: [children, (0, jsx_runtime_1.jsxs)("div", { className: "css-reset", style: {
10
+ position: 'absolute',
11
+ top: 8 / scale,
12
+ right: 8 / scale,
13
+ zIndex: 1000,
14
+ // Cancel the preview zoom while keeping the badge inside its component.
15
+ transform: `scale(${1 / scale})`,
16
+ transformOrigin: 'top right',
17
+ maxWidth: `calc(${scale * 100}% - 16px)`,
18
+ padding: '8px 10px',
19
+ borderRadius: 6,
20
+ border: '1px solid #7f3540',
21
+ backgroundColor: '#2b171c',
22
+ boxShadow: '0 2px 8px #0003',
23
+ pointerEvents: 'none',
24
+ textAlign: 'left',
25
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
26
+ fontFamily: 'Arial, Helvetica, sans-serif',
27
+ fontSize: 12,
28
+ fontWeight: 600,
29
+ lineHeight: 1.5,
30
+ color: '#ffabb5',
31
+ }, children: "HTML-in-canvas is not available" }), (0, jsx_runtime_1.jsx)("div", { style: {
32
+ fontFamily: 'Arial, Helvetica, sans-serif',
33
+ fontSize: 11,
34
+ fontWeight: 400,
35
+ lineHeight: 1.5,
36
+ color: '#e8bdc3',
37
+ }, children: label })] })] }));
38
+ };
39
+ exports.HtmlInCanvasFallback = HtmlInCanvasFallback;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  export declare const IFrame: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLIFrameElement> & React.IframeHTMLAttributes<HTMLIFrameElement> & {
3
- readonly delayRenderRetries?: number | undefined;
4
- readonly delayRenderTimeoutInMilliseconds?: number | undefined;
3
+ readonly delayRenderRetries?: number;
4
+ readonly delayRenderTimeoutInMilliseconds?: number;
5
5
  }, "ref"> & React.RefAttributes<HTMLIFrameElement>>;
@@ -56,7 +56,7 @@ const IFrameRefForwarding = ({ onLoad, onError, delayRenderRetries, delayRenderT
56
56
  console.error('Error loading iframe:', e, 'Handle the event using the onError() prop to make this message disappear.');
57
57
  }
58
58
  }, [onError, continueRender, src, srcDoc]);
59
- return (jsx_runtime_1.jsx("iframe", { referrerPolicy: "strict-origin-when-cross-origin", ...props, ref: ref, onError: didGetError, onLoad: didLoad }));
59
+ return ((0, jsx_runtime_1.jsx)("iframe", { referrerPolicy: "strict-origin-when-cross-origin", ...props, ref: ref, onError: didGetError, onLoad: didLoad }));
60
60
  };
61
61
  /*
62
62
  * @description The <IFrame /> can be used like a regular <iframe> HTML tag.