@atlaskit/tokens 13.0.3 → 13.1.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.
Files changed (316) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/codemods/css-to-design-tokens/lib/meta.tsx +1 -1
  3. package/codemods/css-to-design-tokens/lib/tokens.tsx +1 -1
  4. package/codemods/theme-to-design-tokens/transform.tsx +16 -14
  5. package/codemods/theme-to-design-tokens/utils/ast-meta.tsx +2 -151
  6. package/codemods/theme-to-design-tokens/utils/ast.tsx +3 -35
  7. package/codemods/theme-to-design-tokens/utils/clean-meta.tsx +63 -0
  8. package/codemods/theme-to-design-tokens/utils/color.tsx +3 -11
  9. package/codemods/theme-to-design-tokens/utils/contains-replaceable-css-declarations.tsx +13 -0
  10. package/codemods/theme-to-design-tokens/utils/css-utils.tsx +2 -35
  11. package/codemods/theme-to-design-tokens/utils/find-end-index-of-css-expression.tsx +21 -0
  12. package/codemods/theme-to-design-tokens/utils/find-first-nonspace-index-after.tsx +9 -0
  13. package/codemods/theme-to-design-tokens/utils/get-closest-decendant-of-type.tsx +10 -0
  14. package/codemods/theme-to-design-tokens/utils/get-meta-from-ancestors.tsx +87 -0
  15. package/codemods/theme-to-design-tokens/utils/is-bold-color.tsx +4 -0
  16. package/codemods/theme-to-design-tokens/utils/is-decendant-of-token.tsx +14 -0
  17. package/codemods/theme-to-design-tokens/utils/is-legacy-color.tsx +4 -0
  18. package/codemods/theme-to-design-tokens/utils/is-legacy-named-color.tsx +4 -0
  19. package/codemods/theme-to-design-tokens/utils/is-parent-of-token.tsx +13 -0
  20. package/codemods/theme-to-design-tokens/utils/kebabize.tsx +2 -0
  21. package/codemods/theme-to-design-tokens/utils/legacy-color-meta-map.tsx +88 -0
  22. package/codemods/theme-to-design-tokens/utils/legacy-color-mixins.tsx +26 -0
  23. package/codemods/theme-to-design-tokens/utils/legacy-colors.tsx +2 -115
  24. package/codemods/theme-to-design-tokens/utils/split-at-index.tsx +3 -0
  25. package/codemods/theme-to-design-tokens/utils/string-utils.tsx +3 -16
  26. package/codemods/utils/active-tokens.tsx +284 -0
  27. package/codemods/utils/tokens.tsx +2 -376
  28. package/codemods/utils/unique-words-from-tokens.tsx +91 -0
  29. package/dist/cjs/artifacts/replacement-mapping.js +5 -2
  30. package/dist/cjs/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
  31. package/dist/cjs/artifacts/themes/atlassian-dark.js +2 -2
  32. package/dist/cjs/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
  33. package/dist/cjs/artifacts/themes/atlassian-light.js +2 -2
  34. package/dist/cjs/artifacts/token-default-values.js +2 -2
  35. package/dist/cjs/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +3 -3
  36. package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +3 -3
  37. package/dist/cjs/artifacts/tokens-raw/atlassian-light-increased-contrast.js +3 -3
  38. package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +3 -3
  39. package/dist/cjs/artifacts/tokens-raw/atlassian-motion.js +3 -3
  40. package/dist/cjs/constants.js +1 -0
  41. package/dist/cjs/custom-theme.js +10 -60
  42. package/dist/cjs/entry-points/token-metadata.codegen.js +2 -11
  43. package/dist/cjs/get-custom-theme-styles.js +57 -0
  44. package/dist/cjs/get-global-theme.js +2 -2
  45. package/dist/cjs/get-theme-html-attrs.js +2 -2
  46. package/dist/cjs/get-theme-styles.js +33 -32
  47. package/dist/cjs/load-custom-theme-styles.js +2 -2
  48. package/dist/cjs/set-global-theme.js +36 -34
  49. package/dist/cjs/theme-color-modes.js +13 -0
  50. package/dist/cjs/theme-config.js +21 -16
  51. package/dist/cjs/theme-ids.js +13 -0
  52. package/dist/cjs/theme-state-transformer.js +3 -2
  53. package/dist/cjs/utils/color-detection.js +9 -12
  54. package/dist/cjs/utils/color-utils.js +45 -46
  55. package/dist/cjs/utils/custom-theme-loading-utils.js +9 -11
  56. package/dist/cjs/utils/custom-theme-token-contrast-check.js +2 -0
  57. package/dist/cjs/utils/generate-custom-color-ramp.js +20 -19
  58. package/dist/cjs/utils/get-alpha.js +13 -0
  59. package/dist/cjs/utils/get-closest-color-index.js +20 -0
  60. package/dist/cjs/utils/get-css-custom-property.js +32 -0
  61. package/dist/cjs/utils/get-fully-qualified-token-id.js +19 -0
  62. package/dist/cjs/utils/get-theme-override-preferences.js +12 -0
  63. package/dist/cjs/utils/get-theme-preferences.js +8 -5
  64. package/dist/cjs/utils/get-token-id.js +26 -0
  65. package/dist/cjs/utils/hct-color-utils/argb-from-rgb.js +12 -0
  66. package/dist/cjs/utils/hct-color-utils/clamp-double.js +20 -0
  67. package/dist/cjs/utils/hct-color-utils/clamp-int.js +20 -0
  68. package/dist/cjs/utils/hct-color-utils/color-utils.js +42 -59
  69. package/dist/cjs/utils/hct-color-utils/delinearized.js +27 -0
  70. package/dist/cjs/utils/hct-color-utils/hct.js +19 -95
  71. package/dist/cjs/utils/hct-color-utils/lerp.js +14 -0
  72. package/dist/cjs/utils/hct-color-utils/linearized.js +22 -0
  73. package/dist/cjs/utils/hct-color-utils/math-utils.js +38 -107
  74. package/dist/cjs/utils/hct-color-utils/matrix-multiply.js +15 -0
  75. package/dist/cjs/utils/hct-color-utils/sanitize-degrees-double.js +19 -0
  76. package/dist/cjs/utils/hct-color-utils/signum.js +20 -0
  77. package/dist/cjs/utils/hct-color-utils/viewing-conditions.js +98 -0
  78. package/dist/cjs/utils/hex-to-rgba-values.js +15 -0
  79. package/dist/cjs/utils/hsl-to-rgb.js +18 -0
  80. package/dist/cjs/utils/is-valid-brand-hex.js +9 -0
  81. package/dist/cjs/utils/limit-size-of-custom-style-elements.js +16 -0
  82. package/dist/cjs/utils/load-theme-css.js +32 -0
  83. package/dist/cjs/utils/relative-luminance-w3-c.js +18 -0
  84. package/dist/cjs/utils/rgb-to-hex.js +9 -0
  85. package/dist/cjs/utils/theme-loading.js +18 -33
  86. package/dist/cjs/utils/token-ids.js +21 -62
  87. package/dist/es2019/artifacts/replacement-mapping.js +5 -2
  88. package/dist/es2019/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
  89. package/dist/es2019/artifacts/themes/atlassian-dark.js +2 -2
  90. package/dist/es2019/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
  91. package/dist/es2019/artifacts/themes/atlassian-light.js +2 -2
  92. package/dist/es2019/artifacts/token-default-values.js +2 -2
  93. package/dist/es2019/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +3 -3
  94. package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +3 -3
  95. package/dist/es2019/artifacts/tokens-raw/atlassian-light-increased-contrast.js +3 -3
  96. package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +3 -3
  97. package/dist/es2019/artifacts/tokens-raw/atlassian-motion.js +3 -3
  98. package/dist/es2019/constants.js +1 -0
  99. package/dist/es2019/custom-theme.js +4 -66
  100. package/dist/es2019/entry-points/token-metadata.codegen.js +2 -11
  101. package/dist/es2019/get-custom-theme-styles.js +60 -0
  102. package/dist/es2019/get-global-theme.js +1 -1
  103. package/dist/es2019/get-theme-html-attrs.js +1 -1
  104. package/dist/es2019/get-theme-styles.js +4 -3
  105. package/dist/es2019/load-custom-theme-styles.js +1 -1
  106. package/dist/es2019/set-global-theme.js +3 -2
  107. package/dist/es2019/theme-color-modes.js +7 -0
  108. package/dist/es2019/theme-config.js +6 -16
  109. package/dist/es2019/theme-ids.js +7 -0
  110. package/dist/es2019/theme-state-transformer.js +2 -1
  111. package/dist/es2019/utils/color-detection.js +3 -11
  112. package/dist/es2019/utils/color-utils.js +15 -33
  113. package/dist/es2019/utils/custom-theme-loading-utils.js +4 -8
  114. package/dist/es2019/utils/custom-theme-token-contrast-check.js +2 -0
  115. package/dist/es2019/utils/generate-custom-color-ramp.js +11 -15
  116. package/dist/es2019/utils/get-alpha.js +7 -0
  117. package/dist/es2019/utils/get-closest-color-index.js +14 -0
  118. package/dist/es2019/utils/get-css-custom-property.js +23 -0
  119. package/dist/es2019/utils/get-fully-qualified-token-id.js +11 -0
  120. package/dist/es2019/utils/get-theme-override-preferences.js +4 -0
  121. package/dist/es2019/utils/get-theme-preferences.js +1 -4
  122. package/dist/es2019/utils/get-token-id.js +18 -0
  123. package/dist/es2019/utils/hct-color-utils/argb-from-rgb.js +6 -0
  124. package/dist/es2019/utils/hct-color-utils/clamp-double.js +14 -0
  125. package/dist/es2019/utils/hct-color-utils/clamp-int.js +14 -0
  126. package/dist/es2019/utils/hct-color-utils/color-utils.js +15 -45
  127. package/dist/es2019/utils/hct-color-utils/delinearized.js +20 -0
  128. package/dist/es2019/utils/hct-color-utils/hct.js +3 -76
  129. package/dist/es2019/utils/hct-color-utils/lerp.js +8 -0
  130. package/dist/es2019/utils/hct-color-utils/linearized.js +16 -0
  131. package/dist/es2019/utils/hct-color-utils/math-utils.js +6 -105
  132. package/dist/es2019/utils/hct-color-utils/matrix-multiply.js +9 -0
  133. package/dist/es2019/utils/hct-color-utils/sanitize-degrees-double.js +13 -0
  134. package/dist/es2019/utils/hct-color-utils/signum.js +14 -0
  135. package/dist/es2019/utils/hct-color-utils/viewing-conditions.js +78 -0
  136. package/dist/es2019/utils/hex-to-rgba-values.js +9 -0
  137. package/dist/es2019/utils/hsl-to-rgb.js +8 -0
  138. package/dist/es2019/utils/is-valid-brand-hex.js +1 -0
  139. package/dist/es2019/utils/limit-size-of-custom-style-elements.js +8 -0
  140. package/dist/es2019/utils/load-theme-css.js +7 -0
  141. package/dist/es2019/utils/relative-luminance-w3-c.js +12 -0
  142. package/dist/es2019/utils/rgb-to-hex.js +3 -0
  143. package/dist/es2019/utils/theme-loading.js +3 -8
  144. package/dist/es2019/utils/token-ids.js +3 -54
  145. package/dist/esm/artifacts/replacement-mapping.js +5 -2
  146. package/dist/esm/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
  147. package/dist/esm/artifacts/themes/atlassian-dark.js +2 -2
  148. package/dist/esm/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
  149. package/dist/esm/artifacts/themes/atlassian-light.js +2 -2
  150. package/dist/esm/artifacts/token-default-values.js +2 -2
  151. package/dist/esm/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +3 -3
  152. package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +3 -3
  153. package/dist/esm/artifacts/tokens-raw/atlassian-light-increased-contrast.js +3 -3
  154. package/dist/esm/artifacts/tokens-raw/atlassian-light.js +3 -3
  155. package/dist/esm/artifacts/tokens-raw/atlassian-motion.js +3 -3
  156. package/dist/esm/constants.js +1 -0
  157. package/dist/esm/custom-theme.js +4 -58
  158. package/dist/esm/entry-points/token-metadata.codegen.js +2 -11
  159. package/dist/esm/get-custom-theme-styles.js +52 -0
  160. package/dist/esm/get-global-theme.js +1 -1
  161. package/dist/esm/get-theme-html-attrs.js +1 -1
  162. package/dist/esm/get-theme-styles.js +30 -29
  163. package/dist/esm/load-custom-theme-styles.js +1 -1
  164. package/dist/esm/set-global-theme.js +34 -32
  165. package/dist/esm/theme-color-modes.js +7 -0
  166. package/dist/esm/theme-config.js +8 -17
  167. package/dist/esm/theme-ids.js +7 -0
  168. package/dist/esm/theme-state-transformer.js +2 -1
  169. package/dist/esm/utils/color-detection.js +3 -11
  170. package/dist/esm/utils/color-utils.js +15 -39
  171. package/dist/esm/utils/custom-theme-loading-utils.js +4 -11
  172. package/dist/esm/utils/custom-theme-token-contrast-check.js +2 -0
  173. package/dist/esm/utils/generate-custom-color-ramp.js +11 -15
  174. package/dist/esm/utils/get-alpha.js +7 -0
  175. package/dist/esm/utils/get-closest-color-index.js +14 -0
  176. package/dist/esm/utils/get-css-custom-property.js +26 -0
  177. package/dist/esm/utils/get-fully-qualified-token-id.js +13 -0
  178. package/dist/esm/utils/get-theme-override-preferences.js +5 -0
  179. package/dist/esm/utils/get-theme-preferences.js +1 -4
  180. package/dist/esm/utils/get-token-id.js +20 -0
  181. package/dist/esm/utils/hct-color-utils/argb-from-rgb.js +6 -0
  182. package/dist/esm/utils/hct-color-utils/clamp-double.js +14 -0
  183. package/dist/esm/utils/hct-color-utils/clamp-int.js +14 -0
  184. package/dist/esm/utils/hct-color-utils/color-utils.js +15 -45
  185. package/dist/esm/utils/hct-color-utils/delinearized.js +20 -0
  186. package/dist/esm/utils/hct-color-utils/hct.js +5 -87
  187. package/dist/esm/utils/hct-color-utils/lerp.js +8 -0
  188. package/dist/esm/utils/hct-color-utils/linearized.js +16 -0
  189. package/dist/esm/utils/hct-color-utils/math-utils.js +6 -105
  190. package/dist/esm/utils/hct-color-utils/matrix-multiply.js +9 -0
  191. package/dist/esm/utils/hct-color-utils/sanitize-degrees-double.js +13 -0
  192. package/dist/esm/utils/hct-color-utils/signum.js +14 -0
  193. package/dist/esm/utils/hct-color-utils/viewing-conditions.js +89 -0
  194. package/dist/esm/utils/hex-to-rgba-values.js +9 -0
  195. package/dist/esm/utils/hsl-to-rgb.js +12 -0
  196. package/dist/esm/utils/is-valid-brand-hex.js +3 -0
  197. package/dist/esm/utils/limit-size-of-custom-style-elements.js +10 -0
  198. package/dist/esm/utils/load-theme-css.js +25 -0
  199. package/dist/esm/utils/relative-luminance-w3-c.js +12 -0
  200. package/dist/esm/utils/rgb-to-hex.js +3 -0
  201. package/dist/esm/utils/theme-loading.js +11 -32
  202. package/dist/esm/utils/token-ids.js +3 -61
  203. package/dist/types/artifacts/replacement-mapping.d.ts +1 -1
  204. package/dist/types/artifacts/themes/atlassian-dark-increased-contrast.d.ts +2 -2
  205. package/dist/types/artifacts/themes/atlassian-dark.d.ts +2 -2
  206. package/dist/types/artifacts/themes/atlassian-light-increased-contrast.d.ts +2 -2
  207. package/dist/types/artifacts/themes/atlassian-light.d.ts +2 -2
  208. package/dist/types/artifacts/token-default-values.d.ts +2 -2
  209. package/dist/types/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +1 -1
  210. package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
  211. package/dist/types/artifacts/tokens-raw/atlassian-light-increased-contrast.d.ts +1 -1
  212. package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
  213. package/dist/types/artifacts/tokens-raw/atlassian-motion.d.ts +1 -1
  214. package/dist/types/artifacts/types-internal.d.ts +2 -2
  215. package/dist/types/artifacts/types.d.ts +2 -2
  216. package/dist/types/custom-theme.d.ts +1 -20
  217. package/dist/types/entry-points/token-metadata.codegen.d.ts +1 -1
  218. package/dist/types/get-custom-theme-styles.d.ts +16 -0
  219. package/dist/types/get-global-theme.d.ts +1 -1
  220. package/dist/types/theme-color-modes.d.ts +7 -0
  221. package/dist/types/theme-config.d.ts +4 -14
  222. package/dist/types/theme-ids.d.ts +7 -0
  223. package/dist/types/theme-state-transformer.d.ts +1 -1
  224. package/dist/types/utils/color-detection.d.ts +1 -6
  225. package/dist/types/utils/color-utils.d.ts +5 -5
  226. package/dist/types/utils/custom-theme-loading-utils.d.ts +1 -2
  227. package/dist/types/utils/generate-custom-color-ramp.d.ts +1 -2
  228. package/dist/types/utils/get-alpha.d.ts +1 -0
  229. package/dist/types/utils/get-closest-color-index.d.ts +2 -0
  230. package/dist/types/utils/get-css-custom-property.d.ts +15 -0
  231. package/dist/types/utils/get-fully-qualified-token-id.d.ts +11 -0
  232. package/dist/types/utils/get-theme-override-preferences.d.ts +2 -0
  233. package/dist/types/utils/get-theme-preferences.d.ts +1 -1
  234. package/dist/types/utils/get-token-id.d.ts +15 -0
  235. package/dist/types/utils/hct-color-utils/argb-from-rgb.d.ts +4 -0
  236. package/dist/types/utils/hct-color-utils/clamp-double.d.ts +7 -0
  237. package/dist/types/utils/hct-color-utils/clamp-int.d.ts +7 -0
  238. package/dist/types/utils/hct-color-utils/color-utils.d.ts +3 -23
  239. package/dist/types/utils/hct-color-utils/delinearized.d.ts +9 -0
  240. package/dist/types/utils/hct-color-utils/hct.d.ts +3 -48
  241. package/dist/types/utils/hct-color-utils/lerp.d.ts +6 -0
  242. package/dist/types/utils/hct-color-utils/linearized.d.ts +9 -0
  243. package/dist/types/utils/hct-color-utils/math-utils.d.ts +6 -60
  244. package/dist/types/utils/hct-color-utils/matrix-multiply.d.ts +4 -0
  245. package/dist/types/utils/hct-color-utils/sanitize-degrees-double.d.ts +7 -0
  246. package/dist/types/utils/hct-color-utils/signum.d.ts +6 -0
  247. package/dist/types/utils/hct-color-utils/viewing-conditions.d.ts +47 -0
  248. package/dist/types/utils/hex-to-rgba-values.d.ts +6 -0
  249. package/dist/types/utils/hsl-to-rgb.d.ts +1 -0
  250. package/dist/types/utils/is-valid-brand-hex.d.ts +1 -0
  251. package/dist/types/utils/limit-size-of-custom-style-elements.d.ts +1 -0
  252. package/dist/types/utils/load-theme-css.d.ts +2 -0
  253. package/dist/types/utils/relative-luminance-w3-c.d.ts +1 -0
  254. package/dist/types/utils/rgb-to-hex.d.ts +1 -0
  255. package/dist/types/utils/theme-loading.d.ts +1 -1
  256. package/dist/types/utils/token-ids.d.ts +3 -41
  257. package/dist/types-ts4.5/artifacts/replacement-mapping.d.ts +1 -1
  258. package/dist/types-ts4.5/artifacts/themes/atlassian-dark-increased-contrast.d.ts +2 -2
  259. package/dist/types-ts4.5/artifacts/themes/atlassian-dark.d.ts +2 -2
  260. package/dist/types-ts4.5/artifacts/themes/atlassian-light-increased-contrast.d.ts +2 -2
  261. package/dist/types-ts4.5/artifacts/themes/atlassian-light.d.ts +2 -2
  262. package/dist/types-ts4.5/artifacts/token-default-values.d.ts +2 -2
  263. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +1 -1
  264. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
  265. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light-increased-contrast.d.ts +1 -1
  266. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
  267. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-motion.d.ts +1 -1
  268. package/dist/types-ts4.5/artifacts/types-internal.d.ts +2 -2
  269. package/dist/types-ts4.5/artifacts/types.d.ts +2 -2
  270. package/dist/types-ts4.5/custom-theme.d.ts +1 -20
  271. package/dist/types-ts4.5/entry-points/token-metadata.codegen.d.ts +1 -1
  272. package/dist/types-ts4.5/get-custom-theme-styles.d.ts +16 -0
  273. package/dist/types-ts4.5/get-global-theme.d.ts +1 -1
  274. package/dist/types-ts4.5/theme-color-modes.d.ts +11 -0
  275. package/dist/types-ts4.5/theme-config.d.ts +4 -29
  276. package/dist/types-ts4.5/theme-ids.d.ts +18 -0
  277. package/dist/types-ts4.5/theme-state-transformer.d.ts +1 -1
  278. package/dist/types-ts4.5/utils/color-detection.d.ts +1 -6
  279. package/dist/types-ts4.5/utils/color-utils.d.ts +5 -9
  280. package/dist/types-ts4.5/utils/custom-theme-loading-utils.d.ts +1 -2
  281. package/dist/types-ts4.5/utils/generate-custom-color-ramp.d.ts +1 -2
  282. package/dist/types-ts4.5/utils/get-alpha.d.ts +1 -0
  283. package/dist/types-ts4.5/utils/get-closest-color-index.d.ts +2 -0
  284. package/dist/types-ts4.5/utils/get-css-custom-property.d.ts +15 -0
  285. package/dist/types-ts4.5/utils/get-fully-qualified-token-id.d.ts +11 -0
  286. package/dist/types-ts4.5/utils/get-theme-override-preferences.d.ts +2 -0
  287. package/dist/types-ts4.5/utils/get-theme-preferences.d.ts +1 -1
  288. package/dist/types-ts4.5/utils/get-token-id.d.ts +15 -0
  289. package/dist/types-ts4.5/utils/hct-color-utils/argb-from-rgb.d.ts +4 -0
  290. package/dist/types-ts4.5/utils/hct-color-utils/clamp-double.d.ts +7 -0
  291. package/dist/types-ts4.5/utils/hct-color-utils/clamp-int.d.ts +7 -0
  292. package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +3 -23
  293. package/dist/types-ts4.5/utils/hct-color-utils/delinearized.d.ts +9 -0
  294. package/dist/types-ts4.5/utils/hct-color-utils/hct.d.ts +3 -48
  295. package/dist/types-ts4.5/utils/hct-color-utils/lerp.d.ts +6 -0
  296. package/dist/types-ts4.5/utils/hct-color-utils/linearized.d.ts +9 -0
  297. package/dist/types-ts4.5/utils/hct-color-utils/math-utils.d.ts +6 -60
  298. package/dist/types-ts4.5/utils/hct-color-utils/matrix-multiply.d.ts +4 -0
  299. package/dist/types-ts4.5/utils/hct-color-utils/sanitize-degrees-double.d.ts +7 -0
  300. package/dist/types-ts4.5/utils/hct-color-utils/signum.d.ts +6 -0
  301. package/dist/types-ts4.5/utils/hct-color-utils/viewing-conditions.d.ts +47 -0
  302. package/dist/types-ts4.5/utils/hex-to-rgba-values.d.ts +6 -0
  303. package/dist/types-ts4.5/utils/hsl-to-rgb.d.ts +5 -0
  304. package/dist/types-ts4.5/utils/is-valid-brand-hex.d.ts +1 -0
  305. package/dist/types-ts4.5/utils/limit-size-of-custom-style-elements.d.ts +1 -0
  306. package/dist/types-ts4.5/utils/load-theme-css.d.ts +2 -0
  307. package/dist/types-ts4.5/utils/relative-luminance-w3-c.d.ts +1 -0
  308. package/dist/types-ts4.5/utils/rgb-to-hex.d.ts +1 -0
  309. package/dist/types-ts4.5/utils/theme-loading.d.ts +1 -1
  310. package/dist/types-ts4.5/utils/token-ids.d.ts +3 -41
  311. package/figma/atlassian-dark-increased-contrast.json +1 -1
  312. package/figma/atlassian-dark.json +1 -1
  313. package/figma/atlassian-light-increased-contrast.json +1 -1
  314. package/figma/atlassian-light.json +1 -1
  315. package/package.json +12 -12
  316. package/tokens.docs.tsx +48 -46
