@terrazzo/plugin-css 0.9.0 → 0.10.0

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/index.js CHANGED
@@ -255,28 +255,28 @@ const modes = {};
255
255
  const parsers = [];
256
256
  const colorProfiles = {};
257
257
  const identity = (v) => v;
258
- const useMode = (definition$15) => {
259
- converters$1[definition$15.mode] = {
260
- ...converters$1[definition$15.mode],
261
- ...definition$15.toMode
258
+ const useMode = (definition$16) => {
259
+ converters$1[definition$16.mode] = {
260
+ ...converters$1[definition$16.mode],
261
+ ...definition$16.toMode
262
262
  };
263
- Object.keys(definition$15.fromMode || {}).forEach((k$2) => {
264
- if (!converters$1[k$2]) converters$1[k$2] = {};
265
- converters$1[k$2][definition$15.mode] = definition$15.fromMode[k$2];
263
+ Object.keys(definition$16.fromMode || {}).forEach((k$3) => {
264
+ if (!converters$1[k$3]) converters$1[k$3] = {};
265
+ converters$1[k$3][definition$16.mode] = definition$16.fromMode[k$3];
266
266
  });
267
- if (!definition$15.ranges) definition$15.ranges = {};
268
- if (!definition$15.difference) definition$15.difference = {};
269
- definition$15.channels.forEach((channel) => {
270
- if (definition$15.ranges[channel] === void 0) definition$15.ranges[channel] = [0, 1];
271
- if (!definition$15.interpolate[channel]) throw new Error(`Missing interpolator for: ${channel}`);
272
- if (typeof definition$15.interpolate[channel] === "function") definition$15.interpolate[channel] = { use: definition$15.interpolate[channel] };
273
- if (!definition$15.interpolate[channel].fixup) definition$15.interpolate[channel].fixup = identity;
267
+ if (!definition$16.ranges) definition$16.ranges = {};
268
+ if (!definition$16.difference) definition$16.difference = {};
269
+ definition$16.channels.forEach((channel) => {
270
+ if (definition$16.ranges[channel] === void 0) definition$16.ranges[channel] = [0, 1];
271
+ if (!definition$16.interpolate[channel]) throw new Error(`Missing interpolator for: ${channel}`);
272
+ if (typeof definition$16.interpolate[channel] === "function") definition$16.interpolate[channel] = { use: definition$16.interpolate[channel] };
273
+ if (!definition$16.interpolate[channel].fixup) definition$16.interpolate[channel].fixup = identity;
274
274
  });
275
- modes[definition$15.mode] = definition$15;
276
- (definition$15.parse || []).forEach((parser) => {
277
- useParser(parser, definition$15.mode);
275
+ modes[definition$16.mode] = definition$16;
276
+ (definition$16.parse || []).forEach((parser) => {
277
+ useParser(parser, definition$16.mode);
278
278
  });
279
- return converter_default(definition$15.mode);
279
+ return converter_default(definition$16.mode);
280
280
  };
281
281
  const getMode = (mode) => modes[mode];
282
282
  const useParser = (parser, mode) => {
@@ -615,7 +615,7 @@ const fixupAlpha = (arr) => {
615
615
 
616
616
  //#endregion
617
617
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/rgb/definition.js
618
- const definition$14 = {
618
+ const definition$15 = {
619
619
  mode: "rgb",
620
620
  channels: [
621
621
  "r",
@@ -653,7 +653,7 @@ const definition$14 = {
653
653
  b: 0
654
654
  }
655
655
  };
656
- var definition_default$12 = definition$14;
656
+ var definition_default$12 = definition$15;
657
657
 
658
658
  //#endregion
659
659
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/a98/convertA98ToXyz65.js
@@ -693,7 +693,7 @@ var convertXyz65ToA98_default = convertXyz65ToA98;
693
693
 
694
694
  //#endregion
695
695
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lrgb/convertRgbToLrgb.js
696
- const fn$2 = (c$1 = 0) => {
696
+ const fn$3 = (c$1 = 0) => {
697
697
  const abs = Math.abs(c$1);
698
698
  if (abs <= .04045) return c$1 / 12.92;
699
699
  return (Math.sign(c$1) || 1) * Math.pow((abs + .055) / 1.055, 2.4);
@@ -701,9 +701,9 @@ const fn$2 = (c$1 = 0) => {
701
701
  const convertRgbToLrgb = ({ r: r$1, g, b, alpha }) => {
702
702
  let res = {
703
703
  mode: "lrgb",
704
- r: fn$2(r$1),
705
- g: fn$2(g),
706
- b: fn$2(b)
704
+ r: fn$3(r$1),
705
+ g: fn$3(g),
706
+ b: fn$3(b)
707
707
  };
708
708
  if (alpha !== void 0) res.alpha = alpha;
709
709
  return res;
@@ -727,7 +727,7 @@ var convertRgbToXyz65_default = convertRgbToXyz65;
727
727
 
728
728
  //#endregion
729
729
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lrgb/convertLrgbToRgb.js
730
- const fn$1 = (c$1 = 0) => {
730
+ const fn$2 = (c$1 = 0) => {
731
731
  const abs = Math.abs(c$1);
732
732
  if (abs > .0031308) return (Math.sign(c$1) || 1) * (1.055 * Math.pow(abs, 1 / 2.4) - .055);
733
733
  return c$1 * 12.92;
@@ -735,9 +735,9 @@ const fn$1 = (c$1 = 0) => {
735
735
  const convertLrgbToRgb = ({ r: r$1, g, b, alpha }, mode = "rgb") => {
736
736
  let res = {
737
737
  mode,
738
- r: fn$1(r$1),
739
- g: fn$1(g),
740
- b: fn$1(b)
738
+ r: fn$2(r$1),
739
+ g: fn$2(g),
740
+ b: fn$2(b)
741
741
  };
742
742
  if (alpha !== void 0) res.alpha = alpha;
743
743
  return res;
@@ -762,7 +762,7 @@ var convertXyz65ToRgb_default = convertXyz65ToRgb;
762
762
 
763
763
  //#endregion
764
764
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/a98/definition.js
765
- const definition$13 = {
765
+ const definition$14 = {
766
766
  ...definition_default$12,
767
767
  mode: "a98",
768
768
  parse: ["a98-rgb"],
@@ -776,7 +776,7 @@ const definition$13 = {
776
776
  xyz65: convertA98ToXyz65_default
777
777
  }
778
778
  };
779
- var definition_default = definition$13;
779
+ var definition_default = definition$14;
780
780
 
781
781
  //#endregion
782
782
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/util/normalizeHue.js
@@ -917,12 +917,12 @@ var parseHsl_default = parseHsl;
917
917
 
918
918
  //#endregion
919
919
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/fixup/hue.js
920
- const hue = (hues, fn$3) => {
920
+ const hue = (hues, fn$4) => {
921
921
  return hues.map((hue$2, idx, arr) => {
922
922
  if (hue$2 === void 0) return hue$2;
923
923
  let normalized = normalizeHue_default(hue$2);
924
924
  if (idx === 0 || hues[idx - 1] === void 0) return normalized;
925
- return fn$3(normalized - normalizeHue_default(arr[idx - 1]));
925
+ return fn$4(normalized - normalizeHue_default(arr[idx - 1]));
926
926
  }).reduce((acc, curr) => {
927
927
  if (!acc.length || curr === void 0 || acc[acc.length - 1] === void 0) {
928
928
  acc.push(curr);
@@ -970,8 +970,8 @@ const differenceEuclidean = (mode = "rgb", weights = [
970
970
  return (std, smp) => {
971
971
  let ConvStd = conv(std);
972
972
  let ConvSmp = conv(smp);
973
- return Math.sqrt(channels.reduce((sum, k$2, idx) => {
974
- let delta = diffs[k$2] ? diffs[k$2](ConvStd, ConvSmp) : ConvStd[k$2] - ConvSmp[k$2];
973
+ return Math.sqrt(channels.reduce((sum, k$3, idx) => {
974
+ let delta = diffs[k$3] ? diffs[k$3](ConvStd, ConvSmp) : ConvStd[k$3] - ConvSmp[k$3];
975
975
  return sum + (weights[idx] || 0) * Math.pow(isNaN(delta) ? 0 : delta, 2);
976
976
  }, 0));
977
977
  };
@@ -997,7 +997,7 @@ const averageAngle = (val) => {
997
997
 
998
998
  //#endregion
999
999
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsl/definition.js
1000
- const definition$12 = {
1000
+ const definition$13 = {
1001
1001
  mode: "hsl",
1002
1002
  toMode: { rgb: convertHslToRgb },
1003
1003
  fromMode: { rgb: convertRgbToHsl },
@@ -1026,7 +1026,7 @@ const definition$12 = {
1026
1026
  difference: { h: differenceHueSaturation },
1027
1027
  average: { h: averageAngle }
1028
1028
  };
1029
- var definition_default$1 = definition$12;
1029
+ var definition_default$1 = definition$13;
1030
1030
 
1031
1031
  //#endregion
1032
1032
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsv/convertHsvToRgb.js
@@ -1034,19 +1034,19 @@ function convertHsvToRgb({ h, s, v, alpha }) {
1034
1034
  h = normalizeHue_default(h !== void 0 ? h : 0);
1035
1035
  if (s === void 0) s = 0;
1036
1036
  if (v === void 0) v = 0;
1037
- let f$1 = Math.abs(h / 60 % 2 - 1);
1037
+ let f$2 = Math.abs(h / 60 % 2 - 1);
1038
1038
  let res;
1039
1039
  switch (Math.floor(h / 60)) {
1040
1040
  case 0:
1041
1041
  res = {
1042
1042
  r: v,
1043
- g: v * (1 - s * f$1),
1043
+ g: v * (1 - s * f$2),
1044
1044
  b: v * (1 - s)
1045
1045
  };
1046
1046
  break;
1047
1047
  case 1:
1048
1048
  res = {
1049
- r: v * (1 - s * f$1),
1049
+ r: v * (1 - s * f$2),
1050
1050
  g: v,
1051
1051
  b: v * (1 - s)
1052
1052
  };
@@ -1055,19 +1055,19 @@ function convertHsvToRgb({ h, s, v, alpha }) {
1055
1055
  res = {
1056
1056
  r: v * (1 - s),
1057
1057
  g: v,
1058
- b: v * (1 - s * f$1)
1058
+ b: v * (1 - s * f$2)
1059
1059
  };
1060
1060
  break;
1061
1061
  case 3:
1062
1062
  res = {
1063
1063
  r: v * (1 - s),
1064
- g: v * (1 - s * f$1),
1064
+ g: v * (1 - s * f$2),
1065
1065
  b: v
1066
1066
  };
1067
1067
  break;
1068
1068
  case 4:
1069
1069
  res = {
1070
- r: v * (1 - s * f$1),
1070
+ r: v * (1 - s * f$2),
1071
1071
  g: v * (1 - s),
1072
1072
  b: v
1073
1073
  };
@@ -1076,7 +1076,7 @@ function convertHsvToRgb({ h, s, v, alpha }) {
1076
1076
  res = {
1077
1077
  r: v,
1078
1078
  g: v * (1 - s),
1079
- b: v * (1 - s * f$1)
1079
+ b: v * (1 - s * f$2)
1080
1080
  };
1081
1081
  break;
1082
1082
  default: res = {
@@ -1109,7 +1109,7 @@ function convertRgbToHsv({ r: r$1, g, b, alpha }) {
1109
1109
 
1110
1110
  //#endregion
1111
1111
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hsv/definition.js
1112
- const definition$11 = {
1112
+ const definition$12 = {
1113
1113
  mode: "hsv",
1114
1114
  toMode: { rgb: convertHsvToRgb },
1115
1115
  parse: ["--hsv"],
@@ -1138,7 +1138,7 @@ const definition$11 = {
1138
1138
  difference: { h: differenceHueSaturation },
1139
1139
  average: { h: averageAngle }
1140
1140
  };
1141
- var definition_default$2 = definition$11;
1141
+ var definition_default$15 = definition$12;
1142
1142
 
1143
1143
  //#endregion
1144
1144
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hwb/convertHwbToRgb.js
@@ -1200,7 +1200,7 @@ var parseHwb_default = ParseHwb;
1200
1200
 
1201
1201
  //#endregion
1202
1202
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/hwb/definition.js
1203
- const definition$10 = {
1203
+ const definition$11 = {
1204
1204
  mode: "hwb",
1205
1205
  toMode: { rgb: convertHwbToRgb },
1206
1206
  fromMode: { rgb: convertRgbToHwb },
@@ -1229,12 +1229,12 @@ const definition$10 = {
1229
1229
  difference: { h: differenceHueNaive },
1230
1230
  average: { h: averageAngle }
1231
1231
  };
1232
- var definition_default$3 = definition$10;
1232
+ var definition_default$2 = definition$11;
1233
1233
 
1234
1234
  //#endregion
1235
1235
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz50/constants.js
1236
- const k = Math.pow(29, 3) / Math.pow(3, 3);
1237
- const e = Math.pow(6, 3) / Math.pow(29, 3);
1236
+ const k$1 = Math.pow(29, 3) / Math.pow(3, 3);
1237
+ const e$1 = Math.pow(6, 3) / Math.pow(29, 3);
1238
1238
 
1239
1239
  //#endregion
1240
1240
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/constants.js
@@ -1248,12 +1248,12 @@ const D65 = {
1248
1248
  Y: 1,
1249
1249
  Z: .3583 / .329
1250
1250
  };
1251
- const k$1 = Math.pow(29, 3) / Math.pow(3, 3);
1252
- const e$1 = Math.pow(6, 3) / Math.pow(29, 3);
1251
+ const k$2 = Math.pow(29, 3) / Math.pow(3, 3);
1252
+ const e$2 = Math.pow(6, 3) / Math.pow(29, 3);
1253
1253
 
1254
1254
  //#endregion
1255
1255
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/convertLabToXyz50.js
1256
- let fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k;
1256
+ let fn$1 = (v) => Math.pow(v, 3) > e$1 ? Math.pow(v, 3) : (116 * v - 16) / k$1;
1257
1257
  const convertLabToXyz50 = ({ l, a, b, alpha }) => {
1258
1258
  if (l === void 0) l = 0;
1259
1259
  if (a === void 0) a = 0;
@@ -1263,9 +1263,9 @@ const convertLabToXyz50 = ({ l, a, b, alpha }) => {
1263
1263
  let fz = fy - b / 200;
1264
1264
  let res = {
1265
1265
  mode: "xyz50",
1266
- x: fn(fx) * D50.X,
1267
- y: fn(fy) * D50.Y,
1268
- z: fn(fz) * D50.Z
1266
+ x: fn$1(fx) * D50.X,
1267
+ y: fn$1(fy) * D50.Y,
1268
+ z: fn$1(fz) * D50.Z
1269
1269
  };
1270
1270
  if (alpha !== void 0) res.alpha = alpha;
1271
1271
  return res;
@@ -1310,14 +1310,14 @@ var convertRgbToXyz50_default = convertRgbToXyz50;
1310
1310
 
1311
1311
  //#endregion
1312
1312
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/convertXyz50ToLab.js
1313
- const f = (value) => value > e ? Math.cbrt(value) : (k * value + 16) / 116;
1313
+ const f$1 = (value) => value > e$1 ? Math.cbrt(value) : (k$1 * value + 16) / 116;
1314
1314
  const convertXyz50ToLab = ({ x, y, z, alpha }) => {
1315
1315
  if (x === void 0) x = 0;
1316
1316
  if (y === void 0) y = 0;
1317
1317
  if (z === void 0) z = 0;
1318
- let f0 = f(x / D50.X);
1319
- let f1 = f(y / D50.Y);
1320
- let f2 = f(z / D50.Z);
1318
+ let f0 = f$1(x / D50.X);
1319
+ let f1 = f$1(y / D50.Y);
1320
+ let f2 = f$1(z / D50.Z);
1321
1321
  let res = {
1322
1322
  mode: "lab",
1323
1323
  l: 116 * f1 - 16,
@@ -1355,7 +1355,7 @@ var parseLab_default = parseLab;
1355
1355
 
1356
1356
  //#endregion
1357
1357
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab/definition.js
1358
- const definition$9 = {
1358
+ const definition$10 = {
1359
1359
  mode: "lab",
1360
1360
  toMode: {
1361
1361
  xyz50: convertLabToXyz50_default,
@@ -1388,6 +1388,90 @@ const definition$9 = {
1388
1388
  }
1389
1389
  }
1390
1390
  };
1391
+ var definition_default$3 = definition$10;
1392
+
1393
+ //#endregion
1394
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/xyz65/constants.js
1395
+ const k = Math.pow(29, 3) / Math.pow(3, 3);
1396
+ const e = Math.pow(6, 3) / Math.pow(29, 3);
1397
+
1398
+ //#endregion
1399
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab65/convertLab65ToXyz65.js
1400
+ let fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k;
1401
+ const convertLab65ToXyz65 = ({ l, a, b, alpha }) => {
1402
+ if (l === void 0) l = 0;
1403
+ if (a === void 0) a = 0;
1404
+ if (b === void 0) b = 0;
1405
+ let fy = (l + 16) / 116;
1406
+ let fx = a / 500 + fy;
1407
+ let fz = fy - b / 200;
1408
+ let res = {
1409
+ mode: "xyz65",
1410
+ x: fn(fx) * D65.X,
1411
+ y: fn(fy) * D65.Y,
1412
+ z: fn(fz) * D65.Z
1413
+ };
1414
+ if (alpha !== void 0) res.alpha = alpha;
1415
+ return res;
1416
+ };
1417
+ var convertLab65ToXyz65_default = convertLab65ToXyz65;
1418
+
1419
+ //#endregion
1420
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab65/convertLab65ToRgb.js
1421
+ const convertLab65ToRgb = (lab) => convertXyz65ToRgb_default(convertLab65ToXyz65_default(lab));
1422
+ var convertLab65ToRgb_default = convertLab65ToRgb;
1423
+
1424
+ //#endregion
1425
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab65/convertXyz65ToLab65.js
1426
+ const f = (value) => value > e ? Math.cbrt(value) : (k * value + 16) / 116;
1427
+ const convertXyz65ToLab65 = ({ x, y, z, alpha }) => {
1428
+ if (x === void 0) x = 0;
1429
+ if (y === void 0) y = 0;
1430
+ if (z === void 0) z = 0;
1431
+ let f0 = f(x / D65.X);
1432
+ let f1 = f(y / D65.Y);
1433
+ let f2 = f(z / D65.Z);
1434
+ let res = {
1435
+ mode: "lab65",
1436
+ l: 116 * f1 - 16,
1437
+ a: 500 * (f0 - f1),
1438
+ b: 200 * (f1 - f2)
1439
+ };
1440
+ if (alpha !== void 0) res.alpha = alpha;
1441
+ return res;
1442
+ };
1443
+ var convertXyz65ToLab65_default = convertXyz65ToLab65;
1444
+
1445
+ //#endregion
1446
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab65/convertRgbToLab65.js
1447
+ const convertRgbToLab65 = (rgb$2) => {
1448
+ let res = convertXyz65ToLab65_default(convertRgbToXyz65_default(rgb$2));
1449
+ if (rgb$2.r === rgb$2.b && rgb$2.b === rgb$2.g) res.a = res.b = 0;
1450
+ return res;
1451
+ };
1452
+ var convertRgbToLab65_default = convertRgbToLab65;
1453
+
1454
+ //#endregion
1455
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/lab65/definition.js
1456
+ const definition$9 = {
1457
+ ...definition_default$3,
1458
+ mode: "lab65",
1459
+ parse: ["--lab-d65"],
1460
+ serialize: "--lab-d65",
1461
+ toMode: {
1462
+ xyz65: convertLab65ToXyz65_default,
1463
+ rgb: convertLab65ToRgb_default
1464
+ },
1465
+ fromMode: {
1466
+ xyz65: convertXyz65ToLab65_default,
1467
+ rgb: convertRgbToLab65_default
1468
+ },
1469
+ ranges: {
1470
+ l: [0, 100],
1471
+ a: [-86.182, 98.234],
1472
+ b: [-107.86, 94.477]
1473
+ }
1474
+ };
1391
1475
  var definition_default$4 = definition$9;
1392
1476
 
1393
1477
  //#endregion
@@ -1568,7 +1652,7 @@ var parseOklab_default = parseOklab;
1568
1652
  //#endregion
1569
1653
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/oklab/definition.js
1570
1654
  const definition$6 = {
1571
- ...definition_default$4,
1655
+ ...definition_default$3,
1572
1656
  mode: "oklab",
1573
1657
  toMode: {
1574
1658
  lrgb: convertOklabToLrgb_default,
@@ -1918,6 +2002,183 @@ const definition = {
1918
2002
  };
1919
2003
  var definition_default$14 = definition;
1920
2004
 
2005
+ //#endregion
2006
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/okhsl/helpers.js
2007
+ function toe(x) {
2008
+ const k_1 = .206;
2009
+ const k_2 = .03;
2010
+ const k_3 = (1 + k_1) / (1 + k_2);
2011
+ return .5 * (k_3 * x - k_1 + Math.sqrt((k_3 * x - k_1) * (k_3 * x - k_1) + 4 * k_2 * k_3 * x));
2012
+ }
2013
+ function toe_inv(x) {
2014
+ const k_1 = .206;
2015
+ const k_2 = .03;
2016
+ const k_3 = (1 + k_1) / (1 + k_2);
2017
+ return (x * x + k_1 * x) / (k_3 * (x + k_2));
2018
+ }
2019
+ function compute_max_saturation(a, b) {
2020
+ let k0, k1, k2, k3, k4, wl, wm, ws;
2021
+ if (-1.88170328 * a - .80936493 * b > 1) {
2022
+ k0 = 1.19086277;
2023
+ k1 = 1.76576728;
2024
+ k2 = .59662641;
2025
+ k3 = .75515197;
2026
+ k4 = .56771245;
2027
+ wl = 4.0767416621;
2028
+ wm = -3.3077115913;
2029
+ ws = .2309699292;
2030
+ } else if (1.81444104 * a - 1.19445276 * b > 1) {
2031
+ k0 = .73956515;
2032
+ k1 = -.45954404;
2033
+ k2 = .08285427;
2034
+ k3 = .1254107;
2035
+ k4 = .14503204;
2036
+ wl = -1.2684380046;
2037
+ wm = 2.6097574011;
2038
+ ws = -.3413193965;
2039
+ } else {
2040
+ k0 = 1.35733652;
2041
+ k1 = -.00915799;
2042
+ k2 = -1.1513021;
2043
+ k3 = -.50559606;
2044
+ k4 = .00692167;
2045
+ wl = -.0041960863;
2046
+ wm = -.7034186147;
2047
+ ws = 1.707614701;
2048
+ }
2049
+ let S = k0 + k1 * a + k2 * b + k3 * a * a + k4 * a * b;
2050
+ let k_l = .3963377774 * a + .2158037573 * b;
2051
+ let k_m = -.1055613458 * a - .0638541728 * b;
2052
+ let k_s = -.0894841775 * a - 1.291485548 * b;
2053
+ {
2054
+ let l_ = 1 + S * k_l;
2055
+ let m_ = 1 + S * k_m;
2056
+ let s_ = 1 + S * k_s;
2057
+ let l = l_ * l_ * l_;
2058
+ let m = m_ * m_ * m_;
2059
+ let s = s_ * s_ * s_;
2060
+ let l_dS = 3 * k_l * l_ * l_;
2061
+ let m_dS = 3 * k_m * m_ * m_;
2062
+ let s_dS = 3 * k_s * s_ * s_;
2063
+ let l_dS2 = 6 * k_l * k_l * l_;
2064
+ let m_dS2 = 6 * k_m * k_m * m_;
2065
+ let s_dS2 = 6 * k_s * k_s * s_;
2066
+ let f$2 = wl * l + wm * m + ws * s;
2067
+ let f1 = wl * l_dS + wm * m_dS + ws * s_dS;
2068
+ let f2 = wl * l_dS2 + wm * m_dS2 + ws * s_dS2;
2069
+ S = S - f$2 * f1 / (f1 * f1 - .5 * f$2 * f2);
2070
+ }
2071
+ return S;
2072
+ }
2073
+ function find_cusp(a, b) {
2074
+ let S_cusp = compute_max_saturation(a, b);
2075
+ let rgb$2 = convertOklabToLrgb_default({
2076
+ l: 1,
2077
+ a: S_cusp * a,
2078
+ b: S_cusp * b
2079
+ });
2080
+ let L_cusp = Math.cbrt(1 / Math.max(rgb$2.r, rgb$2.g, rgb$2.b));
2081
+ let C_cusp = L_cusp * S_cusp;
2082
+ return [L_cusp, C_cusp];
2083
+ }
2084
+ function get_ST_max(a_, b_, cusp = null) {
2085
+ if (!cusp) cusp = find_cusp(a_, b_);
2086
+ let L = cusp[0];
2087
+ let C = cusp[1];
2088
+ return [C / L, C / (1 - L)];
2089
+ }
2090
+
2091
+ //#endregion
2092
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/okhsv/convertOklabToOkhsv.js
2093
+ function convertOklabToOkhsv(lab) {
2094
+ let l = lab.l !== void 0 ? lab.l : 0;
2095
+ let a = lab.a !== void 0 ? lab.a : 0;
2096
+ let b = lab.b !== void 0 ? lab.b : 0;
2097
+ let c$1 = Math.sqrt(a * a + b * b);
2098
+ let a_ = c$1 ? a / c$1 : 1;
2099
+ let b_ = c$1 ? b / c$1 : 1;
2100
+ let [S_max, T] = get_ST_max(a_, b_);
2101
+ let S_0 = .5;
2102
+ let k$3 = 1 - S_0 / S_max;
2103
+ let t = T / (c$1 + l * T);
2104
+ let L_v = t * l;
2105
+ let C_v = t * c$1;
2106
+ let L_vt = toe_inv(L_v);
2107
+ let C_vt = C_v * L_vt / L_v;
2108
+ let rgb_scale = convertOklabToLrgb_default({
2109
+ l: L_vt,
2110
+ a: a_ * C_vt,
2111
+ b: b_ * C_vt
2112
+ });
2113
+ let scale_L = Math.cbrt(1 / Math.max(rgb_scale.r, rgb_scale.g, rgb_scale.b, 0));
2114
+ l = l / scale_L;
2115
+ c$1 = c$1 / scale_L * toe(l) / l;
2116
+ l = toe(l);
2117
+ const ret = {
2118
+ mode: "okhsv",
2119
+ s: c$1 ? (S_0 + T) * C_v / (T * S_0 + T * k$3 * C_v) : 0,
2120
+ v: l ? l / L_v : 0
2121
+ };
2122
+ if (ret.s) ret.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI);
2123
+ if (lab.alpha !== void 0) ret.alpha = lab.alpha;
2124
+ return ret;
2125
+ }
2126
+
2127
+ //#endregion
2128
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/okhsv/convertOkhsvToOklab.js
2129
+ function convertOkhsvToOklab(hsv) {
2130
+ const ret = { mode: "oklab" };
2131
+ if (hsv.alpha !== void 0) ret.alpha = hsv.alpha;
2132
+ const h = hsv.h !== void 0 ? hsv.h : 0;
2133
+ const s = hsv.s !== void 0 ? hsv.s : 0;
2134
+ const v = hsv.v !== void 0 ? hsv.v : 0;
2135
+ const a_ = Math.cos(h / 180 * Math.PI);
2136
+ const b_ = Math.sin(h / 180 * Math.PI);
2137
+ const [S_max, T] = get_ST_max(a_, b_);
2138
+ const S_0 = .5;
2139
+ const k$3 = 1 - S_0 / S_max;
2140
+ const L_v = 1 - s * S_0 / (S_0 + T - T * k$3 * s);
2141
+ const C_v = s * T * S_0 / (S_0 + T - T * k$3 * s);
2142
+ const L_vt = toe_inv(L_v);
2143
+ const C_vt = C_v * L_vt / L_v;
2144
+ const rgb_scale = convertOklabToLrgb_default({
2145
+ l: L_vt,
2146
+ a: a_ * C_vt,
2147
+ b: b_ * C_vt
2148
+ });
2149
+ const scale_L = Math.cbrt(1 / Math.max(rgb_scale.r, rgb_scale.g, rgb_scale.b, 0));
2150
+ const L_new = toe_inv(v * L_v);
2151
+ const C = C_v * L_new / L_v;
2152
+ ret.l = L_new * scale_L;
2153
+ ret.a = C * a_ * scale_L;
2154
+ ret.b = C * b_ * scale_L;
2155
+ return ret;
2156
+ }
2157
+
2158
+ //#endregion
2159
+ //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/okhsv/modeOkhsv.js
2160
+ const modeOkhsv = {
2161
+ ...definition_default$15,
2162
+ mode: "okhsv",
2163
+ channels: [
2164
+ "h",
2165
+ "s",
2166
+ "v",
2167
+ "alpha"
2168
+ ],
2169
+ parse: ["--okhsv"],
2170
+ serialize: "--okhsv",
2171
+ fromMode: {
2172
+ oklab: convertOklabToOkhsv,
2173
+ rgb: (c$1) => convertOklabToOkhsv(convertRgbToOklab_default(c$1))
2174
+ },
2175
+ toMode: {
2176
+ oklab: convertOkhsvToOklab,
2177
+ rgb: (c$1) => convertOklabToRgb_default(convertOkhsvToOklab(c$1))
2178
+ }
2179
+ };
2180
+ var modeOkhsv_default = modeOkhsv;
2181
+
1921
2182
  //#endregion
1922
2183
  //#region ../../node_modules/.pnpm/culori@4.0.1/node_modules/culori/src/round.js
1923
2184
  const r = (value, precision) => Math.round(value * (precision = Math.pow(10, precision))) / precision;
@@ -2048,18 +2309,19 @@ function toGamut(dest = "rgb", mode = "oklch", delta = differenceEuclidean("oklc
2048
2309
  }
2049
2310
 
2050
2311
  //#endregion
2051
- //#region ../token-tools/dist/string-BZ5Le1WD.js
2312
+ //#region ../token-tools/dist/string-BwN3ybNv.js
2052
2313
  const HEX_RE = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i;
2053
2314
  const CULORI_TO_CSS = {
2054
- a98: "a98",
2315
+ a98: "a98-rgb",
2055
2316
  hsl: "hsl",
2056
- hsv: "hsv",
2057
2317
  hwb: "hwb",
2058
2318
  lab: "lab",
2319
+ lab65: "lab-d65",
2059
2320
  lch: "lch",
2060
2321
  lrgb: "srgb-linear",
2061
2322
  oklab: "oklab",
2062
2323
  oklch: "oklch",
2324
+ okhsv: "okhsv",
2063
2325
  p3: "display-p3",
2064
2326
  prophoto: "prophoto-rgb",
2065
2327
  rec2020: "rec2020",
@@ -2068,19 +2330,21 @@ const CULORI_TO_CSS = {
2068
2330
  xyz65: "xyz-d65"
2069
2331
  };
2070
2332
  const CSS_TO_CULORI = {
2071
- a98: "a98",
2333
+ "a98-rgb": "a98",
2072
2334
  "display-p3": "p3",
2073
2335
  hsl: "hsl",
2074
- hsv: "hsv",
2075
2336
  hwb: "hwb",
2076
2337
  lab: "lab",
2338
+ "lab-d65": "lab65",
2077
2339
  lch: "lch",
2078
2340
  oklab: "oklab",
2079
2341
  oklch: "oklch",
2342
+ okhsv: "okhsv",
2080
2343
  "prophoto-rgb": "prophoto",
2081
2344
  rec2020: "rec2020",
2082
2345
  srgb: "rgb",
2083
2346
  "srgb-linear": "lrgb",
2347
+ xyz: "xyz65",
2084
2348
  "xyz-d50": "xyz50",
2085
2349
  "xyz-d65": "xyz65"
2086
2350
  };
@@ -2110,30 +2374,27 @@ function parseColor(color) {
2110
2374
  break;
2111
2375
  }
2112
2376
  case "hsl": {
2377
+ const maxS = COLORSPACE[colorSpace].ranges[1]?.[1] ?? 1;
2378
+ const maxL = COLORSPACE[colorSpace].ranges[2]?.[1] ?? 1;
2113
2379
  components = [
2114
2380
  result.h ?? 0,
2115
- result.s,
2116
- result.l
2117
- ];
2118
- break;
2119
- }
2120
- case "hsv": {
2121
- components = [
2122
- result.h ?? 0,
2123
- result.s,
2124
- result.v
2381
+ result.s * maxS,
2382
+ result.l * maxL
2125
2383
  ];
2126
2384
  break;
2127
2385
  }
2128
2386
  case "hwb": {
2387
+ const maxW = COLORSPACE[colorSpace].ranges[1]?.[1] ?? 1;
2388
+ const maxB = COLORSPACE[colorSpace].ranges[2]?.[1] ?? 1;
2129
2389
  components = [
2130
2390
  result.h ?? 0,
2131
- result.w,
2132
- result.b
2391
+ result.w * maxW,
2392
+ result.b * maxB
2133
2393
  ];
2134
2394
  break;
2135
2395
  }
2136
2396
  case "lab":
2397
+ case "lab65":
2137
2398
  case "oklab": {
2138
2399
  components = [
2139
2400
  result.l,
@@ -2151,6 +2412,14 @@ function parseColor(color) {
2151
2412
  ];
2152
2413
  break;
2153
2414
  }
2415
+ case "okhsv": {
2416
+ components = [
2417
+ result.h ?? 0,
2418
+ result.s,
2419
+ result.v
2420
+ ];
2421
+ break;
2422
+ }
2154
2423
  case "xyz50":
2155
2424
  case "xyz65": {
2156
2425
  components = [
@@ -2172,7 +2441,7 @@ function parseColor(color) {
2172
2441
  /** Convert a color token to a Culori color */
2173
2442
  function tokenToCulori(value) {
2174
2443
  switch (value.colorSpace) {
2175
- case "a98":
2444
+ case "a98-rgb":
2176
2445
  case "display-p3":
2177
2446
  case "prophoto-rgb":
2178
2447
  case "rec2020":
@@ -2189,39 +2458,35 @@ function tokenToCulori(value) {
2189
2458
  }
2190
2459
  case "hsl": {
2191
2460
  const [h, s, l] = value.components;
2461
+ const maxS = COLORSPACE[value.colorSpace].ranges[1]?.[1] ?? 1;
2462
+ const maxL = COLORSPACE[value.colorSpace].ranges[2]?.[1] ?? 1;
2192
2463
  return {
2193
2464
  mode: "hsl",
2194
2465
  h,
2195
- s,
2196
- l,
2197
- alpha: value.alpha
2198
- };
2199
- }
2200
- case "hsv": {
2201
- const [h, s, v] = value.components;
2202
- return {
2203
- mode: "hsv",
2204
- h,
2205
- s,
2206
- v,
2466
+ s: s / maxS,
2467
+ l: l / maxL,
2207
2468
  alpha: value.alpha
2208
2469
  };
2209
2470
  }
2210
2471
  case "hwb": {
2211
2472
  const [h, w, b] = value.components;
2473
+ const maxW = COLORSPACE[value.colorSpace].ranges[1]?.[1] ?? 1;
2474
+ const maxB = COLORSPACE[value.colorSpace].ranges[2]?.[1] ?? 1;
2212
2475
  return {
2213
2476
  mode: "hwb",
2214
2477
  h,
2215
- w,
2216
- b,
2478
+ w: w / maxW,
2479
+ b: b / maxB,
2217
2480
  alpha: value.alpha
2218
2481
  };
2219
2482
  }
2220
2483
  case "lab":
2484
+ case "lab-d65":
2221
2485
  case "oklab": {
2222
2486
  const [l, a, b] = value.components;
2487
+ const mode = value.colorSpace === "lab-d65" ? "lab65" : value.colorSpace;
2223
2488
  return {
2224
- mode: value.colorSpace,
2489
+ mode,
2225
2490
  l,
2226
2491
  a,
2227
2492
  b,
@@ -2239,28 +2504,119 @@ function tokenToCulori(value) {
2239
2504
  alpha: value.alpha
2240
2505
  };
2241
2506
  }
2242
- case "xyz-d50": {
2243
- const [x, y, z] = value.components;
2507
+ case "okhsv": {
2508
+ const [h, s, v] = value.components;
2244
2509
  return {
2245
- mode: "xyz50",
2246
- x,
2247
- y,
2248
- z,
2510
+ mode: value.colorSpace,
2511
+ h,
2512
+ s,
2513
+ v,
2249
2514
  alpha: value.alpha
2250
2515
  };
2251
2516
  }
2517
+ case "xyz":
2518
+ case "xyz-d50":
2252
2519
  case "xyz-d65": {
2253
2520
  const [x, y, z] = value.components;
2254
2521
  return {
2255
- mode: "xyz65",
2522
+ mode: CSS_TO_CULORI[value.colorSpace],
2256
2523
  x,
2257
2524
  y,
2258
2525
  z,
2259
2526
  alpha: value.alpha
2260
2527
  };
2261
2528
  }
2529
+ default: throw new Error(`Invalid colorSpace "${value.colorSpace}". Expected one of ${Object.keys(CSS_TO_CULORI).join(", ")}`);
2262
2530
  }
2263
2531
  }
2532
+ /** Complete list of CSS Module 4 Colorspaces */
2533
+ const COLORSPACE = {
2534
+ "a98-rgb": { ranges: [
2535
+ [0, 1],
2536
+ [0, 1],
2537
+ [0, 1]
2538
+ ] },
2539
+ "display-p3": { ranges: [
2540
+ [0, 1],
2541
+ [0, 1],
2542
+ [0, 1]
2543
+ ] },
2544
+ hsl: { ranges: [
2545
+ [0, 360],
2546
+ [0, 100],
2547
+ [0, 100]
2548
+ ] },
2549
+ hwb: { ranges: [
2550
+ [0, 360],
2551
+ [0, 100],
2552
+ [0, 100]
2553
+ ] },
2554
+ lab: { ranges: [
2555
+ [0, 100],
2556
+ [-125, 125],
2557
+ [-125, 125]
2558
+ ] },
2559
+ "lab-d65": { ranges: [
2560
+ [0, 100],
2561
+ [-125, 125],
2562
+ [-125, 125]
2563
+ ] },
2564
+ lch: { ranges: [
2565
+ [0, 100],
2566
+ [0, 150],
2567
+ [0, 360]
2568
+ ] },
2569
+ oklab: { ranges: [
2570
+ [0, 1],
2571
+ [-.4, .4],
2572
+ [-.4, .4]
2573
+ ] },
2574
+ oklch: { ranges: [
2575
+ [0, 1],
2576
+ [0, .4],
2577
+ [0, 360]
2578
+ ] },
2579
+ okhsv: { ranges: [
2580
+ [0, 360],
2581
+ [0, 1],
2582
+ [0, 1]
2583
+ ] },
2584
+ "prophoto-rgb": { ranges: [
2585
+ [0, 1],
2586
+ [0, 1],
2587
+ [0, 1]
2588
+ ] },
2589
+ rec2020: { ranges: [
2590
+ [0, 1],
2591
+ [0, 1],
2592
+ [0, 1]
2593
+ ] },
2594
+ srgb: { ranges: [
2595
+ [0, 1],
2596
+ [0, 1],
2597
+ [0, 1]
2598
+ ] },
2599
+ "srgb-linear": { ranges: [
2600
+ [0, 1],
2601
+ [0, 1],
2602
+ [0, 1]
2603
+ ] },
2604
+ "xyz-d50": { ranges: [
2605
+ [0, 1],
2606
+ [0, 1],
2607
+ [0, 1]
2608
+ ] },
2609
+ xyz: { ranges: [
2610
+ [0, 1],
2611
+ [0, 1],
2612
+ [0, 1]
2613
+ ] },
2614
+ "xyz-d65": { ranges: [
2615
+ [0, 1],
2616
+ [0, 1],
2617
+ [0, 1]
2618
+ ] }
2619
+ };
2264
2620
  /** Turn a string into kebab-case */
2265
2621
  function kebabCase(str) {
2266
2622
  let output = "";
@@ -2385,11 +2741,11 @@ function wildcardMatch(pattern, options) {
2385
2741
  if (options.separator === "\\") throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");
2386
2742
  var regexpPattern = transform(pattern, options.separator);
2387
2743
  var regexp = new RegExp("^".concat(regexpPattern, "$"), options.flags);
2388
- var fn$3 = isMatch.bind(null, regexp);
2389
- fn$3.options = options;
2390
- fn$3.pattern = pattern;
2391
- fn$3.regexp = regexp;
2392
- return fn$3;
2744
+ var fn$4 = isMatch.bind(null, regexp);
2745
+ fn$4.options = options;
2746
+ fn$4.pattern = pattern;
2747
+ fn$4.regexp = regexp;
2748
+ return fn$4;
2393
2749
  }
2394
2750
 
2395
2751
  //#endregion
@@ -2462,13 +2818,14 @@ function transformColor(token, options) {
2462
2818
  const converters = {
2463
2819
  a98: useMode(definition_default),
2464
2820
  hsl: useMode(definition_default$1),
2465
- hsv: useMode(definition_default$2),
2466
- hwb: useMode(definition_default$3),
2467
- lab: useMode(definition_default$4),
2821
+ hwb: useMode(definition_default$2),
2822
+ lab: useMode(definition_default$3),
2823
+ lab65: useMode(definition_default$4),
2468
2824
  lch: useMode(definition_default$5),
2469
2825
  lrgb: useMode(definition_default$6),
2470
2826
  oklab: useMode(definition_default$7),
2471
2827
  oklch: useMode(definition_default$8),
2828
+ okhsv: useMode(modeOkhsv_default),
2472
2829
  p3: useMode(definition_default$9),
2473
2830
  prophoto: useMode(definition_default$10),
2474
2831
  rec2020: useMode(definition_default$11),
@@ -2483,13 +2840,19 @@ const converters = {
2483
2840
  * we’re just preserving the original colorspace.
2484
2841
  */
2485
2842
  function downsample($value, culoriColor) {
2843
+ if (!($value.colorSpace in CSS_TO_CULORI)) throw new Error(`Invalid colorSpace "${$value.colorSpace}". Expected one of: ${Object.keys(CSS_TO_CULORI).join(", ")}`);
2486
2844
  const conversionSpace = CSS_TO_CULORI[$value.colorSpace] || "oklab";
2487
- const converter$1 = converters[conversionSpace];
2845
+ let gamutSpace = conversionSpace;
2846
+ if (gamutSpace === "lab" || gamutSpace === "lab65") gamutSpace = "lch";
2847
+ else if (gamutSpace === "oklab") gamutSpace = "oklch";
2848
+ const srgb = converters[conversionSpace](toGamut("rgb", gamutSpace)(culoriColor));
2849
+ const p3 = converters[conversionSpace](toGamut("p3", gamutSpace)(culoriColor));
2850
+ const rec2020 = converters[conversionSpace](toGamut("rec2020", gamutSpace)(culoriColor));
2488
2851
  return {
2489
2852
  ".": formatCss(culoriColor),
2490
- srgb: formatCss(converter$1(toGamut("rgb", conversionSpace)(culoriColor))),
2491
- p3: formatCss(converter$1(toGamut("p3", conversionSpace)(culoriColor))),
2492
- rec2020: formatCss(converter$1(toGamut("rec2020", conversionSpace)(culoriColor)))
2853
+ srgb: formatCss(srgb),
2854
+ p3: formatCss(p3),
2855
+ rec2020: formatCss(rec2020)
2493
2856
  };
2494
2857
  }
2495
2858
  /** Convert dimension value to CSS */
@@ -2746,7 +3109,7 @@ function _printRule(rule) {
2746
3109
  }
2747
3110
  const declarations = Object.entries(rule.declarations);
2748
3111
  declarations.sort((a, b) => a[0].localeCompare(b[0], "en-us", { numeric: true }));
2749
- for (const [k$2, v] of declarations) output.push(`${indent}${k$2}: ${v};`);
3112
+ for (const [k$3, v] of declarations) output.push(`${indent}${k$3}: ${v};`);
2750
3113
  while (indent !== "") {
2751
3114
  indent = indent.substring(0, indent.length - 2);
2752
3115
  output.push(`${indent}}`);
@@ -2841,7 +3204,7 @@ function generateUtilityCSS(groups, tokens) {
2841
3204
  const selector = makeSelector(token, "font");
2842
3205
  if (token.token.$type === "typography" && token.type === "MULTI_VALUE") {
2843
3206
  const declarations = {};
2844
- for (const k$2 of Object.keys(token.value)) declarations[k$2] = makeCSSVar(`${token.localID ?? token.token.id}-${k$2}`, { wrapVar: true });
3207
+ for (const k$3 of Object.keys(token.value)) declarations[k$3] = makeCSSVar(`${token.localID ?? token.token.id}-${k$3}`, { wrapVar: true });
2845
3208
  output.push({
2846
3209
  selectors: [selector],
2847
3210
  declarations