@remotion/vercel 4.0.438 → 4.0.440

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 +316 -2
  2. package/package.json +4 -4
@@ -217,6 +217,10 @@ var PERCENTAGE = NUMBER + "%";
217
217
  function call(...args) {
218
218
  return "\\\\(\\\\s*(" + args.join(")\\\\s*,\\\\s*(") + ")\\\\s*\\\\)";
219
219
  }
220
+ var MODERN_VALUE = "(?:none|[-+]?\\\\d*\\\\.?\\\\d+(?:%|deg|rad|grad|turn)?)";
221
+ function modernColorCall(name) {
222
+ return new RegExp(name + "\\\\(\\\\s*(" + MODERN_VALUE + ")\\\\s+(" + MODERN_VALUE + ")\\\\s+(" + MODERN_VALUE + ")(?:\\\\s*\\\\/\\\\s*(" + MODERN_VALUE + "))?\\\\s*\\\\)");
223
+ }
220
224
  function getMatchers() {
221
225
  const cachedMatchers = {
222
226
  rgb: undefined,
@@ -227,7 +231,12 @@ function getMatchers() {
227
231
  hex4: undefined,
228
232
  hex5: undefined,
229
233
  hex6: undefined,
230
- hex8: undefined
234
+ hex8: undefined,
235
+ oklch: undefined,
236
+ oklab: undefined,
237
+ lab: undefined,
238
+ lch: undefined,
239
+ hwb: undefined
231
240
  };
232
241
  if (cachedMatchers.rgb === undefined) {
233
242
  cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
@@ -238,6 +247,11 @@ function getMatchers() {
238
247
  cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
239
248
  cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
240
249
  cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
250
+ cachedMatchers.oklch = modernColorCall("oklch");
251
+ cachedMatchers.oklab = modernColorCall("oklab");
252
+ cachedMatchers.lab = modernColorCall("lab");
253
+ cachedMatchers.lch = modernColorCall("lch");
254
+ cachedMatchers.hwb = modernColorCall("hwb");
241
255
  }
242
256
  return cachedMatchers;
243
257
  }
@@ -301,6 +315,96 @@ function parsePercentage(str) {
301
315
  }
302
316
  return int / 100;
303
317
  }
318
+ function parseModernComponent(str, percentScale) {
319
+ if (str === "none")
320
+ return 0;
321
+ if (str.endsWith("%")) {
322
+ return Number.parseFloat(str) / 100 * percentScale;
323
+ }
324
+ return Number.parseFloat(str);
325
+ }
326
+ function parseHueAngle(str) {
327
+ if (str === "none")
328
+ return 0;
329
+ if (str.endsWith("rad")) {
330
+ return Number.parseFloat(str) * 180 / Math.PI;
331
+ }
332
+ if (str.endsWith("grad"))
333
+ return Number.parseFloat(str) * 0.9;
334
+ if (str.endsWith("turn"))
335
+ return Number.parseFloat(str) * 360;
336
+ return Number.parseFloat(str);
337
+ }
338
+ function parseModernAlpha(str) {
339
+ if (str === undefined || str === "none")
340
+ return 1;
341
+ if (str.endsWith("%")) {
342
+ return Math.max(0, Math.min(1, Number.parseFloat(str) / 100));
343
+ }
344
+ return Math.max(0, Math.min(1, Number.parseFloat(str)));
345
+ }
346
+ function linearToSrgb(c) {
347
+ if (c <= 0.0031308)
348
+ return 12.92 * c;
349
+ return 1.055 * c ** (1 / 2.4) - 0.055;
350
+ }
351
+ function clamp01(v) {
352
+ return Math.max(0, Math.min(1, v));
353
+ }
354
+ function rgbFloatToInt(r, g, b, alpha) {
355
+ const ri = Math.round(clamp01(r) * 255);
356
+ const gi = Math.round(clamp01(g) * 255);
357
+ const bi = Math.round(clamp01(b) * 255);
358
+ const ai = Math.round(clamp01(alpha) * 255);
359
+ return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
360
+ }
361
+ function oklabToSrgb(L, a, b) {
362
+ const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
363
+ const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
364
+ const s_ = L - 0.0894841775 * a - 1.291485548 * b;
365
+ const l = l_ * l_ * l_;
366
+ const m = m_ * m_ * m_;
367
+ const s = s_ * s_ * s_;
368
+ const rLin = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
369
+ const gLin = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
370
+ const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
371
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
372
+ }
373
+ function labToSrgb(L, a, b) {
374
+ const epsilon = 216 / 24389;
375
+ const kappa = 24389 / 27;
376
+ const Xn = 0.95047;
377
+ const Yn = 1;
378
+ const Zn = 1.08883;
379
+ const fy = (L + 16) / 116;
380
+ const fx = a / 500 + fy;
381
+ const fz = fy - b / 200;
382
+ const fx3 = fx * fx * fx;
383
+ const fz3 = fz * fz * fz;
384
+ const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
385
+ const yr = L > kappa * epsilon ? ((L + 16) / 116) ** 3 : L / kappa;
386
+ const zr = fz3 > epsilon ? fz3 : (116 * fz - 16) / kappa;
387
+ const X = xr * Xn;
388
+ const Y = yr * Yn;
389
+ const Z = zr * Zn;
390
+ const rLin = 3.2404542 * X - 1.5371385 * Y - 0.4985314 * Z;
391
+ const gLin = -0.969266 * X + 1.8760108 * Y + 0.041556 * Z;
392
+ const bLin = 0.0556434 * X - 0.2040259 * Y + 1.0572252 * Z;
393
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
394
+ }
395
+ function hwbToSrgb(h, w, bk) {
396
+ if (w + bk >= 1) {
397
+ const gray = w / (w + bk);
398
+ return [gray, gray, gray];
399
+ }
400
+ const q = 1;
401
+ const p = 0;
402
+ const r = hue2rgb(p, q, h + 1 / 3);
403
+ const g = hue2rgb(p, q, h);
404
+ const bl = hue2rgb(p, q, h - 1 / 3);
405
+ const factor = 1 - w - bk;
406
+ return [r * factor + w, g * factor + w, bl * factor + w];
407
+ }
304
408
  var colorNames = {
305
409
  transparent: 0,
306
410
  aliceblue: 4042850303,
@@ -499,6 +603,58 @@ function normalizeColor(color) {
499
603
  return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
500
604
  }
501
605
  }
606
+ if (matchers.oklch) {
607
+ if (match = matchers.oklch.exec(color)) {
608
+ const L = parseModernComponent(match[1], 1);
609
+ const C = parseModernComponent(match[2], 0.4);
610
+ const H = parseHueAngle(match[3]);
611
+ const alpha = parseModernAlpha(match[4]);
612
+ const hRad = H * Math.PI / 180;
613
+ const [r, g, b] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
614
+ return rgbFloatToInt(r, g, b, alpha);
615
+ }
616
+ }
617
+ if (matchers.oklab) {
618
+ if (match = matchers.oklab.exec(color)) {
619
+ const L = parseModernComponent(match[1], 1);
620
+ const a = parseModernComponent(match[2], 0.4);
621
+ const b = parseModernComponent(match[3], 0.4);
622
+ const alpha = parseModernAlpha(match[4]);
623
+ const [r, g, bl] = oklabToSrgb(L, a, b);
624
+ return rgbFloatToInt(r, g, bl, alpha);
625
+ }
626
+ }
627
+ if (matchers.lab) {
628
+ if (match = matchers.lab.exec(color)) {
629
+ const L = parseModernComponent(match[1], 100);
630
+ const a = parseModernComponent(match[2], 125);
631
+ const b = parseModernComponent(match[3], 125);
632
+ const alpha = parseModernAlpha(match[4]);
633
+ const [r, g, bl] = labToSrgb(L, a, b);
634
+ return rgbFloatToInt(r, g, bl, alpha);
635
+ }
636
+ }
637
+ if (matchers.lch) {
638
+ if (match = matchers.lch.exec(color)) {
639
+ const L = parseModernComponent(match[1], 100);
640
+ const C = parseModernComponent(match[2], 150);
641
+ const H = parseHueAngle(match[3]);
642
+ const alpha = parseModernAlpha(match[4]);
643
+ const hRad = H * Math.PI / 180;
644
+ const [r, g, bl] = labToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
645
+ return rgbFloatToInt(r, g, bl, alpha);
646
+ }
647
+ }
648
+ if (matchers.hwb) {
649
+ if (match = matchers.hwb.exec(color)) {
650
+ const H = parseHueAngle(match[1]);
651
+ const W = parseModernComponent(match[2], 1);
652
+ const B = parseModernComponent(match[3], 1);
653
+ const alpha = parseModernAlpha(match[4]);
654
+ const [r, g, bl] = hwbToSrgb(H / 360, W, B);
655
+ return rgbFloatToInt(r, g, bl, alpha);
656
+ }
657
+ }
502
658
  throw new Error(\`invalid color string \${color} provided\`);
503
659
  }
504
660
  function processColor(color) {
@@ -543,6 +699,7 @@ var validCodecs = [
543
699
  "h265",
544
700
  "vp8",
545
701
  "vp9",
702
+ "av1",
546
703
  "mp3",
547
704
  "aac",
548
705
  "wav",
@@ -953,6 +1110,10 @@ var PERCENTAGE = NUMBER + "%";
953
1110
  function call(...args) {
954
1111
  return "\\\\(\\\\s*(" + args.join(")\\\\s*,\\\\s*(") + ")\\\\s*\\\\)";
955
1112
  }
1113
+ var MODERN_VALUE = "(?:none|[-+]?\\\\d*\\\\.?\\\\d+(?:%|deg|rad|grad|turn)?)";
1114
+ function modernColorCall(name) {
1115
+ return new RegExp(name + "\\\\(\\\\s*(" + MODERN_VALUE + ")\\\\s+(" + MODERN_VALUE + ")\\\\s+(" + MODERN_VALUE + ")(?:\\\\s*\\\\/\\\\s*(" + MODERN_VALUE + "))?\\\\s*\\\\)");
1116
+ }
956
1117
  function getMatchers() {
957
1118
  const cachedMatchers = {
958
1119
  rgb: undefined,
@@ -963,7 +1124,12 @@ function getMatchers() {
963
1124
  hex4: undefined,
964
1125
  hex5: undefined,
965
1126
  hex6: undefined,
966
- hex8: undefined
1127
+ hex8: undefined,
1128
+ oklch: undefined,
1129
+ oklab: undefined,
1130
+ lab: undefined,
1131
+ lch: undefined,
1132
+ hwb: undefined
967
1133
  };
968
1134
  if (cachedMatchers.rgb === undefined) {
969
1135
  cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
@@ -974,6 +1140,11 @@ function getMatchers() {
974
1140
  cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
975
1141
  cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
976
1142
  cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
1143
+ cachedMatchers.oklch = modernColorCall("oklch");
1144
+ cachedMatchers.oklab = modernColorCall("oklab");
1145
+ cachedMatchers.lab = modernColorCall("lab");
1146
+ cachedMatchers.lch = modernColorCall("lch");
1147
+ cachedMatchers.hwb = modernColorCall("hwb");
977
1148
  }
978
1149
  return cachedMatchers;
979
1150
  }
@@ -1037,6 +1208,96 @@ function parsePercentage(str) {
1037
1208
  }
1038
1209
  return int / 100;
1039
1210
  }
1211
+ function parseModernComponent(str, percentScale) {
1212
+ if (str === "none")
1213
+ return 0;
1214
+ if (str.endsWith("%")) {
1215
+ return Number.parseFloat(str) / 100 * percentScale;
1216
+ }
1217
+ return Number.parseFloat(str);
1218
+ }
1219
+ function parseHueAngle(str) {
1220
+ if (str === "none")
1221
+ return 0;
1222
+ if (str.endsWith("rad")) {
1223
+ return Number.parseFloat(str) * 180 / Math.PI;
1224
+ }
1225
+ if (str.endsWith("grad"))
1226
+ return Number.parseFloat(str) * 0.9;
1227
+ if (str.endsWith("turn"))
1228
+ return Number.parseFloat(str) * 360;
1229
+ return Number.parseFloat(str);
1230
+ }
1231
+ function parseModernAlpha(str) {
1232
+ if (str === undefined || str === "none")
1233
+ return 1;
1234
+ if (str.endsWith("%")) {
1235
+ return Math.max(0, Math.min(1, Number.parseFloat(str) / 100));
1236
+ }
1237
+ return Math.max(0, Math.min(1, Number.parseFloat(str)));
1238
+ }
1239
+ function linearToSrgb(c) {
1240
+ if (c <= 0.0031308)
1241
+ return 12.92 * c;
1242
+ return 1.055 * c ** (1 / 2.4) - 0.055;
1243
+ }
1244
+ function clamp01(v) {
1245
+ return Math.max(0, Math.min(1, v));
1246
+ }
1247
+ function rgbFloatToInt(r, g, b, alpha) {
1248
+ const ri = Math.round(clamp01(r) * 255);
1249
+ const gi = Math.round(clamp01(g) * 255);
1250
+ const bi = Math.round(clamp01(b) * 255);
1251
+ const ai = Math.round(clamp01(alpha) * 255);
1252
+ return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
1253
+ }
1254
+ function oklabToSrgb(L, a, b) {
1255
+ const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
1256
+ const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
1257
+ const s_ = L - 0.0894841775 * a - 1.291485548 * b;
1258
+ const l = l_ * l_ * l_;
1259
+ const m = m_ * m_ * m_;
1260
+ const s = s_ * s_ * s_;
1261
+ const rLin = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
1262
+ const gLin = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
1263
+ const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
1264
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
1265
+ }
1266
+ function labToSrgb(L, a, b) {
1267
+ const epsilon = 216 / 24389;
1268
+ const kappa = 24389 / 27;
1269
+ const Xn = 0.95047;
1270
+ const Yn = 1;
1271
+ const Zn = 1.08883;
1272
+ const fy = (L + 16) / 116;
1273
+ const fx = a / 500 + fy;
1274
+ const fz = fy - b / 200;
1275
+ const fx3 = fx * fx * fx;
1276
+ const fz3 = fz * fz * fz;
1277
+ const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
1278
+ const yr = L > kappa * epsilon ? ((L + 16) / 116) ** 3 : L / kappa;
1279
+ const zr = fz3 > epsilon ? fz3 : (116 * fz - 16) / kappa;
1280
+ const X = xr * Xn;
1281
+ const Y = yr * Yn;
1282
+ const Z = zr * Zn;
1283
+ const rLin = 3.2404542 * X - 1.5371385 * Y - 0.4985314 * Z;
1284
+ const gLin = -0.969266 * X + 1.8760108 * Y + 0.041556 * Z;
1285
+ const bLin = 0.0556434 * X - 0.2040259 * Y + 1.0572252 * Z;
1286
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
1287
+ }
1288
+ function hwbToSrgb(h, w, bk) {
1289
+ if (w + bk >= 1) {
1290
+ const gray = w / (w + bk);
1291
+ return [gray, gray, gray];
1292
+ }
1293
+ const q = 1;
1294
+ const p = 0;
1295
+ const r = hue2rgb(p, q, h + 1 / 3);
1296
+ const g = hue2rgb(p, q, h);
1297
+ const bl = hue2rgb(p, q, h - 1 / 3);
1298
+ const factor = 1 - w - bk;
1299
+ return [r * factor + w, g * factor + w, bl * factor + w];
1300
+ }
1040
1301
  var colorNames = {
1041
1302
  transparent: 0,
1042
1303
  aliceblue: 4042850303,
@@ -1235,6 +1496,58 @@ function normalizeColor(color) {
1235
1496
  return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
1236
1497
  }
1237
1498
  }
1499
+ if (matchers.oklch) {
1500
+ if (match = matchers.oklch.exec(color)) {
1501
+ const L = parseModernComponent(match[1], 1);
1502
+ const C = parseModernComponent(match[2], 0.4);
1503
+ const H = parseHueAngle(match[3]);
1504
+ const alpha = parseModernAlpha(match[4]);
1505
+ const hRad = H * Math.PI / 180;
1506
+ const [r, g, b] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
1507
+ return rgbFloatToInt(r, g, b, alpha);
1508
+ }
1509
+ }
1510
+ if (matchers.oklab) {
1511
+ if (match = matchers.oklab.exec(color)) {
1512
+ const L = parseModernComponent(match[1], 1);
1513
+ const a = parseModernComponent(match[2], 0.4);
1514
+ const b = parseModernComponent(match[3], 0.4);
1515
+ const alpha = parseModernAlpha(match[4]);
1516
+ const [r, g, bl] = oklabToSrgb(L, a, b);
1517
+ return rgbFloatToInt(r, g, bl, alpha);
1518
+ }
1519
+ }
1520
+ if (matchers.lab) {
1521
+ if (match = matchers.lab.exec(color)) {
1522
+ const L = parseModernComponent(match[1], 100);
1523
+ const a = parseModernComponent(match[2], 125);
1524
+ const b = parseModernComponent(match[3], 125);
1525
+ const alpha = parseModernAlpha(match[4]);
1526
+ const [r, g, bl] = labToSrgb(L, a, b);
1527
+ return rgbFloatToInt(r, g, bl, alpha);
1528
+ }
1529
+ }
1530
+ if (matchers.lch) {
1531
+ if (match = matchers.lch.exec(color)) {
1532
+ const L = parseModernComponent(match[1], 100);
1533
+ const C = parseModernComponent(match[2], 150);
1534
+ const H = parseHueAngle(match[3]);
1535
+ const alpha = parseModernAlpha(match[4]);
1536
+ const hRad = H * Math.PI / 180;
1537
+ const [r, g, bl] = labToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
1538
+ return rgbFloatToInt(r, g, bl, alpha);
1539
+ }
1540
+ }
1541
+ if (matchers.hwb) {
1542
+ if (match = matchers.hwb.exec(color)) {
1543
+ const H = parseHueAngle(match[1]);
1544
+ const W = parseModernComponent(match[2], 1);
1545
+ const B = parseModernComponent(match[3], 1);
1546
+ const alpha = parseModernAlpha(match[4]);
1547
+ const [r, g, bl] = hwbToSrgb(H / 360, W, B);
1548
+ return rgbFloatToInt(r, g, bl, alpha);
1549
+ }
1550
+ }
1238
1551
  throw new Error(\`invalid color string \${color} provided\`);
1239
1552
  }
1240
1553
  function processColor(color) {
@@ -1279,6 +1592,7 @@ var validCodecs = [
1279
1592
  "h265",
1280
1593
  "vp8",
1281
1594
  "vp9",
1595
+ "av1",
1282
1596
  "mp3",
1283
1597
  "aac",
1284
1598
  "wav",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.438",
3
+ "version": "4.0.440",
4
4
  "description": "Render Remotion videos on Vercel Sandbox",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/remotion-dev/remotion/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@remotion/renderer": "4.0.438",
28
- "remotion": "4.0.438"
27
+ "@remotion/renderer": "4.0.440",
28
+ "remotion": "4.0.440"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@vercel/sandbox": ">=1.0.0"
@@ -39,7 +39,7 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "devDependencies": {
42
- "@remotion/eslint-config-internal": "4.0.438",
42
+ "@remotion/eslint-config-internal": "4.0.440",
43
43
  "@vercel/blob": "2.3.0",
44
44
  "@vercel/sandbox": "1.6.0",
45
45
  "eslint": "9.19.0",