remotion 4.0.537 → 4.0.539

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 (179) 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 +43 -5
  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/CompositionManagerProvider.d.ts +1 -1
  10. package/dist/cjs/CompositionManagerProvider.js +1 -1
  11. package/dist/cjs/CompositionRegistryProvider.d.ts +1 -1
  12. package/dist/cjs/CompositionRegistryProvider.js +1 -1
  13. package/dist/cjs/EditorProps.d.ts +2 -2
  14. package/dist/cjs/EditorProps.js +1 -1
  15. package/dist/cjs/Folder.js +1 -1
  16. package/dist/cjs/HtmlInCanvas.d.ts +58 -67
  17. package/dist/cjs/HtmlInCanvas.js +22 -9
  18. package/dist/cjs/HtmlInCanvasFallback.d.ts +6 -0
  19. package/dist/cjs/HtmlInCanvasFallback.js +39 -0
  20. package/dist/cjs/IFrame.d.ts +2 -2
  21. package/dist/cjs/IFrame.js +1 -1
  22. package/dist/cjs/Img.d.ts +62 -62
  23. package/dist/cjs/Img.js +160 -132
  24. package/dist/cjs/Interactive.d.ts +147 -145
  25. package/dist/cjs/Interactive.js +2 -2
  26. package/dist/cjs/RemotionRoot.js +1 -1
  27. package/dist/cjs/RenderAssetManager.js +1 -1
  28. package/dist/cjs/Sequence.js +37 -27
  29. package/dist/cjs/SequenceActivityBoundary.js +1 -1
  30. package/dist/cjs/SequenceActivityBudget.js +1 -1
  31. package/dist/cjs/SequenceActivitySuspensionProvider.js +1 -1
  32. package/dist/cjs/SequenceManager.d.ts +6 -0
  33. package/dist/cjs/SequenceManager.js +71 -27
  34. package/dist/cjs/SequenceRegistryProvider.js +16 -3
  35. package/dist/cjs/TimelineContext.js +1 -1
  36. package/dist/cjs/Track.js +2 -2
  37. package/dist/cjs/animated-image/AnimatedImage.d.ts +69 -69
  38. package/dist/cjs/animated-image/AnimatedImage.js +6 -6
  39. package/dist/cjs/animated-image/canvas.d.ts +6 -5
  40. package/dist/cjs/animated-image/canvas.js +1 -1
  41. package/dist/cjs/animated-image/create-image-decoder.d.ts +1 -1
  42. package/dist/cjs/animated-image/decode-image.d.ts +1 -1
  43. package/dist/cjs/animated-image/decode-image.js +2 -0
  44. package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +1 -1
  45. package/dist/cjs/animated-image/index.js +1 -1
  46. package/dist/cjs/audio/AudioForPreview.js +5 -28
  47. package/dist/cjs/audio/AudioForRendering.d.ts +5 -20
  48. package/dist/cjs/audio/AudioForRendering.js +44 -5
  49. package/dist/cjs/audio/html5-audio.d.ts +36 -36
  50. package/dist/cjs/audio/html5-audio.js +8 -10
  51. package/dist/cjs/audio/index.js +1 -1
  52. package/dist/cjs/audio/shared-audio-tags.js +10 -16
  53. package/dist/cjs/audio/shared-element-source-node.d.ts +1 -1
  54. package/dist/cjs/audio/use-audio-context.d.ts +2 -1
  55. package/dist/cjs/audio/wait-until-actually-resumed.d.ts +2 -1
  56. package/dist/cjs/buffer-until-first-frame.d.ts +4 -3
  57. package/dist/cjs/buffering.js +1 -1
  58. package/dist/cjs/cancel-render.js +3 -0
  59. package/dist/cjs/canvas-image/CanvasImage.d.ts +71 -71
  60. package/dist/cjs/canvas-image/CanvasImage.js +27 -24
  61. package/dist/cjs/canvas-image/index.js +1 -1
  62. package/dist/cjs/codec.d.ts +1 -1
  63. package/dist/cjs/committed-metadata.d.ts +4 -2
  64. package/dist/cjs/composition-registry-fallback.d.ts +4 -2
  65. package/dist/cjs/composition-registry-fallback.js +12 -10
  66. package/dist/cjs/create-element-source-proxy.js +46 -6
  67. package/dist/cjs/default-css.d.ts +1 -1
  68. package/dist/cjs/delay-render.d.ts +2 -1
  69. package/dist/cjs/delay-render.js +4 -2
  70. package/dist/cjs/easing.js +3 -1
  71. package/dist/cjs/effects/Solid.d.ts +60 -60
  72. package/dist/cjs/effects/Solid.js +2 -2
  73. package/dist/cjs/effects/canvas-pool.js +6 -9
  74. package/dist/cjs/effects/create-curve-sampler.d.ts +1 -0
  75. package/dist/cjs/effects/create-curve-sampler.js +100 -0
  76. package/dist/cjs/effects/effect-source-observer.d.ts +13 -0
  77. package/dist/cjs/effects/effect-source-observer.js +177 -0
  78. package/dist/cjs/effects/index.js +1 -1
  79. package/dist/cjs/effects/run-effect-chain.js +3 -0
  80. package/dist/cjs/effects/use-memoized-effects.d.ts +2 -1
  81. package/dist/cjs/effects/use-memoized-effects.js +29 -13
  82. package/dist/cjs/freeze.js +2 -2
  83. package/dist/cjs/get-cross-origin-value.d.ts +1 -1
  84. package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
  85. package/dist/cjs/index.d.ts +3 -1
  86. package/dist/cjs/index.js +32 -32
  87. package/dist/cjs/interactivity-schema.d.ts +286 -286
  88. package/dist/cjs/internals.d.ts +412 -595
  89. package/dist/cjs/internals.js +11 -0
  90. package/dist/cjs/interpolate-colors.d.ts +1 -1
  91. package/dist/cjs/interpolate-colors.js +28 -23
  92. package/dist/cjs/interpolate.d.ts +2 -9
  93. package/dist/cjs/interpolate.js +37 -33
  94. package/dist/cjs/is-player.js +1 -1
  95. package/dist/cjs/loading-indicator.js +2 -6
  96. package/dist/cjs/log-level-context.d.ts +1 -1
  97. package/dist/cjs/log.d.ts +12 -7
  98. package/dist/cjs/loop/index.js +1 -1
  99. package/dist/cjs/media-resource-manager.d.ts +1 -1
  100. package/dist/cjs/media-tag-current-time-timestamp.d.ts +1 -1
  101. package/dist/cjs/no-react.d.ts +85 -91
  102. package/dist/cjs/no-react.js +2 -2
  103. package/dist/cjs/nonce.d.ts +11 -0
  104. package/dist/cjs/nonce.js +42 -0
  105. package/dist/cjs/play-and-handle-not-allowed-error.d.ts +5 -4
  106. package/dist/cjs/playback-logging.d.ts +2 -1
  107. package/dist/cjs/playback-pitch-context.d.ts +1 -0
  108. package/dist/cjs/playback-pitch-context.js +5 -0
  109. package/dist/cjs/prefetch-state.js +1 -1
  110. package/dist/cjs/prefetch.d.ts +7 -6
  111. package/dist/cjs/prefetch.js +30 -5
  112. package/dist/cjs/props-if-has-props.d.ts +2 -1
  113. package/dist/cjs/prores-profile.d.ts +1 -1
  114. package/dist/cjs/register-root.d.ts +2 -2
  115. package/dist/cjs/render-resource-manager.d.ts +1 -1
  116. package/dist/cjs/render-types.d.ts +2 -2
  117. package/dist/cjs/resolve-video-config.d.ts +8 -8
  118. package/dist/cjs/runtime-value-store.d.ts +1 -1
  119. package/dist/cjs/scale-value.d.ts +1 -1
  120. package/dist/cjs/seek.d.ts +3 -2
  121. package/dist/cjs/sequence-activity-context.js +1 -1
  122. package/dist/cjs/sequence-crop.js +1 -4
  123. package/dist/cjs/sequence-order-marker.d.ts +58 -0
  124. package/dist/cjs/sequence-order-marker.js +44 -0
  125. package/dist/cjs/series/flatten-children.d.ts +3 -1
  126. package/dist/cjs/series/index.js +4 -5
  127. package/dist/cjs/series/is-inside-series.js +2 -2
  128. package/dist/cjs/spring/index.d.ts +1 -1
  129. package/dist/cjs/spring/index.js +2 -4
  130. package/dist/cjs/spring/measure-spring.d.ts +1 -1
  131. package/dist/cjs/spring/spring-utils.d.ts +1 -1
  132. package/dist/cjs/spring/spring-utils.js +11 -5
  133. package/dist/cjs/timeline-position-state.d.ts +1 -1
  134. package/dist/cjs/timeline-position-state.js +2 -2
  135. package/dist/cjs/use-amplification.d.ts +4 -7
  136. package/dist/cjs/use-current-scale.d.ts +2 -2
  137. package/dist/cjs/use-delay-render.d.ts +2 -1
  138. package/dist/cjs/use-lazy-component.d.ts +1 -1
  139. package/dist/cjs/use-lazy-component.js +20 -9
  140. package/dist/cjs/use-media-buffering.d.ts +3 -2
  141. package/dist/cjs/use-media-duration.d.ts +4 -0
  142. package/dist/cjs/use-media-duration.js +36 -0
  143. package/dist/cjs/use-media-enabled.d.ts +1 -1
  144. package/dist/cjs/use-media-enabled.js +1 -1
  145. package/dist/cjs/use-media-in-timeline.d.ts +1 -1
  146. package/dist/cjs/use-media-playback.d.ts +3 -3
  147. package/dist/cjs/use-media-tag.d.ts +2 -2
  148. package/dist/cjs/use-pixel-density.d.ts +1 -1
  149. package/dist/cjs/use-premounting.d.ts +1 -1
  150. package/dist/cjs/use-premounting.js +6 -2
  151. package/dist/cjs/use-request-video-callback-time.d.ts +3 -3
  152. package/dist/cjs/use-schema.d.ts +4 -4
  153. package/dist/cjs/use-video.js +1 -1
  154. package/dist/cjs/validate-media-props.d.ts +1 -1
  155. package/dist/cjs/validation/validate-default-props.d.ts +1 -1
  156. package/dist/cjs/version.d.ts +1 -1
  157. package/dist/cjs/version.js +1 -1
  158. package/dist/cjs/video/MediaPlaybackError.js +0 -1
  159. package/dist/cjs/video/OffthreadVideo.js +5 -5
  160. package/dist/cjs/video/OffthreadVideoForRendering.js +9 -7
  161. package/dist/cjs/video/VideoForPreview.js +6 -28
  162. package/dist/cjs/video/VideoForRendering.d.ts +5 -3
  163. package/dist/cjs/video/VideoForRendering.js +4 -2
  164. package/dist/cjs/video/duration-state.d.ts +1 -0
  165. package/dist/cjs/video/duration-state.js +8 -2
  166. package/dist/cjs/video/emit-video-frame.d.ts +1 -1
  167. package/dist/cjs/video/html5-video.d.ts +36 -36
  168. package/dist/cjs/video/html5-video.js +8 -10
  169. package/dist/cjs/video/index.js +2 -2
  170. package/dist/cjs/video/seek-until-right.d.ts +3 -2
  171. package/dist/cjs/warn-about-non-seekable-media.d.ts +1 -1
  172. package/dist/cjs/with-interactivity-schema.d.ts +1 -1
  173. package/dist/cjs/with-interactivity-schema.js +3 -8
  174. package/dist/cjs/wrap-remotion-context.d.ts +4 -4
  175. package/dist/cjs/wrap-remotion-context.js +2 -2
  176. package/dist/esm/index.mjs +1304 -819
  177. package/dist/esm/no-react.mjs +74 -52
  178. package/dist/esm/version.mjs +1 -1
  179. 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,6 +1,6 @@
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
6
  const DefaultPremountContext_js_1 = require("./DefaultPremountContext.js");
