@vettvangur/design-system 2.0.70 → 2.0.71

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 +9 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3511,8 +3511,7 @@ async function renderTypography(tokens, config) {
3511
3511
  return;
3512
3512
  }
3513
3513
  if (typeof value === 'number') {
3514
- const k = String(key);
3515
- const v = value === 0 ? '0' : k.startsWith('text-') || k.startsWith('leading-') ? rem(value) : `${value}px`;
3514
+ const v = value === 0 ? '0' : rem(value);
3516
3515
  return ` --${key}: ${v};\n`;
3517
3516
  }
3518
3517
  return ` --${key}: ${String(value)};\n`; // already has units
@@ -3713,14 +3712,14 @@ function ensureVar(lines, varName, value) {
3713
3712
  *
3714
3713
  * addRem(map, name, n)
3715
3714
  */
3716
- function addPx(map, name, n) {
3715
+ function addRem(map, name, n) {
3717
3716
  if (n == null) {
3718
3717
  return;
3719
3718
  }
3720
3719
  if (map.has(name)) {
3721
3720
  return;
3722
3721
  }
3723
- map.set(name, n === 0 ? '0' : `${n}px`);
3722
+ map.set(name, n === 0 ? '0' : rem(n));
3724
3723
  }
3725
3724
 
3726
3725
  /**
@@ -3744,7 +3743,7 @@ function generateSpacingCss(scales) {
3744
3743
  if (v == null) {
3745
3744
  continue;
3746
3745
  }
3747
- addPx(map, `--spacing-${kebab$1(tokenKey)}`, v);
3746
+ addRem(map, `--spacing-${kebab$1(tokenKey)}`, v);
3748
3747
  }
3749
3748
  };
3750
3749
 
@@ -3760,7 +3759,7 @@ function generateSpacingCss(scales) {
3760
3759
  continue;
3761
3760
  }
3762
3761
  const k = kebab$1(tokenKey).replace(/^scale-/, '');
3763
- addPx(map, `--spacing-vertical-${k}`, v);
3762
+ addRem(map, `--spacing-vertical-${k}`, v);
3764
3763
  }
3765
3764
  const lines = Array.from(map.entries()).map(([k, v]) => ` ${k}: ${v};`);
3766
3765
 
@@ -3794,7 +3793,7 @@ function generateBorderCss(scales) {
3794
3793
  if (v == null) {
3795
3794
  continue;
3796
3795
  }
3797
- addPx(map, `--border-${kebab$1(tokenKey)}`, v);
3796
+ addRem(map, `--border-${kebab$1(tokenKey)}`, v);
3798
3797
  }
3799
3798
  const lines = Array.from(map.entries()).map(([k, v]) => ` ${k}: ${v};`);
3800
3799
 
@@ -3852,7 +3851,7 @@ function generateRadiusCss(scales) {
3852
3851
  }
3853
3852
  continue;
3854
3853
  }
3855
- addPx(map, `--radius-${k}`, v);
3854
+ addRem(map, `--radius-${k}`, v);
3856
3855
  }
3857
3856
  if (debug) {
3858
3857
  console.log('[design-system] radius: emitted =', map.size, '| skipped(manual)=', skippedManual, '| skipped(null)=', skippedNull);
@@ -3865,7 +3864,7 @@ function generateRadiusCss(scales) {
3865
3864
  // manual required defaults
3866
3865
  ensureVar(lines, '--radius-0', '0');
3867
3866
  ensureVar(lines, '--radius-circle', '50%');
3868
- ensureVar(lines, '--radius-rounded', '100px');
3867
+ ensureVar(lines, '--radius-rounded', rem(100));
3869
3868
  return `/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n${renderTheme$1(lines)}`;
3870
3869
  }
3871
3870
 
@@ -4016,7 +4015,7 @@ function effectToBoxShadow(effect) {
4016
4015
  const color = rgbaFromColor(effect.color) ?? 'rgba(0 0 0 / 0.25)';
4017
4016
 
4018
4017
  // "x y blur spread color"
4019
- const len = n => n === 0 ? '0' : `${n}px`;
4018
+ const len = n => n === 0 ? '0' : rem(n);
4020
4019
  return `${len(x)} ${len(y)} ${len(blur)} ${len(spread)} ${color}`;
4021
4020
  }
4022
4021
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/design-system",
3
- "version": "2.0.70",
3
+ "version": "2.0.71",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "type": "module",