@atlaskit/tokens 0.13.5 → 1.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 (196) hide show
  1. package/CHANGELOG.md +305 -0
  2. package/README.md +7 -16
  3. package/dist/cjs/artifacts/palettes-raw/legacy-palette.js +0 -1
  4. package/dist/cjs/artifacts/palettes-raw/palette.js +0 -1
  5. package/dist/cjs/artifacts/palettes-raw/spacing-scale.js +0 -1
  6. package/dist/cjs/artifacts/palettes-raw/typography-palette.js +0 -1
  7. package/dist/cjs/artifacts/replacement-mapping.js +3 -611
  8. package/dist/cjs/artifacts/theme-import-map.js +56 -0
  9. package/dist/cjs/artifacts/themes/atlassian-dark.js +13 -0
  10. package/dist/cjs/artifacts/themes/atlassian-legacy-dark.js +13 -0
  11. package/dist/cjs/artifacts/themes/atlassian-legacy-light.js +13 -0
  12. package/dist/cjs/artifacts/themes/atlassian-light.js +13 -0
  13. package/dist/cjs/artifacts/themes/atlassian-spacing.js +13 -0
  14. package/dist/cjs/artifacts/themes/atlassian-typography.js +13 -0
  15. package/dist/cjs/artifacts/token-default-values.js +2 -170
  16. package/dist/cjs/artifacts/token-names.js +2 -170
  17. package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +1354 -4261
  18. package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-dark.js +1352 -4259
  19. package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-light.js +1396 -4283
  20. package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +1365 -4252
  21. package/dist/cjs/artifacts/tokens-raw/atlassian-spacing.js +1 -1582
  22. package/dist/cjs/artifacts/tokens-raw/atlassian-typography.js +0 -1
  23. package/dist/cjs/artifacts/typescript/atlassian-dark-token-names.js +0 -1
  24. package/dist/cjs/artifacts/typescript/atlassian-light-token-names.js +0 -1
  25. package/dist/cjs/babel-plugin/index.js +0 -2
  26. package/dist/cjs/babel-plugin/plugin.js +17 -43
  27. package/dist/cjs/entry-points/babel-plugin.js +0 -2
  28. package/dist/cjs/entry-points/palettes-raw.js +0 -2
  29. package/dist/cjs/entry-points/rename-mapping.js +0 -2
  30. package/dist/cjs/entry-points/token-ids.js +0 -1
  31. package/dist/cjs/entry-points/token-names.js +0 -2
  32. package/dist/cjs/entry-points/tokens-raw.js +0 -5
  33. package/dist/cjs/get-global-theme.js +30 -0
  34. package/dist/cjs/get-token-value.js +1 -10
  35. package/dist/cjs/get-token.js +3 -13
  36. package/dist/cjs/index.js +46 -10
  37. package/dist/cjs/palettes/legacy-palette.js +1 -1
  38. package/dist/cjs/palettes/spacing-scale.js +1 -1
  39. package/dist/cjs/palettes/typography-palette.js +0 -5
  40. package/dist/cjs/set-global-theme.js +265 -39
  41. package/dist/cjs/theme-config.js +8 -23
  42. package/dist/cjs/{theme-change-observer.js → theme-mutation-observer.js} +5 -57
  43. package/dist/cjs/tokens/atlassian-dark/utility/utility.js +1 -4
  44. package/dist/cjs/tokens/atlassian-legacy-dark/utility/utility.js +1 -4
  45. package/dist/cjs/tokens/atlassian-legacy-light/utility/utility.js +1 -4
  46. package/dist/cjs/tokens/atlassian-light/utility/utility.js +1 -4
  47. package/dist/cjs/tokens/atlassian-spacing/spacing.js +0 -228
  48. package/dist/cjs/tokens/default/spacing/spacing.js +0 -621
  49. package/dist/cjs/tokens/default/utility/utility.js +1 -9
  50. package/dist/cjs/use-theme-observer.js +41 -0
  51. package/dist/cjs/utils/color-detection.js +23 -43
  52. package/dist/cjs/utils/theme-loading.js +69 -0
  53. package/dist/cjs/utils/theme-state-transformer.js +73 -0
  54. package/dist/cjs/utils/token-ids.js +4 -12
  55. package/dist/cjs/version.json +1 -1
  56. package/dist/es2019/artifacts/replacement-mapping.js +3 -610
  57. package/dist/es2019/artifacts/theme-import-map.js +27 -0
  58. package/dist/es2019/artifacts/themes/atlassian-dark.js +296 -0
  59. package/dist/es2019/artifacts/themes/atlassian-legacy-dark.js +296 -0
  60. package/dist/es2019/artifacts/themes/atlassian-legacy-light.js +296 -0
  61. package/dist/es2019/artifacts/themes/atlassian-light.js +296 -0
  62. package/dist/es2019/artifacts/themes/atlassian-spacing.js +23 -0
  63. package/{css/atlassian-typography.css → dist/es2019/artifacts/themes/atlassian-typography.js} +4 -2
  64. package/dist/es2019/artifacts/token-default-values.js +2 -169
  65. package/dist/es2019/artifacts/token-names.js +2 -169
  66. package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +1354 -4260
  67. package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-dark.js +1349 -4255
  68. package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-light.js +1397 -4283
  69. package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +1360 -4246
  70. package/dist/es2019/artifacts/tokens-raw/atlassian-spacing.js +1 -1581
  71. package/dist/es2019/babel-plugin/plugin.js +17 -37
  72. package/dist/es2019/get-global-theme.js +20 -0
  73. package/dist/es2019/get-token-value.js +1 -6
  74. package/dist/es2019/get-token.js +3 -8
  75. package/dist/es2019/index.js +5 -2
  76. package/dist/es2019/palettes/legacy-palette.js +1 -0
  77. package/dist/es2019/palettes/spacing-scale.js +1 -0
  78. package/dist/es2019/palettes/typography-palette.js +2 -1
  79. package/dist/es2019/set-global-theme.js +162 -32
  80. package/dist/es2019/theme-config.js +5 -21
  81. package/dist/es2019/{theme-change-observer.js → theme-mutation-observer.js} +4 -37
  82. package/dist/es2019/tokens/atlassian-dark/utility/utility.js +1 -4
  83. package/dist/es2019/tokens/atlassian-legacy-dark/utility/utility.js +1 -4
  84. package/dist/es2019/tokens/atlassian-legacy-light/utility/utility.js +1 -4
  85. package/dist/es2019/tokens/atlassian-light/utility/utility.js +1 -4
  86. package/dist/es2019/tokens/atlassian-spacing/spacing.js +0 -227
  87. package/dist/es2019/tokens/default/spacing/spacing.js +0 -620
  88. package/dist/es2019/tokens/default/utility/utility.js +1 -9
  89. package/dist/es2019/use-theme-observer.js +26 -0
  90. package/dist/es2019/utils/color-detection.js +3 -5
  91. package/dist/es2019/utils/theme-loading.js +18 -0
  92. package/dist/es2019/utils/theme-state-transformer.js +47 -0
  93. package/dist/es2019/utils/token-ids.js +5 -4
  94. package/dist/es2019/version.json +1 -1
  95. package/dist/esm/artifacts/replacement-mapping.js +3 -610
  96. package/dist/esm/artifacts/theme-import-map.js +39 -0
  97. package/dist/esm/artifacts/themes/atlassian-dark.js +6 -0
  98. package/dist/esm/artifacts/themes/atlassian-legacy-dark.js +6 -0
  99. package/dist/esm/artifacts/themes/atlassian-legacy-light.js +6 -0
  100. package/dist/esm/artifacts/themes/atlassian-light.js +6 -0
  101. package/dist/esm/artifacts/themes/atlassian-spacing.js +6 -0
  102. package/dist/esm/artifacts/themes/atlassian-typography.js +6 -0
  103. package/dist/esm/artifacts/token-default-values.js +2 -169
  104. package/dist/esm/artifacts/token-names.js +2 -169
  105. package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +1354 -4260
  106. package/dist/esm/artifacts/tokens-raw/atlassian-legacy-dark.js +1349 -4255
  107. package/dist/esm/artifacts/tokens-raw/atlassian-legacy-light.js +1397 -4283
  108. package/dist/esm/artifacts/tokens-raw/atlassian-light.js +1360 -4246
  109. package/dist/esm/artifacts/tokens-raw/atlassian-spacing.js +1 -1581
  110. package/dist/esm/babel-plugin/plugin.js +17 -35
  111. package/dist/esm/get-global-theme.js +22 -0
  112. package/dist/esm/get-token-value.js +1 -6
  113. package/dist/esm/get-token.js +3 -8
  114. package/dist/esm/index.js +5 -2
  115. package/dist/esm/palettes/legacy-palette.js +1 -0
  116. package/dist/esm/palettes/spacing-scale.js +1 -0
  117. package/dist/esm/palettes/typography-palette.js +0 -3
  118. package/dist/esm/set-global-theme.js +263 -37
  119. package/dist/esm/theme-config.js +5 -21
  120. package/dist/esm/{theme-change-observer.js → theme-mutation-observer.js} +4 -49
  121. package/dist/esm/tokens/atlassian-dark/utility/utility.js +1 -4
  122. package/dist/esm/tokens/atlassian-legacy-dark/utility/utility.js +1 -4
  123. package/dist/esm/tokens/atlassian-legacy-light/utility/utility.js +1 -4
  124. package/dist/esm/tokens/atlassian-light/utility/utility.js +1 -4
  125. package/dist/esm/tokens/atlassian-spacing/spacing.js +0 -227
  126. package/dist/esm/tokens/default/spacing/spacing.js +0 -620
  127. package/dist/esm/tokens/default/utility/utility.js +1 -9
  128. package/dist/esm/use-theme-observer.js +34 -0
  129. package/dist/esm/utils/color-detection.js +23 -30
  130. package/dist/esm/utils/theme-loading.js +60 -0
  131. package/dist/esm/utils/theme-state-transformer.js +64 -0
  132. package/dist/esm/utils/token-ids.js +5 -4
  133. package/dist/esm/version.json +1 -1
  134. package/dist/types/artifacts/replacement-mapping.d.ts +1 -1
  135. package/dist/types/artifacts/theme-import-map.d.ts +16 -0
  136. package/dist/types/artifacts/themes/atlassian-dark.d.ts +7 -0
  137. package/dist/types/artifacts/themes/atlassian-legacy-dark.d.ts +7 -0
  138. package/dist/types/artifacts/themes/atlassian-legacy-light.d.ts +7 -0
  139. package/dist/types/artifacts/themes/atlassian-light.d.ts +7 -0
  140. package/dist/types/artifacts/themes/atlassian-spacing.d.ts +7 -0
  141. package/dist/types/artifacts/themes/atlassian-typography.d.ts +7 -0
  142. package/dist/types/artifacts/token-default-values.d.ts +2 -169
  143. package/dist/types/artifacts/token-names.d.ts +3 -337
  144. package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -115
  145. package/dist/types/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +1 -115
  146. package/dist/types/artifacts/tokens-raw/atlassian-legacy-light.d.ts +1 -91
  147. package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +1 -91
  148. package/dist/types/artifacts/tokens-raw/atlassian-spacing.d.ts +1 -89
  149. package/dist/types/artifacts/types-internal.d.ts +2 -2
  150. package/dist/types/artifacts/types.d.ts +2 -2
  151. package/dist/types/get-global-theme.d.ts +2 -0
  152. package/dist/types/index.d.ts +7 -3
  153. package/dist/types/set-global-theme.d.ts +63 -7
  154. package/dist/types/theme-config.d.ts +10 -7
  155. package/dist/types/{theme-change-observer.d.ts → theme-mutation-observer.d.ts} +2 -16
  156. package/dist/types/types.d.ts +1 -286
  157. package/dist/types/use-theme-observer.d.ts +15 -0
  158. package/dist/types/utils/theme-loading.d.ts +3 -0
  159. package/dist/types/utils/theme-state-transformer.d.ts +26 -0
  160. package/figma/atlassian-dark.json +1 -102
  161. package/figma/atlassian-legacy-dark.json +1 -102
  162. package/figma/atlassian-legacy-light.json +1 -102
  163. package/figma/atlassian-light.json +1 -102
  164. package/figma/atlassian-spacing.json +1 -761
  165. package/package.json +5 -8
  166. package/report.api.md +85 -351
  167. package/tmp/api-report-tmp.d.ts +58 -342
  168. package/css/atlassian-dark.css +0 -786
  169. package/css/atlassian-legacy-dark.css +0 -786
  170. package/css/atlassian-legacy-light.css +0 -786
  171. package/css/atlassian-light.css +0 -786
  172. package/css/atlassian-spacing.css +0 -87
  173. package/dist/cjs/artifacts/typescript/atlassian-light-token-default-values.js +0 -407
  174. package/dist/cjs/tokens/atlassian-dark/deprecated/deprecated.js +0 -435
  175. package/dist/cjs/tokens/atlassian-legacy-dark/deprecated/deprecated.js +0 -532
  176. package/dist/cjs/tokens/atlassian-legacy-light/deprecated/deprecated.js +0 -523
  177. package/dist/cjs/tokens/atlassian-light/deprecated/deprecated.js +0 -421
  178. package/dist/cjs/tokens/default/deprecated/deprecated.js +0 -1186
  179. package/dist/es2019/artifacts/typescript/atlassian-light-token-default-values.js +0 -399
  180. package/dist/es2019/tokens/atlassian-dark/deprecated/deprecated.js +0 -428
  181. package/dist/es2019/tokens/atlassian-legacy-dark/deprecated/deprecated.js +0 -525
  182. package/dist/es2019/tokens/atlassian-legacy-light/deprecated/deprecated.js +0 -516
  183. package/dist/es2019/tokens/atlassian-light/deprecated/deprecated.js +0 -414
  184. package/dist/es2019/tokens/default/deprecated/deprecated.js +0 -1217
  185. package/dist/esm/artifacts/typescript/atlassian-light-token-default-values.js +0 -399
  186. package/dist/esm/tokens/atlassian-dark/deprecated/deprecated.js +0 -428
  187. package/dist/esm/tokens/atlassian-legacy-dark/deprecated/deprecated.js +0 -525
  188. package/dist/esm/tokens/atlassian-legacy-light/deprecated/deprecated.js +0 -516
  189. package/dist/esm/tokens/atlassian-light/deprecated/deprecated.js +0 -414
  190. package/dist/esm/tokens/default/deprecated/deprecated.js +0 -1179
  191. package/dist/types/artifacts/typescript/atlassian-light-token-default-values.d.ts +0 -399
  192. package/dist/types/tokens/atlassian-dark/deprecated/deprecated.d.ts +0 -4
  193. package/dist/types/tokens/atlassian-legacy-dark/deprecated/deprecated.d.ts +0 -4
  194. package/dist/types/tokens/atlassian-legacy-light/deprecated/deprecated.d.ts +0 -4
  195. package/dist/types/tokens/atlassian-light/deprecated/deprecated.d.ts +0 -4
  196. package/dist/types/tokens/default/deprecated/deprecated.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,310 @@
