@vettvangur/design-system 2.0.13 → 2.0.14

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 +27 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2128,10 +2128,13 @@ function renderColorsCshtml(colors, projectName) {
2128
2128
  const items = Object.entries(group || {}).filter(([, token]) => token?.type === 'COLOR').map(([tokenKey]) => {
2129
2129
  const colorTitle = titleizeColor(categoryKey, tokenKey);
2130
2130
 
2131
- // Tailwind utility name (maps to --color-*)
2131
+ // CSS variable name
2132
2132
  const colorKey = `color-${categoryKey}-${tokenKey}`;
2133
+
2134
+ // Tailwind utility name (maps to --color-*)
2135
+ const swatchKey = `${categoryKey}-${tokenKey}`;
2133
2136
  return ` <div class="ds-color">
2134
- <div class="ds-color__swatch bg-${colorKey}"></div>
2137
+ <div class="ds-color__swatch bg-${swatchKey}"></div>
2135
2138
  <div class="ds-color__meta">
2136
2139
  <div class="ds-color__name">${colorTitle}</div>
2137
2140
  <div class="ds-color__var">--${colorKey}</div>
@@ -2274,6 +2277,23 @@ function renderEntry(id, entry) {
2274
2277
  const mSize = getValue(entry.size, 'Mobile');
2275
2278
  const mLine = getValue(entry.lineHeight, 'Mobile');
2276
2279
  const mFamily = getValue(entry.family, 'Mobile');
2280
+ const hasDesktopVariant = dSize != null && dLine != null && dFamily != null && (dSize !== mSize || dLine !== mLine || dFamily !== mFamily);
2281
+ const defaultSize = hasDesktopVariant ? dSize : mSize;
2282
+ const defaultLine = hasDesktopVariant ? dLine : mLine;
2283
+ const defaultFamily = hasDesktopVariant ? dFamily : mFamily;
2284
+ const renderMeta = (family, size, line) => {
2285
+ const lines = [];
2286
+ if (family != null) {
2287
+ lines.push(`<div><strong>Font</strong> ${family}</div>`);
2288
+ }
2289
+ if (size != null) {
2290
+ lines.push(`<div><strong>Size</strong> ${size}px</div>`);
2291
+ }
2292
+ if (line != null) {
2293
+ lines.push(`<div><strong>Line height</strong> ${line}px</div>`);
2294
+ }
2295
+ return lines.join('\n ');
2296
+ };
2277
2297
  return `
2278
2298
  <div class="ds-type-card">
2279
2299
  <div class="ds-type-preview">
@@ -2281,22 +2301,19 @@ ${renderPreview(id, title)}
2281
2301
  </div>
2282
2302
 
2283
2303
  <div class="ds-type-meta">
2284
- <div><strong>Font</strong> ${dFamily}</div>
2285
- <div><strong>Size</strong> ${dSize}px</div>
2286
- <div><strong>Line height</strong> ${dLine}px</div>
2304
+ ${renderMeta(defaultFamily, defaultSize, defaultLine)}
2287
2305
  </div>
2288
2306
 
2307
+ ${hasDesktopVariant ? `
2289
2308
  <div class="ds-type-mobile">
2290
2309
  <div class="ds-type-preview">
2291
- ${renderPreview(id, title)}
2310
+ ${renderPreview(id, title)}
2292
2311
  </div>
2293
2312
 
2294
2313
  <div class="ds-type-meta">
2295
- <div><strong>Font</strong> ${mFamily}</div>
2296
- <div><strong>Size</strong> ${mSize}px</div>
2297
- <div><strong>Line height</strong> ${mLine}px</div>
2314
+ ${renderMeta(mFamily, mSize, mLine)}
2298
2315
  </div>
2299
- </div>
2316
+ </div>` : ''}
2300
2317
  </div>`;
2301
2318
  }
2302
2319
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vettvangur/design-system",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "type": "module",