@@ -1,61 +1,6 @@
1
- import { COLOR_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE } from './constants';
2
- import { themeStateDefaults } from './theme-config';
3
- import { limitSizeOfCustomStyleElements, reduceTokenMap } from './utils/custom-theme-loading-utils';
4
- import { generateColors, generateTokenMapWithContrastCheck } from './utils/generate-custom-color-ramp';
5
- import { hash } from './utils/hash';
1
+ import { getCustomThemeStyles } from './get-custom-theme-styles';
2
+ import { limitSizeOfCustomStyleElements } from './utils/limit-size-of-custom-style-elements';
6
3
  export var CUSTOM_STYLE_ELEMENTS_SIZE_THRESHOLD = 10;
7
-
8
- /**
9
- *
10
- * @param themeSchema The schema of available themes
11
- * @returns a string with the CSS for the custom theme
12
- */
13
- /**
14
- * Takes a color mode and custom branding options, and returns an array of objects for use in applying custom styles to the document head.
15
- * Only supplies the color themes necessary for initial render, based on the current themeState. I.e. if in light mode, dark mode themes are not returned.
16
- *
17
- * @param {Object<string, string>} themeState The themes and color mode that should be applied.
18
- * @param {string} themeState.colorMode Determines which color theme is applied
19
- * @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
20
- *
21
- * @returns An object array, containing theme IDs, data-attributes to attach to the theme, and the theme CSS.
22
- * If an error is encountered while loading themes, the themes array will be empty.
23
- */
24
- export function getCustomThemeStyles(themeState) {
25
- var _themeState$UNSAFE_th;
26
- var brandColor = themeState === null || themeState === void 0 || (_themeState$UNSAFE_th = themeState.UNSAFE_themeOptions) === null || _themeState$UNSAFE_th === void 0 ? void 0 : _themeState$UNSAFE_th.brandColor;
27
- var mode = (themeState === null || themeState === void 0 ? void 0 : themeState.colorMode) || themeStateDefaults['colorMode'];
28
- var optionString = JSON.stringify(themeState === null || themeState === void 0 ? void 0 : themeState.UNSAFE_themeOptions);
29
- var uniqueId = hash(optionString);
30
- var themeRamp = generateColors(brandColor).ramp;
31
-
32
- // outputs object to generate to CSS from
33
- var themes = [];
34
- var tokenMaps = generateTokenMapWithContrastCheck(brandColor, mode, themeRamp);
35
- if ((mode === 'light' || mode === 'auto') && tokenMaps.light) {
36
- // Light mode theming
37
- themes.push({
38
- id: 'light',
39
- attrs: {
40
- 'data-theme': 'light',
41
- 'data-custom-theme': uniqueId
42
- },
43
- css: "\nhtml[".concat(CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(COLOR_MODE_ATTRIBUTE, "=\"light\"][data-theme~=\"light:light\"] {\n /* Branded tokens */\n ").concat(reduceTokenMap(tokenMaps.light, themeRamp), "\n}")
44
- });
45
- }
46
- if ((mode === 'dark' || mode === 'auto') && tokenMaps.dark) {
47
- // Dark mode theming
48
- themes.push({
49
- id: 'dark',
50
- attrs: {
51
- 'data-theme': 'dark',
52
- 'data-custom-theme': uniqueId
53
- },
54
- css: "\nhtml[".concat(CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(COLOR_MODE_ATTRIBUTE, "=\"dark\"][data-theme~=\"dark:dark\"] {\n /* Branded tokens */\n ").concat(reduceTokenMap(tokenMaps.dark, themeRamp), "\n}")
55
- });
56
- }
57
- return themes;
58
- }
59
4
  export function loadAndAppendCustomThemeCss(themeState) {
60
5
  var themes = getCustomThemeStyles(themeState);
61
6
  limitSizeOfCustomStyleElements(CUSTOM_STYLE_ELEMENTS_SIZE_THRESHOLD);
@@ -66,4 +11,5 @@ export function loadAndAppendCustomThemeCss(themeState) {
66
11
  styleTag.dataset.customTheme = theme.attrs['data-custom-theme'];
67
12
  styleTag.textContent = theme.css;
68
13
  });
69
- }
14
+ }
15
+ export { getCustomThemeStyles } from './get-custom-theme-styles';
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Metadata for generation of `@atlaskit/ads-mcp` and https://atlassian.design/llms-tokens.txt.
5
5
  *
