@remotion/serverless-client 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 +158 -2
  2. package/package.json +5 -5
@@ -197,6 +197,10 @@ var PERCENTAGE = NUMBER + "%";
197
197
  function call(...args) {
198
198
  return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
199
199
  }
200
+ var MODERN_VALUE = "(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";
201
+ function modernColorCall(name) {
202
+ return new RegExp(name + "\\(\\s*(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")(?:\\s*\\/\\s*(" + MODERN_VALUE + "))?\\s*\\)");
203
+ }
200
204
  function getMatchers() {
201
205
  const cachedMatchers = {
202
206
  rgb: undefined,
@@ -207,7 +211,12 @@ function getMatchers() {
207
211
  hex4: undefined,
208
212
  hex5: undefined,
209
213
  hex6: undefined,
210
- hex8: undefined
214
+ hex8: undefined,
215
+ oklch: undefined,
216
+ oklab: undefined,
217
+ lab: undefined,
218
+ lch: undefined,
219
+ hwb: undefined
211
220
  };
212
221
  if (cachedMatchers.rgb === undefined) {
213
222
  cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
@@ -218,6 +227,11 @@ function getMatchers() {
218
227
  cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
219
228
  cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
220
229
  cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
230
+ cachedMatchers.oklch = modernColorCall("oklch");
231
+ cachedMatchers.oklab = modernColorCall("oklab");
232
+ cachedMatchers.lab = modernColorCall("lab");
233
+ cachedMatchers.lch = modernColorCall("lch");
234
+ cachedMatchers.hwb = modernColorCall("hwb");
221
235
  }
222
236
  return cachedMatchers;
223
237
  }
@@ -281,6 +295,96 @@ function parsePercentage(str) {
281
295
  }
282
296
  return int / 100;
283
297
  }
298
+ function parseModernComponent(str, percentScale) {
299
+ if (str === "none")
300
+ return 0;
301
+ if (str.endsWith("%")) {
302
+ return Number.parseFloat(str) / 100 * percentScale;
303
+ }
304
+ return Number.parseFloat(str);
305
+ }
306
+ function parseHueAngle(str) {
307
+ if (str === "none")
308
+ return 0;
309
+ if (str.endsWith("rad")) {
310
+ return Number.parseFloat(str) * 180 / Math.PI;
311
+ }
312
+ if (str.endsWith("grad"))
313
+ return Number.parseFloat(str) * 0.9;
314
+ if (str.endsWith("turn"))
315
+ return Number.parseFloat(str) * 360;
316
+ return Number.parseFloat(str);
317
+ }
318
+ function parseModernAlpha(str) {
319
+ if (str === undefined || str === "none")
320
+ return 1;
321
+ if (str.endsWith("%")) {
322
+ return Math.max(0, Math.min(1, Number.parseFloat(str) / 100));
323
+ }
324
+ return Math.max(0, Math.min(1, Number.parseFloat(str)));
325
+ }
326
+ function linearToSrgb(c) {
327
+ if (c <= 0.0031308)
328
+ return 12.92 * c;
329
+ return 1.055 * c ** (1 / 2.4) - 0.055;
330
+ }
331
+ function clamp01(v) {
332
+ return Math.max(0, Math.min(1, v));
333
+ }
334
+ function rgbFloatToInt(r, g, b, alpha) {
335
+ const ri = Math.round(clamp01(r) * 255);
336
+ const gi = Math.round(clamp01(g) * 255);
337
+ const bi = Math.round(clamp01(b) * 255);
338
+ const ai = Math.round(clamp01(alpha) * 255);
339
+ return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
340
+ }
341
+ function oklabToSrgb(L, a, b) {
342
+ const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
343
+ const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
344
+ const s_ = L - 0.0894841775 * a - 1.291485548 * b;
345
+ const l = l_ * l_ * l_;
346
+ const m = m_ * m_ * m_;
347
+ const s = s_ * s_ * s_;
348
+ const rLin = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
349
+ const gLin = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
350
+ const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
351
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
352
+ }
353
+ function labToSrgb(L, a, b) {
354
+ const epsilon = 216 / 24389;
355
+ const kappa = 24389 / 27;
356
+ const Xn = 0.95047;
357
+ const Yn = 1;
358
+ const Zn = 1.08883;
359
+ const fy = (L + 16) / 116;
360
+ const fx = a / 500 + fy;
361
+ const fz = fy - b / 200;
362
+ const fx3 = fx * fx * fx;
363
+ const fz3 = fz * fz * fz;
364
+ const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
365
+ const yr = L > kappa * epsilon ? ((L + 16) / 116) ** 3 : L / kappa;
366
+ const zr = fz3 > epsilon ? fz3 : (116 * fz - 16) / kappa;
367
+ const X = xr * Xn;
368
+ const Y = yr * Yn;
369
+ const Z = zr * Zn;
370
+ const rLin = 3.2404542 * X - 1.5371385 * Y - 0.4985314 * Z;
371
+ const gLin = -0.969266 * X + 1.8760108 * Y + 0.041556 * Z;
372
+ const bLin = 0.0556434 * X - 0.2040259 * Y + 1.0572252 * Z;
373
+ return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
374
+ }
375
+ function hwbToSrgb(h, w, bk) {
376
+ if (w + bk >= 1) {
377
+ const gray = w / (w + bk);
378
+ return [gray, gray, gray];
379
+ }
380
+ const q = 1;
381
+ const p = 0;
382
+ const r = hue2rgb(p, q, h + 1 / 3);
383
+ const g = hue2rgb(p, q, h);
384
+ const bl = hue2rgb(p, q, h - 1 / 3);
385
+ const factor = 1 - w - bk;
386
+ return [r * factor + w, g * factor + w, bl * factor + w];
387
+ }
284
388
  var colorNames = {
285
389
  transparent: 0,
286
390
  aliceblue: 4042850303,
@@ -479,6 +583,58 @@ function normalizeColor(color) {
479
583
  return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
480
584
  }
481
585
  }
586
+ if (matchers.oklch) {
587
+ if (match = matchers.oklch.exec(color)) {
588
+ const L = parseModernComponent(match[1], 1);
589
+ const C = parseModernComponent(match[2], 0.4);
590
+ const H = parseHueAngle(match[3]);
591
+ const alpha = parseModernAlpha(match[4]);
592
+ const hRad = H * Math.PI / 180;
593
+ const [r, g, b] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
594
+ return rgbFloatToInt(r, g, b, alpha);
595
+ }
596
+ }
597
+ if (matchers.oklab) {
598
+ if (match = matchers.oklab.exec(color)) {
599
+ const L = parseModernComponent(match[1], 1);
600
+ const a = parseModernComponent(match[2], 0.4);
601
+ const b = parseModernComponent(match[3], 0.4);
602
+ const alpha = parseModernAlpha(match[4]);
603
+ const [r, g, bl] = oklabToSrgb(L, a, b);
604
+ return rgbFloatToInt(r, g, bl, alpha);
605
+ }
606
+ }
607
+ if (matchers.lab) {
608
+ if (match = matchers.lab.exec(color)) {
609
+ const L = parseModernComponent(match[1], 100);
610
+ const a = parseModernComponent(match[2], 125);
611
+ const b = parseModernComponent(match[3], 125);
612
+ const alpha = parseModernAlpha(match[4]);
613
+ const [r, g, bl] = labToSrgb(L, a, b);
614
+ return rgbFloatToInt(r, g, bl, alpha);
615
+ }
616
+ }
617
+ if (matchers.lch) {
618
+ if (match = matchers.lch.exec(color)) {
619
+ const L = parseModernComponent(match[1], 100);
620
+ const C = parseModernComponent(match[2], 150);
621
+ const H = parseHueAngle(match[3]);
622
+ const alpha = parseModernAlpha(match[4]);
623
+ const hRad = H * Math.PI / 180;
624
+ const [r, g, bl] = labToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
625
+ return rgbFloatToInt(r, g, bl, alpha);
626
+ }
627
+ }
628
+ if (matchers.hwb) {
629
+ if (match = matchers.hwb.exec(color)) {
630
+ const H = parseHueAngle(match[1]);
631
+ const W = parseModernComponent(match[2], 1);
632
+ const B = parseModernComponent(match[3], 1);
633
+ const alpha = parseModernAlpha(match[4]);
634
+ const [r, g, bl] = hwbToSrgb(H / 360, W, B);
635
+ return rgbFloatToInt(r, g, bl, alpha);
636
+ }
637
+ }
482
638
  throw new Error(`invalid color string ${color} provided`);
483
639
  }
484
640
  function processColor(color) {
@@ -843,7 +999,7 @@ var validateFramesPerFunction = ({
843
999
  import * as tty from "tty";
844
1000
 
845
1001
  // ../core/dist/esm/version.mjs
846
- var VERSION = "4.0.438";
1002
+ var VERSION = "4.0.439";
847
1003
 
848
1004
  // ../renderer/dist/esm/error-handling.mjs
849
1005
  var isColorSupported = () => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/serverless-client"
4
4
  },
5
5
  "name": "@remotion/serverless-client",
6
- "version": "4.0.438",
6
+ "version": "4.0.439",
7
7
  "main": "dist",
8
8
  "sideEffects": false,
9
9
  "scripts": {
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "dependencies": {},
26
26
  "devDependencies": {
27
- "remotion": "4.0.438",
28
- "@remotion/streaming": "4.0.438",
29
- "@remotion/renderer": "4.0.438",
30
- "@remotion/eslint-config-internal": "4.0.438",
27
+ "remotion": "4.0.439",
28
+ "@remotion/streaming": "4.0.439",
29
+ "@remotion/renderer": "4.0.439",
30
+ "@remotion/eslint-config-internal": "4.0.439",
31
31
  "eslint": "9.19.0",
32
32
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
33
33
  },