@remotion/promo-pages 4.0.496 → 4.0.498

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.
@@ -5582,7 +5582,7 @@ var getSingleChildComponent = (children) => {
5582
5582
  }
5583
5583
  return child.type;
5584
5584
  };
5585
- var VERSION = "4.0.496";
5585
+ var VERSION = "4.0.498";
5586
5586
  var checkMultipleRemotionVersions = () => {
5587
5587
  if (typeof globalThis === "undefined") {
5588
5588
  return;
@@ -6060,6 +6060,45 @@ var textSchema = {
6060
6060
  hiddenFromList: false
6061
6061
  }
6062
6062
  };
6063
+ var borderSchema = {
6064
+ "style.borderWidth": {
6065
+ type: "number",
6066
+ default: undefined,
6067
+ min: 0,
6068
+ step: 1,
6069
+ description: "Border width",
6070
+ hiddenFromList: false
6071
+ },
6072
+ "style.borderStyle": {
6073
+ type: "enum",
6074
+ default: "none",
6075
+ description: "Border style",
6076
+ variants: {
6077
+ none: {},
6078
+ hidden: {},
6079
+ solid: {},
6080
+ dashed: {},
6081
+ dotted: {},
6082
+ double: {},
6083
+ groove: {},
6084
+ ridge: {},
6085
+ inset: {},
6086
+ outset: {}
6087
+ }
6088
+ },
6089
+ "style.borderColor": {
6090
+ type: "color",
6091
+ default: undefined,
6092
+ description: "Border color"
6093
+ }
6094
+ };
6095
+ var backgroundSchema = {
6096
+ "style.backgroundColor": {
6097
+ type: "color",
6098
+ default: "transparent",
6099
+ description: "Color"
6100
+ }
6101
+ };
6063
6102
  var textContentSchema = {
6064
6103
  children: {
6065
6104
  type: "text-content",
@@ -6087,20 +6126,13 @@ var premountSchema = {
6087
6126
  keyframable: false
6088
6127
  }
6089
6128
  };
6090
- var premountStyleSchema = {
6091
- styleWhilePremounted: {
6092
- type: "hidden"
6093
- },
6094
- styleWhilePostmounted: {
6095
- type: "hidden"
6096
- }
6097
- };
6098
6129
  var sequencePremountSchema = {
6099
- ...premountSchema,
6100
- ...premountStyleSchema
6130
+ ...premountSchema
6101
6131
  };
6102
6132
  var sequenceStyleSchema = {
6103
6133
  ...transformSchema,
6134
+ ...backgroundSchema,
6135
+ ...borderSchema,
6104
6136
  ...sequencePremountSchema
6105
6137
  };
6106
6138
  var hiddenField = {
@@ -6388,6 +6420,9 @@ var PremountContext = createContext15({
6388
6420
  premountFramesRemaining: 0
6389
6421
  });
6390
6422
  var ENABLE_V5_BREAKING_CHANGES = false;
6423
+ var resolveV5Default = (value) => {
6424
+ return value ?? ENABLE_V5_BREAKING_CHANGES;
6425
+ };
6391
6426
  var usePremounting = ({
6392
6427
  from,
6393
6428
  durationInFrames,
@@ -9436,38 +9471,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
9436
9471
  });
9437
9472
  };
9438
9473
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
9439
- var CACHE_SIZE = 5;
9440
- var getActualTime = ({
9441
- loopBehavior,
9442
- durationFound,
9443
- timeInSec
9444
- }) => {
9445
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9446
- };
9447
- var decodeImage = async ({
9474
+ var createImageDecoder = async ({
9448
9475
  resolvedSrc,
9449
9476
  signal,
9450
9477
  requestInit,
9451
- currentTime,
9452
- initialLoopBehavior
9478
+ contentType
9453
9479
  }) => {
9454
9480
  if (typeof ImageDecoder === "undefined") {
9455
9481
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
9456
9482
  }
9457
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
9458
- const { body } = res;
9483
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
9484
+ const { body } = response;
9459
9485
  if (!body) {
9460
9486
  throw new Error("Got no body");
9461
9487
  }
9462
9488
  const decoder = new ImageDecoder({
9463
9489
  data: body,
9464
- type: res.headers.get("Content-Type") || "image/gif"
9490
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
9465
9491
  });
9466
- await decoder.completed;
9492
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
9467
9493
  const { selectedTrack } = decoder.tracks;
9468
9494
  if (!selectedTrack) {
9495
+ decoder.close();
9469
9496
  throw new Error("No selected track");
9470
9497
  }
9498
+ return { decoder, selectedTrack };
9499
+ };
9500
+ var CACHE_SIZE = 5;
9501
+ var getActualTime = ({
9502
+ loopBehavior,
9503
+ durationFound,
9504
+ timeInSec
9505
+ }) => {
9506
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9507
+ };
9508
+ var decodeImage = async ({
9509
+ resolvedSrc,
9510
+ signal,
9511
+ requestInit,
9512
+ currentTime,
9513
+ initialLoopBehavior
9514
+ }) => {
9515
+ const { decoder, selectedTrack } = await createImageDecoder({
9516
+ resolvedSrc,
9517
+ signal,
9518
+ requestInit,
9519
+ contentType: null
9520
+ });
9471
9521
  const cache2 = [];
9472
9522
  let durationFound = null;
9473
9523
  const getFrameByIndex = async (frameIndex) => {
@@ -9573,6 +9623,13 @@ var decodeImage = async ({
9573
9623
  return closest;
9574
9624
  };
9575
9625
  return {
9626
+ close: () => {
9627
+ for (const item of cache2) {
9628
+ item.frame?.close();
9629
+ item.frame = null;
9630
+ }
9631
+ decoder.close();
9632
+ },
9576
9633
  getFrame,
9577
9634
  frameCount: selectedTrack.frameCount
9578
9635
  };
@@ -9610,6 +9667,7 @@ var animatedImageSchema = {
9610
9667
  keyframable: false
9611
9668
  },
9612
9669
  ...baseSchema,
9670
+ ...premountSchema,
9613
9671
  playbackRate: {
9614
9672
  type: "number",
9615
9673
  min: 0,
@@ -9620,7 +9678,9 @@ var animatedImageSchema = {
9620
9678
  hiddenFromList: false,
9621
9679
  keyframable: false
9622
9680
  },
9623
- ...transformSchema
9681
+ ...transformSchema,
9682
+ ...backgroundSchema,
9683
+ ...borderSchema
9624
9684
  };
9625
9685
  var getCanvasPropsFromSequenceProps = (props) => {
9626
9686
  const canvasProps = {};
@@ -9672,6 +9732,15 @@ var AnimatedImageContent = forwardRef4(({
9672
9732
  const [initialLoopBehavior] = useState6(() => loopBehavior);
9673
9733
  useEffect5(() => {
9674
9734
  const controller = new AbortController;
9735
+ let cancelled = false;
9736
+ let continued = false;
9737
+ const continueRenderOnce = () => {
9738
+ if (continued) {
9739
+ return;
9740
+ }
9741
+ continued = true;
9742
+ continueRender2(decodeHandle);
9743
+ };
9675
9744
  decodeImage({
9676
9745
  resolvedSrc,
9677
9746
  signal: controller.signal,
@@ -9679,22 +9748,31 @@ var AnimatedImageContent = forwardRef4(({
9679
9748
  currentTime: currentTimeRef.current,
9680
9749
  initialLoopBehavior
9681
9750
  }).then((d) => {
9751
+ if (cancelled) {
9752
+ d.close();
9753
+ return;
9754
+ }
9682
9755
  setImageDecoder(d);
9683
- continueRender2(decodeHandle);
9756
+ continueRenderOnce();
9684
9757
  }).catch((err) => {
9758
+ if (cancelled) {
9759
+ return;
9760
+ }
9685
9761
  if (err.name === "AbortError") {
9686
- continueRender2(decodeHandle);
9762
+ continueRenderOnce();
9687
9763
  return;
9688
9764
  }
9689
9765
  if (onError) {
9690
9766
  onError?.(err);
9691
- continueRender2(decodeHandle);
9767
+ continueRenderOnce();
9692
9768
  } else {
9693
9769
  cancelRender(err);
9694
9770
  }
9695
9771
  });
9696
9772
  return () => {
9773
+ cancelled = true;
9697
9774
  controller.abort();
9775
+ continueRenderOnce();
9698
9776
  };
9699
9777
  }, [
9700
9778
  resolvedSrc,
@@ -9704,6 +9782,11 @@ var AnimatedImageContent = forwardRef4(({
9704
9782
  initialLoopBehavior,
9705
9783
  continueRender2
9706
9784
  ]);
9785
+ useEffect5(() => {
9786
+ return () => {
9787
+ imageDecoder?.close();
9788
+ };
9789
+ }, [imageDecoder]);
9707
9790
  useLayoutEffect2(() => {
9708
9791
  if (!imageDecoder) {
9709
9792
  return;
@@ -9773,6 +9856,11 @@ var AnimatedImageInner = ({
9773
9856
  className,
9774
9857
  style,
9775
9858
  durationInFrames,
9859
+ from,
9860
+ premountFor,
9861
+ postmountFor,
9862
+ styleWhilePremounted,
9863
+ styleWhilePostmounted,
9776
9864
  requestInit,
9777
9865
  effects = [],
9778
9866
  controls,
@@ -9784,6 +9872,24 @@ var AnimatedImageInner = ({
9784
9872
  useImperativeHandle2(ref, () => {
9785
9873
  return actualRef.current;
9786
9874
  }, []);
9875
+ const {
9876
+ effectivePostmountFor,
9877
+ effectivePremountFor,
9878
+ freezeFrame,
9879
+ isPremountingOrPostmounting,
9880
+ postmountingActive,
9881
+ premountingActive,
9882
+ premountingStyle
9883
+ } = usePremounting({
9884
+ from: from ?? 0,
9885
+ durationInFrames: durationInFrames ?? Infinity,
9886
+ premountFor: premountFor ?? null,
9887
+ postmountFor: postmountFor ?? null,
9888
+ style: style ?? null,
9889
+ styleWhilePremounted: styleWhilePremounted ?? null,
9890
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
9891
+ hideWhilePremounted: "display-none"
9892
+ });
9787
9893
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
9788
9894
  const animatedImageProps = {
9789
9895
  src,
@@ -9795,24 +9901,33 @@ var AnimatedImageInner = ({
9795
9901
  loopBehavior,
9796
9902
  id,
9797
9903
  className,
9798
- style,
9904
+ style: premountingStyle ?? undefined,
9799
9905
  requestInit,
9800
9906
  ...canvasProps
9801
9907
  };
9802
- return /* @__PURE__ */ jsx14(Sequence, {
9803
- layout: "none",
9804
- durationInFrames,
9805
- name: "<AnimatedImage>",
9806
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9807
- controls,
9808
- _remotionInternalEffects: memoizedEffectDefinitions,
9809
- ...sequenceProps,
9810
- outlineRef: actualRef,
9811
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9812
- ...animatedImageProps,
9813
- ref: actualRef,
9814
- effects,
9815
- controls
9908
+ return /* @__PURE__ */ jsx14(Freeze, {
9909
+ frame: freezeFrame,
9910
+ active: isPremountingOrPostmounting,
9911
+ children: /* @__PURE__ */ jsx14(Sequence, {
9912
+ layout: "none",
9913
+ from: from ?? 0,
9914
+ durationInFrames: durationInFrames ?? Infinity,
9915
+ name: "<AnimatedImage>",
9916
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9917
+ controls,
9918
+ _remotionInternalEffects: memoizedEffectDefinitions,
9919
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
9920
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
9921
+ _remotionInternalIsPremounting: premountingActive,
9922
+ _remotionInternalIsPostmounting: postmountingActive,
9923
+ ...sequenceProps,
9924
+ outlineRef: actualRef,
9925
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9926
+ ...animatedImageProps,
9927
+ ref: actualRef,
9928
+ effects,
9929
+ controls
9930
+ })
9816
9931
  })
9817
9932
  });
9818
9933
  };
@@ -10528,13 +10643,17 @@ var makeSharedElementSourceNode = ({
10528
10643
  }) => {
10529
10644
  let connected = null;
10530
10645
  let disposed = false;
10646
+ let currentAudioContext = audioContext;
10531
10647
  return {
10648
+ setAudioContext: (newAudioContext) => {
10649
+ currentAudioContext = newAudioContext;
10650
+ },
10532
10651
  attemptToConnect: () => {
10533
10652
  if (disposed) {
10534
10653
  throw new Error("SharedElementSourceNode has been disposed");
10535
10654
  }
10536
- if (!connected && ref.current) {
10537
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
10655
+ if (!connected && ref.current && currentAudioContext) {
10656
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
10538
10657
  connected = mediaElementSourceNode;
10539
10658
  }
10540
10659
  },
@@ -10862,19 +10981,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10862
10981
  const audioCtx = useContext21(SharedAudioContext);
10863
10982
  const audioContext = audioCtx?.audioContext ?? null;
10864
10983
  const resume = audioCtx?.resume;
10865
- const refs = useMemo22(() => {
10984
+ const [refs] = useState10(() => {
10866
10985
  return new Array(numberOfAudioTags).fill(true).map(() => {
10867
10986
  const ref = createRef2();
10868
10987
  return {
10869
10988
  id: Math.random(),
10870
10989
  ref,
10871
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
10990
+ mediaElementSourceNode: makeSharedElementSourceNode({
10872
10991
  audioContext,
10873
10992
  ref
10874
- }) : null
10993
+ })
10875
10994
  };
10876
10995
  });
10877
- }, [audioContext, numberOfAudioTags]);
10996
+ });
10997
+ for (const { mediaElementSourceNode } of refs) {
10998
+ mediaElementSourceNode?.setAudioContext(audioContext);
10999
+ }
10878
11000
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
10879
11001
  effectToUse(() => {
10880
11002
  return () => {
@@ -10942,7 +11064,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10942
11064
  const cloned = [...takenAudios.current];
10943
11065
  const index = refs.findIndex((r2) => r2.id === id);
10944
11066
  if (index === -1) {
10945
- throw new TypeError("Error occured in ");
11067
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r2) => r2.id).join(", ")}`);
10946
11068
  }
10947
11069
  cloned[index] = false;
10948
11070
  takenAudios.current = cloned;
@@ -11046,10 +11168,10 @@ var useSharedAudio = ({
11046
11168
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
11047
11169
  }
11048
11170
  const el = React20.createRef();
11049
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
11050
- audioContext: audioCtx.audioContext,
11171
+ const mediaElementSourceNode = makeSharedElementSourceNode({
11172
+ audioContext: audioCtx?.audioContext ?? null,
11051
11173
  ref: el
11052
- }) : null;
11174
+ });
11053
11175
  return {
11054
11176
  el,
11055
11177
  id: Math.random(),
@@ -11064,6 +11186,7 @@ var useSharedAudio = ({
11064
11186
  }
11065
11187
  };
11066
11188
  });
11189
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
11067
11190
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
11068
11191
  if (typeof document !== "undefined") {
11069
11192
  effectToUse(() => {
@@ -12775,6 +12898,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12775
12898
  const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
12776
12899
  const { fps } = useVideoConfig();
12777
12900
  const environment = useRemotionEnvironment();
12901
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
12778
12902
  if (environment.isClientSideRendering) {
12779
12903
  throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
12780
12904
  }
@@ -12844,7 +12968,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12844
12968
  name,
12845
12969
  children: /* @__PURE__ */ jsx23(Html5Audio, {
12846
12970
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
12847
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12971
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12848
12972
  ...otherProps,
12849
12973
  ref
12850
12974
  })
@@ -12872,7 +12996,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12872
12996
  ref,
12873
12997
  onNativeError: onError,
12874
12998
  onDuration,
12875
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12999
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12876
13000
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
12877
13001
  showInTimeline: showInTimeline ?? true
12878
13002
  });
@@ -12921,7 +13045,9 @@ var solidSchema = {
12921
13045
  description: "Pixel density",
12922
13046
  hiddenFromList: false
12923
13047
  },
12924
- ...transformSchema
13048
+ ...transformSchema,
13049
+ ...backgroundSchema,
13050
+ ...borderSchema
12925
13051
  };
12926
13052
  var SolidInner = ({
12927
13053
  color,
@@ -13475,7 +13601,9 @@ var htmlInCanvasSchema = {
13475
13601
  description: "Pixel density",
13476
13602
  hiddenFromList: false
13477
13603
  },
13478
- ...transformSchema
13604
+ ...transformSchema,
13605
+ ...backgroundSchema,
13606
+ ...borderSchema
13479
13607
  };
13480
13608
  var HtmlInCanvasWrapped = withInteractivitySchema({
13481
13609
  Component: HtmlInCanvasInner,
@@ -13497,6 +13625,7 @@ function truncateSrcForLabel(src) {
13497
13625
  }
13498
13626
  var canvasImageSchema = {
13499
13627
  ...baseSchema,
13628
+ ...premountSchema,
13500
13629
  fit: {
13501
13630
  type: "enum",
13502
13631
  default: "fill",
@@ -13507,7 +13636,9 @@ var canvasImageSchema = {
13507
13636
  cover: {}
13508
13637
  }
13509
13638
  },
13510
- ...transformSchema
13639
+ ...transformSchema,
13640
+ ...backgroundSchema,
13641
+ ...borderSchema
13511
13642
  };
13512
13643
  var makeAbortError = () => {
13513
13644
  if (typeof DOMException !== "undefined") {
@@ -13831,6 +13962,10 @@ var CanvasImageInner = forwardRef10(({
13831
13962
  from,
13832
13963
  trimBefore,
13833
13964
  freeze,
13965
+ premountFor,
13966
+ postmountFor,
13967
+ styleWhilePremounted,
13968
+ styleWhilePostmounted,
13834
13969
  hidden,
13835
13970
  name,
13836
13971
  showInTimeline,
@@ -13848,39 +13983,65 @@ var CanvasImageInner = forwardRef10(({
13848
13983
  useImperativeHandle7(ref, () => {
13849
13984
  return actualRef.current;
13850
13985
  }, []);
13851
- return /* @__PURE__ */ jsx26(Sequence, {
13852
- layout: "none",
13986
+ const {
13987
+ effectivePostmountFor,
13988
+ effectivePremountFor,
13989
+ freezeFrame,
13990
+ isPremountingOrPostmounting,
13991
+ postmountingActive,
13992
+ premountingActive,
13993
+ premountingStyle
13994
+ } = usePremounting({
13853
13995
  from: from ?? 0,
13854
- trimBefore,
13855
13996
  durationInFrames: durationInFrames ?? Infinity,
13856
- freeze,
13857
- hidden,
13858
- showInTimeline: showInTimeline ?? true,
13859
- name: name ?? "<CanvasImage>",
13860
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13861
- controls,
13862
- _remotionInternalEffects: memoizedEffectDefinitions,
13863
- _remotionInternalIsMedia: { type: "image", src },
13864
- _remotionInternalStack: stack,
13865
- outlineRef: outlineRef ?? actualRef,
13866
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
13867
- ref: actualRef,
13868
- src,
13869
- width,
13870
- height,
13871
- fit,
13872
- effects,
13997
+ premountFor: premountFor ?? null,
13998
+ postmountFor: postmountFor ?? null,
13999
+ style: style ?? null,
14000
+ styleWhilePremounted: styleWhilePremounted ?? null,
14001
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
14002
+ hideWhilePremounted: "display-none"
14003
+ });
14004
+ return /* @__PURE__ */ jsx26(Freeze, {
14005
+ frame: freezeFrame,
14006
+ active: isPremountingOrPostmounting,
14007
+ children: /* @__PURE__ */ jsx26(Sequence, {
14008
+ layout: "none",
14009
+ from: from ?? 0,
14010
+ trimBefore,
14011
+ durationInFrames: durationInFrames ?? Infinity,
14012
+ freeze,
14013
+ hidden,
14014
+ showInTimeline: showInTimeline ?? true,
14015
+ name: name ?? "<CanvasImage>",
14016
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13873
14017
  controls,
13874
- className,
13875
- style,
13876
- id,
13877
- onError,
13878
- pauseWhenLoading,
13879
- maxRetries,
13880
- delayRenderRetries,
13881
- delayRenderTimeoutInMilliseconds,
13882
- refForOutline: outlineRef ?? null,
13883
- ...canvasProps
14018
+ _remotionInternalEffects: memoizedEffectDefinitions,
14019
+ _remotionInternalIsMedia: { type: "image", src },
14020
+ _remotionInternalStack: stack,
14021
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14022
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14023
+ _remotionInternalIsPremounting: premountingActive,
14024
+ _remotionInternalIsPostmounting: postmountingActive,
14025
+ outlineRef: outlineRef ?? actualRef,
14026
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
14027
+ ref: actualRef,
14028
+ src,
14029
+ width,
14030
+ height,
14031
+ fit,
14032
+ effects,
14033
+ controls,
14034
+ className,
14035
+ style: premountingStyle ?? undefined,
14036
+ id,
14037
+ onError,
14038
+ pauseWhenLoading,
14039
+ maxRetries,
14040
+ delayRenderRetries,
14041
+ delayRenderTimeoutInMilliseconds,
14042
+ refForOutline: outlineRef ?? null,
14043
+ ...canvasProps
14044
+ })
13884
14045
  })
13885
14046
  });
13886
14047
  });
@@ -14097,6 +14258,11 @@ var NativeImgInner = ({
14097
14258
  trimBefore,
14098
14259
  durationInFrames,
14099
14260
  freeze,
14261
+ premountFor,
14262
+ postmountFor,
14263
+ style,
14264
+ styleWhilePremounted,
14265
+ styleWhilePostmounted,
14100
14266
  controls,
14101
14267
  outlineRef: refForOutline,
14102
14268
  ...props2
@@ -14104,24 +14270,51 @@ var NativeImgInner = ({
14104
14270
  if (!src) {
14105
14271
  throw new Error('No "src" prop was passed to <Img>.');
14106
14272
  }
14107
- return /* @__PURE__ */ jsx28(Sequence, {
14108
- layout: "none",
14273
+ const {
14274
+ effectivePostmountFor,
14275
+ effectivePremountFor,
14276
+ freezeFrame,
14277
+ isPremountingOrPostmounting,
14278
+ postmountingActive,
14279
+ premountingActive,
14280
+ premountingStyle
14281
+ } = usePremounting({
14109
14282
  from: from ?? 0,
14110
- trimBefore,
14111
14283
  durationInFrames: durationInFrames ?? Infinity,
14112
- freeze,
14113
- _remotionInternalStack: stack,
14114
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14115
- _remotionInternalIsMedia: { type: "image", src },
14116
- name: name ?? "<Img>",
14117
- controls,
14118
- showInTimeline: showInTimeline ?? true,
14119
- hidden,
14120
- outlineRef: refForOutline,
14121
- children: /* @__PURE__ */ jsx28(ImgContent, {
14122
- src,
14123
- refForOutline,
14124
- ...props2
14284
+ premountFor: premountFor ?? null,
14285
+ postmountFor: postmountFor ?? null,
14286
+ style: style ?? null,
14287
+ styleWhilePremounted: styleWhilePremounted ?? null,
14288
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
14289
+ hideWhilePremounted: "display-none"
14290
+ });
14291
+ return /* @__PURE__ */ jsx28(Freeze, {
14292
+ frame: freezeFrame,
14293
+ active: isPremountingOrPostmounting,
14294
+ children: /* @__PURE__ */ jsx28(Sequence, {
14295
+ layout: "none",
14296
+ from: from ?? 0,
14297
+ trimBefore,
14298
+ durationInFrames: durationInFrames ?? Infinity,
14299
+ freeze,
14300
+ _remotionInternalStack: stack,
14301
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14302
+ _remotionInternalIsMedia: { type: "image", src },
14303
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14304
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14305
+ _remotionInternalIsPremounting: premountingActive,
14306
+ _remotionInternalIsPostmounting: postmountingActive,
14307
+ name: name ?? "<Img>",
14308
+ controls,
14309
+ showInTimeline: showInTimeline ?? true,
14310
+ hidden,
14311
+ outlineRef: refForOutline,
14312
+ children: /* @__PURE__ */ jsx28(ImgContent, {
14313
+ src,
14314
+ refForOutline,
14315
+ style: premountingStyle ?? undefined,
14316
+ ...props2
14317
+ })
14125
14318
  })
14126
14319
  });
14127
14320
  };
@@ -14134,7 +14327,10 @@ var imgSchema = {
14134
14327
  keyframable: false
14135
14328
  },
14136
14329
  ...baseSchema,
14137
- ...transformSchema
14330
+ ...premountSchema,
14331
+ ...transformSchema,
14332
+ ...backgroundSchema,
14333
+ ...borderSchema
14138
14334
  };
14139
14335
  var imgCanvasFallbackIncompatibleProps = new Set([
14140
14336
  "alt",
@@ -14190,6 +14386,10 @@ var ImgInner = ({
14190
14386
  trimBefore,
14191
14387
  durationInFrames,
14192
14388
  freeze,
14389
+ premountFor,
14390
+ postmountFor,
14391
+ styleWhilePremounted,
14392
+ styleWhilePostmounted,
14193
14393
  controls,
14194
14394
  width,
14195
14395
  height,
@@ -14203,6 +14403,7 @@ var ImgInner = ({
14203
14403
  ...props2
14204
14404
  }) => {
14205
14405
  const refForOutline = useRef24(null);
14406
+ const shouldPauseWhenLoading = resolveV5Default(pauseWhenLoading);
14206
14407
  if (effects.length === 0) {
14207
14408
  return /* @__PURE__ */ jsx28(NativeImgInner, {
14208
14409
  ...props2,
@@ -14216,13 +14417,17 @@ var ImgInner = ({
14216
14417
  trimBefore,
14217
14418
  durationInFrames,
14218
14419
  freeze,
14420
+ premountFor,
14421
+ postmountFor,
14422
+ styleWhilePremounted,
14423
+ styleWhilePostmounted,
14219
14424
  controls,
14220
14425
  width,
14221
14426
  height,
14222
14427
  className,
14223
14428
  style,
14224
14429
  id,
14225
- pauseWhenLoading,
14430
+ pauseWhenLoading: shouldPauseWhenLoading,
14226
14431
  maxRetries,
14227
14432
  delayRenderRetries,
14228
14433
  delayRenderTimeoutInMilliseconds,
@@ -14251,7 +14456,7 @@ var ImgInner = ({
14251
14456
  className,
14252
14457
  style,
14253
14458
  id,
14254
- pauseWhenLoading,
14459
+ pauseWhenLoading: shouldPauseWhenLoading,
14255
14460
  maxRetries,
14256
14461
  delayRenderRetries,
14257
14462
  delayRenderTimeoutInMilliseconds,
@@ -14259,6 +14464,10 @@ var ImgInner = ({
14259
14464
  trimBefore,
14260
14465
  durationInFrames,
14261
14466
  freeze,
14467
+ premountFor,
14468
+ postmountFor,
14469
+ styleWhilePremounted,
14470
+ styleWhilePostmounted,
14262
14471
  hidden,
14263
14472
  name: name ?? "<Img>",
14264
14473
  showInTimeline,
@@ -14297,7 +14506,20 @@ var interactiveElementSchema = {
14297
14506
  ...baseSchema,
14298
14507
  ...transformSchema
14299
14508
  };
14509
+ var interactiveBackgroundElementSchema = {
14510
+ ...interactiveElementSchema,
14511
+ ...backgroundSchema
14512
+ };
14513
+ var interactiveBorderElementSchema = {
14514
+ ...interactiveBackgroundElementSchema,
14515
+ ...borderSchema
14516
+ };
14300
14517
  var interactiveTextElementSchema = {
14518
+ ...interactiveBorderElementSchema,
14519
+ ...textSchema,
14520
+ ...textContentSchema
14521
+ };
14522
+ var interactiveSvgTextElementSchema = {
14301
14523
  ...interactiveElementSchema,
14302
14524
  ...textSchema,
14303
14525
  ...textContentSchema
@@ -14376,6 +14598,8 @@ var Interactive = {
14376
14598
  baseSchema,
14377
14599
  transformSchema,
14378
14600
  textSchema,
14601
+ backgroundSchema,
14602
+ borderSchema,
14379
14603
  premountSchema,
14380
14604
  sequenceSchema,
14381
14605
  withSchema,
@@ -14412,10 +14636,39 @@ var Interactive = {
14412
14636
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
14413
14637
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
14414
14638
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
14415
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
14416
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
14639
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
14640
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
14417
14641
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
14418
14642
  };
14643
+ var getAnimatedImageDurationInSeconds = async ({
14644
+ resolvedSrc,
14645
+ signal,
14646
+ requestInit,
14647
+ contentType
14648
+ }) => {
14649
+ const { decoder, selectedTrack } = await createImageDecoder({
14650
+ resolvedSrc,
14651
+ signal,
14652
+ requestInit,
14653
+ contentType
14654
+ });
14655
+ try {
14656
+ const { image } = await decoder.decode({
14657
+ frameIndex: selectedTrack.frameCount - 1,
14658
+ completeFramesOnly: true
14659
+ });
14660
+ try {
14661
+ if (image.duration === null) {
14662
+ throw new Error("Could not determine animated image duration");
14663
+ }
14664
+ return (image.timestamp + image.duration) / 1e6;
14665
+ } finally {
14666
+ image.close();
14667
+ }
14668
+ } finally {
14669
+ decoder.close();
14670
+ }
14671
+ };
14419
14672
  var compositionsRef = React31.createRef();
14420
14673
  var CompositionManagerProvider = ({
14421
14674
  children,
@@ -15397,6 +15650,7 @@ var InnerOffthreadVideo = (props2) => {
15397
15650
  ...otherProps
15398
15651
  } = props2;
15399
15652
  const environment = useRemotionEnvironment();
15653
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
15400
15654
  if (environment.isClientSideRendering) {
15401
15655
  throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
15402
15656
  }
@@ -15421,7 +15675,7 @@ var InnerOffthreadVideo = (props2) => {
15421
15675
  durationInFrames: trimAfterValue,
15422
15676
  name,
15423
15677
  children: /* @__PURE__ */ jsx35(InnerOffthreadVideo, {
15424
- pauseWhenBuffering: pauseWhenBuffering ?? false,
15678
+ pauseWhenBuffering: shouldPauseWhenBuffering,
15425
15679
  ...otherProps,
15426
15680
  trimAfter: undefined,
15427
15681
  name: undefined,
@@ -15436,7 +15690,7 @@ var InnerOffthreadVideo = (props2) => {
15436
15690
  validateMediaProps(props2, "Video");
15437
15691
  if (environment.isRendering) {
15438
15692
  return /* @__PURE__ */ jsx35(OffthreadVideoForRendering, {
15439
- pauseWhenBuffering: pauseWhenBuffering ?? false,
15693
+ pauseWhenBuffering: shouldPauseWhenBuffering,
15440
15694
  ...otherProps,
15441
15695
  trimAfter: undefined,
15442
15696
  name: undefined,
@@ -15461,7 +15715,7 @@ var InnerOffthreadVideo = (props2) => {
15461
15715
  _remotionInternalStack: stack ?? null,
15462
15716
  onDuration,
15463
15717
  onlyWarnForMediaSeekingError: true,
15464
- pauseWhenBuffering: pauseWhenBuffering ?? false,
15718
+ pauseWhenBuffering: shouldPauseWhenBuffering,
15465
15719
  showInTimeline: showInTimeline ?? true,
15466
15720
  onAutoPlayError: onAutoPlayError ?? undefined,
15467
15721
  onVideoFrame: onVideoFrame ?? null,
@@ -15519,7 +15773,7 @@ var OffthreadVideo = ({
15519
15773
  onAutoPlayError: onAutoPlayError ?? null,
15520
15774
  onError,
15521
15775
  onVideoFrame,
15522
- pauseWhenBuffering: pauseWhenBuffering ?? true,
15776
+ pauseWhenBuffering: resolveV5Default(pauseWhenBuffering),
15523
15777
  playbackRate: playbackRate ?? 1,
15524
15778
  preservePitch,
15525
15779
  toneFrequency: toneFrequency ?? 1,
@@ -15643,6 +15897,7 @@ var Internals = {
15643
15897
  useAbsoluteTimelinePosition,
15644
15898
  evaluateVolume,
15645
15899
  getAbsoluteSrc,
15900
+ getAnimatedImageDurationInSeconds,
15646
15901
  getAssetDisplayName,
15647
15902
  Timeline: exports_timeline_position_state,
15648
15903
  validateMediaTrimProps,
@@ -15667,7 +15922,6 @@ var Internals = {
15667
15922
  textSchema,
15668
15923
  transformSchema,
15669
15924
  premountSchema,
15670
- premountStyleSchema,
15671
15925
  flattenActiveSchema,
15672
15926
  getFlatSchemaWithAllKeys,
15673
15927
  RemotionRootContexts,
@@ -15806,6 +16060,7 @@ var seriesSequenceSchema = {
15806
16060
  hidden: Interactive.sequenceSchema.hidden,
15807
16061
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
15808
16062
  freeze: Interactive.baseSchema.freeze,
16063
+ trimBefore: Interactive.sequenceSchema.trimBefore,
15809
16064
  layout: Interactive.sequenceSchema.layout
15810
16065
  };
15811
16066
  var SeriesSequenceInner = forwardRef14(({
@@ -16401,6 +16656,7 @@ var VideoForwardingFunction = (props2, ref) => {
16401
16656
  const { loop, ...propsOtherThanLoop } = props2;
16402
16657
  const { fps } = useVideoConfig();
16403
16658
  const environment = useRemotionEnvironment();
16659
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
16404
16660
  if (environment.isClientSideRendering) {
16405
16661
  throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
16406
16662
  }
@@ -16459,7 +16715,7 @@ var VideoForwardingFunction = (props2, ref) => {
16459
16715
  durationInFrames: trimAfterValue === undefined ? undefined : trimAfterValue / (props2.playbackRate ?? 1),
16460
16716
  name,
16461
16717
  children: /* @__PURE__ */ jsx39(Html5Video, {
16462
- pauseWhenBuffering: pauseWhenBuffering ?? false,
16718
+ pauseWhenBuffering: shouldPauseWhenBuffering,
16463
16719
  onVideoFrame,
16464
16720
  ...otherProps,
16465
16721
  ref,
@@ -16485,7 +16741,7 @@ var VideoForwardingFunction = (props2, ref) => {
16485
16741
  ...otherProps,
16486
16742
  ref,
16487
16743
  onVideoFrame: onVideoFrame ?? null,
16488
- pauseWhenBuffering: pauseWhenBuffering ?? false,
16744
+ pauseWhenBuffering: shouldPauseWhenBuffering,
16489
16745
  onDuration,
16490
16746
  _remotionInternalStack: stack ?? null,
16491
16747
  _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed ?? false,
@@ -16878,7 +17134,9 @@ var makeShapeSchema = (shapeFields) => {
16878
17134
  defaultValue: "#0b84ff",
16879
17135
  description: "Fill"
16880
17136
  }),
16881
- ...Internals.transformSchema
17137
+ ...Internals.transformSchema,
17138
+ ...Interactive.backgroundSchema,
17139
+ ...Interactive.borderSchema
16882
17140
  };
16883
17141
  };
16884
17142
  var arrowSchema = makeShapeSchema({