@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/tokens
2
2
 
3
+ ## 13.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6ae1bed1867c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ae1bed1867c5) -
8
+ [ux] Updated `color.background.disabled` to use a stronger neutral palette value (`Neutral200A` in
9
+ light themes, `DarkNeutral300A` in dark themes).
10
+
11
+ ## 13.0.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`591568c487e99`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/591568c487e99) -
16
+ Moved "motion.easing.spring" token into experimental state
17
+
3
18
  ## 13.0.3
4
19
 
5
20
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import type { Declaration, Node, Rule } from 'postcss';
2
2
 
3
- import { uniqueWordsFromTokens } from '../../utils/tokens';
3
+ import { uniqueWordsFromTokens } from '../../utils/unique-words-from-tokens';
4
4
 
5
5
  import { extractCssVarName } from './declaration';
6
6
  import { knownNamedColors, knownRawColors, knownVariables } from './legacy-colors';
@@ -1,5 +1,5 @@
1
1
  import Search from '../../theme-to-design-tokens/utils/fuzzy-search';
2
- import { activeTokens } from '../../utils/tokens';
2
+ import { activeTokens } from '../../utils/active-tokens';
3
3
 
4
4
  import { cleanMeta } from './meta';
5
5
 
@@ -3,21 +3,23 @@ import { hasImportDeclaration, isDecendantOfType } from '@hypermod/utils';
3
3
  import type { API, Collection, FileInfo, JSCodeshift, TemplateElement } from 'jscodeshift';
4
4
 
5
5
  import CSSTransformer from '../css-to-design-tokens/transform';
6
- import { activeTokens } from '../utils/tokens';
7
-
8
- import { isDecendantOfToken, isParentOfToken } from './utils/ast';
9
- import { cleanMeta, getMetaFromAncestors } from './utils/ast-meta';
10
- import {
11
- includesHardCodedColor,
12
- isBoldColor,
13
- isHardCodedColor,
14
- isLegacyColor,
15
- isLegacyNamedColor,
16
- } from './utils/color';
17
- import { containsReplaceableCSSDeclarations, findEndIndexOfCSSExpression } from './utils/css-utils';
6
+ import { activeTokens } from '../utils/active-tokens';
7
+
8
+ import { cleanMeta } from './utils/clean-meta';
9
+ import { includesHardCodedColor, isHardCodedColor } from './utils/color';
10
+ import { containsReplaceableCSSDeclarations } from './utils/contains-replaceable-css-declarations';
11
+ import { findEndIndexOfCSSExpression } from './utils/find-end-index-of-css-expression';
12
+ import { findFirstNonspaceIndexAfter } from './utils/find-first-nonspace-index-after';
18
13
  import Search from './utils/fuzzy-search';
19
- import { legacyColorMetaMap } from './utils/legacy-colors';
20
- import { findFirstNonspaceIndexAfter, kebabize, splitAtIndex } from './utils/string-utils';
14
+ import { getMetaFromAncestors } from './utils/get-meta-from-ancestors';
15
+ import { isBoldColor } from './utils/is-bold-color';
16
+ import { isDecendantOfToken } from './utils/is-decendant-of-token';
17
+ import { isLegacyColor } from './utils/is-legacy-color';
18
+ import { isLegacyNamedColor } from './utils/is-legacy-named-color';
19
+ import { isParentOfToken } from './utils/is-parent-of-token';
20
+ import { kebabize } from './utils/kebabize';
21
+ import { legacyColorMetaMap } from './utils/legacy-color-meta-map';
22
+ import { splitAtIndex } from './utils/split-at-index';
21
23
 
