@vettvangur/design-system 2.0.10 → 2.0.12
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.
- package/dist/index.js +42 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2087,7 +2087,7 @@ function renderButtonsCshtml(buttons, projectName) {
|
|
|
2087
2087
|
<div class="ds__left">
|
|
2088
2088
|
<partial name="${projectName}/DesignSystem/DSNavigation" />
|
|
2089
2089
|
</div>
|
|
2090
|
-
<div class="ds__right"
|
|
2090
|
+
<div class="ds__right">
|
|
2091
2091
|
<vv-headline
|
|
2092
2092
|
identifier="ds-title"
|
|
2093
2093
|
modifier="headline-2"
|
|
@@ -2138,7 +2138,7 @@ function renderColorsCshtml(colors, projectName) {
|
|
|
2138
2138
|
</div>
|
|
2139
2139
|
</div>`;
|
|
2140
2140
|
}).join('\n');
|
|
2141
|
-
return ` <section class="ds-color-group
|
|
2141
|
+
return ` <section class="ds-color-group">
|
|
2142
2142
|
<vv-headline text="${categoryTitle}" size="2" modifier="headline-2" />
|
|
2143
2143
|
<div class="ds-color-grid">
|
|
2144
2144
|
${items}
|
|
@@ -2179,8 +2179,8 @@ async function generateColors(colors, config, outpath, projectName) {
|
|
|
2179
2179
|
message('finished generating colors');
|
|
2180
2180
|
}
|
|
2181
2181
|
|
|
2182
|
-
/* ---------------------------------------------
|
|
2183
|
-
* helpers
|
|
2182
|
+
/* ---------------------------------------------
|
|
2183
|
+
* helpers
|
|
2184
2184
|
* ------------------------------------------- */
|
|
2185
2185
|
|
|
2186
2186
|
function titleCase(str) {
|
|
@@ -2197,8 +2197,8 @@ function isHeadline(id) {
|
|
|
2197
2197
|
return id.startsWith('headline-');
|
|
2198
2198
|
}
|
|
2199
2199
|
|
|
2200
|
-
/* ---------------------------------------------
|
|
2201
|
-
* normalize typography into semantic entries
|
|
2200
|
+
/* ---------------------------------------------
|
|
2201
|
+
* normalize typography into semantic entries
|
|
2202
2202
|
* ------------------------------------------- */
|
|
2203
2203
|
|
|
2204
2204
|
function buildEntries({
|
|
@@ -2228,18 +2228,22 @@ function buildEntries({
|
|
|
2228
2228
|
return map;
|
|
2229
2229
|
}
|
|
2230
2230
|
|
|
2231
|
-
/* ---------------------------------------------
|
|
2232
|
-
* category resolution
|
|
2231
|
+
/* ---------------------------------------------
|
|
2232
|
+
* category resolution
|
|
2233
2233
|
* ------------------------------------------- */
|
|
2234
2234
|
|
|
2235
2235
|
function resolveCategory(id) {
|
|
2236
|
-
if (id.startsWith('headline'))
|
|
2237
|
-
|
|
2236
|
+
if (id.startsWith('headline')) {
|
|
2237
|
+
return 'Headlines';
|
|
2238
|
+
}
|
|
2239
|
+
if (id.startsWith('body') || id === 'blockquote') {
|
|
2240
|
+
return 'Bodies';
|
|
2241
|
+
}
|
|
2238
2242
|
return null;
|
|
2239
2243
|
}
|
|
2240
2244
|
|
|
2241
|
-
/* ---------------------------------------------
|
|
2242
|
-
* preview render
|
|
2245
|
+
/* ---------------------------------------------
|
|
2246
|
+
* preview render
|
|
2243
2247
|
* ------------------------------------------- */
|
|
2244
2248
|
|
|
2245
2249
|
function renderPreview(id, title) {
|
|
@@ -2258,8 +2262,8 @@ function renderPreview(id, title) {
|
|
|
2258
2262
|
</p>`;
|
|
2259
2263
|
}
|
|
2260
2264
|
|
|
2261
|
-
/* ---------------------------------------------
|
|
2262
|
-
* entry render
|
|
2265
|
+
/* ---------------------------------------------
|
|
2266
|
+
* entry render
|
|
2263
2267
|
* ------------------------------------------- */
|
|
2264
2268
|
|
|
2265
2269
|
function renderEntry(id, entry) {
|
|
@@ -2296,8 +2300,8 @@ ${renderPreview(id, title)}
|
|
|
2296
2300
|
</div>`;
|
|
2297
2301
|
}
|
|
2298
2302
|
|
|
2299
|
-
/* ---------------------------------------------
|
|
2300
|
-
* category render
|
|
2303
|
+
/* ---------------------------------------------
|
|
2304
|
+
* category render
|
|
2301
2305
|
* ------------------------------------------- */
|
|
2302
2306
|
|
|
2303
2307
|
function renderCategory(title, entries) {
|
|
@@ -2311,8 +2315,8 @@ ${entries.join('\n')}
|
|
|
2311
2315
|
</section>`;
|
|
2312
2316
|
}
|
|
2313
2317
|
|
|
2314
|
-
/* ---------------------------------------------
|
|
2315
|
-
* main render
|
|
2318
|
+
/* ---------------------------------------------
|
|
2319
|
+
* main render
|
|
2316
2320
|
* ------------------------------------------- */
|
|
2317
2321
|
|
|
2318
2322
|
function renderTypographyCshtml(data, projectName) {
|
|
@@ -2320,7 +2324,9 @@ function renderTypographyCshtml(data, projectName) {
|
|
|
2320
2324
|
const categories = {};
|
|
2321
2325
|
for (const [id, entry] of Object.entries(entries)) {
|
|
2322
2326
|
const cat = resolveCategory(id);
|
|
2323
|
-
if (!cat || !entry.size || !entry.lineHeight || !entry.family)
|
|
2327
|
+
if (!cat || !entry.size || !entry.lineHeight || !entry.family) {
|
|
2328
|
+
continue;
|
|
2329
|
+
}
|
|
2324
2330
|
categories[cat] ??= [];
|
|
2325
2331
|
categories[cat].push(renderEntry(id, entry));
|
|
2326
2332
|
}
|
|
@@ -2350,8 +2356,8 @@ ${sections}
|
|
|
2350
2356
|
</section>`;
|
|
2351
2357
|
}
|
|
2352
2358
|
|
|
2353
|
-
/* ---------------------------------------------
|
|
2354
|
-
* public API
|
|
2359
|
+
/* ---------------------------------------------
|
|
2360
|
+
* public API
|
|
2355
2361
|
* ------------------------------------------- */
|
|
2356
2362
|
|
|
2357
2363
|
async function generateTypography(typography, config, outpath, projectName) {
|
|
@@ -2431,7 +2437,7 @@ function renderRichtextCshtml(projectName) {
|
|
|
2431
2437
|
<div class="ds__left">
|
|
2432
2438
|
<partial name="${projectName}/DesignSystem/DSNavigation" />
|
|
2433
2439
|
</div>
|
|
2434
|
-
<div class="ds__right"
|
|
2440
|
+
<div class="ds__right">
|
|
2435
2441
|
<vv-headline
|
|
2436
2442
|
identifier="ds__headline"
|
|
2437
2443
|
modifier="headline-2"
|
|
@@ -2511,13 +2517,26 @@ function escapeAttr(v) {
|
|
|
2511
2517
|
function renderAttrs(attrs) {
|
|
2512
2518
|
return Object.entries(attrs || {}).filter(([, v]) => v != null).map(([k, v]) => ` ${k}="${escapeAttr(v)}"`).join('\n');
|
|
2513
2519
|
}
|
|
2520
|
+
const voidHtmlTags = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
|
|
2514
2521
|
function renderVoidComponent({
|
|
2515
2522
|
tag,
|
|
2516
2523
|
attrs
|
|
2517
2524
|
}) {
|
|
2518
|
-
|
|
2525
|
+
if (voidHtmlTags.has(tag)) {
|
|
2526
|
+
return ` <${tag}
|
|
2519
2527
|
${renderAttrs(attrs)}
|
|
2520
2528
|
/>`;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
// Our Razor TagHelpers are self-closing.
|
|
2532
|
+
if (tag.startsWith('vv-')) {
|
|
2533
|
+
return ` <${tag}
|
|
2534
|
+
${renderAttrs(attrs)}
|
|
2535
|
+
/>`;
|
|
2536
|
+
}
|
|
2537
|
+
return ` <${tag}
|
|
2538
|
+
${renderAttrs(attrs)}
|
|
2539
|
+
></${tag}>`;
|
|
2521
2540
|
}
|
|
2522
2541
|
function renderSection({
|
|
2523
2542
|
title,
|