@atlaskit/tokens 0.7.3 → 0.8.2

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 (65) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/css/atlassian-dark.css +5 -3
  3. package/css/atlassian-light.css +5 -3
  4. package/dist/cjs/artifacts/rename-mapping.js +89 -89
  5. package/dist/cjs/artifacts/token-default-values.js +5 -3
  6. package/dist/cjs/artifacts/token-names.js +2 -0
  7. package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +222 -184
  8. package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +222 -184
  9. package/dist/cjs/constants.js +18 -0
  10. package/dist/cjs/entry-points/token-ids.js +25 -0
  11. package/dist/cjs/get-token.js +1 -1
  12. package/dist/cjs/token-ids.js +75 -0
  13. package/dist/cjs/tokens/atlassian-dark/color/background.js +3 -3
  14. package/dist/cjs/tokens/atlassian-dark/color/skeleton.js +20 -0
  15. package/dist/cjs/tokens/atlassian-light/color/background.js +3 -3
  16. package/dist/cjs/tokens/atlassian-light/color/skeleton.js +20 -0
  17. package/dist/cjs/tokens/default/color/skeleton.js +28 -0
  18. package/dist/cjs/tokens/default/deprecated/deprecated.js +89 -89
  19. package/dist/cjs/version.json +4 -2
  20. package/dist/es2019/artifacts/rename-mapping.js +89 -89
  21. package/dist/es2019/artifacts/token-default-values.js +5 -3
  22. package/dist/es2019/artifacts/token-names.js +2 -0
  23. package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +222 -184
  24. package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +222 -184
  25. package/dist/es2019/constants.js +8 -0
  26. package/dist/es2019/entry-points/token-ids.js +1 -0
  27. package/dist/es2019/get-token.js +1 -1
  28. package/dist/es2019/token-ids.js +51 -0
  29. package/dist/es2019/tokens/atlassian-dark/color/background.js +3 -3
  30. package/dist/es2019/tokens/atlassian-dark/color/skeleton.js +13 -0
  31. package/dist/es2019/tokens/atlassian-light/color/background.js +3 -3
  32. package/dist/es2019/tokens/atlassian-light/color/skeleton.js +13 -0
  33. package/dist/es2019/tokens/default/color/skeleton.js +21 -0
  34. package/dist/es2019/tokens/default/deprecated/deprecated.js +89 -89
  35. package/dist/es2019/version.json +4 -2
  36. package/dist/esm/artifacts/rename-mapping.js +89 -89
  37. package/dist/esm/artifacts/token-default-values.js +5 -3
  38. package/dist/esm/artifacts/token-names.js +2 -0
  39. package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +222 -184
  40. package/dist/esm/artifacts/tokens-raw/atlassian-light.js +222 -184
  41. package/dist/esm/constants.js +8 -0
  42. package/dist/esm/entry-points/token-ids.js +1 -0
  43. package/dist/esm/get-token.js +1 -1
  44. package/dist/esm/token-ids.js +58 -0
  45. package/dist/esm/tokens/atlassian-dark/color/background.js +3 -3
  46. package/dist/esm/tokens/atlassian-dark/color/skeleton.js +13 -0
  47. package/dist/esm/tokens/atlassian-light/color/background.js +3 -3
  48. package/dist/esm/tokens/atlassian-light/color/skeleton.js +13 -0
  49. package/dist/esm/tokens/default/color/skeleton.js +21 -0
  50. package/dist/esm/tokens/default/deprecated/deprecated.js +89 -89
  51. package/dist/esm/version.json +4 -2
  52. package/dist/types/artifacts/token-default-values.d.ts +5 -3
  53. package/dist/types/artifacts/token-names.d.ts +4 -0
  54. package/dist/types/artifacts/types-internal.d.ts +1 -1
  55. package/dist/types/artifacts/types.d.ts +1 -1
  56. package/dist/types/constants.d.ts +4 -0
  57. package/dist/types/entry-points/token-ids.d.ts +1 -0
  58. package/dist/types/token-ids.d.ts +43 -0
  59. package/dist/types/tokens/atlassian-dark/color/skeleton.d.ts +3 -0
  60. package/dist/types/tokens/atlassian-light/color/skeleton.d.ts +3 -0
  61. package/dist/types/tokens/default/color/skeleton.d.ts +3 -0
  62. package/dist/types/tokens/default/utility/utility.d.ts +10 -10
  63. package/dist/types/types.d.ts +8 -0
  64. package/package.json +5 -2
  65. package/token-ids/package.json +7 -0
@@ -0,0 +1,8 @@
1
+ export const ALLOWED_THEMES = ['light', 'dark'];
2
+ export const DEFAULT_THEME = 'light';
3
+ export const CSS_PREFIX = 'ds'; // Maps the longer theme name to a shorthand used in css/code
4
+
5
+ export const LONG_SHORT_MAPPING = {
6
+ 'atlassian-light': 'light',
7
+ 'atlassian-dark': 'dark'
8
+ };
@@ -0,0 +1 @@
1
+ export { getCSSCustomProperty, getTokenId, getFullyQualifiedTokenId } from '../token-ids';
@@ -1,7 +1,7 @@
1
1
  import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  const name = "@atlaskit/tokens";