6
- * @codegen <<SignedSource::84f21045f3136acc13a56a289840c82a>>
6
+ * @codegen <<SignedSource::ecdf4f84ae7b36849943b200af52ee54>>
7
7
  * @codegenCommand yarn build tokens
8
8
  */
9
9
 
@@ -160,15 +160,6 @@ export var tokens = [{
160
160
  usage: '',
161
161
  cssProperties: []
162
162
  }
163
- }, {
164
- name: 'motion.easing.spring',
165
- path: ['motion', 'easing', 'spring'],
166
- description: 'A spring curve that overshoots slightly before settling. Use for playful, tactile feedback on small branded elements such as avatar hover, where the slight overshoot reinforces a sense of life.',
167
- exampleValue: 'linear(0, 0.021, 0.058, 0.107, 0.164, 0.227, 0.292, 0.359, 0.425, 0.49, 0.552, 0.61, 0.664, 0.714, 0.759, 0.8, 0.837, 0.869, 0.898, 0.922, 0.943, 0.961, 0.976, 0.988, 0.998, 1.006, 1.013, 1.017, 1.02, 1.023, 1.024, 1.024, 1.024, 1.024, 1.023, 1.022, 1.02, 1.019, 1.017, 1.015, 1.014, 1.012, 1.011, 1.009, 1.008, 1.007, 1.006, 1.005, 1.004, 1.003, 1.002, 1.002, 1.001, 1.001, 1.001, 1, 1, 1, 1, 1, 0.999, 0.999, 0.999, 0.999, 1)',
168
- usageGuidelines: {
169
- usage: '',
170
- cssProperties: []
171
- }
172
163
  }, {
173
164
  name: 'motion.flag.enter',
174
165
  path: ['motion', 'flag', 'enter'],
@@ -2324,7 +2315,7 @@ export var tokens = [{
2324
2315
  name: 'color.background.disabled',
2325
2316
  path: ['color', 'background', 'disabled'],
2326
2317
  description: 'Use for backgrounds of elements in a disabled state.',
2327
- exampleValue: '#17171708',
2318
+ exampleValue: '#0515240F',
2328
2319
  usageGuidelines: {
2329
2320
  usage: 'The color for backgrounds. Use for areas behind content (e.g. color.background.neutral, color.background.selected)',
2330
2321
  cssProperties: ['background-color']
@@ -0,0 +1,52 @@
1
+ import { COLOR_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE } from './constants';
2
+ import { themeStateDefaults } from './theme-config';
3
+ import { reduceTokenMap } from './utils/custom-theme-loading-utils';
4
+ import { generateColors, generateTokenMapWithContrastCheck } from './utils/generate-custom-color-ramp';
5
+ import { hash } from './utils/hash';
6
+
7
+ /**
8
+ * Takes a color mode and custom branding options, and returns an array of objects for use in applying custom styles to the document head.
9
+ * Only supplies the color themes necessary for initial render, based on the current themeState. I.e. if in light mode, dark mode themes are not returned.
10
+ *
11
+ * @param {Object<string, string>} themeState The themes and color mode that should be applied.
12
+ * @param {string} themeState.colorMode Determines which color theme is applied
13
+ * @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
14
+ *
15
+ * @returns An object array, containing theme IDs, data-attributes to attach to the theme, and the theme CSS.
16
+ * If an error is encountered while loading themes, the themes array will be empty.
17
+ */
18
+ export function getCustomThemeStyles(themeState) {
19
+ var _themeState$UNSAFE_th;
20
+ var brandColor = themeState === null || themeState === void 0 || (_themeState$UNSAFE_th = themeState.UNSAFE_themeOptions) === null || _themeState$UNSAFE_th === void 0 ? void 0 : _themeState$UNSAFE_th.brandColor;
21
+ var mode = (themeState === null || themeState === void 0 ? void 0 : themeState.colorMode) || themeStateDefaults['colorMode'];
22
+ var optionString = JSON.stringify(themeState === null || themeState === void 0 ? void 0 : themeState.UNSAFE_themeOptions);
23
+ var uniqueId = hash(optionString);
24
+ var themeRamp = generateColors(brandColor).ramp;
25
+
26
+ // outputs object to generate to CSS from
27
+ var themes = [];
28
+ var tokenMaps = generateTokenMapWithContrastCheck(brandColor, mode, themeRamp);
29
+ if ((mode === 'light' || mode === 'auto') && tokenMaps.light) {
30
+ // Light mode theming
31
+ themes.push({
32
+ id: 'light',
33
+ attrs: {
34
+ 'data-theme': 'light',
35
+ 'data-custom-theme': uniqueId
36
+ },
37
+ css: "\nhtml[".concat(CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(COLOR_MODE_ATTRIBUTE, "=\"light\"][data-theme~=\"light:light\"] {\n /* Branded tokens */\n ").concat(reduceTokenMap(tokenMaps.light, themeRamp), "\n}")
38
+ });
39
+ }
40
+ if ((mode === 'dark' || mode === 'auto') && tokenMaps.dark) {
41
+ // Dark mode theming
42
+ themes.push({
43
+ id: 'dark',
44
+ attrs: {
45
+ 'data-theme': 'dark',
46
+ 'data-custom-theme': uniqueId
47
+ },
48
+ css: "\nhtml[".concat(CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(COLOR_MODE_ATTRIBUTE, "=\"dark\"][data-theme~=\"dark:dark\"] {\n /* Branded tokens */\n ").concat(reduceTokenMap(tokenMaps.dark, themeRamp), "\n}")
49
+ });
50
+ }
51
+ return themes;
52
+ }
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { COLOR_MODE_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
5
- import { themeColorModes } from './theme-config';
5
+ import { themeColorModes } from './theme-color-modes';
6
6
  import { themeStringToObject } from './theme-state-transformer';
7
7
  var isThemeColorMode = function isThemeColorMode(colorMode) {
8
8
  return themeColorModes.find(function (mode) {
@@ -5,8 +5,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { COLOR_MODE_ATTRIBUTE, CONTRAST_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
6
6
  import { themeStateDefaults } from './theme-config';
7
7
  import { themeObjectToString } from './theme-state-transformer';
8
- import { isValidBrandHex } from './utils/color-utils';
9
8
  import { hash } from './utils/hash';
9
+ import { isValidBrandHex } from './utils/is-valid-brand-hex';
10
10
  var defaultColorMode = 'light';
11
11
  var defaultContrastMode = 'no-preference';
12
12
 
@@ -3,9 +3,10 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { themeIdsWithOverrides, themeStateDefaults } from './theme-config';
6
- import { isValidBrandHex } from './utils/color-utils';
7
- import { getThemeOverridePreferences, getThemePreferences } from './utils/get-theme-preferences';
8
- import { loadThemeCss } from './utils/theme-loading';
6
+ import { getThemeOverridePreferences } from './utils/get-theme-override-preferences';
7
+ import { getThemePreferences } from './utils/get-theme-preferences';
8
+ import { isValidBrandHex } from './utils/is-valid-brand-hex';
9
+ import { loadThemeCss } from './utils/load-theme-css';
9
10
  /**
10
11
  * Takes an object containing theme preferences, and returns an array of objects for use in applying styles to the document head.
11
12
  * Only supplies the color themes necessary for initial render, based on the current themeState. I.e. if in light mode, dark mode themes are not returned.
@@ -26,7 +27,7 @@ import { loadThemeCss } from './utils/theme-loading';
26
27
  var getThemeStyles = /*#__PURE__*/function () {
27
28
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(preferences) {
28
29
  var themePreferences, themeOverridePreferences, themeState, results;
29
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
30
+ return _regeneratorRuntime.wrap(function (_context3) {
30
31
  while (1) switch (_context3.prev = _context3.next) {
31
32
  case 0:
32
33
  themeOverridePreferences = [];
@@ -53,17 +54,17 @@ var getThemeStyles = /*#__PURE__*/function () {
53
54
  themePreferences = getThemePreferences(themeState);
54
55
  themeOverridePreferences = getThemeOverridePreferences(themeState);
55
56
  }
56
- _context3.next = 4;
57
+ _context3.next = 1;
57
58
  return Promise.all([].concat(_toConsumableArray([].concat(_toConsumableArray(themePreferences), _toConsumableArray(themeOverridePreferences)).map( /*#__PURE__*/function () {
58
59
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeId) {
59
- var css;
60
- return _regeneratorRuntime.wrap(function _callee$(_context) {
60
+ var css, _t;
61
+ return _regeneratorRuntime.wrap(function (_context) {
61
62
  while (1) switch (_context.prev = _context.next) {
62
63
  case 0:
63
64
  _context.prev = 0;
64
- _context.next = 3;
65
+ _context.next = 1;
65
66
  return loadThemeCss(themeId);
66
- case 3:
67
+ case 1:
67
68
  css = _context.sent;
68
69
  return _context.abrupt("return", {
69
70
  id: themeId,
@@ -72,15 +73,15 @@ var getThemeStyles = /*#__PURE__*/function () {
72
73
  },
73
74
  css: css
74
75
  });
75
- case 7:
76
- _context.prev = 7;
77
- _context.t0 = _context["catch"](0);
76
+ case 2:
77
+ _context.prev = 2;
78
+ _t = _context["catch"](0);
78
79
  return _context.abrupt("return", undefined);
79
- case 10:
80
+ case 3:
80
81
  case "end":
81
82
  return _context.stop();
82
83
  }
83
- }, _callee, null, [[0, 7]]);
84
+ }, _callee, null, [[0, 2]]);
84
85
  }));
85
86
  return function (_x2) {
86
87
  return _ref2.apply(this, arguments);
@@ -89,47 +90,47 @@ var getThemeStyles = /*#__PURE__*/function () {
89
90
  // Add custom themes if they're present
90
91
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
91
92
  var _preferences$UNSAFE_t;
92
- var _yield$import, getCustomThemeStyles, customThemeStyles;
93
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
93
+ var _yield$import, getCustomThemeStyles, customThemeStyles, _t2;
94
+ return _regeneratorRuntime.wrap(function (_context2) {
94
95
  while (1) switch (_context2.prev = _context2.next) {
95
96
  case 0:
96
97
  if (!(preferences !== 'all' && preferences !== null && preferences !== void 0 && preferences.UNSAFE_themeOptions && isValidBrandHex(preferences === null || preferences === void 0 || (_preferences$UNSAFE_t = preferences.UNSAFE_themeOptions) === null || _preferences$UNSAFE_t === void 0 ? void 0 : _preferences$UNSAFE_t.brandColor))) {
97
- _context2.next = 15;
98
+ _context2.next = 5;
98
99
  break;
99
100
  }
100
101
  _context2.prev = 1;
101
- _context2.next = 4;
102
+ _context2.next = 2;
102
103
  return import( /* webpackChunkName: "@atlaskit-internal_atlassian-custom-theme" */
103
104
  './custom-theme');
104
- case 4:
105
+ case 2:
105
106
  _yield$import = _context2.sent;
106
107
  getCustomThemeStyles = _yield$import.getCustomThemeStyles;
107
- _context2.next = 8;
108
+ _context2.next = 3;
108
109
  return getCustomThemeStyles({
109
110
  colorMode: (preferences === null || preferences === void 0 ? void 0 : preferences.colorMode) || themeStateDefaults['colorMode'],
110
111
  UNSAFE_themeOptions: preferences === null || preferences === void 0 ? void 0 : preferences.UNSAFE_themeOptions
111
112
  });
112
- case 8:
113
+ case 3:
113
114
  customThemeStyles = _context2.sent;
114
115
  return _context2.abrupt("return", customThemeStyles);
115
- case 12:
116
- _context2.prev = 12;
117
- _context2.t0 = _context2["catch"](1);
116
+ case 4:
117
+ _context2.prev = 4;
118
+ _t2 = _context2["catch"](1);
118
119
  return _context2.abrupt("return", undefined);
119
- case 15:
120
+ case 5:
120
121
  return _context2.abrupt("return", undefined);
121
- case 16:
122
+ case 6:
122
123
  case "end":
123
124
  return _context2.stop();
124
125
  }
125
- }, _callee2, null, [[1, 12]]);
126
+ }, _callee2, null, [[1, 4]]);
126
127
  }))()]));
127
- case 4:
128
+ case 1:
128
129
  results = _context3.sent;
129
130
  return _context3.abrupt("return", results.flat().filter(function (theme) {
130
131
  return theme !== undefined;
131
132
  }));
132
- case 6:
133
+ case 2:
133
134
  case "end":
134
135
  return _context3.stop();
135
136
  }
@@ -1,7 +1,7 @@
1
1
  import { loadAndAppendCustomThemeCss } from './custom-theme';
2
2
  import { themeStateDefaults } from './theme-config';
3
- import { isValidBrandHex } from './utils/color-utils';
4
3
  import { findMissingCustomStyleElements } from './utils/custom-theme-loading-utils';
4
+ import { isValidBrandHex } from './utils/is-valid-brand-hex';
5
5
 
6
6
  /**
7
7
  * Synchronously generates and applies custom theme styles to the page.
@@ -9,10 +9,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import getGlobalTheme from './get-global-theme';
11
11
  import { themeStateDefaults } from './theme-config';
12
- import { isValidBrandHex } from './utils/color-utils';
13
12
  import configurePage from './utils/configure-page';
14
13
  import { findMissingCustomStyleElements } from './utils/custom-theme-loading-utils';
15
- import { getThemeOverridePreferences, getThemePreferences } from './utils/get-theme-preferences';
14
+ import { getThemeOverridePreferences } from './utils/get-theme-override-preferences';
15
+ import { getThemePreferences } from './utils/get-theme-preferences';
16
+ import { isValidBrandHex } from './utils/is-valid-brand-hex';
16
17
  import { loadAndAppendThemeCss } from './utils/theme-loading';
17
18
 
18
19
  /**
@@ -71,8 +72,9 @@ var setGlobalTheme = /*#__PURE__*/function () {
71
72
  _step,
72
73
  themeId,
73
74
  autoUnbind,
74
- _args3 = arguments;
75
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
75
+ _args3 = arguments,
76
+ _t;
77
+ return _regeneratorRuntime.wrap(function (_context3) {
76
78
  while (1) switch (_context3.prev = _context3.next) {
77
79
  case 0:
78
80
  nextThemeState = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
@@ -106,14 +108,14 @@ var setGlobalTheme = /*#__PURE__*/function () {
106
108
  loadingStrategy = themeLoader ? themeLoader : loadAndAppendThemeCss; // Load standard themes
107
109
  loadingTasks = themePreferences.map( /*#__PURE__*/function () {
108
110
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeId) {
109
- return _regeneratorRuntime.wrap(function _callee$(_context) {
111
+ return _regeneratorRuntime.wrap(function (_context) {
110
112
  while (1) switch (_context.prev = _context.next) {
111
113
  case 0:
112
- _context.next = 2;
114
+ _context.next = 1;
113
115
  return loadingStrategy(themeId);
114
- case 2:
116
+ case 1:
115
117
  return _context.abrupt("return", _context.sent);
116
- case 3:
118
+ case 2:
117
119
  case "end":
118
120
  return _context.stop();
119
121
  }
@@ -130,13 +132,13 @@ var setGlobalTheme = /*#__PURE__*/function () {
130
132
  // Load custom theme styles
131
133
  loadingTasks.push(_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
132
134
  var _yield$import, loadAndAppendCustomThemeCss;
133
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
135
+ return _regeneratorRuntime.wrap(function (_context2) {
134
136
  while (1) switch (_context2.prev = _context2.next) {
135
137
  case 0:
136
- _context2.next = 2;
138
+ _context2.next = 1;
137
139
  return import( /* webpackChunkName: "@atlaskit-internal_atlassian-custom-theme" */
138
140
  './custom-theme');
139
- case 2:
141
+ case 1:
140
142
  _yield$import = _context2.sent;
141
143
  loadAndAppendCustomThemeCss = _yield$import.loadAndAppendCustomThemeCss;
142
144
  loadAndAppendCustomThemeCss({
@@ -145,7 +147,7 @@ var setGlobalTheme = /*#__PURE__*/function () {
145
147
  attrOfMissingCustomStyles[0],
146
148
  UNSAFE_themeOptions: UNSAFE_themeOptions
147
149
  });
148
- case 5:
150
+ case 2:
149
151
  case "end":
150
152
  return _context2.stop();
151
153
  }
@@ -153,44 +155,44 @@ var setGlobalTheme = /*#__PURE__*/function () {
153
155
  }))());
154
156
  }
155
157
  }
156
- _context3.next = 11;
158
+ _context3.next = 1;
157
159
  return Promise.all(loadingTasks);
158
- case 11:
160
+ case 1:
159
161
  // Load override themes after standard themes
160
162
  themeOverridePreferences = getThemeOverridePreferences(themeState);
161
163
  _iterator = _createForOfIteratorHelper(themeOverridePreferences);
162
- _context3.prev = 13;
164
+ _context3.prev = 2;
163
165
  _iterator.s();
164
- case 15:
166
+ case 3:
165
167
  if ((_step = _iterator.n()).done) {
166
- _context3.next = 21;
168
+ _context3.next = 5;
167
169
  break;
168
170
  }
169
171
  themeId = _step.value;
170
- _context3.next = 19;
172
+ _context3.next = 4;
171
173
  return loadingStrategy(themeId);
172
- case 19:
173
- _context3.next = 15;
174
+ case 4:
175
+ _context3.next = 3;
174
176
  break;
175
- case 21:
176
- _context3.next = 26;
177
+ case 5:
178
+ _context3.next = 7;
177
179
  break;
178
- case 23:
179
- _context3.prev = 23;
180
- _context3.t0 = _context3["catch"](13);
181
- _iterator.e(_context3.t0);
182
- case 26:
183
- _context3.prev = 26;
180
+ case 6:
181
+ _context3.prev = 6;
182
+ _t = _context3["catch"](2);
183
+ _iterator.e(_t);
184
+ case 7:
185
+ _context3.prev = 7;
184
186
  _iterator.f();
185
- return _context3.finish(26);
186
- case 29:
187
+ return _context3.finish(7);
188
+ case 8:
187
189
  autoUnbind = configurePage(themeState);
188
190
  return _context3.abrupt("return", autoUnbind);
189
- case 31:
191
+ case 9:
190
192
  case "end":
191
193
  return _context3.stop();
192
194
  }
193
- }, _callee3, null, [[13, 23, 26, 29]]);
195
+ }, _callee3, null, [[2, 6, 7, 8]]);
194
196
  }));
195
197
  return function setGlobalTheme() {
196
198
  return _ref.apply(this, arguments);
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Theme modes: The general purpose of a theme.
3
+ * This attr is used to apply the appropriate system-preference option
4
+ * It may also be used as a selector for mode-specific overrides such as light/dark images.
5
+ * The idea is there may exist many color themes, but every theme must either fit into light or dark.
6
+ */
7
+ export var themeColorModes = ['light', 'dark', 'auto'];
@@ -1,5 +1,6 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import { fg } from '@atlaskit/platform-feature-flags';
2
-
3
+ import { themeIds } from './theme-ids';
3
4
  /**
4
5
  * This file contains the source of truth for themes and all associated meta data.
5
6
  */
@@ -23,30 +24,16 @@ import { fg } from '@atlaskit/platform-feature-flags';
23
24
  * In the future other types may be introduced such as typography.
24
25
  */
25
26
 
26
- /**
27
- * Theme modes: The general purpose of a theme.
28
- * This attr is used to apply the appropriate system-preference option
29
- * It may also be used as a selector for mode-specific overrides such as light/dark images.
30
- * The idea is there may exist many color themes, but every theme must either fit into light or dark.
31
- */
32
- export var themeColorModes = ['light', 'dark', 'auto'];
33
27
  /**
34
28
  * Contrast preferences: The system contrast preference
35
29
  */
36
30
  var themeContrastModes = ['more', 'no-preference', 'auto'];
37
- /**
38
- * Theme ids: The value that will be mounted to the DOM as a data attr
39
- * For example: `data-theme="light:light dark:dark spacing:spacing"
40
- *
41
- * These ids must be kebab case
42
- */
43
- export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography', 'motion'];
44
31
  /**
45
32
  * Theme override ids: the equivalent of themeIds for theme overrides.
46
33
  * Theme overrides are temporary and there may not be any defined at times.
47
34
  */
48
35
  var themeOverrideIds = [];
49
- export var themeIdsWithOverrides = [].concat(themeIds, themeOverrideIds);
36
+ export var themeIdsWithOverrides = [].concat(_toConsumableArray(themeIds), themeOverrideIds);
50
37
 
51
38
  /**
52
39
  * Theme to use a base. This will create the theme as
@@ -189,6 +176,7 @@ function getMotionDefault() {
189
176
  /**
190
177
  * themeStateDefaults: the default values for ThemeState used by theming utilities
191
178
  */
179
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
192
180
  export var themeStateDefaults = {
193
181
  colorMode: 'auto',
194
182
  contrastMode: 'auto',
@@ -206,4 +194,7 @@ export var themeStateDefaults = {
206
194
  * (the page doesn't have an "auto" color mode, it's either light or dark)
207
195
  */
208
196
 
209
- export default themeConfig;
197
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
198
+ export default themeConfig;
199
+ export { themeColorModes } from './theme-color-modes';
200
+ export { themeIds } from './theme-ids';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Theme ids: The value that will be mounted to the DOM as a data attr
3
+ * For example: `data-theme="light:light dark:dark spacing:spacing"
4
+ *
5
+ * These ids must be kebab case
6
+ */
7
+ export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography', 'motion'];
@@ -1,6 +1,6 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import { themeIds } from './theme-config';
3
+ import { themeIds } from './theme-ids';
4
4
  var themeKinds = ['light', 'dark', 'spacing', 'typography', 'shape', 'motion'];
5
5
  var customThemeOptions = 'UNSAFE_themeOptions';
6
6
  var isThemeKind = function isThemeKind(themeKind) {
@@ -66,6 +66,7 @@ export var themeStringToObject = function themeStringToObject(themeState) {
66
66
  * // returns 'dark:dark light:light spacing:spacing'
67
67
  * ```
68
68
  */
69
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
69
70
  export var themeObjectToString = function themeObjectToString(themeState) {
70
71
  return Object.entries(themeState).reduce(function (themeString, _ref3) {
71
72
  var _ref4 = _slicedToArray(_ref3, 2),
@@ -1,13 +1,4 @@
1
- export var hexToRGBAValues = function hexToRGBAValues(hex) {
2
- var hexColor = hex.replace('#', '');
3
- return {
4
- r: parseInt(hexColor.slice(0, 2), 16),
5
- g: parseInt(hexColor.slice(2, 4), 16),
6
- b: parseInt(hexColor.slice(4, 6), 16),
7
- a: parseFloat((parseInt(hexColor.slice(6, 8), 16) / 255).toFixed(2))
8
- };
9
- };
10
-
1
+ import { hexToRGBAValues } from './hex-to-rgba-values';
11
2
  /**
12
3
  * Returns a box shadow formatted for CSS from a ShadowToken raw value.
13
4
  *
@@ -25,4 +16,5 @@ export var getBoxShadow = function getBoxShadow(rawShadow) {
25
16
  b = _hexToRGBAValues.b;
26
17
  return "".concat(offset.x, "px ").concat(offset.y, "px ").concat(radius, "px rgba(").concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
27
18
  }).join(',');
28
- };
19
+ };
20
+ export { hexToRGBAValues } from './hex-to-rgba-values';