@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.
@@ -5262,17 +5262,6 @@ var delayRenderInternal = ({
5262
5262
  scope.remotion_renderReady = false;
5263
5263
  return handle;
5264
5264
  };
5265
- var delayRender = (label2, options) => {
5266
- if (typeof window === "undefined") {
5267
- return Math.random();
5268
- }
5269
- return delayRenderInternal({
5270
- scope: window,
5271
- environment: getRemotionEnvironment(),
5272
- label: label2 ?? null,
5273
- options: options ?? {}
5274
- });
5275
- };
5276
5265
  var continueRenderInternal = ({
5277
5266
  scope,
5278
5267
  handle,
@@ -5593,7 +5582,7 @@ var getSingleChildComponent = (children) => {
5593
5582
  }
5594
5583
  return child.type;
5595
5584
  };
5596
- var VERSION = "4.0.495";
5585
+ var VERSION = "4.0.497";
5597
5586
  var checkMultipleRemotionVersions = () => {
5598
5587
  if (typeof globalThis === "undefined") {
5599
5588
  return;
@@ -6071,6 +6060,45 @@ var textSchema = {
6071
6060
  hiddenFromList: false
6072
6061
  }
6073
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
+ };
6074
6102
  var textContentSchema = {
6075
6103
  children: {
6076
6104
  type: "text-content",
@@ -6098,20 +6126,13 @@ var premountSchema = {
6098
6126
  keyframable: false
6099
6127
  }
6100
6128
  };
6101
- var premountStyleSchema = {
6102
- styleWhilePremounted: {
6103
- type: "hidden"
6104
- },
6105
- styleWhilePostmounted: {
6106
- type: "hidden"
6107
- }
6108
- };
6109
6129
  var sequencePremountSchema = {
6110
- ...premountSchema,
6111
- ...premountStyleSchema
6130
+ ...premountSchema
6112
6131
  };
6113
6132
  var sequenceStyleSchema = {
6114
6133
  ...transformSchema,
6134
+ ...backgroundSchema,
6135
+ ...borderSchema,
6115
6136
  ...sequencePremountSchema
6116
6137
  };
6117
6138
  var hiddenField = {
@@ -9447,38 +9468,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
9447
9468
  });
9448
9469
  };
9449
9470
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
9450
- var CACHE_SIZE = 5;
9451
- var getActualTime = ({
9452
- loopBehavior,
9453
- durationFound,
9454
- timeInSec
9455
- }) => {
9456
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
9457
- };
9458
- var decodeImage = async ({
9471
+ var createImageDecoder = async ({
9459
9472
  resolvedSrc,
9460
9473
  signal,
9461
9474
  requestInit,
9462
- currentTime,
9463
- initialLoopBehavior
9475
+ contentType
9464
9476
  }) => {
9465
9477
  if (typeof ImageDecoder === "undefined") {
9466
9478
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
9467
9479
  }
9468
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
9469
- const { body } = res;
9480
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
9481
+ const { body } = response;
9470
9482
  if (!body) {
9471
9483
  throw new Error("Got no body");
9472
9484
  }
9473
9485
  const decoder = new ImageDecoder({
9474
9486
  data: body,
9475
- type: res.headers.get("Content-Type") || "image/gif"
9487
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
9476
9488
  });
9477
- await decoder.completed;
9489
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
9478
9490
  const { selectedTrack } = decoder.tracks;
9479
9491
  if (!selectedTrack) {
9492
+ decoder.close();
9480
9493
  throw new Error("No selected track");
9481
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
+ });
9482
9518
  const cache2 = [];
9483
9519
  let durationFound = null;
9484
9520
  const getFrameByIndex = async (frameIndex) => {
@@ -9584,6 +9620,13 @@ var decodeImage = async ({
9584
9620
  return closest;
9585
9621
  };
9586
9622
  return {
9623
+ close: () => {
9624
+ for (const item of cache2) {
9625
+ item.frame?.close();
9626
+ item.frame = null;
9627
+ }
9628
+ decoder.close();
9629
+ },
9587
9630
  getFrame,
9588
9631
  frameCount: selectedTrack.frameCount
9589
9632
  };
@@ -9621,6 +9664,7 @@ var animatedImageSchema = {
9621
9664
  keyframable: false
9622
9665
  },
9623
9666
  ...baseSchema,
9667
+ ...premountSchema,
9624
9668
  playbackRate: {
9625
9669
  type: "number",
9626
9670
  min: 0,
@@ -9631,7 +9675,9 @@ var animatedImageSchema = {
9631
9675
  hiddenFromList: false,
9632
9676
  keyframable: false
9633
9677
  },
9634
- ...transformSchema
9678
+ ...transformSchema,
9679
+ ...backgroundSchema,
9680
+ ...borderSchema
9635
9681
  };
9636
9682
  var getCanvasPropsFromSequenceProps = (props) => {
9637
9683
  const canvasProps = {};
@@ -9683,6 +9729,15 @@ var AnimatedImageContent = forwardRef4(({
9683
9729
  const [initialLoopBehavior] = useState6(() => loopBehavior);
9684
9730
  useEffect5(() => {
9685
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
+ };
9686
9741
  decodeImage({
9687
9742
  resolvedSrc,
9688
9743
  signal: controller.signal,
@@ -9690,22 +9745,31 @@ var AnimatedImageContent = forwardRef4(({
9690
9745
  currentTime: currentTimeRef.current,
9691
9746
  initialLoopBehavior
9692
9747
  }).then((d) => {
9748
+ if (cancelled) {
9749
+ d.close();
9750
+ return;
9751
+ }
9693
9752
  setImageDecoder(d);
9694
- continueRender2(decodeHandle);
9753
+ continueRenderOnce();
9695
9754
  }).catch((err) => {
9755
+ if (cancelled) {
9756
+ return;
9757
+ }
9696
9758
  if (err.name === "AbortError") {
9697
- continueRender2(decodeHandle);
9759
+ continueRenderOnce();
9698
9760
  return;
9699
9761
  }
9700
9762
  if (onError) {
9701
9763
  onError?.(err);
9702
- continueRender2(decodeHandle);
9764
+ continueRenderOnce();
9703
9765
  } else {
9704
9766
  cancelRender(err);
9705
9767
  }
9706
9768
  });
9707
9769
  return () => {
9770
+ cancelled = true;
9708
9771
  controller.abort();
9772
+ continueRenderOnce();
9709
9773
  };
9710
9774
  }, [
9711
9775
  resolvedSrc,
@@ -9715,6 +9779,11 @@ var AnimatedImageContent = forwardRef4(({
9715
9779
  initialLoopBehavior,
9716
9780
  continueRender2
9717
9781
  ]);
9782
+ useEffect5(() => {
9783
+ return () => {
9784
+ imageDecoder?.close();
9785
+ };
9786
+ }, [imageDecoder]);
9718
9787
  useLayoutEffect2(() => {
9719
9788
  if (!imageDecoder) {
9720
9789
  return;
@@ -9784,6 +9853,11 @@ var AnimatedImageInner = ({
9784
9853
  className,
9785
9854
  style,
9786
9855
  durationInFrames,
9856
+ from,
9857
+ premountFor,
9858
+ postmountFor,
9859
+ styleWhilePremounted,
9860
+ styleWhilePostmounted,
9787
9861
  requestInit,
9788
9862
  effects = [],
9789
9863
  controls,
@@ -9795,6 +9869,24 @@ var AnimatedImageInner = ({
9795
9869
  useImperativeHandle2(ref, () => {
9796
9870
  return actualRef.current;
9797
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
+ });
9798
9890
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
9799
9891
  const animatedImageProps = {
9800
9892
  src,
@@ -9806,24 +9898,33 @@ var AnimatedImageInner = ({
9806
9898
  loopBehavior,
9807
9899
  id,
9808
9900
  className,
9809
- style,
9901
+ style: premountingStyle ?? undefined,
9810
9902
  requestInit,
9811
9903
  ...canvasProps
9812
9904
  };
9813
- return /* @__PURE__ */ jsx14(Sequence, {
9814
- layout: "none",
9815
- durationInFrames,
9816
- name: "<AnimatedImage>",
9817
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
9818
- controls,
9819
- _remotionInternalEffects: memoizedEffectDefinitions,
9820
- ...sequenceProps,
9821
- outlineRef: actualRef,
9822
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
9823
- ...animatedImageProps,
9824
- ref: actualRef,
9825
- effects,
9826
- 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
+ })
9827
9928
  })
9828
9929
  });
9829
9930
  };
@@ -10539,13 +10640,17 @@ var makeSharedElementSourceNode = ({
10539
10640
  }) => {
10540
10641
  let connected = null;
10541
10642
  let disposed = false;
10643
+ let currentAudioContext = audioContext;
10542
10644
  return {
10645
+ setAudioContext: (newAudioContext) => {
10646
+ currentAudioContext = newAudioContext;
10647
+ },
10543
10648
  attemptToConnect: () => {
10544
10649
  if (disposed) {
10545
10650
  throw new Error("SharedElementSourceNode has been disposed");
10546
10651
  }
10547
- if (!connected && ref.current) {
10548
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
10652
+ if (!connected && ref.current && currentAudioContext) {
10653
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
10549
10654
  connected = mediaElementSourceNode;
10550
10655
  }
10551
10656
  },
@@ -10873,19 +10978,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10873
10978
  const audioCtx = useContext21(SharedAudioContext);
10874
10979
  const audioContext = audioCtx?.audioContext ?? null;
10875
10980
  const resume = audioCtx?.resume;
10876
- const refs = useMemo22(() => {
10981
+ const [refs] = useState10(() => {
10877
10982
  return new Array(numberOfAudioTags).fill(true).map(() => {
10878
10983
  const ref = createRef2();
10879
10984
  return {
10880
10985
  id: Math.random(),
10881
10986
  ref,
10882
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
10987
+ mediaElementSourceNode: makeSharedElementSourceNode({
10883
10988
  audioContext,
10884
10989
  ref
10885
- }) : null
10990
+ })
10886
10991
  };
10887
10992
  });
10888
- }, [audioContext, numberOfAudioTags]);
10993
+ });
10994
+ for (const { mediaElementSourceNode } of refs) {
10995
+ mediaElementSourceNode?.setAudioContext(audioContext);
10996
+ }
10889
10997
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
10890
10998
  effectToUse(() => {
10891
10999
  return () => {
@@ -10953,7 +11061,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10953
11061
  const cloned = [...takenAudios.current];
10954
11062
  const index = refs.findIndex((r2) => r2.id === id);
10955
11063
  if (index === -1) {
10956
- throw new TypeError("Error occured in ");
11064
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r2) => r2.id).join(", ")}`);
10957
11065
  }
10958
11066
  cloned[index] = false;
10959
11067
  takenAudios.current = cloned;
@@ -11057,10 +11165,10 @@ var useSharedAudio = ({
11057
11165
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
11058
11166
  }
11059
11167
  const el = React20.createRef();
11060
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
11061
- audioContext: audioCtx.audioContext,
11168
+ const mediaElementSourceNode = makeSharedElementSourceNode({
11169
+ audioContext: audioCtx?.audioContext ?? null,
11062
11170
  ref: el
11063
- }) : null;
11171
+ });
11064
11172
  return {
11065
11173
  el,
11066
11174
  id: Math.random(),
@@ -11075,6 +11183,7 @@ var useSharedAudio = ({
11075
11183
  }
11076
11184
  };
11077
11185
  });
11186
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
11078
11187
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
11079
11188
  if (typeof document !== "undefined") {
11080
11189
  effectToUse(() => {
@@ -12932,7 +13041,9 @@ var solidSchema = {
12932
13041
  description: "Pixel density",
12933
13042
  hiddenFromList: false
12934
13043
  },
12935
- ...transformSchema
13044
+ ...transformSchema,
13045
+ ...backgroundSchema,
13046
+ ...borderSchema
12936
13047
  };
12937
13048
  var SolidInner = ({
12938
13049
  color,
@@ -13176,7 +13287,7 @@ var HtmlInCanvasContent = forwardRef9(({
13176
13287
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
13177
13288
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
13178
13289
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
13179
- const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
13290
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
13180
13291
  const { isClientSideRendering, isRendering } = useRemotionEnvironment();
13181
13292
  const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
13182
13293
  const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
@@ -13230,7 +13341,7 @@ var HtmlInCanvasContent = forwardRef9(({
13230
13341
  if (!placeholderCanvas) {
13231
13342
  throw new Error("Canvas not found");
13232
13343
  }
13233
- const handle = delayRender("onPaint");
13344
+ const handle = delayRender2("onPaint");
13234
13345
  if (!initializedRef.current) {
13235
13346
  const currentOnInit = onInitRef.current;
13236
13347
  if (!currentOnInit) {
@@ -13331,6 +13442,7 @@ var HtmlInCanvasContent = forwardRef9(({
13331
13442
  chainState,
13332
13443
  continueRender2,
13333
13444
  cancelRender2,
13445
+ delayRender2,
13334
13446
  resolvedPixelDensity,
13335
13447
  canRetryMissingPaintRecord
13336
13448
  ]);
@@ -13382,14 +13494,14 @@ var HtmlInCanvasContent = forwardRef9(({
13382
13494
  if (!canvas) {
13383
13495
  return;
13384
13496
  }
13385
- const handle = delayRender("waiting for first paint after canvas resize");
13497
+ const handle = delayRender2("waiting for first paint after canvas resize");
13386
13498
  canvas.addEventListener("paint", () => {
13387
13499
  continueRender2(handle);
13388
13500
  }, { once: true });
13389
13501
  return () => {
13390
13502
  continueRender2(handle);
13391
13503
  };
13392
- }, [width, height, continueRender2, canvasSizeKey]);
13504
+ }, [width, height, continueRender2, delayRender2, canvasSizeKey]);
13393
13505
  const innerStyle = useMemo31(() => {
13394
13506
  return {
13395
13507
  width,
@@ -13485,7 +13597,9 @@ var htmlInCanvasSchema = {
13485
13597
  description: "Pixel density",
13486
13598
  hiddenFromList: false
13487
13599
  },
13488
- ...transformSchema
13600
+ ...transformSchema,
13601
+ ...backgroundSchema,
13602
+ ...borderSchema
13489
13603
  };
13490
13604
  var HtmlInCanvasWrapped = withInteractivitySchema({
13491
13605
  Component: HtmlInCanvasInner,
@@ -13507,6 +13621,7 @@ function truncateSrcForLabel(src) {
13507
13621
  }
13508
13622
  var canvasImageSchema = {
13509
13623
  ...baseSchema,
13624
+ ...premountSchema,
13510
13625
  fit: {
13511
13626
  type: "enum",
13512
13627
  default: "fill",
@@ -13517,7 +13632,9 @@ var canvasImageSchema = {
13517
13632
  cover: {}
13518
13633
  }
13519
13634
  },
13520
- ...transformSchema
13635
+ ...transformSchema,
13636
+ ...backgroundSchema,
13637
+ ...borderSchema
13521
13638
  };
13522
13639
  var makeAbortError = () => {
13523
13640
  if (typeof DOMException !== "undefined") {
@@ -13841,6 +13958,10 @@ var CanvasImageInner = forwardRef10(({
13841
13958
  from,
13842
13959
  trimBefore,
13843
13960
  freeze,
13961
+ premountFor,
13962
+ postmountFor,
13963
+ styleWhilePremounted,
13964
+ styleWhilePostmounted,
13844
13965
  hidden,
13845
13966
  name,
13846
13967
  showInTimeline,
@@ -13858,39 +13979,65 @@ var CanvasImageInner = forwardRef10(({
13858
13979
  useImperativeHandle7(ref, () => {
13859
13980
  return actualRef.current;
13860
13981
  }, []);
13861
- return /* @__PURE__ */ jsx26(Sequence, {
13862
- layout: "none",
13982
+ const {
13983
+ effectivePostmountFor,
13984
+ effectivePremountFor,
13985
+ freezeFrame,
13986
+ isPremountingOrPostmounting,
13987
+ postmountingActive,
13988
+ premountingActive,
13989
+ premountingStyle
13990
+ } = usePremounting({
13863
13991
  from: from ?? 0,
13864
- trimBefore,
13865
13992
  durationInFrames: durationInFrames ?? Infinity,
13866
- freeze,
13867
- hidden,
13868
- showInTimeline: showInTimeline ?? true,
13869
- name: name ?? "<CanvasImage>",
13870
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13871
- controls,
13872
- _remotionInternalEffects: memoizedEffectDefinitions,
13873
- _remotionInternalIsMedia: { type: "image", src },
13874
- _remotionInternalStack: stack,
13875
- outlineRef: outlineRef ?? actualRef,
13876
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
13877
- ref: actualRef,
13878
- src,
13879
- width,
13880
- height,
13881
- fit,
13882
- effects,
13993
+ premountFor: premountFor ?? null,
13994
+ postmountFor: postmountFor ?? null,
13995
+ style: style ?? null,
13996
+ styleWhilePremounted: styleWhilePremounted ?? null,
13997
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
13998
+ hideWhilePremounted: "display-none"
13999
+ });
14000
+ return /* @__PURE__ */ jsx26(Freeze, {
14001
+ frame: freezeFrame,
14002
+ active: isPremountingOrPostmounting,
14003
+ children: /* @__PURE__ */ jsx26(Sequence, {
14004
+ layout: "none",
14005
+ from: from ?? 0,
14006
+ trimBefore,
14007
+ durationInFrames: durationInFrames ?? Infinity,
14008
+ freeze,
14009
+ hidden,
14010
+ showInTimeline: showInTimeline ?? true,
14011
+ name: name ?? "<CanvasImage>",
14012
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
13883
14013
  controls,
13884
- className,
13885
- style,
13886
- id,
13887
- onError,
13888
- pauseWhenLoading,
13889
- maxRetries,
13890
- delayRenderRetries,
13891
- delayRenderTimeoutInMilliseconds,
13892
- refForOutline: outlineRef ?? null,
13893
- ...canvasProps
14014
+ _remotionInternalEffects: memoizedEffectDefinitions,
14015
+ _remotionInternalIsMedia: { type: "image", src },
14016
+ _remotionInternalStack: stack,
14017
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14018
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14019
+ _remotionInternalIsPremounting: premountingActive,
14020
+ _remotionInternalIsPostmounting: postmountingActive,
14021
+ outlineRef: outlineRef ?? actualRef,
14022
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
14023
+ ref: actualRef,
14024
+ src,
14025
+ width,
14026
+ height,
14027
+ fit,
14028
+ effects,
14029
+ controls,
14030
+ className,
14031
+ style: premountingStyle ?? undefined,
14032
+ id,
14033
+ onError,
14034
+ pauseWhenLoading,
14035
+ maxRetries,
14036
+ delayRenderRetries,
14037
+ delayRenderTimeoutInMilliseconds,
14038
+ refForOutline: outlineRef ?? null,
14039
+ ...canvasProps
14040
+ })
13894
14041
  })
13895
14042
  });
13896
14043
  });
@@ -14107,6 +14254,11 @@ var NativeImgInner = ({
14107
14254
  trimBefore,
14108
14255
  durationInFrames,
14109
14256
  freeze,
14257
+ premountFor,
14258
+ postmountFor,
14259
+ style,
14260
+ styleWhilePremounted,
14261
+ styleWhilePostmounted,
14110
14262
  controls,
14111
14263
  outlineRef: refForOutline,
14112
14264
  ...props2
@@ -14114,24 +14266,51 @@ var NativeImgInner = ({
14114
14266
  if (!src) {
14115
14267
  throw new Error('No "src" prop was passed to <Img>.');
14116
14268
  }
14117
- return /* @__PURE__ */ jsx28(Sequence, {
14118
- layout: "none",
14269
+ const {
14270
+ effectivePostmountFor,
14271
+ effectivePremountFor,
14272
+ freezeFrame,
14273
+ isPremountingOrPostmounting,
14274
+ postmountingActive,
14275
+ premountingActive,
14276
+ premountingStyle
14277
+ } = usePremounting({
14119
14278
  from: from ?? 0,
14120
- trimBefore,
14121
14279
  durationInFrames: durationInFrames ?? Infinity,
14122
- freeze,
14123
- _remotionInternalStack: stack,
14124
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14125
- _remotionInternalIsMedia: { type: "image", src },
14126
- name: name ?? "<Img>",
14127
- controls,
14128
- showInTimeline: showInTimeline ?? true,
14129
- hidden,
14130
- outlineRef: refForOutline,
14131
- children: /* @__PURE__ */ jsx28(ImgContent, {
14132
- src,
14133
- refForOutline,
14134
- ...props2
14280
+ premountFor: premountFor ?? null,
14281
+ postmountFor: postmountFor ?? null,
14282
+ style: style ?? null,
14283
+ styleWhilePremounted: styleWhilePremounted ?? null,
14284
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
14285
+ hideWhilePremounted: "display-none"
14286
+ });
14287
+ return /* @__PURE__ */ jsx28(Freeze, {
14288
+ frame: freezeFrame,
14289
+ active: isPremountingOrPostmounting,
14290
+ children: /* @__PURE__ */ jsx28(Sequence, {
14291
+ layout: "none",
14292
+ from: from ?? 0,
14293
+ trimBefore,
14294
+ durationInFrames: durationInFrames ?? Infinity,
14295
+ freeze,
14296
+ _remotionInternalStack: stack,
14297
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
14298
+ _remotionInternalIsMedia: { type: "image", src },
14299
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
14300
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
14301
+ _remotionInternalIsPremounting: premountingActive,
14302
+ _remotionInternalIsPostmounting: postmountingActive,
14303
+ name: name ?? "<Img>",
14304
+ controls,
14305
+ showInTimeline: showInTimeline ?? true,
14306
+ hidden,
14307
+ outlineRef: refForOutline,
14308
+ children: /* @__PURE__ */ jsx28(ImgContent, {
14309
+ src,
14310
+ refForOutline,
14311
+ style: premountingStyle ?? undefined,
14312
+ ...props2
14313
+ })
14135
14314
  })
14136
14315
  });
14137
14316
  };
@@ -14144,7 +14323,10 @@ var imgSchema = {
14144
14323
  keyframable: false
14145
14324
  },
14146
14325
  ...baseSchema,
14147
- ...transformSchema
14326
+ ...premountSchema,
14327
+ ...transformSchema,
14328
+ ...backgroundSchema,
14329
+ ...borderSchema
14148
14330
  };
14149
14331
  var imgCanvasFallbackIncompatibleProps = new Set([
14150
14332
  "alt",
@@ -14200,6 +14382,10 @@ var ImgInner = ({
14200
14382
  trimBefore,
14201
14383
  durationInFrames,
14202
14384
  freeze,
14385
+ premountFor,
14386
+ postmountFor,
14387
+ styleWhilePremounted,
14388
+ styleWhilePostmounted,
14203
14389
  controls,
14204
14390
  width,
14205
14391
  height,
@@ -14226,6 +14412,10 @@ var ImgInner = ({
14226
14412
  trimBefore,
14227
14413
  durationInFrames,
14228
14414
  freeze,
14415
+ premountFor,
14416
+ postmountFor,
14417
+ styleWhilePremounted,
14418
+ styleWhilePostmounted,
14229
14419
  controls,
14230
14420
  width,
14231
14421
  height,
@@ -14269,6 +14459,10 @@ var ImgInner = ({
14269
14459
  trimBefore,
14270
14460
  durationInFrames,
14271
14461
  freeze,
14462
+ premountFor,
14463
+ postmountFor,
14464
+ styleWhilePremounted,
14465
+ styleWhilePostmounted,
14272
14466
  hidden,
14273
14467
  name: name ?? "<Img>",
14274
14468
  showInTimeline,
@@ -14307,7 +14501,20 @@ var interactiveElementSchema = {
14307
14501
  ...baseSchema,
14308
14502
  ...transformSchema
14309
14503
  };
14504
+ var interactiveBackgroundElementSchema = {
14505
+ ...interactiveElementSchema,
14506
+ ...backgroundSchema
14507
+ };
14508
+ var interactiveBorderElementSchema = {
14509
+ ...interactiveBackgroundElementSchema,
14510
+ ...borderSchema
14511
+ };
14310
14512
  var interactiveTextElementSchema = {
14513
+ ...interactiveBorderElementSchema,
14514
+ ...textSchema,
14515
+ ...textContentSchema
14516
+ };
14517
+ var interactiveSvgTextElementSchema = {
14311
14518
  ...interactiveElementSchema,
14312
14519
  ...textSchema,
14313
14520
  ...textContentSchema
@@ -14386,6 +14593,8 @@ var Interactive = {
14386
14593
  baseSchema,
14387
14594
  transformSchema,
14388
14595
  textSchema,
14596
+ backgroundSchema,
14597
+ borderSchema,
14389
14598
  premountSchema,
14390
14599
  sequenceSchema,
14391
14600
  withSchema,
@@ -14422,10 +14631,39 @@ var Interactive = {
14422
14631
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
14423
14632
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
14424
14633
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
14425
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
14426
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
14634
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
14635
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
14427
14636
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
14428
14637
  };
14638
+ var getAnimatedImageDurationInSeconds = async ({
14639
+ resolvedSrc,
14640
+ signal,
14641
+ requestInit,
14642
+ contentType
14643
+ }) => {
14644
+ const { decoder, selectedTrack } = await createImageDecoder({
14645
+ resolvedSrc,
14646
+ signal,
14647
+ requestInit,
14648
+ contentType
14649
+ });
14650
+ try {
14651
+ const { image } = await decoder.decode({
14652
+ frameIndex: selectedTrack.frameCount - 1,
14653
+ completeFramesOnly: true
14654
+ });
14655
+ try {
14656
+ if (image.duration === null) {
14657
+ throw new Error("Could not determine animated image duration");
14658
+ }
14659
+ return (image.timestamp + image.duration) / 1e6;
14660
+ } finally {
14661
+ image.close();
14662
+ }
14663
+ } finally {
14664
+ decoder.close();
14665
+ }
14666
+ };
14429
14667
  var compositionsRef = React31.createRef();
14430
14668
  var CompositionManagerProvider = ({
14431
14669
  children,
@@ -15653,6 +15891,7 @@ var Internals = {
15653
15891
  useAbsoluteTimelinePosition,
15654
15892
  evaluateVolume,
15655
15893
  getAbsoluteSrc,
15894
+ getAnimatedImageDurationInSeconds,
15656
15895
  getAssetDisplayName,
15657
15896
  Timeline: exports_timeline_position_state,
15658
15897
  validateMediaTrimProps,
@@ -15677,7 +15916,6 @@ var Internals = {
15677
15916
  textSchema,
15678
15917
  transformSchema,
15679
15918
  premountSchema,
15680
- premountStyleSchema,
15681
15919
  flattenActiveSchema,
15682
15920
  getFlatSchemaWithAllKeys,
15683
15921
  RemotionRootContexts,
@@ -15816,6 +16054,7 @@ var seriesSequenceSchema = {
15816
16054
  hidden: Interactive.sequenceSchema.hidden,
15817
16055
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
15818
16056
  freeze: Interactive.baseSchema.freeze,
16057
+ trimBefore: Interactive.sequenceSchema.trimBefore,
15819
16058
  layout: Interactive.sequenceSchema.layout
15820
16059
  };
15821
16060
  var SeriesSequenceInner = forwardRef14(({
@@ -16888,7 +17127,9 @@ var makeShapeSchema = (shapeFields) => {
16888
17127
  defaultValue: "#0b84ff",
16889
17128
  description: "Fill"
16890
17129
  }),
16891
- ...Internals.transformSchema
17130
+ ...Internals.transformSchema,
17131
+ ...Interactive.backgroundSchema,
17132
+ ...Interactive.borderSchema
16892
17133
  };
16893
17134
  };
16894
17135
  var arrowSchema = makeShapeSchema({