@atlaskit/tokens 1.19.0 → 1.20.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 +12 -0
- package/dist/cjs/babel-plugin/plugin.js +1 -0
- package/dist/cjs/get-theme-html-attrs.js +2 -13
- package/dist/cjs/get-token-value.js +1 -1
- package/dist/cjs/get-token.js +1 -1
- package/dist/cjs/utils/custom-theme-loading-utils.js +1 -1
- package/dist/cjs/utils/get-theme-preferences.js +3 -5
- package/dist/es2019/babel-plugin/plugin.js +1 -0
- package/dist/es2019/get-theme-html-attrs.js +2 -13
- package/dist/es2019/get-token-value.js +1 -1
- package/dist/es2019/get-token.js +1 -1
- package/dist/es2019/utils/custom-theme-loading-utils.js +1 -1
- package/dist/es2019/utils/get-theme-preferences.js +3 -5
- package/dist/esm/babel-plugin/plugin.js +1 -0
- package/dist/esm/get-theme-html-attrs.js +2 -13
- package/dist/esm/get-token-value.js +1 -1
- package/dist/esm/get-token.js +1 -1
- package/dist/esm/utils/custom-theme-loading-utils.js +1 -1
- package/dist/esm/utils/get-theme-preferences.js +3 -5
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/tokens
|
|
2
2
|
|
|
3
|
+
## 1.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4be033a9cb5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4be033a9cb5) - Update types
|
|
8
|
+
|
|
9
|
+
## 1.20.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`0a95595cd3e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0a95595cd3e) - Space tokens are now enabled by default whenever `setGlobalTheme` is called.
|
|
14
|
+
|
|
3
15
|
## 1.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -45,6 +45,7 @@ function plugin() {
|
|
|
45
45
|
visitor: {
|
|
46
46
|
Program: {
|
|
47
47
|
enter: function enter(path, state) {
|
|
48
|
+
// @ts-expect-error TS2339: Property 'file' does not exist on type 'Hub'
|
|
48
49
|
var sourceFile = path.hub.file.opts.filename;
|
|
49
50
|
if (sourceFile && sourceFile.includes('node_modules')) {
|
|
50
51
|
return;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _constants = require("./constants");
|
|
11
10
|
var _themeConfig = require("./theme-config");
|
|
12
11
|
var _themeStateTransformer = require("./theme-state-transformer");
|
|
@@ -49,20 +48,10 @@ var getThemeHtmlAttrs = function getThemeHtmlAttrs() {
|
|
|
49
48
|
dark: dark,
|
|
50
49
|
light: light,
|
|
51
50
|
shape: shape,
|
|
52
|
-
spacing
|
|
51
|
+
// Load spacing by default
|
|
52
|
+
spacing: spacing || 'spacing',
|
|
53
53
|
typography: typography
|
|
54
54
|
};
|
|
55
|
-
|
|
56
|
-
// Load spacing by default, currently behind a feature flag
|
|
57
|
-
if ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.space-and-shape-tokens_q5me6')) {
|
|
58
|
-
themePreferences = {
|
|
59
|
-
dark: dark,
|
|
60
|
-
light: light,
|
|
61
|
-
shape: shape,
|
|
62
|
-
spacing: 'spacing',
|
|
63
|
-
typography: typography
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
55
|
var themeAttribute = (0, _themeStateTransformer.themeObjectToString)(themePreferences);
|
|
67
56
|
var result = (_result = {}, (0, _defineProperty2.default)(_result, _constants.THEME_DATA_ATTRIBUTE, themeAttribute), (0, _defineProperty2.default)(_result, _constants.COLOR_MODE_ATTRIBUTE, colorMode === 'auto' ? defaultColorMode : colorMode), _result);
|
|
68
57
|
if (UNSAFE_themeOptions && (0, _colorUtils.isValidBrandHex)(UNSAFE_themeOptions.brandColor)) {
|
|
@@ -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.
|
|
11
|
+
var version = "1.20.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.
|
package/dist/cjs/get-token.js
CHANGED
|
@@ -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.
|
|
12
|
+
var version = "1.20.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.
|
|
@@ -28,7 +28,7 @@ function findMissingCustomStyleElements(UNSAFE_themeOptions, mode) {
|
|
|
28
28
|
return attrOfMissingCustomStyles;
|
|
29
29
|
}
|
|
30
30
|
function limitSizeOfCustomStyleElements(sizeThreshold) {
|
|
31
|
-
var styleTags = (0, _toConsumableArray2.default)(document.head.querySelectorAll("style[".concat(_constants.CUSTOM_THEME_ATTRIBUTE, "][").concat(_constants.THEME_DATA_ATTRIBUTE, "]")));
|
|
31
|
+
var styleTags = (0, _toConsumableArray2.default)(Array.from(document.head.querySelectorAll("style[".concat(_constants.CUSTOM_THEME_ATTRIBUTE, "][").concat(_constants.THEME_DATA_ATTRIBUTE, "]"))));
|
|
32
32
|
if (styleTags.length < sizeThreshold) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -24,11 +24,9 @@ var getThemePreferences = function getThemePreferences(themeState) {
|
|
|
24
24
|
themePreferences.push("".concat(themePreferences.includes('dark') ? 'dark' : 'light', "-new-input-border"));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// Load
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
themePreferences.push('spacing');
|
|
31
|
-
}
|
|
27
|
+
// Load spacing by default
|
|
28
|
+
if (!themePreferences.includes('spacing')) {
|
|
29
|
+
themePreferences.push('spacing');
|
|
32
30
|
}
|
|
33
31
|
return (0, _toConsumableArray2.default)(new Set(themePreferences));
|
|
34
32
|
};
|
|
@@ -35,6 +35,7 @@ export default function plugin() {
|
|
|
35
35
|
visitor: {
|
|
36
36
|
Program: {
|
|
37
37
|
enter(path, state) {
|
|
38
|
+
// @ts-expect-error TS2339: Property 'file' does not exist on type 'Hub'
|
|
38
39
|
const sourceFile = path.hub.file.opts.filename;
|
|
39
40
|
if (sourceFile && sourceFile.includes('node_modules')) {
|
|
40
41
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { COLOR_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
|
|
3
2
|
import { themeStateDefaults } from './theme-config';
|
|
4
3
|
import { themeObjectToString } from './theme-state-transformer';
|
|
@@ -33,20 +32,10 @@ const getThemeHtmlAttrs = ({
|
|
|
33
32
|
dark,
|
|
34
33
|
light,
|
|
35
34
|
shape,
|
|
36
|
-
spacing
|
|
35
|
+
// Load spacing by default
|
|
36
|
+
spacing: spacing || 'spacing',
|
|
37
37
|
typography
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
// Load spacing by default, currently behind a feature flag
|
|
41
|
-
if (getBooleanFF('platform.design-system-team.space-and-shape-tokens_q5me6')) {
|
|
42
|
-
themePreferences = {
|
|
43
|
-
dark,
|
|
44
|
-
light,
|
|
45
|
-
shape,
|
|
46
|
-
spacing: 'spacing',
|
|
47
|
-
typography
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
39
|
const themeAttribute = themeObjectToString(themePreferences);
|
|
51
40
|
const result = {
|
|
52
41
|
[THEME_DATA_ATTRIBUTE]: themeAttribute,
|
|
@@ -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.
|
|
4
|
+
const version = "1.20.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.
|
package/dist/es2019/get-token.js
CHANGED
|
@@ -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.
|
|
5
|
+
const version = "1.20.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.
|
|
@@ -17,7 +17,7 @@ export function findMissingCustomStyleElements(UNSAFE_themeOptions, mode) {
|
|
|
17
17
|
return attrOfMissingCustomStyles;
|
|
18
18
|
}
|
|
19
19
|
export function limitSizeOfCustomStyleElements(sizeThreshold) {
|
|
20
|
-
const styleTags = [...document.head.querySelectorAll(`style[${CUSTOM_THEME_ATTRIBUTE}][${THEME_DATA_ATTRIBUTE}]`)];
|
|
20
|
+
const styleTags = [...Array.from(document.head.querySelectorAll(`style[${CUSTOM_THEME_ATTRIBUTE}][${THEME_DATA_ATTRIBUTE}]`))];
|
|
21
21
|
if (styleTags.length < sizeThreshold) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -18,11 +18,9 @@ export const getThemePreferences = themeState => {
|
|
|
18
18
|
themePreferences.push(`${themePreferences.includes('dark') ? 'dark' : 'light'}-new-input-border`);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// Load
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
themePreferences.push('spacing');
|
|
25
|
-
}
|
|
21
|
+
// Load spacing by default
|
|
22
|
+
if (!themePreferences.includes('spacing')) {
|
|
23
|
+
themePreferences.push('spacing');
|
|
26
24
|
}
|
|
27
25
|
return [...new Set(themePreferences)];
|
|
28
26
|
};
|
|
@@ -35,6 +35,7 @@ export default function plugin() {
|
|
|
35
35
|
visitor: {
|
|
36
36
|
Program: {
|
|
37
37
|
enter: function enter(path, state) {
|
|
38
|
+
// @ts-expect-error TS2339: Property 'file' does not exist on type 'Hub'
|
|
38
39
|
var sourceFile = path.hub.file.opts.filename;
|
|
39
40
|
if (sourceFile && sourceFile.includes('node_modules')) {
|
|
40
41
|
return;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { COLOR_MODE_ATTRIBUTE, CUSTOM_THEME_ATTRIBUTE, THEME_DATA_ATTRIBUTE } from './constants';
|
|
4
3
|
import { themeStateDefaults } from './theme-config';
|
|
5
4
|
import { themeObjectToString } from './theme-state-transformer';
|
|
@@ -42,20 +41,10 @@ var getThemeHtmlAttrs = function getThemeHtmlAttrs() {
|
|
|
42
41
|
dark: dark,
|
|
43
42
|
light: light,
|
|
44
43
|
shape: shape,
|
|
45
|
-
spacing
|
|
44
|
+
// Load spacing by default
|
|
45
|
+
spacing: spacing || 'spacing',
|
|
46
46
|
typography: typography
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
// Load spacing by default, currently behind a feature flag
|
|
50
|
-
if (getBooleanFF('platform.design-system-team.space-and-shape-tokens_q5me6')) {
|
|
51
|
-
themePreferences = {
|
|
52
|
-
dark: dark,
|
|
53
|
-
light: light,
|
|
54
|
-
shape: shape,
|
|
55
|
-
spacing: 'spacing',
|
|
56
|
-
typography: typography
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
48
|
var themeAttribute = themeObjectToString(themePreferences);
|
|
60
49
|
var result = (_result = {}, _defineProperty(_result, THEME_DATA_ATTRIBUTE, themeAttribute), _defineProperty(_result, COLOR_MODE_ATTRIBUTE, colorMode === 'auto' ? defaultColorMode : colorMode), _result);
|
|
61
50
|
if (UNSAFE_themeOptions && isValidBrandHex(UNSAFE_themeOptions.brandColor)) {
|
|
@@ -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.
|
|
4
|
+
var version = "1.20.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.
|
package/dist/esm/get-token.js
CHANGED
|
@@ -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.
|
|
5
|
+
var version = "1.20.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.
|
|
@@ -19,7 +19,7 @@ export function findMissingCustomStyleElements(UNSAFE_themeOptions, mode) {
|
|
|
19
19
|
return attrOfMissingCustomStyles;
|
|
20
20
|
}
|
|
21
21
|
export function limitSizeOfCustomStyleElements(sizeThreshold) {
|
|
22
|
-
var styleTags = _toConsumableArray(document.head.querySelectorAll("style[".concat(CUSTOM_THEME_ATTRIBUTE, "][").concat(THEME_DATA_ATTRIBUTE, "]")));
|
|
22
|
+
var styleTags = _toConsumableArray(Array.from(document.head.querySelectorAll("style[".concat(CUSTOM_THEME_ATTRIBUTE, "][").concat(THEME_DATA_ATTRIBUTE, "]"))));
|
|
23
23
|
if (styleTags.length < sizeThreshold) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -17,11 +17,9 @@ export var getThemePreferences = function getThemePreferences(themeState) {
|
|
|
17
17
|
themePreferences.push("".concat(themePreferences.includes('dark') ? 'dark' : 'light', "-new-input-border"));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
// Load
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
themePreferences.push('spacing');
|
|
24
|
-
}
|
|
20
|
+
// Load spacing by default
|
|
21
|
+
if (!themePreferences.includes('spacing')) {
|
|
22
|
+
themePreferences.push('spacing');
|
|
25
23
|
}
|
|
26
24
|
return _toConsumableArray(new Set(themePreferences));
|
|
27
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tokens",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.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/"
|
|
@@ -111,9 +111,6 @@
|
|
|
111
111
|
"platform-feature-flags": {
|
|
112
112
|
"platform.design-system-team.border-checkbox_nyoiu": {
|
|
113
113
|
"type": "boolean"
|
|
114
|
-
},
|
|
115
|
-
"platform.design-system-team.space-and-shape-tokens_q5me6": {
|
|
116
|
-
"type": "boolean"
|
|
117
114
|
}
|
|
118
115
|
},
|
|
119
116
|
"homepage": "https://atlassian.design/components/tokens",
|