@semcore/core 16.5.1 → 16.5.2-prerelease.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +4 -4
- package/lib/theme/themes/auto.css +198 -198
- package/lib/theme/themes/dark.css +99 -99
- package/lib/theme/themes/dark.d.ts +59 -59
- package/lib/theme/themes/dark.js +59 -59
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/dark.mjs +59 -59
- package/lib/theme/themes/dark.mjs.map +1 -1
- package/lib/theme/themes/default.css +100 -100
- package/lib/theme/themes/default.d.ts +59 -59
- package/lib/theme/themes/default.js +59 -59
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/default.mjs +59 -59
- package/lib/theme/themes/default.mjs.map +1 -1
- package/lib/theme/themes/light.css +100 -100
- package/lib/theme/themes/light.d.ts +59 -59
- package/lib/theme/themes/light.js +59 -59
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/theme/themes/light.mjs +59 -59
- package/lib/theme/themes/light.mjs.map +1 -1
- package/lib/utils/ScreenReaderOnly.d.ts +4 -4
- package/lib/utils/ScreenReaderOnly.js +3 -3
- package/lib/utils/ScreenReaderOnly.js.map +1 -1
- package/lib/utils/ScreenReaderOnly.mjs +2 -2
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -1
- package/lib/utils/injectStyle.js +1 -1
- package/lib/utils/injectStyle.mjs +1 -1
- package/lib/utils/isInteractiveElement.js +1 -1
- package/lib/utils/isInteractiveElement.js.map +1 -1
- package/lib/utils/isInteractiveElement.mjs +1 -1
- package/lib/utils/isInteractiveElement.mjs.map +1 -1
- package/lib/utils/use/usePreventScroll.js +7 -9
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +7 -9
- package/lib/utils/use/usePreventScroll.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/theme/dark.json +0 -2695
- package/lib/theme/light.json +0 -2730
- package/lib/theme/processor.d.ts +0 -1
- package/lib/theme/processor.js +0 -299
- package/lib/theme/processor.js.map +0 -1
- package/lib/theme/processor.mjs +0 -292
- package/lib/theme/processor.mjs.map +0 -1
- package/lib/theme/utils.d.ts +0 -58
- package/lib/theme/utils.js +0 -326
- package/lib/theme/utils.js.map +0 -1
- package/lib/theme/utils.mjs +0 -319
- package/lib/theme/utils.mjs.map +0 -1
package/lib/theme/utils.mjs
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
5
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
6
|
-
import ColorJS from 'colorjs.io';
|
|
7
|
-
var Color = ColorJS;
|
|
8
|
-
export var processTokens = function processTokens(base, tokens, featureHighlight, prefix) {
|
|
9
|
-
var values = {};
|
|
10
|
-
var basicTokens = new Set();
|
|
11
|
-
var highlightTokens = new Set();
|
|
12
|
-
var modifications = {};
|
|
13
|
-
var types = {};
|
|
14
|
-
var descriptions = {};
|
|
15
|
-
var mixins = [];
|
|
16
|
-
var _traverse = function traverse(node) {
|
|
17
|
-
var pathParts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
18
|
-
var setToAdd = arguments.length > 2 ? arguments[2] : undefined;
|
|
19
|
-
for (var key in node) {
|
|
20
|
-
if (key === 'type') continue;
|
|
21
|
-
if (key === 'value') continue;
|
|
22
|
-
if (key === 'description') continue;
|
|
23
|
-
if (key === '$extensions') continue;
|
|
24
|
-
_traverse(node[key], [].concat(_toConsumableArray(pathParts), [key]), setToAdd);
|
|
25
|
-
}
|
|
26
|
-
if ('type' in node && typeof node.type === 'string') {
|
|
27
|
-
var path = pathParts.join('-');
|
|
28
|
-
types[path] = node.type;
|
|
29
|
-
if (_typeof(node.value) === 'object') {
|
|
30
|
-
mixins.push(path);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (values[path]) {
|
|
34
|
-
throw new Error("Duplicated design token \"".concat(path, "\""));
|
|
35
|
-
}
|
|
36
|
-
values[path] = node.value;
|
|
37
|
-
setToAdd === null || setToAdd === void 0 || setToAdd.add(path);
|
|
38
|
-
if (typeof node.description === 'string') descriptions[path] = node.description;
|
|
39
|
-
if (node.$extensions) {
|
|
40
|
-
for (var extension in node.$extensions) {
|
|
41
|
-
if (extension === 'studio.tokens') {
|
|
42
|
-
var _modifications$path;
|
|
43
|
-
(_modifications$path = modifications[path]) !== null && _modifications$path !== void 0 ? _modifications$path : modifications[path] = [];
|
|
44
|
-
modifications[path].push(node.$extensions['studio.tokens'].modify);
|
|
45
|
-
} else {
|
|
46
|
-
throw new Error("Unsupported extension \"".concat(extension, "\" for design token \"").concat(path, "\""));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
_traverse(base, [], basicTokens);
|
|
53
|
-
_traverse(tokens);
|
|
54
|
-
_traverse(featureHighlight, [], highlightTokens);
|
|
55
|
-
var _resolveColor = function resolveColor(color) {
|
|
56
|
-
if (color.includes('linear-gradient')) {
|
|
57
|
-
if (color.includes('rgba')) {
|
|
58
|
-
return replaceColors(color);
|
|
59
|
-
} else {
|
|
60
|
-
return color.replace(/\{[a-z0-9.]+\}/g, _resolveColor);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (color.startsWith('rgba(') && color.endsWith(')')) {
|
|
64
|
-
var lastComa = color.lastIndexOf(',');
|
|
65
|
-
var alpha = Number.parseFloat(color.substring(lastComa + 1, color.length - 1));
|
|
66
|
-
if (Number.isNaN(alpha)) {
|
|
67
|
-
throw new Error("Unable to parse rgba of ".concat(color));
|
|
68
|
-
}
|
|
69
|
-
var resolvedColor = color.substring('rgba('.length, lastComa);
|
|
70
|
-
if (resolvedColor.startsWith('{')) resolvedColor = _resolveColor(resolvedColor);
|
|
71
|
-
if (resolvedColor.startsWith('$')) resolvedColor = _resolveColor(resolvedColor);
|
|
72
|
-
if (resolvedColor.startsWith('#')) {
|
|
73
|
-
if (resolvedColor.length === 1 + 3) {
|
|
74
|
-
resolvedColor = [resolvedColor[1], resolvedColor[2], resolvedColor[3]].map(function (hex) {
|
|
75
|
-
return Number.parseInt(hex, 16);
|
|
76
|
-
}).join(', ');
|
|
77
|
-
} else if (resolvedColor.length === 1 + 6) {
|
|
78
|
-
resolvedColor = [resolvedColor.substring(1, 3), resolvedColor.substring(3, 5), resolvedColor.substring(5, 7)].map(function (hex) {
|
|
79
|
-
return Number.parseInt(hex, 16);
|
|
80
|
-
}).join(', ');
|
|
81
|
-
} else {
|
|
82
|
-
throw new Error("Unable to convert hex ".concat(_resolveColor, " to rgb list of colors (processing ").concat(color, ")"));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (!resolvedColor || resolvedColor.split(',').length !== 3) {
|
|
86
|
-
throw new Error("Unable to produce rgba of ".concat(color, " (input format is not supported yet)"));
|
|
87
|
-
}
|
|
88
|
-
return "rgba(".concat(resolvedColor, ", ").concat(alpha, ")");
|
|
89
|
-
}
|
|
90
|
-
if (color.split(', ').length === 2) {
|
|
91
|
-
var baseColor = _resolveColor(color.split(', ')[0]);
|
|
92
|
-
var _map = (baseColor.length === 4 ? [baseColor[1], baseColor[2], baseColor[3]] : [baseColor.substring(1, 3), baseColor.substring(3, 5), baseColor.substring(5, 7)]).map(function (chunk) {
|
|
93
|
-
return Number.parseInt(chunk, 16);
|
|
94
|
-
}),
|
|
95
|
-
_map2 = _slicedToArray(_map, 3),
|
|
96
|
-
r = _map2[0],
|
|
97
|
-
g = _map2[1],
|
|
98
|
-
b = _map2[2];
|
|
99
|
-
var a = Number.parseFloat(color.split(', ')[1]);
|
|
100
|
-
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(a, ")");
|
|
101
|
-
}
|
|
102
|
-
if (color.startsWith('{') && color.split('.').length > 0 && color.endsWith('}')) {
|
|
103
|
-
var _getByPath$value, _getByPath;
|
|
104
|
-
var path = color.substring(1, color.length - 1);
|
|
105
|
-
var _resolvedColor = (_getByPath$value = (_getByPath = getByPath(base, path)) === null || _getByPath === void 0 ? void 0 : _getByPath.value) !== null && _getByPath$value !== void 0 ? _getByPath$value : values[path.split('.').join('-')];
|
|
106
|
-
if (!_resolvedColor) {
|
|
107
|
-
throw new Error("Color ".concat(color, " was not found in base palette"));
|
|
108
|
-
}
|
|
109
|
-
return _resolvedColor;
|
|
110
|
-
}
|
|
111
|
-
if (color.startsWith('$') && color.split('.').length > 0) {
|
|
112
|
-
var _getByPath$value2, _getByPath2;
|
|
113
|
-
var _path = color.substring(1);
|
|
114
|
-
var _resolvedColor2 = (_getByPath$value2 = (_getByPath2 = getByPath(base, _path)) === null || _getByPath2 === void 0 ? void 0 : _getByPath2.value) !== null && _getByPath$value2 !== void 0 ? _getByPath$value2 : values[_path.split('.').join('-')];
|
|
115
|
-
if (!_resolvedColor2) {
|
|
116
|
-
throw new Error("Color ".concat(color, " was not found"));
|
|
117
|
-
}
|
|
118
|
-
return _resolvedColor2;
|
|
119
|
-
}
|
|
120
|
-
if (color.startsWith('#')) {
|
|
121
|
-
return color;
|
|
122
|
-
}
|
|
123
|
-
throw new Error("Unable to process color ".concat(color));
|
|
124
|
-
};
|
|
125
|
-
var _resolveToken = function resolveToken(token) {
|
|
126
|
-
if (token.includes('*')) {
|
|
127
|
-
var _token$split = token.split('*'),
|
|
128
|
-
_token$split2 = _slicedToArray(_token$split, 2),
|
|
129
|
-
value = _token$split2[0],
|
|
130
|
-
factor = _token$split2[1];
|
|
131
|
-
var resolvedValue = _resolveToken(value);
|
|
132
|
-
if (!resolvedValue.endsWith('px')) {
|
|
133
|
-
throw new Error("Unsupported expression ".concat(token));
|
|
134
|
-
}
|
|
135
|
-
return "".concat(Number.parseFloat(resolvedValue) * Number.parseFloat(factor), "px");
|
|
136
|
-
} else if (token.includes('{') && token.includes('}')) {
|
|
137
|
-
var reference = token.substring(token.indexOf('{') + 1, token.indexOf('}')).replace(/\./g, '-');
|
|
138
|
-
var resolvedToken = token.substring(0, token.indexOf('{')) + values[reference] + token.substring(token.indexOf('}') + 1);
|
|
139
|
-
if (!resolvedToken || resolvedToken.includes('{')) {
|
|
140
|
-
throw new Error("On moment of resolving ".concat(token, ", ").concat(resolvedToken, " was not resolved yet"));
|
|
141
|
-
}
|
|
142
|
-
return resolvedToken;
|
|
143
|
-
} else {
|
|
144
|
-
return token;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
var replaceColors = function replaceColors(str) {
|
|
148
|
-
var result = '';
|
|
149
|
-
for (var i = 0; i < str.length; i++) {
|
|
150
|
-
if (str.substring(i, i + 'rgba('.length) === 'rgba(') {
|
|
151
|
-
var start = i;
|
|
152
|
-
while (str[i] !== undefined && str[i] !== ')') i++;
|
|
153
|
-
result += _resolveColor(str.substring(start, i + 1));
|
|
154
|
-
} else {
|
|
155
|
-
result += str[i];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return result;
|
|
159
|
-
};
|
|
160
|
-
var rawValues = _objectSpread({}, values);
|
|
161
|
-
for (var token in values) {
|
|
162
|
-
var _modifications$token;
|
|
163
|
-
if (types[token] === 'color') {
|
|
164
|
-
values[token] = _resolveColor(values[token]);
|
|
165
|
-
} else if (types[token] === 'boxShadow') {
|
|
166
|
-
values[token] = _resolveToken(values[token].split('; ').map(replaceColors).join(', '));
|
|
167
|
-
} else if (types[token] === 'sizing' || types[token] === 'spacing' || types[token] === 'borderRadius' || types[token] === 'other') {
|
|
168
|
-
values[token] = _resolveToken(values[token]);
|
|
169
|
-
}
|
|
170
|
-
var _iterator = _createForOfIteratorHelper((_modifications$token = modifications[token]) !== null && _modifications$token !== void 0 ? _modifications$token : []),
|
|
171
|
-
_step;
|
|
172
|
-
try {
|
|
173
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
174
|
-
var _values$token$match;
|
|
175
|
-
var modification = _step.value;
|
|
176
|
-
// refer to https://docs.tokens.studio/tokens/color-modifiers and https://github.com/tokens-studio/figma-plugin/tree/main/src/utils/color if extension is needed
|
|
177
|
-
|
|
178
|
-
rawValues[token] = "".concat(rawValues[token], " / ").concat(modification.type, "(").concat(modification.value, ") / ").concat(modification.space);
|
|
179
|
-
|
|
180
|
-
// array + regex to process gradients with several colors
|
|
181
|
-
var colorRegex = /(#[0-9a-f]{6}|rgba\([0-9., ]+\))/gi;
|
|
182
|
-
var colors = (_values$token$match = values[token].match(colorRegex)) !== null && _values$token$match !== void 0 ? _values$token$match : [];
|
|
183
|
-
var _iterator2 = _createForOfIteratorHelper(colors),
|
|
184
|
-
_step2;
|
|
185
|
-
try {
|
|
186
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
187
|
-
var originalColor = _step2.value;
|
|
188
|
-
var color = new Color(originalColor);
|
|
189
|
-
if (modification.space === 'hsl') {
|
|
190
|
-
if (modification.type === 'lighten') {
|
|
191
|
-
var lightness = color.hsl.l;
|
|
192
|
-
var difference = 100 - lightness;
|
|
193
|
-
color.set('hsl.l', Math.min(100, lightness + difference * modification.value));
|
|
194
|
-
} else {
|
|
195
|
-
throw new Error("Unsupported color modification ".concat(modification.type, " of token ").concat(token));
|
|
196
|
-
}
|
|
197
|
-
} else {
|
|
198
|
-
throw new Error("Unsupported color space ".concat(modification.space, " of token ").concat(token));
|
|
199
|
-
}
|
|
200
|
-
color = color.to('sRGB');
|
|
201
|
-
var modifiedColor = '';
|
|
202
|
-
if (color.alpha !== 1) {
|
|
203
|
-
var r = Math.round(color.r * 255);
|
|
204
|
-
var g = Math.round(color.g * 255);
|
|
205
|
-
var b = Math.round(color.b * 255);
|
|
206
|
-
var a = color.alpha;
|
|
207
|
-
modifiedColor = "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(a, ")");
|
|
208
|
-
} else {
|
|
209
|
-
modifiedColor = color.toString({
|
|
210
|
-
format: 'hex'
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
values[token] = values[token].replace(originalColor, modifiedColor);
|
|
214
|
-
}
|
|
215
|
-
} catch (err) {
|
|
216
|
-
_iterator2.e(err);
|
|
217
|
-
} finally {
|
|
218
|
-
_iterator2.f();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
} catch (err) {
|
|
222
|
-
_iterator.e(err);
|
|
223
|
-
} finally {
|
|
224
|
-
_iterator.f();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
var processedTokens = [];
|
|
228
|
-
var highlightsTokens = [];
|
|
229
|
-
for (var _token in values) {
|
|
230
|
-
var isBase = basicTokens.has(_token);
|
|
231
|
-
(highlightTokens.has(_token) ? highlightsTokens : processedTokens).push({
|
|
232
|
-
name: isBase ? "--".concat(_token) : "--".concat(prefix, "-").concat(_token),
|
|
233
|
-
description: descriptions[_token],
|
|
234
|
-
value: values[_token]
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
return {
|
|
238
|
-
processedTokens: processedTokens,
|
|
239
|
-
highlightsTokens: highlightsTokens,
|
|
240
|
-
values: values,
|
|
241
|
-
types: types,
|
|
242
|
-
rawValues: rawValues,
|
|
243
|
-
descriptions: descriptions,
|
|
244
|
-
basicTokens: basicTokens
|
|
245
|
-
};
|
|
246
|
-
};
|
|
247
|
-
export var tokensToCss = function tokensToCss(tokens) {
|
|
248
|
-
var selector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ':root';
|
|
249
|
-
var cssLines = [];
|
|
250
|
-
cssLines.push("".concat(selector, " {"));
|
|
251
|
-
var _iterator3 = _createForOfIteratorHelper(tokens),
|
|
252
|
-
_step3;
|
|
253
|
-
try {
|
|
254
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
255
|
-
var token = _step3.value;
|
|
256
|
-
if (token.description) cssLines.push(" /* ".concat(token.description, " */"));
|
|
257
|
-
cssLines.push(" ".concat(token.name, ": ").concat(token.value, ";"));
|
|
258
|
-
}
|
|
259
|
-
} catch (err) {
|
|
260
|
-
_iterator3.e(err);
|
|
261
|
-
} finally {
|
|
262
|
-
_iterator3.f();
|
|
263
|
-
}
|
|
264
|
-
cssLines.push('}');
|
|
265
|
-
return cssLines.join('\n');
|
|
266
|
-
};
|
|
267
|
-
export var tokensToJson = function tokensToJson(tokens) {
|
|
268
|
-
var themeFile = {};
|
|
269
|
-
var _iterator4 = _createForOfIteratorHelper(tokens),
|
|
270
|
-
_step4;
|
|
271
|
-
try {
|
|
272
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
273
|
-
var token = _step4.value;
|
|
274
|
-
themeFile[token.name] = token.value;
|
|
275
|
-
}
|
|
276
|
-
} catch (err) {
|
|
277
|
-
_iterator4.e(err);
|
|
278
|
-
} finally {
|
|
279
|
-
_iterator4.f();
|
|
280
|
-
}
|
|
281
|
-
return JSON.stringify(themeFile, null, 2) + '\n';
|
|
282
|
-
};
|
|
283
|
-
export var tokensToJs = function tokensToJs(tokens) {
|
|
284
|
-
var jsLines = [];
|
|
285
|
-
jsLines.push('export default {');
|
|
286
|
-
var _iterator5 = _createForOfIteratorHelper(tokens),
|
|
287
|
-
_step5;
|
|
288
|
-
try {
|
|
289
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
290
|
-
var token = _step5.value;
|
|
291
|
-
jsLines.push(" '".concat(token.name, "': '").concat(token.value, "',"));
|
|
292
|
-
}
|
|
293
|
-
} catch (err) {
|
|
294
|
-
_iterator5.e(err);
|
|
295
|
-
} finally {
|
|
296
|
-
_iterator5.f();
|
|
297
|
-
}
|
|
298
|
-
jsLines.push('};\n');
|
|
299
|
-
return jsLines.join('\n');
|
|
300
|
-
};
|
|
301
|
-
var getByPath = function getByPath(obj, path) {
|
|
302
|
-
var parts = path.split('.');
|
|
303
|
-
var result = obj;
|
|
304
|
-
var _iterator6 = _createForOfIteratorHelper(parts),
|
|
305
|
-
_step6;
|
|
306
|
-
try {
|
|
307
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
308
|
-
var _result;
|
|
309
|
-
var part = _step6.value;
|
|
310
|
-
result = (_result = result) === null || _result === void 0 ? void 0 : _result[part];
|
|
311
|
-
}
|
|
312
|
-
} catch (err) {
|
|
313
|
-
_iterator6.e(err);
|
|
314
|
-
} finally {
|
|
315
|
-
_iterator6.f();
|
|
316
|
-
}
|
|
317
|
-
return result;
|
|
318
|
-
};
|
|
319
|
-
//# sourceMappingURL=utils.mjs.map
|
package/lib/theme/utils.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":["ColorJS","Color","processTokens","base","tokens","featureHighlight","prefix","values","basicTokens","Set","highlightTokens","modifications","types","descriptions","mixins","traverse","node","pathParts","arguments","length","undefined","setToAdd","key","concat","_toConsumableArray","type","path","join","_typeof","value","push","Error","add","description","$extensions","extension","_modifications$path","modify","resolveColor","color","includes","replaceColors","replace","startsWith","endsWith","lastComa","lastIndexOf","alpha","Number","parseFloat","substring","isNaN","resolvedColor","map","hex","parseInt","split","baseColor","_map","chunk","_map2","_slicedToArray","r","g","b","a","_getByPath$value","_getByPath","getByPath","_getByPath$value2","_getByPath2","resolveToken","token","_token$split","_token$split2","factor","resolvedValue","reference","indexOf","resolvedToken","str","result","i","start","rawValues","_objectSpread","_modifications$token","_iterator","_createForOfIteratorHelper","_step","s","n","done","_values$token$match","modification","space","colorRegex","colors","match","_iterator2","_step2","originalColor","lightness","hsl","l","difference","set","Math","min","to","modifiedColor","round","toString","format","err","e","f","processedTokens","highlightsTokens","isBase","has","name","tokensToCss","selector","cssLines","_iterator3","_step3","tokensToJson","themeFile","_iterator4","_step4","JSON","stringify","tokensToJs","jsLines","_iterator5","_step5","obj","parts","_iterator6","_step6","_result","part"],"sources":["../../src/theme/utils.ts"],"sourcesContent":["import ColorJS from 'colorjs.io';\nconst Color = ColorJS as any;\n\ntype ExtensionsInput = {\n 'studio.tokens': {\n modify: {\n type: string;\n value: number;\n space: string;\n };\n };\n};\n\ntype TokensInput = {\n [nestedKey: string]:\n | TokensInput\n | {\n value: string;\n type: string;\n description: string;\n $extensions?: ExtensionsInput;\n };\n};\n\nexport const processTokens = (base: TokensInput, tokens: TokensInput, featureHighlight: TokensInput, prefix: string) => {\n const values: { [tokenName: string]: string } = {};\n const basicTokens = new Set<string>();\n const highlightTokens = new Set<string>();\n const modifications: {\n [tokenName: string]: {\n type: 'lighten' | 'darken' | 'alpha';\n value: number;\n space: 'lch' | 'srgb' | 'p3' | 'hsl';\n }[];\n } = {};\n const types: { [tokenName: string]: string } = {};\n const descriptions: { [tokenName: string]: string } = {};\n const mixins: string[] = [];\n type ColorPattern =\n | `{${string}.${string}}`\n | `{${string}.${string}}, ${number}`\n | `#${string}`\n | `{${string}.${string}}, ${number}`;\n type DesignTokenNode =\n | {\n type: string;\n value:\n | string\n | { [subTokens: string]: `{${string}}` }\n | ColorPattern\n | `{${string}}`\n | `{${string}*${number}}`\n | `${ColorPattern}; ${ColorPattern}`;\n\n description?: string;\n $extensions?: ExtensionsInput;\n }\n | DesignTokenTree;\n type DesignTokenTree = { [childrenNodeName: string]: DesignTokenNode };\n const traverse = (node: DesignTokenNode, pathParts: string[] = [], setToAdd?: Set<string>) => {\n for (const key in node) {\n if (key === 'type') continue;\n if (key === 'value') continue;\n if (key === 'description') continue;\n if (key === '$extensions') continue;\n traverse((node as any)[key], [...pathParts, key], setToAdd);\n }\n if ('type' in node && typeof node.type === 'string') {\n const path = pathParts.join('-');\n types[path] = node.type;\n if (typeof node.value === 'object') {\n mixins.push(path);\n return;\n }\n if (values[path]) {\n throw new Error(`Duplicated design token \"${path}\"`);\n }\n values[path] = node.value;\n setToAdd?.add(path);\n\n if (typeof node.description === 'string') descriptions[path] = node.description;\n if (node.$extensions) {\n for (const extension in node.$extensions) {\n if (extension === 'studio.tokens') {\n modifications[path] ??= [];\n modifications[path].push((node.$extensions as any)['studio.tokens'].modify);\n } else {\n throw new Error(`Unsupported extension \"${extension}\" for design token \"${path}\"`);\n }\n }\n }\n }\n };\n\n traverse(base, [], basicTokens);\n traverse(tokens);\n traverse(featureHighlight, [], highlightTokens);\n\n const resolveColor = (color: string): string => {\n if (color.includes('linear-gradient')) {\n if (color.includes('rgba')) {\n return replaceColors(color);\n } else {\n return color.replace(/\\{[a-z0-9.]+\\}/g, resolveColor);\n }\n }\n if (color.startsWith('rgba(') && color.endsWith(')')) {\n const lastComa = color.lastIndexOf(',');\n const alpha = Number.parseFloat(color.substring(lastComa + 1, color.length - 1));\n if (Number.isNaN(alpha)) {\n throw new Error(`Unable to parse rgba of ${color}`);\n }\n let resolvedColor = color.substring('rgba('.length, lastComa);\n if (resolvedColor.startsWith('{')) resolvedColor = resolveColor(resolvedColor);\n if (resolvedColor.startsWith('$')) resolvedColor = resolveColor(resolvedColor);\n if (resolvedColor.startsWith('#')) {\n if (resolvedColor.length === 1 + 3) {\n resolvedColor = [resolvedColor[1], resolvedColor[2], resolvedColor[3]]\n .map((hex) => Number.parseInt(hex, 16))\n .join(', ');\n } else if (resolvedColor.length === 1 + 6) {\n resolvedColor = [\n resolvedColor.substring(1, 3),\n resolvedColor.substring(3, 5),\n resolvedColor.substring(5, 7),\n ]\n .map((hex) => Number.parseInt(hex, 16))\n .join(', ');\n } else {\n throw new Error(\n `Unable to convert hex ${resolveColor} to rgb list of colors (processing ${color})`,\n );\n }\n }\n\n if (!resolvedColor || resolvedColor.split(',').length !== 3) {\n throw new Error(`Unable to produce rgba of ${color} (input format is not supported yet)`);\n }\n\n return `rgba(${resolvedColor}, ${alpha})`;\n }\n if (color.split(', ').length === 2) {\n const baseColor = resolveColor(color.split(', ')[0]);\n const [r, g, b] = (\n baseColor.length === 4\n ? [baseColor[1], baseColor[2], baseColor[3]]\n : [baseColor.substring(1, 3), baseColor.substring(3, 5), baseColor.substring(5, 7)]\n ).map((chunk) => Number.parseInt(chunk, 16));\n const a = Number.parseFloat(color.split(', ')[1]);\n\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n }\n if (color.startsWith('{') && color.split('.').length > 0 && color.endsWith('}')) {\n const path = color.substring(1, color.length - 1);\n const resolvedColor =\n getByPath(base as any, path)?.value ?? values[path.split('.').join('-')];\n if (!resolvedColor) {\n throw new Error(`Color ${color} was not found in base palette`);\n }\n return resolvedColor;\n }\n if (color.startsWith('$') && color.split('.').length > 0) {\n const path = color.substring(1);\n const resolvedColor =\n getByPath(base as any, path)?.value ?? values[path.split('.').join('-')];\n if (!resolvedColor) {\n throw new Error(`Color ${color} was not found`);\n }\n return resolvedColor;\n }\n if (color.startsWith('#')) {\n return color;\n }\n throw new Error(`Unable to process color ${color}`);\n };\n const resolveToken = (token: string): string => {\n if (token.includes('*')) {\n const [value, factor] = token.split('*');\n const resolvedValue = resolveToken(value);\n if (!resolvedValue.endsWith('px')) {\n throw new Error(`Unsupported expression ${token}`);\n }\n return `${Number.parseFloat(resolvedValue) * Number.parseFloat(factor)}px`;\n } else if (token.includes('{') && token.includes('}')) {\n const reference = token\n .substring(token.indexOf('{') + 1, token.indexOf('}'))\n .replace(/\\./g, '-');\n const resolvedToken =\n token.substring(0, token.indexOf('{')) +\n values[reference] +\n token.substring(token.indexOf('}') + 1);\n if (!resolvedToken || resolvedToken.includes('{')) {\n throw new Error(`On moment of resolving ${token}, ${resolvedToken} was not resolved yet`);\n }\n return resolvedToken;\n } else {\n return token;\n }\n };\n const replaceColors = (str: string) => {\n let result = '';\n for (let i = 0; i < str.length; i++) {\n if (str.substring(i, i + 'rgba('.length) === 'rgba(') {\n const start = i;\n while (str[i] !== undefined && str[i] !== ')') i++;\n result += resolveColor(str.substring(start, i + 1));\n } else {\n result += str[i];\n }\n }\n\n return result;\n };\n\n const rawValues = { ...values };\n\n for (const token in values) {\n if (types[token] === 'color') {\n values[token] = resolveColor(values[token]);\n } else if (types[token] === 'boxShadow') {\n values[token] = resolveToken(values[token].split('; ').map(replaceColors).join(', '));\n } else if (\n types[token] === 'sizing' ||\n types[token] === 'spacing' ||\n types[token] === 'borderRadius' ||\n types[token] === 'other'\n ) {\n values[token] = resolveToken(values[token]);\n }\n for (const modification of modifications[token] ?? []) {\n // refer to https://docs.tokens.studio/tokens/color-modifiers and https://github.com/tokens-studio/figma-plugin/tree/main/src/utils/color if extension is needed\n\n rawValues[token] = `${rawValues[token]} / ${modification.type}(${modification.value}) / ${modification.space}`;\n\n // array + regex to process gradients with several colors\n const colorRegex = /(#[0-9a-f]{6}|rgba\\([0-9., ]+\\))/gi;\n const colors = values[token].match(colorRegex) ?? [];\n\n for (const originalColor of colors) {\n let color = new Color(originalColor);\n\n if (modification.space === 'hsl') {\n if (modification.type === 'lighten') {\n const lightness = color.hsl.l;\n const difference = 100 - lightness;\n color.set('hsl.l', Math.min(100, lightness + difference * modification.value));\n } else {\n throw new Error(`Unsupported color modification ${modification.type} of token ${token}`);\n }\n } else {\n throw new Error(`Unsupported color space ${modification.space} of token ${token}`);\n }\n\n color = color.to('sRGB');\n let modifiedColor = '';\n\n if (color.alpha !== 1) {\n const r = Math.round(color.r * 255);\n const g = Math.round(color.g * 255);\n const b = Math.round(color.b * 255);\n const a = color.alpha;\n modifiedColor = `rgba(${r}, ${g}, ${b}, ${a})`;\n } else {\n modifiedColor = color.toString({ format: 'hex' });\n }\n\n values[token] = values[token].replace(originalColor, modifiedColor);\n }\n }\n }\n\n const processedTokens: { name: string; value: string; description: string }[] = [];\n const highlightsTokens: { name: string; value: string; description: string }[] = [];\n\n for (const token in values) {\n const isBase = basicTokens.has(token);\n (highlightTokens.has(token) ? highlightsTokens : processedTokens).push({\n name: isBase ? `--${token}` : `--${prefix}-${token}`,\n description: descriptions[token],\n value: values[token],\n });\n }\n\n return { processedTokens, highlightsTokens, values, types, rawValues, descriptions, basicTokens };\n};\n\nexport const tokensToCss = (\n tokens: { name: string; value: string; description: string }[],\n selector = ':root',\n) => {\n const cssLines: string[] = [];\n cssLines.push(`${selector} {`);\n for (const token of tokens) {\n if (token.description) cssLines.push(` /* ${token.description} */`);\n cssLines.push(` ${token.name}: ${token.value};`);\n }\n cssLines.push('}');\n return cssLines.join('\\n');\n};\nexport const tokensToJson = (tokens: { name: string; value: string; description: string }[]) => {\n const themeFile: Record<string, string> = {};\n for (const token of tokens) {\n themeFile[token.name] = token.value;\n }\n return JSON.stringify(themeFile, null, 2) + '\\n';\n};\nexport const tokensToJs = (tokens: { name: string; value: string; description: string }[]) => {\n const jsLines: string[] = [];\n jsLines.push('export default {');\n for (const token of tokens) {\n jsLines.push(` '${token.name}': '${token.value}',`);\n }\n jsLines.push('};\\n');\n return jsLines.join('\\n');\n};\n\nconst getByPath = (obj: any, path: string) => {\n const parts = path.split('.');\n let result = obj;\n for (const part of parts) {\n result = result?.[part];\n }\n return result;\n};\n"],"mappings":";;;;;AAAA,OAAOA,OAAO,MAAM,YAAY;AAChC,IAAMC,KAAK,GAAGD,OAAc;AAuB5B,OAAO,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAAiB,EAAEC,MAAmB,EAAEC,gBAA6B,EAAEC,MAAc,EAAK;EACtH,IAAMC,MAAuC,GAAG,CAAC,CAAC;EAClD,IAAMC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrC,IAAMC,eAAe,GAAG,IAAID,GAAG,CAAS,CAAC;EACzC,IAAME,aAML,GAAG,CAAC,CAAC;EACN,IAAMC,KAAsC,GAAG,CAAC,CAAC;EACjD,IAAMC,YAA6C,GAAG,CAAC,CAAC;EACxD,IAAMC,MAAgB,GAAG,EAAE;EAsB3B,IAAMC,SAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAAqB,EAAuD;IAAA,IAArDC,SAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAA,IAAEG,QAAsB,GAAAH,SA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