@atlaskit/tokens 10.1.0 → 11.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 +10 -0
- package/dist/cjs/artifacts/theme-import-map.js +1 -13
- package/dist/cjs/babel-plugin/plugin.js +3 -7
- package/dist/cjs/entry-points/tokens-raw.js +0 -7
- package/dist/cjs/theme-config.js +1 -19
- package/dist/cjs/theme-state-transformer.js +4 -4
- package/dist/es2019/artifacts/theme-import-map.js +1 -5
- package/dist/es2019/babel-plugin/plugin.js +4 -7
- package/dist/es2019/entry-points/tokens-raw.js +0 -1
- package/dist/es2019/theme-config.js +1 -19
- package/dist/es2019/theme-state-transformer.js +4 -4
- package/dist/esm/artifacts/theme-import-map.js +1 -9
- package/dist/esm/babel-plugin/plugin.js +3 -7
- package/dist/esm/entry-points/tokens-raw.js +0 -1
- package/dist/esm/theme-config.js +1 -19
- package/dist/esm/theme-state-transformer.js +4 -4
- package/dist/types/artifacts/theme-import-map.d.ts +1 -1
- package/dist/types/babel-plugin/plugin.d.ts +1 -1
- package/dist/types/entry-points/tokens-raw.d.ts +0 -1
- package/dist/types/theme-config.d.ts +6 -6
- package/dist/types/theme-state-transformer.d.ts +4 -4
- package/dist/types-ts4.5/artifacts/theme-import-map.d.ts +1 -1
- package/dist/types-ts4.5/babel-plugin/plugin.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/tokens-raw.d.ts +0 -1
- package/dist/types-ts4.5/theme-config.d.ts +4 -8
- package/dist/types-ts4.5/theme-state-transformer.d.ts +4 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/tokens
|
|
2
2
|
|
|
3
|
+
## 11.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`2abd451d54eb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2abd451d54eb2) -
|
|
8
|
+
Removes atlassian-legacy-light/dark color themes from the tokens package. These themes are unused
|
|
9
|
+
and non-functional in terms of color contrast. As a result some primitive components may recieve
|
|
10
|
+
modern fallback color values in some scenarios, however these are inline with the latest token
|
|
11
|
+
themes.
|
|
12
|
+
|
|
3
13
|
## 10.1.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -15,7 +15,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
15
15
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
16
16
|
* When a new theme is created, the import should automatically be added to the map
|
|
17
17
|
*
|
|
18
|
-
* @codegen <<SignedSource::
|
|
18
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
19
19
|
* @codegenCommand yarn build tokens
|
|
20
20
|
*/
|
|
21
21
|
|
|
@@ -56,18 +56,6 @@ var themeImportsMap = {
|
|
|
56
56
|
'./themes/atlassian-dark-increased-contrast'));
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
|
-
'legacy-light': function legacyLight() {
|
|
60
|
-
return Promise.resolve().then(function () {
|
|
61
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-light" */
|
|
62
|
-
'./themes/atlassian-legacy-light'));
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
'legacy-dark': function legacyDark() {
|
|
66
|
-
return Promise.resolve().then(function () {
|
|
67
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-dark" */
|
|
68
|
-
'./themes/atlassian-legacy-dark'));
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
59
|
'spacing': function spacing() {
|
|
72
60
|
return Promise.resolve().then(function () {
|
|
73
61
|
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_atlassian-spacing" */
|
|
@@ -10,7 +10,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var t = _interopRequireWildcard(require("@babel/types"));
|
|
12
12
|
var _tokenNames = _interopRequireDefault(require("../artifacts/token-names"));
|
|
13
|
-
var _atlassianLegacyLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-legacy-light"));
|
|
14
13
|
var _atlassianLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light"));
|
|
15
14
|
var _atlassianShape = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-shape"));
|
|
16
15
|
var _atlassianSpacing = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-spacing"));
|
|
@@ -125,7 +124,7 @@ function plugin() {
|
|
|
125
124
|
// if no fallback is set, optionally find one from the default theme
|
|
126
125
|
if (path.node.arguments.length < 2) {
|
|
127
126
|
if (state.opts.shouldUseAutoFallback !== false) {
|
|
128
|
-
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName
|
|
127
|
+
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName), ")"));
|
|
129
128
|
} else {
|
|
130
129
|
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ")"));
|
|
131
130
|
}
|
|
@@ -136,7 +135,7 @@ function plugin() {
|
|
|
136
135
|
var forceAutoFallbackExemptions = ['radius'].concat((0, _toConsumableArray2.default)(state.opts.forceAutoFallbackExemptions || []));
|
|
137
136
|
|
|
138
137
|
// Handle fallbacks
|
|
139
|
-
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName
|
|
138
|
+
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName)) : path.node.arguments[1];
|
|
140
139
|
if (t.isStringLiteral(fallback)) {
|
|
141
140
|
// String literals can be concatenated into css variable call
|
|
142
141
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
|
@@ -194,12 +193,10 @@ function plugin() {
|
|
|
194
193
|
};
|
|
195
194
|
}
|
|
196
195
|
var lightValues = getThemeValues(_atlassianLight.default);
|
|
197
|
-
var legacyLightValues = getThemeValues(_atlassianLegacyLight.default);
|
|
198
196
|
var shapeValues = getThemeValues(_atlassianShape.default);
|
|
199
197
|
var spacingValues = getThemeValues(_atlassianSpacing.default);
|
|
200
198
|
var typographyValues = getThemeValues(_atlassianTypography.default);
|
|
201
199
|
function getDefaultFallback(tokenName) {
|
|
202
|
-
var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
|
|
203
200
|
if (shapeValues[tokenName]) {
|
|
204
201
|
return shapeValues[tokenName];
|
|
205
202
|
}
|
|
@@ -209,8 +206,7 @@ function getDefaultFallback(tokenName) {
|
|
|
209
206
|
if (typographyValues[tokenName]) {
|
|
210
207
|
return typographyValues[tokenName];
|
|
211
208
|
}
|
|
212
|
-
|
|
213
|
-
return colorValues[tokenName];
|
|
209
|
+
return lightValues[tokenName];
|
|
214
210
|
}
|
|
215
211
|
function getNonAliasedImportName(node) {
|
|
216
212
|
if (t.isIdentifier(node.imported)) {
|
|
@@ -10,12 +10,6 @@ Object.defineProperty(exports, "dark", {
|
|
|
10
10
|
return _atlassianDark.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "legacyLightTokens", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _atlassianLegacyLight.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
13
|
Object.defineProperty(exports, "light", {
|
|
20
14
|
enumerable: true,
|
|
21
15
|
get: function get() {
|
|
@@ -41,7 +35,6 @@ Object.defineProperty(exports, "typography", {
|
|
|
41
35
|
}
|
|
42
36
|
});
|
|
43
37
|
var _atlassianLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-light"));
|
|
44
|
-
var _atlassianLegacyLight = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-legacy-light"));
|
|
45
38
|
var _atlassianDark = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-dark"));
|
|
46
39
|
var _atlassianSpacing = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-spacing"));
|
|
47
40
|
var _atlassianTypography = _interopRequireDefault(require("../artifacts/tokens-raw/atlassian-typography"));
|
package/dist/cjs/theme-config.js
CHANGED
|
@@ -45,7 +45,7 @@ var themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
|
45
45
|
*
|
|
46
46
|
* These ids must be kebab case
|
|
47
47
|
*/
|
|
48
|
-
var themeIds = exports.themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', '
|
|
48
|
+
var themeIds = exports.themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography'];
|
|
49
49
|
/**
|
|
50
50
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
51
51
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
@@ -131,24 +131,6 @@ var themeConfig = {
|
|
|
131
131
|
extends: 'dark',
|
|
132
132
|
increasesContrastFor: 'dark'
|
|
133
133
|
},
|
|
134
|
-
'atlassian-legacy-light': {
|
|
135
|
-
id: 'legacy-light',
|
|
136
|
-
displayName: 'Light Theme (legacy)',
|
|
137
|
-
palette: 'legacyPalette',
|
|
138
|
-
attributes: {
|
|
139
|
-
type: 'color',
|
|
140
|
-
mode: 'light'
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
'atlassian-legacy-dark': {
|
|
144
|
-
id: 'legacy-dark',
|
|
145
|
-
displayName: 'Dark Theme (legacy)',
|
|
146
|
-
palette: 'legacyPalette',
|
|
147
|
-
attributes: {
|
|
148
|
-
type: 'color',
|
|
149
|
-
mode: 'dark'
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
134
|
'atlassian-spacing': {
|
|
153
135
|
id: 'spacing',
|
|
154
136
|
displayName: 'Atlassian Spacing',
|
|
@@ -31,8 +31,8 @@ var isColorMode = function isColorMode(modeId) {
|
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```
|
|
34
|
-
* themeStringToObject('dark:dark light:
|
|
35
|
-
* // returns { dark: 'dark', light: '
|
|
34
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
35
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
var themeStringToObject = exports.themeStringToObject = function themeStringToObject(themeState) {
|
|
@@ -69,8 +69,8 @@ var themeStringToObject = exports.themeStringToObject = function themeStringToOb
|
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
71
|
* ```
|
|
72
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
73
|
-
* // returns 'dark:dark light:
|
|
72
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
73
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
var themeObjectToString = exports.themeObjectToString = function themeObjectToString(themeState) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -23,10 +23,6 @@ const themeImportsMap = {
|
|
|
23
23
|
'./themes/atlassian-dark-future'),
|
|
24
24
|
'dark-increased-contrast': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-dark-increased-contrast" */
|
|
25
25
|
'./themes/atlassian-dark-increased-contrast'),
|
|
26
|
-
'legacy-light': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-light" */
|
|
27
|
-
'./themes/atlassian-legacy-light'),
|
|
28
|
-
'legacy-dark': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-dark" */
|
|
29
|
-
'./themes/atlassian-legacy-dark'),
|
|
30
26
|
'spacing': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-spacing" */
|
|
31
27
|
'./themes/atlassian-spacing'),
|
|
32
28
|
'typography': () => import( /* webpackChunkName: "@atlaskit-internal_atlassian-typography" */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
2
|
import tokenNames from '../artifacts/token-names';
|
|
3
|
-
import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
4
3
|
import light from '../artifacts/tokens-raw/atlassian-light';
|
|
5
4
|
import shape from '../artifacts/tokens-raw/atlassian-shape';
|
|
6
5
|
import spacing from '../artifacts/tokens-raw/atlassian-spacing';
|
|
@@ -102,7 +101,7 @@ export default function plugin() {
|
|
|
102
101
|
// if no fallback is set, optionally find one from the default theme
|
|
103
102
|
if (path.node.arguments.length < 2) {
|
|
104
103
|
if (state.opts.shouldUseAutoFallback !== false) {
|
|
105
|
-
replacementNode = t.stringLiteral(`var(${cssTokenValue}, ${getDefaultFallback(tokenName
|
|
104
|
+
replacementNode = t.stringLiteral(`var(${cssTokenValue}, ${getDefaultFallback(tokenName)})`);
|
|
106
105
|
} else {
|
|
107
106
|
replacementNode = t.stringLiteral(`var(${cssTokenValue})`);
|
|
108
107
|
}
|
|
@@ -113,7 +112,7 @@ export default function plugin() {
|
|
|
113
112
|
const forceAutoFallbackExemptions = ['radius', ...(state.opts.forceAutoFallbackExemptions || [])];
|
|
114
113
|
|
|
115
114
|
// Handle fallbacks
|
|
116
|
-
const fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName
|
|
115
|
+
const fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName)) : path.node.arguments[1];
|
|
117
116
|
if (t.isStringLiteral(fallback)) {
|
|
118
117
|
// String literals can be concatenated into css variable call
|
|
119
118
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
|
@@ -171,11 +170,10 @@ export default function plugin() {
|
|
|
171
170
|
};
|
|
172
171
|
}
|
|
173
172
|
const lightValues = getThemeValues(light);
|
|
174
|
-
const legacyLightValues = getThemeValues(legacyLight);
|
|
175
173
|
const shapeValues = getThemeValues(shape);
|
|
176
174
|
const spacingValues = getThemeValues(spacing);
|
|
177
175
|
const typographyValues = getThemeValues(typography);
|
|
178
|
-
function getDefaultFallback(tokenName
|
|
176
|
+
function getDefaultFallback(tokenName) {
|
|
179
177
|
if (shapeValues[tokenName]) {
|
|
180
178
|
return shapeValues[tokenName];
|
|
181
179
|
}
|
|
@@ -185,8 +183,7 @@ function getDefaultFallback(tokenName, theme = 'light') {
|
|
|
185
183
|
if (typographyValues[tokenName]) {
|
|
186
184
|
return typographyValues[tokenName];
|
|
187
185
|
}
|
|
188
|
-
|
|
189
|
-
return colorValues[tokenName];
|
|
186
|
+
return lightValues[tokenName];
|
|
190
187
|
}
|
|
191
188
|
function getNonAliasedImportName(node) {
|
|
192
189
|
if (t.isIdentifier(node.imported)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
|
@@ -40,7 +40,7 @@ const themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
|
40
40
|
*
|
|
41
41
|
* These ids must be kebab case
|
|
42
42
|
*/
|
|
43
|
-
export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', '
|
|
43
|
+
export const themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography'];
|
|
44
44
|
/**
|
|
45
45
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
46
46
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
@@ -126,24 +126,6 @@ const themeConfig = {
|
|
|
126
126
|
extends: 'dark',
|
|
127
127
|
increasesContrastFor: 'dark'
|
|
128
128
|
},
|
|
129
|
-
'atlassian-legacy-light': {
|
|
130
|
-
id: 'legacy-light',
|
|
131
|
-
displayName: 'Light Theme (legacy)',
|
|
132
|
-
palette: 'legacyPalette',
|
|
133
|
-
attributes: {
|
|
134
|
-
type: 'color',
|
|
135
|
-
mode: 'light'
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
'atlassian-legacy-dark': {
|
|
139
|
-
id: 'legacy-dark',
|
|
140
|
-
displayName: 'Dark Theme (legacy)',
|
|
141
|
-
palette: 'legacyPalette',
|
|
142
|
-
attributes: {
|
|
143
|
-
type: 'color',
|
|
144
|
-
mode: 'dark'
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
129
|
'atlassian-spacing': {
|
|
148
130
|
id: 'spacing',
|
|
149
131
|
displayName: 'Atlassian Spacing',
|
|
@@ -18,8 +18,8 @@ const isColorMode = modeId => {
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```
|
|
21
|
-
* themeStringToObject('dark:dark light:
|
|
22
|
-
* // returns { dark: 'dark', light: '
|
|
21
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
22
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export const themeStringToObject = themeState => {
|
|
@@ -51,8 +51,8 @@ export const themeStringToObject = themeState => {
|
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```
|
|
54
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
55
|
-
* // returns 'dark:dark light:
|
|
54
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
55
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
export const themeObjectToString = themeState => Object.entries(themeState).reduce((themeString, [kind, id]) => {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -35,14 +35,6 @@ var themeImportsMap = {
|
|
|
35
35
|
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-dark-increased-contrast" */
|
|
36
36
|
'./themes/atlassian-dark-increased-contrast');
|
|
37
37
|
},
|
|
38
|
-
'legacy-light': function legacyLight() {
|
|
39
|
-
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-light" */
|
|
40
|
-
'./themes/atlassian-legacy-light');
|
|
41
|
-
},
|
|
42
|
-
'legacy-dark': function legacyDark() {
|
|
43
|
-
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-legacy-dark" */
|
|
44
|
-
'./themes/atlassian-legacy-dark');
|
|
45
|
-
},
|
|
46
38
|
'spacing': function spacing() {
|
|
47
39
|
return import( /* webpackChunkName: "@atlaskit-internal_atlassian-spacing" */
|
|
48
40
|
'./themes/atlassian-spacing');
|
|
@@ -7,7 +7,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
7
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; }
|
|
8
8
|
import * as t from '@babel/types';
|
|
9
9
|
import tokenNames from '../artifacts/token-names';
|
|
10
|
-
import legacyLight from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
11
10
|
import light from '../artifacts/tokens-raw/atlassian-light';
|
|
12
11
|
import shape from '../artifacts/tokens-raw/atlassian-shape';
|
|
13
12
|
import spacing from '../artifacts/tokens-raw/atlassian-spacing';
|
|
@@ -116,7 +115,7 @@ export default function plugin() {
|
|
|
116
115
|
// if no fallback is set, optionally find one from the default theme
|
|
117
116
|
if (path.node.arguments.length < 2) {
|
|
118
117
|
if (state.opts.shouldUseAutoFallback !== false) {
|
|
119
|
-
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName
|
|
118
|
+
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ", ").concat(getDefaultFallback(tokenName), ")"));
|
|
120
119
|
} else {
|
|
121
120
|
replacementNode = t.stringLiteral("var(".concat(cssTokenValue, ")"));
|
|
122
121
|
}
|
|
@@ -127,7 +126,7 @@ export default function plugin() {
|
|
|
127
126
|
var forceAutoFallbackExemptions = ['radius'].concat(_toConsumableArray(state.opts.forceAutoFallbackExemptions || []));
|
|
128
127
|
|
|
129
128
|
// Handle fallbacks
|
|
130
|
-
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName
|
|
129
|
+
var fallback = state.opts.shouldForceAutoFallback !== false && !isExempted(tokenName, forceAutoFallbackExemptions) ? t.stringLiteral(getDefaultFallback(tokenName)) : path.node.arguments[1];
|
|
131
130
|
if (t.isStringLiteral(fallback)) {
|
|
132
131
|
// String literals can be concatenated into css variable call
|
|
133
132
|
// Empty string fallbacks are ignored. For now, as the user did specify a fallback, no default is inserted
|
|
@@ -185,12 +184,10 @@ export default function plugin() {
|
|
|
185
184
|
};
|
|
186
185
|
}
|
|
187
186
|
var lightValues = getThemeValues(light);
|
|
188
|
-
var legacyLightValues = getThemeValues(legacyLight);
|
|
189
187
|
var shapeValues = getThemeValues(shape);
|
|
190
188
|
var spacingValues = getThemeValues(spacing);
|
|
191
189
|
var typographyValues = getThemeValues(typography);
|
|
192
190
|
function getDefaultFallback(tokenName) {
|
|
193
|
-
var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
|
|
194
191
|
if (shapeValues[tokenName]) {
|
|
195
192
|
return shapeValues[tokenName];
|
|
196
193
|
}
|
|
@@ -200,8 +197,7 @@ function getDefaultFallback(tokenName) {
|
|
|
200
197
|
if (typographyValues[tokenName]) {
|
|
201
198
|
return typographyValues[tokenName];
|
|
202
199
|
}
|
|
203
|
-
|
|
204
|
-
return colorValues[tokenName];
|
|
200
|
+
return lightValues[tokenName];
|
|
205
201
|
}
|
|
206
202
|
function getNonAliasedImportName(node) {
|
|
207
203
|
if (t.isIdentifier(node.imported)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
package/dist/esm/theme-config.js
CHANGED
|
@@ -40,7 +40,7 @@ var themeContrastModes = ['more', 'no-preference', 'auto'];
|
|
|
40
40
|
*
|
|
41
41
|
* These ids must be kebab case
|
|
42
42
|
*/
|
|
43
|
-
export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', '
|
|
43
|
+
export var themeIds = ['light-increased-contrast', 'light', 'light-future', 'dark', 'dark-future', 'dark-increased-contrast', 'spacing', 'shape', 'typography'];
|
|
44
44
|
/**
|
|
45
45
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
46
46
|
* Theme overrides are temporary and there may not be any defined at times.
|
|
@@ -126,24 +126,6 @@ var themeConfig = {
|
|
|
126
126
|
extends: 'dark',
|
|
127
127
|
increasesContrastFor: 'dark'
|
|
128
128
|
},
|
|
129
|
-
'atlassian-legacy-light': {
|
|
130
|
-
id: 'legacy-light',
|
|
131
|
-
displayName: 'Light Theme (legacy)',
|
|
132
|
-
palette: 'legacyPalette',
|
|
133
|
-
attributes: {
|
|
134
|
-
type: 'color',
|
|
135
|
-
mode: 'light'
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
'atlassian-legacy-dark': {
|
|
139
|
-
id: 'legacy-dark',
|
|
140
|
-
displayName: 'Dark Theme (legacy)',
|
|
141
|
-
palette: 'legacyPalette',
|
|
142
|
-
attributes: {
|
|
143
|
-
type: 'color',
|
|
144
|
-
mode: 'dark'
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
129
|
'atlassian-spacing': {
|
|
148
130
|
id: 'spacing',
|
|
149
131
|
displayName: 'Atlassian Spacing',
|
|
@@ -24,8 +24,8 @@ var isColorMode = function isColorMode(modeId) {
|
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```
|
|
27
|
-
* themeStringToObject('dark:dark light:
|
|
28
|
-
* // returns { dark: 'dark', light: '
|
|
27
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
28
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
export var themeStringToObject = function themeStringToObject(themeState) {
|
|
@@ -62,8 +62,8 @@ export var themeStringToObject = function themeStringToObject(themeState) {
|
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* ```
|
|
65
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
66
|
-
* // returns 'dark:dark light:
|
|
65
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
66
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
69
|
export var themeObjectToString = function themeObjectToString(themeState) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
import { type ThemeIds, type ThemeOverrideIds } from '../theme-config';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* These ids are what the actual theme files/folders are called.
|
|
7
7
|
* style-dictionary will attempt to locate these in the file-system.
|
|
8
8
|
*/
|
|
9
|
-
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-
|
|
9
|
+
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-shape' | 'atlassian-spacing' | 'atlassian-typography';
|
|
10
10
|
export type ThemeFileNames = Themes;
|
|
11
11
|
/**
|
|
12
12
|
* ThemeOverrides: The internal identifier of a theme override. Which are themes that contain
|
|
@@ -42,7 +42,7 @@ export type DataContrastModes = 'more' | 'no-preference' | 'auto';
|
|
|
42
42
|
*
|
|
43
43
|
* These ids must be kebab case
|
|
44
44
|
*/
|
|
45
|
-
export declare const themeIds: readonly ["light-increased-contrast", "light", "light-future", "dark", "dark-future", "dark-increased-contrast", "
|
|
45
|
+
export declare const themeIds: readonly ["light-increased-contrast", "light", "light-future", "dark", "dark-future", "dark-increased-contrast", "spacing", "shape", "typography"];
|
|
46
46
|
export type ThemeIds = (typeof themeIds)[number];
|
|
47
47
|
/**
|
|
48
48
|
* Theme override ids: the equivalent of themeIds for theme overrides.
|
|
@@ -50,7 +50,7 @@ export type ThemeIds = (typeof themeIds)[number];
|
|
|
50
50
|
*/
|
|
51
51
|
declare const themeOverrideIds: readonly [];
|
|
52
52
|
export type ThemeOverrideIds = (typeof themeOverrideIds)[number];
|
|
53
|
-
export declare const themeIdsWithOverrides: readonly ["light-increased-contrast", "light", "light-future", "dark", "dark-future", "dark-increased-contrast", "
|
|
53
|
+
export declare const themeIdsWithOverrides: readonly ["light-increased-contrast", "light", "light-future", "dark", "dark-future", "dark-increased-contrast", "spacing", "shape", "typography"];
|
|
54
54
|
export type ThemeIdsWithOverrides = (typeof themeIdsWithOverrides)[number];
|
|
55
55
|
/**
|
|
56
56
|
* Theme to use a base. This will create the theme as
|
|
@@ -63,7 +63,7 @@ type ExtensionThemeId = ThemeIds;
|
|
|
63
63
|
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
64
64
|
* previous color set.
|
|
65
65
|
*/
|
|
66
|
-
export type Palettes = 'defaultPalette' | '
|
|
66
|
+
export type Palettes = 'defaultPalette' | 'spacingScale' | 'shapePalette' | 'typographyPalette';
|
|
67
67
|
/**
|
|
68
68
|
* ThemeConfig: the source of truth for all theme meta-data.
|
|
69
69
|
* This object should be used whenever interfacing with themes.
|
|
@@ -115,8 +115,8 @@ export interface ThemeOptionsSchema {
|
|
|
115
115
|
* ThemeState: the standard representation of an app's current theme and preferences
|
|
116
116
|
*/
|
|
117
117
|
export interface ThemeState {
|
|
118
|
-
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
119
|
-
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
118
|
+
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
119
|
+
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
120
120
|
colorMode: ThemeColorModes;
|
|
121
121
|
contrastMode: ThemeContrastModes;
|
|
122
122
|
shape?: Extract<ThemeIds, 'shape'>;
|
|
@@ -7,8 +7,8 @@ import { type ThemeState } from './theme-config';
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```
|
|
10
|
-
* themeStringToObject('dark:dark light:
|
|
11
|
-
* // returns { dark: 'dark', light: '
|
|
10
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
11
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export declare const themeStringToObject: (themeState: string) => Partial<ThemeState>;
|
|
@@ -19,8 +19,8 @@ export declare const themeStringToObject: (themeState: string) => Partial<ThemeS
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```
|
|
22
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
23
|
-
* // returns 'dark:dark light:
|
|
22
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
23
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export declare const themeObjectToString: (themeState: Partial<ThemeState>) => string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows users to compose their themes and only use the tokens that are requested.
|
|
7
7
|
* When a new theme is created, the import should automatically be added to the map
|
|
8
8
|
*
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::c1144182e959da59d17686bccb9fac30>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
import { type ThemeIds, type ThemeOverrideIds } from '../theme-config';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as light } from '../artifacts/tokens-raw/atlassian-light';
|
|
2
|
-
export { default as legacyLightTokens } from '../artifacts/tokens-raw/atlassian-legacy-light';
|
|
3
2
|
export { default as dark } from '../artifacts/tokens-raw/atlassian-dark';
|
|
4
3
|
export { default as spacing } from '../artifacts/tokens-raw/atlassian-spacing';
|
|
5
4
|
export { default as typography } from '../artifacts/tokens-raw/atlassian-typography';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* These ids are what the actual theme files/folders are called.
|
|
7
7
|
* style-dictionary will attempt to locate these in the file-system.
|
|
8
8
|
*/
|
|
9
|
-
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-
|
|
9
|
+
export type Themes = 'atlassian-light' | 'atlassian-light-future' | 'atlassian-light-increased-contrast' | 'atlassian-dark' | 'atlassian-dark-future' | 'atlassian-dark-increased-contrast' | 'atlassian-shape' | 'atlassian-spacing' | 'atlassian-typography';
|
|
10
10
|
export type ThemeFileNames = Themes;
|
|
11
11
|
/**
|
|
12
12
|
* ThemeOverrides: The internal identifier of a theme override. Which are themes that contain
|
|
@@ -57,8 +57,6 @@ export declare const themeIds: readonly [
|
|
|
57
57
|
"dark",
|
|
58
58
|
"dark-future",
|
|
59
59
|
"dark-increased-contrast",
|
|
60
|
-
"legacy-light",
|
|
61
|
-
"legacy-dark",
|
|
62
60
|
"spacing",
|
|
63
61
|
"shape",
|
|
64
62
|
"typography"
|
|
@@ -78,8 +76,6 @@ export declare const themeIdsWithOverrides: readonly [
|
|
|
78
76
|
"dark",
|
|
79
77
|
"dark-future",
|
|
80
78
|
"dark-increased-contrast",
|
|
81
|
-
"legacy-light",
|
|
82
|
-
"legacy-dark",
|
|
83
79
|
"spacing",
|
|
84
80
|
"shape",
|
|
85
81
|
"typography"
|
|
@@ -96,7 +92,7 @@ type ExtensionThemeId = ThemeIds;
|
|
|
96
92
|
* For example: legacy light & dark themes use the "legacyPalette" containing colors from our
|
|
97
93
|
* previous color set.
|
|
98
94
|
*/
|
|
99
|
-
export type Palettes = 'defaultPalette' | '
|
|
95
|
+
export type Palettes = 'defaultPalette' | 'spacingScale' | 'shapePalette' | 'typographyPalette';
|
|
100
96
|
/**
|
|
101
97
|
* ThemeConfig: the source of truth for all theme meta-data.
|
|
102
98
|
* This object should be used whenever interfacing with themes.
|
|
@@ -148,8 +144,8 @@ export interface ThemeOptionsSchema {
|
|
|
148
144
|
* ThemeState: the standard representation of an app's current theme and preferences
|
|
149
145
|
*/
|
|
150
146
|
export interface ThemeState {
|
|
151
|
-
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
152
|
-
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | '
|
|
147
|
+
light: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
148
|
+
dark: Extract<ThemeIds, 'light' | 'light-future' | 'dark' | 'dark-future' | 'light-increased-contrast' | 'dark-increased-contrast'>;
|
|
153
149
|
colorMode: ThemeColorModes;
|
|
154
150
|
contrastMode: ThemeContrastModes;
|
|
155
151
|
shape?: Extract<ThemeIds, 'shape'>;
|
|
@@ -7,8 +7,8 @@ import { type ThemeState } from './theme-config';
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```
|
|
10
|
-
* themeStringToObject('dark:dark light:
|
|
11
|
-
* // returns { dark: 'dark', light: '
|
|
10
|
+
* themeStringToObject('dark:dark light:light spacing:spacing');
|
|
11
|
+
* // returns { dark: 'dark', light: 'light', spacing: 'spacing' }
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export declare const themeStringToObject: (themeState: string) => Partial<ThemeState>;
|
|
@@ -19,8 +19,8 @@ export declare const themeStringToObject: (themeState: string) => Partial<ThemeS
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```
|
|
22
|
-
* themeObjectToString({ dark: 'dark', light: '
|
|
23
|
-
* // returns 'dark:dark light:
|
|
22
|
+
* themeObjectToString({ dark: 'dark', light: 'light', spacing: 'spacing' });
|
|
23
|
+
* // returns 'dark:dark light:light spacing:spacing'
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export declare const themeObjectToString: (themeState: Partial<ThemeState>) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tokens",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.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/"
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"@atlaskit/form": "^15.3.0",
|
|
56
56
|
"@atlaskit/grid": "^0.18.0",
|
|
57
57
|
"@atlaskit/heading": "^5.2.0",
|
|
58
|
-
"@atlaskit/icon": "^
|
|
58
|
+
"@atlaskit/icon": "^30.0.0",
|
|
59
59
|
"@atlaskit/inline-message": "^15.5.0",
|
|
60
60
|
"@atlaskit/link": "^3.3.0",
|
|
61
61
|
"@atlaskit/lozenge": "^13.3.0",
|
|
62
62
|
"@atlaskit/popup": "^4.13.0",
|
|
63
|
-
"@atlaskit/primitives": "^
|
|
63
|
+
"@atlaskit/primitives": "^18.0.0",
|
|
64
64
|
"@atlaskit/radio": "^8.4.0",
|
|
65
65
|
"@atlaskit/section-message": "^8.12.0",
|
|
66
66
|
"@atlaskit/select": "^21.7.0",
|
|
67
|
-
"@atlaskit/tag": "^14.
|
|
67
|
+
"@atlaskit/tag": "^14.3.0",
|
|
68
68
|
"@atlaskit/textarea": "^8.2.0",
|
|
69
69
|
"@atlaskit/textfield": "^8.2.0",
|
|
70
70
|
"@atlaskit/theme": "^21.0.0",
|