@atlaskit/tokens 1.40.0 → 1.41.1

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 (35) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/artifacts/types-internal.js +1 -5
  3. package/dist/cjs/artifacts/types.js +1 -5
  4. package/dist/cjs/artifacts/typescript/atlassian-dark-types-internal.js +1 -5
  5. package/dist/cjs/artifacts/typescript/atlassian-dark-types.js +1 -5
  6. package/dist/cjs/artifacts/typescript/atlassian-light-types-internal.js +1 -5
  7. package/dist/cjs/artifacts/typescript/atlassian-light-types.js +1 -5
  8. package/dist/cjs/babel-plugin/plugin.js +20 -6
  9. package/dist/cjs/entry-points/css-type-schema.codegen.js +1 -5
  10. package/dist/cjs/get-token-value.js +1 -1
  11. package/dist/cjs/get-token.js +1 -1
  12. package/dist/es2019/artifacts/types-internal.js +0 -1
  13. package/dist/es2019/artifacts/types.js +0 -1
  14. package/dist/es2019/artifacts/typescript/atlassian-dark-types-internal.js +0 -1
  15. package/dist/es2019/artifacts/typescript/atlassian-dark-types.js +0 -1
  16. package/dist/es2019/artifacts/typescript/atlassian-light-types-internal.js +0 -1
  17. package/dist/es2019/artifacts/typescript/atlassian-light-types.js +0 -1
  18. package/dist/es2019/babel-plugin/plugin.js +20 -6
  19. package/dist/es2019/entry-points/css-type-schema.codegen.js +0 -1
  20. package/dist/es2019/get-token-value.js +1 -1
  21. package/dist/es2019/get-token.js +1 -1
  22. package/dist/esm/artifacts/types-internal.js +0 -1
  23. package/dist/esm/artifacts/types.js +0 -1
  24. package/dist/esm/artifacts/typescript/atlassian-dark-types-internal.js +0 -1
  25. package/dist/esm/artifacts/typescript/atlassian-dark-types.js +0 -1
  26. package/dist/esm/artifacts/typescript/atlassian-light-types-internal.js +0 -1
  27. package/dist/esm/artifacts/typescript/atlassian-light-types.js +0 -1
  28. package/dist/esm/babel-plugin/plugin.js +20 -6
  29. package/dist/esm/entry-points/css-type-schema.codegen.js +0 -1
  30. package/dist/esm/get-token-value.js +1 -1
  31. package/dist/esm/get-token.js +1 -1
  32. package/dist/types/babel-plugin/plugin.d.ts +2 -2
  33. package/dist/types-ts4.5/babel-plugin/plugin.d.ts +2 -2
  34. package/package.json +1 -1
  35. package/.eslintrc.js +0 -35
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/tokens
2
2
 
