@atlaskit/tokens 1.21.0 → 1.21.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/tokens
2
2
 
3
+ ## 1.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`12c0a5a6f2e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12c0a5a6f2e) - The tokens Babel plugin will now add opacity to shadow token values if they don't already contain them.
8
+
3
9
  ## 1.21.0
4
10
 
5
11
  ### Minor Changes
@@ -28,7 +28,21 @@ var getThemeValues = function getThemeValues(theme) {
28
28
  // If it's a box shadow, it'll be an array of values that needs to be
29
29
  // formatted to look like '0px 0px 8px #091e4229, 0px 0px 1px #091e421F'
30
30
  value = rawToken.value.reduce(function (prev, curr, index) {
31
- var value = "".concat(curr.offset.x, "px ").concat(curr.offset.y, "px ").concat(curr.radius, "px ").concat(curr.color);
31
+ var color = curr.color;
32
+
33
+ // Opacity needs to be added to hex values that don't already contain it.
34
+ // If it contained opacity, the length would be 9 instead of 7.
35
+ if (color.length === 7 && curr.opacity) {
36
+ var opacityAsHex = curr.opacity.toString(16); // 0.4f5c28f5c28f5c
37
+ var shortenedHex = opacityAsHex.slice(2, 4); // 4f
38
+
39
+ // The hex value has to have a length of 2. If it's shorter, a "0" needs to be added.
40
+ if (shortenedHex.length === 1) {
41
+ shortenedHex += '0';
42
+ }
43
+ color += shortenedHex;
44
+ }
45
+ var value = "".concat(curr.offset.x, "px ").concat(curr.offset.y, "px ").concat(curr.radius, "px ").concat(color);
32
46
  if (index === 0) {
33
47
  value += ", ";
34
48
  }
@@ -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.21.0";
11
+ var version = "1.21.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.21.0";
12
+ var version = "1.21.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.
@@ -15,7 +15,21 @@ const getThemeValues = theme => {
15
15
  // If it's a box shadow, it'll be an array of values that needs to be
16
16
  // formatted to look like '0px 0px 8px #091e4229, 0px 0px 1px #091e421F'
17
17
  value = rawToken.value.reduce((prev, curr, index) => {
18
- let value = `${curr.offset.x}px ${curr.offset.y}px ${curr.radius}px ${curr.color}`;
18
+ let color = curr.color;
19
+
20
+ // Opacity needs to be added to hex values that don't already contain it.
21
+ // If it contained opacity, the length would be 9 instead of 7.
22
+ if (color.length === 7 && curr.opacity) {
23
+ const opacityAsHex = curr.opacity.toString(16); // 0.4f5c28f5c28f5c
24
+ let shortenedHex = opacityAsHex.slice(2, 4); // 4f
25
+
26
+ // The hex value has to have a length of 2. If it's shorter, a "0" needs to be added.
27
+ if (shortenedHex.length === 1) {
28
+ shortenedHex += '0';
29
+ }
30
+ color += shortenedHex;
31
+ }
32
+ let value = `${curr.offset.x}px ${curr.offset.y}px ${curr.radius}px ${color}`;
19
33
  if (index === 0) {
20
34
  value += `, `;
21
35
  }
@@ -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.21.0";
4
+ const version = "1.21.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.21.0";
5
+ const version = "1.21.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.
@@ -18,7 +18,21 @@ var getThemeValues = function getThemeValues(theme) {
18
18
  // If it's a box shadow, it'll be an array of values that needs to be
19
19
  // formatted to look like '0px 0px 8px #091e4229, 0px 0px 1px #091e421F'
20
20
  value = rawToken.value.reduce(function (prev, curr, index) {
21
- var value = "".concat(curr.offset.x, "px ").concat(curr.offset.y, "px ").concat(curr.radius, "px ").concat(curr.color);
21
+ var color = curr.color;
22
+
23
+ // Opacity needs to be added to hex values that don't already contain it.
24
+ // If it contained opacity, the length would be 9 instead of 7.
25
+ if (color.length === 7 && curr.opacity) {
26
+ var opacityAsHex = curr.opacity.toString(16); // 0.4f5c28f5c28f5c
27
+ var shortenedHex = opacityAsHex.slice(2, 4); // 4f
28
+
29
+ // The hex value has to have a length of 2. If it's shorter, a "0" needs to be added.
30
+ if (shortenedHex.length === 1) {
31
+ shortenedHex += '0';
32
+ }
33
+ color += shortenedHex;
34
+ }
35
+ var value = "".concat(curr.offset.x, "px ").concat(curr.offset.y, "px ").concat(curr.radius, "px ").concat(color);
22
36
  if (index === 0) {
23
37
  value += ", ";
24
38
  }
@@ -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.21.0";
4
+ var version = "1.21.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.21.0";
5
+ var version = "1.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tokens",
3
- "version": "1.21.0",
3
+ "version": "1.21.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/"