@atlaskit/codemod-cli 0.17.10 → 0.19.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 +16 -0
- package/dist/cjs/filepath.js +1 -1
- package/dist/cjs/main.js +1 -1
- package/dist/cjs/presets/index.js +2 -4
- package/dist/cjs/transforms.js +3 -3
- package/dist/es2019/filepath.js +2 -2
- package/dist/es2019/presets/index.js +2 -4
- package/dist/es2019/transforms.js +3 -3
- package/dist/esm/filepath.js +2 -2
- package/dist/esm/main.js +1 -1
- package/dist/esm/presets/index.js +2 -4
- package/dist/esm/transforms.js +3 -3
- package/dist/types/presets/index.d.ts +1 -3
- package/dist/types-ts4.5/presets/index.d.ts +1 -3
- package/package.json +3 -6
- package/dist/cjs/presets/css-to-design-tokens/css-to-design-tokens.js +0 -117
- package/dist/cjs/presets/css-to-design-tokens/lib/colors.js +0 -49
- package/dist/cjs/presets/css-to-design-tokens/lib/declaration.js +0 -29
- package/dist/cjs/presets/css-to-design-tokens/lib/legacy-colors.js +0 -338
- package/dist/cjs/presets/css-to-design-tokens/lib/logger.js +0 -18
- package/dist/cjs/presets/css-to-design-tokens/lib/meta.js +0 -157
- package/dist/cjs/presets/css-to-design-tokens/lib/tokens.js +0 -47
- package/dist/cjs/presets/css-to-design-tokens/lib/value.js +0 -80
- package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -489
- package/dist/cjs/presets/theme-to-design-tokens/types.js +0 -5
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +0 -82
- package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +0 -35
- package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +0 -44
- package/dist/cjs/presets/theme-to-design-tokens/utils/css-utils.js +0 -38
- package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -289
- package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -96
- package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +0 -7
- package/dist/cjs/presets/theme-to-design-tokens/utils/string-utils.js +0 -25
- package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +0 -28
- package/dist/es2019/presets/css-to-design-tokens/css-to-design-tokens.js +0 -89
- package/dist/es2019/presets/css-to-design-tokens/lib/colors.js +0 -34
- package/dist/es2019/presets/css-to-design-tokens/lib/declaration.js +0 -17
- package/dist/es2019/presets/css-to-design-tokens/lib/legacy-colors.js +0 -332
- package/dist/es2019/presets/css-to-design-tokens/lib/logger.js +0 -11
- package/dist/es2019/presets/css-to-design-tokens/lib/meta.js +0 -133
- package/dist/es2019/presets/css-to-design-tokens/lib/tokens.js +0 -24
- package/dist/es2019/presets/css-to-design-tokens/lib/value.js +0 -68
- package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -377
- package/dist/es2019/presets/theme-to-design-tokens/types.js +0 -1
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +0 -60
- package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +0 -27
- package/dist/es2019/presets/theme-to-design-tokens/utils/color.js +0 -32
- package/dist/es2019/presets/theme-to-design-tokens/utils/css-utils.js +0 -31
- package/dist/es2019/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -279
- package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -90
- package/dist/es2019/presets/theme-to-design-tokens/utils/named-colors.js +0 -1
- package/dist/es2019/presets/theme-to-design-tokens/utils/string-utils.js +0 -13
- package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +0 -8
- package/dist/esm/presets/css-to-design-tokens/css-to-design-tokens.js +0 -109
- package/dist/esm/presets/css-to-design-tokens/lib/colors.js +0 -38
- package/dist/esm/presets/css-to-design-tokens/lib/declaration.js +0 -19
- package/dist/esm/presets/css-to-design-tokens/lib/legacy-colors.js +0 -332
- package/dist/esm/presets/css-to-design-tokens/lib/logger.js +0 -11
- package/dist/esm/presets/css-to-design-tokens/lib/meta.js +0 -146
- package/dist/esm/presets/css-to-design-tokens/lib/tokens.js +0 -40
- package/dist/esm/presets/css-to-design-tokens/lib/value.js +0 -73
- package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -484
- package/dist/esm/presets/theme-to-design-tokens/types.js +0 -1
- package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +0 -74
- package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +0 -27
- package/dist/esm/presets/theme-to-design-tokens/utils/color.js +0 -36
- package/dist/esm/presets/theme-to-design-tokens/utils/css-utils.js +0 -31
- package/dist/esm/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -283
- package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -90
- package/dist/esm/presets/theme-to-design-tokens/utils/named-colors.js +0 -1
- package/dist/esm/presets/theme-to-design-tokens/utils/string-utils.js +0 -17
- package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +0 -21
- package/dist/types/presets/css-to-design-tokens/css-to-design-tokens.d.ts +0 -2
- package/dist/types/presets/css-to-design-tokens/lib/colors.d.ts +0 -6
- package/dist/types/presets/css-to-design-tokens/lib/declaration.d.ts +0 -5
- package/dist/types/presets/css-to-design-tokens/lib/legacy-colors.d.ts +0 -3
- package/dist/types/presets/css-to-design-tokens/lib/logger.d.ts +0 -4
- package/dist/types/presets/css-to-design-tokens/lib/meta.d.ts +0 -6
- package/dist/types/presets/css-to-design-tokens/lib/tokens.d.ts +0 -7
- package/dist/types/presets/css-to-design-tokens/lib/value.d.ts +0 -6
- package/dist/types/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +0 -2
- package/dist/types/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -3
- package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +0 -4
- package/dist/types/presets/theme-to-design-tokens/utils/color.d.ts +0 -5
- package/dist/types/presets/theme-to-design-tokens/utils/css-utils.d.ts +0 -2
- package/dist/types/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +0 -5
- package/dist/types/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +0 -3
- package/dist/types/presets/theme-to-design-tokens/utils/named-colors.d.ts +0 -1
- package/dist/types/presets/theme-to-design-tokens/utils/string-utils.d.ts +0 -3
- package/dist/types/presets/theme-to-design-tokens/utils/tokens.d.ts +0 -2
- package/dist/types-ts4.5/presets/css-to-design-tokens/css-to-design-tokens.d.ts +0 -2
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/colors.d.ts +0 -6
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/declaration.d.ts +0 -5
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/legacy-colors.d.ts +0 -3
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/logger.d.ts +0 -4
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/meta.d.ts +0 -6
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/tokens.d.ts +0 -7
- package/dist/types-ts4.5/presets/css-to-design-tokens/lib/value.d.ts +0 -6
- package/dist/types-ts4.5/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +0 -2
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -3
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast.d.ts +0 -4
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/color.d.ts +0 -5
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/css-utils.d.ts +0 -2
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +0 -5
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +0 -3
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/named-colors.d.ts +0 -1
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/string-utils.d.ts +0 -6
- package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/tokens.d.ts +0 -2
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Fuzzy search ripped from the internet.
|
|
5
|
-
*/
|
|
6
|
-
var FuzzySet = function FuzzySet() {
|
|
7
|
-
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
8
|
-
var useLevenshtein = arguments.length > 1 ? arguments[1] : undefined;
|
|
9
|
-
var gramSizeLower = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
10
|
-
var gramSizeUpper = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 3;
|
|
11
|
-
var fuzzyset = {
|
|
12
|
-
gramSizeLower: gramSizeLower,
|
|
13
|
-
gramSizeUpper: gramSizeUpper,
|
|
14
|
-
useLevenshtein: typeof useLevenshtein !== 'boolean' ? true : useLevenshtein,
|
|
15
|
-
exactSet: {},
|
|
16
|
-
matchDict: {},
|
|
17
|
-
items: {}
|
|
18
|
-
};
|
|
19
|
-
var levenshtein = function levenshtein(str1, str2) {
|
|
20
|
-
var current = [];
|
|
21
|
-
var prev;
|
|
22
|
-
var value;
|
|
23
|
-
for (var i = 0; i <= str2.length; i++) {
|
|
24
|
-
for (var j = 0; j <= str1.length; j++) {
|
|
25
|
-
if (i && j) {
|
|
26
|
-
if (str1.charAt(j - 1) === str2.charAt(i - 1)) {
|
|
27
|
-
// @ts-expect-error
|
|
28
|
-
value = prev;
|
|
29
|
-
} else {
|
|
30
|
-
// @ts-expect-error
|
|
31
|
-
value = Math.min(current[j], current[j - 1], prev) + 1;
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
value = i + j;
|
|
35
|
-
}
|
|
36
|
-
prev = current[j];
|
|
37
|
-
current[j] = value;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return current.pop();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// return an edit distance from 0 to 1
|
|
44
|
-
var _distance = function _distance(str1, str2) {
|
|
45
|
-
if (str1 === null && str2 === null) {
|
|
46
|
-
throw new Error('Trying to compare two null values');
|
|
47
|
-
}
|
|
48
|
-
if (str1 === null || str2 === null) {
|
|
49
|
-
return 0;
|
|
50
|
-
}
|
|
51
|
-
str1 = String(str1);
|
|
52
|
-
str2 = String(str2);
|
|
53
|
-
var distance = levenshtein(str1, str2);
|
|
54
|
-
if (str1.length > str2.length) {
|
|
55
|
-
return 1 - distance / str1.length;
|
|
56
|
-
} else {
|
|
57
|
-
return 1 - distance / str2.length;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var _nonWordRe = /[^a-zA-Z0-9\u00C0-\u00FF, ]+/g;
|
|
61
|
-
var _iterateGrams = function _iterateGrams(value, gramSize) {
|
|
62
|
-
gramSize = gramSize || 2;
|
|
63
|
-
var simplified = '-' + value.toLowerCase().replace(_nonWordRe, '') + '-',
|
|
64
|
-
lenDiff = gramSize - simplified.length,
|
|
65
|
-
results = [];
|
|
66
|
-
if (lenDiff > 0) {
|
|
67
|
-
for (var i = 0; i < lenDiff; ++i) {
|
|
68
|
-
simplified += '-';
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
for (var i = 0; i < simplified.length - gramSize + 1; ++i) {
|
|
72
|
-
results.push(simplified.slice(i, i + gramSize));
|
|
73
|
-
}
|
|
74
|
-
return results;
|
|
75
|
-
};
|
|
76
|
-
var _gramCounter = function _gramCounter(value, gramSize) {
|
|
77
|
-
// return an object where key=gram, value=number of occurrences
|
|
78
|
-
gramSize = gramSize || 2;
|
|
79
|
-
var result = {},
|
|
80
|
-
grams = _iterateGrams(value, gramSize),
|
|
81
|
-
i = 0;
|
|
82
|
-
for (i; i < grams.length; ++i) {
|
|
83
|
-
if (grams[i] in result) {
|
|
84
|
-
// @ts-expect-error
|
|
85
|
-
result[grams[i]] += 1;
|
|
86
|
-
} else {
|
|
87
|
-
// @ts-expect-error
|
|
88
|
-
result[grams[i]] = 1;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// the main functions
|
|
95
|
-
fuzzyset.get = function (value, defaultValue, minMatchScore) {
|
|
96
|
-
// check for value in set, returning defaultValue or null if none found
|
|
97
|
-
if (minMatchScore === undefined) {
|
|
98
|
-
minMatchScore = 0.33;
|
|
99
|
-
}
|
|
100
|
-
var result = this._get(value, minMatchScore);
|
|
101
|
-
if (!result && typeof defaultValue !== 'undefined') {
|
|
102
|
-
return defaultValue;
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
};
|
|
106
|
-
fuzzyset._get = function (value, minMatchScore) {
|
|
107
|
-
var results = [];
|
|
108
|
-
// start with high gram size and if there are no results, go to lower gram sizes
|
|
109
|
-
for (var gramSize = this.gramSizeUpper; gramSize >= this.gramSizeLower; --gramSize) {
|
|
110
|
-
results = this.__get(value, gramSize, minMatchScore);
|
|
111
|
-
if (results && results.length > 0) {
|
|
112
|
-
return results;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
116
|
-
};
|
|
117
|
-
fuzzyset.__get = function (value, gramSize, minMatchScore) {
|
|
118
|
-
var normalizedValue = this._normalizeStr(value),
|
|
119
|
-
matches = {},
|
|
120
|
-
gramCounts = _gramCounter(normalizedValue, gramSize),
|
|
121
|
-
items = this.items[gramSize],
|
|
122
|
-
sumOfSquareGramCounts = 0,
|
|
123
|
-
gram,
|
|
124
|
-
gramCount,
|
|
125
|
-
i,
|
|
126
|
-
index,
|
|
127
|
-
otherGramCount;
|
|
128
|
-
for (gram in gramCounts) {
|
|
129
|
-
// @ts-expect-error
|
|
130
|
-
gramCount = gramCounts[gram];
|
|
131
|
-
sumOfSquareGramCounts += Math.pow(gramCount, 2);
|
|
132
|
-
if (gram in this.matchDict) {
|
|
133
|
-
for (i = 0; i < this.matchDict[gram].length; ++i) {
|
|
134
|
-
index = this.matchDict[gram][i][0];
|
|
135
|
-
otherGramCount = this.matchDict[gram][i][1];
|
|
136
|
-
if (index in matches) {
|
|
137
|
-
// @ts-expect-error
|
|
138
|
-
matches[index] += gramCount * otherGramCount;
|
|
139
|
-
} else {
|
|
140
|
-
// @ts-expect-error
|
|
141
|
-
matches[index] = gramCount * otherGramCount;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function isEmptyObject(obj) {
|
|
147
|
-
for (var prop in obj) {
|
|
148
|
-
if (obj.hasOwnProperty(prop)) {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
if (isEmptyObject(matches)) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
var vectorNormal = Math.sqrt(sumOfSquareGramCounts),
|
|
158
|
-
results = [],
|
|
159
|
-
matchScore;
|
|
160
|
-
// build a results list of [score, str]
|
|
161
|
-
for (var matchIndex in matches) {
|
|
162
|
-
// @ts-expect-error
|
|
163
|
-
matchScore = matches[matchIndex];
|
|
164
|
-
results.push([matchScore / (vectorNormal * items[matchIndex][0]), items[matchIndex][1]]);
|
|
165
|
-
}
|
|
166
|
-
var sortDescending = function sortDescending(a, b) {
|
|
167
|
-
if (a[0] < b[0]) {
|
|
168
|
-
return 1;
|
|
169
|
-
} else if (a[0] > b[0]) {
|
|
170
|
-
return -1;
|
|
171
|
-
} else {
|
|
172
|
-
return 0;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
results.sort(sortDescending);
|
|
176
|
-
if (this.useLevenshtein) {
|
|
177
|
-
var newResults = [],
|
|
178
|
-
endIndex = Math.min(50, results.length);
|
|
179
|
-
// truncate somewhat arbitrarily to 50
|
|
180
|
-
// @ts-expect-error
|
|
181
|
-
for (var i = 0; i < endIndex; ++i) {
|
|
182
|
-
// @ts-expect-error
|
|
183
|
-
newResults.push([_distance(results[i][1], normalizedValue), results[i][1]]);
|
|
184
|
-
}
|
|
185
|
-
results = newResults;
|
|
186
|
-
results.sort(sortDescending);
|
|
187
|
-
}
|
|
188
|
-
newResults = [];
|
|
189
|
-
results.forEach(function (scoreWordPair) {
|
|
190
|
-
if (scoreWordPair[0] >= minMatchScore) {
|
|
191
|
-
// @ts-expect-error
|
|
192
|
-
newResults.push([scoreWordPair[0], this.exactSet[scoreWordPair[1]]]);
|
|
193
|
-
}
|
|
194
|
-
}.bind(this));
|
|
195
|
-
return newResults;
|
|
196
|
-
};
|
|
197
|
-
fuzzyset.add = function (value) {
|
|
198
|
-
var normalizedValue = this._normalizeStr(value);
|
|
199
|
-
if (normalizedValue in this.exactSet) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
var i = this.gramSizeLower;
|
|
203
|
-
for (i; i < this.gramSizeUpper + 1; ++i) {
|
|
204
|
-
this._add(value, i);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
fuzzyset._add = function (value, gramSize) {
|
|
208
|
-
var normalizedValue = this._normalizeStr(value),
|
|
209
|
-
items = this.items[gramSize] || [],
|
|
210
|
-
index = items.length;
|
|
211
|
-
items.push(0);
|
|
212
|
-
var gramCounts = _gramCounter(normalizedValue, gramSize);
|
|
213
|
-
var sumOfSquareGramCounts = 0;
|
|
214
|
-
var gram;
|
|
215
|
-
var gramCount;
|
|
216
|
-
for (gram in gramCounts) {
|
|
217
|
-
// @ts-expect-error
|
|
218
|
-
gramCount = gramCounts[gram];
|
|
219
|
-
sumOfSquareGramCounts += Math.pow(gramCount, 2);
|
|
220
|
-
if (gram in this.matchDict) {
|
|
221
|
-
this.matchDict[gram].push([index, gramCount]);
|
|
222
|
-
} else {
|
|
223
|
-
this.matchDict[gram] = [[index, gramCount]];
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
var vectorNormal = Math.sqrt(sumOfSquareGramCounts);
|
|
227
|
-
items[index] = [vectorNormal, normalizedValue];
|
|
228
|
-
this.items[gramSize] = items;
|
|
229
|
-
this.exactSet[normalizedValue] = value;
|
|
230
|
-
};
|
|
231
|
-
fuzzyset._normalizeStr = function (str) {
|
|
232
|
-
if (Object.prototype.toString.call(str) !== '[object String]') {
|
|
233
|
-
throw new Error('Must use a string as argument to FuzzySet functions');
|
|
234
|
-
}
|
|
235
|
-
return str.toLowerCase();
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
// return length of items in set
|
|
239
|
-
fuzzyset.length = function () {
|
|
240
|
-
var count = 0,
|
|
241
|
-
prop;
|
|
242
|
-
for (prop in this.exactSet) {
|
|
243
|
-
if (this.exactSet.hasOwnProperty(prop)) {
|
|
244
|
-
count += 1;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return count;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
// return is set is empty
|
|
251
|
-
fuzzyset.isEmpty = function () {
|
|
252
|
-
for (var prop in this.exactSet) {
|
|
253
|
-
if (this.exactSet.hasOwnProperty(prop)) {
|
|
254
|
-
return false;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return true;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
// return list of values loaded into set
|
|
261
|
-
fuzzyset.values = function () {
|
|
262
|
-
var values = [],
|
|
263
|
-
prop;
|
|
264
|
-
for (prop in this.exactSet) {
|
|
265
|
-
if (this.exactSet.hasOwnProperty(prop)) {
|
|
266
|
-
values.push(this.exactSet[prop]);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return values;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// initialization
|
|
273
|
-
var i = fuzzyset.gramSizeLower;
|
|
274
|
-
for (i; i < fuzzyset.gramSizeUpper + 1; ++i) {
|
|
275
|
-
fuzzyset.items[i] = [];
|
|
276
|
-
}
|
|
277
|
-
// add all the items to the set
|
|
278
|
-
for (i = 0; i < arr.length; ++i) {
|
|
279
|
-
fuzzyset.add(arr[i]);
|
|
280
|
-
}
|
|
281
|
-
return fuzzyset;
|
|
282
|
-
};
|
|
283
|
-
export default FuzzySet;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export var legacyColors = ['R50', 'R75', 'R100', 'R200', 'R300', 'R400', 'R500', 'Y50', 'Y75', 'Y100', 'Y200', 'Y300', 'Y400', 'Y500', 'G50', 'G75', 'G100', 'G200', 'G300', 'G400', 'G500', 'B50', 'B75', 'B100', 'B200', 'B300', 'B400', 'B500', 'P50', 'P75', 'P100', 'P200', 'P300', 'P400', 'P500', 'T50', 'T75', 'T100', 'T200', 'T300', 'T400', 'T500', 'N0', 'N10', 'N20', 'N30', 'N40', 'N50', 'N60', 'N70', 'N80', 'N90', 'N100', 'N200', 'N300', 'N400', 'N500', 'N600', 'N700', 'N800', 'N900', 'N10A', 'N20A', 'N30A', 'N40A', 'N50A', 'N60A', 'N70A', 'N80A', 'N90A', 'N100A', 'N200A', 'N300A', 'N400A', 'N500A', 'N600A', 'N700A', 'N800A', 'DN900', 'DN800', 'DN700', 'DN600', 'DN500', 'DN400', 'DN300', 'DN200', 'DN100', 'DN90', 'DN80', 'DN70', 'DN60', 'DN50', 'DN40', 'DN30', 'DN20', 'DN10', 'DN0', 'DN800A', 'DN700A', 'DN600A', 'DN500A', 'DN400A', 'DN300A', 'DN200A', 'DN100A', 'DN90A', 'DN80A', 'DN70A', 'DN60A', 'DN50A', 'DN40A', 'DN30A', 'DN20A', 'DN10A'];
|
|
2
|
-
export var legacyColorMixins = ['background', 'backgroundActive', 'backgroundHover', 'backgroundOnLayer', 'text', 'textHover', 'textActive', 'subtleText', 'placeholderText', 'heading', 'subtleHeading', 'codeBlock', 'link', 'linkHover', 'linkActive', 'linkOutline', 'primary', 'blue', 'teal', 'purple', 'red', 'yellow', 'green', 'skeleton'];
|
|
3
|
-
export var legacyColorMetaMap = {
|
|
4
|
-
R50: ['danger'],
|
|
5
|
-
R75: ['danger'],
|
|
6
|
-
R100: ['danger'],
|
|
7
|
-
R200: ['danger'],
|
|
8
|
-
R300: ['danger', 'bold'],
|
|
9
|
-
R400: ['danger', 'bold'],
|
|
10
|
-
R500: ['danger', 'bold'],
|
|
11
|
-
Y50: ['warning'],
|
|
12
|
-
Y75: ['warning'],
|
|
13
|
-
Y100: ['warning'],
|
|
14
|
-
Y200: ['warning'],
|
|
15
|
-
Y300: ['warning', 'bold'],
|
|
16
|
-
Y400: ['warning', 'bold'],
|
|
17
|
-
Y500: ['warning', 'bold'],
|
|
18
|
-
G50: ['success'],
|
|
19
|
-
G75: ['success'],
|
|
20
|
-
G100: ['success'],
|
|
21
|
-
G200: ['success'],
|
|
22
|
-
G300: ['success'],
|
|
23
|
-
G400: ['success'],
|
|
24
|
-
G500: ['success'],
|
|
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
|
-
P50: ['discovery'],
|
|
33
|
-
P75: ['discovery'],
|
|
34
|
-
P100: ['discovery'],
|
|
35
|
-
P200: ['discovery'],
|
|
36
|
-
P300: ['discovery', 'bold'],
|
|
37
|
-
P400: ['discovery', 'bold'],
|
|
38
|
-
P500: ['discovery', 'bold'],
|
|
39
|
-
T50: ['accent', 'teal'],
|
|
40
|
-
T75: ['accent', 'teal'],
|
|
41
|
-
T100: ['accent', 'teal'],
|
|
42
|
-
T200: ['accent', 'teal'],
|
|
43
|
-
T300: ['accent', 'teal'],
|
|
44
|
-
T400: ['accent', 'teal'],
|
|
45
|
-
T500: ['accent', 'teal'],
|
|
46
|
-
N0: ['inverse'],
|
|
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'],
|
|
65
|
-
background: ['background', 'default'],
|
|
66
|
-
backgroundActive: ['background', 'pressed'],
|
|
67
|
-
backgroundHover: ['background', 'hovered'],
|
|
68
|
-
backgroundOnLayer: ['background', 'blanket'],
|
|
69
|
-
text: ['text'],
|
|
70
|
-
textHover: ['text', 'subtle'],
|
|
71
|
-
textActive: ['text', 'link', 'pressed'],
|
|
72
|
-
subtleText: ['text', 'subtlest'],
|
|
73
|
-
placeholderText: ['text', 'subtlest'],
|
|
74
|
-
heading: ['text'],
|
|
75
|
-
subtleHeading: ['text', 'subtle'],
|
|
76
|
-
link: ['link'],
|
|
77
|
-
linkHover: ['link', 'hovered'],
|
|
78
|
-
linkActive: ['link', 'pressed'],
|
|
79
|
-
linkOutline: ['border', 'selected'],
|
|
80
|
-
primary: ['brand'],
|
|
81
|
-
blue: ['accent', 'blue'],
|
|
82
|
-
teal: ['accent', 'teal'],
|
|
83
|
-
purple: ['accent', 'purple'],
|
|
84
|
-
red: ['accent', 'red'],
|
|
85
|
-
yellow: ['accent', 'orange'],
|
|
86
|
-
green: ['accent', 'green'],
|
|
87
|
-
grey: ['background', 'neutral'],
|
|
88
|
-
skeleton: ['skeleton'],
|
|
89
|
-
white: ['inverse']
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export var namedColors = ['black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua', 'orange', 'aliceblue', 'antiquewhite', 'aquamarine', 'azure', 'beige', 'bisque', 'blanchedalmond', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'limegreen', 'linen', 'magenta', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'oldlace', 'olivedrab', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'whitesmoke', 'yellowgreen', 'rebeccapurple'];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export var kebabize = function kebabize(str) {
|
|
2
|
-
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, function ($, ofs) {
|
|
3
|
-
return (ofs ? '-' : '') + $.toLowerCase();
|
|
4
|
-
});
|
|
5
|
-
};
|
|
6
|
-
export function findFirstNonspaceIndexAfter(text, index) {
|
|
7
|
-
var rest = text.slice(index + 1);
|
|
8
|
-
var indexInRest = rest.search(/\S/);
|
|
9
|
-
if (indexInRest === -1) {
|
|
10
|
-
return text.length;
|
|
11
|
-
} else {
|
|
12
|
-
return index + 1 + indexInRest;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export function splitAtIndex(text, index) {
|
|
16
|
-
return [text.slice(0, index), text.slice(index)];
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { light as rawTokens } from '@atlaskit/tokens/tokens-raw';
|
|
3
|
-
export var tokens = rawTokens.filter(function (t) {
|
|
4
|
-
return t.attributes.state === 'active';
|
|
5
|
-
}).map(function (t) {
|
|
6
|
-
return t.name.replace(/\.\[default\]/g, '');
|
|
7
|
-
}).filter(function (t) {
|
|
8
|
-
return !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart') && !t.includes('elevation.shadow.overflow');
|
|
9
|
-
});
|
|
10
|
-
export var getUniqueWordsFromTokens = tokens.reduce(function (accum, val) {
|
|
11
|
-
return [].concat(_toConsumableArray(accum), _toConsumableArray(val.split('.')));
|
|
12
|
-
}, []).reduce(function (accum, val) {
|
|
13
|
-
return [].concat(_toConsumableArray(accum), _toConsumableArray(val.split(/(?=[A-Z])/g).map(function (e) {
|
|
14
|
-
return e.toLowerCase();
|
|
15
|
-
})));
|
|
16
|
-
}, []).reduce(function (accum, val) {
|
|
17
|
-
if (!accum.includes(val)) {
|
|
18
|
-
accum.push(val);
|
|
19
|
-
}
|
|
20
|
-
return accum;
|
|
21
|
-
}, []);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function isKnownCssVariable(value: string): boolean;
|
|
2
|
-
export declare function isRawColor(value: string): boolean;
|
|
3
|
-
export declare function isNamedColor(value: string): boolean;
|
|
4
|
-
export declare function isGradient(value: string): boolean;
|
|
5
|
-
export declare function extractBetweenParentheses(value: string): string;
|
|
6
|
-
export declare function isLessFunction(value: string): boolean;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function isColorRelatedProperty(prop: string): boolean;
|
|
2
|
-
export declare function isCssDeclaration(prop: string): boolean;
|
|
3
|
-
export declare function extractCssVarName(prop: string): string;
|
|
4
|
-
export declare function extractLessVarName(prop: string): string;
|
|
5
|
-
export declare function splitCssValue(value: string): RegExpMatchArray | null;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Declaration } from 'postcss';
|
|
2
|
-
export declare function cleanMeta(meta: string[]): string[];
|
|
3
|
-
export declare function getBaseDeclarationMeta(decl: Declaration): string[];
|
|
4
|
-
export declare function getCssVarMeta(cssVariable: string): string[];
|
|
5
|
-
export declare function getRawColorMeta(rawColor: string): string[];
|
|
6
|
-
export declare function getNamedColorMeta(namedColor: string): string[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import designTokens from '@atlaskit/tokens/token-names';
|
|
2
|
-
type DesignTokensMap = typeof designTokens;
|
|
3
|
-
type DesignTokenJs = keyof DesignTokensMap;
|
|
4
|
-
type DesignTokenCss = DesignTokensMap[DesignTokenJs];
|
|
5
|
-
declare const MISSING_TOKEN_NAME = "MISSING_TOKEN";
|
|
6
|
-
export default function findToken(meta: string[]): DesignTokenCss | typeof MISSING_TOKEN_NAME;
|
|
7
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import core, { ASTNode, ASTPath } from 'jscodeshift';
|
|
2
|
-
export declare function isDecendantOfToken(j: core.JSCodeshift, path: ASTPath | 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,5 +0,0 @@
|
|
|
1
|
-
export declare const isLegacyColor: (value: string) => boolean;
|
|
2
|
-
export declare const isLegacyNamedColor: (value: string) => boolean;
|
|
3
|
-
export declare const includesHardCodedColor: (raw: string) => boolean;
|
|
4
|
-
export declare const isHardCodedColor: (raw: string) => boolean;
|
|
5
|
-
export declare function isBoldColor(color: string): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const namedColors: string[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function isKnownCssVariable(value: string): boolean;
|
|
2
|
-
export declare function isRawColor(value: string): boolean;
|
|
3
|
-
export declare function isNamedColor(value: string): boolean;
|
|
4
|
-
export declare function isGradient(value: string): boolean;
|
|
5
|
-
export declare function extractBetweenParentheses(value: string): string;
|
|
6
|
-
export declare function isLessFunction(value: string): boolean;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function isColorRelatedProperty(prop: string): boolean;
|
|
2
|
-
export declare function isCssDeclaration(prop: string): boolean;
|
|
3
|
-
export declare function extractCssVarName(prop: string): string;
|
|
4
|
-
export declare function extractLessVarName(prop: string): string;
|
|
5
|
-
export declare function splitCssValue(value: string): RegExpMatchArray | null;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Declaration } from 'postcss';
|
|
2
|
-
export declare function cleanMeta(meta: string[]): string[];
|
|
3
|
-
export declare function getBaseDeclarationMeta(decl: Declaration): string[];
|
|
4
|
-
export declare function getCssVarMeta(cssVariable: string): string[];
|
|
5
|
-
export declare function getRawColorMeta(rawColor: string): string[];
|
|
6
|
-
export declare function getNamedColorMeta(namedColor: string): string[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import designTokens from '@atlaskit/tokens/token-names';
|
|
2
|
-
type DesignTokensMap = typeof designTokens;
|
|
3
|
-
type DesignTokenJs = keyof DesignTokensMap;
|
|
4
|
-
type DesignTokenCss = DesignTokensMap[DesignTokenJs];
|
|
5
|
-
declare const MISSING_TOKEN_NAME = "MISSING_TOKEN";
|
|
6
|
-
export default function findToken(meta: string[]): DesignTokenCss | typeof MISSING_TOKEN_NAME;
|
|
7
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import core, { ASTNode, ASTPath } from 'jscodeshift';
|
|
2
|
-
export declare function isDecendantOfToken(j: core.JSCodeshift, path: ASTPath | 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,5 +0,0 @@
|
|
|
1
|
-
export declare const isLegacyColor: (value: string) => boolean;
|
|
2
|
-
export declare const isLegacyNamedColor: (value: string) => boolean;
|
|
3
|
-
export declare const includesHardCodedColor: (raw: string) => boolean;
|
|
4
|
-
export declare const isHardCodedColor: (raw: string) => boolean;
|
|
5
|
-
export declare function isBoldColor(color: string): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const namedColors: string[];
|