@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,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.containsReplaceableCSSDeclarations = containsReplaceableCSSDeclarations;
|
|
7
|
-
exports.findEndIndexOfCSSExpression = findEndIndexOfCSSExpression;
|
|
8
|
-
var _declaration = require("../../css-to-design-tokens/lib/declaration");
|
|
9
|
-
function containsReplaceableCSSDeclarations(input) {
|
|
10
|
-
var cssPattern = /(\S+)\s*:/g;
|
|
11
|
-
var match;
|
|
12
|
-
while ((match = cssPattern.exec(input)) !== null) {
|
|
13
|
-
if ((0, _declaration.isColorRelatedProperty)(match[1])) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
function findEndIndexOfCSSExpression(text, isAtEndOfInput) {
|
|
20
|
-
// CSS expression can end *on* a semicolon or *before* a brace. In either
|
|
21
|
-
// case we treat the remaining part of the value to cover one character
|
|
22
|
-
// before that symbol.
|
|
23
|
-
var semicolonIndex = text.indexOf(';');
|
|
24
|
-
var braceIndex = text.indexOf('}');
|
|
25
|
-
if (semicolonIndex === -1 && braceIndex === -1) {
|
|
26
|
-
if (isAtEndOfInput) {
|
|
27
|
-
return text.length;
|
|
28
|
-
} else {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
} else if (semicolonIndex === -1) {
|
|
32
|
-
return braceIndex - 1;
|
|
33
|
-
} else if (braceIndex === -1) {
|
|
34
|
-
return semicolonIndex - 1;
|
|
35
|
-
} else {
|
|
36
|
-
return Math.min(semicolonIndex, braceIndex) - 1;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Fuzzy search ripped from the internet.
|
|
11
|
-
*/
|
|
12
|
-
var FuzzySet = function FuzzySet() {
|
|
13
|
-
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
14
|
-
var useLevenshtein = arguments.length > 1 ? arguments[1] : undefined;
|
|
15
|
-
var gramSizeLower = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
16
|
-
var gramSizeUpper = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 3;
|
|
17
|
-
var fuzzyset = {
|
|
18
|
-
gramSizeLower: gramSizeLower,
|
|
19
|
-
gramSizeUpper: gramSizeUpper,
|
|
20
|
-
useLevenshtein: typeof useLevenshtein !== 'boolean' ? true : useLevenshtein,
|
|
21
|
-
exactSet: {},
|
|
22
|
-
matchDict: {},
|
|
23
|
-
items: {}
|
|
24
|
-
};
|
|
25
|
-
var levenshtein = function levenshtein(str1, str2) {
|
|
26
|
-
var current = [];
|
|
27
|
-
var prev;
|
|
28
|
-
var value;
|
|
29
|
-
for (var i = 0; i <= str2.length; i++) {
|
|
30
|
-
for (var j = 0; j <= str1.length; j++) {
|
|
31
|
-
if (i && j) {
|
|
32
|
-
if (str1.charAt(j - 1) === str2.charAt(i - 1)) {
|
|
33
|
-
// @ts-expect-error
|
|
34
|
-
value = prev;
|
|
35
|
-
} else {
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
value = Math.min(current[j], current[j - 1], prev) + 1;
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
value = i + j;
|
|
41
|
-
}
|
|
42
|
-
prev = current[j];
|
|
43
|
-
current[j] = value;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return current.pop();
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// return an edit distance from 0 to 1
|
|
50
|
-
var _distance = function _distance(str1, str2) {
|
|
51
|
-
if (str1 === null && str2 === null) {
|
|
52
|
-
throw new Error('Trying to compare two null values');
|
|
53
|
-
}
|
|
54
|
-
if (str1 === null || str2 === null) {
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
str1 = String(str1);
|
|
58
|
-
str2 = String(str2);
|
|
59
|
-
var distance = levenshtein(str1, str2);
|
|
60
|
-
if (str1.length > str2.length) {
|
|
61
|
-
return 1 - distance / str1.length;
|
|
62
|
-
} else {
|
|
63
|
-
return 1 - distance / str2.length;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var _nonWordRe = /[^a-zA-Z0-9\u00C0-\u00FF, ]+/g;
|
|
67
|
-
var _iterateGrams = function _iterateGrams(value, gramSize) {
|
|
68
|
-
gramSize = gramSize || 2;
|
|
69
|
-
var simplified = '-' + value.toLowerCase().replace(_nonWordRe, '') + '-',
|
|
70
|
-
lenDiff = gramSize - simplified.length,
|
|
71
|
-
results = [];
|
|
72
|
-
if (lenDiff > 0) {
|
|
73
|
-
for (var i = 0; i < lenDiff; ++i) {
|
|
74
|
-
simplified += '-';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
for (var i = 0; i < simplified.length - gramSize + 1; ++i) {
|
|
78
|
-
results.push(simplified.slice(i, i + gramSize));
|
|
79
|
-
}
|
|
80
|
-
return results;
|
|
81
|
-
};
|
|
82
|
-
var _gramCounter = function _gramCounter(value, gramSize) {
|
|
83
|
-
// return an object where key=gram, value=number of occurrences
|
|
84
|
-
gramSize = gramSize || 2;
|
|
85
|
-
var result = {},
|
|
86
|
-
grams = _iterateGrams(value, gramSize),
|
|
87
|
-
i = 0;
|
|
88
|
-
for (i; i < grams.length; ++i) {
|
|
89
|
-
if (grams[i] in result) {
|
|
90
|
-
// @ts-expect-error
|
|
91
|
-
result[grams[i]] += 1;
|
|
92
|
-
} else {
|
|
93
|
-
// @ts-expect-error
|
|
94
|
-
result[grams[i]] = 1;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// the main functions
|
|
101
|
-
fuzzyset.get = function (value, defaultValue, minMatchScore) {
|
|
102
|
-
// check for value in set, returning defaultValue or null if none found
|
|
103
|
-
if (minMatchScore === undefined) {
|
|
104
|
-
minMatchScore = 0.33;
|
|
105
|
-
}
|
|
106
|
-
var result = this._get(value, minMatchScore);
|
|
107
|
-
if (!result && typeof defaultValue !== 'undefined') {
|
|
108
|
-
return defaultValue;
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
};
|
|
112
|
-
fuzzyset._get = function (value, minMatchScore) {
|
|
113
|
-
var results = [];
|
|
114
|
-
// start with high gram size and if there are no results, go to lower gram sizes
|
|
115
|
-
for (var gramSize = this.gramSizeUpper; gramSize >= this.gramSizeLower; --gramSize) {
|
|
116
|
-
results = this.__get(value, gramSize, minMatchScore);
|
|
117
|
-
if (results && results.length > 0) {
|
|
118
|
-
return results;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
};
|
|
123
|
-
fuzzyset.__get = function (value, gramSize, minMatchScore) {
|
|
124
|
-
var normalizedValue = this._normalizeStr(value),
|
|
125
|
-
matches = {},
|
|
126
|
-
gramCounts = _gramCounter(normalizedValue, gramSize),
|
|
127
|
-
items = this.items[gramSize],
|
|
128
|
-
sumOfSquareGramCounts = 0,
|
|
129
|
-
gram,
|
|
130
|
-
gramCount,
|
|
131
|
-
i,
|
|
132
|
-
index,
|
|
133
|
-
otherGramCount;
|
|
134
|
-
for (gram in gramCounts) {
|
|
135
|
-
// @ts-expect-error
|
|
136
|
-
gramCount = gramCounts[gram];
|
|
137
|
-
sumOfSquareGramCounts += Math.pow(gramCount, 2);
|
|
138
|
-
if (gram in this.matchDict) {
|
|
139
|
-
for (i = 0; i < this.matchDict[gram].length; ++i) {
|
|
140
|
-
index = this.matchDict[gram][i][0];
|
|
141
|
-
otherGramCount = this.matchDict[gram][i][1];
|
|
142
|
-
if (index in matches) {
|
|
143
|
-
// @ts-expect-error
|
|
144
|
-
matches[index] += gramCount * otherGramCount;
|
|
145
|
-
} else {
|
|
146
|
-
// @ts-expect-error
|
|
147
|
-
matches[index] = gramCount * otherGramCount;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function isEmptyObject(obj) {
|
|
153
|
-
for (var prop in obj) {
|
|
154
|
-
if (obj.hasOwnProperty(prop)) {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
if (isEmptyObject(matches)) {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
var vectorNormal = Math.sqrt(sumOfSquareGramCounts),
|
|
164
|
-
results = [],
|
|
165
|
-
matchScore;
|
|
166
|
-
// build a results list of [score, str]
|
|
167
|
-
for (var matchIndex in matches) {
|
|
168
|
-
// @ts-expect-error
|
|
169
|
-
matchScore = matches[matchIndex];
|
|
170
|
-
results.push([matchScore / (vectorNormal * items[matchIndex][0]), items[matchIndex][1]]);
|
|
171
|
-
}
|
|
172
|
-
var sortDescending = function sortDescending(a, b) {
|
|
173
|
-
if (a[0] < b[0]) {
|
|
174
|
-
return 1;
|
|
175
|
-
} else if (a[0] > b[0]) {
|
|
176
|
-
return -1;
|
|
177
|
-
} else {
|
|
178
|
-
return 0;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
results.sort(sortDescending);
|
|
182
|
-
if (this.useLevenshtein) {
|
|
183
|
-
var newResults = [],
|
|
184
|
-
endIndex = Math.min(50, results.length);
|
|
185
|
-
// truncate somewhat arbitrarily to 50
|
|
186
|
-
// @ts-expect-error
|
|
187
|
-
for (var i = 0; i < endIndex; ++i) {
|
|
188
|
-
// @ts-expect-error
|
|
189
|
-
newResults.push([_distance(results[i][1], normalizedValue), results[i][1]]);
|
|
190
|
-
}
|
|
191
|
-
results = newResults;
|
|
192
|
-
results.sort(sortDescending);
|
|
193
|
-
}
|
|
194
|
-
newResults = [];
|
|
195
|
-
results.forEach(function (scoreWordPair) {
|
|
196
|
-
if (scoreWordPair[0] >= minMatchScore) {
|
|
197
|
-
// @ts-expect-error
|
|
198
|
-
newResults.push([scoreWordPair[0], this.exactSet[scoreWordPair[1]]]);
|
|
199
|
-
}
|
|
200
|
-
}.bind(this));
|
|
201
|
-
return newResults;
|
|
202
|
-
};
|
|
203
|
-
fuzzyset.add = function (value) {
|
|
204
|
-
var normalizedValue = this._normalizeStr(value);
|
|
205
|
-
if (normalizedValue in this.exactSet) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
var i = this.gramSizeLower;
|
|
209
|
-
for (i; i < this.gramSizeUpper + 1; ++i) {
|
|
210
|
-
this._add(value, i);
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
fuzzyset._add = function (value, gramSize) {
|
|
214
|
-
var normalizedValue = this._normalizeStr(value),
|
|
215
|
-
items = this.items[gramSize] || [],
|
|
216
|
-
index = items.length;
|
|
217
|
-
items.push(0);
|
|
218
|
-
var gramCounts = _gramCounter(normalizedValue, gramSize);
|
|
219
|
-
var sumOfSquareGramCounts = 0;
|
|
220
|
-
var gram;
|
|
221
|
-
var gramCount;
|
|
222
|
-
for (gram in gramCounts) {
|
|
223
|
-
// @ts-expect-error
|
|
224
|
-
gramCount = gramCounts[gram];
|
|
225
|
-
sumOfSquareGramCounts += Math.pow(gramCount, 2);
|
|
226
|
-
if (gram in this.matchDict) {
|
|
227
|
-
this.matchDict[gram].push([index, gramCount]);
|
|
228
|
-
} else {
|
|
229
|
-
this.matchDict[gram] = [[index, gramCount]];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
var vectorNormal = Math.sqrt(sumOfSquareGramCounts);
|
|
233
|
-
items[index] = [vectorNormal, normalizedValue];
|
|
234
|
-
this.items[gramSize] = items;
|
|
235
|
-
this.exactSet[normalizedValue] = value;
|
|
236
|
-
};
|
|
237
|
-
fuzzyset._normalizeStr = function (str) {
|
|
238
|
-
if (Object.prototype.toString.call(str) !== '[object String]') {
|
|
239
|
-
throw new Error('Must use a string as argument to FuzzySet functions');
|
|
240
|
-
}
|
|
241
|
-
return str.toLowerCase();
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
// return length of items in set
|
|
245
|
-
fuzzyset.length = function () {
|
|
246
|
-
var count = 0,
|
|
247
|
-
prop;
|
|
248
|
-
for (prop in this.exactSet) {
|
|
249
|
-
if (this.exactSet.hasOwnProperty(prop)) {
|
|
250
|
-
count += 1;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return count;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// return is set is empty
|
|
257
|
-
fuzzyset.isEmpty = function () {
|
|
258
|
-
for (var prop in this.exactSet) {
|
|
259
|
-
if (this.exactSet.hasOwnProperty(prop)) {
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return true;
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
// return list of values loaded into set
|
|
267
|
-
fuzzyset.values = function () {
|
|
268
|
-
var values = [],
|
|
269
|
-
prop;
|
|
270
|
-
for (prop in this.exactSet) {
|
|
271
|
-
if (this.exactSet.hasOwnProperty(prop)) {
|
|
272
|
-
values.push(this.exactSet[prop]);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return values;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
// initialization
|
|
279
|
-
var i = fuzzyset.gramSizeLower;
|
|
280
|
-
for (i; i < fuzzyset.gramSizeUpper + 1; ++i) {
|
|
281
|
-
fuzzyset.items[i] = [];
|
|
282
|
-
}
|
|
283
|
-
// add all the items to the set
|
|
284
|
-
for (i = 0; i < arr.length; ++i) {
|
|
285
|
-
fuzzyset.add(arr[i]);
|
|
286
|
-
}
|
|
287
|
-
return fuzzyset;
|
|
288
|
-
};
|
|
289
|
-
var _default = exports.default = FuzzySet;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.legacyColors = exports.legacyColorMixins = exports.legacyColorMetaMap = void 0;
|
|
7
|
-
var legacyColors = exports.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'];
|
|
8
|
-
var legacyColorMixins = exports.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'];
|
|
9
|
-
var legacyColorMetaMap = exports.legacyColorMetaMap = {
|
|
10
|
-
R50: ['danger'],
|
|
11
|
-
R75: ['danger'],
|
|
12
|
-
R100: ['danger'],
|
|
13
|
-
R200: ['danger'],
|
|
14
|
-
R300: ['danger', 'bold'],
|
|
15
|
-
R400: ['danger', 'bold'],
|
|
16
|
-
R500: ['danger', 'bold'],
|
|
17
|
-
Y50: ['warning'],
|
|
18
|
-
Y75: ['warning'],
|
|
19
|
-
Y100: ['warning'],
|
|
20
|
-
Y200: ['warning'],
|
|
21
|
-
Y300: ['warning', 'bold'],
|
|
22
|
-
Y400: ['warning', 'bold'],
|
|
23
|
-
Y500: ['warning', 'bold'],
|
|
24
|
-
G50: ['success'],
|
|
25
|
-
G75: ['success'],
|
|
26
|
-
G100: ['success'],
|
|
27
|
-
G200: ['success'],
|
|
28
|
-
G300: ['success'],
|
|
29
|
-
G400: ['success'],
|
|
30
|
-
G500: ['success'],
|
|
31
|
-
B50: ['information'],
|
|
32
|
-
B75: ['information'],
|
|
33
|
-
B100: ['information'],
|
|
34
|
-
B200: ['information'],
|
|
35
|
-
B300: ['information', 'bold'],
|
|
36
|
-
B400: ['information', 'bold'],
|
|
37
|
-
B500: ['information', 'bold'],
|
|
38
|
-
P50: ['discovery'],
|
|
39
|
-
P75: ['discovery'],
|
|
40
|
-
P100: ['discovery'],
|
|
41
|
-
P200: ['discovery'],
|
|
42
|
-
P300: ['discovery', 'bold'],
|
|
43
|
-
P400: ['discovery', 'bold'],
|
|
44
|
-
P500: ['discovery', 'bold'],
|
|
45
|
-
T50: ['accent', 'teal'],
|
|
46
|
-
T75: ['accent', 'teal'],
|
|
47
|
-
T100: ['accent', 'teal'],
|
|
48
|
-
T200: ['accent', 'teal'],
|
|
49
|
-
T300: ['accent', 'teal'],
|
|
50
|
-
T400: ['accent', 'teal'],
|
|
51
|
-
T500: ['accent', 'teal'],
|
|
52
|
-
N0: ['inverse'],
|
|
53
|
-
N10: ['neutral'],
|
|
54
|
-
N20: ['neutral'],
|
|
55
|
-
N30: ['neutral'],
|
|
56
|
-
N40: ['neutral'],
|
|
57
|
-
N50: ['neutral'],
|
|
58
|
-
N60: ['neutral'],
|
|
59
|
-
N70: ['neutral'],
|
|
60
|
-
N80: ['neutral'],
|
|
61
|
-
N90: ['neutral'],
|
|
62
|
-
N100: ['neutral'],
|
|
63
|
-
N200: ['neutral'],
|
|
64
|
-
N300: ['neutral'],
|
|
65
|
-
N400: ['neutral'],
|
|
66
|
-
N500: ['neutral'],
|
|
67
|
-
N600: ['neutral'],
|
|
68
|
-
N700: ['neutral'],
|
|
69
|
-
N800: ['neutral'],
|
|
70
|
-
N900: ['neutral'],
|
|
71
|
-
background: ['background', 'default'],
|
|
72
|
-
backgroundActive: ['background', 'pressed'],
|
|
73
|
-
backgroundHover: ['background', 'hovered'],
|
|
74
|
-
backgroundOnLayer: ['background', 'blanket'],
|
|
75
|
-
text: ['text'],
|
|
76
|
-
textHover: ['text', 'subtle'],
|
|
77
|
-
textActive: ['text', 'link', 'pressed'],
|
|
78
|
-
subtleText: ['text', 'subtlest'],
|
|
79
|
-
placeholderText: ['text', 'subtlest'],
|
|
80
|
-
heading: ['text'],
|
|
81
|
-
subtleHeading: ['text', 'subtle'],
|
|
82
|
-
link: ['link'],
|
|
83
|
-
linkHover: ['link', 'hovered'],
|
|
84
|
-
linkActive: ['link', 'pressed'],
|
|
85
|
-
linkOutline: ['border', 'selected'],
|
|
86
|
-
primary: ['brand'],
|
|
87
|
-
blue: ['accent', 'blue'],
|
|
88
|
-
teal: ['accent', 'teal'],
|
|
89
|
-
purple: ['accent', 'purple'],
|
|
90
|
-
red: ['accent', 'red'],
|
|
91
|
-
yellow: ['accent', 'orange'],
|
|
92
|
-
green: ['accent', 'green'],
|
|
93
|
-
grey: ['background', 'neutral'],
|
|
94
|
-
skeleton: ['skeleton'],
|
|
95
|
-
white: ['inverse']
|
|
96
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.namedColors = void 0;
|
|
7
|
-
var namedColors = exports.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,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findFirstNonspaceIndexAfter = findFirstNonspaceIndexAfter;
|
|
7
|
-
exports.kebabize = void 0;
|
|
8
|
-
exports.splitAtIndex = splitAtIndex;
|
|
9
|
-
var kebabize = exports.kebabize = function kebabize(str) {
|
|
10
|
-
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, function ($, ofs) {
|
|
11
|
-
return (ofs ? '-' : '') + $.toLowerCase();
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
function findFirstNonspaceIndexAfter(text, index) {
|
|
15
|
-
var rest = text.slice(index + 1);
|
|
16
|
-
var indexInRest = rest.search(/\S/);
|
|
17
|
-
if (indexInRest === -1) {
|
|
18
|
-
return text.length;
|
|
19
|
-
} else {
|
|
20
|
-
return index + 1 + indexInRest;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function splitAtIndex(text, index) {
|
|
24
|
-
return [text.slice(0, index), text.slice(index)];
|
|
25
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.tokens = exports.getUniqueWordsFromTokens = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _tokensRaw = require("@atlaskit/tokens/tokens-raw");
|
|
10
|
-
var tokens = exports.tokens = _tokensRaw.light.filter(function (t) {
|
|
11
|
-
return t.attributes.state === 'active';
|
|
12
|
-
}).map(function (t) {
|
|
13
|
-
return t.name.replace(/\.\[default\]/g, '');
|
|
14
|
-
}).filter(function (t) {
|
|
15
|
-
return !t.includes('UNSAFE') && !t.includes('interaction') && !t.includes('chart') && !t.includes('elevation.shadow.overflow');
|
|
16
|
-
});
|
|
17
|
-
var getUniqueWordsFromTokens = exports.getUniqueWordsFromTokens = tokens.reduce(function (accum, val) {
|
|
18
|
-
return [].concat((0, _toConsumableArray2.default)(accum), (0, _toConsumableArray2.default)(val.split('.')));
|
|
19
|
-
}, []).reduce(function (accum, val) {
|
|
20
|
-
return [].concat((0, _toConsumableArray2.default)(accum), (0, _toConsumableArray2.default)(val.split(/(?=[A-Z])/g).map(function (e) {
|
|
21
|
-
return e.toLowerCase();
|
|
22
|
-
})));
|
|
23
|
-
}, []).reduce(function (accum, val) {
|
|
24
|
-
if (!accum.includes(val)) {
|
|
25
|
-
accum.push(val);
|
|
26
|
-
}
|
|
27
|
-
return accum;
|
|
28
|
-
}, []);
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import postcss from 'postcss';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import lessSyntax from 'postcss-less';
|
|
4
|
-
import { isColorRelatedProperty, isCssDeclaration, splitCssValue } from './lib/declaration';
|
|
5
|
-
import { getBaseDeclarationMeta } from './lib/meta';
|
|
6
|
-
import findToken from './lib/tokens';
|
|
7
|
-
import parseValue from './lib/value';
|
|
8
|
-
const POSTCSS_OPTIONS = {
|
|
9
|
-
syntax: lessSyntax,
|
|
10
|
-
from: undefined
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// https://github.com/postcss/postcss/blob/main/docs/writing-a-plugin.md
|
|
14
|
-
// https://astexplorer.net/#/2uBU1BLuJ1
|
|
15
|
-
const plugin = () => {
|
|
16
|
-
const processed = Symbol('processed');
|
|
17
|
-
return {
|
|
18
|
-
postcssPlugin: 'UsingTokens',
|
|
19
|
-
AtRule(atRule, helper) {
|
|
20
|
-
// @ts-expect-error
|
|
21
|
-
if (atRule[processed]) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// @ts-expect-error: The 'variable' property does not exist on 'AtRule' according to the TypeScript definitions.
|
|
26
|
-
// However, the 'postcss-less' library adds a 'variable' property to 'AtRule' when parsing LESS variables.
|
|
27
|
-
// This property indicates whether the 'AtRule' is a LESS variable.
|
|
28
|
-
if (atRule.variable) {
|
|
29
|
-
// TODO https://hello.atlassian.net/browse/DCA11Y-637
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// @ts-expect-error
|
|
33
|
-
atRule[processed] = true;
|
|
34
|
-
},
|
|
35
|
-
Declaration: decl => {
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
if (decl[processed]) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (decl.value === 'none') {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const baseMeta = getBaseDeclarationMeta(decl);
|
|
44
|
-
if (isCssDeclaration(decl.prop)) {
|
|
45
|
-
// TODO https://hello.atlassian.net/browse/DCA11Y-637
|
|
46
|
-
}
|
|
47
|
-
if (isColorRelatedProperty(decl.prop)) {
|
|
48
|
-
const values = splitCssValue(decl.value);
|
|
49
|
-
if (!values) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
switch (decl.prop) {
|
|
53
|
-
case 'box-shadow':
|
|
54
|
-
const meta = values.reduce((acc, curr) => {
|
|
55
|
-
const parsedValue = parseValue(curr);
|
|
56
|
-
if (!parsedValue) {
|
|
57
|
-
return acc;
|
|
58
|
-
}
|
|
59
|
-
return [...acc, ...parsedValue.getMeta()];
|
|
60
|
-
}, baseMeta);
|
|
61
|
-
const token = findToken(meta);
|
|
62
|
-
decl.value = `var(${token}, ${decl.value})`;
|
|
63
|
-
break;
|
|
64
|
-
default:
|
|
65
|
-
const replacedValues = values.map(value => {
|
|
66
|
-
const parsedValue = parseValue(value);
|
|
67
|
-
if (!parsedValue) {
|
|
68
|
-
return value;
|
|
69
|
-
}
|
|
70
|
-
return parsedValue.getReplacement(baseMeta);
|
|
71
|
-
});
|
|
72
|
-
decl.value = replacedValues.join(' ');
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// @ts-expect-error
|
|
78
|
-
decl[processed] = true;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
export default async function transformer(file) {
|
|
83
|
-
const processor = postcss([plugin()]);
|
|
84
|
-
const src = typeof file === 'string' ? file : file.source;
|
|
85
|
-
const {
|
|
86
|
-
css
|
|
87
|
-
} = await processor.process(src, POSTCSS_OPTIONS);
|
|
88
|
-
return css;
|
|
89
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { knownNamedColors, knownVariables } from './legacy-colors';
|
|
2
|
-
const NAMED_COLORS = Object.keys(knownNamedColors);
|
|
3
|
-
const GRADIENT_TYPES = ['linear', 'radial', 'conic'];
|
|
4
|
-
const 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
|
-
const 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(gradient => value.startsWith(`${gradient}-gradient(`));
|
|
27
|
-
}
|
|
28
|
-
export function extractBetweenParentheses(value) {
|
|
29
|
-
const match = value.match(/\((.*?)\)/);
|
|
30
|
-
return match ? match[1] : '';
|
|
31
|
-
}
|
|
32
|
-
export function isLessFunction(value) {
|
|
33
|
-
return LESS_COLOR_FUNCTIONS.some(func => value.startsWith(`${func}(`));
|
|
34
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const 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(property => property === prop);
|
|
4
|
-
}
|
|
5
|
-
export function isCssDeclaration(prop) {
|
|
6
|
-
return prop.startsWith('--');
|
|
7
|
-
}
|
|
8
|
-
export function extractCssVarName(prop) {
|
|
9
|
-
return prop.substring(prop.indexOf('(') + 1).split(/\,|\)/)[0];
|
|
10
|
-
}
|
|
11
|
-
export function extractLessVarName(prop) {
|
|
12
|
-
return prop.substring(1);
|
|
13
|
-
}
|
|
14
|
-
export function splitCssValue(value) {
|
|
15
|
-
const regex = /(?:[^\s()]+|\((?:[^()]+|\([^()]*\))*\))+/g;
|
|
16
|
-
return value.match(regex);
|
|
17
|
-
}
|