@remotion/promo-pages 4.0.482 → 4.0.484

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.
package/dist/templates.js CHANGED
@@ -5565,7 +5565,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
5565
5565
  var addSequenceStackTraces = (component) => {
5566
5566
  componentsToAddStacksTo.push(component);
5567
5567
  };
5568
- var VERSION = "4.0.482";
5568
+ var VERSION = "4.0.484";
5569
5569
  var checkMultipleRemotionVersions = () => {
5570
5570
  if (typeof globalThis === "undefined") {
5571
5571
  return;
@@ -6781,6 +6781,35 @@ function findRange(input, inputRange) {
6781
6781
  return i - 1;
6782
6782
  }
6783
6783
  var defaultEasing = (num) => num;
6784
+ var shouldExtendRightForEasing = (easing) => {
6785
+ return easing.remotionShouldExtendRight === true;
6786
+ };
6787
+ var resolveEasingForSegment = ({
6788
+ easing,
6789
+ segmentIndex
6790
+ }) => {
6791
+ if (easing === undefined) {
6792
+ return defaultEasing;
6793
+ }
6794
+ if (typeof easing === "function") {
6795
+ return easing;
6796
+ }
6797
+ return easing[segmentIndex];
6798
+ };
6799
+ var interpolateSegment = ({
6800
+ input,
6801
+ inputRange,
6802
+ outputRange,
6803
+ easing,
6804
+ extrapolateLeft,
6805
+ extrapolateRight
6806
+ }) => {
6807
+ return interpolateFunction(input, inputRange, outputRange, {
6808
+ easing,
6809
+ extrapolateLeft,
6810
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
6811
+ });
6812
+ };
6784
6813
  var interpolateNumber = ({
6785
6814
  input,
6786
6815
  inputRange,
@@ -6791,15 +6820,6 @@ var interpolateNumber = ({
6791
6820
  return outputRange[0];
6792
6821
  }
6793
6822
  const easingOption = options?.easing;
6794
- const resolveEasingForSegment = (segmentIndex) => {
6795
- if (easingOption === undefined) {
6796
- return defaultEasing;
6797
- }
6798
- if (typeof easingOption === "function") {
6799
- return easingOption;
6800
- }
6801
- return easingOption[segmentIndex];
6802
- };
6803
6823
  let extrapolateLeft = "extend";
6804
6824
  if (options?.extrapolateLeft !== undefined) {
6805
6825
  extrapolateLeft = options.extrapolateLeft;
@@ -6810,11 +6830,41 @@ var interpolateNumber = ({
6810
6830
  }
6811
6831
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
6812
6832
  const range = findRange(posterizedInput, inputRange);
6813
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
6814
- easing: resolveEasingForSegment(range),
6833
+ const easing = resolveEasingForSegment({
6834
+ easing: easingOption,
6835
+ segmentIndex: range
6836
+ });
6837
+ let result = interpolateSegment({
6838
+ input: posterizedInput,
6839
+ inputRange: [inputRange[range], inputRange[range + 1]],
6840
+ outputRange: [outputRange[range], outputRange[range + 1]],
6841
+ easing,
6815
6842
  extrapolateLeft,
6816
6843
  extrapolateRight
6817
6844
  });
6845
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
6846
+ const previousEasing = resolveEasingForSegment({
6847
+ easing: easingOption,
6848
+ segmentIndex
6849
+ });
6850
+ if (!shouldExtendRightForEasing(previousEasing)) {
6851
+ continue;
6852
+ }
6853
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
6854
+ if (posterizedInput <= previousSegmentEnd) {
6855
+ continue;
6856
+ }
6857
+ const continuedSegmentValue = interpolateSegment({
6858
+ input: posterizedInput,
6859
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
6860
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
6861
+ easing: previousEasing,
6862
+ extrapolateLeft,
6863
+ extrapolateRight: "extend"
6864
+ });
6865
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
6866
+ }
6867
+ return result;
6818
6868
  };
6819
6869
  var interpolateString = ({
6820
6870
  input,
@@ -7288,21 +7338,40 @@ class Easing {
7288
7338
  static back(s = 1.70158) {
7289
7339
  return (t) => t * t * ((s + 1) * t - s);
7290
7340
  }
7291
- static spring(config = {}) {
7292
- return (t) => {
7341
+ static spring({
7342
+ allowTail = false,
7343
+ durationRestThreshold,
7344
+ ...config
7345
+ } = {}) {
7346
+ const easing = (t) => {
7293
7347
  if (t <= 0) {
7294
7348
  return 0;
7295
7349
  }
7296
- if (t >= 1) {
7350
+ if (!allowTail && t >= 1) {
7297
7351
  return 1;
7298
7352
  }
7353
+ if (allowTail) {
7354
+ return spring({
7355
+ fps: springEasingDurationInFrames,
7356
+ frame: t * measureSpring({
7357
+ fps: springEasingDurationInFrames,
7358
+ config,
7359
+ threshold: durationRestThreshold
7360
+ }),
7361
+ config
7362
+ });
7363
+ }
7299
7364
  return spring({
7300
7365
  fps: springEasingDurationInFrames,
7301
7366
  frame: t * springEasingDurationInFrames,
7302
7367
  config,
7303
- durationInFrames: springEasingDurationInFrames
7368
+ durationInFrames: springEasingDurationInFrames,
7369
+ durationRestThreshold
7304
7370
  });
7305
7371
  };
7372
+ return Object.assign(easing, {
7373
+ remotionShouldExtendRight: allowTail
7374
+ });
7306
7375
  }
7307
7376
  static bounce(t) {
7308
7377
  const u = clampUnit(t);
@@ -7833,25 +7902,31 @@ var interpolateColors = (input, inputRange, outputRange, options) => {
7833
7902
  const processedOutputRange = outputRange.map((c2) => processColor(c2));
7834
7903
  return interpolateColorsRGB(input, inputRange, processedOutputRange, options);
7835
7904
  };
7836
- var easingToFn = (e) => {
7837
- switch (e.type) {
7905
+ var easingToFn = ({
7906
+ easing,
7907
+ forceSpringAllowTail
7908
+ }) => {
7909
+ switch (easing.type) {
7838
7910
  case "linear":
7839
7911
  return Easing.linear;
7840
7912
  case "spring":
7841
7913
  return Easing.spring({
7842
- damping: e.damping,
7843
- mass: e.mass,
7844
- overshootClamping: e.overshootClamping,
7845
- stiffness: e.stiffness
7914
+ allowTail: forceSpringAllowTail ?? easing.allowTail ?? undefined,
7915
+ damping: easing.damping,
7916
+ durationRestThreshold: easing.durationRestThreshold ?? undefined,
7917
+ mass: easing.mass,
7918
+ overshootClamping: easing.overshootClamping,
7919
+ stiffness: easing.stiffness
7846
7920
  });
7847
7921
  case "bezier":
7848
- return bezier(e.x1, e.y1, e.x2, e.y2);
7922
+ return bezier(easing.x1, easing.y1, easing.x2, easing.y2);
7849
7923
  default:
7850
- throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`);
7924
+ throw new TypeError(`Unsupported easing: ${JSON.stringify(easing)}`);
7851
7925
  }
7852
7926
  };
7853
7927
  var interpolateKeyframedStatus = ({
7854
7928
  frame,
7929
+ forceSpringAllowTail,
7855
7930
  status
7856
7931
  }) => {
7857
7932
  const { keyframes, easing, clamping, interpolationFunction } = status;
@@ -7870,7 +7945,7 @@ var interpolateKeyframedStatus = ({
7870
7945
  }
7871
7946
  try {
7872
7947
  return interpolateColors(frame, inputRange, outputs, {
7873
- easing: easing.map(easingToFn),
7948
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
7874
7949
  posterize: status.posterize
7875
7950
  });
7876
7951
  } catch {
@@ -7882,7 +7957,7 @@ var interpolateKeyframedStatus = ({
7882
7957
  }
7883
7958
  try {
7884
7959
  return interpolate(frame, inputRange, outputs, {
7885
- easing: easing.map(easingToFn),
7960
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
7886
7961
  extrapolateLeft: clamping.left,
7887
7962
  extrapolateRight: clamping.right,
7888
7963
  posterize: status.posterize
@@ -7905,6 +7980,7 @@ var resolveDragOverrideValue = ({
7905
7980
  return { type: "none" };
7906
7981
  }
7907
7982
  const interpolated = interpolateKeyframedStatus({
7983
+ forceSpringAllowTail: null,
7908
7984
  frame,
7909
7985
  status: dragOverrideValue.status
7910
7986
  });
@@ -7930,6 +8006,7 @@ var getEffectiveVisualModeValue = ({
7930
8006
  if (propStatus.status === "keyframed") {
7931
8007
  if (frame !== null) {
7932
8008
  return interpolateKeyframedStatus({
8009
+ forceSpringAllowTail: null,
7933
8010
  frame,
7934
8011
  status: propStatus
7935
8012
  });
@@ -7998,6 +8075,7 @@ var resolvePropStatusOverrides = (propStatus, frame) => {
7998
8075
  }
7999
8076
  if (status.status === "keyframed") {
8000
8077
  const value = interpolateKeyframedStatus({
8078
+ forceSpringAllowTail: null,
8001
8079
  frame,
8002
8080
  status
8003
8081
  });
@@ -8173,6 +8251,17 @@ var findPropsToDelete = ({
8173
8251
  var DEFAULT_LINEAR_EASING = {
8174
8252
  type: "linear"
8175
8253
  };
8254
+ var getEasingIndexToDuplicate = ({
8255
+ insertedKeyframeIndex,
8256
+ easingLength,
8257
+ keyframeCount
8258
+ }) => {
8259
+ const isSplittingExistingSegment = insertedKeyframeIndex > 0 && insertedKeyframeIndex < keyframeCount - 1;
8260
+ if (!isSplittingExistingSegment || easingLength === 0) {
8261
+ return null;
8262
+ }
8263
+ return Math.min(insertedKeyframeIndex - 1, easingLength - 1);
8264
+ };
8176
8265
  var makeStaticDragOverride = (value) => {
8177
8266
  return { type: "static", value };
8178
8267
  };
@@ -8184,6 +8273,16 @@ var makeKeyframedDragOverride = ({
8184
8273
  const existingIndex = status.keyframes.findIndex((keyframe) => keyframe.frame === frame);
8185
8274
  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);
8186
8275
  const easing = [...status.easing];
8276
+ if (existingIndex === -1) {
8277
+ const insertedKeyframeIndex = keyframes.findIndex((keyframe) => keyframe.frame === frame);
8278
+ const easingIndexToDuplicate = getEasingIndexToDuplicate({
8279
+ insertedKeyframeIndex,
8280
+ easingLength: easing.length,
8281
+ keyframeCount: keyframes.length
8282
+ });
8283
+ const easingToDuplicate = easingIndexToDuplicate === null ? DEFAULT_LINEAR_EASING : easing[easingIndexToDuplicate];
8284
+ easing.splice(insertedKeyframeIndex, 0, easingToDuplicate);
8285
+ }
8187
8286
  while (easing.length < keyframes.length - 1) {
8188
8287
  easing.push(DEFAULT_LINEAR_EASING);
8189
8288
  }
@@ -8255,6 +8354,7 @@ var computeEffectiveSchemaValuesDotNotation = ({
8255
8354
  value = dragOverride.value;
8256
8355
  } else if (frame !== null) {
8257
8356
  const interpolated = interpolateKeyframedStatus({
8357
+ forceSpringAllowTail: null,
8258
8358
  frame,
8259
8359
  status
8260
8360
  });
@@ -12406,6 +12506,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
12406
12506
  var AudioForRendering = forwardRef6(AudioForRenderingRefForwardingFunction);
12407
12507
  var AudioRefForwardingFunction = (props, ref) => {
12408
12508
  const audioTagsContext = useContext30(SharedAudioTagsContext);
12509
+ const propsWithFreeze = props;
12409
12510
  const {
12410
12511
  startFrom,
12411
12512
  endAt,
@@ -12416,14 +12517,18 @@ var AudioRefForwardingFunction = (props, ref) => {
12416
12517
  pauseWhenBuffering,
12417
12518
  showInTimeline,
12418
12519
  onError: onRemotionError,
12520
+ freeze,
12419
12521
  ...otherProps
12420
- } = props;
12421
- const { loop, ...propsOtherThanLoop } = props;
12522
+ } = propsWithFreeze;
12523
+ const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
12422
12524
  const { fps } = useVideoConfig();
12423
12525
  const environment = useRemotionEnvironment();
12424
12526
  if (environment.isClientSideRendering) {
12425
12527
  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");
12426
12528
  }
12529
+ if (typeof freeze !== "undefined") {
12530
+ throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
12531
+ }
12427
12532
  const { durations, setDurations } = useContext30(DurationsContext);
12428
12533
  if (typeof props.src !== "string") {
12429
12534
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -12762,6 +12867,10 @@ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
12762
12867
  }
12763
12868
  return pixelDensity;
12764
12869
  }
12870
+ var isMissingPaintRecordError = (error2) => {
12871
+ return error2 instanceof DOMException && error2.name === "InvalidStateError";
12872
+ };
12873
+ var missingPaintRecordMessage = "HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.";
12765
12874
  var resizeOffscreenCanvas = ({
12766
12875
  offscreen,
12767
12876
  width,
@@ -12805,6 +12914,7 @@ var HtmlInCanvasContent = forwardRef9(({
12805
12914
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
12806
12915
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
12807
12916
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
12917
+ const { isRendering } = useRemotionEnvironment();
12808
12918
  if (!isHtmlInCanvasSupported()) {
12809
12919
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
12810
12920
  }
@@ -12855,28 +12965,51 @@ var HtmlInCanvasContent = forwardRef9(({
12855
12965
  }
12856
12966
  const handle = delayRender("onPaint");
12857
12967
  if (!initializedRef.current) {
12858
- initializedRef.current = true;
12859
- const initImage = placeholderCanvas.captureElementImage(element);
12860
- const currentOnInit = onInitRef.current;
12861
- if (currentOnInit) {
12862
- const cleanup = await currentOnInit({
12863
- canvas: offscreen,
12864
- element,
12865
- elementImage: initImage,
12866
- pixelDensity: resolvedPixelDensity
12867
- });
12868
- if (typeof cleanup !== "function") {
12869
- throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
12870
- }
12871
- if (unmountedRef.current) {
12872
- cleanup();
12968
+ let initImage = null;
12969
+ try {
12970
+ initImage = placeholderCanvas.captureElementImage(element);
12971
+ } catch (error2) {
12972
+ if (isMissingPaintRecordError(error2) && !isRendering) {} else if (isMissingPaintRecordError(error2)) {
12973
+ throw new Error(missingPaintRecordMessage);
12873
12974
  } else {
12874
- onInitCleanupRef.current = cleanup;
12975
+ throw error2;
12976
+ }
12977
+ }
12978
+ if (initImage) {
12979
+ initializedRef.current = true;
12980
+ const currentOnInit = onInitRef.current;
12981
+ if (currentOnInit) {
12982
+ const cleanup = await currentOnInit({
12983
+ canvas: offscreen,
12984
+ element,
12985
+ elementImage: initImage,
12986
+ pixelDensity: resolvedPixelDensity
12987
+ });
12988
+ if (typeof cleanup !== "function") {
12989
+ throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
12990
+ }
12991
+ if (unmountedRef.current) {
12992
+ cleanup();
12993
+ } else {
12994
+ onInitCleanupRef.current = cleanup;
12995
+ }
12875
12996
  }
12876
12997
  }
12877
12998
  }
12878
12999
  const handler = onPaintRef.current ?? defaultOnPaint;
12879
- const elImage = placeholderCanvas.captureElementImage(element);
13000
+ let elImage;
13001
+ try {
13002
+ elImage = placeholderCanvas.captureElementImage(element);
13003
+ } catch (error2) {
13004
+ if (isMissingPaintRecordError(error2) && !isRendering) {
13005
+ continueRender2(handle);
13006
+ return;
13007
+ }
13008
+ if (isMissingPaintRecordError(error2)) {
13009
+ throw new Error(missingPaintRecordMessage);
13010
+ }
13011
+ throw error2;
13012
+ }
12880
13013
  await handler({
12881
13014
  canvas: offscreen,
12882
13015
  element,
@@ -12901,7 +13034,8 @@ var HtmlInCanvasContent = forwardRef9(({
12901
13034
  chainState,
12902
13035
  continueRender2,
12903
13036
  cancelRender2,
12904
- resolvedPixelDensity
13037
+ resolvedPixelDensity,
13038
+ isRendering
12905
13039
  ]);
12906
13040
  useLayoutEffect9(() => {
12907
13041
  const placeholder = canvas2dRef.current;
@@ -25555,6 +25689,7 @@ var listOfRemotionPackages = [
25555
25689
  "@remotion/bugs",
25556
25690
  "@remotion/brand",
25557
25691
  "@remotion/bundler",
25692
+ "@remotion/browser-studio",
25558
25693
  "@remotion/canvas-capture",
25559
25694
  "@remotion/cli",
25560
25695
  "@remotion/cloudrun",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/promo-pages",
3
- "version": "4.0.482",
3
+ "version": "4.0.484",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,19 +11,19 @@
11
11
  },
12
12
  "type": "module",
13
13
  "dependencies": {
14
- "@remotion/animated-emoji": "4.0.482",
15
- "@remotion/design": "4.0.482",
16
- "@remotion/web-renderer": "4.0.482",
17
- "@remotion/lottie": "4.0.482",
18
- "@remotion/paths": "4.0.482",
19
- "@remotion/player": "4.0.482",
20
- "@remotion/shapes": "4.0.482",
21
- "@remotion/media": "4.0.482",
22
- "@remotion/svg-3d-engine": "4.0.482",
23
- "create-video": "4.0.482",
14
+ "@remotion/animated-emoji": "4.0.484",
15
+ "@remotion/design": "4.0.484",
16
+ "@remotion/web-renderer": "4.0.484",
17
+ "@remotion/lottie": "4.0.484",
18
+ "@remotion/paths": "4.0.484",
19
+ "@remotion/player": "4.0.484",
20
+ "@remotion/shapes": "4.0.484",
21
+ "@remotion/media": "4.0.484",
22
+ "@remotion/svg-3d-engine": "4.0.484",
23
+ "create-video": "4.0.484",
24
24
  "hls.js": "1.5.19",
25
25
  "polished": "4.3.1",
26
- "remotion": "4.0.482",
26
+ "remotion": "4.0.484",
27
27
  "zod": "4.3.6",
28
28
  "@mux/upchunk": "3.5.0",
29
29
  "@vidstack/react": "1.12.13",
@@ -34,7 +34,7 @@
34
34
  "@mediabunny/mp3-encoder": "1.47.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@remotion/eslint-config-internal": "4.0.482",
37
+ "@remotion/eslint-config-internal": "4.0.484",
38
38
  "@eslint/eslintrc": "3.1.0",
39
39
  "@types/react": "19.2.7",
40
40
  "@types/react-dom": "19.2.3",