figma-tokens-flattener 1.0.7 → 1.0.9
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 +4 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -470,14 +470,14 @@ 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
|
|
|
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
|
|
|
483
483
|
const processedValue = flattenMapTokens(rawValue, contextTokens);
|
|
@@ -565,7 +565,7 @@ function flatten() {
|
|
|
565
565
|
lightTokens = { ...flattenDefaultValues, ...lightTokens };
|
|
566
566
|
|
|
567
567
|
const flattenedComponents = flattenComponentsTokens(allTokensData[lightFullKey], lightTokens);
|
|
568
|
-
lightTokens = { ...lightTokens,
|
|
568
|
+
lightTokens = { ...lightTokens, components: flattenedComponents };
|
|
569
569
|
}
|
|
570
570
|
} else {
|
|
571
571
|
console.warn(`Collection not found, collection key: ${lightFullKey}`);
|
|
@@ -597,7 +597,7 @@ function flatten() {
|
|
|
597
597
|
darkTokens = { ...flattenDefaultValues, ...darkTokens };
|
|
598
598
|
|
|
599
599
|
const flattenedComponents = flattenComponentsTokens(allTokensData[darkFullKey], darkTokens);
|
|
600
|
-
darkTokens = { ...darkTokens,
|
|
600
|
+
darkTokens = { ...darkTokens, components: flattenedComponents };
|
|
601
601
|
}
|
|
602
602
|
} else {
|
|
603
603
|
console.warn(`Collection not found, collection key: ${darkFullKey}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figma-tokens-flattener",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
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": {
|