@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.
Files changed (108) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/filepath.js +1 -1
  3. package/dist/cjs/main.js +1 -1
  4. package/dist/cjs/presets/index.js +2 -4
  5. package/dist/cjs/transforms.js +3 -3
  6. package/dist/es2019/filepath.js +2 -2
  7. package/dist/es2019/presets/index.js +2 -4
  8. package/dist/es2019/transforms.js +3 -3
  9. package/dist/esm/filepath.js +2 -2
  10. package/dist/esm/main.js +1 -1
  11. package/dist/esm/presets/index.js +2 -4
  12. package/dist/esm/transforms.js +3 -3
  13. package/dist/types/presets/index.d.ts +1 -3
  14. package/dist/types-ts4.5/presets/index.d.ts +1 -3
  15. package/package.json +3 -6
  16. package/dist/cjs/presets/css-to-design-tokens/css-to-design-tokens.js +0 -117
  17. package/dist/cjs/presets/css-to-design-tokens/lib/colors.js +0 -49
  18. package/dist/cjs/presets/css-to-design-tokens/lib/declaration.js +0 -29
  19. package/dist/cjs/presets/css-to-design-tokens/lib/legacy-colors.js +0 -338
  20. package/dist/cjs/presets/css-to-design-tokens/lib/logger.js +0 -18
  21. package/dist/cjs/presets/css-to-design-tokens/lib/meta.js +0 -157
  22. package/dist/cjs/presets/css-to-design-tokens/lib/tokens.js +0 -47
  23. package/dist/cjs/presets/css-to-design-tokens/lib/value.js +0 -80
  24. package/dist/cjs/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -489
  25. package/dist/cjs/presets/theme-to-design-tokens/types.js +0 -5
  26. package/dist/cjs/presets/theme-to-design-tokens/utils/ast-meta.js +0 -82
  27. package/dist/cjs/presets/theme-to-design-tokens/utils/ast.js +0 -35
  28. package/dist/cjs/presets/theme-to-design-tokens/utils/color.js +0 -44
  29. package/dist/cjs/presets/theme-to-design-tokens/utils/css-utils.js +0 -38
  30. package/dist/cjs/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -289
  31. package/dist/cjs/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -96
  32. package/dist/cjs/presets/theme-to-design-tokens/utils/named-colors.js +0 -7
  33. package/dist/cjs/presets/theme-to-design-tokens/utils/string-utils.js +0 -25
  34. package/dist/cjs/presets/theme-to-design-tokens/utils/tokens.js +0 -28
  35. package/dist/es2019/presets/css-to-design-tokens/css-to-design-tokens.js +0 -89
  36. package/dist/es2019/presets/css-to-design-tokens/lib/colors.js +0 -34
  37. package/dist/es2019/presets/css-to-design-tokens/lib/declaration.js +0 -17
  38. package/dist/es2019/presets/css-to-design-tokens/lib/legacy-colors.js +0 -332
  39. package/dist/es2019/presets/css-to-design-tokens/lib/logger.js +0 -11
  40. package/dist/es2019/presets/css-to-design-tokens/lib/meta.js +0 -133
  41. package/dist/es2019/presets/css-to-design-tokens/lib/tokens.js +0 -24
  42. package/dist/es2019/presets/css-to-design-tokens/lib/value.js +0 -68
  43. package/dist/es2019/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -377
  44. package/dist/es2019/presets/theme-to-design-tokens/types.js +0 -1
  45. package/dist/es2019/presets/theme-to-design-tokens/utils/ast-meta.js +0 -60
  46. package/dist/es2019/presets/theme-to-design-tokens/utils/ast.js +0 -27
  47. package/dist/es2019/presets/theme-to-design-tokens/utils/color.js +0 -32
  48. package/dist/es2019/presets/theme-to-design-tokens/utils/css-utils.js +0 -31
  49. package/dist/es2019/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -279
  50. package/dist/es2019/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -90
  51. package/dist/es2019/presets/theme-to-design-tokens/utils/named-colors.js +0 -1
  52. package/dist/es2019/presets/theme-to-design-tokens/utils/string-utils.js +0 -13
  53. package/dist/es2019/presets/theme-to-design-tokens/utils/tokens.js +0 -8
  54. package/dist/esm/presets/css-to-design-tokens/css-to-design-tokens.js +0 -109
  55. package/dist/esm/presets/css-to-design-tokens/lib/colors.js +0 -38
  56. package/dist/esm/presets/css-to-design-tokens/lib/declaration.js +0 -19
  57. package/dist/esm/presets/css-to-design-tokens/lib/legacy-colors.js +0 -332
  58. package/dist/esm/presets/css-to-design-tokens/lib/logger.js +0 -11
  59. package/dist/esm/presets/css-to-design-tokens/lib/meta.js +0 -146
  60. package/dist/esm/presets/css-to-design-tokens/lib/tokens.js +0 -40
  61. package/dist/esm/presets/css-to-design-tokens/lib/value.js +0 -73
  62. package/dist/esm/presets/theme-to-design-tokens/theme-to-design-tokens.js +0 -484
  63. package/dist/esm/presets/theme-to-design-tokens/types.js +0 -1
  64. package/dist/esm/presets/theme-to-design-tokens/utils/ast-meta.js +0 -74
  65. package/dist/esm/presets/theme-to-design-tokens/utils/ast.js +0 -27
  66. package/dist/esm/presets/theme-to-design-tokens/utils/color.js +0 -36
  67. package/dist/esm/presets/theme-to-design-tokens/utils/css-utils.js +0 -31
  68. package/dist/esm/presets/theme-to-design-tokens/utils/fuzzy-search.js +0 -283
  69. package/dist/esm/presets/theme-to-design-tokens/utils/legacy-colors.js +0 -90
  70. package/dist/esm/presets/theme-to-design-tokens/utils/named-colors.js +0 -1
  71. package/dist/esm/presets/theme-to-design-tokens/utils/string-utils.js +0 -17
  72. package/dist/esm/presets/theme-to-design-tokens/utils/tokens.js +0 -21
  73. package/dist/types/presets/css-to-design-tokens/css-to-design-tokens.d.ts +0 -2
  74. package/dist/types/presets/css-to-design-tokens/lib/colors.d.ts +0 -6
  75. package/dist/types/presets/css-to-design-tokens/lib/declaration.d.ts +0 -5
  76. package/dist/types/presets/css-to-design-tokens/lib/legacy-colors.d.ts +0 -3
  77. package/dist/types/presets/css-to-design-tokens/lib/logger.d.ts +0 -4
  78. package/dist/types/presets/css-to-design-tokens/lib/meta.d.ts +0 -6
  79. package/dist/types/presets/css-to-design-tokens/lib/tokens.d.ts +0 -7
  80. package/dist/types/presets/css-to-design-tokens/lib/value.d.ts +0 -6
  81. package/dist/types/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +0 -2
  82. package/dist/types/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -3
  83. package/dist/types/presets/theme-to-design-tokens/utils/ast.d.ts +0 -4
  84. package/dist/types/presets/theme-to-design-tokens/utils/color.d.ts +0 -5
  85. package/dist/types/presets/theme-to-design-tokens/utils/css-utils.d.ts +0 -2
  86. package/dist/types/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +0 -5
  87. package/dist/types/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +0 -3
  88. package/dist/types/presets/theme-to-design-tokens/utils/named-colors.d.ts +0 -1
  89. package/dist/types/presets/theme-to-design-tokens/utils/string-utils.d.ts +0 -3
  90. package/dist/types/presets/theme-to-design-tokens/utils/tokens.d.ts +0 -2
  91. package/dist/types-ts4.5/presets/css-to-design-tokens/css-to-design-tokens.d.ts +0 -2
  92. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/colors.d.ts +0 -6
  93. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/declaration.d.ts +0 -5
  94. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/legacy-colors.d.ts +0 -3
  95. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/logger.d.ts +0 -4
  96. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/meta.d.ts +0 -6
  97. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/tokens.d.ts +0 -7
  98. package/dist/types-ts4.5/presets/css-to-design-tokens/lib/value.d.ts +0 -6
  99. package/dist/types-ts4.5/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +0 -2
  100. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast-meta.d.ts +0 -3
  101. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/ast.d.ts +0 -4
  102. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/color.d.ts +0 -5
  103. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/css-utils.d.ts +0 -2
  104. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +0 -5
  105. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +0 -3
  106. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/named-colors.d.ts +0 -1
  107. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/string-utils.d.ts +0 -6
  108. package/dist/types-ts4.5/presets/theme-to-design-tokens/utils/tokens.d.ts +0 -2
