@atlaskit/tokens 13.1.0 → 13.1.1

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 (277) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/codemods/css-to-design-tokens/lib/colors.tsx +3 -8
  3. package/codemods/css-to-design-tokens/lib/declaration.tsx +3 -13
  4. package/codemods/css-to-design-tokens/lib/extract-between-parentheses.tsx +4 -0
  5. package/codemods/css-to-design-tokens/lib/extract-less-var-name.tsx +3 -0
  6. package/codemods/css-to-design-tokens/lib/get-css-var-meta.tsx +13 -0
  7. package/codemods/css-to-design-tokens/lib/get-named-color-meta.tsx +5 -0
  8. package/codemods/css-to-design-tokens/lib/get-raw-color-meta.tsx +11 -0
  9. package/codemods/css-to-design-tokens/lib/is-css-declaration.tsx +3 -0
  10. package/codemods/css-to-design-tokens/lib/is-known-css-variable.tsx +5 -0
  11. package/codemods/css-to-design-tokens/lib/known-named-colors.tsx +150 -0
  12. package/codemods/css-to-design-tokens/lib/known-raw-colors.tsx +17 -0
  13. package/codemods/css-to-design-tokens/lib/known-variables.tsx +167 -0
  14. package/codemods/css-to-design-tokens/lib/legacy-colors.tsx +3 -335
  15. package/codemods/css-to-design-tokens/lib/meta.tsx +3 -28
  16. package/codemods/css-to-design-tokens/lib/split-css-value.tsx +4 -0
  17. package/codemods/css-to-design-tokens/lib/value.tsx +6 -9
  18. package/codemods/css-to-design-tokens/transform.tsx +3 -1
  19. package/dist/cjs/artifacts/palettes-raw/palette.js +35 -1
  20. package/dist/cjs/entry-points/theme-state-transformer.js +4 -3
  21. package/dist/cjs/get-custom-theme-styles.js +7 -6
  22. package/dist/cjs/get-global-theme.js +2 -2
  23. package/dist/cjs/get-theme-html-attrs.js +2 -2
  24. package/dist/cjs/index.js +4 -3
  25. package/dist/cjs/is-color-mode.js +9 -0
  26. package/dist/cjs/is-theme-ids.js +12 -0
  27. package/dist/cjs/is-theme-kind.js +12 -0
  28. package/dist/cjs/theme-config.js +8 -44
  29. package/dist/cjs/theme-object-to-string.js +42 -0
  30. package/dist/cjs/theme-options-schema.js +1 -0
  31. package/dist/cjs/theme-state-defaults.js +39 -0
  32. package/dist/cjs/theme-state.js +5 -0
  33. package/dist/cjs/theme-string-to-object.js +51 -0
  34. package/dist/cjs/utils/additional-contrast-checker.js +43 -0
  35. package/dist/cjs/utils/custom-theme-loading-utils.js +0 -22
  36. package/dist/cjs/utils/custom-theme-token-contrast-check.js +2 -40
  37. package/dist/cjs/utils/delta-e.js +26 -0
  38. package/dist/cjs/utils/generate-colors.js +47 -0
  39. package/dist/cjs/utils/generate-token-map-with-contrast-check.js +32 -0
  40. package/dist/cjs/utils/{generate-custom-color-ramp.js → generate-token-map.js} +6 -75
  41. package/dist/cjs/utils/get-closest-color-index.js +3 -2
  42. package/dist/cjs/utils/get-contrast-ratio.js +22 -0
  43. package/dist/cjs/utils/hct-color-utils/alpha-from-argb.js +12 -0
  44. package/dist/cjs/utils/hct-color-utils/argb-from-linrgb.js +17 -0
  45. package/dist/cjs/utils/hct-color-utils/argb-from-lstar.js +21 -0
  46. package/dist/cjs/utils/hct-color-utils/argb-from-rgba.js +24 -0
  47. package/dist/cjs/utils/hct-color-utils/argb-from-xyz.js +29 -0
  48. package/dist/cjs/utils/hct-color-utils/blue-from-argb.js +12 -0
  49. package/dist/cjs/utils/hct-color-utils/clamp-component.js +15 -0
  50. package/dist/cjs/utils/hct-color-utils/contrast.js +10 -11
  51. package/dist/cjs/utils/hct-color-utils/green-from-argb.js +12 -0
  52. package/dist/cjs/utils/hct-color-utils/hct.js +18 -12
  53. package/dist/cjs/utils/hct-color-utils/index.js +4 -3
  54. package/dist/cjs/utils/hct-color-utils/lab-f.js +15 -0
  55. package/dist/cjs/utils/hct-color-utils/lab-invf.js +16 -0
  56. package/dist/cjs/utils/hct-color-utils/lstar-from-argb.js +34 -0
  57. package/dist/cjs/utils/hct-color-utils/lstar-from-y.js +21 -0
  58. package/dist/cjs/utils/hct-color-utils/red-from-argb.js +12 -0
  59. package/dist/cjs/utils/hct-color-utils/rgba-from-argb.js +28 -0
  60. package/dist/cjs/utils/hct-color-utils/rgba.js +1 -0
  61. package/dist/cjs/utils/hct-color-utils/viewing-conditions.js +5 -4
  62. package/dist/cjs/utils/hct-color-utils/white-point-d65.js +14 -0
  63. package/dist/cjs/utils/hct-color-utils/y-from-lstar.js +21 -0
  64. package/dist/cjs/utils/hex-to-hsl.js +52 -0
  65. package/dist/cjs/utils/hex-to-rgb-a.js +20 -0
  66. package/dist/cjs/utils/hex-to-rgb.js +19 -0
  67. package/dist/cjs/utils/is-valid-hex.js +10 -0
  68. package/dist/cjs/utils/reduce-token-map.js +18 -0
  69. package/dist/cjs/utils/rgb-to-lab.js +24 -0
  70. package/dist/es2019/artifacts/palettes-raw/palette.js +35 -1
  71. package/dist/es2019/entry-points/theme-state-transformer.js +2 -1
  72. package/dist/es2019/get-custom-theme-styles.js +3 -2
  73. package/dist/es2019/get-global-theme.js +1 -1
  74. package/dist/es2019/get-theme-html-attrs.js +1 -1
  75. package/dist/es2019/index.js +2 -1
  76. package/dist/es2019/is-color-mode.js +3 -0
  77. package/dist/es2019/is-theme-ids.js +4 -0
  78. package/dist/es2019/is-theme-kind.js +4 -0
  79. package/dist/es2019/theme-config.js +4 -45
  80. package/dist/es2019/theme-object-to-string.js +28 -0
  81. package/dist/es2019/theme-options-schema.js +0 -0
  82. package/dist/es2019/theme-state-defaults.js +34 -0
  83. package/dist/es2019/theme-state.js +1 -0
  84. package/dist/es2019/theme-string-to-object.js +38 -0
  85. package/dist/es2019/utils/additional-contrast-checker.js +39 -0
  86. package/dist/es2019/utils/custom-theme-loading-utils.js +1 -11
  87. package/dist/es2019/utils/custom-theme-token-contrast-check.js +1 -41
  88. package/dist/es2019/utils/delta-e.js +20 -0
  89. package/dist/es2019/utils/generate-colors.js +39 -0
  90. package/dist/es2019/utils/generate-token-map-with-contrast-check.js +21 -0
  91. package/dist/es2019/utils/{generate-custom-color-ramp.js → generate-token-map.js} +3 -63
  92. package/dist/es2019/utils/get-closest-color-index.js +2 -1
  93. package/dist/es2019/utils/get-contrast-ratio.js +16 -0
  94. package/dist/es2019/utils/hct-color-utils/alpha-from-argb.js +6 -0
  95. package/dist/es2019/utils/hct-color-utils/argb-from-linrgb.js +12 -0
  96. package/dist/es2019/utils/hct-color-utils/argb-from-lstar.js +16 -0
  97. package/dist/es2019/utils/hct-color-utils/argb-from-rgba.js +19 -0
  98. package/dist/es2019/utils/hct-color-utils/argb-from-xyz.js +24 -0
  99. package/dist/es2019/utils/hct-color-utils/blue-from-argb.js +6 -0
  100. package/dist/es2019/utils/hct-color-utils/clamp-component.js +9 -0
  101. package/dist/es2019/utils/hct-color-utils/contrast.js +10 -10
  102. package/dist/es2019/utils/hct-color-utils/green-from-argb.js +6 -0
  103. package/dist/es2019/utils/hct-color-utils/hct.js +19 -12
  104. package/dist/es2019/utils/hct-color-utils/index.js +2 -1
  105. package/dist/es2019/utils/hct-color-utils/lab-f.js +9 -0
  106. package/dist/es2019/utils/hct-color-utils/lab-invf.js +10 -0
  107. package/dist/es2019/utils/hct-color-utils/lstar-from-argb.js +28 -0
  108. package/dist/es2019/utils/hct-color-utils/lstar-from-y.js +16 -0
  109. package/dist/es2019/utils/hct-color-utils/red-from-argb.js +6 -0
  110. package/dist/es2019/utils/hct-color-utils/rgba-from-argb.js +22 -0
  111. package/dist/es2019/utils/hct-color-utils/rgba.js +0 -0
  112. package/dist/es2019/utils/hct-color-utils/viewing-conditions.js +4 -3
  113. package/dist/es2019/utils/hct-color-utils/white-point-d65.js +8 -0
  114. package/dist/es2019/utils/hct-color-utils/y-from-lstar.js +16 -0
  115. package/dist/es2019/utils/hex-to-hsl.js +46 -0
  116. package/dist/es2019/utils/hex-to-rgb-a.js +14 -0
  117. package/dist/es2019/utils/hex-to-rgb.js +13 -0
  118. package/dist/es2019/utils/is-valid-hex.js +2 -0
  119. package/dist/es2019/utils/reduce-token-map.js +7 -0
  120. package/dist/es2019/utils/rgb-to-lab.js +18 -0
  121. package/dist/esm/artifacts/palettes-raw/palette.js +35 -1
  122. package/dist/esm/entry-points/theme-state-transformer.js +2 -1
  123. package/dist/esm/get-custom-theme-styles.js +3 -2
  124. package/dist/esm/get-global-theme.js +1 -1
  125. package/dist/esm/get-theme-html-attrs.js +1 -1
  126. package/dist/esm/index.js +2 -1
  127. package/dist/esm/is-color-mode.js +3 -0
  128. package/dist/esm/is-theme-ids.js +6 -0
  129. package/dist/esm/is-theme-kind.js +6 -0
  130. package/dist/esm/theme-config.js +4 -45
  131. package/dist/esm/theme-object-to-string.js +35 -0
  132. package/dist/esm/theme-options-schema.js +0 -0
  133. package/dist/esm/theme-state-defaults.js +34 -0
  134. package/dist/esm/theme-state.js +1 -0
  135. package/dist/esm/theme-string-to-object.js +44 -0
  136. package/dist/esm/utils/additional-contrast-checker.js +36 -0
  137. package/dist/esm/utils/custom-theme-loading-utils.js +1 -15
  138. package/dist/esm/utils/custom-theme-token-contrast-check.js +1 -38
  139. package/dist/esm/utils/delta-e.js +20 -0
  140. package/dist/esm/utils/generate-colors.js +40 -0
  141. package/dist/esm/utils/generate-token-map-with-contrast-check.js +25 -0
  142. package/dist/esm/utils/{generate-custom-color-ramp.js → generate-token-map.js} +3 -67
  143. package/dist/esm/utils/get-closest-color-index.js +2 -1
  144. package/dist/esm/utils/get-contrast-ratio.js +16 -0
  145. package/dist/esm/utils/hct-color-utils/alpha-from-argb.js +6 -0
  146. package/dist/esm/utils/hct-color-utils/argb-from-linrgb.js +12 -0
  147. package/dist/esm/utils/hct-color-utils/argb-from-lstar.js +16 -0
  148. package/dist/esm/utils/hct-color-utils/argb-from-rgba.js +18 -0
  149. package/dist/esm/utils/hct-color-utils/argb-from-xyz.js +24 -0
  150. package/dist/esm/utils/hct-color-utils/blue-from-argb.js +6 -0
  151. package/dist/esm/utils/hct-color-utils/clamp-component.js +9 -0
  152. package/dist/esm/utils/hct-color-utils/contrast.js +10 -10
  153. package/dist/esm/utils/hct-color-utils/green-from-argb.js +6 -0
  154. package/dist/esm/utils/hct-color-utils/hct.js +19 -12
  155. package/dist/esm/utils/hct-color-utils/index.js +2 -1
  156. package/dist/esm/utils/hct-color-utils/lab-f.js +9 -0
  157. package/dist/esm/utils/hct-color-utils/lab-invf.js +10 -0
  158. package/dist/esm/utils/hct-color-utils/lstar-from-argb.js +28 -0
  159. package/dist/esm/utils/hct-color-utils/lstar-from-y.js +16 -0
  160. package/dist/esm/utils/hct-color-utils/red-from-argb.js +6 -0
  161. package/dist/esm/utils/hct-color-utils/rgba-from-argb.js +22 -0
  162. package/dist/esm/utils/hct-color-utils/rgba.js +0 -0
  163. package/dist/esm/utils/hct-color-utils/viewing-conditions.js +5 -4
  164. package/dist/esm/utils/hct-color-utils/white-point-d65.js +8 -0
  165. package/dist/esm/utils/hct-color-utils/y-from-lstar.js +16 -0
  166. package/dist/esm/utils/hex-to-hsl.js +46 -0
  167. package/dist/esm/utils/hex-to-rgb-a.js +14 -0
  168. package/dist/esm/utils/hex-to-rgb.js +13 -0
  169. package/dist/esm/utils/is-valid-hex.js +4 -0
  170. package/dist/esm/utils/reduce-token-map.js +11 -0
  171. package/dist/esm/utils/rgb-to-lab.js +18 -0
  172. package/dist/types/artifacts/palettes-raw/palette.d.ts +1 -1
  173. package/dist/types/entry-points/theme-state-transformer.d.ts +2 -1
  174. package/dist/types/index.d.ts +2 -1
  175. package/dist/types/is-color-mode.d.ts +2 -0
  176. package/dist/types/is-theme-ids.d.ts +2 -0
  177. package/dist/types/is-theme-kind.d.ts +4 -0
  178. package/dist/types/theme-color-modes.d.ts +1 -0
  179. package/dist/types/theme-config.d.ts +8 -40
  180. package/dist/types/theme-ids.d.ts +1 -0
  181. package/dist/types/theme-object-to-string.d.ts +13 -0
  182. package/dist/types/theme-options-schema.d.ts +7 -0
  183. package/dist/types/theme-state-defaults.d.ts +14 -0
  184. package/dist/types/theme-state.d.ts +17 -0
  185. package/dist/types/{theme-state-transformer.d.ts → theme-string-to-object.d.ts} +0 -12
  186. package/dist/types/utils/additional-contrast-checker.d.ts +9 -0
  187. package/dist/types/utils/custom-theme-loading-utils.d.ts +1 -6
  188. package/dist/types/utils/custom-theme-token-contrast-check.d.ts +0 -9
  189. package/dist/types/utils/delta-e.d.ts +1 -0
  190. package/dist/types/utils/generate-colors.d.ts +5 -0
  191. package/dist/types/utils/{generate-custom-color-ramp.d.ts → generate-token-map-with-contrast-check.d.ts} +1 -6
  192. package/dist/types/utils/generate-token-map.d.ts +9 -0
  193. package/dist/types/utils/get-contrast-ratio.d.ts +1 -0
  194. package/dist/types/utils/hct-color-utils/alpha-from-argb.d.ts +4 -0
  195. package/dist/types/utils/hct-color-utils/argb-from-linrgb.d.ts +4 -0
  196. package/dist/types/utils/hct-color-utils/argb-from-lstar.d.ts +8 -0
  197. package/dist/types/utils/hct-color-utils/argb-from-rgba.d.ts +8 -0
  198. package/dist/types/utils/hct-color-utils/argb-from-xyz.d.ts +4 -0
  199. package/dist/types/utils/hct-color-utils/blue-from-argb.d.ts +4 -0
  200. package/dist/types/utils/hct-color-utils/clamp-component.d.ts +1 -0
  201. package/dist/types/utils/hct-color-utils/green-from-argb.d.ts +4 -0
  202. package/dist/types/utils/hct-color-utils/index.d.ts +2 -1
  203. package/dist/types/utils/hct-color-utils/lab-f.d.ts +1 -0
  204. package/dist/types/utils/hct-color-utils/lab-invf.d.ts +1 -0
  205. package/dist/types/utils/hct-color-utils/lstar-from-argb.d.ts +7 -0
  206. package/dist/types/utils/hct-color-utils/lstar-from-y.d.ts +12 -0
  207. package/dist/types/utils/hct-color-utils/red-from-argb.d.ts +4 -0
  208. package/dist/types/utils/hct-color-utils/rgba-from-argb.d.ts +8 -0
  209. package/dist/types/utils/hct-color-utils/rgba.d.ts +14 -0
  210. package/dist/types/utils/hct-color-utils/white-point-d65.d.ts +6 -0
  211. package/dist/types/utils/hct-color-utils/y-from-lstar.d.ts +12 -0
  212. package/dist/types/utils/hex-to-hsl.d.ts +1 -0
  213. package/dist/types/utils/hex-to-rgb-a.d.ts +1 -0
  214. package/dist/types/utils/hex-to-rgb.d.ts +1 -0
  215. package/dist/types/utils/is-valid-hex.d.ts +1 -0
  216. package/dist/types/utils/reduce-token-map.d.ts +6 -0
  217. package/dist/types/utils/rgb-to-lab.d.ts +1 -0
  218. package/dist/types-ts4.5/artifacts/palettes-raw/palette.d.ts +1 -1
  219. package/dist/types-ts4.5/entry-points/theme-state-transformer.d.ts +2 -1
  220. package/dist/types-ts4.5/index.d.ts +2 -1
  221. package/dist/types-ts4.5/is-color-mode.d.ts +2 -0
  222. package/dist/types-ts4.5/is-theme-ids.d.ts +2 -0
  223. package/dist/types-ts4.5/is-theme-kind.d.ts +11 -0
  224. package/dist/types-ts4.5/theme-color-modes.d.ts +1 -0
  225. package/dist/types-ts4.5/theme-config.d.ts +8 -40
  226. package/dist/types-ts4.5/theme-ids.d.ts +1 -0
  227. package/dist/types-ts4.5/theme-object-to-string.d.ts +13 -0
  228. package/dist/types-ts4.5/theme-options-schema.d.ts +7 -0
  229. package/dist/types-ts4.5/theme-state-defaults.d.ts +14 -0
  230. package/dist/types-ts4.5/theme-state.d.ts +17 -0
  231. package/dist/types-ts4.5/{theme-state-transformer.d.ts → theme-string-to-object.d.ts} +0 -12
  232. package/dist/types-ts4.5/utils/additional-contrast-checker.d.ts +9 -0
  233. package/dist/types-ts4.5/utils/custom-theme-loading-utils.d.ts +1 -6
  234. package/dist/types-ts4.5/utils/custom-theme-token-contrast-check.d.ts +0 -9
  235. package/dist/types-ts4.5/utils/delta-e.d.ts +1 -0
  236. package/dist/types-ts4.5/utils/generate-colors.d.ts +5 -0
  237. package/dist/types-ts4.5/utils/{generate-custom-color-ramp.d.ts → generate-token-map-with-contrast-check.d.ts} +1 -8
  238. package/dist/types-ts4.5/utils/generate-token-map.d.ts +11 -0
  239. package/dist/types-ts4.5/utils/get-contrast-ratio.d.ts +1 -0
  240. package/dist/types-ts4.5/utils/hct-color-utils/alpha-from-argb.d.ts +4 -0
  241. package/dist/types-ts4.5/utils/hct-color-utils/argb-from-linrgb.d.ts +4 -0
  242. package/dist/types-ts4.5/utils/hct-color-utils/argb-from-lstar.d.ts +8 -0
  243. package/dist/types-ts4.5/utils/hct-color-utils/argb-from-rgba.d.ts +8 -0
  244. package/dist/types-ts4.5/utils/hct-color-utils/argb-from-xyz.d.ts +4 -0
  245. package/dist/types-ts4.5/utils/hct-color-utils/blue-from-argb.d.ts +4 -0
  246. package/dist/types-ts4.5/utils/hct-color-utils/clamp-component.d.ts +1 -0
  247. package/dist/types-ts4.5/utils/hct-color-utils/green-from-argb.d.ts +4 -0
  248. package/dist/types-ts4.5/utils/hct-color-utils/index.d.ts +2 -1
  249. package/dist/types-ts4.5/utils/hct-color-utils/lab-f.d.ts +1 -0
  250. package/dist/types-ts4.5/utils/hct-color-utils/lab-invf.d.ts +1 -0
  251. package/dist/types-ts4.5/utils/hct-color-utils/lstar-from-argb.d.ts +7 -0
  252. package/dist/types-ts4.5/utils/hct-color-utils/lstar-from-y.d.ts +12 -0
  253. package/dist/types-ts4.5/utils/hct-color-utils/red-from-argb.d.ts +4 -0
  254. package/dist/types-ts4.5/utils/hct-color-utils/rgba-from-argb.d.ts +8 -0
  255. package/dist/types-ts4.5/utils/hct-color-utils/rgba.d.ts +14 -0
  256. package/dist/types-ts4.5/utils/hct-color-utils/white-point-d65.d.ts +6 -0
  257. package/dist/types-ts4.5/utils/hct-color-utils/y-from-lstar.d.ts +12 -0
  258. package/dist/types-ts4.5/utils/hex-to-hsl.d.ts +5 -0
  259. package/dist/types-ts4.5/utils/hex-to-rgb-a.d.ts +6 -0
  260. package/dist/types-ts4.5/utils/hex-to-rgb.d.ts +5 -0
  261. package/dist/types-ts4.5/utils/is-valid-hex.d.ts +1 -0
  262. package/dist/types-ts4.5/utils/reduce-token-map.d.ts +6 -0
  263. package/dist/types-ts4.5/utils/rgb-to-lab.d.ts +5 -0
  264. package/package.json +5 -5
  265. package/dist/cjs/theme-state-transformer.js +0 -93
  266. package/dist/cjs/utils/color-utils.js +0 -176
  267. package/dist/cjs/utils/hct-color-utils/color-utils.js +0 -279
  268. package/dist/es2019/theme-state-transformer.js +0 -70
  269. package/dist/es2019/utils/color-utils.js +0 -136
  270. package/dist/es2019/utils/hct-color-utils/color-utils.js +0 -249
  271. package/dist/esm/theme-state-transformer.js +0 -86
  272. package/dist/esm/utils/color-utils.js +0 -138
  273. package/dist/esm/utils/hct-color-utils/color-utils.js +0 -248
  274. package/dist/types/utils/color-utils.d.ts +0 -10
  275. package/dist/types/utils/hct-color-utils/color-utils.d.ts +0 -88
  276. package/dist/types-ts4.5/utils/color-utils.d.ts +0 -23
  277. package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +0 -88
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns the red component of a color in ARGB format.
3
+ */
4
+ export declare function redFromArgb(argb: number): number;
@@ -0,0 +1,8 @@
1
+ import type { Rgba } from './rgba';
2
+ /**
3
+ * Return RGBA from a given int32 color
4
+ *
5
+ * @param argb ARGB representation of a int32 color.
6
+ * @return RGBA representation of a int32 color.
7
+ */
8
+ export declare function rgbaFromArgb(argb: number): Rgba;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * RGBA component
3
+ *
4
+ * @param r Red value should be between 0-255
5
+ * @param g Green value should be between 0-255
6
+ * @param b Blue value should be between 0-255
7
+ * @param a Alpha value should be between 0-255
8
+ */
9
+ export interface Rgba {
10
+ r: number;
11
+ g: number;
12
+ b: number;
13
+ a: number;
14
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns the standard white point; white on a sunny day.
3
+ *
4
+ * @return The white point
5
+ */
6
+ export declare function whitePointD65(): number[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Converts an L* value to a Y value.
3
+ *
4
+ * L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
5
+ *
6
+ * L* measures perceptual luminance, a linear scale. Y in XYZ
7
+ * measures relative luminance, a logarithmic scale.
8
+ *
9
+ * @param lstar L* in L*a*b*
10
+ * @return Y in XYZ
11
+ */
12
+ export declare function yFromLstar(lstar: number): number;
@@ -0,0 +1,5 @@
1
+ export declare function hexToHSL(hex: string): [
2
+ number,
3
+ number,
4
+ number
5
+ ];
@@ -0,0 +1,6 @@
1
+ export declare function hexToRgbA(hex: string): [
2
+ number,
3
+ number,
4
+ number,
5
+ number
6
+ ];
@@ -0,0 +1,5 @@
1
+ export declare function hexToRgb(hex: string): [
2
+ number,
3
+ number,
4
+ number
5
+ ];
@@ -0,0 +1 @@
1
+ export declare const isValidHex: (hex: string) => boolean;
@@ -0,0 +1,6 @@
1
+ import tokens from '../artifacts/token-names';
2
+ type Token = keyof typeof tokens;
3
+ export declare function reduceTokenMap(tokenMap: {
4
+ [key in Token]?: number | string;
5
+ }, themeRamp: string[]): string;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function rgbToLab(rgb: number[]): [
2
+ number,
3
+ number,
4
+ number
5
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "13.1.0",
3
+ "version": "13.1.1",
4
4
  "description": "Design tokens are the single source of truth to name and store design decisions.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/code": "^17.5.0",
58
58
  "@atlaskit/css": "^0.19.0",
59
59
  "@atlaskit/docs": "^11.8.0",
60
- "@atlaskit/dropdown-menu": "^16.9.0",
60
+ "@atlaskit/dropdown-menu": "^16.10.0",
61
61
  "@atlaskit/dynamic-table": "^18.4.0",
62
62
  "@atlaskit/form": "^15.5.0",
63
63
  "@atlaskit/heading": "^5.4.0",
@@ -65,7 +65,7 @@
65
65
  "@atlaskit/inline-message": "^15.6.0",
66
66
  "@atlaskit/link": "^3.4.0",
67
67
  "@atlaskit/lozenge": "^13.8.0",
68
- "@atlaskit/popup": "^4.22.0",
68
+ "@atlaskit/popup": "^4.23.0",
69
69
  "@atlaskit/primitives": "^19.0.0",
70
70
  "@atlaskit/radio": "^8.6.0",
71
71
  "@atlaskit/section-message": "^8.13.0",
@@ -74,7 +74,7 @@
74
74
  "@atlaskit/textarea": "^8.3.0",
75
75
  "@atlaskit/textfield": "^8.3.0",
76
76
  "@atlaskit/theme": "^25.0.0",
77
- "@atlaskit/tooltip": "^22.4.0",
77
+ "@atlaskit/tooltip": "^22.5.0",
78
78
  "@atlassian/codegen": "^0.2.0",
79
79
  "@atlassian/feature-flags-test-utils": "^1.1.0",
80
80
  "@atlassian/react-compiler-gating": "workspace:^",
@@ -86,7 +86,7 @@
86
86
  "@testing-library/react": "^16.3.0",
87
87
  "color-blend": "^4.0.0",
88
88
  "echarts": "^5.4.1",
89
- "echarts-for-react": "^3.0.2",
89
+ "echarts-for-react": "3.0.6",
90
90
  "jscodeshift": "^17.0.0",
91
91
  "json5": "^2.2.2",
92
92
  "lodash": "^4.17.21",
@@ -1,93 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.themeStringToObject = exports.themeObjectToString = void 0;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _themeIds = require("./theme-ids");
11
- var themeKinds = ['light', 'dark', 'spacing', 'typography', 'shape', 'motion'];
12
- var customThemeOptions = 'UNSAFE_themeOptions';
13
- var isThemeKind = function isThemeKind(themeKind) {
14
- return themeKinds.find(function (kind) {
15
- return kind === themeKind;
16
- }) !== undefined;
17
- };
18
- var isThemeIds = function isThemeIds(themeId) {
19
- return _themeIds.themeIds.find(function (id) {
20
- return id === themeId;
21
- }) !== undefined;
22
- };
23
- var isColorMode = function isColorMode(modeId) {
24
- return ['light', 'dark', 'auto'].includes(modeId);
25
- };
26
- /**
27
- * Converts a string that is formatted for the `data-theme` HTML attribute
28
- * to an object that can be passed to `setGlobalTheme`.
29
- *
30
- * @param {string} themes The themes that should be applied.
31
- *
32
- * @example
33
- * ```
34
- * themeStringToObject('dark:dark light:light spacing:spacing');
35
- * // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
36
- * ```
37
- */
38
- var themeStringToObject = exports.themeStringToObject = function themeStringToObject(themeState) {
39
- return themeState.split(' ')
40
- // @ts-ignore - TS1501 TypeScript 5.9.2 upgrade
41
- .map(function (theme) {
42
- return theme.split(/:([^]*)/);
43
- }).reduce(function (themeObject, _ref) {
44
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
45
- kind = _ref2[0],
46
- id = _ref2[1];
47
- if (kind === 'colorMode' && isColorMode(id)) {
48
- themeObject[kind] = id;
49
- }
50
- if (isThemeKind(kind) && isThemeIds(id)) {
51
- // @ts-expect-error FIXME - this is a valid ts error
52
- themeObject[kind] = id;
53
- }
54
- if (kind === customThemeOptions) {
55
- try {
56
- themeObject[customThemeOptions] = JSON.parse(id);
57
- } catch (_unused) {
58
- new Error('Invalid custom theme string');
59
- }
60
- }
61
- return themeObject;
62
- }, {});
63
- };
64
-
65
- /**
66
- * Converts a theme object to a string formatted for the `data-theme` HTML attribute.
67
- *
68
- * @param {object} themes The themes that should be applied.
69
- *
70
- * @example
71
- * ```
72
- * themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
73
- * // returns 'dark:dark light:light spacing:spacing'
74
- * ```
75
- */
76
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
77
- var themeObjectToString = exports.themeObjectToString = function themeObjectToString(themeState) {
78
- return Object.entries(themeState).reduce(function (themeString, _ref3) {
79
- var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
80
- kind = _ref4[0],
81
- id = _ref4[1];
82
- if (
83
- // colorMode theme state
84
- kind === 'colorMode' && typeof id === 'string' && isColorMode(id) ||
85
- // custom theme state
86
- kind === customThemeOptions && (0, _typeof2.default)(id) === 'object' ||
87
- // other theme states
88
- isThemeKind(kind) && typeof id === 'string' && isThemeIds(id)) {
89
- return themeString + "".concat(themeString ? ' ' : '') + "".concat(kind, ":").concat((0, _typeof2.default)(id) === 'object' ? JSON.stringify(id) : id);
90
- }
91
- return themeString;
92
- }, '');
93
- };
@@ -1,176 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "HSLToRGB", {
7
- enumerable: true,
8
- get: function get() {
9
- return _hslToRgb.HSLToRGB;
10
- }
11
- });
12
- exports.deltaE = deltaE;
13
- Object.defineProperty(exports, "getAlpha", {
14
- enumerable: true,
15
- get: function get() {
16
- return _getAlpha.getAlpha;
17
- }
18
- });
19
- exports.getContrastRatio = getContrastRatio;
20
- exports.hexToHSL = hexToHSL;
21
- exports.hexToRgb = hexToRgb;
22
- exports.hexToRgbA = hexToRgbA;
23
- Object.defineProperty(exports, "isValidBrandHex", {
24
- enumerable: true,
25
- get: function get() {
26
- return _isValidBrandHex.isValidBrandHex;
27
- }
28
- });
29
- Object.defineProperty(exports, "relativeLuminanceW3C", {
30
- enumerable: true,
31
- get: function get() {
32
- return _relativeLuminanceW3C.relativeLuminanceW3C;
33
- }
34
- });
35
- Object.defineProperty(exports, "rgbToHex", {
36
- enumerable: true,
37
- get: function get() {
38
- return _rgbToHex.rgbToHex;
39
- }
40
- });
41
- var _getAlpha = require("./get-alpha");
42
- var _relativeLuminanceW3C = require("./relative-luminance-w3-c");
43
- var _isValidBrandHex = require("./is-valid-brand-hex");
44
- var _rgbToHex = require("./rgb-to-hex");
45
- var _hslToRgb = require("./hsl-to-rgb");
46
- // valid hex color with 4, 6 or 8 digits
47
- var isValidHex = function isValidHex(hex) {
48
- return /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
49
- };
50
- function hexToRgbA(hex) {
51
- if (!isValidHex(hex)) {
52
- throw new Error('Invalid HEX');
53
- }
54
- var c;
55
- c = hex.substring(1).split('');
56
- if (c.length === 3) {
57
- c = [c[0], c[0], c[1], c[1], c[2], c[2]];
58
- }
59
- c = '0x' + c.join('');
60
- return [c >> 16 & 255, c >> 8 & 255, c & 255, (0, _getAlpha.getAlpha)(hex)];
61
- }
62
-
63
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
64
- function hexToRgb(hex) {
65
- if (!isValidHex(hex)) {
66
- throw new Error('Invalid HEX');
67
- }
68
- var c;
69
- c = hex.substring(1).split('');
70
- if (c.length === 3) {
71
- c = [c[0], c[0], c[1], c[1], c[2], c[2]];
72
- }
73
- c = '0x' + c.join('');
74
- return [c >> 16 & 255, c >> 8 & 255, c & 255];
75
- }
76
-
77
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
78
- function hexToHSL(hex) {
79
- if (!isValidHex(hex)) {
80
- throw new Error('Invalid HEX');
81
- }
82
- var r = 0,
83
- g = 0,
84
- b = 0;
85
- if (hex.length === 4) {
86
- r = '0x' + hex[1] + hex[1];
87
- g = '0x' + hex[2] + hex[2];
88
- b = '0x' + hex[3] + hex[3];
89
- } else if (hex.length === 7) {
90
- r = '0x' + hex[1] + hex[2];
91
- g = '0x' + hex[3] + hex[4];
92
- b = '0x' + hex[5] + hex[6];
93
- }
94
- // Then to HSL
95
- r /= 255;
96
- g /= 255;
97
- b /= 255;
98
- var cmin = Math.min(r, g, b),
99
- cmax = Math.max(r, g, b),
100
- delta = cmax - cmin,
101
- h = 0,
102
- s = 0,
103
- l = 0;
104
- if (delta === 0) {
105
- h = 0;
106
- } else if (cmax === r) {
107
- h = (g - b) / delta % 6;
108
- } else if (cmax === g) {
109
- h = (b - r) / delta + 2;
110
- } else {
111
- h = (r - g) / delta + 4;
112
- }
113
- h = Math.round(h * 60);
114
- if (h < 0) {
115
- h += 360;
116
- }
117
- l = (cmax + cmin) / 2;
118
- s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
119
- s = +(s * 100).toFixed(1);
120
- l = +(l * 100).toFixed(1);
121
- return [h, s, l];
122
- }
123
-
124
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
125
- function getContrastRatio(foreground, background) {
126
- if (!isValidHex(foreground) || !isValidHex(background)) {
127
- throw new Error('Invalid HEX');
128
- }
129
- var foregroundRgb = hexToRgb(foreground);
130
- var backgroundRgb = hexToRgb(background);
131
- var foregroundLuminance = (0, _relativeLuminanceW3C.relativeLuminanceW3C)(foregroundRgb[0], foregroundRgb[1], foregroundRgb[2]);
132
- var backgroundLuminance = (0, _relativeLuminanceW3C.relativeLuminanceW3C)(backgroundRgb[0], backgroundRgb[1], backgroundRgb[2]);
133
- // calculate the color contrast ratio
134
- var brightest = Math.max(foregroundLuminance, backgroundLuminance);
135
- var darkest = Math.min(foregroundLuminance, backgroundLuminance);
136
- return (brightest + 0.05) / (darkest + 0.05);
137
- }
138
-
139
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
140
- function deltaE(rgbA, rgbB) {
141
- var labA = rgbToLab(rgbA);
142
- var labB = rgbToLab(rgbB);
143
- var deltaL = labA[0] - labB[0];
144
- var deltaA = labA[1] - labB[1];
145
- var deltaB = labA[2] - labB[2];
146
- var c1 = Math.sqrt(labA[1] * labA[1] + labA[2] * labA[2]);
147
- var c2 = Math.sqrt(labB[1] * labB[1] + labB[2] * labB[2]);
148
- var deltaC = c1 - c2;
149
- var deltaH = deltaA * deltaA + deltaB * deltaB - deltaC * deltaC;
150
- deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
151
- var sc = 1.0 + 0.045 * c1;
152
- var sh = 1.0 + 0.015 * c1;
153
- var deltaLKlsl = deltaL / 1.0;
154
- var deltaCkcsc = deltaC / sc;
155
- var deltaHkhsh = deltaH / sh;
156
- var i = deltaLKlsl * deltaLKlsl + deltaCkcsc * deltaCkcsc + deltaHkhsh * deltaHkhsh;
157
- return i < 0 ? 0 : Math.sqrt(i);
158
- }
159
- function rgbToLab(rgb) {
160
- var r = rgb[0] / 255,
161
- g = rgb[1] / 255,
162
- b = rgb[2] / 255,
163
- x,
164
- y,
165
- z;
166
- r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
167
- g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
168
- b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
169
- x = (r * 0.4124 + g * 0.3576 + b * 0.1805) / 0.95047;
170
- y = (r * 0.2126 + g * 0.7152 + b * 0.0722) / 1.0;
171
- z = (r * 0.0193 + g * 0.1192 + b * 0.9505) / 1.08883;
172
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
173
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
174
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
175
- return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
176
- }
@@ -1,279 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.argbFromLinrgb = argbFromLinrgb;
8
- exports.argbFromLstar = argbFromLstar;
9
- Object.defineProperty(exports, "argbFromRgb", {
10
- enumerable: true,
11
- get: function get() {
12
- return _argbFromRgb.argbFromRgb;
13
- }
14
- });
15
- exports.argbFromRgba = argbFromRgba;
16
- exports.argbFromXyz = argbFromXyz;
17
- Object.defineProperty(exports, "delinearized", {
18
- enumerable: true,
19
- get: function get() {
20
- return _delinearized.delinearized;
21
- }
22
- });
23
- Object.defineProperty(exports, "linearized", {
24
- enumerable: true,
25
- get: function get() {
26
- return _linearized.linearized;
27
- }
28
- });
29
- exports.lstarFromArgb = lstarFromArgb;
30
- exports.lstarFromY = lstarFromY;
31
- exports.rgbaFromArgb = rgbaFromArgb;
32
- exports.whitePointD65 = whitePointD65;
33
- exports.yFromLstar = yFromLstar;
34
- var _argbFromRgb = require("./argb-from-rgb");
35
- var _delinearized = require("./delinearized");
36
- var _linearized = require("./linearized");
37
- var mathUtils = _interopRequireWildcard(require("./math-utils"));
38
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
39
- /**
40
- * Below lines are copied from @material/material-color-utilities.
41
- * Do not modify it.
42
- */
43
-
44
- /**
45
- * @license
46
- * Copyright 2021 Google LLC
47
- *
48
- * Licensed under the Apache License, Version 2.0 (the "License");
49
- * you may not use this file except in compliance with the License.
50
- * You may obtain a copy of the License at
51
- *
52
- * http://www.apache.org/licenses/LICENSE-2.0
53
- *
54
- * Unless required by applicable law or agreed to in writing, software
55
- * distributed under the License is distributed on an "AS IS" BASIS,
56
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57
- * See the License for the specific language governing permissions and
58
- * limitations under the License.
59
- */
60
-
61
- // This file is automatically generated. Do not modify it.
62
-
63
- /**
64
- * Color science utilities.
65
- *
66
- * Utility methods for color science constants and color space
67
- * conversions that aren't HCT or CAM16.
68
- */
69
-
70
- var SRGB_TO_XYZ = [[0.41233895, 0.35762064, 0.18051042], [0.2126, 0.7152, 0.0722], [0.01932141, 0.11916382, 0.95034478]];
71
- var XYZ_TO_SRGB = [[3.2413774792388685, -1.5376652402851851, -0.49885366846268053], [-0.9691452513005321, 1.8758853451067872, 0.04156585616912061], [0.05562093689691305, -0.20395524564742123, 1.0571799111220335]];
72
- var WHITE_POINT_D65 = [95.047, 100.0, 108.883];
73
-
74
- /**
75
- * Converts a color from linear RGB components to ARGB format.
76
- */
77
- function argbFromLinrgb(linrgb) {
78
- var r = (0, _delinearized.delinearized)(linrgb[0]);
79
- var g = (0, _delinearized.delinearized)(linrgb[1]);
80
- var b = (0, _delinearized.delinearized)(linrgb[2]);
81
- return (0, _argbFromRgb.argbFromRgb)(r, g, b);
82
- }
83
-
84
- /**
85
- * Returns the alpha component of a color in ARGB format.
86
- */
87
- function alphaFromArgb(argb) {
88
- return argb >> 24 & 255;
89
- }
90
-
91
- /**
92
- * Returns the red component of a color in ARGB format.
93
- */
94
- function redFromArgb(argb) {
95
- return argb >> 16 & 255;
96
- }
97
-
98
- /**
99
- * Returns the green component of a color in ARGB format.
100
- */
101
- function greenFromArgb(argb) {
102
- return argb >> 8 & 255;
103
- }
104
-
105
- /**
106
- * Returns the blue component of a color in ARGB format.
107
- */
108
- function blueFromArgb(argb) {
109
- return argb & 255;
110
- }
111
-
112
- /**
113
- * Converts a color from ARGB to XYZ.
114
- */
115
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
116
- function argbFromXyz(x, y, z) {
117
- var matrix = XYZ_TO_SRGB;
118
- var linearR = matrix[0][0] * x + matrix[0][1] * y + matrix[0][2] * z;
119
- var linearG = matrix[1][0] * x + matrix[1][1] * y + matrix[1][2] * z;
120
- var linearB = matrix[2][0] * x + matrix[2][1] * y + matrix[2][2] * z;
121
- var r = (0, _delinearized.delinearized)(linearR);
122
- var g = (0, _delinearized.delinearized)(linearG);
123
- var b = (0, _delinearized.delinearized)(linearB);
124
- return (0, _argbFromRgb.argbFromRgb)(r, g, b);
125
- }
126
-
127
- /**
128
- * Converts a color from XYZ to ARGB.
129
- */
130
- function xyzFromArgb(argb) {
131
- var r = (0, _linearized.linearized)(redFromArgb(argb));
132
- var g = (0, _linearized.linearized)(greenFromArgb(argb));
133
- var b = (0, _linearized.linearized)(blueFromArgb(argb));
134
- return mathUtils.matrixMultiply([r, g, b], SRGB_TO_XYZ);
135
- }
136
-
137
- /**
138
- * Converts an L* value to an ARGB representation.
139
- *
140
- * @param lstar L* in L*a*b*
141
- * @return ARGB representation of grayscale color with lightness
142
- * matching L*
143
- */
144
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
145
- function argbFromLstar(lstar) {
146
- var y = yFromLstar(lstar);
147
- var component = (0, _delinearized.delinearized)(y);
148
- return (0, _argbFromRgb.argbFromRgb)(component, component, component);
149
- }
150
-
151
- /**
152
- * Computes the L* value of a color in ARGB representation.
153
- *
154
- * @param argb ARGB representation of a color
155
- * @return L*, from L*a*b*, coordinate of the color
156
- */
157
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
158
- function lstarFromArgb(argb) {
159
- var y = xyzFromArgb(argb)[1];
160
- return 116.0 * labF(y / 100.0) - 16.0;
161
- }
162
-
163
- /**
164
- * Converts an L* value to a Y value.
165
- *
166
- * L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
167
- *
168
- * L* measures perceptual luminance, a linear scale. Y in XYZ
169
- * measures relative luminance, a logarithmic scale.
170
- *
171
- * @param lstar L* in L*a*b*
172
- * @return Y in XYZ
173
- */
174
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
175
- function yFromLstar(lstar) {
176
- return 100.0 * labInvf((lstar + 16.0) / 116.0);
177
- }
178
-
179
- /**
180
- * Converts a Y value to an L* value.
181
- *
182
- * L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
183
- *
184
- * L* measures perceptual luminance, a linear scale. Y in XYZ
185
- * measures relative luminance, a logarithmic scale.
186
- *
187
- * @param y Y in XYZ
188
- * @return L* in L*a*b*
189
- */
190
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
191
- function lstarFromY(y) {
192
- return labF(y / 100.0) * 116.0 - 16.0;
193
- }
194
-
195
- /**
196
- * Returns the standard white point; white on a sunny day.
197
- *
198
- * @return The white point
199
- */
200
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
201
- function whitePointD65() {
202
- return WHITE_POINT_D65;
203
- }
204
-
205
- /**
206
- * RGBA component
207
- *
208
- * @param r Red value should be between 0-255
209
- * @param g Green value should be between 0-255
210
- * @param b Blue value should be between 0-255
211
- * @param a Alpha value should be between 0-255
212
- */
213
-
214
- /**
215
- * Return RGBA from a given int32 color
216
- *
217
- * @param argb ARGB representation of a int32 color.
218
- * @return RGBA representation of a int32 color.
219
- */
220
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
221
- function rgbaFromArgb(argb) {
222
- var r = redFromArgb(argb);
223
- var g = greenFromArgb(argb);
224
- var b = blueFromArgb(argb);
225
- var a = alphaFromArgb(argb);
226
- return {
227
- r: r,
228
- g: g,
229
- b: b,
230
- a: a
231
- };
232
- }
233
-
234
- /**
235
- * Return int32 color from a given RGBA component
236
- *
237
- * @param rgba RGBA representation of a int32 color.
238
- * @returns ARGB representation of a int32 color.
239
- */
240
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
241
- function argbFromRgba(_ref) {
242
- var r = _ref.r,
243
- g = _ref.g,
244
- b = _ref.b,
245
- a = _ref.a;
246
- var rValue = clampComponent(r);
247
- var gValue = clampComponent(g);
248
- var bValue = clampComponent(b);
249
- var aValue = clampComponent(a);
250
- return aValue << 24 | rValue << 16 | gValue << 8 | bValue;
251
- }
252
- function clampComponent(value) {
253
- if (value < 0) {
254
- return 0;
255
- }
256
- if (value > 255) {
257
- return 255;
258
- }
259
- return value;
260
- }
261
- function labF(t) {
262
- var e = 216.0 / 24389.0;
263
- var kappa = 24389.0 / 27.0;
264
- if (t > e) {
265
- return Math.pow(t, 1.0 / 3.0);
266
- } else {
267
- return (kappa * t + 16) / 116;
268
- }
269
- }
270
- function labInvf(ft) {
271
- var e = 216.0 / 24389.0;
272
- var kappa = 24389.0 / 27.0;
273
- var ft3 = ft * ft * ft;
274
- if (ft3 > e) {
275
- return ft3;
276
- } else {
277
- return (116 * ft - 16) / kappa;
278
- }
279
- }