@@ -9,6 +9,7 @@ const use_effect_chain_state_js_1 = require("./effects/use-effect-chain-state.js
9
9
  const use_memoized_effects_js_1 = require("./effects/use-memoized-effects.js");
10
10
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
11
11
  const freeze_js_1 = require("./freeze.js");
12
+ const HtmlInCanvasFallback_js_1 = require("./HtmlInCanvasFallback.js");
12
13
  const interactivity_schema_js_1 = require("./interactivity-schema.js");
13
14
  const resolve_sequence_duration_js_1 = require("./resolve-sequence-duration.js");
14
15
  const Sequence_js_1 = require("./Sequence.js");
@@ -147,6 +148,17 @@ const defaultOnPaint = ({ canvas, elementImage, }) => {
147
148
  ctx.drawElementImage(elementImage, 0, 0);
148
149
  };
149
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;
150
162
  const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, effectsOutputSize, children, canvasSiblings, onPaint, onInit, pixelDensity, controls, style, renderFrame, }, ref) => {
151
163
  var _a, _b;
152
164
  const ancestorPaintState = (0, react_1.useContext)(HtmlInCanvasAncestorContext);
@@ -589,8 +601,7 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
589
601
  ...(style !== null && style !== void 0 ? style : {}),
590
602
  };
