@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.
@@ -5579,7 +5579,7 @@ var getSingleChildComponent = (children) => {
5579
5579
  }
5580
5580
  return child.type;
5581
5581
  };
5582
- var VERSION = "4.0.496";
5582
+ var VERSION = "4.0.498";
5583
5583
  var checkMultipleRemotionVersions = () => {
5584
5584
  if (typeof globalThis === "undefined") {
5585
5585
  return;
@@ -6057,6 +6057,45 @@ var textSchema = {
6057
6057
  hiddenFromList: false
6058
6058
  }
6059
6059
  };
6060
+ var borderSchema = {
6061
+ "style.borderWidth": {
6062
+ type: "number",
6063
+ default: undefined,
6064
+ min: 0,
6065
+ step: 1,
6066
+ description: "Border width",
6067
+ hiddenFromList: false
6068
+ },
6069
+ "style.borderStyle": {
6070
+ type: "enum",
6071
+ default: "none",
6072
+ description: "Border style",
6073
+ variants: {
6074
+ none: {},
6075
+ hidden: {},
6076
+ solid: {},
6077
+ dashed: {},
6078
+ dotted: {},
6079
+ double: {},
6080
+ groove: {},
6081
+ ridge: {},
6082
+ inset: {},
6083
+ outset: {}
6084
+ }
6085
+ },
6086
+ "style.borderColor": {
6087
+ type: "color",
6088
+ default: undefined,
6089
+ description: "Border color"
6090
+ }
6091
+ };
6092
+ var backgroundSchema = {
6093
+ "style.backgroundColor": {
6094
+ type: "color",
6095
+ default: "transparent",
6096
+ description: "Color"
6097
+ }
6098
+ };
6060
6099
  var textContentSchema = {
6061
6100
  children: {
6062
6101
  type: "text-content",
@@ -6084,20 +6123,13 @@ var premountSchema = {
6084
6123
  keyframable: false
6085
6124
  }
6086
6125
  };
6087
- var premountStyleSchema = {
6088
- styleWhilePremounted: {
6089
- type: "hidden"
6090
- },
6091
- styleWhilePostmounted: {
6092
- type: "hidden"
6093
- }
6094
- };
6095
6126
  var sequencePremountSchema = {
6096
- ...premountSchema,
6097
- ...premountStyleSchema
6127
+ ...premountSchema
6098
6128
  };
6099
6129
  var sequenceStyleSchema = {
6100
6130
  ...transformSchema,
6131
+ ...backgroundSchema,
6132
+ ...borderSchema,
6101
6133
  ...sequencePremountSchema
6102
6134
  };
6103
6135
  var hiddenField = {
@@ -6385,6 +6417,9 @@ var PremountContext = createContext15({
6385
6417
  premountFramesRemaining: 0
6386
6418
  });
6387
6419
  var ENABLE_V5_BREAKING_CHANGES = false;
6420
+ var resolveV5Default = (value) => {
6421
+ return value ?? ENABLE_V5_BREAKING_CHANGES;
6422
+ };
6388
6423
  var usePremounting = ({
6389
6424
  from,
6390
6425
  durationInFrames,
@@ -9433,38 +9468,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
9433
9468
  });
9434
9469
  };
9435
9470
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
9436
- var CACHE_SIZE = 5;
9437
- var getActualTime = ({
9438
- loopBehavior,
9439
- durationFound,
9440
- timeInSec
9441
- }) => {
9442
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9443
- };
9444
- var decodeImage = async ({
9471
+ var createImageDecoder = async ({
9445
9472
  resolvedSrc,
9446
9473
  signal,
9447
9474
  requestInit,
9448
- currentTime,
9449
- initialLoopBehavior
9475
+ contentType
9450
9476
  }) => {
9451
9477
  if (typeof ImageDecoder === "undefined") {
9452
9478
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
9453
9479
  }
9454
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
9455
- const { body } = res;
9480
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
9481
+ const { body } = response;
9456
9482
  if (!body) {
9457
9483
  throw new Error("Got no body");
9458
9484
  }
9459
9485
  const decoder = new ImageDecoder({
9460
9486
  data: body,
9461
- type: res.headers.get("Content-Type") || "image/gif"
9487
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
9462
9488
  });
9463
- await decoder.completed;
9489
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
9464
9490
  const { selectedTrack } = decoder.tracks;
9465
9491
  if (!selectedTrack) {
9492
+ decoder.close();
9466
9493
  throw new Error("No selected track");
9467
9494
  }
9495
+ return { decoder, selectedTrack };
9496
+ };
9497
+ var CACHE_SIZE = 5;
9498
+ var getActualTime = ({
9499
+ loopBehavior,
9500
+ durationFound,
9501
+ timeInSec
9502
+ }) => {
9503
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9504
+ };
9505
+ var decodeImage = async ({
9506
+ resolvedSrc,
9507
+ signal,
9508
+ requestInit,
9509
+ currentTime,
9510
+ initialLoopBehavior
9511
+ }) => {
9512
+ const { decoder, selectedTrack } = await createImageDecoder({
9513
+ resolvedSrc,
9514
+ signal,
9515
+ requestInit,
9516
+ contentType: null
9517
+ });
9468
9518
  const cache2 = [];
9469
9519
  let durationFound = null;
9470
9520
  const getFrameByIndex = async (frameIndex) => {
@@ -9570,6 +9620,13 @@ var decodeImage = async ({
9570
9620
  return closest;
9571
9621
  };
9572
9622
  return {
9623
+ close: () => {
9624
+ for (const item of cache2) {
9625
+ item.frame?.close();
9626
+ item.frame = null;
9627
+ }
9628
+ decoder.close();
9629
+ },
9573
9630
  getFrame,
9574
9631
  frameCount: selectedTrack.frameCount
9575
9632
  };
@@ -9607,6 +9664,7 @@ var animatedImageSchema = {
9607
9664
  keyframable: false
9608
9665
  },
9609
9666
  ...baseSchema,
9667
+ ...premountSchema,
9610
9668
  playbackRate: {
9611
9669
  type: "number",
9612
9670
  min: 0,
@@ -9617,7 +9675,9 @@ var animatedImageSchema = {
9617
9675
  hiddenFromList: false,
9618
9676
  keyframable: false
9619
9677
  },
9620
- ...transformSchema
9678
+ ...transformSchema,
9679
+ ...backgroundSchema,
9680
+ ...borderSchema
9621
9681
  };
9622
9682
  var getCanvasPropsFromSequenceProps = (props) => {
9623
9683
  const canvasProps = {};
@@ -9669,6 +9729,15 @@ var AnimatedImageContent = forwardRef4(({
9669
9729
  const [initialLoopBehavior] = useState6(() => loopBehavior);
9670
9730
  useEffect5(() => {
9671
9731
  const controller = new AbortController;
9732
+ let cancelled = false;
9733
+ let continued = false;
9734
+ const continueRenderOnce = () => {
9735
+ if (continued) {
9736
+ return;
9737
+ }
9738
+ continued = true;
9739
+ continueRender2(decodeHandle);
9740
+ };
9672
9741
  decodeImage({
9673
9742
  resolvedSrc,
9674
9743
  signal: controller.signal,
@@ -9676,22 +9745,31 @@ var AnimatedImageContent = forwardRef4(({
9676
9745
  currentTime: currentTimeRef.current,
9677
9746
  initialLoopBehavior
9678
9747
  }).then((d) => {
9748
+ if (cancelled) {
9749
+ d.close();
9750
+ return;
9751
+ }
9679
9752
  setImageDecoder(d);
9680
- continueRender2(decodeHandle);
9753
+ continueRenderOnce();
9681
9754
  }).catch((err) => {
9755
+ if (cancelled) {
9756
+ return;
9757
+ }
9682
9758
  if (err.name === "AbortError") {
9683
- continueRender2(decodeHandle);
9759
+ continueRenderOnce();
9684
9760
  return;
9685
9761
  }
9686
9762
  if (onError) {
9687
9763
  onError?.(err);
9688
- continueRender2(decodeHandle);
9764
+ continueRenderOnce();
9689
9765
  } else {
9690
9766
  cancelRender(err);
9691
9767
  }
9692
9768
  });
9693
9769
  return () => {
9770
+ cancelled = true;
9694
9771
  controller.abort();
9772
+ continueRenderOnce();
9695
9773
  };
9696
9774
  }, [
9697
9775
  resolvedSrc,
@@ -9701,6 +9779,11 @@ var AnimatedImageContent = forwardRef4(({
9701
9779
  initialLoopBehavior,
9702
9780
  continueRender2
9703
9781
  ]);
9782
+ useEffect5(() => {
9783
+ return () => {
9784
+ imageDecoder?.close();
9785
+ };
9786
+ }, [imageDecoder]);
9704
9787
  useLayoutEffect2(() => {
9705
9788
  if (!imageDecoder) {
9706
9789
  return;
@@ -9770,6 +9853,11 @@ var AnimatedImageInner = ({
9770
9853
  className,
9771
9854
  style,
9772
9855
  durationInFrames,
9856
+ from,
9857
+ premountFor,
9858
+ postmountFor,
9859
+ styleWhilePremounted,
9860
+ styleWhilePostmounted,
9773
9861
  requestInit,
9774
9862
  effects = [],
9775
9863
  controls,
@@ -9781,6 +9869,24 @@ var AnimatedImageInner = ({
9781
9869
  useImperativeHandle2(ref, () => {
9782
9870
  return actualRef.current;
9783
9871
  }, []);
9872
+ const {
9873
+ effectivePostmountFor,
9874
+ effectivePremountFor,
9875
+ freezeFrame,
9876
+ isPremountingOrPostmounting,
9877
+ postmountingActive,
9878
+ premountingActive,
9879
+ premountingStyle
9880
+ } = usePremounting({
9881
+ from: from ?? 0,
9882
+ durationInFrames: durationInFrames ?? Infinity,
9883
+ premountFor: premountFor ?? null,
9884
+ postmountFor: postmountFor ?? null,
9885
+ style: style ?? null,
9886
+ styleWhilePremounted: styleWhilePremounted ?? null,
9887
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
9888
+ hideWhilePremounted: "display-none"
9889
+ });
9784
9890
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
9785
9891
  const animatedImageProps = {
9786
9892
  src,
@@ -9792,24 +9898,33 @@ var AnimatedImageInner = ({
9792
9898
  loopBehavior,
9793
9899
  id,
9794
9900
  className,
9795
- style,
9901
+ style: premountingStyle ?? undefined,
9796
9902
  requestInit,
9797
9903
  ...canvasProps
9798
9904
  };
9799
- return /* @__PURE__ */ jsx14(Sequence, {
9800
- layout: "none",
9801
- durationInFrames,
9802
- name: "<AnimatedImage>",
9803
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9804
- controls,
9805
- _remotionInternalEffects: memoizedEffectDefinitions,
9806
- ...sequenceProps,
9807
- outlineRef: actualRef,
9808
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9809
- ...animatedImageProps,
9810
- ref: actualRef,
9811
- effects,
9812
- controls
9905
+ return /* @__PURE__ */ jsx14(Freeze, {
9906
+ frame: freezeFrame,
9907
+ active: isPremountingOrPostmounting,
9908
+ children: /* @__PURE__ */ jsx14(Sequence, {
9909
+ layout: "none",
9910
+ from: from ?? 0,
9911
+ durationInFrames: durationInFrames ?? Infinity,
9912
+ name: "<AnimatedImage>",
9913
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9914
+ controls,
9915
+ _remotionInternalEffects: memoizedEffectDefinitions,
9916
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
9917
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
9918
+ _remotionInternalIsPremounting: premountingActive,
9919
+ _remotionInternalIsPostmounting: postmountingActive,
9920
+ ...sequenceProps,
9921
+ outlineRef: actualRef,
9922
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9923
+ ...animatedImageProps,
9924
+ ref: actualRef,
9925
+ effects,
9926
+ controls
9927
+ })
9813
9928
  })
9814
9929
  });
9815
9930
  };
@@ -10525,13 +10640,17 @@ var makeSharedElementSourceNode = ({
10525
10640
  }) => {
10526
10641
  let connected = null;
10527
10642
  let disposed = false;
10643
+ let currentAudioContext = audioContext;
10528
10644
  return {
10645
+ setAudioContext: (newAudioContext) => {
10646
+ currentAudioContext = newAudioContext;
10647
+ },
10529
10648
  attemptToConnect: () => {
10530
10649
  if (disposed) {
10531
10650
  throw new Error("SharedElementSourceNode has been disposed");
10532
10651
  }
10533
- if (!connected && ref.current) {
10534
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
10652
+ if (!connected && ref.current && currentAudioContext) {
10653
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
10535
10654
  connected = mediaElementSourceNode;
10536
10655
  }
10537
10656
  },
@@ -10859,19 +10978,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10859
10978
  const audioCtx = useContext21(SharedAudioContext);
10860
10979
  const audioContext = audioCtx?.audioContext ?? null;
10861
10980
  const resume = audioCtx?.resume;
10862
- const refs = useMemo22(() => {
10981
+ const [refs] = useState10(() => {
10863
10982
  return new Array(numberOfAudioTags).fill(true).map(() => {
10864
10983
  const ref = createRef2();
10865
10984
  return {
10866
10985
  id: Math.random(),
10867
10986
  ref,
10868
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
10987
+ mediaElementSourceNode: makeSharedElementSourceNode({
10869
10988
  audioContext,
10870
10989
  ref
10871
- }) : null
10990
+ })
10872
10991
  };
10873
10992
  });
10874
- }, [audioContext, numberOfAudioTags]);
10993
+ });
10994
+ for (const { mediaElementSourceNode } of refs) {
10995
+ mediaElementSourceNode?.setAudioContext(audioContext);
10996
+ }
10875
10997
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
10876
10998
  effectToUse(() => {
10877
10999
  return () => {
@@ -10939,7 +11061,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10939
11061
  const cloned = [...takenAudios.current];
10940
11062
  const index = refs.findIndex((r2) => r2.id === id);
10941
11063
  if (index === -1) {
10942
- throw new TypeError("Error occured in ");
11064
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r2) => r2.id).join(", ")}`);
10943
11065
  }
10944
11066
  cloned[index] = false;
10945
11067
  takenAudios.current = cloned;
@@ -11043,10 +11165,10 @@ var useSharedAudio = ({
11043
11165
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
11044
11166
  }
11045
11167
  const el = React20.createRef();
11046
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
11047
- audioContext: audioCtx.audioContext,
11168
+ const mediaElementSourceNode = makeSharedElementSourceNode({
11169
+ audioContext: audioCtx?.audioContext ?? null,
11048
11170
  ref: el
11049
- }) : null;
11171
+ });
11050
11172
  return {
11051
11173
  el,
11052
11174
  id: Math.random(),
@@ -11061,6 +11183,7 @@ var useSharedAudio = ({
11061
11183
  }
11062
11184
  };
11063
11185
  });
11186
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
11064
11187
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
11065
11188
  if (typeof document !== "undefined") {
11066
11189
  effectToUse(() => {
@@ -12772,6 +12895,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12772
12895
  const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
12773
12896
  const { fps } = useVideoConfig();
12774
12897
  const environment = useRemotionEnvironment();
12898
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
12775
12899
  if (environment.isClientSideRendering) {
12776
12900
  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");
12777
12901
  }
@@ -12841,7 +12965,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12841
12965
  name,
12842
12966
  children: /* @__PURE__ */ jsx23(Html5Audio, {
12843
12967
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
12844
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12968
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12845
12969
  ...otherProps,
12846
12970
  ref
12847
12971
  })
@@ -12869,7 +12993,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12869
12993
  ref,
12870
12994
  onNativeError: onError,
12871
12995
  onDuration,
12872
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12996
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12873
12997
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
12874
12998
  showInTimeline: showInTimeline ?? true
12875
12999
  });
@@ -12918,7 +13042,9 @@ var solidSchema = {
12918
13042
  description: "Pixel density",
12919
13043
  hiddenFromList: false
12920
13044
  },
12921
- ...transformSchema
13045
+ ...transformSchema,
13046
+ ...backgroundSchema,
13047
+ ...borderSchema
12922
13048
  };
12923
13049
  var SolidInner = ({
12924
13050
  color,
@@ -13472,7 +13598,9 @@ var htmlInCanvasSchema = {
13472
13598
  description: "Pixel density",
13473
13599
  hiddenFromList: false
13474
13600
  },
13475
- ...transformSchema
13601
+ ...transformSchema,
13602
+ ...backgroundSchema,
13603
+ ...borderSchema
13476
13604
  };
13477
13605
  var HtmlInCanvasWrapped = withInteractivitySchema({
13478
13606
  Component: HtmlInCanvasInner,
@@ -13494,6 +13622,7 @@ function truncateSrcForLabel(src) {
13494
13622
  }
13495
13623
  var canvasImageSchema = {
13496
13624
  ...baseSchema,
13625
+ ...premountSchema,
13497
13626
  fit: {
13498
13627
  type: "enum",
13499
13628
  default: "fill",
@@ -13504,7 +13633,9 @@ var canvasImageSchema = {
13504
13633
  cover: {}
13505
13634
  }
13506
13635
  },
13507
- ...transformSchema
13636
+ ...transformSchema,
13637
+ ...backgroundSchema,
13638
+ ...borderSchema
13508
13639
  };
13509
13640
  var makeAbortError = () => {
13510
13641
  if (typeof DOMException !== "undefined") {
@@ -13828,6 +13959,10 @@ var CanvasImageInner = forwardRef10(({
13828
13959
  from,
13829
13960
  trimBefore,
13830
13961
  freeze,
13962
+ premountFor,
13963
+ postmountFor,
13964
+ styleWhilePremounted,
13965
+ styleWhilePostmounted,
13831
13966
  hidden,
13832
13967
  name,
13833
13968
  showInTimeline,
@@ -13845,39 +13980,65 @@ var CanvasImageInner = forwardRef10(({
13845
13980
  useImperativeHandle7(ref, () => {
13846
13981
  return actualRef.current;
13847
13982
  }, []);
13848
- return /* @__PURE__ */ jsx26(Sequence, {
13849
- layout: "none",
13983
+ const {
13984
+ effectivePostmountFor,
13985
+ effectivePremountFor,
13986
+ freezeFrame,
13987
+ isPremountingOrPostmounting,
13988
+ postmountingActive,
13989
+ premountingActive,
13990
+ premountingStyle
13991
+ } = usePremounting({
13850
13992
  from: from ?? 0,
13851
- trimBefore,
13852
13993
  durationInFrames: durationInFrames ?? Infinity,
13853
- freeze,
13854
- hidden,
13855
- showInTimeline: showInTimeline ?? true,
13856
- name: name ?? "<CanvasImage>",
13857
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13858
- controls,
13859
- _remotionInternalEffects: memoizedEffectDefinitions,
13860
- _remotionInternalIsMedia: { type: "image", src },
13861
- _remotionInternalStack: stack,
13862
- outlineRef: outlineRef ?? actualRef,
13863
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
13864
- ref: actualRef,
13865
- src,
13866
- width,
13867
- height,
13868
- fit,
13869
- effects,
13994
+ premountFor: premountFor ?? null,
13995
+ postmountFor: postmountFor ?? null,
13996
+ style: style ?? null,
13997
+ styleWhilePremounted: styleWhilePremounted ?? null,
13998
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
13999
+ hideWhilePremounted: "display-none"
14000
+ });
14001
+ return /* @__PURE__ */ jsx26(Freeze, {
14002
+ frame: freezeFrame,
14003
+ active: isPremountingOrPostmounting,
14004
+ children: /* @__PURE__ */ jsx26(Sequence, {
14005
+ layout: "none",
14006
+ from: from ?? 0,
14007
+ trimBefore,
14008
+ durationInFrames: durationInFrames ?? Infinity,
14009
+ freeze,
14010
+ hidden,
14011
+ showInTimeline: showInTimeline ?? true,
14012
+ name: name ?? "<CanvasImage>",
14013
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13870
14014
  controls,
13871
- className,
13872
- style,
13873
- id,
13874
- onError,
13875
- pauseWhenLoading,
13876
- maxRetries,
13877
- delayRenderRetries,
13878
- delayRenderTimeoutInMilliseconds,
13879
- refForOutline: outlineRef ?? null,
13880
- ...canvasProps
14015
+ _remotionInternalEffects: memoizedEffectDefinitions,
14016
+ _remotionInternalIsMedia: { type: "image", src },
14017
+ _remotionInternalStack: stack,
14018
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14019
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14020
+ _remotionInternalIsPremounting: premountingActive,
14021
+ _remotionInternalIsPostmounting: postmountingActive,
14022
+ outlineRef: outlineRef ?? actualRef,
14023
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
14024
+ ref: actualRef,
14025
+ src,
14026
+ width,
14027
+ height,
14028
+ fit,
14029
+ effects,
14030
+ controls,
14031
+ className,
14032
+ style: premountingStyle ?? undefined,
14033
+ id,
14034
+ onError,
14035
+ pauseWhenLoading,
14036
+ maxRetries,
14037
+ delayRenderRetries,
14038
+ delayRenderTimeoutInMilliseconds,
14039
+ refForOutline: outlineRef ?? null,
14040
+ ...canvasProps
14041
+ })
13881
14042
  })
13882
14043
  });
13883
14044
  });
@@ -14094,6 +14255,11 @@ var NativeImgInner = ({
14094
14255
  trimBefore,
14095
14256
  durationInFrames,
14096
14257
  freeze,
14258
+ premountFor,
14259
+ postmountFor,
14260
+ style,
14261
+ styleWhilePremounted,
14262
+ styleWhilePostmounted,
14097
14263
  controls,
14098
14264
  outlineRef: refForOutline,
14099
14265
  ...props2
@@ -14101,24 +14267,51 @@ var NativeImgInner = ({
14101
14267
  if (!src) {
14102
14268
  throw new Error('No "src" prop was passed to <Img>.');
14103
14269
  }
14104
- return /* @__PURE__ */ jsx28(Sequence, {
14105
- layout: "none",
14270
+ const {
14271
+ effectivePostmountFor,
14272
+ effectivePremountFor,
14273
+ freezeFrame,
14274
+ isPremountingOrPostmounting,
14275
+ postmountingActive,
14276
+ premountingActive,
14277
+ premountingStyle
14278
+ } = usePremounting({
14106
14279
  from: from ?? 0,
14107
- trimBefore,
14108
14280
  durationInFrames: durationInFrames ?? Infinity,
14109
- freeze,
14110
- _remotionInternalStack: stack,
14111
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14112
- _remotionInternalIsMedia: { type: "image", src },
14113
- name: name ?? "<Img>",
14114
- controls,
14115
- showInTimeline: showInTimeline ?? true,
14116
- hidden,
14117
- outlineRef: refForOutline,
14118
- children: /* @__PURE__ */ jsx28(ImgContent, {
14119
- src,
14120
- refForOutline,
14121
- ...props2
14281
+ premountFor: premountFor ?? null,
14282
+ postmountFor: postmountFor ?? null,
14283
+ style: style ?? null,
14284
+ styleWhilePremounted: styleWhilePremounted ?? null,
14285
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
14286
+ hideWhilePremounted: "display-none"
14287
+ });
14288
+ return /* @__PURE__ */ jsx28(Freeze, {
14289
+ frame: freezeFrame,
14290
+ active: isPremountingOrPostmounting,
14291
+ children: /* @__PURE__ */ jsx28(Sequence, {
14292
+ layout: "none",
14293
+ from: from ?? 0,
14294
+ trimBefore,
14295
+ durationInFrames: durationInFrames ?? Infinity,
14296
+ freeze,
14297
+ _remotionInternalStack: stack,
14298
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14299
+ _remotionInternalIsMedia: { type: "image", src },
14300
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14301
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14302
+ _remotionInternalIsPremounting: premountingActive,
14303
+ _remotionInternalIsPostmounting: postmountingActive,
14304
+ name: name ?? "<Img>",
14305
+ controls,
14306
+ showInTimeline: showInTimeline ?? true,
14307
+ hidden,
14308
+ outlineRef: refForOutline,
14309
+ children: /* @__PURE__ */ jsx28(ImgContent, {
14310
+ src,
14311
+ refForOutline,
14312
+ style: premountingStyle ?? undefined,
14313
+ ...props2
14314
+ })
14122
14315
  })
14123
14316
  });
14124
14317
  };
@@ -14131,7 +14324,10 @@ var imgSchema = {
14131
14324
  keyframable: false
14132
14325
  },
14133
14326
  ...baseSchema,
14134
- ...transformSchema
14327
+ ...premountSchema,
14328
+ ...transformSchema,
14329
+ ...backgroundSchema,
14330
+ ...borderSchema
14135
14331
  };
14136
14332
  var imgCanvasFallbackIncompatibleProps = new Set([
14137
14333
  "alt",
@@ -14187,6 +14383,10 @@ var ImgInner = ({
14187
14383
  trimBefore,
14188
14384
  durationInFrames,
14189
14385
  freeze,
14386
+ premountFor,
14387
+ postmountFor,
14388
+ styleWhilePremounted,
14389
+ styleWhilePostmounted,
14190
14390
  controls,
14191
14391
  width,
14192
14392
  height,
@@ -14200,6 +14400,7 @@ var ImgInner = ({
14200
14400
  ...props2
14201
14401
  }) => {
14202
14402
  const refForOutline = useRef24(null);
14403
+ const shouldPauseWhenLoading = resolveV5Default(pauseWhenLoading);
14203
14404
  if (effects.length === 0) {
14204
14405
  return /* @__PURE__ */ jsx28(NativeImgInner, {
14205
14406
  ...props2,
@@ -14213,13 +14414,17 @@ var ImgInner = ({
14213
14414
  trimBefore,
14214
14415
  durationInFrames,
14215
14416
  freeze,
14417
+ premountFor,
14418
+ postmountFor,
14419
+ styleWhilePremounted,
14420
+ styleWhilePostmounted,
14216
14421
  controls,
14217
14422
  width,
14218
14423
  height,
14219
14424
  className,
14220
14425
  style,
14221
14426
  id,
14222
- pauseWhenLoading,
14427
+ pauseWhenLoading: shouldPauseWhenLoading,
14223
14428
  maxRetries,
14224
14429
  delayRenderRetries,
14225
14430
  delayRenderTimeoutInMilliseconds,
@@ -14248,7 +14453,7 @@ var ImgInner = ({
14248
14453
  className,
14249
14454
  style,
14250
14455
  id,
14251
- pauseWhenLoading,
14456
+ pauseWhenLoading: shouldPauseWhenLoading,
14252
14457
  maxRetries,
14253
14458
  delayRenderRetries,
14254
14459
  delayRenderTimeoutInMilliseconds,
@@ -14256,6 +14461,10 @@ var ImgInner = ({
14256
14461
  trimBefore,
14257
14462
  durationInFrames,
14258
14463
  freeze,
14464
+ premountFor,
14465
+ postmountFor,
14466
+ styleWhilePremounted,
14467
+ styleWhilePostmounted,
14259
14468
  hidden,
14260
14469
  name: name ?? "<Img>",
14261
14470
  showInTimeline,
@@ -14294,7 +14503,20 @@ var interactiveElementSchema = {
14294
14503
  ...baseSchema,
14295
14504
  ...transformSchema
14296
14505
  };
14506
+ var interactiveBackgroundElementSchema = {
14507
+ ...interactiveElementSchema,
14508
+ ...backgroundSchema
14509
+ };
14510
+ var interactiveBorderElementSchema = {
14511
+ ...interactiveBackgroundElementSchema,
14512
+ ...borderSchema
14513
+ };
14297
14514
  var interactiveTextElementSchema = {
14515
+ ...interactiveBorderElementSchema,
14516
+ ...textSchema,
14517
+ ...textContentSchema
14518
+ };
14519
+ var interactiveSvgTextElementSchema = {
14298
14520
  ...interactiveElementSchema,
14299
14521
  ...textSchema,
14300
14522
  ...textContentSchema
@@ -14373,6 +14595,8 @@ var Interactive = {
14373
14595
  baseSchema,
14374
14596
  transformSchema,
14375
14597
  textSchema,
14598
+ backgroundSchema,
14599
+ borderSchema,
14376
14600
  premountSchema,
14377
14601
  sequenceSchema,
14378
14602
  withSchema,
@@ -14409,10 +14633,39 @@ var Interactive = {
14409
14633
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
14410
14634
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
14411
14635
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
14412
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
14413
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
14636
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
14637
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
14414
14638
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
14415
14639
  };
14640
+ var getAnimatedImageDurationInSeconds = async ({
14641
+ resolvedSrc,
14642
+ signal,
14643
+ requestInit,
14644
+ contentType
14645
+ }) => {
14646
+ const { decoder, selectedTrack } = await createImageDecoder({
14647
+ resolvedSrc,
14648
+ signal,
14649
+ requestInit,
14650
+ contentType
14651
+ });
14652
+ try {
14653
+ const { image } = await decoder.decode({
14654
+ frameIndex: selectedTrack.frameCount - 1,
14655
+ completeFramesOnly: true
14656
+ });
14657
+ try {
14658
+ if (image.duration === null) {
14659
+ throw new Error("Could not determine animated image duration");
14660
+ }
14661
+ return (image.timestamp + image.duration) / 1e6;
14662
+ } finally {
14663
+ image.close();
14664
+ }
14665
+ } finally {
14666
+ decoder.close();
14667
+ }
14668
+ };
14416
14669
  var compositionsRef = React31.createRef();
14417
14670
  var CompositionManagerProvider = ({
14418
14671
  children,
@@ -15394,6 +15647,7 @@ var InnerOffthreadVideo = (props2) => {
15394
15647
  ...otherProps
15395
15648
  } = props2;
15396
15649
  const environment = useRemotionEnvironment();
15650
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
15397
15651
  if (environment.isClientSideRendering) {
15398
15652
  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");
15399
15653
  }
@@ -15418,7 +15672,7 @@ var InnerOffthreadVideo = (props2) => {
15418
15672
  durationInFrames: trimAfterValue,
15419
15673
  name,
15420
15674
  children: /* @__PURE__ */ jsx35(InnerOffthreadVideo, {
15421
- pauseWhenBuffering: pauseWhenBuffering ?? false,
15675
+ pauseWhenBuffering: shouldPauseWhenBuffering,
15422
15676
  ...otherProps,
15423
15677
  trimAfter: undefined,
15424
15678
  name: undefined,
@@ -15433,7 +15687,7 @@ var InnerOffthreadVideo = (props2) => {
15433
15687
  validateMediaProps(props2, "Video");
15434
15688
  if (environment.isRendering) {
15435
15689
  return /* @__PURE__ */ jsx35(OffthreadVideoForRendering, {
15436
- pauseWhenBuffering: pauseWhenBuffering ?? false,
15690
+ pauseWhenBuffering: shouldPauseWhenBuffering,
15437
15691
  ...otherProps,
15438
15692
  trimAfter: undefined,
15439
15693
  name: undefined,
@@ -15458,7 +15712,7 @@ var InnerOffthreadVideo = (props2) => {
15458
15712
  _remotionInternalStack: stack ?? null,
15459
15713
  onDuration,
15460
15714
  onlyWarnForMediaSeekingError: true,
15461
- pauseWhenBuffering: pauseWhenBuffering ?? false,
15715
+ pauseWhenBuffering: shouldPauseWhenBuffering,
15462
15716
  showInTimeline: showInTimeline ?? true,
15463
15717
  onAutoPlayError: onAutoPlayError ?? undefined,
15464
15718
  onVideoFrame: onVideoFrame ?? null,
@@ -15516,7 +15770,7 @@ var OffthreadVideo = ({
15516
15770
  onAutoPlayError: onAutoPlayError ?? null,
15517
15771
  onError,
15518
15772
  onVideoFrame,
15519
- pauseWhenBuffering: pauseWhenBuffering ?? true,
15773
+ pauseWhenBuffering: resolveV5Default(pauseWhenBuffering),
15520
15774
  playbackRate: playbackRate ?? 1,
15521
15775
  preservePitch,
15522
15776
  toneFrequency: toneFrequency ?? 1,
@@ -15640,6 +15894,7 @@ var Internals = {
15640
15894
  useAbsoluteTimelinePosition,
15641
15895
  evaluateVolume,
15642
15896
  getAbsoluteSrc,
15897
+ getAnimatedImageDurationInSeconds,
15643
15898
  getAssetDisplayName,
15644
15899
  Timeline: exports_timeline_position_state,
15645
15900
  validateMediaTrimProps,
@@ -15664,7 +15919,6 @@ var Internals = {
15664
15919
  textSchema,
15665
15920
  transformSchema,
15666
15921
  premountSchema,
15667
- premountStyleSchema,
15668
15922
  flattenActiveSchema,
15669
15923
  getFlatSchemaWithAllKeys,
15670
15924
  RemotionRootContexts,
@@ -15803,6 +16057,7 @@ var seriesSequenceSchema = {
15803
16057
  hidden: Interactive.sequenceSchema.hidden,
15804
16058
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
15805
16059
  freeze: Interactive.baseSchema.freeze,
16060
+ trimBefore: Interactive.sequenceSchema.trimBefore,
15806
16061
  layout: Interactive.sequenceSchema.layout
15807
16062
  };
15808
16063
  var SeriesSequenceInner = forwardRef14(({
@@ -16398,6 +16653,7 @@ var VideoForwardingFunction = (props2, ref) => {
16398
16653
  const { loop, ...propsOtherThanLoop } = props2;
16399
16654
  const { fps } = useVideoConfig();
16400
16655
  const environment = useRemotionEnvironment();
16656
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
16401
16657
  if (environment.isClientSideRendering) {
16402
16658
  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");
16403
16659
  }
@@ -16456,7 +16712,7 @@ var VideoForwardingFunction = (props2, ref) => {
16456
16712
  durationInFrames: trimAfterValue === undefined ? undefined : trimAfterValue / (props2.playbackRate ?? 1),
16457
16713
  name,
16458
16714
  children: /* @__PURE__ */ jsx39(Html5Video, {
16459
- pauseWhenBuffering: pauseWhenBuffering ?? false,
16715
+ pauseWhenBuffering: shouldPauseWhenBuffering,
16460
16716
  onVideoFrame,
16461
16717
  ...otherProps,
16462
16718
  ref,
@@ -16482,7 +16738,7 @@ var VideoForwardingFunction = (props2, ref) => {
16482
16738
  ...otherProps,
16483
16739
  ref,
16484
16740
  onVideoFrame: onVideoFrame ?? null,
16485
- pauseWhenBuffering: pauseWhenBuffering ?? false,
16741
+ pauseWhenBuffering: shouldPauseWhenBuffering,
16486
16742
  onDuration,
16487
16743
  _remotionInternalStack: stack ?? null,
16488
16744
  _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed ?? false,
@@ -16875,7 +17131,9 @@ var makeShapeSchema = (shapeFields) => {
16875
17131
  defaultValue: "#0b84ff",
16876
17132
  description: "Fill"
16877
17133
  }),
16878
- ...Internals.transformSchema
17134
+ ...Internals.transformSchema,
17135
+ ...Interactive.backgroundSchema,
17136
+ ...Interactive.borderSchema
16879
17137
  };
16880
17138
  };
16881
17139
  var arrowSchema = makeShapeSchema({