@remotion/promo-pages 4.0.495 → 4.0.497

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.
package/dist/experts.js CHANGED
@@ -2029,17 +2029,6 @@ var delayRenderInternal = ({
2029
2029
  scope.remotion_renderReady = false;
2030
2030
  return handle;
2031
2031
  };
2032
- var delayRender = (label2, options) => {
2033
- if (typeof window === "undefined") {
2034
- return Math.random();
2035
- }
2036
- return delayRenderInternal({
2037
- scope: window,
2038
- environment: getRemotionEnvironment(),
2039
- label: label2 ?? null,
2040
- options: options ?? {}
2041
- });
2042
- };
2043
2032
  var continueRenderInternal = ({
2044
2033
  scope,
2045
2034
  handle,
@@ -2360,7 +2349,7 @@ var getSingleChildComponent = (children) => {
2360
2349
  }
2361
2350
  return child.type;
2362
2351
  };
2363
- var VERSION = "4.0.495";
2352
+ var VERSION = "4.0.497";
2364
2353
  var checkMultipleRemotionVersions = () => {
2365
2354
  if (typeof globalThis === "undefined") {
2366
2355
  return;
@@ -2838,6 +2827,45 @@ var textSchema = {
2838
2827
  hiddenFromList: false
2839
2828
  }
2840
2829
  };
2830
+ var borderSchema = {
2831
+ "style.borderWidth": {
2832
+ type: "number",
2833
+ default: undefined,
2834
+ min: 0,
2835
+ step: 1,
2836
+ description: "Border width",
2837
+ hiddenFromList: false
2838
+ },
2839
+ "style.borderStyle": {
2840
+ type: "enum",
2841
+ default: "none",
2842
+ description: "Border style",
2843
+ variants: {
2844
+ none: {},
2845
+ hidden: {},
2846
+ solid: {},
2847
+ dashed: {},
2848
+ dotted: {},
2849
+ double: {},
2850
+ groove: {},
2851
+ ridge: {},
2852
+ inset: {},
2853
+ outset: {}
2854
+ }
2855
+ },
2856
+ "style.borderColor": {
2857
+ type: "color",
2858
+ default: undefined,
2859
+ description: "Border color"
2860
+ }
2861
+ };
2862
+ var backgroundSchema = {
2863
+ "style.backgroundColor": {
2864
+ type: "color",
2865
+ default: "transparent",
2866
+ description: "Color"
2867
+ }
2868
+ };
2841
2869
  var textContentSchema = {
2842
2870
  children: {
2843
2871
  type: "text-content",
@@ -2865,20 +2893,13 @@ var premountSchema = {
2865
2893
  keyframable: false
2866
2894
  }
2867
2895
  };
2868
- var premountStyleSchema = {
2869
- styleWhilePremounted: {
2870
- type: "hidden"
2871
- },
2872
- styleWhilePostmounted: {
2873
- type: "hidden"
2874
- }
2875
- };
2876
2896
  var sequencePremountSchema = {
2877
- ...premountSchema,
2878
- ...premountStyleSchema
2897
+ ...premountSchema
2879
2898
  };
2880
2899
  var sequenceStyleSchema = {
2881
2900
  ...transformSchema,
2901
+ ...backgroundSchema,
2902
+ ...borderSchema,
2882
2903
  ...sequencePremountSchema
2883
2904
  };
2884
2905
  var hiddenField = {
@@ -6214,38 +6235,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
6214
6235
  });
6215
6236
  };
6216
6237
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
6217
- var CACHE_SIZE = 5;
6218
- var getActualTime = ({
6219
- loopBehavior,
6220
- durationFound,
6221
- timeInSec
6222
- }) => {
6223
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6224
- };
6225
- var decodeImage = async ({
6238
+ var createImageDecoder = async ({
6226
6239
  resolvedSrc,
6227
6240
  signal,
6228
6241
  requestInit,
6229
- currentTime,
6230
- initialLoopBehavior
6242
+ contentType
6231
6243
  }) => {
6232
6244
  if (typeof ImageDecoder === "undefined") {
6233
6245
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
6234
6246
  }
6235
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
6236
- const { body } = res;
6247
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
6248
+ const { body } = response;
6237
6249
  if (!body) {
6238
6250
  throw new Error("Got no body");
6239
6251
  }
6240
6252
  const decoder = new ImageDecoder({
6241
6253
  data: body,
6242
- type: res.headers.get("Content-Type") || "image/gif"
6254
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
6243
6255
  });
6244
- await decoder.completed;
6256
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
6245
6257
  const { selectedTrack } = decoder.tracks;
6246
6258
  if (!selectedTrack) {
6259
+ decoder.close();
6247
6260
  throw new Error("No selected track");
6248
6261
  }
6262
+ return { decoder, selectedTrack };
6263
+ };
6264
+ var CACHE_SIZE = 5;
6265
+ var getActualTime = ({
6266
+ loopBehavior,
6267
+ durationFound,
6268
+ timeInSec
6269
+ }) => {
6270
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6271
+ };
6272
+ var decodeImage = async ({
6273
+ resolvedSrc,
6274
+ signal,
6275
+ requestInit,
6276
+ currentTime,
6277
+ initialLoopBehavior
6278
+ }) => {
6279
+ const { decoder, selectedTrack } = await createImageDecoder({
6280
+ resolvedSrc,
6281
+ signal,
6282
+ requestInit,
6283
+ contentType: null
6284
+ });
6249
6285
  const cache2 = [];
6250
6286
  let durationFound = null;
6251
6287
  const getFrameByIndex = async (frameIndex) => {
@@ -6351,6 +6387,13 @@ var decodeImage = async ({
6351
6387
  return closest;
6352
6388
  };
6353
6389
  return {
6390
+ close: () => {
6391
+ for (const item of cache2) {
6392
+ item.frame?.close();
6393
+ item.frame = null;
6394
+ }
6395
+ decoder.close();
6396
+ },
6354
6397
  getFrame,
6355
6398
  frameCount: selectedTrack.frameCount
6356
6399
  };
@@ -6388,6 +6431,7 @@ var animatedImageSchema = {
6388
6431
  keyframable: false
6389
6432
  },
6390
6433
  ...baseSchema,
6434
+ ...premountSchema,
6391
6435
  playbackRate: {
6392
6436
  type: "number",
6393
6437
  min: 0,
@@ -6398,7 +6442,9 @@ var animatedImageSchema = {
6398
6442
  hiddenFromList: false,
6399
6443
  keyframable: false
6400
6444
  },
6401
- ...transformSchema
6445
+ ...transformSchema,
6446
+ ...backgroundSchema,
6447
+ ...borderSchema
6402
6448
  };
6403
6449
  var getCanvasPropsFromSequenceProps = (props) => {
6404
6450
  const canvasProps = {};
@@ -6450,6 +6496,15 @@ var AnimatedImageContent = forwardRef4(({
6450
6496
  const [initialLoopBehavior] = useState6(() => loopBehavior);
6451
6497
  useEffect5(() => {
6452
6498
  const controller = new AbortController;
6499
+ let cancelled = false;
6500
+ let continued = false;
6501
+ const continueRenderOnce = () => {
6502
+ if (continued) {
6503
+ return;
6504
+ }
6505
+ continued = true;
6506
+ continueRender2(decodeHandle);
6507
+ };
6453
6508
  decodeImage({
6454
6509
  resolvedSrc,
6455
6510
  signal: controller.signal,
@@ -6457,22 +6512,31 @@ var AnimatedImageContent = forwardRef4(({
6457
6512
  currentTime: currentTimeRef.current,
6458
6513
  initialLoopBehavior
6459
6514
  }).then((d) => {
6515
+ if (cancelled) {
6516
+ d.close();
6517
+ return;
6518
+ }
6460
6519
  setImageDecoder(d);
6461
- continueRender2(decodeHandle);
6520
+ continueRenderOnce();
6462
6521
  }).catch((err) => {
6522
+ if (cancelled) {
6523
+ return;
6524
+ }
6463
6525
  if (err.name === "AbortError") {
6464
- continueRender2(decodeHandle);
6526
+ continueRenderOnce();
6465
6527
  return;
6466
6528
  }
6467
6529
  if (onError) {
6468
6530
  onError?.(err);
6469
- continueRender2(decodeHandle);
6531
+ continueRenderOnce();
6470
6532
  } else {
6471
6533
  cancelRender(err);
6472
6534
  }
6473
6535
  });
6474
6536
  return () => {
6537
+ cancelled = true;
6475
6538
  controller.abort();
6539
+ continueRenderOnce();
6476
6540
  };
6477
6541
  }, [
6478
6542
  resolvedSrc,
@@ -6482,6 +6546,11 @@ var AnimatedImageContent = forwardRef4(({
6482
6546
  initialLoopBehavior,
6483
6547
  continueRender2
6484
6548
  ]);
6549
+ useEffect5(() => {
6550
+ return () => {
6551
+ imageDecoder?.close();
6552
+ };
6553
+ }, [imageDecoder]);
6485
6554
  useLayoutEffect2(() => {
6486
6555
  if (!imageDecoder) {
6487
6556
  return;
@@ -6551,6 +6620,11 @@ var AnimatedImageInner = ({
6551
6620
  className,
6552
6621
  style,
6553
6622
  durationInFrames,
6623
+ from,
6624
+ premountFor,
6625
+ postmountFor,
6626
+ styleWhilePremounted,
6627
+ styleWhilePostmounted,
6554
6628
  requestInit,
6555
6629
  effects = [],
6556
6630
  controls,
@@ -6562,6 +6636,24 @@ var AnimatedImageInner = ({
6562
6636
  useImperativeHandle2(ref, () => {
6563
6637
  return actualRef.current;
6564
6638
  }, []);
6639
+ const {
6640
+ effectivePostmountFor,
6641
+ effectivePremountFor,
6642
+ freezeFrame,
6643
+ isPremountingOrPostmounting,
6644
+ postmountingActive,
6645
+ premountingActive,
6646
+ premountingStyle
6647
+ } = usePremounting({
6648
+ from: from ?? 0,
6649
+ durationInFrames: durationInFrames ?? Infinity,
6650
+ premountFor: premountFor ?? null,
6651
+ postmountFor: postmountFor ?? null,
6652
+ style: style ?? null,
6653
+ styleWhilePremounted: styleWhilePremounted ?? null,
6654
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
6655
+ hideWhilePremounted: "display-none"
6656
+ });
6565
6657
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
6566
6658
  const animatedImageProps = {
6567
6659
  src,
@@ -6573,24 +6665,33 @@ var AnimatedImageInner = ({
6573
6665
  loopBehavior,
6574
6666
  id,
6575
6667
  className,
6576
- style,
6668
+ style: premountingStyle ?? undefined,
6577
6669
  requestInit,
6578
6670
  ...canvasProps
6579
6671
  };
6580
- return /* @__PURE__ */ jsx14(Sequence, {
6581
- layout: "none",
6582
- durationInFrames,
6583
- name: "<AnimatedImage>",
6584
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6585
- controls,
6586
- _remotionInternalEffects: memoizedEffectDefinitions,
6587
- ...sequenceProps,
6588
- outlineRef: actualRef,
6589
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6590
- ...animatedImageProps,
6591
- ref: actualRef,
6592
- effects,
6593
- controls
6672
+ return /* @__PURE__ */ jsx14(Freeze, {
6673
+ frame: freezeFrame,
6674
+ active: isPremountingOrPostmounting,
6675
+ children: /* @__PURE__ */ jsx14(Sequence, {
6676
+ layout: "none",
6677
+ from: from ?? 0,
6678
+ durationInFrames: durationInFrames ?? Infinity,
6679
+ name: "<AnimatedImage>",
6680
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6681
+ controls,
6682
+ _remotionInternalEffects: memoizedEffectDefinitions,
6683
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
6684
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
6685
+ _remotionInternalIsPremounting: premountingActive,
6686
+ _remotionInternalIsPostmounting: postmountingActive,
6687
+ ...sequenceProps,
6688
+ outlineRef: actualRef,
6689
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6690
+ ...animatedImageProps,
6691
+ ref: actualRef,
6692
+ effects,
6693
+ controls
6694
+ })
6594
6695
  })
6595
6696
  });
6596
6697
  };
@@ -7306,13 +7407,17 @@ var makeSharedElementSourceNode = ({
7306
7407
  }) => {
7307
7408
  let connected = null;
7308
7409
  let disposed = false;
7410
+ let currentAudioContext = audioContext;
7309
7411
  return {
7412
+ setAudioContext: (newAudioContext) => {
7413
+ currentAudioContext = newAudioContext;
7414
+ },
7310
7415
  attemptToConnect: () => {
7311
7416
  if (disposed) {
7312
7417
  throw new Error("SharedElementSourceNode has been disposed");
7313
7418
  }
7314
- if (!connected && ref.current) {
7315
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
7419
+ if (!connected && ref.current && currentAudioContext) {
7420
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
7316
7421
  connected = mediaElementSourceNode;
7317
7422
  }
7318
7423
  },
@@ -7640,19 +7745,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7640
7745
  const audioCtx = useContext21(SharedAudioContext);
7641
7746
  const audioContext = audioCtx?.audioContext ?? null;
7642
7747
  const resume = audioCtx?.resume;
7643
- const refs = useMemo22(() => {
7748
+ const [refs] = useState10(() => {
7644
7749
  return new Array(numberOfAudioTags).fill(true).map(() => {
7645
7750
  const ref = createRef2();
7646
7751
  return {
7647
7752
  id: Math.random(),
7648
7753
  ref,
7649
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
7754
+ mediaElementSourceNode: makeSharedElementSourceNode({
7650
7755
  audioContext,
7651
7756
  ref
7652
- }) : null
7757
+ })
7653
7758
  };
7654
7759
  });
7655
- }, [audioContext, numberOfAudioTags]);
7760
+ });
7761
+ for (const { mediaElementSourceNode } of refs) {
7762
+ mediaElementSourceNode?.setAudioContext(audioContext);
7763
+ }
7656
7764
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7657
7765
  effectToUse(() => {
7658
7766
  return () => {
@@ -7720,7 +7828,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7720
7828
  const cloned = [...takenAudios.current];
7721
7829
  const index = refs.findIndex((r) => r.id === id);
7722
7830
  if (index === -1) {
7723
- throw new TypeError("Error occured in ");
7831
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r) => r.id).join(", ")}`);
7724
7832
  }
7725
7833
  cloned[index] = false;
7726
7834
  takenAudios.current = cloned;
@@ -7824,10 +7932,10 @@ var useSharedAudio = ({
7824
7932
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
7825
7933
  }
7826
7934
  const el = React20.createRef();
7827
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
7828
- audioContext: audioCtx.audioContext,
7935
+ const mediaElementSourceNode = makeSharedElementSourceNode({
7936
+ audioContext: audioCtx?.audioContext ?? null,
7829
7937
  ref: el
7830
- }) : null;
7938
+ });
7831
7939
  return {
7832
7940
  el,
7833
7941
  id: Math.random(),
@@ -7842,6 +7950,7 @@ var useSharedAudio = ({
7842
7950
  }
7843
7951
  };
7844
7952
  });
7953
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
7845
7954
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7846
7955
  if (typeof document !== "undefined") {
7847
7956
  effectToUse(() => {
@@ -9699,7 +9808,9 @@ var solidSchema = {
9699
9808
  description: "Pixel density",
9700
9809
  hiddenFromList: false
9701
9810
  },
9702
- ...transformSchema
9811
+ ...transformSchema,
9812
+ ...backgroundSchema,
9813
+ ...borderSchema
9703
9814
  };
9704
9815
  var SolidInner = ({
9705
9816
  color,
@@ -9943,7 +10054,7 @@ var HtmlInCanvasContent = forwardRef9(({
9943
10054
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
9944
10055
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
9945
10056
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
9946
- const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
10057
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
9947
10058
  const { isClientSideRendering, isRendering } = useRemotionEnvironment();
9948
10059
  const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
9949
10060
  const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
@@ -9997,7 +10108,7 @@ var HtmlInCanvasContent = forwardRef9(({
9997
10108
  if (!placeholderCanvas) {
9998
10109
  throw new Error("Canvas not found");
9999
10110
  }
10000
- const handle = delayRender("onPaint");
10111
+ const handle = delayRender2("onPaint");
10001
10112
  if (!initializedRef.current) {
10002
10113
  const currentOnInit = onInitRef.current;
10003
10114
  if (!currentOnInit) {
@@ -10098,6 +10209,7 @@ var HtmlInCanvasContent = forwardRef9(({
10098
10209
  chainState,
10099
10210
  continueRender2,
10100
10211
  cancelRender2,
10212
+ delayRender2,
10101
10213
  resolvedPixelDensity,
10102
10214
  canRetryMissingPaintRecord
10103
10215
  ]);
@@ -10149,14 +10261,14 @@ var HtmlInCanvasContent = forwardRef9(({
10149
10261
  if (!canvas) {
10150
10262
  return;
10151
10263
  }
10152
- const handle = delayRender("waiting for first paint after canvas resize");
10264
+ const handle = delayRender2("waiting for first paint after canvas resize");
10153
10265
  canvas.addEventListener("paint", () => {
10154
10266
  continueRender2(handle);
10155
10267
  }, { once: true });
10156
10268
  return () => {
10157
10269
  continueRender2(handle);
10158
10270
  };
10159
- }, [width, height, continueRender2, canvasSizeKey]);
10271
+ }, [width, height, continueRender2, delayRender2, canvasSizeKey]);
10160
10272
  const innerStyle = useMemo31(() => {
10161
10273
  return {
10162
10274
  width,
@@ -10252,7 +10364,9 @@ var htmlInCanvasSchema = {
10252
10364
  description: "Pixel density",
10253
10365
  hiddenFromList: false
10254
10366
  },
10255
- ...transformSchema
10367
+ ...transformSchema,
10368
+ ...backgroundSchema,
10369
+ ...borderSchema
10256
10370
  };
10257
10371
  var HtmlInCanvasWrapped = withInteractivitySchema({
10258
10372
  Component: HtmlInCanvasInner,
@@ -10274,6 +10388,7 @@ function truncateSrcForLabel(src) {
10274
10388
  }
10275
10389
  var canvasImageSchema = {
10276
10390
  ...baseSchema,
10391
+ ...premountSchema,
10277
10392
  fit: {
10278
10393
  type: "enum",
10279
10394
  default: "fill",
@@ -10284,7 +10399,9 @@ var canvasImageSchema = {
10284
10399
  cover: {}
10285
10400
  }
10286
10401
  },
10287
- ...transformSchema
10402
+ ...transformSchema,
10403
+ ...backgroundSchema,
10404
+ ...borderSchema
10288
10405
  };
10289
10406
  var makeAbortError = () => {
10290
10407
  if (typeof DOMException !== "undefined") {
@@ -10608,6 +10725,10 @@ var CanvasImageInner = forwardRef10(({
10608
10725
  from,
10609
10726
  trimBefore,
10610
10727
  freeze,
10728
+ premountFor,
10729
+ postmountFor,
10730
+ styleWhilePremounted,
10731
+ styleWhilePostmounted,
10611
10732
  hidden,
10612
10733
  name,
10613
10734
  showInTimeline,
@@ -10625,39 +10746,65 @@ var CanvasImageInner = forwardRef10(({
10625
10746
  useImperativeHandle7(ref, () => {
10626
10747
  return actualRef.current;
10627
10748
  }, []);
10628
- return /* @__PURE__ */ jsx26(Sequence, {
10629
- layout: "none",
10749
+ const {
10750
+ effectivePostmountFor,
10751
+ effectivePremountFor,
10752
+ freezeFrame,
10753
+ isPremountingOrPostmounting,
10754
+ postmountingActive,
10755
+ premountingActive,
10756
+ premountingStyle
10757
+ } = usePremounting({
10630
10758
  from: from ?? 0,
10631
- trimBefore,
10632
10759
  durationInFrames: durationInFrames ?? Infinity,
10633
- freeze,
10634
- hidden,
10635
- showInTimeline: showInTimeline ?? true,
10636
- name: name ?? "<CanvasImage>",
10637
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10638
- controls,
10639
- _remotionInternalEffects: memoizedEffectDefinitions,
10640
- _remotionInternalIsMedia: { type: "image", src },
10641
- _remotionInternalStack: stack,
10642
- outlineRef: outlineRef ?? actualRef,
10643
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10644
- ref: actualRef,
10645
- src,
10646
- width,
10647
- height,
10648
- fit,
10649
- effects,
10760
+ premountFor: premountFor ?? null,
10761
+ postmountFor: postmountFor ?? null,
10762
+ style: style ?? null,
10763
+ styleWhilePremounted: styleWhilePremounted ?? null,
10764
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
10765
+ hideWhilePremounted: "display-none"
10766
+ });
10767
+ return /* @__PURE__ */ jsx26(Freeze, {
10768
+ frame: freezeFrame,
10769
+ active: isPremountingOrPostmounting,
10770
+ children: /* @__PURE__ */ jsx26(Sequence, {
10771
+ layout: "none",
10772
+ from: from ?? 0,
10773
+ trimBefore,
10774
+ durationInFrames: durationInFrames ?? Infinity,
10775
+ freeze,
10776
+ hidden,
10777
+ showInTimeline: showInTimeline ?? true,
10778
+ name: name ?? "<CanvasImage>",
10779
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10650
10780
  controls,
10651
- className,
10652
- style,
10653
- id,
10654
- onError,
10655
- pauseWhenLoading,
10656
- maxRetries,
10657
- delayRenderRetries,
10658
- delayRenderTimeoutInMilliseconds,
10659
- refForOutline: outlineRef ?? null,
10660
- ...canvasProps
10781
+ _remotionInternalEffects: memoizedEffectDefinitions,
10782
+ _remotionInternalIsMedia: { type: "image", src },
10783
+ _remotionInternalStack: stack,
10784
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
10785
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
10786
+ _remotionInternalIsPremounting: premountingActive,
10787
+ _remotionInternalIsPostmounting: postmountingActive,
10788
+ outlineRef: outlineRef ?? actualRef,
10789
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10790
+ ref: actualRef,
10791
+ src,
10792
+ width,
10793
+ height,
10794
+ fit,
10795
+ effects,
10796
+ controls,
10797
+ className,
10798
+ style: premountingStyle ?? undefined,
10799
+ id,
10800
+ onError,
10801
+ pauseWhenLoading,
10802
+ maxRetries,
10803
+ delayRenderRetries,
10804
+ delayRenderTimeoutInMilliseconds,
10805
+ refForOutline: outlineRef ?? null,
10806
+ ...canvasProps
10807
+ })
10661
10808
  })
10662
10809
  });
10663
10810
  });
@@ -10874,6 +11021,11 @@ var NativeImgInner = ({
10874
11021
  trimBefore,
10875
11022
  durationInFrames,
10876
11023
  freeze,
11024
+ premountFor,
11025
+ postmountFor,
11026
+ style,
11027
+ styleWhilePremounted,
11028
+ styleWhilePostmounted,
10877
11029
  controls,
10878
11030
  outlineRef: refForOutline,
10879
11031
  ...props2
@@ -10881,24 +11033,51 @@ var NativeImgInner = ({
10881
11033
  if (!src) {
10882
11034
  throw new Error('No "src" prop was passed to <Img>.');
10883
11035
  }
10884
- return /* @__PURE__ */ jsx28(Sequence, {
10885
- layout: "none",
11036
+ const {
11037
+ effectivePostmountFor,
11038
+ effectivePremountFor,
11039
+ freezeFrame,
11040
+ isPremountingOrPostmounting,
11041
+ postmountingActive,
11042
+ premountingActive,
11043
+ premountingStyle
11044
+ } = usePremounting({
10886
11045
  from: from ?? 0,
10887
- trimBefore,
10888
11046
  durationInFrames: durationInFrames ?? Infinity,
10889
- freeze,
10890
- _remotionInternalStack: stack,
10891
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
10892
- _remotionInternalIsMedia: { type: "image", src },
10893
- name: name ?? "<Img>",
10894
- controls,
10895
- showInTimeline: showInTimeline ?? true,
10896
- hidden,
10897
- outlineRef: refForOutline,
10898
- children: /* @__PURE__ */ jsx28(ImgContent, {
10899
- src,
10900
- refForOutline,
10901
- ...props2
11047
+ premountFor: premountFor ?? null,
11048
+ postmountFor: postmountFor ?? null,
11049
+ style: style ?? null,
11050
+ styleWhilePremounted: styleWhilePremounted ?? null,
11051
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
11052
+ hideWhilePremounted: "display-none"
11053
+ });
11054
+ return /* @__PURE__ */ jsx28(Freeze, {
11055
+ frame: freezeFrame,
11056
+ active: isPremountingOrPostmounting,
11057
+ children: /* @__PURE__ */ jsx28(Sequence, {
11058
+ layout: "none",
11059
+ from: from ?? 0,
11060
+ trimBefore,
11061
+ durationInFrames: durationInFrames ?? Infinity,
11062
+ freeze,
11063
+ _remotionInternalStack: stack,
11064
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
11065
+ _remotionInternalIsMedia: { type: "image", src },
11066
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
11067
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
11068
+ _remotionInternalIsPremounting: premountingActive,
11069
+ _remotionInternalIsPostmounting: postmountingActive,
11070
+ name: name ?? "<Img>",
11071
+ controls,
11072
+ showInTimeline: showInTimeline ?? true,
11073
+ hidden,
11074
+ outlineRef: refForOutline,
11075
+ children: /* @__PURE__ */ jsx28(ImgContent, {
11076
+ src,
11077
+ refForOutline,
11078
+ style: premountingStyle ?? undefined,
11079
+ ...props2
11080
+ })
10902
11081
  })
10903
11082
  });
10904
11083
  };
@@ -10911,7 +11090,10 @@ var imgSchema = {
10911
11090
  keyframable: false
10912
11091
  },
10913
11092
  ...baseSchema,
10914
- ...transformSchema
11093
+ ...premountSchema,
11094
+ ...transformSchema,
11095
+ ...backgroundSchema,
11096
+ ...borderSchema
10915
11097
  };
10916
11098
  var imgCanvasFallbackIncompatibleProps = new Set([
10917
11099
  "alt",
@@ -10967,6 +11149,10 @@ var ImgInner = ({
10967
11149
  trimBefore,
10968
11150
  durationInFrames,
10969
11151
  freeze,
11152
+ premountFor,
11153
+ postmountFor,
11154
+ styleWhilePremounted,
11155
+ styleWhilePostmounted,
10970
11156
  controls,
10971
11157
  width,
10972
11158
  height,
@@ -10993,6 +11179,10 @@ var ImgInner = ({
10993
11179
  trimBefore,
10994
11180
  durationInFrames,
10995
11181
  freeze,
11182
+ premountFor,
11183
+ postmountFor,
11184
+ styleWhilePremounted,
11185
+ styleWhilePostmounted,
10996
11186
  controls,
10997
11187
  width,
10998
11188
  height,
@@ -11036,6 +11226,10 @@ var ImgInner = ({
11036
11226
  trimBefore,
11037
11227
  durationInFrames,
11038
11228
  freeze,
11229
+ premountFor,
11230
+ postmountFor,
11231
+ styleWhilePremounted,
11232
+ styleWhilePostmounted,
11039
11233
  hidden,
11040
11234
  name: name ?? "<Img>",
11041
11235
  showInTimeline,
@@ -11074,7 +11268,20 @@ var interactiveElementSchema = {
11074
11268
  ...baseSchema,
11075
11269
  ...transformSchema
11076
11270
  };
11271
+ var interactiveBackgroundElementSchema = {
11272
+ ...interactiveElementSchema,
11273
+ ...backgroundSchema
11274
+ };
11275
+ var interactiveBorderElementSchema = {
11276
+ ...interactiveBackgroundElementSchema,
11277
+ ...borderSchema
11278
+ };
11077
11279
  var interactiveTextElementSchema = {
11280
+ ...interactiveBorderElementSchema,
11281
+ ...textSchema,
11282
+ ...textContentSchema
11283
+ };
11284
+ var interactiveSvgTextElementSchema = {
11078
11285
  ...interactiveElementSchema,
11079
11286
  ...textSchema,
11080
11287
  ...textContentSchema
@@ -11153,6 +11360,8 @@ var Interactive = {
11153
11360
  baseSchema,
11154
11361
  transformSchema,
11155
11362
  textSchema,
11363
+ backgroundSchema,
11364
+ borderSchema,
11156
11365
  premountSchema,
11157
11366
  sequenceSchema,
11158
11367
  withSchema,
@@ -11189,10 +11398,39 @@ var Interactive = {
11189
11398
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
11190
11399
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
11191
11400
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
11192
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
11193
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
11401
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
11402
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
11194
11403
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
11195
11404
  };
11405
+ var getAnimatedImageDurationInSeconds = async ({
11406
+ resolvedSrc,
11407
+ signal,
11408
+ requestInit,
11409
+ contentType
11410
+ }) => {
11411
+ const { decoder, selectedTrack } = await createImageDecoder({
11412
+ resolvedSrc,
11413
+ signal,
11414
+ requestInit,
11415
+ contentType
11416
+ });
11417
+ try {
11418
+ const { image } = await decoder.decode({
11419
+ frameIndex: selectedTrack.frameCount - 1,
11420
+ completeFramesOnly: true
11421
+ });
11422
+ try {
11423
+ if (image.duration === null) {
11424
+ throw new Error("Could not determine animated image duration");
11425
+ }
11426
+ return (image.timestamp + image.duration) / 1e6;
11427
+ } finally {
11428
+ image.close();
11429
+ }
11430
+ } finally {
11431
+ decoder.close();
11432
+ }
11433
+ };
11196
11434
  var compositionsRef = React31.createRef();
11197
11435
  var CompositionManagerProvider = ({
11198
11436
  children,
@@ -12420,6 +12658,7 @@ var Internals = {
12420
12658
  useAbsoluteTimelinePosition,
12421
12659
  evaluateVolume,
12422
12660
  getAbsoluteSrc,
12661
+ getAnimatedImageDurationInSeconds,
12423
12662
  getAssetDisplayName,
12424
12663
  Timeline: exports_timeline_position_state,
12425
12664
  validateMediaTrimProps,
@@ -12444,7 +12683,6 @@ var Internals = {
12444
12683
  textSchema,
12445
12684
  transformSchema,
12446
12685
  premountSchema,
12447
- premountStyleSchema,
12448
12686
  flattenActiveSchema,
12449
12687
  getFlatSchemaWithAllKeys,
12450
12688
  RemotionRootContexts,
@@ -12583,6 +12821,7 @@ var seriesSequenceSchema = {
12583
12821
  hidden: Interactive.sequenceSchema.hidden,
12584
12822
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
12585
12823
  freeze: Interactive.baseSchema.freeze,
12824
+ trimBefore: Interactive.sequenceSchema.trimBefore,
12586
12825
  layout: Interactive.sequenceSchema.layout
12587
12826
  };
12588
12827
  var SeriesSequenceInner = forwardRef14(({