@remotion/promo-pages 4.0.482 → 4.0.483

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.
@@ -22899,7 +22899,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
22899
22899
  var addSequenceStackTraces = (component) => {
22900
22900
  componentsToAddStacksTo.push(component);
22901
22901
  };
22902
- var VERSION = "4.0.482";
22902
+ var VERSION = "4.0.483";
22903
22903
  var checkMultipleRemotionVersions = () => {
22904
22904
  if (typeof globalThis === "undefined") {
22905
22905
  return;
@@ -24115,6 +24115,35 @@ function findRange(input, inputRange) {
24115
24115
  return i - 1;
24116
24116
  }
24117
24117
  var defaultEasing = (num) => num;
24118
+ var shouldExtendRightForEasing = (easing) => {
24119
+ return easing.remotionShouldExtendRight === true;
24120
+ };
24121
+ var resolveEasingForSegment = ({
24122
+ easing,
24123
+ segmentIndex
24124
+ }) => {
24125
+ if (easing === undefined) {
24126
+ return defaultEasing;
24127
+ }
24128
+ if (typeof easing === "function") {
24129
+ return easing;
24130
+ }
24131
+ return easing[segmentIndex];
24132
+ };
24133
+ var interpolateSegment = ({
24134
+ input,
24135
+ inputRange,
24136
+ outputRange,
24137
+ easing,
24138
+ extrapolateLeft,
24139
+ extrapolateRight
24140
+ }) => {
24141
+ return interpolateFunction(input, inputRange, outputRange, {
24142
+ easing,
24143
+ extrapolateLeft,
24144
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
24145
+ });
24146
+ };
24118
24147
  var interpolateNumber = ({
24119
24148
  input,
24120
24149
  inputRange,
@@ -24125,15 +24154,6 @@ var interpolateNumber = ({
24125
24154
  return outputRange[0];
24126
24155
  }
24127
24156
  const easingOption = options?.easing;
24128
- const resolveEasingForSegment = (segmentIndex) => {
24129
- if (easingOption === undefined) {
24130
- return defaultEasing;
24131
- }
24132
- if (typeof easingOption === "function") {
24133
- return easingOption;
24134
- }
24135
- return easingOption[segmentIndex];
24136
- };
24137
24157
  let extrapolateLeft = "extend";
24138
24158
  if (options?.extrapolateLeft !== undefined) {
24139
24159
  extrapolateLeft = options.extrapolateLeft;
@@ -24144,11 +24164,41 @@ var interpolateNumber = ({
24144
24164
  }
24145
24165
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
24146
24166
  const range = findRange(posterizedInput, inputRange);
24147
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
24148
- easing: resolveEasingForSegment(range),
24167
+ const easing = resolveEasingForSegment({
24168
+ easing: easingOption,
24169
+ segmentIndex: range
24170
+ });
24171
+ let result = interpolateSegment({
24172
+ input: posterizedInput,
24173
+ inputRange: [inputRange[range], inputRange[range + 1]],
24174
+ outputRange: [outputRange[range], outputRange[range + 1]],
24175
+ easing,
24149
24176
  extrapolateLeft,
24150
24177
  extrapolateRight
24151
24178
  });
24179
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
24180
+ const previousEasing = resolveEasingForSegment({
24181
+ easing: easingOption,
24182
+ segmentIndex
24183
+ });
24184
+ if (!shouldExtendRightForEasing(previousEasing)) {
24185
+ continue;
24186
+ }
24187
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
24188
+ if (posterizedInput <= previousSegmentEnd) {
24189
+ continue;
24190
+ }
24191
+ const continuedSegmentValue = interpolateSegment({
24192
+ input: posterizedInput,
24193
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
24194
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
24195
+ easing: previousEasing,
24196
+ extrapolateLeft,
24197
+ extrapolateRight: "extend"
24198
+ });
24199
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
24200
+ }
24201
+ return result;
24152
24202
  };
24153
24203
  var interpolateString = ({
24154
24204
  input,
@@ -24622,21 +24672,40 @@ class Easing {
24622
24672
  static back(s = 1.70158) {
24623
24673
  return (t) => t * t * ((s + 1) * t - s);
24624
24674
  }
24625
- static spring(config = {}) {
24626
- return (t) => {
24675
+ static spring({
24676
+ allowTail = false,
24677
+ durationRestThreshold,
24678
+ ...config
24679
+ } = {}) {
24680
+ const easing = (t) => {
24627
24681
  if (t <= 0) {
24628
24682
  return 0;
24629
24683
  }
24630
- if (t >= 1) {
24684
+ if (!allowTail && t >= 1) {
24631
24685
  return 1;
24632
24686
  }
24687
+ if (allowTail) {
24688
+ return spring({
24689
+ fps: springEasingDurationInFrames,
24690
+ frame: t * measureSpring({
24691
+ fps: springEasingDurationInFrames,
24692
+ config,
24693
+ threshold: durationRestThreshold
24694
+ }),
24695
+ config
24696
+ });
24697
+ }
24633
24698
  return spring({
24634
24699
  fps: springEasingDurationInFrames,
24635
24700
  frame: t * springEasingDurationInFrames,
24636
24701
  config,
24637
- durationInFrames: springEasingDurationInFrames
24702
+ durationInFrames: springEasingDurationInFrames,
24703
+ durationRestThreshold
24638
24704
  });
24639
24705
  };
24706
+ return Object.assign(easing, {
24707
+ remotionShouldExtendRight: allowTail
24708
+ });
24640
24709
  }
24641
24710
  static bounce(t) {
24642
24711
  const u = clampUnit(t);
@@ -25167,25 +25236,31 @@ var interpolateColors = (input, inputRange, outputRange, options) => {
25167
25236
  const processedOutputRange = outputRange.map((c2) => processColor(c2));
25168
25237
  return interpolateColorsRGB(input, inputRange, processedOutputRange, options);
25169
25238
  };
25170
- var easingToFn = (e) => {
25171
- switch (e.type) {
25239
+ var easingToFn = ({
25240
+ easing,
25241
+ forceSpringAllowTail
25242
+ }) => {
25243
+ switch (easing.type) {
25172
25244
  case "linear":
25173
25245
  return Easing.linear;
25174
25246
  case "spring":
25175
25247
  return Easing.spring({
25176
- damping: e.damping,
25177
- mass: e.mass,
25178
- overshootClamping: e.overshootClamping,
25179
- stiffness: e.stiffness
25248
+ allowTail: forceSpringAllowTail ?? easing.allowTail ?? undefined,
25249
+ damping: easing.damping,
25250
+ durationRestThreshold: easing.durationRestThreshold ?? undefined,
25251
+ mass: easing.mass,
25252
+ overshootClamping: easing.overshootClamping,
25253
+ stiffness: easing.stiffness
25180
25254
  });
25181
25255
  case "bezier":
25182
- return bezier(e.x1, e.y1, e.x2, e.y2);
25256
+ return bezier(easing.x1, easing.y1, easing.x2, easing.y2);
25183
25257
  default:
25184
- throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`);
25258
+ throw new TypeError(`Unsupported easing: ${JSON.stringify(easing)}`);
25185
25259
  }
25186
25260
  };
25187
25261
  var interpolateKeyframedStatus = ({
25188
25262
  frame,
25263
+ forceSpringAllowTail,
25189
25264
  status
25190
25265
  }) => {
25191
25266
  const { keyframes, easing, clamping, interpolationFunction } = status;
@@ -25204,7 +25279,7 @@ var interpolateKeyframedStatus = ({
25204
25279
  }
25205
25280
  try {
25206
25281
  return interpolateColors(frame, inputRange, outputs, {
25207
- easing: easing.map(easingToFn),
25282
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
25208
25283
  posterize: status.posterize
25209
25284
  });
25210
25285
  } catch {
@@ -25216,7 +25291,7 @@ var interpolateKeyframedStatus = ({
25216
25291
  }
25217
25292
  try {
25218
25293
  return interpolate(frame, inputRange, outputs, {
25219
- easing: easing.map(easingToFn),
25294
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
25220
25295
  extrapolateLeft: clamping.left,
25221
25296
  extrapolateRight: clamping.right,
25222
25297
  posterize: status.posterize
@@ -25239,6 +25314,7 @@ var resolveDragOverrideValue = ({
25239
25314
  return { type: "none" };
25240
25315
  }
25241
25316
  const interpolated = interpolateKeyframedStatus({
25317
+ forceSpringAllowTail: null,
25242
25318
  frame,
25243
25319
  status: dragOverrideValue.status
25244
25320
  });
@@ -25264,6 +25340,7 @@ var getEffectiveVisualModeValue = ({
25264
25340
  if (propStatus.status === "keyframed") {
25265
25341
  if (frame !== null) {
25266
25342
  return interpolateKeyframedStatus({
25343
+ forceSpringAllowTail: null,
25267
25344
  frame,
25268
25345
  status: propStatus
25269
25346
  });
@@ -25332,6 +25409,7 @@ var resolvePropStatusOverrides = (propStatus, frame) => {
25332
25409
  }
25333
25410
  if (status.status === "keyframed") {
25334
25411
  const value = interpolateKeyframedStatus({
25412
+ forceSpringAllowTail: null,
25335
25413
  frame,
25336
25414
  status
25337
25415
  });
@@ -25507,6 +25585,17 @@ var findPropsToDelete = ({
25507
25585
  var DEFAULT_LINEAR_EASING = {
25508
25586
  type: "linear"
25509
25587
  };
25588
+ var getEasingIndexToDuplicate = ({
25589
+ insertedKeyframeIndex,
25590
+ easingLength,
25591
+ keyframeCount
25592
+ }) => {
25593
+ const isSplittingExistingSegment = insertedKeyframeIndex > 0 && insertedKeyframeIndex < keyframeCount - 1;
25594
+ if (!isSplittingExistingSegment || easingLength === 0) {
25595
+ return null;
25596
+ }
25597
+ return Math.min(insertedKeyframeIndex - 1, easingLength - 1);
25598
+ };
25510
25599
  var makeStaticDragOverride = (value) => {
25511
25600
  return { type: "static", value };
25512
25601
  };
@@ -25518,6 +25607,16 @@ var makeKeyframedDragOverride = ({
25518
25607
  const existingIndex = status.keyframes.findIndex((keyframe) => keyframe.frame === frame);
25519
25608
  const keyframes = existingIndex === -1 ? [...status.keyframes, { frame, value }].sort((first, second) => first.frame - second.frame) : status.keyframes.map((keyframe, index) => index === existingIndex ? { frame, value } : keyframe);
25520
25609
  const easing = [...status.easing];
25610
+ if (existingIndex === -1) {
25611
+ const insertedKeyframeIndex = keyframes.findIndex((keyframe) => keyframe.frame === frame);
25612
+ const easingIndexToDuplicate = getEasingIndexToDuplicate({
25613
+ insertedKeyframeIndex,
25614
+ easingLength: easing.length,
25615
+ keyframeCount: keyframes.length
25616
+ });
25617
+ const easingToDuplicate = easingIndexToDuplicate === null ? DEFAULT_LINEAR_EASING : easing[easingIndexToDuplicate];
25618
+ easing.splice(insertedKeyframeIndex, 0, easingToDuplicate);
25619
+ }
25521
25620
  while (easing.length < keyframes.length - 1) {
25522
25621
  easing.push(DEFAULT_LINEAR_EASING);
25523
25622
  }
@@ -25589,6 +25688,7 @@ var computeEffectiveSchemaValuesDotNotation = ({
25589
25688
  value = dragOverride.value;
25590
25689
  } else if (frame !== null) {
25591
25690
  const interpolated = interpolateKeyframedStatus({
25691
+ forceSpringAllowTail: null,
25592
25692
  frame,
25593
25693
  status
25594
25694
  });
@@ -29740,6 +29840,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
29740
29840
  var AudioForRendering = forwardRef6(AudioForRenderingRefForwardingFunction);
29741
29841
  var AudioRefForwardingFunction = (props, ref) => {
29742
29842
  const audioTagsContext = useContext30(SharedAudioTagsContext);
29843
+ const propsWithFreeze = props;
29743
29844
  const {
29744
29845
  startFrom,
29745
29846
  endAt,
@@ -29750,14 +29851,18 @@ var AudioRefForwardingFunction = (props, ref) => {
29750
29851
  pauseWhenBuffering,
29751
29852
  showInTimeline,
29752
29853
  onError: onRemotionError,
29854
+ freeze,
29753
29855
  ...otherProps
29754
- } = props;
29755
- const { loop, ...propsOtherThanLoop } = props;
29856
+ } = propsWithFreeze;
29857
+ const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
29756
29858
  const { fps } = useVideoConfig();
29757
29859
  const environment = useRemotionEnvironment();
29758
29860
  if (environment.isClientSideRendering) {
29759
29861
  throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
29760
29862
  }
29863
+ if (typeof freeze !== "undefined") {
29864
+ throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
29865
+ }
29761
29866
  const { durations, setDurations } = useContext30(DurationsContext);
29762
29867
  if (typeof props.src !== "string") {
29763
29868
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -30096,6 +30201,10 @@ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
30096
30201
  }
30097
30202
  return pixelDensity;
30098
30203
  }
30204
+ var isMissingPaintRecordError = (error2) => {
30205
+ return error2 instanceof DOMException && error2.name === "InvalidStateError";
30206
+ };
30207
+ var missingPaintRecordMessage = "HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.";
30099
30208
  var resizeOffscreenCanvas = ({
30100
30209
  offscreen,
30101
30210
  width,
@@ -30139,6 +30248,7 @@ var HtmlInCanvasContent = forwardRef9(({
30139
30248
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
30140
30249
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
30141
30250
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
30251
+ const { isRendering } = useRemotionEnvironment();
30142
30252
  if (!isHtmlInCanvasSupported()) {
30143
30253
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
30144
30254
  }
@@ -30189,28 +30299,51 @@ var HtmlInCanvasContent = forwardRef9(({
30189
30299
  }
30190
30300
  const handle = delayRender("onPaint");
30191
30301
  if (!initializedRef.current) {
30192
- initializedRef.current = true;
30193
- const initImage = placeholderCanvas.captureElementImage(element);
30194
- const currentOnInit = onInitRef.current;
30195
- if (currentOnInit) {
30196
- const cleanup = await currentOnInit({
30197
- canvas: offscreen,
30198
- element,
30199
- elementImage: initImage,
30200
- pixelDensity: resolvedPixelDensity
30201
- });
30202
- if (typeof cleanup !== "function") {
30203
- throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
30204
- }
30205
- if (unmountedRef.current) {
30206
- cleanup();
30302
+ let initImage = null;
30303
+ try {
30304
+ initImage = placeholderCanvas.captureElementImage(element);
30305
+ } catch (error2) {
30306
+ if (isMissingPaintRecordError(error2) && !isRendering) {} else if (isMissingPaintRecordError(error2)) {
30307
+ throw new Error(missingPaintRecordMessage);
30207
30308
  } else {
30208
- onInitCleanupRef.current = cleanup;
30309
+ throw error2;
30310
+ }
30311
+ }
30312
+ if (initImage) {
30313
+ initializedRef.current = true;
30314
+ const currentOnInit = onInitRef.current;
30315
+ if (currentOnInit) {
30316
+ const cleanup = await currentOnInit({
30317
+ canvas: offscreen,
30318
+ element,
30319
+ elementImage: initImage,
30320
+ pixelDensity: resolvedPixelDensity
30321
+ });
30322
+ if (typeof cleanup !== "function") {
30323
+ throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
30324
+ }
30325
+ if (unmountedRef.current) {
30326
+ cleanup();
30327
+ } else {
30328
+ onInitCleanupRef.current = cleanup;
30329
+ }
30209
30330
  }
30210
30331
  }
30211
30332
  }
30212
30333
  const handler = onPaintRef.current ?? defaultOnPaint;
30213
- const elImage = placeholderCanvas.captureElementImage(element);
30334
+ let elImage;
30335
+ try {
30336
+ elImage = placeholderCanvas.captureElementImage(element);
30337
+ } catch (error2) {
30338
+ if (isMissingPaintRecordError(error2) && !isRendering) {
30339
+ continueRender2(handle);
30340
+ return;
30341
+ }
30342
+ if (isMissingPaintRecordError(error2)) {
30343
+ throw new Error(missingPaintRecordMessage);
30344
+ }
30345
+ throw error2;
30346
+ }
30214
30347
  await handler({
30215
30348
  canvas: offscreen,
30216
30349
  element,
@@ -30235,7 +30368,8 @@ var HtmlInCanvasContent = forwardRef9(({
30235
30368
  chainState,
30236
30369
  continueRender2,
30237
30370
  cancelRender2,
30238
- resolvedPixelDensity
30371
+ resolvedPixelDensity,
30372
+ isRendering
30239
30373
  ]);
30240
30374
  useLayoutEffect9(() => {
30241
30375
  const placeholder = canvas2dRef.current;