@remotion/vercel 4.0.438 → 4.0.439

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 +314 -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) {
@@ -953,6 +1109,10 @@ var PERCENTAGE = NUMBER + "%";
953
1109
  function call(...args) {
954
1110
  return "\\\\(\\\\s*(" + args.join(")\\\\s*,\\\\s*(") + ")\\\\s*\\\\)";
955
1111
  }
1112
+ var MODERN_VALUE = "(?:none|[-+]?\\\\d*\\\\.?\\\\d+(?:%|deg|rad|grad|turn)?)";
1113
+ function modernColorCall(name) {
1114
+ return new RegExp(name + "\\\\(\\\\s*(" + MODERN_VALUE + ")\\\\s+(" + MODERN_VALUE + ")\\\\s+(" + MODERN_VALUE + ")(?:\\\\s*\\\\/\\\\s*(" + MODERN_VALUE + "))?\\\\s*\\\\)");
1115
+ }
956
1116
  function getMatchers() {
957
1117
  const cachedMatchers = {
958
1118
  rgb: undefined,
@@ -963,7 +1123,12 @@ function getMatchers() {
963
1123
  hex4: undefined,
964
1124
  hex5: undefined,
965
1125
  hex6: undefined,
966
- hex8: undefined
1126
+ hex8: undefined,
1127
+ oklch: undefined,
1128
+ oklab: undefined,
1129
+ lab: undefined,
1130
+ lch: undefined,
1131
+ hwb: undefined
967
1132
  };
968
1133
  if (cachedMatchers.rgb === undefined) {
969
1134
  cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
@@ -974,6 +1139,11 @@ function getMatchers() {
974
1139
  cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
975
1140
  cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
976
1141
  cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
1142
+ cachedMatchers.oklch = modernColorCall("oklch");
1143
+ cachedMatchers.oklab = modernColorCall("oklab");
1144
+ cachedMatchers.lab = modernColorCall("lab");
1145
+ cachedMatchers.lch = modernColorCall("lch");
1146
+ cachedMatchers.hwb = modernColorCall("hwb");
977
1147
  }
978
1148
  return cachedMatchers;
979
1149
  }
@@ -1037,6 +1207,96 @@ function parsePercentage(str) {
1037
1207
  }
1038
1208
  return int / 100;
1039
1209
  }
1210
+ function parseModernComponent(str, percentScale) {
1211
+ if (str === "none")
1212
+ return 0;
1213
+ if (str.endsWith("%")) {
1214
+ return Number.parseFloat(str) / 100 * percentScale;
1215
+ }
1216
+ return Number.parseFloat(str);
1217
+ }
1218
+ function parseHueAngle(str) {
1219
+ if (str === "none")
1220
+ return 0;
1221
+ if (str.endsWith("rad")) {
1222
+ return Number.parseFloat(str) * 180 / Math.PI;
1223
+ }
1224
+ if (str.endsWith("grad"))
1225
+ return Number.parseFloat(str) * 0.9;
1226
+ if (str.endsWith("turn"))
1227
+ return Number.parseFloat(str) * 360;
1228
+ return Number.parseFloat(str);
1229
+ }
1230
+ function parseModernAlpha(str) {
1231
+ if (str === undefined || str === "none")
1232
+ return 1;
1233
+ if (str.endsWith("%")) {
1234
+ return Math.max(0, Math.min(1, Number.parseFloat(str) / 100));
1235
+ }
1236
+ return Math.max(0, Math.min(1, Number.parseFloat(str)));
1237
+ }
1238
+ function linearToSrgb(c) {
1239
+ if (c <= 0.0031308)
1240
+ return 12.92 * c;
1241
+ return 1.055 * c ** (1 / 2.4) - 0.055;
1242
+ }
1243
+ function clamp01(v) {
1244
+ return Math.max(0, Math.min(1, v));
1245
+ }
1246
+ function rgbFloatToInt(r, g, b, alpha) {
1247
+ const ri = Math.round(clamp01(r) * 255);
1248
+ const gi = Math.round(clamp01(g) * 255);
1249
+ const bi = Math.round(clamp01(b) * 255);
1250
+ const ai = Math.round(clamp01(alpha) * 255);
1251
+ return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
1252
+ }
1253
+ function oklabToSrgb(L, a, b) {
1254
+ const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
1255
+ const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
1256
+ const s_ = L - 0.0894841775 * a - 1.291485548 * b;
1257
+ const l = l_ * l_ * l_;
1258
+ const m = m_ * m_ * m_;
1259
+ const s = s_ * s_ * s_;
1260
+ const rLin = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
1261
+ const gLin = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
1262
+ const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
1263
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
1264
+ }
1265
+ function labToSrgb(L, a, b) {
1266
+ const epsilon = 216 / 24389;
1267
+ const kappa = 24389 / 27;
1268
+ const Xn = 0.95047;
1269
+ const Yn = 1;
1270
+ const Zn = 1.08883;
1271
+ const fy = (L + 16) / 116;
1272
+ const fx = a / 500 + fy;
1273
+ const fz = fy - b / 200;
1274
+ const fx3 = fx * fx * fx;
1275
+ const fz3 = fz * fz * fz;
1276
+ const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
1277
+ const yr = L > kappa * epsilon ? ((L + 16) / 116) ** 3 : L / kappa;
1278
+ const zr = fz3 > epsilon ? fz3 : (116 * fz - 16) / kappa;
1279
+ const X = xr * Xn;
1280
+ const Y = yr * Yn;
1281
+ const Z = zr * Zn;
1282
+ const rLin = 3.2404542 * X - 1.5371385 * Y - 0.4985314 * Z;
1283
+ const gLin = -0.969266 * X + 1.8760108 * Y + 0.041556 * Z;
1284
+ const bLin = 0.0556434 * X - 0.2040259 * Y + 1.0572252 * Z;
1285
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
1286
+ }
1287
+ function hwbToSrgb(h, w, bk) {
1288
+ if (w + bk >= 1) {
1289
+ const gray = w / (w + bk);
1290
+ return [gray, gray, gray];
1291
+ }
1292
+ const q = 1;
1293
+ const p = 0;
1294
+ const r = hue2rgb(p, q, h + 1 / 3);
1295
+ const g = hue2rgb(p, q, h);
1296
+ const bl = hue2rgb(p, q, h - 1 / 3);
1297
+ const factor = 1 - w - bk;
1298
+ return [r * factor + w, g * factor + w, bl * factor + w];
1299
+ }
1040
1300
  var colorNames = {
1041
1301
  transparent: 0,
1042
1302
  aliceblue: 4042850303,
@@ -1235,6 +1495,58 @@ function normalizeColor(color) {
1235
1495
  return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
1236
1496
  }
1237
1497
  }
1498
+ if (matchers.oklch) {
1499
+ if (match = matchers.oklch.exec(color)) {
1500
+ const L = parseModernComponent(match[1], 1);
1501
+ const C = parseModernComponent(match[2], 0.4);
1502
+ const H = parseHueAngle(match[3]);
1503
+ const alpha = parseModernAlpha(match[4]);
1504
+ const hRad = H * Math.PI / 180;
1505
+ const [r, g, b] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
1506
+ return rgbFloatToInt(r, g, b, alpha);
1507
+ }
1508
+ }
1509
+ if (matchers.oklab) {
1510
+ if (match = matchers.oklab.exec(color)) {
1511
+ const L = parseModernComponent(match[1], 1);
1512
+ const a = parseModernComponent(match[2], 0.4);
1513
+ const b = parseModernComponent(match[3], 0.4);
1514
+ const alpha = parseModernAlpha(match[4]);
1515
+ const [r, g, bl] = oklabToSrgb(L, a, b);
1516
+ return rgbFloatToInt(r, g, bl, alpha);
1517
+ }
1518
+ }
1519
+ if (matchers.lab) {
1520
+ if (match = matchers.lab.exec(color)) {
1521
+ const L = parseModernComponent(match[1], 100);
1522
+ const a = parseModernComponent(match[2], 125);
1523
+ const b = parseModernComponent(match[3], 125);
1524
+ const alpha = parseModernAlpha(match[4]);
1525
+ const [r, g, bl] = labToSrgb(L, a, b);
1526
+ return rgbFloatToInt(r, g, bl, alpha);
1527
+ }
1528
+ }
1529
+ if (matchers.lch) {
1530
+ if (match = matchers.lch.exec(color)) {
1531
+ const L = parseModernComponent(match[1], 100);
1532
+ const C = parseModernComponent(match[2], 150);
1533
+ const H = parseHueAngle(match[3]);
1534
+ const alpha = parseModernAlpha(match[4]);
1535
+ const hRad = H * Math.PI / 180;
1536
+ const [r, g, bl] = labToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
1537
+ return rgbFloatToInt(r, g, bl, alpha);
1538
+ }
1539
+ }
1540
+ if (matchers.hwb) {
1541
+ if (match = matchers.hwb.exec(color)) {
1542
+ const H = parseHueAngle(match[1]);
1543
+ const W = parseModernComponent(match[2], 1);
1544
+ const B = parseModernComponent(match[3], 1);
1545
+ const alpha = parseModernAlpha(match[4]);
1546
+ const [r, g, bl] = hwbToSrgb(H / 360, W, B);
1547
+ return rgbFloatToInt(r, g, bl, alpha);
1548
+ }
1549
+ }
1238
1550
  throw new Error(\`invalid color string \${color} provided\`);
1239
1551
  }
1240
1552
  function processColor(color) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.438",
3
+ "version": "4.0.439",
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.439",
28
+ "remotion": "4.0.439"
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.439",
43
43
  "@vercel/blob": "2.3.0",
44
44
  "@vercel/sandbox": "1.6.0",
45
45
  "eslint": "9.19.0",