@atlaskit/tokens 0.13.5 → 1.0.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.
- package/CHANGELOG.md +289 -0
- package/README.md +7 -16
- package/dist/cjs/artifacts/palettes-raw/legacy-palette.js +0 -1
- package/dist/cjs/artifacts/palettes-raw/palette.js +0 -1
- package/dist/cjs/artifacts/palettes-raw/spacing-scale.js +0 -1
- package/dist/cjs/artifacts/palettes-raw/typography-palette.js +0 -1
- package/dist/cjs/artifacts/replacement-mapping.js +2 -402
- package/dist/cjs/artifacts/theme-import-map.js +56 -0
- package/dist/cjs/artifacts/themes/atlassian-dark.js +13 -0
- package/dist/cjs/artifacts/themes/atlassian-legacy-dark.js +13 -0
- package/dist/cjs/artifacts/themes/atlassian-legacy-light.js +13 -0
- package/dist/cjs/artifacts/themes/atlassian-light.js +13 -0
- package/dist/cjs/artifacts/themes/atlassian-spacing.js +13 -0
- package/dist/cjs/artifacts/themes/atlassian-typography.js +13 -0
- package/dist/cjs/artifacts/token-default-values.js +2 -104
- package/dist/cjs/artifacts/token-names.js +2 -104
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +1354 -4261
- package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-dark.js +1352 -4259
- package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-light.js +1396 -4283
- package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +1365 -4252
- package/dist/cjs/artifacts/tokens-raw/atlassian-spacing.js +0 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-typography.js +0 -1
- package/dist/cjs/artifacts/typescript/atlassian-dark-token-names.js +0 -1
- package/dist/cjs/artifacts/typescript/atlassian-light-token-names.js +0 -1
- package/dist/cjs/babel-plugin/index.js +0 -2
- package/dist/cjs/babel-plugin/plugin.js +17 -43
- package/dist/cjs/entry-points/babel-plugin.js +0 -2
- package/dist/cjs/entry-points/palettes-raw.js +0 -2
- package/dist/cjs/entry-points/rename-mapping.js +0 -2
- package/dist/cjs/entry-points/token-ids.js +0 -1
- package/dist/cjs/entry-points/token-names.js +0 -2
- package/dist/cjs/entry-points/tokens-raw.js +0 -5
- package/dist/cjs/get-global-theme.js +30 -0
- package/dist/cjs/get-token-value.js +1 -10
- package/dist/cjs/get-token.js +3 -13
- package/dist/cjs/index.js +46 -10
- package/dist/cjs/palettes/legacy-palette.js +1 -1
- package/dist/cjs/palettes/spacing-scale.js +1 -1
- package/dist/cjs/palettes/typography-palette.js +0 -5
- package/dist/cjs/set-global-theme.js +265 -39
- package/dist/cjs/theme-config.js +8 -23
- package/dist/cjs/{theme-change-observer.js → theme-mutation-observer.js} +5 -57
- package/dist/cjs/tokens/atlassian-dark/utility/utility.js +1 -4
- package/dist/cjs/tokens/atlassian-legacy-dark/utility/utility.js +1 -4
- package/dist/cjs/tokens/atlassian-legacy-light/utility/utility.js +1 -4
- package/dist/cjs/tokens/atlassian-light/utility/utility.js +1 -4
- package/dist/cjs/tokens/atlassian-spacing/spacing.js +0 -1
- package/dist/cjs/tokens/default/spacing/spacing.js +0 -1
- package/dist/cjs/tokens/default/utility/utility.js +1 -9
- package/dist/cjs/use-theme-observer.js +41 -0
- package/dist/cjs/utils/color-detection.js +23 -43
- package/dist/cjs/utils/theme-loading.js +69 -0
- package/dist/cjs/utils/theme-state-transformer.js +73 -0
- package/dist/cjs/utils/token-ids.js +4 -12
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/artifacts/replacement-mapping.js +2 -401
- package/dist/es2019/artifacts/theme-import-map.js +27 -0
- package/dist/es2019/artifacts/themes/atlassian-dark.js +296 -0
- package/dist/es2019/artifacts/themes/atlassian-legacy-dark.js +296 -0
- package/dist/es2019/artifacts/themes/atlassian-legacy-light.js +296 -0
- package/dist/es2019/artifacts/themes/atlassian-light.js +296 -0
- package/{css/atlassian-spacing.css → dist/es2019/artifacts/themes/atlassian-spacing.js} +4 -2
- package/{css/atlassian-typography.css → dist/es2019/artifacts/themes/atlassian-typography.js} +4 -2
- package/dist/es2019/artifacts/token-default-values.js +2 -103
- package/dist/es2019/artifacts/token-names.js +2 -103
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +1354 -4260
- package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-dark.js +1349 -4255
- package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-light.js +1397 -4283
- package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +1360 -4246
- package/dist/es2019/babel-plugin/plugin.js +17 -37
- package/dist/es2019/get-global-theme.js +20 -0
- package/dist/es2019/get-token-value.js +1 -6
- package/dist/es2019/get-token.js +3 -8
- package/dist/es2019/index.js +5 -2
- package/dist/es2019/palettes/legacy-palette.js +1 -0
- package/dist/es2019/palettes/spacing-scale.js +1 -0
- package/dist/es2019/palettes/typography-palette.js +2 -1
- package/dist/es2019/set-global-theme.js +162 -32
- package/dist/es2019/theme-config.js +5 -21
- package/dist/es2019/{theme-change-observer.js → theme-mutation-observer.js} +4 -37
- package/dist/es2019/tokens/atlassian-dark/utility/utility.js +1 -4
- package/dist/es2019/tokens/atlassian-legacy-dark/utility/utility.js +1 -4
- package/dist/es2019/tokens/atlassian-legacy-light/utility/utility.js +1 -4
- package/dist/es2019/tokens/atlassian-light/utility/utility.js +1 -4
- package/dist/es2019/tokens/default/utility/utility.js +1 -9
- package/dist/es2019/use-theme-observer.js +26 -0
- package/dist/es2019/utils/color-detection.js +3 -5
- package/dist/es2019/utils/theme-loading.js +18 -0
- package/dist/es2019/utils/theme-state-transformer.js +47 -0
- package/dist/es2019/utils/token-ids.js +5 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/artifacts/replacement-mapping.js +2 -401
- package/dist/esm/artifacts/theme-import-map.js +39 -0
- package/dist/esm/artifacts/themes/atlassian-dark.js +6 -0
- package/dist/esm/artifacts/themes/atlassian-legacy-dark.js +6 -0
- package/dist/esm/artifacts/themes/atlassian-legacy-light.js +6 -0
- package/dist/esm/artifacts/themes/atlassian-light.js +6 -0
- package/dist/esm/artifacts/themes/atlassian-spacing.js +6 -0
- package/dist/esm/artifacts/themes/atlassian-typography.js +6 -0
- package/dist/esm/artifacts/token-default-values.js +2 -103
- package/dist/esm/artifacts/token-names.js +2 -103
- package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +1354 -4260
- package/dist/esm/artifacts/tokens-raw/atlassian-legacy-dark.js +1349 -4255
- package/dist/esm/artifacts/tokens-raw/atlassian-legacy-light.js +1397 -4283
- package/dist/esm/artifacts/tokens-raw/atlassian-light.js +1360 -4246
- package/dist/esm/babel-plugin/plugin.js +17 -35
- package/dist/esm/get-global-theme.js +22 -0
- package/dist/esm/get-token-value.js +1 -6
- package/dist/esm/get-token.js +3 -8
- package/dist/esm/index.js +5 -2
- package/dist/esm/palettes/legacy-palette.js +1 -0
- package/dist/esm/palettes/spacing-scale.js +1 -0
- package/dist/esm/palettes/typography-palette.js +0 -3
- package/dist/esm/set-global-theme.js +263 -37
- package/dist/esm/theme-config.js +5 -21
- package/dist/esm/{theme-change-observer.js → theme-mutation-observer.js} +4 -49
- package/dist/esm/tokens/atlassian-dark/utility/utility.js +1 -4
- package/dist/esm/tokens/atlassian-legacy-dark/utility/utility.js +1 -4
- package/dist/esm/tokens/atlassian-legacy-light/utility/utility.js +1 -4
- package/dist/esm/tokens/atlassian-light/utility/utility.js +1 -4
- package/dist/esm/tokens/default/utility/utility.js +1 -9
- package/dist/esm/use-theme-observer.js +34 -0
- package/dist/esm/utils/color-detection.js +23 -30
- package/dist/esm/utils/theme-loading.js +60 -0
- package/dist/esm/utils/theme-state-transformer.js +64 -0
- package/dist/esm/utils/token-ids.js +5 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/artifacts/replacement-mapping.d.ts +1 -1
- package/dist/types/artifacts/theme-import-map.d.ts +16 -0
- package/dist/types/artifacts/themes/atlassian-dark.d.ts +7 -0
- package/dist/types/artifacts/themes/atlassian-legacy-dark.d.ts +7 -0
- package/dist/types/artifacts/themes/atlassian-legacy-light.d.ts +7 -0
- package/dist/types/artifacts/themes/atlassian-light.d.ts +7 -0
- package/dist/types/artifacts/themes/atlassian-spacing.d.ts +7 -0
- package/dist/types/artifacts/themes/atlassian-typography.d.ts +7 -0
- package/dist/types/artifacts/token-default-values.d.ts +2 -103
- package/dist/types/artifacts/token-names.d.ts +3 -205
- package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -115
- package/dist/types/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +1 -115
- package/dist/types/artifacts/tokens-raw/atlassian-legacy-light.d.ts +1 -91
- package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +1 -91
- package/dist/types/artifacts/types-internal.d.ts +2 -2
- package/dist/types/artifacts/types.d.ts +2 -2
- package/dist/types/get-global-theme.d.ts +2 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/set-global-theme.d.ts +63 -7
- package/dist/types/theme-config.d.ts +10 -7
- package/dist/types/{theme-change-observer.d.ts → theme-mutation-observer.d.ts} +2 -16
- package/dist/types/types.d.ts +1 -180
- package/dist/types/use-theme-observer.d.ts +15 -0
- package/dist/types/utils/theme-loading.d.ts +3 -0
- package/dist/types/utils/theme-state-transformer.d.ts +26 -0
- package/figma/atlassian-dark.json +1 -102
- package/figma/atlassian-legacy-dark.json +1 -102
- package/figma/atlassian-legacy-light.json +1 -102
- package/figma/atlassian-light.json +1 -102
- package/package.json +5 -8
- package/report.api.md +85 -219
- package/tmp/api-report-tmp.d.ts +58 -210
- package/css/atlassian-dark.css +0 -786
- package/css/atlassian-legacy-dark.css +0 -786
- package/css/atlassian-legacy-light.css +0 -786
- package/css/atlassian-light.css +0 -786
- package/dist/cjs/artifacts/typescript/atlassian-light-token-default-values.js +0 -407
- package/dist/cjs/tokens/atlassian-dark/deprecated/deprecated.js +0 -435
- package/dist/cjs/tokens/atlassian-legacy-dark/deprecated/deprecated.js +0 -532
- package/dist/cjs/tokens/atlassian-legacy-light/deprecated/deprecated.js +0 -523
- package/dist/cjs/tokens/atlassian-light/deprecated/deprecated.js +0 -421
- package/dist/cjs/tokens/default/deprecated/deprecated.js +0 -1186
- package/dist/es2019/artifacts/typescript/atlassian-light-token-default-values.js +0 -399
- package/dist/es2019/tokens/atlassian-dark/deprecated/deprecated.js +0 -428
- package/dist/es2019/tokens/atlassian-legacy-dark/deprecated/deprecated.js +0 -525
- package/dist/es2019/tokens/atlassian-legacy-light/deprecated/deprecated.js +0 -516
- package/dist/es2019/tokens/atlassian-light/deprecated/deprecated.js +0 -414
- package/dist/es2019/tokens/default/deprecated/deprecated.js +0 -1217
- package/dist/esm/artifacts/typescript/atlassian-light-token-default-values.js +0 -399
- package/dist/esm/tokens/atlassian-dark/deprecated/deprecated.js +0 -428
- package/dist/esm/tokens/atlassian-legacy-dark/deprecated/deprecated.js +0 -525
- package/dist/esm/tokens/atlassian-legacy-light/deprecated/deprecated.js +0 -516
- package/dist/esm/tokens/atlassian-light/deprecated/deprecated.js +0 -414
- package/dist/esm/tokens/default/deprecated/deprecated.js +0 -1179
- package/dist/types/artifacts/typescript/atlassian-light-token-default-values.d.ts +0 -399
- package/dist/types/tokens/atlassian-dark/deprecated/deprecated.d.ts +0 -4
- package/dist/types/tokens/atlassian-legacy-dark/deprecated/deprecated.d.ts +0 -4
- package/dist/types/tokens/atlassian-legacy-light/deprecated/deprecated.d.ts +0 -4
- package/dist/types/tokens/atlassian-light/deprecated/deprecated.d.ts +0 -4
- package/dist/types/tokens/default/deprecated/deprecated.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,294 @@
|
|
|
1
1
|
# @atlaskit/tokens
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`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_.
|
|
8
|
+
|
|
9
|
+
#### 💥 Breaking change: Theme lazy-loading
|
|
10
|
+
|
|
11
|
+
Previously, themes were exposed as static CSS files via custom entry-points. This worked quite well but had a couple of obvious drawbacks.
|
|
12
|
+
|
|
13
|
+
1. CSS files depend on webpack/css-loading mechanisms (`style-loader`/`css-loader`) which aren't available in all environments.
|
|
14
|
+
|
|
15
|
+
2. Configuration and ordering of themes happened entirely in products, which becomes increasingly harder to maintain as new themes & functionality are introduced
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
**Benefits include:**
|
|
20
|
+
|
|
21
|
+
- More control over the ordering and composition of themes
|
|
22
|
+
|
|
23
|
+
- Automatic lazy-loading of new themes when `setGlobalTheme` is called by the client
|
|
24
|
+
|
|
25
|
+
- Simplified bundler configuration
|
|
26
|
+
|
|
27
|
+
- Improved portability
|
|
28
|
+
|
|
29
|
+
- Integrates with a new SSR solution for theme loading
|
|
30
|
+
|
|
31
|
+
**Changes:**
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
```diff
|
|
36
|
+
-import("atlassian-light.css") from '@atlaskit/tokens/css'
|
|
37
|
+
-import("atlassian-legacy-dark.css") from '@atlaskit/tokens/css'
|
|
38
|
+
-setGlobalTheme("light", true)
|
|
39
|
+
+setGlobalTheme({light: "light", dark: "legacy-dark", colorMode: 'auto'})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
#### 💥 Breaking change: Removal of deprecated & deleted tokens
|
|
45
|
+
|
|
46
|
+
[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.
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
Please run `yarn eslint --fix` or similar to automate your migration before upgrading to `1.0.0`.
|
|
51
|
+
|
|
52
|
+
_Please see below for a full list of removed tokens and their replacements._
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
#### 💥 Breaking change: `setGlobalTheme` & `ThemeObserver` & `useThemeObserver`
|
|
57
|
+
|
|
58
|
+
**ThemeState configuration object**
|
|
59
|
+
|
|
60
|
+
`setGlobalTheme`, `ThemeObserver` & `useThemeObserver` now input and output theme preferences as a `themeState` object rather than a space-separated string. This enables:
|
|
61
|
+
|
|
62
|
+
- Stronger type safety
|
|
63
|
+
|
|
64
|
+
- Explicit definition of themes to render in light and dark mode.
|
|
65
|
+
|
|
66
|
+
- Improved extensibility options for new types of themes, such as spacing and typography.
|
|
67
|
+
|
|
68
|
+
`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:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
{
|
|
72
|
+
colorMode: 'auto',
|
|
73
|
+
dark: 'dark',
|
|
74
|
+
light: 'light',
|
|
75
|
+
spacing: undefined,
|
|
76
|
+
typography: undefined,
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Any usages of `setGlobalTheme` need` to be updated to the new object syntax:
|
|
81
|
+
|
|
82
|
+
```diff
|
|
83
|
+
-setGlobalTheme('light');
|
|
84
|
+
+setGlobalTheme({ light: 'light', colorMode: 'light' ...});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Changes to colorMode**
|
|
88
|
+
|
|
89
|
+
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:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
setGlobalTheme('legacy-dark'); // a "dark" theme, so color mode is set to 'dark'
|
|
93
|
+
setGlobalTheme('light', true); // color mode is 'light' or 'dark' depending on system theme
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Now, the current color mode, as well as which themes to render in each color mode, can be configured via the `themeState` object:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
setGlobalTheme({
|
|
100
|
+
dark: 'dark' // in dark mode, use the 'dark' theme
|
|
101
|
+
light: 'light' // in light mode, use the 'light' theme
|
|
102
|
+
colorMode: 'auto', // Set the color mode automatically based on system preference
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If your app previously set the second parameter, `shouldMatchSystem`, this feature is now enabled by default.
|
|
107
|
+
|
|
108
|
+
```diff
|
|
109
|
+
// Automatic theme switching
|
|
110
|
+
-setGlobalTheme('light', true)
|
|
111
|
+
+setGlobalTheme({light: 'light', dark: 'dark', 'auto'})
|
|
112
|
+
// OR, since setGlobalTheme has default values
|
|
113
|
+
+setGlobalTheme({})
|
|
114
|
+
|
|
115
|
+
// Light theme
|
|
116
|
+
-setGlobalTheme('light')
|
|
117
|
+
+setGlobalTheme({light: 'light', colorMode: 'light'})
|
|
118
|
+
// OR
|
|
119
|
+
+setGlobalTheme({colorMode: 'light'})
|
|
120
|
+
|
|
121
|
+
// Dark theme
|
|
122
|
+
-setGlobalTheme('dark')
|
|
123
|
+
+setGlobalTheme({dark: 'dark', colorMode: 'dark'})
|
|
124
|
+
// OR
|
|
125
|
+
+setGlobalTheme({colorMode: 'dark'})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Color mode switching is enabled by default**
|
|
129
|
+
|
|
130
|
+
As noted above, automatic theme switching is now enabled by default. To disable automatic theme switching, set `colorMode` to either `'light'` or `'dark'`.
|
|
131
|
+
|
|
132
|
+
#### 🔀 Breaking behavioural change: `data-theme` & `data-color-mode`
|
|
133
|
+
|
|
134
|
+
The way this state is reflected on the DOM has been updated to match the changes above:
|
|
135
|
+
|
|
136
|
+
```diff
|
|
137
|
+
-<html data-theme="light" data-color-mode="light">
|
|
138
|
+
+<html data-theme="light:light dark:dark spacing:compact" data-color-mode="light">
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
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.
|
|
142
|
+
|
|
143
|
+
Two new utilities, `themeStringToObject` and `themeObjectToString`, allow conversion from string to object syntax if necessary.
|
|
144
|
+
|
|
145
|
+
#### 🔀 Breaking change: System-level theme switching
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
149
|
+
This provides several benefits:
|
|
150
|
+
|
|
151
|
+
- Significant (~50%) improvements to bundle size for token CSS files compared to the pre-release version of `@atlaskit/tokens`.
|
|
152
|
+
|
|
153
|
+
- Simpler logic for switching an experience based on the current theme:
|
|
154
|
+
|
|
155
|
+
- 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.
|
|
156
|
+
|
|
157
|
+
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.
|
|
158
|
+
|
|
159
|
+
#### ✨ New: server-side rendering utility functions
|
|
160
|
+
|
|
161
|
+
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:
|
|
162
|
+
|
|
163
|
+
- `getThemeStyles` provides the contents of `<style>` tags to attach to the head of your server-side rendered document
|
|
164
|
+
|
|
165
|
+
- `getThemeHtmlAttributes` provides data-attributes to set on the root of your document.
|
|
166
|
+
|
|
167
|
+
- `getSSRAutoScript` provides a script to detect the system theme and configure the color mode before first paint.
|
|
168
|
+
|
|
169
|
+
For more information on these utilities, check the [@atlaskit/tokens API documentation](https://atlassian.design/components/tokens/code) on atlassian.design.
|
|
170
|
+
|
|
171
|
+
#### 🐞 Fixes
|
|
172
|
+
|
|
173
|
+
**Observer fixes:**
|
|
174
|
+
|
|
175
|
+
`useThemeObserver` & `ThemeObserver` now listen to changes on data-theme instead of data-color-mode.
|
|
176
|
+
|
|
177
|
+
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.
|
|
178
|
+
|
|
179
|
+
**Automatic theme switching changes:**
|
|
180
|
+
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
Now, the theme that renders when the system is in 'light' and 'dark' mode is deterministic, and explicitly configured via the `themeState` object.
|
|
184
|
+
|
|
185
|
+
#### 🚮 Removed tokens
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
- `color.text.highEmphasis` => `color.text`
|
|
190
|
+
- `color.text.link.pressed` => `color.link.pressed`
|
|
191
|
+
- `color.text.link.resting` => `color.link`
|
|
192
|
+
- `color.text.lowEmphasis` => `color.text.subtlest`
|
|
193
|
+
- `color.text.mediumEmphasis` => `color.text.subtle`
|
|
194
|
+
- `color.text.onBold` => `color.text.inverse`
|
|
195
|
+
- `color.text.onBoldWarning` => `color.text.warning.inverse`
|
|
196
|
+
- `color.border.focus` => `color.border.focused`
|
|
197
|
+
- `color.border.neutral` => `color.border`
|
|
198
|
+
- `color.background.accent.blue` => `color.background.accent.blue.subtler`
|
|
199
|
+
- `color.background.accent.blue.bold` => `color.background.accent.blue.subtle`
|
|
200
|
+
- `color.background.accent.red` => `color.background.accent.red.subtler`
|
|
201
|
+
- `color.background.accent.red.bold` => `color.background.accent.red.subtle`
|
|
202
|
+
- `color.background.accent.orange` => `color.background.accent.orange.subtler`
|
|
203
|
+
- `color.background.accent.orange.bold` => `color.background.accent.orange.subtle`
|
|
204
|
+
- `color.background.accent.yellow` => `color.background.accent.yellow.subtler`
|
|
205
|
+
- `color.background.accent.yellow.bold` => `color.background.accent.yellow.subtle`
|
|
206
|
+
- `color.background.accent.green` => `color.background.accent.green.subtler`
|
|
207
|
+
- `color.background.accent.green.bold` => `color.background.accent.green.subtle`
|
|
208
|
+
- `color.background.accent.teal` => `color.background.accent.teal.subtler`
|
|
209
|
+
- `color.background.accent.teal.bold` => `color.background.accent.teal.subtle`
|
|
210
|
+
- `color.background.accent.purple` => `color.background.accent.purple.subtler`
|
|
211
|
+
- `color.background.accent.purple.bold` => `color.background.accent.purple.subtle`
|
|
212
|
+
- `color.background.accent.magenta` => `color.background.accent.magenta.subtler`
|
|
213
|
+
- `color.background.accent.magenta.bold` => `color.background.accent.magenta.subtle`
|
|
214
|
+
- `color.background.inverse` => `color.background.inverse.subtle`
|
|
215
|
+
- `color.background.brand` => `color.background.selected`
|
|
216
|
+
- `color.background.brand.hovered` => `color.background.selected.hovered`
|
|
217
|
+
- `color.background.brand.pressed` => `color.background.selected.pressed`
|
|
218
|
+
- `color.background.selected.resting` => `color.background.selected`
|
|
219
|
+
- `color.background.selected.hover` => `color.background.selected.hovered`
|
|
220
|
+
- `color.background.blanket` => `color.blanket`
|
|
221
|
+
- `color.background.boldBrand.hover` => `color.background.brand.bold.hovered`
|
|
222
|
+
- `color.background.boldBrand.pressed` => `color.background.brand.bold.pressed`
|
|
223
|
+
- `color.background.boldBrand.resting` => `color.background.brand.bold`
|
|
224
|
+
- `color.background.boldDanger.hover` => `color.background.danger.bold.hovered`
|
|
225
|
+
- `color.background.boldDanger.pressed` => `color.background.danger.bold.pressed`
|
|
226
|
+
- `color.background.boldDanger.resting` => `color.background.danger.bold`
|
|
227
|
+
- `color.background.boldDiscovery.hover` => `color.background.discovery.bold.hovered`
|
|
228
|
+
- `color.background.boldDiscovery.pressed` => `color.background.discovery.bold.pressed`
|
|
229
|
+
- `color.background.boldDiscovery.resting` => `color.background.discovery.bold`
|
|
230
|
+
- `color.background.boldNeutral.hover` => `color.background.neutral.bold.hovered`
|
|
231
|
+
- `color.background.boldNeutral.pressed` => `color.background.neutral.bold.pressed`
|
|
232
|
+
- `color.background.boldNeutral.resting` => `color.background.neutral.bold`
|
|
233
|
+
- `color.background.boldSuccess.hover` => `color.background.success.bold.hovered`
|
|
234
|
+
- `color.background.boldSuccess.pressed` => `color.background.success.bold.pressed`
|
|
235
|
+
- `color.background.boldSuccess.resting` => `color.background.success.bold`
|
|
236
|
+
- `color.background.boldWarning.hover` => `color.background.warning.bold.hovered`
|
|
237
|
+
- `color.background.boldWarning.pressed` => `color.background.warning.bold.pressed`
|
|
238
|
+
- `color.background.boldWarning.resting` => `color.background.warning.bold`
|
|
239
|
+
- `color.background.card` => `elevation.surface.raised`
|
|
240
|
+
- `color.background.default` => `elevation.surface`
|
|
241
|
+
- `color.background.overlay` => `elevation.surface.overlay`
|
|
242
|
+
- `color.background.subtleBorderedNeutral.pressed` => `color.background.input.pressed`
|
|
243
|
+
- `color.background.subtleBorderedNeutral.resting` => `color.background.input`
|
|
244
|
+
- `color.background.subtleBrand.hover` => `color.background.selected.hovered`
|
|
245
|
+
- `color.background.subtleBrand.pressed` => `color.background.selected.pressed`
|
|
246
|
+
- `color.background.subtleBrand.resting` => `color.background.selected`
|
|
247
|
+
- `color.background.subtleDanger.hover` => `color.background.danger.hovered`
|
|
248
|
+
- `color.background.subtleDanger.pressed` => `color.background.danger.pressed`
|
|
249
|
+
- `color.background.subtleDanger.resting` => `color.background.danger`
|
|
250
|
+
- `color.background.subtleDiscovery.hover` => `color.background.discovery.hovered`
|
|
251
|
+
- `color.background.subtleDiscovery.pressed` => `color.background.discovery.pressed`
|
|
252
|
+
- `color.background.subtleDiscovery.resting` => `color.background.discovery`
|
|
253
|
+
- `color.background.subtleNeutral.hover` => `color.background.neutral.hovered`
|
|
254
|
+
- `color.background.subtleNeutral.pressed` => `color.background.neutral.pressed`
|
|
255
|
+
- `color.background.subtleNeutral.resting` => `color.background.neutral`
|
|
256
|
+
- `color.background.subtleSuccess.hover` => `color.background.success.hovered`
|
|
257
|
+
- `color.background.subtleSuccess.pressed` => `color.background.success.pressed`
|
|
258
|
+
- `color.background.subtleSuccess.resting` => `color.background.success`
|
|
259
|
+
- `color.background.subtleWarning.hover` => `color.background.warning.hovered`
|
|
260
|
+
- `color.background.subtleWarning.pressed` => `color.background.warning.pressed`
|
|
261
|
+
- `color.background.subtleWarning.resting` => `color.background.warning`
|
|
262
|
+
- `color.background.sunken` => `elevation.surface.sunken`
|
|
263
|
+
- `color.background.transparentNeutral.hover` => `color.background.neutral.subtle.hovered`
|
|
264
|
+
- `color.background.transparentNeutral.pressed` => `color.background.neutral.subtle.pressed`
|
|
265
|
+
- `color.interaction.inverse.hovered` => `color.background.inverse.subtle.hovered`
|
|
266
|
+
- `color.interaction.inverse.pressed` => `color.background.inverse.subtle.pressed`
|
|
267
|
+
- `color.accent.boldBlue` => `color.background.accent.blue.bolder`
|
|
268
|
+
- `color.accent.boldGreen` => `color.background.accent.green.bolder`
|
|
269
|
+
- `color.accent.boldOrange` => `color.background.accent.orange.bolder`
|
|
270
|
+
- `color.accent.boldPurple` => `color.background.accent.purple.bolder`
|
|
271
|
+
- `color.accent.boldRed` => `color.background.accent.red.bolder`
|
|
272
|
+
- `color.accent.boldTeal` => `color.background.accent.teal.bolder`
|
|
273
|
+
- `color.accent.subtleBlue` => `color.background.accent.blue.subtler`
|
|
274
|
+
- `color.accent.subtleGreen` => `color.background.accent.green.subtler`
|
|
275
|
+
- `color.accent.subtleMagenta` => `color.background.accent.magenta.subtler`
|
|
276
|
+
- `color.accent.subtleOrange` => `color.background.accent.orange.subtler`
|
|
277
|
+
- `color.accent.subtlePurple` => `color.background.accent.purple.subtler`
|
|
278
|
+
- `color.accent.subtleRed` => `color.background.accent.red.subtler`
|
|
279
|
+
- `color.accent.subtleTeal` => `color.background.accent.teal.subtler`
|
|
280
|
+
- `color.iconBorder.brand` => `color.icon.brand`
|
|
281
|
+
- `color.iconBorder.danger` => `color.icon.danger`
|
|
282
|
+
- `color.iconBorder.discovery` => `color.icon.discovery`
|
|
283
|
+
- `color.iconBorder.success` => `color.icon.success`
|
|
284
|
+
- `color.iconBorder.warning` => `color.icon.warning`
|
|
285
|
+
- `color.overlay.hover` => `color.interaction.hovered`
|
|
286
|
+
- `color.overlay.pressed` => `color.interaction.pressed`
|
|
287
|
+
- `shadow.card` => `elevation.shadow.raised`
|
|
288
|
+
- `shadow.overlay` => `elevation.shadow.overlay`
|
|
289
|
+
- `utility.UNSAFE_util.transparent` => `utility.UNSAFE.transparent`
|
|
290
|
+
- `utility.UNSAFE_util.MISSING_TOKEN` => No replacement
|
|
291
|
+
|
|
3
292
|
## 0.13.5
|
|
4
293
|
|
|
5
294
|
### 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
|
-
###
|
|
13
|
+
### Set global theme
|
|
17
14
|
|
|
18
|
-
|
|
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
|
|
23
|
-
|
|
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
|
-
###
|
|
37
|
-
|
|
38
|
-
Change the global theme during runtime.
|
|
33
|
+
### Learn more
|
|
39
34
|
|
|
40
|
-
|
|
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
|
|