4
- const version = "0.7.3";
4
+ const version = "0.8.2";
5
5
 
6
6
  function token(path, fallback) {
7
7
  let token = tokens[path];
@@ -0,0 +1,51 @@
1
+ import { CSS_PREFIX } from './constants';
2
+ /**
3
+ * Transforms a style dictionary token path to a CSS custom property.
4
+ *
5
+ * A css prefix will be prepended and all [default] key words will be omitted
6
+ * from the path
7
+ *
8
+ * @example <caption>Passing a path as an array</caption>
9
+ * // Returns ds-background-bold
10
+ * getCSSCustomProperty(['color', 'background', 'bold', '[default]'])
11
+ *
12
+ * @example <caption>Passing a path as a string</caption>
13
+ * // Returns ds-background-bold
14
+ * getCSSCustomProperty('color.background.bold.[default]')
15
+ */
16
+
17
+ export const getCSSCustomProperty = path => {
18
+ const normalizedPath = typeof path === 'string' ? path.split('.') : path;
19
+ return `--${[CSS_PREFIX, ...normalizedPath.slice(1)].filter(el => el !== '[default]').join('-')}`;
20
+ };
21
+
22
+ /**
23
+ * Transforms a style dictionary token path to a shorthand token id
24
+ * These ids will be typically be how tokens are interacted with via typescript and css
25
+ *
26
+ * All [default] key words will be omitted from the path
27
+ *
28
+ * @example <caption>Passing a path as an array</caption>
29
+ * // Returns color.background.bold
30
+ * getTokenId(['color', 'background', 'bold', '[default]'])
31
+ *
32
+ * @example <caption>Passing a path as a string</caption>
33
+ * // Returns color.background.bold
34
+ * getTokenId('color.background.bold.[default]')
35
+ */
36
+ export const getTokenId = path => {
37
+ const normalizedPath = typeof path === 'string' ? path.split('.') : path;
38
+ return normalizedPath.filter(el => el !== '[default]').join('.');
39
+ };
40
+ /**
41
+ * Transforms a style dictionary token path to a fully qualified token id
42
+ * These Ids are intended to be used internal to this package by style-dictionary
43
+ *
44
+ * [default] key words will NOT be omitted from the path
45
+ *
46
+ * @example <caption>Passing a path as a string</caption>
47
+ * // Returns color.background.bold.[default]
48
+ * getFullyQualifiedTokenId(['color', 'background', 'bold', '[default]'])
49
+ */
50
+
51
+ export const getFullyQualifiedTokenId = path => path.join('.');
@@ -23,13 +23,13 @@ const color = {
23
23
  },
24
24
  input: {
25
25
  '[default]': {
26
- value: 'DN100A'
26
+ value: 'DN100'
27
27
  },
28
28
  hovered: {
29
- value: 'DN0'
29
+ value: 'DN200'
30
30
  },
31
31
  pressed: {
32
- value: 'DN200A'
32
+ value: 'DN100'
33
33
  }
34
34
  },
35
35
  neutral: {
@@ -0,0 +1,13 @@
1
+ const color = {
2
+ color: {
3
+ skeleton: {
4
+ '[default]': {
5
+ value: 'DN200A'
6
+ },
7
+ subtle: {
8
+ value: 'DN100A'
9
+ }
10
+ }
11
+ }
12
+ };
13
+ export default color;
@@ -23,13 +23,13 @@ const color = {
23
23
  },
24
24
  input: {
25
25
  '[default]': {
26
- value: 'N100A'
26
+ value: 'N0'
27
27
  },
28
28
  hovered: {
29
- value: 'N0'
29
+ value: 'N100'
30
30
  },
31
31
  pressed: {
32
- value: 'N200A'
32
+ value: 'N0'
33
33
  }
34
34
  },
35
35
  neutral: {
@@ -0,0 +1,13 @@
1
+ const color = {
2
+ color: {
3
+ skeleton: {
4
+ '[default]': {
5
+ value: 'N200A'
6
+ },
7
+ subtle: {
8
+ value: 'N100A'
9
+ }
10
+ }
11
+ }
12
+ };
13
+ export default color;
@@ -0,0 +1,21 @@
1
+ const color = {
2
+ color: {
3
+ skeleton: {
4
+ '[default]': {
5
+ attributes: {
6
+ group: 'paint',
7
+ state: 'active',
8
+ description: 'Use for skeleton loading states'
9
+ }
10
+ },
11
+ subtle: {
12
+ attributes: {
13
+ group: 'paint',
14
+ state: 'active',
15
+ description: 'Use for the pulse or shimmer effect in skeleton loading states'
16
+ }
17
+ }
18
+ }
19
+ }
20
+ };
21
+ export default color;