@vettvangur/design-system 2.0.6 → 2.0.8
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 +24 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2057,7 +2057,7 @@ function titleizeButton(key) {
|
|
|
2057
2057
|
// "button-primary-blue-round" -> "Primary Blue Round"
|
|
2058
2058
|
return String(key).replace(/^button-/, '').split('-').filter(Boolean).map(p => p.charAt(0).toUpperCase() + p.slice(1)).join(' ');
|
|
2059
2059
|
}
|
|
2060
|
-
function renderButtonsCshtml(buttons) {
|
|
2060
|
+
function renderButtonsCshtml(buttons, projectName) {
|
|
2061
2061
|
const items = (buttons || []).filter(b => b?.key).map(b => {
|
|
2062
2062
|
const key = b.key;
|
|
2063
2063
|
const title = titleizeButton(key);
|
|
@@ -2103,13 +2103,13 @@ ${items}
|
|
|
2103
2103
|
</section>
|
|
2104
2104
|
`;
|
|
2105
2105
|
}
|
|
2106
|
-
async function generateButtons(buttons, config, outpath) {
|
|
2106
|
+
async function generateButtons(buttons, config, outpath, projectName) {
|
|
2107
2107
|
message('generating buttons...');
|
|
2108
2108
|
const filePath = path.join(outpath, 'DSButtons.cshtml');
|
|
2109
2109
|
await fs$1.mkdir(outpath, {
|
|
2110
2110
|
recursive: true
|
|
2111
2111
|
});
|
|
2112
|
-
const cshtml = renderButtonsCshtml(buttons);
|
|
2112
|
+
const cshtml = renderButtonsCshtml(buttons, projectName);
|
|
2113
2113
|
await fs$1.writeFile(filePath, cshtml, 'utf8');
|
|
2114
2114
|
message('finished generating buttons');
|
|
2115
2115
|
}
|
|
@@ -2121,7 +2121,7 @@ function titleizeColor(categoryKey, tokenKey) {
|
|
|
2121
2121
|
// "primary" + "dark-blue-10" → "Primary Dark Blue 10"
|
|
2122
2122
|
return `${titleCaseWords(categoryKey)} ${titleCaseWords(tokenKey)}`;
|
|
2123
2123
|
}
|
|
2124
|
-
function renderColorsCshtml(colors) {
|
|
2124
|
+
function renderColorsCshtml(colors, projectName) {
|
|
2125
2125
|
const sections = Object.entries(colors || {}).map(([categoryKey, group]) => {
|
|
2126
2126
|
const categoryTitle = titleCaseWords(categoryKey);
|
|
2127
2127
|
const items = Object.entries(group || {}).filter(([, token]) => token?.type === 'COLOR').map(([tokenKey]) => {
|
|
@@ -2166,13 +2166,13 @@ ${sections}
|
|
|
2166
2166
|
</section>
|
|
2167
2167
|
`;
|
|
2168
2168
|
}
|
|
2169
|
-
async function generateColors(colors, config, outpath) {
|
|
2169
|
+
async function generateColors(colors, config, outpath, projectName) {
|
|
2170
2170
|
message('generating colors...');
|
|
2171
2171
|
const filePath = path.join(outpath, 'DSColors.cshtml');
|
|
2172
2172
|
await fs$1.mkdir(outpath, {
|
|
2173
2173
|
recursive: true
|
|
2174
2174
|
});
|
|
2175
|
-
const cshtml = renderColorsCshtml(colors);
|
|
2175
|
+
const cshtml = renderColorsCshtml(colors, projectName);
|
|
2176
2176
|
await fs$1.writeFile(filePath, cshtml, 'utf8');
|
|
2177
2177
|
message('finished generating colors');
|
|
2178
2178
|
}
|
|
@@ -2313,7 +2313,7 @@ ${entries.join('\n')}
|
|
|
2313
2313
|
* main render
|
|
2314
2314
|
* ------------------------------------------- */
|
|
2315
2315
|
|
|
2316
|
-
function renderTypographyCshtml(data) {
|
|
2316
|
+
function renderTypographyCshtml(data, projectName) {
|
|
2317
2317
|
const entries = buildEntries(data);
|
|
2318
2318
|
const categories = {};
|
|
2319
2319
|
for (const [id, entry] of Object.entries(entries)) {
|
|
@@ -2351,16 +2351,16 @@ ${sections}
|
|
|
2351
2351
|
* public API
|
|
2352
2352
|
* ------------------------------------------- */
|
|
2353
2353
|
|
|
2354
|
-
async function generateTypography(typography, config, outpath) {
|
|
2354
|
+
async function generateTypography(typography, config, outpath, projectName) {
|
|
2355
2355
|
const file = path.join(outpath, 'DSTypography.cshtml');
|
|
2356
2356
|
await fs$1.mkdir(outpath, {
|
|
2357
2357
|
recursive: true
|
|
2358
2358
|
});
|
|
2359
|
-
const html = renderTypographyCshtml(typography);
|
|
2359
|
+
const html = renderTypographyCshtml(typography, projectName);
|
|
2360
2360
|
await fs$1.writeFile(file, html, 'utf8');
|
|
2361
2361
|
}
|
|
2362
2362
|
|
|
2363
|
-
function renderTablesCshtml() {
|
|
2363
|
+
function renderTablesCshtml(projectName) {
|
|
2364
2364
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2365
2365
|
@{
|
|
2366
2366
|
Layout = "Master.cshtml";
|
|
@@ -2407,18 +2407,18 @@ function renderTablesCshtml() {
|
|
|
2407
2407
|
</section>
|
|
2408
2408
|
`;
|
|
2409
2409
|
}
|
|
2410
|
-
async function generateTables(config, outpath) {
|
|
2410
|
+
async function generateTables(config, outpath, projectName) {
|
|
2411
2411
|
message('generating tables...');
|
|
2412
2412
|
const filePath = path.join(outpath, 'DSTables.cshtml');
|
|
2413
2413
|
await fs$1.mkdir(outpath, {
|
|
2414
2414
|
recursive: true
|
|
2415
2415
|
});
|
|
2416
|
-
const cshtml = renderTablesCshtml();
|
|
2416
|
+
const cshtml = renderTablesCshtml(projectName);
|
|
2417
2417
|
await fs$1.writeFile(filePath, cshtml, 'utf8');
|
|
2418
2418
|
message('finished generating tables');
|
|
2419
2419
|
}
|
|
2420
2420
|
|
|
2421
|
-
function renderRichtextCshtml() {
|
|
2421
|
+
function renderRichtextCshtml(projectName) {
|
|
2422
2422
|
return `@* AUTO-GENERATED - DO NOT EDIT BY HAND *@
|
|
2423
2423
|
@{
|
|
2424
2424
|
Layout = "Master.cshtml";
|
|
@@ -2491,13 +2491,13 @@ function renderRichtextCshtml() {
|
|
|
2491
2491
|
</section>
|
|
2492
2492
|
`;
|
|
2493
2493
|
}
|
|
2494
|
-
async function generateRichtext(config, outpath) {
|
|
2494
|
+
async function generateRichtext(config, outpath, projectName) {
|
|
2495
2495
|
message('generating richtext...');
|
|
2496
2496
|
const filePath = path.join(outpath, 'DSRichtext.cshtml');
|
|
2497
2497
|
await fs$1.mkdir(outpath, {
|
|
2498
2498
|
recursive: true
|
|
2499
2499
|
});
|
|
2500
|
-
const cshtml = renderRichtextCshtml();
|
|
2500
|
+
const cshtml = renderRichtextCshtml(projectName);
|
|
2501
2501
|
await fs$1.writeFile(filePath, cshtml, 'utf8');
|
|
2502
2502
|
message('finished generating richtext');
|
|
2503
2503
|
}
|
|
@@ -2796,7 +2796,7 @@ function buildSpec() {
|
|
|
2796
2796
|
sections
|
|
2797
2797
|
};
|
|
2798
2798
|
}
|
|
2799
|
-
function renderInputsCshtml() {
|
|
2799
|
+
function renderInputsCshtml(projectName) {
|
|
2800
2800
|
const {
|
|
2801
2801
|
razorPrelude,
|
|
2802
2802
|
sections
|
|
@@ -2828,13 +2828,13 @@ ${renderedSections}
|
|
|
2828
2828
|
</section>
|
|
2829
2829
|
`;
|
|
2830
2830
|
}
|
|
2831
|
-
async function generateInputs(config, outpath) {
|
|
2831
|
+
async function generateInputs(config, outpath, projectName) {
|
|
2832
2832
|
message('generating inputs...');
|
|
2833
2833
|
const filePath = path.join(outpath, 'DSInputs.cshtml');
|
|
2834
2834
|
await fs$1.mkdir(outpath, {
|
|
2835
2835
|
recursive: true
|
|
2836
2836
|
});
|
|
2837
|
-
const cshtml = renderInputsCshtml();
|
|
2837
|
+
const cshtml = renderInputsCshtml(projectName);
|
|
2838
2838
|
await fs$1.writeFile(filePath, cshtml, 'utf8');
|
|
2839
2839
|
message('finished generating inputs');
|
|
2840
2840
|
}
|
|
@@ -2911,22 +2911,20 @@ async function generateDesignSystemView(config, projectName) {
|
|
|
2911
2911
|
|
|
2912
2912
|
async function generateRazor(config, projectName, buttons, colors, typography) {
|
|
2913
2913
|
message(pc.yellow('-=[ razor ]=-'));
|
|
2914
|
-
console.log('[generateRazor]', projectName);
|
|
2915
2914
|
|
|
2916
2915
|
// <views>/Partials/<ProjectName>/DesignSystem
|
|
2917
2916
|
const outpath = path.join(config.paths.views, 'Partials', projectName, 'DesignSystem');
|
|
2918
2917
|
await fs$1.mkdir(outpath, {
|
|
2919
2918
|
recursive: true
|
|
2920
2919
|
});
|
|
2921
|
-
console.log('[generateRazor generateDesignSystemView]', projectName);
|
|
2922
2920
|
await generateDesignSystemView(config, projectName);
|
|
2923
2921
|
await generateNavigation(config, outpath);
|
|
2924
|
-
await generateButtons(buttons, config, outpath);
|
|
2925
|
-
await generateColors(colors, config, outpath);
|
|
2926
|
-
await generateTypography(typography, config, outpath);
|
|
2927
|
-
await generateTables(config, outpath);
|
|
2928
|
-
await generateRichtext(config, outpath);
|
|
2929
|
-
await generateInputs(config, outpath);
|
|
2922
|
+
await generateButtons(buttons, config, outpath, projectName);
|
|
2923
|
+
await generateColors(colors, config, outpath, projectName);
|
|
2924
|
+
await generateTypography(typography, config, outpath, projectName);
|
|
2925
|
+
await generateTables(config, outpath, projectName);
|
|
2926
|
+
await generateRichtext(config, outpath, projectName);
|
|
2927
|
+
await generateInputs(config, outpath, projectName);
|
|
2930
2928
|
}
|
|
2931
2929
|
|
|
2932
2930
|
async function pullAndBuild({
|