@tbela99/css-parser 1.4.2 → 1.4.3

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 (216) hide show
  1. package/.nyc_output/4874b20e-6f53-4d7a-be5a-cf68316925f2.json +1 -0
  2. package/.nyc_output/6193bc4c-6f5f-4898-8950-c628825e6342.json +1 -0
  3. package/.nyc_output/processinfo/4874b20e-6f53-4d7a-be5a-cf68316925f2.json +1 -0
  4. package/.nyc_output/processinfo/6193bc4c-6f5f-4898-8950-c628825e6342.json +1 -0
  5. package/.repl_history +4 -0
  6. package/CHANGELOG.md +164 -4
  7. package/README.md +43 -0
  8. package/badges/coverage.svg +20 -0
  9. package/deno.lock +2861 -0
  10. package/dist/config.json.js +33 -1
  11. package/dist/index-umd-web.js +24382 -18476
  12. package/dist/index.cjs +24522 -18618
  13. package/dist/index.d.ts +1396 -929
  14. package/dist/lib/ast/clone.d.ts +10 -0
  15. package/dist/lib/ast/clone.js +45 -0
  16. package/dist/lib/ast/expand.d.ts +14 -0
  17. package/dist/lib/ast/expand.js +89 -64
  18. package/dist/lib/ast/features/calc.d.ts +10 -0
  19. package/dist/lib/ast/features/calc.js +62 -24
  20. package/dist/lib/ast/features/if.d.ts +10 -0
  21. package/dist/lib/ast/features/if.js +215 -0
  22. package/dist/lib/ast/features/index.d.ts +6 -0
  23. package/dist/lib/ast/features/index.js +1 -0
  24. package/dist/lib/ast/features/inlinecssvariables.d.ts +15 -0
  25. package/dist/lib/ast/features/inlinecssvariables.js +32 -27
  26. package/dist/lib/ast/features/prefix.d.ts +8 -0
  27. package/dist/lib/ast/features/prefix.js +68 -43
  28. package/dist/lib/ast/features/shorthand.d.ts +12 -0
  29. package/dist/lib/ast/features/shorthand.js +6 -9
  30. package/dist/lib/ast/features/transform.d.ts +10 -0
  31. package/dist/lib/ast/features/transform.js +9 -13
  32. package/dist/lib/ast/features/type.d.ts +15 -0
  33. package/dist/lib/ast/find.d.ts +165 -0
  34. package/dist/lib/ast/find.js +175 -0
  35. package/dist/lib/ast/math/expression.d.ts +18 -0
  36. package/dist/lib/ast/math/expression.js +140 -98
  37. package/dist/lib/ast/math/math.d.ts +6 -0
  38. package/dist/lib/ast/math/math.js +30 -41
  39. package/dist/lib/ast/minify.d.ts +19 -0
  40. package/dist/lib/ast/minify.js +541 -217
  41. package/dist/lib/ast/transform/compute.d.ts +8 -0
  42. package/dist/lib/ast/transform/compute.js +82 -69
  43. package/dist/lib/ast/transform/matrix.d.ts +22 -0
  44. package/dist/lib/ast/transform/matrix.js +12 -26
  45. package/dist/lib/ast/transform/minify.d.ts +5 -0
  46. package/dist/lib/ast/transform/minify.js +20 -20
  47. package/dist/lib/ast/transform/perspective.d.ts +3 -0
  48. package/dist/lib/ast/transform/perspective.js +1 -1
  49. package/dist/lib/ast/transform/rotate.d.ts +12 -0
  50. package/dist/lib/ast/transform/rotate.js +1 -1
  51. package/dist/lib/ast/transform/scale.d.ts +6 -0
  52. package/dist/lib/ast/transform/scale.js +1 -1
  53. package/dist/lib/ast/transform/skew.d.ts +4 -0
  54. package/dist/lib/ast/transform/skew.js +1 -1
  55. package/dist/lib/ast/transform/translate.d.ts +6 -0
  56. package/dist/lib/ast/transform/translate.js +1 -1
  57. package/dist/lib/ast/transform/utils.d.ts +9 -0
  58. package/dist/lib/ast/types.d.ts +903 -0
  59. package/dist/lib/ast/types.js +277 -23
  60. package/dist/lib/ast/walk.d.ts +162 -0
  61. package/dist/lib/ast/walk.js +116 -60
  62. package/dist/lib/fs/resolve.d.ts +20 -0
  63. package/dist/lib/fs/resolve.js +37 -45
  64. package/dist/lib/parser/declaration/list.d.ts +16 -0
  65. package/dist/lib/parser/declaration/list.js +26 -24
  66. package/dist/lib/parser/declaration/map.d.ts +15 -0
  67. package/dist/lib/parser/declaration/map.js +140 -95
  68. package/dist/lib/parser/declaration/set.d.ts +9 -0
  69. package/dist/lib/parser/declaration/set.js +30 -25
  70. package/dist/lib/parser/node.d.ts +7 -0
  71. package/dist/lib/parser/parse.d.ts +107 -0
  72. package/dist/lib/parser/parse.js +1454 -1445
  73. package/dist/lib/parser/tokenize.d.ts +57 -0
  74. package/dist/lib/parser/tokenize.js +557 -404
  75. package/dist/lib/parser/utils/at-rule-container.d.ts +5 -0
  76. package/dist/lib/parser/utils/at-rule-container.js +486 -0
  77. package/dist/lib/parser/utils/at-rule-font-feature-values.d.ts +5 -0
  78. package/dist/lib/parser/utils/at-rule-font-feature-values.js +13 -0
  79. package/dist/lib/parser/utils/at-rule-generic.d.ts +5 -0
  80. package/dist/lib/parser/utils/at-rule-generic.js +118 -0
  81. package/dist/lib/parser/utils/at-rule-import.d.ts +5 -0
  82. package/dist/lib/parser/utils/at-rule-import.js +393 -0
  83. package/dist/lib/parser/utils/at-rule-media.d.ts +5 -0
  84. package/dist/lib/parser/utils/at-rule-media.js +603 -0
  85. package/dist/lib/parser/utils/at-rule-page.d.ts +5 -0
  86. package/dist/lib/parser/utils/at-rule-page.js +28 -0
  87. package/dist/lib/parser/utils/at-rule-support.d.ts +5 -0
  88. package/dist/lib/parser/utils/at-rule-support.js +366 -0
  89. package/dist/lib/parser/utils/at-rule-token.d.ts +1 -0
  90. package/dist/lib/parser/utils/at-rule-when-else.d.ts +5 -0
  91. package/dist/lib/parser/utils/at-rule-when-else.js +363 -0
  92. package/dist/lib/parser/utils/at-rule.d.ts +13 -0
  93. package/dist/lib/parser/utils/at-rule.js +37 -0
  94. package/dist/lib/parser/utils/cache.d.ts +6 -0
  95. package/dist/lib/parser/utils/cache.js +19 -0
  96. package/dist/lib/parser/utils/config.d.ts +2 -0
  97. package/dist/lib/parser/utils/config.js +1 -0
  98. package/dist/lib/parser/utils/declaration-list.d.ts +5 -0
  99. package/dist/lib/parser/utils/declaration.d.ts +18 -0
  100. package/dist/lib/parser/utils/declaration.js +569 -91
  101. package/dist/lib/parser/utils/eq.d.ts +1 -0
  102. package/dist/lib/parser/utils/hash.d.ts +21 -0
  103. package/dist/lib/parser/utils/hash.js +1 -1
  104. package/dist/lib/parser/utils/selector.d.ts +5 -0
  105. package/dist/lib/parser/utils/selector.js +476 -0
  106. package/dist/lib/parser/utils/text.d.ts +3 -0
  107. package/dist/lib/parser/utils/text.js +17 -1
  108. package/dist/lib/parser/utils/token.d.ts +14 -0
  109. package/dist/lib/parser/utils/token.js +102 -0
  110. package/dist/lib/parser/utils/type.d.ts +2 -0
  111. package/dist/lib/parser/utils/type.js +29 -18
  112. package/dist/lib/renderer/render.d.ts +28 -0
  113. package/dist/lib/renderer/render.js +421 -262
  114. package/dist/lib/renderer/sourcemap/lib/encode.d.ts +1 -0
  115. package/dist/lib/renderer/sourcemap/sourcemap.d.ts +26 -0
  116. package/dist/lib/renderer/sourcemap/sourcemap.js +17 -7
  117. package/dist/lib/syntax/color/a98rgb.d.ts +2 -0
  118. package/dist/lib/syntax/color/a98rgb.js +8 -12
  119. package/dist/lib/syntax/color/cmyk.d.ts +10 -0
  120. package/dist/lib/syntax/color/cmyk.js +23 -21
  121. package/dist/lib/syntax/color/color-mix.d.ts +2 -0
  122. package/dist/lib/syntax/color/color-mix.js +88 -77
  123. package/dist/lib/syntax/color/color.d.ts +42 -0
  124. package/dist/lib/syntax/color/color.js +65 -68
  125. package/dist/lib/syntax/color/hex.d.ts +16 -0
  126. package/dist/lib/syntax/color/hex.js +27 -31
  127. package/dist/lib/syntax/color/hsl.d.ts +20 -0
  128. package/dist/lib/syntax/color/hsl.js +5 -12
  129. package/dist/lib/syntax/color/hsv.d.ts +2 -0
  130. package/dist/lib/syntax/color/hwb.d.ts +21 -0
  131. package/dist/lib/syntax/color/hwb.js +8 -21
  132. package/dist/lib/syntax/color/lab.d.ts +25 -0
  133. package/dist/lib/syntax/color/lab.js +20 -21
  134. package/dist/lib/syntax/color/lch.d.ts +23 -0
  135. package/dist/lib/syntax/color/lch.js +13 -15
  136. package/dist/lib/syntax/color/oklab.d.ts +22 -0
  137. package/dist/lib/syntax/color/oklab.js +20 -39
  138. package/dist/lib/syntax/color/oklch.d.ts +20 -0
  139. package/dist/lib/syntax/color/oklch.js +14 -16
  140. package/dist/lib/syntax/color/p3.d.ts +6 -0
  141. package/dist/lib/syntax/color/p3.js +0 -8
  142. package/dist/lib/syntax/color/prophotorgb.d.ts +2 -0
  143. package/dist/lib/syntax/color/rec2020.d.ts +2 -0
  144. package/dist/lib/syntax/color/rec2020.js +9 -13
  145. package/dist/lib/syntax/color/relativecolor.d.ts +13 -0
  146. package/dist/lib/syntax/color/relativecolor.js +68 -41
  147. package/dist/lib/syntax/color/rgb.d.ts +20 -0
  148. package/dist/lib/syntax/color/rgb.js +14 -18
  149. package/dist/lib/syntax/color/srgb.d.ts +23 -0
  150. package/dist/lib/syntax/color/srgb.js +27 -26
  151. package/dist/lib/syntax/color/utils/components.d.ts +2 -0
  152. package/dist/lib/syntax/color/utils/components.js +30 -14
  153. package/dist/lib/syntax/color/utils/distance.d.ts +18 -0
  154. package/dist/lib/syntax/color/utils/distance.js +1 -8
  155. package/dist/lib/syntax/color/utils/matrix.d.ts +6 -0
  156. package/dist/lib/syntax/color/xyz.d.ts +5 -0
  157. package/dist/lib/syntax/color/xyz.js +8 -20
  158. package/dist/lib/syntax/color/xyzd50.d.ts +4 -0
  159. package/dist/lib/syntax/color/xyzd50.js +6 -20
  160. package/dist/lib/syntax/constants.d.ts +67 -0
  161. package/dist/lib/syntax/constants.js +436 -0
  162. package/dist/lib/syntax/syntax.d.ts +38 -0
  163. package/dist/lib/syntax/syntax.js +533 -568
  164. package/dist/lib/validation/config.d.ts +14 -0
  165. package/dist/lib/validation/config.js +72 -33
  166. package/dist/lib/validation/config.json.js +1159 -74
  167. package/dist/lib/validation/json.d.ts +2 -0
  168. package/dist/lib/validation/match.d.ts +38 -0
  169. package/dist/lib/validation/match.js +2985 -0
  170. package/dist/lib/validation/parser/parse.d.ts +8 -0
  171. package/dist/lib/validation/parser/parse.js +684 -935
  172. package/dist/lib/validation/parser/typedef.d.ts +95 -0
  173. package/dist/lib/validation/parser/typedef.js +100 -0
  174. package/dist/lib/validation/utils/list.d.ts +4 -0
  175. package/dist/lib/validation/utils/list.js +4 -11
  176. package/dist/lib/validation/utils/whitespace.d.ts +2 -0
  177. package/dist/lib/validation/utils/whitespace.js +2 -8
  178. package/dist/node.d.ts +207 -0
  179. package/dist/node.js +42 -39
  180. package/dist/web.d.ts +169 -0
  181. package/dist/web.js +38 -33
  182. package/package.json +15 -12
  183. package/playground/index.html +1328 -0
  184. package/playground/sw.js +55 -0
  185. package/playground/tree.js +176 -0
  186. package/dist/lib/syntax/color/utils/constants.js +0 -214
  187. package/dist/lib/syntax/utils.js +0 -70
  188. package/dist/lib/validation/at-rules/container.js +0 -342
  189. package/dist/lib/validation/at-rules/counter-style.js +0 -90
  190. package/dist/lib/validation/at-rules/custom-media.js +0 -50
  191. package/dist/lib/validation/at-rules/document.js +0 -89
  192. package/dist/lib/validation/at-rules/else.js +0 -5
  193. package/dist/lib/validation/at-rules/font-feature-values.js +0 -63
  194. package/dist/lib/validation/at-rules/import.js +0 -150
  195. package/dist/lib/validation/at-rules/keyframes.js +0 -67
  196. package/dist/lib/validation/at-rules/layer.js +0 -41
  197. package/dist/lib/validation/at-rules/media.js +0 -255
  198. package/dist/lib/validation/at-rules/namespace.js +0 -81
  199. package/dist/lib/validation/at-rules/page-margin-box.js +0 -64
  200. package/dist/lib/validation/at-rules/page.js +0 -100
  201. package/dist/lib/validation/at-rules/supports.js +0 -295
  202. package/dist/lib/validation/at-rules/when.js +0 -185
  203. package/dist/lib/validation/atrule.js +0 -184
  204. package/dist/lib/validation/selector.js +0 -36
  205. package/dist/lib/validation/syntax.js +0 -1073
  206. package/dist/lib/validation/syntaxes/complex-selector-list.js +0 -27
  207. package/dist/lib/validation/syntaxes/complex-selector.js +0 -52
  208. package/dist/lib/validation/syntaxes/compound-selector.js +0 -196
  209. package/dist/lib/validation/syntaxes/family-name.js +0 -57
  210. package/dist/lib/validation/syntaxes/keyframe-selector.js +0 -36
  211. package/dist/lib/validation/syntaxes/layer-name.js +0 -57
  212. package/dist/lib/validation/syntaxes/relative-selector-list.js +0 -31
  213. package/dist/lib/validation/syntaxes/relative-selector.js +0 -38
  214. package/dist/lib/validation/syntaxes/selector-list.js +0 -5
  215. package/dist/lib/validation/syntaxes/selector.js +0 -5
  216. package/dist/lib/validation/syntaxes/url.js +0 -40
