figma-tokens-flattener 1.0.17 → 1.0.18

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 (2) hide show
  1. package/index.js +9 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -394,10 +394,16 @@ function flattenComponentsTokens(componentsTokens, contextTokens) {
394
394
  Object.keys(componentTokens).forEach(tokenName => {
395
395
  const tokenDefinition = componentTokens[tokenName];
396
396
 
397
- if (tokenDefinition && typeof tokenDefinition === 'object' && Object.hasOwn(tokenDefinition, 'value')) {
398
- const rawValue = tokenDefinition.value;
397
+ if (tokenDefinition && typeof tokenDefinition === 'object') {
398
+ let rawValueToProcess;
399
399
 
400
- const processedValue = flattenMapTokens(rawValue, contextTokens);
400
+ if (Object.hasOwn(tokenDefinition, 'value') && typeof tokenDefinition.value === 'object' && tokenDefinition.value !== null && Object.hasOwn(tokenDefinition.value, 'style')) {
401
+ rawValueToProcess = tokenDefinition.value.style;
402
+ }
403
+ else if (Object.hasOwn(tokenDefinition, 'value')) {
404
+ rawValueToProcess = tokenDefinition.value;
405
+ }
406
+ const processedValue = flattenMapTokens(rawValueToProcess, contextTokens);
401
407
  processedComponentTokens[tokenName] = processedValue;
402
408
  } else {
403
409
  console.warn(`Unsupported token structure ${componentName}.${tokenName}:`, tokenDefinition);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-tokens-flattener",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
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": {