@remotion/vercel 4.0.471 → 4.0.472
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/esm/index.mjs +578 -70
- package/package.json +4 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -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,96 @@ 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
|
+
};
|
|
162
369
|
function checkValidInputRange(arr) {
|
|
163
370
|
for (let i = 1;i < arr.length; ++i) {
|
|
164
371
|
if (!(arr[i] > arr[i - 1])) {
|
|
@@ -218,42 +425,27 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
218
425
|
throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
|
|
219
426
|
}
|
|
220
427
|
checkInfiniteRange("inputRange", inputRange);
|
|
221
|
-
checkInfiniteRange("outputRange", outputRange);
|
|
222
428
|
checkValidInputRange(inputRange);
|
|
223
429
|
assertValidInterpolateEasingOption(options?.easing, inputRange.length);
|
|
224
430
|
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
431
|
if (typeof input !== "number") {
|
|
245
432
|
throw new TypeError("Cannot interpolate an input which is not a number");
|
|
246
433
|
}
|
|
247
|
-
if (
|
|
248
|
-
|
|
434
|
+
if (!Array.isArray(outputRange)) {
|
|
435
|
+
throw new Error("outputRange must contain only numbers");
|
|
249
436
|
}
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
437
|
+
const hasStringOutput = outputRange.some((output) => typeof output === "string");
|
|
438
|
+
if (hasStringOutput) {
|
|
439
|
+
if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
|
|
440
|
+
throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
|
|
441
|
+
}
|
|
442
|
+
return interpolateString({ input, inputRange, outputRange, options });
|
|
443
|
+
}
|
|
444
|
+
if (!outputRange.every((output) => typeof output === "number")) {
|
|
445
|
+
throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
|
|
446
|
+
}
|
|
447
|
+
checkInfiniteRange("outputRange", outputRange);
|
|
448
|
+
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
257
449
|
}
|
|
258
450
|
function truthy(value) {
|
|
259
451
|
return Boolean(value);
|
|
@@ -804,6 +996,45 @@ var proResProfileOptions = [
|
|
|
804
996
|
"light",
|
|
805
997
|
"proxy"
|
|
806
998
|
];
|
|
999
|
+
var defaultScaleValue = [1, 1, 1];
|
|
1000
|
+
var parseScaleString = (value) => {
|
|
1001
|
+
const parts = value.trim().split(/\\s+/);
|
|
1002
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
1003
|
+
return null;
|
|
1004
|
+
}
|
|
1005
|
+
const parsed = parts.map((part) => Number(part));
|
|
1006
|
+
if (!parsed.every((part) => Number.isFinite(part))) {
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
const x = parsed[0];
|
|
1010
|
+
const y = parsed[1] ?? x;
|
|
1011
|
+
const z = parsed[2] ?? 1;
|
|
1012
|
+
return [x, y, z];
|
|
1013
|
+
};
|
|
1014
|
+
var parseValidScaleValue = (value) => {
|
|
1015
|
+
if (typeof value === "number") {
|
|
1016
|
+
return Number.isFinite(value) ? [value, value, 1] : null;
|
|
1017
|
+
}
|
|
1018
|
+
if (typeof value === "string") {
|
|
1019
|
+
return parseScaleString(value);
|
|
1020
|
+
}
|
|
1021
|
+
return null;
|
|
1022
|
+
};
|
|
1023
|
+
var parseScaleValue = (value) => {
|
|
1024
|
+
return parseValidScaleValue(value) ?? defaultScaleValue;
|
|
1025
|
+
};
|
|
1026
|
+
var serializeScaleValue = ([x, y, z]) => {
|
|
1027
|
+
const normalizedX = normalizeNumber(x);
|
|
1028
|
+
const normalizedY = normalizeNumber(y);
|
|
1029
|
+
const normalizedZ = normalizeNumber(z);
|
|
1030
|
+
if (normalizedX === normalizedY && normalizedZ === 1) {
|
|
1031
|
+
return normalizedX;
|
|
1032
|
+
}
|
|
1033
|
+
if (normalizedZ === 1) {
|
|
1034
|
+
return \`\${normalizedX} \${normalizedY}\`;
|
|
1035
|
+
}
|
|
1036
|
+
return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
|
|
1037
|
+
};
|
|
807
1038
|
var sequenceVisualStyleSchema = {
|
|
808
1039
|
"style.translate": {
|
|
809
1040
|
type: "translate",
|
|
@@ -812,7 +1043,7 @@ var sequenceVisualStyleSchema = {
|
|
|
812
1043
|
description: "Offset"
|
|
813
1044
|
},
|
|
814
1045
|
"style.scale": {
|
|
815
|
-
type: "
|
|
1046
|
+
type: "scale",
|
|
816
1047
|
min: 0.05,
|
|
817
1048
|
max: 100,
|
|
818
1049
|
step: 0.01,
|
|
@@ -820,7 +1051,7 @@ var sequenceVisualStyleSchema = {
|
|
|
820
1051
|
description: "Scale"
|
|
821
1052
|
},
|
|
822
1053
|
"style.rotate": {
|
|
823
|
-
type: "rotation",
|
|
1054
|
+
type: "rotation-css",
|
|
824
1055
|
step: 1,
|
|
825
1056
|
default: "0deg",
|
|
826
1057
|
description: "Rotation"
|
|
@@ -831,7 +1062,8 @@ var sequenceVisualStyleSchema = {
|
|
|
831
1062
|
max: 1,
|
|
832
1063
|
step: 0.01,
|
|
833
1064
|
default: 1,
|
|
834
|
-
description: "Opacity"
|
|
1065
|
+
description: "Opacity",
|
|
1066
|
+
hiddenFromList: false
|
|
835
1067
|
}
|
|
836
1068
|
};
|
|
837
1069
|
var sequencePremountSchema = {
|
|
@@ -840,10 +1072,15 @@ var sequencePremountSchema = {
|
|
|
840
1072
|
default: 0,
|
|
841
1073
|
description: "Premount For",
|
|
842
1074
|
min: 0,
|
|
843
|
-
step: 1
|
|
1075
|
+
step: 1,
|
|
1076
|
+
hiddenFromList: false
|
|
844
1077
|
},
|
|
845
1078
|
postmountFor: {
|
|
846
|
-
type: "
|
|
1079
|
+
type: "number",
|
|
1080
|
+
default: 0,
|
|
1081
|
+
min: 0,
|
|
1082
|
+
step: 1,
|
|
1083
|
+
hiddenFromList: true
|
|
847
1084
|
},
|
|
848
1085
|
styleWhilePremounted: {
|
|
849
1086
|
type: "hidden"
|
|
@@ -861,8 +1098,23 @@ var hiddenField = {
|
|
|
861
1098
|
default: false,
|
|
862
1099
|
description: "Hidden"
|
|
863
1100
|
};
|
|
1101
|
+
var durationInFramesField = {
|
|
1102
|
+
type: "number",
|
|
1103
|
+
default: undefined,
|
|
1104
|
+
min: 1,
|
|
1105
|
+
step: 1,
|
|
1106
|
+
hiddenFromList: true
|
|
1107
|
+
};
|
|
1108
|
+
var fromField = {
|
|
1109
|
+
type: "number",
|
|
1110
|
+
default: 0,
|
|
1111
|
+
step: 1,
|
|
1112
|
+
hiddenFromList: true
|
|
1113
|
+
};
|
|
864
1114
|
var sequenceSchema = {
|
|
865
1115
|
hidden: hiddenField,
|
|
1116
|
+
from: fromField,
|
|
1117
|
+
durationInFrames: durationInFramesField,
|
|
866
1118
|
layout: {
|
|
867
1119
|
type: "enum",
|
|
868
1120
|
default: "absolute-fill",
|
|
@@ -1044,7 +1296,9 @@ var NoReactInternals = {
|
|
|
1044
1296
|
validateCodec,
|
|
1045
1297
|
proResProfileOptions,
|
|
1046
1298
|
findPropsToDelete,
|
|
1047
|
-
sequenceSchema
|
|
1299
|
+
sequenceSchema,
|
|
1300
|
+
parseScaleValue,
|
|
1301
|
+
serializeScaleValue
|
|
1048
1302
|
};
|
|
1049
1303
|
|
|
1050
1304
|
// src/scripts/render-still.ts
|
|
@@ -1159,6 +1413,123 @@ import { RenderInternals } from "@remotion/renderer";
|
|
|
1159
1413
|
import { put } from "@vercel/blob";
|
|
1160
1414
|
|
|
1161
1415
|
// ../core/dist/esm/no-react.mjs
|
|
1416
|
+
var normalizeNumber = (value) => {
|
|
1417
|
+
return Math.round(value * 1e6) / 1e6;
|
|
1418
|
+
};
|
|
1419
|
+
var angleUnits = new Set(["deg", "rad", "grad", "turn"]);
|
|
1420
|
+
var lengthUnits = new Set([
|
|
1421
|
+
"%",
|
|
1422
|
+
"cap",
|
|
1423
|
+
"ch",
|
|
1424
|
+
"cm",
|
|
1425
|
+
"cqb",
|
|
1426
|
+
"cqh",
|
|
1427
|
+
"cqi",
|
|
1428
|
+
"cqmax",
|
|
1429
|
+
"cqmin",
|
|
1430
|
+
"cqw",
|
|
1431
|
+
"dvh",
|
|
1432
|
+
"dvw",
|
|
1433
|
+
"em",
|
|
1434
|
+
"ex",
|
|
1435
|
+
"ic",
|
|
1436
|
+
"in",
|
|
1437
|
+
"lh",
|
|
1438
|
+
"lvh",
|
|
1439
|
+
"lvw",
|
|
1440
|
+
"mm",
|
|
1441
|
+
"pc",
|
|
1442
|
+
"pt",
|
|
1443
|
+
"px",
|
|
1444
|
+
"q",
|
|
1445
|
+
"rem",
|
|
1446
|
+
"rlh",
|
|
1447
|
+
"svh",
|
|
1448
|
+
"svw",
|
|
1449
|
+
"vb",
|
|
1450
|
+
"vh",
|
|
1451
|
+
"vi",
|
|
1452
|
+
"vmax",
|
|
1453
|
+
"vmin",
|
|
1454
|
+
"vw"
|
|
1455
|
+
]);
|
|
1456
|
+
var cssNumberRegex = /^([+-]?(?:\\d+\\.?\\d*|\\.\\d+))([a-zA-Z%]+)?$/;
|
|
1457
|
+
var stringifyNumber = (value) => {
|
|
1458
|
+
return String(normalizeNumber(value));
|
|
1459
|
+
};
|
|
1460
|
+
var parseStringInterpolationComponent = (component, value) => {
|
|
1461
|
+
const match = cssNumberRegex.exec(component);
|
|
1462
|
+
if (match === null) {
|
|
1463
|
+
throw new TypeError(\`Cannot interpolate "\${value}" because "\${component}" is not a supported scale, translate, or rotate value\`);
|
|
1464
|
+
}
|
|
1465
|
+
const unit = match[2] ?? null;
|
|
1466
|
+
const numberValue = Number(match[1]);
|
|
1467
|
+
if (!Number.isFinite(numberValue)) {
|
|
1468
|
+
throw new TypeError(\`Cannot interpolate "\${value}" because "\${component}" is not finite\`);
|
|
1469
|
+
}
|
|
1470
|
+
if (unit === null) {
|
|
1471
|
+
return { kind: "scale", value: numberValue, unit: null };
|
|
1472
|
+
}
|
|
1473
|
+
if (angleUnits.has(unit)) {
|
|
1474
|
+
return { kind: "rotate", value: numberValue, unit };
|
|
1475
|
+
}
|
|
1476
|
+
if (lengthUnits.has(unit)) {
|
|
1477
|
+
return { kind: "translate", value: numberValue, unit };
|
|
1478
|
+
}
|
|
1479
|
+
throw new TypeError(\`Cannot interpolate "\${value}" because "\${unit}" is not a supported translate or rotate unit\`);
|
|
1480
|
+
};
|
|
1481
|
+
var parseStringInterpolationValue = (output) => {
|
|
1482
|
+
if (typeof output === "number") {
|
|
1483
|
+
if (!Number.isFinite(output)) {
|
|
1484
|
+
throw new Error(\`outputRange must contain only finite numbers, but got [\${output}]\`);
|
|
1485
|
+
}
|
|
1486
|
+
return {
|
|
1487
|
+
kind: "scale",
|
|
1488
|
+
values: [output, output, 1],
|
|
1489
|
+
units: [null, null, null],
|
|
1490
|
+
dimensions: 1
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
const parts = output.trim().split(/\\s+/);
|
|
1494
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
1495
|
+
throw new TypeError(\`String outputRange values must contain 1 to 3 components, but got "\${output}"\`);
|
|
1496
|
+
}
|
|
1497
|
+
const parsed = parts.map((part) => parseStringInterpolationComponent(part, output));
|
|
1498
|
+
const [{ kind }] = parsed;
|
|
1499
|
+
for (const part of parsed) {
|
|
1500
|
+
if (part.kind !== kind) {
|
|
1501
|
+
throw new TypeError(\`Cannot interpolate "\${output}" because it mixes \${kind} and \${part.kind} values\`);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
if (kind === "scale") {
|
|
1505
|
+
const x = parsed[0].value;
|
|
1506
|
+
const y = parsed[1]?.value ?? x;
|
|
1507
|
+
const z = parsed[2]?.value ?? 1;
|
|
1508
|
+
return {
|
|
1509
|
+
kind,
|
|
1510
|
+
values: [x, y, z],
|
|
1511
|
+
units: [null, null, null],
|
|
1512
|
+
dimensions: parsed.length
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
return {
|
|
1516
|
+
kind,
|
|
1517
|
+
values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
|
|
1518
|
+
units: [parsed[0].unit, parsed[1]?.unit ?? null, parsed[2]?.unit ?? null],
|
|
1519
|
+
dimensions: parsed.length
|
|
1520
|
+
};
|
|
1521
|
+
};
|
|
1522
|
+
var serializeStringInterpolationValue = ({
|
|
1523
|
+
kind,
|
|
1524
|
+
values,
|
|
1525
|
+
units,
|
|
1526
|
+
dimensions
|
|
1527
|
+
}) => {
|
|
1528
|
+
if (kind === "scale") {
|
|
1529
|
+
return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
|
|
1530
|
+
}
|
|
1531
|
+
return values.slice(0, dimensions).map((value, index) => \`\${stringifyNumber(value)}\${units[index]}\`).join(" ");
|
|
1532
|
+
};
|
|
1162
1533
|
function interpolateFunction(input, inputRange, outputRange, options) {
|
|
1163
1534
|
const { extrapolateLeft, extrapolateRight, easing } = options;
|
|
1164
1535
|
let result = input;
|
|
@@ -1203,6 +1574,96 @@ function findRange(input, inputRange) {
|
|
|
1203
1574
|
}
|
|
1204
1575
|
return i - 1;
|
|
1205
1576
|
}
|
|
1577
|
+
var defaultEasing = (num) => num;
|
|
1578
|
+
var interpolateNumber = ({
|
|
1579
|
+
input,
|
|
1580
|
+
inputRange,
|
|
1581
|
+
outputRange,
|
|
1582
|
+
options
|
|
1583
|
+
}) => {
|
|
1584
|
+
if (inputRange.length === 1) {
|
|
1585
|
+
return outputRange[0];
|
|
1586
|
+
}
|
|
1587
|
+
const easingOption = options?.easing;
|
|
1588
|
+
const resolveEasingForSegment = (segmentIndex) => {
|
|
1589
|
+
if (easingOption === undefined) {
|
|
1590
|
+
return defaultEasing;
|
|
1591
|
+
}
|
|
1592
|
+
if (typeof easingOption === "function") {
|
|
1593
|
+
return easingOption;
|
|
1594
|
+
}
|
|
1595
|
+
return easingOption[segmentIndex];
|
|
1596
|
+
};
|
|
1597
|
+
let extrapolateLeft = "extend";
|
|
1598
|
+
if (options?.extrapolateLeft !== undefined) {
|
|
1599
|
+
extrapolateLeft = options.extrapolateLeft;
|
|
1600
|
+
}
|
|
1601
|
+
let extrapolateRight = "extend";
|
|
1602
|
+
if (options?.extrapolateRight !== undefined) {
|
|
1603
|
+
extrapolateRight = options.extrapolateRight;
|
|
1604
|
+
}
|
|
1605
|
+
const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
|
|
1606
|
+
const range = findRange(posterizedInput, inputRange);
|
|
1607
|
+
return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
|
|
1608
|
+
easing: resolveEasingForSegment(range),
|
|
1609
|
+
extrapolateLeft,
|
|
1610
|
+
extrapolateRight
|
|
1611
|
+
});
|
|
1612
|
+
};
|
|
1613
|
+
var interpolateString = ({
|
|
1614
|
+
input,
|
|
1615
|
+
inputRange,
|
|
1616
|
+
outputRange,
|
|
1617
|
+
options
|
|
1618
|
+
}) => {
|
|
1619
|
+
const parsedOutputRange = outputRange.map(parseStringInterpolationValue);
|
|
1620
|
+
const kind = parsedOutputRange[0]?.kind;
|
|
1621
|
+
if (kind === undefined) {
|
|
1622
|
+
throw new Error("outputRange must have at least 1 element");
|
|
1623
|
+
}
|
|
1624
|
+
for (const parsed of parsedOutputRange) {
|
|
1625
|
+
if (parsed.kind !== kind) {
|
|
1626
|
+
throw new TypeError(\`Cannot interpolate \${kind} values with \${parsed.kind} values\`);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
|
|
1630
|
+
const units = [
|
|
1631
|
+
null,
|
|
1632
|
+
null,
|
|
1633
|
+
null
|
|
1634
|
+
];
|
|
1635
|
+
if (kind !== "scale") {
|
|
1636
|
+
for (let axis = 0;axis < dimensions; axis++) {
|
|
1637
|
+
for (const parsed of parsedOutputRange) {
|
|
1638
|
+
const unit = parsed.units[axis];
|
|
1639
|
+
if (unit === null) {
|
|
1640
|
+
continue;
|
|
1641
|
+
}
|
|
1642
|
+
if (units[axis] === null) {
|
|
1643
|
+
units[axis] = unit;
|
|
1644
|
+
continue;
|
|
1645
|
+
}
|
|
1646
|
+
if (units[axis] !== unit) {
|
|
1647
|
+
throw new TypeError(\`Cannot interpolate \${kind} values with different units on axis \${axis + 1}: \${units[axis]} and \${unit}\`);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
if (units[axis] === null) {
|
|
1651
|
+
throw new TypeError(\`Cannot interpolate \${kind} values because axis \${axis + 1} has no unit\`);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
return serializeStringInterpolationValue({
|
|
1656
|
+
kind,
|
|
1657
|
+
values: [0, 0, 0].map((_, axis) => interpolateNumber({
|
|
1658
|
+
input,
|
|
1659
|
+
inputRange,
|
|
1660
|
+
outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
|
|
1661
|
+
options
|
|
1662
|
+
})),
|
|
1663
|
+
units,
|
|
1664
|
+
dimensions
|
|
1665
|
+
});
|
|
1666
|
+
};
|
|
1206
1667
|
function checkValidInputRange(arr) {
|
|
1207
1668
|
for (let i = 1;i < arr.length; ++i) {
|
|
1208
1669
|
if (!(arr[i] > arr[i - 1])) {
|
|
@@ -1262,42 +1723,27 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
1262
1723
|
throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
|
|
1263
1724
|
}
|
|
1264
1725
|
checkInfiniteRange("inputRange", inputRange);
|
|
1265
|
-
checkInfiniteRange("outputRange", outputRange);
|
|
1266
1726
|
checkValidInputRange(inputRange);
|
|
1267
1727
|
assertValidInterpolateEasingOption(options?.easing, inputRange.length);
|
|
1268
1728
|
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
1729
|
if (typeof input !== "number") {
|
|
1289
1730
|
throw new TypeError("Cannot interpolate an input which is not a number");
|
|
1290
1731
|
}
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1732
|
+
if (!Array.isArray(outputRange)) {
|
|
1733
|
+
throw new Error("outputRange must contain only numbers");
|
|
1293
1734
|
}
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1735
|
+
const hasStringOutput = outputRange.some((output) => typeof output === "string");
|
|
1736
|
+
if (hasStringOutput) {
|
|
1737
|
+
if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
|
|
1738
|
+
throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
|
|
1739
|
+
}
|
|
1740
|
+
return interpolateString({ input, inputRange, outputRange, options });
|
|
1741
|
+
}
|
|
1742
|
+
if (!outputRange.every((output) => typeof output === "number")) {
|
|
1743
|
+
throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
|
|
1744
|
+
}
|
|
1745
|
+
checkInfiniteRange("outputRange", outputRange);
|
|
1746
|
+
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
1301
1747
|
}
|
|
1302
1748
|
function truthy(value) {
|
|
1303
1749
|
return Boolean(value);
|
|
@@ -1848,6 +2294,45 @@ var proResProfileOptions = [
|
|
|
1848
2294
|
"light",
|
|
1849
2295
|
"proxy"
|
|
1850
2296
|
];
|
|
2297
|
+
var defaultScaleValue = [1, 1, 1];
|
|
2298
|
+
var parseScaleString = (value) => {
|
|
2299
|
+
const parts = value.trim().split(/\\s+/);
|
|
2300
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
2301
|
+
return null;
|
|
2302
|
+
}
|
|
2303
|
+
const parsed = parts.map((part) => Number(part));
|
|
2304
|
+
if (!parsed.every((part) => Number.isFinite(part))) {
|
|
2305
|
+
return null;
|
|
2306
|
+
}
|
|
2307
|
+
const x = parsed[0];
|
|
2308
|
+
const y = parsed[1] ?? x;
|
|
2309
|
+
const z = parsed[2] ?? 1;
|
|
2310
|
+
return [x, y, z];
|
|
2311
|
+
};
|
|
2312
|
+
var parseValidScaleValue = (value) => {
|
|
2313
|
+
if (typeof value === "number") {
|
|
2314
|
+
return Number.isFinite(value) ? [value, value, 1] : null;
|
|
2315
|
+
}
|
|
2316
|
+
if (typeof value === "string") {
|
|
2317
|
+
return parseScaleString(value);
|
|
2318
|
+
}
|
|
2319
|
+
return null;
|
|
2320
|
+
};
|
|
2321
|
+
var parseScaleValue = (value) => {
|
|
2322
|
+
return parseValidScaleValue(value) ?? defaultScaleValue;
|
|
2323
|
+
};
|
|
2324
|
+
var serializeScaleValue = ([x, y, z]) => {
|
|
2325
|
+
const normalizedX = normalizeNumber(x);
|
|
2326
|
+
const normalizedY = normalizeNumber(y);
|
|
2327
|
+
const normalizedZ = normalizeNumber(z);
|
|
2328
|
+
if (normalizedX === normalizedY && normalizedZ === 1) {
|
|
2329
|
+
return normalizedX;
|
|
2330
|
+
}
|
|
2331
|
+
if (normalizedZ === 1) {
|
|
2332
|
+
return \`\${normalizedX} \${normalizedY}\`;
|
|
2333
|
+
}
|
|
2334
|
+
return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
|
|
2335
|
+
};
|
|
1851
2336
|
var sequenceVisualStyleSchema = {
|
|
1852
2337
|
"style.translate": {
|
|
1853
2338
|
type: "translate",
|
|
@@ -1856,7 +2341,7 @@ var sequenceVisualStyleSchema = {
|
|
|
1856
2341
|
description: "Offset"
|
|
1857
2342
|
},
|
|
1858
2343
|
"style.scale": {
|
|
1859
|
-
type: "
|
|
2344
|
+
type: "scale",
|
|
1860
2345
|
min: 0.05,
|
|
1861
2346
|
max: 100,
|
|
1862
2347
|
step: 0.01,
|
|
@@ -1864,7 +2349,7 @@ var sequenceVisualStyleSchema = {
|
|
|
1864
2349
|
description: "Scale"
|
|
1865
2350
|
},
|
|
1866
2351
|
"style.rotate": {
|
|
1867
|
-
type: "rotation",
|
|
2352
|
+
type: "rotation-css",
|
|
1868
2353
|
step: 1,
|
|
1869
2354
|
default: "0deg",
|
|
1870
2355
|
description: "Rotation"
|
|
@@ -1875,7 +2360,8 @@ var sequenceVisualStyleSchema = {
|
|
|
1875
2360
|
max: 1,
|
|
1876
2361
|
step: 0.01,
|
|
1877
2362
|
default: 1,
|
|
1878
|
-
description: "Opacity"
|
|
2363
|
+
description: "Opacity",
|
|
2364
|
+
hiddenFromList: false
|
|
1879
2365
|
}
|
|
1880
2366
|
};
|
|
1881
2367
|
var sequencePremountSchema = {
|
|
@@ -1884,10 +2370,15 @@ var sequencePremountSchema = {
|
|
|
1884
2370
|
default: 0,
|
|
1885
2371
|
description: "Premount For",
|
|
1886
2372
|
min: 0,
|
|
1887
|
-
step: 1
|
|
2373
|
+
step: 1,
|
|
2374
|
+
hiddenFromList: false
|
|
1888
2375
|
},
|
|
1889
2376
|
postmountFor: {
|
|
1890
|
-
type: "
|
|
2377
|
+
type: "number",
|
|
2378
|
+
default: 0,
|
|
2379
|
+
min: 0,
|
|
2380
|
+
step: 1,
|
|
2381
|
+
hiddenFromList: true
|
|
1891
2382
|
},
|
|
1892
2383
|
styleWhilePremounted: {
|
|
1893
2384
|
type: "hidden"
|
|
@@ -1905,8 +2396,23 @@ var hiddenField = {
|
|
|
1905
2396
|
default: false,
|
|
1906
2397
|
description: "Hidden"
|
|
1907
2398
|
};
|
|
2399
|
+
var durationInFramesField = {
|
|
2400
|
+
type: "number",
|
|
2401
|
+
default: undefined,
|
|
2402
|
+
min: 1,
|
|
2403
|
+
step: 1,
|
|
2404
|
+
hiddenFromList: true
|
|
2405
|
+
};
|
|
2406
|
+
var fromField = {
|
|
2407
|
+
type: "number",
|
|
2408
|
+
default: 0,
|
|
2409
|
+
step: 1,
|
|
2410
|
+
hiddenFromList: true
|
|
2411
|
+
};
|
|
1908
2412
|
var sequenceSchema = {
|
|
1909
2413
|
hidden: hiddenField,
|
|
2414
|
+
from: fromField,
|
|
2415
|
+
durationInFrames: durationInFramesField,
|
|
1910
2416
|
layout: {
|
|
1911
2417
|
type: "enum",
|
|
1912
2418
|
default: "absolute-fill",
|
|
@@ -2088,7 +2594,9 @@ var NoReactInternals = {
|
|
|
2088
2594
|
validateCodec,
|
|
2089
2595
|
proResProfileOptions,
|
|
2090
2596
|
findPropsToDelete,
|
|
2091
|
-
sequenceSchema
|
|
2597
|
+
sequenceSchema,
|
|
2598
|
+
parseScaleValue,
|
|
2599
|
+
serializeScaleValue
|
|
2092
2600
|
};
|
|
2093
2601
|
|
|
2094
2602
|
// src/scripts/render-video.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/vercel",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.472",
|
|
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.
|
|
27
|
-
"remotion": "4.0.
|
|
26
|
+
"@remotion/renderer": "4.0.472",
|
|
27
|
+
"remotion": "4.0.472"
|
|
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.
|
|
41
|
+
"@remotion/eslint-config-internal": "4.0.472",
|
|
42
42
|
"@vercel/blob": "2.3.0",
|
|
43
43
|
"@vercel/sandbox": "1.6.0",
|
|
44
44
|
"eslint": "9.19.0",
|