figma-tokens-flattener 1.0.8 → 1.0.10
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/index.js +6 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -135,9 +135,9 @@ function flattenMapTokens(value, seedContext) {
|
|
|
135
135
|
hadUnknown = true;
|
|
136
136
|
return match;
|
|
137
137
|
}
|
|
138
|
-
if (typeof
|
|
138
|
+
if (typeof tokenValue === 'number') return String(tokenValue);
|
|
139
139
|
|
|
140
|
-
const numericValue = typeof
|
|
140
|
+
const numericValue = typeof tokenValue === 'string' ? Number(tokenValue) : NaN;
|
|
141
141
|
if (Number.isFinite(numericValue)) return String(numericValue);
|
|
142
142
|
|
|
143
143
|
hadNonNumeric = true;
|
|
@@ -470,16 +470,16 @@ function flattenComponentsTokens(componentsTokens, contextTokens) {
|
|
|
470
470
|
Object.keys(componentTokens).forEach(tokenName => {
|
|
471
471
|
const tokenDefinition = componentTokens[tokenName];
|
|
472
472
|
|
|
473
|
-
if (tokenDefinition && typeof tokenDefinition === 'object' &&
|
|
473
|
+
if (tokenDefinition && typeof tokenDefinition === 'object' && Object.hasOwn(tokenDefinition, 'value')) {
|
|
474
474
|
const rawValue = tokenDefinition.value;
|
|
475
|
-
|
|
475
|
+
console.log('Here1');
|
|
476
476
|
const processedValue = flattenMapTokens(rawValue, contextTokens);
|
|
477
477
|
processedComponentTokens[tokenName] = processedValue;
|
|
478
478
|
} else {
|
|
479
479
|
// It can be a token with a nested structure, for example, lineType.style.value
|
|
480
|
-
if (tokenDefinition && typeof tokenDefinition === 'object' && tokenDefinition.style && typeof tokenDefinition.style === 'object' && tokenDefinition.style
|
|
480
|
+
if (tokenDefinition && typeof tokenDefinition === 'object' && tokenDefinition.style && typeof tokenDefinition.style === 'object' && Object.hasOwn(tokenDefinition.style, 'value')) {
|
|
481
481
|
const rawValue = tokenDefinition.style.value;
|
|
482
|
-
|
|
482
|
+
console.log('Here2');
|
|
483
483
|
const processedValue = flattenMapTokens(rawValue, contextTokens);
|
|
484
484
|
processedComponentTokens[tokenName] = processedValue;
|
|
485
485
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figma-tokens-flattener",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "A tool for transforming Ant Design tokens from Tokens Studio for Figma (Single file) into flat style mappings for light and dark themes.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|