@vettvangur/design-system 2.0.0 → 2.0.2

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 +19 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1767,18 +1767,21 @@ async function generateHeadlines(sizes, lineHeights, config) {
1767
1767
  }
1768
1768
 
1769
1769
  async function renderTypography(tokens, config) {
1770
- let css = `/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n` + `@theme {\n`;
1770
+ let css = `/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n` + `@theme {\n` + ` --text-0: 0px;\n` + ` --text-full: 100%;\n` + ` --leading-0: 0px;\n` + ` --leading-full: 100%;\n`;
1771
+ const emit = (key, value) => {
1772
+ if (value == null) return;
1773
+ if (typeof value === 'number') return ` --${key}: ${value}px;\n`;
1774
+ return ` --${key}: ${String(value)};\n`; // already has units
1775
+ };
1771
1776
  for (const [key, token] of Object.entries(tokens || {})) {
1772
1777
  const mobile = token?.values?.mobile;
1773
1778
  const desktop = token?.values?.desktop;
1774
- if (mobile != null) {
1775
- css += ` --${key}: ${mobile}px;\n`;
1776
- }
1779
+ css += emit(key, mobile) ?? '';
1777
1780
  if (desktop != null && desktop !== mobile) {
1778
- css += ` --${key}-desktop: ${desktop}px;\n`;
1781
+ css += emit(`${key}-desktop`, desktop) ?? '';
1779
1782
  }
1780
1783
  }
1781
- css += '}\n';
1784
+ css += `}\n`;
1782
1785
  const outPath = path.join(config.paths.styles, 'config', 'typography.css');
1783
1786
  await fs$1.writeFile(outPath, css, 'utf8');
1784
1787
  }
@@ -2815,9 +2818,16 @@ async function pullAndBuild({
2815
2818
  projectName
2816
2819
  }) {
2817
2820
  const raw = await figmaSource(config.figma.fileKey);
2818
- const outPath = path.join(process.cwd(), 'figma-raw.json');
2819
- const tokens = normalizeTokens(raw.variables);
2820
- await fs$1.writeFile(outPath, JSON.stringify(tokens, null, 2), 'utf8');
2821
+
2822
+ // const outPath = path.join(process.cwd(), 'figma-raw.json')
2823
+
2824
+ normalizeTokens(raw.variables);
2825
+ // await fs.writeFile(
2826
+ // outPath,
2827
+ // JSON.stringify(tokens, null, 2),
2828
+ // 'utf8'
2829
+ // )
2830
+
2821
2831
  const colors = groupColors(raw.variables);
2822
2832
  const typography = groupTypography(raw.variables);
2823
2833
  const scales = groupScales(raw.variables);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/design-system",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "type": "module",