1
1
  # @atlaskit/tokens
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`4b9aea55b97`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4b9aea55b97) - Removed various unused experimental spacing tokens in favor of the `space.X` token format.
8
+
9
+ Removed:
10
+
11
+ - `spacing.scale`
12
+ - `spacing.scaleLinear`
13
+ - `spacing.size`
14
+ - `spacing.gap`
15
+ - `spacing.inset`
16
+ - `spacing.ecl`
17
+ - `spacing.ccc`
18
+
19
+ ## 1.0.0
20
+
21
+ ### Major Changes
22
+
23
+ - [`512be9e1854`](https://bitbucket.org/atlassian/atlassian-frontend/commits/512be9e1854) - This PR introduces the 1.0 stable version of `@atlaskit/tokens`. With the changes introduced here, the tokens package _will be considered stable and feature-complete moving forward_.
24
+
25
+ #### 💥 Breaking change: Theme lazy-loading
26
+
27
+ Previously, themes were exposed as static CSS files via custom entry-points. This worked quite well but had a couple of obvious drawbacks.
28
+
29
+ 1. CSS files depend on webpack/css-loading mechanisms (`style-loader`/`css-loader`) which aren't available in all environments.
30
+
31
+ 2. Configuration and ordering of themes happened entirely in products, which becomes increasingly harder to maintain as new themes & functionality are introduced
32
+
33
+ We have moved this to a lazy-loaded JS solution. Themes are now codegen'd into Javascript modules, wrapped in a template literal string, then lazy-loaded and mounted to the head of the document when required at runtime.
34
+
35
+ **Benefits include:**
36
+
37
+ - More control over the ordering and composition of themes
38
+
39
+ - Automatic lazy-loading of new themes when `setGlobalTheme` is called by the client
40
+
41
+ - Simplified bundler configuration
42
+
43
+ - Improved portability
44
+
45
+ - Integrates with a new SSR solution for theme loading
46
+
47
+ **Changes:**
48
+
49
+ If you set themes using `setGlobalTheme` in your app, you can now remove manual imports of theme CSS files from your app. The themes will be automatically added when `setGlobalTheme` is called.
50
+
51
+ ```diff
52
+ -import("atlassian-light.css") from '@atlaskit/tokens/css'
53
+ -import("atlassian-legacy-dark.css") from '@atlaskit/tokens/css'
54
+ -setGlobalTheme("light", true)
55
+ +setGlobalTheme({light: "light", dark: "legacy-dark", colorMode: 'auto'})
56
+ ```
57
+
58
+ If your app supports server-side rendering, further work is required to ensure themes are loaded on the page before first paint. See below for details on the new SSR utilities.
59
+
60
+ #### 💥 Breaking change: Removal of deprecated & deleted tokens
61
+
62
+ [As per our versioning strategy](https://hello.atlassian.net/wiki/spaces/DST/pages/1818362892?search_id=660dc077-8ecb-4142-be48-1e610e372315), MAJOR versions is when we remove all deprecated and sunset tokens. This provides significant bundle size improvements to token CSS files.
63
+
64
+ If you have been using our lint rules `@atlaskit/design-system/no-unsafe-design-token-usage` and `@atlaskit/design-system/no-deprecated-design-token-usage`, these tokens should already be triggering eslint errors from the version they were deprecated.
65
+
66
+ Please run `yarn eslint --fix` or similar to automate your migration before upgrading to `1.0.0`.
67
+
68
+ _Please see below for a full list of removed tokens and their replacements._
69
+
70
+ Note: MISSING_TOKEN is also being removed. This was a utility token to support early migration efforts; as tokens are now visible to end-users, please ensure all usages are removed from your app.
71
+
72
+ #### 💥 Breaking change: `setGlobalTheme` & `ThemeObserver` & `useThemeObserver`
73
+
74
+ **ThemeState configuration object**
75
+
76
+ `setGlobalTheme`, `ThemeObserver` & `useThemeObserver` now input and output theme preferences as a `themeState` object rather than a space-separated string. This enables:
77
+
78
+ - Stronger type safety
79
+
80
+ - Explicit definition of themes to render in light and dark mode.
81
+
82
+ - Improved extensibility options for new types of themes, such as spacing and typography.
83
+
84
+ `themeState` has the following default values, which set the standard Atlassian color themes, and enables automatic color mode switching based on the user's system preference:
85
+
86
+ ```js
87
+ {
88
+ colorMode: 'auto',
89
+ dark: 'dark',
90
+ light: 'light',
91
+ spacing: undefined,
92
+ typography: undefined,
93
+ };
94
+ ```
95
+
96
+ Any usages of `setGlobalTheme` need` to be updated to the new object syntax:
97
+
98
+ ```diff
99
+ -setGlobalTheme('light');
100
+ +setGlobalTheme({ light: 'light', colorMode: 'light' ...});
101
+ ```
102
+
103
+ **Changes to colorMode**
104
+
105
+ Previously, the current color mode (i.e. "light" or "dark" mode) was inferred from the color theme passed into `setGlobalTheme`. A second parameter, `shouldMatchSystem`, set `data-color-mode` to `'auto'` and matched the current theme to operating system settings:
106
+
107
+ ```js
108
+ setGlobalTheme('legacy-dark'); // a "dark" theme, so color mode is set to 'dark'
109
+ setGlobalTheme('light', true); // color mode is 'light' or 'dark' depending on system theme
110
+ ```
111
+
112
+ Now, the current color mode, as well as which themes to render in each color mode, can be configured via the `themeState` object:
113
+
114
+ ```js
115
+ setGlobalTheme({
116
+ dark: 'dark' // in dark mode, use the 'dark' theme
117
+ light: 'light' // in light mode, use the 'light' theme
118
+ colorMode: 'auto', // Set the color mode automatically based on system preference
119
+ });
120
+ ```
121
+
122
+ If your app previously set the second parameter, `shouldMatchSystem`, this feature is now enabled by default.
123
+
124
+ ```diff
125
+ // Automatic theme switching
126
+ -setGlobalTheme('light', true)
127
+ +setGlobalTheme({light: 'light', dark: 'dark', 'auto'})
128
+ // OR, since setGlobalTheme has default values
129
+ +setGlobalTheme({})
130
+
131
+ // Light theme
132
+ -setGlobalTheme('light')
133
+ +setGlobalTheme({light: 'light', colorMode: 'light'})
134
+ // OR
135
+ +setGlobalTheme({colorMode: 'light'})
136
+
137
+ // Dark theme
138
+ -setGlobalTheme('dark')
139
+ +setGlobalTheme({dark: 'dark', colorMode: 'dark'})
140
+ // OR
141
+ +setGlobalTheme({colorMode: 'dark'})
142
+ ```
143
+
144
+ **Color mode switching is enabled by default**
145
+
146
+ As noted above, automatic theme switching is now enabled by default. To disable automatic theme switching, set `colorMode` to either `'light'` or `'dark'`.
147
+
148
+ #### 🔀 Breaking behavioural change: `data-theme` & `data-color-mode`
149
+
150
+ The way this state is reflected on the DOM has been updated to match the changes above:
151
+
152
+ ```diff
153
+ -<html data-theme="light" data-color-mode="light">
154
+ +<html data-theme="light:light dark:dark spacing:compact" data-color-mode="light">
155
+ ```
156
+
157
+ Theme state on the DOM is primarily to store data in a place that can be accessed from anywhere in the app, and secondly to activate CSS selectors.
158
+
159
+ Two new utilities, `themeStringToObject` and `themeObjectToString`, allow conversion from string to object syntax if necessary.
160
+
161
+ #### 🔀 Breaking change: System-level theme switching
162
+
163
+ Token auto theme switching now uses a Javascript-based solution, rather than embedding media queries in theme CSS files. If `colorMode` is set to `'auto'`, media query event listeners will trigger when the system theme changes, and update `data-color-mode` to `'light'` or `'dark'` automatically.
164
+
165
+ This provides several benefits:
166
+
167
+ - Significant (~50%) improvements to bundle size for token CSS files compared to the pre-release version of `@atlaskit/tokens`.
168
+
169
+ - Simpler logic for switching an experience based on the current theme:
170
+
171
+ - Previously, experiences using theme observers had to check a combination of the `data-color-mode` attribute use media queries to to correctly match the currently rendered color mode in light, dark and 'auto' color modes. Now, the `data-color-mode` attribute always matches the currently rendered color mode, and media queries are no longer required.
172
+
173
+ As a result of this change, the `data-color-mode` attribute no longer supports the value `'auto'`. If your experience checked for this value, this logic can now be removed, as `data-color-mode` will always reflect the currently rendered theme.
174
+
175
+ #### ✨ New: server-side rendering utility functions
176
+
177
+ Three new utility functions provide the logic required to load and display the correct themes in your server-rendered output, preventing a flash of incorrectly themed content on first paint. Each accepts the same themeState object representing the user's stored theme preference:
178
+
179
+ - `getThemeStyles` provides the contents of `<style>` tags to attach to the head of your server-side rendered document
180
+
181
+ - `getThemeHtmlAttributes` provides data-attributes to set on the root of your document.
182
+
183
+ - `getSSRAutoScript` provides a script to detect the system theme and configure the color mode before first paint.
184
+
185
+ For more information on these utilities, check the [@atlaskit/tokens API documentation](https://atlassian.design/components/tokens/code) on atlassian.design.
186
+
187
+ #### 🐞 Fixes
188
+
189
+ **Observer fixes:**
190
+
191
+ `useThemeObserver` & `ThemeObserver` now listen to changes on data-theme instead of data-color-mode.
192
+
193
+ Previously changes between two themes that both have a light color mode would not trigger an event since `data-color-mode` would not be updated. With this fix, the event fires on every call to `setGlobalTheme` regardless if there is a change to the theme or not.
194
+
195
+ **Automatic theme switching changes:**
196
+
197
+ Previously, the order of themes determined which one rendered. If you had multiple 'light' themes in your app, the order of the CSS files in the DOM determined which one rendered in "auto" mode.
198
+
199
+ Now, the theme that renders when the system is in 'light' and 'dark' mode is deterministic, and explicitly configured via the `themeState` object.
200
+
201
+ #### 🚮 Removed tokens
202
+
203
+ The following tokens have been moved from the `deprecated` & `deleted` to removed state in their lifecycles. These tokens will no longer exist and will not be functional moving forward, tooling will begin to error wherever they're used.
204
+
205
+ - `color.text.highEmphasis` => `color.text`
206
+ - `color.text.link.pressed` => `color.link.pressed`
207
+ - `color.text.link.resting` => `color.link`
208
+ - `color.text.lowEmphasis` => `color.text.subtlest`
209
+ - `color.text.mediumEmphasis` => `color.text.subtle`
210
+ - `color.text.onBold` => `color.text.inverse`
211
+ - `color.text.onBoldWarning` => `color.text.warning.inverse`
212
+ - `color.border.focus` => `color.border.focused`
213
+ - `color.border.neutral` => `color.border`
214
+ - `color.background.accent.blue` => `color.background.accent.blue.subtler`
215
+ - `color.background.accent.blue.bold` => `color.background.accent.blue.subtle`
216
+ - `color.background.accent.red` => `color.background.accent.red.subtler`
217
+ - `color.background.accent.red.bold` => `color.background.accent.red.subtle`
218
+ - `color.background.accent.orange` => `color.background.accent.orange.subtler`
219
+ - `color.background.accent.orange.bold` => `color.background.accent.orange.subtle`
220
+ - `color.background.accent.yellow` => `color.background.accent.yellow.subtler`
221
+ - `color.background.accent.yellow.bold` => `color.background.accent.yellow.subtle`
222
+ - `color.background.accent.green` => `color.background.accent.green.subtler`
223
+ - `color.background.accent.green.bold` => `color.background.accent.green.subtle`
224
+ - `color.background.accent.teal` => `color.background.accent.teal.subtler`
225
+ - `color.background.accent.teal.bold` => `color.background.accent.teal.subtle`
226
+ - `color.background.accent.purple` => `color.background.accent.purple.subtler`
227
+ - `color.background.accent.purple.bold` => `color.background.accent.purple.subtle`
228
+ - `color.background.accent.magenta` => `color.background.accent.magenta.subtler`
229
+ - `color.background.accent.magenta.bold` => `color.background.accent.magenta.subtle`
230
+ - `color.background.inverse` => `color.background.inverse.subtle`
231
+ - `color.background.brand` => `color.background.selected`
232
+ - `color.background.brand.hovered` => `color.background.selected.hovered`
233
+ - `color.background.brand.pressed` => `color.background.selected.pressed`
234
+ - `color.background.selected.resting` => `color.background.selected`
235
+ - `color.background.selected.hover` => `color.background.selected.hovered`
236
+ - `color.background.blanket` => `color.blanket`
237
+ - `color.background.boldBrand.hover` => `color.background.brand.bold.hovered`
238
+ - `color.background.boldBrand.pressed` => `color.background.brand.bold.pressed`
239
+ - `color.background.boldBrand.resting` => `color.background.brand.bold`
240
+ - `color.background.boldDanger.hover` => `color.background.danger.bold.hovered`
241
+ - `color.background.boldDanger.pressed` => `color.background.danger.bold.pressed`
242
+ - `color.background.boldDanger.resting` => `color.background.danger.bold`
243
+ - `color.background.boldDiscovery.hover` => `color.background.discovery.bold.hovered`
244
+ - `color.background.boldDiscovery.pressed` => `color.background.discovery.bold.pressed`
245
+ - `color.background.boldDiscovery.resting` => `color.background.discovery.bold`
246
+ - `color.background.boldNeutral.hover` => `color.background.neutral.bold.hovered`
247
+ - `color.background.boldNeutral.pressed` => `color.background.neutral.bold.pressed`
248
+ - `color.background.boldNeutral.resting` => `color.background.neutral.bold`
249
+ - `color.background.boldSuccess.hover` => `color.background.success.bold.hovered`
250
+ - `color.background.boldSuccess.pressed` => `color.background.success.bold.pressed`
251
+ - `color.background.boldSuccess.resting` => `color.background.success.bold`
252
+ - `color.background.boldWarning.hover` => `color.background.warning.bold.hovered`
253
+ - `color.background.boldWarning.pressed` => `color.background.warning.bold.pressed`
254
+ - `color.background.boldWarning.resting` => `color.background.warning.bold`
255
+ - `color.background.card` => `elevation.surface.raised`
256
+ - `color.background.default` => `elevation.surface`
257
+ - `color.background.overlay` => `elevation.surface.overlay`
258
+ - `color.background.subtleBorderedNeutral.pressed` => `color.background.input.pressed`
259
+ - `color.background.subtleBorderedNeutral.resting` => `color.background.input`
260
+ - `color.background.subtleBrand.hover` => `color.background.selected.hovered`
261
+ - `color.background.subtleBrand.pressed` => `color.background.selected.pressed`
262
+ - `color.background.subtleBrand.resting` => `color.background.selected`
263
+ - `color.background.subtleDanger.hover` => `color.background.danger.hovered`
264
+ - `color.background.subtleDanger.pressed` => `color.background.danger.pressed`
265
+ - `color.background.subtleDanger.resting` => `color.background.danger`
266
+ - `color.background.subtleDiscovery.hover` => `color.background.discovery.hovered`
267
+ - `color.background.subtleDiscovery.pressed` => `color.background.discovery.pressed`
268
+ - `color.background.subtleDiscovery.resting` => `color.background.discovery`
269
+ - `color.background.subtleNeutral.hover` => `color.background.neutral.hovered`
270
+ - `color.background.subtleNeutral.pressed` => `color.background.neutral.pressed`
271
+ - `color.background.subtleNeutral.resting` => `color.background.neutral`
272
+ - `color.background.subtleSuccess.hover` => `color.background.success.hovered`
273
+ - `color.background.subtleSuccess.pressed` => `color.background.success.pressed`
274
+ - `color.background.subtleSuccess.resting` => `color.background.success`
275
+ - `color.background.subtleWarning.hover` => `color.background.warning.hovered`
276
+ - `color.background.subtleWarning.pressed` => `color.background.warning.pressed`
277
+ - `color.background.subtleWarning.resting` => `color.background.warning`
278
+ - `color.background.sunken` => `elevation.surface.sunken`
279
+ - `color.background.transparentNeutral.hover` => `color.background.neutral.subtle.hovered`
280
+ - `color.background.transparentNeutral.pressed` => `color.background.neutral.subtle.pressed`
281
+ - `color.interaction.inverse.hovered` => `color.background.inverse.subtle.hovered`
282
+ - `color.interaction.inverse.pressed` => `color.background.inverse.subtle.pressed`
283
+ - `color.accent.boldBlue` => `color.background.accent.blue.bolder`
284
+ - `color.accent.boldGreen` => `color.background.accent.green.bolder`
285
+ - `color.accent.boldOrange` => `color.background.accent.orange.bolder`
286
+ - `color.accent.boldPurple` => `color.background.accent.purple.bolder`
287
+ - `color.accent.boldRed` => `color.background.accent.red.bolder`
288
+ - `color.accent.boldTeal` => `color.background.accent.teal.bolder`
289
+ - `color.accent.subtleBlue` => `color.background.accent.blue.subtler`
290
+ - `color.accent.subtleGreen` => `color.background.accent.green.subtler`
291
+ - `color.accent.subtleMagenta` => `color.background.accent.magenta.subtler`
292
+ - `color.accent.subtleOrange` => `color.background.accent.orange.subtler`
293
+ - `color.accent.subtlePurple` => `color.background.accent.purple.subtler`
294
+ - `color.accent.subtleRed` => `color.background.accent.red.subtler`
295
+ - `color.accent.subtleTeal` => `color.background.accent.teal.subtler`
296
+ - `color.iconBorder.brand` => `color.icon.brand`
297
+ - `color.iconBorder.danger` => `color.icon.danger`
298
+ - `color.iconBorder.discovery` => `color.icon.discovery`
299
+ - `color.iconBorder.success` => `color.icon.success`
300
+ - `color.iconBorder.warning` => `color.icon.warning`
301
+ - `color.overlay.hover` => `color.interaction.hovered`
302
+ - `color.overlay.pressed` => `color.interaction.pressed`
303
+ - `shadow.card` => `elevation.shadow.raised`
304
+ - `shadow.overlay` => `elevation.shadow.overlay`
305
+ - `utility.UNSAFE_util.transparent` => `utility.UNSAFE.transparent`
306
+ - `utility.UNSAFE_util.MISSING_TOKEN` => No replacement
307
+
3
308
  ## 0.13.5
4
309
 
5
310
  ### Patch Changes
package/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # Tokens
2
2
 
3
- > ⚠️ This package is under development and comes with no semver guarantees,
4
- > your app will break if you use this directly.
5
-
6
3
  Tokens are a single source of truth to name and store Atlassian design decisions.
7
4
 
8
5
  ## Installation
@@ -13,14 +10,14 @@ yarn add @atlaskit/tokens
13
10
 
14
11
  ## Usage
15
12
 
16
- ### Setup your environment
13
+ ### Set global theme
17
14
 
18
- Before continuing ensure the CSS themes are installed,
19
- depending on your bundler configuration may differ.
15
+ To load and set themes into your app, call setGlobalTheme during runtime.
20
16
 
21
17
  ```tsx
22
- import '@atlaskit/tokens/css/atlassian-light.css';
23
- import '@atlaskit/tokens/css/atlassian-dark.css';
18
+ import { setGlobalTheme } from '@atlaskit/tokens';
19
+
20
+ setGlobalTheme({ colorMode: 'light', light: 'light', dark: 'dark' });
24
21
  ```
25
22
 
26
23
  ### Token
@@ -33,15 +30,9 @@ import { token } from '@atlaskit/tokens';
33
30
  token('color.background.default');
34
31
  ```
35
32
 
36
- ### Set global theme
37
-
38
- Change the global theme during runtime.
33
+ ### Learn more
39
34
 
40
- ```tsx
41
- import { setGlobalTheme } from '@atlaskit/tokens';
42
-
43
- setGlobalTheme('light');
44
- ```
35
+ To learn more about the tokens package API, view the [token package docs on atlassian.design](https://atlassian.design/components/tokens/code)
45
36
 
46
37
  # BabelPlugin
47
38
 
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
10
9
  * @codegen <<SignedSource::dedf6c0d26805cf0e48a136204fac4d2>>
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
10
9
  * @codegen <<SignedSource::c144bfcbb2df5e70994524a9f6da2dfa>>
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
10
9
  * @codegen <<SignedSource::496467b0392d344d04df137d9d8edf4c>>
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
10
9
  * @codegen <<SignedSource::04c90c279da3841c8c8952b13bddb31b>>