@@ -1,10 +1,4 @@
1
- import { EnumToken, ColorType } from '../../ast/types.js';
2
- import '../../ast/minify.js';
3
- import '../../ast/walk.js';
4
- import '../../parser/parse.js';
5
- import '../../parser/tokenize.js';
6
- import '../../parser/utils/config.js';
7
- import { isIdentColor } from '../syntax.js';
1
+ import { ColorType, EnumToken } from '../../ast/types.js';
8
2
  import { color2RgbToken, lch2RgbToken, lab2RgbToken, oklch2RgbToken, oklab2RgbToken, cmyk2RgbToken, hwb2RgbToken, hsl2RgbToken, hex2RgbToken, cmyk2rgbvalues } from './rgb.js';
9
3
  import { color2HslToken, lch2HslToken, lab2HslToken, oklch2HslToken, oklab2HslToken, cmyk2HslToken, hwb2HslToken, hex2HslToken, rgb2HslToken } from './hsl.js';
10
4
  import { color2hwbToken, cmyk2hwbToken, lch2hwbToken, lab2hwbToken, oklch2hwbToken, oklab2hwbToken, hsl2hwbToken, rgb2hwbToken } from './hwb.js';
@@ -12,7 +6,6 @@ import { color2labToken, oklch2labToken, oklab2labToken, lch2labToken, cmyk2labT
12
6
  import { color2lchToken, oklch2lchToken, oklab2lchToken, lab2lchToken, cmyk2lchToken, hwb2lchToken, hsl2lchToken, rgb2lchToken, hex2lchToken } from './lch.js';
13
7
  import { color2oklabToken, oklch2oklabToken, lch2oklabToken, lab2oklabToken, cmyk2oklabToken, hwb2oklabToken, hsl2oklabToken, rgb2oklabToken, hex2oklabToken } from './oklab.js';
14
8
  import { color2oklchToken, lch2oklchToken, oklab2oklchToken, lab2oklchToken, cmyk2oklchToken, hwb2oklchToken, hsl2oklchToken, rgb2oklchToken, hex2oklchToken } from './oklch.js';
15
- import { colorFuncColorSpace, colorPrecision, anglePrecision } from './utils/constants.js';
16
9
  import { getComponents } from './utils/components.js';
17
10
  import { oklch2srgbvalues, lch2srgbvalues, oklab2srgbvalues, lab2srgbvalues, hwb2srgbvalues, hsl2srgb, rgb2srgb, hex2srgbvalues, xyz2srgb, lsrgb2srgbvalues, srgb2lsrgbvalues } from './srgb.js';
18
11
  import { prophotorgb2srgbvalues, srgb2prophotorgbvalues } from './prophotorgb.js';
@@ -23,10 +16,11 @@ import { xyzd502srgb } from './xyzd50.js';
23
16
  import { colorMix } from './color-mix.js';
24
17
  import { reduceHexValue, rgb2HexToken, color2HexToken, lch2HexToken, lab2HexToken, oklch2HexToken, oklab2HexToken, cmyk2HexToken, hwb2HexToken, hsl2HexToken } from './hex.js';
25
18
  import { parseRelativeColor } from './relativecolor.js';
19
+ import { isIdentColor } from '../syntax.js';
26
20
  import { color2cmykToken, lch2cmykToken, lab2cmykToken, oklch2cmykToken, oklab2cmyk, hwb2cmykToken, hsl2cmykToken, rgb2cmykToken } from './cmyk.js';
27
21
  import { a98rgb2srgbvalues, srgb2a98values } from './a98rgb.js';
28
22
  import { epsilon } from '../../ast/transform/utils.js';
29
- import '../../renderer/sourcemap/lib/encode.js';
23
+ import { definedPropertySettings, colorFuncColorSpace, colorPrecision, anglePrecision } from '../constants.js';
30
24
 
31
25
  /**
32
26
  * Converts a color to another color space
@@ -35,29 +29,26 @@ import '../../renderer/sourcemap/lib/encode.js';
35
29
  *
36
30
  * @private
37
31
  *
38
- * <code>
32
+ * ```ts
39
33
  *
40
34
  * const token = {typ: EnumToken.ColorTokenType, kin: ColorType.HEX, val: '#F00'}
41
35
  * const result = convertColor(token, ColorType.LCH);
42
36
  *
43
- * </code>
37
+ * ```
44
38
  */
45
39
  function convertColor(token, to) {
46
40
  if (token.kin == ColorType.SYS ||
47
41
  token.kin == ColorType.DPSYS ||
48
- (isIdentColor(token) &&
49
- 'currentcolor' == token.val.toLowerCase())) {
42
+ (isIdentColor(token) && "currentcolor" == token.val.toLowerCase())) {
50
43
  return token;
51
44
  }
52
45
  if (token.kin == ColorType.COLOR_MIX && to != ColorType.COLOR_MIX) {
53
46
  const children = token.chi.reduce((acc, t) => {
54
- if (t.typ == EnumToken.ColorTokenType) {
55
- acc.push([t]);
47
+ if (t.typ === EnumToken.CommaTokenType) {
48
+ acc.push([]);
56
49
  }
57
- else {
58
- if (![EnumToken.WhitespaceTokenType, EnumToken.CommentTokenType, EnumToken.CommaTokenType].includes(t.typ)) {
59
- acc[acc.length - 1].push(t);
60
- }
50
+ else if (t.typ !== EnumToken.WhitespaceTokenType && t.typ !== EnumToken.CommentTokenType) {
51
+ acc[acc.length - 1].push(t);
61
52
  }
62
53
  return acc;
63
54
  }, [[]]);
@@ -66,35 +57,40 @@ function convertColor(token, to) {
66
57
  return null;
67
58
  }
68
59
  }
69
- if (token.cal == 'rel' && ['rgb', 'hsl', 'hwb', 'lab', 'lch', 'oklab', 'oklch', 'color'].includes(token.val.toLowerCase())) {
60
+ if (token.cal == "rel" &&
61
+ ["rgb", "hsl", "hwb", "lab", "lch", "oklab", "oklch", "color"].includes(token.val.toLowerCase())) {
70
62
  const chi = getComponents(token);
71
- const offset = token.val == 'color' ? 2 : 1;
63
+ const offset = token.val == "color" ? 2 : 1;
72
64
  if (chi != null) {
73
65
  // @ts-ignore
74
66
  const color = chi[1];
75
- const components = parseRelativeColor(token.val.toLowerCase() == 'color' ? chi[offset].val : token.val, color, chi[offset + 1], chi[offset + 2], chi[offset + 3], chi[offset + 4]);
76
- if (components != null) {
77
- token = {
78
- ...token,
79
- chi: [...(token.val == 'color' ? [chi[offset]] : []), ...Object.values(components)],
80
- kin: ColorType[token.val.toUpperCase().replaceAll('-', '_')]
81
- };
82
- delete token.cal;
67
+ const components = parseRelativeColor(token.val.toLowerCase() == "color"
68
+ ? chi[offset].val
69
+ : token.val, color, chi[offset + 1], chi[offset + 2], chi[offset + 3], chi[offset + 4]);
70
+ if (components == null) {
71
+ return null;
83
72
  }
73
+ let { cal, ...tk } = {
74
+ ...token,
75
+ chi: [...(token.val == "color" ? [chi[offset]] : []), ...Object.values(components)],
76
+ kin: ColorType[token.val.toUpperCase().replaceAll("-", "_")],
77
+ };
78
+ Object.defineProperty(tk, "loc", { ...definedPropertySettings, value: token.loc });
79
+ token = tk;
84
80
  }
85
81
  }
86
82
  if (token.kin == to) {
87
83
  if (token.kin == ColorType.HEX || token.kin == ColorType.LIT) {
88
84
  token.val = reduceHexValue(token.val);
89
- token.kin = token.val[0] == '#' ? ColorType.HEX : ColorType.LIT;
85
+ token.kin = token.val[0] == "#" ? ColorType.HEX : ColorType.LIT;
90
86
  }
91
87
  return token;
92
88
  }
93
89
  if (token.kin == ColorType.COLOR) {
94
- const colorSpace = token.chi.find(t => ![EnumToken.WhitespaceTokenType, EnumToken.CommentTokenType].includes(t.typ));
95
- if (colorSpace.val == ColorType[to].toLowerCase().replaceAll('_', '-')) {
90
+ const colorSpace = token.chi.find((t) => ![EnumToken.WhitespaceTokenType, EnumToken.CommentTokenType].includes(t.typ));
91
+ if (colorSpace.val == ColorType[to].toLowerCase().replaceAll("_", "-")) {
96
92
  for (const chi of token.chi) {
97
- if (chi.typ == EnumToken.NumberTokenType && typeof chi.val == 'number') {
93
+ if (chi.typ == EnumToken.NumberTokenType && typeof chi.val == "number") {
98
94
  chi.val = toPrecisionValue(getNumber(chi));
99
95
  }
100
96
  }
@@ -169,7 +165,6 @@ function convertColor(token, to) {
169
165
  return oklch2cmykToken(token);
170
166
  case ColorType.LAB:
171
167
  return lab2cmykToken(token);
172
- //
173
168
  case ColorType.LCH:
174
169
  return lch2cmykToken(token);
175
170
  case ColorType.COLOR:
@@ -183,8 +178,8 @@ function convertColor(token, to) {
183
178
  const val = reduceHexValue(token.val);
184
179
  return {
185
180
  typ: EnumToken.ColorTokenType,
186
- val,
187
- kin: val[0] == '#' ? ColorType.HEX : ColorType.LIT
181
+ val: val,
182
+ kin: val[0] == "#" ? ColorType.HEX : ColorType.LIT,
188
183
  };
189
184
  }
190
185
  case ColorType.HSL:
@@ -331,7 +326,7 @@ function convertColor(token, to) {
331
326
  return color2oklchToken(token);
332
327
  }
333
328
  }
334
- else if (colorFuncColorSpace.includes(ColorType[to].toLowerCase().replaceAll('_', '-').toLowerCase().replaceAll('_', '-'))) {
329
+ else if (colorFuncColorSpace.includes(ColorType[to].toLowerCase().replaceAll("_", "-").toLowerCase().replaceAll("_", "-"))) {
335
330
  switch (token.kin) {
336
331
  case ColorType.HEX:
337
332
  case ColorType.LIT:
@@ -485,36 +480,35 @@ function color2srgbvalues(token) {
485
480
  const colorSpace = components.shift();
486
481
  let values = components.map((val) => getNumber(val));
487
482
  switch (colorSpace.val.toLowerCase()) {
488
- case 'display-p3':
483
+ case "display-p3":
489
484
  // @ts-ignore
490
485
  values = p32srgbvalues(...values);
491
486
  break;
492
- case 'srgb-linear':
487
+ case "srgb-linear":
493
488
  // @ts-ignore
494
489
  values = lsrgb2srgbvalues(...values);
495
490
  break;
496
- case 'prophoto-rgb':
491
+ case "prophoto-rgb":
497
492
  // @ts-ignore
498
493
  values = prophotorgb2srgbvalues(...values);
499
494
  break;
500
- case 'a98-rgb':
495
+ case "a98-rgb":
501
496
  // @ts-ignore
502
497
  values = a98rgb2srgbvalues(...values);
503
498
  break;
504
- case 'rec2020':
499
+ case "rec2020":
505
500
  // @ts-ignore
506
501
  values = rec20202srgb(...values);
507
502
  break;
508
- case 'xyz':
509
- case 'xyz-d65':
503
+ case "xyz":
504
+ case "xyz-d65":
510
505
  // @ts-ignore
511
506
  values = xyz2srgb(...values);
512
507
  break;
513
- case 'xyz-d50':
508
+ case "xyz-d50":
514
509
  // @ts-ignore
515
510
  values = xyzd502srgb(...values);
516
511
  break;
517
- // case srgb:
518
512
  }
519
513
  return values;
520
514
  }
@@ -528,31 +522,34 @@ function values2colortoken(values, to) {
528
522
  if (values.length == 4) {
529
523
  chi.push({ typ: EnumToken.LiteralTokenType, val: "/" }, {
530
524
  typ: EnumToken.PercentageTokenType,
531
- val: values[3] * 100
525
+ val: values[3] * 100,
532
526
  });
533
527
  }
534
- const colorSpace = ColorType[to].toLowerCase().replaceAll('_', '-');
535
- return colorFuncColorSpace.includes(colorSpace) ? {
536
- typ: EnumToken.ColorTokenType,
537
- val: 'color',
538
- chi: [{ typ: EnumToken.IdenTokenType, val: colorSpace }].concat(chi),
539
- kin: ColorType.COLOR
540
- } : {
541
- typ: EnumToken.ColorTokenType,
542
- val: colorSpace,
543
- chi,
544
- kin: to
545
- };
528
+ const colorSpace = ColorType[to].toLowerCase().replaceAll("_", "-");
529
+ return colorFuncColorSpace.includes(colorSpace)
530
+ ? {
531
+ typ: EnumToken.ColorTokenType,
532
+ val: "color",
533
+ chi: [{ typ: EnumToken.IdenTokenType, val: colorSpace }].concat(chi),
534
+ kin: ColorType.COLOR,
535
+ }
536
+ : {
537
+ typ: EnumToken.ColorTokenType,
538
+ val: colorSpace,
539
+ chi,
540
+ kin: to,
541
+ };
546
542
  }
547
543
  function getNumber(token) {
548
- if (token.typ == EnumToken.IdenTokenType && token.val == 'none') {
544
+ if (token.typ == EnumToken.IdenTokenType && token.val == "none") {
549
545
  return 0;
550
546
  }
551
547
  let val;
552
548
  // @ts-ignore
553
- if (typeof token.val != 'number' && token.val?.typ == EnumToken.FractionTokenType) {
554
- // @ts-ignore
555
- val = token.val.l.val / token.val.r.val;
549
+ if (typeof token.val != "number" && token.val?.typ == EnumToken.FractionTokenType) {
550
+ val = (token.val.l.val /
551
+ // @ts-expect-error
552
+ token.val.r.val);
556
553
  }
557
554
  else {
558
555
  val = token.val;
@@ -566,22 +563,22 @@ function getNumber(token) {
566
563
  */
567
564
  function getAngle(token) {
568
565
  if (token.typ == EnumToken.IdenTokenType) {
569
- if (token.val == 'none') {
566
+ if (token.val == "none") {
570
567
  return 0;
571
568
  }
572
569
  }
573
570
  if (token.typ == EnumToken.AngleTokenType) {
574
571
  switch (token.unit) {
575
- case 'deg':
572
+ case "deg":
576
573
  // @ts-ignore
577
574
  return token.val / 360;
578
- case 'rad':
575
+ case "rad":
579
576
  // @ts-ignore
580
577
  return token.val / (2 * Math.PI);
581
- case 'grad':
578
+ case "grad":
582
579
  // @ts-ignore
583
580
  return token.val / 400;
584
- case 'turn':
581
+ case "turn":
585
582
  // @ts-ignore
586
583
  return +token.val;
587
584
  }
@@ -0,0 +1,16 @@
1
+ import type { ColorToken } from "../../../@types/index.d.ts";
2
+ export declare function reduceHexValue(value: string): string;
3
+ export declare function expandHexValue(value: string): string;
4
+ export declare function rgb2HexToken(token: ColorToken): ColorToken | null;
5
+ export declare function hsl2HexToken(token: ColorToken): ColorToken | null;
6
+ export declare function cmyk2HexToken(token: ColorToken): ColorToken | null;
7
+ export declare function hwb2HexToken(token: ColorToken): ColorToken | null;
8
+ export declare function color2HexToken(token: ColorToken): ColorToken | null;
9
+ export declare function oklab2HexToken(token: ColorToken): ColorToken | null;
10
+ export declare function oklch2HexToken(token: ColorToken): ColorToken | null;
11
+ export declare function lab2HexToken(token: ColorToken): ColorToken | null;
12
+ export declare function lch2HexToken(token: ColorToken): ColorToken | null;
13
+ export declare function rgb2hexvalues(token: ColorToken): string | null;
14
+ export declare function hsl2hexvalues(token: ColorToken): string | null;
15
+ export declare function hwb2hexvalues(token: ColorToken): string | null;
16
+ export declare function cmyk2hexvalues(token: ColorToken): string | null;
@@ -1,39 +1,28 @@
1
1
  import { EnumToken, ColorType } from '../../ast/types.js';
2
- import '../../ast/minify.js';
3
- import '../../ast/walk.js';
4
- import '../../parser/parse.js';
5
- import '../../parser/tokenize.js';
6
- import '../../parser/utils/config.js';
7
2
  import { color2srgbvalues, getNumber } from './color.js';
8
3
  import { srgb2rgb, cmyk2rgbvalues, hwb2rgbvalues, hsl2rgbvalues } from './rgb.js';
9
- import { COLORS_NAMES, NAMES_COLORS } from './utils/constants.js';
10
4
  import { getComponents } from './utils/components.js';
11
5
  import { lch2srgbvalues, lab2srgbvalues, oklch2srgbvalues, oklab2srgbvalues } from './srgb.js';
12
- import '../../renderer/sourcemap/lib/encode.js';
6
+ import { COLORS_NAMES, NAMES_COLORS } from '../constants.js';
13
7
 
14
8
  function toHexString(acc, value) {
15
- return acc + value.toString(16).padStart(2, '0');
9
+ return acc + value.toString(16).padStart(2, "0");
16
10
  }
17
11
  function reduceHexValue(value) {
18
- if (value[0] != '#') {
12
+ if (value[0] != "#") {
19
13
  value = COLORS_NAMES[value.toLowerCase()] ?? value;
20
14
  }
21
15
  const named_color = NAMES_COLORS[expandHexValue(value)];
22
16
  if (value.length == 7) {
23
- if (value[1] == value[2] &&
24
- value[3] == value[4] &&
25
- value[5] == value[6]) {
17
+ if (value[1] == value[2] && value[3] == value[4] && value[5] == value[6]) {
26
18
  value = `#${value[1]}${value[3]}${value[5]}`;
27
19
  }
28
20
  }
29
21
  else if (value.length == 9) {
30
- if (value[1] == value[2] &&
31
- value[3] == value[4] &&
32
- value[5] == value[6] &&
33
- value[7] == value[8]) {
34
- value = `#${value[1]}${value[3]}${value[5]}${value[7] == 'f' ? '' : value[7]}`;
22
+ if (value[1] == value[2] && value[3] == value[4] && value[5] == value[6] && value[7] == value[8]) {
23
+ value = `#${value[1]}${value[3]}${value[5]}${value[7] == "f" ? "" : value[7]}`;
35
24
  }
36
- if (value.endsWith('ff')) {
25
+ if (value.endsWith("ff")) {
37
26
  value = value.slice(0, -2);
38
27
  }
39
28
  }
@@ -81,46 +70,46 @@ function color2HexToken(token) {
81
70
  if (value == null) {
82
71
  return null;
83
72
  }
84
- return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, '0'), '#'));
73
+ return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, "0"), "#"));
85
74
  }
86
75
  function oklab2HexToken(token) {
87
76
  let value = oklab2srgbvalues(token);
88
77
  if (value == null) {
89
78
  return null;
90
79
  }
91
- return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, '0'), '#'));
80
+ return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, "0"), "#"));
92
81
  }
93
82
  function oklch2HexToken(token) {
94
83
  let value = oklch2srgbvalues(token);
95
84
  if (value == null) {
96
85
  return null;
97
86
  }
98
- return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, '0'), '#'));
87
+ return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, "0"), "#"));
99
88
  }
100
89
  function lab2HexToken(token) {
101
90
  let value = lab2srgbvalues(token);
102
91
  if (value == null) {
103
92
  return null;
104
93
  }
105
- return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, '0'), '#'));
94
+ return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, "0"), "#"));
106
95
  }
107
96
  function lch2HexToken(token) {
108
97
  let value = lch2srgbvalues(token);
109
98
  if (value == null) {
110
99
  return null;
111
100
  }
112
- return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, '0'), '#'));
101
+ return hexToken(value.reduce((acc, curr) => acc + srgb2rgb(curr).toString(16).padStart(2, "0"), "#"));
113
102
  }
