rizzo-css 0.0.23 → 0.0.24
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 +187 -27
- package/package.json +1 -1
- package/scaffold/astro/Navbar.astro +7 -0
- package/scaffold/astro/Settings.astro +374 -5
- package/scaffold/vanilla/README-RIZZO.md +1 -1
- package/scaffold/vanilla/components/accordion.html +6 -0
- package/scaffold/vanilla/components/alert.html +6 -0
- package/scaffold/vanilla/components/avatar.html +6 -0
- package/scaffold/vanilla/components/badge.html +6 -0
- package/scaffold/vanilla/components/breadcrumb.html +6 -0
- package/scaffold/vanilla/components/button.html +6 -0
- package/scaffold/vanilla/components/cards.html +6 -0
- package/scaffold/vanilla/components/copy-to-clipboard.html +6 -0
- package/scaffold/vanilla/components/divider.html +6 -0
- package/scaffold/vanilla/components/dropdown.html +6 -0
- package/scaffold/vanilla/components/forms.html +6 -0
- package/scaffold/vanilla/components/icons.html +6 -0
- package/scaffold/vanilla/components/index.html +6 -0
- package/scaffold/vanilla/components/modal.html +6 -0
- package/scaffold/vanilla/components/navbar.html +6 -0
- package/scaffold/vanilla/components/pagination.html +6 -0
- package/scaffold/vanilla/components/progress-bar.html +6 -0
- package/scaffold/vanilla/components/search.html +6 -0
- package/scaffold/vanilla/components/settings.html +6 -0
- package/scaffold/vanilla/components/spinner.html +6 -0
- package/scaffold/vanilla/components/table.html +6 -0
- package/scaffold/vanilla/components/tabs.html +6 -0
- package/scaffold/vanilla/components/theme-switcher.html +6 -0
- package/scaffold/vanilla/components/toast.html +6 -0
- package/scaffold/vanilla/components/tooltip.html +6 -0
- package/scaffold/vanilla/index.html +6 -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.24 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 \u00b7 1-9 pick';
|
|
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,15 +462,25 @@ 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
|
|
|
474
|
+
const selectByNumber = (num) => {
|
|
475
|
+
const n = num === 0 ? 10 : num; // 0 = 10th item
|
|
476
|
+
const idx = n >= 1 && n <= items.length ? n - 1 : index;
|
|
477
|
+
process.stdin.setRawMode(false);
|
|
478
|
+
process.stdin.removeListener('data', onData);
|
|
479
|
+
process.stdin.pause();
|
|
480
|
+
process.stdout.write('\n');
|
|
481
|
+
resolve(items[idx].value);
|
|
482
|
+
};
|
|
483
|
+
|
|
418
484
|
process.stdin.setRawMode(true);
|
|
419
485
|
process.stdin.resume();
|
|
420
486
|
process.stdin.setEncoding('utf8');
|
|
@@ -437,6 +503,16 @@ function selectMenu(options, title) {
|
|
|
437
503
|
resolve(items[index].value);
|
|
438
504
|
return;
|
|
439
505
|
}
|
|
506
|
+
if (ch >= '1' && ch <= '9') {
|
|
507
|
+
buf = '';
|
|
508
|
+
selectByNumber(parseInt(ch, 10));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (ch === '0' && items.length >= 10) {
|
|
512
|
+
buf = '';
|
|
513
|
+
selectByNumber(10);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
440
516
|
buf += ch;
|
|
441
517
|
const isUp = buf === '\u001b[A' || buf === '\u001bOA' || (buf.length >= 2 && buf.endsWith('A') && buf.startsWith('\u001b'));
|
|
442
518
|
const isDown = buf === '\u001b[B' || buf === '\u001bOB' || (buf.length >= 2 && buf.endsWith('B') && buf.startsWith('\u001b'));
|
|
@@ -528,7 +604,8 @@ function multiSelectMenu(options, title, initialSelected) {
|
|
|
528
604
|
if (initialSet.has(items[i].value)) selected.add(i);
|
|
529
605
|
}
|
|
530
606
|
}
|
|
531
|
-
const
|
|
607
|
+
const HINT = ' \u2191\u2193 move \u00b7 Space toggle \u00b7 a all \u00b7 n none \u00b7 Enter confirm';
|
|
608
|
+
const lineCount = (title ? 1 : 0) + items.length + 2; // +1 blank +1 hint
|
|
532
609
|
const realStart = withSentinels ? 2 : 0;
|
|
533
610
|
|
|
534
611
|
const finish = () => {
|
|
@@ -556,15 +633,24 @@ function multiSelectMenu(options, title, initialSelected) {
|
|
|
556
633
|
const prefix = i === index ? C.cyan + '>' + C.reset + ' ' : ' ';
|
|
557
634
|
return prefix + circle + formatLabel(item);
|
|
558
635
|
})
|
|
559
|
-
);
|
|
636
|
+
).concat(['', HINT]);
|
|
560
637
|
if (!first) {
|
|
561
638
|
process.stdout.write('\u001b[' + lineCount + 'A');
|
|
562
639
|
}
|
|
563
640
|
process.stdout.write('\u001b[?25l');
|
|
564
|
-
process.stdout.write(lines.join('\n') + '\n
|
|
641
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
565
642
|
process.stdout.write('\u001b[?25h');
|
|
566
643
|
};
|
|
567
644
|
|
|
645
|
+
const toggleByNumber = (num) => {
|
|
646
|
+
const n = num === 0 ? 10 : num;
|
|
647
|
+
const idx = n >= 1 && n <= items.length ? n - 1 : -1;
|
|
648
|
+
if (idx < realStart) return; // don't toggle "Select all" / "Select none"
|
|
649
|
+
if (selected.has(idx)) selected.delete(idx);
|
|
650
|
+
else selected.add(idx);
|
|
651
|
+
render(false);
|
|
652
|
+
};
|
|
653
|
+
|
|
568
654
|
process.stdin.setRawMode(true);
|
|
569
655
|
process.stdin.resume();
|
|
570
656
|
process.stdin.setEncoding('utf8');
|
|
@@ -605,6 +691,16 @@ function multiSelectMenu(options, title, initialSelected) {
|
|
|
605
691
|
render(false);
|
|
606
692
|
return;
|
|
607
693
|
}
|
|
694
|
+
if (ch >= '1' && ch <= '9') {
|
|
695
|
+
buf = '';
|
|
696
|
+
toggleByNumber(parseInt(ch, 10));
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (ch === '0' && items.length >= 10) {
|
|
700
|
+
buf = '';
|
|
701
|
+
toggleByNumber(10);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
608
704
|
if (ch === 'a' || ch === 'A') {
|
|
609
705
|
buf = '';
|
|
610
706
|
for (let i = realStart; i < items.length; i++) selected.add(i);
|
|
@@ -642,6 +738,12 @@ rizzo-css CLI — Add Rizzo CSS to your project (Vanilla, Astro, Svelte)
|
|
|
642
738
|
|
|
643
739
|
Available commands: init, add, theme, help
|
|
644
740
|
|
|
741
|
+
Flags summary:
|
|
742
|
+
init --yes --framework <fw> --template <t> --package-manager <pm> --install --no-install
|
|
743
|
+
add --path <dir> --framework <fw> --package-manager <pm> --install-package --no-install
|
|
744
|
+
theme (no flags)
|
|
745
|
+
help (no flags)
|
|
746
|
+
|
|
645
747
|
Usage (use your package manager):
|
|
646
748
|
npx rizzo-css <command> [options]
|
|
647
749
|
pnpm dlx rizzo-css <command> [options]
|
|
@@ -673,6 +775,11 @@ Options (add):
|
|
|
673
775
|
Package managers:
|
|
674
776
|
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
777
|
|
|
778
|
+
Interactive prompts (when no --yes/flag provided):
|
|
779
|
+
Single-choice: ↑/↓ move, Enter select, 1-9 pick by number (0 = 10th).
|
|
780
|
+
Multi-choice: ↑/↓ move, Space toggle, a = all, n = none, Enter confirm, 1-9 toggle by number.
|
|
781
|
+
Ctrl+C to exit.
|
|
782
|
+
|
|
676
783
|
Config:
|
|
677
784
|
Optional rizzo-css.json in project root: { "targetDir", "framework", "packageManager" }.
|
|
678
785
|
Used by add and init when present. Detection: lockfiles and packageManager field in package.json.
|
|
@@ -701,10 +808,43 @@ Examples:
|
|
|
701
808
|
npx rizzo-css add --install-package
|
|
702
809
|
npx rizzo-css theme
|
|
703
810
|
|
|
811
|
+
Component dependencies (manual / add):
|
|
812
|
+
Some components require others to work. Picking them adds the required ones automatically.
|
|
813
|
+
Full list of available components and what relies on what: npx rizzo-css help components
|
|
814
|
+
|
|
704
815
|
Docs: https://rizzo-css.vercel.app
|
|
705
816
|
`);
|
|
706
817
|
}
|
|
707
818
|
|
|
819
|
+
function printHelpComponents() {
|
|
820
|
+
const list = ASTRO_COMPONENTS.map((name) => {
|
|
821
|
+
const deps = getComponentDeps('astro', name);
|
|
822
|
+
return deps.length ? name + ' (adds ' + deps.join(', ') + ')' : name;
|
|
823
|
+
});
|
|
824
|
+
const line1 = list.slice(0, 10).join(', ');
|
|
825
|
+
const line2 = list.slice(10, 20).join(', ');
|
|
826
|
+
const line3 = list.slice(20).join(', ');
|
|
827
|
+
console.log(`
|
|
828
|
+
Components — full list and what relies on what
|
|
829
|
+
|
|
830
|
+
Available to pick (Astro & Svelte; same list):
|
|
831
|
+
` + line1 + (line2 ? ',\n ' + line2 : '') + (line3 ? ',\n ' + line3 : '') + `
|
|
832
|
+
|
|
833
|
+
Dependencies (when you pick the component on the left, the right is added automatically):
|
|
834
|
+
Settings → ThemeSwitcher (and themes.ts)
|
|
835
|
+
Toast → Alert
|
|
836
|
+
|
|
837
|
+
ThemeSwitcher and ThemeIcon: when selected, themes.ts (and Svelte theme.ts) is copied so they work.
|
|
838
|
+
Icons: copied whenever you add any component.
|
|
839
|
+
|
|
840
|
+
Full = all components above; dependencies are included so everything works.
|
|
841
|
+
Minimal = recommended set; any component in that set that requires others gets them.
|
|
842
|
+
Manual = you pick; the picker shows e.g. "Settings (adds ThemeSwitcher)". Required deps are added when you confirm.
|
|
843
|
+
|
|
844
|
+
To see this again: npx rizzo-css help components
|
|
845
|
+
`);
|
|
846
|
+
}
|
|
847
|
+
|
|
708
848
|
function cmdTheme() {
|
|
709
849
|
process.stdout.write('\nDark themes (set data-theme on <html>):\n');
|
|
710
850
|
DARK_THEMES.forEach((t) => process.stdout.write(' ' + t + '\n'));
|
|
@@ -735,6 +875,11 @@ async function promptThemes() {
|
|
|
735
875
|
return { theme, defaultDark: DARK_THEMES.includes(defaultDark) ? defaultDark : DARK_THEMES[0], defaultLight: LIGHT_THEMES.includes(defaultLight) ? defaultLight : LIGHT_THEMES[0] };
|
|
736
876
|
}
|
|
737
877
|
|
|
878
|
+
function componentOptionLabel(framework, name) {
|
|
879
|
+
const suffix = getComponentDependencyLabel(framework, name);
|
|
880
|
+
return name + suffix;
|
|
881
|
+
}
|
|
882
|
+
|
|
738
883
|
/** 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
884
|
async function promptComponentChoice(componentList, framework, initialSelection) {
|
|
740
885
|
const recommended = RECOMMENDED_COMPONENTS.filter((c) => componentList.includes(c));
|
|
@@ -743,7 +888,7 @@ async function promptComponentChoice(componentList, framework, initialSelection)
|
|
|
743
888
|
[
|
|
744
889
|
{ value: SENTINEL_ALL, label: 'Select all components' },
|
|
745
890
|
{ value: SENTINEL_NONE, label: 'Select no components' },
|
|
746
|
-
...componentList.map((c) => ({ value: c, label: c })),
|
|
891
|
+
...componentList.map((c) => ({ value: c, label: componentOptionLabel(framework, c) })),
|
|
747
892
|
],
|
|
748
893
|
'? Components (minimal set pre-selected) — Space to toggle, Enter to confirm',
|
|
749
894
|
initialSelection
|
|
@@ -765,9 +910,9 @@ async function promptComponentChoice(componentList, framework, initialSelection)
|
|
|
765
910
|
[
|
|
766
911
|
{ value: SENTINEL_ALL, label: 'Select all components' },
|
|
767
912
|
{ value: SENTINEL_NONE, label: 'Select no components' },
|
|
768
|
-
...componentList.map((c) => ({ value: c, label: c })),
|
|
913
|
+
...componentList.map((c) => ({ value: c, label: componentOptionLabel(framework, c) })),
|
|
769
914
|
],
|
|
770
|
-
'? Components — Space to toggle, Enter to confirm'
|
|
915
|
+
'? Components — Space to toggle, Enter to confirm. Items like "Settings (adds ThemeSwitcher)" add those deps automatically. List: npx rizzo-css help components'
|
|
771
916
|
);
|
|
772
917
|
}
|
|
773
918
|
|
|
@@ -1021,7 +1166,7 @@ function copySvelteComponents(projectDir, selectedNames) {
|
|
|
1021
1166
|
if (existsSync(iconsSrc) && (toCopy.length > 0 || copyIconsOnly)) {
|
|
1022
1167
|
copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
|
|
1023
1168
|
}
|
|
1024
|
-
if (toCopy.includes('ThemeSwitcher')) {
|
|
1169
|
+
if (toCopy.includes('ThemeSwitcher') || toCopy.includes('ThemeIcon')) {
|
|
1025
1170
|
const themesSrc = join(scaffoldDir, 'themes.ts');
|
|
1026
1171
|
const themeSrc = join(scaffoldDir, 'theme.ts');
|
|
1027
1172
|
if (existsSync(themesSrc)) copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
@@ -1066,7 +1211,7 @@ function copyAstroComponents(projectDir, selectedNames) {
|
|
|
1066
1211
|
if (existsSync(iconsSrc) && (toCopy.length > 0 || copyIconsOnly)) {
|
|
1067
1212
|
copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
|
|
1068
1213
|
}
|
|
1069
|
-
if (toCopy.includes('ThemeSwitcher')) {
|
|
1214
|
+
if (toCopy.includes('ThemeSwitcher') || toCopy.includes('ThemeIcon')) {
|
|
1070
1215
|
const themesSrc = join(scaffoldDir, 'themes.ts');
|
|
1071
1216
|
if (existsSync(themesSrc)) {
|
|
1072
1217
|
copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
@@ -1171,9 +1316,13 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1171
1316
|
|
|
1172
1317
|
copyRizzoIcons(cwd, framework);
|
|
1173
1318
|
if (framework === 'svelte' && selectedComponents.length > 0) {
|
|
1174
|
-
|
|
1319
|
+
const expanded = expandWithDeps('svelte', selectedComponents);
|
|
1320
|
+
logAddedDeps(selectedComponents, expanded, 'svelte');
|
|
1321
|
+
copySvelteComponents(cwd, expanded);
|
|
1175
1322
|
} else if (framework === 'astro' && selectedComponents.length > 0) {
|
|
1176
|
-
|
|
1323
|
+
const expanded = expandWithDeps('astro', selectedComponents);
|
|
1324
|
+
logAddedDeps(selectedComponents, expanded, 'astro');
|
|
1325
|
+
copyAstroComponents(cwd, expanded);
|
|
1177
1326
|
} else if (framework === 'vanilla' && selectedComponents.length > 0) {
|
|
1178
1327
|
const linkHrefForVanilla = (options && options.targetDir) ? getLinkHrefForTargetDir(framework, options.targetDir) : paths.linkHref;
|
|
1179
1328
|
const vanillaRepl = { '{{LINK_HREF}}': linkHrefForVanilla, '{{DATA_THEME}}': theme };
|
|
@@ -1351,6 +1500,13 @@ async function cmdInit(argv) {
|
|
|
1351
1500
|
const useVanillaFull = selectedTemplate === 'full' && framework === 'vanilla' && existsSync(getScaffoldVanillaIndex());
|
|
1352
1501
|
const useVanillaMinimal = selectedTemplate === 'minimal' && framework === 'vanilla';
|
|
1353
1502
|
|
|
1503
|
+
// Full and minimal get all required dependencies so everything works; manual gets deps when user picks (see prompt labels).
|
|
1504
|
+
let componentsToCopy = selectedComponents;
|
|
1505
|
+
if ((framework === 'astro' || framework === 'svelte') && selectedComponents.length > 0) {
|
|
1506
|
+
componentsToCopy = expandWithDeps(framework, selectedComponents);
|
|
1507
|
+
logAddedDeps(selectedComponents, componentsToCopy, framework);
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1354
1510
|
let cssTarget;
|
|
1355
1511
|
let indexPath;
|
|
1356
1512
|
|
|
@@ -1378,9 +1534,9 @@ async function cmdInit(argv) {
|
|
|
1378
1534
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1379
1535
|
}
|
|
1380
1536
|
copyPackageLicense(projectDir);
|
|
1381
|
-
if (
|
|
1537
|
+
if (componentsToCopy.length > 0) {
|
|
1382
1538
|
copyRizzoIcons(projectDir, 'astro');
|
|
1383
|
-
copyAstroComponents(projectDir,
|
|
1539
|
+
copyAstroComponents(projectDir, componentsToCopy);
|
|
1384
1540
|
}
|
|
1385
1541
|
} else if (useAstroBase) {
|
|
1386
1542
|
mkdirSync(projectDir, { recursive: true });
|
|
@@ -1391,9 +1547,9 @@ async function cmdInit(argv) {
|
|
|
1391
1547
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1392
1548
|
}
|
|
1393
1549
|
copyPackageLicense(projectDir);
|
|
1394
|
-
if (
|
|
1550
|
+
if (componentsToCopy.length > 0) {
|
|
1395
1551
|
copyRizzoIcons(projectDir, 'astro');
|
|
1396
|
-
copyAstroComponents(projectDir,
|
|
1552
|
+
copyAstroComponents(projectDir, componentsToCopy);
|
|
1397
1553
|
}
|
|
1398
1554
|
} else if (useHandpickSvelte) {
|
|
1399
1555
|
mkdirSync(projectDir, { recursive: true });
|
|
@@ -1404,9 +1560,9 @@ async function cmdInit(argv) {
|
|
|
1404
1560
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1405
1561
|
}
|
|
1406
1562
|
copyPackageLicense(projectDir);
|
|
1407
|
-
if (
|
|
1563
|
+
if (componentsToCopy.length > 0) {
|
|
1408
1564
|
copyRizzoIcons(projectDir, 'svelte');
|
|
1409
|
-
copySvelteComponents(projectDir,
|
|
1565
|
+
copySvelteComponents(projectDir, componentsToCopy);
|
|
1410
1566
|
}
|
|
1411
1567
|
} else if (useSvelteBase) {
|
|
1412
1568
|
mkdirSync(projectDir, { recursive: true });
|
|
@@ -1417,9 +1573,9 @@ async function cmdInit(argv) {
|
|
|
1417
1573
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1418
1574
|
}
|
|
1419
1575
|
copyPackageLicense(projectDir);
|
|
1420
|
-
if (
|
|
1576
|
+
if (componentsToCopy.length > 0) {
|
|
1421
1577
|
copyRizzoIcons(projectDir, 'svelte');
|
|
1422
|
-
copySvelteComponents(projectDir,
|
|
1578
|
+
copySvelteComponents(projectDir, componentsToCopy);
|
|
1423
1579
|
}
|
|
1424
1580
|
} else if (useVanillaFull) {
|
|
1425
1581
|
const cssDir = join(projectDir, pathsForScaffold.targetDir);
|
|
@@ -1589,6 +1745,10 @@ function main() {
|
|
|
1589
1745
|
const command = (argv[0] || 'help').toLowerCase().replace(/^--?/, '');
|
|
1590
1746
|
|
|
1591
1747
|
if (command === 'help' || command === 'h' || !COMMANDS.includes(command)) {
|
|
1748
|
+
if (argv[1] === 'components') {
|
|
1749
|
+
printHelpComponents();
|
|
1750
|
+
return;
|
|
1751
|
+
}
|
|
1592
1752
|
if (argv[0] && !COMMANDS.includes(command) && command !== 'h') {
|
|
1593
1753
|
console.error('Unknown command: ' + argv[0] + '\n');
|
|
1594
1754
|
}
|
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>
|