@atlaskit/tokens 1.61.0 → 2.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlaskit/tokens
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#145551](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145551)
8
+ [`d477dc32ae480`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d477dc32ae480) -
9
+ Changes the `@atlaskit/tokens/babel-plugin`'s 'shouldUseAutoFallback' configuration to be true by
10
+ default as this is currently the expectation within a majority of Atlassian's frontend code.
11
+
12
+ To opt-out (which likely means you must be using fallbacks manually or can guarantee theming is
13
+ turned on), you would have config like this in Babel, Webpack, or similar:
14
+
15
+ ```json
16
+ "plugins": [
17
+ ["@atlaskit/tokens/babel-plugin", { "shouldUseAutoFallback": false }]
18
+ ]
19
+ ```
20
+
21
+ ### Patch Changes
22
+
23
+ - [#145551](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145551)
24
+ [`d477dc32ae480`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d477dc32ae480) -
25
+ Removes 'shouldUseAutoFallbacks' config on '@atlaskit/tokens/babel-plugin' as this is now the
26
+ default.
27
+
3
28
  ## 1.61.0
4
29
 
5
30
  ### Minor Changes
package/README.md CHANGED
@@ -39,9 +39,9 @@ Add the plugin to your babel configuration:
39
39
 
40
40
  ### Options
41
41
 
42
- Currently the plugin supports one option, `shouldUseAutoFallback`. When enabled, the plugin will
43
- fetch the token's value in the default Atlassian theme (currently `atlassian-light`) and use it as
44
- the fallback value.
42
+ Currently the plugin supports one option, `shouldUseAutoFallback`. When not disabled, the plugin
43
+ will fetch the token's value in the default Atlassian theme (currently `atlassian-light`) and use it
44
+ as the fallback value.
45
45
 
46
46
  This is useful for cases where tokens are in use, but token definitions aren't guaranteed to be
47
47
  present in the top-level page CSS.
@@ -90,7 +90,7 @@ function plugin() {
90
90
 
91
91
  // if no fallback is set, optionally find one from the default theme
92
92
  if (path.node.arguments.length < 2) {
93
- if (state.opts.shouldUseAutoFallback) {
93
+ if (state.opts.shouldUseAutoFallback !== false) {
94
94
  replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName, state.opts.defaultTheme), ")"));
95
95
  } else {
96
96
  replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ")"));
@@ -80,7 +80,7 @@ export default function plugin() {
80
80
 
81
81
  // if no fallback is set, optionally find one from the default theme
82
82
  if (path.node.arguments.length < 2) {
83
- if (state.opts.shouldUseAutoFallback) {
83
+ if (state.opts.shouldUseAutoFallback !== false) {
84
84
  replacementNode = t.stringLiteral(`var(${cssTokenValue}, ${getDefaultFallback(tokenName, state.opts.defaultTheme)})`);
85
85
  } else {
86
86
  replacementNode = t.stringLiteral(`var(${cssTokenValue})`);
@@ -80,7 +80,7 @@ export default function plugin() {
80
80
 
81
81
  // if no fallback is set, optionally find one from the default theme
82
82
  if (path.node.arguments.length < 2) {
83
- if (state.opts.shouldUseAutoFallback) {
83
+ if (state.opts.shouldUseAutoFallback !== false) {
84
84
  replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName, state.opts.defaultTheme), ")"));
85
85
  } else {
86
86
  replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ")"));
@@ -6,6 +6,9 @@ export default function plugin(): {
6
6
  Program: {
7
7
  enter(path: NodePath<t.Program>, state: {
8
8
  opts: {
9
+ /**
10
+ * @default true
11
+ */
9
12
  shouldUseAutoFallback?: boolean;
10
13
  shouldForceAutoFallback?: boolean;
11
14
  defaultTheme?: DefaultColorTheme;
@@ -6,6 +6,9 @@ export default function plugin(): {
6
6
  Program: {
7
7
  enter(path: NodePath<t.Program>, state: {
8
8
  opts: {
9
+ /**
10
+ * @default true
11
+ */
9
12
  shouldUseAutoFallback?: boolean;
10
13
  shouldForceAutoFallback?: boolean;
11
14
  defaultTheme?: DefaultColorTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "1.61.0",
3
+ "version": "2.0.0",
4
4
  "description": "Design tokens are the single source of truth to name and store design decisions.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@af/accessibility-testing": "*",
46
46
  "@af/formatting": "*",
47
- "@atlaskit/button": "^20.1.0",
47
+ "@atlaskit/button": "^20.2.0",
48
48
  "@atlaskit/calendar": "^15.0.0",
49
49
  "@atlaskit/checkbox": "^14.0.0",
50
50
  "@atlaskit/radio": "^6.5.0",