@@ -1,279 +0,0 @@
1
- /* eslint-disable */
2
-
3
- /**
4
- * Fuzzy search ripped from the internet.
5
- */
6
- const FuzzySet = function (arr = [], useLevenshtein, gramSizeLower = 2, gramSizeUpper = 3) {
7
- var fuzzyset = {
8
- gramSizeLower: gramSizeLower,
9
- gramSizeUpper: gramSizeUpper,
10
- useLevenshtein: typeof useLevenshtein !== 'boolean' ? true : useLevenshtein,
11
- exactSet: {},
12
- matchDict: {},
13
- items: {}
14
- };
15
- var levenshtein = function (str1, str2) {
16
- var current = [];
17
- var prev;
18
- var value;
19
- for (var i = 0; i <= str2.length; i++) {
20
- for (var j = 0; j <= str1.length; j++) {
21
- if (i && j) {
22
- if (str1.charAt(j - 1) === str2.charAt(i - 1)) {
23
- // @ts-expect-error
24
- value = prev;
25
- } else {
26
- // @ts-expect-error
27
- value = Math.min(current[j], current[j - 1], prev) + 1;
28
- }
29
- } else {
30
- value = i + j;
31
- }
32
- prev = current[j];
33
- current[j] = value;
34
- }
35
- }
36
- return current.pop();
37
- };
38
-
39
- // return an edit distance from 0 to 1
40
- var _distance = function (str1, str2) {
41
- if (str1 === null && str2 === null) {
42
- throw new Error('Trying to compare two null values');
43
- }
44
- if (str1 === null || str2 === null) {
45
- return 0;
46
- }
47
- str1 = String(str1);
48
- str2 = String(str2);
49
- var distance = levenshtein(str1, str2);
50
- if (str1.length > str2.length) {
51
- return 1 - distance / str1.length;
52
- } else {
53
- return 1 - distance / str2.length;
54
- }
55
- };
56
- var _nonWordRe = /[^a-zA-Z0-9\u00C0-\u00FF, ]+/g;
57
- var _iterateGrams = function (value, gramSize) {
58
- gramSize = gramSize || 2;
59
- var simplified = '-' + value.toLowerCase().replace(_nonWordRe, '') + '-',
60
- lenDiff = gramSize - simplified.length,
61
- results = [];
62
- if (lenDiff > 0) {
63
- for (var i = 0; i < lenDiff; ++i) {
64
- simplified += '-';
65
- }
66
- }
67
- for (var i = 0; i < simplified.length - gramSize + 1; ++i) {
68
- results.push(simplified.slice(i, i + gramSize));
69
- }
70
- return results;
71
- };
72
- var _gramCounter = function (value, gramSize) {
73
- // return an object where key=gram, value=number of occurrences
74
- gramSize = gramSize || 2;
75
- var result = {},
76
- grams = _iterateGrams(value, gramSize),
77
- i = 0;
78
- for (i; i < grams.length; ++i) {
79
- if (grams[i] in result) {
80
- // @ts-expect-error
81
- result[grams[i]] += 1;
82
- } else {
83
- // @ts-expect-error
84
- result[grams[i]] = 1;
85
- }
86
- }
87
- return result;
88
- };
89
-
90
- // the main functions
91
- fuzzyset.get = function (value, defaultValue, minMatchScore) {
92
- // check for value in set, returning defaultValue or null if none found
93
- if (minMatchScore === undefined) {
94
- minMatchScore = 0.33;
95
- }
96
- var result = this._get(value, minMatchScore);
97
- if (!result && typeof defaultValue !== 'undefined') {
98
- return defaultValue;
99
- }
100
- return result;
101
- };
102
- fuzzyset._get = function (value, minMatchScore) {
103
- var results = [];
104
- // start with high gram size and if there are no results, go to lower gram sizes
105
- for (var gramSize = this.gramSizeUpper; gramSize >= this.gramSizeLower; --gramSize) {
106
- results = this.__get(value, gramSize, minMatchScore);
107
- if (results && results.length > 0) {
108
- return results;
109
- }
110
- }
111
- return null;
112
- };
113
- fuzzyset.__get = function (value, gramSize, minMatchScore) {
114
- var normalizedValue = this._normalizeStr(value),
115
- matches = {},
116
- gramCounts = _gramCounter(normalizedValue, gramSize),
117
- items = this.items[gramSize],
118
- sumOfSquareGramCounts = 0,
119
- gram,
120
- gramCount,
121
- i,
122
- index,
123
- otherGramCount;
124
- for (gram in gramCounts) {
125
- // @ts-expect-error
126
- gramCount = gramCounts[gram];
127
- sumOfSquareGramCounts += Math.pow(gramCount, 2);
128
- if (gram in this.matchDict) {
129
- for (i = 0; i < this.matchDict[gram].length; ++i) {
130
- index = this.matchDict[gram][i][0];
131
- otherGramCount = this.matchDict[gram][i][1];
132
- if (index in matches) {
133
- // @ts-expect-error
134
- matches[index] += gramCount * otherGramCount;
135
- } else {
136
- // @ts-expect-error
137
- matches[index] = gramCount * otherGramCount;
138
- }
139
- }
140
- }
141
- }
142
- function isEmptyObject(obj) {
143
- for (var prop in obj) {
144
- if (obj.hasOwnProperty(prop)) {
145
- return false;
146
- }
147
- }
148
- return true;
149
- }
150
- if (isEmptyObject(matches)) {
151
- return null;
152
- }
153
- var vectorNormal = Math.sqrt(sumOfSquareGramCounts),
154
- results = [],
155
- matchScore;
156
- // build a results list of [score, str]
157
- for (var matchIndex in matches) {
158
- // @ts-expect-error
159
- matchScore = matches[matchIndex];
160
- results.push([matchScore / (vectorNormal * items[matchIndex][0]), items[matchIndex][1]]);
161
- }
162
- var sortDescending = function (a, b) {
163
- if (a[0] < b[0]) {
164
- return 1;
165
- } else if (a[0] > b[0]) {
166
- return -1;
167
- } else {
168
- return 0;
169
- }
170
- };
171
- results.sort(sortDescending);
172
- if (this.useLevenshtein) {
173
- var newResults = [],
174
- endIndex = Math.min(50, results.length);
175
- // truncate somewhat arbitrarily to 50
176
- // @ts-expect-error
177
- for (var i = 0; i < endIndex; ++i) {
178
- // @ts-expect-error
179
- newResults.push([_distance(results[i][1], normalizedValue), results[i][1]]);
180
- }
181
- results = newResults;
182
- results.sort(sortDescending);
183
- }
184
- newResults = [];
185
- results.forEach(function (scoreWordPair) {
186
- if (scoreWordPair[0] >= minMatchScore) {
187
- // @ts-expect-error
188
- newResults.push([scoreWordPair[0], this.exactSet[scoreWordPair[1]]]);
189
- }
190
- }.bind(this));
191
- return newResults;
192
- };
193
- fuzzyset.add = function (value) {
194
- var normalizedValue = this._normalizeStr(value);
195
- if (normalizedValue in this.exactSet) {
196
- return false;
197
- }
198
- var i = this.gramSizeLower;
199
- for (i; i < this.gramSizeUpper + 1; ++i) {
200
- this._add(value, i);
201
- }
202
- };
203
- fuzzyset._add = function (value, gramSize) {
204
- var normalizedValue = this._normalizeStr(value),
205
- items = this.items[gramSize] || [],
206
- index = items.length;
207
- items.push(0);
208
- var gramCounts = _gramCounter(normalizedValue, gramSize);
209
- var sumOfSquareGramCounts = 0;
210
- var gram;
211
- var gramCount;
212
- for (gram in gramCounts) {
213
- // @ts-expect-error
214
- gramCount = gramCounts[gram];
215
- sumOfSquareGramCounts += Math.pow(gramCount, 2);
216
- if (gram in this.matchDict) {
217
- this.matchDict[gram].push([index, gramCount]);
218
- } else {
219
- this.matchDict[gram] = [[index, gramCount]];
220
- }
221
- }
222
- var vectorNormal = Math.sqrt(sumOfSquareGramCounts);
223
- items[index] = [vectorNormal, normalizedValue];
224
- this.items[gramSize] = items;
225
- this.exactSet[normalizedValue] = value;
226
- };
227
- fuzzyset._normalizeStr = function (str) {
228
- if (Object.prototype.toString.call(str) !== '[object String]') {
229
- throw new Error('Must use a string as argument to FuzzySet functions');
230
- }
231
- return str.toLowerCase();
232
- };
233
-
234
- // return length of items in set
235
- fuzzyset.length = function () {
236
- var count = 0,
237
- prop;
238
- for (prop in this.exactSet) {
239
- if (this.exactSet.hasOwnProperty(prop)) {
240
- count += 1;
241
- }
242
- }
243
- return count;
244
- };
245
-
246
- // return is set is empty
247
- fuzzyset.isEmpty = function () {
248
- for (var prop in this.exactSet) {
249
- if (this.exactSet.hasOwnProperty(prop)) {
250
- return false;
251
- }
252
- }
253
- return true;
254
- };
255
-
256
- // return list of values loaded into set
257
- fuzzyset.values = function () {
258
- var values = [],
259
- prop;
260
- for (prop in this.exactSet) {
261
- if (this.exactSet.hasOwnProperty(prop)) {
262
- values.push(this.exactSet[prop]);
263
- }
264
- }
265
- return values;
266
- };
267
-
268
- // initialization
269
- var i = fuzzyset.gramSizeLower;
270
- for (i; i < fuzzyset.gramSizeUpper + 1; ++i) {
271
- fuzzyset.items[i] = [];
272
- }
273
- // add all the items to the set
274
- for (i = 0; i < arr.length; ++i) {
275
- fuzzyset.add(arr[i]);
276
- }
277
- return fuzzyset;
278
- };
279
- export default FuzzySet;
@@ -1,90 +0,0 @@
1
- export const 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 const 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 const 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 const 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,13 +0,0 @@
1
- export const kebabize = str => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
2
- export function findFirstNonspaceIndexAfter(text, index) {
3
- const rest = text.slice(index + 1);
4
- const indexInRest = rest.search(/\S/);
5
- if (indexInRest === -1) {
6
- return text.length;
7
- } else {
8
- return index + 1 + indexInRest;
9
- }
10
- }
11
- export function splitAtIndex(text, index) {
12
- return [text.slice(0, index), text.slice(index)];
13
- }
@@ -1,8 +0,0 @@
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') && !t.includes('elevation.shadow.overflow'));
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
- if (!accum.includes(val)) {
5
- accum.push(val);
6
- }
7
- return accum;
8
- }, []);
@@ -1,109 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import postcss from 'postcss';
5
- // @ts-ignore
6
- import lessSyntax from 'postcss-less';
7
- import { isColorRelatedProperty, isCssDeclaration, splitCssValue } from './lib/declaration';
8
- import { getBaseDeclarationMeta } from './lib/meta';
9
- import findToken from './lib/tokens';
10
- import parseValue from './lib/value';
11
- var POSTCSS_OPTIONS = {
12
- syntax: lessSyntax,
13
- from: undefined
14
- };
15
-
16
- // https://github.com/postcss/postcss/blob/main/docs/writing-a-plugin.md
17
- // https://astexplorer.net/#/2uBU1BLuJ1
18
- var plugin = function plugin() {
19
- var processed = Symbol('processed');
20
- return {
21
- postcssPlugin: 'UsingTokens',
22
- AtRule: function AtRule(atRule, helper) {
23
- // @ts-expect-error
24
- if (atRule[processed]) {
25
- return;
26
- }
27
-
28
- // @ts-expect-error: The 'variable' property does not exist on 'AtRule' according to the TypeScript definitions.
29
- // However, the 'postcss-less' library adds a 'variable' property to 'AtRule' when parsing LESS variables.
30
- // This property indicates whether the 'AtRule' is a LESS variable.
31
- if (atRule.variable) {
32
- // TODO https://hello.atlassian.net/browse/DCA11Y-637
33
- }
34
-
35
- // @ts-expect-error
36
- atRule[processed] = true;
37
- },
38
- Declaration: function Declaration(decl) {
39
- // @ts-expect-error
40
- if (decl[processed]) {
41
- return;
42
- }
43
- if (decl.value === 'none') {
44
- return;
45
- }
46
- var baseMeta = getBaseDeclarationMeta(decl);
47
- if (isCssDeclaration(decl.prop)) {
48
- // TODO https://hello.atlassian.net/browse/DCA11Y-637
49
- }
50
- if (isColorRelatedProperty(decl.prop)) {
51
- var values = splitCssValue(decl.value);
52
- if (!values) {
53
- return;
54
- }
55
- switch (decl.prop) {
56
- case 'box-shadow':
57
- var meta = values.reduce(function (acc, curr) {
58
- var parsedValue = parseValue(curr);
59
- if (!parsedValue) {
60
- return acc;
61
- }
62
- return [].concat(_toConsumableArray(acc), _toConsumableArray(parsedValue.getMeta()));
63
- }, baseMeta);
64
- var token = findToken(meta);
65
- decl.value = "var(".concat(token, ", ").concat(decl.value, ")");
66
- break;
67
- default:
68
- var replacedValues = values.map(function (value) {
69
- var parsedValue = parseValue(value);
70
- if (!parsedValue) {
71
- return value;
72
- }
73
- return parsedValue.getReplacement(baseMeta);
74
- });
75
- decl.value = replacedValues.join(' ');
76
- break;
77
- }
78
- }
79
-
80
- // @ts-expect-error
81
- decl[processed] = true;
82
- }
83
- };
84
- };
85
- export default function transformer(_x) {
86
- return _transformer.apply(this, arguments);
87
- }
88
- function _transformer() {
89
- _transformer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file) {
90
- var processor, src, _yield$processor$proc, css;
91
- return _regeneratorRuntime.wrap(function _callee$(_context) {
92
- while (1) switch (_context.prev = _context.next) {
93
- case 0:
94
- processor = postcss([plugin()]);
95
- src = typeof file === 'string' ? file : file.source;
96
- _context.next = 4;
97
- return processor.process(src, POSTCSS_OPTIONS);
98
- case 4:
99
- _yield$processor$proc = _context.sent;
100
- css = _yield$processor$proc.css;
101
- return _context.abrupt("return", css);
102
- case 7:
103
- case "end":
104
- return _context.stop();
105
- }
106
- }, _callee);
107
- }));
108
- return _transformer.apply(this, arguments);
109
- }
@@ -1,38 +0,0 @@
1
- import { knownNamedColors, knownVariables } from './legacy-colors';
2
- var NAMED_COLORS = Object.keys(knownNamedColors);
3
- var GRADIENT_TYPES = ['linear', 'radial', 'conic'];
4
- var LESS_COLOR_FUNCTIONS = ['lighten', 'darken', 'saturate', 'desaturate', 'fadein', 'fadeout', 'fade', 'spin', 'mix', 'greyscale', 'contrast', 'multiply', 'screen', 'overlay', 'softlight', 'hardlight', 'difference', 'exclusion', 'average', 'negation', 'tint', 'shade', 'luma', 'hue', 'saturation', 'lightness', 'alpha', 'red', 'green', 'blue'];
5
- var REGEXES = {
6
- // The CSS regular expression matches CSS variable declarations.
7
- // It looks for the string "var(" followed by any characters except a closing parenthesis, and ending with a closing parenthesis.
8
- CSS: /var\([^\)]+\)/g,
9
- // The RAW_COLOR regular expression matches various CSS color formats including hexadecimal, RGB(A), HSL(A), LAB, LCH, and HWB.
10
- // It allows for optional leading and trailing white spaces.
11
- // For RGBA and HSLA, it allows any number (including negative numbers and numbers greater than 1) for the alpha channel.
12
- // For RGB, HSL, LAB, LCH, and HWB, it expects three comma-separated values.
13
- // It also allows optional white spaces around the commas and the values.
14
- RAW_COLOR: /^\s*(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\s*\d{1,3}%?\s*(,\s*\d{1,3}%?\s*){2},\s*-?\d*\.?\d+\s*\)|(rgb|hsl)\(\s*\d{1,3}%?\s*(,\s*\d{1,3}%?\s*){2}\)\s*|(lab|lch)\(\s*\d{1,3}%?\s+\d{1,3}%?\s+\d{1,3}%?\s*\)|hwb\(\s*\d{1,3}\s+\d{1,3}%?\s+\d{1,3}%?\s*\))\s*$/i
15
- };
16
- export function isKnownCssVariable(value) {
17
- return value in knownVariables;
18
- }
19
- export function isRawColor(value) {
20
- return REGEXES.RAW_COLOR.test(value);
21
- }
22
- export function isNamedColor(value) {
23
- return NAMED_COLORS.includes(value);
24
- }
25
- export function isGradient(value) {
26
- return GRADIENT_TYPES.some(function (gradient) {
27
- return value.startsWith("".concat(gradient, "-gradient("));
28
- });
29
- }
30
- export function extractBetweenParentheses(value) {
31
- var match = value.match(/\((.*?)\)/);
32
- return match ? match[1] : '';
33
- }
34
- export function isLessFunction(value) {
35
- return LESS_COLOR_FUNCTIONS.some(function (func) {
36
- return value.startsWith("".concat(func, "("));
37
- });
38
- }
@@ -1,19 +0,0 @@
1
- var COLOR_PROPERTIES = ['color', 'background', 'background-color', 'box-shadow', 'border', 'border-left', 'border-right', 'border-top', 'border-bottom', 'border-color', 'border-left-color', 'border-right-color', 'border-top-color', 'border-bottom-color', 'outline', 'outline-color', 'accent-color', 'caret-color', 'scrollbar-color', 'text-stroke'];
2
- export function isColorRelatedProperty(prop) {
3
- return COLOR_PROPERTIES.some(function (property) {
4
- return property === prop;
5
- });
6
- }
7
- export function isCssDeclaration(prop) {
8
- return prop.startsWith('--');
9
- }
10
- export function extractCssVarName(prop) {
11
- return prop.substring(prop.indexOf('(') + 1).split(/\,|\)/)[0];
12
- }
13
- export function extractLessVarName(prop) {
14
- return prop.substring(1);
15
- }
16
- export function splitCssValue(value) {
17
- var regex = /(?:[^\s()]+|\((?:[^()]+|\([^()]*\))*\))+/g;
18
- return value.match(regex);
19
- }