@vettvangur/design-system 2.0.21 → 2.0.22

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 +39 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1537,24 +1537,55 @@ function modeKey$1(raw) {
1537
1537
  return kebab$2(raw);
1538
1538
  }
1539
1539
  function pickHex(values, preferredMode) {
1540
- if (!values || typeof values !== 'object') return null;
1541
- if (values[preferredMode]?.hex) return values[preferredMode].hex;
1542
- if (values[modeKey$1(preferredMode)]?.hex) return values[modeKey$1(preferredMode)].hex; // if already normalized upstream
1540
+ if (!values || typeof values !== 'object') {
1541
+ return null;
1542
+ }
1543
+ if (values[preferredMode]?.hex) {
1544
+ return values[preferredMode].hex;
1545
+ }
1546
+
1547
+ // if already normalized upstream
1548
+ if (values[modeKey$1(preferredMode)]?.hex) {
1549
+ return values[modeKey$1(preferredMode)].hex;
1550
+ }
1543
1551
 
1544
1552
  // fallback: first entry
1545
1553
  const first = Object.values(values)[0];
1546
1554
  return first?.hex ?? null;
1547
1555
  }
1548
1556
  function collectColorVars(variableSet) {
1549
- const out = [];
1557
+ // Colors not present in Figma, but required by consumers.
1558
+ // These must come first in the generated output.
1559
+ const out = [{
1560
+ varName: '--color-transparent',
1561
+ hex: 'transparent'
1562
+ }, {
1563
+ varName: '--color-white',
1564
+ hex: '#fff'
1565
+ }, {
1566
+ varName: '--color-black',
1567
+ hex: '#111'
1568
+ }, {
1569
+ varName: '--color-umbraco-blue',
1570
+ hex: '#283a97'
1571
+ }, {
1572
+ varName: '--color-umbraco-pink',
1573
+ hex: '#f5c1bc'
1574
+ }];
1550
1575
  for (const [groupKey, group] of Object.entries(variableSet ?? {})) {
1551
- if (!group || typeof group !== 'object') continue;
1576
+ if (!group || typeof group !== 'object') {
1577
+ continue;
1578
+ }
1552
1579
  for (const [tokenKey, token] of Object.entries(group)) {
1553
- if (!token || token.type !== 'COLOR') continue;
1580
+ if (!token || token.type !== 'COLOR') {
1581
+ continue;
1582
+ }
1554
1583
 
1555
1584
  // Prefer "Mode 1" if present, else fallback to first mode
1556
1585
  const hex = pickHex(token.values, 'Mode 1');
1557
- if (!hex) continue;
1586
+ if (!hex) {
1587
+ continue;
1588
+ }
1558
1589
  const varName = `--color-${kebab$2(groupKey)}-${kebab$2(tokenKey)}`;
1559
1590
  out.push({
1560
1591
  varName,
@@ -1571,7 +1602,7 @@ function renderColors(vars) {
1571
1602
  async function generateColors$1(variableSet, config) {
1572
1603
  message('generating colors...');
1573
1604
  const vars = collectColorVars(variableSet);
1574
- const css = `/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n` + renderColors(vars);
1605
+ const css = '/* AUTO-GENERATED - DO NOT EDIT BY HAND */\n\n' + renderColors(vars);
1575
1606
  const outPath = path.join(config.paths.styles, 'config', 'color.css');
1576
1607
  await fs$1.writeFile(outPath, css, 'utf8');
1577
1608
  message(`finished generating (${vars.length}) colors`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/design-system",
3
- "version": "2.0.21",
3
+ "version": "2.0.22",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "type": "module",