@vettvangur/design-system 2.0.9 → 2.0.11
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 +72 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2062,37 +2062,38 @@ function renderButtonsCshtml(buttons, projectName) {
|
|
|
2062
2062
|
const key = b.key;
|
|
2063
2063
|
const title = titleizeButton(key);
|
|
2064
2064
|
return ` <div class="ds-button-wrap">
|
|
2065
|
-
<vv-headline text="${title}" size="2" modifier="headline-2"
|
|
2065
|
+
<vv-headline text="${title}" size="2" modifier="headline-2"></vv-headline>
|
|
2066
2066
|
<vv-button
|
|
2067
2067
|
identifier="ds__button"
|
|
2068
2068
|
modifier="${key}"
|
|
2069
2069
|
type="@ButtonType.Button"
|
|
2070
2070
|
text="${title}"
|
|
2071
|
-
|
|
2071
|
+
></vv-button>
|
|
2072
2072
|
<vv-button
|
|
2073
2073
|
identifier="ds__button"
|
|
2074
2074
|
modifier="${key}"
|
|
2075
2075
|
type="@ButtonType.Button"
|
|
2076
2076
|
text="${title} disabled"
|
|
2077
2077
|
disabled="true"
|
|
2078
|
-
|
|
2078
|
+
></vv-button>
|
|
2079
2079
|
</div>`;
|
|
2080
2080
|
}).join('\n\n');
|
|
2081
|
+
|
|
2082
|
+
// @{
|
|
2083
|
+
// Layout = "Master.cshtml";
|
|
2084
|
+
// }
|
|
2081
2085
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2082
|
-
@{
|
|
2083
|
-
Layout = "Master.cshtml";
|
|
2084
|
-
}
|
|
2085
2086
|
<section class="ds-buttons">
|
|
2086
2087
|
<div class="ds__left">
|
|
2087
2088
|
<partial name="${projectName}/DesignSystem/DSNavigation" />
|
|
2088
2089
|
</div>
|
|
2089
|
-
<div class="ds__right"
|
|
2090
|
+
<div class="ds__right">
|
|
2090
2091
|
<vv-headline
|
|
2091
2092
|
identifier="ds-title"
|
|
2092
2093
|
modifier="headline-2"
|
|
2093
2094
|
size="2"
|
|
2094
2095
|
text="Buttons"
|
|
2095
|
-
|
|
2096
|
+
></vv-headline>
|
|
2096
2097
|
|
|
2097
2098
|
<div class="ds-section-grid">
|
|
2098
2099
|
|
|
@@ -2137,17 +2138,18 @@ function renderColorsCshtml(colors, projectName) {
|
|
|
2137
2138
|
</div>
|
|
2138
2139
|
</div>`;
|
|
2139
2140
|
}).join('\n');
|
|
2140
|
-
return ` <section class="ds-color-group
|
|
2141
|
-
<vv-headline text="${categoryTitle}" size="2" modifier="headline-2"
|
|
2141
|
+
return ` <section class="ds-color-group">
|
|
2142
|
+
<vv-headline text="${categoryTitle}" size="2" modifier="headline-2"></vv-headline>
|
|
2142
2143
|
<div class="ds-color-grid">
|
|
2143
2144
|
${items}
|
|
2144
2145
|
</div>
|
|
2145
2146
|
</section>`;
|
|
2146
2147
|
}).join('\n\n');
|
|
2148
|
+
|
|
2149
|
+
// @{
|
|
2150
|
+
// Layout = "Master.cshtml";
|
|
2151
|
+
// }
|
|
2147
2152
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2148
|
-
@{
|
|
2149
|
-
Layout = "Master.cshtml";
|
|
2150
|
-
}
|
|
2151
2153
|
<section class="ds-colors">
|
|
2152
2154
|
<div class="ds__left">
|
|
2153
2155
|
<partial name="${projectName}/DesignSystem/DSNavigation" />
|
|
@@ -2158,7 +2160,7 @@ ${items}
|
|
|
2158
2160
|
modifier="headline-2"
|
|
2159
2161
|
size="2"
|
|
2160
2162
|
text="Colors"
|
|
2161
|
-
|
|
2163
|
+
></vv-headline>
|
|
2162
2164
|
|
|
2163
2165
|
${sections}
|
|
2164
2166
|
|
|
@@ -2177,8 +2179,8 @@ async function generateColors(colors, config, outpath, projectName) {
|
|
|
2177
2179
|
message('finished generating colors');
|
|
2178
2180
|
}
|
|
2179
2181
|
|
|
2180
|
-
/* ---------------------------------------------
|
|
2181
|
-
* helpers
|
|
2182
|
+
/* ---------------------------------------------
|
|
2183
|
+
* helpers
|
|
2182
2184
|
* ------------------------------------------- */
|
|
2183
2185
|
|
|
2184
2186
|
function titleCase(str) {
|
|
@@ -2195,8 +2197,8 @@ function isHeadline(id) {
|
|
|
2195
2197
|
return id.startsWith('headline-');
|
|
2196
2198
|
}
|
|
2197
2199
|
|
|
2198
|
-
/* ---------------------------------------------
|
|
2199
|
-
* normalize typography into semantic entries
|
|
2200
|
+
/* ---------------------------------------------
|
|
2201
|
+
* normalize typography into semantic entries
|
|
2200
2202
|
* ------------------------------------------- */
|
|
2201
2203
|
|
|
2202
2204
|
function buildEntries({
|
|
@@ -2226,8 +2228,8 @@ function buildEntries({
|
|
|
2226
2228
|
return map;
|
|
2227
2229
|
}
|
|
2228
2230
|
|
|
2229
|
-
/* ---------------------------------------------
|
|
2230
|
-
* category resolution
|
|
2231
|
+
/* ---------------------------------------------
|
|
2232
|
+
* category resolution
|
|
2231
2233
|
* ------------------------------------------- */
|
|
2232
2234
|
|
|
2233
2235
|
function resolveCategory(id) {
|
|
@@ -2236,8 +2238,8 @@ function resolveCategory(id) {
|
|
|
2236
2238
|
return null;
|
|
2237
2239
|
}
|
|
2238
2240
|
|
|
2239
|
-
/* ---------------------------------------------
|
|
2240
|
-
* preview render
|
|
2241
|
+
/* ---------------------------------------------
|
|
2242
|
+
* preview render
|
|
2241
2243
|
* ------------------------------------------- */
|
|
2242
2244
|
|
|
2243
2245
|
function renderPreview(id, title) {
|
|
@@ -2248,7 +2250,7 @@ function renderPreview(id, title) {
|
|
|
2248
2250
|
text="${title}"
|
|
2249
2251
|
size="2"
|
|
2250
2252
|
modifier="${id}"
|
|
2251
|
-
|
|
2253
|
+
></vv-headline>`;
|
|
2252
2254
|
}
|
|
2253
2255
|
return `
|
|
2254
2256
|
<p class="${id}">
|
|
@@ -2256,8 +2258,8 @@ function renderPreview(id, title) {
|
|
|
2256
2258
|
</p>`;
|
|
2257
2259
|
}
|
|
2258
2260
|
|
|
2259
|
-
/* ---------------------------------------------
|
|
2260
|
-
* entry render
|
|
2261
|
+
/* ---------------------------------------------
|
|
2262
|
+
* entry render
|
|
2261
2263
|
* ------------------------------------------- */
|
|
2262
2264
|
|
|
2263
2265
|
function renderEntry(id, entry) {
|
|
@@ -2294,14 +2296,14 @@ ${renderPreview(id, title)}
|
|
|
2294
2296
|
</div>`;
|
|
2295
2297
|
}
|
|
2296
2298
|
|
|
2297
|
-
/* ---------------------------------------------
|
|
2298
|
-
* category render
|
|
2299
|
+
/* ---------------------------------------------
|
|
2300
|
+
* category render
|
|
2299
2301
|
* ------------------------------------------- */
|
|
2300
2302
|
|
|
2301
2303
|
function renderCategory(title, entries) {
|
|
2302
2304
|
return `
|
|
2303
2305
|
<section class="ds-type-category">
|
|
2304
|
-
<vv-headline text="${title}" size="3" modifier="headline-2"
|
|
2306
|
+
<vv-headline text="${title}" size="3" modifier="headline-2"></vv-headline>
|
|
2305
2307
|
|
|
2306
2308
|
<div class="ds-type-grid">
|
|
2307
2309
|
${entries.join('\n')}
|
|
@@ -2309,8 +2311,8 @@ ${entries.join('\n')}
|
|
|
2309
2311
|
</section>`;
|
|
2310
2312
|
}
|
|
2311
2313
|
|
|
2312
|
-
/* ---------------------------------------------
|
|
2313
|
-
* main render
|
|
2314
|
+
/* ---------------------------------------------
|
|
2315
|
+
* main render
|
|
2314
2316
|
* ------------------------------------------- */
|
|
2315
2317
|
|
|
2316
2318
|
function renderTypographyCshtml(data, projectName) {
|
|
@@ -2323,10 +2325,11 @@ function renderTypographyCshtml(data, projectName) {
|
|
|
2323
2325
|
categories[cat].push(renderEntry(id, entry));
|
|
2324
2326
|
}
|
|
2325
2327
|
const sections = Object.entries(categories).map(([title, items]) => renderCategory(title, items)).join('\n');
|
|
2328
|
+
|
|
2329
|
+
// @{
|
|
2330
|
+
// Layout = "Master.cshtml";
|
|
2331
|
+
// }
|
|
2326
2332
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2327
|
-
@{
|
|
2328
|
-
Layout = "Master.cshtml";
|
|
2329
|
-
}
|
|
2330
2333
|
|
|
2331
2334
|
<section class="ds-typography">
|
|
2332
2335
|
<div class="ds__left">
|
|
@@ -2339,7 +2342,7 @@ function renderTypographyCshtml(data, projectName) {
|
|
|
2339
2342
|
modifier="headline-1"
|
|
2340
2343
|
size="2"
|
|
2341
2344
|
text="Typography"
|
|
2342
|
-
|
|
2345
|
+
></vv-headline>
|
|
2343
2346
|
|
|
2344
2347
|
${sections}
|
|
2345
2348
|
|
|
@@ -2347,8 +2350,8 @@ ${sections}
|
|
|
2347
2350
|
</section>`;
|
|
2348
2351
|
}
|
|
2349
2352
|
|
|
2350
|
-
/* ---------------------------------------------
|
|
2351
|
-
* public API
|
|
2353
|
+
/* ---------------------------------------------
|
|
2354
|
+
* public API
|
|
2352
2355
|
* ------------------------------------------- */
|
|
2353
2356
|
|
|
2354
2357
|
async function generateTypography(typography, config, outpath, projectName) {
|
|
@@ -2361,10 +2364,10 @@ async function generateTypography(typography, config, outpath, projectName) {
|
|
|
2361
2364
|
}
|
|
2362
2365
|
|
|
2363
2366
|
function renderTablesCshtml(projectName) {
|
|
2367
|
+
// @{
|
|
2368
|
+
// Layout = "Master.cshtml";
|
|
2369
|
+
// }
|
|
2364
2370
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2365
|
-
@{
|
|
2366
|
-
Layout = "Master.cshtml";
|
|
2367
|
-
}
|
|
2368
2371
|
|
|
2369
2372
|
<section class="ds-tables">
|
|
2370
2373
|
<div class="ds__left">
|
|
@@ -2377,7 +2380,7 @@ function renderTablesCshtml(projectName) {
|
|
|
2377
2380
|
modifier="headline-2"
|
|
2378
2381
|
size="2"
|
|
2379
2382
|
text="Tables"
|
|
2380
|
-
|
|
2383
|
+
></vv-headline>
|
|
2381
2384
|
|
|
2382
2385
|
<div class="table">
|
|
2383
2386
|
<table class="table__element">
|
|
@@ -2419,21 +2422,21 @@ async function generateTables(config, outpath, projectName) {
|
|
|
2419
2422
|
}
|
|
2420
2423
|
|
|
2421
2424
|
function renderRichtextCshtml(projectName) {
|
|
2425
|
+
// @{
|
|
2426
|
+
// Layout = "Master.cshtml";
|
|
2427
|
+
// }
|
|
2422
2428
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2423
|
-
@{
|
|
2424
|
-
Layout = "Master.cshtml";
|
|
2425
|
-
}
|
|
2426
2429
|
|
|
2427
2430
|
<section class="ds-richtext">
|
|
2428
2431
|
<div class="ds__left">
|
|
2429
2432
|
<partial name="${projectName}/DesignSystem/DSNavigation" />
|
|
2430
2433
|
</div>
|
|
2431
|
-
<div class="ds__right"
|
|
2434
|
+
<div class="ds__right">
|
|
2432
2435
|
<vv-headline
|
|
2433
2436
|
identifier="ds__headline"
|
|
2434
2437
|
modifier="headline-2"
|
|
2435
2438
|
text="Richtext"
|
|
2436
|
-
|
|
2439
|
+
></vv-headline>
|
|
2437
2440
|
|
|
2438
2441
|
<div class="richtext">
|
|
2439
2442
|
<h1>h1</h1>
|
|
@@ -2508,13 +2511,21 @@ function escapeAttr(v) {
|
|
|
2508
2511
|
function renderAttrs(attrs) {
|
|
2509
2512
|
return Object.entries(attrs || {}).filter(([, v]) => v != null).map(([k, v]) => ` ${k}="${escapeAttr(v)}"`).join('\n');
|
|
2510
2513
|
}
|
|
2514
|
+
const voidHtmlTags = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
|
|
2511
2515
|
function renderVoidComponent({
|
|
2512
2516
|
tag,
|
|
2513
2517
|
attrs
|
|
2514
2518
|
}) {
|
|
2515
|
-
|
|
2519
|
+
if (voidHtmlTags.has(tag)) {
|
|
2520
|
+
return ` <${tag}
|
|
2516
2521
|
${renderAttrs(attrs)}
|
|
2517
2522
|
/>`;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
// Razor TagHelpers generally must not be self-closing.
|
|
2526
|
+
return ` <${tag}
|
|
2527
|
+
${renderAttrs(attrs)}
|
|
2528
|
+
></${tag}>`;
|
|
2518
2529
|
}
|
|
2519
2530
|
function renderSection({
|
|
2520
2531
|
title,
|
|
@@ -2526,7 +2537,7 @@ function renderSection({
|
|
|
2526
2537
|
identifier="ds__headline"
|
|
2527
2538
|
modifier="headline-2"
|
|
2528
2539
|
text="${escapeAttr(title)}"
|
|
2529
|
-
|
|
2540
|
+
></vv-headline>
|
|
2530
2541
|
`;
|
|
2531
2542
|
if (layout === 'stack') {
|
|
2532
2543
|
const rows = (items || []).map(it => ` <div class="ds-inputs__row">\n${renderVoidComponent(it)}\n </div>`).join('\n\n');
|
|
@@ -2802,10 +2813,11 @@ function renderInputsCshtml(projectName) {
|
|
|
2802
2813
|
sections
|
|
2803
2814
|
} = buildSpec();
|
|
2804
2815
|
const renderedSections = sections.map(renderSection).join('\n\n');
|
|
2816
|
+
|
|
2817
|
+
// @{
|
|
2818
|
+
// Layout = "Master.cshtml";
|
|
2819
|
+
// }
|
|
2805
2820
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2806
|
-
@{
|
|
2807
|
-
Layout = "Master.cshtml";
|
|
2808
|
-
}
|
|
2809
2821
|
|
|
2810
2822
|
${razorPrelude}
|
|
2811
2823
|
|
|
@@ -2819,7 +2831,7 @@ ${razorPrelude}
|
|
|
2819
2831
|
identifier="ds__headline"
|
|
2820
2832
|
modifier="headline-2"
|
|
2821
2833
|
text="Inputs"
|
|
2822
|
-
|
|
2834
|
+
></vv-headline>
|
|
2823
2835
|
|
|
2824
2836
|
<div class="ds-section-grid">
|
|
2825
2837
|
${renderedSections}
|
|
@@ -2885,14 +2897,20 @@ function renderDesignSystemViewCshtml(projectName) {
|
|
|
2885
2897
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2886
2898
|
@{
|
|
2887
2899
|
Layout = "Master.cshtml";
|
|
2900
|
+
// This template will used later, right now users are redirected to /design-system/colors
|
|
2888
2901
|
}
|
|
2889
2902
|
<section class="ds">
|
|
2890
2903
|
<div class="ds__left">
|
|
2891
2904
|
<partial name="${projectName}/DesignSystem/DSNavigation" />
|
|
2892
2905
|
</div>
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2906
|
+
<div class="ds__right">
|
|
2907
|
+
<partial name="${projectName}/DesignSystem/DSColors" />
|
|
2908
|
+
<partial name="${projectName}/DesignSystem/DSTypography" />
|
|
2909
|
+
<partial name="${projectName}/DesignSystem/DSButtons" />
|
|
2910
|
+
<partial name="${projectName}/DesignSystem/DSInputs" />
|
|
2911
|
+
<partial name="${projectName}/DesignSystem/DSRichtext" />
|
|
2912
|
+
<partial name="${projectName}/DesignSystem/DSTables" />
|
|
2913
|
+
</div>
|
|
2896
2914
|
</section>
|
|
2897
2915
|
`;
|
|
2898
2916
|
}
|