rizzo-css 0.0.23 → 0.0.25
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/README.md +2 -2
- package/bin/rizzo-css.js +183 -27
- package/package.json +1 -1
- package/scaffold/astro/Navbar.astro +7 -0
- package/scaffold/astro/Settings.astro +379 -5
- package/scaffold/astro/ThemeSwitcher.astro +7 -2
- package/scaffold/astro-minimal/src/layouts/Layout.astro +3 -0
- package/scaffold/vanilla/README-RIZZO.md +1 -1
- package/scaffold/vanilla/components/accordion.html +14 -0
- package/scaffold/vanilla/components/alert.html +14 -0
- package/scaffold/vanilla/components/avatar.html +14 -0
- package/scaffold/vanilla/components/badge.html +14 -0
- package/scaffold/vanilla/components/breadcrumb.html +14 -0
- package/scaffold/vanilla/components/button.html +14 -0
- package/scaffold/vanilla/components/cards.html +14 -0
- package/scaffold/vanilla/components/copy-to-clipboard.html +14 -0
- package/scaffold/vanilla/components/divider.html +14 -0
- package/scaffold/vanilla/components/dropdown.html +14 -0
- package/scaffold/vanilla/components/forms.html +14 -0
- package/scaffold/vanilla/components/icons.html +14 -0
- package/scaffold/vanilla/components/index.html +14 -0
- package/scaffold/vanilla/components/modal.html +14 -0
- package/scaffold/vanilla/components/navbar.html +14 -0
- package/scaffold/vanilla/components/pagination.html +14 -0
- package/scaffold/vanilla/components/progress-bar.html +14 -0
- package/scaffold/vanilla/components/search.html +14 -0
- package/scaffold/vanilla/components/settings.html +14 -0
- package/scaffold/vanilla/components/spinner.html +14 -0
- package/scaffold/vanilla/components/table.html +14 -0
- package/scaffold/vanilla/components/tabs.html +14 -0
- package/scaffold/vanilla/components/theme-switcher.html +14 -0
- package/scaffold/vanilla/components/toast.html +14 -0
- package/scaffold/vanilla/components/tooltip.html +14 -0
- package/scaffold/vanilla/index.html +14 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ pnpm add rizzo-css
|
|
|
12
12
|
yarn add rizzo-css
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
**Quick start (no install):** `npx rizzo-css init` — choose **framework** (Vanilla, Astro, or Svelte), then **add to existing** or **create new**. **Existing** (or `npx rizzo-css add`) → drop in CSS + hand-pick components; you must add the `<link>` yourself (CLI prints the exact tag). **New** → choose **Full** (everything) | **Minimal** (recommended) | **Manual** (pick components), then package manager. Non-interactive: `npx rizzo-css init --yes --framework vanilla|astro|svelte`. Optional **rizzo-css.json** and `add --install-package`. All get the **same CSS and component styles**. To use the **official Svelte or Astro create command** plus Rizzo, create the app first, then run `npx rizzo-css add`:
|
|
15
|
+
**Quick start (no install):** `npx rizzo-css init` — choose **framework** (Vanilla, Astro, or Svelte), then **add to existing** or **create new**. **Existing** (or `npx rizzo-css add`) → drop in CSS + hand-pick components; you must add the `<link>` yourself (CLI prints the exact tag). **New** → choose **Full** (everything) | **Minimal** (recommended) | **Manual** (pick components; list shows which add others, e.g. Settings adds ThemeSwitcher), then package manager. Full and Minimal include all required dependencies so every component works. Run `npx rizzo-css help components` for the dependency list. Non-interactive: `npx rizzo-css init --yes --framework vanilla|astro|svelte`. Optional **rizzo-css.json** and `add --install-package`. All get the **same CSS and component styles**. To use the **official Svelte or Astro create command** plus Rizzo, create the app first, then run `npx rizzo-css add`:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm create svelte@latest my-app && cd my-app && npx rizzo-css add
|
|
@@ -56,7 +56,7 @@ import 'rizzo-css';
|
|
|
56
56
|
**Without a bundler (plain HTML):** Use a CDN. Both unpkg and jsDelivr resolve the package root to the built CSS (via the `unpkg` / `jsdelivr` fields in this package). For reliability or to pin a version, use the explicit path:
|
|
57
57
|
|
|
58
58
|
```html
|
|
59
|
-
<!-- unpkg (pin version: replace @latest with @0.0.
|
|
59
|
+
<!-- unpkg (pin version: replace @latest with @0.0.25 or any version) -->
|
|
60
60
|
<link rel="stylesheet" href="https://unpkg.com/rizzo-css@latest/dist/rizzo.min.css" />
|
|
61
61
|
|
|
62
62
|
<!-- or jsDelivr -->
|
package/bin/rizzo-css.js
CHANGED
|
@@ -24,14 +24,14 @@ const TEMPLATES = {
|
|
|
24
24
|
{ value: 'manual', label: 'Manual — index.html + CSS; pick components to add their pages + js/main.js' },
|
|
25
25
|
],
|
|
26
26
|
astro: [
|
|
27
|
-
{ value: 'full', label: 'Full — Astro app + all
|
|
28
|
-
{ value: 'minimal', label: 'Minimal — Astro app + recommended
|
|
29
|
-
{ value: 'manual', label: 'Manual — minimal base + pick
|
|
27
|
+
{ value: 'full', label: 'Full — Astro app + all components (with dependencies so everything works)' },
|
|
28
|
+
{ value: 'minimal', label: 'Minimal — Astro app + recommended set (includes any required dependencies)' },
|
|
29
|
+
{ value: 'manual', label: 'Manual — minimal base + pick components (list shows which add others)' },
|
|
30
30
|
],
|
|
31
31
|
svelte: [
|
|
32
|
-
{ value: 'full', label: 'Full — SvelteKit app + all
|
|
33
|
-
{ value: 'minimal', label: 'Minimal — SvelteKit app + recommended
|
|
34
|
-
{ value: 'manual', label: 'Manual — minimal base + pick
|
|
32
|
+
{ value: 'full', label: 'Full — SvelteKit app + all components (with dependencies so everything works)' },
|
|
33
|
+
{ value: 'minimal', label: 'Minimal — SvelteKit app + recommended set (includes any required dependencies)' },
|
|
34
|
+
{ value: 'manual', label: 'Manual — minimal base + pick components (list shows which add others)' },
|
|
35
35
|
],
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -112,6 +112,61 @@ const RECOMMENDED_COMPONENTS = [
|
|
|
112
112
|
'Button', 'Badge', 'Card', 'Modal', 'Tabs', 'ThemeSwitcher', 'FormGroup', 'Alert', 'Toast', 'Dropdown',
|
|
113
113
|
];
|
|
114
114
|
|
|
115
|
+
// Component dependencies per framework: when user selects a component, these are copied automatically so it works.
|
|
116
|
+
// Manual users can run: npx rizzo-css help components
|
|
117
|
+
const COMPONENT_DEPS = {
|
|
118
|
+
astro: { Settings: ['ThemeSwitcher'], Toast: ['Alert'] },
|
|
119
|
+
svelte: { Settings: ['ThemeSwitcher'], Toast: ['Alert'] },
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
function getComponentDeps(framework, componentName) {
|
|
123
|
+
const deps = COMPONENT_DEPS[framework];
|
|
124
|
+
return (deps && deps[componentName]) ? deps[componentName] : [];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Returns a short label for the picker, e.g. " (adds ThemeSwitcher)" or "". */
|
|
128
|
+
function getComponentDependencyLabel(framework, componentName) {
|
|
129
|
+
const deps = getComponentDeps(framework, componentName);
|
|
130
|
+
if (deps.length === 0) return '';
|
|
131
|
+
return ' (adds ' + deps.join(', ') + ')';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Expand a list of component names with all required dependencies. Used for full, minimal, and add so everything works. */
|
|
135
|
+
function expandWithDeps(framework, names) {
|
|
136
|
+
const depsMap = COMPONENT_DEPS[framework];
|
|
137
|
+
if (!depsMap) return [...names];
|
|
138
|
+
const out = new Set(names);
|
|
139
|
+
let added = true;
|
|
140
|
+
while (added) {
|
|
141
|
+
added = false;
|
|
142
|
+
for (const name of out) {
|
|
143
|
+
const req = depsMap[name];
|
|
144
|
+
if (req) for (const d of req) {
|
|
145
|
+
if (!out.has(d)) { out.add(d); added = true; }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return [...names].filter((n) => out.has(n)).concat([...out].filter((n) => !names.includes(n)));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Log which components were added automatically because others require them. Call before copy when expanded.length > selected.length. */
|
|
153
|
+
function logAddedDeps(selected, expanded, framework) {
|
|
154
|
+
const added = expanded.filter((n) => !selected.includes(n));
|
|
155
|
+
if (added.length === 0) return;
|
|
156
|
+
const depsMap = COMPONENT_DEPS[framework];
|
|
157
|
+
if (!depsMap) return;
|
|
158
|
+
const byRequirement = [];
|
|
159
|
+
for (const name of added) {
|
|
160
|
+
for (const [parent, deps] of Object.entries(depsMap)) {
|
|
161
|
+
if (deps.includes(name) && selected.includes(parent)) {
|
|
162
|
+
byRequirement.push(name + ' (required by ' + parent + ')');
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (byRequirement.length) console.log('\n Also adding: ' + byRequirement.join('; '));
|
|
168
|
+
}
|
|
169
|
+
|
|
115
170
|
// Vanilla scaffold: component name (same as ASTRO_COMPONENTS) -> components/*.html slug. Navbar, Settings, Search, Icons are vanilla-only.
|
|
116
171
|
const VANILLA_COMPONENT_SLUGS = {
|
|
117
172
|
Button: 'button', Badge: 'badge', Card: 'cards', Divider: 'divider', Spinner: 'spinner', ProgressBar: 'progress-bar',
|
|
@@ -395,9 +450,10 @@ function selectMenu(options, title) {
|
|
|
395
450
|
});
|
|
396
451
|
}
|
|
397
452
|
|
|
453
|
+
const HINT = ' \u2191\u2193 move \u00b7 Enter select';
|
|
398
454
|
return new Promise((resolve) => {
|
|
399
455
|
let index = 0;
|
|
400
|
-
const lineCount = (title ? 1 : 0) + items.length + 1
|
|
456
|
+
const lineCount = (title ? 1 : 0) + items.length + 2; // +1 blank +1 hint
|
|
401
457
|
|
|
402
458
|
const render = (first) => {
|
|
403
459
|
const lines = (title ? [title] : []).concat(
|
|
@@ -406,12 +462,12 @@ function selectMenu(options, title) {
|
|
|
406
462
|
const prefix = i === index ? C.cyan + '>' + C.reset + ' ' : ' ';
|
|
407
463
|
return prefix + circle + formatLabel(item);
|
|
408
464
|
})
|
|
409
|
-
);
|
|
465
|
+
).concat(['', HINT]);
|
|
410
466
|
if (!first) {
|
|
411
467
|
process.stdout.write('\u001b[' + lineCount + 'A');
|
|
412
468
|
}
|
|
413
469
|
process.stdout.write('\u001b[?25l');
|
|
414
|
-
process.stdout.write(lines.join('\n') + '\n
|
|
470
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
415
471
|
process.stdout.write('\u001b[?25h');
|
|
416
472
|
};
|
|
417
473
|
|
|
@@ -528,7 +584,8 @@ function multiSelectMenu(options, title, initialSelected) {
|
|
|
528
584
|
if (initialSet.has(items[i].value)) selected.add(i);
|
|
529
585
|
}
|
|
530
586
|
}
|
|
531
|
-
const
|
|
587
|
+
const HINT = ' \u2191\u2193 move \u00b7 Space toggle \u00b7 a all \u00b7 n none \u00b7 1-9 toggle (0=10th) \u00b7 Enter confirm';
|
|
588
|
+
const lineCount = (title ? 1 : 0) + items.length + 2; // +1 blank +1 hint
|
|
532
589
|
const realStart = withSentinels ? 2 : 0;
|
|
533
590
|
|
|
534
591
|
const finish = () => {
|
|
@@ -556,15 +613,24 @@ function multiSelectMenu(options, title, initialSelected) {
|
|
|
556
613
|
const prefix = i === index ? C.cyan + '>' + C.reset + ' ' : ' ';
|
|
557
614
|
return prefix + circle + formatLabel(item);
|
|
558
615
|
})
|
|
559
|
-
);
|
|
616
|
+
).concat(['', HINT]);
|
|
560
617
|
if (!first) {
|
|
561
618
|
process.stdout.write('\u001b[' + lineCount + 'A');
|
|
562
619
|
}
|
|
563
620
|
process.stdout.write('\u001b[?25l');
|
|
564
|
-
process.stdout.write(lines.join('\n') + '\n
|
|
621
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
565
622
|
process.stdout.write('\u001b[?25h');
|
|
566
623
|
};
|
|
567
624
|
|
|
625
|
+
const toggleByNumber = (num) => {
|
|
626
|
+
const n = num === 0 ? 10 : num;
|
|
627
|
+
const idx = n >= 1 && n <= items.length ? n - 1 : -1;
|
|
628
|
+
if (idx < realStart) return; // don't toggle "Select all" / "Select none"
|
|
629
|
+
if (selected.has(idx)) selected.delete(idx);
|
|
630
|
+
else selected.add(idx);
|
|
631
|
+
render(false);
|
|
632
|
+
};
|
|
633
|
+
|
|
568
634
|
process.stdin.setRawMode(true);
|
|
569
635
|
process.stdin.resume();
|
|
570
636
|
process.stdin.setEncoding('utf8');
|
|
@@ -605,6 +671,16 @@ function multiSelectMenu(options, title, initialSelected) {
|
|
|
605
671
|
render(false);
|
|
606
672
|
return;
|
|
607
673
|
}
|
|
674
|
+
if (ch >= '1' && ch <= '9') {
|
|
675
|
+
buf = '';
|
|
676
|
+
toggleByNumber(parseInt(ch, 10));
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
if (ch === '0' && items.length >= 10) {
|
|
680
|
+
buf = '';
|
|
681
|
+
toggleByNumber(10);
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
608
684
|
if (ch === 'a' || ch === 'A') {
|
|
609
685
|
buf = '';
|
|
610
686
|
for (let i = realStart; i < items.length; i++) selected.add(i);
|
|
@@ -642,6 +718,12 @@ rizzo-css CLI — Add Rizzo CSS to your project (Vanilla, Astro, Svelte)
|
|
|
642
718
|
|
|
643
719
|
Available commands: init, add, theme, help
|
|
644
720
|
|
|
721
|
+
Flags summary:
|
|
722
|
+
init --yes --framework <fw> --template <t> --package-manager <pm> --install --no-install
|
|
723
|
+
add --path <dir> --framework <fw> --package-manager <pm> --install-package --no-install
|
|
724
|
+
theme (no flags)
|
|
725
|
+
help (no flags)
|
|
726
|
+
|
|
645
727
|
Usage (use your package manager):
|
|
646
728
|
npx rizzo-css <command> [options]
|
|
647
729
|
pnpm dlx rizzo-css <command> [options]
|
|
@@ -673,6 +755,11 @@ Options (add):
|
|
|
673
755
|
Package managers:
|
|
674
756
|
Supported: npm, pnpm, yarn, bun. Detection: lockfiles (pnpm-lock.yaml, yarn.lock, bun.lockb, package-lock.json) or package.json "packageManager"/"devEngines.packageManager". Use --package-manager to override.
|
|
675
757
|
|
|
758
|
+
Interactive prompts (when no --yes/flag provided):
|
|
759
|
+
Single-choice (framework, template, etc.): ↑/↓ move, Enter select.
|
|
760
|
+
Multi-choice (component selection only): ↑/↓ move, Space toggle, a = all, n = none, Enter confirm, 1-9 toggle by number (0 = 10th).
|
|
761
|
+
Ctrl+C to exit.
|
|
762
|
+
|
|
676
763
|
Config:
|
|
677
764
|
Optional rizzo-css.json in project root: { "targetDir", "framework", "packageManager" }.
|
|
678
765
|
Used by add and init when present. Detection: lockfiles and packageManager field in package.json.
|
|
@@ -701,10 +788,43 @@ Examples:
|
|
|
701
788
|
npx rizzo-css add --install-package
|
|
702
789
|
npx rizzo-css theme
|
|
703
790
|
|
|
791
|
+
Component dependencies (manual / add):
|
|
792
|
+
Some components require others to work. Picking them adds the required ones automatically.
|
|
793
|
+
Full list of available components and what relies on what: npx rizzo-css help components
|
|
794
|
+
|
|
704
795
|
Docs: https://rizzo-css.vercel.app
|
|
705
796
|
`);
|
|
706
797
|
}
|
|
707
798
|
|
|
799
|
+
function printHelpComponents() {
|
|
800
|
+
const list = ASTRO_COMPONENTS.map((name) => {
|
|
801
|
+
const deps = getComponentDeps('astro', name);
|
|
802
|
+
return deps.length ? name + ' (adds ' + deps.join(', ') + ')' : name;
|
|
803
|
+
});
|
|
804
|
+
const line1 = list.slice(0, 10).join(', ');
|
|
805
|
+
const line2 = list.slice(10, 20).join(', ');
|
|
806
|
+
const line3 = list.slice(20).join(', ');
|
|
807
|
+
console.log(`
|
|
808
|
+
Components — full list and what relies on what
|
|
809
|
+
|
|
810
|
+
Available to pick (Astro & Svelte; same list):
|
|
811
|
+
` + line1 + (line2 ? ',\n ' + line2 : '') + (line3 ? ',\n ' + line3 : '') + `
|
|
812
|
+
|
|
813
|
+
Dependencies (when you pick the component on the left, the right is added automatically):
|
|
814
|
+
Settings → ThemeSwitcher (and themes.ts)
|
|
815
|
+
Toast → Alert
|
|
816
|
+
|
|
817
|
+
ThemeSwitcher and ThemeIcon: when selected, themes.ts (and Svelte theme.ts) is copied so they work.
|
|
818
|
+
Icons: copied whenever you add any component.
|
|
819
|
+
|
|
820
|
+
Full = all components above; dependencies are included so everything works.
|
|
821
|
+
Minimal = recommended set; any component in that set that requires others gets them.
|
|
822
|
+
Manual = you pick; the picker shows e.g. "Settings (adds ThemeSwitcher)". Required deps are added when you confirm.
|
|
823
|
+
|
|
824
|
+
To see this again: npx rizzo-css help components
|
|
825
|
+
`);
|
|
826
|
+
}
|
|
827
|
+
|
|
708
828
|
function cmdTheme() {
|
|
709
829
|
process.stdout.write('\nDark themes (set data-theme on <html>):\n');
|
|
710
830
|
DARK_THEMES.forEach((t) => process.stdout.write(' ' + t + '\n'));
|
|
@@ -735,6 +855,11 @@ async function promptThemes() {
|
|
|
735
855
|
return { theme, defaultDark: DARK_THEMES.includes(defaultDark) ? defaultDark : DARK_THEMES[0], defaultLight: LIGHT_THEMES.includes(defaultLight) ? defaultLight : LIGHT_THEMES[0] };
|
|
736
856
|
}
|
|
737
857
|
|
|
858
|
+
function componentOptionLabel(framework, name) {
|
|
859
|
+
const suffix = getComponentDependencyLabel(framework, name);
|
|
860
|
+
return name + suffix;
|
|
861
|
+
}
|
|
862
|
+
|
|
738
863
|
/** Ask what to include: CSS only, recommended set, all components, or pick. Returns array of component names. Only call when componentList.length > 0. initialSelection: when set (e.g. for manual = minimal base), skip the menu and show multi-select with these pre-selected. */
|
|
739
864
|
async function promptComponentChoice(componentList, framework, initialSelection) {
|
|
740
865
|
const recommended = RECOMMENDED_COMPONENTS.filter((c) => componentList.includes(c));
|
|
@@ -743,7 +868,7 @@ async function promptComponentChoice(componentList, framework, initialSelection)
|
|
|
743
868
|
[
|
|
744
869
|
{ value: SENTINEL_ALL, label: 'Select all components' },
|
|
745
870
|
{ value: SENTINEL_NONE, label: 'Select no components' },
|
|
746
|
-
...componentList.map((c) => ({ value: c, label: c })),
|
|
871
|
+
...componentList.map((c) => ({ value: c, label: componentOptionLabel(framework, c) })),
|
|
747
872
|
],
|
|
748
873
|
'? Components (minimal set pre-selected) — Space to toggle, Enter to confirm',
|
|
749
874
|
initialSelection
|
|
@@ -765,9 +890,9 @@ async function promptComponentChoice(componentList, framework, initialSelection)
|
|
|
765
890
|
[
|
|
766
891
|
{ value: SENTINEL_ALL, label: 'Select all components' },
|
|
767
892
|
{ value: SENTINEL_NONE, label: 'Select no components' },
|
|
768
|
-
...componentList.map((c) => ({ value: c, label: c })),
|
|
893
|
+
...componentList.map((c) => ({ value: c, label: componentOptionLabel(framework, c) })),
|
|
769
894
|
],
|
|
770
|
-
'? Components — Space to toggle, Enter to confirm'
|
|
895
|
+
'? Components — Space to toggle, Enter to confirm. Items like "Settings (adds ThemeSwitcher)" add those deps automatically. List: npx rizzo-css help components'
|
|
771
896
|
);
|
|
772
897
|
}
|
|
773
898
|
|
|
@@ -1021,7 +1146,7 @@ function copySvelteComponents(projectDir, selectedNames) {
|
|
|
1021
1146
|
if (existsSync(iconsSrc) && (toCopy.length > 0 || copyIconsOnly)) {
|
|
1022
1147
|
copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
|
|
1023
1148
|
}
|
|
1024
|
-
if (toCopy.includes('ThemeSwitcher')) {
|
|
1149
|
+
if (toCopy.includes('ThemeSwitcher') || toCopy.includes('ThemeIcon')) {
|
|
1025
1150
|
const themesSrc = join(scaffoldDir, 'themes.ts');
|
|
1026
1151
|
const themeSrc = join(scaffoldDir, 'theme.ts');
|
|
1027
1152
|
if (existsSync(themesSrc)) copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
@@ -1066,7 +1191,7 @@ function copyAstroComponents(projectDir, selectedNames) {
|
|
|
1066
1191
|
if (existsSync(iconsSrc) && (toCopy.length > 0 || copyIconsOnly)) {
|
|
1067
1192
|
copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
|
|
1068
1193
|
}
|
|
1069
|
-
if (toCopy.includes('ThemeSwitcher')) {
|
|
1194
|
+
if (toCopy.includes('ThemeSwitcher') || toCopy.includes('ThemeIcon')) {
|
|
1070
1195
|
const themesSrc = join(scaffoldDir, 'themes.ts');
|
|
1071
1196
|
if (existsSync(themesSrc)) {
|
|
1072
1197
|
copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
@@ -1171,9 +1296,13 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1171
1296
|
|
|
1172
1297
|
copyRizzoIcons(cwd, framework);
|
|
1173
1298
|
if (framework === 'svelte' && selectedComponents.length > 0) {
|
|
1174
|
-
|
|
1299
|
+
const expanded = expandWithDeps('svelte', selectedComponents);
|
|
1300
|
+
logAddedDeps(selectedComponents, expanded, 'svelte');
|
|
1301
|
+
copySvelteComponents(cwd, expanded);
|
|
1175
1302
|
} else if (framework === 'astro' && selectedComponents.length > 0) {
|
|
1176
|
-
|
|
1303
|
+
const expanded = expandWithDeps('astro', selectedComponents);
|
|
1304
|
+
logAddedDeps(selectedComponents, expanded, 'astro');
|
|
1305
|
+
copyAstroComponents(cwd, expanded);
|
|
1177
1306
|
} else if (framework === 'vanilla' && selectedComponents.length > 0) {
|
|
1178
1307
|
const linkHrefForVanilla = (options && options.targetDir) ? getLinkHrefForTargetDir(framework, options.targetDir) : paths.linkHref;
|
|
1179
1308
|
const vanillaRepl = { '{{LINK_HREF}}': linkHrefForVanilla, '{{DATA_THEME}}': theme };
|
|
@@ -1351,6 +1480,29 @@ async function cmdInit(argv) {
|
|
|
1351
1480
|
const useVanillaFull = selectedTemplate === 'full' && framework === 'vanilla' && existsSync(getScaffoldVanillaIndex());
|
|
1352
1481
|
const useVanillaMinimal = selectedTemplate === 'minimal' && framework === 'vanilla';
|
|
1353
1482
|
|
|
1483
|
+
// Full and minimal get all required dependencies so everything works; manual gets deps when user picks (see prompt labels).
|
|
1484
|
+
let componentsToCopy = selectedComponents;
|
|
1485
|
+
if ((framework === 'astro' || framework === 'svelte') && selectedComponents.length > 0) {
|
|
1486
|
+
componentsToCopy = expandWithDeps(framework, selectedComponents);
|
|
1487
|
+
logAddedDeps(selectedComponents, componentsToCopy, framework);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
// Astro layout: inject Navbar and Settings when those components are selected so the settings menu works.
|
|
1491
|
+
if ((framework === 'astro') && (useHandpickAstro || useAstroBase)) {
|
|
1492
|
+
const hasNavbar = componentsToCopy.includes('Navbar');
|
|
1493
|
+
const hasSettings = componentsToCopy.includes('Settings');
|
|
1494
|
+
const layoutImports = [];
|
|
1495
|
+
if (hasNavbar) layoutImports.push("import Navbar from '../components/rizzo/Navbar.astro';");
|
|
1496
|
+
if (hasSettings) layoutImports.push("import Settings from '../components/rizzo/Settings.astro';");
|
|
1497
|
+
replacements['{{RIZZO_LAYOUT_IMPORTS}}'] = layoutImports.length ? '\n' + layoutImports.join('\n') + '\n' : '\n';
|
|
1498
|
+
replacements['{{RIZZO_LAYOUT_BODY_TOP}}'] = hasNavbar ? '\n <Navbar />' : '';
|
|
1499
|
+
replacements['{{RIZZO_LAYOUT_BODY_BOTTOM}}'] = hasSettings ? '\n <Settings />' : '';
|
|
1500
|
+
} else {
|
|
1501
|
+
replacements['{{RIZZO_LAYOUT_IMPORTS}}'] = '\n';
|
|
1502
|
+
replacements['{{RIZZO_LAYOUT_BODY_TOP}}'] = '';
|
|
1503
|
+
replacements['{{RIZZO_LAYOUT_BODY_BOTTOM}}'] = '';
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1354
1506
|
let cssTarget;
|
|
1355
1507
|
let indexPath;
|
|
1356
1508
|
|
|
@@ -1378,9 +1530,9 @@ async function cmdInit(argv) {
|
|
|
1378
1530
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1379
1531
|
}
|
|
1380
1532
|
copyPackageLicense(projectDir);
|
|
1381
|
-
if (
|
|
1533
|
+
if (componentsToCopy.length > 0) {
|
|
1382
1534
|
copyRizzoIcons(projectDir, 'astro');
|
|
1383
|
-
copyAstroComponents(projectDir,
|
|
1535
|
+
copyAstroComponents(projectDir, componentsToCopy);
|
|
1384
1536
|
}
|
|
1385
1537
|
} else if (useAstroBase) {
|
|
1386
1538
|
mkdirSync(projectDir, { recursive: true });
|
|
@@ -1391,9 +1543,9 @@ async function cmdInit(argv) {
|
|
|
1391
1543
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1392
1544
|
}
|
|
1393
1545
|
copyPackageLicense(projectDir);
|
|
1394
|
-
if (
|
|
1546
|
+
if (componentsToCopy.length > 0) {
|
|
1395
1547
|
copyRizzoIcons(projectDir, 'astro');
|
|
1396
|
-
copyAstroComponents(projectDir,
|
|
1548
|
+
copyAstroComponents(projectDir, componentsToCopy);
|
|
1397
1549
|
}
|
|
1398
1550
|
} else if (useHandpickSvelte) {
|
|
1399
1551
|
mkdirSync(projectDir, { recursive: true });
|
|
@@ -1404,9 +1556,9 @@ async function cmdInit(argv) {
|
|
|
1404
1556
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1405
1557
|
}
|
|
1406
1558
|
copyPackageLicense(projectDir);
|
|
1407
|
-
if (
|
|
1559
|
+
if (componentsToCopy.length > 0) {
|
|
1408
1560
|
copyRizzoIcons(projectDir, 'svelte');
|
|
1409
|
-
copySvelteComponents(projectDir,
|
|
1561
|
+
copySvelteComponents(projectDir, componentsToCopy);
|
|
1410
1562
|
}
|
|
1411
1563
|
} else if (useSvelteBase) {
|
|
1412
1564
|
mkdirSync(projectDir, { recursive: true });
|
|
@@ -1417,9 +1569,9 @@ async function cmdInit(argv) {
|
|
|
1417
1569
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1418
1570
|
}
|
|
1419
1571
|
copyPackageLicense(projectDir);
|
|
1420
|
-
if (
|
|
1572
|
+
if (componentsToCopy.length > 0) {
|
|
1421
1573
|
copyRizzoIcons(projectDir, 'svelte');
|
|
1422
|
-
copySvelteComponents(projectDir,
|
|
1574
|
+
copySvelteComponents(projectDir, componentsToCopy);
|
|
1423
1575
|
}
|
|
1424
1576
|
} else if (useVanillaFull) {
|
|
1425
1577
|
const cssDir = join(projectDir, pathsForScaffold.targetDir);
|
|
@@ -1589,6 +1741,10 @@ function main() {
|
|
|
1589
1741
|
const command = (argv[0] || 'help').toLowerCase().replace(/^--?/, '');
|
|
1590
1742
|
|
|
1591
1743
|
if (command === 'help' || command === 'h' || !COMMANDS.includes(command)) {
|
|
1744
|
+
if (argv[1] === 'components') {
|
|
1745
|
+
printHelpComponents();
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1592
1748
|
if (argv[0] && !COMMANDS.includes(command) && command !== 'h') {
|
|
1593
1749
|
console.error('Unknown command: ' + argv[0] + '\n');
|
|
1594
1750
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import Cat from './icons/Cat.astro';
|
|
3
|
+
import Gear from './icons/Gear.astro';
|
|
3
4
|
interface Props { siteName?: string; logo?: string; }
|
|
4
5
|
const { siteName = 'Site', logo } = Astro.props;
|
|
5
6
|
---
|
|
@@ -15,6 +16,12 @@ const { siteName = 'Site', logo } = Astro.props;
|
|
|
15
16
|
{siteName}
|
|
16
17
|
</a>
|
|
17
18
|
</div>
|
|
19
|
+
<div class="navbar__actions-desktop">
|
|
20
|
+
<button type="button" class="navbar__settings-btn" aria-label="Open settings" onclick="window.openSettings && window.openSettings()">
|
|
21
|
+
<Gear class="navbar__settings-icon" width={20} height={20} />
|
|
22
|
+
<span class="navbar__settings-label">Settings</span>
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
18
25
|
<button type="button" class="navbar__toggle" aria-label="Toggle menu" aria-expanded="false">
|
|
19
26
|
<span class="navbar__toggle-icon" aria-hidden="true"><span></span><span></span><span></span></span>
|
|
20
27
|
</button>
|