114
103
  function hexToken(value) {
115
104
  value = reduceHexValue(value);
116
105
  return {
117
106
  typ: EnumToken.ColorTokenType,
118
107
  val: value,
119
- kin: value[0] == '#' ? ColorType.HEX : ColorType.LIT
108
+ kin: value[0] == "#" ? ColorType.HEX : ColorType.LIT,
120
109
  };
121
110
  }
122
111
  function rgb2hexvalues(token) {
123
- let value = '#';
112
+ let value = "#";
124
113
  let t;
125
114
  // @ts-ignore
126
115
  const components = getComponents(token);
@@ -131,8 +120,13 @@ function rgb2hexvalues(token) {
131
120
  for (let i = 0; i < 3; i++) {
132
121
  // @ts-ignore
133
122
  t = components[i];
134
- // @ts-ignore
135
- value += (t.typ == EnumToken.Iden && t.val == 'none' ? '0' : Math.round(getNumber(t) * (t.typ == EnumToken.PercentageTokenType ? 255 : 1))).toString(16).padStart(2, '0');
123
+ value +=
124
+ ( // @ts-expect-error
125
+ t.typ == EnumToken.Iden && t.val == "none"
126
+ ? "0"
127
+ : Math.round(getNumber(t) * (t.typ == EnumToken.PercentageTokenType ? 255 : 1)))
128
+ .toString(16)
129
+ .padStart(2, "0");
136
130
  }
137
131
  // @ts-ignore
138
132
  if (components.length == 4) {
@@ -143,7 +137,9 @@ function rgb2hexvalues(token) {
143
137
  // @ts-ignore
144
138
  if (v < 1) {
145
139
  // @ts-ignore
146
- value += Math.round(255 * getNumber(t)).toString(16).padStart(2, '0');
140
+ value += Math.round(255 * getNumber(t))
141
+ .toString(16)
142
+ .padStart(2, "0");
147
143
  }
148
144
  }
149
145
  return value;
@@ -156,7 +152,7 @@ function hsl2hexvalues(token) {
156
152
  if (t.length == 4) {
157
153
  t[3] = srgb2rgb(t[3]);
158
154
  }
159
- return `${t.reduce(toHexString, '#')}`;
155
+ return `${t.reduce(toHexString, "#")}`;
160
156
  }
161
157
  function hwb2hexvalues(token) {
162
158
  const t = hwb2rgbvalues(token);
@@ -166,7 +162,7 @@ function hwb2hexvalues(token) {
166
162
  if (t.length == 4) {
167
163
  t[3] = srgb2rgb(t[3]);
168
164
  }
169
- return `${t.reduce(toHexString, '#')}`;
165
+ return `${t.reduce(toHexString, "#")}`;
170
166
  }
171
167
  function cmyk2hexvalues(token) {
172
168
  const t = cmyk2rgbvalues(token);
@@ -176,7 +172,7 @@ function cmyk2hexvalues(token) {
176
172
  if (t.length == 4) {
177
173
  t[3] = srgb2rgb(t[3]);
178
174
  }
179
- return `#${t.reduce(toHexString, '')}`;
175
+ return `#${t.reduce(toHexString, "")}`;
180
176
  }
181
177
 
182
178
  export { cmyk2HexToken, cmyk2hexvalues, color2HexToken, expandHexValue, hsl2HexToken, hsl2hexvalues, hwb2HexToken, hwb2hexvalues, lab2HexToken, lch2HexToken, oklab2HexToken, oklch2HexToken, reduceHexValue, rgb2HexToken, rgb2hexvalues };
@@ -0,0 +1,20 @@
1
+ import type { ColorToken } from "../../../@types/index.d.ts";
2
+ export declare function hex2HslToken(token: ColorToken): ColorToken | null;
3
+ export declare function rgb2HslToken(token: ColorToken): ColorToken | null;
4
+ export declare function hwb2HslToken(token: ColorToken): ColorToken | null;
5
+ export declare function cmyk2HslToken(token: ColorToken): ColorToken | null;
6
+ export declare function oklab2HslToken(token: ColorToken): ColorToken | null;
7
+ export declare function oklch2HslToken(token: ColorToken): ColorToken | null;
8
+ export declare function lab2HslToken(token: ColorToken): ColorToken | null;
9
+ export declare function lch2HslToken(token: ColorToken): ColorToken | null;
10
+ export declare function color2HslToken(token: ColorToken): ColorToken | null;
11
+ export declare function rgb2hslvalues(token: ColorToken): number[] | null;
12
+ export declare function hsv2hsl(h: number, s: number, v: number, a?: number): number[];
13
+ export declare function cmyk2hslvalues(token: ColorToken): number[];
14
+ export declare function hwb2hslvalues(token: ColorToken): [number, number, number, number];
15
+ export declare function lab2hslvalues(token: ColorToken): number[] | null;
16
+ export declare function lch2hslvalues(token: ColorToken): number[] | null;
17
+ export declare function oklab2hslvalues(token: ColorToken): number[] | null;
18
+ export declare function oklch2hslvalues(token: ColorToken): number[] | null;
19
+ export declare function rgbvalues2hslvalues(r: number, g: number, b: number, a?: number | null): number[];
20
+ export declare function srgb2hslvalues(r: number, g: number, b: number, a?: number | null): number[];
@@ -1,16 +1,9 @@
1
1
  import { hwb2hsv } from './hsv.js';
2
2
  import { color2srgbvalues, toPrecisionAngle, toPrecisionValue, getNumber } from './color.js';
3
3
  import { lch2rgbvalues, lab2rgbvalues, cmyk2rgbvalues } from './rgb.js';
4
- import './utils/constants.js';
5
4
  import { getComponents } from './utils/components.js';
6
5
  import { hex2srgbvalues, oklch2srgbvalues, oklab2srgbvalues, hslvalues } from './srgb.js';
7
6
  import { EnumToken, ColorType } from '../../ast/types.js';
8
- import '../../ast/minify.js';
9
- import '../../ast/walk.js';
10
- import '../../parser/parse.js';
11
- import '../../parser/tokenize.js';
12
- import '../../parser/utils/config.js';
13
- import '../../renderer/sourcemap/lib/encode.js';
14
7
 
15
8
  function hex2HslToken(token) {
16
9
  // @ts-ignore
@@ -81,16 +74,16 @@ function hslToken(values) {
81
74
  { typ: EnumToken.PercentageTokenType, val: toPrecisionValue(values[2]) * 100 },
82
75
  ];
83
76
  if (values.length == 4 && values[3] != 1) {
84
- chi.push({ typ: EnumToken.LiteralTokenType, val: '/' }, {
77
+ chi.push({ typ: EnumToken.LiteralTokenType, val: "/" }, {
85
78
  typ: EnumToken.PercentageTokenType,
86
- val: values[3] * 100
79
+ val: values[3] * 100,
87
80
  });
88
81
  }
89
82
  return {
90
83
  typ: EnumToken.ColorTokenType,
91
- val: 'hsl',
84
+ val: "hsl",
92
85
  chi,
93
- kin: ColorType.HSL
86
+ kin: ColorType.HSL,
94
87
  };
95
88
  }
96
89
  function rgb2hslvalues(token) {
@@ -132,7 +125,7 @@ function hsv2hsl(h, s, v, a) {
132
125
  //If (2-sat)*val < 1 set it to sat*val/((2-sat)*val)
133
126
  //Otherwise sat*val/(2-(2-sat)*val)
134
127
  //Conditional is not operating with hue, it is reassigned!
135
- s * v / ((h = (2 - s) * v) < 1 ? h : 2 - h),
128
+ (s * v) / ((h = (2 - s) * v) < 1 ? h : 2 - h),
136
129
  h / 2, //Lightness is (2-sat)*val/2
137
130
  ];
138
131
  if (a != null) {
@@ -0,0 +1,2 @@
1
+ export declare function hwb2hsv(h: number, w: number, b: number, a?: number): [number, number, number, number | null];
2
+ export declare function hsl2hsv(h: number, s: number, l: number, a?: number | null): number[];
@@ -0,0 +1,21 @@
1
+ import type { ColorToken } from "../../../@types/index.d.ts";
2
+ export declare function rgb2hwbToken(token: ColorToken): ColorToken | null;
3
+ export declare function hsl2hwbToken(token: ColorToken): ColorToken | null;
4
+ export declare function cmyk2hwbToken(token: ColorToken): ColorToken | null;
5
+ export declare function oklab2hwbToken(token: ColorToken): ColorToken | null;
6
+ export declare function oklch2hwbToken(token: ColorToken): ColorToken | null;
7
+ export declare function lab2hwbToken(token: ColorToken): ColorToken | null;
8
+ export declare function lch2hwbToken(token: ColorToken): ColorToken | null;
9
+ export declare function color2hwbToken(token: ColorToken): ColorToken | null;
10
+ export declare function hwbToken(values: number[]): ColorToken;
11
+ export declare function rgb2hwbvalues(token: ColorToken): number[];
12
+ export declare function cmyk2hwbvalues(token: ColorToken): number[];
13
+ export declare function hsl2hwbvalues(token: ColorToken): number[];
14
+ export declare function lab2hwbvalues(token: ColorToken): number[] | null;
15
+ export declare function lch2hwbvalues(token: ColorToken): number[] | null;
16
+ export declare function oklab2hwbvalues(token: ColorToken): number[] | null;
17
+ export declare function oklch2hwbvalues(token: ColorToken): number[];
18
+ export declare function color2hwbvalues(token: ColorToken): number[] | null;
19
+ export declare function srgb2hwb(r: number, g: number, b: number, a?: number | null, fallback?: number): number[];
20
+ export declare function hsv2hwb(h: number, s: number, v: number, a?: number | null): number[];
21
+ export declare function hslvalues2hwbvalues(h: number, s: number, l: number, a?: number | null): number[];
@@ -1,15 +1,8 @@
1
1
  import { hsl2hsv } from './hsv.js';
2
- import './utils/constants.js';
3
2
  import { getComponents } from './utils/components.js';
4
3
  import { color2srgbvalues, toPrecisionAngle, toPrecisionValue, getAngle, getNumber } from './color.js';
5
- import { cmyk2srgbvalues, lch2srgbvalues, lab2srgbvalues, oklch2srgbvalues, oklab2srgbvalues } from './srgb.js';
6
4
  import { EnumToken, ColorType } from '../../ast/types.js';
7
- import '../../ast/minify.js';
8
- import '../../ast/walk.js';
9
- import '../../parser/parse.js';
10
- import '../../parser/tokenize.js';
11
- import '../../parser/utils/config.js';
12
- import '../../renderer/sourcemap/lib/encode.js';
5
+ import { cmyk2srgbvalues, lch2srgbvalues, lab2srgbvalues, oklch2srgbvalues, oklab2srgbvalues } from './srgb.js';
13
6
 
14
7
  function rgb2hwbToken(token) {
15
8
  const values = rgb2hwbvalues(token);
@@ -75,16 +68,16 @@ function hwbToken(values) {
75
68
  { typ: EnumToken.PercentageTokenType, val: toPrecisionValue(values[2]) * 100 },
76
69
  ];
77
70
  if (values.length == 4) {
78
- chi.push({ typ: EnumToken.LiteralTokenType, val: '/' }, {
71
+ chi.push({ typ: EnumToken.LiteralTokenType, val: "/" }, {
79
72
  typ: EnumToken.PercentageTokenType,
80
- val: values[3] * 100
73
+ val: values[3] * 100,
81
74
  });
82
75
  }
83
76
  return {
84
77
  typ: EnumToken.ColorTokenType,
85
- val: 'hwb',
78
+ val: "hwb",
86
79
  chi,
87
- kin: ColorType.HWB
80
+ kin: ColorType.HWB,
88
81
  };
89
82
  }
90
83
  function rgb2hwbvalues(token) {
@@ -103,7 +96,7 @@ function cmyk2hwbvalues(token) {
103
96
  function hsl2hwbvalues(token) {
104
97
  // @ts-ignore
105
98
  return hslvalues2hwbvalues(...getComponents(token).map((t, index) => {
106
- if (index == 3 && (t.typ == EnumToken.IdenTokenType && t.val == 'none')) {
99
+ if (index == 3 && t.typ == EnumToken.IdenTokenType && t.val == "none") {
107
100
  return 1;
108
101
  }
109
102
  if (index == 0) {
@@ -147,15 +140,9 @@ function rgb2hue(r, g, b, fallback = 0) {
147
140
  let delta = value - whiteness;
148
141
  if (delta > 0) {
149
142
  // calculate segment
150
- let segment = value === r ? (g - b) / delta : (value === g
151
- ? (b - r) / delta
152
- : (r - g) / delta);
143
+ let segment = value === r ? (g - b) / delta : value === g ? (b - r) / delta : (r - g) / delta;
153
144
  // calculate shift
154
- let shift = value === r ? segment < 0
155
- ? 360 / 60
156
- : 0 / 60 : (value === g
157
- ? 120 / 60
158
- : 240 / 60);
145
+ let shift = value === r ? (segment < 0 ? 360 / 60 : 0 / 60) : value === g ? 120 / 60 : 240 / 60;
159
146
  // calculate hue
160
147
  return (segment + shift) * 60;
161
148
  }
@@ -0,0 +1,25 @@
1
+ import type { ColorToken } from "../../../@types/index.d.ts";
2
+ export declare function hex2labToken(token: ColorToken): ColorToken | null;
3
+ export declare function rgb2labToken(token: ColorToken): ColorToken | null;
4
+ export declare function hsl2labToken(token: ColorToken): ColorToken | null;
5
+ export declare function hwb2labToken(token: ColorToken): ColorToken | null;
6
+ export declare function cmyk2labToken(token: ColorToken): ColorToken | null;
7
+ export declare function lch2labToken(token: ColorToken): ColorToken | null;
8
+ export declare function oklab2labToken(token: ColorToken): ColorToken | null;
9
+ export declare function oklch2labToken(token: ColorToken): ColorToken | null;
10
+ export declare function color2labToken(token: ColorToken): ColorToken | null;
11
+ export declare function hex2labvalues(token: ColorToken): number[] | null;
12
+ export declare function rgb2labvalues(token: ColorToken): number[] | null;
13
+ export declare function cmyk2labvalues(token: ColorToken): number[] | null;
14
+ export declare function hsl2labvalues(token: ColorToken): number[] | null;
15
+ export declare function hwb2labvalues(token: ColorToken): number[] | null;
16
+ export declare function lch2labvalues(token: ColorToken): number[] | null;
17
+ export declare function oklab2labvalues(token: ColorToken): number[] | null;
18
+ export declare function oklch2labvalues(token: ColorToken): number[] | null;
19
+ export declare function color2labvalues(token: ColorToken): number[] | null;
20
+ export declare function srgb2labvalues(r: number, g: number, b: number, a: number | null): number[];
21
+ export declare function xyz2lab(x: number, y: number, z: number, a?: number | null): number[];
22
+ export declare function lchvalues2labvalues(l: number, c: number, h: number, a?: number | null): number[];
23
+ export declare function getLABComponents(token: ColorToken): number[] | null;
24
+ export declare function Lab_to_sRGB(l: number, a: number, b: number): number[];
25
+ export declare function Lab_to_XYZ(l: number, a: number, b: number): number[];