@vettvangur/design-system 2.0.56 → 2.0.57

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/dist/index.js +18 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2418,9 +2418,26 @@ const extractVariantColors = variantNode => {
2418
2418
  };
2419
2419
  }
2420
2420
  const getFillToken = node => {
2421
+ // Figma exposes fill variable bindings in two common shapes:
2422
+ // - node.boundVariables.fills[0]
2423
+ // - node.fills[i].boundVariables.color
2421
2424
  const fillAlias = Array.isArray(node?.boundVariables?.fills) ? node.boundVariables.fills[0] : null;
2422
2425
  const fillVar = fillAlias?.variable;
2423
- return fillVar?.resolvedType === 'COLOR' && fillVar?.nameKebab ? fillVar.nameKebab : null;
2426
+ if (fillVar?.resolvedType === 'COLOR' && fillVar?.nameKebab) {
2427
+ return fillVar.nameKebab;
2428
+ }
2429
+ const paints = Array.isArray(node?.fills) ? node.fills : null;
2430
+ if (!paints) {
2431
+ return null;
2432
+ }
2433
+ for (const paint of paints) {
2434
+ const colorAlias = paint?.boundVariables?.color;
2435
+ const colorVar = colorAlias?.variable;
2436
+ if (colorVar?.resolvedType === 'COLOR' && colorVar?.nameKebab) {
2437
+ return colorVar.nameKebab;
2438
+ }
2439
+ }
2440
+ return null;
2424
2441
  };
2425
2442
  const getStrokeToken = node => {
2426
2443
  const strokeAlias = Array.isArray(node?.boundVariables?.strokes) ? node.boundVariables.strokes[0] : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/design-system",
3
- "version": "2.0.56",
3
+ "version": "2.0.57",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "type": "module",