@atlaskit/tokens 4.6.0 → 4.8.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,25 @@
1
1
  # @atlaskit/tokens
2
2
 
3
+ ## 4.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#139915](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139915)
8
+ [`bb8ff89963687`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb8ff89963687) -
9
+ Add lightBrandRefresh and darkBrandRefresh to @atlaskit/tokens/tokens-raw
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 4.7.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#137774](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137774)
20
+ [`02ed87dfa643c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/02ed87dfa643c) -
21
+ Adds forceAutoFallbackExemptions that allows skipping certain tokens from fallback enforcement
22
+
3
23
  ## 4.6.0
4
24
 
5
25
  ### Minor Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = plugin;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var t = _interopRequireWildcard(require("@babel/types"));
11
12
  var _tokenNames = _interopRequireDefault(require("../artifacts/token-names"));
@@ -18,6 +19,29 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
18
19
  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 && {}.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; }
19
20
  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; }
20
21
  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; }
22
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
23
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
24
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
25
+ var isExempted = function isExempted(tokenName) {
26
+ var exemptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
27
+ // Check if the token name starts with any of the exempted prefixes
28
+ var _iterator = _createForOfIteratorHelper(exemptions),
29
+ _step;
30
+ try {
31
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
32
+ var exemption = _step.value;
33
+ if (tokenName.startsWith(exemption)) {
34
+ return true;
35
+ }
36
+ }
37
+ } catch (err) {
38
+ _iterator.e(err);
39
+ } finally {
40
+ _iterator.f();
41
+ }
42
+ return false;
43
+ };
44
+
21
45
  // Convert raw tokens to key-value pairs { token: value }
22
46
  var getThemeValues = function getThemeValues(theme) {
23
47
  return theme.reduce(function (formatted, rawToken) {
@@ -97,9 +121,12 @@ function plugin() {
97
121
  }
98
122
  }
99
123
 
100
- // Handle fallbacks
101
124
  // The border.radius tokens are skipped in shouldForceAutoFallback mode because these tokens are not enabled in the live products and enforcing default values on them will override all the fallback values that are currently being used to render the actual UI.
102
- var fallback = state.opts.shouldForceAutoFallback && !tokenName.startsWith('border.radius') ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
125
+ // The exempted tokens (the ones that start with any of the provided exemption prefixes) are also skipped.
126
+ var forceAutoFallbackExemptions = ['border.radius'].concat((0, _toConsumableArray2.default)(state.opts.forceAutoFallbackExemptions || []));
127
+
128
+ // Handle fallbacks
129
+ var fallback = state.opts.shouldForceAutoFallback && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
103
130
  if (t.isStringLiteral(fallback)) {
104
131
  // String literals can be concatenated into css variable call
105
132
  // Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "dark", {
10
10
  return _atlassianDark.default;
11
11
  }
12
12
  });
13
+ Object.defineProperty(exports, "darkBrandRefresh", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _atlassianDarkBrandRefresh.default;
17
+ }
18
+ });
13
19
  Object.defineProperty(exports, "legacyLightTokens", {
14
20
  enumerable: true,
15
21
  get: function get() {
@@ -22,6 +28,12 @@ Object.defineProperty(exports, "light", {
22
28
  return _atlassianLight.default;
23
29
  }
24
30
  });
31
+ Object.defineProperty(exports, "lightBrandRefresh", {
32
+ enumerable: true,
33
+ get: function get() {
34
+ return _atlassianLightBrandRefresh.default;
35
+ }
36
+ });
25
37
  Object.defineProperty(exports, "shape", {
26
38
  enumerable: true,
27
39
  get: function get() {
@@ -53,8 +65,10 @@ Object.defineProperty(exports, "typographyRefreshed", {
53
65
  }
54
66
  });
55
67
  var _atlassianLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light"));
68
+ var _atlassianLightBrandRefresh = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light-brand-refresh"));
56
69
  var _atlassianLegacyLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-legacy-light"));
57
70
  var _atlassianDark = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-dark"));
71
+ var _atlassianDarkBrandRefresh = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-dark-brand-refresh"));
58
72
  var _atlassianSpacing = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-spacing"));
59
73
  var _atlassianTypographyModernized = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-typography-modernized"));
60
74
  var _atlassianTypographyRefreshed = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-typography-refreshed"));
@@ -5,6 +5,16 @@ import light from '../artifacts/tokens-raw/atlassian-light';
5
5
  import shape from '../artifacts/tokens-raw/atlassian-shape';
6
6
  import spacing from '../artifacts/tokens-raw/atlassian-spacing';
7
7
  import typography from '../artifacts/tokens-raw/atlassian-typography-adg3';
8
+ const isExempted = (tokenName, exemptions = []) => {
9
+ // Check if the token name starts with any of the exempted prefixes
10
+ for (const exemption of exemptions) {
11
+ if (tokenName.startsWith(exemption)) {
12
+ return true;
13
+ }
14
+ }
15
+ return false;
16
+ };
17
+
8
18
  // Convert raw tokens to key-value pairs { token: value }
9
19
  const getThemeValues = theme => {
10
20
  return theme.reduce((formatted, rawToken) => {
@@ -87,9 +97,12 @@ export default function plugin() {
87
97
  }
88
98
  }
89
99
 
90
- // Handle fallbacks
91
100
  // The border.radius tokens are skipped in shouldForceAutoFallback mode because these tokens are not enabled in the live products and enforcing default values on them will override all the fallback values that are currently being used to render the actual UI.
92
- const fallback = state.opts.shouldForceAutoFallback && !tokenName.startsWith('border.radius') ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
101
+ // The exempted tokens (the ones that start with any of the provided exemption prefixes) are also skipped.
102
+ const forceAutoFallbackExemptions = ['border.radius', ...(state.opts.forceAutoFallbackExemptions || [])];
103
+
104
+ // Handle fallbacks
105
+ const fallback = state.opts.shouldForceAutoFallback && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
93
106
  if (t.isStringLiteral(fallback)) {
94
107
  // String literals can be concatenated into css variable call
95
108
  // Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
@@ -1,6 +1,8 @@
1
1
  export { default as light } from '../artifacts/tokens-raw/atlassian-light';
2
+ export { default as lightBrandRefresh } from '../artifacts/tokens-raw/atlassian-light-brand-refresh';
2
3
  export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
3
4
  export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
5
+ export { default as darkBrandRefresh } from '../artifacts/tokens-raw/atlassian-dark-brand-refresh';
4
6
  export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
5
7
  export { default as typography } from '../artifacts/tokens-raw/atlassian-typography-modernized';
6
8
  export { default as typographyRefreshed } from '../artifacts/tokens-raw/atlassian-typography-refreshed';
@@ -1,6 +1,10 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  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; }
3
4
  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) { _defineProperty(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; }
5
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
6
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
8
  import * as t from '@babel/types';
5
9
  import tokenNames from '../artifacts/token-names';
6
10
  import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
@@ -8,6 +12,26 @@ import light from '../artifacts/tokens-raw/atlassian-light';
8
12
  import shape from '../artifacts/tokens-raw/atlassian-shape';
9
13
  import spacing from '../artifacts/tokens-raw/atlassian-spacing';
10
14
  import typography from '../artifacts/tokens-raw/atlassian-typography-adg3';
15
+ var isExempted = function isExempted(tokenName) {
16
+ var exemptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
17
+ // Check if the token name starts with any of the exempted prefixes
18
+ var _iterator = _createForOfIteratorHelper(exemptions),
19
+ _step;
20
+ try {
21
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
22
+ var exemption = _step.value;
23
+ if (tokenName.startsWith(exemption)) {
24
+ return true;
25
+ }
26
+ }
27
+ } catch (err) {
28
+ _iterator.e(err);
29
+ } finally {
30
+ _iterator.f();
31
+ }
32
+ return false;
33
+ };
34
+
11
35
  // Convert raw tokens to key-value pairs { token: value }
12
36
  var getThemeValues = function getThemeValues(theme) {
13
37
  return theme.reduce(function (formatted, rawToken) {
@@ -87,9 +111,12 @@ export default function plugin() {
87
111
  }
88
112
  }
89
113
 
90
- // Handle fallbacks
91
114
  // The border.radius tokens are skipped in shouldForceAutoFallback mode because these tokens are not enabled in the live products and enforcing default values on them will override all the fallback values that are currently being used to render the actual UI.
92
- var fallback = state.opts.shouldForceAutoFallback && !tokenName.startsWith('border.radius') ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
115
+ // The exempted tokens (the ones that start with any of the provided exemption prefixes) are also skipped.
116
+ var forceAutoFallbackExemptions = ['border.radius'].concat(_toConsumableArray(state.opts.forceAutoFallbackExemptions || []));
117
+
118
+ // Handle fallbacks
119
+ var fallback = state.opts.shouldForceAutoFallback && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName, state.opts.defaultTheme)) : path.node.arguments[1];
93
120
  if (t.isStringLiteral(fallback)) {
94
121
  // String literals can be concatenated into css variable call
95
122
  // Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
@@ -1,6 +1,8 @@
1
1
  export { default as light } from '../artifacts/tokens-raw/atlassian-light';
2
+ export { default as lightBrandRefresh } from '../artifacts/tokens-raw/atlassian-light-brand-refresh';
2
3
  export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
3
4
  export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
5
+ export { default as darkBrandRefresh } from '../artifacts/tokens-raw/atlassian-dark-brand-refresh';
4
6
  export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
5
7
  export { default as typography } from '../artifacts/tokens-raw/atlassian-typography-modernized';
6
8
  export { default as typographyRefreshed } from '../artifacts/tokens-raw/atlassian-typography-refreshed';
@@ -11,6 +11,7 @@ export default function plugin(): {
11
11
  */
12
12
  shouldUseAutoFallback?: boolean;
13
13
  shouldForceAutoFallback?: boolean;
14
+ forceAutoFallbackExemptions?: string[];
14
15
  defaultTheme?: DefaultColorTheme;
15
16
  };
16
17
  }): void;
@@ -1,6 +1,8 @@
1
1
  export { default as light } from '../artifacts/tokens-raw/atlassian-light';
2
+ export { default as lightBrandRefresh } from '../artifacts/tokens-raw/atlassian-light-brand-refresh';
2
3
  export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
3
4
  export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
5
+ export { default as darkBrandRefresh } from '../artifacts/tokens-raw/atlassian-dark-brand-refresh';
4
6
  export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
5
7
  export { default as typography } from '../artifacts/tokens-raw/atlassian-typography-modernized';
6
8
  export { default as typographyRefreshed } from '../artifacts/tokens-raw/atlassian-typography-refreshed';
@@ -11,6 +11,7 @@ export default function plugin(): {
11
11
  */
12
12
  shouldUseAutoFallback?: boolean;
13
13
  shouldForceAutoFallback?: boolean;
14
+ forceAutoFallbackExemptions?: string[];
14
15
  defaultTheme?: DefaultColorTheme;
15
16
  };
16
17
  }): void;
@@ -1,6 +1,8 @@
1
1
  export { default as light } from '../artifacts/tokens-raw/atlassian-light';
2
+ export { default as lightBrandRefresh } from '../artifacts/tokens-raw/atlassian-light-brand-refresh';
2
3
  export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
3
4
  export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
5
+ export { default as darkBrandRefresh } from '../artifacts/tokens-raw/atlassian-dark-brand-refresh';
4
6
  export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
5
7
  export { default as typography } from '../artifacts/tokens-raw/atlassian-typography-modernized';
6
8
  export { default as typographyRefreshed } from '../artifacts/tokens-raw/atlassian-typography-refreshed';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "4.6.0",
3
+ "version": "4.8.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/"
@@ -48,22 +48,22 @@
48
48
  "@atlaskit/button": "^23.0.0",
49
49
  "@atlaskit/calendar": "^17.1.0",
50
50
  "@atlaskit/checkbox": "^17.0.0",
51
- "@atlaskit/code": "^16.2.0",
51
+ "@atlaskit/code": "^17.0.0",
52
52
  "@atlaskit/docs": "^10.0.0",
53
53
  "@atlaskit/dropdown-menu": "^14.0.0",
54
- "@atlaskit/dynamic-table": "^18.0.0",
54
+ "@atlaskit/dynamic-table": "^18.1.0",
55
55
  "@atlaskit/form": "^12.0.0",
56
56
  "@atlaskit/grid": "^0.18.0",
57
- "@atlaskit/heading": "^5.1.0",
58
- "@atlaskit/icon": "^25.4.0",
57
+ "@atlaskit/heading": "^5.2.0",
58
+ "@atlaskit/icon": "^25.6.0",
59
59
  "@atlaskit/inline-message": "^14.0.0",
60
60
  "@atlaskit/link": "^3.1.0",
61
61
  "@atlaskit/lozenge": "^12.2.0",
62
- "@atlaskit/popup": "^3.0.0",
63
- "@atlaskit/primitives": "^14.3.0",
62
+ "@atlaskit/popup": "^4.0.0",
63
+ "@atlaskit/primitives": "^14.4.0",
64
64
  "@atlaskit/radio": "^8.0.0",
65
65
  "@atlaskit/section-message": "^8.2.0",
66
- "@atlaskit/select": "^20.0.0",
66
+ "@atlaskit/select": "^20.3.0",
67
67
  "@atlaskit/tag": "^14.0.0",
68
68
  "@atlaskit/textarea": "^8.0.0",
69
69
  "@atlaskit/textfield": "^8.0.0",