591
603
  }, [height, style, width]);
592
- return (jsx_runtime_1.jsxs(HtmlInCanvasAncestorContext.Provider, { value: paintState, children: [
593
- jsx_runtime_1.jsx("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'
594
605
  ? {
595
606
  ...canvasStyle,
596
607
  position: 'absolute',
@@ -599,22 +610,24 @@ const HtmlInCanvasContent = (0, react_1.forwardRef)(({ width, height, effects, e
599
610
  visibility: 'hidden',
600
611
  pointerEvents: 'none',
601
612
  }
602
- : canvasStyle, children: jsx_runtime_1.jsxs(DefaultPremountContext_js_1.DefaultPremountContext.Provider, { value: 0, children: [
603
- jsx_runtime_1.jsx("div", { ref: divRef, style: paintTargetMode === 'copied'
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'
604
614
  ? { ...innerStyle, visibility: 'visible' }
605
- : innerStyle, children: children }), canvasSiblings] }) }, canvasSizeKey), paintTargetMode === 'copied' ? (jsx_runtime_1.jsx("canvas", { ref: setVisibleCanvasRef, width: canvasWidth, height: canvasHeight, style: canvasStyle }, `output-${canvasSizeKey}`)) : null] }));
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] }));
606
616
  });
607
617
  HtmlInCanvasContent.displayName = 'HtmlInCanvasContent';
