@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.
@@ -5259,17 +5259,6 @@ var delayRenderInternal = ({
5259
5259
  scope.remotion_renderReady = false;
5260
5260
  return handle;
5261
5261
  };
5262
- var delayRender = (label2, options) => {
5263
- if (typeof window === "undefined") {
5264
- return Math.random();
5265
- }
5266
- return delayRenderInternal({
5267
- scope: window,
5268
- environment: getRemotionEnvironment(),
5269
- label: label2 ?? null,
5270
- options: options ?? {}
5271
- });
5272
- };
5273
5262
  var continueRenderInternal = ({
5274
5263
  scope,
5275
5264
  handle,
@@ -5590,7 +5579,7 @@ var getSingleChildComponent = (children) => {
5590
5579
  }
5591
5580
  return child.type;
5592
5581
  };
5593
- var VERSION = "4.0.495";
5582
+ var VERSION = "4.0.497";
5594
5583
  var checkMultipleRemotionVersions = () => {
5595
5584
  if (typeof globalThis === "undefined") {
5596
5585
  return;
@@ -6068,6 +6057,45 @@ var textSchema = {
6068
6057
  hiddenFromList: false
6069
6058
  }
6070
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
+ };
6071
6099
  var textContentSchema = {
6072
6100
  children: {
6073
6101
  type: "text-content",
@@ -6095,20 +6123,13 @@ var premountSchema = {
6095
6123
  keyframable: false
6096
6124
  }
6097
6125
  };
6098
- var premountStyleSchema = {
6099
- styleWhilePremounted: {
6100
- type: "hidden"
6101
- },
6102
- styleWhilePostmounted: {
6103
- type: "hidden"
6104
- }
6105
- };
6106
6126
  var sequencePremountSchema = {
6107
- ...premountSchema,
6108
- ...premountStyleSchema
6127
+ ...premountSchema
6109
6128
  };
6110
6129
  var sequenceStyleSchema = {
6111
6130
  ...transformSchema,
6131
+ ...backgroundSchema,
6132
+ ...borderSchema,
6112
6133
  ...sequencePremountSchema
6113
6134
  };
6114
6135
  var hiddenField = {
@@ -9444,38 +9465,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
9444
9465
  });
9445
9466
  };
9446
9467
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
9447
- var CACHE_SIZE = 5;
9448
- var getActualTime = ({
9449
- loopBehavior,
9450
- durationFound,
9451
- timeInSec
9452
- }) => {
9453
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9454
- };
9455
- var decodeImage = async ({
9468
+ var createImageDecoder = async ({
9456
9469
  resolvedSrc,
9457
9470
  signal,
9458
9471
  requestInit,
9459
- currentTime,
9460
- initialLoopBehavior
9472
+ contentType
9461
9473
  }) => {
9462
9474
  if (typeof ImageDecoder === "undefined") {
9463
9475
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
9464
9476
  }
9465
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
9466
- const { body } = res;
9477
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
9478
+ const { body } = response;
9467
9479
  if (!body) {
9468
9480
  throw new Error("Got no body");
9469
9481
  }
9470
9482
  const decoder = new ImageDecoder({
9471
9483
  data: body,
9472
- type: res.headers.get("Content-Type") || "image/gif"
9484
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
9473
9485
  });
9474
- await decoder.completed;
9486
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
9475
9487
  const { selectedTrack } = decoder.tracks;
9476
9488
  if (!selectedTrack) {
9489
+ decoder.close();
9477
9490
  throw new Error("No selected track");
9478
9491
  }
9492
+ return { decoder, selectedTrack };
9493
+ };
9494
+ var CACHE_SIZE = 5;
9495
+ var getActualTime = ({
9496
+ loopBehavior,
9497
+ durationFound,
9498
+ timeInSec
9499
+ }) => {
9500
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9501
+ };
9502
+ var decodeImage = async ({
9503
+ resolvedSrc,
9504
+ signal,
9505
+ requestInit,
9506
+ currentTime,
9507
+ initialLoopBehavior
9508
+ }) => {
9509
+ const { decoder, selectedTrack } = await createImageDecoder({
9510
+ resolvedSrc,
9511
+ signal,
9512
+ requestInit,
9513
+ contentType: null
9514
+ });
9479
9515
  const cache2 = [];
9480
9516
  let durationFound = null;
9481
9517
  const getFrameByIndex = async (frameIndex) => {
@@ -9581,6 +9617,13 @@ var decodeImage = async ({
9581
9617
  return closest;
9582
9618
  };
9583
9619
  return {
9620
+ close: () => {
9621
+ for (const item of cache2) {
9622
+ item.frame?.close();
9623
+ item.frame = null;
9624
+ }
9625
+ decoder.close();
9626
+ },
9584
9627
  getFrame,
9585
9628
  frameCount: selectedTrack.frameCount
9586
9629
  };
@@ -9618,6 +9661,7 @@ var animatedImageSchema = {
9618
9661
  keyframable: false
9619
9662
  },
9620
9663
  ...baseSchema,
9664
+ ...premountSchema,
9621
9665
  playbackRate: {
9622
9666
  type: "number",
9623
9667
  min: 0,
@@ -9628,7 +9672,9 @@ var animatedImageSchema = {
9628
9672
  hiddenFromList: false,
9629
9673
  keyframable: false
9630
9674
  },
9631
- ...transformSchema
9675
+ ...transformSchema,
9676
+ ...backgroundSchema,
9677
+ ...borderSchema
9632
9678
  };
9633
9679
  var getCanvasPropsFromSequenceProps = (props) => {
9634
9680
  const canvasProps = {};
@@ -9680,6 +9726,15 @@ var AnimatedImageContent = forwardRef4(({
9680
9726
  const [initialLoopBehavior] = useState6(() => loopBehavior);
9681
9727
  useEffect5(() => {
9682
9728
  const controller = new AbortController;
9729
+ let cancelled = false;
9730
+ let continued = false;
9731
+ const continueRenderOnce = () => {
9732
+ if (continued) {
9733
+ return;
9734
+ }
9735
+ continued = true;
9736
+ continueRender2(decodeHandle);
9737
+ };
9683
9738
  decodeImage({
9684
9739
  resolvedSrc,
9685
9740
  signal: controller.signal,
@@ -9687,22 +9742,31 @@ var AnimatedImageContent = forwardRef4(({
9687
9742
  currentTime: currentTimeRef.current,
9688
9743
  initialLoopBehavior
9689
9744
  }).then((d) => {
9745
+ if (cancelled) {
9746
+ d.close();
9747
+ return;
9748
+ }
9690
9749
  setImageDecoder(d);
9691
- continueRender2(decodeHandle);
9750
+ continueRenderOnce();
9692
9751
  }).catch((err) => {
9752
+ if (cancelled) {
9753
+ return;
9754
+ }
9693
9755
  if (err.name === "AbortError") {
9694
- continueRender2(decodeHandle);
9756
+ continueRenderOnce();
9695
9757
  return;
9696
9758
  }
9697
9759
  if (onError) {
9698
9760
  onError?.(err);
9699
- continueRender2(decodeHandle);
9761
+ continueRenderOnce();
9700
9762
  } else {
9701
9763
  cancelRender(err);
9702
9764
  }
9703
9765
  });
9704
9766
  return () => {
9767
+ cancelled = true;
9705
9768
  controller.abort();
9769
+ continueRenderOnce();
9706
9770
  };
9707
9771
  }, [
9708
9772
  resolvedSrc,
@@ -9712,6 +9776,11 @@ var AnimatedImageContent = forwardRef4(({
9712
9776
  initialLoopBehavior,
9713
9777
  continueRender2
9714
9778
  ]);
9779
+ useEffect5(() => {
9780
+ return () => {
9781
+ imageDecoder?.close();
9782
+ };
9783
+ }, [imageDecoder]);
9715
9784
  useLayoutEffect2(() => {
9716
9785
  if (!imageDecoder) {
9717
9786
  return;
@@ -9781,6 +9850,11 @@ var AnimatedImageInner = ({
9781
9850
  className,
9782
9851
  style,
9783
9852
  durationInFrames,
9853
+ from,
9854
+ premountFor,
9855
+ postmountFor,
9856
+ styleWhilePremounted,
9857
+ styleWhilePostmounted,
9784
9858
  requestInit,
9785
9859
  effects = [],
9786
9860
  controls,
@@ -9792,6 +9866,24 @@ var AnimatedImageInner = ({
9792
9866
  useImperativeHandle2(ref, () => {
9793
9867
  return actualRef.current;
9794
9868
  }, []);
9869
+ const {
9870
+ effectivePostmountFor,
9871
+ effectivePremountFor,
9872
+ freezeFrame,
9873
+ isPremountingOrPostmounting,
9874
+ postmountingActive,
9875
+ premountingActive,
9876
+ premountingStyle
9877
+ } = usePremounting({
9878
+ from: from ?? 0,
9879
+ durationInFrames: durationInFrames ?? Infinity,
9880
+ premountFor: premountFor ?? null,
9881
+ postmountFor: postmountFor ?? null,
9882
+ style: style ?? null,
9883
+ styleWhilePremounted: styleWhilePremounted ?? null,
9884
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
9885
+ hideWhilePremounted: "display-none"
9886
+ });
9795
9887
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
9796
9888
  const animatedImageProps = {
9797
9889
  src,
@@ -9803,24 +9895,33 @@ var AnimatedImageInner = ({
9803
9895
  loopBehavior,
9804
9896
  id,
9805
9897
  className,
9806
- style,
9898
+ style: premountingStyle ?? undefined,
9807
9899
  requestInit,
9808
9900
  ...canvasProps
9809
9901
  };
9810
- return /* @__PURE__ */ jsx14(Sequence, {
9811
- layout: "none",
9812
- durationInFrames,
9813
- name: "<AnimatedImage>",
9814
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9815
- controls,
9816
- _remotionInternalEffects: memoizedEffectDefinitions,
9817
- ...sequenceProps,
9818
- outlineRef: actualRef,
9819
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9820
- ...animatedImageProps,
9821
- ref: actualRef,
9822
- effects,
9823
- controls
9902
+ return /* @__PURE__ */ jsx14(Freeze, {
9903
+ frame: freezeFrame,
9904
+ active: isPremountingOrPostmounting,
9905
+ children: /* @__PURE__ */ jsx14(Sequence, {
9906
+ layout: "none",
9907
+ from: from ?? 0,
9908
+ durationInFrames: durationInFrames ?? Infinity,
9909
+ name: "<AnimatedImage>",
9910
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9911
+ controls,
9912
+ _remotionInternalEffects: memoizedEffectDefinitions,
9913
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
9914
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
9915
+ _remotionInternalIsPremounting: premountingActive,
9916
+ _remotionInternalIsPostmounting: postmountingActive,
9917
+ ...sequenceProps,
9918
+ outlineRef: actualRef,
9919
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9920
+ ...animatedImageProps,
9921
+ ref: actualRef,
9922
+ effects,
9923
+ controls
9924
+ })
9824
9925
  })
9825
9926
  });
9826
9927
  };
@@ -10536,13 +10637,17 @@ var makeSharedElementSourceNode = ({
10536
10637
  }) => {
10537
10638
  let connected = null;
10538
10639
  let disposed = false;
10640
+ let currentAudioContext = audioContext;
10539
10641
  return {
10642
+ setAudioContext: (newAudioContext) => {
10643
+ currentAudioContext = newAudioContext;
10644
+ },
10540
10645
  attemptToConnect: () => {
10541
10646
  if (disposed) {
10542
10647
  throw new Error("SharedElementSourceNode has been disposed");
10543
10648
  }
10544
- if (!connected && ref.current) {
10545
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
10649
+ if (!connected && ref.current && currentAudioContext) {
10650
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
10546
10651
  connected = mediaElementSourceNode;
10547
10652
  }
10548
10653
  },
@@ -10870,19 +10975,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10870
10975
  const audioCtx = useContext21(SharedAudioContext);
10871
10976
  const audioContext = audioCtx?.audioContext ?? null;
10872
10977
  const resume = audioCtx?.resume;
10873
- const refs = useMemo22(() => {
10978
+ const [refs] = useState10(() => {
10874
10979
  return new Array(numberOfAudioTags).fill(true).map(() => {
10875
10980
  const ref = createRef2();
10876
10981
  return {
10877
10982
  id: Math.random(),
10878
10983
  ref,
10879
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
10984
+ mediaElementSourceNode: makeSharedElementSourceNode({
10880
10985
  audioContext,
10881
10986
  ref
10882
- }) : null
10987
+ })
10883
10988
  };
10884
10989
  });
10885
- }, [audioContext, numberOfAudioTags]);
10990
+ });
10991
+ for (const { mediaElementSourceNode } of refs) {
10992
+ mediaElementSourceNode?.setAudioContext(audioContext);
10993
+ }
10886
10994
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
10887
10995
  effectToUse(() => {
10888
10996
  return () => {
@@ -10950,7 +11058,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10950
11058
  const cloned = [...takenAudios.current];
10951
11059
  const index = refs.findIndex((r2) => r2.id === id);
10952
11060
  if (index === -1) {
10953
- throw new TypeError("Error occured in ");
11061
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r2) => r2.id).join(", ")}`);
10954
11062
  }
10955
11063
  cloned[index] = false;
10956
11064
  takenAudios.current = cloned;
@@ -11054,10 +11162,10 @@ var useSharedAudio = ({
11054
11162
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
11055
11163
  }
11056
11164
  const el = React20.createRef();
11057
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
11058
- audioContext: audioCtx.audioContext,
11165
+ const mediaElementSourceNode = makeSharedElementSourceNode({
11166
+ audioContext: audioCtx?.audioContext ?? null,
11059
11167
  ref: el
11060
- }) : null;
11168
+ });
11061
11169
  return {
11062
11170
  el,
11063
11171
  id: Math.random(),
@@ -11072,6 +11180,7 @@ var useSharedAudio = ({
11072
11180
  }
11073
11181
  };
11074
11182
  });
11183
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
11075
11184
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
11076
11185
  if (typeof document !== "undefined") {
11077
11186
  effectToUse(() => {
@@ -12929,7 +13038,9 @@ var solidSchema = {
12929
13038
  description: "Pixel density",
12930
13039
  hiddenFromList: false
12931
13040
  },
12932
- ...transformSchema
13041
+ ...transformSchema,
13042
+ ...backgroundSchema,
13043
+ ...borderSchema
12933
13044
  };
12934
13045
  var SolidInner = ({
12935
13046
  color,
@@ -13173,7 +13284,7 @@ var HtmlInCanvasContent = forwardRef9(({
13173
13284
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
13174
13285
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
13175
13286
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
13176
- const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
13287
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
13177
13288
  const { isClientSideRendering, isRendering } = useRemotionEnvironment();
13178
13289
  const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
13179
13290
  const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
@@ -13227,7 +13338,7 @@ var HtmlInCanvasContent = forwardRef9(({
13227
13338
  if (!placeholderCanvas) {
13228
13339
  throw new Error("Canvas not found");
13229
13340
  }
13230
- const handle = delayRender("onPaint");
13341
+ const handle = delayRender2("onPaint");
13231
13342
  if (!initializedRef.current) {
13232
13343
  const currentOnInit = onInitRef.current;
13233
13344
  if (!currentOnInit) {
@@ -13328,6 +13439,7 @@ var HtmlInCanvasContent = forwardRef9(({
13328
13439
  chainState,
13329
13440
  continueRender2,
13330
13441
  cancelRender2,
13442
+ delayRender2,
13331
13443
  resolvedPixelDensity,
13332
13444
  canRetryMissingPaintRecord
13333
13445
  ]);
@@ -13379,14 +13491,14 @@ var HtmlInCanvasContent = forwardRef9(({
13379
13491
  if (!canvas) {
13380
13492
  return;
13381
13493
  }
13382
- const handle = delayRender("waiting for first paint after canvas resize");
13494
+ const handle = delayRender2("waiting for first paint after canvas resize");
13383
13495
  canvas.addEventListener("paint", () => {
13384
13496
  continueRender2(handle);
13385
13497
  }, { once: true });
13386
13498
  return () => {
13387
13499
  continueRender2(handle);
13388
13500
  };
13389
- }, [width, height, continueRender2, canvasSizeKey]);
13501
+ }, [width, height, continueRender2, delayRender2, canvasSizeKey]);
13390
13502
  const innerStyle = useMemo31(() => {
13391
13503
  return {
13392
13504
  width,
@@ -13482,7 +13594,9 @@ var htmlInCanvasSchema = {
13482
13594
  description: "Pixel density",
13483
13595
  hiddenFromList: false
13484
13596
  },
13485
- ...transformSchema
13597
+ ...transformSchema,
13598
+ ...backgroundSchema,
13599
+ ...borderSchema
13486
13600
  };
13487
13601
  var HtmlInCanvasWrapped = withInteractivitySchema({
13488
13602
  Component: HtmlInCanvasInner,
@@ -13504,6 +13618,7 @@ function truncateSrcForLabel(src) {
13504
13618
  }
13505
13619
  var canvasImageSchema = {
13506
13620
  ...baseSchema,
13621
+ ...premountSchema,
13507
13622
  fit: {
13508
13623
  type: "enum",
13509
13624
  default: "fill",
@@ -13514,7 +13629,9 @@ var canvasImageSchema = {
13514
13629
  cover: {}
13515
13630
  }
13516
13631
  },
13517
- ...transformSchema
13632
+ ...transformSchema,
13633
+ ...backgroundSchema,
13634
+ ...borderSchema
13518
13635
  };
13519
13636
  var makeAbortError = () => {
13520
13637
  if (typeof DOMException !== "undefined") {
@@ -13838,6 +13955,10 @@ var CanvasImageInner = forwardRef10(({
13838
13955
  from,
13839
13956
  trimBefore,
13840
13957
  freeze,
13958
+ premountFor,
13959
+ postmountFor,
13960
+ styleWhilePremounted,
13961
+ styleWhilePostmounted,
13841
13962
  hidden,
13842
13963
  name,
13843
13964
  showInTimeline,
@@ -13855,39 +13976,65 @@ var CanvasImageInner = forwardRef10(({
13855
13976
  useImperativeHandle7(ref, () => {
13856
13977
  return actualRef.current;
13857
13978
  }, []);
13858
- return /* @__PURE__ */ jsx26(Sequence, {
13859
- layout: "none",
13979
+ const {
13980
+ effectivePostmountFor,
13981
+ effectivePremountFor,
13982
+ freezeFrame,
13983
+ isPremountingOrPostmounting,
13984
+ postmountingActive,
13985
+ premountingActive,
13986
+ premountingStyle
13987
+ } = usePremounting({
13860
13988
  from: from ?? 0,
13861
- trimBefore,
13862
13989
  durationInFrames: durationInFrames ?? Infinity,
13863
- freeze,
13864
- hidden,
13865
- showInTimeline: showInTimeline ?? true,
13866
- name: name ?? "<CanvasImage>",
13867
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13868
- controls,
13869
- _remotionInternalEffects: memoizedEffectDefinitions,
13870
- _remotionInternalIsMedia: { type: "image", src },
13871
- _remotionInternalStack: stack,
13872
- outlineRef: outlineRef ?? actualRef,
13873
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
13874
- ref: actualRef,
13875
- src,
13876
- width,
13877
- height,
13878
- fit,
13879
- effects,
13990
+ premountFor: premountFor ?? null,
13991
+ postmountFor: postmountFor ?? null,
13992
+ style: style ?? null,
13993
+ styleWhilePremounted: styleWhilePremounted ?? null,
13994
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
13995
+ hideWhilePremounted: "display-none"
13996
+ });
13997
+ return /* @__PURE__ */ jsx26(Freeze, {
13998
+ frame: freezeFrame,
13999
+ active: isPremountingOrPostmounting,
14000
+ children: /* @__PURE__ */ jsx26(Sequence, {
14001
+ layout: "none",
14002
+ from: from ?? 0,
14003
+ trimBefore,
14004
+ durationInFrames: durationInFrames ?? Infinity,
14005
+ freeze,
14006
+ hidden,
14007
+ showInTimeline: showInTimeline ?? true,
14008
+ name: name ?? "<CanvasImage>",
14009
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13880
14010
  controls,
13881
- className,
13882
- style,
13883
- id,
13884
- onError,
13885
- pauseWhenLoading,
13886
- maxRetries,
13887
- delayRenderRetries,
13888
- delayRenderTimeoutInMilliseconds,
13889
- refForOutline: outlineRef ?? null,
13890
- ...canvasProps
14011
+ _remotionInternalEffects: memoizedEffectDefinitions,
14012
+ _remotionInternalIsMedia: { type: "image", src },
14013
+ _remotionInternalStack: stack,
14014
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14015
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14016
+ _remotionInternalIsPremounting: premountingActive,
14017
+ _remotionInternalIsPostmounting: postmountingActive,
14018
+ outlineRef: outlineRef ?? actualRef,
14019
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
14020
+ ref: actualRef,
14021
+ src,
14022
+ width,
14023
+ height,
14024
+ fit,
14025
+ effects,
14026
+ controls,
14027
+ className,
14028
+ style: premountingStyle ?? undefined,
14029
+ id,
14030
+ onError,
14031
+ pauseWhenLoading,
14032
+ maxRetries,
14033
+ delayRenderRetries,
14034
+ delayRenderTimeoutInMilliseconds,
14035
+ refForOutline: outlineRef ?? null,
14036
+ ...canvasProps
14037
+ })
13891
14038
  })
13892
14039
  });
13893
14040
  });
@@ -14104,6 +14251,11 @@ var NativeImgInner = ({
14104
14251
  trimBefore,
14105
14252
  durationInFrames,
14106
14253
  freeze,
14254
+ premountFor,
14255
+ postmountFor,
14256
+ style,
14257
+ styleWhilePremounted,
14258
+ styleWhilePostmounted,
14107
14259
  controls,
14108
14260
  outlineRef: refForOutline,
14109
14261
  ...props2
@@ -14111,24 +14263,51 @@ var NativeImgInner = ({
14111
14263
  if (!src) {
14112
14264
  throw new Error('No "src" prop was passed to <Img>.');
14113
14265
  }
14114
- return /* @__PURE__ */ jsx28(Sequence, {
14115
- layout: "none",
14266
+ const {
14267
+ effectivePostmountFor,
14268
+ effectivePremountFor,
14269
+ freezeFrame,
14270
+ isPremountingOrPostmounting,
14271
+ postmountingActive,
14272
+ premountingActive,
14273
+ premountingStyle
14274
+ } = usePremounting({
14116
14275
  from: from ?? 0,
14117
- trimBefore,
14118
14276
  durationInFrames: durationInFrames ?? Infinity,
14119
- freeze,
14120
- _remotionInternalStack: stack,
14121
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14122
- _remotionInternalIsMedia: { type: "image", src },
14123
- name: name ?? "<Img>",
14124
- controls,
14125
- showInTimeline: showInTimeline ?? true,
14126
- hidden,
14127
- outlineRef: refForOutline,
14128
- children: /* @__PURE__ */ jsx28(ImgContent, {
14129
- src,
14130
- refForOutline,
14131
- ...props2
14277
+ premountFor: premountFor ?? null,
14278
+ postmountFor: postmountFor ?? null,
14279
+ style: style ?? null,
14280
+ styleWhilePremounted: styleWhilePremounted ?? null,
14281
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
14282
+ hideWhilePremounted: "display-none"
14283
+ });
14284
+ return /* @__PURE__ */ jsx28(Freeze, {
14285
+ frame: freezeFrame,
14286
+ active: isPremountingOrPostmounting,
14287
+ children: /* @__PURE__ */ jsx28(Sequence, {
14288
+ layout: "none",
14289
+ from: from ?? 0,
14290
+ trimBefore,
14291
+ durationInFrames: durationInFrames ?? Infinity,
14292
+ freeze,
14293
+ _remotionInternalStack: stack,
14294
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14295
+ _remotionInternalIsMedia: { type: "image", src },
14296
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14297
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14298
+ _remotionInternalIsPremounting: premountingActive,
14299
+ _remotionInternalIsPostmounting: postmountingActive,
14300
+ name: name ?? "<Img>",
14301
+ controls,
14302
+ showInTimeline: showInTimeline ?? true,
14303
+ hidden,
14304
+ outlineRef: refForOutline,
14305
+ children: /* @__PURE__ */ jsx28(ImgContent, {
14306
+ src,
14307
+ refForOutline,
14308
+ style: premountingStyle ?? undefined,
14309
+ ...props2
14310
+ })
14132
14311
  })
14133
14312
  });
14134
14313
  };
@@ -14141,7 +14320,10 @@ var imgSchema = {
14141
14320
  keyframable: false
14142
14321
  },
14143
14322
  ...baseSchema,
14144
- ...transformSchema
14323
+ ...premountSchema,
14324
+ ...transformSchema,
14325
+ ...backgroundSchema,
14326
+ ...borderSchema
14145
14327
  };
14146
14328
  var imgCanvasFallbackIncompatibleProps = new Set([
14147
14329
  "alt",
@@ -14197,6 +14379,10 @@ var ImgInner = ({
14197
14379
  trimBefore,
14198
14380
  durationInFrames,
14199
14381
  freeze,
14382
+ premountFor,
14383
+ postmountFor,
14384
+ styleWhilePremounted,
14385
+ styleWhilePostmounted,
14200
14386
  controls,
14201
14387
  width,
14202
14388
  height,
@@ -14223,6 +14409,10 @@ var ImgInner = ({
14223
14409
  trimBefore,
14224
14410
  durationInFrames,
14225
14411
  freeze,
14412
+ premountFor,
14413
+ postmountFor,
14414
+ styleWhilePremounted,
14415
+ styleWhilePostmounted,
14226
14416
  controls,
14227
14417
  width,
14228
14418
  height,
@@ -14266,6 +14456,10 @@ var ImgInner = ({
14266
14456
  trimBefore,
14267
14457
  durationInFrames,
14268
14458
  freeze,
14459
+ premountFor,
14460
+ postmountFor,
14461
+ styleWhilePremounted,
14462
+ styleWhilePostmounted,
14269
14463
  hidden,
14270
14464
  name: name ?? "<Img>",
14271
14465
  showInTimeline,
@@ -14304,7 +14498,20 @@ var interactiveElementSchema = {
14304
14498
  ...baseSchema,
14305
14499
  ...transformSchema
14306
14500
  };
14501
+ var interactiveBackgroundElementSchema = {
14502
+ ...interactiveElementSchema,
14503
+ ...backgroundSchema
14504
+ };
14505
+ var interactiveBorderElementSchema = {
14506
+ ...interactiveBackgroundElementSchema,
14507
+ ...borderSchema
14508
+ };
14307
14509
  var interactiveTextElementSchema = {
14510
+ ...interactiveBorderElementSchema,
14511
+ ...textSchema,
14512
+ ...textContentSchema
14513
+ };
14514
+ var interactiveSvgTextElementSchema = {
14308
14515
  ...interactiveElementSchema,
14309
14516
  ...textSchema,
14310
14517
  ...textContentSchema
@@ -14383,6 +14590,8 @@ var Interactive = {
14383
14590
  baseSchema,
14384
14591
  transformSchema,
14385
14592
  textSchema,
14593
+ backgroundSchema,
14594
+ borderSchema,
14386
14595
  premountSchema,
14387
14596
  sequenceSchema,
14388
14597
  withSchema,
@@ -14419,10 +14628,39 @@ var Interactive = {
14419
14628
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
14420
14629
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
14421
14630
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
14422
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
14423
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
14631
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
14632
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
14424
14633
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
14425
14634
  };
14635
+ var getAnimatedImageDurationInSeconds = async ({
14636
+ resolvedSrc,
14637
+ signal,
14638
+ requestInit,
14639
+ contentType
14640
+ }) => {
14641
+ const { decoder, selectedTrack } = await createImageDecoder({
14642
+ resolvedSrc,
14643
+ signal,
14644
+ requestInit,
14645
+ contentType
14646
+ });
14647
+ try {
14648
+ const { image } = await decoder.decode({
14649
+ frameIndex: selectedTrack.frameCount - 1,
14650
+ completeFramesOnly: true
14651
+ });
14652
+ try {
14653
+ if (image.duration === null) {
14654
+ throw new Error("Could not determine animated image duration");
14655
+ }
14656
+ return (image.timestamp + image.duration) / 1e6;
14657
+ } finally {
14658
+ image.close();
14659
+ }
14660
+ } finally {
14661
+ decoder.close();
14662
+ }
14663
+ };
14426
14664
  var compositionsRef = React31.createRef();
14427
14665
  var CompositionManagerProvider = ({
14428
14666
  children,
@@ -15650,6 +15888,7 @@ var Internals = {
15650
15888
  useAbsoluteTimelinePosition,
15651
15889
  evaluateVolume,
15652
15890
  getAbsoluteSrc,
15891
+ getAnimatedImageDurationInSeconds,
15653
15892
  getAssetDisplayName,
15654
15893
  Timeline: exports_timeline_position_state,
15655
15894
  validateMediaTrimProps,
@@ -15674,7 +15913,6 @@ var Internals = {
15674
15913
  textSchema,
15675
15914
  transformSchema,
15676
15915
  premountSchema,
15677
- premountStyleSchema,
15678
15916
  flattenActiveSchema,
15679
15917
  getFlatSchemaWithAllKeys,
15680
15918
  RemotionRootContexts,
@@ -15813,6 +16051,7 @@ var seriesSequenceSchema = {
15813
16051
  hidden: Interactive.sequenceSchema.hidden,
15814
16052
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
15815
16053
  freeze: Interactive.baseSchema.freeze,
16054
+ trimBefore: Interactive.sequenceSchema.trimBefore,
15816
16055
  layout: Interactive.sequenceSchema.layout
15817
16056
  };
15818
16057
  var SeriesSequenceInner = forwardRef14(({
@@ -16885,7 +17124,9 @@ var makeShapeSchema = (shapeFields) => {
16885
17124
  defaultValue: "#0b84ff",
16886
17125
  description: "Fill"
16887
17126
  }),
16888
- ...Internals.transformSchema
17127
+ ...Internals.transformSchema,
17128
+ ...Interactive.backgroundSchema,
17129
+ ...Interactive.borderSchema
16889
17130
  };
16890
17131
  };
16891
17132
  var arrowSchema = makeShapeSchema({