remotion 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.
Files changed (43) hide show
  1. package/dist/cjs/HtmlInCanvas.d.ts +35 -0
  2. package/dist/cjs/HtmlInCanvas.js +7 -5
  3. package/dist/cjs/Img.d.ts +55 -3
  4. package/dist/cjs/Img.js +20 -5
  5. package/dist/cjs/Interactive.d.ts +74 -6
  6. package/dist/cjs/Interactive.js +17 -2
  7. package/dist/cjs/animated-image/AnimatedImage.d.ts +135 -1
  8. package/dist/cjs/animated-image/AnimatedImage.js +47 -9
  9. package/dist/cjs/animated-image/create-image-decoder.d.ts +9 -0
  10. package/dist/cjs/animated-image/create-image-decoder.js +26 -0
  11. package/dist/cjs/animated-image/decode-image.d.ts +1 -0
  12. package/dist/cjs/animated-image/decode-image.js +14 -16
  13. package/dist/cjs/animated-image/get-duration-in-seconds.d.ts +6 -0
  14. package/dist/cjs/animated-image/get-duration-in-seconds.js +31 -0
  15. package/dist/cjs/animated-image/props.d.ts +2 -2
  16. package/dist/cjs/audio/shared-audio-tags.js +18 -16
  17. package/dist/cjs/audio/shared-element-source-node.d.ts +2 -1
  18. package/dist/cjs/audio/shared-element-source-node.js +6 -2
  19. package/dist/cjs/canvas-image/CanvasImage.d.ts +53 -1
  20. package/dist/cjs/canvas-image/CanvasImage.js +17 -2
  21. package/dist/cjs/canvas-image/props.d.ts +2 -2
  22. package/dist/cjs/effects/Solid.d.ts +35 -0
  23. package/dist/cjs/effects/Solid.js +2 -0
  24. package/dist/cjs/interactivity-schema.d.ts +144 -32
  25. package/dist/cjs/interactivity-schema.js +44 -10
  26. package/dist/cjs/internals.d.ts +77 -26
  27. package/dist/cjs/internals.js +2 -1
  28. package/dist/cjs/no-react.d.ts +35 -6
  29. package/dist/cjs/series/index.d.ts +1 -1
  30. package/dist/cjs/series/index.js +1 -0
  31. package/dist/cjs/use-amplification.d.ts +1 -0
  32. package/dist/cjs/version.d.ts +1 -1
  33. package/dist/cjs/version.js +1 -1
  34. package/dist/esm/index.mjs +367 -113
  35. package/dist/esm/no-react.mjs +42 -10
  36. package/dist/esm/version.mjs +1 -1
  37. package/package.json +2 -2
  38. package/dist/cjs/interpolate-translate.d.ts +0 -8
  39. package/dist/cjs/interpolate-translate.js +0 -70
  40. package/dist/cjs/sequence-field-schema.d.ts +0 -425
  41. package/dist/cjs/sequence-field-schema.js +0 -133
  42. package/dist/cjs/wrap-in-schema.d.ts +0 -20
  43. package/dist/cjs/wrap-in-schema.js +0 -203
@@ -1310,7 +1310,7 @@ var getSingleChildComponent = (children) => {
1310
1310
  };
1311
1311
 
1312
1312
  // src/version.ts
1313
- var VERSION = "4.0.495";
1313
+ var VERSION = "4.0.497";
1314
1314
 
1315
1315
  // src/multiple-versions-warning.ts
1316
1316
  var checkMultipleRemotionVersions = () => {
@@ -1847,6 +1847,45 @@ var textSchema = {
1847
1847
  hiddenFromList: false
1848
1848
  }
1849
1849
  };