3
+ ## 1.41.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#81644](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81644) [`8ab7a816dca7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8ab7a816dca7) - Revert input border change from the previous version
8
+
9
+ ## 1.41.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#80805](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80805) [`427c2dd9e0d6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/427c2dd9e0d6) - [ux] Update input border color token to meet 3:1 color contrast ratio
14
+
15
+ Light theme: color.border.input: #091E4224 → #8590A2
16
+ Dark mode: color.border.input: #A6C5E229 → #738496
17
+
18
+ - [#79670](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79670) [`28b71d14576b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/28b71d14576b) - Adds autofallback support for Spacing, Typography, and Shape themes to the babel plugin.
19
+
3
20
  ## 1.40.0
4
21
 
5
22
  ### Minor Changes
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -11,14 +11,16 @@ var t = _interopRequireWildcard(require("@babel/types"));
11
11
  var _tokenNames = _interopRequireDefault(require("../artifacts/token-names"));
12
12
  var _atlassianLegacyLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-legacy-light"));
13
13
  var _atlassianLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light"));
14
+ var _atlassianShape = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-shape"));
15
+ var _atlassianSpacing = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-spacing"));
16
+ var _atlassianTypographyAdg = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-typography-adg3"));
14
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
21
  // Convert raw tokens to key-value pairs { token: value }
19
22
  var getThemeValues = function getThemeValues(theme) {
20
- var tokensToMap = theme === 'light' ? _atlassianLight.default : _atlassianLegacyLight.default;
21
- return tokensToMap.reduce(function (formatted, rawToken) {
23
+ return theme.reduce(function (formatted, rawToken) {
22
24
  var value;
23
25
  if (typeof rawToken.value === 'string') {
24
26
  value = rawToken.value;
@@ -52,8 +54,6 @@ var getThemeValues = function getThemeValues(theme) {
52
54
  return _objectSpread(_objectSpread({}, formatted), {}, (0, _defineProperty2.default)({}, rawToken.cleanName, value));
53
55
  }, {});
54
56
  };
55
- var lightValues = getThemeValues('light');
56
- var legacyLightValues = getThemeValues('legacy-light');
57
57
  function plugin() {
58
58
  return {
59
59
  visitor: {
@@ -163,10 +163,24 @@ function plugin() {
163
163
  }
164
164
  };
165
165
  }
166
+ var lightValues = getThemeValues(_atlassianLight.default);
167
+ var legacyLightValues = getThemeValues(_atlassianLegacyLight.default);
168
+ var shapeValues = getThemeValues(_atlassianShape.default);
169
+ var spacingValues = getThemeValues(_atlassianSpacing.default);
170
+ var typographyValues = getThemeValues(_atlassianTypographyAdg.default);
166
171
  function getDefaultFallback(tokenName) {
167
172
  var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
168
- var tokens = theme === 'legacy-light' ? legacyLightValues : lightValues;
169
- return tokens[tokenName];
173
+ if (shapeValues[tokenName]) {
174
+ return shapeValues[tokenName];
175
+ }
176
+ if (spacingValues[tokenName]) {
177
+ return spacingValues[tokenName];
178
+ }
179
+ if (typographyValues[tokenName]) {
180
+ return typographyValues[tokenName];
181
+ }
182
+ var colorValues = theme === 'legacy-light' ? legacyLightValues : lightValues;
183
+ return colorValues[tokenName];
170
184
  }
171
185
  function getNonAliasedImportName(node) {
172
186
  if (t.isIdentifier(node.imported)) {
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _warnOnce = _interopRequireDefault(require("@atlaskit/ds-lib/warn-once"));
9
9
  var _tokenNames = _interopRequireDefault(require("./artifacts/token-names"));
10
10
  var name = "@atlaskit/tokens";
11
- var version = "1.40.0";
11
+ var version = "1.41.1";
12
12
  /**
13
13
  * Takes a dot-separated token name and and an optional fallback, and returns the current computed CSS value for the
14
14
  * resulting CSS Custom Property.
@@ -9,7 +9,7 @@ var _warnOnce = _interopRequireDefault(require("@atlaskit/ds-lib/warn-once"));
9
9
  var _tokenNames = _interopRequireDefault(require("./artifacts/token-names"));
10
10
  var _constants = require("./constants");
11
11
  var name = "@atlaskit/tokens";
12
- var version = "1.40.0";
12
+ var version = "1.41.1";
13
13
  /**
14
14
  * Takes a dot-separated token name and an optional fallback, and returns the CSS custom property for the corresponding token.
15
15
  * This should be used to implement design decisions throughout your application.
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -2,10 +2,12 @@ import * as t from '@babel/types';
2
2
  import tokenNames from '../artifacts/token-names';
3
3
  import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
4
4
  import light from '../artifacts/tokens-raw/atlassian-light';
5
+ import shape from '../artifacts/tokens-raw/atlassian-shape';
6
+ import spacing from '../artifacts/tokens-raw/atlassian-spacing';
7
+ import typography from '../artifacts/tokens-raw/atlassian-typography-adg3';
5
8
  // Convert raw tokens to key-value pairs { token: value }
6
9
  const getThemeValues = theme => {
7
- const tokensToMap = theme === 'light' ? light : legacyLight;
8
- return tokensToMap.reduce((formatted, rawToken) => {
10
+ return theme.reduce((formatted, rawToken) => {
9
11
  let value;
10
12
  if (typeof rawToken.value === 'string') {
11
13
  value = rawToken.value;
@@ -42,8 +44,6 @@ const getThemeValues = theme => {
42
44
  };
43
45
  }, {});
44
46
  };
45
- const lightValues = getThemeValues('light');
46
- const legacyLightValues = getThemeValues('legacy-light');
47
47
  export default function plugin() {
48
48
  return {
49
49
  visitor: {
@@ -145,9 +145,23 @@ export default function plugin() {
145
145
  }
146
146
  };
147
147
  }
148
+ const lightValues = getThemeValues(light);
149
+ const legacyLightValues = getThemeValues(legacyLight);
150
+ const shapeValues = getThemeValues(shape);
151
+ const spacingValues = getThemeValues(spacing);
152
+ const typographyValues = getThemeValues(typography);
148
153
  function getDefaultFallback(tokenName, theme = 'light') {
149
- const tokens = theme === 'legacy-light' ? legacyLightValues : lightValues;
150
- return tokens[tokenName];
154
+ if (shapeValues[tokenName]) {
155
+ return shapeValues[tokenName];
156
+ }
157
+ if (spacingValues[tokenName]) {
158
+ return spacingValues[tokenName];
159
+ }
160
+ if (typographyValues[tokenName]) {
161
+ return typographyValues[tokenName];
162
+ }
163
+ const colorValues = theme === 'legacy-light' ? legacyLightValues : lightValues;
164
+ return colorValues[tokenName];
151
165
  }
152
166
  function getNonAliasedImportName(node) {
153
167
  if (t.isIdentifier(node.imported)) {
@@ -1 +0,0 @@
1
- export {};
@@ -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 = "1.40.0";
4
+ const version = "1.41.1";
5
5
  /**
6
6
  * Takes a dot-separated token name and and an optional fallback, and returns the current computed CSS value for the
7
7
  * resulting CSS Custom Property.
@@ -2,7 +2,7 @@ import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
4
4
  const name = "@atlaskit/tokens";
5
- const version = "1.40.0";
5
+ const version = "1.41.1";
6
6
  /**
7
7
  * Takes a dot-separated token name and an optional fallback, and returns the CSS custom property for the corresponding token.
8
8
  * This should be used to implement design decisions throughout your application.
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -5,10 +5,12 @@ import * as t from '@babel/types';
5
5
  import tokenNames from '../artifacts/token-names';
6
6
  import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
7
7
  import light from '../artifacts/tokens-raw/atlassian-light';
8
+ import shape from '../artifacts/tokens-raw/atlassian-shape';
9
+ import spacing from '../artifacts/tokens-raw/atlassian-spacing';
10
+ import typography from '../artifacts/tokens-raw/atlassian-typography-adg3';
8
11
  // Convert raw tokens to key-value pairs { token: value }
9
12
  var getThemeValues = function getThemeValues(theme) {
10
- var tokensToMap = theme === 'light' ? light : legacyLight;
11
- return tokensToMap.reduce(function (formatted, rawToken) {
13
+ return theme.reduce(function (formatted, rawToken) {
12
14
  var value;
13
15
  if (typeof rawToken.value === 'string') {
14
16
  value = rawToken.value;
@@ -42,8 +44,6 @@ var getThemeValues = function getThemeValues(theme) {
42
44
  return _objectSpread(_objectSpread({}, formatted), {}, _defineProperty({}, rawToken.cleanName, value));
43
45
  }, {});
44
46
  };
45
- var lightValues = getThemeValues('light');
46
- var legacyLightValues = getThemeValues('legacy-light');
47
47
  export default function plugin() {
48
48
  return {
49
49
  visitor: {
@@ -153,10 +153,24 @@ export default function plugin() {
153
153
  }
154
154
  };
155
155
  }
156
+ var lightValues = getThemeValues(light);
157
+ var legacyLightValues = getThemeValues(legacyLight);
158
+ var shapeValues = getThemeValues(shape);
159
+ var spacingValues = getThemeValues(spacing);
160
+ var typographyValues = getThemeValues(typography);
156
161
  function getDefaultFallback(tokenName) {
157
162
  var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
158
- var tokens = theme === 'legacy-light' ? legacyLightValues : lightValues;
159
- return tokens[tokenName];
163
+ if (shapeValues[tokenName]) {
164
+ return shapeValues[tokenName];
165
+ }
166
+ if (spacingValues[tokenName]) {
167
+ return spacingValues[tokenName];
168
+ }
169
+ if (typographyValues[tokenName]) {
170
+ return typographyValues[tokenName];
171
+ }
172
+ var colorValues = theme === 'legacy-light' ? legacyLightValues : lightValues;
173
+ return colorValues[tokenName];
160
174
  }
161
175
  function getNonAliasedImportName(node) {
162
176
  if (t.isIdentifier(node.imported)) {
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +1,7 @@
1
1
  import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  var name = "@atlaskit/tokens";
4
- var version = "1.40.0";
4
+ var version = "1.41.1";
5
5
  /**
6
6
  * Takes a dot-separated token name and and an optional fallback, and returns the current computed CSS value for the
7
7
  * resulting CSS Custom Property.
@@ -2,7 +2,7 @@ import warnOnce from '@atlaskit/ds-lib/warn-once';
2
2
  import tokens from './artifacts/token-names';
3
3
  import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
4
4
  var name = "@atlaskit/tokens";
5
- var version = "1.40.0";
5
+ var version = "1.41.1";
6
6
  /**
7
7
  * Takes a dot-separated token name and an optional fallback, and returns the CSS custom property for the corresponding token.
8
8
  * This should be used to implement design decisions throughout your application.
@@ -1,13 +1,13 @@
1
1
  import { NodePath } from '@babel/traverse';
2
2
  import * as t from '@babel/types';
3
- type DefaultTheme = 'light' | 'legacy-light';
3
+ type DefaultColorTheme = 'light' | 'legacy-light';
4
4
  export default function plugin(): {
5
5
  visitor: {
6
6
  Program: {
7
7
  enter(path: NodePath<t.Program>, state: {
8
8
  opts: {
9
9
  shouldUseAutoFallback?: boolean;
10
- defaultTheme?: DefaultTheme;
10
+ defaultTheme?: DefaultColorTheme;
11
11
  };
12
12
  }): void;
13
13
  exit(path: NodePath<t.Program>): void;
@@ -1,13 +1,13 @@
1
1
  import { NodePath } from '@babel/traverse';
2
2
  import * as t from '@babel/types';
3
- type DefaultTheme = 'light' | 'legacy-light';
3
+ type DefaultColorTheme = 'light' | 'legacy-light';
4
4
  export default function plugin(): {
5
5
  visitor: {
6
6
  Program: {
7
7
  enter(path: NodePath<t.Program>, state: {
8
8
  opts: {
9
9
  shouldUseAutoFallback?: boolean;
10
- defaultTheme?: DefaultTheme;
10
+ defaultTheme?: DefaultColorTheme;
11
11
  };
12
12
  }): void;
13
13
  exit(path: NodePath<t.Program>): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "1.40.0",
3
+ "version": "1.41.1",
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/"
package/.eslintrc.js DELETED
@@ -1,35 +0,0 @@
1
- module.exports = {
2
- overrides: [
3
- {
4
- // Lint documentation to ensure usage examples are up-to-date
5
- files: ['./examples/**', './docs/**'],
6
- rules: {
7
- '@atlaskit/design-system/no-deprecated-design-token-usage': ['warn'],
8
- '@atlaskit/design-system/ensure-design-token-usage': [
9
- 'error',
10
- { domains: ['color'], shouldEnforceFallbacks: true },
11
- ],
12
- },
13
- },
14
- {
15
- // Constellation examples, and docs, include fallbacks for now
16
- files: ['./examples/constellation/**', './docs/**'],
17
- rules: {
18
- '@atlaskit/design-system/no-unsafe-design-token-usage': [
19
- 'error',
20
- { shouldEnforceFallbacks: true },
21
- ],
22
- },
23
- },
24
- {
25
- // Atlaskit examples don't all have fallbacks
26
- files: ['./examples/**.tsx'],
27
- rules: {
28
- '@atlaskit/design-system/no-unsafe-design-token-usage': [
29
- 'error',
30
- { shouldEnforceFallbacks: false },
31
- ],
32
- },
33
- },
34
- ],
35
- };