@remotion/vercel 4.0.538 → 4.0.539

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 (2) hide show
  1. package/dist/esm/index.mjs +94 -60
  2. package/package.json +4 -4
@@ -577,7 +577,7 @@ function spring({
577
577
  frame: durationProcessed,
578
578
  config
579
579
  });
580
- const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
580
+ const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
581
581
  const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
582
582
  return interpolated;
583
583
  }
@@ -1113,6 +1113,20 @@ var interpolateSegment = ({
1113
1113
  output
1114
1114
  });
1115
1115
  };
1116
+ var getInputForInterpolation = ({
1117
+ input,
1118
+ inputRange,
1119
+ options
1120
+ }) => {
1121
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1122
+ const inputMin = inputRange[0];
1123
+ const inputMax = inputRange[inputRange.length - 1];
1124
+ if (inputRange.length === 1 || !(posterizedInput < inputMin && options?.extrapolateLeft === "wrap" || posterizedInput > inputMax && options?.extrapolateRight === "wrap")) {
1125
+ return posterizedInput;
1126
+ }
1127
+ const range = inputMax - inputMin;
1128
+ return ((posterizedInput - inputMin) % range + range) % range + inputMin;
1129
+ };
1116
1130
  var interpolateNumber = ({
1117
1131
  input,
1118
1132
  inputRange,
@@ -1132,14 +1146,18 @@ var interpolateNumber = ({
1132
1146
  if (options?.extrapolateRight !== undefined) {
1133
1147
  extrapolateRight = options.extrapolateRight;
1134
1148
  }
1135
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1136
- const range = findRange(posterizedInput, inputRange);
1149
+ const resolvedInput = getInputForInterpolation({
1150
+ input,
1151
+ inputRange,
1152
+ options: options ?? null
1153
+ });
1154
+ const range = findRange(resolvedInput, inputRange);
1137
1155
  const easing = resolveEasingForSegment({
1138
1156
  easing: easingOption,
1139
1157
  segmentIndex: range
1140
1158
  });
1141
1159
  let result = interpolateSegment({
1142
- input: posterizedInput,
1160
+ input: resolvedInput,
1143
1161
  inputRange: [inputRange[range], inputRange[range + 1]],
1144
1162
  outputRange: [outputRange[range], outputRange[range + 1]],
1145
1163
  easing,
@@ -1156,11 +1174,11 @@ var interpolateNumber = ({
1156
1174
  continue;
1157
1175
  }
1158
1176
  const previousSegmentEnd = inputRange[segmentIndex + 1];
1159
- if (posterizedInput <= previousSegmentEnd) {
1177
+ if (resolvedInput <= previousSegmentEnd) {
1160
1178
  continue;
1161
1179
  }
1162
1180
  const continuedSegmentValue = interpolateSegment({
1163
- input: posterizedInput,
1181
+ input: resolvedInput,
1164
1182
  inputRange: [inputRange[segmentIndex], previousSegmentEnd],
1165
1183
  outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
1166
1184
  easing: previousEasing,
@@ -1181,8 +1199,12 @@ var interpolateString = ({
1181
1199
  }) => {
1182
1200
  const initiallyParsedOutputRange = outputRange.map((output) => parseStringInterpolationValue(output, outputType));
1183
1201
  const hasAxisRotation = initiallyParsedOutputRange.some((parsed) => parsed.axisRotation);
1184
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1185
- const segmentIndex = inputRange.length === 1 ? 0 : findRange(posterizedInput, inputRange);
1202
+ const resolvedInput = getInputForInterpolation({
1203
+ input,
1204
+ inputRange,
1205
+ options: options ?? null
1206
+ });
1207
+ const segmentIndex = inputRange.length === 1 ? 0 : findRange(resolvedInput, inputRange);
1186
1208
  const parsedOutputRange = hasAxisRotation ? initiallyParsedOutputRange.map((parsed, index) => {
1187
1209
  if (parsed.kind !== "rotate") {
1188
1210
  return parsed;
@@ -1306,31 +1328,24 @@ var interpolateDiscreteValue = ({
1306
1328
  throw new TypeError(typeof outputRange[0] === "boolean" ? "Booleans can only be interpolated using Easing.step1" : "Non-numeric strings can only be interpolated using Easing.step1");
1307
1329
  }
1308
1330
  }
1309
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1331
+ const resolvedInput = getInputForInterpolation({
1332
+ input,
1333
+ inputRange,
1334
+ options: options ?? null
1335
+ });
1310
1336
  const inputMin = inputRange[0];
1311
1337
  const inputMax = inputRange[inputRange.length - 1];
1312
- let resolvedInput = posterizedInput;
1313
1338
  if (resolvedInput < inputMin) {
1314
1339
  if (options?.extrapolateLeft === "identity") {
1315
1340
  throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateLeft: "identity" is not supported for booleans' : 'extrapolateLeft: "identity" is not supported for non-numeric strings');
1316
1341
  }
1317
- if (options?.extrapolateLeft === "wrap") {
1318
- const wrapRange = inputMax - inputMin;
1319
- resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
1320
- } else {
1321
- return outputRange[0];
1322
- }
1342
+ return outputRange[0];
1323
1343
  }
1324
1344
  if (resolvedInput > inputMax) {
1325
1345
  if (options?.extrapolateRight === "identity") {
1326
1346
  throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateRight: "identity" is not supported for booleans' : 'extrapolateRight: "identity" is not supported for non-numeric strings');
1327
1347
  }
1328
- if (options?.extrapolateRight === "wrap") {
1329
- const wrapRange = inputMax - inputMin;
1330
- resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
1331
- } else {
1332
- return outputRange[outputRange.length - 1];
1333
- }
1348
+ return outputRange[outputRange.length - 1];
1334
1349
  }
1335
1350
  const range = findRange(resolvedInput, inputRange);
1336
1351
  return resolvedInput >= inputRange[range + 1] ? outputRange[range + 1] : outputRange[range];
@@ -2100,14 +2115,16 @@ function parseModernComponent(str, percentScale) {
2100
2115
  function parseHueAngle(str) {
2101
2116
  if (str === "none")
2102
2117
  return 0;
2103
- if (str.endsWith("rad")) {
2104
- return Number.parseFloat(str) * 180 / Math.PI;
2105
- }
2106
- if (str.endsWith("grad"))
2107
- return Number.parseFloat(str) * 0.9;
2108
- if (str.endsWith("turn"))
2109
- return Number.parseFloat(str) * 360;
2110
- return Number.parseFloat(str);
2118
+ let degrees = Number.parseFloat(str);
2119
+ if (str.endsWith("grad")) {
2120
+ degrees *= 0.9;
2121
+ } else if (str.endsWith("rad")) {
2122
+ degrees = degrees * 180 / Math.PI;
2123
+ } else if (str.endsWith("turn")) {
2124
+ degrees *= 360;
2125
+ }
2126
+ const normalized = degrees % 360;
2127
+ return normalized < 0 ? (normalized + 360) % 360 : normalized;
2111
2128
  }
2112
2129
  function parseModernAlpha(str) {
2113
2130
  if (str === undefined || str === "none")
@@ -3196,7 +3213,7 @@ function spring({
3196
3213
  frame: durationProcessed,
3197
3214
  config
3198
3215
  });
3199
- const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
3216
+ const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
3200
3217
  const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
3201
3218
  return interpolated;
3202
3219
  }
@@ -3732,6 +3749,20 @@ var interpolateSegment = ({
3732
3749
  output
3733
3750
  });
3734
3751
  };
3752
+ var getInputForInterpolation = ({
3753
+ input,
3754
+ inputRange,
3755
+ options
3756
+ }) => {
3757
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
3758
+ const inputMin = inputRange[0];
3759
+ const inputMax = inputRange[inputRange.length - 1];
3760
+ if (inputRange.length === 1 || !(posterizedInput < inputMin && options?.extrapolateLeft === "wrap" || posterizedInput > inputMax && options?.extrapolateRight === "wrap")) {
3761
+ return posterizedInput;
3762
+ }
3763
+ const range = inputMax - inputMin;
3764
+ return ((posterizedInput - inputMin) % range + range) % range + inputMin;
3765
+ };
3735
3766
  var interpolateNumber = ({
3736
3767
  input,
3737
3768
  inputRange,
@@ -3751,14 +3782,18 @@ var interpolateNumber = ({
3751
3782
  if (options?.extrapolateRight !== undefined) {
3752
3783
  extrapolateRight = options.extrapolateRight;
3753
3784
  }
3754
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
3755
- const range = findRange(posterizedInput, inputRange);
3785
+ const resolvedInput = getInputForInterpolation({
3786
+ input,
3787
+ inputRange,
3788
+ options: options ?? null
3789
+ });
3790
+ const range = findRange(resolvedInput, inputRange);
3756
3791
  const easing = resolveEasingForSegment({
3757
3792
  easing: easingOption,
3758
3793
  segmentIndex: range
3759
3794
  });
3760
3795
  let result = interpolateSegment({
3761
- input: posterizedInput,
3796
+ input: resolvedInput,
3762
3797
  inputRange: [inputRange[range], inputRange[range + 1]],
3763
3798
  outputRange: [outputRange[range], outputRange[range + 1]],
3764
3799
  easing,
@@ -3775,11 +3810,11 @@ var interpolateNumber = ({
3775
3810
  continue;
3776
3811
  }
3777
3812
  const previousSegmentEnd = inputRange[segmentIndex + 1];
3778
- if (posterizedInput <= previousSegmentEnd) {
3813
+ if (resolvedInput <= previousSegmentEnd) {
3779
3814
  continue;
3780
3815
  }
3781
3816
  const continuedSegmentValue = interpolateSegment({
3782
- input: posterizedInput,
3817
+ input: resolvedInput,
3783
3818
  inputRange: [inputRange[segmentIndex], previousSegmentEnd],
3784
3819
  outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
3785
3820
  easing: previousEasing,
@@ -3800,8 +3835,12 @@ var interpolateString = ({
3800
3835
  }) => {
3801
3836
  const initiallyParsedOutputRange = outputRange.map((output) => parseStringInterpolationValue(output, outputType));
3802
3837
  const hasAxisRotation = initiallyParsedOutputRange.some((parsed) => parsed.axisRotation);
3803
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
3804
- const segmentIndex = inputRange.length === 1 ? 0 : findRange(posterizedInput, inputRange);
3838
+ const resolvedInput = getInputForInterpolation({
3839
+ input,
3840
+ inputRange,
3841
+ options: options ?? null
3842
+ });
3843
+ const segmentIndex = inputRange.length === 1 ? 0 : findRange(resolvedInput, inputRange);
3805
3844
  const parsedOutputRange = hasAxisRotation ? initiallyParsedOutputRange.map((parsed, index) => {
3806
3845
  if (parsed.kind !== "rotate") {
3807
3846
  return parsed;
@@ -3925,31 +3964,24 @@ var interpolateDiscreteValue = ({
3925
3964
  throw new TypeError(typeof outputRange[0] === "boolean" ? "Booleans can only be interpolated using Easing.step1" : "Non-numeric strings can only be interpolated using Easing.step1");
3926
3965
  }
3927
3966
  }
3928
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
3967
+ const resolvedInput = getInputForInterpolation({
3968
+ input,
3969
+ inputRange,
3970
+ options: options ?? null
3971
+ });
3929
3972
  const inputMin = inputRange[0];
3930
3973
  const inputMax = inputRange[inputRange.length - 1];
3931
- let resolvedInput = posterizedInput;
3932
3974
  if (resolvedInput < inputMin) {
3933
3975
  if (options?.extrapolateLeft === "identity") {
3934
3976
  throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateLeft: "identity" is not supported for booleans' : 'extrapolateLeft: "identity" is not supported for non-numeric strings');
3935
3977
  }
3936
- if (options?.extrapolateLeft === "wrap") {
3937
- const wrapRange = inputMax - inputMin;
3938
- resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
3939
- } else {
3940
- return outputRange[0];
3941
- }
3978
+ return outputRange[0];
3942
3979
  }
3943
3980
  if (resolvedInput > inputMax) {
3944
3981
  if (options?.extrapolateRight === "identity") {
3945
3982
  throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateRight: "identity" is not supported for booleans' : 'extrapolateRight: "identity" is not supported for non-numeric strings');
3946
3983
  }
3947
- if (options?.extrapolateRight === "wrap") {
3948
- const wrapRange = inputMax - inputMin;
3949
- resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
3950
- } else {
3951
- return outputRange[outputRange.length - 1];
3952
- }
3984
+ return outputRange[outputRange.length - 1];
3953
3985
  }
3954
3986
  const range = findRange(resolvedInput, inputRange);
3955
3987
  return resolvedInput >= inputRange[range + 1] ? outputRange[range + 1] : outputRange[range];
@@ -4719,14 +4751,16 @@ function parseModernComponent(str, percentScale) {
4719
4751
  function parseHueAngle(str) {
4720
4752
  if (str === "none")
4721
4753
  return 0;
4722
- if (str.endsWith("rad")) {
4723
- return Number.parseFloat(str) * 180 / Math.PI;
4724
- }
4725
- if (str.endsWith("grad"))
4726
- return Number.parseFloat(str) * 0.9;
4727
- if (str.endsWith("turn"))
4728
- return Number.parseFloat(str) * 360;
4729
- return Number.parseFloat(str);
4754
+ let degrees = Number.parseFloat(str);
4755
+ if (str.endsWith("grad")) {
4756
+ degrees *= 0.9;
4757
+ } else if (str.endsWith("rad")) {
4758
+ degrees = degrees * 180 / Math.PI;
4759
+ } else if (str.endsWith("turn")) {
4760
+ degrees *= 360;
4761
+ }
4762
+ const normalized = degrees % 360;
4763
+ return normalized < 0 ? (normalized + 360) % 360 : normalized;
4730
4764
  }
4731
4765
  function parseModernAlpha(str) {
4732
4766
  if (str === undefined || str === "none")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.538",
3
+ "version": "4.0.539",
4
4
  "description": "Render Remotion videos on Vercel Sandbox",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,8 +23,8 @@
23
23
  "url": "https://github.com/remotion-dev/remotion/issues"
24
24
  },
25
25
  "dependencies": {
26
- "@remotion/renderer": "4.0.538",
27
- "remotion": "4.0.538"
26
+ "@remotion/renderer": "4.0.539",
27
+ "remotion": "4.0.539"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@vercel/sandbox": ">=1.0.0"
@@ -38,7 +38,7 @@
38
38
  "./package.json": "./package.json"
39
39
  },
40
40
  "devDependencies": {
41
- "@remotion/eslint-config-internal": "4.0.538",
41
+ "@remotion/eslint-config-internal": "4.0.539",
42
42
  "@vercel/blob": "2.3.0",
43
43
  "@vercel/sandbox": "1.6.0",
44
44
  "eslint": "9.19.0",