608
618
  // Subscribe to frame changes only while rendering. Preview keeps relying on
609
619
  // the browser's paints and does not need a capture barrier on every frame.
610
620
  const HtmlInCanvasContentForRendering = (0, react_1.forwardRef)((props, ref) => {
611
621
  const frame = (0, use_current_frame_js_1.useCurrentFrame)();
612
- return jsx_runtime_1.jsx(HtmlInCanvasContent, { ...props, ref: ref, renderFrame: frame });
622
+ return (0, jsx_runtime_1.jsx)(HtmlInCanvasContent, { ...props, ref: ref, renderFrame: frame });
613
623
  });
614
624
  HtmlInCanvasContentForRendering.displayName = 'HtmlInCanvasContentForRendering';
615
- 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) => {
616
626
  var _a;
617
627
  const { isRendering } = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
628
+ const unsupportedMessage = (0, exports.useHtmlInCanvasUnsupportedMessage)();
629
+ assertHtmlInCanvasDimensions(width, height);
630
+ resolveHtmlInCanvasPixelDensity(pixelDensity);
618
631
  const Content = isRendering
619
632
  ? HtmlInCanvasContentForRendering
620
633
  : HtmlInCanvasContent;
@@ -651,7 +664,7 @@ const HtmlInCanvasInner = (0, react_1.forwardRef)(({ width, height, effects = []
651
664
  style: premountingStyle,
652
665
  componentName: '<HtmlInCanvas />',
653
666
  });
654
- 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 })) }) }));
655
668
  });
656
669
  HtmlInCanvasInner.displayName = 'HtmlInCanvas';
657
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.