@atlaskit/codemod-cli 0.13.1 → 0.13.2
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 +6 -0
- package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +178 -50
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +11 -5
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +21 -3
- package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +36 -20
- package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +178 -50
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +11 -5
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +19 -2
- package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +36 -20
- package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +194 -75
- package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +10 -2
- package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +19 -2
- package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +36 -20
- package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/main.d.ts +1 -0
- package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +4 -3
- package/dist/types-ts4.5/main.d.ts +1 -0
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast.d.ts +4 -3
- package/package.json +2 -2
- package/report.api.md +2 -0
- package/tmp/api-report-tmp.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
|
+
var _utils = require("@codeshift/utils");
|
|
8
9
|
var _ast = require("./utils/ast");
|
|
9
10
|
var _astMeta = require("./utils/ast-meta");
|
|
10
11
|
var _color = require("./utils/color");
|
|
@@ -13,19 +14,13 @@ var _legacyColors = require("./utils/legacy-colors");
|
|
|
13
14
|
var _tokens = require("./utils/tokens");
|
|
14
15
|
/* eslint-disable no-console */
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function hasImportSpecifier(j, source, specifier, sourcePath) {
|
|
21
|
-
return !!source.find(j.ImportDeclaration).filter(path => path.node.source.value === sourcePath).find(j.ImportSpecifier, {
|
|
22
|
-
local: {
|
|
23
|
-
name: specifier
|
|
24
|
-
}
|
|
25
|
-
}).length;
|
|
17
|
+
const kebabize = str => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
|
|
18
|
+
function isBoldColor(color) {
|
|
19
|
+
const number = parseInt(color.replace(/^./, ''), 10);
|
|
20
|
+
return number > 300;
|
|
26
21
|
}
|
|
27
22
|
function insertTokenImport(j, source) {
|
|
28
|
-
if (hasImportDeclaration(j, source, '@atlaskit/tokens')) {
|
|
23
|
+
if ((0, _utils.hasImportDeclaration)(j, source, '@atlaskit/tokens')) {
|
|
29
24
|
return;
|
|
30
25
|
}
|
|
31
26
|
const newImport = j.importDeclaration([j.importSpecifier(j.identifier('token'))], j.stringLiteral('@atlaskit/tokens'));
|
|
@@ -35,9 +30,100 @@ function buildToken(j, tokenId, node) {
|
|
|
35
30
|
const callExpr = j.callExpression(j.identifier('token'), [j.stringLiteral(tokenId), node].filter(Boolean));
|
|
36
31
|
return callExpr;
|
|
37
32
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
function getColorFromIdentifier(expression) {
|
|
34
|
+
let value = '';
|
|
35
|
+
if (expression.type === 'Identifier') {
|
|
36
|
+
value = expression.name;
|
|
37
|
+
}
|
|
38
|
+
if (expression.type === 'StringLiteral') {
|
|
39
|
+
value = expression.value;
|
|
40
|
+
}
|
|
41
|
+
if (expression.type === 'MemberExpression' && expression.object.name === 'colors' && (0, _color.isLegacyColor)(expression.property.name)) {
|
|
42
|
+
value = expression.property.name;
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function getTokenFromNode(j, path, value, propertyName) {
|
|
47
|
+
const valueMeta = (0, _astMeta.cleanMeta)(_legacyColors.legacyColorMetaMap[value] || []);
|
|
48
|
+
const ancestorMeta = (0, _astMeta.cleanMeta)([...(0, _astMeta.getMetaFromAncestors)(j, path), ...kebabize(propertyName).split('-')] || []);
|
|
49
|
+
let property = (0, _astMeta.cleanMeta)([kebabize(propertyName)])[0];
|
|
50
|
+
|
|
51
|
+
// Attempt to find a property from ancestors if one is not found
|
|
52
|
+
if (!property || !['border', 'icon', 'background', 'text'].includes(property)) {
|
|
53
|
+
if (ancestorMeta.includes('border')) {
|
|
54
|
+
property = 'border';
|
|
55
|
+
}
|
|
56
|
+
if (ancestorMeta.includes('icon')) {
|
|
57
|
+
property = 'icon';
|
|
58
|
+
}
|
|
59
|
+
if (ancestorMeta.includes('background')) {
|
|
60
|
+
property = 'background';
|
|
61
|
+
}
|
|
62
|
+
if (ancestorMeta.includes('color')) {
|
|
63
|
+
property = 'text';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let meta = [];
|
|
67
|
+
let possibleTokens = _tokens.tokens;
|
|
68
|
+
if (property === 'text') {
|
|
69
|
+
possibleTokens = _tokens.tokens.filter(token => token.includes('.text'));
|
|
70
|
+
if (valueMeta.includes('neutral')) {
|
|
71
|
+
meta.push('color', 'text');
|
|
72
|
+
}
|
|
73
|
+
if (valueMeta.includes('neutral') && (value === 'N400' || value === 'N500')) {
|
|
74
|
+
meta.push('color', 'text', 'subtle');
|
|
75
|
+
}
|
|
76
|
+
if (valueMeta.includes('neutral') && (value === 'N80' || value === 'N100' || value === 'N200' || value === 'N300' || value === 'N400')) {
|
|
77
|
+
meta.push('color', 'text', 'subtlest');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// handle non-neutrals
|
|
81
|
+
if (!valueMeta.includes('neutral')) {
|
|
82
|
+
meta.push('color', ...ancestorMeta, ...valueMeta);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (property === 'background' || property === 'background-color') {
|
|
86
|
+
if (ancestorMeta.includes('disabled')) {
|
|
87
|
+
// disabled backgrounds
|
|
88
|
+
meta.push(property, ...ancestorMeta);
|
|
89
|
+
} else if (
|
|
90
|
+
// Surfaces
|
|
91
|
+
valueMeta.includes('neutral') && value !== 'N100' && value !== 'N200' && value !== 'N300' && value !== 'N400' && value !== 'N500' && value !== 'N600' && value !== 'N700' && value !== 'N800') {
|
|
92
|
+
meta.push('surface', ...ancestorMeta);
|
|
93
|
+
} else if (value.includes('N0')) {
|
|
94
|
+
// default surface
|
|
95
|
+
meta.push('elevation', 'surface');
|
|
96
|
+
} else if (valueMeta.includes('neutral') && isBoldColor(value)) {
|
|
97
|
+
// bold netural backgrounds
|
|
98
|
+
meta.push('background', 'neutral', 'bold');
|
|
99
|
+
} else if (valueMeta.includes('neutral')) {
|
|
100
|
+
// netural backgrounds
|
|
101
|
+
meta.push('background', 'neutral');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (property === 'border' || property === 'border-color' || property === 'border-left' || property === 'border-right' || property === 'border-top' || property === 'border-bottom' || property === 'outline' || property === 'outline-color') {
|
|
105
|
+
possibleTokens = _tokens.tokens.filter(token => token.includes('.border') || token.includes('.focus'));
|
|
106
|
+
if (valueMeta.includes('neutral')) {
|
|
107
|
+
// standard netural boarder
|
|
108
|
+
meta.push('color', 'border', ...ancestorMeta);
|
|
109
|
+
} else {
|
|
110
|
+
meta.push('border', ...valueMeta, ...ancestorMeta);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (ancestorMeta.includes('icon')) {
|
|
114
|
+
possibleTokens = _tokens.tokens.filter(token => token.includes('.icon'));
|
|
115
|
+
if (ancestorMeta.includes('disabled')) {
|
|
116
|
+
// disabled backgrounds
|
|
117
|
+
meta.push('disabled');
|
|
118
|
+
}
|
|
119
|
+
meta.push('color', 'icon', ...valueMeta);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Fallback if guided behavior yields nothing
|
|
123
|
+
if (meta.length === 0) {
|
|
124
|
+
meta.push(property, ...valueMeta, ...ancestorMeta);
|
|
125
|
+
}
|
|
126
|
+
const search = (0, _fuzzySearch.default)(possibleTokens, false);
|
|
41
127
|
const results = search.get(meta.join(' '));
|
|
42
128
|
let tokenId = ['MISSING_TOKEN'];
|
|
43
129
|
if (results) {
|
|
@@ -45,53 +131,95 @@ function getTokenFromNode(j, path, baseMeta = []) {
|
|
|
45
131
|
}
|
|
46
132
|
return tokenId[0];
|
|
47
133
|
}
|
|
134
|
+
function parseCSSPropertyName(cssString) {
|
|
135
|
+
const lastColonIndex = cssString.lastIndexOf(':');
|
|
136
|
+
const propertyNameEndIndex = Math.max(cssString.lastIndexOf(';', lastColonIndex), cssString.lastIndexOf(' ', lastColonIndex));
|
|
137
|
+
return cssString.slice(propertyNameEndIndex + 1, lastColonIndex).trim();
|
|
138
|
+
}
|
|
48
139
|
function transformer(file, api, debug = false) {
|
|
49
140
|
const j = api.jscodeshift;
|
|
50
141
|
const source = j(file.source);
|
|
51
142
|
let transformed = false;
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
.find(j.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
143
|
+
|
|
144
|
+
// Objects
|
|
145
|
+
source.find(j.ObjectProperty).forEach(path => {
|
|
146
|
+
if (path.value.value.type === 'ObjectExpression') {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Avoid transforming objects that are default arguments
|
|
151
|
+
if (path.parent.parent.value.type === 'ArrowFunctionExpression' || path.parent.parent.value.type === 'FunctionDeclaration') {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if ((0, _ast.isParentOfToken)(j, path.value.value)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const value = getColorFromIdentifier(path.value.value);
|
|
158
|
+
if (!value || !(0, _color.includesHardCodedColor)(value) && !(0, _color.isHardCodedColor)(value) && !(0, _color.isLegacyColor)(value) && !(0, _color.isLegacyNamedColor)(value)) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
let key;
|
|
162
|
+
if (path.value.key.type === 'NumericLiteral' || path.value.key.type === 'StringLiteral') {
|
|
163
|
+
key = path.value.key.value.toString();
|
|
164
|
+
}
|
|
165
|
+
if (path.value.key.type === 'Identifier') {
|
|
166
|
+
key = path.value.key.name;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Key is a node type we do not support
|
|
170
|
+
if (!key) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const tokenId = getTokenFromNode(j, path, value, key);
|
|
68
174
|
insertTokenImport(j, source);
|
|
69
|
-
|
|
70
|
-
const tokenId = getTokenFromNode(j, valuePath, colorMeta);
|
|
71
|
-
j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, valuePath.value)));
|
|
175
|
+
j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, path.value.value)));
|
|
72
176
|
transformed = true;
|
|
73
177
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
178
|
+
|
|
179
|
+
// Template literals
|
|
180
|
+
source.find(j.TemplateLiteral).forEach(path => {
|
|
181
|
+
function replaceTemplateLiteralExpressions(j, expression, index) {
|
|
182
|
+
if ((0, _ast.isDecendantOfToken)(j, expression)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (index >= path.value.quasis.length) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const quasi = path.value.quasis[index];
|
|
189
|
+
const value = getColorFromIdentifier(expression.value);
|
|
190
|
+
if (!value || !(0, _color.includesHardCodedColor)(value) && !(0, _color.isHardCodedColor)(value) && !(0, _color.isLegacyColor)(value) && !(0, _color.isLegacyNamedColor)(value)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const tokenId = getTokenFromNode(j, expression, value, parseCSSPropertyName(quasi.value.cooked || ''));
|
|
194
|
+
insertTokenImport(j, source);
|
|
195
|
+
expression.replace(buildToken(j, tokenId, expression.value));
|
|
196
|
+
}
|
|
197
|
+
j(path).find(j.Identifier).filter(expression => !(0, _utils.isDecendantOfType)(j, expression, j.MemberExpression)).forEach((expression, i) => replaceTemplateLiteralExpressions(j, expression, i));
|
|
198
|
+
j(path).find(j.MemberExpression).forEach((expression, i) => replaceTemplateLiteralExpressions(j, expression, i));
|
|
80
199
|
transformed = true;
|
|
81
200
|
});
|
|
82
|
-
|
|
201
|
+
|
|
202
|
+
// JSX props
|
|
203
|
+
source.find(j.JSXAttribute).forEach(path => {
|
|
83
204
|
var _path$value, _path$value$value;
|
|
84
|
-
|
|
205
|
+
if (((_path$value = path.value) === null || _path$value === void 0 ? void 0 : (_path$value$value = _path$value.value) === null || _path$value$value === void 0 ? void 0 : _path$value$value.type) !== 'JSXExpressionContainer') {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if ((0, _ast.isParentOfToken)(j, path)) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const expression = path.value.value.expression;
|
|
212
|
+
const value = getColorFromIdentifier(expression);
|
|
213
|
+
if (!value || !(0, _color.includesHardCodedColor)(value) && !(0, _color.isHardCodedColor)(value) && !(0, _color.isLegacyColor)(value) && !(0, _color.isLegacyNamedColor)(value)) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const tokenId = getTokenFromNode(j, path, value, path.value.name.name);
|
|
85
217
|
insertTokenImport(j, source);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
j(path).replaceWith((0, _ast.isDecendantOfType)(j, path, j.JSXAttribute) ? j.jsxExpressionContainer(tokenNode) : tokenNode);
|
|
218
|
+
j(path).find(j.JSXExpressionContainer).forEach(path => {
|
|
219
|
+
const tokenNode = buildToken(j, tokenId, path.value.expression);
|
|
220
|
+
j(path).replaceWith(j.jsxExpressionContainer(tokenNode));
|
|
221
|
+
});
|
|
91
222
|
transformed = true;
|
|
92
223
|
});
|
|
93
|
-
|
|
94
|
-
return source.toSource();
|
|
95
|
-
}
|
|
96
|
-
return file.source;
|
|
224
|
+
return transformed ? source.toSource() : file.source;
|
|
97
225
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.cleanMeta = cleanMeta;
|
|
7
7
|
exports.getMetaFromAncestors = getMetaFromAncestors;
|
|
8
|
+
var _ast = require("./ast");
|
|
8
9
|
var _tokens = require("./tokens");
|
|
9
10
|
function getMetaFromAncestors(j, path, meta = []) {
|
|
10
11
|
const parent = path.parentPath;
|
|
@@ -34,10 +35,16 @@ function getMetaFromAncestors(j, path, meta = []) {
|
|
|
34
35
|
meta.push(propertyName);
|
|
35
36
|
}
|
|
36
37
|
if (parent && parent.value.type === 'JSXAttribute') {
|
|
37
|
-
if (!['css', 'styles', 'style'].includes(parent.value.name.name)) {
|
|
38
|
+
if (!['css', 'styles', 'style', 'fill', 'stopColor', 'startColor'].includes(parent.value.name.name)) {
|
|
38
39
|
meta.push(parent.value.name.name);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
42
|
+
const closestJSXElement = (0, _ast.getClosestDecendantOfType)(j, path, j.JSXOpeningElement);
|
|
43
|
+
if (closestJSXElement) {
|
|
44
|
+
const jsxElementName = closestJSXElement.value.name.name;
|
|
45
|
+
const nameComponents = jsxElementName.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
|
|
46
|
+
meta.push(...nameComponents);
|
|
47
|
+
}
|
|
41
48
|
if (parent && parent.value.type === 'VariableDeclarator') {
|
|
42
49
|
meta.push(parent.value.id.name);
|
|
43
50
|
}
|
|
@@ -48,11 +55,10 @@ function getMetaFromAncestors(j, path, meta = []) {
|
|
|
48
55
|
}
|
|
49
56
|
function cleanMeta(meta) {
|
|
50
57
|
return meta.reduce((accum, val) => [...accum, ...(typeof val === 'string' ? val.split(/(?=[A-Z])/g).map(e => e.toLowerCase()) : [])], []).reduce((accum, val) => {
|
|
51
|
-
|
|
58
|
+
const cleanVal = val.replace(/:/g, '').replace(/,/g, '').replace('grey', 'neutral').replace('skeleton', 'neutral').replace('texts', 'text').replace('red', 'danger').replace('error', 'danger').replace('invalid', 'danger').replace('removed', 'danger').replace('removal', 'danger').replace('remove', 'danger').replace('focus', 'focused').replace('valid', 'success').replace('successful', 'success').replace('risk', 'warning').replace('caution', 'warning').replace('primary', 'bold').replace('secondary', 'subtle').replace('hyperlink', 'link').replace('anchor', 'link').replace('active', 'pressed').replace('hover', 'hovered').replace('card', 'raised').replace('dragged', 'surface overlay').replace('dragging', 'surface overlay').replace('drag', 'surface overlay').replace('background-color', 'background').replace('color', 'text').replace('icons', 'icon').replace('glyph', 'icon').replace('stroke', 'border').replace('border-left', 'border').replace('border-right', 'border').replace('border-top', 'border').replace('border-bottom', 'border').replace('box-shadow', 'shadow');
|
|
59
|
+
accum.push(...cleanVal.split(' '));
|
|
52
60
|
return accum;
|
|
53
|
-
}, []).filter(val => {
|
|
54
|
-
return _tokens.getUniqueWordsFromTokens.includes(val);
|
|
55
|
-
}).reduce((accum, val) => {
|
|
61
|
+
}, []).filter(val => _tokens.getUniqueWordsFromTokens.includes(val)).reduce((accum, val) => {
|
|
56
62
|
if (!accum.includes(val)) {
|
|
57
63
|
accum.push(val);
|
|
58
64
|
}
|
|
@@ -3,15 +3,33 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getClosestDecendantOfType = getClosestDecendantOfType;
|
|
6
7
|
exports.isDecendantOfToken = isDecendantOfToken;
|
|
7
|
-
exports.
|
|
8
|
+
exports.isParentOfToken = isParentOfToken;
|
|
9
|
+
var _utils = require("@codeshift/utils");
|
|
8
10
|
function isDecendantOfToken(j, path) {
|
|
11
|
+
if (path.type === 'CallExpression' && path.callee.type === 'Identifier' && path.callee.name === 'token') {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
9
14
|
return j(path).closest(j.CallExpression, {
|
|
10
15
|
callee: {
|
|
11
16
|
name: 'token'
|
|
12
17
|
}
|
|
13
18
|
}).length > 0;
|
|
14
19
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
20
|
+
function isParentOfToken(j, path) {
|
|
21
|
+
if (path.type === 'CallExpression' && path.callee.type === 'Identifier' && path.callee.name === 'token') {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return j(path).find(j.CallExpression, {
|
|
25
|
+
callee: {
|
|
26
|
+
name: 'token'
|
|
27
|
+
}
|
|
28
|
+
}).length > 0;
|
|
29
|
+
}
|
|
30
|
+
function getClosestDecendantOfType(j, path, type) {
|
|
31
|
+
if (!(0, _utils.isDecendantOfType)(j, path, type)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
return j(path).closest(type).get();
|
|
17
35
|
}
|
|
@@ -13,16 +13,16 @@ const legacyColorMetaMap = {
|
|
|
13
13
|
R75: ['danger'],
|
|
14
14
|
R100: ['danger'],
|
|
15
15
|
R200: ['danger'],
|
|
16
|
-
R300: ['danger'],
|
|
17
|
-
R400: ['danger'],
|
|
18
|
-
R500: ['danger'],
|
|
16
|
+
R300: ['danger', 'bold'],
|
|
17
|
+
R400: ['danger', 'bold'],
|
|
18
|
+
R500: ['danger', 'bold'],
|
|
19
19
|
Y50: ['warning'],
|
|
20
20
|
Y75: ['warning'],
|
|
21
21
|
Y100: ['warning'],
|
|
22
22
|
Y200: ['warning'],
|
|
23
|
-
Y300: ['warning'],
|
|
24
|
-
Y400: ['warning'],
|
|
25
|
-
Y500: ['warning'],
|
|
23
|
+
Y300: ['warning', 'bold'],
|
|
24
|
+
Y400: ['warning', 'bold'],
|
|
25
|
+
Y500: ['warning', 'bold'],
|
|
26
26
|
G50: ['success'],
|
|
27
27
|
G75: ['success'],
|
|
28
28
|
G100: ['success'],
|
|
@@ -30,20 +30,20 @@ const legacyColorMetaMap = {
|
|
|
30
30
|
G300: ['success'],
|
|
31
31
|
G400: ['success'],
|
|
32
32
|
G500: ['success'],
|
|
33
|
-
B50: ['
|
|
34
|
-
B75: ['
|
|
35
|
-
B100: ['
|
|
36
|
-
B200: ['
|
|
37
|
-
B300: ['
|
|
38
|
-
B400: ['
|
|
39
|
-
B500: ['
|
|
33
|
+
B50: ['information'],
|
|
34
|
+
B75: ['information'],
|
|
35
|
+
B100: ['information'],
|
|
36
|
+
B200: ['information'],
|
|
37
|
+
B300: ['information', 'bold'],
|
|
38
|
+
B400: ['information', 'bold'],
|
|
39
|
+
B500: ['information', 'bold'],
|
|
40
40
|
P50: ['discovery'],
|
|
41
41
|
P75: ['discovery'],
|
|
42
42
|
P100: ['discovery'],
|
|
43
43
|
P200: ['discovery'],
|
|
44
|
-
P300: ['discovery'],
|
|
45
|
-
P400: ['discovery'],
|
|
46
|
-
P500: ['discovery'],
|
|
44
|
+
P300: ['discovery', 'bold'],
|
|
45
|
+
P400: ['discovery', 'bold'],
|
|
46
|
+
P500: ['discovery', 'bold'],
|
|
47
47
|
T50: ['accent', 'teal'],
|
|
48
48
|
T75: ['accent', 'teal'],
|
|
49
49
|
T100: ['accent', 'teal'],
|
|
@@ -52,9 +52,24 @@ const legacyColorMetaMap = {
|
|
|
52
52
|
T400: ['accent', 'teal'],
|
|
53
53
|
T500: ['accent', 'teal'],
|
|
54
54
|
N0: ['inverse'],
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
N10: ['neutral'],
|
|
56
|
+
N20: ['neutral'],
|
|
57
|
+
N30: ['neutral'],
|
|
58
|
+
N40: ['neutral'],
|
|
59
|
+
N50: ['neutral'],
|
|
60
|
+
N60: ['neutral'],
|
|
61
|
+
N70: ['neutral'],
|
|
62
|
+
N80: ['neutral'],
|
|
63
|
+
N90: ['neutral'],
|
|
64
|
+
N100: ['neutral'],
|
|
65
|
+
N200: ['neutral'],
|
|
66
|
+
N300: ['neutral'],
|
|
67
|
+
N400: ['neutral'],
|
|
68
|
+
N500: ['neutral'],
|
|
69
|
+
N600: ['neutral'],
|
|
70
|
+
N700: ['neutral'],
|
|
71
|
+
N800: ['neutral'],
|
|
72
|
+
N900: ['neutral'],
|
|
58
73
|
background: ['background', 'default'],
|
|
59
74
|
backgroundActive: ['background', 'pressed'],
|
|
60
75
|
backgroundHover: ['background', 'hovered'],
|
|
@@ -78,6 +93,7 @@ const legacyColorMetaMap = {
|
|
|
78
93
|
yellow: ['accent', 'orange'],
|
|
79
94
|
green: ['accent', 'green'],
|
|
80
95
|
grey: ['background', 'neutral'],
|
|
81
|
-
skeleton: ['
|
|
96
|
+
skeleton: ['skeleton'],
|
|
97
|
+
white: ['inverse']
|
|
82
98
|
};
|
|
83
99
|
exports.legacyColorMetaMap = legacyColorMetaMap;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.tokens = exports.getUniqueWordsFromTokens = void 0;
|
|
7
7
|
var _tokensRaw = require("@atlaskit/tokens/tokens-raw");
|
|
8
|
-
const tokens = _tokensRaw.light.filter(t => t.attributes.state === 'active').map(t => t.name.replace(/\.\[default\]/g, '')).filter(t => !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart'));
|
|
8
|
+
const tokens = _tokensRaw.light.filter(t => t.attributes.state === 'active').map(t => t.name.replace(/\.\[default\]/g, '')).filter(t => !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart') && !t.includes('elevation.shadow.overflow'));
|
|
9
9
|
exports.tokens = tokens;
|
|
10
10
|
const getUniqueWordsFromTokens = tokens.reduce((accum, val) => [...accum, ...val.split('.')], []).reduce((accum, val) => [...accum, ...val.split(/(?=[A-Z])/g).map(e => e.toLowerCase())], []).reduce((accum, val) => {
|
|
11
11
|
if (!accum.includes(val)) {
|
package/dist/cjs/version.json
CHANGED