@remotion/vercel 4.0.471 → 4.0.473

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 +662 -72
  2. package/package.json +4 -4
@@ -115,6 +115,123 @@ import { statSync } from "fs";
115
115
  import { RenderInternals } from "@remotion/renderer";
116
116
 
117
117
  // ../core/dist/esm/no-react.mjs
118
+ var normalizeNumber = (value) => {
119
+ return Math.round(value * 1e6) / 1e6;
120
+ };
121
+ var angleUnits = new Set(["deg", "rad", "grad", "turn"]);
122
+ var lengthUnits = new Set([
123
+ "%",
124
+ "cap",
125
+ "ch",
126
+ "cm",
127
+ "cqb",
128
+ "cqh",
129
+ "cqi",
130
+ "cqmax",
131
+ "cqmin",
132
+ "cqw",
133
+ "dvh",
134
+ "dvw",
135
+ "em",
136
+ "ex",
137
+ "ic",
138
+ "in",
139
+ "lh",
140
+ "lvh",
141
+ "lvw",
142
+ "mm",
143
+ "pc",
144
+ "pt",
145
+ "px",
146
+ "q",
147
+ "rem",
148
+ "rlh",
149
+ "svh",
150
+ "svw",
151
+ "vb",
152
+ "vh",
153
+ "vi",
154
+ "vmax",
155
+ "vmin",
156
+ "vw"
157
+ ]);
158
+ var cssNumberRegex = /^([+-]?(?:\\d+\\.?\\d*|\\.\\d+))([a-zA-Z%]+)?$/;
159
+ var stringifyNumber = (value) => {
160
+ return String(normalizeNumber(value));
161
+ };
162
+ var parseStringInterpolationComponent = (component, value) => {
163
+ const match = cssNumberRegex.exec(component);
164
+ if (match === null) {
165
+ throw new TypeError(\`Cannot interpolate "\${value}" because "\${component}" is not a supported scale, translate, or rotate value\`);
166
+ }
167
+ const unit = match[2] ?? null;
168
+ const numberValue = Number(match[1]);
169
+ if (!Number.isFinite(numberValue)) {
170
+ throw new TypeError(\`Cannot interpolate "\${value}" because "\${component}" is not finite\`);
171
+ }
172
+ if (unit === null) {
173
+ return { kind: "scale", value: numberValue, unit: null };
174
+ }
175
+ if (angleUnits.has(unit)) {
176
+ return { kind: "rotate", value: numberValue, unit };
177
+ }
178
+ if (lengthUnits.has(unit)) {
179
+ return { kind: "translate", value: numberValue, unit };
180
+ }
181
+ throw new TypeError(\`Cannot interpolate "\${value}" because "\${unit}" is not a supported translate or rotate unit\`);
182
+ };
183
+ var parseStringInterpolationValue = (output) => {
184
+ if (typeof output === "number") {
185
+ if (!Number.isFinite(output)) {
186
+ throw new Error(\`outputRange must contain only finite numbers, but got [\${output}]\`);
187
+ }
188
+ return {
189
+ kind: "scale",
190
+ values: [output, output, 1],
191
+ units: [null, null, null],
192
+ dimensions: 1
193
+ };
194
+ }
195
+ const parts = output.trim().split(/\\s+/);
196
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
197
+ throw new TypeError(\`String outputRange values must contain 1 to 3 components, but got "\${output}"\`);
198
+ }
199
+ const parsed = parts.map((part) => parseStringInterpolationComponent(part, output));
200
+ const [{ kind }] = parsed;
201
+ for (const part of parsed) {
202
+ if (part.kind !== kind) {
203
+ throw new TypeError(\`Cannot interpolate "\${output}" because it mixes \${kind} and \${part.kind} values\`);
204
+ }
205
+ }
206
+ if (kind === "scale") {
207
+ const x = parsed[0].value;
208
+ const y = parsed[1]?.value ?? x;
209
+ const z = parsed[2]?.value ?? 1;
210
+ return {
211
+ kind,
212
+ values: [x, y, z],
213
+ units: [null, null, null],
214
+ dimensions: parsed.length
215
+ };
216
+ }
217
+ return {
218
+ kind,
219
+ values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
220
+ units: [parsed[0].unit, parsed[1]?.unit ?? null, parsed[2]?.unit ?? null],
221
+ dimensions: parsed.length
222
+ };
223
+ };
224
+ var serializeStringInterpolationValue = ({
225
+ kind,
226
+ values,
227
+ units,
228
+ dimensions
229
+ }) => {
230
+ if (kind === "scale") {
231
+ return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
232
+ }
233
+ return values.slice(0, dimensions).map((value, index) => \`\${stringifyNumber(value)}\${units[index]}\`).join(" ");
234
+ };
118
235
  function interpolateFunction(input, inputRange, outputRange, options) {
119
236
  const { extrapolateLeft, extrapolateRight, easing } = options;
120
237
  let result = input;
@@ -159,6 +276,130 @@ function findRange(input, inputRange) {
159
276
  }
160
277
  return i - 1;
161
278
  }
279
+ var defaultEasing = (num) => num;
280
+ var interpolateNumber = ({
281
+ input,
282
+ inputRange,
283
+ outputRange,
284
+ options
285
+ }) => {
286
+ if (inputRange.length === 1) {
287
+ return outputRange[0];
288
+ }
289
+ const easingOption = options?.easing;
290
+ const resolveEasingForSegment = (segmentIndex) => {
291
+ if (easingOption === undefined) {
292
+ return defaultEasing;
293
+ }
294
+ if (typeof easingOption === "function") {
295
+ return easingOption;
296
+ }
297
+ return easingOption[segmentIndex];
298
+ };
299
+ let extrapolateLeft = "extend";
300
+ if (options?.extrapolateLeft !== undefined) {
301
+ extrapolateLeft = options.extrapolateLeft;
302
+ }
303
+ let extrapolateRight = "extend";
304
+ if (options?.extrapolateRight !== undefined) {
305
+ extrapolateRight = options.extrapolateRight;
306
+ }
307
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
308
+ const range = findRange(posterizedInput, inputRange);
309
+ return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
310
+ easing: resolveEasingForSegment(range),
311
+ extrapolateLeft,
312
+ extrapolateRight
313
+ });
314
+ };
315
+ var interpolateString = ({
316
+ input,
317
+ inputRange,
318
+ outputRange,
319
+ options
320
+ }) => {
321
+ const parsedOutputRange = outputRange.map(parseStringInterpolationValue);
322
+ const kind = parsedOutputRange[0]?.kind;
323
+ if (kind === undefined) {
324
+ throw new Error("outputRange must have at least 1 element");
325
+ }
326
+ for (const parsed of parsedOutputRange) {
327
+ if (parsed.kind !== kind) {
328
+ throw new TypeError(\`Cannot interpolate \${kind} values with \${parsed.kind} values\`);
329
+ }
330
+ }
331
+ const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
332
+ const units = [
333
+ null,
334
+ null,
335
+ null
336
+ ];
337
+ if (kind !== "scale") {
338
+ for (let axis = 0;axis < dimensions; axis++) {
339
+ for (const parsed of parsedOutputRange) {
340
+ const unit = parsed.units[axis];
341
+ if (unit === null) {
342
+ continue;
343
+ }
344
+ if (units[axis] === null) {
345
+ units[axis] = unit;
346
+ continue;
347
+ }
348
+ if (units[axis] !== unit) {
349
+ throw new TypeError(\`Cannot interpolate \${kind} values with different units on axis \${axis + 1}: \${units[axis]} and \${unit}\`);
350
+ }
351
+ }
352
+ if (units[axis] === null) {
353
+ throw new TypeError(\`Cannot interpolate \${kind} values because axis \${axis + 1} has no unit\`);
354
+ }
355
+ }
356
+ }
357
+ return serializeStringInterpolationValue({
358
+ kind,
359
+ values: [0, 0, 0].map((_, axis) => interpolateNumber({
360
+ input,
361
+ inputRange,
362
+ outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
363
+ options
364
+ })),
365
+ units,
366
+ dimensions
367
+ });
368
+ };
369
+ var validateTupleOutputRange = (outputRange) => {
370
+ const dimensions = outputRange[0]?.length;
371
+ if (dimensions === undefined) {
372
+ throw new Error("outputRange must have at least 1 element");
373
+ }
374
+ if (dimensions === 0) {
375
+ throw new TypeError("outputRange tuples must contain at least 1 number");
376
+ }
377
+ for (const output of outputRange) {
378
+ if (output.length !== dimensions) {
379
+ throw new TypeError(\`outputRange tuples must all have the same length, but got \${dimensions} and \${output.length}\`);
380
+ }
381
+ for (const value of output) {
382
+ if (typeof value !== "number" || !Number.isFinite(value)) {
383
+ throw new TypeError(\`outputRange tuples must contain only finite numbers, but got [\${output.join(",")}]\`);
384
+ }
385
+ }
386
+ }
387
+ return dimensions;
388
+ };
389
+ var interpolateTuple = ({
390
+ input,
391
+ inputRange,
392
+ outputRange,
393
+ options
394
+ }) => {
395
+ const dimensions = validateTupleOutputRange(outputRange);
396
+ return new Array(dimensions).fill(true).map((_, axis) => interpolateNumber({
397
+ input,
398
+ inputRange,
399
+ outputRange: outputRange.map((output) => output[axis]),
400
+ options
401
+ }));
402
+ };
162
403
  function checkValidInputRange(arr) {
163
404
  for (let i = 1;i < arr.length; ++i) {
164
405
  if (!(arr[i] > arr[i - 1])) {
@@ -218,42 +459,30 @@ function interpolate(input, inputRange, outputRange, options) {
218
459
  throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
219
460
  }
220
461
  checkInfiniteRange("inputRange", inputRange);
221
- checkInfiniteRange("outputRange", outputRange);
222
462
  checkValidInputRange(inputRange);
223
463
  assertValidInterpolateEasingOption(options?.easing, inputRange.length);
224
464
  assertValidInterpolatePosterizeOption(options?.posterize);
225
- const easingOption = options?.easing;
226
- const defaultEasing = (num) => num;
227
- const resolveEasingForSegment = (segmentIndex) => {
228
- if (easingOption === undefined) {
229
- return defaultEasing;
230
- }
231
- if (typeof easingOption === "function") {
232
- return easingOption;
233
- }
234
- return easingOption[segmentIndex];
235
- };
236
- let extrapolateLeft = "extend";
237
- if (options?.extrapolateLeft !== undefined) {
238
- extrapolateLeft = options.extrapolateLeft;
239
- }
240
- let extrapolateRight = "extend";
241
- if (options?.extrapolateRight !== undefined) {
242
- extrapolateRight = options.extrapolateRight;
243
- }
244
465
  if (typeof input !== "number") {
245
466
  throw new TypeError("Cannot interpolate an input which is not a number");
246
467
  }
247
- if (inputRange.length === 1) {
248
- return outputRange[0];
468
+ if (!Array.isArray(outputRange)) {
469
+ throw new Error("outputRange must contain only numbers");
249
470
  }
250
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
251
- const range = findRange(posterizedInput, inputRange);
252
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
253
- easing: resolveEasingForSegment(range),
254
- extrapolateLeft,
255
- extrapolateRight
256
- });
471
+ const hasStringOutput = outputRange.some((output) => typeof output === "string");
472
+ if (hasStringOutput) {
473
+ if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
474
+ throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
475
+ }
476
+ return interpolateString({ input, inputRange, outputRange, options });
477
+ }
478
+ if (outputRange.every((output) => Array.isArray(output))) {
479
+ return interpolateTuple({ input, inputRange, outputRange, options });
480
+ }
481
+ if (!outputRange.every((output) => typeof output === "number")) {
482
+ throw new TypeError("outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings");
483
+ }
484
+ checkInfiniteRange("outputRange", outputRange);
485
+ return interpolateNumber({ input, inputRange, outputRange, options });
257
486
  }
258
487
  function truthy(value) {
259
488
  return Boolean(value);
@@ -804,6 +1033,45 @@ var proResProfileOptions = [
804
1033
  "light",
805
1034
  "proxy"
806
1035
  ];
1036
+ var defaultScaleValue = [1, 1, 1];
1037
+ var parseScaleString = (value) => {
1038
+ const parts = value.trim().split(/\\s+/);
1039
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
1040
+ return null;
1041
+ }
1042
+ const parsed = parts.map((part) => Number(part));
1043
+ if (!parsed.every((part) => Number.isFinite(part))) {
1044
+ return null;
1045
+ }
1046
+ const x = parsed[0];
1047
+ const y = parsed[1] ?? x;
1048
+ const z = parsed[2] ?? 1;
1049
+ return [x, y, z];
1050
+ };
1051
+ var parseValidScaleValue = (value) => {
1052
+ if (typeof value === "number") {
1053
+ return Number.isFinite(value) ? [value, value, 1] : null;
1054
+ }
1055
+ if (typeof value === "string") {
1056
+ return parseScaleString(value);
1057
+ }
1058
+ return null;
1059
+ };
1060
+ var parseScaleValue = (value) => {
1061
+ return parseValidScaleValue(value) ?? defaultScaleValue;
1062
+ };
1063
+ var serializeScaleValue = ([x, y, z]) => {
1064
+ const normalizedX = normalizeNumber(x);
1065
+ const normalizedY = normalizeNumber(y);
1066
+ const normalizedZ = normalizeNumber(z);
1067
+ if (normalizedX === normalizedY && normalizedZ === 1) {
1068
+ return normalizedX;
1069
+ }
1070
+ if (normalizedZ === 1) {
1071
+ return \`\${normalizedX} \${normalizedY}\`;
1072
+ }
1073
+ return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
1074
+ };
807
1075
  var sequenceVisualStyleSchema = {
808
1076
  "style.translate": {
809
1077
  type: "translate",
@@ -812,15 +1080,14 @@ var sequenceVisualStyleSchema = {
812
1080
  description: "Offset"
813
1081
  },
814
1082
  "style.scale": {
815
- type: "number",
816
- min: 0.05,
1083
+ type: "scale",
817
1084
  max: 100,
818
1085
  step: 0.01,
819
1086
  default: 1,
820
1087
  description: "Scale"
821
1088
  },
822
1089
  "style.rotate": {
823
- type: "rotation",
1090
+ type: "rotation-css",
824
1091
  step: 1,
825
1092
  default: "0deg",
826
1093
  description: "Rotation"
@@ -831,7 +1098,8 @@ var sequenceVisualStyleSchema = {
831
1098
  max: 1,
832
1099
  step: 0.01,
833
1100
  default: 1,
834
- description: "Opacity"
1101
+ description: "Opacity",
1102
+ hiddenFromList: false
835
1103
  }
836
1104
  };
837
1105
  var sequencePremountSchema = {
@@ -840,10 +1108,15 @@ var sequencePremountSchema = {
840
1108
  default: 0,
841
1109
  description: "Premount For",
842
1110
  min: 0,
843
- step: 1
1111
+ step: 1,
1112
+ hiddenFromList: false
844
1113
  },
845
1114
  postmountFor: {
846
- type: "hidden"
1115
+ type: "number",
1116
+ default: 0,
1117
+ min: 0,
1118
+ step: 1,
1119
+ hiddenFromList: true
847
1120
  },
848
1121
  styleWhilePremounted: {
849
1122
  type: "hidden"
@@ -861,8 +1134,23 @@ var hiddenField = {
861
1134
  default: false,
862
1135
  description: "Hidden"
863
1136
  };
1137
+ var durationInFramesField = {
1138
+ type: "number",
1139
+ default: undefined,
1140
+ min: 1,
1141
+ step: 1,
1142
+ hiddenFromList: true
1143
+ };
1144
+ var fromField = {
1145
+ type: "number",
1146
+ default: 0,
1147
+ step: 1,
1148
+ hiddenFromList: true
1149
+ };
864
1150
  var sequenceSchema = {
865
1151
  hidden: hiddenField,
1152
+ from: fromField,
1153
+ durationInFrames: durationInFramesField,
866
1154
  layout: {
867
1155
  type: "enum",
868
1156
  default: "absolute-fill",
@@ -873,6 +1161,11 @@ var sequenceSchema = {
873
1161
  }
874
1162
  }
875
1163
  };
1164
+ var sequenceSchemaWithoutFrom = {
1165
+ hidden: hiddenField,
1166
+ durationInFrames: durationInFramesField,
1167
+ layout: sequenceSchema.layout
1168
+ };
876
1169
  var sequenceSchemaDefaultLayoutNone = {
877
1170
  ...sequenceSchema,
878
1171
  layout: {
@@ -1044,7 +1337,9 @@ var NoReactInternals = {
1044
1337
  validateCodec,
1045
1338
  proResProfileOptions,
1046
1339
  findPropsToDelete,
1047
- sequenceSchema
1340
+ sequenceSchema,
1341
+ parseScaleValue,
1342
+ serializeScaleValue
1048
1343
  };
1049
1344
 
1050
1345
  // src/scripts/render-still.ts
@@ -1159,6 +1454,123 @@ import { RenderInternals } from "@remotion/renderer";
1159
1454
  import { put } from "@vercel/blob";
1160
1455
 
1161
1456
  // ../core/dist/esm/no-react.mjs
1457
+ var normalizeNumber = (value) => {
1458
+ return Math.round(value * 1e6) / 1e6;
1459
+ };
1460
+ var angleUnits = new Set(["deg", "rad", "grad", "turn"]);
1461
+ var lengthUnits = new Set([
1462
+ "%",
1463
+ "cap",
1464
+ "ch",
1465
+ "cm",
1466
+ "cqb",
1467
+ "cqh",
1468
+ "cqi",
1469
+ "cqmax",
1470
+ "cqmin",
1471
+ "cqw",
1472
+ "dvh",
1473
+ "dvw",
1474
+ "em",
1475
+ "ex",
1476
+ "ic",
1477
+ "in",
1478
+ "lh",
1479
+ "lvh",
1480
+ "lvw",
1481
+ "mm",
1482
+ "pc",
1483
+ "pt",
1484
+ "px",
1485
+ "q",
1486
+ "rem",
1487
+ "rlh",
1488
+ "svh",
1489
+ "svw",
1490
+ "vb",
1491
+ "vh",
1492
+ "vi",
1493
+ "vmax",
1494
+ "vmin",
1495
+ "vw"
1496
+ ]);
1497
+ var cssNumberRegex = /^([+-]?(?:\\d+\\.?\\d*|\\.\\d+))([a-zA-Z%]+)?$/;
1498
+ var stringifyNumber = (value) => {
1499
+ return String(normalizeNumber(value));
1500
+ };
1501
+ var parseStringInterpolationComponent = (component, value) => {
1502
+ const match = cssNumberRegex.exec(component);
1503
+ if (match === null) {
1504
+ throw new TypeError(\`Cannot interpolate "\${value}" because "\${component}" is not a supported scale, translate, or rotate value\`);
1505
+ }
1506
+ const unit = match[2] ?? null;
1507
+ const numberValue = Number(match[1]);
1508
+ if (!Number.isFinite(numberValue)) {
1509
+ throw new TypeError(\`Cannot interpolate "\${value}" because "\${component}" is not finite\`);
1510
+ }
1511
+ if (unit === null) {
1512
+ return { kind: "scale", value: numberValue, unit: null };
1513
+ }
1514
+ if (angleUnits.has(unit)) {
1515
+ return { kind: "rotate", value: numberValue, unit };
1516
+ }
1517
+ if (lengthUnits.has(unit)) {
1518
+ return { kind: "translate", value: numberValue, unit };
1519
+ }
1520
+ throw new TypeError(\`Cannot interpolate "\${value}" because "\${unit}" is not a supported translate or rotate unit\`);
1521
+ };
1522
+ var parseStringInterpolationValue = (output) => {
1523
+ if (typeof output === "number") {
1524
+ if (!Number.isFinite(output)) {
1525
+ throw new Error(\`outputRange must contain only finite numbers, but got [\${output}]\`);
1526
+ }
1527
+ return {
1528
+ kind: "scale",
1529
+ values: [output, output, 1],
1530
+ units: [null, null, null],
1531
+ dimensions: 1
1532
+ };
1533
+ }
1534
+ const parts = output.trim().split(/\\s+/);
1535
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
1536
+ throw new TypeError(\`String outputRange values must contain 1 to 3 components, but got "\${output}"\`);
1537
+ }
1538
+ const parsed = parts.map((part) => parseStringInterpolationComponent(part, output));
1539
+ const [{ kind }] = parsed;
1540
+ for (const part of parsed) {
1541
+ if (part.kind !== kind) {
1542
+ throw new TypeError(\`Cannot interpolate "\${output}" because it mixes \${kind} and \${part.kind} values\`);
1543
+ }
1544
+ }
1545
+ if (kind === "scale") {
1546
+ const x = parsed[0].value;
1547
+ const y = parsed[1]?.value ?? x;
1548
+ const z = parsed[2]?.value ?? 1;
1549
+ return {
1550
+ kind,
1551
+ values: [x, y, z],
1552
+ units: [null, null, null],
1553
+ dimensions: parsed.length
1554
+ };
1555
+ }
1556
+ return {
1557
+ kind,
1558
+ values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
1559
+ units: [parsed[0].unit, parsed[1]?.unit ?? null, parsed[2]?.unit ?? null],
1560
+ dimensions: parsed.length
1561
+ };
1562
+ };
1563
+ var serializeStringInterpolationValue = ({
1564
+ kind,
1565
+ values,
1566
+ units,
1567
+ dimensions
1568
+ }) => {
1569
+ if (kind === "scale") {
1570
+ return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
1571
+ }
1572
+ return values.slice(0, dimensions).map((value, index) => \`\${stringifyNumber(value)}\${units[index]}\`).join(" ");
1573
+ };
1162
1574
  function interpolateFunction(input, inputRange, outputRange, options) {
1163
1575
  const { extrapolateLeft, extrapolateRight, easing } = options;
1164
1576
  let result = input;
@@ -1203,6 +1615,130 @@ function findRange(input, inputRange) {
1203
1615
  }
1204
1616
  return i - 1;
1205
1617
  }
1618
+ var defaultEasing = (num) => num;
1619
+ var interpolateNumber = ({
1620
+ input,
1621
+ inputRange,
1622
+ outputRange,
1623
+ options
1624
+ }) => {
1625
+ if (inputRange.length === 1) {
1626
+ return outputRange[0];
1627
+ }
1628
+ const easingOption = options?.easing;
1629
+ const resolveEasingForSegment = (segmentIndex) => {
1630
+ if (easingOption === undefined) {
1631
+ return defaultEasing;
1632
+ }
1633
+ if (typeof easingOption === "function") {
1634
+ return easingOption;
1635
+ }
1636
+ return easingOption[segmentIndex];
1637
+ };
1638
+ let extrapolateLeft = "extend";
1639
+ if (options?.extrapolateLeft !== undefined) {
1640
+ extrapolateLeft = options.extrapolateLeft;
1641
+ }
1642
+ let extrapolateRight = "extend";
1643
+ if (options?.extrapolateRight !== undefined) {
1644
+ extrapolateRight = options.extrapolateRight;
1645
+ }
1646
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1647
+ const range = findRange(posterizedInput, inputRange);
1648
+ return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
1649
+ easing: resolveEasingForSegment(range),
1650
+ extrapolateLeft,
1651
+ extrapolateRight
1652
+ });
1653
+ };
1654
+ var interpolateString = ({
1655
+ input,
1656
+ inputRange,
1657
+ outputRange,
1658
+ options
1659
+ }) => {
1660
+ const parsedOutputRange = outputRange.map(parseStringInterpolationValue);
1661
+ const kind = parsedOutputRange[0]?.kind;
1662
+ if (kind === undefined) {
1663
+ throw new Error("outputRange must have at least 1 element");
1664
+ }
1665
+ for (const parsed of parsedOutputRange) {
1666
+ if (parsed.kind !== kind) {
1667
+ throw new TypeError(\`Cannot interpolate \${kind} values with \${parsed.kind} values\`);
1668
+ }
1669
+ }
1670
+ const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
1671
+ const units = [
1672
+ null,
1673
+ null,
1674
+ null
1675
+ ];
1676
+ if (kind !== "scale") {
1677
+ for (let axis = 0;axis < dimensions; axis++) {
1678
+ for (const parsed of parsedOutputRange) {
1679
+ const unit = parsed.units[axis];
1680
+ if (unit === null) {
1681
+ continue;
1682
+ }
1683
+ if (units[axis] === null) {
1684
+ units[axis] = unit;
1685
+ continue;
1686
+ }
1687
+ if (units[axis] !== unit) {
1688
+ throw new TypeError(\`Cannot interpolate \${kind} values with different units on axis \${axis + 1}: \${units[axis]} and \${unit}\`);
1689
+ }
1690
+ }
1691
+ if (units[axis] === null) {
1692
+ throw new TypeError(\`Cannot interpolate \${kind} values because axis \${axis + 1} has no unit\`);
1693
+ }
1694
+ }
1695
+ }
1696
+ return serializeStringInterpolationValue({
1697
+ kind,
1698
+ values: [0, 0, 0].map((_, axis) => interpolateNumber({
1699
+ input,
1700
+ inputRange,
1701
+ outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
1702
+ options
1703
+ })),
1704
+ units,
1705
+ dimensions
1706
+ });
1707
+ };
1708
+ var validateTupleOutputRange = (outputRange) => {
1709
+ const dimensions = outputRange[0]?.length;
1710
+ if (dimensions === undefined) {
1711
+ throw new Error("outputRange must have at least 1 element");
1712
+ }
1713
+ if (dimensions === 0) {
1714
+ throw new TypeError("outputRange tuples must contain at least 1 number");
1715
+ }
1716
+ for (const output of outputRange) {
1717
+ if (output.length !== dimensions) {
1718
+ throw new TypeError(\`outputRange tuples must all have the same length, but got \${dimensions} and \${output.length}\`);
1719
+ }
1720
+ for (const value of output) {
1721
+ if (typeof value !== "number" || !Number.isFinite(value)) {
1722
+ throw new TypeError(\`outputRange tuples must contain only finite numbers, but got [\${output.join(",")}]\`);
1723
+ }
1724
+ }
1725
+ }
1726
+ return dimensions;
1727
+ };
1728
+ var interpolateTuple = ({
1729
+ input,
1730
+ inputRange,
1731
+ outputRange,
1732
+ options
1733
+ }) => {
1734
+ const dimensions = validateTupleOutputRange(outputRange);
1735
+ return new Array(dimensions).fill(true).map((_, axis) => interpolateNumber({
1736
+ input,
1737
+ inputRange,
1738
+ outputRange: outputRange.map((output) => output[axis]),
1739
+ options
1740
+ }));
1741
+ };
1206
1742
  function checkValidInputRange(arr) {
1207
1743
  for (let i = 1;i < arr.length; ++i) {
1208
1744
  if (!(arr[i] > arr[i - 1])) {
@@ -1262,42 +1798,30 @@ function interpolate(input, inputRange, outputRange, options) {
1262
1798
  throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
1263
1799
  }
1264
1800
  checkInfiniteRange("inputRange", inputRange);
1265
- checkInfiniteRange("outputRange", outputRange);
1266
1801
  checkValidInputRange(inputRange);
1267
1802
  assertValidInterpolateEasingOption(options?.easing, inputRange.length);
1268
1803
  assertValidInterpolatePosterizeOption(options?.posterize);
1269
- const easingOption = options?.easing;
1270
- const defaultEasing = (num) => num;
1271
- const resolveEasingForSegment = (segmentIndex) => {
1272
- if (easingOption === undefined) {
1273
- return defaultEasing;
1274
- }
1275
- if (typeof easingOption === "function") {
1276
- return easingOption;
1277
- }
1278
- return easingOption[segmentIndex];
1279
- };
1280
- let extrapolateLeft = "extend";
1281
- if (options?.extrapolateLeft !== undefined) {
1282
- extrapolateLeft = options.extrapolateLeft;
1283
- }
1284
- let extrapolateRight = "extend";
1285
- if (options?.extrapolateRight !== undefined) {
1286
- extrapolateRight = options.extrapolateRight;
1287
- }
1288
1804
  if (typeof input !== "number") {
1289
1805
  throw new TypeError("Cannot interpolate an input which is not a number");
1290
1806
  }
1291
- if (inputRange.length === 1) {
1292
- return outputRange[0];
1807
+ if (!Array.isArray(outputRange)) {
1808
+ throw new Error("outputRange must contain only numbers");
1293
1809
  }
1294
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1295
- const range = findRange(posterizedInput, inputRange);
1296
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
1297
- easing: resolveEasingForSegment(range),
1298
- extrapolateLeft,
1299
- extrapolateRight
1300
- });
1810
+ const hasStringOutput = outputRange.some((output) => typeof output === "string");
1811
+ if (hasStringOutput) {
1812
+ if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
1813
+ throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
1814
+ }
1815
+ return interpolateString({ input, inputRange, outputRange, options });
1816
+ }
1817
+ if (outputRange.every((output) => Array.isArray(output))) {
1818
+ return interpolateTuple({ input, inputRange, outputRange, options });
1819
+ }
1820
+ if (!outputRange.every((output) => typeof output === "number")) {
1821
+ throw new TypeError("outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings");
1822
+ }
1823
+ checkInfiniteRange("outputRange", outputRange);
1824
+ return interpolateNumber({ input, inputRange, outputRange, options });
1301
1825
  }
1302
1826
  function truthy(value) {
1303
1827
  return Boolean(value);
@@ -1848,6 +2372,45 @@ var proResProfileOptions = [
1848
2372
  "light",
1849
2373
  "proxy"
1850
2374
  ];
2375
+ var defaultScaleValue = [1, 1, 1];
2376
+ var parseScaleString = (value) => {
2377
+ const parts = value.trim().split(/\\s+/);
2378
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
2379
+ return null;
2380
+ }
2381
+ const parsed = parts.map((part) => Number(part));
2382
+ if (!parsed.every((part) => Number.isFinite(part))) {
2383
+ return null;
2384
+ }
2385
+ const x = parsed[0];
2386
+ const y = parsed[1] ?? x;
2387
+ const z = parsed[2] ?? 1;
2388
+ return [x, y, z];
2389
+ };
2390
+ var parseValidScaleValue = (value) => {
2391
+ if (typeof value === "number") {
2392
+ return Number.isFinite(value) ? [value, value, 1] : null;
2393
+ }
2394
+ if (typeof value === "string") {
2395
+ return parseScaleString(value);
2396
+ }
2397
+ return null;
2398
+ };
2399
+ var parseScaleValue = (value) => {
2400
+ return parseValidScaleValue(value) ?? defaultScaleValue;
2401
+ };
2402
+ var serializeScaleValue = ([x, y, z]) => {
2403
+ const normalizedX = normalizeNumber(x);
2404
+ const normalizedY = normalizeNumber(y);
2405
+ const normalizedZ = normalizeNumber(z);
2406
+ if (normalizedX === normalizedY && normalizedZ === 1) {
2407
+ return normalizedX;
2408
+ }
2409
+ if (normalizedZ === 1) {
2410
+ return \`\${normalizedX} \${normalizedY}\`;
2411
+ }
2412
+ return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
2413
+ };
1851
2414
  var sequenceVisualStyleSchema = {
1852
2415
  "style.translate": {
1853
2416
  type: "translate",
@@ -1856,15 +2419,14 @@ var sequenceVisualStyleSchema = {
1856
2419
  description: "Offset"
1857
2420
  },
1858
2421
  "style.scale": {
1859
- type: "number",
1860
- min: 0.05,
2422
+ type: "scale",
1861
2423
  max: 100,
1862
2424
  step: 0.01,
1863
2425
  default: 1,
1864
2426
  description: "Scale"
1865
2427
  },
1866
2428
  "style.rotate": {
1867
- type: "rotation",
2429
+ type: "rotation-css",
1868
2430
  step: 1,
1869
2431
  default: "0deg",
1870
2432
  description: "Rotation"
@@ -1875,7 +2437,8 @@ var sequenceVisualStyleSchema = {
1875
2437
  max: 1,
1876
2438
  step: 0.01,
1877
2439
  default: 1,
1878
- description: "Opacity"
2440
+ description: "Opacity",
2441
+ hiddenFromList: false
1879
2442
  }
1880
2443
  };
1881
2444
  var sequencePremountSchema = {
@@ -1884,10 +2447,15 @@ var sequencePremountSchema = {
1884
2447
  default: 0,
1885
2448
  description: "Premount For",
1886
2449
  min: 0,
1887
- step: 1
2450
+ step: 1,
2451
+ hiddenFromList: false
1888
2452
  },
1889
2453
  postmountFor: {
1890
- type: "hidden"
2454
+ type: "number",
2455
+ default: 0,
2456
+ min: 0,
2457
+ step: 1,
2458
+ hiddenFromList: true
1891
2459
  },
1892
2460
  styleWhilePremounted: {
1893
2461
  type: "hidden"
@@ -1905,8 +2473,23 @@ var hiddenField = {
1905
2473
  default: false,
1906
2474
  description: "Hidden"
1907
2475
  };
2476
+ var durationInFramesField = {
2477
+ type: "number",
2478
+ default: undefined,
2479
+ min: 1,
2480
+ step: 1,
2481
+ hiddenFromList: true
2482
+ };
2483
+ var fromField = {
2484
+ type: "number",
2485
+ default: 0,
2486
+ step: 1,
2487
+ hiddenFromList: true
2488
+ };
1908
2489
  var sequenceSchema = {
1909
2490
  hidden: hiddenField,
2491
+ from: fromField,
2492
+ durationInFrames: durationInFramesField,
1910
2493
  layout: {
1911
2494
  type: "enum",
1912
2495
  default: "absolute-fill",
@@ -1917,6 +2500,11 @@ var sequenceSchema = {
1917
2500
  }
1918
2501
  }
1919
2502
  };
2503
+ var sequenceSchemaWithoutFrom = {
2504
+ hidden: hiddenField,
2505
+ durationInFrames: durationInFramesField,
2506
+ layout: sequenceSchema.layout
2507
+ };
1920
2508
  var sequenceSchemaDefaultLayoutNone = {
1921
2509
  ...sequenceSchema,
1922
2510
  layout: {
@@ -2088,7 +2676,9 @@ var NoReactInternals = {
2088
2676
  validateCodec,
2089
2677
  proResProfileOptions,
2090
2678
  findPropsToDelete,
2091
- sequenceSchema
2679
+ sequenceSchema,
2680
+ parseScaleValue,
2681
+ serializeScaleValue
2092
2682
  };
2093
2683
 
2094
2684
  // src/scripts/render-video.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.471",
3
+ "version": "4.0.473",
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.471",
27
- "remotion": "4.0.471"
26
+ "@remotion/renderer": "4.0.473",
27
+ "remotion": "4.0.473"
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.471",
41
+ "@remotion/eslint-config-internal": "4.0.473",
42
42
  "@vercel/blob": "2.3.0",
43
43
  "@vercel/sandbox": "1.6.0",
44
44
  "eslint": "9.19.0",