1850
+ var borderSchema = {
1851
+ "style.borderWidth": {
1852
+ type: "number",
1853
+ default: undefined,
1854
+ min: 0,
1855
+ step: 1,
1856
+ description: "Border width",
1857
+ hiddenFromList: false
1858
+ },
1859
+ "style.borderStyle": {
1860
+ type: "enum",
1861
+ default: "none",
1862
+ description: "Border style",
1863
+ variants: {
1864
+ none: {},
1865
+ hidden: {},
1866
+ solid: {},
1867
+ dashed: {},
1868
+ dotted: {},
1869
+ double: {},
1870
+ groove: {},
1871
+ ridge: {},
1872
+ inset: {},
1873
+ outset: {}
1874
+ }
1875
+ },
1876
+ "style.borderColor": {
1877
+ type: "color",
1878
+ default: undefined,
1879
+ description: "Border color"
1880
+ }
1881
+ };
1882
+ var backgroundSchema = {
1883
+ "style.backgroundColor": {
1884
+ type: "color",
1885
+ default: "transparent",
1886
+ description: "Color"
1887
+ }
1888
+ };
1850
1889
  var textContentSchema = {
1851
1890
  children: {
1852
1891
  type: "text-content",
@@ -1874,20 +1913,13 @@ var premountSchema = {
1874
1913
  keyframable: false
1875
1914
  }
1876
1915
  };
1877
- var premountStyleSchema = {
1878
- styleWhilePremounted: {
1879
- type: "hidden"
1880
- },
1881
- styleWhilePostmounted: {
1882
- type: "hidden"
1883
- }
1884
- };
1885
1916
  var sequencePremountSchema = {
1886
- ...premountSchema,
1887
- ...premountStyleSchema
1917
+ ...premountSchema
1888
1918
  };
1889
1919
  var sequenceStyleSchema = {
1890
1920
  ...transformSchema,
1921
+ ...backgroundSchema,
1922
+ ...borderSchema,
1891
1923
  ...sequencePremountSchema
1892
1924
  };
1893
1925
  var hiddenField = {
@@ -5319,39 +5351,56 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
5319
5351
  };
5320
5352
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
5321
5353
 
5322
- // src/animated-image/decode-image.ts
5323
- var CACHE_SIZE = 5;
5324
- var getActualTime = ({
5325
- loopBehavior,
5326
- durationFound,
5327
- timeInSec
5328
- }) => {
5329
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
5330
- };
5331
- var decodeImage = async ({
5354
+ // src/animated-image/create-image-decoder.ts
5355
+ var createImageDecoder = async ({
5332
5356
  resolvedSrc,
5333
5357
  signal,
5334
5358
  requestInit,
5335
- currentTime,
5336
- initialLoopBehavior
5359
+ contentType
5337
5360
  }) => {
5338
5361
  if (typeof ImageDecoder === "undefined") {
5339
5362
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
5340
5363
  }
5341
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
5342
- const { body } = res;
5364
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
5365
+ const { body } = response;
5343
5366
  if (!body) {
5344
5367
  throw new Error("Got no body");
5345
5368
  }
5346
5369
  const decoder = new ImageDecoder({
5347
5370
  data: body,
5348
- type: res.headers.get("Content-Type") || "image/gif"
5371
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
5349
5372
  });
5350
- await decoder.completed;
5373
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
5351
5374
  const { selectedTrack } = decoder.tracks;
5352
5375
  if (!selectedTrack) {
5376
+ decoder.close();
5353
5377
  throw new Error("No selected track");
5354
5378
  }
5379
+ return { decoder, selectedTrack };
5380
+ };
5381
+
5382
+ // src/animated-image/decode-image.ts
5383
+ var CACHE_SIZE = 5;
5384
+ var getActualTime = ({
5385
+ loopBehavior,
5386
+ durationFound,
5387
+ timeInSec
5388
+ }) => {
5389
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
5390
+ };
5391
+ var decodeImage = async ({
5392
+ resolvedSrc,
5393
+ signal,
5394
+ requestInit,
5395
+ currentTime,
5396
+ initialLoopBehavior
5397
+ }) => {
5398
+ const { decoder, selectedTrack } = await createImageDecoder({
5399
+ resolvedSrc,
5400
+ signal,
5401
+ requestInit,
5402
+ contentType: null
5403
+ });
5355
5404
  const cache2 = [];
5356
5405
  let durationFound = null;
5357
5406
  const getFrameByIndex = async (frameIndex) => {
@@ -5457,6 +5506,13 @@ var decodeImage = async ({
5457
5506
  return closest;
5458
5507
  };
5459
5508
  return {
5509
+ close: () => {
5510
+ for (const item of cache2) {
5511
+ item.frame?.close();
5512
+ item.frame = null;
5513
+ }
5514
+ decoder.close();
5515
+ },
5460
5516
  getFrame,
5461
5517
  frameCount: selectedTrack.frameCount
5462
5518
  };
@@ -5503,6 +5559,7 @@ var animatedImageSchema = {
5503
5559
  keyframable: false
5504
5560
  },
5505
5561
  ...baseSchema,
5562
+ ...premountSchema,
5506
5563
  playbackRate: {
5507
5564
  type: "number",
5508
5565
  min: 0,
@@ -5513,7 +5570,9 @@ var animatedImageSchema = {
5513
5570
  hiddenFromList: false,
5514
5571
  keyframable: false
5515
5572
  },
5516
- ...transformSchema
5573
+ ...transformSchema,
5574
+ ...backgroundSchema,
5575
+ ...borderSchema
5517
5576
  };
5518
5577
  var getCanvasPropsFromSequenceProps = (props) => {
5519
5578
  const canvasProps = {};
@@ -5565,6 +5624,15 @@ var AnimatedImageContent = forwardRef4(({
5565
5624
  const [initialLoopBehavior] = useState6(() => loopBehavior);
5566
5625
  useEffect5(() => {
5567
5626
  const controller = new AbortController;
5627
+ let cancelled = false;
5628
+ let continued = false;
5629
+ const continueRenderOnce = () => {
5630
+ if (continued) {
5631
+ return;
5632
+ }
5633
+ continued = true;
5634
+ continueRender2(decodeHandle);
5635
+ };
5568
5636
  decodeImage({
5569
5637
  resolvedSrc,
5570
5638
  signal: controller.signal,
@@ -5572,22 +5640,31 @@ var AnimatedImageContent = forwardRef4(({
5572
5640
  currentTime: currentTimeRef.current,
5573
5641
  initialLoopBehavior
5574
5642
  }).then((d) => {
5643
+ if (cancelled) {
5644
+ d.close();
5645
+ return;
5646
+ }
5575
5647
  setImageDecoder(d);
5576
- continueRender2(decodeHandle);
5648
+ continueRenderOnce();
5577
5649
  }).catch((err) => {
5650
+ if (cancelled) {
5651
+ return;
5652
+ }
5578
5653
  if (err.name === "AbortError") {
5579
- continueRender2(decodeHandle);
5654
+ continueRenderOnce();
5580
5655
  return;
5581
5656
  }
5582
5657
  if (onError) {
5583
5658
  onError?.(err);
5584
- continueRender2(decodeHandle);
5659
+ continueRenderOnce();
5585
5660
  } else {
5586
5661
  cancelRender(err);
5587
5662
  }
5588
5663
  });
5589
5664
  return () => {
5665
+ cancelled = true;
5590
5666
  controller.abort();
5667
+ continueRenderOnce();
5591
5668
  };
5592
5669
  }, [
5593
5670
  resolvedSrc,
@@ -5597,6 +5674,11 @@ var AnimatedImageContent = forwardRef4(({
5597
5674
  initialLoopBehavior,
5598
5675
  continueRender2
5599
5676
  ]);
5677
+ useEffect5(() => {
5678
+ return () => {
5679
+ imageDecoder?.close();
5680
+ };
5681
+ }, [imageDecoder]);
5600
5682
  useLayoutEffect2(() => {
5601
5683
  if (!imageDecoder) {
5602
5684
  return;
@@ -5666,6 +5748,11 @@ var AnimatedImageInner = ({
5666
5748
  className,
5667
5749
  style,
5668
5750
  durationInFrames,
5751
+ from,
5752
+ premountFor,
5753
+ postmountFor,
5754
+ styleWhilePremounted,
5755
+ styleWhilePostmounted,
5669
5756
  requestInit,
5670
5757
  effects = [],
5671
5758
  controls,
@@ -5677,6 +5764,24 @@ var AnimatedImageInner = ({
5677
5764
  useImperativeHandle2(ref, () => {
5678
5765
  return actualRef.current;
5679
5766
  }, []);
5767
+ const {
5768
+ effectivePostmountFor,
5769
+ effectivePremountFor,
5770
+ freezeFrame,
5771
+ isPremountingOrPostmounting,
5772
+ postmountingActive,
5773
+ premountingActive,
5774
+ premountingStyle
5775
+ } = usePremounting({
5776
+ from: from ?? 0,
5777
+ durationInFrames: durationInFrames ?? Infinity,
5778
+ premountFor: premountFor ?? null,
5779
+ postmountFor: postmountFor ?? null,
5780
+ style: style ?? null,
5781
+ styleWhilePremounted: styleWhilePremounted ?? null,
5782
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
5783
+ hideWhilePremounted: "display-none"
5784
+ });
5680
5785
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
5681
5786
  const animatedImageProps = {
5682
5787
  src,
@@ -5688,24 +5793,33 @@ var AnimatedImageInner = ({
5688
5793
  loopBehavior,
5689
5794
  id,
5690
5795
  className,
5691
- style,
5796
+ style: premountingStyle ?? undefined,
5692
5797
  requestInit,
5693
5798
  ...canvasProps
5694
5799
  };
5695
- return /* @__PURE__ */ jsx14(Sequence, {
5696
- layout: "none",
5697
- durationInFrames,
5698
- name: "<AnimatedImage>",
5699
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
5700
- controls,
5701
- _remotionInternalEffects: memoizedEffectDefinitions,
5702
- ...sequenceProps,
5703
- outlineRef: actualRef,
5704
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
5705
- ...animatedImageProps,
5706
- ref: actualRef,
5707
- effects,
5708
- controls
5800
+ return /* @__PURE__ */ jsx14(Freeze, {
5801
+ frame: freezeFrame,
5802
+ active: isPremountingOrPostmounting,
5803
+ children: /* @__PURE__ */ jsx14(Sequence, {
5804
+ layout: "none",
5805
+ from: from ?? 0,
5806
+ durationInFrames: durationInFrames ?? Infinity,
5807
+ name: "<AnimatedImage>",
5808
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
5809
+ controls,
5810
+ _remotionInternalEffects: memoizedEffectDefinitions,
5811
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
5812
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
5813
+ _remotionInternalIsPremounting: premountingActive,
5814
+ _remotionInternalIsPostmounting: postmountingActive,
5815
+ ...sequenceProps,
5816
+ outlineRef: actualRef,
5817
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
5818
+ ...animatedImageProps,
5819
+ ref: actualRef,
5820
+ effects,
5821
+ controls
5822
+ })
5709
5823
  })
5710
5824
  });
5711
5825
  };
@@ -6504,13 +6618,17 @@ var makeSharedElementSourceNode = ({
6504
6618
  }) => {
6505
6619
  let connected = null;
6506
6620
  let disposed = false;
6621
+ let currentAudioContext = audioContext;
6507
6622
  return {
6623
+ setAudioContext: (newAudioContext) => {
6624
+ currentAudioContext = newAudioContext;
6625
+ },
6508
6626
  attemptToConnect: () => {
6509
6627
  if (disposed) {
6510
6628
  throw new Error("SharedElementSourceNode has been disposed");
6511
6629
  }
6512
- if (!connected && ref.current) {
6513
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
6630
+ if (!connected && ref.current && currentAudioContext) {
6631
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
6514
6632
  connected = mediaElementSourceNode;
6515
6633
  }
6516
6634
  },
@@ -6846,19 +6964,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6846
6964
  const audioCtx = useContext21(SharedAudioContext);
6847
6965
  const audioContext = audioCtx?.audioContext ?? null;
6848
6966
  const resume = audioCtx?.resume;
6849
- const refs = useMemo22(() => {
6967
+ const [refs] = useState10(() => {
6850
6968
  return new Array(numberOfAudioTags).fill(true).map(() => {
6851
6969
  const ref = createRef2();
6852
6970
  return {
6853
6971
  id: Math.random(),
6854
6972
  ref,
6855
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
6973
+ mediaElementSourceNode: makeSharedElementSourceNode({
6856
6974
  audioContext,
6857
6975
  ref
6858
- }) : null
6976
+ })
6859
6977
  };
6860
6978
  });
6861
- }, [audioContext, numberOfAudioTags]);
6979
+ });
6980
+ for (const { mediaElementSourceNode } of refs) {
6981
+ mediaElementSourceNode?.setAudioContext(audioContext);
6982
+ }
6862
6983
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
6863
6984
  effectToUse(() => {
6864
6985
  return () => {
@@ -6926,7 +7047,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6926
7047
  const cloned = [...takenAudios.current];
6927
7048
  const index = refs.findIndex((r) => r.id === id);
6928
7049
  if (index === -1) {
6929
- throw new TypeError("Error occured in ");
7050
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r) => r.id).join(", ")}`);
6930
7051
  }
6931
7052
  cloned[index] = false;
6932
7053
  takenAudios.current = cloned;
@@ -7030,10 +7151,10 @@ var useSharedAudio = ({
7030
7151
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
7031
7152
  }
7032
7153
  const el = React20.createRef();
7033
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
7034
- audioContext: audioCtx.audioContext,
7154
+ const mediaElementSourceNode = makeSharedElementSourceNode({
7155
+ audioContext: audioCtx?.audioContext ?? null,
7035
7156
  ref: el
7036
- }) : null;
7157
+ });
7037
7158
  return {
7038
7159
  el,
7039
7160
  id: Math.random(),
@@ -7048,6 +7169,7 @@ var useSharedAudio = ({
7048
7169
  }
7049
7170
  };
7050
7171
  });
7172
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
7051
7173
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7052
7174
  if (typeof document !== "undefined") {
7053
7175
  effectToUse(() => {
@@ -9013,7 +9135,9 @@ var solidSchema = {
9013
9135
  description: "Pixel density",
9014
9136
  hiddenFromList: false
9015
9137
  },
9016
- ...transformSchema
9138
+ ...transformSchema,
9139
+ ...backgroundSchema,
9140
+ ...borderSchema
9017
9141
  };
9018
9142
  var SolidInner = ({
9019
9143
  color,
@@ -9268,7 +9392,7 @@ var HtmlInCanvasContent = forwardRef9(({
9268
9392
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
9269
9393
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
9270
9394
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
9271
- const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
9395
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
9272
9396
  const { isClientSideRendering, isRendering } = useRemotionEnvironment();
9273
9397
  const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
9274
9398
  const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
@@ -9322,7 +9446,7 @@ var HtmlInCanvasContent = forwardRef9(({
9322
9446
  if (!placeholderCanvas) {
9323
9447
  throw new Error("Canvas not found");
9324
9448
  }
9325
- const handle = delayRender("onPaint");
9449
+ const handle = delayRender2("onPaint");
9326
9450
  if (!initializedRef.current) {
9327
9451
  const currentOnInit = onInitRef.current;
9328
9452
  if (!currentOnInit) {
@@ -9423,6 +9547,7 @@ var HtmlInCanvasContent = forwardRef9(({
9423
9547
  chainState,
9424
9548
  continueRender2,
9425
9549
  cancelRender2,
9550
+ delayRender2,
9426
9551
  resolvedPixelDensity,
9427
9552
  canRetryMissingPaintRecord
9428
9553
  ]);
@@ -9474,14 +9599,14 @@ var HtmlInCanvasContent = forwardRef9(({
9474
9599
  if (!canvas) {
9475
9600
  return;
9476
9601
  }
9477
- const handle = delayRender("waiting for first paint after canvas resize");
9602
+ const handle = delayRender2("waiting for first paint after canvas resize");
9478
9603
  canvas.addEventListener("paint", () => {
9479
9604
  continueRender2(handle);
9480
9605
  }, { once: true });
9481
9606
  return () => {
9482
9607
  continueRender2(handle);
9483
9608
  };
9484
- }, [width, height, continueRender2, canvasSizeKey]);
9609
+ }, [width, height, continueRender2, delayRender2, canvasSizeKey]);
9485
9610
  const innerStyle = useMemo31(() => {
9486
9611
  return {
9487
9612
  width,
@@ -9577,7 +9702,9 @@ var htmlInCanvasSchema = {
9577
9702
  description: "Pixel density",
9578
9703
  hiddenFromList: false
9579
9704
  },
9580
- ...transformSchema
9705
+ ...transformSchema,
9706
+ ...backgroundSchema,
9707
+ ...borderSchema
9581
9708
  };
9582
9709
  var HtmlInCanvasWrapped = withInteractivitySchema({
9583
9710
  Component: HtmlInCanvasInner,
@@ -9615,6 +9742,7 @@ function truncateSrcForLabel(src) {
9615
9742
  import { jsx as jsx26 } from "react/jsx-runtime";
9616
9743
  var canvasImageSchema = {
9617
9744
  ...baseSchema,
9745
+ ...premountSchema,
9618
9746
  fit: {
9619
9747
  type: "enum",
9620
9748
  default: "fill",
@@ -9625,7 +9753,9 @@ var canvasImageSchema = {
9625
9753
  cover: {}
9626
9754
  }
9627
9755
  },
9628
- ...transformSchema
9756
+ ...transformSchema,
9757
+ ...backgroundSchema,
9758
+ ...borderSchema
9629
9759
  };
9630
9760
  var makeAbortError = () => {
9631
9761
  if (typeof DOMException !== "undefined") {
@@ -9949,6 +10079,10 @@ var CanvasImageInner = forwardRef10(({
9949
10079
  from,
9950
10080
  trimBefore,
9951
10081
  freeze,
10082
+ premountFor,
10083
+ postmountFor,
10084
+ styleWhilePremounted,
10085
+ styleWhilePostmounted,
9952
10086
  hidden,
9953
10087
  name,
9954
10088
  showInTimeline,
@@ -9966,39 +10100,65 @@ var CanvasImageInner = forwardRef10(({
9966
10100
  useImperativeHandle7(ref, () => {
9967
10101
  return actualRef.current;
9968
10102
  }, []);
9969
- return /* @__PURE__ */ jsx26(Sequence, {
9970
- layout: "none",
10103
+ const {
10104
+ effectivePostmountFor,
10105
+ effectivePremountFor,
10106
+ freezeFrame,
10107
+ isPremountingOrPostmounting,
10108
+ postmountingActive,
10109
+ premountingActive,
10110
+ premountingStyle
10111
+ } = usePremounting({
9971
10112
  from: from ?? 0,
9972
- trimBefore,
9973
10113
  durationInFrames: durationInFrames ?? Infinity,
9974
- freeze,
9975
- hidden,
9976
- showInTimeline: showInTimeline ?? true,
9977
- name: name ?? "<CanvasImage>",
9978
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
9979
- controls,
9980
- _remotionInternalEffects: memoizedEffectDefinitions,
9981
- _remotionInternalIsMedia: { type: "image", src },
9982
- _remotionInternalStack: stack,
9983
- outlineRef: outlineRef ?? actualRef,
9984
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
9985
- ref: actualRef,
9986
- src,
9987
- width,
9988
- height,
9989
- fit,
9990
- effects,
10114
+ premountFor: premountFor ?? null,
10115
+ postmountFor: postmountFor ?? null,
10116
+ style: style ?? null,
10117
+ styleWhilePremounted: styleWhilePremounted ?? null,
10118
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
10119
+ hideWhilePremounted: "display-none"
10120
+ });
10121
+ return /* @__PURE__ */ jsx26(Freeze, {
10122
+ frame: freezeFrame,
10123
+ active: isPremountingOrPostmounting,
10124
+ children: /* @__PURE__ */ jsx26(Sequence, {
10125
+ layout: "none",
10126
+ from: from ?? 0,
10127
+ trimBefore,
10128
+ durationInFrames: durationInFrames ?? Infinity,
10129
+ freeze,
10130
+ hidden,
10131
+ showInTimeline: showInTimeline ?? true,
10132
+ name: name ?? "<CanvasImage>",
10133
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
9991
10134
  controls,
9992
- className,
9993
- style,
9994
- id,
9995
- onError,
9996
- pauseWhenLoading,
9997
- maxRetries,
9998
- delayRenderRetries,
9999
- delayRenderTimeoutInMilliseconds,
10000
- refForOutline: outlineRef ?? null,
10001
- ...canvasProps
10135
+ _remotionInternalEffects: memoizedEffectDefinitions,
10136
+ _remotionInternalIsMedia: { type: "image", src },
10137
+ _remotionInternalStack: stack,
10138
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
10139
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
10140
+ _remotionInternalIsPremounting: premountingActive,
10141
+ _remotionInternalIsPostmounting: postmountingActive,
10142
+ outlineRef: outlineRef ?? actualRef,
10143
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10144
+ ref: actualRef,
10145
+ src,
10146
+ width,
10147
+ height,
10148
+ fit,
10149
+ effects,
10150
+ controls,
10151
+ className,
10152
+ style: premountingStyle ?? undefined,
10153
+ id,
10154
+ onError,
10155
+ pauseWhenLoading,
10156
+ maxRetries,
10157
+ delayRenderRetries,
10158
+ delayRenderTimeoutInMilliseconds,
10159
+ refForOutline: outlineRef ?? null,
10160
+ ...canvasProps
10161
+ })
10002
10162
  })
10003
10163
  });
10004
10164
  });
@@ -10258,6 +10418,11 @@ var NativeImgInner = ({
10258
10418
  trimBefore,
10259
10419
  durationInFrames,
10260
10420
  freeze,
10421
+ premountFor,
10422
+ postmountFor,
10423
+ style,
10424
+ styleWhilePremounted,
10425
+ styleWhilePostmounted,
10261
10426
  controls,
10262
10427
  outlineRef: refForOutline,
10263
10428
  ...props2
@@ -10265,24 +10430,51 @@ var NativeImgInner = ({
10265
10430
  if (!src) {
10266
10431
  throw new Error('No "src" prop was passed to <Img>.');
10267
10432
  }
10268
- return /* @__PURE__ */ jsx28(Sequence, {
10269
- layout: "none",
10433
+ const {
10434
+ effectivePostmountFor,
10435
+ effectivePremountFor,
10436
+ freezeFrame,
10437
+ isPremountingOrPostmounting,
10438
+ postmountingActive,
10439
+ premountingActive,
10440
+ premountingStyle
10441
+ } = usePremounting({
10270
10442
  from: from ?? 0,
10271
- trimBefore,
10272
10443
  durationInFrames: durationInFrames ?? Infinity,
10273
- freeze,
10274
- _remotionInternalStack: stack,
10275
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
10276
- _remotionInternalIsMedia: { type: "image", src },
10277
- name: name ?? "<Img>",
10278
- controls,
10279
- showInTimeline: showInTimeline ?? true,
10280
- hidden,
10281
- outlineRef: refForOutline,
10282
- children: /* @__PURE__ */ jsx28(ImgContent, {
10283
- src,
10284
- refForOutline,
10285
- ...props2
10444
+ premountFor: premountFor ?? null,
10445
+ postmountFor: postmountFor ?? null,
10446
+ style: style ?? null,
10447
+ styleWhilePremounted: styleWhilePremounted ?? null,
10448
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
10449
+ hideWhilePremounted: "display-none"
10450
+ });
10451
+ return /* @__PURE__ */ jsx28(Freeze, {
10452
+ frame: freezeFrame,
10453
+ active: isPremountingOrPostmounting,
10454
+ children: /* @__PURE__ */ jsx28(Sequence, {
10455
+ layout: "none",
10456
+ from: from ?? 0,
10457
+ trimBefore,
10458
+ durationInFrames: durationInFrames ?? Infinity,
10459
+ freeze,
10460
+ _remotionInternalStack: stack,
10461
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
10462
+ _remotionInternalIsMedia: { type: "image", src },
10463
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
10464
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
10465
+ _remotionInternalIsPremounting: premountingActive,
10466
+ _remotionInternalIsPostmounting: postmountingActive,
10467
+ name: name ?? "<Img>",
10468
+ controls,
10469
+ showInTimeline: showInTimeline ?? true,
10470
+ hidden,
10471
+ outlineRef: refForOutline,
10472
+ children: /* @__PURE__ */ jsx28(ImgContent, {
10473
+ src,
10474
+ refForOutline,
10475
+ style: premountingStyle ?? undefined,
10476
+ ...props2
10477
+ })
10286
10478
  })
10287
10479
  });
10288
10480
  };
@@ -10295,7 +10487,10 @@ var imgSchema = {
10295
10487
  keyframable: false
10296
10488
  },
10297
10489
  ...baseSchema,
10298
- ...transformSchema
10490
+ ...premountSchema,
10491
+ ...transformSchema,
10492
+ ...backgroundSchema,
10493
+ ...borderSchema
10299
10494
  };
10300
10495
  var imgCanvasFallbackIncompatibleProps = new Set([
10301
10496
  "alt",
@@ -10351,6 +10546,10 @@ var ImgInner = ({
10351
10546
  trimBefore,
10352
10547
  durationInFrames,
10353
10548
  freeze,
10549
+ premountFor,
10550
+ postmountFor,
10551
+ styleWhilePremounted,
10552
+ styleWhilePostmounted,
10354
10553
  controls,
10355
10554
  width,
10356
10555
  height,
@@ -10377,6 +10576,10 @@ var ImgInner = ({
10377
10576
  trimBefore,
10378
10577
  durationInFrames,
10379
10578
  freeze,
10579
+ premountFor,
10580
+ postmountFor,
10581
+ styleWhilePremounted,
10582
+ styleWhilePostmounted,
10380
10583
  controls,
10381
10584
  width,
10382
10585
  height,
@@ -10420,6 +10623,10 @@ var ImgInner = ({
10420
10623
  trimBefore,
10421
10624
  durationInFrames,
10422
10625
  freeze,
10626
+ premountFor,
10627
+ postmountFor,
10628
+ styleWhilePremounted,
10629
+ styleWhilePostmounted,
10423
10630
  hidden,
10424
10631
  name: name ?? "<Img>",
10425
10632
  showInTimeline,
@@ -10461,7 +10668,20 @@ var interactiveElementSchema = {
10461
10668
  ...baseSchema,
10462
10669
  ...transformSchema
10463
10670
  };
10671
+ var interactiveBackgroundElementSchema = {
10672
+ ...interactiveElementSchema,
10673
+ ...backgroundSchema
10674
+ };
10675
+ var interactiveBorderElementSchema = {
10676
+ ...interactiveBackgroundElementSchema,
10677
+ ...borderSchema
10678
+ };
10464
10679
  var interactiveTextElementSchema = {
10680
+ ...interactiveBorderElementSchema,
10681
+ ...textSchema,
10682
+ ...textContentSchema
10683
+ };
10684
+ var interactiveSvgTextElementSchema = {
10465
10685
  ...interactiveElementSchema,
10466
10686
  ...textSchema,
10467
10687
  ...textContentSchema
@@ -10540,6 +10760,8 @@ var Interactive = {
10540
10760
  baseSchema,
10541
10761
  transformSchema,
10542
10762
  textSchema,
10763
+ backgroundSchema,
10764
+ borderSchema,
10543
10765
  premountSchema,
10544
10766
  sequenceSchema,
10545
10767
  withSchema,
@@ -10576,13 +10798,44 @@ var Interactive = {
10576
10798
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
10577
10799
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
10578
10800
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
10579
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
10580
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
10801
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
10802
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
10581
10803
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
10582
10804
  };
10583
10805
  // src/internals.ts
10584
10806
  import { createRef as createRef3 } from "react";
10585
10807
 
10808
+ // src/animated-image/get-duration-in-seconds.ts
10809
+ var getAnimatedImageDurationInSeconds = async ({
10810
+ resolvedSrc,
10811
+ signal,
10812
+ requestInit,
10813
+ contentType
10814
+ }) => {
10815
+ const { decoder, selectedTrack } = await createImageDecoder({
10816
+ resolvedSrc,
10817
+ signal,
10818
+ requestInit,
10819
+ contentType
10820
+ });
10821
+ try {
10822
+ const { image } = await decoder.decode({
10823
+ frameIndex: selectedTrack.frameCount - 1,
10824
+ completeFramesOnly: true
10825
+ });
10826
+ try {
10827
+ if (image.duration === null) {
10828
+ throw new Error("Could not determine animated image duration");
10829
+ }
10830
+ return (image.timestamp + image.duration) / 1e6;
10831
+ } finally {
10832
+ image.close();
10833
+ }
10834
+ } finally {
10835
+ decoder.close();
10836
+ }
10837
+ };
10838
+
10586
10839
  // src/CompositionManager.tsx
10587
10840
  import React31 from "react";
10588
10841
  var compositionsRef = React31.createRef();
@@ -12005,6 +12258,7 @@ var Internals = {
12005
12258
  useAbsoluteTimelinePosition,
12006
12259
  evaluateVolume,
12007
12260
  getAbsoluteSrc,
12261
+ getAnimatedImageDurationInSeconds,
12008
12262
  getAssetDisplayName,
12009
12263
  Timeline: exports_timeline_position_state,
12010
12264
  validateMediaTrimProps,
@@ -12029,7 +12283,6 @@ var Internals = {
12029
12283
  textSchema,
12030
12284
  transformSchema,
12031
12285
  premountSchema,
12032
- premountStyleSchema,
12033
12286
  flattenActiveSchema,
12034
12287
  getFlatSchemaWithAllKeys,
12035
12288
  RemotionRootContexts,
@@ -12179,6 +12432,7 @@ var seriesSequenceSchema = {
12179
12432
  hidden: Interactive.sequenceSchema.hidden,
12180
12433
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
12181
12434
  freeze: Interactive.baseSchema.freeze,
12435
+ trimBefore: Interactive.sequenceSchema.trimBefore,
12182
12436
  layout: Interactive.sequenceSchema.layout
12183
12437
  };
12184
12438
  var SeriesSequenceInner = forwardRef14(({