@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.
@@ -22593,17 +22593,6 @@ var delayRenderInternal = ({
22593
22593
  scope.remotion_renderReady = false;
22594
22594
  return handle;
22595
22595
  };
22596
- var delayRender = (label2, options) => {
22597
- if (typeof window === "undefined") {
22598
- return Math.random();
22599
- }
22600
- return delayRenderInternal({
22601
- scope: window,
22602
- environment: getRemotionEnvironment(),
22603
- label: label2 ?? null,
22604
- options: options ?? {}
22605
- });
22606
- };
22607
22596
  var continueRenderInternal = ({
22608
22597
  scope,
22609
22598
  handle,
@@ -22924,7 +22913,7 @@ var getSingleChildComponent = (children) => {
22924
22913
  }
22925
22914
  return child.type;
22926
22915
  };
22927
- var VERSION = "4.0.495";
22916
+ var VERSION = "4.0.497";
22928
22917
  var checkMultipleRemotionVersions = () => {
22929
22918
  if (typeof globalThis === "undefined") {
22930
22919
  return;
@@ -23402,6 +23391,45 @@ var textSchema = {
23402
23391
  hiddenFromList: false
23403
23392
  }
23404
23393
  };
23394
+ var borderSchema = {
23395
+ "style.borderWidth": {
23396
+ type: "number",
23397
+ default: undefined,
23398
+ min: 0,
23399
+ step: 1,
23400
+ description: "Border width",
23401
+ hiddenFromList: false
23402
+ },
23403
+ "style.borderStyle": {
23404
+ type: "enum",
23405
+ default: "none",
23406
+ description: "Border style",
23407
+ variants: {
23408
+ none: {},
23409
+ hidden: {},
23410
+ solid: {},
23411
+ dashed: {},
23412
+ dotted: {},
23413
+ double: {},
23414
+ groove: {},
23415
+ ridge: {},
23416
+ inset: {},
23417
+ outset: {}
23418
+ }
23419
+ },
23420
+ "style.borderColor": {
23421
+ type: "color",
23422
+ default: undefined,
23423
+ description: "Border color"
23424
+ }
23425
+ };
23426
+ var backgroundSchema = {
23427
+ "style.backgroundColor": {
23428
+ type: "color",
23429
+ default: "transparent",
23430
+ description: "Color"
23431
+ }
23432
+ };
23405
23433
  var textContentSchema = {
23406
23434
  children: {
23407
23435
  type: "text-content",
@@ -23429,20 +23457,13 @@ var premountSchema = {
23429
23457
  keyframable: false
23430
23458
  }
23431
23459
  };
23432
- var premountStyleSchema = {
23433
- styleWhilePremounted: {
23434
- type: "hidden"
23435
- },
23436
- styleWhilePostmounted: {
23437
- type: "hidden"
23438
- }
23439
- };
23440
23460
  var sequencePremountSchema = {
23441
- ...premountSchema,
23442
- ...premountStyleSchema
23461
+ ...premountSchema
23443
23462
  };
23444
23463
  var sequenceStyleSchema = {
23445
23464
  ...transformSchema,
23465
+ ...backgroundSchema,
23466
+ ...borderSchema,
23446
23467
  ...sequencePremountSchema
23447
23468
  };
23448
23469
  var hiddenField = {
@@ -26778,38 +26799,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
26778
26799
  });
26779
26800
  };
26780
26801
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
26781
- var CACHE_SIZE = 5;
26782
- var getActualTime = ({
26783
- loopBehavior,
26784
- durationFound,
26785
- timeInSec
26786
- }) => {
26787
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
26788
- };
26789
- var decodeImage = async ({
26802
+ var createImageDecoder = async ({
26790
26803
  resolvedSrc,
26791
26804
  signal,
26792
26805
  requestInit,
26793
- currentTime,
26794
- initialLoopBehavior
26806
+ contentType
26795
26807
  }) => {
26796
26808
  if (typeof ImageDecoder === "undefined") {
26797
26809
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
26798
26810
  }
26799
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
26800
- const { body } = res;
26811
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
26812
+ const { body } = response;
26801
26813
  if (!body) {
26802
26814
  throw new Error("Got no body");
26803
26815
  }
26804
26816
  const decoder = new ImageDecoder({
26805
26817
  data: body,
26806
- type: res.headers.get("Content-Type") || "image/gif"
26818
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
26807
26819
  });
26808
- await decoder.completed;
26820
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
26809
26821
  const { selectedTrack } = decoder.tracks;
26810
26822
  if (!selectedTrack) {
26823
+ decoder.close();
26811
26824
  throw new Error("No selected track");
26812
26825
  }
26826
+ return { decoder, selectedTrack };
26827
+ };
26828
+ var CACHE_SIZE = 5;
26829
+ var getActualTime = ({
26830
+ loopBehavior,
26831
+ durationFound,
26832
+ timeInSec
26833
+ }) => {
26834
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
26835
+ };
26836
+ var decodeImage = async ({
26837
+ resolvedSrc,
26838
+ signal,
26839
+ requestInit,
26840
+ currentTime,
26841
+ initialLoopBehavior
26842
+ }) => {
26843
+ const { decoder, selectedTrack } = await createImageDecoder({
26844
+ resolvedSrc,
26845
+ signal,
26846
+ requestInit,
26847
+ contentType: null
26848
+ });
26813
26849
  const cache2 = [];
26814
26850
  let durationFound = null;
26815
26851
  const getFrameByIndex = async (frameIndex) => {
@@ -26915,6 +26951,13 @@ var decodeImage = async ({
26915
26951
  return closest;
26916
26952
  };
26917
26953
  return {
26954
+ close: () => {
26955
+ for (const item of cache2) {
26956
+ item.frame?.close();
26957
+ item.frame = null;
26958
+ }
26959
+ decoder.close();
26960
+ },
26918
26961
  getFrame,
26919
26962
  frameCount: selectedTrack.frameCount
26920
26963
  };
@@ -26952,6 +26995,7 @@ var animatedImageSchema = {
26952
26995
  keyframable: false
26953
26996
  },
26954
26997
  ...baseSchema,
26998
+ ...premountSchema,
26955
26999
  playbackRate: {
26956
27000
  type: "number",
26957
27001
  min: 0,
@@ -26962,7 +27006,9 @@ var animatedImageSchema = {
26962
27006
  hiddenFromList: false,
26963
27007
  keyframable: false
26964
27008
  },
26965
- ...transformSchema
27009
+ ...transformSchema,
27010
+ ...backgroundSchema,
27011
+ ...borderSchema
26966
27012
  };
26967
27013
  var getCanvasPropsFromSequenceProps = (props) => {
26968
27014
  const canvasProps = {};
@@ -27014,6 +27060,15 @@ var AnimatedImageContent = forwardRef4(({
27014
27060
  const [initialLoopBehavior] = useState6(() => loopBehavior);
27015
27061
  useEffect5(() => {
27016
27062
  const controller = new AbortController;
27063
+ let cancelled = false;
27064
+ let continued = false;
27065
+ const continueRenderOnce = () => {
27066
+ if (continued) {
27067
+ return;
27068
+ }
27069
+ continued = true;
27070
+ continueRender2(decodeHandle);
27071
+ };
27017
27072
  decodeImage({
27018
27073
  resolvedSrc,
27019
27074
  signal: controller.signal,
@@ -27021,22 +27076,31 @@ var AnimatedImageContent = forwardRef4(({
27021
27076
  currentTime: currentTimeRef.current,
27022
27077
  initialLoopBehavior
27023
27078
  }).then((d) => {
27079
+ if (cancelled) {
27080
+ d.close();
27081
+ return;
27082
+ }
27024
27083
  setImageDecoder(d);
27025
- continueRender2(decodeHandle);
27084
+ continueRenderOnce();
27026
27085
  }).catch((err) => {
27086
+ if (cancelled) {
27087
+ return;
27088
+ }
27027
27089
  if (err.name === "AbortError") {
27028
- continueRender2(decodeHandle);
27090
+ continueRenderOnce();
27029
27091
  return;
27030
27092
  }
27031
27093
  if (onError) {
27032
27094
  onError?.(err);
27033
- continueRender2(decodeHandle);
27095
+ continueRenderOnce();
27034
27096
  } else {
27035
27097
  cancelRender(err);
27036
27098
  }
27037
27099
  });
27038
27100
  return () => {
27101
+ cancelled = true;
27039
27102
  controller.abort();
27103
+ continueRenderOnce();
27040
27104
  };
27041
27105
  }, [
27042
27106
  resolvedSrc,
@@ -27046,6 +27110,11 @@ var AnimatedImageContent = forwardRef4(({
27046
27110
  initialLoopBehavior,
27047
27111
  continueRender2
27048
27112
  ]);
27113
+ useEffect5(() => {
27114
+ return () => {
27115
+ imageDecoder?.close();
27116
+ };
27117
+ }, [imageDecoder]);
27049
27118
  useLayoutEffect2(() => {
27050
27119
  if (!imageDecoder) {
27051
27120
  return;
@@ -27115,6 +27184,11 @@ var AnimatedImageInner = ({
27115
27184
  className,
27116
27185
  style,
27117
27186
  durationInFrames,
27187
+ from,
27188
+ premountFor,
27189
+ postmountFor,
27190
+ styleWhilePremounted,
27191
+ styleWhilePostmounted,
27118
27192
  requestInit,
27119
27193
  effects = [],
27120
27194
  controls,
@@ -27126,6 +27200,24 @@ var AnimatedImageInner = ({
27126
27200
  useImperativeHandle2(ref, () => {
27127
27201
  return actualRef.current;
27128
27202
  }, []);
27203
+ const {
27204
+ effectivePostmountFor,
27205
+ effectivePremountFor,
27206
+ freezeFrame,
27207
+ isPremountingOrPostmounting,
27208
+ postmountingActive,
27209
+ premountingActive,
27210
+ premountingStyle
27211
+ } = usePremounting({
27212
+ from: from ?? 0,
27213
+ durationInFrames: durationInFrames ?? Infinity,
27214
+ premountFor: premountFor ?? null,
27215
+ postmountFor: postmountFor ?? null,
27216
+ style: style ?? null,
27217
+ styleWhilePremounted: styleWhilePremounted ?? null,
27218
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
27219
+ hideWhilePremounted: "display-none"
27220
+ });
27129
27221
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
27130
27222
  const animatedImageProps = {
27131
27223
  src,
@@ -27137,24 +27229,33 @@ var AnimatedImageInner = ({
27137
27229
  loopBehavior,
27138
27230
  id,
27139
27231
  className,
27140
- style,
27232
+ style: premountingStyle ?? undefined,
27141
27233
  requestInit,
27142
27234
  ...canvasProps
27143
27235
  };
27144
- return /* @__PURE__ */ jsx14(Sequence, {
27145
- layout: "none",
27146
- durationInFrames,
27147
- name: "<AnimatedImage>",
27148
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
27149
- controls,
27150
- _remotionInternalEffects: memoizedEffectDefinitions,
27151
- ...sequenceProps,
27152
- outlineRef: actualRef,
27153
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
27154
- ...animatedImageProps,
27155
- ref: actualRef,
27156
- effects,
27157
- controls
27236
+ return /* @__PURE__ */ jsx14(Freeze, {
27237
+ frame: freezeFrame,
27238
+ active: isPremountingOrPostmounting,
27239
+ children: /* @__PURE__ */ jsx14(Sequence, {
27240
+ layout: "none",
27241
+ from: from ?? 0,
27242
+ durationInFrames: durationInFrames ?? Infinity,
27243
+ name: "<AnimatedImage>",
27244
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
27245
+ controls,
27246
+ _remotionInternalEffects: memoizedEffectDefinitions,
27247
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
27248
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
27249
+ _remotionInternalIsPremounting: premountingActive,
27250
+ _remotionInternalIsPostmounting: postmountingActive,
27251
+ ...sequenceProps,
27252
+ outlineRef: actualRef,
27253
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
27254
+ ...animatedImageProps,
27255
+ ref: actualRef,
27256
+ effects,
27257
+ controls
27258
+ })
27158
27259
  })
27159
27260
  });
27160
27261
  };
@@ -27870,13 +27971,17 @@ var makeSharedElementSourceNode = ({
27870
27971
  }) => {
27871
27972
  let connected = null;
27872
27973
  let disposed = false;
27974
+ let currentAudioContext = audioContext;
27873
27975
  return {
27976
+ setAudioContext: (newAudioContext) => {
27977
+ currentAudioContext = newAudioContext;
27978
+ },
27874
27979
  attemptToConnect: () => {
27875
27980
  if (disposed) {
27876
27981
  throw new Error("SharedElementSourceNode has been disposed");
27877
27982
  }
27878
- if (!connected && ref.current) {
27879
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
27983
+ if (!connected && ref.current && currentAudioContext) {
27984
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
27880
27985
  connected = mediaElementSourceNode;
27881
27986
  }
27882
27987
  },
@@ -28204,19 +28309,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
28204
28309
  const audioCtx = useContext21(SharedAudioContext);
28205
28310
  const audioContext = audioCtx?.audioContext ?? null;
28206
28311
  const resume = audioCtx?.resume;
28207
- const refs = useMemo22(() => {
28312
+ const [refs] = useState10(() => {
28208
28313
  return new Array(numberOfAudioTags).fill(true).map(() => {
28209
28314
  const ref = createRef2();
28210
28315
  return {
28211
28316
  id: Math.random(),
28212
28317
  ref,
28213
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
28318
+ mediaElementSourceNode: makeSharedElementSourceNode({
28214
28319
  audioContext,
28215
28320
  ref
28216
- }) : null
28321
+ })
28217
28322
  };
28218
28323
  });
28219
- }, [audioContext, numberOfAudioTags]);
28324
+ });
28325
+ for (const { mediaElementSourceNode } of refs) {
28326
+ mediaElementSourceNode?.setAudioContext(audioContext);
28327
+ }
28220
28328
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
28221
28329
  effectToUse(() => {
28222
28330
  return () => {
@@ -28284,7 +28392,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
28284
28392
  const cloned = [...takenAudios.current];
28285
28393
  const index = refs.findIndex((r2) => r2.id === id);
28286
28394
  if (index === -1) {
28287
- throw new TypeError("Error occured in ");
28395
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r2) => r2.id).join(", ")}`);
28288
28396
  }
28289
28397
  cloned[index] = false;
28290
28398
  takenAudios.current = cloned;
@@ -28388,10 +28496,10 @@ var useSharedAudio = ({
28388
28496
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
28389
28497
  }
28390
28498
  const el = React20.createRef();
28391
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
28392
- audioContext: audioCtx.audioContext,
28499
+ const mediaElementSourceNode = makeSharedElementSourceNode({
28500
+ audioContext: audioCtx?.audioContext ?? null,
28393
28501
  ref: el
28394
- }) : null;
28502
+ });
28395
28503
  return {
28396
28504
  el,
28397
28505
  id: Math.random(),
@@ -28406,6 +28514,7 @@ var useSharedAudio = ({
28406
28514
  }
28407
28515
  };
28408
28516
  });
28517
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
28409
28518
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
28410
28519
  if (typeof document !== "undefined") {
28411
28520
  effectToUse(() => {
@@ -30263,7 +30372,9 @@ var solidSchema = {
30263
30372
  description: "Pixel density",
30264
30373
  hiddenFromList: false
30265
30374
  },
30266
- ...transformSchema
30375
+ ...transformSchema,
30376
+ ...backgroundSchema,
30377
+ ...borderSchema
30267
30378
  };
30268
30379
  var SolidInner = ({
30269
30380
  color,
@@ -30507,7 +30618,7 @@ var HtmlInCanvasContent = forwardRef9(({
30507
30618
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
30508
30619
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
30509
30620
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
30510
- const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
30621
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
30511
30622
  const { isClientSideRendering, isRendering } = useRemotionEnvironment();
30512
30623
  const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
30513
30624
  const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
@@ -30561,7 +30672,7 @@ var HtmlInCanvasContent = forwardRef9(({
30561
30672
  if (!placeholderCanvas) {
30562
30673
  throw new Error("Canvas not found");
30563
30674
  }
30564
- const handle = delayRender("onPaint");
30675
+ const handle = delayRender2("onPaint");
30565
30676
  if (!initializedRef.current) {
30566
30677
  const currentOnInit = onInitRef.current;
30567
30678
  if (!currentOnInit) {
@@ -30662,6 +30773,7 @@ var HtmlInCanvasContent = forwardRef9(({
30662
30773
  chainState,
30663
30774
  continueRender2,
30664
30775
  cancelRender2,
30776
+ delayRender2,
30665
30777
  resolvedPixelDensity,
30666
30778
  canRetryMissingPaintRecord
30667
30779
  ]);
@@ -30713,14 +30825,14 @@ var HtmlInCanvasContent = forwardRef9(({
30713
30825
  if (!canvas) {
30714
30826
  return;
30715
30827
  }
30716
- const handle = delayRender("waiting for first paint after canvas resize");
30828
+ const handle = delayRender2("waiting for first paint after canvas resize");
30717
30829
  canvas.addEventListener("paint", () => {
30718
30830
  continueRender2(handle);
30719
30831
  }, { once: true });
30720
30832
  return () => {
30721
30833
  continueRender2(handle);
30722
30834
  };
30723
- }, [width, height, continueRender2, canvasSizeKey]);
30835
+ }, [width, height, continueRender2, delayRender2, canvasSizeKey]);
30724
30836
  const innerStyle = useMemo31(() => {
30725
30837
  return {
30726
30838
  width,
@@ -30816,7 +30928,9 @@ var htmlInCanvasSchema = {
30816
30928
  description: "Pixel density",
30817
30929
  hiddenFromList: false
30818
30930
  },
30819
- ...transformSchema
30931
+ ...transformSchema,
30932
+ ...backgroundSchema,
30933
+ ...borderSchema
30820
30934
  };
30821
30935
  var HtmlInCanvasWrapped = withInteractivitySchema({
30822
30936
  Component: HtmlInCanvasInner,
@@ -30838,6 +30952,7 @@ function truncateSrcForLabel(src) {
30838
30952
  }
30839
30953
  var canvasImageSchema = {
30840
30954
  ...baseSchema,
30955
+ ...premountSchema,
30841
30956
  fit: {
30842
30957
  type: "enum",
30843
30958
  default: "fill",
@@ -30848,7 +30963,9 @@ var canvasImageSchema = {
30848
30963
  cover: {}
30849
30964
  }
30850
30965
  },
30851
- ...transformSchema
30966
+ ...transformSchema,
30967
+ ...backgroundSchema,
30968
+ ...borderSchema
30852
30969
  };
30853
30970
  var makeAbortError = () => {
30854
30971
  if (typeof DOMException !== "undefined") {
@@ -31172,6 +31289,10 @@ var CanvasImageInner = forwardRef10(({
31172
31289
  from,
31173
31290
  trimBefore,
31174
31291
  freeze,
31292
+ premountFor,
31293
+ postmountFor,
31294
+ styleWhilePremounted,
31295
+ styleWhilePostmounted,
31175
31296
  hidden,
31176
31297
  name,
31177
31298
  showInTimeline,
@@ -31189,39 +31310,65 @@ var CanvasImageInner = forwardRef10(({
31189
31310
  useImperativeHandle7(ref, () => {
31190
31311
  return actualRef.current;
31191
31312
  }, []);
31192
- return /* @__PURE__ */ jsx26(Sequence, {
31193
- layout: "none",
31313
+ const {
31314
+ effectivePostmountFor,
31315
+ effectivePremountFor,
31316
+ freezeFrame,
31317
+ isPremountingOrPostmounting,
31318
+ postmountingActive,
31319
+ premountingActive,
31320
+ premountingStyle
31321
+ } = usePremounting({
31194
31322
  from: from ?? 0,
31195
- trimBefore,
31196
31323
  durationInFrames: durationInFrames ?? Infinity,
31197
- freeze,
31198
- hidden,
31199
- showInTimeline: showInTimeline ?? true,
31200
- name: name ?? "<CanvasImage>",
31201
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
31202
- controls,
31203
- _remotionInternalEffects: memoizedEffectDefinitions,
31204
- _remotionInternalIsMedia: { type: "image", src },
31205
- _remotionInternalStack: stack,
31206
- outlineRef: outlineRef ?? actualRef,
31207
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
31208
- ref: actualRef,
31209
- src,
31210
- width,
31211
- height,
31212
- fit,
31213
- effects,
31324
+ premountFor: premountFor ?? null,
31325
+ postmountFor: postmountFor ?? null,
31326
+ style: style ?? null,
31327
+ styleWhilePremounted: styleWhilePremounted ?? null,
31328
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
31329
+ hideWhilePremounted: "display-none"
31330
+ });
31331
+ return /* @__PURE__ */ jsx26(Freeze, {
31332
+ frame: freezeFrame,
31333
+ active: isPremountingOrPostmounting,
31334
+ children: /* @__PURE__ */ jsx26(Sequence, {
31335
+ layout: "none",
31336
+ from: from ?? 0,
31337
+ trimBefore,
31338
+ durationInFrames: durationInFrames ?? Infinity,
31339
+ freeze,
31340
+ hidden,
31341
+ showInTimeline: showInTimeline ?? true,
31342
+ name: name ?? "<CanvasImage>",
31343
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
31214
31344
  controls,
31215
- className,
31216
- style,
31217
- id,
31218
- onError,
31219
- pauseWhenLoading,
31220
- maxRetries,
31221
- delayRenderRetries,
31222
- delayRenderTimeoutInMilliseconds,
31223
- refForOutline: outlineRef ?? null,
31224
- ...canvasProps
31345
+ _remotionInternalEffects: memoizedEffectDefinitions,
31346
+ _remotionInternalIsMedia: { type: "image", src },
31347
+ _remotionInternalStack: stack,
31348
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
31349
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
31350
+ _remotionInternalIsPremounting: premountingActive,
31351
+ _remotionInternalIsPostmounting: postmountingActive,
31352
+ outlineRef: outlineRef ?? actualRef,
31353
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
31354
+ ref: actualRef,
31355
+ src,
31356
+ width,
31357
+ height,
31358
+ fit,
31359
+ effects,
31360
+ controls,
31361
+ className,
31362
+ style: premountingStyle ?? undefined,
31363
+ id,
31364
+ onError,
31365
+ pauseWhenLoading,
31366
+ maxRetries,
31367
+ delayRenderRetries,
31368
+ delayRenderTimeoutInMilliseconds,
31369
+ refForOutline: outlineRef ?? null,
31370
+ ...canvasProps
31371
+ })
31225
31372
  })
31226
31373
  });
31227
31374
  });
@@ -31438,6 +31585,11 @@ var NativeImgInner = ({
31438
31585
  trimBefore,
31439
31586
  durationInFrames,
31440
31587
  freeze,
31588
+ premountFor,
31589
+ postmountFor,
31590
+ style,
31591
+ styleWhilePremounted,
31592
+ styleWhilePostmounted,
31441
31593
  controls,
31442
31594
  outlineRef: refForOutline,
31443
31595
  ...props2
@@ -31445,24 +31597,51 @@ var NativeImgInner = ({
31445
31597
  if (!src) {
31446
31598
  throw new Error('No "src" prop was passed to <Img>.');
31447
31599
  }
31448
- return /* @__PURE__ */ jsx28(Sequence, {
31449
- layout: "none",
31600
+ const {
31601
+ effectivePostmountFor,
31602
+ effectivePremountFor,
31603
+ freezeFrame,
31604
+ isPremountingOrPostmounting,
31605
+ postmountingActive,
31606
+ premountingActive,
31607
+ premountingStyle
31608
+ } = usePremounting({
31450
31609
  from: from ?? 0,
31451
- trimBefore,
31452
31610
  durationInFrames: durationInFrames ?? Infinity,
31453
- freeze,
31454
- _remotionInternalStack: stack,
31455
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
31456
- _remotionInternalIsMedia: { type: "image", src },
31457
- name: name ?? "<Img>",
31458
- controls,
31459
- showInTimeline: showInTimeline ?? true,
31460
- hidden,
31461
- outlineRef: refForOutline,
31462
- children: /* @__PURE__ */ jsx28(ImgContent, {
31463
- src,
31464
- refForOutline,
31465
- ...props2
31611
+ premountFor: premountFor ?? null,
31612
+ postmountFor: postmountFor ?? null,
31613
+ style: style ?? null,
31614
+ styleWhilePremounted: styleWhilePremounted ?? null,
31615
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
31616
+ hideWhilePremounted: "display-none"
31617
+ });
31618
+ return /* @__PURE__ */ jsx28(Freeze, {
31619
+ frame: freezeFrame,
31620
+ active: isPremountingOrPostmounting,
31621
+ children: /* @__PURE__ */ jsx28(Sequence, {
31622
+ layout: "none",
31623
+ from: from ?? 0,
31624
+ trimBefore,
31625
+ durationInFrames: durationInFrames ?? Infinity,
31626
+ freeze,
31627
+ _remotionInternalStack: stack,
31628
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
31629
+ _remotionInternalIsMedia: { type: "image", src },
31630
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
31631
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
31632
+ _remotionInternalIsPremounting: premountingActive,
31633
+ _remotionInternalIsPostmounting: postmountingActive,
31634
+ name: name ?? "<Img>",
31635
+ controls,
31636
+ showInTimeline: showInTimeline ?? true,
31637
+ hidden,
31638
+ outlineRef: refForOutline,
31639
+ children: /* @__PURE__ */ jsx28(ImgContent, {
31640
+ src,
31641
+ refForOutline,
31642
+ style: premountingStyle ?? undefined,
31643
+ ...props2
31644
+ })
31466
31645
  })
31467
31646
  });
31468
31647
  };
@@ -31475,7 +31654,10 @@ var imgSchema = {
31475
31654
  keyframable: false
31476
31655
  },
31477
31656
  ...baseSchema,
31478
- ...transformSchema
31657
+ ...premountSchema,
31658
+ ...transformSchema,
31659
+ ...backgroundSchema,
31660
+ ...borderSchema
31479
31661
  };
31480
31662
  var imgCanvasFallbackIncompatibleProps = new Set([
31481
31663
  "alt",
@@ -31531,6 +31713,10 @@ var ImgInner = ({
31531
31713
  trimBefore,
31532
31714
  durationInFrames,
31533
31715
  freeze,
31716
+ premountFor,
31717
+ postmountFor,
31718
+ styleWhilePremounted,
31719
+ styleWhilePostmounted,
31534
31720
  controls,
31535
31721
  width,
31536
31722
  height,
@@ -31557,6 +31743,10 @@ var ImgInner = ({
31557
31743
  trimBefore,
31558
31744
  durationInFrames,
31559
31745
  freeze,
31746
+ premountFor,
31747
+ postmountFor,
31748
+ styleWhilePremounted,
31749
+ styleWhilePostmounted,
31560
31750
  controls,
31561
31751
  width,
31562
31752
  height,
@@ -31600,6 +31790,10 @@ var ImgInner = ({
31600
31790
  trimBefore,
31601
31791
  durationInFrames,
31602
31792
  freeze,
31793
+ premountFor,
31794
+ postmountFor,
31795
+ styleWhilePremounted,
31796
+ styleWhilePostmounted,
31603
31797
  hidden,
31604
31798
  name: name ?? "<Img>",
31605
31799
  showInTimeline,
@@ -31638,7 +31832,20 @@ var interactiveElementSchema = {
31638
31832
  ...baseSchema,
31639
31833
  ...transformSchema
31640
31834
  };
31835
+ var interactiveBackgroundElementSchema = {
31836
+ ...interactiveElementSchema,
31837
+ ...backgroundSchema
31838
+ };
31839
+ var interactiveBorderElementSchema = {
31840
+ ...interactiveBackgroundElementSchema,
31841
+ ...borderSchema
31842
+ };
31641
31843
  var interactiveTextElementSchema = {
31844
+ ...interactiveBorderElementSchema,
31845
+ ...textSchema,
31846
+ ...textContentSchema
31847
+ };
31848
+ var interactiveSvgTextElementSchema = {
31642
31849
  ...interactiveElementSchema,
31643
31850
  ...textSchema,
31644
31851
  ...textContentSchema
@@ -31717,6 +31924,8 @@ var Interactive = {
31717
31924
  baseSchema,
31718
31925
  transformSchema,
31719
31926
  textSchema,
31927
+ backgroundSchema,
31928
+ borderSchema,
31720
31929
  premountSchema,
31721
31930
  sequenceSchema,
31722
31931
  withSchema,
@@ -31753,10 +31962,39 @@ var Interactive = {
31753
31962
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
31754
31963
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
31755
31964
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
31756
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
31757
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
31965
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
31966
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
31758
31967
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
31759
31968
  };
31969
+ var getAnimatedImageDurationInSeconds = async ({
31970
+ resolvedSrc,
31971
+ signal,
31972
+ requestInit,
31973
+ contentType
31974
+ }) => {
31975
+ const { decoder, selectedTrack } = await createImageDecoder({
31976
+ resolvedSrc,
31977
+ signal,
31978
+ requestInit,
31979
+ contentType
31980
+ });
31981
+ try {
31982
+ const { image } = await decoder.decode({
31983
+ frameIndex: selectedTrack.frameCount - 1,
31984
+ completeFramesOnly: true
31985
+ });
31986
+ try {
31987
+ if (image.duration === null) {
31988
+ throw new Error("Could not determine animated image duration");
31989
+ }
31990
+ return (image.timestamp + image.duration) / 1e6;
31991
+ } finally {
31992
+ image.close();
31993
+ }
31994
+ } finally {
31995
+ decoder.close();
31996
+ }
31997
+ };
31760
31998
  var compositionsRef = React31.createRef();
31761
31999
  var CompositionManagerProvider = ({
31762
32000
  children,
@@ -32984,6 +33222,7 @@ var Internals = {
32984
33222
  useAbsoluteTimelinePosition,
32985
33223
  evaluateVolume,
32986
33224
  getAbsoluteSrc,
33225
+ getAnimatedImageDurationInSeconds,
32987
33226
  getAssetDisplayName,
32988
33227
  Timeline: exports_timeline_position_state,
32989
33228
  validateMediaTrimProps,
@@ -33008,7 +33247,6 @@ var Internals = {
33008
33247
  textSchema,
33009
33248
  transformSchema,
33010
33249
  premountSchema,
33011
- premountStyleSchema,
33012
33250
  flattenActiveSchema,
33013
33251
  getFlatSchemaWithAllKeys,
33014
33252
  RemotionRootContexts,
@@ -33147,6 +33385,7 @@ var seriesSequenceSchema = {
33147
33385
  hidden: Interactive.sequenceSchema.hidden,
33148
33386
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
33149
33387
  freeze: Interactive.baseSchema.freeze,
33388
+ trimBefore: Interactive.sequenceSchema.trimBefore,
33150
33389
  layout: Interactive.sequenceSchema.layout
33151
33390
  };
33152
33391
  var SeriesSequenceInner = forwardRef14(({
@@ -34219,7 +34458,9 @@ var makeShapeSchema = (shapeFields) => {
34219
34458
  defaultValue: "#0b84ff",
34220
34459
  description: "Fill"
34221
34460
  }),
34222
- ...Internals.transformSchema
34461
+ ...Internals.transformSchema,
34462
+ ...Interactive.backgroundSchema,
34463
+ ...Interactive.borderSchema
34223
34464
  };
34224
34465
  };
34225
34466
  var arrowSchema = makeShapeSchema({