22
24
  function insertTokenImport(j: JSCodeshift, source: Collection<any>) {
23
25
  if (hasImportDeclaration(j, source, '@atlaskit/tokens')) {
@@ -1,151 +1,2 @@
1
- import type core from 'jscodeshift';
2
-
3
- import { uniqueWordsFromTokens } from '../../utils/tokens';
4
-
5
- import { getClosestDecendantOfType } from './ast';
6
-
7
- export function getMetaFromAncestors(
8
- j: core.JSCodeshift,
9
- path: any,
10
- meta: string[] = [],
11
- ): string[] {
12
- const parent = path.parentPath;
13
- const grandParent = parent && parent.parentPath;
14
-
15
- if (parent && parent.value.type === 'ObjectProperty') {
16
- let value = '';
17
-
18
- if (
19
- parent.value.key.type === 'Literal' ||
20
- parent.value.key.type === 'StringLiteral' ||
21
- parent.value.key.type === 'NumericLiteral'
22
- ) {
23
- value = parent.value.key.value.toString();
24
- } else {
25
- value = parent.value.key.name;
26
- }
27
-
28
- meta.push(value);
29
- }
30
-
31
- if (parent && grandParent && grandParent.value.type === 'TemplateLiteral') {
32
- const expressionIndex = grandParent.value.expressions.findIndex(
33
- (exp: any) => exp.name === path.value.name,
34
- );
35
- const quasi = grandParent.value.quasis[expressionIndex];
36
- const propertyName = (quasi.value.cooked || quasi.value.raw || '')
37
- .replace(/\n/g, '')
38
- .split(/;|{|}/)
39
- .filter((el: string) => !el.match(/\.|\@|\(|\)/))
40
- .pop()
41
- .split(/:/g)[0]
42
- .trim();
43
-
44
- grandParent.value.quasis
45
- .slice(0, expressionIndex + 1)
46
- .map((q: any) => q.value.cooked)
47
- // We reverse so the most nested one is first which we're more likely than not interested in
48
- .reverse()
49
- .some((str: string) => {
50
- const result = /(hover|active|disabled|focus)/.exec(str.toLowerCase());
51
-
52
- if (result) {
53
- meta.push(result[0]);
54
- return true;
55
- }
56
- });
57
-
58
- meta.push(propertyName);
59
- }
60
-
61
- if (parent && parent.value.type === 'JSXAttribute') {
62
- if (
63
- !['css', 'styles', 'style', 'fill', 'stopColor', 'startColor'].includes(
64
- parent.value.name.name,
65
- )
66
- ) {
67
- meta.push(parent.value.name.name);
68
- }
69
- }
70
-
71
- const closestJSXElement = getClosestDecendantOfType(j, path, j.JSXOpeningElement);
72
-
73
- if (closestJSXElement) {
74
- const jsxElementName = closestJSXElement.value.name.name;
75
- const nameComponents = jsxElementName.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
76
-
77
- meta.push(...nameComponents);
78
- }
79
-
80
- if (parent && parent.value.type === 'VariableDeclarator') {
81
- meta.push(parent.value.id.name);
82
- }
83
-
84
- if (parent) {
85
- return getMetaFromAncestors(j, parent, meta);
86
- }
87
-
88
- return meta;
89
- }
90
-
91
- export function cleanMeta(meta: string[]): string[] {
92
- return meta
93
- .reduce<string[]>(
94
- (accum, val) => [
95
- ...accum,
96
- ...(typeof val === 'string' ? val.split(/(?=[A-Z])/g).map((e) => e.toLowerCase()) : []),
97
- ],
98
- [],
99
- )
100
- .reduce<string[]>((accum, val) => {
101
- const cleanVal = val
102
- .replace(/:/g, '')
103
- .replace(/,/g, '')
104
- .replace('grey', 'neutral')
105
- .replace('skeleton', 'neutral')
106
- .replace('texts', 'text')
107
- .replace('red', 'danger')
108
- .replace('error', 'danger')
109
- .replace('invalid', 'danger')
110
- .replace('removed', 'danger')
111
- .replace('removal', 'danger')
112
- .replace('remove', 'danger')
113
- .replace('focus', 'focused')
114
- .replace('valid', 'success')
115
- .replace('successful', 'success')
116
- .replace('risk', 'warning')
117
- .replace('caution', 'warning')
118
- .replace('primary', 'bold')
119
- .replace('secondary', 'subtle')
120
- .replace('hyperlink', 'link')
121
- .replace('anchor', 'link')
122
- .replace('active', 'pressed')
123
- .replace('hover', 'hovered')
124
- .replace('card', 'raised')
125
- .replace('dragged', 'surface overlay')
126
- .replace('dragging', 'surface overlay')
127
- .replace('drag', 'surface overlay')
128
- .replace('background-color', 'background')
129
- .replace('color', 'text')
130
- .replace('icons', 'icon')
131
- .replace('glyph', 'icon')
132
- .replace('stroke', 'border')
133
- .replace('border-left', 'border')
134
- .replace('border-right', 'border')
135
- .replace('border-top', 'border')
136
- .replace('border-bottom', 'border')
137
- .replace('box-shadow', 'shadow');
138
-
139
- accum.push(...cleanVal.split(' '));
140
-
141
- return accum;
142
- }, [])
143
- .filter((val) => uniqueWordsFromTokens.includes(val))
144
- .reduce<string[]>((accum, val) => {
145
- if (!accum.includes(val)) {
146
- accum.push(val);
147
- }
148
-
149
- return accum;
150
- }, []);
151
- }
1
+ export { getMetaFromAncestors } from './get-meta-from-ancestors';
2
+ export { cleanMeta } from './clean-meta';
@@ -1,35 +1,3 @@
1
- import { isDecendantOfType } from '@hypermod/utils';
2
- import type { ASTNode, ASTPath, JSCodeshift } from 'jscodeshift';
3
-
4
- export function isDecendantOfToken(j: JSCodeshift, path: ASTPath | ASTNode): boolean {
5
- if (
6
- 'type' in path &&
7
- path.type === 'CallExpression' &&
8
- path.callee.type === 'Identifier' &&
9
- path.callee.name === 'token'
10
- ) {
11
- return true;
12
- }
13
-
14
- return j(path).closest(j.CallExpression, { callee: { name: 'token' } }).length > 0;
15
- }
16
-
17
- export function isParentOfToken(j: JSCodeshift, path: any): boolean {
18
- if (
19
- path.type === 'CallExpression' &&
20
- path.callee.type === 'Identifier' &&
21
- path.callee.name === 'token'
22
- ) {
23
- return true;
24
- }
25
-
26
- return j(path).find(j.CallExpression, { callee: { name: 'token' } }).length > 0;
27
- }
28
-
29
- export function getClosestDecendantOfType(j: JSCodeshift, path: ASTPath<any>, type: any): any {
30
- if (!isDecendantOfType(j, path, type)) {
31
- return;
32
- }
33
-
34
- return j(path).closest(type).get();
35
- }
1
+ export { isDecendantOfToken } from './is-decendant-of-token';
2
+ export { isParentOfToken } from './is-parent-of-token';
3
+ export { getClosestDecendantOfType } from './get-closest-decendant-of-type';
@@ -0,0 +1,63 @@
1
+ import { uniqueWordsFromTokens } from '../../utils/unique-words-from-tokens';
2
+
3
+ export function cleanMeta(meta: string[]): string[] {
4
+ return meta
5
+ .reduce<string[]>(
6
+ (accum, val) => [
7
+ ...accum,
8
+ ...(typeof val === 'string' ? val.split(/(?=[A-Z])/g).map((e) => e.toLowerCase()) : []),
9
+ ],
10
+ [],
11
+ )
12
+ .reduce<string[]>((accum, val) => {
13
+ const cleanVal = val
14
+ .replace(/:/g, '')
15
+ .replace(/,/g, '')
16
+ .replace('grey', 'neutral')
17
+ .replace('skeleton', 'neutral')
18
+ .replace('texts', 'text')
19
+ .replace('red', 'danger')
20
+ .replace('error', 'danger')
21
+ .replace('invalid', 'danger')
22
+ .replace('removed', 'danger')
23
+ .replace('removal', 'danger')
24
+ .replace('remove', 'danger')
25
+ .replace('focus', 'focused')
26
+ .replace('valid', 'success')
27
+ .replace('successful', 'success')
28
+ .replace('risk', 'warning')
29
+ .replace('caution', 'warning')
30
+ .replace('primary', 'bold')
31
+ .replace('secondary', 'subtle')
32
+ .replace('hyperlink', 'link')
33
+ .replace('anchor', 'link')
34
+ .replace('active', 'pressed')
35
+ .replace('hover', 'hovered')
36
+ .replace('card', 'raised')
37
+ .replace('dragged', 'surface overlay')
38
+ .replace('dragging', 'surface overlay')
39
+ .replace('drag', 'surface overlay')
40
+ .replace('background-color', 'background')
41
+ .replace('color', 'text')
42
+ .replace('icons', 'icon')
43
+ .replace('glyph', 'icon')
44
+ .replace('stroke', 'border')
45
+ .replace('border-left', 'border')
46
+ .replace('border-right', 'border')
47
+ .replace('border-top', 'border')
48
+ .replace('border-bottom', 'border')
49
+ .replace('box-shadow', 'shadow');
50
+
51
+ accum.push(...cleanVal.split(' '));
52
+
53
+ return accum;
54
+ }, [])
55
+ .filter((val) => uniqueWordsFromTokens.includes(val))
56
+ .reduce<string[]>((accum, val) => {
57
+ if (!accum.includes(val)) {
58
+ accum.push(val);
59
+ }
60
+
61
+ return accum;
62
+ }, []);
63
+ }
@@ -1,12 +1,5 @@
1
- import { legacyColorMixins, legacyColors } from './legacy-colors';
2
1
  import { namedColors } from './named-colors';
3
2
 
4
- export const isLegacyColor: (value: string) => boolean = (value: string) =>
5
- legacyColors.includes(value);
6
-
7
- export const isLegacyNamedColor: (value: string) => boolean = (value: string) =>
8
- legacyColorMixins.includes(value);
9
-
10
3
  const colorRegexp =
11
4
  /#(?:[a-f0-9]{3}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|lch|lab|color)\([^\)]*\)/;
12
5
 
@@ -40,7 +33,6 @@ export const isHardCodedColor: (raw: string) => boolean = (raw: string) => {
40
33
  return false;
41
34
  };
42
35
 
43
- export function isBoldColor(color: string): boolean {
44
- const number = parseInt(color.replace(/^./, ''), 10);
45
- return number > 300;
46
- }
36
+ export { isLegacyColor } from './is-legacy-color';
37
+ export { isLegacyNamedColor } from './is-legacy-named-color';
38
+ export { isBoldColor } from './is-bold-color';
@@ -0,0 +1,13 @@
1
+ import { isColorRelatedProperty } from '../../css-to-design-tokens/lib/declaration';
2
+
3
+ export function containsReplaceableCSSDeclarations(input: string): boolean {
4
+ const cssPattern = /(\S+)\s*:/g;
5
+
6
+ let match;
7
+ while ((match = cssPattern.exec(input)) !== null) {
8
+ if (isColorRelatedProperty(match[1])) {
9
+ return true;
10
+ }
11
+ }
12
+ return false;
13
+ }
@@ -1,35 +1,2 @@
1
- import { isColorRelatedProperty } from '../../css-to-design-tokens/lib/declaration';
2
-
3
- export function containsReplaceableCSSDeclarations(input: string): boolean {
4
- const cssPattern = /(\S+)\s*:/g;
5
-
6
- let match;
7
- while ((match = cssPattern.exec(input)) !== null) {
8
- if (isColorRelatedProperty(match[1])) {
9
- return true;
10
- }
11
- }
12
- return false;
13
- }
14
-
15
- export function findEndIndexOfCSSExpression(text: string, isAtEndOfInput: boolean): number | null {
16
- // CSS expression can end *on* a semicolon or *before* a brace. In either
17
- // case we treat the remaining part of the value to cover one character
18
- // before that symbol.
19
- const semicolonIndex = text.indexOf(';');
20
- const braceIndex = text.indexOf('}');
21
-
22
- if (semicolonIndex === -1 && braceIndex === -1) {
23
- if (isAtEndOfInput) {
24
- return text.length;
25
- } else {
26
- return null;
27
- }
28
- } else if (semicolonIndex === -1) {
29
- return braceIndex - 1;
30
- } else if (braceIndex === -1) {
31
- return semicolonIndex - 1;
32
- } else {
33
- return Math.min(semicolonIndex, braceIndex) - 1;
34
- }
35
- }
1
+ export { containsReplaceableCSSDeclarations } from './contains-replaceable-css-declarations';
2
+ export { findEndIndexOfCSSExpression } from './find-end-index-of-css-expression';
@@ -0,0 +1,21 @@
1
+ export function findEndIndexOfCSSExpression(text: string, isAtEndOfInput: boolean): number | null {
2
+ // CSS expression can end *on* a semicolon or *before* a brace. In either
3
+ // case we treat the remaining part of the value to cover one character
4
+ // before that symbol.
5
+ const semicolonIndex = text.indexOf(';');
6
+ const braceIndex = text.indexOf('}');
7
+
8
+ if (semicolonIndex === -1 && braceIndex === -1) {
9
+ if (isAtEndOfInput) {
10
+ return text.length;
11
+ } else {
12
+ return null;
13
+ }
14
+ } else if (semicolonIndex === -1) {
15
+ return braceIndex - 1;
16
+ } else if (braceIndex === -1) {
17
+ return semicolonIndex - 1;
18
+ } else {
19
+ return Math.min(semicolonIndex, braceIndex) - 1;
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ export function findFirstNonspaceIndexAfter(text: string, index: number): number {
2
+ const rest = text.slice(index + 1);
3
+ const indexInRest = rest.search(/\S/);
4
+ if (indexInRest === -1) {
5
+ return text.length;
6
+ } else {
7
+ return index + 1 + indexInRest;
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ import { isDecendantOfType } from '@hypermod/utils';
2
+ import type { ASTPath, JSCodeshift } from 'jscodeshift';
3
+
4
+ export function getClosestDecendantOfType(j: JSCodeshift, path: ASTPath<any>, type: any): any {
5
+ if (!isDecendantOfType(j, path, type)) {
6
+ return;
7
+ }
8
+
9
+ return j(path).closest(type).get();
10
+ }
@@ -0,0 +1,87 @@
1
+ import type core from 'jscodeshift';
2
+
3
+ import { getClosestDecendantOfType } from './get-closest-decendant-of-type';
4
+
5
+ export function getMetaFromAncestors(
6
+ j: core.JSCodeshift,
7
+ path: any,
8
+ meta: string[] = [],
9
+ ): string[] {
10
+ const parent = path.parentPath;
11
+ const grandParent = parent && parent.parentPath;
12
+
13
+ if (parent && parent.value.type === 'ObjectProperty') {
14
+ let value = '';
15
+
16
+ if (
17
+ parent.value.key.type === 'Literal' ||
18
+ parent.value.key.type === 'StringLiteral' ||
19
+ parent.value.key.type === 'NumericLiteral'
20
+ ) {
21
+ value = parent.value.key.value.toString();
22
+ } else {
23
+ value = parent.value.key.name;
24
+ }
25
+
26
+ meta.push(value);
27
+ }
28
+
29
+ if (parent && grandParent && grandParent.value.type === 'TemplateLiteral') {
30
+ const expressionIndex = grandParent.value.expressions.findIndex(
31
+ (exp: any) => exp.name === path.value.name,
32
+ );
33
+ const quasi = grandParent.value.quasis[expressionIndex];
34
+ const propertyName = (quasi.value.cooked || quasi.value.raw || '')
35
+ .replace(/\n/g, '')
36
+ .split(/;|{|}/)
37
+ .filter((el: string) => !el.match(/\.|\@|\(|\)/))
38
+ .pop()
39
+ .split(/:/g)[0]
40
+ .trim();
41
+
42
+ grandParent.value.quasis
43
+ .slice(0, expressionIndex + 1)
44
+ .map((q: any) => q.value.cooked)
45
+ // We reverse so the most nested one is first which we're more likely than not interested in
46
+ .reverse()
47
+ .some((str: string) => {
48
+ const result = /(hover|active|disabled|focus)/.exec(str.toLowerCase());
49
+
50
+ if (result) {
51
+ meta.push(result[0]);
52
+ return true;
53
+ }
54
+ });
55
+
56
+ meta.push(propertyName);
57
+ }
58
+
59
+ if (parent && parent.value.type === 'JSXAttribute') {
60
+ if (
61
+ !['css', 'styles', 'style', 'fill', 'stopColor', 'startColor'].includes(
62
+ parent.value.name.name,
63
+ )
64
+ ) {
65
+ meta.push(parent.value.name.name);
66
+ }
67
+ }
68
+
69
+ const closestJSXElement = getClosestDecendantOfType(j, path, j.JSXOpeningElement);
70
+
71
+ if (closestJSXElement) {
72
+ const jsxElementName = closestJSXElement.value.name.name;
73
+ const nameComponents = jsxElementName.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
74
+
75
+ meta.push(...nameComponents);
76
+ }
77
+
78
+ if (parent && parent.value.type === 'VariableDeclarator') {
79
+ meta.push(parent.value.id.name);
80
+ }
81
+
82
+ if (parent) {
83
+ return getMetaFromAncestors(j, parent, meta);
84
+ }
85
+
86
+ return meta;
87
+ }
@@ -0,0 +1,4 @@
1
+ export function isBoldColor(color: string): boolean {
2
+ const number = parseInt(color.replace(/^./, ''), 10);
3
+ return number > 300;
4
+ }
@@ -0,0 +1,14 @@
1
+ import type { ASTNode, ASTPath, JSCodeshift } from 'jscodeshift';
2
+
3
+ export function isDecendantOfToken(j: JSCodeshift, path: ASTPath | ASTNode): boolean {
4
+ if (
5
+ 'type' in path &&
6
+ path.type === 'CallExpression' &&
7
+ path.callee.type === 'Identifier' &&
8
+ path.callee.name === 'token'
9
+ ) {
10
+ return true;
11
+ }
12
+
13
+ return j(path).closest(j.CallExpression, { callee: { name: 'token' } }).length > 0;
14
+ }
@@ -0,0 +1,4 @@
1
+ import { legacyColors } from './legacy-colors';
2
+
3
+ export const isLegacyColor: (value: string) => boolean = (value: string) =>
4
+ legacyColors.includes(value);
@@ -0,0 +1,4 @@
1
+ import { legacyColorMixins } from './legacy-color-mixins';
2
+
3
+ export const isLegacyNamedColor: (value: string) => boolean = (value: string) =>
4
+ legacyColorMixins.includes(value);
@@ -0,0 +1,13 @@
1
+ import type { JSCodeshift } from 'jscodeshift';
2
+
3
+ export function isParentOfToken(j: JSCodeshift, path: any): boolean {
4
+ if (
5
+ path.type === 'CallExpression' &&
6
+ path.callee.type === 'Identifier' &&
7
+ path.callee.name === 'token'
8
+ ) {
9
+ return true;
10
+ }
11
+
12
+ return j(path).find(j.CallExpression, { callee: { name: 'token' } }).length > 0;
13
+ }
@@ -0,0 +1,2 @@
1
+ export const kebabize: (str: string) => string = (str: string) =>
2
+ str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());