@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
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { isDecendantOfType, hasImportDeclaration } from '@codeshift/utils';
|
|
5
|
+
import { isDecendantOfToken, isParentOfToken } from './utils/ast';
|
|
5
6
|
import { cleanMeta, getMetaFromAncestors } from './utils/ast-meta';
|
|
6
7
|
import { includesHardCodedColor, isHardCodedColor, isLegacyColor, isLegacyNamedColor } from './utils/color';
|
|
7
8
|
import Search from './utils/fuzzy-search';
|
|
8
9
|
import { legacyColorMetaMap } from './utils/legacy-colors';
|
|
9
10
|
import { tokens } from './utils/tokens';
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
return path.node.source.value === sourcePath;
|
|
19
|
-
}).find(j.ImportSpecifier, {
|
|
20
|
-
local: {
|
|
21
|
-
name: specifier
|
|
22
|
-
}
|
|
23
|
-
}).length;
|
|
11
|
+
var kebabize = function kebabize(str) {
|
|
12
|
+
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, function ($, ofs) {
|
|
13
|
+
return (ofs ? '-' : '') + $.toLowerCase();
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
function isBoldColor(color) {
|
|
17
|
+
var number = parseInt(color.replace(/^./, ''), 10);
|
|
18
|
+
return number > 300;
|
|
24
19
|
}
|
|
25
20
|
function insertTokenImport(j, source) {
|
|
26
21
|
if (hasImportDeclaration(j, source, '@atlaskit/tokens')) {
|
|
@@ -33,10 +28,106 @@ function buildToken(j, tokenId, node) {
|
|
|
33
28
|
var callExpr = j.callExpression(j.identifier('token'), [j.stringLiteral(tokenId), node].filter(Boolean));
|
|
34
29
|
return callExpr;
|
|
35
30
|
}
|
|
36
|
-
function
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
function getColorFromIdentifier(expression) {
|
|
32
|
+
var value = '';
|
|
33
|
+
if (expression.type === 'Identifier') {
|
|
34
|
+
value = expression.name;
|
|
35
|
+
}
|
|
36
|
+
if (expression.type === 'StringLiteral') {
|
|
37
|
+
value = expression.value;
|
|
38
|
+
}
|
|
39
|
+
if (expression.type === 'MemberExpression' && expression.object.name === 'colors' && isLegacyColor(expression.property.name)) {
|
|
40
|
+
value = expression.property.name;
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function getTokenFromNode(j, path, value, propertyName) {
|
|
45
|
+
var valueMeta = cleanMeta(legacyColorMetaMap[value] || []);
|
|
46
|
+
var ancestorMeta = cleanMeta([].concat(_toConsumableArray(getMetaFromAncestors(j, path)), _toConsumableArray(kebabize(propertyName).split('-'))) || []);
|
|
47
|
+
var property = cleanMeta([kebabize(propertyName)])[0];
|
|
48
|
+
|
|
49
|
+
// Attempt to find a property from ancestors if one is not found
|
|
50
|
+
if (!property || !['border', 'icon', 'background', 'text'].includes(property)) {
|
|
51
|
+
if (ancestorMeta.includes('border')) {
|
|
52
|
+
property = 'border';
|
|
53
|
+
}
|
|
54
|
+
if (ancestorMeta.includes('icon')) {
|
|
55
|
+
property = 'icon';
|
|
56
|
+
}
|
|
57
|
+
if (ancestorMeta.includes('background')) {
|
|
58
|
+
property = 'background';
|
|
59
|
+
}
|
|
60
|
+
if (ancestorMeta.includes('color')) {
|
|
61
|
+
property = 'text';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var meta = [];
|
|
65
|
+
var possibleTokens = tokens;
|
|
66
|
+
if (property === 'text') {
|
|
67
|
+
possibleTokens = tokens.filter(function (token) {
|
|
68
|
+
return token.includes('.text');
|
|
69
|
+
});
|
|
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.apply(meta, ['color'].concat(_toConsumableArray(ancestorMeta), _toConsumableArray(valueMeta)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (property === 'background' || property === 'background-color') {
|
|
86
|
+
if (ancestorMeta.includes('disabled')) {
|
|
87
|
+
// disabled backgrounds
|
|
88
|
+
meta.push.apply(meta, [property].concat(_toConsumableArray(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.apply(meta, ['surface'].concat(_toConsumableArray(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.filter(function (token) {
|
|
106
|
+
return token.includes('.border') || token.includes('.focus');
|
|
107
|
+
});
|
|
108
|
+
if (valueMeta.includes('neutral')) {
|
|
109
|
+
// standard netural boarder
|
|
110
|
+
meta.push.apply(meta, ['color', 'border'].concat(_toConsumableArray(ancestorMeta)));
|
|
111
|
+
} else {
|
|
112
|
+
meta.push.apply(meta, ['border'].concat(_toConsumableArray(valueMeta), _toConsumableArray(ancestorMeta)));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (ancestorMeta.includes('icon')) {
|
|
116
|
+
possibleTokens = tokens.filter(function (token) {
|
|
117
|
+
return token.includes('.icon');
|
|
118
|
+
});
|
|
119
|
+
if (ancestorMeta.includes('disabled')) {
|
|
120
|
+
// disabled backgrounds
|
|
121
|
+
meta.push('disabled');
|
|
122
|
+
}
|
|
123
|
+
meta.push.apply(meta, ['color', 'icon'].concat(_toConsumableArray(valueMeta)));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Fallback if guided behavior yields nothing
|
|
127
|
+
if (meta.length === 0) {
|
|
128
|
+
meta.push.apply(meta, [property].concat(_toConsumableArray(valueMeta), _toConsumableArray(ancestorMeta)));
|
|
129
|
+
}
|
|
130
|
+
var search = Search(possibleTokens, false);
|
|
40
131
|
var results = search.get(meta.join(' '));
|
|
41
132
|
var tokenId = ['MISSING_TOKEN'];
|
|
42
133
|
if (results) {
|
|
@@ -46,74 +137,102 @@ function getTokenFromNode(j, path) {
|
|
|
46
137
|
}
|
|
47
138
|
return tokenId[0];
|
|
48
139
|
}
|
|
140
|
+
function parseCSSPropertyName(cssString) {
|
|
141
|
+
var lastColonIndex = cssString.lastIndexOf(':');
|
|
142
|
+
var propertyNameEndIndex = Math.max(cssString.lastIndexOf(';', lastColonIndex), cssString.lastIndexOf(' ', lastColonIndex));
|
|
143
|
+
return cssString.slice(propertyNameEndIndex + 1, lastColonIndex).trim();
|
|
144
|
+
}
|
|
49
145
|
export default function transformer(file, api) {
|
|
50
146
|
var debug = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
51
147
|
var j = api.jscodeshift;
|
|
52
148
|
var source = j(file.source);
|
|
53
149
|
var transformed = false;
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
.find(j.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
150
|
+
|
|
151
|
+
// Objects
|
|
152
|
+
source.find(j.ObjectProperty).forEach(function (path) {
|
|
153
|
+
if (path.value.value.type === 'ObjectExpression') {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Avoid transforming objects that are default arguments
|
|
158
|
+
if (path.parent.parent.value.type === 'ArrowFunctionExpression' || path.parent.parent.value.type === 'FunctionDeclaration') {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (isParentOfToken(j, path.value.value)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
var value = getColorFromIdentifier(path.value.value);
|
|
165
|
+
if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
var key;
|
|
169
|
+
if (path.value.key.type === 'NumericLiteral' || path.value.key.type === 'StringLiteral') {
|
|
170
|
+
key = path.value.key.value.toString();
|
|
171
|
+
}
|
|
172
|
+
if (path.value.key.type === 'Identifier') {
|
|
173
|
+
key = path.value.key.name;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Key is a node type we do not support
|
|
177
|
+
if (!key) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
var tokenId = getTokenFromNode(j, path, value, key);
|
|
78
181
|
insertTokenImport(j, source);
|
|
79
|
-
|
|
80
|
-
var tokenId = getTokenFromNode(j, valuePath, colorMeta);
|
|
81
|
-
j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, valuePath.value)));
|
|
182
|
+
j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, path.value.value)));
|
|
82
183
|
transformed = true;
|
|
83
184
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
185
|
+
|
|
186
|
+
// Template literals
|
|
187
|
+
source.find(j.TemplateLiteral).forEach(function (path) {
|
|
188
|
+
function replaceTemplateLiteralExpressions(j, expression, index) {
|
|
189
|
+
if (isDecendantOfToken(j, expression)) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (index >= path.value.quasis.length) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
var quasi = path.value.quasis[index];
|
|
196
|
+
var value = getColorFromIdentifier(expression.value);
|
|
197
|
+
if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
var tokenId = getTokenFromNode(j, expression, value, parseCSSPropertyName(quasi.value.cooked || ''));
|
|
201
|
+
insertTokenImport(j, source);
|
|
202
|
+
expression.replace(buildToken(j, tokenId, expression.value));
|
|
203
|
+
}
|
|
204
|
+
j(path).find(j.Identifier).filter(function (expression) {
|
|
205
|
+
return !isDecendantOfType(j, expression, j.MemberExpression);
|
|
206
|
+
}).forEach(function (expression, i) {
|
|
207
|
+
return replaceTemplateLiteralExpressions(j, expression, i);
|
|
208
|
+
});
|
|
209
|
+
j(path).find(j.MemberExpression).forEach(function (expression, i) {
|
|
210
|
+
return replaceTemplateLiteralExpressions(j, expression, i);
|
|
211
|
+
});
|
|
98
212
|
transformed = true;
|
|
99
213
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return !isDecendantOfToken(j, path);
|
|
104
|
-
}).forEach(function (path) {
|
|
214
|
+
|
|
215
|
+
// JSX props
|
|
216
|
+
source.find(j.JSXAttribute).forEach(function (path) {
|
|
105
217
|
var _path$value, _path$value$value;
|
|
106
|
-
|
|
218
|
+
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') {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (isParentOfToken(j, path)) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
var expression = path.value.value.expression;
|
|
225
|
+
var value = getColorFromIdentifier(expression);
|
|
226
|
+
if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
var tokenId = getTokenFromNode(j, path, value, path.value.name.name);
|
|
107
230
|
insertTokenImport(j, source);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
j(path).replaceWith(isDecendantOfType(j, path, j.JSXAttribute) ? j.jsxExpressionContainer(tokenNode) : tokenNode);
|
|
231
|
+
j(path).find(j.JSXExpressionContainer).forEach(function (path) {
|
|
232
|
+
var tokenNode = buildToken(j, tokenId, path.value.expression);
|
|
233
|
+
j(path).replaceWith(j.jsxExpressionContainer(tokenNode));
|
|
234
|
+
});
|
|
113
235
|
transformed = true;
|
|
114
236
|
});
|
|
115
|
-
|
|
116
|
-
return source.toSource();
|
|
117
|
-
}
|
|
118
|
-
return file.source;
|
|
237
|
+
return transformed ? source.toSource() : file.source;
|
|
119
238
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { getClosestDecendantOfType } from './ast';
|
|
2
3
|
import { getUniqueWordsFromTokens } from './tokens';
|
|
3
4
|
export function getMetaFromAncestors(j, path) {
|
|
4
5
|
var meta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -35,10 +36,16 @@ export function getMetaFromAncestors(j, path) {
|
|
|
35
36
|
meta.push(propertyName);
|
|
36
37
|
}
|
|
37
38
|
if (parent && parent.value.type === 'JSXAttribute') {
|
|
38
|
-
if (!['css', 'styles', 'style'].includes(parent.value.name.name)) {
|
|
39
|
+
if (!['css', 'styles', 'style', 'fill', 'stopColor', 'startColor'].includes(parent.value.name.name)) {
|
|
39
40
|
meta.push(parent.value.name.name);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
var closestJSXElement = getClosestDecendantOfType(j, path, j.JSXOpeningElement);
|
|
44
|
+
if (closestJSXElement) {
|
|
45
|
+
var jsxElementName = closestJSXElement.value.name.name;
|
|
46
|
+
var nameComponents = jsxElementName.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
|
|
47
|
+
meta.push.apply(meta, _toConsumableArray(nameComponents));
|
|
48
|
+
}
|
|
42
49
|
if (parent && parent.value.type === 'VariableDeclarator') {
|
|
43
50
|
meta.push(parent.value.id.name);
|
|
44
51
|
}
|
|
@@ -53,7 +60,8 @@ export function cleanMeta(meta) {
|
|
|
53
60
|
return e.toLowerCase();
|
|
54
61
|
}) : []));
|
|
55
62
|
}, []).reduce(function (accum, val) {
|
|
56
|
-
|
|
63
|
+
var 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');
|
|
64
|
+
accum.push.apply(accum, _toConsumableArray(cleanVal.split(' ')));
|
|
57
65
|
return accum;
|
|
58
66
|
}, []).filter(function (val) {
|
|
59
67
|
return getUniqueWordsFromTokens.includes(val);
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
import { isDecendantOfType } from '@codeshift/utils';
|
|
1
2
|
export function isDecendantOfToken(j, path) {
|
|
3
|
+
if (path.type === 'CallExpression' && path.callee.type === 'Identifier' && path.callee.name === 'token') {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
2
6
|
return j(path).closest(j.CallExpression, {
|
|
3
7
|
callee: {
|
|
4
8
|
name: 'token'
|
|
5
9
|
}
|
|
6
10
|
}).length > 0;
|
|
7
11
|
}
|
|
8
|
-
export function
|
|
9
|
-
|
|
12
|
+
export function isParentOfToken(j, path) {
|
|
13
|
+
if (path.type === 'CallExpression' && path.callee.type === 'Identifier' && path.callee.name === 'token') {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return j(path).find(j.CallExpression, {
|
|
17
|
+
callee: {
|
|
18
|
+
name: 'token'
|
|
19
|
+
}
|
|
20
|
+
}).length > 0;
|
|
21
|
+
}
|
|
22
|
+
export function getClosestDecendantOfType(j, path, type) {
|
|
23
|
+
if (!isDecendantOfType(j, path, type)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return j(path).closest(type).get();
|
|
10
27
|
}
|
|
@@ -5,16 +5,16 @@ export var legacyColorMetaMap = {
|
|
|
5
5
|
R75: ['danger'],
|
|
6
6
|
R100: ['danger'],
|
|
7
7
|
R200: ['danger'],
|
|
8
|
-
R300: ['danger'],
|
|
9
|
-
R400: ['danger'],
|
|
10
|
-
R500: ['danger'],
|
|
8
|
+
R300: ['danger', 'bold'],
|
|
9
|
+
R400: ['danger', 'bold'],
|
|
10
|
+
R500: ['danger', 'bold'],
|
|
11
11
|
Y50: ['warning'],
|
|
12
12
|
Y75: ['warning'],
|
|
13
13
|
Y100: ['warning'],
|
|
14
14
|
Y200: ['warning'],
|
|
15
|
-
Y300: ['warning'],
|
|
16
|
-
Y400: ['warning'],
|
|
17
|
-
Y500: ['warning'],
|
|
15
|
+
Y300: ['warning', 'bold'],
|
|
16
|
+
Y400: ['warning', 'bold'],
|
|
17
|
+
Y500: ['warning', 'bold'],
|
|
18
18
|
G50: ['success'],
|
|
19
19
|
G75: ['success'],
|
|
20
20
|
G100: ['success'],
|
|
@@ -22,20 +22,20 @@ export var legacyColorMetaMap = {
|
|
|
22
22
|
G300: ['success'],
|
|
23
23
|
G400: ['success'],
|
|
24
24
|
G500: ['success'],
|
|
25
|
-
B50: ['
|
|
26
|
-
B75: ['
|
|
27
|
-
B100: ['
|
|
28
|
-
B200: ['
|
|
29
|
-
B300: ['
|
|
30
|
-
B400: ['
|
|
31
|
-
B500: ['
|
|
25
|
+
B50: ['information'],
|
|
26
|
+
B75: ['information'],
|
|
27
|
+
B100: ['information'],
|
|
28
|
+
B200: ['information'],
|
|
29
|
+
B300: ['information', 'bold'],
|
|
30
|
+
B400: ['information', 'bold'],
|
|
31
|
+
B500: ['information', 'bold'],
|
|
32
32
|
P50: ['discovery'],
|
|
33
33
|
P75: ['discovery'],
|
|
34
34
|
P100: ['discovery'],
|
|
35
35
|
P200: ['discovery'],
|
|
36
|
-
P300: ['discovery'],
|
|
37
|
-
P400: ['discovery'],
|
|
38
|
-
P500: ['discovery'],
|
|
36
|
+
P300: ['discovery', 'bold'],
|
|
37
|
+
P400: ['discovery', 'bold'],
|
|
38
|
+
P500: ['discovery', 'bold'],
|
|
39
39
|
T50: ['accent', 'teal'],
|
|
40
40
|
T75: ['accent', 'teal'],
|
|
41
41
|
T100: ['accent', 'teal'],
|
|
@@ -44,9 +44,24 @@ export var legacyColorMetaMap = {
|
|
|
44
44
|
T400: ['accent', 'teal'],
|
|
45
45
|
T500: ['accent', 'teal'],
|
|
46
46
|
N0: ['inverse'],
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
N10: ['neutral'],
|
|
48
|
+
N20: ['neutral'],
|
|
49
|
+
N30: ['neutral'],
|
|
50
|
+
N40: ['neutral'],
|
|
51
|
+
N50: ['neutral'],
|
|
52
|
+
N60: ['neutral'],
|
|
53
|
+
N70: ['neutral'],
|
|
54
|
+
N80: ['neutral'],
|
|
55
|
+
N90: ['neutral'],
|
|
56
|
+
N100: ['neutral'],
|
|
57
|
+
N200: ['neutral'],
|
|
58
|
+
N300: ['neutral'],
|
|
59
|
+
N400: ['neutral'],
|
|
60
|
+
N500: ['neutral'],
|
|
61
|
+
N600: ['neutral'],
|
|
62
|
+
N700: ['neutral'],
|
|
63
|
+
N800: ['neutral'],
|
|
64
|
+
N900: ['neutral'],
|
|
50
65
|
background: ['background', 'default'],
|
|
51
66
|
backgroundActive: ['background', 'pressed'],
|
|
52
67
|
backgroundHover: ['background', 'hovered'],
|
|
@@ -70,5 +85,6 @@ export var legacyColorMetaMap = {
|
|
|
70
85
|
yellow: ['accent', 'orange'],
|
|
71
86
|
green: ['accent', 'green'],
|
|
72
87
|
grey: ['background', 'neutral'],
|
|
73
|
-
skeleton: ['
|
|
88
|
+
skeleton: ['skeleton'],
|
|
89
|
+
white: ['inverse']
|
|
74
90
|
};
|
|
@@ -5,7 +5,7 @@ export var tokens = rawTokens.filter(function (t) {
|
|
|
5
5
|
}).map(function (t) {
|
|
6
6
|
return t.name.replace(/\.\[default\]/g, '');
|
|
7
7
|
}).filter(function (t) {
|
|
8
|
-
return !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart');
|
|
8
|
+
return !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart') && !t.includes('elevation.shadow.overflow');
|
|
9
9
|
});
|
|
10
10
|
export var getUniqueWordsFromTokens = tokens.reduce(function (accum, val) {
|
|
11
11
|
return [].concat(_toConsumableArray(accum), _toConsumableArray(val.split('.')));
|
package/dist/esm/version.json
CHANGED
package/dist/types/main.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import core from 'jscodeshift';
|
|
2
|
-
export declare function isDecendantOfToken(j: core.JSCodeshift, path:
|
|
3
|
-
export declare function
|
|
1
|
+
import core, { ASTNode, ASTPath } from 'jscodeshift';
|
|
2
|
+
export declare function isDecendantOfToken(j: core.JSCodeshift, path: ASTNode): boolean;
|
|
3
|
+
export declare function isParentOfToken(j: core.JSCodeshift, path: any): boolean;
|
|
4
|
+
export declare function getClosestDecendantOfType(j: core.JSCodeshift, path: ASTPath, type: any): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import core from 'jscodeshift';
|
|
2
|
-
export declare function isDecendantOfToken(j: core.JSCodeshift, path:
|
|
3
|
-
export declare function
|
|
1
|
+
import core, { ASTNode, ASTPath } from 'jscodeshift';
|
|
2
|
+
export declare function isDecendantOfToken(j: core.JSCodeshift, path: ASTNode): boolean;
|
|
3
|
+
export declare function isParentOfToken(j: core.JSCodeshift, path: any): boolean;
|
|
4
|
+
export declare function getClosestDecendantOfType(j: core.JSCodeshift, path: ASTPath, type: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/codemod-cli",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "A cli for distributing codemods for atlassian-frontend components and services",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/tokens": "^1.5.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
|
-
"@codeshift/utils": "^0.2.
|
|
37
|
+
"@codeshift/utils": "^0.2.4",
|
|
38
38
|
"@types/jscodeshift": "^0.11.0",
|
|
39
39
|
"chalk": "^4.1.2",
|
|
40
40
|
"enquirer": "^2.3.4",
|
package/report.api.md
CHANGED