@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,21 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { isDecendantOfType, hasImportDeclaration } from '@codeshift/utils';
|
|
4
|
+
import { isDecendantOfToken, isParentOfToken } from './utils/ast';
|
|
4
5
|
import { cleanMeta, getMetaFromAncestors } from './utils/ast-meta';
|
|
5
6
|
import { includesHardCodedColor, isHardCodedColor, isLegacyColor, isLegacyNamedColor } from './utils/color';
|
|
6
7
|
import Search from './utils/fuzzy-search';
|
|
7
8
|
import { legacyColorMetaMap } from './utils/legacy-colors';
|
|
8
9
|
import { tokens } from './utils/tokens';
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function hasImportSpecifier(j, source, specifier, sourcePath) {
|
|
14
|
-
return !!source.find(j.ImportDeclaration).filter(path => path.node.source.value === sourcePath).find(j.ImportSpecifier, {
|
|
15
|
-
local: {
|
|
16
|
-
name: specifier
|
|
17
|
-
}
|
|
18
|
-
}).length;
|
|
10
|
+
const kebabize = str => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
|
|
11
|
+
function isBoldColor(color) {
|
|
12
|
+
const number = parseInt(color.replace(/^./, ''), 10);
|
|
13
|
+
return number > 300;
|
|
19
14
|
}
|
|
20
15
|
function insertTokenImport(j, source) {
|
|
21
16
|
if (hasImportDeclaration(j, source, '@atlaskit/tokens')) {
|
|
@@ -28,9 +23,100 @@ function buildToken(j, tokenId, node) {
|
|
|
28
23
|
const callExpr = j.callExpression(j.identifier('token'), [j.stringLiteral(tokenId), node].filter(Boolean));
|
|
29
24
|
return callExpr;
|
|
30
25
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
function getColorFromIdentifier(expression) {
|
|
27
|
+
let value = '';
|
|
28
|
+
if (expression.type === 'Identifier') {
|
|
29
|
+
value = expression.name;
|
|
30
|
+
}
|
|
31
|
+
if (expression.type === 'StringLiteral') {
|
|
32
|
+
value = expression.value;
|
|
33
|
+
}
|
|
34
|
+
if (expression.type === 'MemberExpression' && expression.object.name === 'colors' && isLegacyColor(expression.property.name)) {
|
|
35
|
+
value = expression.property.name;
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
function getTokenFromNode(j, path, value, propertyName) {
|
|
40
|
+
const valueMeta = cleanMeta(legacyColorMetaMap[value] || []);
|
|
41
|
+
const ancestorMeta = cleanMeta([...getMetaFromAncestors(j, path), ...kebabize(propertyName).split('-')] || []);
|
|
42
|
+
let property = cleanMeta([kebabize(propertyName)])[0];
|
|
43
|
+
|
|
44
|
+
// Attempt to find a property from ancestors if one is not found
|
|
45
|
+
if (!property || !['border', 'icon', 'background', 'text'].includes(property)) {
|
|
46
|
+
if (ancestorMeta.includes('border')) {
|
|
47
|
+
property = 'border';
|
|
48
|
+
}
|
|
49
|
+
if (ancestorMeta.includes('icon')) {
|
|
50
|
+
property = 'icon';
|
|
51
|
+
}
|
|
52
|
+
if (ancestorMeta.includes('background')) {
|
|
53
|
+
property = 'background';
|
|
54
|
+
}
|
|
55
|
+
if (ancestorMeta.includes('color')) {
|
|
56
|
+
property = 'text';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let meta = [];
|
|
60
|
+
let possibleTokens = tokens;
|
|
61
|
+
if (property === 'text') {
|
|
62
|
+
possibleTokens = tokens.filter(token => token.includes('.text'));
|
|
63
|
+
if (valueMeta.includes('neutral')) {
|
|
64
|
+
meta.push('color', 'text');
|
|
65
|
+
}
|
|
66
|
+
if (valueMeta.includes('neutral') && (value === 'N400' || value === 'N500')) {
|
|
67
|
+
meta.push('color', 'text', 'subtle');
|
|
68
|
+
}
|
|
69
|
+
if (valueMeta.includes('neutral') && (value === 'N80' || value === 'N100' || value === 'N200' || value === 'N300' || value === 'N400')) {
|
|
70
|
+
meta.push('color', 'text', 'subtlest');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// handle non-neutrals
|
|
74
|
+
if (!valueMeta.includes('neutral')) {
|
|
75
|
+
meta.push('color', ...ancestorMeta, ...valueMeta);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (property === 'background' || property === 'background-color') {
|
|
79
|
+
if (ancestorMeta.includes('disabled')) {
|
|
80
|
+
// disabled backgrounds
|
|
81
|
+
meta.push(property, ...ancestorMeta);
|
|
82
|
+
} else if (
|
|
83
|
+
// Surfaces
|
|
84
|
+
valueMeta.includes('neutral') && value !== 'N100' && value !== 'N200' && value !== 'N300' && value !== 'N400' && value !== 'N500' && value !== 'N600' && value !== 'N700' && value !== 'N800') {
|
|
85
|
+
meta.push('surface', ...ancestorMeta);
|
|
86
|
+
} else if (value.includes('N0')) {
|
|
87
|
+
// default surface
|
|
88
|
+
meta.push('elevation', 'surface');
|
|
89
|
+
} else if (valueMeta.includes('neutral') && isBoldColor(value)) {
|
|
90
|
+
// bold netural backgrounds
|
|
91
|
+
meta.push('background', 'neutral', 'bold');
|
|
92
|
+
} else if (valueMeta.includes('neutral')) {
|
|
93
|
+
// netural backgrounds
|
|
94
|
+
meta.push('background', 'neutral');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (property === 'border' || property === 'border-color' || property === 'border-left' || property === 'border-right' || property === 'border-top' || property === 'border-bottom' || property === 'outline' || property === 'outline-color') {
|
|
98
|
+
possibleTokens = tokens.filter(token => token.includes('.border') || token.includes('.focus'));
|
|
99
|
+
if (valueMeta.includes('neutral')) {
|
|
100
|
+
// standard netural boarder
|
|
101
|
+
meta.push('color', 'border', ...ancestorMeta);
|
|
102
|
+
} else {
|
|
103
|
+
meta.push('border', ...valueMeta, ...ancestorMeta);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (ancestorMeta.includes('icon')) {
|
|
107
|
+
possibleTokens = tokens.filter(token => token.includes('.icon'));
|
|
108
|
+
if (ancestorMeta.includes('disabled')) {
|
|
109
|
+
// disabled backgrounds
|
|
110
|
+
meta.push('disabled');
|
|
111
|
+
}
|
|
112
|
+
meta.push('color', 'icon', ...valueMeta);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Fallback if guided behavior yields nothing
|
|
116
|
+
if (meta.length === 0) {
|
|
117
|
+
meta.push(property, ...valueMeta, ...ancestorMeta);
|
|
118
|
+
}
|
|
119
|
+
const search = Search(possibleTokens, false);
|
|
34
120
|
const results = search.get(meta.join(' '));
|
|
35
121
|
let tokenId = ['MISSING_TOKEN'];
|
|
36
122
|
if (results) {
|
|
@@ -38,53 +124,95 @@ function getTokenFromNode(j, path, baseMeta = []) {
|
|
|
38
124
|
}
|
|
39
125
|
return tokenId[0];
|
|
40
126
|
}
|
|
127
|
+
function parseCSSPropertyName(cssString) {
|
|
128
|
+
const lastColonIndex = cssString.lastIndexOf(':');
|
|
129
|
+
const propertyNameEndIndex = Math.max(cssString.lastIndexOf(';', lastColonIndex), cssString.lastIndexOf(' ', lastColonIndex));
|
|
130
|
+
return cssString.slice(propertyNameEndIndex + 1, lastColonIndex).trim();
|
|
131
|
+
}
|
|
41
132
|
export default function transformer(file, api, debug = false) {
|
|
42
133
|
const j = api.jscodeshift;
|
|
43
134
|
const source = j(file.source);
|
|
44
135
|
let transformed = false;
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
.find(j.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
136
|
+
|
|
137
|
+
// Objects
|
|
138
|
+
source.find(j.ObjectProperty).forEach(path => {
|
|
139
|
+
if (path.value.value.type === 'ObjectExpression') {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Avoid transforming objects that are default arguments
|
|
144
|
+
if (path.parent.parent.value.type === 'ArrowFunctionExpression' || path.parent.parent.value.type === 'FunctionDeclaration') {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (isParentOfToken(j, path.value.value)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const value = getColorFromIdentifier(path.value.value);
|
|
151
|
+
if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
let key;
|
|
155
|
+
if (path.value.key.type === 'NumericLiteral' || path.value.key.type === 'StringLiteral') {
|
|
156
|
+
key = path.value.key.value.toString();
|
|
157
|
+
}
|
|
158
|
+
if (path.value.key.type === 'Identifier') {
|
|
159
|
+
key = path.value.key.name;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Key is a node type we do not support
|
|
163
|
+
if (!key) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const tokenId = getTokenFromNode(j, path, value, key);
|
|
61
167
|
insertTokenImport(j, source);
|
|
62
|
-
|
|
63
|
-
const tokenId = getTokenFromNode(j, valuePath, colorMeta);
|
|
64
|
-
j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, valuePath.value)));
|
|
168
|
+
j(path).replaceWith(j.objectProperty(path.value.key, buildToken(j, tokenId, path.value.value)));
|
|
65
169
|
transformed = true;
|
|
66
170
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
171
|
+
|
|
172
|
+
// Template literals
|
|
173
|
+
source.find(j.TemplateLiteral).forEach(path => {
|
|
174
|
+
function replaceTemplateLiteralExpressions(j, expression, index) {
|
|
175
|
+
if (isDecendantOfToken(j, expression)) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (index >= path.value.quasis.length) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const quasi = path.value.quasis[index];
|
|
182
|
+
const value = getColorFromIdentifier(expression.value);
|
|
183
|
+
if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const tokenId = getTokenFromNode(j, expression, value, parseCSSPropertyName(quasi.value.cooked || ''));
|
|
187
|
+
insertTokenImport(j, source);
|
|
188
|
+
expression.replace(buildToken(j, tokenId, expression.value));
|
|
189
|
+
}
|
|
190
|
+
j(path).find(j.Identifier).filter(expression => !isDecendantOfType(j, expression, j.MemberExpression)).forEach((expression, i) => replaceTemplateLiteralExpressions(j, expression, i));
|
|
191
|
+
j(path).find(j.MemberExpression).forEach((expression, i) => replaceTemplateLiteralExpressions(j, expression, i));
|
|
73
192
|
transformed = true;
|
|
74
193
|
});
|
|
75
|
-
|
|
194
|
+
|
|
195
|
+
// JSX props
|
|
196
|
+
source.find(j.JSXAttribute).forEach(path => {
|
|
76
197
|
var _path$value, _path$value$value;
|
|
77
|
-
|
|
198
|
+
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') {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (isParentOfToken(j, path)) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const expression = path.value.value.expression;
|
|
205
|
+
const value = getColorFromIdentifier(expression);
|
|
206
|
+
if (!value || !includesHardCodedColor(value) && !isHardCodedColor(value) && !isLegacyColor(value) && !isLegacyNamedColor(value)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const tokenId = getTokenFromNode(j, path, value, path.value.name.name);
|
|
78
210
|
insertTokenImport(j, source);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
j(path).replaceWith(isDecendantOfType(j, path, j.JSXAttribute) ? j.jsxExpressionContainer(tokenNode) : tokenNode);
|
|
211
|
+
j(path).find(j.JSXExpressionContainer).forEach(path => {
|
|
212
|
+
const tokenNode = buildToken(j, tokenId, path.value.expression);
|
|
213
|
+
j(path).replaceWith(j.jsxExpressionContainer(tokenNode));
|
|
214
|
+
});
|
|
84
215
|
transformed = true;
|
|
85
216
|
});
|
|
86
|
-
|
|
87
|
-
return source.toSource();
|
|
88
|
-
}
|
|
89
|
-
return file.source;
|
|
217
|
+
return transformed ? source.toSource() : file.source;
|
|
90
218
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getClosestDecendantOfType } from './ast';
|
|
1
2
|
import { getUniqueWordsFromTokens } from './tokens';
|
|
2
3
|
export function getMetaFromAncestors(j, path, meta = []) {
|
|
3
4
|
const parent = path.parentPath;
|
|
@@ -27,10 +28,16 @@ export function getMetaFromAncestors(j, path, meta = []) {
|
|
|
27
28
|
meta.push(propertyName);
|
|
28
29
|
}
|
|
29
30
|
if (parent && parent.value.type === 'JSXAttribute') {
|
|
30
|
-
if (!['css', 'styles', 'style'].includes(parent.value.name.name)) {
|
|
31
|
+
if (!['css', 'styles', 'style', 'fill', 'stopColor', 'startColor'].includes(parent.value.name.name)) {
|
|
31
32
|
meta.push(parent.value.name.name);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
const closestJSXElement = getClosestDecendantOfType(j, path, j.JSXOpeningElement);
|
|
36
|
+
if (closestJSXElement) {
|
|
37
|
+
const jsxElementName = closestJSXElement.value.name.name;
|
|
38
|
+
const nameComponents = jsxElementName.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
|
|
39
|
+
meta.push(...nameComponents);
|
|
40
|
+
}
|
|
34
41
|
if (parent && parent.value.type === 'VariableDeclarator') {
|
|
35
42
|
meta.push(parent.value.id.name);
|
|
36
43
|
}
|
|
@@ -41,11 +48,10 @@ export function getMetaFromAncestors(j, path, meta = []) {
|
|
|
41
48
|
}
|
|
42
49
|
export function cleanMeta(meta) {
|
|
43
50
|
return meta.reduce((accum, val) => [...accum, ...(typeof val === 'string' ? val.split(/(?=[A-Z])/g).map(e => e.toLowerCase()) : [])], []).reduce((accum, val) => {
|
|
44
|
-
|
|
51
|
+
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');
|
|
52
|
+
accum.push(...cleanVal.split(' '));
|
|
45
53
|
return accum;
|
|
46
|
-
}, []).filter(val => {
|
|
47
|
-
return getUniqueWordsFromTokens.includes(val);
|
|
48
|
-
}).reduce((accum, val) => {
|
|
54
|
+
}, []).filter(val => getUniqueWordsFromTokens.includes(val)).reduce((accum, val) => {
|
|
49
55
|
if (!accum.includes(val)) {
|
|
50
56
|
accum.push(val);
|
|
51
57
|
}
|
|
@@ -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 const 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 const 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 const 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 const 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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { light as rawTokens } from '@atlaskit/tokens/tokens-raw';
|
|
2
|
-
export const tokens = rawTokens.filter(t => t.attributes.state === 'active').map(t => t.name.replace(/\.\[default\]/g, '')).filter(t => !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart'));
|
|
2
|
+
export const tokens = rawTokens.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'));
|
|
3
3
|
export 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) => {
|
|
4
4
|
if (!accum.includes(val)) {
|
|
5
5
|
accum.push(val);
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/main.js
CHANGED
|
@@ -289,7 +289,7 @@ function _main() {
|
|
|
289
289
|
case 4:
|
|
290
290
|
_yield$parseArgs = _context5.sent;
|
|
291
291
|
packages = _yield$parseArgs.packages;
|
|
292
|
-
_process$env$_PACKAGE = "0.13.
|
|
292
|
+
_process$env$_PACKAGE = "0.13.2", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
|
|
293
293
|
logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
|
|
294
294
|
if (packages && packages.length > 0) {
|
|
295
295
|
logger.log(chalk.gray("Searching for codemods for newer versions of the following packages: ".concat(packages.map(function (pkg) {
|